From 51c25d070deb27ddeec4bb5e3535792bda97471b Mon Sep 17 00:00:00 2001 From: julien2512 Date: Sun, 17 Dec 2017 01:13:07 +0100 Subject: [PATCH 1/2] now able to start from a snapshot --- gtk/src/gtk_s9x.cpp | 5 ++++- snes9x.cpp | 11 +++++++++++ snes9x.h | 1 + 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/gtk/src/gtk_s9x.cpp b/gtk/src/gtk_s9x.cpp index 59db0ab1..cb46ade0 100644 --- a/gtk/src/gtk_s9x.cpp +++ b/gtk/src/gtk_s9x.cpp @@ -105,7 +105,7 @@ main (int argc, char *argv[]) if (rom_filename) { - if (S9xOpenROM (rom_filename) && gui_config->full_screen_on_open) + if ((rom_opened=S9xOpenROM (rom_filename)) && gui_config->full_screen_on_open) gtk_window_unfullscreen (top_level->get_window()); } @@ -128,6 +128,9 @@ main (int argc, char *argv[]) gtk_window_present (top_level->get_window ()); + if (rom_filename && Settings.InitialSnapshotFilename) + S9xUnfreezeGame(Settings.InitialSnapshotFilename); + gtk_main (); gdk_threads_leave (); return 0; diff --git a/snes9x.cpp b/snes9x.cpp index 1d6f6d7e..7fab3827 100644 --- a/snes9x.cpp +++ b/snes9x.cpp @@ -756,6 +756,17 @@ char * S9xParseArgs (char **argv, int argc) else if (!strcasecmp(argv[i], "-bsxbootup")) Settings.BSXBootup = TRUE; + else + if (!strcasecmp(argv[i], "-snapshot")) + { + if (i + 1 < argc) + { + strncpy(Settings.InitialSnapshotFilename, argv[++i], PATH_MAX); + Settings.InitialSnapshotFilename[PATH_MAX] = 0; + } + else + S9xUsage(); + } else // PATCH/CHEAT OPTIONS diff --git a/snes9x.h b/snes9x.h index 443e2585..5f439768 100644 --- a/snes9x.h +++ b/snes9x.h @@ -457,6 +457,7 @@ struct SSettings bool8 TakeScreenshot; int8 StretchScreenshots; bool8 SnapshotScreenshots; + char InitialSnapshotFilename[PATH_MAX + 1]; bool8 ApplyCheats; bool8 NoPatch; From 63b9bebd3ffdd63b6350b3c7133a84ac5c717cb7 Mon Sep 17 00:00:00 2001 From: julien2512 Date: Sun, 17 Dec 2017 01:19:17 +0100 Subject: [PATCH 2/2] Syntax --- gtk/src/gtk_s9x.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gtk/src/gtk_s9x.cpp b/gtk/src/gtk_s9x.cpp index cb46ade0..4bf312b1 100644 --- a/gtk/src/gtk_s9x.cpp +++ b/gtk/src/gtk_s9x.cpp @@ -105,7 +105,7 @@ main (int argc, char *argv[]) if (rom_filename) { - if ((rom_opened=S9xOpenROM (rom_filename)) && gui_config->full_screen_on_open) + if (S9xOpenROM (rom_filename) && gui_config->full_screen_on_open) gtk_window_unfullscreen (top_level->get_window()); }