[Scummvm-git-logs] scummvm master -> 87549b46602b1c4b71af90787824f91bedb0cea9

athrxx noreply at scummvm.org
Sat Mar 28 10:41:32 UTC 2026


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .

Summary:
87549b4660 SCI: fix broken ADGF_ADDENGLISH flag handling


Commit: 87549b46602b1c4b71af90787824f91bedb0cea9
    https://github.com/scummvm/scummvm/commit/87549b46602b1c4b71af90787824f91bedb0cea9
Author: athrxx (athrxx at scummvm.org)
Date: 2026-03-28T11:40:13+01:00

Commit Message:
SCI: fix broken ADGF_ADDENGLISH flag handling

All languages have to be re-added after the customization
of the gui options. We only added the default language.

Changed paths:
    common/language.cpp
    common/language.h
    engines/sci/detection.cpp


diff --git a/common/language.cpp b/common/language.cpp
index 08f62821260..79a82aff79f 100644
--- a/common/language.cpp
+++ b/common/language.cpp
@@ -184,6 +184,22 @@ const String getGameGUIOptionsDescriptionLanguage(Language lang) {
 	return String("lang_") + getLanguageDescription(lang);
 }
 
+List<Language> parseLanguagesFromGameGUIOptionsString(const String &optionsString) {
+	List<Language> result;
+
+	const char langPrefix[] = "lang_";
+	const size_t langPrefixLen = strlen(langPrefix);
+
+	for (size_t pos = optionsString.find(langPrefix); pos != String::npos; pos = optionsString.find(langPrefix, pos + langPrefixLen)) {
+		for (const LanguageDescription *it = g_languages; it < &g_languages[ARRAYSIZE(g_languages)] && it->id != UNK_LANG; ++it) {
+			if (optionsString.substr(pos + langPrefixLen, MIN<size_t>(optionsString.size() - (pos + langPrefixLen), strlen(it->description))).equals(it->description))
+				result.push_back(it->id);
+		}
+	}
+
+	return result;
+}
+
 List<String> getLanguageList() {
 	List<String> list;
 
diff --git a/common/language.h b/common/language.h
index 169807680e7..c76eb04cd14 100644
--- a/common/language.h
+++ b/common/language.h
@@ -106,6 +106,7 @@ extern const char *getLanguageDescription(Language id);
 
 // TODO: Document this GUIO related function
 const String getGameGUIOptionsDescriptionLanguage(Common::Language lang);
+List<Language> parseLanguagesFromGameGUIOptionsString(const String &optionsString);
 
 // TODO: Document this GUIO related function
 bool checkGameGUIOptionLanguage(Common::Language lang, const String &str);
diff --git a/engines/sci/detection.cpp b/engines/sci/detection.cpp
index ee943810a19..9830ce28c38 100644
--- a/engines/sci/detection.cpp
+++ b/engines/sci/detection.cpp
@@ -235,8 +235,14 @@ DetectedGames SciMetaEngineDetection::detectGames(const Common::FSList &fslist,
 				break;
 		}
 
+		// Save the language info from the options string, since it will be overwritten in the next step.
+		Common::List<Common::Language> langList = Common::parseLanguagesFromGameGUIOptionsString(game.getGUIOptions());
+
 		game.setGUIOptions(customizeGuiOptions(fslist.begin()->getParent().getPath(), parseGameGUIOptions(game.getGUIOptions()), game.platform, g->gameidStr, g->version));
-		game.appendGUIOptions(getGameGUIOptionsDescriptionLanguage(game.language));
+
+		// Restore the language info to the options string.
+		for (const Common::Language &lang : langList)
+			game.appendGUIOptions(getGameGUIOptionsDescriptionLanguage(lang));
 	}
 
 	return games;




More information about the Scummvm-git-logs mailing list