aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
diff options
context:
space:
mode:
authorFilippos Karapetis2009-07-04 15:22:42 +0000
committerFilippos Karapetis2009-07-04 15:22:42 +0000
commit49ef8ae5a4a4b4f08ac5a8d6f059bb4f7dd43c3f (patch)
tree8994e6482fcfd5646e3a049fb673d242ad0e8d4a /engines/sci
parent8726f0198672c26dfb4f3944bf470a2150d8dc01 (diff)
downloadscummvm-rg350-49ef8ae5a4a4b4f08ac5a8d6f059bb4f7dd43c3f.tar.gz
scummvm-rg350-49ef8ae5a4a4b4f08ac5a8d6f059bb4f7dd43c3f.tar.bz2
scummvm-rg350-49ef8ae5a4a4b4f08ac5a8d6f059bb4f7dd43c3f.zip
Added a new console command, "selector", which attempts to find a selector by name
svn-id: r42093
Diffstat (limited to 'engines/sci')
-rw-r--r--engines/sci/console.cpp21
-rw-r--r--engines/sci/console.h1
2 files changed, 22 insertions, 0 deletions
diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp
index bf919c3a25..6ef6ff3d0c 100644
--- a/engines/sci/console.cpp
+++ b/engines/sci/console.cpp
@@ -67,6 +67,7 @@ Console::Console(SciEngine *vm) : GUI::Debugger() {
// Kernel
// DCmd_Register("classes", WRAP_METHOD(Console, cmdClasses)); // TODO
DCmd_Register("opcodes", WRAP_METHOD(Console, cmdOpcodes));
+ DCmd_Register("selector", WRAP_METHOD(Console, cmdSelector));
DCmd_Register("selectors", WRAP_METHOD(Console, cmdSelectors));
DCmd_Register("functions", WRAP_METHOD(Console, cmdKernelFunctions));
DCmd_Register("class_table", WRAP_METHOD(Console, cmdClassTable));
@@ -239,6 +240,7 @@ bool Console::cmdHelp(int argc, const char **argv) {
DebugPrintf("Kernel:\n");
DebugPrintf(" opcodes - Lists the opcode names\n");
DebugPrintf(" selectors - Lists the selector names\n");
+ DebugPrintf(" selector - Attempts to find the requested selector by name\n");
DebugPrintf(" functions - Lists the kernel functions\n");
DebugPrintf(" class_table - Shows the available classes\n");
DebugPrintf("\n");
@@ -392,6 +394,25 @@ bool Console::cmdOpcodes(int argc, const char **argv) {
return true;
}
+bool Console::cmdSelector(int argc, const char **argv) {
+ if (argc < 2) {
+ DebugPrintf("Attempts to find the requested selector by name.\n");
+ DebugPrintf("Usage: %s <selector name>\n", argv[0]);
+ return true;
+ }
+
+ for (uint seeker = 0; seeker < _vm->_gamestate->_kernel->getSelectorNamesSize(); seeker++) {
+ if (!scumm_stricmp(_vm->_gamestate->_kernel->getSelectorName(seeker).c_str(), argv[1])) {
+ DebugPrintf("Selector %s found at %03x\n", _vm->_gamestate->_kernel->getSelectorName(seeker).c_str(), seeker);
+ return true;
+ }
+ }
+
+ DebugPrintf("Selector %s wasn't found\n", argv[1]);
+
+ return true;
+}
+
bool Console::cmdSelectors(int argc, const char **argv) {
DebugPrintf("Selector names in numeric order:\n");
for (uint seeker = 0; seeker < _vm->_gamestate->_kernel->getSelectorNamesSize(); seeker++) {
diff --git a/engines/sci/console.h b/engines/sci/console.h
index 84a8d2f942..bc07ddb530 100644
--- a/engines/sci/console.h
+++ b/engines/sci/console.h
@@ -52,6 +52,7 @@ private:
// Kernel
// bool cmdClasses(int argc, const char **argv); // TODO
bool cmdOpcodes(int argc, const char **argv);
+ bool cmdSelector(int argc, const char **argv);
bool cmdSelectors(int argc, const char **argv);
bool cmdKernelFunctions(int argc, const char **argv);
bool cmdClassTable(int argc, const char **argv);