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

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Fri Nov 20 15:17:47 CET 2009


Revision: 46006
          http://scummvm.svn.sourceforge.net/scummvm/?rev=46006&view=rev
Author:   thebluegr
Date:     2009-11-20 14:17:47 +0000 (Fri, 20 Nov 2009)

Log Message:
-----------
Changed the lofs detection to iterate through all the methods of the Game object again, instead of a specific selector - fixes Jones

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/script.cpp
    scummvm/trunk/engines/sci/engine/state.cpp
    scummvm/trunk/engines/sci/engine/state.h
    scummvm/trunk/engines/sci/engine/static_selectors.cpp
    scummvm/trunk/engines/sci/engine/vm.h

Modified: scummvm/trunk/engines/sci/engine/script.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/script.cpp	2009-11-20 13:29:42 UTC (rev 46005)
+++ scummvm/trunk/engines/sci/engine/script.cpp	2009-11-20 14:17:47 UTC (rev 46006)
@@ -233,7 +233,6 @@
 	FIND_SELECTOR(subtitleLang);
 	FIND_SELECTOR(parseLang);
 	FIND_SELECTOR(overlay);
-	FIND_SELECTOR(newRoom);
 	FIND_SELECTOR(setCursor);
 	FIND_SELECTOR(topString);
 	FIND_SELECTOR(scaleX);

Modified: scummvm/trunk/engines/sci/engine/state.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/state.cpp	2009-11-20 13:29:42 UTC (rev 46005)
+++ scummvm/trunk/engines/sci/engine/state.cpp	2009-11-20 14:17:47 UTC (rev 46006)
@@ -233,7 +233,7 @@
 	return retval;
 }
 
-bool EngineState::autoDetectFeature(FeatureDetection featureDetection) {
+bool EngineState::autoDetectFeature(FeatureDetection featureDetection, int methodNum) {
 	Common::String objName;
 	Selector slc;
 
@@ -257,12 +257,7 @@
 		break;
 	case kDetectLofsType:
 		objName = "Game";
-		slc = _kernel->_selectorCache.play;
 		break;
-	case kDetectLofsTypeFallback:
-		objName = "Game";
-		slc = _kernel->_selectorCache.newRoom;
-		break;
 	default:
 		break;
 	}
@@ -274,9 +269,13 @@
 		return false;
 	}
 
-	if (lookup_selector(_segMan, objAddr, slc, NULL, &addr) != kSelectorMethod) {
-		warning("autoDetectFeature: target selector is not a method of object %s", objName.c_str());
-		return false;
+	if (featureDetection != kDetectLofsType) {
+		if (lookup_selector(_segMan, objAddr, slc, NULL, &addr) != kSelectorMethod) {
+			warning("autoDetectFeature: target selector is not a method of object %s", objName.c_str());
+			return false;
+		}
+	} else {
+		addr = _segMan->getObject(objAddr)->getFunction(methodNum);
 	}
 
 	uint16 offset = addr.offset;
@@ -289,7 +288,7 @@
 		int i = 0;
 		byte argc;
 
-		if (featureDetection == kDetectLofsType || featureDetection == kDetectLofsTypeFallback) {
+		if (featureDetection == kDetectLofsType) {
 			if (opcode == op_lofsa || opcode == op_lofss) {
 				uint16 lofs;
 
@@ -315,7 +314,8 @@
 				if ((signed)offset + (int16)lofs >= (signed)script->_bufSize)
 					_lofsType = SCI_VERSION_1_MIDDLE;
 
-				return true;
+				if (_lofsType != SCI_VERSION_AUTODETECT)
+					return true;
 			}
 		}
 
@@ -483,9 +483,19 @@
 			return _lofsType;
 		}
 
-		// Either the init or the newRoom selectors of the Game
-		// object make calls to lofsa/lofss
-		if (!autoDetectFeature(kDetectLofsType) && !autoDetectFeature(kDetectLofsTypeFallback)) {
+		// Find a function of the game object which invokes lofsa/lofss
+		reg_t gameClass = _segMan->findObjectByName("Game");
+		Object *obj = _segMan->getObject(gameClass);
+		bool found = false;
+
+		for (uint m = 0; m < obj->getMethodCount(); m++) {
+			found = autoDetectFeature(kDetectLofsType, m);
+
+			if (found)
+				break;
+		}
+
+		if (!found) {
 			warning("Lofs detection failed, taking an educated guess");
 
 			if (getSciVersion() >= SCI_VERSION_1_MIDDLE)

Modified: scummvm/trunk/engines/sci/engine/state.h
===================================================================
--- scummvm/trunk/engines/sci/engine/state.h	2009-11-20 13:29:42 UTC (rev 46005)
+++ scummvm/trunk/engines/sci/engine/state.h	2009-11-20 14:17:47 UTC (rev 46006)
@@ -107,8 +107,7 @@
 	kDetectMoveCountType = 1,
 	kDetectSoundType = 2,
 	kDetectSetCursorType = 3,
-	kDetectLofsType = 4,
-	kDetectLofsTypeFallback = 5
+	kDetectLofsType = 4
 };
 
 class FileHandle {
@@ -294,7 +293,7 @@
 	Common::String getLanguageString(const char *str, kLanguage lang) const;
 
 private:
-	bool autoDetectFeature(FeatureDetection featureDetection);
+	bool autoDetectFeature(FeatureDetection featureDetection, int methodNum = -1);
 
 	SciVersion _doSoundType, _setCursorType, _lofsType, _gfxFunctionsType;
 	MoveCountType _moveCountType;

Modified: scummvm/trunk/engines/sci/engine/static_selectors.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/static_selectors.cpp	2009-11-20 13:29:42 UTC (rev 46005)
+++ scummvm/trunk/engines/sci/engine/static_selectors.cpp	2009-11-20 14:17:47 UTC (rev 46006)
@@ -63,17 +63,16 @@
 
 // Taken from Codename: Iceman (Full Game)
 static const SelectorRemap sci0SelectorRemap[] = {
-    {          "cue", 121 }, {     "moveDone", 170 }, {    "setCursor", 254 },
-	{      "overlay", 270 }, {      "points",  316 }, {        "flags", 368 },
-	{              0,   0 }
+    {     "moveDone", 170 }, {    "setCursor", 254 }, {      "overlay", 270 },
+	{      "points",  316 }, {        "flags", 368 }, {              0,   0 }
 };
 
 // Taken from Leisure Suit Larry 1 VGA (Full Game)
 static const SelectorRemap sci1SelectorRemap[] = {
 	{      "nodePtr",  44 }, {   "cantBeHere",  57 }, {    "topString", 101 },
-	{        "flags", 102 }, {      "dispose", 105 }, {      "newRoom", 173 },
-	{    "setCursor", 183 }, {    "canBeHere", 232 }, {     "syncTime", 247 },
-	{      "syncCue", 248 }, {              0,   0 }
+	{        "flags", 102 }, {      "dispose", 105 }, {    "setCursor", 183 },
+	{    "canBeHere", 232 }, {     "syncTime", 247 }, {      "syncCue", 248 },
+	{              0,   0 }
 };
 
 // Taken from KQ6 floppy (Full Game)

Modified: scummvm/trunk/engines/sci/engine/vm.h
===================================================================
--- scummvm/trunk/engines/sci/engine/vm.h	2009-11-20 13:29:42 UTC (rev 46005)
+++ scummvm/trunk/engines/sci/engine/vm.h	2009-11-20 14:17:47 UTC (rev 46006)
@@ -192,9 +192,8 @@
 	Selector scaleX, scaleY;	// SCI1.1 view scaling
 
 	// Used for auto detection purposes
-	Selector overlay;	/** Used to determine if a game is using old gfx functions or not */
-	Selector newRoom;	/** For SCI1 lofs parameter type autodetection fallback */
-	Selector setCursor; /** For autodetection */
+	Selector overlay;	// Used to determine if a game is using old gfx functions or not
+	Selector setCursor; // For autodetection
 };
 
 // A reference to an object's variable.


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