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

wjpalenstijn at users.sourceforge.net wjpalenstijn at users.sourceforge.net
Sun Sep 27 14:23:14 CEST 2009


Revision: 44396
          http://scummvm.svn.sourceforge.net/scummvm/?rev=44396&view=rev
Author:   wjpalenstijn
Date:     2009-09-27 12:23:14 +0000 (Sun, 27 Sep 2009)

Log Message:
-----------
SCI: change segment offsets in reg segments to be in half reg_t.
This makes offsets in raw and reg segments consistent, which
fixes string addressing in savegame dialogs.

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/seg_manager.cpp
    scummvm/trunk/engines/sci/engine/segment.cpp
    scummvm/trunk/engines/sci/engine/vm.cpp

Modified: scummvm/trunk/engines/sci/engine/seg_manager.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/seg_manager.cpp	2009-09-27 12:14:08 UTC (rev 44395)
+++ scummvm/trunk/engines/sci/engine/seg_manager.cpp	2009-09-27 12:23:14 UTC (rev 44396)
@@ -859,9 +859,8 @@
 }
 
 reg_t *SegManager::derefRegPtr(reg_t pointer, int entries) {
-	const int align = sizeof(reg_t);
-	if (pointer.offset & (align - 1)) {
-		warning("Unaligned pointer read: %04x:%04x expected with %d alignment", PRINT_REG(pointer), align);
+	if (pointer.offset & 1) {
+		warning("Unaligned pointer read: %04x:%04x expected with word alignment", PRINT_REG(pointer));
 		return NULL;
 	}
 

Modified: scummvm/trunk/engines/sci/engine/segment.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/segment.cpp	2009-09-27 12:14:08 UTC (rev 44395)
+++ scummvm/trunk/engines/sci/engine/segment.cpp	2009-09-27 12:23:14 UTC (rev 44396)
@@ -264,7 +264,7 @@
 	SegmentRef ret;
 	ret.isRaw = false;	// reg_t based data!
 	ret.maxSize = _locals.size() * sizeof(reg_t);
-	ret.raw = (byte *)&_locals[0] + pointer.offset;
+	ret.raw = (byte *)&_locals[pointer.offset/2];
 	return ret;
 }
 
@@ -279,7 +279,7 @@
 	// FIXME: Is this correct? See comment in LocalVariables::dereference
 	if (pointer.offset & 1)
 		warning("LocalVariables::dereference: Odd offset in pointer  %04x:%04x", PRINT_REG(pointer));
-	ret.raw = (byte *)_entries + pointer.offset;
+	ret.raw = (byte *)&_entries[pointer.offset/2];
 	return ret;
 }
 

Modified: scummvm/trunk/engines/sci/engine/vm.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/vm.cpp	2009-09-27 12:14:08 UTC (rev 44395)
+++ scummvm/trunk/engines/sci/engine/vm.cpp	2009-09-27 12:23:14 UTC (rev 44396)
@@ -490,9 +490,6 @@
 	switch (mobj->getType()) {
 
 	case SEG_TYPE_LOCALS:
-		base.offset += 2 * offset;
-		return base;
-
 	case SEG_TYPE_SCRIPT:
 	case SEG_TYPE_STACK:
 	case SEG_TYPE_DYNMEM:
@@ -1112,7 +1109,7 @@
 				r_temp.offset += signed_validate_arithmetic(s->r_acc);
 
 			r_temp.offset += opparams[1];  // Add index
-			r_temp.offset *= sizeof(reg_t);
+			r_temp.offset *= 2; // variables are 16 bit
 			// That's the immediate address now
 			s->r_acc = r_temp;
 			break;


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