From 4a52f9182cd7083293a549b1455b49945781ae90 Mon Sep 17 00:00:00 2001 From: zilmar Date: Wed, 26 Sep 2012 10:38:29 +1000 Subject: [PATCH] In overflow delay slot make sure TestTimer is set for jr --- .../N64 System/Recompiler/Recompiler Ops.cpp | 14 +++++++++----- .../N64 System/Recompiler/Recompiler Ops.h | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Source/Project64/N64 System/Recompiler/Recompiler Ops.cpp b/Source/Project64/N64 System/Recompiler/Recompiler Ops.cpp index 4a1b224c9..d11be8142 100644 --- a/Source/Project64/N64 System/Recompiler/Recompiler Ops.cpp +++ b/Source/Project64/N64 System/Recompiler/Recompiler Ops.cpp @@ -184,7 +184,7 @@ void CRecompilerOps::Compile_Branch (CRecompilerOps::BranchFunction CompareFunc, CPU_Message(" DoDelaySlot:"); SetJump8(DelayLinkLocation,m_RecompPos); } - OverflowDelaySlot(); + OverflowDelaySlot(false); return; } ResetX86Protection(); @@ -326,7 +326,7 @@ void CRecompilerOps::Compile_BranchLikely (BranchFunction CompareFunc, BOOL Link } } MoveConstToVariable(m_Section->m_Jump.TargetPC,&R4300iOp::m_JumpToLocation,"R4300iOp::m_JumpToLocation"); - OverflowDelaySlot(); + OverflowDelaySlot(false); CPU_Message(" "); CPU_Message(" %s:",m_Section->m_Cont.BranchLabel.c_str()); if (m_Section->m_Cont.LinkLocation != NULL) { @@ -1291,7 +1291,7 @@ void CRecompilerOps::JAL (void) { if ((m_CompilePC & 0xFFC) == 0xFFC) { MoveConstToVariable((m_CompilePC & 0xF0000000) + (m_Opcode.target << 2),&R4300iOp::m_JumpToLocation,"R4300iOp::m_JumpToLocation"); - OverflowDelaySlot(); + OverflowDelaySlot(false); return; } m_Section->m_Jump.TargetPC = (m_CompilePC & 0xF0000000) + (m_Opcode.target << 2); @@ -1978,7 +1978,7 @@ void CRecompilerOps::SPECIAL_JR (void) { m_RegWorkingSet.WriteBackRegisters(); MoveX86regToVariable(Map_TempReg(x86_Any,m_Opcode.rs,FALSE),&R4300iOp::m_JumpToLocation,"R4300iOp::m_JumpToLocation"); } - OverflowDelaySlot(); + OverflowDelaySlot(true); return; } @@ -5168,13 +5168,17 @@ void CRecompilerOps::CompileSystemCheck (DWORD TargetPC, CRegInfo RegSet) SetJump32(Jump,(DWORD *)m_RecompPos); } -void CRecompilerOps::OverflowDelaySlot (void) +void CRecompilerOps::OverflowDelaySlot (BOOL TestTimer) { m_RegWorkingSet.WriteBackRegisters(); UpdateCounters(m_RegWorkingSet,false,true); MoveConstToVariable(CompilePC() + 4,_PROGRAM_COUNTER,"PROGRAM_COUNTER"); if (_SyncSystem) { Call_Direct(SyncSystem, "SyncSystem"); } MoveConstToVariable(JUMP,&R4300iOp::m_NextInstruction,"R4300iOp::m_NextInstruction"); + if (TestTimer) + { + MoveConstToVariable(TestTimer,&R4300iOp::m_TestTimer,"R4300iOp::m_TestTimer"); + } PushImm32("CountPerOp()",CountPerOp()); Call_Direct(CInterpreterCPU::ExecuteOps, "CInterpreterCPU::ExecuteOps"); AddConstToX86Reg(x86_ESP,4); diff --git a/Source/Project64/N64 System/Recompiler/Recompiler Ops.h b/Source/Project64/N64 System/Recompiler/Recompiler Ops.h index 4609138dd..e3182c2c4 100644 --- a/Source/Project64/N64 System/Recompiler/Recompiler Ops.h +++ b/Source/Project64/N64 System/Recompiler/Recompiler Ops.h @@ -195,7 +195,7 @@ protected: static void UpdateCounters (CRegInfo & RegSet, bool CheckTimer, bool ClearValues = false ); static void CompileSystemCheck ( DWORD TargetPC, CRegInfo RegSet ); static void ChangeDefaultRoundingModel ( void ); - static void OverflowDelaySlot ( void ); + static void OverflowDelaySlot ( BOOL TestTimer );