[Scummvm-cvs-logs] CVS: scummvm/sky sky.cpp,1.122,1.123

Max Horn fingolfin at users.sourceforge.net
Fri Oct 17 16:23:01 CEST 2003


Update of /cvsroot/scummvm/scummvm/sky
In directory sc8-pr-cvs1:/tmp/cvs-serv32633/sky

Modified Files:
	sky.cpp 
Log Message:
moved game detection code out to the plugins

Index: sky.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/sky.cpp,v
retrieving revision 1.122
retrieving revision 1.123
diff -u -d -r1.122 -r1.123
--- sky.cpp	17 Oct 2003 16:39:32 -0000	1.122
+++ sky.cpp	17 Oct 2003 23:16:53 -0000	1.123
@@ -21,6 +21,8 @@
 
 #include "stdafx.h"
 
+#include "backends/fs/fs.h"
+
 #include "base/gameDetector.h"
 #include "base/plugins.h"
 
@@ -82,15 +84,36 @@
 	{NULL, NULL, 0, 0, MDT_NONE, 0, NULL}
 };
 
-const GameSettings *Engine_SKY_targetList() {
-	return sky_settings;
+GameList Engine_SKY_gameList() {
+	const GameSettings *g = sky_settings;
+	GameList games;
+	while (g->gameName)
+		games.push_back(*g++);
+	return games;
+}
+
+GameList Engine_SKY_detectGames(const FSList &fslist) {
+	GameList detectedGames;
+	const GameSettings *g = &sky_settings[0];
+
+	// Iterate over all files in the given directory
+	for (FSList::ConstIterator file = fslist.begin(); file != fslist.end(); ++file) {
+		const char *gameName = file->displayName().c_str();
+
+		if (0 == scumm_stricmp(g->detectname, gameName)) {
+			// Match found, add to list of candidates, then abort inner loop.
+			detectedGames.push_back(*g);
+			break;
+		}
+	}
+	return detectedGames;
 }
 
 Engine *Engine_SKY_create(GameDetector *detector, OSystem *syst) {
 	return new SkyEngine(detector, syst);
 }
 
-REGISTER_PLUGIN("Beneath a Steel Sky", Engine_SKY_targetList, Engine_SKY_create);
+REGISTER_PLUGIN("Beneath a Steel Sky", Engine_SKY_gameList, Engine_SKY_create, Engine_SKY_detectGames);
 
 void **SkyEngine::_itemList[300];
 





More information about the Scummvm-git-logs mailing list