diff options
author | Filippos Karapetis | 2009-05-11 17:10:36 +0000 |
---|---|---|
committer | Filippos Karapetis | 2009-05-11 17:10:36 +0000 |
commit | e3e3fbd7d1d5f358515fc0d28b2c0abd715e5b79 (patch) | |
tree | f052d4ed1d56912433c54b0b9ecdf789d8995b3d /engines | |
parent | b9a026eb20c2cc99c582a5c6fc3f7a1da232a04f (diff) | |
download | scummvm-rg350-e3e3fbd7d1d5f358515fc0d28b2c0abd715e5b79.tar.gz scummvm-rg350-e3e3fbd7d1d5f358515fc0d28b2c0abd715e5b79.tar.bz2 scummvm-rg350-e3e3fbd7d1d5f358515fc0d28b2c0abd715e5b79.zip |
Moved the "selectors" and "syscalls" console commands to ScummVM's debug console (as commands "selectors" and "kernelnames", respectively)
svn-id: r40457
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/console.cpp | 45 | ||||
-rw-r--r-- | engines/sci/console.h | 2 | ||||
-rw-r--r-- | engines/sci/engine/scriptconsole.cpp | 51 |
3 files changed, 47 insertions, 51 deletions
diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index 31fac56bae..6b40504e10 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -29,6 +29,7 @@ #include "sci/console.h" #include "sci/scicore/resource.h" #include "sci/scicore/versions.h" +#include "sci/scicore/vocabulary.h" namespace Sci { @@ -36,6 +37,8 @@ Console::Console(SciEngine *vm) : GUI::Debugger() { _vm = vm; DCmd_Register("version", WRAP_METHOD(Console, cmdGetVersion)); + DCmd_Register("selectors", WRAP_METHOD(Console, cmdSelectors)); + DCmd_Register("kernelnames", WRAP_METHOD(Console, cmdKernelNames)); DCmd_Register("man", WRAP_METHOD(Console, cmdMan)); } @@ -53,6 +56,48 @@ bool Console::cmdGetVersion(int argc, const char **argv) { return true; } +bool Console::cmdSelectors(int argc, const char **argv) { + Common::StringList selectorNames; + + if (!vocabulary_get_snames(_vm->getResMgr(), _vm->getVersion(), selectorNames)) { + DebugPrintf("No selector name table found!\n"); + return true; + } + + DebugPrintf("Selector names in numeric order:\n"); + for (uint seeker = 0; seeker < selectorNames.size(); seeker++) { + DebugPrintf("%03x: %20s | ", seeker, selectorNames[seeker].c_str()); + if (seeker % 3 == 0) + DebugPrintf("\n"); + } + + DebugPrintf("\n"); + + return true; +} + +bool Console::cmdKernelNames(int argc, const char **argv) { + Common::StringList kernelNames; + + vocabulary_get_knames(_vm->getResMgr(), kernelNames); + + if (kernelNames.empty()) { + DebugPrintf("No kernel name table found!\n"); + return true; + } + + DebugPrintf("Selector names in numeric order:\n"); + for (uint seeker = 0; seeker < kernelNames.size(); seeker++) { + DebugPrintf("%03x: %20s | ", seeker, kernelNames[seeker].c_str()); + if (seeker % 3 == 0) + DebugPrintf("\n"); + } + + DebugPrintf("\n"); + + return true; +} + bool Console::cmdMan(int argc, const char **argv) { #if 0 int section = 0; diff --git a/engines/sci/console.h b/engines/sci/console.h index 4c527acf4b..8ee65f5281 100644 --- a/engines/sci/console.h +++ b/engines/sci/console.h @@ -41,6 +41,8 @@ public: private: bool cmdGetVersion(int argc, const char **argv); + bool cmdSelectors(int argc, const char **argv); + bool cmdKernelNames(int argc, const char **argv); bool cmdMan(int argc, const char **argv); private: diff --git a/engines/sci/engine/scriptconsole.cpp b/engines/sci/engine/scriptconsole.cpp index c114314531..054d1e4e97 100644 --- a/engines/sci/engine/scriptconsole.cpp +++ b/engines/sci/engine/scriptconsole.cpp @@ -45,8 +45,6 @@ static int c_dump(EngineState *s, const Common::Array<cmd_param_t> &cmdParams); //static int c_objinfo(EngineState *s, const Common::Array<cmd_param_t> &cmdParams); // shows some info about one class //static int c_objmethods(EngineState *s, const Common::Array<cmd_param_t> &cmdParams); // Disassembles all methods of a class static int c_hexgrep(EngineState *s, const Common::Array<cmd_param_t> &cmdParams); // Searches a string in one resource or resource class -static int c_selectornames(EngineState *s, const Common::Array<cmd_param_t> &cmdParams); // Displays all selector names -static int c_kernelnames(EngineState *s, const Common::Array<cmd_param_t> &cmdParams); // Displays all kernel function names static int c_dissectscript(EngineState *s, const Common::Array<cmd_param_t> &cmdParams); // Splits a script into objects and explains them struct cmd_mm_entry_t { @@ -785,8 +783,6 @@ static int c_list(EngineState *s, const Common::Array<cmd_param_t> &cmdParams) { "docs - lists all misc. documentation\n" "\n" "restypes - lists all resource types\n" - "selectors - lists all selectors\n" - "syscalls - lists all kernel functions\n" "words - lists all kernel words\n" "suffixes - lists all suffix replacements\n" "[resource] - lists all [resource]s"); @@ -808,10 +804,6 @@ static int c_list(EngineState *s, const Common::Array<cmd_param_t> &cmdParams) { return 1; } - if (!strcmp("selectors", cmdParams[0].str)) - return c_selectornames(s, cmdParams); - else if (!strcmp("syscalls", cmdParams[0].str)) - return c_kernelnames(s, cmdParams); else if (!strcmp("suffixes", cmdParams[0].str) || !strcmp("suffices", cmdParams[0].str) || !strcmp("sufficos", cmdParams[0].str)) // sufficos: Accusative Plural of 'suffix' return c_list_suffixes(s, cmdParams); @@ -997,49 +989,6 @@ static int c_hexgrep(EngineState *s, const Common::Array<cmd_param_t> &cmdParams return 0; } -static int c_selectornames(EngineState *s, const Common::Array<cmd_param_t> &cmdParams) { - Common::StringList selectorNames; - - if (NULL == s) { - sciprintf("console.c: c_selectornames(): NULL passed for parameter s\n"); - return -1; - } - - if (!vocabulary_get_snames(s->resmgr, s ? s->version : 0, selectorNames)) { - sciprintf("No selector name table found!\n"); - return 1; - } - - sciprintf("Selector names in numeric order:\n"); - for (uint seeker = 0; seeker < selectorNames.size(); seeker++) { - sciprintf("%03x: %s\n", seeker, selectorNames[seeker].c_str()); - } - - return 0; -} - -static int c_kernelnames(EngineState *s, const Common::Array<cmd_param_t> &cmdParams) { - Common::StringList knames; - - if (NULL == s) { - sciprintf("console.c: c_kernelnames NULL passed for parameter s\n"); - return -1; - } - - vocabulary_get_knames(s->resmgr, knames); - - if (knames.empty()) { - sciprintf("No kernel name table found!\n"); - return 1; - } - - sciprintf("Syscalls in numeric order:\n"); - for (uint seeker = 0; seeker < knames.size(); seeker++) - sciprintf("%03x: %s\n", seeker, knames[seeker].c_str()); - - return 0; -} - static int c_dissectscript(EngineState *s, const Common::Array<cmd_param_t> &cmdParams) { if (NULL == s) { sciprintf("console.c: c_dissectscript(): NULL passed for parameter s\n"); |