diff options
author | Eugene Sandulenko | 2016-03-07 18:46:08 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2016-03-07 19:00:37 +0100 |
commit | 0463b787e1355f416a5d133dfae443928181ca83 (patch) | |
tree | 214ae5851e290c0a87963e851351a81c197b25f1 /engines | |
parent | a515d69e7f41ec233b3b781438996f4fc7f0a827 (diff) | |
download | scummvm-rg350-0463b787e1355f416a5d133dfae443928181ca83.tar.gz scummvm-rg350-0463b787e1355f416a5d133dfae443928181ca83.tar.bz2 scummvm-rg350-0463b787e1355f416a5d133dfae443928181ca83.zip |
AD: Added new flag for autogenerating game target from extra information
Diffstat (limited to 'engines')
-rw-r--r-- | engines/advancedDetector.cpp | 22 | ||||
-rw-r--r-- | engines/advancedDetector.h | 1 |
2 files changed, 22 insertions, 1 deletions
diff --git a/engines/advancedDetector.cpp b/engines/advancedDetector.cpp index 72629a833e..aa76e6c4b7 100644 --- a/engines/advancedDetector.cpp +++ b/engines/advancedDetector.cpp @@ -89,6 +89,18 @@ static Common::String generatePreferredTarget(const Common::String &id, const AD return res; } +static Common::String sanitizeName(const char *name) { + Common::String res; + + while (*name) { + if (Common::isAlnum(*name)) + res += tolower(*name); + name++; + } + + return res; +} + void AdvancedMetaEngine::updateGameDescriptor(GameDescriptor &desc, const ADGameDescription *realDesc) const { if (_singleid != NULL) { desc["preferredtarget"] = desc["gameid"]; @@ -96,7 +108,15 @@ void AdvancedMetaEngine::updateGameDescriptor(GameDescriptor &desc, const ADGame } if (!desc.contains("preferredtarget")) - desc["preferredtarget"] = desc["gameid"]; + desc["preferredtarget"] = desc["gameid"]; + + if (realDesc->flags & ADGF_AUTOGENTARGET) { + warning("Ahem"); + if (*realDesc->extra) + desc["preferredtarget"] = sanitizeName(realDesc->extra); + } + + warning("here: %s", desc["preferredtarget"].c_str()); desc["preferredtarget"] = generatePreferredTarget(desc["preferredtarget"], realDesc); diff --git a/engines/advancedDetector.h b/engines/advancedDetector.h index ad551698f6..ba1aa02cff 100644 --- a/engines/advancedDetector.h +++ b/engines/advancedDetector.h @@ -81,6 +81,7 @@ typedef Common::HashMap<Common::String, ADFileProperties, Common::IgnoreCase_Has enum ADGameFlags { ADGF_NO_FLAGS = 0, + ADGF_AUTOGENTARGET = (1 << 20), // automatically generate gameid from extra ADGF_UNSTABLE = (1 << 21), // flag to designate not yet officially-supported games that are not fit for public testing ADGF_TESTING = (1 << 22), // flag to designate not yet officially-supported games that are fit for public testing ADGF_PIRATED = (1 << 23), ///< flag to designate well known pirated versions with cracks |