diff --git a/Changes.txt b/Changes.txt index 9573b1389..369fda381 100644 --- a/Changes.txt +++ b/Changes.txt @@ -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. diff --git a/docs/graphics/options_developer_timemachine.png b/docs/graphics/options_developer_timemachine.png index ff0e2178a..ddb58f28e 100644 Binary files a/docs/graphics/options_developer_timemachine.png and b/docs/graphics/options_developer_timemachine.png differ diff --git a/docs/index.html b/docs/index.html index b2ab9f1b5..4efd03786 100644 --- a/docs/index.html +++ b/docs/index.html @@ -2256,7 +2256,8 @@
-saveonexit <none|current|all>
- Automatically save no, current or all states when exiting emulation. + Automatically save no, current or all states when exiting emulation. The latter + also loads all states when entering emulation. @@ -3402,11 +3403,12 @@ -plr.tm.horizon
-dev.tm.horizon - When exiting emulation: + When entering/exiting emulation: Automatically save no, current or all Time Machine states when exiting emulation.
- 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! -saveonexit diff --git a/src/emucore/EventHandler.cxx b/src/emucore/EventHandler.cxx index eb7500259..823b3d9d7 100644 --- a/src/emucore/EventHandler.cxx +++ b/src/emucore/EventHandler.cxx @@ -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?"); - msg.push_back(""); - msg.push_back("You will lose all your progress."); - + 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); diff --git a/src/emucore/OSystem.cxx b/src/emucore/OSystem.cxx index dfc87e9e3..70f738f1f 100644 --- a/src/emucore/OSystem.cxx +++ b/src/emucore/OSystem.cxx @@ -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(); diff --git a/src/gui/DeveloperDialog.cxx b/src/gui/DeveloperDialog.cxx index bc79a2d40..4d6924f11 100644 --- a/src/gui/DeveloperDialog.cxx +++ b/src/gui/DeveloperDialog.cxx @@ -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;