wxSavestates: savestates now include game serial code, and a ps2z extension (which can be linked to any zip-supporting tool, like winzip or 7zip). This branch is ready for extensive testing. :)

git-svn-id: http://pcsx2.googlecode.com/svn/branches/wxSavestates@4092 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
Jake.Stine 2010-12-14 15:09:22 +00:00
parent daf47b50a0
commit 9eddbb5845
3 changed files with 51 additions and 25 deletions

View File

@ -176,8 +176,10 @@ public:
template< typename T > template< typename T >
class ScopedAlloc : public BaseScopedAlloc<T> class ScopedAlloc : public BaseScopedAlloc<T>
{ {
typedef BaseScopedAlloc<T> _parent;
public: public:
ScopedAlloc( size_t size=0 ) : BaseScopedAlloc<T>() ScopedAlloc( size_t size=0 ) : _parent()
{ {
Alloc(size); Alloc(size);
} }
@ -206,6 +208,8 @@ public:
if (!this->m_buffer) if (!this->m_buffer)
throw Exception::OutOfMemory(L"ScopedAlloc::Resize"); throw Exception::OutOfMemory(L"ScopedAlloc::Resize");
} }
using _parent::operator[];
}; };
// -------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------
@ -220,8 +224,10 @@ public:
template< typename T, uint align > template< typename T, uint align >
class ScopedAlignedAlloc : public BaseScopedAlloc<T> class ScopedAlignedAlloc : public BaseScopedAlloc<T>
{ {
typedef BaseScopedAlloc<T> _parent;
public: public:
ScopedAlignedAlloc( size_t size=0 ) : BaseScopedAlloc<T>() ScopedAlignedAlloc( size_t size=0 ) : _parent()
{ {
Alloc(size); Alloc(size);
} }
@ -250,4 +256,6 @@ public:
if (!this->m_buffer) if (!this->m_buffer)
throw Exception::OutOfMemory(L"ScopedAlignedAlloc::Resize"); throw Exception::OutOfMemory(L"ScopedAlignedAlloc::Resize");
} }
using _parent::operator[];
}; };

View File

@ -51,8 +51,14 @@ static void PostLoadPrep()
// -------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------
wxString SaveStateBase::GetFilename( int slot ) wxString SaveStateBase::GetFilename( int slot )
{ {
wxString serialName( DiscSerial );
if (serialName.IsEmpty()) serialName = L"BIOS";
return (g_Conf->Folders.Savestates + return (g_Conf->Folders.Savestates +
pxsFmt( L"%08X.%03d", ElfCRC, slot )).GetFullPath(); pxsFmt( L"%s (%08X).%02d.ps2z", serialName.c_str(), ElfCRC, slot )).GetFullPath();
//return (g_Conf->Folders.Savestates +
// pxsFmt( L"%08X.%03d", ElfCRC, slot )).GetFullPath();
} }
SaveStateBase::SaveStateBase( SafeArray<u8>& memblock ) SaveStateBase::SaveStateBase( SafeArray<u8>& memblock )

View File

@ -215,29 +215,41 @@ public:
// would not be useful). // would not be useful).
// //
static const BaseSavestateEntry* const SavestateEntries[] = static const uint NumSavestateEntries = 9 + PluginId_Count;
class SavestateEntryPack : public ScopedAlloc<const BaseSavestateEntry*>
{ {
new SavestateEntry_EmotionMemory, typedef ScopedAlloc<const BaseSavestateEntry*> _parent;
new SavestateEntry_IopMemory,
new SavestateEntry_HwRegs,
new SavestateEntry_IopHwRegs,
new SavestateEntry_Scratchpad,
new SavestateEntry_VU0mem,
new SavestateEntry_VU1mem,
new SavestateEntry_VU0prog,
new SavestateEntry_VU1prog,
new PluginSavestateEntry( PluginId_GS ), public:
new PluginSavestateEntry( PluginId_PAD ), SavestateEntryPack()
new PluginSavestateEntry( PluginId_SPU2 ), : _parent( NumSavestateEntries )
new PluginSavestateEntry( PluginId_CDVD ), {
new PluginSavestateEntry( PluginId_USB ), uint i = 0; // more convenient in case we re-arrange anything...
new PluginSavestateEntry( PluginId_FW ),
new PluginSavestateEntry( PluginId_DEV9 ),
this->operator[](i++) = new SavestateEntry_EmotionMemory;
this->operator[](i++) = new SavestateEntry_IopMemory;
this->operator[](i++) = new SavestateEntry_HwRegs;
this->operator[](i++) = new SavestateEntry_IopHwRegs;
this->operator[](i++) = new SavestateEntry_Scratchpad;
this->operator[](i++) = new SavestateEntry_VU0mem;
this->operator[](i++) = new SavestateEntry_VU1mem;
this->operator[](i++) = new SavestateEntry_VU0prog;
this->operator[](i++) = new SavestateEntry_VU1prog;
this->operator[](i++) = new PluginSavestateEntry( PluginId_GS );
this->operator[](i++) = new PluginSavestateEntry( PluginId_PAD );
this->operator[](i++) = new PluginSavestateEntry( PluginId_SPU2 );
this->operator[](i++) = new PluginSavestateEntry( PluginId_CDVD );
this->operator[](i++) = new PluginSavestateEntry( PluginId_USB );
this->operator[](i++) = new PluginSavestateEntry( PluginId_FW );
this->operator[](i++) = new PluginSavestateEntry( PluginId_DEV9 );
}
using _parent::operator[];
}; };
static const uint NumSavestateEntries = ArraySize(SavestateEntries); static const SavestateEntryPack SavestateEntries;
// It's bad mojo to have savestates trying to read and write from the same file at the // It's bad mojo to have savestates trying to read and write from the same file at the
// same time. To prevent that we use this mutex lock, which is used by both the // same time. To prevent that we use this mutex lock, which is used by both the
@ -312,7 +324,7 @@ protected:
internals.SetDataSize( saveme.GetCurrentPos() - internals.GetDataIndex() ); internals.SetDataSize( saveme.GetCurrentPos() - internals.GetDataIndex() );
m_dest_list->Add( internals ); m_dest_list->Add( internals );
for (uint i=0; i<NumSavestateEntries; ++i) for (uint i=0; i<SavestateEntries.GetSize(); ++i)
{ {
uint startpos = saveme.GetCurrentPos(); uint startpos = saveme.GetCurrentPos();
SavestateEntries[i]->FreezeOut( saveme ); SavestateEntries[i]->FreezeOut( saveme );
@ -496,7 +508,7 @@ protected:
bool foundVersion = false; bool foundVersion = false;
//bool foundScreenshot = false; //bool foundScreenshot = false;
//bool foundEntry[NumSavestateEntries] = false; //bool foundEntry[numSavestateEntries] = false;
ScopedPtr<wxZipEntry> foundInternal; ScopedPtr<wxZipEntry> foundInternal;
ScopedPtr<wxZipEntry> foundEntry[NumSavestateEntries]; ScopedPtr<wxZipEntry> foundEntry[NumSavestateEntries];