[Scummvm-cvs-logs] SF.net SVN: scummvm: [30105] scummvm/trunk/common
sev at users.sourceforge.net
sev at users.sourceforge.net
Mon Dec 31 15:45:39 CET 2007
Revision: 30105
http://scummvm.svn.sourceforge.net/scummvm/?rev=30105&view=rev
Author: sev
Date: 2007-12-31 06:45:38 -0800 (Mon, 31 Dec 2007)
Log Message:
-----------
Add to AdvancedDetector possibility to use field 'extra' in ADGameDescription
to be used as a hint.
Modified Paths:
--------------
scummvm/trunk/common/advancedDetector.cpp
scummvm/trunk/common/advancedDetector.h
Modified: scummvm/trunk/common/advancedDetector.cpp
===================================================================
--- scummvm/trunk/common/advancedDetector.cpp 2007-12-31 13:37:14 UTC (rev 30104)
+++ scummvm/trunk/common/advancedDetector.cpp 2007-12-31 14:45:38 UTC (rev 30105)
@@ -48,7 +48,7 @@
* @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 ¶ms, Language language, Platform platform);
+static ADGameDescList detectGame(const FSList *fslist, const Common::ADParams ¶ms, Language language, Platform platform, const Common::String extra);
GameList gameIDList(const Common::ADParams ¶ms) {
@@ -194,13 +194,16 @@
desc["preferredtarget"] = generatePreferredTarget(desc["preferredtarget"], realDesc);
}
+
+ if (params.flags & kADFlagUseExtraAsHint)
+ desc["extra"] = realDesc->extra;
}
GameList detectAllGames(
const FSList &fslist,
const Common::ADParams ¶ms
) {
- 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 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 @@
reportUnknown(filesMD5, filesSize);
}
-static ADGameDescList detectGame(const FSList *fslist, const Common::ADParams ¶ms, Language language, Platform platform) {
+static ADGameDescList detectGame(const FSList *fslist, const Common::ADParams ¶ms, Language language, Platform platform, const Common::String extra) {
typedef HashMap<String, bool, CaseSensitiveString_Hash, CaseSensitiveString_EqualTo> StringSet;
StringSet filesList;
@@ -404,6 +411,9 @@
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;
Modified: scummvm/trunk/common/advancedDetector.h
===================================================================
--- scummvm/trunk/common/advancedDetector.h 2007-12-31 13:37:14 UTC (rev 30104)
+++ scummvm/trunk/common/advancedDetector.h 2007-12-31 14:45:38 UTC (rev 30105)
@@ -126,7 +126,8 @@
* not equal to english) and platform (if not equal to PC).
*/
kADFlagAugmentPreferredTarget = (1 << 0),
- kADFlagPrintWarningOnFileBasedFallback = (1 << 1)
+ kADFlagPrintWarningOnFileBasedFallback = (1 << 1),
+ kADFlagUseExtraAsHint = (1 << 2)
};
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list