From f2c2453b80bb13abd7e95c6485bceee98d66e724 Mon Sep 17 00:00:00 2001 From: Ralph Caraveo Date: Mon, 28 Aug 2023 13:15:20 -0700 Subject: [PATCH] SCI: Improve debugger disassembly selector name context Show additional selector name context when push0, push1, push2 opcodes are used. Possible matching selector names are always shown for the debugger disassembly when a `pushi` opcode is encountered. This is great as it gives additional context when push is used for call/send related invocations. It would be nice to additionally show *possible* matching `selector` methods/properties when `push0`, `push1` or `push2` is encountered because selector names start at 0 so the dissassembly never shows selectors 0 through 2 inclusive. --- engines/sci/engine/scriptdebug.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/engines/sci/engine/scriptdebug.cpp b/engines/sci/engine/scriptdebug.cpp index e4ec0a88c23..0910705d728 100644 --- a/engines/sci/engine/scriptdebug.cpp +++ b/engines/sci/engine/scriptdebug.cpp @@ -256,7 +256,10 @@ reg_t disassemble(EngineState *s, reg_t pos, const Object *obj, bool printBWTag, separator = ", "; } - if (opcode == op_pushi && param_value < kernel->getSelectorNamesSize()) { + // Provide additional selector name context for all integer push scenarios. + if (opcode >= op_push0 && opcode <= op_push2) { + debugN("%s%s", separator, kernel->getSelectorName(opcode - op_push0).c_str()); + } else if (opcode == op_pushi && param_value < kernel->getSelectorNamesSize()) { debugN("%s%s", separator, kernel->getSelectorName(param_value).c_str()); } }