wxSavestates: many bugfixes!! *now* it's ready for testing. :p

git-svn-id: http://pcsx2.googlecode.com/svn/branches/wxSavestates@4096 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
Jake.Stine 2010-12-14 22:41:02 +00:00
parent 73d74e85c0
commit a728cfee96
5 changed files with 31 additions and 8 deletions

View File

@ -331,6 +331,7 @@ wxString Exception::CannotCreateStream::FormatDisplayMessage() const
{ {
FastFormatUnicode retval; FastFormatUnicode retval;
retval.Write(_("A file could not be created.")); retval.Write(_("A file could not be created."));
retval.Write("\n");
_formatUserMsg(retval); _formatUserMsg(retval);
return retval; return retval;
} }
@ -341,7 +342,7 @@ wxString Exception::CannotCreateStream::FormatDisplayMessage() const
wxString Exception::FileNotFound::FormatDiagnosticMessage() const wxString Exception::FileNotFound::FormatDiagnosticMessage() const
{ {
FastFormatUnicode retval; FastFormatUnicode retval;
retval.Write("File not found."); retval.Write("File not found.\n");
_formatDiagMsg(retval); _formatDiagMsg(retval);
return retval; return retval;
} }
@ -350,6 +351,7 @@ wxString Exception::FileNotFound::FormatDisplayMessage() const
{ {
FastFormatUnicode retval; FastFormatUnicode retval;
retval.Write(_("File not found.")); retval.Write(_("File not found."));
retval.Write("\n");
_formatUserMsg(retval); _formatUserMsg(retval);
return retval; return retval;
} }
@ -360,7 +362,7 @@ wxString Exception::FileNotFound::FormatDisplayMessage() const
wxString Exception::AccessDenied::FormatDiagnosticMessage() const wxString Exception::AccessDenied::FormatDiagnosticMessage() const
{ {
FastFormatUnicode retval; FastFormatUnicode retval;
retval.Write("Permission denied to file."); retval.Write("Permission denied to file.\n");
_formatDiagMsg(retval); _formatDiagMsg(retval);
return retval; return retval;
} }
@ -369,6 +371,7 @@ wxString Exception::AccessDenied::FormatDisplayMessage() const
{ {
FastFormatUnicode retval; FastFormatUnicode retval;
retval.Write(_("Permission denied while trying to open file, likely due to insufficient user account rights.")); retval.Write(_("Permission denied while trying to open file, likely due to insufficient user account rights."));
retval.Write("\n");
_formatUserMsg(retval); _formatUserMsg(retval);
return retval; return retval;
} }
@ -379,7 +382,7 @@ wxString Exception::AccessDenied::FormatDisplayMessage() const
wxString Exception::EndOfStream::FormatDiagnosticMessage() const wxString Exception::EndOfStream::FormatDiagnosticMessage() const
{ {
FastFormatUnicode retval; FastFormatUnicode retval;
retval.Write("Unexpected end of file or stream."); retval.Write("Unexpected end of file or stream.\n");
_formatDiagMsg(retval); _formatDiagMsg(retval);
return retval; return retval;
} }
@ -388,6 +391,7 @@ wxString Exception::EndOfStream::FormatDisplayMessage() const
{ {
FastFormatUnicode retval; FastFormatUnicode retval;
retval.Write(_("Unexpected end of file or stream encountered. File is probably truncated or corrupted.")); retval.Write(_("Unexpected end of file or stream encountered. File is probably truncated or corrupted."));
retval.Write("\n");
_formatUserMsg(retval); _formatUserMsg(retval);
return retval; return retval;
} }

View File

@ -681,7 +681,7 @@ SysCorePlugins *g_plugins = NULL;
wxString Exception::SaveStateLoadError::FormatDiagnosticMessage() const wxString Exception::SaveStateLoadError::FormatDiagnosticMessage() const
{ {
FastFormatUnicode retval; FastFormatUnicode retval;
retval.Write("Savestate is corrupt or incomplete!"); retval.Write("Savestate is corrupt or incomplete!\n");
_formatDiagMsg(retval); _formatDiagMsg(retval);
return retval; return retval;
} }
@ -690,6 +690,7 @@ wxString Exception::SaveStateLoadError::FormatDisplayMessage() const
{ {
FastFormatUnicode retval; FastFormatUnicode retval;
retval.Write(_("The savestate cannot be loaded, as it appears to be corrupt or incomplete.")); retval.Write(_("The savestate cannot be loaded, as it appears to be corrupt or incomplete."));
retval.Write("\n");
_formatUserMsg(retval); _formatUserMsg(retval);
return retval; return retval;
} }

View File

@ -55,7 +55,7 @@ wxString SaveStateBase::GetFilename( int slot )
if (serialName.IsEmpty()) serialName = L"BIOS"; if (serialName.IsEmpty()) serialName = L"BIOS";
return (g_Conf->Folders.Savestates + return (g_Conf->Folders.Savestates +
pxsFmt( L"%s (%08X).%02d.ps2z", serialName.c_str(), ElfCRC, slot )).GetFullPath(); pxsFmt( L"%s (%08X).%02d.p2z", serialName.c_str(), ElfCRC, slot )).GetFullPath();
//return (g_Conf->Folders.Savestates + //return (g_Conf->Folders.Savestates +
// pxsFmt( L"%08X.%03d", ElfCRC, slot )).GetFullPath(); // pxsFmt( L"%08X.%03d", ElfCRC, slot )).GetFullPath();

View File

@ -57,6 +57,7 @@ void BaseCompressThread::ExecuteTaskInThread()
for( uint i=0; i<listlen; ++i ) for( uint i=0; i<listlen; ++i )
{ {
const ArchiveEntry& entry = (*m_src_list)[i]; const ArchiveEntry& entry = (*m_src_list)[i];
if (!entry.GetDataSize()) continue;
wxArchiveOutputStream& woot = *(wxArchiveOutputStream*)m_gzfp->GetWxStreamBase(); wxArchiveOutputStream& woot = *(wxArchiveOutputStream*)m_gzfp->GetWxStreamBase();
woot.PutNextEntry( entry.GetFilename() ); woot.PutNextEntry( entry.GetFilename() );

View File

@ -47,6 +47,7 @@ public:
virtual wxString GetFilename() const=0; virtual wxString GetFilename() const=0;
virtual void FreezeIn( pxInputStream& reader ) const=0; virtual void FreezeIn( pxInputStream& reader ) const=0;
virtual void FreezeOut( SaveStateBase& writer ) const=0; virtual void FreezeOut( SaveStateBase& writer ) const=0;
virtual bool IsRequired() const=0;
}; };
class MemorySavestateEntry : public BaseSavestateEntry class MemorySavestateEntry : public BaseSavestateEntry
@ -58,6 +59,7 @@ protected:
public: public:
virtual void FreezeIn( pxInputStream& reader ) const; virtual void FreezeIn( pxInputStream& reader ) const;
virtual void FreezeOut( SaveStateBase& writer ) const; virtual void FreezeOut( SaveStateBase& writer ) const;
virtual bool IsRequired() const { return true; }
protected: protected:
virtual u8* GetDataPtr() const=0; virtual u8* GetDataPtr() const=0;
@ -81,6 +83,8 @@ public:
virtual void FreezeIn( pxInputStream& reader ) const; virtual void FreezeIn( pxInputStream& reader ) const;
virtual void FreezeOut( SaveStateBase& writer ) const; virtual void FreezeOut( SaveStateBase& writer ) const;
virtual bool IsRequired() const { return false; }
protected: protected:
virtual PluginsEnum_t GetPluginId() const { return m_pid; } virtual PluginsEnum_t GetPluginId() const { return m_pid; }
}; };
@ -121,6 +125,7 @@ void PluginSavestateEntry::FreezeOut( SaveStateBase& writer ) const
{ {
writer.PrepBlock( size ); writer.PrepBlock( size );
GetCorePlugins().FreezeOut( GetPluginId(), writer.GetBlockPtr() ); GetCorePlugins().FreezeOut( GetPluginId(), writer.GetBlockPtr() );
writer.CommitBlock( size );
} }
} }
@ -139,6 +144,12 @@ public:
wxString GetFilename() const { return L"eeMemory.bin"; } wxString GetFilename() const { return L"eeMemory.bin"; }
u8* GetDataPtr() const { return eeMem->Main; } u8* GetDataPtr() const { return eeMem->Main; }
uint GetDataSize() const { return sizeof(eeMem->Main); } uint GetDataSize() const { return sizeof(eeMem->Main); }
virtual void FreezeIn( pxInputStream& reader ) const
{
SysClearExecutionCache();
MemorySavestateEntry::FreezeIn( reader );
}
}; };
class SavestateEntry_IopMemory : public MemorySavestateEntry class SavestateEntry_IopMemory : public MemorySavestateEntry
@ -323,7 +334,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<SavestateEntries.GetSize(); ++i) for (uint i=0; i<SavestateEntries.GetSize(); ++i)
{ {
uint startpos = saveme.GetCurrentPos(); uint startpos = saveme.GetCurrentPos();
@ -566,8 +577,12 @@ protected:
for (uint i=0; i<NumSavestateEntries; ++i) for (uint i=0; i<NumSavestateEntries; ++i)
{ {
if (foundEntry[i]) continue; if (foundEntry[i]) continue;
throwIt = true;
Console.WriteLn( Color_Red, " ... not found '%s'!", SavestateEntries[i]->GetFilename() ); if (SavestateEntries[i]->IsRequired())
{
throwIt = true;
Console.WriteLn( Color_Red, " ... not found '%s'!", SavestateEntries[i]->GetFilename() );
}
} }
if (throwIt) if (throwIt)
@ -583,6 +598,8 @@ protected:
for (uint i=0; i<NumSavestateEntries; ++i) for (uint i=0; i<NumSavestateEntries; ++i)
{ {
if (!foundEntry[i]) continue;
Threading::pxTestCancel(); Threading::pxTestCancel();
gzreader->OpenEntry( *foundEntry[i] ); gzreader->OpenEntry( *foundEntry[i] );