diff --git a/Source/Project64-core/N64System/Recompiler/x86/x86RecompilerOps.cpp b/Source/Project64-core/N64System/Recompiler/x86/x86RecompilerOps.cpp index 00a9d8696..d00088f15 100644 --- a/Source/Project64-core/N64System/Recompiler/x86/x86RecompilerOps.cpp +++ b/Source/Project64-core/N64System/Recompiler/x86/x86RecompilerOps.cpp @@ -9825,7 +9825,7 @@ void CX86RecompilerOps::CompileLoadMemoryValue(CX86Ops::x86Reg AddressReg, CX86O } if (OpsExecuted != 0) { - m_Assembler.AddConstToVariable(OpsExecuted, g_NextTimer, "g_NextTimer"); + m_Assembler.AddConstToVariable(g_NextTimer, "g_NextTimer", OpsExecuted); } m_CodeBlock.Log(""); m_CodeBlock.Log(stdstr_f(" MemoryReadMap_%X_Found:", m_CompilePC).c_str()); @@ -9963,7 +9963,7 @@ void CX86RecompilerOps::CompileStoreMemoryValue(CX86Ops::x86Reg AddressReg, CX86 m_Assembler.CallThis((uint32_t)&m_MMU, AddressOf(&CMipsMemoryVM::SB_NonMemory), "CMipsMemoryVM::SB_NonMemory", 12); if (OpsExecuted != 0) { - m_Assembler.AddConstToVariable(OpsExecuted, g_NextTimer, "g_NextTimer"); + m_Assembler.AddConstToVariable(g_NextTimer, "g_NextTimer", OpsExecuted); } m_Assembler.TestX86ByteRegToX86Reg(CX86Ops::x86_AL, CX86Ops::x86_AL); m_RegWorkingSet.AfterCallDirect(); @@ -9986,7 +9986,7 @@ void CX86RecompilerOps::CompileStoreMemoryValue(CX86Ops::x86Reg AddressReg, CX86 m_Assembler.CallThis((uint32_t)&m_MMU, AddressOf(&CMipsMemoryVM::SH_NonMemory), "CMipsMemoryVM::SH_NonMemory", 12); if (OpsExecuted != 0) { - m_Assembler.AddConstToVariable(OpsExecuted, g_NextTimer, "g_NextTimer"); + m_Assembler.AddConstToVariable(g_NextTimer, "g_NextTimer", OpsExecuted); } m_Assembler.TestX86ByteRegToX86Reg(CX86Ops::x86_AL, CX86Ops::x86_AL); m_RegWorkingSet.AfterCallDirect(); @@ -10009,7 +10009,7 @@ void CX86RecompilerOps::CompileStoreMemoryValue(CX86Ops::x86Reg AddressReg, CX86 m_Assembler.CallThis((uint32_t)&m_MMU, AddressOf(&CMipsMemoryVM::SW_NonMemory), "CMipsMemoryVM::SW_NonMemory", 12); if (OpsExecuted != 0) { - m_Assembler.AddConstToVariable(OpsExecuted, g_NextTimer, "g_NextTimer"); + m_Assembler.AddConstToVariable(g_NextTimer, "g_NextTimer", OpsExecuted); } m_Assembler.TestX86ByteRegToX86Reg(CX86Ops::x86_AL, CX86Ops::x86_AL); m_RegWorkingSet.AfterCallDirect(); @@ -10034,7 +10034,7 @@ void CX86RecompilerOps::CompileStoreMemoryValue(CX86Ops::x86Reg AddressReg, CX86 m_Assembler.CallThis((uint32_t)&m_MMU, AddressOf(&CMipsMemoryVM::SD_NonMemory), "CMipsMemoryVM::SD_NonMemory", 12); if (OpsExecuted != 0) { - m_Assembler.AddConstToVariable(OpsExecuted, g_NextTimer, "g_NextTimer"); + m_Assembler.AddConstToVariable(g_NextTimer, "g_NextTimer", OpsExecuted); } m_Assembler.TestX86ByteRegToX86Reg(CX86Ops::x86_AL, CX86Ops::x86_AL); m_RegWorkingSet.AfterCallDirect(); diff --git a/Source/Project64-core/N64System/Recompiler/x86/x86ops.cpp b/Source/Project64-core/N64System/Recompiler/x86/x86ops.cpp index 6ed33aceb..9839a4f7a 100644 --- a/Source/Project64-core/N64System/Recompiler/x86/x86ops.cpp +++ b/Source/Project64-core/N64System/Recompiler/x86/x86ops.cpp @@ -65,7 +65,7 @@ void CX86Ops::AdcX86RegToX86Reg(x86Reg Destination, x86Reg Source) AddCode16((uint16_t)(0xC013 + (Source * 0x100) + (Destination * 0x800))); } -void CX86Ops::AddConstToVariable(uint32_t Const, void * Variable, const char * VariableName) +void CX86Ops::AddConstToVariable(void * Variable, const char * VariableName, uint32_t Const) { CodeLog(" add dword ptr [%s], 0x%X", VariableName, Const); AddCode16(0x0581); diff --git a/Source/Project64-core/N64System/Recompiler/x86/x86ops.h b/Source/Project64-core/N64System/Recompiler/x86/x86ops.h index 72aa738c7..88a2d3bba 100644 --- a/Source/Project64-core/N64System/Recompiler/x86/x86ops.h +++ b/Source/Project64-core/N64System/Recompiler/x86/x86ops.h @@ -68,7 +68,7 @@ public: void AdcConstToX86Reg(x86Reg Reg, uint32_t Const); void AdcVariableToX86reg(x86Reg reg, void * Variable, const char * VariableName); void AdcX86RegToX86Reg(x86Reg Destination, x86Reg Source); - void AddConstToVariable(uint32_t Const, void * Variable, const char * VariableName); + void AddConstToVariable(void * Variable, const char * VariableName, uint32_t Const); void AddConstToX86Reg(x86Reg Reg, uint32_t Const, bool NeedCarry = false); void AddVariableToX86reg(x86Reg reg, void * Variable, const char * VariableName); void AddX86regToVariable(x86Reg reg, void * Variable, const char * VariableName);