diff options
| -rw-r--r-- | engines/sci/engine/script_patches.cpp | 17 | ||||
| -rw-r--r-- | engines/sci/engine/vm.cpp | 2 | 
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) {  | 
