From 68de5228a84eb5b315d76d4d16edac2e8a1f51c8 Mon Sep 17 00:00:00 2001 From: refractionpcsx2 Date: Wed, 12 Aug 2015 02:16:23 +0100 Subject: [PATCH] GIF Unit: Stop multiple fires of FINISH IRQ's - Fixes Indiecar Series 2005. - Savestate bump was required, sorry, not sorry :P --- pcsx2/GS.cpp | 5 ++++- pcsx2/Gif_Unit.cpp | 4 +++- pcsx2/Gif_Unit.h | 8 ++++++++ pcsx2/SaveState.h | 2 +- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/pcsx2/GS.cpp b/pcsx2/GS.cpp index e63b166c22..620c6c5c04 100644 --- a/pcsx2/GS.cpp +++ b/pcsx2/GS.cpp @@ -108,7 +108,10 @@ static __fi void gsCSRwrite( const tGS_CSR& csr ) gifUnit.Execute(false, true); // Resume paused transfers } - if(csr.FINISH) CSRreg.FINISH = false; + if (csr.FINISH) { + CSRreg.FINISH = false; + gifUnit.gsFINISH.gsFINISHFired = false; //Clear the previously fired FINISH (YS, Indiecar 2005, MGS3) + } if(csr.HSINT) CSRreg.HSINT = false; if(csr.VSINT) CSRreg.VSINT = false; if(csr.EDWINT) CSRreg.EDWINT = false; diff --git a/pcsx2/Gif_Unit.cpp b/pcsx2/Gif_Unit.cpp index 94f74c9fac..d46a5fa4ec 100644 --- a/pcsx2/Gif_Unit.cpp +++ b/pcsx2/Gif_Unit.cpp @@ -97,8 +97,9 @@ bool Gif_HandlerAD_Debug(u8* pMem) { } void Gif_FinishIRQ() { - if (CSRreg.FINISH && !(GSIMR&0x200)) { + if (CSRreg.FINISH && !(GSIMR & 0x200) && gifUnit.gsFINISH.gsFINISHFired == false) { gsIrq(); + gifUnit.gsFINISH.gsFINISHFired = true; } } @@ -163,6 +164,7 @@ void SaveStateBase::gifFreeze() { Freeze(mtvuMode); Freeze(gifUnit.stat); Freeze(gifUnit.gsSIGNAL); + Freeze(gifUnit.gsFINISH); Freeze(gifUnit.lastTranType); gifPathFreeze(GIF_PATH_1); gifPathFreeze(GIF_PATH_2); diff --git a/pcsx2/Gif_Unit.h b/pcsx2/Gif_Unit.h index 43cd170cf8..8846b9d5a5 100644 --- a/pcsx2/Gif_Unit.h +++ b/pcsx2/Gif_Unit.h @@ -133,6 +133,12 @@ struct GS_SIGNAL { void Reset() { memzero(*this); } }; +struct GS_FINISH { + bool gsFINISHFired; + + void Reset() { memzero(*this); } +}; + static __fi void incTag(u32& offset, u32& size, u32 incAmount) { size += incAmount; offset += incAmount; @@ -413,6 +419,7 @@ struct Gif_Path { struct Gif_Unit { Gif_Path gifPath[3]; GS_SIGNAL gsSIGNAL; // Stalling Signal + GS_FINISH gsFINISH; // Finish Signal tGIF_STAT& stat; GIF_TRANSFER_TYPE lastTranType; // Last Transfer Type @@ -427,6 +434,7 @@ struct Gif_Unit { GUNIT_WARN(Color_Red, "Gif Unit Reset!!! [soft=%d]", softReset); ResetRegs(); gsSIGNAL.Reset(); + gsFINISH.Reset(); gifPath[0].Reset(softReset); gifPath[1].Reset(softReset); gifPath[2].Reset(softReset); diff --git a/pcsx2/SaveState.h b/pcsx2/SaveState.h index 45684b16e1..747708bbd6 100644 --- a/pcsx2/SaveState.h +++ b/pcsx2/SaveState.h @@ -24,7 +24,7 @@ // the lower 16 bit value. IF the change is breaking of all compatibility with old // states, increment the upper 16 bit value, and clear the lower 16 bits to 0. -static const u32 g_SaveVersion = (0x9A0A << 16) | 0x0000; +static const u32 g_SaveVersion = (0x9A0B << 16) | 0x0000; // this function is meant to be used in the place of GSfreeze, and provides a safe layer // between the GS saving function and the MTGS's needs. :)