[Scummvm-cvs-logs] SF.net SVN: scummvm:[54413] scummvm/trunk/engines/sci

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Mon Nov 22 00:43:15 CET 2010


Revision: 54413
          http://scummvm.svn.sourceforge.net/scummvm/?rev=54413&view=rev
Author:   thebluegr
Date:     2010-11-21 23:43:14 +0000 (Sun, 21 Nov 2010)

Log Message:
-----------
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

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/script_patches.cpp
    scummvm/trunk/engines/sci/event.cpp

Modified: scummvm/trunk/engines/sci/engine/script_patches.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/script_patches.cpp	2010-11-21 22:16:02 UTC (rev 54412)
+++ scummvm/trunk/engines/sci/engine/script_patches.cpp	2010-11-21 23:43:14 UTC (rev 54413)
@@ -713,6 +713,45 @@
 };
 
 // ===========================================================================
+// 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 @@
 	case GID_QFG1VGA:
 		signatureTable = qfg1vgaSignatures;
 		break;
+	case GID_QFG2:
+		signatureTable = qfg2Signatures;
+		break;
 	case GID_SQ4:
 		signatureTable = sq4Signatures;
 		break;

Modified: scummvm/trunk/engines/sci/event.cpp
===================================================================
--- scummvm/trunk/engines/sci/event.cpp	2010-11-21 22:16:02 UTC (rev 54412)
+++ scummvm/trunk/engines/sci/event.cpp	2010-11-21 23:43:14 UTC (rev 54413)
@@ -347,20 +347,6 @@
 		}
 	}
 	
-	// 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;
 }
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list