Save-state: gracefully handle state load/save when the VM isn't at a valid state (was crashing on load state before running anything if a bios savestate existed)

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4462 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
avihal@gmail.com 2011-03-20 11:19:00 +00:00
parent bebea985ce
commit b72971408c
1 changed files with 11 additions and 0 deletions

View File

@ -67,6 +67,11 @@ void States_FreezeCurrentSlot()
{ {
// FIXME : Use of the IsSavingOrLoading flag is mostly a hack until we implement a // 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 // complete thread to manage queuing savestate tasks, and zipping states to disk. --air
if( !SysHasValidState() )
{
Console.WriteLn( "Save state: Aborting (VM is not active)." );
return;
}
if( wxGetApp().HasPendingSaves() || AtomicExchange(IsSavingOrLoading, true) ) if( wxGetApp().HasPendingSaves() || AtomicExchange(IsSavingOrLoading, true) )
{ {
@ -83,6 +88,12 @@ void States_FreezeCurrentSlot()
void _States_DefrostCurrentSlot( bool isFromBackup ) void _States_DefrostCurrentSlot( bool isFromBackup )
{ {
if( !SysHasValidState() )
{
Console.WriteLn( "Load state: Aborting (VM is not active)." );
return;
}
if( AtomicExchange(IsSavingOrLoading, true) ) if( AtomicExchange(IsSavingOrLoading, true) )
{ {
Console.WriteLn( "Load or save action is already pending." ); Console.WriteLn( "Load or save action is already pending." );