Skip to content

Commit

Permalink
Remove customizeGuiOptionsLanguages for now
Browse files Browse the repository at this point in the history
  • Loading branch information
phcoder committed Jan 1, 2025
1 parent d047bd9 commit f72d75e
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 95 deletions.
4 changes: 0 additions & 4 deletions engines/metaengine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
13 changes: 0 additions & 13 deletions engines/metaengine.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down
100 changes: 25 additions & 75 deletions engines/tetraedge/detection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
2 changes: 0 additions & 2 deletions engines/tetraedge/detection.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ class TetraedgeMetaEngineDetection : public AdvancedMetaEngineDetection<ADGameDe
TetraedgeMetaEngineDetection();
~TetraedgeMetaEngineDetection() override {}

Common::String customizeGuiOptionsLanguages(const Common::String &optionsString, const Common::String &domain) const override;

const char *getEngineName() const override {
return "Tetraedge Engine";
}
Expand Down
1 change: 0 additions & 1 deletion gui/options.h
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,6 @@ class OptionsDialog : public Dialog {
// Game GUI options
//
Common::String _guioptions;
Common::String _guioptionsLanguages;
Common::String _guioptionsString;

//
Expand Down

0 comments on commit f72d75e

Please sign in to comment.