diff options
author | Max Horn | 2006-04-23 11:38:48 +0000 |
---|---|---|
committer | Max Horn | 2006-04-23 11:38:48 +0000 |
commit | eb895185a6832e8849c89d964fccf2ecfc50a481 (patch) | |
tree | 39b3f587207361a2b630fef6bb9d534722f572f1 /base | |
parent | cbb5f5fc75deba04bfd2a3ca67eef3b6594044c5 (diff) | |
download | scummvm-rg350-eb895185a6832e8849c89d964fccf2ecfc50a481.tar.gz scummvm-rg350-eb895185a6832e8849c89d964fccf2ecfc50a481.tar.bz2 scummvm-rg350-eb895185a6832e8849c89d964fccf2ecfc50a481.zip |
Test code for the detection code in all engines (disabled by default)
svn-id: r22095
Diffstat (limited to 'base')
-rw-r--r-- | base/main.cpp | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/base/main.cpp b/base/main.cpp index f5b2ef49bf..68932ec6ac 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -50,6 +50,13 @@ #include "gui/launcher.h" #endif + +//#define DETECTOR_TESTING_HACK + +#ifdef DETECTOR_TESTING_HACK +#include "backends/fs/fs.h" +#endif + #ifdef PALMOS_68K #include "args.h" #endif @@ -284,6 +291,55 @@ extern "C" int scummvm_main(int argc, char *argv[]) { listGames(); return 0; } + + +#ifdef DETECTOR_TESTING_HACK + // HACK: The following code can be used to test the detection code of our + // engines. Basically, it loops over all targets, and calls the detector + // for the given path. It then prints out the result and also checks + // whether the result agrees with the settings of the target. + + const Common::ConfigManager::DomainMap &domains = ConfMan.getGameDomains(); + Common::ConfigManager::DomainMap::const_iterator iter = domains.begin(); + for (iter = domains.begin(); iter != domains.end(); ++iter) { + Common::String name(iter->_key); + Common::String gameid(iter->_value.get("gameid")); + Common::String path(iter->_value.get("path")); + printf("Looking at target '%s', gameid '%s', path '%s' ...\n", + name.c_str(), gameid.c_str(), path.c_str()); + if (path.empty()) { + printf(" ... no path specified, skipping\n"); + continue; + } + if (gameid.empty()) { + gameid = name; + } + + FilesystemNode dir(path); + FSList files = dir.listDir(FilesystemNode::kListAll); + DetectedGameList candidates(PluginManager::instance().detectGames(files)); + + if (candidates.empty()) { + printf(" FAILURE: No games detected\n"); + } else if (candidates.size() > 1) { + printf(" FAILURE: Multiple games detected\n"); + } else if (scumm_stricmp(gameid.c_str(), candidates.begin()->gameid.c_str())) { + printf(" FAILURE: Wrong gameid detected\n"); + } else { + printf(" SUCCESS: Game was detected correctl\n"); + } + + for (DetectedGameList::iterator x = candidates.begin(); x != candidates.end(); ++x) { + printf(" gameid '%s', language '%s', platform '%s'\n", + x->gameid.c_str(), + Common::getLanguageCode(x->language), + Common::getPlatformCode(x->platform)); + } + } + + return 0; + +#endif // Process the remaining command line settings |