[Scummvm-cvs-logs] SF.net SVN: scummvm:[44492] scummvm/trunk/engines/sci
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Wed Sep 30 18:00:51 CEST 2009
Revision: 44492
http://scummvm.svn.sourceforge.net/scummvm/?rev=44492&view=rev
Author: fingolfin
Date: 2009-09-30 16:00:44 +0000 (Wed, 30 Sep 2009)
Log Message:
-----------
SCI: Replace magic '-42' by an enum
Modified Paths:
--------------
scummvm/trunk/engines/sci/console.cpp
scummvm/trunk/engines/sci/engine/vm.cpp
scummvm/trunk/engines/sci/engine/vm.h
Modified: scummvm/trunk/engines/sci/console.cpp
===================================================================
--- scummvm/trunk/engines/sci/console.cpp 2009-09-30 15:43:28 UTC (rev 44491)
+++ scummvm/trunk/engines/sci/console.cpp 2009-09-30 16:00:44 UTC (rev 44492)
@@ -2003,7 +2003,7 @@
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:
Modified: scummvm/trunk/engines/sci/engine/vm.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/vm.cpp 2009-09-30 15:43:28 UTC (rev 44491)
+++ scummvm/trunk/engines/sci/engine/vm.cpp 2009-09-30 16:00:44 UTC (rev 44492)
@@ -953,7 +953,7 @@
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 @@
// 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 ? ")" : ", ");
}
Modified: scummvm/trunk/engines/sci/engine/vm.h
===================================================================
--- scummvm/trunk/engines/sci/engine/vm.h 2009-09-30 15:43:28 UTC (rev 44491)
+++ scummvm/trunk/engines/sci/engine/vm.h 2009-09-30 16:00:44 UTC (rev 44492)
@@ -102,6 +102,14 @@
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 */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list