aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.HLE/HOS/Tamper/CodeEmitters/Arithmetic.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Ryujinx.HLE/HOS/Tamper/CodeEmitters/Arithmetic.cs')
-rw-r--r--src/Ryujinx.HLE/HOS/Tamper/CodeEmitters/Arithmetic.cs50
1 files changed, 36 insertions, 14 deletions
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");
}