aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormd52011-02-21 20:43:54 +0200
committermd52011-02-21 20:43:54 +0200
commit4766774b3dbd8824276ad7ff2e3c916b6dc1de37 (patch)
tree709432ee390ab7f38ed32e0f33f85c04dc1bd3f1
parent8a52e4bf0055104047afd70ba2c6de0fcb0b630a (diff)
downloadscummvm-rg350-4766774b3dbd8824276ad7ff2e3c916b6dc1de37.tar.gz
scummvm-rg350-4766774b3dbd8824276ad7ff2e3c916b6dc1de37.tar.bz2
scummvm-rg350-4766774b3dbd8824276ad7ff2e3c916b6dc1de37.zip
SCI: Fixed script bug #3040722 in QFG3
-rw-r--r--engines/sci/engine/script_patches.cpp17
-rw-r--r--engines/sci/engine/vm.cpp2
2 files changed, 18 insertions, 1 deletions
diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp
index 5191887e47..79a0cfc204 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -928,9 +928,26 @@ const uint16 qfg3PatchWindowDispose[] = {
PATCH_END
};
+// Script 23 in QFG3 has a typo/bug which makes it loop endlessly and
+// read garbage. Fixes bug #3040722.
+const byte qfg3DialogCrash[] = {
+ 5,
+ 0x34, 0xe7, 0x03, // ldi 3e7 (999)
+ 0x22, // lt?
+ 0x33, // jmp [back] ---> BUG! Infinite loop
+};
+
+const uint16 qfg3PatchDialogCrash[] = {
+ 0x34, 0xe7, 0x03, // ldi 3e7 (999)
+ 0x22, // lt?
+ 0x31, // bnt [back]
+ PATCH_END
+};
+
// script, description, magic DWORD, adjust
const SciScriptSignature qfg3Signatures[] = {
{ 22, "window dispose", 1, PATCH_MAGICDWORD(0x39, 0x05, 0x39, 0x0d), 0, qfg3WindowDispose, qfg3PatchWindowDispose },
+ { 23, "dialog crash", 1, PATCH_MAGICDWORD(0xe7, 0x03, 0x22, 0x33), -1, qfg3DialogCrash, qfg3PatchDialogCrash },
{ 944, "import dialog continuous calls", 1, PATCH_MAGICDWORD(0x2a, 0x31, 0x0b, 0x7a), -1, qfg3SignatureImportDialog, qfg3PatchImportDialog },
SCI_SIGNATUREENTRY_TERMINATOR
};
diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp
index 69d046da7d..a70ff5ab72 100644
--- a/engines/sci/engine/vm.cpp
+++ b/engines/sci/engine/vm.cpp
@@ -935,7 +935,7 @@ void run_vm(EngineState *s) {
byte extOpcode;
s->xs->addr.pc.offset += readPMachineInstruction(scr->getBuf() + s->xs->addr.pc.offset, extOpcode, opparams);
const byte opcode = extOpcode >> 1;
- //debug("%s", opcodeNames[opcode]);
+ //debug("%s: %d, %d, %d, %d, acc = %04x:%04x", opcodeNames[opcode], opparams[0], opparams[1], opparams[2], opparams[3], PRINT_REG(s->r_acc));
switch (opcode) {