diff options
author | Max Horn | 2010-07-17 18:38:42 +0000 |
---|---|---|
committer | Max Horn | 2010-07-17 18:38:42 +0000 |
commit | 1d4c82885ddcc0442671c863eef643aef2dc7dda (patch) | |
tree | aba7524c27208b07bbf2e0e598b3d1b9fd21d769 | |
parent | 625af1260b2b6a28b57726564547d740fce35cad (diff) | |
download | scummvm-rg350-1d4c82885ddcc0442671c863eef643aef2dc7dda.tar.gz scummvm-rg350-1d4c82885ddcc0442671c863eef643aef2dc7dda.tar.bz2 scummvm-rg350-1d4c82885ddcc0442671c863eef643aef2dc7dda.zip |
DEBUGGER: Simplify how our console debugger works / is used
* Remove _isAttached member var and isAttached method
* Engines now always call the onFrame method; whether it does
something is decided by the debugger class resp. its subclasses
* Make detach() protected instead of private, so that subclasses
can invoke it
* Remove _detach_now member var (call detach() instead).
* Rename _frame_countdown to _frameCountdown and properly
document it.
* Add more doxygen comments
* Cleanup
svn-id: r50963
-rw-r--r-- | engines/agi/agi.cpp | 3 | ||||
-rw-r--r-- | engines/agi/console.cpp | 9 | ||||
-rw-r--r-- | engines/agi/console.h | 17 | ||||
-rw-r--r-- | engines/agos/event.cpp | 3 | ||||
-rw-r--r-- | engines/cruise/cruise_main.cpp | 10 | ||||
-rw-r--r-- | engines/engine.cpp | 2 | ||||
-rw-r--r-- | engines/groovie/groovie.cpp | 6 | ||||
-rw-r--r-- | engines/kyra/debugger.cpp | 4 | ||||
-rw-r--r-- | engines/kyra/kyra_v1.cpp | 2 | ||||
-rw-r--r-- | engines/lure/debugger.cpp | 2 | ||||
-rw-r--r-- | engines/lure/fights.cpp | 3 | ||||
-rw-r--r-- | engines/lure/game.cpp | 3 | ||||
-rw-r--r-- | engines/parallaction/input.cpp | 3 | ||||
-rw-r--r-- | engines/queen/queen.cpp | 4 | ||||
-rw-r--r-- | engines/saga/saga.cpp | 3 | ||||
-rw-r--r-- | engines/sci/engine/vm.cpp | 4 | ||||
-rw-r--r-- | engines/scumm/debugger.cpp | 12 | ||||
-rw-r--r-- | engines/scumm/scumm.cpp | 3 | ||||
-rw-r--r-- | engines/sky/sky.cpp | 3 | ||||
-rw-r--r-- | engines/sword2/sword2.cpp | 3 | ||||
-rw-r--r-- | engines/teenagent/teenagent.cpp | 4 | ||||
-rw-r--r-- | engines/tinsel/tinsel.cpp | 3 | ||||
-rw-r--r-- | gui/debugger.cpp | 61 | ||||
-rw-r--r-- | gui/debugger.h | 116 |
24 files changed, 152 insertions, 131 deletions
diff --git a/engines/agi/agi.cpp b/engines/agi/agi.cpp index ce8b5931af..789d6a2193 100644 --- a/engines/agi/agi.cpp +++ b/engines/agi/agi.cpp @@ -279,8 +279,7 @@ void AgiEngine::pollTimer() { while ((dm = _tickTimer - _lastTickTimer) < 5) { processEvents(); - if (_console->isAttached()) - _console->onFrame(); + _console->onFrame(); _system->delayMillis(10); _system->updateScreen(); } diff --git a/engines/agi/console.cpp b/engines/agi/console.cpp index e881b092e3..e5942455e2 100644 --- a/engines/agi/console.cpp +++ b/engines/agi/console.cpp @@ -53,15 +53,6 @@ Console::Console(AgiEngine *vm) : GUI::Debugger() { DCmd_Register("bt", WRAP_METHOD(Console, Cmd_BT)); } -Console::~Console() { -} - -void Console::preEnter() { -} - -void Console::postEnter() { -} - bool Console::Cmd_SetVar(int argc, const char **argv) { if (argc != 3) { DebugPrintf("Usage: setvar <varnum> <value>\n"); diff --git a/engines/agi/console.h b/engines/agi/console.h index e8eccbe50a..e79db42054 100644 --- a/engines/agi/console.h +++ b/engines/agi/console.h @@ -46,11 +46,6 @@ struct AgiDebug { class Console : public GUI::Debugger { public: Console(AgiEngine *vm); - virtual ~Console(); - -protected: - virtual void preEnter(); - virtual void postEnter(); private: bool Cmd_SetVar(int argc, const char **argv); @@ -80,10 +75,6 @@ public: PreAGI_Console(PreAgiEngine *vm); virtual ~PreAGI_Console() {} -protected: - virtual void preEnter() {} - virtual void postEnter() {} - private: PreAgiEngine *_vm; }; @@ -94,10 +85,6 @@ public: Mickey_Console(PreAgiEngine *vm, Mickey *mickey); virtual ~Mickey_Console() {} -protected: - virtual void preEnter() {} - virtual void postEnter() {} - private: Mickey *_mickey; @@ -112,10 +99,6 @@ public: Winnie_Console(PreAgiEngine *vm, Winnie *winnie); virtual ~Winnie_Console() {} -protected: - virtual void preEnter() {} - virtual void postEnter() {} - private: Winnie *_winnie; diff --git a/engines/agos/event.cpp b/engines/agos/event.cpp index ac552ec285..95c9db906a 100644 --- a/engines/agos/event.cpp +++ b/engines/agos/event.cpp @@ -431,8 +431,7 @@ void AGOSEngine::delay(uint amount) { AudioCD.updateCD(); - if (_debugger->isAttached()) - _debugger->onFrame(); + _debugger->onFrame(); vgaPeriod = (_fastMode) ? 10 : _vgaPeriod; if (getGameType() == GType_PP && getGameId() != GID_DIMP) { diff --git a/engines/cruise/cruise_main.cpp b/engines/cruise/cruise_main.cpp index 14de916a84..65d8b57366 100644 --- a/engines/cruise/cruise_main.cpp +++ b/engines/cruise/cruise_main.cpp @@ -1833,19 +1833,17 @@ void CruiseEngine::mainLoop() { if (!skipEvents) skipEvents = manageEvents(); - if (playerDontAskQuit) break; + if (playerDontAskQuit) + break; - if (_vm->getDebugger()->isAttached()) - _vm->getDebugger()->onFrame(); + _vm->getDebugger()->onFrame(); } while (currentTick < lastTick + _gameSpeed); } else { manageEvents(); if (currentTick >= (lastTickDebug + 10)) { lastTickDebug = currentTick; - - if (_vm->getDebugger()->isAttached()) - _vm->getDebugger()->onFrame(); + _vm->getDebugger()->onFrame(); } } if (playerDontAskQuit) diff --git a/engines/engine.cpp b/engines/engine.cpp index 84fc0bbe4e..e2c0bb79f3 100644 --- a/engines/engine.cpp +++ b/engines/engine.cpp @@ -78,7 +78,7 @@ static void defaultErrorHandler(const char *msg) { if (isSmartphone()) debugger = 0; #endif - if (debugger && !debugger->isAttached()) { + if (debugger && !debugger->isActive()) { debugger->attach(msg); debugger->onFrame(); } diff --git a/engines/groovie/groovie.cpp b/engines/groovie/groovie.cpp index 9da413d362..cdf5171ab9 100644 --- a/engines/groovie/groovie.cpp +++ b/engines/groovie/groovie.cpp @@ -220,10 +220,8 @@ Common::Error GroovieEngine::run() { _system->openCD(cd_num); while (!shouldQuit()) { - // Show the debugger if required - if (_debugger->isAttached()) { - _debugger->onFrame(); - } + // Give the debugger a chance to act + _debugger->onFrame(); // Handle input Common::Event ev; diff --git a/engines/kyra/debugger.cpp b/engines/kyra/debugger.cpp index d71f7b8b25..225b44b3f4 100644 --- a/engines/kyra/debugger.cpp +++ b/engines/kyra/debugger.cpp @@ -240,7 +240,7 @@ bool Debugger_LoK::cmd_enterRoom(int argc, const char **argv) { while (!_vm->_screen->isMouseVisible()) _vm->_screen->showMouse(); - _detach_now = true; + detach(); return false; } @@ -327,7 +327,7 @@ bool Debugger_v2::cmd_enterScene(int argc, const char **argv) { while (!_vm->screen_v2()->isMouseVisible()) _vm->screen_v2()->showMouse(); - _detach_now = true; + detach(); return false; } diff --git a/engines/kyra/kyra_v1.cpp b/engines/kyra/kyra_v1.cpp index abe13cec2b..2c6cd3ab5c 100644 --- a/engines/kyra/kyra_v1.cpp +++ b/engines/kyra/kyra_v1.cpp @@ -336,7 +336,7 @@ int KyraEngine_v1::checkInput(Button *buttonList, bool mainLoop, int eventFlag) break; } - if (_debugger && _debugger->isAttached()) + if (_debugger) _debugger->onFrame(); if (breakLoop) diff --git a/engines/lure/debugger.cpp b/engines/lure/debugger.cpp index 3abc079a05..1cfe0804e4 100644 --- a/engines/lure/debugger.cpp +++ b/engines/lure/debugger.cpp @@ -105,7 +105,7 @@ bool Debugger::cmd_enterRoom(int argc, const char **argv) { if (!remoteFlag) res.getActiveHotspot(PLAYER_ID)->setRoomNumber(roomNumber); - _detach_now = true; + detach(); return false; } diff --git a/engines/lure/fights.cpp b/engines/lure/fights.cpp index 53539677c8..789c9d924e 100644 --- a/engines/lure/fights.cpp +++ b/engines/lure/fights.cpp @@ -132,8 +132,7 @@ void FightsManager::fightLoop() { } Screen::getReference().update(); - if (game.debugger().isAttached()) - game.debugger().onFrame(); + game.debugger().onFrame(); g_system->delayMillis(10); } diff --git a/engines/lure/game.cpp b/engines/lure/game.cpp index d0f98b9c34..5d2f0e8ed1 100644 --- a/engines/lure/game.cpp +++ b/engines/lure/game.cpp @@ -281,8 +281,7 @@ void Game::execute() { system.updateScreen(); system.delayMillis(10); - if (_debugger->isAttached()) - _debugger->onFrame(); + _debugger->onFrame(); } room.leaveRoom(); diff --git a/engines/parallaction/input.cpp b/engines/parallaction/input.cpp index 6d3f6f0b04..ca8f358158 100644 --- a/engines/parallaction/input.cpp +++ b/engines/parallaction/input.cpp @@ -148,8 +148,7 @@ void Input::readInput() { setCursorPos(e.mouse); } - if (_vm->_debugger->isAttached()) - _vm->_debugger->onFrame(); + _vm->_debugger->onFrame(); return; diff --git a/engines/queen/queen.cpp b/engines/queen/queen.cpp index 10c3d56cb4..5cda4e3208 100644 --- a/engines/queen/queen.cpp +++ b/engines/queen/queen.cpp @@ -264,9 +264,7 @@ void QueenEngine::writeOptionSettings() { } void QueenEngine::update(bool checkPlayerInput) { - if (_debugger->isAttached()) { - _debugger->onFrame(); - } + _debugger->onFrame(); _graphics->update(_logic->currentRoom()); _logic->update(); diff --git a/engines/saga/saga.cpp b/engines/saga/saga.cpp index d1ab3bc9d7..1b7fa97f8d 100644 --- a/engines/saga/saga.cpp +++ b/engines/saga/saga.cpp @@ -352,8 +352,7 @@ Common::Error SagaEngine::run() { uint32 currentTicks; while (!shouldQuit()) { - if (_console->isAttached()) - _console->onFrame(); + _console->onFrame(); if (_render->getFlags() & RF_RENDERPAUSE) { // Freeze time while paused diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp index c7909672e5..900d843867 100644 --- a/engines/sci/engine/vm.cpp +++ b/engines/sci/engine/vm.cpp @@ -1085,9 +1085,7 @@ void run_vm(EngineState *s, bool restoring) { g_sci->_debugState.breakpointWasHit = false; } Console *con = g_sci->getSciDebugger(); - if (con->isAttached()) { - con->onFrame(); - } + con->onFrame(); if (s->xs->sp < s->xs->fp) error("run_vm(): stack underflow, sp: %04x:%04x, fp: %04x:%04x", diff --git a/engines/scumm/debugger.cpp b/engines/scumm/debugger.cpp index ea29e25a1f..b5a4070f0b 100644 --- a/engines/scumm/debugger.cpp +++ b/engines/scumm/debugger.cpp @@ -62,8 +62,6 @@ ScummDebugger::ScummDebugger(ScummEngine *s) _vm = s; // Register variables - DVar_Register("debug_countdown", &_frame_countdown, DVAR_INT, 0); - DVar_Register("scumm_speed", &_vm->_fastMode, DVAR_BYTE, 0); DVar_Register("scumm_room", &_vm->_currentRoom, DVAR_BYTE, 0); DVar_Register("scumm_roomresource", &_vm->_roomResource, DVAR_INT, 0); @@ -128,7 +126,7 @@ void ScummDebugger::postEnter() { bool ScummDebugger::Cmd_Restart(int argc, const char **argv) { _vm->restart(); - _detach_now = true; + detach(); return false; } @@ -202,7 +200,7 @@ bool ScummDebugger::Cmd_LoadGame(int argc, const char **argv) { _vm->requestLoad(slot); - _detach_now = true; + detach(); return false; } @@ -867,7 +865,7 @@ bool ScummDebugger::Cmd_Passcode(int argc, const char **argv) { } _vm->_bootParam = 0; - _detach_now = true; + detach(); } else { DebugPrintf("Current Passcode is %d \nUse 'passcode <SEGA CD Passcode>'\n",_vm->_scummVars[411]); @@ -878,9 +876,7 @@ bool ScummDebugger::Cmd_Passcode(int argc, const char **argv) { bool ScummDebugger::Cmd_ResetCursors(int argc, const char **argv) { _vm->resetCursors(); - - _detach_now = true; - + detach(); return false; } diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index 7c3b8a4a1d..b44184f5cb 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -1840,8 +1840,7 @@ Common::Error ScummEngine::go() { while (!shouldQuit()) { - if (_debugger->isAttached()) - _debugger->onFrame(); + _debugger->onFrame(); // Randomize the PRNG by calling it at regular intervals. This ensures // that it will be in a different state each time you run the program. diff --git a/engines/sky/sky.cpp b/engines/sky/sky.cpp index 45b3cab947..edf96f8e8c 100644 --- a/engines/sky/sky.cpp +++ b/engines/sky/sky.cpp @@ -185,8 +185,7 @@ Common::Error SkyEngine::go() { uint32 delayCount = _system->getMillis(); while (!shouldQuit()) { - if (_debugger->isAttached()) - _debugger->onFrame(); + _debugger->onFrame(); if (shouldPerformAutoSave(_lastSaveTime)) { if (_skyControl->loadSaveAllowed()) { diff --git a/engines/sword2/sword2.cpp b/engines/sword2/sword2.cpp index 29f567d7ef..1060dcf728 100644 --- a/engines/sword2/sword2.cpp +++ b/engines/sword2/sword2.cpp @@ -458,8 +458,7 @@ Common::Error Sword2Engine::run() { _screen->initialiseRenderCycle(); while (1) { - if (_debugger->isAttached()) - _debugger->onFrame(); + _debugger->onFrame(); #ifdef SWORD2_DEBUG if (_stepOneCycle) { diff --git a/engines/teenagent/teenagent.cpp b/engines/teenagent/teenagent.cpp index bb0e9773a2..c30809eef4 100644 --- a/engines/teenagent/teenagent.cpp +++ b/engines/teenagent/teenagent.cpp @@ -618,9 +618,7 @@ Common::Error TeenAgentEngine::run() { _system->updateScreen(); - if (console->isAttached()) { - console->onFrame(); - } + console->onFrame(); uint32 next_tick = MIN(game_timer, mark_timer); if (next_tick > 0) { diff --git a/engines/tinsel/tinsel.cpp b/engines/tinsel/tinsel.cpp index 195066cac1..6c77a98dda 100644 --- a/engines/tinsel/tinsel.cpp +++ b/engines/tinsel/tinsel.cpp @@ -1001,8 +1001,7 @@ Common::Error TinselEngine::run() { uint32 timerVal = 0; while (!shouldQuit()) { assert(_console); - if (_console->isAttached()) - _console->onFrame(); + _console->onFrame(); // Check for time to do next game cycle if ((g_system->getMillis() > timerVal + GAME_FRAME_DELAY)) { diff --git a/gui/debugger.cpp b/gui/debugger.cpp index 13dc02452d..71728e8b13 100644 --- a/gui/debugger.cpp +++ b/gui/debugger.cpp @@ -39,9 +39,8 @@ namespace GUI { Debugger::Debugger() { - _frame_countdown = 0; - _detach_now = false; - _isAttached = false; + _frameCountdown = 0; + _isActive = false; _errStr = NULL; _firstTime = true; #ifndef USE_TEXT_CONSOLE @@ -50,6 +49,10 @@ Debugger::Debugger() { _debuggerDialog->setCompletionCallback(debuggerCompletionCallback, this); #endif + // Register variables + DVar_Register("debug_countdown", &_frameCountdown, DVAR_INT, 0); + + // Register commands //DCmd_Register("continue", WRAP_METHOD(Debugger, Cmd_Exit)); DCmd_Register("exit", WRAP_METHOD(Debugger, Cmd_Exit)); DCmd_Register("quit", WRAP_METHOD(Debugger, Cmd_Exit)); @@ -84,40 +87,32 @@ int Debugger::DebugPrintf(const char *format, ...) { } void Debugger::attach(const char *entry) { - g_system->setFeatureState(OSystem::kFeatureVirtualKeyboard, true); - if (entry) { - _errStr = strdup(entry); - } + // Set error string (if any) + free(_errStr); + _errStr = entry ? strdup(entry) : 0; - _frame_countdown = 1; - _detach_now = false; - _isAttached = true; + // Reset frame countdown (i.e. attach immediately) + _frameCountdown = 1; } void Debugger::detach() { g_system->setFeatureState(OSystem::kFeatureVirtualKeyboard, false); - - _detach_now = false; - _isAttached = false; } // Temporary execution handler void Debugger::onFrame() { - if (_frame_countdown == 0) - return; - --_frame_countdown; - - if (!_frame_countdown) { - - preEnter(); - enter(); - postEnter(); - - // Detach if we're finished with the debugger - if (_detach_now) - detach(); + // Count down until 0 is reached + if (_frameCountdown > 0) { + --_frameCountdown; + if (_frameCountdown == 0) { + _isActive = true; + preEnter(); + enter(); + postEnter(); + _isActive = false; + } } } @@ -250,8 +245,8 @@ bool Debugger::parseCommand(const char *inputOrig) { } else { int element = atoi(chr+1); int32 *var = *(int32 **)_dvars[i].variable; - if (element >= _dvars[i].optional) { - DebugPrintf("%s is out of range (array is %d elements big)\n", param[0], _dvars[i].optional); + if (element >= _dvars[i].arraySize) { + DebugPrintf("%s is out of range (array is %d elements big)\n", param[0], _dvars[i].arraySize); } else { var[element] = atoi(param[1]); DebugPrintf("(int)%s = %d\n", param[0], var[element]); @@ -281,8 +276,8 @@ bool Debugger::parseCommand(const char *inputOrig) { } else { int element = atoi(chr+1); const int32 *var = *(const int32 **)_dvars[i].variable; - if (element >= _dvars[i].optional) { - DebugPrintf("%s is out of range (array is %d elements big)\n", param[0], _dvars[i].optional); + if (element >= _dvars[i].arraySize) { + DebugPrintf("%s is out of range (array is %d elements big)\n", param[0], _dvars[i].arraySize); } else { DebugPrintf("(int)%s = %d\n", param[0], var[element]); } @@ -383,7 +378,7 @@ char *Debugger::readlineComplete(const char *input, int state) { #endif // Variable registration function -void Debugger::DVar_Register(const Common::String &varname, void *pointer, int type, int optional) { +void Debugger::DVar_Register(const Common::String &varname, void *pointer, int type, int arraySize) { // TODO: Filter out duplicates // TODO: Sort this list? Then we can do binary search later on when doing lookups. assert(pointer); @@ -392,7 +387,7 @@ void Debugger::DVar_Register(const Common::String &varname, void *pointer, int t tmp.name = varname; tmp.type = type; tmp.variable = pointer; - tmp.optional = optional; + tmp.arraySize = arraySize; _dvars.push_back(tmp); } @@ -406,7 +401,7 @@ void Debugger::DCmd_Register(const Common::String &cmdname, Debuglet *debuglet) // Detach ("exit") the debugger bool Debugger::Cmd_Exit(int argc, const char **argv) { - _detach_now = true; + detach(); return false; } diff --git a/gui/debugger.h b/gui/debugger.h index 07fdddb808..6f06befdf1 100644 --- a/gui/debugger.h +++ b/gui/debugger.h @@ -43,20 +43,46 @@ public: int DebugPrintf(const char *format, ...); + /** + * The onFrame() method should be invoked by the engine at regular + * intervals (usually once per main loop iteration) whenever the + * debugger is attached. + * This will open up the console and accept user input if certain + * preconditions are met, such as the frame countdown having + * reached zero. + * + * Subclasses can override this to e.g. check for breakpoints being + * triggered. + */ virtual void onFrame(); + /** + * 'Attach' the debugger. This ensures that the next time onFrame() + * is invoked, the debugger will activate and accept user input. + */ virtual void attach(const char *entry = 0); - bool isAttached() const { return _isAttached; } + + /** + * Return true if the debugger is currently active (i.e. executing + * a command or waiting for use input). + */ + bool isActive() const { return _isActive; } protected: typedef Common::Functor2<int, const char **, bool> Debuglet; - // Convenience macro for registering a method of a debugger class - // as the current command. + /** + * Convenience macro that makes it either to register a method + * of a debugger subclass as a command. + * Usage example: + * DCmd_Register("COMMAND", WRAP_METHOD(MyDebugger, MyCmd)); + * would register the method MyDebugger::MyCmd(int, const char **) + * under the command name "COMMAND". + */ #define WRAP_METHOD(cls, method) \ new Common::Functor2Mem<int, const char **, bool, cls>(this, &cls::method) - enum { + enum VarType { DVAR_BYTE, DVAR_INT, DVAR_BOOL, @@ -67,50 +93,100 @@ protected: struct DVar { Common::String name; void *variable; - int type; - int optional; + VarType type; + int arraySize; }; - int _frame_countdown; - bool _detach_now; + + /** + * Register a variable with the debugger. This allows the user to read and modify + * this variable. + * @param varname the identifier with which the user may access the variable + * @param variable pointer to the actual storage of the variable + * @param type the type of the variable (byte, int, bool, ...) + * @paral arraySize for type DVAR_INTARRAY this specifies the size of the array + * + * @todo replace this single method by type safe variants. + */ + void DVar_Register(const Common::String &varname, void *variable, VarType type, int arraySize); + void DCmd_Register(const Common::String &cmdname, Debuglet *debuglet); + private: + /** + * The frame countdown specifies a number of frames that must pass + * until the console will show up. This value is decremented by one + * each time onFrame() is called, until it reaches 0, at which point + * onFrame() will open the console and handle input into it. + * + * The user can modify this value using the debug_countdown command. + * + * Note: The console must be in *attached* state, otherwise, it + * won't show up (and the countdown won't count down either). + */ + uint _frameCountdown; + Common::Array<DVar> _dvars; typedef Common::HashMap<Common::String, Common::SharedPtr<Debuglet>, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> CommandsMap; CommandsMap _cmds; - bool _isAttached; + /** + * True if the debugger is currently active (i.e. executing + * a command or waiting for use input). + */ + bool _isActive; + char *_errStr; + + /** + * Initially true, set to false when Debugger::enter is called + * the first time. We use this flag to show a greeting message + * to the user once, when he opens the debugger for the first + * time. + */ bool _firstTime; + #ifndef USE_TEXT_CONSOLE GUI::ConsoleDialog *_debuggerDialog; #endif protected: - // Hook for subclasses: Called just before enter() is run + /** + * Hook for subclasses which is called just before enter() is run. + * A typical usage example is pausing music and sound effects. + */ virtual void preEnter() {} - // Hook for subclasses: Called just after enter() was run + /** + * Hook for subclasses which is called just after enter() was run. + * A typical usage example is resuming music and sound effects. + */ virtual void postEnter() {} - // Hook for subclasses: Process the given command line. - // Should return true if and only if argv[0] is a known command and was - // handled, false otherwise. - virtual bool handleCommand(int argc, const char **argv, bool &keepRunning); - + /** + * Subclasses should invoke the detach() method in their Cmd_FOO methods + * if that command will resume execution of the program (as opposed to + * executing, say, a "single step through code" command). + * + * This currently only hides the virtual keyboard, if any. + */ + void detach(); private: - void detach(); void enter(); bool parseCommand(const char *input); bool tabComplete(const char *input, Common::String &completion) const; -protected: - void DVar_Register(const Common::String &varname, void *pointer, int type, int optional); - void DCmd_Register(const Common::String &cmdname, Debuglet *debuglet); + /** + * Process the given command line. + * Returns true if and only if argv[0] is a known command and was + * handled, false otherwise. + */ + virtual bool handleCommand(int argc, const char **argv, bool &keepRunning); +protected: bool Cmd_Exit(int argc, const char **argv); bool Cmd_Help(int argc, const char **argv); bool Cmd_DebugFlagsList(int argc, const char **argv); |