microVU: Fixes to D/T Bit handling and XGKick Delay

-Elemental Garde - Fixed up D-Bit so it remembers the microVU state when recompiling, this fixes the bad geometry that was introduced with T/D bit handling.
-WRC Rally Evolved - Changed the XGKick delay to an increased number, solves all remaining SPS problems.
-Crash Twinsanity - Increased XGKick delay resolves geometry issues on Crash, thanks to Autoran1 for debugging this :)

GameDB Changes: Added XGKick hack to Crash Twinsanity auto gamefixes, checked the main entries for the others above have it too.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5608 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
refraction@gmail.com 2013-04-08 20:47:04 +00:00
parent fa7d10cfb1
commit c472db6327
5 changed files with 17 additions and 9 deletions

View File

@ -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

View File

@ -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) {

View File

@ -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);
}

View File

@ -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

View File

@ -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)