From 0463b787e1355f416a5d133dfae443928181ca83 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 7 Mar 2016 18:46:08 +0100 Subject: AD: Added new flag for autogenerating game target from extra information --- engines/advancedDetector.cpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'engines/advancedDetector.cpp') 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); -- cgit v1.2.3 From 86592b82a569f30d5f536343adffc4341db249d1 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 7 Mar 2016 20:48:13 +0100 Subject: AD: Remove leftover debug messages --- engines/advancedDetector.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'engines/advancedDetector.cpp') diff --git a/engines/advancedDetector.cpp b/engines/advancedDetector.cpp index aa76e6c4b7..6233203885 100644 --- a/engines/advancedDetector.cpp +++ b/engines/advancedDetector.cpp @@ -111,13 +111,10 @@ void AdvancedMetaEngine::updateGameDescriptor(GameDescriptor &desc, const ADGame 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); if (_flags & kADFlagUseExtraAsHint) -- cgit v1.2.3 From 3ec225f12726171a0b3e69fe305ff5354ea3489c Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 8 Mar 2016 18:23:04 +0100 Subject: ENGINES: Fix formatting. --- engines/advancedDetector.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/advancedDetector.cpp') diff --git a/engines/advancedDetector.cpp b/engines/advancedDetector.cpp index 6233203885..ec48a9b6c2 100644 --- a/engines/advancedDetector.cpp +++ b/engines/advancedDetector.cpp @@ -108,7 +108,7 @@ void AdvancedMetaEngine::updateGameDescriptor(GameDescriptor &desc, const ADGame } if (!desc.contains("preferredtarget")) - desc["preferredtarget"] = desc["gameid"]; + desc["preferredtarget"] = desc["gameid"]; if (realDesc->flags & ADGF_AUTOGENTARGET) { if (*realDesc->extra) -- cgit v1.2.3 From 0b6befdcc5f5f8d6d5deb2831104fb7abc0f7466 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 8 Mar 2016 18:30:58 +0100 Subject: ENGINES: Make variable names of AdvancedMetaEngine conform to our guidelines. _singleid -> _singleId _gameids -> _gameIds _guioptions -> _guiOptions --- engines/advancedDetector.cpp | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'engines/advancedDetector.cpp') diff --git a/engines/advancedDetector.cpp b/engines/advancedDetector.cpp index ec48a9b6c2..0d051e470b 100644 --- a/engines/advancedDetector.cpp +++ b/engines/advancedDetector.cpp @@ -102,9 +102,9 @@ static Common::String sanitizeName(const char *name) { } void AdvancedMetaEngine::updateGameDescriptor(GameDescriptor &desc, const ADGameDescription *realDesc) const { - if (_singleid != NULL) { + if (_singleId != NULL) { desc["preferredtarget"] = desc["gameid"]; - desc["gameid"] = _singleid; + desc["gameid"] = _singleId; } if (!desc.contains("preferredtarget")) @@ -120,7 +120,7 @@ void AdvancedMetaEngine::updateGameDescriptor(GameDescriptor &desc, const ADGame if (_flags & kADFlagUseExtraAsHint) desc["extra"] = realDesc->extra; - desc.setGUIOptions(realDesc->guioptions + _guioptions); + desc.setGUIOptions(realDesc->guioptions + _guiOptions); desc.appendGUIOptions(getGameGUIOptionsDescriptionLanguage(realDesc->language)); if (realDesc->flags & ADGF_ADDENGLISH) @@ -166,7 +166,7 @@ GameList AdvancedMetaEngine::detectGames(const Common::FSList &fslist) const { // 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)); + GameDescriptor desc(toGameDescriptor(*fallbackDesc, _gameIds)); updateGameDescriptor(desc, fallbackDesc); detectedGames.push_back(desc); } @@ -174,7 +174,7 @@ GameList AdvancedMetaEngine::detectGames(const Common::FSList &fslist) const { // Otherwise use the found matches cleanupPirated(matches); for (uint i = 0; i < matches.size(); i++) { - GameDescriptor desc(toGameDescriptor(*matches[i], _gameids)); + GameDescriptor desc(toGameDescriptor(*matches[i], _gameIds)); updateGameDescriptor(desc, matches[i]); detectedGames.push_back(desc); } @@ -269,7 +269,7 @@ Common::Error AdvancedMetaEngine::createInstance(OSystem *syst, Engine **engine) if (cleanupPirated(matches)) return Common::kNoGameDataFoundError; - if (_singleid == NULL) { + if (_singleId == NULL) { // Find the first match with correct gameid. for (uint i = 0; i < matches.size(); i++) { if (matches[i]->gameid == gameid) { @@ -287,7 +287,7 @@ Common::Error AdvancedMetaEngine::createInstance(OSystem *syst, Engine **engine) if (agdDesc != 0) { // Seems we found a fallback match. But first perform a basic // sanity check: the gameid must match. - if (_singleid == NULL && agdDesc->gameid != gameid) + if (_singleId == NULL && agdDesc->gameid != gameid) agdDesc = 0; } } @@ -301,9 +301,9 @@ Common::Error AdvancedMetaEngine::createInstance(OSystem *syst, Engine **engine) if (agdDesc->flags & ADGF_ADDENGLISH) lang += " " + getGameGUIOptionsDescriptionLanguage(Common::EN_ANY); - Common::updateGameGUIOptions(agdDesc->guioptions + _guioptions, lang); + Common::updateGameGUIOptions(agdDesc->guioptions + _guiOptions, lang); - GameDescriptor gameDescriptor = toGameDescriptor(*agdDesc, _gameids); + GameDescriptor gameDescriptor = toGameDescriptor(*agdDesc, _gameIds); bool showTestingWarning = false; @@ -585,27 +585,27 @@ const ADGameDescription *AdvancedMetaEngine::detectGameFilebased(const FileMap & } GameList AdvancedMetaEngine::getSupportedGames() const { - if (_singleid != NULL) { + if (_singleId != NULL) { GameList gl; - const PlainGameDescriptor *g = _gameids; + const PlainGameDescriptor *g = _gameIds; while (g->gameid) { - if (0 == scumm_stricmp(_singleid, 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); + error("Engine %s doesn't have its singleid specified in ids list", _singleId); } - return GameList(_gameids); + return GameList(_gameIds); } -GameDescriptor AdvancedMetaEngine::findGame(const char *gameid) const { +GameDescriptor AdvancedMetaEngine::findGame(const char *gameId) const { // First search the list of supported gameids for a match. - const PlainGameDescriptor *g = findPlainGameDescriptor(gameid, _gameids); + const PlainGameDescriptor *g = findPlainGameDescriptor(gameId, _gameIds); if (g) return GameDescriptor(*g); @@ -613,14 +613,14 @@ GameDescriptor AdvancedMetaEngine::findGame(const char *gameid) const { return GameDescriptor(); } -AdvancedMetaEngine::AdvancedMetaEngine(const void *descs, uint descItemSize, const PlainGameDescriptor *gameids, const ADExtraGuiOptionsMap *extraGuiOptions) - : _gameDescriptors((const byte *)descs), _descItemSize(descItemSize), _gameids(gameids), +AdvancedMetaEngine::AdvancedMetaEngine(const void *descs, uint descItemSize, const PlainGameDescriptor *gameIds, const ADExtraGuiOptionsMap *extraGuiOptions) + : _gameDescriptors((const byte *)descs), _descItemSize(descItemSize), _gameIds(gameIds), _extraGuiOptions(extraGuiOptions) { _md5Bytes = 5000; - _singleid = NULL; + _singleId = NULL; _flags = 0; - _guioptions = GUIO_NONE; + _guiOptions = GUIO_NONE; _maxScanDepth = 1; _directoryGlobs = NULL; } -- cgit v1.2.3 From 3aecd8ef2a79dbbd43dd0e39e42b11409720361f Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 8 Mar 2016 18:53:55 +0100 Subject: ENGINES: Make variable names of ADGameDescription conform to our guidelines. gameid -> gameId guioptions -> guiOptions --- engines/advancedDetector.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'engines/advancedDetector.cpp') diff --git a/engines/advancedDetector.cpp b/engines/advancedDetector.cpp index 0d051e470b..f4c199aa89 100644 --- a/engines/advancedDetector.cpp +++ b/engines/advancedDetector.cpp @@ -42,7 +42,7 @@ static GameDescriptor toGameDescriptor(const ADGameDescription &g, const PlainGa extra = ""; } else { while (sg->gameid) { - if (!scumm_stricmp(g.gameid, sg->gameid)) + if (!scumm_stricmp(g.gameId, sg->gameid)) title = sg->description; sg++; } @@ -56,7 +56,7 @@ static GameDescriptor toGameDescriptor(const ADGameDescription &g, const PlainGa else if (g.flags & ADGF_TESTING) gsl = kTestingGame; - GameDescriptor gd(g.gameid, title, g.language, g.platform, 0, gsl); + GameDescriptor gd(g.gameId, title, g.language, g.platform, 0, gsl); gd.updateDesc(extra); return gd; } @@ -120,7 +120,7 @@ void AdvancedMetaEngine::updateGameDescriptor(GameDescriptor &desc, const ADGame if (_flags & kADFlagUseExtraAsHint) desc["extra"] = realDesc->extra; - desc.setGUIOptions(realDesc->guioptions + _guiOptions); + desc.setGUIOptions(realDesc->guiOptions + _guiOptions); desc.appendGUIOptions(getGameGUIOptionsDescriptionLanguage(realDesc->language)); if (realDesc->flags & ADGF_ADDENGLISH) @@ -272,7 +272,7 @@ Common::Error AdvancedMetaEngine::createInstance(OSystem *syst, Engine **engine) if (_singleId == NULL) { // Find the first match with correct gameid. for (uint i = 0; i < matches.size(); i++) { - if (matches[i]->gameid == gameid) { + if (matches[i]->gameId == gameid) { agdDesc = matches[i]; break; } @@ -287,7 +287,7 @@ Common::Error AdvancedMetaEngine::createInstance(OSystem *syst, Engine **engine) if (agdDesc != 0) { // Seems we found a fallback match. But first perform a basic // sanity check: the gameid must match. - if (_singleId == NULL && agdDesc->gameid != gameid) + if (_singleId == NULL && agdDesc->gameId != gameid) agdDesc = 0; } } @@ -301,7 +301,7 @@ Common::Error AdvancedMetaEngine::createInstance(OSystem *syst, Engine **engine) if (agdDesc->flags & ADGF_ADDENGLISH) lang += " " + getGameGUIOptionsDescriptionLanguage(Common::EN_ANY); - Common::updateGameGUIOptions(agdDesc->guioptions + _guiOptions, lang); + Common::updateGameGUIOptions(agdDesc->guiOptions + _guiOptions, lang); GameDescriptor gameDescriptor = toGameDescriptor(*agdDesc, _gameIds); @@ -424,7 +424,7 @@ ADGameDescList AdvancedMetaEngine::detectGame(const Common::FSNode &parent, cons // Check which files are included in some ADGameDescription *and* are present. // Compute MD5s and file sizes for these files. - for (descPtr = _gameDescriptors; ((const ADGameDescription *)descPtr)->gameid != 0; descPtr += _descItemSize) { + for (descPtr = _gameDescriptors; ((const ADGameDescription *)descPtr)->gameId != 0; descPtr += _descItemSize) { g = (const ADGameDescription *)descPtr; for (fileDesc = g->filesDescriptions; fileDesc->fileName; fileDesc++) { @@ -447,7 +447,7 @@ ADGameDescList AdvancedMetaEngine::detectGame(const Common::FSNode &parent, cons // MD5 based matching uint i; - for (i = 0, descPtr = _gameDescriptors; ((const ADGameDescription *)descPtr)->gameid != 0; descPtr += _descItemSize, ++i) { + for (i = 0, descPtr = _gameDescriptors; ((const ADGameDescription *)descPtr)->gameId != 0; descPtr += _descItemSize, ++i) { g = (const ADGameDescription *)descPtr; bool fileMissing = false; @@ -504,7 +504,7 @@ ADGameDescList AdvancedMetaEngine::detectGame(const Common::FSNode &parent, cons gotAnyMatchesWithAllFiles = true; if (!fileMissing) { - debug(2, "Found game: %s (%s %s/%s) (%d)", g->gameid, g->extra, + debug(2, "Found game: %s (%s %s/%s) (%d)", g->gameId, g->extra, getPlatformDescription(g->platform), getLanguageDescription(g->language), i); if (curFilesMatched > maxFilesMatched) { @@ -520,7 +520,7 @@ ADGameDescList AdvancedMetaEngine::detectGame(const Common::FSNode &parent, cons } } else { - debug(5, "Skipping game: %s (%s %s/%s) (%d)", g->gameid, g->extra, + debug(5, "Skipping game: %s (%s %s/%s) (%d)", g->gameId, g->extra, getPlatformDescription(g->platform), getLanguageDescription(g->language), i); } } @@ -560,7 +560,7 @@ const ADGameDescription *AdvancedMetaEngine::detectGameFilebased(const FileMap & } if (!fileMissing) { - debug(4, "Matched: %s", agdesc->gameid); + debug(4, "Matched: %s", agdesc->gameId); if (numMatchedFiles > maxNumMatchedFiles) { matchedDesc = agdesc; -- cgit v1.2.3 From e515fc18db0cdff1d947ef8686123ef0dc669cff Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 8 Mar 2016 18:59:23 +0100 Subject: ENGINES: Make variable names of PlainGameDescriptor conform to our guidelines. gameid -> gameId --- engines/advancedDetector.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'engines/advancedDetector.cpp') diff --git a/engines/advancedDetector.cpp b/engines/advancedDetector.cpp index f4c199aa89..7a09f662d1 100644 --- a/engines/advancedDetector.cpp +++ b/engines/advancedDetector.cpp @@ -41,8 +41,8 @@ static GameDescriptor toGameDescriptor(const ADGameDescription &g, const PlainGa title = g.extra; extra = ""; } else { - while (sg->gameid) { - if (!scumm_stricmp(g.gameId, sg->gameid)) + while (sg->gameId) { + if (!scumm_stricmp(g.gameId, sg->gameId)) title = sg->description; sg++; } @@ -589,9 +589,9 @@ GameList AdvancedMetaEngine::getSupportedGames() const { GameList gl; const PlainGameDescriptor *g = _gameIds; - while (g->gameid) { - if (0 == scumm_stricmp(_singleId, g->gameid)) { - gl.push_back(GameDescriptor(g->gameid, g->description)); + while (g->gameId) { + if (0 == scumm_stricmp(_singleId, g->gameId)) { + gl.push_back(GameDescriptor(g->gameId, g->description)); return gl; } -- cgit v1.2.3