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

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Sat Aug 14 08:05:55 CEST 2010


Revision: 52077
          http://scummvm.svn.sourceforge.net/scummvm/?rev=52077&view=rev
Author:   m_kiewitz
Date:     2010-08-14 06:05:54 +0000 (Sat, 14 Aug 2010)

Log Message:
-----------
SCI: adding workaround for camelot during ending

fixes bug #3044734
also fixing heap corruption during the ending

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

Modified: scummvm/trunk/engines/sci/engine/vm.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/vm.cpp	2010-08-14 04:21:09 UTC (rev 52076)
+++ scummvm/trunk/engines/sci/engine/vm.cpp	2010-08-14 06:05:54 UTC (rev 52077)
@@ -1800,7 +1800,10 @@
 			// Load global, local, temp or param variable into the accumulator,
 			// 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, opcodeLaiWorkarounds, s->r_acc, NULL_REG).offset;
+			var_number = opparams[0] + value;
 			s->r_acc = READ_VAR(var_type, var_number);
 			break;
 

Modified: scummvm/trunk/engines/sci/engine/workarounds.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/workarounds.cpp	2010-08-14 04:21:09 UTC (rev 52076)
+++ scummvm/trunk/engines/sci/engine/workarounds.cpp	2010-08-14 06:05:54 UTC (rev 52077)
@@ -59,6 +59,12 @@
 };
 
 //    gameID,           room,script,lvl,          object-name, method-name,    call,index,             workaround
+const SciWorkaroundEntry opcodeLaiWorkarounds[] = {
+	{ GID_CAMELOT,         92,   92,  0,     "endingCartoon2", "changeState", 0x20d,    0, { WORKAROUND_FAKE,   0 } }, // during the ending, sub gets called with no parameters, uses parameter 1 which is theGrail in this case - bug #3044734
+	SCI_WORKAROUNDENTRY_TERMINATOR
+};
+
+//    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

Modified: scummvm/trunk/engines/sci/engine/workarounds.h
===================================================================
--- scummvm/trunk/engines/sci/engine/workarounds.h	2010-08-14 04:21:09 UTC (rev 52076)
+++ scummvm/trunk/engines/sci/engine/workarounds.h	2010-08-14 06:05:54 UTC (rev 52077)
@@ -72,6 +72,7 @@
 extern const SciWorkaroundEntry opcodeDptoaWorkarounds[];
 extern const SciWorkaroundEntry opcodeGeWorkarounds[];
 extern const SciWorkaroundEntry opcodeLeWorkarounds[];
+extern const SciWorkaroundEntry opcodeLaiWorkarounds[];
 extern const SciWorkaroundEntry opcodeLsiWorkarounds[];
 extern const SciWorkaroundEntry opcodeMulWorkarounds[];
 extern const SciWorkaroundEntry opcodeAndWorkarounds[];

Modified: scummvm/trunk/engines/sci/graphics/paint16.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/paint16.cpp	2010-08-14 04:21:09 UTC (rev 52076)
+++ scummvm/trunk/engines/sci/graphics/paint16.cpp	2010-08-14 06:05:54 UTC (rev 52077)
@@ -417,6 +417,7 @@
 }
 
 void GfxPaint16::kernelGraphDrawLine(Common::Point startPoint, Common::Point endPoint, int16 color, int16 priority, int16 control) {
+	_ports->clipLine(startPoint, endPoint);
 	_ports->offsetLine(startPoint, endPoint);
 	_screen->drawLine(startPoint.x, startPoint.y, endPoint.x, endPoint.y, color, priority, control);
 }

Modified: scummvm/trunk/engines/sci/graphics/ports.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/ports.cpp	2010-08-14 04:21:09 UTC (rev 52076)
+++ scummvm/trunk/engines/sci/graphics/ports.cpp	2010-08-14 06:05:54 UTC (rev 52077)
@@ -566,6 +566,13 @@
 	end.y += _curPort->top;
 }
 
+void GfxPorts::clipLine(Common::Point &start, Common::Point &end) {
+	start.y = CLIP<int16>(start.y, _curPort->rect.top, _curPort->rect.bottom - 1);
+	start.x = CLIP<int16>(start.x, _curPort->rect.left, _curPort->rect.right - 1);
+	end.y = CLIP<int16>(end.y, _curPort->rect.top, _curPort->rect.bottom - 1);
+	end.x = CLIP<int16>(end.x, _curPort->rect.left, _curPort->rect.right - 1);
+}
+
 void GfxPorts::priorityBandsInit(int16 bandCount, int16 top, int16 bottom) {
 	int16 y;
 	int32 bandSize;

Modified: scummvm/trunk/engines/sci/graphics/ports.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/ports.h	2010-08-14 04:21:09 UTC (rev 52076)
+++ scummvm/trunk/engines/sci/graphics/ports.h	2010-08-14 06:05:54 UTC (rev 52077)
@@ -83,6 +83,7 @@
 
 	void offsetRect(Common::Rect &r);
 	void offsetLine(Common::Point &start, Common::Point &end);
+	void clipLine(Common::Point &start, Common::Point &end);
 
 	void priorityBandsInit(int16 bandCount, int16 top, int16 bottom);
 	void priorityBandsInit(byte *data);


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