GameList AdvancedMetaEngine::detectGames(const Common::FSList &fslist) const { ADGameDescList matches = detectGame(fslist, params, Common::UNK_LANG, Common::kPlatformUnknown, ""); GameList detectedGames; if (cleanupPirated(matches)) return detectedGames; if (matches.empty()) { // Use fallback detector if there were no matches by other means const ADGameDescription *fallbackDesc = fallbackDetect(fslist); if (fallbackDesc != 0) { GameDescriptor desc(toGameDescriptor(*fallbackDesc, params.list)); updateGameDescriptor(desc, fallbackDesc, params); detectedGames.push_back(desc); } } else { // Otherwise use the found matches for (uint i = 0; i < matches.size(); i++) { GameDescriptor desc(toGameDescriptor(*matches[i], params.list)); updateGameDescriptor(desc, matches[i], params); detectedGames.push_back(desc); } } return detectedGames; }
GameList AdvancedMetaEngine::detectGames(const Common::FSList &fslist) const { ADGameDescList matches; GameList detectedGames; FileMap allFiles; if (fslist.empty()) return detectedGames; // Compose a hashmap of all files in fslist. composeFileHashMap(allFiles, fslist, (_maxScanDepth == 0 ? 1 : _maxScanDepth)); // Run the detector on this matches = detectGame(fslist.begin()->getParent(), allFiles, Common::UNK_LANG, Common::kPlatformUnknown, ""); if (matches.empty()) { // Use fallback detector if there were no matches by other means const ADGameDescription *fallbackDesc = fallbackDetect(allFiles, fslist); if (fallbackDesc != 0) { GameDescriptor desc(toGameDescriptor(*fallbackDesc, _gameIds)); updateGameDescriptor(desc, fallbackDesc); detectedGames.push_back(desc); } } else { // Otherwise use the found matches cleanupPirated(matches); for (uint i = 0; i < matches.size(); i++) { GameDescriptor desc(toGameDescriptor(*matches[i], _gameIds)); updateGameDescriptor(desc, matches[i]); detectedGames.push_back(desc); } } return detectedGames; }