diff options
author | D G Turner | 2014-05-10 17:08:34 +0100 |
---|---|---|
committer | D G Turner | 2014-05-10 17:12:14 +0100 |
commit | bc7af1de19e249c2928dd8df9da6250334a9b652 (patch) | |
tree | 7c2048b3ea0aeb933c78a129282e04b64c5cb0c6 /gui | |
parent | 0549ae8259f25a3bd86e6dabfb822d96c5b40416 (diff) | |
download | scummvm-rg350-bc7af1de19e249c2928dd8df9da6250334a9b652.tar.gz scummvm-rg350-bc7af1de19e249c2928dd8df9da6250334a9b652.tar.bz2 scummvm-rg350-bc7af1de19e249c2928dd8df9da6250334a9b652.zip |
GUI: Add "debuglevel" command to Debugger base class.
This allows the debug level to be changed at runtime from the debug
console.
Diffstat (limited to 'gui')
-rw-r--r-- | gui/debugger.cpp | 17 | ||||
-rw-r--r-- | gui/debugger.h | 1 |
2 files changed, 18 insertions, 0 deletions
diff --git a/gui/debugger.cpp b/gui/debugger.cpp index 2ec9937fdb..832f49f0c9 100644 --- a/gui/debugger.cpp +++ b/gui/debugger.cpp @@ -61,6 +61,7 @@ Debugger::Debugger() { DCmd_Register("help", WRAP_METHOD(Debugger, Cmd_Help)); DCmd_Register("openlog", WRAP_METHOD(Debugger, Cmd_OpenLog)); + DCmd_Register("debuglevel", WRAP_METHOD(Debugger, Cmd_DebugLevel)); DCmd_Register("debugflag_list", WRAP_METHOD(Debugger, Cmd_DebugFlagsList)); DCmd_Register("debugflag_enable", WRAP_METHOD(Debugger, Cmd_DebugFlagEnable)); DCmd_Register("debugflag_disable", WRAP_METHOD(Debugger, Cmd_DebugFlagDisable)); @@ -501,6 +502,22 @@ bool Debugger::Cmd_OpenLog(int argc, const char **argv) { } +bool Debugger::Cmd_DebugLevel(int argc, const char **argv) { + if (argc == 1) { + DebugPrintf("Debugging is currently set at level %d\n", gDebugLevel); + } else { // set level + gDebugLevel = atoi(argv[1]); + if (gDebugLevel >= 0 && gDebugLevel < 11) { + DebugPrintf("Debug level set to level %d\n", gDebugLevel); + } else if (gDebugLevel < 0) { + DebugPrintf("Debugging is now disabled\n"); + } else + DebugPrintf("Not a valid debug level (0 - 10)\n"); + } + + return true; +} + bool Debugger::Cmd_DebugFlagsList(int argc, const char **argv) { const Common::DebugManager::DebugChannelList &debugLevels = DebugMan.listDebugChannels(); diff --git a/gui/debugger.h b/gui/debugger.h index 4ce5481fbb..7481f89df2 100644 --- a/gui/debugger.h +++ b/gui/debugger.h @@ -193,6 +193,7 @@ protected: bool Cmd_Exit(int argc, const char **argv); bool Cmd_Help(int argc, const char **argv); bool Cmd_OpenLog(int argc, const char **argv); + bool Cmd_DebugLevel(int argc, const char **argv); bool Cmd_DebugFlagsList(int argc, const char **argv); bool Cmd_DebugFlagEnable(int argc, const char **argv); bool Cmd_DebugFlagDisable(int argc, const char **argv); |