From 0448b4902c5e158af5bb654422d05eb78ceafa83 Mon Sep 17 00:00:00 2001 From: refractionpcsx2 Date: Sun, 25 Oct 2020 21:41:29 +0000 Subject: [PATCH] microVU: Fixed bug in E-bit conditional branches. Fixes DT Racer GameDB: Added VU0 Kickstart hack for DT Racer --- bin/GameIndex.dbf | 2 ++ pcsx2/x86/microVU_Branch.inl | 17 +++++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/bin/GameIndex.dbf b/bin/GameIndex.dbf index a5da507701..79c6a7a154 100644 --- a/bin/GameIndex.dbf +++ b/bin/GameIndex.dbf @@ -15658,6 +15658,7 @@ Serial = SLES-53904 Name = DT Racer Region = PAL-M5 GIFFIFOHack = 1 // Fixes corrupted graphics in the menus. +VU0KickstartHack = 1 // Fixes TLB misses and collision bugs --------------------------------------------- Serial = SLES-53906 Name = 50cent - Bulletproof @@ -40481,6 +40482,7 @@ Name = DT Racer Region = NTSC-U Compat = 5 GIFFIFOHack = 1 // Fixes corrupted graphics in the menus. +VU0KickstartHack = 1 // Fixes TLB misses and collision bugs --------------------------------------------- Serial = SLUS-21096 Name = Ape Escape - Pumped & Primed diff --git a/pcsx2/x86/microVU_Branch.inl b/pcsx2/x86/microVU_Branch.inl index ceab0e3eaf..c79c10cd3d 100644 --- a/pcsx2/x86/microVU_Branch.inl +++ b/pcsx2/x86/microVU_Branch.inl @@ -365,6 +365,7 @@ void condBranch(mV, microFlagCycles& mFC, int JMPcc) { if (mVUup.tBit) { + DevCon.Warning("T-Bit on branch, please report if broken"); u32 tempPC = iPC; xTEST(ptr32[&VU0.VI[REG_FBRST].UL], (isVU1 ? 0x800 : 0x8)); xForwardJump32 eJMP(Jcc_Zero); @@ -403,28 +404,32 @@ void condBranch(mV, microFlagCycles& mFC, int JMPcc) { xMOV(ptr32[&mVU.regs().VI[REG_TPC].UL], xPC); xJMP(mVU.exitFunct); eJMP.SetTarget(); - iPC = tempPC; + iPC = tempPC; } - xCMP(ptr16[&mVU.branch], 0); if (mVUup.eBit) { // Conditional Branch With E-Bit Set if(mVUlow.evilBranch) DevCon.Warning("End on evil branch! - Not implemented! - If game broken report to PCSX2 Team"); - - incPC(3); + mVUendProgram(mVU, &mFC, 2); - xForwardJump32 eJMP(xInvertCond((JccComparisonType)JMPcc)); + xCMP(ptr16[&mVU.branch], 0); + + incPC(3); + xForwardJump32 eJMP(((JccComparisonType)JMPcc)); incPC(1); // Set PC to First instruction of Non-Taken Side xMOV(ptr32[&mVU.regs().VI[REG_TPC].UL], xPC); xJMP(mVU.exitFunct); - eJMP.SetTarget(); + eJMP.SetTarget(); incPC(-4); // Go Back to Branch Opcode to get branchAddr + iPC = branchAddr(mVU)/4; xMOV(ptr32[&mVU.regs().VI[REG_TPC].UL], xPC); xJMP(mVU.exitFunct); return; } else { // Normal Conditional Branch + xCMP(ptr16[&mVU.branch], 0); + incPC(3); if(mVUlow.evilBranch) //We are dealing with an evil evil block, so we need to process this slightly differently {