From 6212789a96bd760a8875cec2cd20d0d6daa604ae Mon Sep 17 00:00:00 2001 From: cottonvibes Date: Thu, 18 Mar 2010 23:17:42 +0000 Subject: [PATCH] Vif: - A small optimization from my r2732 fix. - Enabled some code for some questionable vifcode MARK behavior. Prints to console if the case happens since unsure if its correct. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2736 96395faa-99c1-11dd-bbfe-3dabce05a288 --- pcsx2/Vif_Transfer.cpp | 19 ++++++++++++------- pcsx2/x86/newVif_Dynarec.cpp | 4 ++-- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/pcsx2/Vif_Transfer.cpp b/pcsx2/Vif_Transfer.cpp index b639ad7eb3..794a90518d 100644 --- a/pcsx2/Vif_Transfer.cpp +++ b/pcsx2/Vif_Transfer.cpp @@ -22,13 +22,13 @@ // VifCode Transfer Interpreter (Vif0/Vif1) //------------------------------------------------------------------ -// Runs the next vifCode if its the Mark command -_vifT void runMark(u32* &data) { +// Doesn't stall if the next vifCode is the Mark command +_vifT bool runMark(u32* &data) { if (vifX.vifpacketsize && (((data[0]>>24)&0x7f)==7)) { - vifX.vifpacketsize--; - vifXCode[7](0, data++); - DevCon.WriteLn("Vif%d: Running Mark on I-bit", idx); + Console.WriteLn("Vif%d: Running Mark after I-bit", idx); + return 0; // No Stall? } + return 1; // Stall } // Returns 1 if i-bit && finished vifcode && i-bit not masked @@ -37,9 +37,14 @@ _vifT bool analyzeIbit(u32* &data, int iBit) { //DevCon.WriteLn("Vif I-Bit IRQ"); vifX.irq++; // On i-bit, the command is run, vif stalls etc, - // however if the vifcode is MASK, you do NOT stall, just send IRQ. - Max Payne shows this up. + // however if the vifcode is MARK, you do NOT stall, just send IRQ. - Max Payne shows this up. if((vifX.cmd & 0x7f) == 0x7) return 0; - else return 1; + + // If we have a vifcode with i-bit, the following instruction + // should stall unless its MARK?.. we test that case here... + // Not 100% sure if this is the correct behavior, so printing + // a console message to see games that use this. (cottonvibes) + return runMark(data); } return 0; } diff --git a/pcsx2/x86/newVif_Dynarec.cpp b/pcsx2/x86/newVif_Dynarec.cpp index 6f57d6d237..3d59bf36e0 100644 --- a/pcsx2/x86/newVif_Dynarec.cpp +++ b/pcsx2/x86/newVif_Dynarec.cpp @@ -57,8 +57,8 @@ _f void VifUnpackSSE_Dynarec::SetMasks(int cS) const { u32 m3 = (m1>>1) & ~m0; u32* row = (v.idx) ? g_vifmask.Row1 : g_vifmask.Row0; u32* col = (v.idx) ? g_vifmask.Col1 : g_vifmask.Col0; - if (isFill||(m2&&doMask)||doMode) { xMOVAPS(xmmRow, ptr32[row]); } - if (isFill||(m3&&doMask)) { + if((m2&&(doMask||isFill))||doMode) { xMOVAPS(xmmRow, ptr32[row]); } + if (m3&&(doMask||isFill)) { xMOVAPS(xmmCol0, ptr32[col]); if ((cS>=2) && (m3&0x0000ff00)) xPSHUF.D(xmmCol1, xmmCol0, _v1); if ((cS>=3) && (m3&0x00ff0000)) xPSHUF.D(xmmCol2, xmmCol0, _v2);