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

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Wed Nov 17 21:47:00 CET 2010


Revision: 54304
          http://scummvm.svn.sourceforge.net/scummvm/?rev=54304&view=rev
Author:   thebluegr
Date:     2010-11-17 20:46:59 +0000 (Wed, 17 Nov 2010)

Log Message:
-----------
SCI: Added sanity checks for SCI3 scripts bigger than 64KB

- Extended the "verify_scripts" console command for SCI3 scripts
- Added a check for such large scripts when scripts are loaded, with
an error for now, till a mechanism to support such scripts with a
16-bit addressing scheme is in place (e.g. overlaying, or splitting
scripts). Either way, such scripts should span over more than one segment

Modified Paths:
--------------
    scummvm/trunk/engines/sci/console.cpp
    scummvm/trunk/engines/sci/engine/script.cpp

Modified: scummvm/trunk/engines/sci/console.cpp
===================================================================
--- scummvm/trunk/engines/sci/console.cpp	2010-11-17 20:43:51 UTC (rev 54303)
+++ scummvm/trunk/engines/sci/console.cpp	2010-11-17 20:46:59 UTC (rev 54304)
@@ -834,8 +834,8 @@
 }
 
 bool Console::cmdVerifyScripts(int argc, const char **argv) {
-	if (getSciVersion() < SCI_VERSION_1_1 || getSciVersion() == SCI_VERSION_3) {
-		DebugPrintf("This script check is only meant for SCI1.1-SCI2.1 games\n");
+	if (getSciVersion() < SCI_VERSION_1_1) {
+		DebugPrintf("This script check is only meant for SCI1.1-SCI3 games\n");
 		return true;
 	}
 
@@ -843,7 +843,7 @@
 	Common::sort(resources->begin(), resources->end());
 	Common::List<ResourceId>::iterator itr = resources->begin();
 
-	DebugPrintf("%d SCI1.1-SCI2.1 scripts found, performing sanity checks...\n", resources->size());
+	DebugPrintf("%d SCI1.1-SCI3 scripts found, performing sanity checks...\n", resources->size());
 
 	Resource *script, *heap;
 	while (itr != resources->end()) {
@@ -851,13 +851,19 @@
 		if (!script)
 			DebugPrintf("Error: script %d couldn't be loaded\n", itr->getNumber());
 
-		heap = _engine->getResMan()->findResource(ResourceId(kResourceTypeHeap, itr->getNumber()), false);
-		if (!heap)
-			DebugPrintf("Error: script %d doesn't have a corresponding heap\n", itr->getNumber());
+		if (getSciVersion() <= SCI_VERSION_2_1) {
+			heap = _engine->getResMan()->findResource(ResourceId(kResourceTypeHeap, itr->getNumber()), false);
+			if (!heap)
+				DebugPrintf("Error: script %d doesn't have a corresponding heap\n", itr->getNumber());
 
-		if (script && heap && (script->size + heap->size > 65535))
-			DebugPrintf("Error: script and heap %d together are larger than 64KB (%d bytes)\n",
-			itr->getNumber(), script->size + heap->size);
+			if (script && heap && (script->size + heap->size > 65535))
+				DebugPrintf("Error: script and heap %d together are larger than 64KB (%d bytes)\n",
+				itr->getNumber(), script->size + heap->size);
+		} else {	// SCI3
+			if (script && script->size > 65535)
+				DebugPrintf("Error: script %d is larger than 64KB (%d bytes)\n",
+				itr->getNumber(), script->size);
+		}
 
 		++itr;
 	}

Modified: scummvm/trunk/engines/sci/engine/script.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/script.cpp	2010-11-17 20:43:51 UTC (rev 54303)
+++ scummvm/trunk/engines/sci/engine/script.cpp	2010-11-17 20:46:59 UTC (rev 54304)
@@ -113,6 +113,15 @@
 			error("Script and heap sizes combined exceed 64K. This means a fundamental "
 					"design bug was made regarding SCI1.1 and newer games.\n"
 					"Please report this error to the ScummVM team");
+	} else if (getSciVersion() == SCI_VERSION_3) {
+		// Check for scripts over 64KB. These won't work with the current 16-bit address
+		// scheme. We need an overlaying mechanism, or a mechanism to split script parts
+		// in different segments to handle these. For now, simply stop when such a script
+		// is found.
+		// TODO: Remove this once such a mechanism is in place
+		if (script->size > 65535)
+			error("TODO: SCI script %d is over 64KB - it's %d bytes long. This can't "
+			      "be handled at the moment, thus stopping", script_nr, script->size);
 	}
 }
 


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