aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.HLE/HOS/Tamper
diff options
context:
space:
mode:
authorTSRBerry <20988865+TSRBerry@users.noreply.github.com>2023-07-16 19:31:14 +0200
committerGitHub <noreply@github.com>2023-07-16 19:31:14 +0200
commit326749498bed4360e5a4b11fc67d5ec7cb9a3076 (patch)
treeae21fb26f99b401ca4e9efaab72b679a81c22369 /src/Ryujinx.HLE/HOS/Tamper
parentfec8291c17fa106c28f58b56419e90d49a41a1ea (diff)
[Ryujinx.HLE] Address dotnet-format issues (#5380)
* dotnet format style --severity info Some changes were manually reverted. * dotnet format analyzers --serverity info Some changes have been minimally adapted. * Restore a few unused methods and variables * Silence dotnet format IDE0060 warnings * Silence dotnet format IDE0052 warnings * Address or silence dotnet format IDE1006 warnings * Address dotnet format CA1816 warnings * Address or silence dotnet format CA2208 warnings * Address or silence dotnet format CA1806 and a few CA1854 warnings * Address dotnet format CA2211 warnings * Address dotnet format CA1822 warnings * Address or silence dotnet format CA1069 warnings * Make dotnet format succeed in style mode * Address or silence dotnet format CA2211 warnings * Address review comments * Address dotnet format CA2208 warnings properly * Make ProcessResult readonly * Address most dotnet format whitespace warnings * Apply dotnet format whitespace formatting A few of them have been manually reverted and the corresponding warning was silenced * Add previously silenced warnings back I have no clue how these disappeared * Revert formatting changes for while and for-loops * Format if-blocks correctly * Run dotnet format style after rebase * Run dotnet format whitespace after rebase * Run dotnet format style after rebase * Run dotnet format analyzers after rebase * Run dotnet format after rebase and remove unused usings - analyzers - style - whitespace * Disable 'prefer switch expression' rule * Add comments to disabled warnings * Fix a few disabled warnings * Fix naming rule violation, Convert shader properties to auto-property and convert values to const * Simplify properties and array initialization, Use const when possible, Remove trailing commas * Start working on disabled warnings * Fix and silence a few dotnet-format warnings again * Run dotnet format after rebase * Use using declaration instead of block syntax * Address IDE0251 warnings * Address a few disabled IDE0060 warnings * Silence IDE0060 in .editorconfig * Revert "Simplify properties and array initialization, Use const when possible, Remove trailing commas" This reverts commit 9462e4136c0a2100dc28b20cf9542e06790aa67e. * dotnet format whitespace after rebase * First dotnet format pass * Fix naming rule violations * Fix typo * Add trailing commas, use targeted new and use array initializer * Fix build issues * Fix remaining build issues * Remove SuppressMessage for CA1069 where possible * Address dotnet format issues * Address formatting issues Co-authored-by: Ac_K <acoustik666@gmail.com> * Add GetHashCode implementation for RenderingSurfaceInfo * Explicitly silence CA1822 for every affected method in Syscall * Address formatting issues in Demangler.cs * Address review feedback Co-authored-by: Ac_K <acoustik666@gmail.com> * Revert marking service methods as static * Next dotnet format pass * Address review feedback --------- Co-authored-by: Ac_K <acoustik666@gmail.com>
Diffstat (limited to 'src/Ryujinx.HLE/HOS/Tamper')
-rw-r--r--src/Ryujinx.HLE/HOS/Tamper/AtmosphereCompiler.cs37
-rw-r--r--src/Ryujinx.HLE/HOS/Tamper/AtmosphereProgram.cs4
-rw-r--r--src/Ryujinx.HLE/HOS/Tamper/CodeEmitters/Arithmetic.cs50
-rw-r--r--src/Ryujinx.HLE/HOS/Tamper/CodeEmitters/EndConditionalBlock.cs6
-rw-r--r--src/Ryujinx.HLE/HOS/Tamper/CodeEmitters/LegacyArithmetic.cs24
-rw-r--r--src/Ryujinx.HLE/HOS/Tamper/CodeEmitters/LoadRegisterWithConstant.cs2
-rw-r--r--src/Ryujinx.HLE/HOS/Tamper/CodeEmitters/MemoryConditional.cs2
-rw-r--r--src/Ryujinx.HLE/HOS/Tamper/CodeEmitters/ResumeProcess.cs1
-rw-r--r--src/Ryujinx.HLE/HOS/Tamper/CodeEmitters/StartEndLoop.cs2
-rw-r--r--src/Ryujinx.HLE/HOS/Tamper/CodeEmitters/StoreConstantToAddress.cs2
-rw-r--r--src/Ryujinx.HLE/HOS/Tamper/CodeEmitters/StoreConstantToMemory.cs2
-rw-r--r--src/Ryujinx.HLE/HOS/Tamper/CodeType.cs2
-rw-r--r--src/Ryujinx.HLE/HOS/Tamper/Comparison.cs2
-rw-r--r--src/Ryujinx.HLE/HOS/Tamper/CompilationContext.cs18
-rw-r--r--src/Ryujinx.HLE/HOS/Tamper/Conditions/CondEQ.cs4
-rw-r--r--src/Ryujinx.HLE/HOS/Tamper/Conditions/CondGE.cs4
-rw-r--r--src/Ryujinx.HLE/HOS/Tamper/Conditions/CondGT.cs4
-rw-r--r--src/Ryujinx.HLE/HOS/Tamper/Conditions/CondLE.cs4
-rw-r--r--src/Ryujinx.HLE/HOS/Tamper/Conditions/CondLT.cs4
-rw-r--r--src/Ryujinx.HLE/HOS/Tamper/Conditions/CondNE.cs4
-rw-r--r--src/Ryujinx.HLE/HOS/Tamper/Conditions/InputMask.cs4
-rw-r--r--src/Ryujinx.HLE/HOS/Tamper/InstructionHelper.cs37
-rw-r--r--src/Ryujinx.HLE/HOS/Tamper/MemoryHelper.cs41
-rw-r--r--src/Ryujinx.HLE/HOS/Tamper/Operations/Block.cs2
-rw-r--r--src/Ryujinx.HLE/HOS/Tamper/Operations/ForBlock.cs6
-rw-r--r--src/Ryujinx.HLE/HOS/Tamper/Operations/IfBlock.cs6
-rw-r--r--src/Ryujinx.HLE/HOS/Tamper/Operations/OpAdd.cs6
-rw-r--r--src/Ryujinx.HLE/HOS/Tamper/Operations/OpAnd.cs6
-rw-r--r--src/Ryujinx.HLE/HOS/Tamper/Operations/OpLog.cs4
-rw-r--r--src/Ryujinx.HLE/HOS/Tamper/Operations/OpLsh.cs6
-rw-r--r--src/Ryujinx.HLE/HOS/Tamper/Operations/OpMov.cs4
-rw-r--r--src/Ryujinx.HLE/HOS/Tamper/Operations/OpMul.cs6
-rw-r--r--src/Ryujinx.HLE/HOS/Tamper/Operations/OpNot.cs4
-rw-r--r--src/Ryujinx.HLE/HOS/Tamper/Operations/OpOr.cs6
-rw-r--r--src/Ryujinx.HLE/HOS/Tamper/Operations/OpProcCtrl.cs4
-rw-r--r--src/Ryujinx.HLE/HOS/Tamper/Operations/OpRsh.cs6
-rw-r--r--src/Ryujinx.HLE/HOS/Tamper/Operations/OpSub.cs6
-rw-r--r--src/Ryujinx.HLE/HOS/Tamper/Operations/OpXor.cs6
-rw-r--r--src/Ryujinx.HLE/HOS/Tamper/Pointer.cs4
-rw-r--r--src/Ryujinx.HLE/HOS/Tamper/Register.cs2
-rw-r--r--src/Ryujinx.HLE/HOS/Tamper/TamperedKProcess.cs4
-rw-r--r--src/Ryujinx.HLE/HOS/Tamper/Value.cs8
42 files changed, 188 insertions, 168 deletions
diff --git a/src/Ryujinx.HLE/HOS/Tamper/AtmosphereCompiler.cs b/src/Ryujinx.HLE/HOS/Tamper/AtmosphereCompiler.cs
index 7d7af208..e25ba7a5 100644
--- a/src/Ryujinx.HLE/HOS/Tamper/AtmosphereCompiler.cs
+++ b/src/Ryujinx.HLE/HOS/Tamper/AtmosphereCompiler.cs
@@ -9,29 +9,28 @@ namespace Ryujinx.HLE.HOS.Tamper
{
class AtmosphereCompiler
{
- private ulong _exeAddress;
- private ulong _heapAddress;
- private ulong _aliasAddress;
- private ulong _aslrAddress;
- private ITamperedProcess _process;
+ private readonly ulong _exeAddress;
+ private readonly ulong _heapAddress;
+ private readonly ulong _aliasAddress;
+ private readonly ulong _aslrAddress;
+ private readonly ITamperedProcess _process;
public AtmosphereCompiler(ulong exeAddress, ulong heapAddress, ulong aliasAddress, ulong aslrAddress, ITamperedProcess process)
{
- _exeAddress = exeAddress;
- _heapAddress = heapAddress;
+ _exeAddress = exeAddress;
+ _heapAddress = heapAddress;
_aliasAddress = aliasAddress;
- _aslrAddress = aslrAddress;
- _process = process;
+ _aslrAddress = aslrAddress;
+ _process = process;
}
public ITamperProgram Compile(string name, IEnumerable<string> rawInstructions)
{
- string[] addresses = new string[]
- {
+ string[] addresses = {
$" Executable address: 0x{_exeAddress:X16}",
$" Heap address : 0x{_heapAddress:X16}",
$" Alias address : 0x{_aliasAddress:X16}",
- $" Aslr address : 0x{_aslrAddress:X16}"
+ $" Aslr address : 0x{_aslrAddress:X16}",
};
Logger.Debug?.Print(LogClass.TamperMachine, $"Compiling Atmosphere cheat {name}...\n{string.Join('\n', addresses)}");
@@ -40,14 +39,14 @@ namespace Ryujinx.HLE.HOS.Tamper
{
return CompileImpl(name, rawInstructions);
}
- catch(TamperCompilationException exception)
+ catch (TamperCompilationException ex)
{
// Just print the message without the stack trace.
- Logger.Error?.Print(LogClass.TamperMachine, exception.Message);
+ Logger.Error?.Print(LogClass.TamperMachine, ex.Message);
}
- catch (Exception exception)
+ catch (Exception ex)
{
- Logger.Error?.Print(LogClass.TamperMachine, exception.ToString());
+ Logger.Error?.Print(LogClass.TamperMachine, ex.ToString());
}
Logger.Error?.Print(LogClass.TamperMachine, "There was a problem while compiling the Atmosphere cheat");
@@ -57,7 +56,7 @@ namespace Ryujinx.HLE.HOS.Tamper
private ITamperProgram CompileImpl(string name, IEnumerable<string> rawInstructions)
{
- CompilationContext context = new CompilationContext(_exeAddress, _heapAddress, _aliasAddress, _aslrAddress, _process);
+ CompilationContext context = new(_exeAddress, _heapAddress, _aliasAddress, _aslrAddress, _process);
context.BlockStack.Push(new OperationBlock(null));
// Parse the instructions.
@@ -132,7 +131,7 @@ namespace Ryujinx.HLE.HOS.Tamper
// Initialize only the registers used.
- Value<ulong> zero = new Value<ulong>(0UL);
+ Value<ulong> zero = new(0UL);
int position = 0;
foreach (Register register in context.Registers.Values)
@@ -143,7 +142,7 @@ namespace Ryujinx.HLE.HOS.Tamper
if (context.BlockStack.Count != 1)
{
- throw new TamperCompilationException($"Reached end of compilation with unmatched conditional(s) or loop(s)");
+ throw new TamperCompilationException("Reached end of compilation with unmatched conditional(s) or loop(s)");
}
return new AtmosphereProgram(name, _process, context.PressedKeys, new Block(context.CurrentOperations));
diff --git a/src/Ryujinx.HLE/HOS/Tamper/AtmosphereProgram.cs b/src/Ryujinx.HLE/HOS/Tamper/AtmosphereProgram.cs
index a2aa73a4..8171d217 100644
--- a/src/Ryujinx.HLE/HOS/Tamper/AtmosphereProgram.cs
+++ b/src/Ryujinx.HLE/HOS/Tamper/AtmosphereProgram.cs
@@ -5,8 +5,8 @@ namespace Ryujinx.HLE.HOS.Tamper
{
class AtmosphereProgram : ITamperProgram
{
- private Parameter<long> _pressedKeys;
- private IOperation _entryPoint;
+ private readonly Parameter<long> _pressedKeys;
+ private readonly IOperation _entryPoint;
public string Name { get; }
public bool TampersCodeMemory { get; set; } = false;
diff --git a/src/Ryujinx.HLE/HOS/Tamper/CodeEmitters/Arithmetic.cs b/src/Ryujinx.HLE/HOS/Tamper/CodeEmitters/Arithmetic.cs
index b7d46d3a..c51630d6 100644
--- a/src/Ryujinx.HLE/HOS/Tamper/CodeEmitters/Arithmetic.cs
+++ b/src/Ryujinx.HLE/HOS/Tamper/CodeEmitters/Arithmetic.cs
@@ -27,7 +27,7 @@ namespace Ryujinx.HLE.HOS.Tamper.CodeEmitters
private const byte Lsh = 3; // lhs << rhs
private const byte Rsh = 4; // lhs >> rhs
private const byte And = 5; // lhs & rhs
- private const byte Or = 6; // lhs | rhs
+ private const byte Or = 6; // lhs | rhs
private const byte Not = 7; // ~lhs (discards right-hand operand)
private const byte Xor = 8; // lhs ^ rhs
private const byte Mov = 9; // lhs (discards right-hand operand)
@@ -73,9 +73,11 @@ namespace Ryujinx.HLE.HOS.Tamper.CodeEmitters
void Emit(Type operationType, IOperand rhs = null)
{
- List<IOperand> operandList = new List<IOperand>();
- operandList.Add(destinationRegister);
- operandList.Add(leftHandSideRegister);
+ List<IOperand> operandList = new()
+ {
+ destinationRegister,
+ leftHandSideRegister,
+ };
if (rhs != null)
{
@@ -87,16 +89,36 @@ namespace Ryujinx.HLE.HOS.Tamper.CodeEmitters
switch (operation)
{
- case Add: Emit(typeof(OpAdd<>), rightHandSideOperand); break;
- case Sub: Emit(typeof(OpSub<>), rightHandSideOperand); break;
- case Mul: Emit(typeof(OpMul<>), rightHandSideOperand); break;
- case Lsh: Emit(typeof(OpLsh<>), rightHandSideOperand); break;
- case Rsh: Emit(typeof(OpRsh<>), rightHandSideOperand); break;
- case And: Emit(typeof(OpAnd<>), rightHandSideOperand); break;
- case Or: Emit(typeof(OpOr<> ), rightHandSideOperand); break;
- case Not: Emit(typeof(OpNot<>) ); break;
- case Xor: Emit(typeof(OpXor<>), rightHandSideOperand); break;
- case Mov: Emit(typeof(OpMov<>) ); break;
+ case Add:
+ Emit(typeof(OpAdd<>), rightHandSideOperand);
+ break;
+ case Sub:
+ Emit(typeof(OpSub<>), rightHandSideOperand);
+ break;
+ case Mul:
+ Emit(typeof(OpMul<>), rightHandSideOperand);
+ break;
+ case Lsh:
+ Emit(typeof(OpLsh<>), rightHandSideOperand);
+ break;
+ case Rsh:
+ Emit(typeof(OpRsh<>), rightHandSideOperand);
+ break;
+ case And:
+ Emit(typeof(OpAnd<>), rightHandSideOperand);
+ break;
+ case Or:
+ Emit(typeof(OpOr<>), rightHandSideOperand);
+ break;
+ case Not:
+ Emit(typeof(OpNot<>));
+ break;
+ case Xor:
+ Emit(typeof(OpXor<>), rightHandSideOperand);
+ break;
+ case Mov:
+ Emit(typeof(OpMov<>));
+ break;
default:
throw new TamperCompilationException($"Invalid arithmetic operation {operation} in Atmosphere cheat");
}
diff --git a/src/Ryujinx.HLE/HOS/Tamper/CodeEmitters/EndConditionalBlock.cs b/src/Ryujinx.HLE/HOS/Tamper/CodeEmitters/EndConditionalBlock.cs
index a25dddde..63625a55 100644
--- a/src/Ryujinx.HLE/HOS/Tamper/CodeEmitters/EndConditionalBlock.cs
+++ b/src/Ryujinx.HLE/HOS/Tamper/CodeEmitters/EndConditionalBlock.cs
@@ -12,7 +12,7 @@ namespace Ryujinx.HLE.HOS.Tamper.CodeEmitters
{
const int TerminationTypeIndex = 1;
- private const byte End = 0; // True end of the conditional.
+ private const byte End = 0; // True end of the conditional.
private const byte Else = 1; // End of the 'then' block and beginning of 'else' block.
public static void Emit(byte[] instruction, CompilationContext context)
@@ -51,7 +51,7 @@ namespace Ryujinx.HLE.HOS.Tamper.CodeEmitters
// If the else operations are already set, then the upper block must not be another end.
if (operationsElse != null && codeType == CodeType.EndConditionalBlock)
{
- throw new TamperCompilationException($"Expected an upper 'if' conditional instead of 'end conditional'");
+ throw new TamperCompilationException("Expected an upper 'if' conditional instead of 'end conditional'");
}
ICondition condition;
@@ -84,7 +84,7 @@ namespace Ryujinx.HLE.HOS.Tamper.CodeEmitters
// Create a conditional block with the current operations and nest it in the upper
// block of the stack.
- IfBlock block = new IfBlock(condition, operations, operationsElse);
+ IfBlock block = new(condition, operations, operationsElse);
context.CurrentOperations.Add(block);
}
}
diff --git a/src/Ryujinx.HLE/HOS/Tamper/CodeEmitters/LegacyArithmetic.cs b/src/Ryujinx.HLE/HOS/Tamper/CodeEmitters/LegacyArithmetic.cs
index 479c80ec..1c389cd7 100644
--- a/src/Ryujinx.HLE/HOS/Tamper/CodeEmitters/LegacyArithmetic.cs
+++ b/src/Ryujinx.HLE/HOS/Tamper/CodeEmitters/LegacyArithmetic.cs
@@ -10,7 +10,7 @@ namespace Ryujinx.HLE.HOS.Tamper.CodeEmitters
/// </summary>
class LegacyArithmetic
{
- const int OperationWidthIndex = 1;
+ const int OperationWidthIndex = 1;
const int DestinationRegisterIndex = 3;
const int OperationTypeIndex = 4;
const int ValueImmediateIndex = 8;
@@ -35,7 +35,7 @@ namespace Ryujinx.HLE.HOS.Tamper.CodeEmitters
Register register = context.GetRegister(instruction[DestinationRegisterIndex]);
byte operation = instruction[OperationTypeIndex];
ulong immediate = InstructionHelper.GetImmediate(instruction, ValueImmediateIndex, ValueImmediateSize);
- Value<ulong> rightHandSideValue = new Value<ulong>(immediate);
+ Value<ulong> rightHandSideValue = new(immediate);
void Emit(Type operationType)
{
@@ -44,11 +44,21 @@ namespace Ryujinx.HLE.HOS.Tamper.CodeEmitters
switch (operation)
{
- case Add: Emit(typeof(OpAdd<>)); break;
- case Sub: Emit(typeof(OpSub<>)); break;
- case Mul: Emit(typeof(OpMul<>)); break;
- case Lsh: Emit(typeof(OpLsh<>)); break;
- case Rsh: Emit(typeof(OpRsh<>)); break;
+ case Add:
+ Emit(typeof(OpAdd<>));
+ break;
+ case Sub:
+ Emit(typeof(OpSub<>));
+ break;
+ case Mul:
+ Emit(typeof(OpMul<>));
+ break;
+ case Lsh:
+ Emit(typeof(OpLsh<>));
+ break;
+ case Rsh:
+ Emit(typeof(OpRsh<>));
+ break;
default:
throw new TamperCompilationException($"Invalid arithmetic operation {operation} in Atmosphere cheat");
}
diff --git a/src/Ryujinx.HLE/HOS/Tamper/CodeEmitters/LoadRegisterWithConstant.cs b/src/Ryujinx.HLE/HOS/Tamper/CodeEmitters/LoadRegisterWithConstant.cs
index e4a86d7b..16500cf9 100644
--- a/src/Ryujinx.HLE/HOS/Tamper/CodeEmitters/LoadRegisterWithConstant.cs
+++ b/src/Ryujinx.HLE/HOS/Tamper/CodeEmitters/LoadRegisterWithConstant.cs
@@ -20,7 +20,7 @@ namespace Ryujinx.HLE.HOS.Tamper.CodeEmitters
Register destinationRegister = context.GetRegister(instruction[RegisterIndex]);
ulong immediate = InstructionHelper.GetImmediate(instruction, ValueImmediateIndex, ValueImmediateSize);
- Value<ulong> sourceValue = new Value<ulong>(immediate);
+ Value<ulong> sourceValue = new(immediate);
context.CurrentOperations.Add(new OpMov<ulong>(destinationRegister, sourceValue));
}
diff --git a/src/Ryujinx.HLE/HOS/Tamper/CodeEmitters/MemoryConditional.cs b/src/Ryujinx.HLE/HOS/Tamper/CodeEmitters/MemoryConditional.cs
index 2048a67b..272cf3d0 100644
--- a/src/Ryujinx.HLE/HOS/Tamper/CodeEmitters/MemoryConditional.cs
+++ b/src/Ryujinx.HLE/HOS/Tamper/CodeEmitters/MemoryConditional.cs
@@ -37,7 +37,7 @@ namespace Ryujinx.HLE.HOS.Tamper.CodeEmitters
int valueSize = operationWidth <= 4 ? ValueImmediateSize4 : ValueImmediateSize8;
ulong value = InstructionHelper.GetImmediate(instruction, ValueImmediateIndex, valueSize);
- Value<ulong> compareToValue = new Value<ulong>(value);
+ Value<ulong> compareToValue = new(value);
return InstructionHelper.CreateCondition(comparison, operationWidth, sourceMemory, compareToValue);
}
diff --git a/src/Ryujinx.HLE/HOS/Tamper/CodeEmitters/ResumeProcess.cs b/src/Ryujinx.HLE/HOS/Tamper/CodeEmitters/ResumeProcess.cs
index 02f76e22..7af327d3 100644
--- a/src/Ryujinx.HLE/HOS/Tamper/CodeEmitters/ResumeProcess.cs
+++ b/src/Ryujinx.HLE/HOS/Tamper/CodeEmitters/ResumeProcess.cs
@@ -8,7 +8,6 @@ namespace Ryujinx.HLE.HOS.Tamper.CodeEmitters
class ResumeProcess
{
// FF1?????
-
public static void Emit(byte[] instruction, CompilationContext context)
{
context.CurrentOperations.Add(new OpProcCtrl(context.Process, false));
diff --git a/src/Ryujinx.HLE/HOS/Tamper/CodeEmitters/StartEndLoop.cs b/src/Ryujinx.HLE/HOS/Tamper/CodeEmitters/StartEndLoop.cs
index 1e399b59..51fc8f35 100644
--- a/src/Ryujinx.HLE/HOS/Tamper/CodeEmitters/StartEndLoop.cs
+++ b/src/Ryujinx.HLE/HOS/Tamper/CodeEmitters/StartEndLoop.cs
@@ -64,7 +64,7 @@ namespace Ryujinx.HLE.HOS.Tamper.CodeEmitters
// Create a loop block with the current operations and nest it in the upper
// block of the stack.
- ForBlock block = new ForBlock(immediate, iterationRegister, context.CurrentOperations);
+ ForBlock block = new(immediate, iterationRegister, context.CurrentOperations);
context.BlockStack.Pop();
context.CurrentOperations.Add(block);
}
diff --git a/src/Ryujinx.HLE/HOS/Tamper/CodeEmitters/StoreConstantToAddress.cs b/src/Ryujinx.HLE/HOS/Tamper/CodeEmitters/StoreConstantToAddress.cs
index 933646bd..a2a62015 100644
--- a/src/Ryujinx.HLE/HOS/Tamper/CodeEmitters/StoreConstantToAddress.cs
+++ b/src/Ryujinx.HLE/HOS/Tamper/CodeEmitters/StoreConstantToAddress.cs
@@ -33,7 +33,7 @@
int valueImmediateSize = operationWidth <= 4 ? ValueImmediateSize8 : ValueImmediateSize16;
ulong valueImmediate = InstructionHelper.GetImmediate(instruction, ValueImmediateIndex, valueImmediateSize);
- Value<ulong> storeValue = new Value<ulong>(valueImmediate);
+ Value<ulong> storeValue = new(valueImmediate);
InstructionHelper.EmitMov(operationWidth, context, dstMem, storeValue);
}
diff --git a/src/Ryujinx.HLE/HOS/Tamper/CodeEmitters/StoreConstantToMemory.cs b/src/Ryujinx.HLE/HOS/Tamper/CodeEmitters/StoreConstantToMemory.cs
index 5f036969..d53b7a26 100644
--- a/src/Ryujinx.HLE/HOS/Tamper/CodeEmitters/StoreConstantToMemory.cs
+++ b/src/Ryujinx.HLE/HOS/Tamper/CodeEmitters/StoreConstantToMemory.cs
@@ -32,7 +32,7 @@ namespace Ryujinx.HLE.HOS.Tamper.CodeEmitters
byte incrementAddressRegister = instruction[IncrementAddressRegisterIndex];
byte useOffsetRegister = instruction[UseOffsetRegisterIndex];
ulong immediate = InstructionHelper.GetImmediate(instruction, ValueImmediateIndex, ValueImmediateSize);
- Value<ulong> storeValue = new Value<ulong>(immediate);
+ Value<ulong> storeValue = new(immediate);
Pointer destinationMemory;
diff --git a/src/Ryujinx.HLE/HOS/Tamper/CodeType.cs b/src/Ryujinx.HLE/HOS/Tamper/CodeType.cs
index 7c4f2286..d65f8a2f 100644
--- a/src/Ryujinx.HLE/HOS/Tamper/CodeType.cs
+++ b/src/Ryujinx.HLE/HOS/Tamper/CodeType.cs
@@ -105,6 +105,6 @@
/// <summary>
/// Code type 0xFFF writes a debug log.
/// </summary>
- DebugLog = 0xFFF
+ DebugLog = 0xFFF,
}
}
diff --git a/src/Ryujinx.HLE/HOS/Tamper/Comparison.cs b/src/Ryujinx.HLE/HOS/Tamper/Comparison.cs
index cd162b1c..dc0f0264 100644
--- a/src/Ryujinx.HLE/HOS/Tamper/Comparison.cs
+++ b/src/Ryujinx.HLE/HOS/Tamper/Comparison.cs
@@ -10,6 +10,6 @@
Less = 3,
LessOrEqual = 4,
Equal = 5,
- NotEqual = 6
+ NotEqual = 6,
}
}
diff --git a/src/Ryujinx.HLE/HOS/Tamper/CompilationContext.cs b/src/Ryujinx.HLE/HOS/Tamper/CompilationContext.cs
index 45a47f44..922e568a 100644
--- a/src/Ryujinx.HLE/HOS/Tamper/CompilationContext.cs
+++ b/src/Ryujinx.HLE/HOS/Tamper/CompilationContext.cs
@@ -21,16 +21,16 @@ namespace Ryujinx.HLE.HOS.Tamper
public CompilationContext(ulong exeAddress, ulong heapAddress, ulong aliasAddress, ulong aslrAddress, ITamperedProcess process)
{
- Process = process;
- PressedKeys = new Parameter<long>(0);
- BlockStack = new Stack<OperationBlock>();
- Registers = new Dictionary<byte, Register>();
- SavedRegisters = new Dictionary<byte, Register>();
+ Process = process;
+ PressedKeys = new Parameter<long>(0);
+ BlockStack = new Stack<OperationBlock>();
+ Registers = new Dictionary<byte, Register>();
+ SavedRegisters = new Dictionary<byte, Register>();
StaticRegisters = new Dictionary<byte, Register>();
- ExeAddress = exeAddress;
- HeapAddress = heapAddress;
- AliasAddress = aliasAddress;
- AslrAddress = aslrAddress;
+ ExeAddress = exeAddress;
+ HeapAddress = heapAddress;
+ AliasAddress = aliasAddress;
+ AslrAddress = aslrAddress;
}
public Register GetRegister(byte index)
diff --git a/src/Ryujinx.HLE/HOS/Tamper/Conditions/CondEQ.cs b/src/Ryujinx.HLE/HOS/Tamper/Conditions/CondEQ.cs
index ad5bd223..529ed25b 100644
--- a/src/Ryujinx.HLE/HOS/Tamper/Conditions/CondEQ.cs
+++ b/src/Ryujinx.HLE/HOS/Tamper/Conditions/CondEQ.cs
@@ -4,8 +4,8 @@ namespace Ryujinx.HLE.HOS.Tamper.Conditions
{
class CondEQ<T> : ICondition where T : unmanaged
{
- private IOperand _lhs;
- private IOperand _rhs;
+ private readonly IOperand _lhs;
+ private readonly IOperand _rhs;
public CondEQ(IOperand lhs, IOperand rhs)
{
diff --git a/src/Ryujinx.HLE/HOS/Tamper/Conditions/CondGE.cs b/src/Ryujinx.HLE/HOS/Tamper/Conditions/CondGE.cs
index d9ad6d81..94877c2a 100644
--- a/src/Ryujinx.HLE/HOS/Tamper/Conditions/CondGE.cs
+++ b/src/Ryujinx.HLE/HOS/Tamper/Conditions/CondGE.cs
@@ -4,8 +4,8 @@ namespace Ryujinx.HLE.HOS.Tamper.Conditions
{
class CondGE<T> : ICondition where T : unmanaged
{
- private IOperand _lhs;
- private IOperand _rhs;
+ private readonly IOperand _lhs;
+ private readonly IOperand _rhs;
public CondGE(IOperand lhs, IOperand rhs)
{
diff --git a/src/Ryujinx.HLE/HOS/Tamper/Conditions/CondGT.cs b/src/Ryujinx.HLE/HOS/Tamper/Conditions/CondGT.cs
index 262457da..35068816 100644
--- a/src/Ryujinx.HLE/HOS/Tamper/Conditions/CondGT.cs
+++ b/src/Ryujinx.HLE/HOS/Tamper/Conditions/CondGT.cs
@@ -4,8 +4,8 @@ namespace Ryujinx.HLE.HOS.Tamper.Conditions
{
class CondGT<T> : ICondition where T : unmanaged
{
- private IOperand _lhs;
- private IOperand _rhs;
+ private readonly IOperand _lhs;
+ private readonly IOperand _rhs;
public CondGT(IOperand lhs, IOperand rhs)
{
diff --git a/src/Ryujinx.HLE/HOS/Tamper/Conditions/CondLE.cs b/src/Ryujinx.HLE/HOS/Tamper/Conditions/CondLE.cs
index fd488bc1..dd9cf70c 100644
--- a/src/Ryujinx.HLE/HOS/Tamper/Conditions/CondLE.cs
+++ b/src/Ryujinx.HLE/HOS/Tamper/Conditions/CondLE.cs
@@ -4,8 +4,8 @@ namespace Ryujinx.HLE.HOS.Tamper.Conditions
{
class CondLE<T> : ICondition where T : unmanaged
{
- private IOperand _lhs;
- private IOperand _rhs;
+ private readonly IOperand _lhs;
+ private readonly IOperand _rhs;
public CondLE(IOperand lhs, IOperand rhs)
{
diff --git a/src/Ryujinx.HLE/HOS/Tamper/Conditions/CondLT.cs b/src/Ryujinx.HLE/HOS/Tamper/Conditions/CondLT.cs
index 744eb5dc..0c85f5e4 100644
--- a/src/Ryujinx.HLE/HOS/Tamper/Conditions/CondLT.cs
+++ b/src/Ryujinx.HLE/HOS/Tamper/Conditions/CondLT.cs
@@ -4,8 +4,8 @@ namespace Ryujinx.HLE.HOS.Tamper.Conditions
{
class CondLT<T> : ICondition where T : unmanaged
{
- private IOperand _lhs;
- private IOperand _rhs;
+ private readonly IOperand _lhs;
+ private readonly IOperand _rhs;
public CondLT(IOperand lhs, IOperand rhs)
{
diff --git a/src/Ryujinx.HLE/HOS/Tamper/Conditions/CondNE.cs b/src/Ryujinx.HLE/HOS/Tamper/Conditions/CondNE.cs
index 2709ad92..b649ecce 100644
--- a/src/Ryujinx.HLE/HOS/Tamper/Conditions/CondNE.cs
+++ b/src/Ryujinx.HLE/HOS/Tamper/Conditions/CondNE.cs
@@ -4,8 +4,8 @@ namespace Ryujinx.HLE.HOS.Tamper.Conditions
{
class CondNE<T> : ICondition where T : unmanaged
{
- private IOperand _lhs;
- private IOperand _rhs;
+ private readonly IOperand _lhs;
+ private readonly IOperand _rhs;
public CondNE(IOperand lhs, IOperand rhs)
{
diff --git a/src/Ryujinx.HLE/HOS/Tamper/Conditions/InputMask.cs b/src/Ryujinx.HLE/HOS/Tamper/Conditions/InputMask.cs
index 8d75a0e1..6c72eb5c 100644
--- a/src/Ryujinx.HLE/HOS/Tamper/Conditions/InputMask.cs
+++ b/src/Ryujinx.HLE/HOS/Tamper/Conditions/InputMask.cs
@@ -2,8 +2,8 @@ namespace Ryujinx.HLE.HOS.Tamper.Conditions
{
class InputMask : ICondition
{
- private long _mask;
- private Parameter<long> _input;
+ private readonly long _mask;
+ private readonly Parameter<long> _input;
public InputMask(long mask, Parameter<long> input)
{
diff --git a/src/Ryujinx.HLE/HOS/Tamper/InstructionHelper.cs b/src/Ryujinx.HLE/HOS/Tamper/InstructionHelper.cs
index a31c055f..76ffefb6 100644
--- a/src/Ryujinx.HLE/HOS/Tamper/InstructionHelper.cs
+++ b/src/Ryujinx.HLE/HOS/Tamper/InstructionHelper.cs
@@ -32,33 +32,28 @@ namespace Ryujinx.HLE.HOS.Tamper
return (ICondition)InstructionHelper.Create(conditionType, width, lhs, rhs);
}
- switch (comparison)
+ return comparison switch
{
- case Comparison.Greater : return Create(typeof(CondGT<>));
- case Comparison.GreaterOrEqual: return Create(typeof(CondGE<>));
- case Comparison.Less : return Create(typeof(CondLT<>));
- case Comparison.LessOrEqual : return Create(typeof(CondLE<>));
- case Comparison.Equal : return Create(typeof(CondEQ<>));
- case Comparison.NotEqual : return Create(typeof(CondNE<>));
- default:
- throw new TamperCompilationException($"Invalid comparison {comparison} in Atmosphere cheat");
- }
+ Comparison.Greater => Create(typeof(CondGT<>)),
+ Comparison.GreaterOrEqual => Create(typeof(CondGE<>)),
+ Comparison.Less => Create(typeof(CondLT<>)),
+ Comparison.LessOrEqual => Create(typeof(CondLE<>)),
+ Comparison.Equal => Create(typeof(CondEQ<>)),
+ Comparison.NotEqual => Create(typeof(CondNE<>)),
+ _ => throw new TamperCompilationException($"Invalid comparison {comparison} in Atmosphere cheat"),
+ };
}
public static Object Create(Type instruction, byte width, params Object[] operands)
{
- Type realType;
-
- switch (width)
+ Type realType = width switch
{
- case 1: realType = instruction.MakeGenericType(typeof(byte)); break;
- case 2: realType = instruction.MakeGenericType(typeof(ushort)); break;
- case 4: realType = instruction.MakeGenericType(typeof(uint)); break;
- case 8: realType = instruction.MakeGenericType(typeof(ulong)); break;
- default:
- throw new TamperCompilationException($"Invalid instruction width {width} in Atmosphere cheat");
- }
-
+ 1 => instruction.MakeGenericType(typeof(byte)),
+ 2 => instruction.MakeGenericType(typeof(ushort)),
+ 4 => instruction.MakeGenericType(typeof(uint)),
+ 8 => instruction.MakeGenericType(typeof(ulong)),
+ _ => throw new TamperCompilationException($"Invalid instruction width {width} in Atmosphere cheat"),
+ };
return Activator.CreateInstance(realType, operands);
}
diff --git a/src/Ryujinx.HLE/HOS/Tamper/MemoryHelper.cs b/src/Ryujinx.HLE/HOS/Tamper/MemoryHelper.cs
index 1260ed9a..52e12bfe 100644
--- a/src/Ryujinx.HLE/HOS/Tamper/MemoryHelper.cs
+++ b/src/Ryujinx.HLE/HOS/Tamper/MemoryHelper.cs
@@ -7,23 +7,18 @@ namespace Ryujinx.HLE.HOS.Tamper
{
public static ulong GetAddressShift(MemoryRegion source, CompilationContext context)
{
- switch (source)
+ return source switch
{
- case MemoryRegion.NSO:
- // Memory address is relative to the code start.
- return context.ExeAddress;
- case MemoryRegion.Heap:
- // Memory address is relative to the heap.
- return context.HeapAddress;
- case MemoryRegion.Alias:
- // Memory address is relative to the alias region.
- return context.AliasAddress;
- case MemoryRegion.Asrl:
- // Memory address is relative to the asrl region, which matches the code region.
- return context.AslrAddress;
- default:
- throw new TamperCompilationException($"Invalid memory source {source} in Atmosphere cheat");
- }
+ // Memory address is relative to the code start.
+ MemoryRegion.NSO => context.ExeAddress,
+ // Memory address is relative to the heap.
+ MemoryRegion.Heap => context.HeapAddress,
+ // Memory address is relative to the alias region.
+ MemoryRegion.Alias => context.AliasAddress,
+ // Memory address is relative to the asrl region, which matches the code region.
+ MemoryRegion.Asrl => context.AslrAddress,
+ _ => throw new TamperCompilationException($"Invalid memory source {source} in Atmosphere cheat"),
+ };
}
private static void EmitAdd(Value<ulong> finalValue, IOperand firstOperand, IOperand secondOperand, CompilationContext context)
@@ -33,7 +28,7 @@ namespace Ryujinx.HLE.HOS.Tamper
public static Pointer EmitPointer(ulong addressImmediate, CompilationContext context)
{
- Value<ulong> addressImmediateValue = new Value<ulong>(addressImmediate);
+ Value<ulong> addressImmediateValue = new(addressImmediate);
return new Pointer(addressImmediateValue, context.Process);
}
@@ -45,8 +40,8 @@ namespace Ryujinx.HLE.HOS.Tamper
public static Pointer EmitPointer(Register addressRegister, ulong offsetImmediate, CompilationContext context)
{
- Value<ulong> offsetImmediateValue = new Value<ulong>(offsetImmediate);
- Value<ulong> finalAddressValue = new Value<ulong>(0);
+ Value<ulong> offsetImmediateValue = new(offsetImmediate);
+ Value<ulong> finalAddressValue = new(0);
EmitAdd(finalAddressValue, addressRegister, offsetImmediateValue, context);
return new Pointer(finalAddressValue, context.Process);
@@ -54,7 +49,7 @@ namespace Ryujinx.HLE.HOS.Tamper
public static Pointer EmitPointer(Register addressRegister, Register offsetRegister, CompilationContext context)
{
- Value<ulong> finalAddressValue = new Value<ulong>(0);
+ Value<ulong> finalAddressValue = new(0);
EmitAdd(finalAddressValue, addressRegister, offsetRegister, context);
return new Pointer(finalAddressValue, context.Process);
@@ -62,10 +57,10 @@ namespace Ryujinx.HLE.HOS.Tamper
public static Pointer EmitPointer(Register addressRegister, Register offsetRegister, ulong offsetImmediate, CompilationContext context)
{
- Value<ulong> offsetImmediateValue = new Value<ulong>(offsetImmediate);
- Value<ulong> finalOffsetValue = new Value<ulong>(0);
+ Value<ulong> offsetImmediateValue = new(offsetImmediate);
+ Value<ulong> finalOffsetValue = new(0);
EmitAdd(finalOffsetValue, offsetRegister, offsetImmediateValue, context);
- Value<ulong> finalAddressValue = new Value<ulong>(0);
+ Value<ulong> finalAddressValue = new(0);
EmitAdd(finalAddressValue, addressRegister, finalOffsetValue, context);
return new Pointer(finalAddressValue, context.Process);
diff --git a/src/Ryujinx.HLE/HOS/Tamper/Operations/Block.cs b/src/Ryujinx.HLE/HOS/Tamper/Operations/Block.cs
index d81daa90..6d4b1637 100644
--- a/src/Ryujinx.HLE/HOS/Tamper/Operations/Block.cs
+++ b/src/Ryujinx.HLE/HOS/Tamper/Operations/Block.cs
@@ -4,7 +4,7 @@ namespace Ryujinx.HLE.HOS.Tamper.Operations
{
class Block : IOperation
{
- private IEnumerable<IOperation> _operations;
+ private readonly IEnumerable<IOperation> _operations;
public Block(IEnumerable<IOperation> operations)
{
diff --git a/src/Ryujinx.HLE/HOS/Tamper/Operations/ForBlock.cs b/src/Ryujinx.HLE/HOS/Tamper/Operations/ForBlock.cs
index ef95fa2b..1e8cafa8 100644
--- a/src/Ryujinx.HLE/HOS/Tamper/Operations/ForBlock.cs
+++ b/src/Ryujinx.HLE/HOS/Tamper/Operations/ForBlock.cs
@@ -4,9 +4,9 @@ namespace Ryujinx.HLE.HOS.Tamper.Operations
{
class ForBlock : IOperation
{
- private ulong _count;
- private Register _register;
- private IEnumerable<IOperation> _operations;
+ private readonly ulong _count;
+ private readonly Register _register;
+ private readonly IEnumerable<IOperation> _operations;
public ForBlock(ulong count, Register register, IEnumerable<IOperation> operations)
{
diff --git a/src/Ryujinx.HLE/HOS/Tamper/Operations/IfBlock.cs b/src/Ryujinx.HLE/HOS/Tamper/Operations/IfBlock.cs
index b7c5684e..a6b31f25 100644
--- a/src/Ryujinx.HLE/HOS/Tamper/Operations/IfBlock.cs
+++ b/src/Ryujinx.HLE/HOS/Tamper/Operations/IfBlock.cs
@@ -5,9 +5,9 @@ namespace Ryujinx.HLE.HOS.Tamper.Operations
{
class IfBlock : IOperation
{
- private ICondition _condition;
- private IEnumerable<IOperation> _operationsThen;
- private IEnumerable<IOperation> _operationsElse;
+ private readonly ICondition _condition;
+ private readonly IEnumerable<IOperation> _operationsThen;
+ private readonly IEnumerable<IOperation> _operationsElse;
public IfBlock(ICondition condition, IEnumerable<IOperation> operationsThen, IEnumerable<IOperation> operationsElse)
{
diff --git a/src/Ryujinx.HLE/HOS/Tamper/Operations/OpAdd.cs b/src/Ryujinx.HLE/HOS/Tamper/Operations/OpAdd.cs
index 214518d7..855245e3 100644
--- a/src/Ryujinx.HLE/HOS/Tamper/Operations/OpAdd.cs
+++ b/src/Ryujinx.HLE/HOS/Tamper/Operations/OpAdd.cs
@@ -2,9 +2,9 @@ namespace Ryujinx.HLE.HOS.Tamper.Operations
{
class OpAdd<T> : IOperation where T : unmanaged
{
- IOperand _destination;
- IOperand _lhs;
- IOperand _rhs;
+ readonly IOperand _destination;
+ readonly IOperand _lhs;
+ readonly IOperand _rhs;
public OpAdd(IOperand destination, IOperand lhs, IOperand rhs)
{
diff --git a/src/Ryujinx.HLE/HOS/Tamper/Operations/OpAnd.cs b/src/Ryujinx.HLE/HOS/Tamper/Operations/OpAnd.cs
index 366a82b0..7d1fa10b 100644
--- a/src/Ryujinx.HLE/HOS/Tamper/Operations/OpAnd.cs
+++ b/src/Ryujinx.HLE/HOS/Tamper/Operations/OpAnd.cs
@@ -2,9 +2,9 @@ namespace Ryujinx.HLE.HOS.Tamper.Operations
{
class OpAnd<T> : IOperation where T : unmanaged
{
- IOperand _destination;
- IOperand _lhs;
- IOperand _rhs;
+ readonly IOperand _destination;
+ readonly IOperand _lhs;
+ readonly IOperand _rhs;
public OpAnd(IOperand destination, IOperand lhs, IOperand rhs)
{
diff --git a/src/Ryujinx.HLE/HOS/Tamper/Operations/OpLog.cs b/src/Ryujinx.HLE/HOS/Tamper/Operations/OpLog.cs
index 49f8b41e..4017e5f7 100644
--- a/src/Ryujinx.HLE/HOS/Tamper/Operations/OpLog.cs
+++ b/src/Ryujinx.HLE/HOS/Tamper/Operations/OpLog.cs
@@ -4,8 +4,8 @@ namespace Ryujinx.HLE.HOS.Tamper.Operations
{
class OpLog<T> : IOperation where T : unmanaged
{
- int _logId;
- IOperand _source;
+ readonly int _logId;
+ readonly IOperand _source;
public OpLog(int logId, IOperand source)
{
diff --git a/src/Ryujinx.HLE/HOS/Tamper/Operations/OpLsh.cs b/src/Ryujinx.HLE/HOS/Tamper/Operations/OpLsh.cs
index 34e7c81a..6c846425 100644
--- a/src/Ryujinx.HLE/HOS/Tamper/Operations/OpLsh.cs
+++ b/src/Ryujinx.HLE/HOS/Tamper/Operations/OpLsh.cs
@@ -2,9 +2,9 @@ namespace Ryujinx.HLE.HOS.Tamper.Operations
{
class OpLsh<T> : IOperation where T : unmanaged
{
- IOperand _destination;
- IOperand _lhs;
- IOperand _rhs;
+ readonly IOperand _destination;
+ readonly IOperand _lhs;
+ readonly IOperand _rhs;
public OpLsh(IOperand destination, IOperand lhs, IOperand rhs)
{
diff --git a/src/Ryujinx.HLE/HOS/Tamper/Operations/OpMov.cs b/src/Ryujinx.HLE/HOS/Tamper/Operations/OpMov.cs
index 5fad38f9..af82f18e 100644
--- a/src/Ryujinx.HLE/HOS/Tamper/Operations/OpMov.cs
+++ b/src/Ryujinx.HLE/HOS/Tamper/Operations/OpMov.cs
@@ -2,8 +2,8 @@ namespace Ryujinx.HLE.HOS.Tamper.Operations
{
class OpMov<T> : IOperation where T : unmanaged
{
- IOperand _destination;
- IOperand _source;
+ readonly IOperand _destination;
+ readonly IOperand _source;
public OpMov(IOperand destination, IOperand source)
{
diff --git a/src/Ryujinx.HLE/HOS/Tamper/Operations/OpMul.cs b/src/Ryujinx.HLE/HOS/Tamper/Operations/OpMul.cs
index 5aa0e34e..a1b080f0 100644
--- a/src/Ryujinx.HLE/HOS/Tamper/Operations/OpMul.cs
+++ b/src/Ryujinx.HLE/HOS/Tamper/Operations/OpMul.cs
@@ -2,9 +2,9 @@ namespace Ryujinx.HLE.HOS.Tamper.Operations
{
class OpMul<T> : IOperation where T : unmanaged
{
- IOperand _destination;
- IOperand _lhs;
- IOperand _rhs;
+ readonly IOperand _destination;
+ readonly IOperand _lhs;
+ readonly IOperand _rhs;
public OpMul(IOperand destination, IOperand lhs, IOperand rhs)
{
diff --git a/src/Ryujinx.HLE/HOS/Tamper/Operations/OpNot.cs b/src/Ryujinx.HLE/HOS/Tamper/Operations/OpNot.cs
index 8a97c3fe..034e2200 100644
--- a/src/Ryujinx.HLE/HOS/Tamper/Operations/OpNot.cs
+++ b/src/Ryujinx.HLE/HOS/Tamper/Operations/OpNot.cs
@@ -2,8 +2,8 @@ namespace Ryujinx.HLE.HOS.Tamper.Operations
{
class OpNot<T> : IOperation where T : unmanaged
{
- IOperand _destination;
- IOperand _source;
+ readonly IOperand _destination;
+ readonly IOperand _source;
public OpNot(IOperand destination, IOperand source)
{
diff --git a/src/Ryujinx.HLE/HOS/Tamper/Operations/OpOr.cs b/src/Ryujinx.HLE/HOS/Tamper/Operations/OpOr.cs
index d074de1c..0afdc3f4 100644
--- a/src/Ryujinx.HLE/HOS/Tamper/Operations/OpOr.cs
+++ b/src/Ryujinx.HLE/HOS/Tamper/Operations/OpOr.cs
@@ -2,9 +2,9 @@ namespace Ryujinx.HLE.HOS.Tamper.Operations
{
class OpOr<T> : IOperation where T : unmanaged
{
- IOperand _destination;
- IOperand _lhs;
- IOperand _rhs;
+ readonly IOperand _destination;
+ readonly IOperand _lhs;
+ readonly IOperand _rhs;
public OpOr(IOperand destination, IOperand lhs, IOperand rhs)
{
diff --git a/src/Ryujinx.HLE/HOS/Tamper/Operations/OpProcCtrl.cs b/src/Ryujinx.HLE/HOS/Tamper/Operations/OpProcCtrl.cs
index 1b89f450..5de225a1 100644
--- a/src/Ryujinx.HLE/HOS/Tamper/Operations/OpProcCtrl.cs
+++ b/src/Ryujinx.HLE/HOS/Tamper/Operations/OpProcCtrl.cs
@@ -2,8 +2,8 @@ namespace Ryujinx.HLE.HOS.Tamper.Operations
{
class OpProcCtrl : IOperation
{
- private ITamperedProcess _process;
- private bool _pause;
+ private readonly ITamperedProcess _process;
+ private readonly bool _pause;
public OpProcCtrl(ITamperedProcess process, bool pause)
{
diff --git a/src/Ryujinx.HLE/HOS/Tamper/Operations/OpRsh.cs b/src/Ryujinx.HLE/HOS/Tamper/Operations/OpRsh.cs
index b08dd957..e7e0f870 100644
--- a/src/Ryujinx.HLE/HOS/Tamper/Operations/OpRsh.cs
+++ b/src/Ryujinx.HLE/HOS/Tamper/Operations/OpRsh.cs
@@ -2,9 +2,9 @@ namespace Ryujinx.HLE.HOS.Tamper.Operations
{
class OpRsh<T> : IOperation where T : unmanaged
{
- IOperand _destination;
- IOperand _lhs;
- IOperand _rhs;
+ readonly IOperand _destination;
+ readonly IOperand _lhs;
+ readonly IOperand _rhs;
public OpRsh(IOperand destination, IOperand lhs, IOperand rhs)
{
diff --git a/src/Ryujinx.HLE/HOS/Tamper/Operations/OpSub.cs b/src/Ryujinx.HLE/HOS/Tamper/Operations/OpSub.cs
index b9c67d04..d860d66f 100644
--- a/src/Ryujinx.HLE/HOS/Tamper/Operations/OpSub.cs
+++ b/src/Ryujinx.HLE/HOS/Tamper/Operations/OpSub.cs
@@ -2,9 +2,9 @@ namespace Ryujinx.HLE.HOS.Tamper.Operations
{
class OpSub<T> : IOperation where T : unmanaged
{
- IOperand _destination;
- IOperand _lhs;
- IOperand _rhs;
+ readonly IOperand _destination;
+ readonly IOperand _lhs;
+ readonly IOperand _rhs;
public OpSub(IOperand destination, IOperand lhs, IOperand rhs)
{
diff --git a/src/Ryujinx.HLE/HOS/Tamper/Operations/OpXor.cs b/src/Ryujinx.HLE/HOS/Tamper/Operations/OpXor.cs
index 3bbb76a1..07ba6b33 100644
--- a/src/Ryujinx.HLE/HOS/Tamper/Operations/OpXor.cs
+++ b/src/Ryujinx.HLE/HOS/Tamper/Operations/OpXor.cs
@@ -2,9 +2,9 @@ namespace Ryujinx.HLE.HOS.Tamper.Operations
{
class OpXor<T> : IOperation where T : unmanaged
{
- IOperand _destination;
- IOperand _lhs;
- IOperand _rhs;
+ readonly IOperand _destination;
+ readonly IOperand _lhs;
+ readonly IOperand _rhs;
public OpXor(IOperand destination, IOperand lhs, IOperand rhs)
{
diff --git a/src/Ryujinx.HLE/HOS/Tamper/Pointer.cs b/src/Ryujinx.HLE/HOS/Tamper/Pointer.cs
index 22acf4d5..c961e1a7 100644
--- a/src/Ryujinx.HLE/HOS/Tamper/Pointer.cs
+++ b/src/Ryujinx.HLE/HOS/Tamper/Pointer.cs
@@ -6,8 +6,8 @@ namespace Ryujinx.HLE.HOS.Tamper
{
class Pointer : IOperand
{
- private IOperand _position;
- private ITamperedProcess _process;
+ private readonly IOperand _position;
+ private readonly ITamperedProcess _process;
public Pointer(IOperand position, ITamperedProcess process)
{
diff --git a/src/Ryujinx.HLE/HOS/Tamper/Register.cs b/src/Ryujinx.HLE/HOS/Tamper/Register.cs
index 01af20de..cce13ee6 100644
--- a/src/Ryujinx.HLE/HOS/Tamper/Register.cs
+++ b/src/Ryujinx.HLE/HOS/Tamper/Register.cs
@@ -6,7 +6,7 @@ namespace Ryujinx.HLE.HOS.Tamper
class Register : IOperand
{
private ulong _register = 0;
- private string _alias;
+ private readonly string _alias;
public Register(string alias)
{
diff --git a/src/Ryujinx.HLE/HOS/Tamper/TamperedKProcess.cs b/src/Ryujinx.HLE/HOS/Tamper/TamperedKProcess.cs
index be51264a..c8768e88 100644
--- a/src/Ryujinx.HLE/HOS/Tamper/TamperedKProcess.cs
+++ b/src/Ryujinx.HLE/HOS/Tamper/TamperedKProcess.cs
@@ -7,7 +7,7 @@ namespace Ryujinx.HLE.HOS.Tamper
{
class TamperedKProcess : ITamperedProcess
{
- private KProcess _process;
+ private readonly KProcess _process;
public ProcessState State => _process.State;
@@ -65,4 +65,4 @@ namespace Ryujinx.HLE.HOS.Tamper
Logger.Warning?.Print(LogClass.TamperMachine, "Process resuming is not supported!");
}
}
-} \ No newline at end of file
+}
diff --git a/src/Ryujinx.HLE/HOS/Tamper/Value.cs b/src/Ryujinx.HLE/HOS/Tamper/Value.cs
index 865f8e04..436fc13d 100644
--- a/src/Ryujinx.HLE/HOS/Tamper/Value.cs
+++ b/src/Ryujinx.HLE/HOS/Tamper/Value.cs
@@ -2,11 +2,11 @@ using Ryujinx.HLE.HOS.Tamper.Operations;
namespace Ryujinx.HLE.HOS.Tamper
{
- class Value<P> : IOperand where P : unmanaged
+ class Value<TP> : IOperand where TP : unmanaged
{
- private P _value;
+ private TP _value;
- public Value(P value)
+ public Value(TP value)
{
_value = value;
}
@@ -18,7 +18,7 @@ namespace Ryujinx.HLE.HOS.Tamper
public void Set<T>(T value) where T : unmanaged
{
- _value = (P)(dynamic)value;
+ _value = (TP)(dynamic)value;
}
}
}