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

View File

@ -51,8 +51,14 @@ static void PostLoadPrep()
// --------------------------------------------------------------------------------------
wxString SaveStateBase::GetFilename( int slot )
{
wxString serialName( DiscSerial );
if (serialName.IsEmpty()) serialName = L"BIOS";
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 )

View File

@ -215,29 +215,41 @@ public:
// 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,
new SavestateEntry_IopMemory,
new SavestateEntry_HwRegs,
new SavestateEntry_IopHwRegs,
new SavestateEntry_Scratchpad,
new SavestateEntry_VU0mem,
new SavestateEntry_VU1mem,
new SavestateEntry_VU0prog,
new SavestateEntry_VU1prog,
typedef ScopedAlloc<const BaseSavestateEntry*> _parent;
new PluginSavestateEntry( PluginId_GS ),
new PluginSavestateEntry( PluginId_PAD ),
new PluginSavestateEntry( PluginId_SPU2 ),
new PluginSavestateEntry( PluginId_CDVD ),
new PluginSavestateEntry( PluginId_USB ),
new PluginSavestateEntry( PluginId_FW ),
new PluginSavestateEntry( PluginId_DEV9 ),
public:
SavestateEntryPack()
: _parent( NumSavestateEntries )
{
uint i = 0; // more convenient in case we re-arrange anything...
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
// 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() );
m_dest_list->Add( internals );
for (uint i=0; i<NumSavestateEntries; ++i)
for (uint i=0; i<SavestateEntries.GetSize(); ++i)
{
uint startpos = saveme.GetCurrentPos();
SavestateEntries[i]->FreezeOut( saveme );
@ -496,7 +508,7 @@ protected:
bool foundVersion = false;
//bool foundScreenshot = false;
//bool foundEntry[NumSavestateEntries] = false;
//bool foundEntry[numSavestateEntries] = false;
ScopedPtr<wxZipEntry> foundInternal;
ScopedPtr<wxZipEntry> foundEntry[NumSavestateEntries];