From 5f41558e4920b3d69c476e875e3e7daffc4beb7d Mon Sep 17 00:00:00 2001 From: zilmar Date: Sat, 20 Oct 2012 06:06:30 +1100 Subject: [PATCH] Fixed delay slot at edge condition --- .../Project64/N64 System/Recompiler/Code Section.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Source/Project64/N64 System/Recompiler/Code Section.cpp b/Source/Project64/N64 System/Recompiler/Code Section.cpp index a86f87b7e..cf47156f4 100644 --- a/Source/Project64/N64 System/Recompiler/Code Section.cpp +++ b/Source/Project64/N64 System/Recompiler/Code Section.cpp @@ -1246,8 +1246,14 @@ bool CCodeSection::GenerateX86Code ( DWORD Test ) { _Notify->BreakPoint(__FILE__,__LINE__); } - if (m_NextInstruction == NORMAL) { - CompileExit (m_CompilePC, m_CompilePC + 4,m_RegWorkingSet,CExitInfo::Normal,true,NULL); + if (m_NextInstruction == NORMAL) + { + if (m_DelaySlot) + { + CompileExit (m_CompilePC, m_Jump.TargetPC,m_RegWorkingSet,CExitInfo::Normal,true,NULL); + } else { + CompileExit (m_CompilePC, m_CompilePC + 4,m_RegWorkingSet,CExitInfo::Normal,true,NULL); + } m_NextInstruction = END_BLOCK; } } @@ -1267,7 +1273,7 @@ bool CCodeSection::GenerateX86Code ( DWORD Test ) break; } - if (m_DelaySlot) + if (m_DelaySlot && (CompilePC() & 0xFFC) != 0xFFC) { m_Jump.RegSet = m_RegWorkingSet; m_Jump.FallThrough = true;