diff options
| author | Filippos Karapetis | 2009-08-27 23:39:59 +0000 |
|---|---|---|
| committer | Filippos Karapetis | 2009-08-27 23:39:59 +0000 |
| commit | faa3c64d1b22c87ef01adb885fba57293fda4aa7 (patch) | |
| tree | c8c7726d5bf63711fbf8c23ad9b9f13ec22f80b5 /engines/sci/console.cpp | |
| parent | e8406cc7c3603622cd0dea83683d35902ef72749 (diff) | |
| download | scummvm-rg350-faa3c64d1b22c87ef01adb885fba57293fda4aa7.tar.gz scummvm-rg350-faa3c64d1b22c87ef01adb885fba57293fda4aa7.tar.bz2 scummvm-rg350-faa3c64d1b22c87ef01adb885fba57293fda4aa7.zip | |
Stop loading opcodes from vocab.998. They are the same in all SCI games and are hardcoded anyway (plus, vocab.998 is unreliable in some games, e.g. QFG3, or completely missing in others). Also hardcoded the opcode names for the script debugger, the only place they're actually used. The only place where vocab.998 is loaded on demand is when using the "opcodes" console command (for debug/verification purposes)
svn-id: r43775
Diffstat (limited to 'engines/sci/console.cpp')
| -rw-r--r-- | engines/sci/console.cpp | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index 9ba252166c..be72cbe9e9 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -388,11 +388,27 @@ bool Console::cmdGetVersion(int argc, const char **argv) { } bool Console::cmdOpcodes(int argc, const char **argv) { + // Load the opcode table from vocab.998 if it exists, to obtain the opcode names + Resource* r = _vm->getresourceManager()->findResource(ResourceId(kResourceTypeVocab, 998), 0); + + // If the resource couldn't be loaded, leave + if (!r) { + DebugPrintf("unable to load vocab.998"); + return true; + } + + int count = READ_LE_UINT16(r->data); + DebugPrintf("Opcode names in numeric order [index: type name]:\n"); - for (uint seeker = 0; seeker < _vm->getKernel()->getOpcodesSize(); seeker++) { - opcode op = _vm->getKernel()->getOpcode(seeker); - DebugPrintf("%03x: %03x %20s | ", seeker, op.type, op.name.c_str()); - if ((seeker % 3) == 2) + + for (int i = 0; i < count; i++) { + int offset = READ_LE_UINT16(r->data + 2 + i * 2); + int len = READ_LE_UINT16(r->data + offset) - 2; + int type = READ_LE_UINT16(r->data + offset + 2); + // QFG3 has empty opcodes + Common::String name = len > 0 ? Common::String((char *)r->data + offset + 4, len) : "Dummy"; + DebugPrintf("%03x: %03x %20s | ", i, type, name.c_str()); + if ((i % 3) == 2) DebugPrintf("\n"); } |
