diff options
| -rw-r--r-- | engines/sci/engine/kparse.cpp | 10 | ||||
| -rw-r--r-- | engines/sci/engine/script_patches.cpp | 32 | 
2 files changed, 33 insertions, 9 deletions
| diff --git a/engines/sci/engine/kparse.cpp b/engines/sci/engine/kparse.cpp index 076ca59cdb..4db59f9738 100644 --- a/engines/sci/engine/kparse.cpp +++ b/engines/sci/engine/kparse.cpp @@ -143,16 +143,8 @@ reg_t kParse(EngineState *s, int argc, reg_t *argv) {  	} else {  		s->r_acc = make_reg(0, 0); -		// FIXME: When typing something wrong in the fanmade game Demo Quest, -		// after the error dialog, the game checks for claimed to be 0 before -		// showing a subsequent dialog. The following selector change causes -		// it to be 1, thus causing the game to hang in an endless loop (bug -		// #3038870. Thus, this seems to be wrong (since fanmade games use -		// the original SCI interpreter), but we need to check against -		// dissassembly. Since kParse is in the process of being dissassembled -		// again, I'm leaving this FIXME in for now, so that it won't be -		// forgotten :)  		writeSelectorValue(segMan, event, SELECTOR(claimed), 1); +  		if (error) {  			s->_segMan->strcpy(s->_segMan->getParserPtr(), error);  			debugC(2, kDebugLevelParser, "Word unknown: %s", error); diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp index d5d6ff6189..8d9c78ad56 100644 --- a/engines/sci/engine/script_patches.cpp +++ b/engines/sci/engine/script_patches.cpp @@ -300,6 +300,35 @@ const SciScriptSignature ecoquest2Signatures[] = {  };  // =========================================================================== +// EventHandler::handleEvent in Demo Quest has a bug, and it jumps to the +// wrong address when an incorrect word is typed, therefore leading to an +// infinite loop. This script bug was not apparent in SSCI, probably because +// event handling was slightly different there, so it was never discovered. +// Fixes bug #3038870. +const byte fanmadeSignatureInfiniteLoop[] = { +	13, +	0x38, 0x4c, 0x00,  // pushi 004c +	0x39, 0x00,        // pushi 00 +	0x87, 0x01,        // lap 01 +	0x4b, 0x04,        // send 04 +	0x18,              // not +	0x30, 0x2f, 0x00,  // bnt 002f  [06a5]	--> jmp ffbc  [0664] --> BUG! infinite loop +	0 +}; + +const uint16 fanmadePatchInfiniteLoop[] = { +	PATCH_ADDTOOFFSET | +10, +	0x30, 0x32, 0x00,  // bnt 0032  [06a8] --> pushi 004c +	PATCH_END +}; + +//    script, description,                                      magic DWORD,                                 adjust +const SciScriptSignature fanmadeSignatures[] = { +	{    999, "infinite loop on typo",                       1, PATCH_MAGICDWORD(0x18, 0x30, 0x2f, 0x00),    -9, fanmadeSignatureInfiniteLoop, fanmadePatchInfiniteLoop }, +	SCI_SIGNATUREENTRY_TERMINATOR +}; + +// ===========================================================================  //  script 0 of freddy pharkas/CD PointsSound::check waits for a signal and if  //   no signal received will call kDoSound(0xD) which is a dummy in sierra sci  //   and ScummVM and will use acc (which is not set by the dummy) to trigger @@ -1172,6 +1201,9 @@ void Script::matchSignatureAndPatch(uint16 scriptNr, byte *scriptData, const uin  	case GID_ECOQUEST2:  		signatureTable = ecoquest2Signatures;  		break; +	case GID_FANMADE: +		signatureTable = fanmadeSignatures; +		break;  	case GID_FREDDYPHARKAS:  		signatureTable = freddypharkasSignatures;  		break; | 
