microVU: Fixed a case where a cached microProgram was killed but was still being used...

This fixes Suikoden III hanging/infinite loop problems, and possibly some other games...

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1641 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
cottonvibes 2009-08-17 01:51:13 +00:00
parent 761e36796a
commit 47b04ffb5b
2 changed files with 7 additions and 6 deletions

View File

@ -207,13 +207,13 @@ microVUt(void) mVUvsyncUpdate(mV) {
mVU->prog.prog[i].used = 0; mVU->prog.prog[i].used = 0;
mVU->prog.prog[i].frame = mVU->prog.curFrame; mVU->prog.prog[i].frame = mVU->prog.curFrame;
} }
if((mVU->prog.curFrame - mVU->prog.prog[i].frame) >= (360 * 10)) { else if (((mVU->prog.curFrame - mVU->prog.prog[i].frame) >= (360 * 10)) && (i != mVU->prog.cur)) {
mVU->prog.total--; mVU->prog.total--;
if (!mVU->index) mVUclearProg<0>(i); if (!mVU->index) mVUclearProg<0>(i);
else mVUclearProg<1>(i); else mVUclearProg<1>(i);
DevCon::Status("microVU%d: Killing Dead Program [%03d]", params mVU->index, i+1); DevCon::Status("microVU%d: Killing Dead Program [%03d]", params mVU->index, i+1);
} }
else if (!mVU->prog.prog[i].isOld && ((mVU->prog.curFrame - mVU->prog.prog[i].frame) >= (30 * 1))) { else if (((mVU->prog.curFrame - mVU->prog.prog[i].frame) >= (30 * 1)) && !mVU->prog.prog[i].isOld) {
mVU->prog.prog[i].isOld = 1; mVU->prog.prog[i].isOld = 1;
//DevCon::Status("microVU%d: Aging Old Program [%03d]", params mVU->index, i+1); //DevCon::Status("microVU%d: Aging Old Program [%03d]", params mVU->index, i+1);
} }
@ -268,6 +268,7 @@ microVUf(int) mVUsearchProg() {
return 0; return 0;
} }
mVU->prog.prog[mVU->prog.cur].used = 1; mVU->prog.prog[mVU->prog.cur].used = 1;
mVU->prog.prog[mVU->prog.cur].isOld = 0;
return 1; // If !cleared, then we're still on the same program as last-time ;) return 1; // If !cleared, then we're still on the same program as last-time ;)
} }

View File

@ -258,8 +258,8 @@ microVUt(void) mVUsetCycles(mV) {
tCycles(mVUregs.xgkick, mVUregsTemp.xgkick); tCycles(mVUregs.xgkick, mVUregsTemp.xgkick);
} }
void __fastcall mVUwarning0(u32 PC) { Console::Error("microVU0 Warning: Exiting from Possible Infinite Loop [%04x]", params PC); } void __fastcall mVUwarning0(mV) { Console::Error("microVU0 Warning: Exiting from Possible Infinite Loop [%04x] [%x]", params xPC, mVU->prog.cur); }
void __fastcall mVUwarning1(u32 PC) { Console::Error("microVU1 Warning: Exiting from Possible Infinite Loop [%04x]", params PC); } void __fastcall mVUwarning1(mV) { Console::Error("microVU1 Warning: Exiting from Possible Infinite Loop [%04x] [%x]", params xPC, mVU->prog.cur); }
void __fastcall mVUprintPC1(u32 PC) { Console::Write("Block PC [%04x] ", params PC); } void __fastcall mVUprintPC1(u32 PC) { Console::Write("Block PC [%04x] ", params PC); }
void __fastcall mVUprintPC2(u32 PC) { Console::Write("[%04x]\n", params PC); } void __fastcall mVUprintPC2(u32 PC) { Console::Write("[%04x]\n", params PC); }
@ -269,7 +269,7 @@ microVUt(void) mVUtestCycles(mV) {
SUB32ItoM((uptr)&mVU->cycles, mVUcycles); SUB32ItoM((uptr)&mVU->cycles, mVUcycles);
if (IsDevBuild || !isVU1) { if (IsDevBuild || !isVU1) {
u32* jmp32 = JG32(0); u32* jmp32 = JG32(0);
MOV32ItoR(gprT2, xPC); MOV32ItoR(gprT2, (uptr)mVU);
if (isVU1) CALLFunc((uptr)mVUwarning1); if (isVU1) CALLFunc((uptr)mVUwarning1);
//else CALLFunc((uptr)mVUwarning0); // VU0 is allowed early exit for COP2 Interlock Simulation //else CALLFunc((uptr)mVUwarning0); // VU0 is allowed early exit for COP2 Interlock Simulation
MOV32ItoR(gprR, Roffset); // Restore gprR MOV32ItoR(gprR, Roffset); // Restore gprR