diff --git a/gtk/src/gtk_file.cpp b/gtk/src/gtk_file.cpp
index ce08ebaa..57e16b1b 100644
--- a/gtk/src/gtk_file.cpp
+++ b/gtk/src/gtk_file.cpp
@@ -385,6 +385,8 @@ S9xAutoSaveSRAM (void)
void
S9xLoadState (const char *filename)
{
+ S9xFreezeGame (S9xGetFilename (".undo", SNAPSHOT_DIR));
+
if (S9xUnfreezeGame (filename))
{
sprintf (buf, "%s loaded", filename);
@@ -528,34 +530,40 @@ S9xQuickLoadSlot (int slot)
S9xGetDirectory (SNAPSHOT_DIR), SLASH_STR, def,
slot);
+ if (file_exists (filename))
+ S9xFreezeGame (S9xGetFilename (".undo", SNAPSHOT_DIR));
+
if (S9xUnfreezeGame (filename))
{
snprintf (buf, PATH_MAX, "%s.%03d loaded", def, slot);
S9xSetInfoString (buf);
+ return;
}
- else
+
+ static const char *digits = "t123456789";
+
+ _splitpath (Memory.ROMFilename, drive, dir, def, ext);
+
+ snprintf (filename, PATH_MAX, "%s%s%s.zs%c",
+ S9xGetDirectory (SNAPSHOT_DIR), SLASH_STR,
+ def, digits[slot]);
+
+ if (file_exists (filename))
+ S9xFreezeGame (S9xGetFilename (".undo", SNAPSHOT_DIR));
+
+ if (S9xUnfreezeGame (filename))
{
- static const char *digits = "t123456789";
-
- _splitpath (Memory.ROMFilename, drive, dir, def, ext);
-
- snprintf (filename, PATH_MAX, "%s%s%s.zs%c",
- S9xGetDirectory (SNAPSHOT_DIR), SLASH_STR,
- def, digits[slot]);
-
- if (S9xUnfreezeGame (filename))
- {
- snprintf (buf, PATH_MAX,
- "Loaded ZSNES freeze file %s.zs%c",
- def, digits [slot]);
- S9xSetInfoString (buf);
- }
- else
- S9xMessage (S9X_ERROR,
- S9X_FREEZE_FILE_NOT_FOUND,
- "Freeze file not found");
+ snprintf (buf, PATH_MAX,
+ "Loaded ZSNES freeze file %s.zs%c",
+ def, digits [slot]);
+ S9xSetInfoString (buf);
+ return;
}
+ S9xMessage (S9X_ERROR,
+ S9X_FREEZE_FILE_NOT_FOUND,
+ "Freeze file not found");
+
return;
}
diff --git a/gtk/src/gtk_s9xwindow.cpp b/gtk/src/gtk_s9xwindow.cpp
index facab641..f464acf5 100644
--- a/gtk/src/gtk_s9xwindow.cpp
+++ b/gtk/src/gtk_s9xwindow.cpp
@@ -460,6 +460,15 @@ event_load_state (GtkWidget *widget, gpointer data)
return;
}
+static void
+event_load_state_undo (GtkWidget *widget, gpointer data)
+{
+ S9xUnfreezeGame (S9xGetFilename (".undo", SNAPSHOT_DIR));
+
+ return;
+}
+
+
static void
event_load_state_file (GtkWidget *widget, gpointer data)
{
@@ -585,6 +594,7 @@ Snes9xWindow::Snes9xWindow (Snes9xConfig *config) :
{ "on_port_activate", G_CALLBACK (event_port) },
{ "load_save_state", G_CALLBACK (event_load_state) },
{ "load_state_file", G_CALLBACK (event_load_state_file) },
+ { "load_state_undo", G_CALLBACK (event_load_state_undo) },
{ "save_save_state", G_CALLBACK (event_save_state) },
{ "save_state_file", G_CALLBACK (event_save_state_file) },
{ "drawingarea_button_press", G_CALLBACK (event_button_press) },
diff --git a/gtk/src/snes9x.ui b/gtk/src/snes9x.ui
index 09cf412b..7f28bd3e 100644
--- a/gtk/src/snes9x.ui
+++ b/gtk/src/snes9x.ui
@@ -1334,6 +1334,21 @@
+
+
+
+
+
+