[Scummvm-cvs-logs] SF.net SVN: scummvm:[50963] scummvm/trunk
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Sat Jul 17 20:38:42 CEST 2010
Revision: 50963
http://scummvm.svn.sourceforge.net/scummvm/?rev=50963&view=rev
Author: fingolfin
Date: 2010-07-17 18:38:42 +0000 (Sat, 17 Jul 2010)
Log Message:
-----------
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
Modified Paths:
--------------
scummvm/trunk/engines/agi/agi.cpp
scummvm/trunk/engines/agi/console.cpp
scummvm/trunk/engines/agi/console.h
scummvm/trunk/engines/agos/event.cpp
scummvm/trunk/engines/cruise/cruise_main.cpp
scummvm/trunk/engines/engine.cpp
scummvm/trunk/engines/groovie/groovie.cpp
scummvm/trunk/engines/kyra/debugger.cpp
scummvm/trunk/engines/kyra/kyra_v1.cpp
scummvm/trunk/engines/lure/debugger.cpp
scummvm/trunk/engines/lure/fights.cpp
scummvm/trunk/engines/lure/game.cpp
scummvm/trunk/engines/parallaction/input.cpp
scummvm/trunk/engines/queen/queen.cpp
scummvm/trunk/engines/saga/saga.cpp
scummvm/trunk/engines/sci/engine/vm.cpp
scummvm/trunk/engines/scumm/debugger.cpp
scummvm/trunk/engines/scumm/scumm.cpp
scummvm/trunk/engines/sky/sky.cpp
scummvm/trunk/engines/sword2/sword2.cpp
scummvm/trunk/engines/teenagent/teenagent.cpp
scummvm/trunk/engines/tinsel/tinsel.cpp
scummvm/trunk/gui/debugger.cpp
scummvm/trunk/gui/debugger.h
Modified: scummvm/trunk/engines/agi/agi.cpp
===================================================================
--- scummvm/trunk/engines/agi/agi.cpp 2010-07-17 17:58:50 UTC (rev 50962)
+++ scummvm/trunk/engines/agi/agi.cpp 2010-07-17 18:38:42 UTC (rev 50963)
@@ -279,8 +279,7 @@
while ((dm = _tickTimer - _lastTickTimer) < 5) {
processEvents();
- if (_console->isAttached())
- _console->onFrame();
+ _console->onFrame();
_system->delayMillis(10);
_system->updateScreen();
}
Modified: scummvm/trunk/engines/agi/console.cpp
===================================================================
--- scummvm/trunk/engines/agi/console.cpp 2010-07-17 17:58:50 UTC (rev 50962)
+++ scummvm/trunk/engines/agi/console.cpp 2010-07-17 18:38:42 UTC (rev 50963)
@@ -53,15 +53,6 @@
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");
Modified: scummvm/trunk/engines/agi/console.h
===================================================================
--- scummvm/trunk/engines/agi/console.h 2010-07-17 17:58:50 UTC (rev 50962)
+++ scummvm/trunk/engines/agi/console.h 2010-07-17 18:38:42 UTC (rev 50963)
@@ -46,12 +46,7 @@
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);
bool Cmd_SetFlag(int argc, const char **argv);
@@ -80,10 +75,6 @@
PreAGI_Console(PreAgiEngine *vm);
virtual ~PreAGI_Console() {}
-protected:
- virtual void preEnter() {}
- virtual void postEnter() {}
-
private:
PreAgiEngine *_vm;
};
@@ -94,10 +85,6 @@
Mickey_Console(PreAgiEngine *vm, Mickey *mickey);
virtual ~Mickey_Console() {}
-protected:
- virtual void preEnter() {}
- virtual void postEnter() {}
-
private:
Mickey *_mickey;
@@ -112,10 +99,6 @@
Winnie_Console(PreAgiEngine *vm, Winnie *winnie);
virtual ~Winnie_Console() {}
-protected:
- virtual void preEnter() {}
- virtual void postEnter() {}
-
private:
Winnie *_winnie;
Modified: scummvm/trunk/engines/agos/event.cpp
===================================================================
--- scummvm/trunk/engines/agos/event.cpp 2010-07-17 17:58:50 UTC (rev 50962)
+++ scummvm/trunk/engines/agos/event.cpp 2010-07-17 18:38:42 UTC (rev 50963)
@@ -431,8 +431,7 @@
AudioCD.updateCD();
- if (_debugger->isAttached())
- _debugger->onFrame();
+ _debugger->onFrame();
vgaPeriod = (_fastMode) ? 10 : _vgaPeriod;
if (getGameType() == GType_PP && getGameId() != GID_DIMP) {
Modified: scummvm/trunk/engines/cruise/cruise_main.cpp
===================================================================
--- scummvm/trunk/engines/cruise/cruise_main.cpp 2010-07-17 17:58:50 UTC (rev 50962)
+++ scummvm/trunk/engines/cruise/cruise_main.cpp 2010-07-17 18:38:42 UTC (rev 50963)
@@ -1833,19 +1833,17 @@
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)
Modified: scummvm/trunk/engines/engine.cpp
===================================================================
--- scummvm/trunk/engines/engine.cpp 2010-07-17 17:58:50 UTC (rev 50962)
+++ scummvm/trunk/engines/engine.cpp 2010-07-17 18:38:42 UTC (rev 50963)
@@ -78,7 +78,7 @@
if (isSmartphone())
debugger = 0;
#endif
- if (debugger && !debugger->isAttached()) {
+ if (debugger && !debugger->isActive()) {
debugger->attach(msg);
debugger->onFrame();
}
Modified: scummvm/trunk/engines/groovie/groovie.cpp
===================================================================
--- scummvm/trunk/engines/groovie/groovie.cpp 2010-07-17 17:58:50 UTC (rev 50962)
+++ scummvm/trunk/engines/groovie/groovie.cpp 2010-07-17 18:38:42 UTC (rev 50963)
@@ -220,10 +220,8 @@
_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;
Modified: scummvm/trunk/engines/kyra/debugger.cpp
===================================================================
--- scummvm/trunk/engines/kyra/debugger.cpp 2010-07-17 17:58:50 UTC (rev 50962)
+++ scummvm/trunk/engines/kyra/debugger.cpp 2010-07-17 18:38:42 UTC (rev 50963)
@@ -240,7 +240,7 @@
while (!_vm->_screen->isMouseVisible())
_vm->_screen->showMouse();
- _detach_now = true;
+ detach();
return false;
}
@@ -327,7 +327,7 @@
while (!_vm->screen_v2()->isMouseVisible())
_vm->screen_v2()->showMouse();
- _detach_now = true;
+ detach();
return false;
}
Modified: scummvm/trunk/engines/kyra/kyra_v1.cpp
===================================================================
--- scummvm/trunk/engines/kyra/kyra_v1.cpp 2010-07-17 17:58:50 UTC (rev 50962)
+++ scummvm/trunk/engines/kyra/kyra_v1.cpp 2010-07-17 18:38:42 UTC (rev 50963)
@@ -336,7 +336,7 @@
break;
}
- if (_debugger && _debugger->isAttached())
+ if (_debugger)
_debugger->onFrame();
if (breakLoop)
Modified: scummvm/trunk/engines/lure/debugger.cpp
===================================================================
--- scummvm/trunk/engines/lure/debugger.cpp 2010-07-17 17:58:50 UTC (rev 50962)
+++ scummvm/trunk/engines/lure/debugger.cpp 2010-07-17 18:38:42 UTC (rev 50963)
@@ -105,7 +105,7 @@
if (!remoteFlag)
res.getActiveHotspot(PLAYER_ID)->setRoomNumber(roomNumber);
- _detach_now = true;
+ detach();
return false;
}
Modified: scummvm/trunk/engines/lure/fights.cpp
===================================================================
--- scummvm/trunk/engines/lure/fights.cpp 2010-07-17 17:58:50 UTC (rev 50962)
+++ scummvm/trunk/engines/lure/fights.cpp 2010-07-17 18:38:42 UTC (rev 50963)
@@ -132,8 +132,7 @@
}
Screen::getReference().update();
- if (game.debugger().isAttached())
- game.debugger().onFrame();
+ game.debugger().onFrame();
g_system->delayMillis(10);
}
Modified: scummvm/trunk/engines/lure/game.cpp
===================================================================
--- scummvm/trunk/engines/lure/game.cpp 2010-07-17 17:58:50 UTC (rev 50962)
+++ scummvm/trunk/engines/lure/game.cpp 2010-07-17 18:38:42 UTC (rev 50963)
@@ -281,8 +281,7 @@
system.updateScreen();
system.delayMillis(10);
- if (_debugger->isAttached())
- _debugger->onFrame();
+ _debugger->onFrame();
}
room.leaveRoom();
Modified: scummvm/trunk/engines/parallaction/input.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/input.cpp 2010-07-17 17:58:50 UTC (rev 50962)
+++ scummvm/trunk/engines/parallaction/input.cpp 2010-07-17 18:38:42 UTC (rev 50963)
@@ -148,8 +148,7 @@
setCursorPos(e.mouse);
}
- if (_vm->_debugger->isAttached())
- _vm->_debugger->onFrame();
+ _vm->_debugger->onFrame();
return;
Modified: scummvm/trunk/engines/queen/queen.cpp
===================================================================
--- scummvm/trunk/engines/queen/queen.cpp 2010-07-17 17:58:50 UTC (rev 50962)
+++ scummvm/trunk/engines/queen/queen.cpp 2010-07-17 18:38:42 UTC (rev 50963)
@@ -264,9 +264,7 @@
}
void QueenEngine::update(bool checkPlayerInput) {
- if (_debugger->isAttached()) {
- _debugger->onFrame();
- }
+ _debugger->onFrame();
_graphics->update(_logic->currentRoom());
_logic->update();
Modified: scummvm/trunk/engines/saga/saga.cpp
===================================================================
--- scummvm/trunk/engines/saga/saga.cpp 2010-07-17 17:58:50 UTC (rev 50962)
+++ scummvm/trunk/engines/saga/saga.cpp 2010-07-17 18:38:42 UTC (rev 50963)
@@ -352,8 +352,7 @@
uint32 currentTicks;
while (!shouldQuit()) {
- if (_console->isAttached())
- _console->onFrame();
+ _console->onFrame();
if (_render->getFlags() & RF_RENDERPAUSE) {
// Freeze time while paused
Modified: scummvm/trunk/engines/sci/engine/vm.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/vm.cpp 2010-07-17 17:58:50 UTC (rev 50962)
+++ scummvm/trunk/engines/sci/engine/vm.cpp 2010-07-17 18:38:42 UTC (rev 50963)
@@ -1085,9 +1085,7 @@
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",
Modified: scummvm/trunk/engines/scumm/debugger.cpp
===================================================================
--- scummvm/trunk/engines/scumm/debugger.cpp 2010-07-17 17:58:50 UTC (rev 50962)
+++ scummvm/trunk/engines/scumm/debugger.cpp 2010-07-17 18:38:42 UTC (rev 50963)
@@ -62,8 +62,6 @@
_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 @@
bool ScummDebugger::Cmd_Restart(int argc, const char **argv) {
_vm->restart();
- _detach_now = true;
+ detach();
return false;
}
@@ -202,7 +200,7 @@
_vm->requestLoad(slot);
- _detach_now = true;
+ detach();
return false;
}
@@ -867,7 +865,7 @@
}
_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_ResetCursors(int argc, const char **argv) {
_vm->resetCursors();
-
- _detach_now = true;
-
+ detach();
return false;
}
Modified: scummvm/trunk/engines/scumm/scumm.cpp
===================================================================
--- scummvm/trunk/engines/scumm/scumm.cpp 2010-07-17 17:58:50 UTC (rev 50962)
+++ scummvm/trunk/engines/scumm/scumm.cpp 2010-07-17 18:38:42 UTC (rev 50963)
@@ -1840,8 +1840,7 @@
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.
Modified: scummvm/trunk/engines/sky/sky.cpp
===================================================================
--- scummvm/trunk/engines/sky/sky.cpp 2010-07-17 17:58:50 UTC (rev 50962)
+++ scummvm/trunk/engines/sky/sky.cpp 2010-07-17 18:38:42 UTC (rev 50963)
@@ -185,8 +185,7 @@
uint32 delayCount = _system->getMillis();
while (!shouldQuit()) {
- if (_debugger->isAttached())
- _debugger->onFrame();
+ _debugger->onFrame();
if (shouldPerformAutoSave(_lastSaveTime)) {
if (_skyControl->loadSaveAllowed()) {
Modified: scummvm/trunk/engines/sword2/sword2.cpp
===================================================================
--- scummvm/trunk/engines/sword2/sword2.cpp 2010-07-17 17:58:50 UTC (rev 50962)
+++ scummvm/trunk/engines/sword2/sword2.cpp 2010-07-17 18:38:42 UTC (rev 50963)
@@ -458,8 +458,7 @@
_screen->initialiseRenderCycle();
while (1) {
- if (_debugger->isAttached())
- _debugger->onFrame();
+ _debugger->onFrame();
#ifdef SWORD2_DEBUG
if (_stepOneCycle) {
Modified: scummvm/trunk/engines/teenagent/teenagent.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/teenagent.cpp 2010-07-17 17:58:50 UTC (rev 50962)
+++ scummvm/trunk/engines/teenagent/teenagent.cpp 2010-07-17 18:38:42 UTC (rev 50963)
@@ -618,9 +618,7 @@
_system->updateScreen();
- if (console->isAttached()) {
- console->onFrame();
- }
+ console->onFrame();
uint32 next_tick = MIN(game_timer, mark_timer);
if (next_tick > 0) {
Modified: scummvm/trunk/engines/tinsel/tinsel.cpp
===================================================================
--- scummvm/trunk/engines/tinsel/tinsel.cpp 2010-07-17 17:58:50 UTC (rev 50962)
+++ scummvm/trunk/engines/tinsel/tinsel.cpp 2010-07-17 18:38:42 UTC (rev 50963)
@@ -1001,8 +1001,7 @@
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)) {
Modified: scummvm/trunk/gui/debugger.cpp
===================================================================
--- scummvm/trunk/gui/debugger.cpp 2010-07-17 17:58:50 UTC (rev 50962)
+++ scummvm/trunk/gui/debugger.cpp 2010-07-17 18:38:42 UTC (rev 50963)
@@ -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 @@
_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 @@
}
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 @@
} 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 @@
} 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 @@
#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 @@
tmp.name = varname;
tmp.type = type;
tmp.variable = pointer;
- tmp.optional = optional;
+ tmp.arraySize = arraySize;
_dvars.push_back(tmp);
}
@@ -406,7 +401,7 @@
// Detach ("exit") the debugger
bool Debugger::Cmd_Exit(int argc, const char **argv) {
- _detach_now = true;
+ detach();
return false;
}
Modified: scummvm/trunk/gui/debugger.h
===================================================================
--- scummvm/trunk/gui/debugger.h 2010-07-17 17:58:50 UTC (rev 50962)
+++ scummvm/trunk/gui/debugger.h 2010-07-17 18:38:42 UTC (rev 50963)
@@ -43,20 +43,46 @@
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 @@
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;
+ /**
+ * 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:
- void DVar_Register(const Common::String &varname, void *pointer, int type, int optional);
- void DCmd_Register(const Common::String &cmdname, Debuglet *debuglet);
-
bool Cmd_Exit(int argc, const char **argv);
bool Cmd_Help(int argc, const char **argv);
bool Cmd_DebugFlagsList(int argc, const char **argv);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list