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 /engines | |
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
Diffstat (limited to 'engines')
-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 |
22 files changed, 28 insertions, 78 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)) { |