From 9adf6858c17bde78d67fba8e9e3b7535461dbeb2 Mon Sep 17 00:00:00 2001 From: cottonvibes Date: Fri, 28 Aug 2009 04:27:14 +0000 Subject: [PATCH] microVU: Made the flaghack safer by accounting for some problematic case. It fixes the few games I have that were having problems with the flaghack (but the speedup the flaghack offered in those games has been lessened). The speedup on games that weren't having problems before should be around the same as before; (in other words: games that were compatible with the hack should still be as fast as before, and games that had problems with the hack will probably be fixed but the speedhack won't do as-much) git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1694 96395faa-99c1-11dd-bbfe-3dabce05a288 --- pcsx2/x86/microVU_Flags.inl | 4 +++- pcsx2/x86/microVU_Upper.inl | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pcsx2/x86/microVU_Flags.inl b/pcsx2/x86/microVU_Flags.inl index 2191f8cf17..dd9ccfcb68 100644 --- a/pcsx2/x86/microVU_Flags.inl +++ b/pcsx2/x86/microVU_Flags.inl @@ -74,7 +74,8 @@ int sortFlag(int* fFlag, int* bFlag, int cycles) { return x; // Returns the number of Valid Flag Instances } -#define sFlagCond ((sFLAG.doFlag && !mVUsFlagHack) || mVUlow.isFSSET || mVUinfo.doDivFlag) +#define sFlagCond (sFLAG.doFlag || mVUlow.isFSSET || mVUinfo.doDivFlag) +#define sHackCond (mVUsFlagHack && !sFLAG.doNonSticky) // Note: Flag handling is 'very' complex, it requires full knowledge of how microVU recs work, so don't touch! microVUt(void) mVUsetFlags(mV, microFlagCycles& mFC) { @@ -143,6 +144,7 @@ microVUt(void) mVUsetFlags(mV, microFlagCycles& mFC) { mFLAG.lastWrite = (xM-1) & 3; cFLAG.lastWrite = (xC-1) & 3; + if (sHackCond) { sFLAG.doFlag = 0; } if (sFlagCond) { mFC.xStatus[xS] = mFC.cycles + 4; xS = (xS+1) & 3; } if (mFLAG.doFlag) { mFC.xMac [xM] = mFC.cycles + 4; xM = (xM+1) & 3; } if (cFLAG.doFlag) { mFC.xClip [xC] = mFC.cycles + 4; xC = (xC+1) & 3; } diff --git a/pcsx2/x86/microVU_Upper.inl b/pcsx2/x86/microVU_Upper.inl index 9d0d074f14..b8f5627f3e 100644 --- a/pcsx2/x86/microVU_Upper.inl +++ b/pcsx2/x86/microVU_Upper.inl @@ -32,7 +32,6 @@ microVUt(void) mVUupdateFlags(mV, int reg, int regT1 = -1, int regT2 = -1, bool static const u16 flipMask[16] = {0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15}; //SysPrintf("Status = %d; Mac = %d\n", sFLAG.doFlag, mFLAG.doFlag); - if (mVUsFlagHack) { sFLAG.doFlag = 0; } if (!sFLAG.doFlag && !mFLAG.doFlag) { return; } if ((mFLAG.doFlag && !(_XYZW_SS && modXYZW))) { if (regT2 < 0) { regT2 = mVU->regAlloc->allocReg(); regT2b = 1; }