[Scummvm-cvs-logs] SF.net SVN: scummvm: [28584] scummvm/trunk/engines/kyra/detection.cpp

sev at users.sourceforge.net sev at users.sourceforge.net
Mon Aug 13 11:00:52 CEST 2007


Revision: 28584
          http://scummvm.svn.sourceforge.net/scummvm/?rev=28584&view=rev
Author:   sev
Date:     2007-08-13 02:00:52 -0700 (Mon, 13 Aug 2007)

Log Message:
-----------
(At last) switched Kyra detection to AdvancedDetector

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/detection.cpp

Modified: scummvm/trunk/engines/kyra/detection.cpp
===================================================================
--- scummvm/trunk/engines/kyra/detection.cpp	2007-08-13 08:59:38 UTC (rev 28583)
+++ scummvm/trunk/engines/kyra/detection.cpp	2007-08-13 09:00:52 UTC (rev 28584)
@@ -119,30 +119,10 @@
 
 } // End of anonymous namespace
 
-GameList Engine_KYRA_gameIDList() {
-	return GameList(gameList);
-}
-
-GameDescriptor Engine_KYRA_findGameID(const char *gameid) {
-	return Common::AdvancedDetector::findGameID(gameid, gameList);
-}
-
-GameList Engine_KYRA_detectGames(const FSList &fslist) {
-	return Common::AdvancedDetector::detectAllGames(fslist, detectionParams);
-}
-
-PluginError Engine_KYRA_create(OSystem *syst, Engine **engine) {
-	assert(engine);
-	const char *gameid = ConfMan.get("gameid").c_str();
-	
-	Common::EncapsulatedADGameDesc encapsulatedDesc = Common::AdvancedDetector::detectBestMatchingGame(detectionParams);
+bool engineCreate(OSystem *syst, Engine **engine, Common::EncapsulatedADGameDesc encapsulatedDesc) {
 	const KYRAGameDescription *gd = (const KYRAGameDescription *)(encapsulatedDesc.realDesc);
+	bool res = true;
 
-	if (gd == 0) {
-		// maybe add non md5 based detection again?
-		return kNoGameDataFoundError;
-	}
-
 	Kyra::GameFlags flags = gd->flags;
 	
 	flags.lang = gd->desc.language;
@@ -160,17 +140,25 @@
 			flags.lang = Common::EN_ANY;
 	}
 
-	if (!scumm_stricmp("kyra1", gameid)) {
+	switch (flags.gameID) {
+	case Kyra::GI_KYRA1:
 		*engine = new Kyra::KyraEngine_v1(syst, flags);
-	} else if (!scumm_stricmp("kyra2", gameid)) {
+		break;
+	case Kyra::GI_KYRA2:
 		*engine = new Kyra::KyraEngine_v2(syst, flags);
-	} else if (!scumm_stricmp("kyra3", gameid)) {
+		break;
+	case Kyra::GI_KYRA3:
 		*engine = new Kyra::KyraEngine_v3(syst, flags);
-	} else
-		error("Kyra engine created with invalid gameid ('%s')", gameid);
+		break;
+	default:
+		res = false;
+		error("Kyra engine: unknown gameID");
+	}
 
-	return kNoError;
+	return res;
 }
 
+ADVANCED_DETECTOR_DEFINE_PLUGIN_WITH_COMPLEX_CREATION(KYRA, engineCreate, detectionParams);
+
 REGISTER_PLUGIN(KYRA, "Legend of Kyrandia Engine", "The Legend of Kyrandia (C) Westwood Studios");
 


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