From a88d03a12d78388d50a941aca82ef302a7060ce7 Mon Sep 17 00:00:00 2001 From: zilmar Date: Tue, 3 Feb 2015 17:36:42 +1100 Subject: [PATCH] Update JALR edge condition --- Config/Project64.rdb | 12 ++++++ .../N64 System/Recompiler/Recompiler Ops.cpp | 37 ++++++++++++------- 2 files changed, 35 insertions(+), 14 deletions(-) diff --git a/Config/Project64.rdb b/Config/Project64.rdb index 1f32819c3..9c6b8af97 100644 --- a/Config/Project64.rdb +++ b/Config/Project64.rdb @@ -1647,6 +1647,18 @@ glide64-filtering=1 glide64-fix_tex_coord=1 glide64-fog=0 +[A08D0F77-6F82E38C-C:45] +Good Name=Conker's Bad Fur Day (ECTS) +Internal Name=CBFD ECTS +Status=Compatible +32bit=No +FuncFind=2 +SMM-Cache=0 +SMM-FUNC=0 +SMM-PI DMA=0 +SMM-TLB=0 +Save Type=16kbit Eeprom + [373F5889-9A6CA80A-C:50] Good Name=Conker's Bad Fur Day (E) Internal Name=CONKER BFD diff --git a/Source/Project64/N64 System/Recompiler/Recompiler Ops.cpp b/Source/Project64/N64 System/Recompiler/Recompiler Ops.cpp index 933f73445..702ef1b96 100644 --- a/Source/Project64/N64 System/Recompiler/Recompiler Ops.cpp +++ b/Source/Project64/N64 System/Recompiler/Recompiler Ops.cpp @@ -1950,10 +1950,15 @@ void CRecompilerOps::SPECIAL_JALR (void) if ( m_NextInstruction == NORMAL ) { CPU_Message(" %X %s",m_CompilePC,R4300iOpcodeName(m_Opcode.Hex,m_CompilePC)); - if (DelaySlotEffectsCompare(m_CompilePC,m_Opcode.rs,0)) + if (DelaySlotEffectsCompare(m_CompilePC,m_Opcode.rs,0) && (m_CompilePC & 0xFFC) != 0xFFC) { - CRecompilerOps::UnknownOpcode(); - return; + if (IsConst(m_Opcode.rs)) { + MoveConstToVariable(GetMipsRegLo(m_Opcode.rs),_PROGRAM_COUNTER, "PROGRAM_COUNTER"); + } else if (IsMapped(m_Opcode.rs)) { + MoveX86regToVariable(GetMipsRegMapLo(m_Opcode.rs),_PROGRAM_COUNTER, "PROGRAM_COUNTER"); + } else { + MoveX86regToVariable(Map_TempReg(x86_Any,m_Opcode.rs,FALSE),_PROGRAM_COUNTER, "PROGRAM_COUNTER"); + } } UnMap_GPR( m_Opcode.rd, FALSE); m_RegWorkingSet.SetMipsRegLo(m_Opcode.rd,m_CompilePC + 8); @@ -1980,18 +1985,22 @@ void CRecompilerOps::SPECIAL_JALR (void) m_NextInstruction = DO_DELAY_SLOT; } else if (m_NextInstruction == DELAY_SLOT_DONE ) { - UpdateCounters(m_RegWorkingSet,true,true); - if (IsConst(m_Opcode.rs)) { - MoveConstToVariable(GetMipsRegLo(m_Opcode.rs),_PROGRAM_COUNTER, "PROGRAM_COUNTER"); - } else if (IsMapped(m_Opcode.rs)) { - MoveX86regToVariable(GetMipsRegMapLo(m_Opcode.rs),_PROGRAM_COUNTER, "PROGRAM_COUNTER"); + if (DelaySlotEffectsCompare(m_CompilePC,m_Opcode.rs,0)) { + m_Section->CompileExit(m_CompilePC,(DWORD)-1,m_RegWorkingSet,CExitInfo::Normal,TRUE,NULL); } else { - MoveX86regToVariable(Map_TempReg(x86_Any,m_Opcode.rs,FALSE),_PROGRAM_COUNTER, "PROGRAM_COUNTER"); - } - m_Section->CompileExit((DWORD)-1, (DWORD)-1,m_RegWorkingSet,CExitInfo::Normal,TRUE,NULL); - if (m_Section->m_JumpSection) - { - m_Section->GenerateSectionLinkage(); + UpdateCounters(m_RegWorkingSet,true,true); + if (IsConst(m_Opcode.rs)) { + MoveConstToVariable(GetMipsRegLo(m_Opcode.rs),_PROGRAM_COUNTER, "PROGRAM_COUNTER"); + } else if (IsMapped(m_Opcode.rs)) { + MoveX86regToVariable(GetMipsRegMapLo(m_Opcode.rs),_PROGRAM_COUNTER, "PROGRAM_COUNTER"); + } else { + MoveX86regToVariable(Map_TempReg(x86_Any,m_Opcode.rs,FALSE),_PROGRAM_COUNTER, "PROGRAM_COUNTER"); + } + m_Section->CompileExit((DWORD)-1, (DWORD)-1,m_RegWorkingSet,CExitInfo::Normal,TRUE,NULL); + if (m_Section->m_JumpSection) + { + m_Section->GenerateSectionLinkage(); + } } m_NextInstruction = END_BLOCK; } else if (bHaveDebugger()) {