From c380571d8b985f74f94acfd49c821dc97857655d Mon Sep 17 00:00:00 2001 From: zilmar Date: Mon, 5 Sep 2022 19:42:22 +0930 Subject: [PATCH] Core: Update when branch goes to the opcode after the delay slot --- .../N64System/Recompiler/x86/x86RecompilerOps.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Source/Project64-core/N64System/Recompiler/x86/x86RecompilerOps.cpp b/Source/Project64-core/N64System/Recompiler/x86/x86RecompilerOps.cpp index 81b6c4091..87171f56d 100644 --- a/Source/Project64-core/N64System/Recompiler/x86/x86RecompilerOps.cpp +++ b/Source/Project64-core/N64System/Recompiler/x86/x86RecompilerOps.cpp @@ -620,6 +620,13 @@ void CX86RecompilerOps::Compile_Branch(RecompilerBranchCompare CompareType, bool } else if (m_PipelineStage == PIPELINE_STAGE_DELAY_SLOT_DONE) { + if (m_CompilePC + ((int16_t)m_Opcode.offset << 2) + 4 == m_CompilePC + 8) + { + m_PipelineStage = PIPELINE_STAGE_NORMAL; + m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() - g_System->CountPerOp()); + SetCurrentPC(GetCurrentPC() + 4); + return; + } if (m_EffectDelaySlot) { CJumpInfo * FallInfo = m_Section->m_Jump.FallThrough ? &m_Section->m_Jump : &m_Section->m_Cont;