diff options
author | Filippos Karapetis | 2010-11-21 23:43:14 +0000 |
---|---|---|
committer | Filippos Karapetis | 2010-11-21 23:43:14 +0000 |
commit | 0b06a1fe7b8295ab1c26c9a76ec2e5a3b2716638 (patch) | |
tree | 56672cd9f88e193d8eee6cd61cb248399c513e89 /engines | |
parent | 44669ac54d849999c0c75c4f914bef4bd6d3a2d8 (diff) | |
download | scummvm-rg350-0b06a1fe7b8295ab1c26c9a76ec2e5a3b2716638.tar.gz scummvm-rg350-0b06a1fe7b8295ab1c26c9a76ec2e5a3b2716638.tar.bz2 scummvm-rg350-0b06a1fe7b8295ab1c26c9a76ec2e5a3b2716638.zip |
SCI: Proper fix for the QFG2 character import screen crashes (bug #3037996)
Script 944 does constant reallocations whenever the selection changes,
which leads to all sorts of unpredictable crashes. Thanks to waltervn for
his help on this issue
svn-id: r54413
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/engine/script_patches.cpp | 42 | ||||
-rw-r--r-- | engines/sci/event.cpp | 14 |
2 files changed, 42 insertions, 14 deletions
diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp index 86d9effcbe..6a9035103e 100644 --- a/engines/sci/engine/script_patches.cpp +++ b/engines/sci/engine/script_patches.cpp @@ -713,6 +713,45 @@ const SciScriptSignature qfg1vgaSignatures[] = { }; // =========================================================================== +// Script 944 in QFG2 contains the FileSelector system class, used in the +// character import screen. This gets incorrectly called constantly, whenever +// the user clicks on a button in order to refresh the file list. This was +// probably done because it would be easier to refresh the list whenever the +// user inserted a new floppy disk, or changed directory. The problem is that +// the script has a bug, and it invalidates the text of the entries in the +// list. This has a high probability of breaking, as the user could change the +// list very quickly, or the garbage collector could kick in and remove the +// deleted entries. We don't allow the user to change the directory, thus the +// contents of the file list are constant, so we can avoid the constant file +// and text entry refreshes whenever a button is pressed, and prevent possible +// crashes because of these constant quick object reallocations. Fixes bug +// #3037996. +const byte qfg2SignatureImportDialog[] = { + 16, + 0x63, 0x20, // pToa text + 0x30, 0x0b, 0x00, // bnt [next state] + 0x7a, // push2 + 0x39, 0x03, // pushi 03 + 0x36, // push + 0x43, 0x72, 0x04, // callk Memory 4 + 0x35, 0x00, // ldi 00 + 0x65, 0x20, // aTop text + 0 +}; + +const uint16 qfg2PatchImportDialog[] = { + PATCH_ADDTOOFFSET | +5, + 0x48, // ret + PATCH_END +}; + +// script, description, magic DWORD, adjust +const SciScriptSignature qfg2Signatures[] = { + { 944, "import dialog continuous calls", 1, PATCH_MAGICDWORD(0x20, 0x30, 0x0b, 0x00), -1, qfg2SignatureImportDialog, qfg2PatchImportDialog }, + SCI_SIGNATUREENTRY_TERMINATOR +}; + +// =========================================================================== // script 298 of sq4/floppy has an issue. object "nest" uses another property // which isn't included in property count. We return 0 in that case, the game // adds it to nest::x. The problem is that the script also checks if x exceeds @@ -933,6 +972,9 @@ void Script::matchSignatureAndPatch(uint16 scriptNr, byte *scriptData, const uin case GID_QFG1VGA: signatureTable = qfg1vgaSignatures; break; + case GID_QFG2: + signatureTable = qfg2Signatures; + break; case GID_SQ4: signatureTable = sq4Signatures; break; diff --git a/engines/sci/event.cpp b/engines/sci/event.cpp index 5d8f6a8a28..97c33d5e56 100644 --- a/engines/sci/event.cpp +++ b/engines/sci/event.cpp @@ -347,20 +347,6 @@ SciEvent EventManager::getScummVMEvent() { } } - // WORKAROUND: In the QFG2 character screen, if the user right clicks and - // then left clicks on something, an invalid reference is passed to kStrAt. - // This is a script bug, as only left mouse clicks should be processed by - // the game in that screen. Therefore, we work around it here by filtering - // out all right and middle mouse button clicks. Fixes bug #3037996. - if (g_sci->getGameId() == GID_QFG2 && g_sci->getEngineState()->currentRoomNumber() == 805) { - if ((input.type == SCI_EVENT_MOUSE_PRESS || input.type == SCI_EVENT_MOUSE_RELEASE) && input.data > 1) { - input.type = SCI_EVENT_NONE; - input.character = 0; - input.data = 0; - input.modifiers = 0; - } - } - return input; } |