From ef20c1a93fa445eef60267ce485b1821f366cd1a Mon Sep 17 00:00:00 2001 From: refraction Date: Thu, 18 Mar 2010 22:15:58 +0000 Subject: [PATCH] Implemented freaky VIF Unpack operation for V2 and V3 unpacks, games such as Lemmings and And1 Streetball require this to be determinate! Tested on the PS2 and it certainly is determinate. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2735 96395faa-99c1-11dd-bbfe-3dabce05a288 --- pcsx2/x86/newVif_UnpackSSE.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pcsx2/x86/newVif_UnpackSSE.cpp b/pcsx2/x86/newVif_UnpackSSE.cpp index ea479efdd2..28dbd69289 100644 --- a/pcsx2/x86/newVif_UnpackSSE.cpp +++ b/pcsx2/x86/newVif_UnpackSSE.cpp @@ -121,8 +121,14 @@ else { xPSHUF.D (destReg, workReg, _v0); } +// The V2 + V3 unpacks have freaky behaviour, the manual claims "indeterminate". +// After testing on the PS2, it's very much determinate in 99% of cases +// and games like Lemmings, And1 Streetball rely on this data to be like this! +// I have commented after each shuffle to show what data is going where - Ref + void VifUnpackSSE_Base::xUPK_V2_32() const { xMOV64 (destReg, ptr32[srcIndirect]); + xMOVH.PS (destReg, ptr32[srcIndirect]); //v1v0v1v0 } void VifUnpackSSE_Base::xUPK_V2_16() const { @@ -134,6 +140,7 @@ else { xPUNPCK.LWD(destReg, destReg); xShiftR (destReg, 16); } + xPSHUF.D (destReg, destReg, 0x44); //v1v0v1v0 } void VifUnpackSSE_Base::xUPK_V2_8() const { @@ -146,10 +153,12 @@ else { xPUNPCK.LWD(destReg, destReg); xShiftR (destReg, 24); } + xPSHUF.D (destReg, destReg, 0x44); //v1v0v1v0 } void VifUnpackSSE_Base::xUPK_V3_32() const { xMOV128 (destReg, ptr32[srcIndirect]); + xPSHUF.D (destReg, destReg, 0xA4); //v2v2v1v0 } void VifUnpackSSE_Base::xUPK_V3_16() const { @@ -161,6 +170,7 @@ else { xPUNPCK.LWD(destReg, destReg); xShiftR (destReg, 16); } + xPSHUF.D (destReg, destReg, 0xA4); //v2v2v1v0 } void VifUnpackSSE_Base::xUPK_V3_8() const { @@ -173,6 +183,7 @@ else { xPUNPCK.LWD(destReg, destReg); xShiftR (destReg, 24); } + xPSHUF.D (destReg, destReg, 0xA4); //v2v2v1v0 } void VifUnpackSSE_Base::xUPK_V4_32() const {