aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine
diff options
context:
space:
mode:
authorFilippos Karapetis2011-01-07 20:24:49 +0000
committerFilippos Karapetis2011-01-07 20:24:49 +0000
commit2b87eebdb0da3b2f0c47220854cb81d28e271a38 (patch)
tree415e74cac15e47ede610ed40e71f43b1efac2643 /engines/sci/engine
parent59d00fca17455ee3548d8f7ea1919142e1ec8e2e (diff)
downloadscummvm-rg350-2b87eebdb0da3b2f0c47220854cb81d28e271a38.tar.gz
scummvm-rg350-2b87eebdb0da3b2f0c47220854cb81d28e271a38.tar.bz2
scummvm-rg350-2b87eebdb0da3b2f0c47220854cb81d28e271a38.zip
SCI: Moved the handling of the op_line debug opcode inside readPMachineInstruction()
The handling has been moved inside readPMachineInstruction(), instead of run_vm(), as a lot of parts of the code depend on this function handling all opcodes correctly (e.g. the script dissassembler, the features class, find_callk etc) svn-id: r55154
Diffstat (limited to 'engines/sci/engine')
-rw-r--r--engines/sci/engine/vm.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp
index df2ba9cbac..244e3b0b6a 100644
--- a/engines/sci/engine/vm.cpp
+++ b/engines/sci/engine/vm.cpp
@@ -903,6 +903,22 @@ int readPMachineInstruction(const byte *src, byte &extOpcode, int16 opparams[4])
}
}
+ // Special handling of the op_line opcode
+ if (opcode == op_pushSelf) {
+ // Compensate for a bug in non-Sierra compilers, which seem to generate
+ // pushSelf instructions with the low bit set. This makes the following
+ // heuristic fail and leads to endless loops and crashes. Our
+ // interpretation of this seems correct, as other SCI tools, like for
+ // example SCI Viewer, have issues with these scripts (e.g. script 999
+ // in Circus Quest). Fixes bug #3038686.
+ if (!(extOpcode & 1) || g_sci->getGameId() == GID_FANMADE) {
+ // op_pushSelf: no adjustment necessary
+ } else {
+ // Debug opcode op_file, skip null-terminated string (file name)
+ while (src[offset++]) {}
+ }
+ }
+
return offset;
}
@@ -1825,9 +1841,7 @@ void run_vm(EngineState *s) {
if (!(extOpcode & 1) || g_sci->getGameId() == GID_FANMADE) {
PUSH32(s->xs->objp);
} else {
- // Debug opcode op_file, skip null-terminated string (file name)
- const byte *code_buf = scr->getBuf();
- while (code_buf[s->xs->addr.pc.offset++]) ;
+ // Debug opcode op_file
}
break;