Savestate version upgrade and stability fix -- added some vars that the SPRdma might like to preserve between states, and removed some old hacky VM-related stuff while I was at it.

Fixed up the Saveslot detection somewhat (File:Load > menu now greys out unavailable saveslots).

Applied ICC fixup patch from Issue 84. :)

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@677 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
Jake.Stine 2009-03-04 13:00:32 +00:00
parent 05e3554541
commit a7fcdbaafa
15 changed files with 39 additions and 35 deletions

View File

@ -766,16 +766,6 @@ struct Freeze_v10Compat
void SaveState::cdvdFreeze() void SaveState::cdvdFreeze()
{ {
if( GetVersion() <= 0x10 )
{
// the old cdvd struct didn't save the last few items.
FreezeLegacy( cdvd, sizeof(Freeze_v10Compat) );
cdvd.SeekToSector = cdvd.Sector;
cdvd.Action = cdvdAction_None;
cdvd.ReadTime = cdvdBlockReadTime( MODE_DVDROM );
cdvd.Spinning = true;
}
else
Freeze( cdvd ); Freeze( cdvd );
if( IsLoading() ) if( IsLoading() )

View File

@ -770,8 +770,8 @@ void SaveState::rcntFreeze()
Freeze(nextCounter); Freeze(nextCounter);
Freeze(nextsCounter); Freeze(nextsCounter);
// New in version 11 -- save the PAL/NTSC info! // New in version 1 -- save the PAL/NTSC info!
if( GetVersion() > 0x10 ) if( GetVersion() >= 0x1 )
{ {
Freeze( Config.PsxType ); Freeze( Config.PsxType );
} }

View File

@ -122,6 +122,7 @@ namespace Exception
public: public:
explicit OutOfMemory( const std::string& msg="Out of memory!" ) : explicit OutOfMemory( const std::string& msg="Out of memory!" ) :
RuntimeError( msg ) {} RuntimeError( msg ) {}
virtual ~OutOfMemory() throw() {}
}; };
// This exception thrown any time an operation is attempted when an object // This exception thrown any time an operation is attempted when an object
@ -161,6 +162,7 @@ namespace Exception
public: public:
explicit HardwareDeficiency( const std::string& msg="Your machine's hardware is incapable of running Pcsx2. Sorry dood." ) : explicit HardwareDeficiency( const std::string& msg="Your machine's hardware is incapable of running Pcsx2. Sorry dood." ) :
RuntimeError( msg ) {} RuntimeError( msg ) {}
virtual ~HardwareDeficiency() throw() {}
}; };
// This exception is thrown by the PS2 emulation (R5900, etc) when bad things happen // This exception is thrown by the PS2 emulation (R5900, etc) when bad things happen

View File

@ -584,7 +584,7 @@ void gifMFIFOInterrupt()
void SaveState::gifFreeze() void SaveState::gifFreeze()
{ {
if( GetVersion() >= 0x14 ) if( GetVersion() >= 0x04 )
{ {
Freeze( gifstate ); Freeze( gifstate );
Freeze( gifqwc ); Freeze( gifqwc );

View File

@ -169,7 +169,7 @@ void ipuShutdown()
void SaveState::ipuFreeze() { void SaveState::ipuFreeze() {
IPUProcessInterrupt(); IPUProcessInterrupt();
if( GetVersion() < 0x14 ) if( GetVersion() < 0x04 )
{ {
// old versions saved the IPU regs, but they're already saved as part of HW! // old versions saved the IPU regs, but they're already saved as part of HW!
FreezeMem(ipuRegs, sizeof(IPUregisters)); FreezeMem(ipuRegs, sizeof(IPUregisters));

View File

@ -28,7 +28,7 @@
#include "Common.h" #include "Common.h"
#include "PsxCommon.h" #include "PsxCommon.h"
#include "SaveState.h" #include "HostGui.h"
#include "CDVDisodrv.h" #include "CDVDisodrv.h"
#include "VUmicro.h" #include "VUmicro.h"
@ -583,6 +583,7 @@ void ProcessFKeys(int fkey, int shift)
try try
{ {
gzSavingState( SaveState::GetFilename( StatesC ) ).FreezeAll(); gzSavingState( SaveState::GetFilename( StatesC ) ).FreezeAll();
HostGui::ResetMenuSlots();
} }
catch( Exception::BaseException& ex ) catch( Exception::BaseException& ex )
{ {

View File

@ -26,9 +26,10 @@
#define spr0 ((DMACh*)&PS2MEM_HW[0xD000]) #define spr0 ((DMACh*)&PS2MEM_HW[0xD000])
#define spr1 ((DMACh*)&PS2MEM_HW[0xD400]) #define spr1 ((DMACh*)&PS2MEM_HW[0xD400])
int spr0finished = 0; static int spr0finished = 0;
int spr1finished = 0; static int spr1finished = 0;
u32 mfifotransferred = 0; static u32 mfifotransferred = 0;
void sprInit() { void sprInit() {
} }
@ -451,3 +452,13 @@ void SPRTOinterrupt()
hwDmacIrq(9); hwDmacIrq(9);
} }
void SaveState::sprFreeze()
{
// Gotta save the weird ref-style DMA timing vars!
if( GetVersion() >= 0x05 )
{
Freeze(spr0finished);
Freeze(spr1finished);
Freeze(mfifotransferred);
}
}

View File

@ -27,7 +27,7 @@
// Savestate Versioning! // Savestate Versioning!
// If you make changes to the savestate version, please increment the value below. // If you make changes to the savestate version, please increment the value below.
static const u32 g_SaveVersion = 0x8b400004; static const u32 g_SaveVersion = 0x8b400005;
// this function is meant to be sued in the place of GSfreeze, and provides a safe layer // this function is meant to be sued in the place of GSfreeze, and provides a safe layer
// between the GS saving function and the MTGS's needs. :) // between the GS saving function and the MTGS's needs. :)
@ -52,8 +52,7 @@ public:
// The version refers to the low 16 bits only (high 16 bits classifies Pcsx2 build types) // The version refers to the low 16 bits only (high 16 bits classifies Pcsx2 build types)
u32 GetVersion() const u32 GetVersion() const
{ {
// HACK! Matches the vTLB build versions with VM return (m_version & 0xffff);
return (m_version & 0xffff) + 0x10;
} }
// Loads or saves the entire emulation state. // Loads or saves the entire emulation state.
@ -110,6 +109,7 @@ protected:
void sifFreeze(); void sifFreeze();
void ipuFreeze(); void ipuFreeze();
void gifFreeze(); void gifFreeze();
void sprFreeze();
void sioFreeze(); void sioFreeze();
void cdrFreeze(); void cdrFreeze();

View File

@ -591,7 +591,7 @@ void SaveState::sifFreeze() {
Freeze(sif0); Freeze(sif0);
Freeze(sif1); Freeze(sif1);
if( GetVersion() >= 0x0012 ) if( GetVersion() >= 0x0002 )
{ {
Freeze(eesifbusy); Freeze(eesifbusy);
Freeze(iopsifbusy); Freeze(iopsifbusy);

View File

@ -568,8 +568,8 @@ void SaveState::sioFreeze()
Freeze( sio ); Freeze( sio );
// versions prior to 13 didn't have CRCs. // versions prior to 3 didn't have CRCs.
if( GetVersion() >= 0x13 ) if( GetVersion() >= 0x03 )
{ {
if( IsSaving() ) if( IsSaving() )
{ {

View File

@ -98,7 +98,7 @@ static __forceinline void _vSourceLog( u16 protocol, u8 source, u32 cpuPc, u32 c
#ifdef PCSX2_DEVBUILD #ifdef PCSX2_DEVBUILD
#ifdef _WIN32 #ifdef _WIN32
// Send log data to the (remote?) debugger. // Send log data to the (remote?) debugger.
if (connected && logProtocol>=0 && logProtocol<0x10) if (connected && logProtocol<0x10)
{ {
sendTTYP(logProtocol, logSource, tmp); sendTTYP(logProtocol, logSource, tmp);
} }

View File

@ -169,7 +169,7 @@ void SaveState::vuMicroFreeze()
FreezeMem(VU0.Micro, 4*1024); FreezeMem(VU0.Micro, 4*1024);
Freeze(VU0.VF); Freeze(VU0.VF);
if( GetVersion() >= 0x0012 ) if( GetVersion() >= 0x02 )
Freeze(VU0.VI); Freeze(VU0.VI);
else else
{ {
@ -185,7 +185,7 @@ void SaveState::vuMicroFreeze()
FreezeMem(VU1.Micro, 16*1024); FreezeMem(VU1.Micro, 16*1024);
Freeze(VU1.VF); Freeze(VU1.VF);
if( GetVersion() >= 0x0012 ) if( GetVersion() >= 0x02 )
Freeze(VU1.VI); Freeze(VU1.VI);
else else
{ {

View File

@ -55,8 +55,8 @@ extern vifStruct *_vif;
vifStruct vif0, vif1; vifStruct vif0, vif1;
PCSX2_ALIGNED16(u32 g_vif1Masks[64]); static PCSX2_ALIGNED16(u32 g_vif1Masks[64]);
PCSX2_ALIGNED16(u32 g_vif0Masks[64]); static PCSX2_ALIGNED16(u32 g_vif0Masks[64]);
u32 g_vif1HasMask3[4] = {0}, g_vif0HasMask3[4] = {0}; u32 g_vif1HasMask3[4] = {0}, g_vif0HasMask3[4] = {0};
// Generic constants // Generic constants
@ -1338,11 +1338,11 @@ void vif0Reset() {
void SaveState::vif0Freeze() void SaveState::vif0Freeze()
{ {
// Dunno if this one is needed, but whatever, it's small. :) // Dunno if this one is needed, but whatever, it's small. :)
if( GetVersion() >= 0x14 ) if( GetVersion() >= 0x04 )
Freeze( g_vifCycles ); Freeze( g_vifCycles );
Freeze( vif0 ); Freeze( vif0 );
if( GetVersion() >= 0x14 ) if( GetVersion() >= 0x04 )
{ {
Freeze( g_vif0HasMask3 ); Freeze( g_vif0HasMask3 );
Freeze( g_vif0Masks ); Freeze( g_vif0Masks );
@ -2263,7 +2263,7 @@ void SaveState::vif1Freeze()
{ {
Freeze(vif1); Freeze(vif1);
if( GetVersion() >= 0x14 ) if( GetVersion() >= 0x04 )
{ {
Freeze( g_vif1HasMask3 ); Freeze( g_vif1HasMask3 );
Freeze( g_vif1Masks ); Freeze( g_vif1Masks );

View File

@ -1027,8 +1027,6 @@ void CreateMainWindow()
RECT rect; RECT rect;
int w, h; int w, h;
//g_ReturnToGui = true;
#ifdef _MSC_VER #ifdef _MSC_VER
sprintf(COMPILER, "(VC%d)", (_MSC_VER+100)/200);//hacky:) works for VC6 & VC.NET sprintf(COMPILER, "(VC%d)", (_MSC_VER+100)/200);//hacky:) works for VC6 & VC.NET
#elif __BORLANDC__ #elif __BORLANDC__

View File

@ -32,8 +32,10 @@
{ {
void __cpuid(int* CPUInfo, int InfoType); void __cpuid(int* CPUInfo, int InfoType);
unsigned __int64 __rdtsc(); unsigned __int64 __rdtsc();
#ifndef __INTEL_COMPILER
# pragma intrinsic(__cpuid) # pragma intrinsic(__cpuid)
# pragma intrinsic(__rdtsc) # pragma intrinsic(__rdtsc)
#endif
} }
#endif #endif