diff options
Diffstat (limited to 'engines/sci/engine/kernel.cpp')
-rw-r--r-- | engines/sci/engine/kernel.cpp | 49 |
1 files changed, 32 insertions, 17 deletions
diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp index ff327a0049..16534fbce9 100644 --- a/engines/sci/engine/kernel.cpp +++ b/engines/sci/engine/kernel.cpp @@ -66,12 +66,12 @@ const Common::String &Kernel::getSelectorName(uint selector) { // We need this for proper workaround tables // TODO: maybe check, if there is a fixed selector-table and error() out in that case for (uint loopSelector = _selectorNames.size(); loopSelector <= selector; ++loopSelector) - _selectorNames.push_back(Common::String::printf("<noname%d>", loopSelector)); + _selectorNames.push_back(Common::String::format("<noname%d>", loopSelector)); } // Ensure that the selector has a name if (_selectorNames[selector].empty()) - _selectorNames[selector] = Common::String::printf("<noname%d>", selector); + _selectorNames[selector] = Common::String::format("<noname%d>", selector); return _selectorNames[selector]; } @@ -88,6 +88,14 @@ const Common::String &Kernel::getKernelName(uint number) const { return _kernelNames[number]; } +int Kernel::findKernelFuncPos(Common::String kernelFuncName) { + for (uint32 i = 0; i < _kernelNames.size(); i++) + if (_kernelNames[i] == kernelFuncName) + return i; + + return -1; +} + int Kernel::findSelector(const char *selectorName) const { for (uint pos = 0; pos < _selectorNames.size(); ++pos) { if (_selectorNames[pos] == selectorName) @@ -130,7 +138,7 @@ void Kernel::loadSelectorNames() { Common::String tmp((const char *)r->data + offset + 2, len); _selectorNames.push_back(tmp); - //printf("%s\n", tmp.c_str()); // debug + //debug("%s", tmp.c_str()); // Early SCI versions used the LSB in the selector ID as a read/write // toggle. To compensate for that, we add every selector name twice. @@ -422,8 +430,8 @@ static void kernelSignatureDebugType(const uint16 type) { while (list->typeCheck) { if (type & list->typeCheck) { if (!firstPrint) - printf(", "); - printf("%s", list->text); + debugN(", "); + debugN("%s", list->text); firstPrint = false; } list++; @@ -434,38 +442,38 @@ static void kernelSignatureDebugType(const uint16 type) { void Kernel::signatureDebug(const uint16 *sig, int argc, const reg_t *argv) { int argnr = 0; while (*sig || argc) { - printf("parameter %d: ", argnr++); + debugN("parameter %d: ", argnr++); if (argc) { reg_t parameter = *argv; - printf("%04x:%04x (", PRINT_REG(parameter)); + debugN("%04x:%04x (", PRINT_REG(parameter)); int regType = findRegType(parameter); if (regType) kernelSignatureDebugType(regType); else - printf("unknown type of %04x:%04x", PRINT_REG(parameter)); - printf(")"); + debugN("unknown type of %04x:%04x", PRINT_REG(parameter)); + debugN(")"); argv++; argc--; } else { - printf("not passed"); + debugN("not passed"); } if (*sig) { const uint16 signature = *sig; if ((signature & SIG_MAYBE_ANY) == SIG_MAYBE_ANY) { - printf(", may be any"); + debugN(", may be any"); } else { - printf(", should be "); + debugN(", should be "); kernelSignatureDebugType(signature); } if (signature & SIG_IS_OPTIONAL) - printf(" (optional)"); + debugN(" (optional)"); if (signature & SIG_NEEDS_MORE) - printf(" (needs more)"); + debugN(" (needs more)"); if (signature & SIG_MORE_MAY_FOLLOW) - printf(" (more may follow)"); + debugN(" (more may follow)"); sig++; } - printf("\n"); + debugN("\n"); } } @@ -828,7 +836,7 @@ void Kernel::setKernelNamesSci21(GameFeatures *features) { // version (2.100.002), yet they would not be compatible with other // games of the same interpreter. - if (features->detectSci21KernelType() == SCI_VERSION_2) { + if (getSciVersion() != SCI_VERSION_3 && features->detectSci21KernelType() == SCI_VERSION_2) { _kernelNames = Common::StringArray(sci2_default_knames, kKernelEntriesGk2Demo); // OnMe is IsOnMe here, but they should be compatible _kernelNames[0x23] = "Robot"; // Graph in SCI2 @@ -903,6 +911,13 @@ void script_adjust_opcode_formats() { g_opcode_formats[op_call][1] = Script_Word; g_opcode_formats[op_callb][1] = Script_Word; } + + if (getSciVersion() >= SCI_VERSION_3) { + // TODO: There are also opcodes in + // here to get the superclass, and possibly the species too. + g_opcode_formats[0x4d/2][0] = Script_None; + g_opcode_formats[0x4e/2][0] = Script_None; + } #endif } |