wxSavestates: Fixed Bios CRC calculations and improved robustness against saving multiple states at once (hackfix). Console title still doesn't display the BIOS label properly ... not sure yet the good way to remedy that one.

git-svn-id: http://pcsx2.googlecode.com/svn/branches/wxSavestates@4097 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
Jake.Stine 2010-12-15 00:04:23 +00:00
parent a728cfee96
commit bbb1c8a94a
7 changed files with 43 additions and 24 deletions

View File

@ -605,6 +605,8 @@ wxString SysGetDiscID()
// FIXME: system is currently running the BIOS, so it should return a serial based on
// the BIOS being run (either a checksum of the BIOS roms, and/or a string based on BIOS
// region and revision).
return wxEmptyString;
}
return pxsFmt( L"%08x", ElfCRC );

View File

@ -75,7 +75,6 @@ void BaseCompressThread::ExecuteTaskInThread()
woot.CloseEntry();
}
m_gzfp->Close();
if( !wxRenameFile( m_gzfp->GetStreamName(), m_final_filename, true ) )

View File

@ -539,6 +539,7 @@ public:
void WipeUserModeSettings();
void ReadUserModeSettings();
bool HasPendingSaves() const;
void StartPendingSave();
void ClearPendingSave();

View File

@ -298,8 +298,7 @@ void AppCoreThread::ApplySettings( const Pcsx2Config& src )
wxString gameFixes;
wxString gameCheats;
// [TODO] : Fix this so that it recognizes and reports BIOS-booting status!
wxString gameName (L"Unknown");
wxString gameName;
wxString gameCompat;
if (ElfCRC) gameCRC.Printf( L"%8.8x", ElfCRC );
@ -309,6 +308,8 @@ void AppCoreThread::ApplySettings( const Pcsx2Config& src )
const bool verbose( newGameKey != curGameKey );
curGameKey = newGameKey;
if (!curGameKey.IsEmpty())
{
if (IGameDatabase* GameDB = AppHost_GetGameDatabase() )
{
Game_Data game;
@ -329,6 +330,13 @@ void AppCoreThread::ApplySettings( const Pcsx2Config& src )
}
}
}
}
if (gameName.IsEmpty() && gameSerial.IsEmpty() && BiosChecksum)
{
gameName = L"BIOS";
gameCRC.Printf( L"%8.8x", BiosChecksum );
}
if (EmuConfig.EnableCheats) {
if (int cheats = InitCheats(gameCRC)) {

View File

@ -605,6 +605,12 @@ void Pcsx2App::HandleEvent(wxEvtHandler* handler, wxEventFunction func, wxEvent&
}
}
bool Pcsx2App::HasPendingSaves() const
{
AffinityAssert_AllowFrom_MainUI();
return !!m_PendingSaves;
}
// A call to this method informs the app that there is a pending save operation that must be
// finished prior to exiting the app, or else data loss will occur. Any call to this method
// should be matched by a call to ClearPendingSave().

View File

@ -37,6 +37,8 @@ bool States_isSlotUsed(int num)
return wxFileExists( SaveStateBase::GetFilename( num ) );
}
// FIXME : Use of the IsSavingOrLoading flag is mostly a hack until we implement a
// complete thread to manage queuing savestate tasks, and zipping states to disk. --air
static volatile u32 IsSavingOrLoading = false;
class SysExecEvent_ClearSavingLoadingFlag : public SysExecEvent
@ -60,7 +62,10 @@ protected:
void States_FreezeCurrentSlot()
{
if( AtomicExchange(IsSavingOrLoading, true) )
// FIXME : Use of the IsSavingOrLoading flag is mostly a hack until we implement a
// complete thread to manage queuing savestate tasks, and zipping states to disk. --air
if( wxGetApp().HasPendingSaves() || AtomicExchange(IsSavingOrLoading, true) )
{
Console.WriteLn( "Load or save action is already pending." );
return;
@ -84,8 +89,6 @@ void States_DefrostCurrentSlot()
StateCopy_LoadFromSlot( StatesC );
GetSysExecutorThread().PostIdleEvent( SysExecEvent_ClearSavingLoadingFlag() );
//SysStatus( wxsFormat( _("Loaded State (slot %d)"), StatesC ) );
}
static void OnSlotChanged()

View File

@ -158,12 +158,12 @@ static void LoadBiosVersion( pxInputStream& fp, u32& version, wxString& descript
}
}
template< typename T, size_t _size >
void ChecksumIt( u32& result, const T (&srcdata)[_size] )
template< size_t _size >
void ChecksumIt( u32& result, const u8 (&srcdata)[_size] )
{
pxAssume( (_size & 3) == 0 );
for( size_t i=0; i<_size/4; ++i )
result ^= srcdata[i];
result ^= ((u32*)srcdata)[i];
}
// Attempts to load a BIOS rom sub-component, by trying multiple combinations of base