[Scummvm-cvs-logs] CVS: scummvm/simon simon.cpp,1.313,1.314
Max Horn
fingolfin at users.sourceforge.net
Fri Oct 17 16:23:01 CEST 2003
Update of /cvsroot/scummvm/scummvm/simon
In directory sc8-pr-cvs1:/tmp/cvs-serv32633/simon
Modified Files:
simon.cpp
Log Message:
moved game detection code out to the plugins
Index: simon.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/simon.cpp,v
retrieving revision 1.313
retrieving revision 1.314
diff -u -d -r1.313 -r1.314
--- simon.cpp 17 Oct 2003 15:35:45 -0000 1.313
+++ simon.cpp 17 Oct 2003 23:16:53 -0000 1.314
@@ -21,6 +21,8 @@
#include "stdafx.h"
+#include "backends/fs/fs.h"
+
#include "base/gameDetector.h"
#include "base/plugins.h"
@@ -62,15 +64,45 @@
{NULL, NULL, 0, 0, MDT_NONE, 0, NULL}
};
-const GameSettings *Engine_SIMON_targetList() {
- return simon_settings;
+GameList Engine_SIMON_gameList() {
+ const GameSettings *g = simon_settings;
+ GameList games;
+ while (g->gameName)
+ games.push_back(*g++);
+ return games;
+}
+
+GameList Engine_SIMON_detectGames(const FSList &fslist) {
+ GameList detectedGames;
+ const GameSettings *g;
+ char detectName[128];
+ char detectName2[128];
+
+ for (g = simon_settings; g->gameName; ++g) {
+ strcpy(detectName, g->detectname);
+ strcpy(detectName2, g->detectname);
+ strcat(detectName2, ".");
+
+ // 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(detectName, gameName)) ||
+ (0 == scumm_stricmp(detectName2, gameName))) {
+ // Match found, add to list of candidates, then abort inner loop.
+ detectedGames.push_back(*g);
+ break;
+ }
+ }
+ }
+ return detectedGames;
}
Engine *Engine_SIMON_create(GameDetector *detector, OSystem *syst) {
return new Simon::SimonEngine(detector, syst);
}
-REGISTER_PLUGIN("Simon the Sorcerer", Engine_SIMON_targetList, Engine_SIMON_create);
+REGISTER_PLUGIN("Simon the Sorcerer", Engine_SIMON_gameList, Engine_SIMON_create, Engine_SIMON_detectGames);
namespace Simon {
More information about the Scummvm-git-logs
mailing list