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

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Wed Aug 26 18:50:24 CEST 2009


Revision: 43759
          http://scummvm.svn.sourceforge.net/scummvm/?rev=43759&view=rev
Author:   thebluegr
Date:     2009-08-26 16:50:22 +0000 (Wed, 26 Aug 2009)

Log Message:
-----------
Added a safeguard to avoid getting stuck in an endless loop when initializing some problematic scripts in certain demos (e.g. the EcoQuest 1 demo), and fixed the return values of script_instantiate_sci0() in the process

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

Modified: scummvm/trunk/engines/sci/engine/vm.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/vm.cpp	2009-08-26 15:46:48 UTC (rev 43758)
+++ scummvm/trunk/engines/sci/engine/vm.cpp	2009-08-26 16:50:22 UTC (rev 43759)
@@ -1629,6 +1629,14 @@
 
 		objlength = scr->getHeap(reg.offset + 2);
 
+		// This happens in some demos (e.g. the EcoQuest 1 demo). Not sure what is the
+		// actual cause of it, but the scripts of these demos can't be loaded properly
+		// and we're stuck forever in this loop, as objlength never changes
+		if (!objlength) {
+			warning("script_instantiate_sci0: objlength is 0, unable to parse script");
+			return 0;
+		}
+
 		data_base = reg;
 		data_base.offset += 4;
 
@@ -1654,11 +1662,11 @@
 			int species;
 			species = scr->getHeap(addr.offset - SCRIPT_OBJECT_MAGIC_OFFSET + SCRIPT_SPECIES_OFFSET);
 			if (species < 0 || species >= (int)segManager->_classtable.size()) {
-				error("Invalid species %d(0x%x) not in interval "
+				warning("Invalid species %d(0x%x) not in interval "
 				          "[0,%d) while instantiating script %d\n",
 				          species, species, segManager->_classtable.size(),
 				          script_nr);
-				return 1;
+				return 0;
 			}
 
 			segManager->_classtable[species].reg = addr;


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