GameDescriptor findGameID( const char *gameid, const PlainGameDescriptor *list, const ADObsoleteGameID *obsoleteList ) { // First search the list of supported game IDs for a match. const PlainGameDescriptor *g = findPlainGameDescriptor(gameid, list); if (g) return GameDescriptor(*g); // If we didn't find the gameid in the main list, check if it // is an obsolete game id. if (obsoleteList != 0) { const ADObsoleteGameID *o = obsoleteList; while (o->from) { if (0 == scumm_stricmp(gameid, o->from)) { g = findPlainGameDescriptor(o->to, list); if (g && g->description) return GameDescriptor(gameid, "Obsolete game ID (" + Common::String(g->description) + ")"); else return GameDescriptor(gameid, "Obsolete game ID"); } o++; } } // No match found return GameDescriptor(); }
GameDescriptor AdvancedMetaEngine::findGame(const char *gameId) const { // First search the list of supported gameids for a match. const PlainGameDescriptor *g = findPlainGameDescriptor(gameId, _gameIds); if (g) return GameDescriptor(*g); // No match found return GameDescriptor(); }
GameDescriptor Sword2MetaEngine::findGame(const char *gameid) const { const Sword2::GameSettings *g = Sword2::sword2_settings; while (g->gameid) { if (0 == scumm_stricmp(gameid, g->gameid)) break; g++; } return GameDescriptor(g->gameid, g->description); }
GameList Sword2MetaEngine::getSupportedGames() const { const Sword2::GameSettings *g = Sword2::sword2_settings; GameList games; while (g->gameid) { games.push_back(GameDescriptor(g->gameid, g->description)); g++; } return games; }
GameList Sword2MetaEngine::detectGames(const Common::FSList &fslist) const { GameList detectedGames; const Sword2::GameSettings *g; Common::FSList::const_iterator file; // TODO: It would be nice if we had code here which distinguishes // between the 'sword2' and 'sword2demo' targets. The current code // can't do that since they use the same detectname. for (g = Sword2::sword2_settings; g->gameid; ++g) { // Iterate over all files in the given directory for (file = fslist.begin(); file != fslist.end(); ++file) { if (!file->isDirectory()) { const char *fileName = file->getName().c_str(); if (0 == scumm_stricmp(g->detectname, fileName)) { // Match found, add to list of candidates, then abort inner loop. detectedGames.push_back(GameDescriptor(g->gameid, g->description, Common::UNK_LANG, Common::kPlatformUnknown, Common::GUIO_NOMIDI)); break; } } } } if (detectedGames.empty()) { // Nothing found -- try to recurse into the 'clusters' subdirectory, // present e.g. if the user copied the data straight from CD. for (file = fslist.begin(); file != fslist.end(); ++file) { if (file->isDirectory()) { const char *fileName = file->getName().c_str(); if (0 == scumm_stricmp("clusters", fileName)) { Common::FSList recList; if (file->getChildren(recList, Common::FSNode::kListAll)) { GameList recGames(detectGames(recList)); if (!recGames.empty()) { detectedGames.push_back(recGames); break; } } } } } } return detectedGames; }
GameDescriptor SwordMetaEngine::findGame(const char *gameid) const { if (0 == scumm_stricmp(gameid, sword1FullSettings.gameid)) return sword1FullSettings; if (0 == scumm_stricmp(gameid, sword1DemoSettings.gameid)) return sword1DemoSettings; if (0 == scumm_stricmp(gameid, sword1MacFullSettings.gameid)) return sword1MacFullSettings; if (0 == scumm_stricmp(gameid, sword1MacDemoSettings.gameid)) return sword1MacDemoSettings; if (0 == scumm_stricmp(gameid, sword1PSXSettings.gameid)) return sword1PSXSettings; if (0 == scumm_stricmp(gameid, sword1PSXDemoSettings.gameid)) return sword1PSXDemoSettings; return GameDescriptor(); }
GameList SwordMetaEngine::getSupportedGames() const { GameList games; games.push_back(GameDescriptor(getEngineID(), sword1FullSettings, GUIO_NOMIDI)); games.push_back(GameDescriptor(getEngineID(), sword1DemoSettings, GUIO_NOMIDI)); games.push_back(GameDescriptor(getEngineID(), sword1MacFullSettings, GUIO_NOMIDI)); games.push_back(GameDescriptor(getEngineID(), sword1MacDemoSettings, GUIO_NOMIDI)); games.push_back(GameDescriptor(getEngineID(), sword1PSXSettings, GUIO_NOMIDI)); games.push_back(GameDescriptor(getEngineID(), sword1PSXDemoSettings, GUIO_NOMIDI)); return games; }
GameList SwordMetaEngine::detectGames(const Common::FSList &fslist) const { int i, j; GameList detectedGames; bool filesFound[NUM_FILES_TO_CHECK]; for (i = 0; i < NUM_FILES_TO_CHECK; i++) filesFound[i] = false; Sword1CheckDirectory(fslist, filesFound); bool mainFilesFound = true; bool pcFilesFound = true; bool macFilesFound = true; bool demoFilesFound = true; bool macDemoFilesFound = true; bool psxFilesFound = true; bool psxDemoFilesFound = true; for (i = 0; i < NUM_COMMON_FILES_TO_CHECK; i++) if (!filesFound[i]) mainFilesFound = false; for (j = 0; j < NUM_PC_FILES_TO_CHECK; i++, j++) if (!filesFound[i]) pcFilesFound = false; for (j = 0; j < NUM_MAC_FILES_TO_CHECK; i++, j++) if (!filesFound[i]) macFilesFound = false; for (j = 0; j < NUM_DEMO_FILES_TO_CHECK; i++, j++) if (!filesFound[i]) demoFilesFound = false; for (j = 0; j < NUM_DEMO_FILES_TO_CHECK; i++, j++) if (!filesFound[i]) macDemoFilesFound = false; for (j = 0; j < NUM_PSX_FILES_TO_CHECK; i++, j++) if (!filesFound[i]) psxFilesFound = false; for (j = 0; j < NUM_PSX_DEMO_FILES_TO_CHECK; i++, j++) if (!filesFound[i] || psxFilesFound) psxDemoFilesFound = false; if (mainFilesFound && pcFilesFound && demoFilesFound) detectedGames.push_back(GameDescriptor(getEngineID(), sword1DemoSettings, GUIO2(GUIO_NOMIDI, GUIO_NOASPECT))); else if (mainFilesFound && pcFilesFound && psxFilesFound) detectedGames.push_back(GameDescriptor(getEngineID(), sword1PSXSettings, GUIO2(GUIO_NOMIDI, GUIO_NOASPECT))); else if (mainFilesFound && pcFilesFound && psxDemoFilesFound) detectedGames.push_back(GameDescriptor(getEngineID(), sword1PSXDemoSettings, GUIO2(GUIO_NOMIDI, GUIO_NOASPECT))); else if (mainFilesFound && pcFilesFound && !psxFilesFound) detectedGames.push_back(GameDescriptor(getEngineID(), sword1FullSettings, GUIO2(GUIO_NOMIDI, GUIO_NOASPECT))); else if (mainFilesFound && macFilesFound) detectedGames.push_back(GameDescriptor(getEngineID(), sword1MacFullSettings, GUIO2(GUIO_NOMIDI, GUIO_NOASPECT))); else if (mainFilesFound && macDemoFilesFound) detectedGames.push_back(GameDescriptor(getEngineID(), sword1MacDemoSettings, GUIO2(GUIO_NOMIDI, GUIO_NOASPECT))); return detectedGames; }
/** * Returns list of targets supported by the engine. * Distinguishes engines with single ID */ static GameList gameIDList(const ADParams ¶ms) { if (params.singleid != NULL) { GameList gl; const PlainGameDescriptor *g = params.list; while (g->gameid) { if (0 == scumm_stricmp(params.singleid, g->gameid)) { gl.push_back(GameDescriptor(g->gameid, g->description)); return gl; } g++; } error("Engine %s doesn't have its singleid specified in ids list", params.singleid); } return GameList(params.list); }
GameList AdvancedMetaEngine::getSupportedGames() const { if (_singleId != NULL) { GameList gl; const PlainGameDescriptor *g = _gameIds; while (g->gameId) { if (0 == scumm_stricmp(_singleId, g->gameId)) { gl.push_back(GameDescriptor(g->gameId, g->description)); return gl; } g++; } error("Engine %s doesn't have its singleid specified in ids list", _singleId); } return GameList(_gameIds); }
GameDescriptor SkyMetaEngine::findGame(const char *gameid) const { if (0 == scumm_stricmp(gameid, skySetting.gameid)) return GameDescriptor("sky", skySetting); return GameDescriptor(); }
GameList SkyMetaEngine::getSupportedGames() const { GameList games; games.push_back(GameDescriptor("sky", skySetting)); return games; }
GameList detectGamesImpl(const Common::FSList &fslist, bool recursion = false) { GameList detectedGames; const Sword2::GameSettings *g; Common::FSList::const_iterator file; bool isFullVersion = isFullGame(fslist); for (g = Sword2::sword2_settings; g->gameid; ++g) { // Iterate over all files in the given directory for (file = fslist.begin(); file != fslist.end(); ++file) { if (!file->isDirectory()) { // The required game data files can be located in the game directory, or in // a subdirectory called "clusters". In the latter case, we don't want to // detect the game in that subdirectory, as this will detect the game twice // when mass add is searching inside a directory. In this case, the first // result (the game directory) will be correct, but the second result (the // clusters subdirectory) will be wrong, as the optional speech, music and // video data files will be ignored. Note that this fix will skip the game // data files if the user has placed them inside a "clusters" subdirectory, // or if he/she points ScummVM directly to the "clusters" directory of the // game CD. Fixes bug #3049336. Common::String directory = file->getParent().getName(); directory.toLowercase(); if (directory.hasPrefix("clusters") && directory.size() <= 9 && !recursion) continue; if (file->getName().equalsIgnoreCase(g->detectname)) { // Make sure that the sword2 demo is not mixed up with the // full version, since they use the same filename for detection if ((g->features == Sword2::GF_DEMO && isFullVersion) || (g->features == 0 && !isFullVersion)) continue; // Match found, add to list of candidates, then abort inner loop. detectedGames.push_back(GameDescriptor(g->gameid, g->description, Common::UNK_LANG, Common::kPlatformUnknown, GUIO2(GUIO_NOMIDI, GUIO_NOASPECT))); break; } } } } if (detectedGames.empty()) { // Nothing found -- try to recurse into the 'clusters' subdirectory, // present e.g. if the user copied the data straight from CD. for (file = fslist.begin(); file != fslist.end(); ++file) { if (file->isDirectory()) { if (file->getName().equalsIgnoreCase("clusters")) { Common::FSList recList; if (file->getChildren(recList, Common::FSNode::kListAll)) { GameList recGames(detectGamesImpl(recList, true)); if (!recGames.empty()) { detectedGames.push_back(recGames); break; } } } } } } return detectedGames; }
GameDescriptor QueenMetaEngine::findGame(const char *gameid) const { if (0 == scumm_stricmp(gameid, queenGameDescriptor.gameid)) { return queenGameDescriptor; } return GameDescriptor(); }