diff options
author | Max Horn | 2003-10-17 23:16:53 +0000 |
---|---|---|
committer | Max Horn | 2003-10-17 23:16:53 +0000 |
commit | 0694eed27393ee7d1cbeccd20e8641fa261f5642 (patch) | |
tree | f050bac8eda4b451100bffbc6aebf416070d7f7d /sky/sky.cpp | |
parent | 6eb03982170a625063c1e8be57e581a7f10d4cc9 (diff) | |
download | scummvm-rg350-0694eed27393ee7d1cbeccd20e8641fa261f5642.tar.gz scummvm-rg350-0694eed27393ee7d1cbeccd20e8641fa261f5642.tar.bz2 scummvm-rg350-0694eed27393ee7d1cbeccd20e8641fa261f5642.zip |
moved game detection code out to the plugins
svn-id: r10882
Diffstat (limited to 'sky/sky.cpp')
-rw-r--r-- | sky/sky.cpp | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/sky/sky.cpp b/sky/sky.cpp index 2ba3848461..ddec59eaa0 100644 --- a/sky/sky.cpp +++ b/sky/sky.cpp @@ -21,6 +21,8 @@ #include "stdafx.h" +#include "backends/fs/fs.h" + #include "base/gameDetector.h" #include "base/plugins.h" @@ -82,15 +84,36 @@ static const GameSettings sky_settings[] = { {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]; |