microVU: Fixed bug in E-bit conditional branches. Fixes DT Racer

GameDB: Added VU0 Kickstart hack for DT Racer
This commit is contained in:
refractionpcsx2 2020-10-25 21:41:29 +00:00
parent 418974a28a
commit 0448b4902c
2 changed files with 13 additions and 6 deletions

View File

@ -15658,6 +15658,7 @@ Serial = SLES-53904
Name = DT Racer Name = DT Racer
Region = PAL-M5 Region = PAL-M5
GIFFIFOHack = 1 // Fixes corrupted graphics in the menus. GIFFIFOHack = 1 // Fixes corrupted graphics in the menus.
VU0KickstartHack = 1 // Fixes TLB misses and collision bugs
--------------------------------------------- ---------------------------------------------
Serial = SLES-53906 Serial = SLES-53906
Name = 50cent - Bulletproof Name = 50cent - Bulletproof
@ -40481,6 +40482,7 @@ Name = DT Racer
Region = NTSC-U Region = NTSC-U
Compat = 5 Compat = 5
GIFFIFOHack = 1 // Fixes corrupted graphics in the menus. GIFFIFOHack = 1 // Fixes corrupted graphics in the menus.
VU0KickstartHack = 1 // Fixes TLB misses and collision bugs
--------------------------------------------- ---------------------------------------------
Serial = SLUS-21096 Serial = SLUS-21096
Name = Ape Escape - Pumped & Primed Name = Ape Escape - Pumped & Primed

View File

@ -365,6 +365,7 @@ void condBranch(mV, microFlagCycles& mFC, int JMPcc) {
if (mVUup.tBit) if (mVUup.tBit)
{ {
DevCon.Warning("T-Bit on branch, please report if broken");
u32 tempPC = iPC; u32 tempPC = iPC;
xTEST(ptr32[&VU0.VI[REG_FBRST].UL], (isVU1 ? 0x800 : 0x8)); xTEST(ptr32[&VU0.VI[REG_FBRST].UL], (isVU1 ? 0x800 : 0x8));
xForwardJump32 eJMP(Jcc_Zero); xForwardJump32 eJMP(Jcc_Zero);
@ -403,28 +404,32 @@ void condBranch(mV, microFlagCycles& mFC, int JMPcc) {
xMOV(ptr32[&mVU.regs().VI[REG_TPC].UL], xPC); xMOV(ptr32[&mVU.regs().VI[REG_TPC].UL], xPC);
xJMP(mVU.exitFunct); xJMP(mVU.exitFunct);
eJMP.SetTarget(); eJMP.SetTarget();
iPC = tempPC; iPC = tempPC;
} }
xCMP(ptr16[&mVU.branch], 0);
if (mVUup.eBit) { // Conditional Branch With E-Bit Set if (mVUup.eBit) { // Conditional Branch With E-Bit Set
if(mVUlow.evilBranch) if(mVUlow.evilBranch)
DevCon.Warning("End on evil branch! - Not implemented! - If game broken report to PCSX2 Team"); DevCon.Warning("End on evil branch! - Not implemented! - If game broken report to PCSX2 Team");
incPC(3);
mVUendProgram(mVU, &mFC, 2); 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 incPC(1); // Set PC to First instruction of Non-Taken Side
xMOV(ptr32[&mVU.regs().VI[REG_TPC].UL], xPC); xMOV(ptr32[&mVU.regs().VI[REG_TPC].UL], xPC);
xJMP(mVU.exitFunct); xJMP(mVU.exitFunct);
eJMP.SetTarget(); eJMP.SetTarget();
incPC(-4); // Go Back to Branch Opcode to get branchAddr incPC(-4); // Go Back to Branch Opcode to get branchAddr
iPC = branchAddr(mVU)/4; iPC = branchAddr(mVU)/4;
xMOV(ptr32[&mVU.regs().VI[REG_TPC].UL], xPC); xMOV(ptr32[&mVU.regs().VI[REG_TPC].UL], xPC);
xJMP(mVU.exitFunct); xJMP(mVU.exitFunct);
return; return;
} }
else { // Normal Conditional Branch else { // Normal Conditional Branch
xCMP(ptr16[&mVU.branch], 0);
incPC(3); incPC(3);
if(mVUlow.evilBranch) //We are dealing with an evil evil block, so we need to process this slightly differently if(mVUlow.evilBranch) //We are dealing with an evil evil block, so we need to process this slightly differently
{ {