microVU: Fixed a bug in my handling of branch in branch-delay slots.

Fixes Hot Wheels Velocity Maximum Justice, and now makes the game playable with pcsx2 from what I can see :D
This revision might also fix other games that were still having problems that do branches in branch-delay slots.


git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4657 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
cottonvibes 2011-05-20 06:20:36 +00:00
parent 1420318b04
commit daefeb1649
3 changed files with 16 additions and 13 deletions

View File

@ -441,6 +441,7 @@ __ri int mVUbranchCheck(mV) {
if (!mVUcount) return 0;
incPC(-2);
if (mVUlow.branch) {
u32 branchType = mVUlow.branch;
if (doBranchInDelaySlot) {
mVUlow.badBranch = 1;
incPC(2);
@ -450,13 +451,15 @@ __ri int mVUbranchCheck(mV) {
mVUregs.flagInfo = 0;
mVUregs.fullFlags0 = 0;
mVUregs.fullFlags1 = 0;
DevCon.Warning("microVU%d Warning: Branch in Branch delay slot! [%04x]", mVU.index, xPC);
DevCon.Warning("microVU%d Warning: Branch[%d] in Branch[%d] delay slot! [%04x]",
mVU.index, branchType, mVUlow.branch, xPC);
return 1;
}
else {
incPC(2);
mVUlow.isNOP = 1;
DevCon.Warning("microVU%d Warning: Branch in Branch delay slot! [%04x]", mVU.index, xPC);
DevCon.Warning("microVU%d Warning: Branch[%d] in Branch[%d] delay slot! [%04x]",
mVU.index, branchType, mVUlow.branch, xPC);
return 0;
}
}
@ -489,8 +492,8 @@ __fi void mVUanalyzeNormBranch(mV, int It, bool isBAL) {
}
__ri void mVUanalyzeJump(mV, int Is, int It, bool isJALR) {
mVUbranchCheck(mVU);
mVUlow.branch = (isJALR) ? 10 : 9;
mVUbranchCheck(mVU);
if (mVUconstReg[Is].isValid && doConstProp) {
mVUlow.constJump.isValid = 1;
mVUlow.constJump.regValue = mVUconstReg[Is].regValue;

View File

@ -446,7 +446,7 @@ void* mVUcompile(microVU& mVU, u32 startPC, uptr pState) {
mVUinfo.readP = mVU.p;
mVUinfo.writeP = !mVU.p;
if (branch >= 2) { mVUinfo.isEOB = 1; if (branch == 3) { mVUinfo.isBdelay = 1; } mVUcount++; branchWarning(mVU); break; }
else if (branch == 1) { branch = 2; }
elif (branch == 1) { branch = 2; }
if (mVUbranch) { mVUsetFlagInfo(mVU); eBitWarning(mVU); branch = 3; mVUbranch = 0; }
incPC(1);
}

View File

@ -1228,9 +1228,9 @@ void condEvilBranch(mV, int JMPcc) {
xMOV(ptr32[&mVU.badBranch], branchAddrN);
xCMP(gprT1b, 0);
xForwardJump8 cJMP((JccComparisonType)JMPcc);
incPC(4); // Branch Not Taken
incPC(6); // Branch Not Taken Addr + 8
xMOV(ptr32[&mVU.badBranch], xPC);
incPC(-4);
incPC(-6);
cJMP.SetTarget();
return;
}