[Scummvm-cvs-logs] scummvm master -> b807041ad2527a355be6c1eb56e659e6daac0cb7

bluegr md5 at scummvm.org
Thu Sep 22 03:25:02 CEST 2011


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
7f675de855 SCI: Fixed compilation with VM_DEBUG_SEND defined
b807041ad2 SCI: Ignore invalid pointers if the kernel function signature specifies it


Commit: 7f675de8554b30e7b14af87a9cbb2e51d66fde5b
    https://github.com/scummvm/scummvm/commit/7f675de8554b30e7b14af87a9cbb2e51d66fde5b
Author: Filippos Karapetis (md5 at scummvm.org)
Date: 2011-09-21T18:18:11-07:00

Commit Message:
SCI: Fixed compilation with VM_DEBUG_SEND defined

Changed paths:
    engines/sci/engine/scriptdebug.cpp
    engines/sci/engine/vm.cpp



diff --git a/engines/sci/engine/scriptdebug.cpp b/engines/sci/engine/scriptdebug.cpp
index 3a18fbc..ad3f4fb 100644
--- a/engines/sci/engine/scriptdebug.cpp
+++ b/engines/sci/engine/scriptdebug.cpp
@@ -31,6 +31,8 @@
 
 namespace Sci {
 
+//#define VM_DEBUG_SEND
+
 // This table is only used for debugging. Don't include it for devices
 // with not enough available memory (e.g. phones), where REDUCE_MEMORY_USAGE
 // is defined
@@ -618,12 +620,13 @@ void debugSelectorCall(reg_t send_obj, Selector selector, int argc, StackPtr arg
 
 #ifdef VM_DEBUG_SEND
 		debugN("Send to %04x:%04x (%s), selector %04x (%s):", PRINT_REG(send_obj),
-			s->_segMan->getObjectName(send_obj), selector,
+			segMan->getObjectName(send_obj), selector,
 			g_sci->getKernel()->getSelectorName(selector).c_str());
 #endif // VM_DEBUG_SEND
 
 	switch (selectorType) {
 	case kSelectorNone:
+		debugN("\n");
 		break;
 	case kSelectorVariable:
 #ifdef VM_DEBUG_SEND
diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp
index 274b0bb..7c22b48 100644
--- a/engines/sci/engine/vm.cpp
+++ b/engines/sci/engine/vm.cpp
@@ -41,7 +41,6 @@ namespace Sci {
 const reg_t NULL_REG = {0, 0};
 const reg_t SIGNAL_REG = {0, SIGNAL_OFFSET};
 const reg_t TRUE_REG = {0, 1};
-//#define VM_DEBUG_SEND
 // Enable the define below to have the VM abort on cases where a conditional
 // statement is followed by an unconditional jump (which will most likely lead
 // to an infinite loop). Aids in detecting script bugs such as #3040722.


Commit: b807041ad2527a355be6c1eb56e659e6daac0cb7
    https://github.com/scummvm/scummvm/commit/b807041ad2527a355be6c1eb56e659e6daac0cb7
Author: Filippos Karapetis (md5 at scummvm.org)
Date: 2011-09-21T18:18:13-07:00

Commit Message:
SCI: Ignore invalid pointers if the kernel function signature specifies it

SCI scripts can send stale pointers to kernel functions (e.g. after
loading a saved game). This is normal in some cases (such as kDisplay
and kGraphRestoreBox), and their signatures are set to allow invalid
pointers.
Thus, in such cases, allow invalid pointers, as the kernel functions
will handle them themselves. Fixes bug #3412002, and properly fixes bugs
#3389579, #3292251, #3308087 and #3056811. Removed a relevant TODO.

Changed paths:
    engines/sci/engine/kernel.cpp
    engines/sci/engine/workarounds.cpp



diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp
index 8fb6322..a83a026 100644
--- a/engines/sci/engine/kernel.cpp
+++ b/engines/sci/engine/kernel.cpp
@@ -488,8 +488,15 @@ bool Kernel::signatureMatch(const uint16 *sig, int argc, const reg_t *argv) {
 		if ((type & SIG_IS_INVALID) && (!(curSig & SIG_IS_INVALID)))
 			return false; // pointer is invalid and signature doesn't allow that?
 
-		if (!((type & ~SIG_IS_INVALID) & curSig))
-			return false; // type mismatch
+		if (!((type & ~SIG_IS_INVALID) & curSig)) {
+			if ((type & ~SIG_IS_INVALID) == SIG_TYPE_ERROR && (curSig & SIG_IS_INVALID)) {
+				// Type is unknown (error - usually because of a deallocated object or
+				// stale pointer) and the signature allows invalid pointers. In this case,
+				// ignore the invalid pointer.
+			} else {
+				return false; // type mismatch
+			}
+		}
 
 		if (!(curSig & SIG_MORE_MAY_FOLLOW)) {
 			sig++;
diff --git a/engines/sci/engine/workarounds.cpp b/engines/sci/engine/workarounds.cpp
index 968afcb..ac8d5fa 100644
--- a/engines/sci/engine/workarounds.cpp
+++ b/engines/sci/engine/workarounds.cpp
@@ -209,15 +209,9 @@ const SciWorkaroundEntry kDeviceInfo_workarounds[] = {
 //    gameID,           room,script,lvl,          object-name, method-name,    call,index,                workaround
 const SciWorkaroundEntry kDisplay_workarounds[] = {
 	{ GID_ISLANDBRAIN,   300,   300,  0,           "geneDude", "show",           -1,    0, { WORKAROUND_IGNORE,    0 } }, // when looking at the gene explanation chart - a parameter is an object
-	{ GID_PQ1,           500,   500,  0,           "endInter", "changeState", 0x3e8,    0, { WORKAROUND_IGNORE,    0 } }, // restoring a game at the map scene (bug #3389579)
-	{ GID_PQ1,           500,   500,  0,           "endInter", "changeState", 0x46b,    0, { WORKAROUND_IGNORE,    0 } }, // restoring a game at the map scene (bug #3389579)
 	{ GID_PQ2,            23,    23,  0,         "rm23Script", "elements",    0x4ae,    0, { WORKAROUND_IGNORE,    0 } }, // when looking at the 2nd page of pate's file - 0x75 as id
 	{ GID_PQ2,            23,    23,  0,         "rm23Script", "elements",    0x4c1,    0, { WORKAROUND_IGNORE,    0 } }, // when looking at the 2nd page of pate's file - 0x75 as id (another pq2 version, bug #3043904)
 	{ GID_QFG1,           11,    11,  0,             "battle", "<noname90>",     -1,    0, { WORKAROUND_IGNORE,    0 } }, // DEMO: When entering battle, 0x75 as id
-	{ GID_QFG3,           -1,    47,  0,          "barterWin", "open",       0x1426,    0, { WORKAROUND_IGNORE,    0 } }, // sometimes when talking with a vendor that can be bartered with, the wrong local variable is checked and the variable contents are wrong - bug #3292251
-	{ GID_QFG3,           -1,    47,  0,         "barterIcon", "show",       0x135c,    0, { WORKAROUND_IGNORE,    0 } }, // sometimes when talking with a vendor that can be bartered with, the wrong local variable is checked and the variable contents are wrong - bug #3292251
-	{ GID_SQ1,            -1,   700,  0,       "arcadaRegion", "doit",           -1,    0, { WORKAROUND_IGNORE,    0 } }, // restoring in some rooms of the arcada (right at the start)
-	{ GID_SQ1,            44,    44,  0,           "spinDone", "changeState",0x13b0,    0, { WORKAROUND_IGNORE,    0 } }, // restoring a game at the slot machine in Ulence Flats (bug #3308087)
 	{ GID_SQ4,           397,     0,  0,                   "", "export 12",      -1,    0, { WORKAROUND_IGNORE,    0 } }, // FLOPPY: when going into the computer store (bug #3044044)
 	{ GID_SQ4,           391,   391,  0,          "doCatalog", "mode",         0x84,    0, { WORKAROUND_IGNORE,    0 } }, // CD: clicking on catalog in roboter sale - a parameter is an object
 	{ GID_SQ4,           391,   391,  0,         "choosePlug", "changeState",    -1,    0, { WORKAROUND_IGNORE,    0 } }, // CD: ordering connector in roboter sale - a parameter is an object
@@ -285,10 +279,7 @@ const SciWorkaroundEntry kGraphSaveBox_workarounds[] = {
 
 //    gameID,           room,script,lvl,          object-name, method-name,    call,index,                workaround
 const SciWorkaroundEntry kGraphRestoreBox_workarounds[] = {
-	{ GID_LSL6,           -1,    86,  0,             "LL6Inv", "show",           -1,    0, { WORKAROUND_STILLCALL, 0 } }, // happens when restoring, is called with hunk segment, but hunk is not allocated at that time
-	// ^^ TODO: check, if this is really a script error or an issue with our restore code
 	{ GID_LSL6,           -1,    86,  0,             "LL6Inv", "hide",           -1,    0, { WORKAROUND_STILLCALL, 0 } }, // happens during the game, gets called with 1 extra parameter
-	{ GID_SQ5,           850,   850,  0,                 NULL, "changeState",    -1,    0, { WORKAROUND_STILLCALL, 0 } }, // happens while playing Battle Cruiser (invalid segment) - bug #3056811
 	SCI_WORKAROUNDENTRY_TERMINATOR
 };
 






More information about the Scummvm-git-logs mailing list