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