From aedf28726cb7979afe55606416f909166f88ff96 Mon Sep 17 00:00:00 2001 From: cottonvibes Date: Sat, 25 Jul 2009 02:38:09 +0000 Subject: [PATCH] microVU: Setting VU clamp mode to "normal" should fix sps/problems in alot of games now. I'll list what I think should be fixed: Dawn of Mana SPS <- Should be fixed, untested ToTa Characters <- Should be fixed, untested FFXII SPS in Barheim Passage <- Should be fixed, untested KH1 floor bug <- Fixed for me, but theres still other sps on characters caused by something else Most-likely SPS in some other games is fixed as well... If anyone can confirm the games I listed are fixed, please leave a comment :D git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1568 96395faa-99c1-11dd-bbfe-3dabce05a288 --- pcsx2/x86/microVU_Lower.inl | 4 ++-- pcsx2/x86/microVU_Misc.inl | 34 ++++++++++++++++++---------------- pcsx2/x86/microVU_Upper.inl | 3 +++ 3 files changed, 23 insertions(+), 18 deletions(-) diff --git a/pcsx2/x86/microVU_Lower.inl b/pcsx2/x86/microVU_Lower.inl index 7bd2cdd09f..4ca15ed320 100644 --- a/pcsx2/x86/microVU_Lower.inl +++ b/pcsx2/x86/microVU_Lower.inl @@ -68,7 +68,7 @@ mVUop(mVU_DIV) { x86SetJ8(cjmp); MOV32ItoM((uptr)&mVU->divFlag, 0); // Clear I/D flags SSE_DIVSS_XMM_to_XMM(xmmFs, xmmFt); - if (CHECK_VU_OVERFLOW) mVUclamp1(xmmFs, xmmFt, 8); + mVUclamp1(xmmFs, xmmFt, 8); x86SetJ8(djmp); if (mVUinfo.writeQ) SSE2_PSHUFD_XMM_to_XMM(xmmPQ, xmmPQ, 0xe1); @@ -124,7 +124,7 @@ mVUop(mVU_RSQRT) { djmp = JMP8(0); x86SetJ8(ajmp); SSE_DIVSS_XMM_to_XMM(xmmFs, xmmFt); - if (CHECK_VU_OVERFLOW) mVUclamp1(xmmFs, xmmFt, 8); + mVUclamp1(xmmFs, xmmFt, 8); x86SetJ8(djmp); if (mVUinfo.writeQ) SSE2_PSHUFD_XMM_to_XMM(xmmPQ, xmmPQ, 0xe1); diff --git a/pcsx2/x86/microVU_Misc.inl b/pcsx2/x86/microVU_Misc.inl index 42a7e5b077..73c762d45b 100644 --- a/pcsx2/x86/microVU_Misc.inl +++ b/pcsx2/x86/microVU_Misc.inl @@ -24,15 +24,17 @@ // Used for Result Clamping void mVUclamp1(int reg, int regT1, int xyzw) { - switch (xyzw) { - case 1: case 2: case 4: case 8: - SSE_MINSS_M32_to_XMM(reg, (uptr)mVU_maxvals); - SSE_MAXSS_M32_to_XMM(reg, (uptr)mVU_minvals); - break; - default: - SSE_MINPS_M128_to_XMM(reg, (uptr)mVU_maxvals); - SSE_MAXPS_M128_to_XMM(reg, (uptr)mVU_minvals); - break; + if (CHECK_VU_OVERFLOW) { + switch (xyzw) { + case 1: case 2: case 4: case 8: + SSE_MINSS_M32_to_XMM(reg, (uptr)mVU_maxvals); + SSE_MAXSS_M32_to_XMM(reg, (uptr)mVU_minvals); + break; + default: + SSE_MINPS_M128_to_XMM(reg, (uptr)mVU_maxvals); + SSE_MAXPS_M128_to_XMM(reg, (uptr)mVU_minvals); + break; + } } } @@ -41,18 +43,18 @@ void mVUclamp2(int reg, int regT1, int xyzw) { if (CHECK_VU_SIGN_OVERFLOW) { switch (xyzw) { case 1: case 2: case 4: case 8: - SSE_MOVSS_XMM_to_XMM(regT1, reg); + SSE_MOVSS_XMM_to_XMM (regT1, reg); SSE_ANDPS_M128_to_XMM(regT1, (uptr)mVU_signbit); - SSE_MINSS_M32_to_XMM(reg, (uptr)mVU_maxvals); - SSE_MAXSS_M32_to_XMM(reg, (uptr)mVU_minvals); - SSE_ORPS_XMM_to_XMM(reg, regT1); + SSE_MINSS_M32_to_XMM (reg, (uptr)mVU_maxvals); + SSE_MAXSS_M32_to_XMM (reg, (uptr)mVU_minvals); + SSE_ORPS_XMM_to_XMM (reg, regT1); break; default: SSE_MOVAPS_XMM_to_XMM(regT1, reg); SSE_ANDPS_M128_to_XMM(regT1, (uptr)mVU_signbit); - SSE_MINPS_M128_to_XMM(reg, (uptr)mVU_maxvals); - SSE_MAXPS_M128_to_XMM(reg, (uptr)mVU_minvals); - SSE_ORPS_XMM_to_XMM(reg, regT1); + SSE_MINPS_M128_to_XMM(reg, (uptr)mVU_maxvals); + SSE_MAXPS_M128_to_XMM(reg, (uptr)mVU_minvals); + SSE_ORPS_XMM_to_XMM (reg, regT1); break; } } diff --git a/pcsx2/x86/microVU_Upper.inl b/pcsx2/x86/microVU_Upper.inl index 4d93e77f1a..bc7e56cf86 100644 --- a/pcsx2/x86/microVU_Upper.inl +++ b/pcsx2/x86/microVU_Upper.inl @@ -148,6 +148,7 @@ void mVU_FMACa(microVU* mVU, int recPass, int opCase, int opType, bool isACC, co opCase1 { if (_XYZW_SS && _X_Y_Z_W != 8) { SSE2_PSHUFD_XMM_to_XMM(Ft, Ft, shuffleSS(_X_Y_Z_W)); } } opCase2 { if (_XYZW_SS && (!_bc_x)) { SSE2_PSHUFD_XMM_to_XMM(Ft, Ft, shuffleSS((1 << (3 - _bc_)))); } } + opCase2 { if (opType == 2) { mVUclamp1(Fs, -1, _X_Y_Z_W); } } // Clamp Needed for alot of games (TOTA, DoM, etc...) if (_XYZW_SS) SSE_SS[opType](mVU, Fs, Ft, -1, -1); else SSE_PS[opType](mVU, Fs, Ft, -1, -1); @@ -186,6 +187,7 @@ void mVU_FMACb(microVU* mVU, int recPass, int opCase, int opType, const char* op if (_XYZW_SS && _X_Y_Z_W != 8) { SSE2_PSHUFD_XMM_to_XMM(ACC, ACC, shuffleSS(_X_Y_Z_W)); } opCase1 { if (_XYZW_SS && _X_Y_Z_W != 8) { SSE2_PSHUFD_XMM_to_XMM(Ft, Ft, shuffleSS(_X_Y_Z_W)); } } opCase2 { if (_XYZW_SS && (!_bc_x)) { SSE2_PSHUFD_XMM_to_XMM(Ft, Ft, shuffleSS((1 << (3 - _bc_)))); } } + opCase2 { if (opType == 2) { mVUclamp1(Fs, -1, _X_Y_Z_W); } } // Clamp Needed for alot of games (TOTA, DoM, etc...) if (_XYZW_SS) SSE_SS[2](mVU, Fs, Ft, -1, -1); else SSE_PS[2](mVU, Fs, Ft, -1, -1); @@ -230,6 +232,7 @@ void mVU_FMACc(microVU* mVU, int recPass, int opCase, const char* opName) { if (_XYZW_SS && _X_Y_Z_W != 8) { SSE2_PSHUFD_XMM_to_XMM(ACC, ACC, shuffleSS(_X_Y_Z_W)); } opCase1 { if (_XYZW_SS && _X_Y_Z_W != 8) { SSE2_PSHUFD_XMM_to_XMM(Ft, Ft, shuffleSS(_X_Y_Z_W)); } } opCase2 { if (_XYZW_SS && (!_bc_x)) { SSE2_PSHUFD_XMM_to_XMM(Ft, Ft, shuffleSS((1 << (3 - _bc_)))); } } + opCase2 { mVUclamp1(Fs, -1, _X_Y_Z_W); } // Clamp Needed for alot of games (TOTA, DoM, etc...) if (_XYZW_SS) { SSE_SS[2](mVU, Fs, Ft, -1, -1); SSE_SS[0](mVU, Fs, ACC, -1, -1); } else { SSE_PS[2](mVU, Fs, Ft, -1, -1); SSE_PS[0](mVU, Fs, ACC, -1, -1); }