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
This commit is contained in:
Jake.Stine 2009-03-07 19:04:37 +00:00
parent e88cf84e9c
commit dacfe85189
8 changed files with 12 additions and 57 deletions

View File

@ -43,7 +43,6 @@
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="1" RuntimeLibrary="1"
WarningLevel="3" WarningLevel="3"
DebugInformationFormat="4"
/> />
<Tool <Tool
Name="VCManagedResourceCompilerTool" Name="VCManagedResourceCompilerTool"

View File

@ -19,8 +19,6 @@
#ifndef __SAFEARRAY_H__ #ifndef __SAFEARRAY_H__
#define __SAFEARRAY_H__ #define __SAFEARRAY_H__
#include "System.h"
extern void* __fastcall pcsx2_aligned_malloc(size_t size, size_t align); extern void* __fastcall pcsx2_aligned_malloc(size_t size, size_t align);
extern void* __fastcall pcsx2_aligned_realloc(void* handle, size_t size, size_t align); extern void* __fastcall pcsx2_aligned_realloc(void* handle, size_t size, size_t align);
extern void pcsx2_aligned_free(void* pmem); extern void pcsx2_aligned_free(void* pmem);
@ -202,7 +200,7 @@ protected:
// //
// //
template< typename T > template< typename T >
class SafeList : public SafeArray<T> class SafeList
{ {
public: public:
static const int DefaultChunkSize = 0x80 * sizeof(T); static const int DefaultChunkSize = 0x80 * sizeof(T);

View File

@ -792,31 +792,8 @@ static s32 recExecuteBlock( s32 eeCycles )
return psxBreak + psxCycleEE; 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 // Returns the offset to the next instruction after any cleared memory
u32 psxRecClearMem(u32 pc) static __forceinline u32 psxRecClearMem(u32 pc)
{ {
BASEBLOCKEX* pexblock; BASEBLOCKEX* pexblock;
BASEBLOCK* pblock; BASEBLOCK* pblock;
@ -885,6 +862,13 @@ u32 psxRecClearMem(u32 pc)
return upperextent - 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) void psxSetBranchReg(u32 reg)
{ {
psxbranch = 1; psxbranch = 1;

View File

@ -67,10 +67,9 @@ extern u32 g_iopCyclePenalty;
void psxSaveBranchState(); void psxSaveBranchState();
void psxLoadBranchState(); void psxLoadBranchState();
void psxSetBranchReg(u32 reg); extern void psxSetBranchReg(u32 reg);
void psxSetBranchImm( u32 imm ); extern void psxSetBranchImm( u32 imm );
void psxRecompileNextInstruction(int delayslot); extern void psxRecompileNextInstruction(int delayslot);
u32 psxRecClearMem(u32 p);
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// IOP Constant Propagation Defines, Vars, and API - From here down! // IOP Constant Propagation Defines, Vars, and API - From here down!

View File

@ -151,8 +151,6 @@ EXPORT_C_(s32) SPU2init()
#endif #endif
srand((unsigned)time(NULL)); srand((unsigned)time(NULL));
disableFreezes=false;
if (spu2init) if (spu2init)
{ {
ConLog( " * SPU2: Already initialized - Ignoring SPU2init signal." ); 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 // for now, pData is not used
EXPORT_C_(int) SPU2setupRecording(int start, void* pData) EXPORT_C_(int) SPU2setupRecording(int start, void* pData)
{ {
// Don't record if we have a bogus state.
if( disableFreezes ) return 0;
if(start==0) if(start==0)
RecordStop(); RecordStop();
else if(start==1) else if(start==1)

View File

@ -61,16 +61,6 @@ typedef s32 __fastcall FreezeHandlerFunction( SPU2freezeData& data );
s32 __fastcall FreezeIt( SPU2freezeData& spud ) 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.id = SAVE_ID;
spud.version = SAVE_VERSION; 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("\tAudio may not recover correctly. Save your game to memorycard, reset,\n\n");
printf(" and then continue from there.\n\n"); printf(" and then continue from there.\n\n");
disableFreezes = true;
resetClock = true; resetClock = true;
// Do *not* reset the cores. // Do *not* reset the cores.
@ -143,8 +132,6 @@ s32 __fastcall ThawIt( SPU2freezeData& spud )
} }
else else
{ {
disableFreezes=false;
// base stuff // base stuff
memcpy(spu2regs, spud.unkregs, 0x010000); memcpy(spu2regs, spud.unkregs, 0x010000);
memcpy(_spu2mem, spud.mem, 0x200000); memcpy(_spu2mem, spud.mem, 0x200000);
@ -191,8 +178,6 @@ s32 __fastcall ThawIt( SPU2freezeData& spud )
s32 __fastcall SizeIt() s32 __fastcall SizeIt()
{ {
if( disableFreezes ) return 8; // length of the string id "invalid" (plus a zero!)
int size = sizeof(SPU2freezeData); int size = sizeof(SPU2freezeData);
// calculate the amount of memory consumed by our cache: // calculate the amount of memory consumed by our cache:

View File

@ -39,10 +39,6 @@ DWORD CALLBACK TimeThread(PVOID /* unused param */);
// [Air]: fixed the hacky part of UpdateTimer with this: // [Air]: fixed the hacky part of UpdateTimer with this:
bool resetClock = true; 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 (* _irqcallback)();
void (* dma4callback)(); void (* dma4callback)();
void (* dma7callback)(); void (* dma7callback)();

View File

@ -170,7 +170,6 @@ extern u32 input_data_ptr;
extern int PlayMode; extern int PlayMode;
extern int recording; extern int recording;
extern bool disableFreezes;
extern u32 lClocks; extern u32 lClocks;
extern u32* cPtr; extern u32* cPtr;