From 40bdbf9748c60f935fbe39d9a4dd0aa57dc570aa Mon Sep 17 00:00:00 2001 From: refraction Date: Thu, 15 Apr 2010 10:48:44 +0000 Subject: [PATCH] Fixes for r2853. - BIOS works again, Issue involving GIF Tag looping from the VU (which must have never worked!) - Fixed KH freeze issue, possibly fixes Onimusha 2 as well. Thx Arcum for spotting it, thanks Rama for trying to bring fast resolution to the issue (however it wasnt quite right) git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2856 96395faa-99c1-11dd-bbfe-3dabce05a288 --- pcsx2/Vif.cpp | 2 +- pcsx2/Vif_Codes.cpp | 2 +- pcsx2/Vif_Transfer.cpp | 2 +- pcsx2/ps2/GIFpath.cpp | 30 ++++++++++++++++++++++++++++-- 4 files changed, 31 insertions(+), 5 deletions(-) diff --git a/pcsx2/Vif.cpp b/pcsx2/Vif.cpp index 00611b420d..8e07d95a0f 100644 --- a/pcsx2/Vif.cpp +++ b/pcsx2/Vif.cpp @@ -23,7 +23,7 @@ vifStruct vif0; vifStruct vif1; -tGSTransferStatus GSTransferStatus = (STOPPED_MODE<<4) | (STOPPED_MODE<<2) | STOPPED_MODE; +tGSTransferStatus GSTransferStatus((STOPPED_MODE<<4) | (STOPPED_MODE<<2) | STOPPED_MODE); void vif0Init() { initNewVif(0); } void vif1Init() { initNewVif(1); } diff --git a/pcsx2/Vif_Codes.cpp b/pcsx2/Vif_Codes.cpp index 146f290e63..047c6a8194 100644 --- a/pcsx2/Vif_Codes.cpp +++ b/pcsx2/Vif_Codes.cpp @@ -115,7 +115,7 @@ template _f int _vifCode_Direct(int pass, u8* data, bool isDirectHL) { { /*if(!isDirectHL) DevCon.WriteLn("Direct: Waiting for Path3 to finish!"); else DevCon.WriteLn("DirectHL: Waiting for Path3 to finish!");*/ - + VIF_LOG("Mask %x, GIF STR %x, PTH1 %x, PTH2 %x, PTH3 %x", vif1Regs->mskpath3, gif->chcr.STR, GSTransferStatus.PTH1, GSTransferStatus.PTH2, GSTransferStatus.PTH3); vif1Regs->stat.VGW = true; // PATH3 is in image mode, so wait for end of transfer vif1.vifstalled = true; return 0; diff --git a/pcsx2/Vif_Transfer.cpp b/pcsx2/Vif_Transfer.cpp index e4c9425b59..f6d4dd56e2 100644 --- a/pcsx2/Vif_Transfer.cpp +++ b/pcsx2/Vif_Transfer.cpp @@ -72,7 +72,7 @@ _vifT void vifTransferLoop(u32* &data) { vifXRegs->code = data[0]; vifX.cmd = data[0] >> 24; iBit = data[0] >> 31; - + VIF_LOG("New VifCMD %x tagsize %x", vifX.cmd, vifX.tag.size); vifXCode[vifX.cmd & 0x7f](0, data); data++; pSize--; if (analyzeIbit(data, iBit)) break; diff --git a/pcsx2/ps2/GIFpath.cpp b/pcsx2/ps2/GIFpath.cpp index a4e53deb37..b74e08f5d0 100644 --- a/pcsx2/ps2/GIFpath.cpp +++ b/pcsx2/ps2/GIFpath.cpp @@ -337,7 +337,7 @@ __forceinline int GIFPath::ParseTag(GIF_PATH pathidx, const u8* pMem, u32 size) { const u8* vuMemEnd = pMem + (size<<4); // End of VU1 Mem if (pathidx==GIF_PATH_1) size = 0x400; // VU1 mem size - const u32 startSize = size; // Start Size + u32 startSize = size; // Start Size while (size > 0) { if (!nloop) { @@ -363,7 +363,8 @@ __forceinline int GIFPath::ParseTag(GIF_PATH pathidx, const u8* pMem, u32 size) } //} } - else { + else + { switch(tag.FLG) { case GIF_FLG_PACKED: GIF_LOG("Packed Mode"); @@ -398,7 +399,32 @@ __forceinline int GIFPath::ParseTag(GIF_PATH pathidx, const u8* pMem, u32 size) break; } } + if(pathidx == GIF_PATH_1) + { + if(nloop > 0 && size == 0 && !tag.EOP) //Need to check all of this, some cases VU will send info (like the BIOS) but be incomplete + { + switch(tag.FLG) + { + case GIF_FLG_PACKED: + size = nloop * numregs; + break; + case GIF_FLG_REGLIST: + size = (nloop * numregs) / 2; + break; + + default: + size = nloop; + break; + } + startSize += size; + if(startSize >= 0x3fff) + { + size = 0; + Console.Warning("GIFTAG error, size exceeded VU memory size"); + } + } + } if (tag.EOP && !nloop) { if (pathidx != GIF_PATH_2) { break;