diff --git a/bin/GameIndex.dbf b/bin/GameIndex.dbf index 8504c71091..88afe2a73e 100644 --- a/bin/GameIndex.dbf +++ b/bin/GameIndex.dbf @@ -10667,6 +10667,7 @@ Region = NTSC-U Serial = SLUS-29101 Name = Crash Twinsanity & Spyro - A Hero's Tail [Demo] Region = NTSC-U +XgKickHack = 1 //Fixes bad Geometry --------------------------------------------- Serial = SLUS-29104 Name = Galactic Wrestling - Featuring Ultimate Muscle [Demo] @@ -16456,7 +16457,7 @@ Serial = SLPM-62623 Name = Elemental Gerad Region = NTSC-J Compat = 5 -XgKickHack = 1 +XgKickHack = 1 //Fixes chocolate coloured characters --------------------------------------------- Serial = SLPM-62624 Name = Indoor Helicopter Adventure 2 @@ -29400,7 +29401,7 @@ Region = NTSC-J Serial = TCPS-10111 Name = Eremental Gerad Region = NTSC-J -XgKickHack = 1 +XgKickHack = 1 //Fixes chocolate coloured characters --------------------------------------------- Serial = TCPS-10113 Name = Mushihime-sama @@ -30476,7 +30477,7 @@ Serial = SCES-53247 Name = WRC - World Rally Championship - Rally Evolved Region = PAL-Unk Compat = 4 -XgKickHack = 1 //Most of the ingame SPS gets fixed with it. +XgKickHack = 1 //SPS. [patches = cbbc2e7f] comment=patches by Nachbrenner //fix delay slot violation @@ -36477,6 +36478,7 @@ Serial = SLES-52568 Name = Crash Twinsanity Region = PAL-Unk Compat = 5 +XgKickHack = 1 //Fixes bad Geometry --------------------------------------------- Serial = SLES-52569 Name = Spyro - A Hero's Tail diff --git a/pcsx2/x86/microVU_Branch.inl b/pcsx2/x86/microVU_Branch.inl index d63aabc64e..e99b0a16cf 100644 --- a/pcsx2/x86/microVU_Branch.inl +++ b/pcsx2/x86/microVU_Branch.inl @@ -35,6 +35,9 @@ void mVUDTendProgram(mV, microFlagCycles* mFC, int isEbit) { int fClip = getLastFlagInst(mVUpBlock->pState, mFC->xClip, 2, isEbit); int qInst = 0; int pInst = 0; + microBlock stateBackup; + memcpy(&stateBackup, &mVUregs, sizeof(mVUregs)); //backup the state, it's about to get screwed with. + mVU.regAlloc->TDwritebackAll(); //Writing back ok, invalidating early kills the rec, so don't do it :P if (isEbit) { @@ -49,7 +52,8 @@ void mVUDTendProgram(mV, microFlagCycles* mFC, int isEbit) { sFLAG.write = fStatus; mVUdivSet(mVU); } - if (mVUinfo.doXGKICK) { mVU_XGKICK_DELAY(mVU, 1); } + //Run any pending XGKick, providing we've got to it. + if (mVUinfo.doXGKICK && xPC >= mVUinfo.XGKICKPC) { mVU_XGKICK_DELAY(mVU, 1); } if (doEarlyExit(mVU)) { if (!isVU1) xCALL(mVU0clearlpStateJIT); else xCALL(mVU1clearlpStateJIT); @@ -82,6 +86,7 @@ void mVUDTendProgram(mV, microFlagCycles* mFC, int isEbit) { xMOV(ptr32[&mVU.regs().VI[REG_TPC].UL], xPC); xJMP(mVU.exitFunct); } + memcpy(&mVUregs, &stateBackup, sizeof(mVUregs)); //Restore the state for the rest of the recompile } void mVUendProgram(mV, microFlagCycles* mFC, int isEbit) { diff --git a/pcsx2/x86/microVU_Compile.inl b/pcsx2/x86/microVU_Compile.inl index 74e57bfbea..349a5be40c 100644 --- a/pcsx2/x86/microVU_Compile.inl +++ b/pcsx2/x86/microVU_Compile.inl @@ -269,7 +269,7 @@ void mVUincCycles(mV, int x) { } if (mVUregs.xgkick) { calcCycles(mVUregs.xgkick, x); - if (!mVUregs.xgkick) { mVUinfo.doXGKICK = 1; } + if (!mVUregs.xgkick) { mVUinfo.doXGKICK = 1; mVUinfo.XGKICKPC = xPC;} } calcCycles(mVUregs.r, x); } @@ -380,9 +380,9 @@ void mVUtestCycles(microVU& mVU) { // This gets run at the start of every loop of mVU's first pass __fi void startLoop(mV) { - if (curI & _Mbit_) { DevCon.WriteLn (Color_Green, "microVU%d: M-bit set!", getIndex); } - if (curI & _Dbit_) { DevCon.WriteLn (Color_Green, "microVU%d: D-bit set!", getIndex); } - if (curI & _Tbit_) { DevCon.WriteLn (Color_Green, "microVU%d: T-bit set!", getIndex); } + if (curI & _Mbit_) { DevCon.WriteLn (Color_Green, "microVU%d: M-bit set! PC = %x", getIndex, xPC); } + if (curI & _Dbit_) { DevCon.WriteLn (Color_Green, "microVU%d: D-bit set! PC = %x", getIndex, xPC); } + if (curI & _Tbit_) { DevCon.WriteLn (Color_Green, "microVU%d: T-bit set! PC = %x", getIndex, xPC); } memzero(mVUinfo); memzero(mVUregsTemp); } diff --git a/pcsx2/x86/microVU_IR.h b/pcsx2/x86/microVU_IR.h index 2845b39b5f..3f77da4504 100644 --- a/pcsx2/x86/microVU_IR.h +++ b/pcsx2/x86/microVU_IR.h @@ -159,6 +159,7 @@ struct microOp { bool swapOps; // Run Lower Instruction before Upper Instruction bool backupVF; // Backup mVUlow.VF_write.reg, and restore it before the Upper Instruction is called bool doXGKICK; // Do XGKICK transfer on this instruction + u32 XGKICKPC; // The PC in which the XGKick has taken place, so if we break early (before it) we don run it. bool doDivFlag; // Transfer Div flag to Status Flag on this instruction int readQ; // Q instance for reading int writeQ; // Q instance for writing diff --git a/pcsx2/x86/microVU_Misc.h b/pcsx2/x86/microVU_Misc.h index bc05ddc53a..73a9a16e2c 100644 --- a/pcsx2/x86/microVU_Misc.h +++ b/pcsx2/x86/microVU_Misc.h @@ -370,7 +370,7 @@ static const bool doJumpAsSameProgram = 0; // Set to 1 to treat jumps as same pr //------------------------------------------------------------------ // XG Kick Transfer Delay Amount -#define mVU_XGKICK_CYCLES ((CHECK_XGKICKHACK) ? 3 : 1) +#define mVU_XGKICK_CYCLES ((CHECK_XGKICKHACK) ? 6 : 1) // Its unknown at recompile time how long the xgkick transfer will take // so give it a value that makes games happy :) (SO3 is fine at 1 cycle delay)