From 46800c97a00c1e6b065c70a9b011984b7f9c947d Mon Sep 17 00:00:00 2001 From: "Jake.Stine" Date: Wed, 23 Jun 2010 12:33:57 +0000 Subject: [PATCH] Add missing GIF Path buffers to the savestate (untested code); buddy commit to the prev version upgrade -- just a few mins late. ;) git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3281 96395faa-99c1-11dd-bbfe-3dabce05a288 --- pcsx2/Gif.cpp | 21 ++++++++++++++++++++- pcsx2/x86/microVU_Lower.inl | 4 ++-- pcsx2/x86/sVU_Lower.cpp | 2 ++ 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/pcsx2/Gif.cpp b/pcsx2/Gif.cpp index d719fa3f4a..5a61590324 100644 --- a/pcsx2/Gif.cpp +++ b/pcsx2/Gif.cpp @@ -66,12 +66,13 @@ void gsPath1Interrupt() gifRegs->stat.APATH = GIF_APATH1; memcpy_aligned(pDest, Path1Buffer + (Path1ReadPos * 16), size*16); GetMTGS().SendDataPacket(); + Registers::Thaw(); + Path1ReadPos += size; if(Path1ReadPos == Path1WritePos) { Path1WritePos = Path1ReadPos = 0; } - Registers::Thaw(); CPU_INT(28, 16); //Should be size * BIAS (probably) but Tony Hawk doesnt like this, probably to do with vif flush stalling } else @@ -680,4 +681,22 @@ void SaveStateBase::gifFreeze() Freeze( gscycles ); //Freeze(gifempty); // Note: mfifocycles is not a persistent var, so no need to save it here. + + int bufsize = Path1WritePos - Path1ReadPos; + Freeze(bufsize); + + if (IsSaving()) + { + // We can just load the queued Path1 data into the front of the buffer, and + // reset the ReadPos and WritePos accordingly. + FreezeMem(Path1Buffer, bufsize); + Path1ReadPos = 0; + Path1WritePos = bufsize; + } + else + { + // Only want to save the actual Path1 data between readpos and writepos. The + // rest of the buffer is just unused-ness! + FreezeMem(&Path1Buffer[Path1ReadPos], bufsize); + } } diff --git a/pcsx2/x86/microVU_Lower.inl b/pcsx2/x86/microVU_Lower.inl index 4732609a8f..c5e861ae09 100644 --- a/pcsx2/x86/microVU_Lower.inl +++ b/pcsx2/x86/microVU_Lower.inl @@ -1134,9 +1134,9 @@ void __fastcall mVU_XGKICK_(u32 addr) { size = GIFPath_ParseTag(GIF_PATH_1, data, diff, true); pDest = &Path1Buffer[Path1WritePos*16]; - - + pxAssumeMsg((Path1WritePos+size < sizeof(Path1Buffer)), "XGKick Buffer Overflow detected on Path1Buffer!"); //DevCon.Warning("Storing size %x PATH 1", size); + if (size > diff) { // fixme: one of these days the following *16's will get cleaned up when we introduce // a special qwc/simd16 optimized version of memcpy_aligned. :) diff --git a/pcsx2/x86/sVU_Lower.cpp b/pcsx2/x86/sVU_Lower.cpp index 75df90e0ad..c256f43d8f 100644 --- a/pcsx2/x86/sVU_Lower.cpp +++ b/pcsx2/x86/sVU_Lower.cpp @@ -1998,6 +1998,8 @@ void __fastcall VU1XGKICK_MTGSTransfer(u32 *pMem, u32 addr) } else { + pxAssumeMsg((Path1WritePos+size < sizeof(Path1Buffer)), "XGKick Buffer Overflow detected on Path1Buffer!"); + //DevCon.Warning("GIF APATH busy %x Holding for later W %x, R %x", gifRegs->stat.APATH, Path1WritePos, Path1ReadPos); size = GIFPath_ParseTag(GIF_PATH_1, data, diff, true); pDest = &Path1Buffer[Path1WritePos*16];