mirror of https://github.com/stella-emu/stella.git
A different implementation of testing whether debugger can be exited.
- basically check whether the current dialog is the 'base' one (ie, the debugger window) - this solution is more robust, in that we don't have to modify every dialog that can appear in the debugger
This commit is contained in:
parent
9263e7c62f
commit
d7bcde29dc
|
@ -64,8 +64,7 @@ Debugger::Debugger(OSystem& osystem, Console& console)
|
|||
mySystem(console.system()),
|
||||
myDialog(nullptr),
|
||||
myWidth(DebuggerDialog::kSmallFontMinW),
|
||||
myHeight(DebuggerDialog::kSmallFontMinH),
|
||||
myMenuMode(false)
|
||||
myHeight(DebuggerDialog::kSmallFontMinH)
|
||||
{
|
||||
// Init parser
|
||||
myParser = make_unique<DebuggerParser>(*this, osystem.settings());
|
||||
|
@ -784,6 +783,12 @@ void Debugger::unlockBankswitchState()
|
|||
myConsole.cartridge().unlockBank();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool Debugger::canExit() const
|
||||
{
|
||||
return myDialogStack.top() == baseDialog();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Debugger::BuiltinFunction Debugger::ourBuiltinFunctions[NUM_BUILTIN_FUNCS] = {
|
||||
// left joystick:
|
||||
|
|
|
@ -241,11 +241,10 @@ class Debugger : public DialogContainer
|
|||
void unlockBankswitchState();
|
||||
|
||||
/**
|
||||
Used to make sure that debugger cannot be exited while Options dialog is open.
|
||||
(ugly hack!)
|
||||
Answers whether the debugger can be exited. Currently this only
|
||||
happens when no other dialogs are active.
|
||||
*/
|
||||
void setMenuMode(bool enable) { myMenuMode = enable; };
|
||||
bool inMenuMode() { return myMenuMode; };
|
||||
bool canExit() const;
|
||||
|
||||
private:
|
||||
/**
|
||||
|
@ -330,8 +329,6 @@ class Debugger : public DialogContainer
|
|||
static BuiltinFunction ourBuiltinFunctions[NUM_BUILTIN_FUNCS];
|
||||
static PseudoRegister ourPseudoRegisters[NUM_PSEUDO_REGS];
|
||||
|
||||
bool myMenuMode;
|
||||
|
||||
private:
|
||||
// rewind/unwind n states
|
||||
uInt16 windStates(uInt16 numStates, bool unwind, string& message);
|
||||
|
|
|
@ -174,7 +174,6 @@ void DebuggerDialog::handleCommand(CommandSender* sender, int cmd,
|
|||
break;
|
||||
|
||||
case kDDOptionsCmd:
|
||||
instance().debugger().setMenuMode(true);
|
||||
myOptions->open();
|
||||
loadConfig();
|
||||
break;
|
||||
|
|
|
@ -1275,7 +1275,7 @@ bool EventHandler::eventStateChange(Event::Type type)
|
|||
case Event::DebuggerMode:
|
||||
if(myState == EventHandlerState::EMULATION || myState == EventHandlerState::PAUSE)
|
||||
enterDebugMode();
|
||||
else if(myState == EventHandlerState::DEBUGGER && !myOSystem.debugger().inMenuMode())
|
||||
else if(myState == EventHandlerState::DEBUGGER && myOSystem.debugger().canExit())
|
||||
leaveDebugMode();
|
||||
else
|
||||
handled = false;
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
#include "HelpDialog.hxx"
|
||||
#include "AboutDialog.hxx"
|
||||
#include "OptionsDialog.hxx"
|
||||
#include "Debugger.hxx"
|
||||
#include "Launcher.hxx"
|
||||
|
||||
#ifdef CHEATCODE_SUPPORT
|
||||
|
@ -252,10 +251,7 @@ void OptionsDialog::handleCommand(CommandSender* sender, int cmd,
|
|||
|
||||
case kExitCmd:
|
||||
if(myMode != emulator)
|
||||
{
|
||||
instance().debugger().setMenuMode(false);
|
||||
close();
|
||||
}
|
||||
else
|
||||
instance().eventHandler().leaveMenuMode();
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue