From 48a48d861940120f028234789972241a66572a69 Mon Sep 17 00:00:00 2001 From: stephena Date: Fri, 18 Dec 2009 22:56:48 +0000 Subject: [PATCH] Added '-md5instate' commandline argument, which determines how a state load is related to the currently running ROM. If enabled (the default and current behaviour), state files that do not match the currently loaded ROM will not be loaded. Otherwise, the state file will attempt to load. Note that in the latter case, this will probably cause 'bad things' to happen. It's mostly for developers who are constantly recompiling a ROM, and wish to use a previously created state file even when the ROM MD5 changes. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1915 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- docs/index.html | 6 ++++++ src/emucore/Settings.cxx | 2 ++ src/emucore/StateManager.cxx | 15 ++++++++++++--- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/docs/index.html b/docs/index.html index e82767747..aa6bdb75f 100644 --- a/docs/index.html +++ b/docs/index.html @@ -866,6 +866,12 @@ saving a ROM state file. + +
-md5instate <1|0>
+ When loading state files, check if the MD5 of the current ROM matches that + saved in the state file. If disabled, no such check is performed. + +
-audiofirst <1|0>
Initialize the audio subsystem before video when emulating a diff --git a/src/emucore/Settings.cxx b/src/emucore/Settings.cxx index 519249cb6..438e22876 100644 --- a/src/emucore/Settings.cxx +++ b/src/emucore/Settings.cxx @@ -114,6 +114,7 @@ Settings::Settings(OSystem* osystem) // Misc options setInternal("autoslot", "false"); + setInternal("md5instate", "true"); setInternal("showinfo", "false"); setInternal("tiadriven", "false"); setInternal("avoxport", ""); @@ -358,6 +359,7 @@ void Settings::usage() << " -sa1 Stelladaptor 1 emulates specified joystick port\n" << " -sa2 Stelladaptor 2 emulates specified joystick port\n" << " -autoslot <1|0> Automatically switch to next save slot when state saving\n" + << " -md5instate <1|0> ROM MD5 information is saved in a state file, tying the state file to the ROM\n" << " -audiofirst <1|0> Initial audio before video (required for some ATI video cards)\n" << " -fastscbios <1|0> Disable Supercharger BIOS progress loading bars\n" << " -ssdir The directory to save snapshot files to\n" diff --git a/src/emucore/StateManager.cxx b/src/emucore/StateManager.cxx index 355d6d280..c21f86a5a 100644 --- a/src/emucore/StateManager.cxx +++ b/src/emucore/StateManager.cxx @@ -199,10 +199,19 @@ void StateManager::loadState(int slot) // If so, do a complete state load using the Console if(in.getString() != STATE_HEADER) buf << "Incompatible state " << slot << " file"; - else if(in.getString() == md5 && myOSystem->console().load(in)) - buf << "State " << slot << " loaded"; else - buf << "Invalid data in state " << slot << " file"; + { + const string& s = in.getString(); + if(myOSystem->settings().getBool("md5instate") ? s == md5 : true) + { + if(myOSystem->console().load(in)) + buf << "State " << slot << " loaded"; + else + buf << "Invalid data in state " << slot << " file"; + } + else + buf << "State " << slot << " file doesn't match current ROM"; + } myOSystem->frameBuffer().showMessage(buf.str()); }