mirror of https://github.com/stella-emu/stella.git
fixed autosave
This commit is contained in:
parent
16a3a977dd
commit
cabc56b155
|
@ -26,6 +26,7 @@
|
|||
#include "FSNode.hxx"
|
||||
#include "Settings.hxx"
|
||||
#include "DebuggerDialog.hxx"
|
||||
#include "PromptWidget.hxx"
|
||||
#include "DebuggerParser.hxx"
|
||||
#include "StateManager.hxx"
|
||||
#include "RewindManager.hxx"
|
||||
|
@ -151,11 +152,16 @@ bool Debugger::startWithFatalError(const string& message)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Debugger::quit(bool exitrom)
|
||||
void Debugger::quit()
|
||||
{
|
||||
if(myOSystem.settings().getBool("dbg.autosave"))
|
||||
if(myOSystem.settings().getBool("dbg.autosave")
|
||||
&& myDialog->prompt().isLoaded())
|
||||
myParser->run("save");
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Debugger::exit(bool exitrom)
|
||||
{
|
||||
if(exitrom)
|
||||
myOSystem.eventHandler().handleEvent(Event::ExitGame);
|
||||
else
|
||||
|
|
|
@ -102,7 +102,12 @@ class Debugger : public DialogContainer
|
|||
Wrapper method for EventHandler::leaveDebugMode() for those classes
|
||||
that don't have access to EventHandler.
|
||||
*/
|
||||
void quit(bool exitrom);
|
||||
void exit(bool exitrom);
|
||||
|
||||
/**
|
||||
Executed when debugger is quit.
|
||||
*/
|
||||
void quit();
|
||||
|
||||
bool addFunction(const string& name, const string& def,
|
||||
Expression* exp, bool builtin = false);
|
||||
|
|
|
@ -153,7 +153,7 @@ string DebuggerParser::exec(const FilesystemNode& file, StringList* history)
|
|||
history->push_back(command);
|
||||
count++;
|
||||
}
|
||||
buf << "\nExecuted " << count << " commands from \""
|
||||
buf << "\nExecuted " << count << " command" << (count != 1 ? "s" : "") << " from \""
|
||||
<< file.getShortPath() << "\"";
|
||||
|
||||
return buf.str();
|
||||
|
@ -1332,7 +1332,7 @@ void DebuggerParser::executeExec()
|
|||
// "exitRom"
|
||||
void DebuggerParser::executeExitRom()
|
||||
{
|
||||
debugger.quit(true);
|
||||
debugger.exit(true);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -1690,7 +1690,7 @@ void DebuggerParser::executeLogBreaks()
|
|||
bool enable = !debugger.mySystem.m6502().getLogBreaks();
|
||||
|
||||
debugger.mySystem.m6502().setLogBreaks(enable);
|
||||
settings.setValue("dbg.logBreaks", enable);
|
||||
settings.setValue("dbg.logbreaks", enable);
|
||||
commandResult << "logBreaks " << (enable ? "enabled" : "disabled");
|
||||
}
|
||||
|
||||
|
@ -1814,7 +1814,7 @@ void DebuggerParser::executeRow()
|
|||
void DebuggerParser::executeRun()
|
||||
{
|
||||
debugger.saveOldState();
|
||||
debugger.quit(false);
|
||||
debugger.exit(false);
|
||||
commandResult << "_EXIT_DEBUGGER"; // See PromptWidget for more info
|
||||
}
|
||||
|
||||
|
|
|
@ -53,6 +53,8 @@ class PromptWidget : public Widget, public CommandSender
|
|||
|
||||
void addToHistory(const char *str);
|
||||
|
||||
bool isLoaded() const { return !_firstTime; }
|
||||
|
||||
protected:
|
||||
ATTRIBUTE_FMT_PRINTF int printf(const char* format, ...);
|
||||
ATTRIBUTE_FMT_PRINTF int vprintf(const char* format, va_list argptr);
|
||||
|
|
|
@ -54,6 +54,7 @@
|
|||
#endif
|
||||
#ifdef DEBUGGER_SUPPORT
|
||||
#include "Debugger.hxx"
|
||||
#include "DebuggerParser.hxx"
|
||||
#endif
|
||||
#ifdef GUI_SUPPORT
|
||||
#include "Menu.hxx"
|
||||
|
@ -2996,12 +2997,15 @@ void EventHandler::exitEmulation(bool checkLauncher)
|
|||
const bool activeTM = myOSystem.settings().getBool(
|
||||
myOSystem.settings().getBool("dev.settings") ? "dev.timemachine" : "plr.timemachine");
|
||||
|
||||
|
||||
if (saveOnExit == "all" && activeTM)
|
||||
handleEvent(Event::SaveAllStates);
|
||||
else if (saveOnExit == "current")
|
||||
handleEvent(Event::SaveState);
|
||||
|
||||
#if DEBUGGER_SUPPORT
|
||||
myOSystem.debugger().quit();
|
||||
#endif
|
||||
|
||||
if (checkLauncher)
|
||||
{
|
||||
// Go back to the launcher, or immediately quit
|
||||
|
|
Loading…
Reference in New Issue