MOHAWK: RIVEN: Allow changing the game language at run-time

This commit is contained in:
Bastien Bouclet 2020-03-24 19:13:10 +01:00
parent 1f5d4d1fdd
commit 195d593405
10 changed files with 187 additions and 169 deletions

View file

@ -208,6 +208,8 @@ public:
return "Myst and Riven (C) Cyan Worlds\nMohawk OS (C) Ubisoft";
}
DetectedGames detectGames(const Common::FSList &fslist) const override;
bool hasFeature(MetaEngineFeature f) const override;
bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const override;
SaveStateList listSaves(const char *target) const override;
@ -220,6 +222,29 @@ public:
GUI::OptionsContainerWidget *buildEngineOptionsWidget(GUI::GuiObject *boss, const Common::String &name, const Common::String &target) const override;
};
DetectedGames MohawkMetaEngine::detectGames(const Common::FSList &fslist) const {
DetectedGames detectedGames = AdvancedMetaEngine::detectGames(fslist);
// The AdvancedDetector model only allows specifying a single supported
// game language. The 25th anniversary edition Myst games are multilanguage.
// Here we amend the detected games to set the list of supported languages.
for (uint i = 0; i < detectedGames.size(); i++) {
DetectedGame &game = detectedGames[i];
#ifdef ENABLE_RIVEN
if (game.gameId == "riven"
&& Common::checkGameGUIOption(GAMEOPTION_25TH, game.getGUIOptions())) {
const Mohawk::RivenLanguage *languages = Mohawk::MohawkEngine_Riven::listLanguages();
while (languages->language != Common::UNK_LANG) {
game.appendGUIOptions(Common::getGameGUIOptionsDescriptionLanguage(languages->language));
languages++;
}
}
#endif
}
return detectedGames;
}
bool MohawkMetaEngine::hasFeature(MetaEngineFeature f) const {
return
(f == kSupportsListSaves)