From f72d75e9cdc3b83614641d34d97b97b74042174b Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Wed, 1 Jan 2025 03:30:05 +0300 Subject: [PATCH] Remove customizeGuiOptionsLanguages for now --- engines/metaengine.cpp | 4 -- engines/metaengine.h | 13 ----- engines/tetraedge/detection.cpp | 100 ++++++++------------------------ engines/tetraedge/detection.h | 2 - gui/options.h | 1 - 5 files changed, 25 insertions(+), 95 deletions(-) diff --git a/engines/metaengine.cpp b/engines/metaengine.cpp index 934844d83adb..e1edb41d911b 100644 --- a/engines/metaengine.cpp +++ b/engines/metaengine.cpp @@ -36,10 +36,6 @@ #include "graphics/managed_surface.h" #include "graphics/thumbnail.h" -Common::String MetaEngineDetection::customizeGuiOptionsLanguages(const Common::String &optionsString, const Common::String &domain) const { - return optionsString; -} - const char MetaEngineDetection::GAME_NOT_IMPLEMENTED[] = _s("Game not implemented"); Common::String MetaEngine::getSavegameFile(int saveGameIdx, const char *target) const { diff --git a/engines/metaengine.h b/engines/metaengine.h index 1b513c72c5c2..d3c790a1150b 100644 --- a/engines/metaengine.h +++ b/engines/metaengine.h @@ -169,19 +169,6 @@ class MetaEngineDetection : public PluginObject { /** Returns formatted data from game descriptor for dumping into a file */ virtual void dumpDetectionEntries() const = 0; - /** - * The default version of this method will just return optionsStrings. - * However it also allows the meta engine to post process - * result and add/remove languages as needed. - * - * @param optionsString Options string that from the config manager. - * @param domain Domain of the current target. - * - * @return The list of languages in the same format as options string. - * - */ - virtual Common::String customizeGuiOptionsLanguages(const Common::String &optionsString, const Common::String &domain) const; - /** * Return a list of engine specified debug channels * diff --git a/engines/tetraedge/detection.cpp b/engines/tetraedge/detection.cpp index 69aadafe65a7..0aca9da2ea79 100644 --- a/engines/tetraedge/detection.cpp +++ b/engines/tetraedge/detection.cpp @@ -41,85 +41,35 @@ TetraedgeMetaEngineDetection::TetraedgeMetaEngineDetection() : AdvancedMetaEngin _flags = kADFlagMatchFullPaths; } -Common::String TetraedgeMetaEngineDetection::customizeGuiOptionsLanguages(const Common::String &optionsString, const Common::String &domain) const { - Common::String result; - - struct { - Common::Language id; - const char *code; - } languages[] = { - { Common::EN_ANY, "en" }, - { Common::FR_FRA, "fr" }, - { Common::DE_DEU, "de" }, - { Common::IT_ITA, "it" }, - { Common::ES_ESP, "es" }, - { Common::RU_RUS, "ru" }, - { Common::HE_ISR, "he" } // This is a Fan-translation, which requires additional patch - }; - - static const char *obbNames[] = { - "main.5.com.microids.syberia.obb", - "main.12.com.microids.syberia.obb", - "main.2.ru.buka.syberia1.obb", - "main.4.com.microids.syberia2.obb", - "main.2.ru.buka.syberia2.obb", - }; - - static const char *subDirs[] = { - nullptr, - "PC-MacOSX-Android-iPhone-iPad", - "PS3" +static const Common::Language *getGameLanguages() { + static const Common::Language languages[] = { + Common::EN_ANY, + Common::FR_FRA, + Common::DE_DEU, + Common::IT_ITA, + Common::ES_ESP, + Common::RU_RUS, + Common::HE_ISR, // This is a Fan-translation, which requires additional patch + Common::UNK_LANG }; + return languages; +} - bool hasLang[ARRAYSIZE(languages)]; - - memset(hasLang, 0, sizeof(hasLang)); - - const Common::Platform platform = Common::parsePlatform(ConfMan.get("platform", domain)); - - Common::FSNode dir(ConfMan.getPath("path", domain)); - - if (platform == Common::Platform::kPlatformMacintosh) - dir = dir.getChild("Resources"); - - for (uint i = 0; i < ARRAYSIZE(languages); i++) { - Common::FSNode base = dir.getChild("texts"); - for (uint k = 0; k < ARRAYSIZE(subDirs); k++) { - Common::FSNode base2 = subDirs[k] ? base.getChild(subDirs[k]) : base; - if (base2.getChild(Common::String::format("%s.xml", languages[i].code)).exists()) - hasLang[i] = true; - } +DetectedGame TetraedgeMetaEngineDetection::toDetectedGame(const ADDetectedGame &adGame, ADDetectedGameExtraInfo *extraInfo) const { + DetectedGame game = AdvancedMetaEngineDetection::toDetectedGame(adGame); + + // The AdvancedDetector model only allows specifying a single supported + // game language. All games support multiple languages. Only Syberia 1 + // supports RU. + for (const Common::Language *language = getGameLanguages(); *language != Common::UNK_LANG; language++) { + // "ru" only present on syberia 1 + if (game.gameId != "syberia" && *language == Common::RU_RUS) + continue; + game.appendGUIOptions(Common::getGameGUIOptionsDescriptionLanguage(*language)); } - if (platform == Common::Platform::kPlatformAndroid) - for (uint j = 0; j < ARRAYSIZE(obbNames); j++) { - Common::FSNode obbPath = dir.getChild(obbNames[j]); - Common::File obbFile; - if (!obbPath.exists() || !obbFile.open(obbPath)) - continue; - - Tetraedge::ObbArchive::FileMap fileMap; - if (!Tetraedge::ObbArchive::readFileMap(obbFile, fileMap)) - continue; - - for (uint i = 0; i < ARRAYSIZE(languages); i++) - for (uint k = 0; k < ARRAYSIZE(subDirs); k++) { - Common::String dname = "texts/"; - if (subDirs[k]) { - dname += subDirs[k]; - dname += "/"; - } - if (fileMap.contains(dname + languages[i].code)) - hasLang[i] = true; - } - } - - - for (uint i = 0; i < ARRAYSIZE(languages); i++) - if(hasLang[i]) - result += " " + Common::getGameGUIOptionsDescriptionLanguage(languages[i].id); - - return result; + return game; } + REGISTER_PLUGIN_STATIC(TETRAEDGE_DETECTION, PLUGIN_TYPE_ENGINE_DETECTION, TetraedgeMetaEngineDetection); diff --git a/engines/tetraedge/detection.h b/engines/tetraedge/detection.h index 36fa1c21b36b..8f3c44c0f191 100644 --- a/engines/tetraedge/detection.h +++ b/engines/tetraedge/detection.h @@ -47,8 +47,6 @@ class TetraedgeMetaEngineDetection : public AdvancedMetaEngineDetection