Skip to content

Commit

Permalink
microVU: Implement Overflow checks. Fixes Superman Returns
Browse files Browse the repository at this point in the history
Removed patches for Superman Returns
  • Loading branch information
refractionpcsx2 committed Jan 1, 2021
1 parent af89879 commit ee07f86
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 34 deletions.
34 changes: 0 additions & 34 deletions bin/GameIndex.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13405,15 +13405,6 @@ SLES-53744:
SLES-53746:
name: "Superman Returns"
region: "PAL-E"
patches:
E8F7BAB6:
content: |-
author=kozarovv
// Fix sps and various graphical issues by Using iaddiu instead of FSAND
// require preload frame data and crc hack atleast minimum for GSDX HW
patch=1,EE,00639Ef0,word,10050208
patch=1,EE,0063a068,word,10080208
patch=1,EE,0063D488,word,10020208
SLES-53747:
name: "Ed, Edd, 'n Eddy - The Misadventure"
region: "PAL-E"
Expand Down Expand Up @@ -14587,28 +14578,12 @@ SLES-54348:
SLES-54349:
name: "Superman Returns"
region: "PAL-I"
patches:
E7F7B6BD:
content: |-
author=kozarovv
// Use iaddiu instead of FSAND.
patch=1,EE,00639ef0,word,10050208
patch=1,EE,0063a068,word,10080208
SLES-54350:
name: "Superman Returns"
region: "PAL-G"
SLES-54351:
name: "Superman Returns"
region: "PAL-S"
patches:
EDF0A0A7:
content: |-
author=kozarovv
// Fix sps and various graphical issues by Using iaddiu instead of FSAND
// require preload frame data and crc hack atleast minimum for GSDX HW
patch=1,EE,00639Ef0,word,10050208
patch=1,EE,0063a068,word,10080208
patch=1,EE,0063D488,word,10020208
SLES-54354:
name: "Final Fantasy XII"
region: "PAL-E"
Expand Down Expand Up @@ -36972,15 +36947,6 @@ SLUS-21434:
name: "Superman Returns - The Video Game"
region: "NTSC-U"
compat: 4
patches:
E1BF5DCA:
content: |-
author=kozarovv
// Fix sps and various graphical issues by Using iaddiu instead of FSAND
// require preload frame data and crc hack atleast minimum for GSDX HW
patch=1,EE,00639E70,word,10050208
patch=1,EE,00639FE8,word,10080208
patch=1,EE,0063D408,word,10020208
SLUS-21435:
name: "One Piece - Grand Adventure"
region: "NTSC-U"
Expand Down
19 changes: 19 additions & 0 deletions pcsx2/x86/microVU_Upper.inl
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@
#define ADD_XYZW ((_XYZW_SS && modXYZW) ? (_X ? 3 : (_Y ? 2 : (_Z ? 1 : 0))) : 0)
#define SHIFT_XYZW(gprReg) { if (_XYZW_SS && modXYZW && !_W) { xSHL(gprReg, ADD_XYZW); } }


const __aligned16 u32 sse4_compvals[2][4] = {
{ 0x7f7fffff, 0x7f7fffff, 0x7f7fffff, 0x7f7fffff }, //1111
{ 0x7fffffff, 0x7fffffff, 0x7fffffff, 0x7fffffff }, //1111
};

// Note: If modXYZW is true, then it adjusts XYZW for Single Scalar operations
static void mVUupdateFlags(mV, const xmm& reg, const xmm& regT1in = xEmptyReg, const xmm& regT2in = xEmptyReg, bool modXYZW = 1) {
const x32& mReg = gprT1;
Expand Down Expand Up @@ -67,6 +73,19 @@ static void mVUupdateFlags(mV, const xmm& reg, const xmm& regT1in = xEmptyReg, c
if (mFLAG.doFlag) { SHIFT_XYZW(gprT2); }
xOR(mReg, gprT2);

if (sFLAG.doFlag) {
//Calculate overflow
xMOVAPS(regT1, regT2);
xAND.PS(regT1, ptr128[&sse4_compvals[1][0]]); // Remove sign flags (we don't care)
xPMIN.UD(regT1, ptr128[&sse4_compvals[0][0]]); // Get the minimum value, FLT_MAX = overflow
xCMPEQ.PS(regT1, ptr128[&sse4_compvals[0][0]]); // Compare if T1 == FLT_MAX
xMOVMSKPS(gprT2, regT1); // Grab sign bits for equal results
xAND(gprT2, AND_XYZW); // Grab "Is Zero" bits from the previous calculation
xTEST(gprT2, 0xF);
xForwardJump32 oJMP(Jcc_Zero);
xOR(sReg, 0x820000);

This comment has been minimized.

Copy link
@lightningterror

lightningterror Jan 1, 2021

Contributor

Tab...

This comment has been minimized.

Copy link
@refractionpcsx2

refractionpcsx2 Jan 1, 2021

Author Member

I tabbed it on purpose because it's in a Jump, aka an if statement.

oJMP.SetTarget();
}
//-------------------------Write back flags------------------------------

if (mFLAG.doFlag) mVUallocMFLAGb(mVU, mReg, mFLAG.write); // Set Mac Flag
Expand Down

0 comments on commit ee07f86

Please sign in to comment.