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

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Sun Aug 1 00:45:39 CEST 2010


Revision: 51557
          http://scummvm.svn.sourceforge.net/scummvm/?rev=51557&view=rev
Author:   m_kiewitz
Date:     2010-07-31 22:45:38 +0000 (Sat, 31 Jul 2010)

Log Message:
-----------
SCI: fix lofs autodetection

makes polish lsl1 work (its game superclass name got translated, so no "Game" object available) - bug #3037194 thx to dam-soft for his patient help

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

Modified: scummvm/trunk/engines/sci/engine/features.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/features.cpp	2010-07-31 22:43:09 UTC (rev 51556)
+++ scummvm/trunk/engines/sci/engine/features.cpp	2010-07-31 22:45:38 UTC (rev 51557)
@@ -216,9 +216,9 @@
 	return _setCursorType;
 }
 
-bool GameFeatures::autoDetectLofsType(int methodNum) {
+bool GameFeatures::autoDetectLofsType(Common::String gameSuperClassName, int methodNum) {
 	// Look up the script address
-	reg_t addr = getDetectionAddr("Game", -1, methodNum);
+	reg_t addr = getDetectionAddr(gameSuperClassName.c_str(), -1, methodNum);
 
 	if (!addr.segment)
 		return false;
@@ -275,20 +275,35 @@
 			return _lofsType;
 		}
 
+		// Find the "Game" object, super class of the actual game-object
+		const reg_t game = g_sci->getGameObject();
+		const Object *gameObject = _segMan->getObject(game);
+		reg_t gameSuperClass = NULL_REG;
+		if (gameObject) {
+			gameSuperClass = gameObject->getSuperClassSelector();
+		}
+
 		// Find a function of the game object which invokes lofsa/lofss
-		reg_t gameClass = _segMan->findObjectByName("Game");
-		const Object *obj = _segMan->getObject(gameClass);
 		bool found = false;
+		if (!gameSuperClass.isNull()) {
+			Common::String gameSuperClassName = _segMan->getObjectName(gameSuperClass);
+			const Object *gameSuperObject = _segMan->getObject(gameSuperClass);
 
-		for (uint m = 0; m < obj->getMethodCount(); m++) {
-			found = autoDetectLofsType(m);
-
-			if (found)
-				break;
+			if (gameSuperObject) {
+				for (uint m = 0; m < gameSuperObject->getMethodCount(); m++) {
+					found = autoDetectLofsType(gameSuperClassName, m);
+					if (found)
+						break;
+				}
+			} else {
+				warning("detectLofsType(): Could not get superclass object");
+			}
+		} else {
+			warning("detectLofsType(): Could not find superclass of game object");
 		}
 
 		if (!found) {
-			warning("Lofs detection failed, taking an educated guess");
+			warning("detectLofsType(): failed, taking an educated guess");
 
 			if (getSciVersion() >= SCI_VERSION_1_MIDDLE)
 				_lofsType = SCI_VERSION_1_MIDDLE;

Modified: scummvm/trunk/engines/sci/engine/features.h
===================================================================
--- scummvm/trunk/engines/sci/engine/features.h	2010-07-31 22:43:09 UTC (rev 51556)
+++ scummvm/trunk/engines/sci/engine/features.h	2010-07-31 22:45:38 UTC (rev 51557)
@@ -103,7 +103,7 @@
 private:
 	reg_t getDetectionAddr(const Common::String &objName, Selector slc, int methodNum = -1);
 
-	bool autoDetectLofsType(int methodNum);
+	bool autoDetectLofsType(Common::String gameSuperClassName, int methodNum);
 	bool autoDetectGfxFunctionsType(int methodNum = -1);
 	bool autoDetectSoundType();
 	bool autoDetectMoveCountType();


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