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

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Fri Aug 6 13:45:33 CEST 2010


Revision: 51783
          http://scummvm.svn.sourceforge.net/scummvm/?rev=51783&view=rev
Author:   m_kiewitz
Date:     2010-08-06 11:45:32 +0000 (Fri, 06 Aug 2010)

Log Message:
-----------
SCI: properly implementing qfg2 astrologer workaround

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 11:02:52 UTC (rev 51782)
+++ scummvm/trunk/engines/sci/engine/vm.cpp	2010-08-06 11:45:32 UTC (rev 51783)
@@ -136,12 +136,7 @@
 	if (reg.segment) {
 		// The results of this are likely unpredictable... It most likely means that a kernel function is returning something wrong.
 		// If such an error occurs, we usually need to find the last kernel function called and check its return value.
-		if (g_sci->getGameId() == GID_QFG2 && g_sci->getEngineState()->currentRoomNumber() == 200) {
-			// WORKAROUND: This happens in QFG2, room 200, when talking to the astrologer (bug #3039879) - script bug.
-			// Returning 0 in this case.
-		} else {
-			error("[VM] Attempt to read arithmetic value from non-zero segment [%04x]. Address: %04x:%04x", reg.segment, PRINT_REG(reg));
-		}
+		error("[VM] Attempt to read arithmetic value from non-zero segment [%04x]. Address: %04x:%04x", reg.segment, PRINT_REG(reg));
 		return 0;
 	}
 
@@ -1820,13 +1815,17 @@
 		case op_lsgi: // 0x4c (76)
 		case op_lsli: // 0x4d (77)
 		case op_lsti: // 0x4e (78)
-		case op_lspi: // 0x4f (79)
+		case op_lspi: { // 0x4f (79)
 			// Load global, local, temp or param variable into the stack,
 			// using the accumulator as an additional index
 			var_type = opcode & 0x3; // Gets the variable type: g, l, t or p
-			var_number = opparams[0] + signed_validate_arithmetic(s->r_acc);
+			int16 value;
+			if (!validate_signedInteger(s->r_acc, value))
+				value = arithmetic_lookForWorkaround(opcode, opcodeLsiWorkarounds, s->r_acc, NULL_REG).offset;
+			var_number = opparams[0] + value;
 			PUSH32(READ_VAR(var_type, var_number));
 			break;
+		}
 
 		case op_sag: // 0x50 (80)
 		case op_sal: // 0x51 (81)

Modified: scummvm/trunk/engines/sci/engine/workarounds.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/workarounds.cpp	2010-08-06 11:02:52 UTC (rev 51782)
+++ scummvm/trunk/engines/sci/engine/workarounds.cpp	2010-08-06 11:45:32 UTC (rev 51783)
@@ -53,6 +53,12 @@
 };
 
 //    gameID,           room,script,lvl,          object-name, method-name,    call,index,             workaround
+const SciWorkaroundEntry opcodeLsiWorkarounds[] = {
+	{ GID_QFG2,           200,  200,  0,              "astro", "messages",       -1,    0, { WORKAROUND_FAKE,   0 } }, // when getting asked for your name by the astrologer bug #3039879
+	SCI_WORKAROUNDENTRY_TERMINATOR
+};
+
+//    gameID,           room,script,lvl,          object-name, method-name,    call,index,             workaround
 const SciWorkaroundEntry opcodeMulWorkarounds[] = {
 	{ GID_FANMADE,        516,  983,  0,             "Wander", "setTarget",      -1,    0, { WORKAROUND_FAKE,   0 } }, // The Legend of the Lost Jewel Demo (fan made): called with object as second parameter when attacked by insects - bug #3038913
 	SCI_WORKAROUNDENTRY_TERMINATOR

Modified: scummvm/trunk/engines/sci/engine/workarounds.h
===================================================================
--- scummvm/trunk/engines/sci/engine/workarounds.h	2010-08-06 11:02:52 UTC (rev 51782)
+++ scummvm/trunk/engines/sci/engine/workarounds.h	2010-08-06 11:45:32 UTC (rev 51783)
@@ -71,6 +71,7 @@
 extern const SciWorkaroundEntry opcodeDivWorkarounds[];
 extern const SciWorkaroundEntry opcodeDptoaWorkarounds[];
 extern const SciWorkaroundEntry opcodeGeWorkarounds[];
+extern const SciWorkaroundEntry opcodeLsiWorkarounds[];
 extern const SciWorkaroundEntry opcodeMulWorkarounds[];
 extern const SciWorkaroundEntry opcodeOrWorkarounds[];
 extern const SciWorkaroundEntry uninitializedReadWorkarounds[];


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