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
This commit is contained in:
stephena 2009-12-18 22:56:48 +00:00
parent 88df583c23
commit 48a48d8619
3 changed files with 20 additions and 3 deletions

View File

@ -866,6 +866,12 @@
saving a ROM state file.</td> saving a ROM state file.</td>
</tr> </tr>
<tr>
<td><pre>-md5instate &lt;1|0&gt;</pre></td>
<td>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.</td>
</tr>
<tr> <tr>
<td><pre>-audiofirst &lt;1|0&gt;</pre></td> <td><pre>-audiofirst &lt;1|0&gt;</pre></td>
<td>Initialize the audio subsystem before video when emulating a <td>Initialize the audio subsystem before video when emulating a

View File

@ -114,6 +114,7 @@ Settings::Settings(OSystem* osystem)
// Misc options // Misc options
setInternal("autoslot", "false"); setInternal("autoslot", "false");
setInternal("md5instate", "true");
setInternal("showinfo", "false"); setInternal("showinfo", "false");
setInternal("tiadriven", "false"); setInternal("tiadriven", "false");
setInternal("avoxport", ""); setInternal("avoxport", "");
@ -358,6 +359,7 @@ void Settings::usage()
<< " -sa1 <left|right> Stelladaptor 1 emulates specified joystick port\n" << " -sa1 <left|right> Stelladaptor 1 emulates specified joystick port\n"
<< " -sa2 <left|right> Stelladaptor 2 emulates specified joystick port\n" << " -sa2 <left|right> Stelladaptor 2 emulates specified joystick port\n"
<< " -autoslot <1|0> Automatically switch to next save slot when state saving\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" << " -audiofirst <1|0> Initial audio before video (required for some ATI video cards)\n"
<< " -fastscbios <1|0> Disable Supercharger BIOS progress loading bars\n" << " -fastscbios <1|0> Disable Supercharger BIOS progress loading bars\n"
<< " -ssdir <path> The directory to save snapshot files to\n" << " -ssdir <path> The directory to save snapshot files to\n"

View File

@ -199,10 +199,19 @@ void StateManager::loadState(int slot)
// If so, do a complete state load using the Console // If so, do a complete state load using the Console
if(in.getString() != STATE_HEADER) if(in.getString() != STATE_HEADER)
buf << "Incompatible state " << slot << " file"; buf << "Incompatible state " << slot << " file";
else if(in.getString() == md5 && myOSystem->console().load(in)) else
{
const string& s = in.getString();
if(myOSystem->settings().getBool("md5instate") ? s == md5 : true)
{
if(myOSystem->console().load(in))
buf << "State " << slot << " loaded"; buf << "State " << slot << " loaded";
else else
buf << "Invalid data in state " << slot << " file"; buf << "Invalid data in state " << slot << " file";
}
else
buf << "State " << slot << " file doesn't match current ROM";
}
myOSystem->frameBuffer().showMessage(buf.str()); myOSystem->frameBuffer().showMessage(buf.str());
} }