Made the kyra debug extensions more generic, i.e. scumm engine could replace

their debugC calls now with the new introduced debugC calls.
(A mail how to use it will follow shortly on -devel)
Also now these special engine debug flags can be specified from the commandline.
Also made the -c & --config parameter check more secure.

svn-id: r20695
This commit is contained in:
Johannes Schickel 2006-02-14 23:31:25 +00:00
parent fc3cdbe5a9
commit 0bea9cf47b
27 changed files with 734 additions and 584 deletions

View file

@ -43,6 +43,10 @@ Debugger<T>::Debugger() {
_debuggerDialog = new GUI::ConsoleDialog(1.0, 0.67F);
_debuggerDialog->setInputCallback(debuggerInputCallback, this);
_debuggerDialog->setCompletionCallback(debuggerCompletionCallback, this);
DCmd_Register("debugflag_list", &Debugger<T>::Cmd_DebugFlagsList);
DCmd_Register("debugflag_enable", &Debugger<T>::Cmd_DebugFlagEnable);
DCmd_Register("debugflag_disable", &Debugger<T>::Cmd_DebugFlagDisable);
}
template <class T>
@ -340,6 +344,51 @@ void Debugger<T>::DCmd_Register(const char *cmdname, DebugProc pointer) {
_dcmd_count++;
}
template <class T>
bool Debugger<T>::Cmd_DebugFlagsList(int argc, const char **argv) {
const Common::Array<Common::EngineDebugLevel> &debugLevels = Common::listSpecialDebugLevels();
DebugPrintf("Engine debug levels:\n");
DebugPrintf("--------------------\n");
if (!debugLevels.size()) {
DebugPrintf("No engine debug levels\n");
return true;
}
for (uint i = 0; i < debugLevels.size(); ++i) {
DebugPrintf("'%s' - Description: %s\n", debugLevels[i].option.c_str(), debugLevels[i].description.c_str());
}
DebugPrintf("\n");
return true;
}
template <class T>
bool Debugger<T>::Cmd_DebugFlagEnable(int argc, const char **argv) {
if (argc < 2) {
DebugPrintf("debugflag_enable <flag>\n");
} else {
if (Common::enableSpecialDebugLevel(argv[1])) {
DebugPrintf("Enabled debug flag '%s'\n", argv[1]);
} else {
DebugPrintf("Failed to enable debug flag '%s'\n", argv[1]);
}
}
return true;
}
template <class T>
bool Debugger<T>::Cmd_DebugFlagDisable(int argc, const char **argv) {
if (argc < 2) {
DebugPrintf("debugflag_disable <flag>\n");
} else {
if (Common::disableSpecialDebugLevel(argv[1])) {
DebugPrintf("Disabled debug flag '%s'\n", argv[1]);
} else {
DebugPrintf("Failed to disable debug flag '%s'\n", argv[1]);
}
}
return true;
}
// Console handler
#if USE_CONSOLE
template <class T>