From b72971408c415bc60f52286a56559c186d26f387 Mon Sep 17 00:00:00 2001 From: "avihal@gmail.com" Date: Sun, 20 Mar 2011 11:19:00 +0000 Subject: [PATCH] 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 --- pcsx2/gui/Saveslots.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pcsx2/gui/Saveslots.cpp b/pcsx2/gui/Saveslots.cpp index 51aef54964..832c91dcb6 100644 --- a/pcsx2/gui/Saveslots.cpp +++ b/pcsx2/gui/Saveslots.cpp @@ -67,6 +67,11 @@ void States_FreezeCurrentSlot() { // 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( !SysHasValidState() ) + { + Console.WriteLn( "Save state: Aborting (VM is not active)." ); + return; + } if( wxGetApp().HasPendingSaves() || AtomicExchange(IsSavingOrLoading, true) ) { @@ -83,6 +88,12 @@ void States_FreezeCurrentSlot() void _States_DefrostCurrentSlot( bool isFromBackup ) { + if( !SysHasValidState() ) + { + Console.WriteLn( "Load state: Aborting (VM is not active)." ); + return; + } + if( AtomicExchange(IsSavingOrLoading, true) ) { Console.WriteLn( "Load or save action is already pending." );