diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/console.cpp | 2 | ||||
-rw-r--r-- | engines/sci/engine/vm.cpp | 11 | ||||
-rw-r--r-- | engines/sci/engine/vm.h | 8 |
3 files changed, 13 insertions, 8 deletions
diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index 032264bcaf..1cba6077d2 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -2003,7 +2003,7 @@ bool Console::cmdBacktrace(int argc, const char **argv) { break; case EXEC_STACK_TYPE_KERNEL: // Kernel function - printf(" %x:[%x] k%s(", i, call.origin, _vm->getKernel()->getKernelName(-(call.selector) - 42).c_str()); + printf(" %x:[%x] k%s(", i, call.origin, _vm->getKernel()->getKernelName(kMagicSelectorOffset - call.selector).c_str()); break; case EXEC_STACK_TYPE_VARSELECTOR: diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp index c9b665d881..acb89824b2 100644 --- a/engines/sci/engine/vm.cpp +++ b/engines/sci/engine/vm.cpp @@ -953,7 +953,7 @@ void run_vm(EngineState *s, int restoring) { xstack = add_exec_stack_entry(s, NULL_REG, NULL, NULL_REG, argc, argv - 1, 0, NULL_REG, s->_executionStack.size()-1, SCI_XS_CALLEE_LOCALS); // Debugging hack to identify kernel function - xstack->selector = -42 - opparams[0]; + xstack->selector = kMagicSelectorOffset - opparams[0]; xstack->type = EXEC_STACK_TYPE_KERNEL; // Call kernel function @@ -962,14 +962,11 @@ void run_vm(EngineState *s, int restoring) { // Remove callk stack frame again s->_executionStack.pop_back(); } else { - Common::String warningMsg = "Dummy function " + kfun.orig_name + "["; - warningMsg += warningMsg.printf("0x%x", opparams[0]); - warningMsg += "] invoked - ignoring. Params: "; - warningMsg += warningMsg.printf("%d", argc); - warningMsg += " ("; + Common::String warningMsg = "Dummy function " + kfun.orig_name; + warningMsg += Common::String::printf("[0x%x] invoked - ignoring. Params: %d (", opparams[0], argc); for (int i = 0; i < argc; i++) { - warningMsg += warningMsg.printf("%04x:%04x", PRINT_REG(argv[i])); + warningMsg += Common::String::printf("%04x:%04x", PRINT_REG(argv[i])); warningMsg += (i == argc - 1 ? ")" : ", "); } diff --git a/engines/sci/engine/vm.h b/engines/sci/engine/vm.h index 530a293081..9247bfa350 100644 --- a/engines/sci/engine/vm.h +++ b/engines/sci/engine/vm.h @@ -102,6 +102,14 @@ enum SelectorType { kSelectorMethod }; +enum { + /** + * Magic offset, used to compute fake selector values for use in ExecStack + * when doing a callk. See the callk code in vm.cpp for details. + */ + kMagicSelectorOffset = -42 +}; + struct Class { int script; /**< number of the script the class is in, -1 for non-existing */ reg_t reg; /**< offset; script-relative offset, segment: 0 if not instantiated */ |