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

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Wed Nov 17 15:28:32 CET 2010


Revision: 54293
          http://scummvm.svn.sourceforge.net/scummvm/?rev=54293&view=rev
Author:   thebluegr
Date:     2010-11-17 14:28:32 +0000 (Wed, 17 Nov 2010)

Log Message:
-----------
SCI: lofsa/lofss functionality for SCI3

- Updated detectLofsType() for SCI3
- Cleaned up op_lofsa and op_lofss and updated them for SCI3

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

Modified: scummvm/trunk/engines/sci/engine/features.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/features.cpp	2010-11-17 14:08:13 UTC (rev 54292)
+++ scummvm/trunk/engines/sci/engine/features.cpp	2010-11-17 14:28:32 UTC (rev 54293)
@@ -270,11 +270,20 @@
 			return _lofsType;
 		}
 
-		if (getSciVersion() >= SCI_VERSION_1_1) {
+		if (getSciVersion() >= SCI_VERSION_1_1 && getSciVersion() <= SCI_VERSION_2_1) {
+			// SCI1.1 type, i.e. we compensate for the fact that the heap is attached
+			// to the end of the script
 			_lofsType = SCI_VERSION_1_1;
 			return _lofsType;
 		}
 
+		if (getSciVersion() == SCI_VERSION_3) {
+			// SCI3 type, same as pre-SCI1.1, really, as there is no separate heap
+			// resource
+			_lofsType = SCI_VERSION_3;
+			return _lofsType;
+		}
+
 		// Find a function of the "Game" object (which is the game super class) which invokes lofsa/lofss
 		reg_t gameSuperClass = g_sci->getGameSuperClassAddress();
 		bool found = false;

Modified: scummvm/trunk/engines/sci/engine/features.h
===================================================================
--- scummvm/trunk/engines/sci/engine/features.h	2010-11-17 14:08:13 UTC (rev 54292)
+++ scummvm/trunk/engines/sci/engine/features.h	2010-11-17 14:28:32 UTC (rev 54293)
@@ -57,7 +57,7 @@
 
 	/**
 	 * Autodetects the Lofs type
-	 * @return Lofs type, SCI_VERSION_0_EARLY / SCI_VERSION_1_MIDDLE / SCI_VERSION_1_1
+	 * @return Lofs type, SCI_VERSION_0_EARLY / SCI_VERSION_1_MIDDLE / SCI_VERSION_1_1 / SCI_VERSION_3
 	 */
 	SciVersion detectLofsType();
 

Modified: scummvm/trunk/engines/sci/engine/vm.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/vm.cpp	2010-11-17 14:08:13 UTC (rev 54292)
+++ scummvm/trunk/engines/sci/engine/vm.cpp	2010-11-17 14:28:32 UTC (rev 54293)
@@ -1723,14 +1723,20 @@
 			s->r_acc.segment = s->xs->addr.pc.segment;
 
 			switch (g_sci->_features->detectLofsType()) {
+			case SCI_VERSION_0_EARLY:
+				s->r_acc.offset = s->xs->addr.pc.offset + opparams[0];
+				break;
+			case SCI_VERSION_1_MIDDLE:
+				s->r_acc.offset = opparams[0];
+				break;
 			case SCI_VERSION_1_1:
 				s->r_acc.offset = opparams[0] + local_script->getScriptSize();
 				break;
-			case SCI_VERSION_1_MIDDLE:
+			case SCI_VERSION_3:
 				s->r_acc.offset = opparams[0];
 				break;
 			default:
-				s->r_acc.offset = s->xs->addr.pc.offset + opparams[0];
+				error("Unknown lofs type");
 			}
 
 			if (s->r_acc.offset >= scr->getBufSize()) {
@@ -1744,14 +1750,20 @@
 			r_temp.segment = s->xs->addr.pc.segment;
 
 			switch (g_sci->_features->detectLofsType()) {
+			case SCI_VERSION_0_EARLY:
+				r_temp.offset = s->xs->addr.pc.offset + opparams[0];
+				break;
+			case SCI_VERSION_1_MIDDLE:
+				r_temp.offset = opparams[0];
+				break;
 			case SCI_VERSION_1_1:
 				r_temp.offset = opparams[0] + local_script->getScriptSize();
 				break;
-			case SCI_VERSION_1_MIDDLE:
+			case SCI_VERSION_3:
 				r_temp.offset = opparams[0];
 				break;
 			default:
-				r_temp.offset = s->xs->addr.pc.offset + opparams[0];
+				error("Unknown lofs type");
 			}
 
 			if (r_temp.offset >= scr->getBufSize()) {


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