[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>
This commit is contained in:
TSRBerry 2023-07-16 19:31:14 +02:00 committed by GitHub
parent fec8291c17
commit 326749498b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1015 changed files with 8173 additions and 7615 deletions

View file

@ -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));

View file

@ -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;

View file

@ -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");
}

View file

@ -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);
}
}

View file

@ -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");
}

View file

@ -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));
}

View file

@ -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);
}

View file

@ -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));

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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;

View file

@ -105,6 +105,6 @@
/// <summary>
/// Code type 0xFFF writes a debug log.
/// </summary>
DebugLog = 0xFFF
DebugLog = 0xFFF,
}
}

View file

@ -10,6 +10,6 @@
Less = 3,
LessOrEqual = 4,
Equal = 5,
NotEqual = 6
NotEqual = 6,
}
}

View file

@ -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)

View file

@ -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)
{

View file

@ -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)
{

View file

@ -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)
{

View file

@ -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)
{

View file

@ -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)
{

View file

@ -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)
{

View file

@ -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)
{

View file

@ -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);
}

View file

@ -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);

View file

@ -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)
{

View file

@ -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)
{

View file

@ -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)
{

View file

@ -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)
{

View file

@ -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)
{

View file

@ -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)
{

View file

@ -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)
{

View file

@ -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)
{

View file

@ -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)
{

View file

@ -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)
{

View file

@ -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)
{

View file

@ -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)
{

View file

@ -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)
{

View file

@ -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)
{

View file

@ -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)
{

View file

@ -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)
{

View file

@ -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)
{

View file

@ -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!");
}
}
}
}

View file

@ -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;
}
}
}