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

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Fri Aug 6 17:05:05 CEST 2010


Revision: 51786
          http://scummvm.svn.sourceforge.net/scummvm/?rev=51786&view=rev
Author:   thebluegr
Date:     2010-08-06 15:05:05 +0000 (Fri, 06 Aug 2010)

Log Message:
-----------
SCI: Rewrote the Mother Goose workaround to be like the others, some cleanup

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/vm.cpp
    scummvm/trunk/engines/sci/engine/workarounds.cpp
    scummvm/trunk/engines/sci/engine/workarounds.h

Modified: scummvm/trunk/engines/sci/engine/vm.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/vm.cpp	2010-08-06 14:54:00 UTC (rev 51785)
+++ scummvm/trunk/engines/sci/engine/vm.cpp	2010-08-06 15:05:05 UTC (rev 51786)
@@ -75,7 +75,6 @@
 		reg_t objp, int argc, StackPtr argp, Selector selector, int exportId, int localCallOffset,
 		reg_t sendp, int origin, SegmentId local_segment);
 
-
 /**
  * Adds one varselector access to the execution stack.
  * This function is called from send_selector only.
@@ -93,8 +92,6 @@
 		int origin);
 
 
-
-
 // validation functionality
 
 static reg_t &validate_property(Object *obj, int index) {
@@ -103,14 +100,10 @@
 	// may modify the value of the returned reg_t.
 	static reg_t dummyReg = NULL_REG;
 
-	// FIXME/TODO: Where does this occur? Returning a dummy reg here could lead
-	// to all sorts of issues! Turned it into an error for now...
 	// If this occurs, it means there's probably something wrong with the garbage
 	// collector, so don't hide it with fake return values
-	if (!obj) {
+	if (!obj)
 		error("validate_property: Sending to disposed object");
-		//return dummyReg;
-	}
 
 	if (index < 0 || (uint)index >= obj->getVarCount()) {
 		// This is same way sierra does it and there are some games, that contain such scripts like
@@ -166,11 +159,6 @@
 				error("%s. [VM] Access would be outside even of the stack (%d); access denied", txt.c_str(), total_offset);
 				return false;
 			} else {
-				// WORKAROUND: Mixed-Up Mother Goose tries to use an invalid parameter in Event::new().
-				// Just skip around it here so we don't error out in validate_arithmetic.
-				if (g_sci->getGameId() == GID_MOTHERGOOSE && type == VAR_PARAM && index == 1)
-					return false;
-
 				debugC(2, kDebugLevelVM, "%s", txt.c_str());
 				debugC(2, kDebugLevelVM, "[VM] Access within stack boundaries; access granted.");
 				return true;
@@ -1139,7 +1127,7 @@
 			if (validate_unsignedInteger(r_temp, value1) && validate_unsignedInteger(s->r_acc, value2))
 				s->r_acc = make_reg(0, value1 & value2);
 			else
-				s->r_acc = arithmetic_lookForWorkaround(opcode, NULL, r_temp, s->r_acc);
+				s->r_acc = arithmetic_lookForWorkaround(opcode, opcodeAndWorkarounds, r_temp, s->r_acc);
 			break;
 		}
 

Modified: scummvm/trunk/engines/sci/engine/workarounds.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/workarounds.cpp	2010-08-06 14:54:00 UTC (rev 51785)
+++ scummvm/trunk/engines/sci/engine/workarounds.cpp	2010-08-06 15:05:05 UTC (rev 51786)
@@ -65,8 +65,14 @@
 };
 
 //    gameID,           room,script,lvl,          object-name, method-name,    call,index,             workaround
+const SciWorkaroundEntry opcodeAndWorkarounds[] = {
+	{ GID_MOTHERGOOSE,     -1,  999,  0,               "Event", "new",           -1,     0, { WORKAROUND_FAKE,   0 } }, // constantly during the game
+	SCI_WORKAROUNDENTRY_TERMINATOR
+};
+
+//    gameID,           room,script,lvl,          object-name, method-name,    call,index,             workaround
 const SciWorkaroundEntry opcodeOrWorkarounds[] = {
-	{ GID_ECOQUEST2,      100,    0,  0,               "Rain", "points",      0xcc6,    0, { WORKAROUND_FAKE,   0 } }, // when giving the papers to the customs officer, gets called against a pointer instead of a number - bug #3034464
+	{ GID_ECOQUEST2,        100,    0,  0,              "Rain", "points",      0xcc6,    0, { WORKAROUND_FAKE,   0 } }, // when giving the papers to the customs officer, gets called against a pointer instead of a number - bug #3034464
 	SCI_WORKAROUNDENTRY_TERMINATOR
 };
 

Modified: scummvm/trunk/engines/sci/engine/workarounds.h
===================================================================
--- scummvm/trunk/engines/sci/engine/workarounds.h	2010-08-06 14:54:00 UTC (rev 51785)
+++ scummvm/trunk/engines/sci/engine/workarounds.h	2010-08-06 15:05:05 UTC (rev 51786)
@@ -73,6 +73,7 @@
 extern const SciWorkaroundEntry opcodeGeWorkarounds[];
 extern const SciWorkaroundEntry opcodeLsiWorkarounds[];
 extern const SciWorkaroundEntry opcodeMulWorkarounds[];
+extern const SciWorkaroundEntry opcodeAndWorkarounds[];
 extern const SciWorkaroundEntry opcodeOrWorkarounds[];
 extern const SciWorkaroundEntry uninitializedReadWorkarounds[];
 extern const SciWorkaroundEntry kAbs_workarounds[];


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