diff options
author | Max Horn | 2003-10-17 16:04:46 +0000 |
---|---|---|
committer | Max Horn | 2003-10-17 16:04:46 +0000 |
commit | ae6e6a4885e7364d9f96251ca55769dcc84fb237 (patch) | |
tree | 9c0845000a7453358b5a5a6a8485e07c16f0acd7 | |
parent | df7cda84d33a01555298e258c3502d1390c2d6ab (diff) | |
download | scummvm-rg350-ae6e6a4885e7364d9f96251ca55769dcc84fb237.tar.gz scummvm-rg350-ae6e6a4885e7364d9f96251ca55769dcc84fb237.tar.bz2 scummvm-rg350-ae6e6a4885e7364d9f96251ca55769dcc84fb237.zip |
added a listTargets() function (not yet used, soon) and some cleanup
svn-id: r10865
-rw-r--r-- | base/gameDetector.cpp | 50 | ||||
-rw-r--r-- | base/gameDetector.h | 1 |
2 files changed, 30 insertions, 21 deletions
diff --git a/base/gameDetector.cpp b/base/gameDetector.cpp index ebc8565368..45edfb1363 100644 --- a/base/gameDetector.cpp +++ b/base/gameDetector.cpp @@ -207,35 +207,45 @@ GameDetector::GameDetector() { _plugin = 0; } -void GameDetector::list_games() { - // FIXME / TODO: config rewrite - // Right now this lists all known built-in targets; and also for each of - // those it tells the user if the target is "configured". - // To me this seems like an ill mix of two different functionalities. - // IMHO we should split this into two seperate commands/options: - // 1) List all built-in gameids (e.g. monkey, atlantis, ...) similiar to - // what this code does, but without the "Config" column. - // 2) List all available (configured) targets, including those with custom - // names, e.g. "monkey-mac", "skycd-demo", ... +/** List all supported games, i.e. all games which any loaded plugin supports. */ +void listGames() { const PluginList &plugins = PluginManager::instance().getPlugins(); - printf("Game Full Title \n" - "---------------- ------------------------------------------------------\n"); + printf("Game ID Full Title \n" + "-------------------- ------------------------------------------------------\n"); PluginList::ConstIterator iter = plugins.begin(); for (iter = plugins.begin(); iter != plugins.end(); ++iter) { GameList list = (*iter)->getSupportedGames(); for (GameList::Iterator v = list.begin(); v != list.end(); ++v) { -#if 1 - printf("%-17s%-56s\n", v->gameName, v->description); -#else - const char *config = (g_config->has_domain(v->gameName)) ? "Yes" : ""; - printf("%-17s%-56s%s\n", v->gameName, v->description, config); -#endif + printf("%-20s %s\n", v->gameName, v->description); } } } +/** List all targets which are configured in the config file. */ +void listTargets() { + using namespace Common; + const ConfigManager::DomainMap &domains = ConfMan.getGameDomains(); + + printf("Target Description \n" + "-------------------- ------------------------------------------------------\n"); + + ConfigManager::DomainMap::ConstIterator iter = domains.begin(); + for (iter = domains.begin(); iter != domains.end(); ++iter) { + String name(iter->_key); + String description(iter->_value.get("description")); + + if (description.isEmpty()) { + GameSettings g = GameDetector::findGame(name); + if (g.description) + description = g.description; + } + + printf("%-20s %s\n", name.c_str(), description.c_str()); + } +} + GameSettings GameDetector::findGame(const String &gameName, const Plugin **plugin) { // Find the GameSettings for this target const PluginList &plugins = PluginManager::instance().getPlugins(); @@ -381,7 +391,7 @@ void GameDetector::parseCommandLine(int argc, char **argv) { #endif case 'z': CHECK_OPTION(); - list_games(); + listGames(); exit(0); case '-': // Long options. Let the fun begin! @@ -393,7 +403,7 @@ void GameDetector::parseCommandLine(int argc, char **argv) { ConfMan.set("platform", platform); break; - } + } if (!strncmp(s, "no-", 3)) { long_option_value = false; diff --git a/base/gameDetector.h b/base/gameDetector.h index cab41fff0a..bb2d9bdae9 100644 --- a/base/gameDetector.h +++ b/base/gameDetector.h @@ -91,7 +91,6 @@ public: protected: bool detectGame(void); - void list_games(); }; #endif |