From f036c7825c1c7b48c98dd728812dfa6927d2044b Mon Sep 17 00:00:00 2001 From: zilmar Date: Sun, 21 Jan 2018 08:51:49 +1100 Subject: [PATCH] [Project64] Make sure cycles are updated before calling CDMA::PI_DMA_WRITE --- .../N64System/Recompiler/Arm/ArmRecompilerOps.cpp | 6 ++++++ .../N64System/Recompiler/x86/x86RecompilerOps.cpp | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/Source/Project64-core/N64System/Recompiler/Arm/ArmRecompilerOps.cpp b/Source/Project64-core/N64System/Recompiler/Arm/ArmRecompilerOps.cpp index 087e32368..33c81fd66 100644 --- a/Source/Project64-core/N64System/Recompiler/Arm/ArmRecompilerOps.cpp +++ b/Source/Project64-core/N64System/Recompiler/Arm/ArmRecompilerOps.cpp @@ -6376,6 +6376,9 @@ void CArmRecompilerOps::SW_Const(uint32_t Value, uint32_t VAddr) m_RegWorkingSet.AfterCallDirect(); break; case 0x0460000C: + m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() - g_System->CountPerOp()); + UpdateCounters(m_RegWorkingSet, false, true); + m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() + g_System->CountPerOp()); MoveConstToVariable(Value, &g_Reg->PI_WR_LEN_REG, "PI_WR_LEN_REG"); m_RegWorkingSet.BeforeCallDirect(); MoveConstToArmReg(Arm_R0, (uint32_t)((CDMA *)g_MMU), "(CDMA *)g_MMU"); @@ -6810,6 +6813,9 @@ void CArmRecompilerOps::SW_Register(ArmReg Reg, uint32_t VAddr) m_RegWorkingSet.AfterCallDirect(); break; case 0x0460000C: + m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() - g_System->CountPerOp()); + UpdateCounters(m_RegWorkingSet, false, true); + m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() + g_System->CountPerOp()); MoveArmRegToVariable(Reg, &g_Reg->PI_WR_LEN_REG, "PI_WR_LEN_REG"); m_RegWorkingSet.BeforeCallDirect(); MoveConstToArmReg(Arm_R0, (uint32_t)((CDMA *)g_MMU), "(CDMA *)g_MMU"); diff --git a/Source/Project64-core/N64System/Recompiler/x86/x86RecompilerOps.cpp b/Source/Project64-core/N64System/Recompiler/x86/x86RecompilerOps.cpp index 012aec321..31eac0413 100644 --- a/Source/Project64-core/N64System/Recompiler/x86/x86RecompilerOps.cpp +++ b/Source/Project64-core/N64System/Recompiler/x86/x86RecompilerOps.cpp @@ -10667,6 +10667,9 @@ void CX86RecompilerOps::SW_Const(uint32_t Value, uint32_t VAddr) m_RegWorkingSet.AfterCallDirect(); break; case 0x0460000C: + m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() - g_System->CountPerOp()); + UpdateCounters(m_RegWorkingSet, false, true); + m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() + g_System->CountPerOp()); MoveConstToVariable(Value, &g_Reg->PI_WR_LEN_REG, "PI_WR_LEN_REG"); m_RegWorkingSet.BeforeCallDirect(); #ifdef _MSC_VER @@ -11146,6 +11149,9 @@ void CX86RecompilerOps::SW_Register(x86Reg Reg, uint32_t VAddr) m_RegWorkingSet.AfterCallDirect(); break; case 0x0460000C: + m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() - g_System->CountPerOp()); + UpdateCounters(m_RegWorkingSet, false, true); + m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() + g_System->CountPerOp()); MoveX86regToVariable(Reg, &g_Reg->PI_WR_LEN_REG, "PI_WR_LEN_REG"); m_RegWorkingSet.BeforeCallDirect(); #ifdef _MSC_VER