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

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Sun Nov 28 15:57:56 CET 2010


Revision: 54521
          http://scummvm.svn.sourceforge.net/scummvm/?rev=54521&view=rev
Author:   thebluegr
Date:     2010-11-28 14:57:56 +0000 (Sun, 28 Nov 2010)

Log Message:
-----------
SCI: Fixed bug #3034471 - "SCI, Castlebrain/Amiga: Invisible text in word search"

Fixed some endianness issues in Amiga versions, thanks to wjp. Amiga
versions expect a BE VM, thus we adjust accordingly in the places
where memory is accessed directly (i.e. kStrAt, kMemory and all places
that set/get characters from memory)

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/kmisc.cpp
    scummvm/trunk/engines/sci/engine/kstring.cpp
    scummvm/trunk/engines/sci/engine/seg_manager.cpp

Modified: scummvm/trunk/engines/sci/engine/kmisc.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kmisc.cpp	2010-11-28 14:57:26 UTC (rev 54520)
+++ scummvm/trunk/engines/sci/engine/kmisc.cpp	2010-11-28 14:57:56 UTC (rev 54521)
@@ -289,9 +289,12 @@
 			error("Attempt to peek invalid memory at %04x:%04x", PRINT_REG(argv[1]));
 			return s->r_acc;
 		}
-		if (ref.isRaw)
-			return make_reg(0, (int16)READ_LE_UINT16(ref.raw));
-		else {
+		if (ref.isRaw) {
+			if (g_sci->getPlatform() == Common::kPlatformAmiga)
+				return make_reg(0, (int16)READ_BE_UINT16(ref.raw));		// Amiga versions are BE
+			else
+				return make_reg(0, (int16)READ_LE_UINT16(ref.raw));
+		} else {
 			if (ref.skipByte)
 				error("Attempt to peek memory at odd offset %04X:%04X", PRINT_REG(argv[1]));
 			return *(ref.reg);
@@ -311,7 +314,10 @@
 				error("Attempt to poke memory reference %04x:%04x to %04x:%04x", PRINT_REG(argv[2]), PRINT_REG(argv[1]));
 				return s->r_acc;
 			}
-			WRITE_LE_UINT16(ref.raw, argv[2].offset);
+			if (g_sci->getPlatform() == Common::kPlatformAmiga)
+				WRITE_BE_UINT16(ref.raw, argv[2].offset);		// Amiga versions are BE
+			else
+				WRITE_LE_UINT16(ref.raw, argv[2].offset);
 		} else {
 			if (ref.skipByte)
 				error("Attempt to poke memory at odd offset %04X:%04X", PRINT_REG(argv[1]));

Modified: scummvm/trunk/engines/sci/engine/kstring.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kstring.cpp	2010-11-28 14:57:26 UTC (rev 54520)
+++ scummvm/trunk/engines/sci/engine/kstring.cpp	2010-11-28 14:57:56 UTC (rev 54521)
@@ -111,7 +111,12 @@
 			offset++;
 
 		reg_t &tmp = dest_r.reg[offset / 2];
-		if (!(offset & 1)) {
+
+		bool oddOffset = offset & 1;
+		if (g_sci->getPlatform() == Common::kPlatformAmiga)
+			oddOffset = !oddOffset;
+
+		if (!oddOffset) {
 			value = tmp.offset & 0x00ff;
 			if (argc > 2) { /* Request to modify this char */
 				tmp.offset &= 0xff00;
@@ -128,9 +133,7 @@
 		}
 	}
 
-	s->r_acc = make_reg(0, value);
-
-	return s->r_acc;
+	return make_reg(0, value);
 }
 
 

Modified: scummvm/trunk/engines/sci/engine/seg_manager.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/seg_manager.cpp	2010-11-28 14:57:26 UTC (rev 54520)
+++ scummvm/trunk/engines/sci/engine/seg_manager.cpp	2010-11-28 14:57:56 UTC (rev 54521)
@@ -600,7 +600,11 @@
 		if (!((val.segment == 0xFFFF) && (offset > 1)))
 			warning("Attempt to read character from non-raw data");
 
-	return (offset & 1 ? val.offset >> 8 : val.offset & 0xff);
+	bool oddOffset = offset & 1;
+	if (g_sci->getPlatform() == Common::kPlatformAmiga)
+		oddOffset = !oddOffset;		// Amiga versions are BE
+
+	return (oddOffset ? val.offset >> 8 : val.offset & 0xff);
 }
 
 static inline void setChar(const SegmentRef &ref, uint offset, char value) {
@@ -611,7 +615,11 @@
 
 	val->segment = 0;
 
-	if (offset & 1)
+	bool oddOffset = offset & 1;
+	if (g_sci->getPlatform() == Common::kPlatformAmiga)
+		oddOffset = !oddOffset;		// Amiga versions are BE
+
+	if (oddOffset)
 		val->offset = (val->offset & 0x00ff) | (value << 8);
 	else
 		val->offset = (val->offset & 0xff00) | value;


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