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 // 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 // the BIOS being run (either a checksum of the BIOS roms, and/or a string based on BIOS
// region and revision). // region and revision).
return wxEmptyString;
} }
return pxsFmt( L"%08x", ElfCRC ); return pxsFmt( L"%08x", ElfCRC );

View File

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

View File

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

View File

@ -298,8 +298,7 @@ void AppCoreThread::ApplySettings( const Pcsx2Config& src )
wxString gameFixes; wxString gameFixes;
wxString gameCheats; wxString gameCheats;
// [TODO] : Fix this so that it recognizes and reports BIOS-booting status! wxString gameName;
wxString gameName (L"Unknown");
wxString gameCompat; wxString gameCompat;
if (ElfCRC) gameCRC.Printf( L"%8.8x", ElfCRC ); if (ElfCRC) gameCRC.Printf( L"%8.8x", ElfCRC );
@ -309,27 +308,36 @@ void AppCoreThread::ApplySettings( const Pcsx2Config& src )
const bool verbose( newGameKey != curGameKey ); const bool verbose( newGameKey != curGameKey );
curGameKey = newGameKey; curGameKey = newGameKey;
if (IGameDatabase* GameDB = AppHost_GetGameDatabase() ) if (!curGameKey.IsEmpty())
{ {
Game_Data game; if (IGameDatabase* GameDB = AppHost_GetGameDatabase() )
if (GameDB->findGame(game, curGameKey)) { {
int compat = game.getInt("Compat"); Game_Data game;
gameName = game.getString("Name"); if (GameDB->findGame(game, curGameKey)) {
gameName += L" (" + game.getString("Region") + L")"; int compat = game.getInt("Compat");
gameCompat = L" [Status = "+compatToStringWX(compat)+L"]"; gameName = game.getString("Name");
} gameName += L" (" + game.getString("Region") + L")";
gameCompat = L" [Status = "+compatToStringWX(compat)+L"]";
}
if (EmuConfig.EnablePatches) { if (EmuConfig.EnablePatches) {
if (int patches = InitPatches(gameCRC, game)) { if (int patches = InitPatches(gameCRC, game)) {
gamePatch.Printf(L" [%d Patches]", patches); gamePatch.Printf(L" [%d Patches]", patches);
if (verbose) Console.WriteLn(Color_Green, "(GameDB) Patches Loaded: %d", patches); if (verbose) Console.WriteLn(Color_Green, "(GameDB) Patches Loaded: %d", patches);
} }
if (int fixes = loadGameSettings(fixup, game, verbose)) { if (int fixes = loadGameSettings(fixup, game, verbose)) {
gameFixes.Printf(L" [%d Fixes]", fixes); gameFixes.Printf(L" [%d Fixes]", fixes);
}
} }
} }
} }
if (gameName.IsEmpty() && gameSerial.IsEmpty() && BiosChecksum)
{
gameName = L"BIOS";
gameCRC.Printf( L"%8.8x", BiosChecksum );
}
if (EmuConfig.EnableCheats) { if (EmuConfig.EnableCheats) {
if (int cheats = InitCheats(gameCRC)) { if (int cheats = InitCheats(gameCRC)) {
gameCheats.Printf(L" [%d Cheats]", cheats); gameCheats.Printf(L" [%d Cheats]", cheats);

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 // 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 // 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(). // should be matched by a call to ClearPendingSave().

View File

@ -37,6 +37,8 @@ bool States_isSlotUsed(int num)
return wxFileExists( SaveStateBase::GetFilename( 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; static volatile u32 IsSavingOrLoading = false;
class SysExecEvent_ClearSavingLoadingFlag : public SysExecEvent class SysExecEvent_ClearSavingLoadingFlag : public SysExecEvent
@ -60,7 +62,10 @@ protected:
void States_FreezeCurrentSlot() 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." ); Console.WriteLn( "Load or save action is already pending." );
return; return;
@ -84,8 +89,6 @@ void States_DefrostCurrentSlot()
StateCopy_LoadFromSlot( StatesC ); StateCopy_LoadFromSlot( StatesC );
GetSysExecutorThread().PostIdleEvent( SysExecEvent_ClearSavingLoadingFlag() ); GetSysExecutorThread().PostIdleEvent( SysExecEvent_ClearSavingLoadingFlag() );
//SysStatus( wxsFormat( _("Loaded State (slot %d)"), StatesC ) );
} }
static void OnSlotChanged() static void OnSlotChanged()

View File

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