make automatic TM saving load the states on enter too

This commit is contained in:
thrust26 2020-01-25 20:06:04 +01:00
parent ffeaa61cbe
commit ff388cfb31
6 changed files with 31 additions and 12 deletions

View File

@ -97,7 +97,8 @@
* Added option to save and load all TimeMachine states at once.
* Added option to automatically save states when exiting emulation.
* Added option to automatically load/save states when entering/exiting
emulation.
* Added option to change pitch of Pitfall II music.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

@ -2256,7 +2256,8 @@
<tr>
<td><pre>-saveonexit &lt;none|current|all&gt;</pre></td>
<td>Automatically save no, current or all states when exiting emulation.</td>
<td>Automatically save no, current or all states when exiting emulation. The latter
also loads all states when entering emulation.</td>
</tr>
<tr>
@ -3402,11 +3403,12 @@
</td>
<td>-plr.tm.horizon<br>-dev.tm.horizon</td>
</tr><tr>
<td>When exiting emulation:</td>
<td>When entering/exiting emulation:</td>
<td>
Automatically save no, current or all Time Machine states when exiting emulation.<br/>
When saving is enabled, you can always continue your game session
from where you exited it. Even including the Time Machine buffer!
The latter also loads all states when entering emulation. When this is enabled, you
can always continue your game session from where you exited it. Even including the
Time Machine buffer!
</td>
<td>-saveonexit</td>
</tr><tr>

View File

@ -745,11 +745,17 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
if (myOSystem.settings().getBool("confirmexit"))
{
StringList msg;
string saveOnExit = myOSystem.settings().getString("saveonexit");
bool activeTM = myOSystem.settings().getBool(
myOSystem.settings().getBool("dev.settings") ? "dev.timemachine" : "plr.timemachine");
msg.push_back("Do you really want to exit emulation?");
if (saveOnExit != "all" || !activeTM)
{
msg.push_back("");
msg.push_back("You will lose all your progress.");
}
myOSystem.messageMenu().setMessage("Exit Emulation", msg, true);
enterMenuMode(EventHandlerState::MESSAGEMENU);
}
@ -1775,8 +1781,11 @@ void EventHandler::setState(EventHandlerState state)
void EventHandler::exitEmulation(bool checkLauncher)
{
string saveOnExit = myOSystem.settings().getString("saveonexit");
bool activeTM = myOSystem.settings().getBool(
myOSystem.settings().getBool("dev.settings") ? "dev.timemachine" : "plr.timemachine");
if (saveOnExit == "all")
if (saveOnExit == "all" && activeTM)
handleEvent(Event::SaveAllStates);
else if (saveOnExit == "current")
handleEvent(Event::SaveState);

View File

@ -410,6 +410,13 @@ string OSystem::createConsole(const FilesystemNode& rom, const string& md5sum,
}
myConsole->initializeAudio();
string saveOnExit = settings().getString("saveonexit");
bool activeTM = settings().getBool(
settings().getBool("dev.settings") ? "dev.timemachine" : "plr.timemachine");
if (saveOnExit == "all" && activeTM)
myEventHandler->handleEvent(Event::LoadAllStates);
if(showmessage)
{
const string& id = myConsole->cartridge().multiCartID();

View File

@ -478,11 +478,11 @@ void DeveloperDialog::addTimeMachineTab(const GUI::Font& font)
ypos += lineHeight + VGAP * 2;
new StaticTextWidget(myTab, font, HBORDER, ypos + 1,
"When exiting emulation:");
"When entering/exiting emulation:");
ypos += lineHeight + VGAP;
mySaveOnExitGroup = new RadioButtonGroup();
r = new RadioButtonWidget(myTab, font, HBORDER + INDENT, ypos + 1,
"Save nothing", mySaveOnExitGroup);
"Do nothing", mySaveOnExitGroup);
wid.push_back(r);
ypos += lineHeight + VGAP;
r = new RadioButtonWidget(myTab, font, HBORDER + INDENT, ypos + 1,
@ -490,7 +490,7 @@ void DeveloperDialog::addTimeMachineTab(const GUI::Font& font)
wid.push_back(r);
ypos += lineHeight + VGAP;
r = new RadioButtonWidget(myTab, font, HBORDER + INDENT, ypos + 1,
"Save all Time Machine states", mySaveOnExitGroup);
"Load/save all Time Machine states", mySaveOnExitGroup);
wid.push_back(r);
ypos += lineHeight + VGAP;