From 95579258dbd543d16ca1d6216b587bbe45e803e5 Mon Sep 17 00:00:00 2001 From: cottonvibes Date: Tue, 30 Jun 2009 04:45:22 +0000 Subject: [PATCH] microVU: fixed some problems from my last revision. (fixes problems in DQ8) git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1444 96395faa-99c1-11dd-bbfe-3dabce05a288 --- pcsx2/x86/microVU.cpp | 4 ++-- pcsx2/x86/microVU_Compile.inl | 16 +++++++++------- pcsx2/x86/microVU_Misc.h | 2 +- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/pcsx2/x86/microVU.cpp b/pcsx2/x86/microVU.cpp index 59a0ea433d..45b565b533 100644 --- a/pcsx2/x86/microVU.cpp +++ b/pcsx2/x86/microVU.cpp @@ -219,8 +219,8 @@ microVUf(bool) mVUcmpPartial(int progIndex) { microVUf(bool) mVUcmpProg(int progIndex, bool progUsed, const bool cmpWholeProg) { microVU* mVU = mVUx; if (progUsed) { - if (cmpWholeProg && (!memcmp_mmx((u8*)mVUprogI.data, mVU->regs->Micro, mVU->microMemSize)) - ||(!cmpWholeProg && mVUcmpPartial(progIndex))) { + if ((cmpWholeProg && !memcmp_mmx((u8*)mVUprogI.data, mVU->regs->Micro, mVU->microMemSize)) + || (!cmpWholeProg && mVUcmpPartial(progIndex))) { mVU->prog.cur = progIndex; mVU->prog.cleared = 0; mVU->prog.isSame = cmpWholeProg ? 1 : -1; diff --git a/pcsx2/x86/microVU_Compile.inl b/pcsx2/x86/microVU_Compile.inl index b05ddbd5bf..6836109557 100644 --- a/pcsx2/x86/microVU_Compile.inl +++ b/pcsx2/x86/microVU_Compile.inl @@ -79,7 +79,7 @@ microVUt(void) mVUcheckIsSame(mV) { if (mVU->prog.isSame == -1) { - mVU->prog.isSame = !memcmp_mmx(mVUcurProg.data, mVU->regs->Micro, mVU->microMemSize); + mVU->prog.isSame = !memcmp_mmx((u8*)mVUcurProg.data, mVU->regs->Micro, mVU->microMemSize); } if (mVU->prog.isSame == 0) { if (!isVU1) mVUcacheProg<0>(mVU->prog.cur); @@ -96,6 +96,7 @@ microVUt(void) mVUsetupRange(mV, s32 pc, bool isStartPC) { && (pc <= mVUcurProg.ranges.range[i][1])) { return; } } + const u32 endMem = mVU->microMemSize-8; mVUcheckIsSame(mVU); if (isStartPC) { @@ -106,16 +107,17 @@ microVUt(void) mVUsetupRange(mV, s32 pc, bool isStartPC) { else { mVUcurProg.ranges.total = 0; mVUrange[0] = 0; - mVUrange[1] = mVU->microMemSize - 8; + mVUrange[1] = endMem; DevCon::Status("microVU%d: Prog Range List Full", params mVU->index); } } else { - if (mVUrange[1] != -1) return; if (mVUrange[0] <= pc) { mVUrange[1] = pc; for (int i = 0; i <= (mVUcurProg.ranges.total-1); i++) { - if ((mVUrange[0]-8) == mVUcurProg.ranges.range[i][1]) { + if ((mVUrange[0] == mVUcurProg.ranges.range[i][1]) + ||(((mVUrange[0]-8)&endMem) == mVUcurProg.ranges.range[i][1])) { + if (mVUcurProg.ranges.range[i][1] > pc) { continue; } mVUcurProg.ranges.range[i][1] = pc; mVUrange[0] = -1; mVUrange[1] = -1; @@ -125,7 +127,7 @@ microVUt(void) mVUsetupRange(mV, s32 pc, bool isStartPC) { } } else { - DevCon::Status("microVU%d: Prog Range Wrap", params mVU->index); + DevCon::Status("microVU%d: Prog Range Wrap [%04x] [%d]", params mVU->index, mVUrange[0], mVUrange[1]); mVUrange[1] = mVU->microMemSize - 8; if (mVUcurProg.ranges.total < mVUcurProg.ranges.max) { mVUcurProg.ranges.total++; @@ -135,7 +137,7 @@ microVUt(void) mVUsetupRange(mV, s32 pc, bool isStartPC) { else { mVUcurProg.ranges.total = 0; mVUrange[0] = 0; - mVUrange[1] = mVU->microMemSize - 8; + mVUrange[1] = endMem; DevCon::Status("microVU%d: Prog Range List Full", params mVU->index); } } @@ -477,7 +479,7 @@ microVUr(void*) mVUcompile(microVU* mVU, u32 startPC, uptr pState) { if (x == endCount) { Console::Error("microVU%d: Possible infinite compiling loop!", params mVU->index); } // E-bit End - mVUsetupRange(mVU, xPC, 0); + mVUsetupRange(mVU, xPC-8, 0); mVUendProgram(mVU, 1, xStatus, xMac, xClip); return thisPtr; } diff --git a/pcsx2/x86/microVU_Misc.h b/pcsx2/x86/microVU_Misc.h index cb252591a6..5f4d22bcf0 100644 --- a/pcsx2/x86/microVU_Misc.h +++ b/pcsx2/x86/microVU_Misc.h @@ -215,7 +215,7 @@ typedef u32 (__fastcall *mVUCall)(void*, void*); #define bSaveAddr (((xPC + (2 * 8)) & ((isVU1) ? 0x3ff8:0xff8)) / 8) #define branchAddr ((xPC + 8 + (_Imm11_ * 8)) & (mVU->microMemSize-8)) #define shufflePQ (((mVU->p) ? 0xb0 : 0xe0) | ((mVU->q) ? 0x01 : 0x04)) -#define cmpOffset(x) (&(((u8*)x)[mVUprogI.ranges.range[i][0]])) +#define cmpOffset(x) ((u8*)&(((u8*)x)[mVUprogI.ranges.range[i][0]])) #define Rmem (uptr)&mVU->regs->VI[REG_R].UL #define Roffset (uptr)&mVU->regs->VI[9].UL