From dacfe85189fa962d80659256b70b28649fa5b469 Mon Sep 17 00:00:00 2001 From: "Jake.Stine" Date: Sat, 7 Mar 2009 19:04:37 +0000 Subject: [PATCH] SPU2-X: Fixed some problems with saving/loading states, when loading from old savestate versions. Pcsx2: Small speedup for the IOP's recClearMem (used a forceinline to cure MSVC's laxidazical inlining) git-svn-id: http://pcsx2.googlecode.com/svn/trunk@714 96395faa-99c1-11dd-bbfe-3dabce05a288 --- 3rdparty/SoundTouch/SoundTouch.vcproj | 1 - pcsx2/SafeArray.h | 4 +--- pcsx2/x86/iR3000A.cpp | 32 +++++++-------------------- pcsx2/x86/iR3000A.h | 7 +++--- plugins/spu2-x/src/DllInterface.cpp | 5 ----- plugins/spu2-x/src/SaveStateSPU.cpp | 15 ------------- plugins/spu2-x/src/Spu2.cpp | 4 ---- plugins/spu2-x/src/Spu2.h | 1 - 8 files changed, 12 insertions(+), 57 deletions(-) diff --git a/3rdparty/SoundTouch/SoundTouch.vcproj b/3rdparty/SoundTouch/SoundTouch.vcproj index 9a1c83f998..08ae7e479d 100644 --- a/3rdparty/SoundTouch/SoundTouch.vcproj +++ b/3rdparty/SoundTouch/SoundTouch.vcproj @@ -43,7 +43,6 @@ BasicRuntimeChecks="3" RuntimeLibrary="1" WarningLevel="3" - DebugInformationFormat="4" /> -class SafeList : public SafeArray +class SafeList { public: static const int DefaultChunkSize = 0x80 * sizeof(T); diff --git a/pcsx2/x86/iR3000A.cpp b/pcsx2/x86/iR3000A.cpp index ca4fdad790..6a0c6af8dd 100644 --- a/pcsx2/x86/iR3000A.cpp +++ b/pcsx2/x86/iR3000A.cpp @@ -792,31 +792,8 @@ static s32 recExecuteBlock( s32 eeCycles ) return psxBreak + psxCycleEE; } -static void recClear(u32 Addr, u32 Size) -{ - u32 pc = Addr; - while (pc < Addr + Size*4) - pc += PSXREC_CLEARM(pc); -} - -// not used and not right for now -#if 0 -void rpsxMemConstClear(u32 mem) -{ - // NOTE! This assumes recLUT never changes its mapping - if( !(psxRecLUT[mem>>16] + mem) ) - return; - - CMP32ItoM((uptr)PSX_GETBLOCK(mem), iopJITCompile); - j8Ptr[6] = JE8(0); - - _callFunctionArg1((uptr)psxRecClearMem, MEM_CONSTTAG, mem); - x86SetJ8(j8Ptr[6]); -} -#endif - // Returns the offset to the next instruction after any cleared memory -u32 psxRecClearMem(u32 pc) +static __forceinline u32 psxRecClearMem(u32 pc) { BASEBLOCKEX* pexblock; BASEBLOCK* pblock; @@ -885,6 +862,13 @@ u32 psxRecClearMem(u32 pc) return upperextent - pc; } +static void recClear(u32 Addr, u32 Size) +{ + u32 pc = Addr; + while (pc < Addr + Size*4) + pc += PSXREC_CLEARM(pc); +} + void psxSetBranchReg(u32 reg) { psxbranch = 1; diff --git a/pcsx2/x86/iR3000A.h b/pcsx2/x86/iR3000A.h index e5dc2f963c..7f19f1440d 100644 --- a/pcsx2/x86/iR3000A.h +++ b/pcsx2/x86/iR3000A.h @@ -67,10 +67,9 @@ extern u32 g_iopCyclePenalty; void psxSaveBranchState(); void psxLoadBranchState(); -void psxSetBranchReg(u32 reg); -void psxSetBranchImm( u32 imm ); -void psxRecompileNextInstruction(int delayslot); -u32 psxRecClearMem(u32 p); +extern void psxSetBranchReg(u32 reg); +extern void psxSetBranchImm( u32 imm ); +extern void psxRecompileNextInstruction(int delayslot); //////////////////////////////////////////////////////////////////// // IOP Constant Propagation Defines, Vars, and API - From here down! diff --git a/plugins/spu2-x/src/DllInterface.cpp b/plugins/spu2-x/src/DllInterface.cpp index 1a7a2c447f..6e55ec3101 100644 --- a/plugins/spu2-x/src/DllInterface.cpp +++ b/plugins/spu2-x/src/DllInterface.cpp @@ -151,8 +151,6 @@ EXPORT_C_(s32) SPU2init() #endif srand((unsigned)time(NULL)); - disableFreezes=false; - if (spu2init) { ConLog( " * SPU2: Already initialized - Ignoring SPU2init signal." ); @@ -448,9 +446,6 @@ EXPORT_C_(void) SPU2write(u32 rmem, u16 value) // for now, pData is not used EXPORT_C_(int) SPU2setupRecording(int start, void* pData) { - // Don't record if we have a bogus state. - if( disableFreezes ) return 0; - if(start==0) RecordStop(); else if(start==1) diff --git a/plugins/spu2-x/src/SaveStateSPU.cpp b/plugins/spu2-x/src/SaveStateSPU.cpp index abe3400990..59445df78f 100644 --- a/plugins/spu2-x/src/SaveStateSPU.cpp +++ b/plugins/spu2-x/src/SaveStateSPU.cpp @@ -61,16 +61,6 @@ typedef s32 __fastcall FreezeHandlerFunction( SPU2freezeData& data ); s32 __fastcall FreezeIt( SPU2freezeData& spud ) { - if( disableFreezes ) - { - // No point in making a save state since the SPU2 - // state is completely bogus anyway... Let's just - // give this some random ID that no one will recognize. - - strcpy( (char*)&spud, "invalid" ); - return 0; - } - spud.id = SAVE_ID; spud.version = SAVE_VERSION; @@ -125,7 +115,6 @@ s32 __fastcall ThawIt( SPU2freezeData& spud ) printf("\tAudio may not recover correctly. Save your game to memorycard, reset,\n\n"); printf(" and then continue from there.\n\n"); - disableFreezes = true; resetClock = true; // Do *not* reset the cores. @@ -143,8 +132,6 @@ s32 __fastcall ThawIt( SPU2freezeData& spud ) } else { - disableFreezes=false; - // base stuff memcpy(spu2regs, spud.unkregs, 0x010000); memcpy(_spu2mem, spud.mem, 0x200000); @@ -191,8 +178,6 @@ s32 __fastcall ThawIt( SPU2freezeData& spud ) s32 __fastcall SizeIt() { - if( disableFreezes ) return 8; // length of the string id "invalid" (plus a zero!) - int size = sizeof(SPU2freezeData); // calculate the amount of memory consumed by our cache: diff --git a/plugins/spu2-x/src/Spu2.cpp b/plugins/spu2-x/src/Spu2.cpp index 7c74d399b0..0deae90f3a 100644 --- a/plugins/spu2-x/src/Spu2.cpp +++ b/plugins/spu2-x/src/Spu2.cpp @@ -39,10 +39,6 @@ DWORD CALLBACK TimeThread(PVOID /* unused param */); // [Air]: fixed the hacky part of UpdateTimer with this: bool resetClock = true; -// Used to make spu2 more robust at loading incompatible saves. -// Disables re-freezing of save state data. -bool disableFreezes = false; - void (* _irqcallback)(); void (* dma4callback)(); void (* dma7callback)(); diff --git a/plugins/spu2-x/src/Spu2.h b/plugins/spu2-x/src/Spu2.h index f98dc1b258..b347a28484 100644 --- a/plugins/spu2-x/src/Spu2.h +++ b/plugins/spu2-x/src/Spu2.h @@ -170,7 +170,6 @@ extern u32 input_data_ptr; extern int PlayMode; extern int recording; -extern bool disableFreezes; extern u32 lClocks; extern u32* cPtr;