From 7a68ee57b1ba091111c7f340fbf877bd165872b3 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 16 Mar 2020 01:58:34 +0200 Subject: [PATCH] SCI: Always include the opcodeNames table, as it's used in VM hooks --- engines/sci/engine/scriptdebug.cpp | 9 +++++---- engines/sci/engine/scriptdebug.h | 4 ++-- engines/sci/engine/vm_hooks.cpp | 3 +++ 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/engines/sci/engine/scriptdebug.cpp b/engines/sci/engine/scriptdebug.cpp index fc80d1f22a9..d56c3d92916 100644 --- a/engines/sci/engine/scriptdebug.cpp +++ b/engines/sci/engine/scriptdebug.cpp @@ -39,7 +39,8 @@ namespace Sci { // This table is only used for debugging. Don't include it for devices // with not enough available memory (e.g. phones), where REDUCE_MEMORY_USAGE // is defined -#ifndef REDUCE_MEMORY_USAGE +// Update: This is used in the VM hooks mechanism. TODO: Readd the memory check? +//#ifndef REDUCE_MEMORY_USAGE const char *opcodeNames[] = { "bnot", "add", "sub", "mul", "div", "mod", "shr", "shl", "xor", "and", @@ -68,7 +69,7 @@ const char *opcodeNames[] = { "-agi", "-ali", "-ati", "-api", "-sgi", "-sli", "-sti", "-spi" }; -#endif // REDUCE_MEMORY_USAGE +//#endif // REDUCE_MEMORY_USAGE void DebugState::updateActiveBreakpointTypes() { int type = 0; @@ -149,9 +150,9 @@ reg_t disassemble(EngineState *s, reg_t pos, const Object *obj, bool printBWTag, return retval; } -#ifndef REDUCE_MEMORY_USAGE +//#ifndef REDUCE_MEMORY_USAGE debugN("%-5s", opcodeNames[opcode]); -#endif +//#endif static const char *defaultSeparator = "\t\t; "; diff --git a/engines/sci/engine/scriptdebug.h b/engines/sci/engine/scriptdebug.h index 3d54b327d30..df6bcef34f0 100644 --- a/engines/sci/engine/scriptdebug.h +++ b/engines/sci/engine/scriptdebug.h @@ -25,9 +25,9 @@ namespace Sci { -#ifndef REDUCE_MEMORY_USAGE +//#ifndef REDUCE_MEMORY_USAGE extern const char *opcodeNames[]; -#endif +//#endif void debugSelectorCall(reg_t send_obj, Selector selector, int argc, StackPtr argp, ObjVarRef &varp, reg_t funcp, SegManager *segMan, SelectorType selectorType); diff --git a/engines/sci/engine/vm_hooks.cpp b/engines/sci/engine/vm_hooks.cpp index d598d9a9a18..267a581dab5 100644 --- a/engines/sci/engine/vm_hooks.cpp +++ b/engines/sci/engine/vm_hooks.cpp @@ -101,6 +101,9 @@ uint64 HookHashKey::hash() { return ((uint64)scriptNumber << 32) + offset; } +//#ifndef REDUCE_MEMORY_USAGE +extern const char* opcodeNames[]; +//#endif // returns true if entry is matching to current state bool hook_exec_match(Sci::EngineState *s, HookEntry entry) {