aboutsummaryrefslogtreecommitdiff
path: root/common/advancedDetector.cpp
diff options
context:
space:
mode:
authorEugene Sandulenko2007-12-31 14:45:38 +0000
committerEugene Sandulenko2007-12-31 14:45:38 +0000
commit65ffe2bcee21345da18222db53f1d7f5da8e9ae5 (patch)
tree5f25534f5344e767683184359e42bceeea86a299 /common/advancedDetector.cpp
parent10686b04ab1dfa86ca5cb8ed35d52fe18476cf0b (diff)
downloadscummvm-rg350-65ffe2bcee21345da18222db53f1d7f5da8e9ae5.tar.gz
scummvm-rg350-65ffe2bcee21345da18222db53f1d7f5da8e9ae5.tar.bz2
scummvm-rg350-65ffe2bcee21345da18222db53f1d7f5da8e9ae5.zip
Add to AdvancedDetector possibility to use field 'extra' in ADGameDescription
to be used as a hint. svn-id: r30105
Diffstat (limited to 'common/advancedDetector.cpp')
-rw-r--r--common/advancedDetector.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/common/advancedDetector.cpp b/common/advancedDetector.cpp
index 3b235835f3..6e72b35e44 100644
--- a/common/advancedDetector.cpp
+++ b/common/advancedDetector.cpp
@@ -48,7 +48,7 @@ namespace AdvancedDetector {
* @param platform restrict results to specified platform only
* @return list of ADGameDescription (or subclass) pointers corresponding to matched games
*/
-static ADGameDescList detectGame(const FSList *fslist, const Common::ADParams &params, Language language, Platform platform);
+static ADGameDescList detectGame(const FSList *fslist, const Common::ADParams &params, Language language, Platform platform, const Common::String extra);
GameList gameIDList(const Common::ADParams &params) {
@@ -194,13 +194,16 @@ static void updateGameDescriptor(GameDescriptor &desc, const ADGameDescription *
desc["preferredtarget"] = generatePreferredTarget(desc["preferredtarget"], realDesc);
}
+
+ if (params.flags & kADFlagUseExtraAsHint)
+ desc["extra"] = realDesc->extra;
}
GameList detectAllGames(
const FSList &fslist,
const Common::ADParams &params
) {
- ADGameDescList matches = detectGame(&fslist, params, Common::UNK_LANG, Common::kPlatformUnknown);
+ ADGameDescList matches = detectGame(&fslist, params, Common::UNK_LANG, Common::kPlatformUnknown, "");
GameList detectedGames;
// Use fallback detector if there were no matches by other means
@@ -227,15 +230,19 @@ EncapsulatedADGameDesc detectBestMatchingGame(
EncapsulatedADGameDesc result;
Common::Language language = Common::UNK_LANG;
Common::Platform platform = Common::kPlatformUnknown;
+ Common::String extra("");
if (ConfMan.hasKey("language"))
language = Common::parseLanguage(ConfMan.get("language"));
if (ConfMan.hasKey("platform"))
platform = Common::parsePlatform(ConfMan.get("platform"));
+ if (params.flags & kADFlagUseExtraAsHint)
+ if (ConfMan.hasKey("extra"))
+ extra = ConfMan.get("extra");
Common::String gameid = ConfMan.get("gameid");
- ADGameDescList matches = detectGame(0, params, language, platform);
+ ADGameDescList matches = detectGame(0, params, language, platform, extra);
if (params.singleid == NULL) {
for (uint i = 0; i < matches.size(); i++) {
@@ -303,7 +310,7 @@ void reportUnknown(StringList &files, int md5Bytes) {
reportUnknown(filesMD5, filesSize);
}
-static ADGameDescList detectGame(const FSList *fslist, const Common::ADParams &params, Language language, Platform platform) {
+static ADGameDescList detectGame(const FSList *fslist, const Common::ADParams &params, Language language, Platform platform, const Common::String extra) {
typedef HashMap<String, bool, CaseSensitiveString_Hash, CaseSensitiveString_EqualTo> StringSet;
StringSet filesList;
@@ -404,6 +411,9 @@ static ADGameDescList detectGame(const FSList *fslist, const Common::ADParams &p
continue;
}
+ if ((params.flags & kADFlagUseExtraAsHint) && extra != "" && g->extra != extra)
+ continue;
+
// Try to match all files for this game
for (fileDesc = g->filesDescriptions; fileDesc->fileName; fileDesc++) {
tstr = fileDesc->fileName;