From d87d13e155528d53c81e7f9a6ee036ea9d543d74 Mon Sep 17 00:00:00 2001 From: refraction Date: Thu, 11 Nov 2010 21:48:55 +0000 Subject: [PATCH] -Fix for killzone. -Did same code for VIF0 just to standardize things a little. If this breaks anything let me know, and make sure it is this revision please. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4013 96395faa-99c1-11dd-bbfe-3dabce05a288 --- pcsx2/Vif0_Dma.cpp | 31 +++++++++++++++++++++++++------ pcsx2/Vif1_Dma.cpp | 10 ++++++---- pcsx2/Vif_Transfer.cpp | 11 +++++++---- 3 files changed, 38 insertions(+), 14 deletions(-) diff --git a/pcsx2/Vif0_Dma.cpp b/pcsx2/Vif0_Dma.cpp index b0a39138fe..fc5fed0682 100644 --- a/pcsx2/Vif0_Dma.cpp +++ b/pcsx2/Vif0_Dma.cpp @@ -107,17 +107,36 @@ __fi void vif0SetupTransfer() if (vif0ch.chcr.TTE) { + // Transfer dma tag if tte is set + bool ret; - if (vif0.vifstalled) - ret = VIF0transfer((u32*)ptag + (2 + vif0.irqoffset), 2 - vif0.irqoffset); //Transfer Tag on stall - else - ret = VIF0transfer((u32*)ptag + 2, 2); //Transfer Tag + static __aligned16 u128 masked_tag; - if ((ret == false) && vif0.irqoffset < 2) + masked_tag._u64[0] = 0; + masked_tag._u64[1] = *((u64*)ptag + 1); + + VIF_LOG("\tVIF0 SrcChain TTE=1, data = 0x%08x.%08x", masked_tag._u32[3], masked_tag._u32[2]); + + if (vif0.vifstalled) + { + ret = VIF0transfer((u32*)&masked_tag + vif0.irqoffset, 4 - vif0.irqoffset, true); //Transfer Tag on stall + //ret = VIF0transfer((u32*)ptag + (2 + vif0.irqoffset), 2 - vif0.irqoffset); //Transfer Tag on stall + } + else + { + //Some games (like killzone) do Tags mid unpack, the nops will just write blank data + //to the VU's, which breaks stuff, this is where the 128bit packet will fail, so we ignore the first 2 words + vif0.irqoffset = 2; + ret = VIF0transfer((u32*)&masked_tag + 2, 2, true); //Transfer Tag + //ret = VIF0transfer((u32*)ptag + 2, 2); //Transfer Tag + } + + if (!ret && vif0.irqoffset) { vif0.inprogress = 0; //Better clear this so it has to do it again (Jak 1) - return; //There has been an error or an interrupt + return; //IRQ set by VIFTransfer + } } diff --git a/pcsx2/Vif1_Dma.cpp b/pcsx2/Vif1_Dma.cpp index d15c3bd56b..4cf76447ae 100644 --- a/pcsx2/Vif1_Dma.cpp +++ b/pcsx2/Vif1_Dma.cpp @@ -205,7 +205,7 @@ __fi void vif1SetupTransfer() bool ret; static __aligned16 u128 masked_tag; - + masked_tag._u64[0] = 0; masked_tag._u64[1] = *((u64*)ptag + 1); @@ -218,7 +218,10 @@ __fi void vif1SetupTransfer() } else { - ret = VIF1transfer((u32*)&masked_tag, 4, true); //Transfer Tag + //Some games (like killzone) do Tags mid unpack, the nops will just write blank data + //to the VU's, which breaks stuff, this is where the 128bit packet will fail, so we ignore the first 2 words + vif1.irqoffset = 2; + ret = VIF1transfer((u32*)&masked_tag + 2, 2, true); //Transfer Tag //ret = VIF1transfer((u32*)ptag + 2, 2); //Transfer Tag } @@ -226,8 +229,7 @@ __fi void vif1SetupTransfer() { vif1.inprogress &= ~1; //Better clear this so it has to do it again (Jak 1) return; //IRQ set by VIFTransfer - - } //else vif1.vifstalled = false; + } } vif1.irqoffset = 0; diff --git a/pcsx2/Vif_Transfer.cpp b/pcsx2/Vif_Transfer.cpp index 9029248130..0aabd1f675 100644 --- a/pcsx2/Vif_Transfer.cpp +++ b/pcsx2/Vif_Transfer.cpp @@ -112,7 +112,7 @@ _vifT static __fi bool vifTransfer(u32 *data, int size, bool TTE) { vifStruct& vifX = GetVifX; // irqoffset necessary to add up the right qws, or else will spin (spiderman) - int transferred = vifX.vifstalled ? vifX.irqoffset : 0; + int transferred = vifX.irqoffset; vifX.irqoffset = 0; vifX.vifstalled = false; @@ -146,17 +146,20 @@ _vifT static __fi bool vifTransfer(u32 *data, int size, bool TTE) { vifXch.madr +=(transferred << 4); vifXch.qwc -= transferred; } - if (!vifXch.qwc && !vifX.irqoffset) vifX.inprogress &= ~0x1; + + if (!vifXch.qwc && !vifX.irqoffset) + { + vifX.inprogress &= ~0x1; + vifX.vifstalled = false; + } if (vifX.irq && vifX.cmd == 0) { //DevCon.WriteLn("Vif IRQ!"); if(((vifXRegs.code >> 24) & 0x7f) != 0x7) { - vifX.vifstalled = true; vifXRegs.stat.VIS = true; // Note: commenting this out fixes WALL-E? } - if (!vifXch.qwc && !vifX.irqoffset) vifX.inprogress &= ~1; return false; }