From 47b04ffb5ba4109e927820b312a11019a0f4956c Mon Sep 17 00:00:00 2001 From: cottonvibes Date: Mon, 17 Aug 2009 01:51:13 +0000 Subject: [PATCH] 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 --- pcsx2/x86/microVU.cpp | 7 ++++--- pcsx2/x86/microVU_Compile.inl | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/pcsx2/x86/microVU.cpp b/pcsx2/x86/microVU.cpp index a4630a3e1e..6b4e028c3e 100644 --- a/pcsx2/x86/microVU.cpp +++ b/pcsx2/x86/microVU.cpp @@ -207,13 +207,13 @@ microVUt(void) mVUvsyncUpdate(mV) { mVU->prog.prog[i].used = 0; 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--; if (!mVU->index) mVUclearProg<0>(i); else mVUclearProg<1>(i); 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; //DevCon::Status("microVU%d: Aging Old Program [%03d]", params mVU->index, i+1); } @@ -267,7 +267,8 @@ microVUf(int) mVUsearchProg() { mVU->prog.isSame = 1; 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 ;) } diff --git a/pcsx2/x86/microVU_Compile.inl b/pcsx2/x86/microVU_Compile.inl index 50e612eb38..6502641abf 100644 --- a/pcsx2/x86/microVU_Compile.inl +++ b/pcsx2/x86/microVU_Compile.inl @@ -258,8 +258,8 @@ microVUt(void) mVUsetCycles(mV) { tCycles(mVUregs.xgkick, mVUregsTemp.xgkick); } -void __fastcall mVUwarning0(u32 PC) { Console::Error("microVU0 Warning: Exiting from Possible Infinite Loop [%04x]", params PC); } -void __fastcall mVUwarning1(u32 PC) { Console::Error("microVU1 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(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 mVUprintPC2(u32 PC) { Console::Write("[%04x]\n", params PC); } @@ -269,7 +269,7 @@ microVUt(void) mVUtestCycles(mV) { SUB32ItoM((uptr)&mVU->cycles, mVUcycles); if (IsDevBuild || !isVU1) { u32* jmp32 = JG32(0); - MOV32ItoR(gprT2, xPC); + MOV32ItoR(gprT2, (uptr)mVU); if (isVU1) CALLFunc((uptr)mVUwarning1); //else CALLFunc((uptr)mVUwarning0); // VU0 is allowed early exit for COP2 Interlock Simulation MOV32ItoR(gprR, Roffset); // Restore gprR