[Scummvm-git-logs] scummvm master -> ebecd4f12fb72dc4e5304ee052af8f3f4999cf27

bluegr noreply at scummvm.org
Thu Nov 14 18:57:41 UTC 2024


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

Summary:
ebecd4f12f MYST3: Add support for orignal layout of multilingual CD and DVD


Commit: ebecd4f12fb72dc4e5304ee052af8f3f4999cf27
    https://github.com/scummvm/scummvm/commit/ebecd4f12fb72dc4e5304ee052af8f3f4999cf27
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2024-11-14T20:57:37+02:00

Commit Message:
MYST3: Add support for orignal layout of multilingual CD and DVD

Fixes bug 13039.

Changed paths:
    engines/myst3/detection.cpp
    engines/myst3/detection.h
    engines/myst3/metaengine.cpp
    engines/myst3/myst3.cpp
    engines/myst3/myst3.h


diff --git a/engines/myst3/detection.cpp b/engines/myst3/detection.cpp
index 9de5493a031..65dd72ce4ff 100644
--- a/engines/myst3/detection.cpp
+++ b/engines/myst3/detection.cpp
@@ -46,6 +46,9 @@ static const char *const directoryGlobs[] = {
 	"M3Data",
 	"MYST3BIN",
 	"TEXT",
+	"Myst III Spanish", // For the DVD original layout
+	"Dutch",            // For the CD multilingual original layout
+	"Spanish",
 	nullptr
 };
 
@@ -135,6 +138,24 @@ static const Myst3GameDescription gameDescriptions[] = {
 	MYST3ENTRY(Common::IT_ITA, "ITALIAN.m3u",  "73db43aac3fe8671e2c4e227977fbb61", nullptr, kLocMulti6)
 	MYST3ENTRY(Common::ES_ESP, "SPANISH.m3u",  "55ceb165dad02211ef2d25946c3aac8e", nullptr, kLocMulti6)
 
+	// Multilingual CD release (1.21, original layout)
+	{
+		{
+			"myst3",
+			nullptr,
+			{
+				{ "RSRC.m3r",     0, "a2c8ed69800f60bf5667e5c76a88e481", 1223862 },
+				{ "SPANISH.m3u",  0, "55ceb165dad02211ef2d25946c3aac8e", 2604702 }, // Use the spanish language file
+				{ "DUTCH.m3u",    0, "c4a8d8fb0eb3fecb9c435a8517bc1f9a", 2607925 }, // and the dutch one to exclude Multi2 versions
+			},
+			Common::UNK_LANG,
+			Common::kPlatformWindows,
+			ADGF_NO_FLAGS,
+			GUIO_NONE
+		},
+		kLocMulti6 | kLayoutCD
+	},
+
 	{
 		// Chinese (Simplified) CD release (1.22LC)
 		{
@@ -164,6 +185,24 @@ static const Myst3GameDescription gameDescriptions[] = {
 	MYST3ENTRY_DVD(Common::IT_ITA, "ITALIAN.m3u",  "51fb02f6bf37dde811d7cde648365260", "DVD", kLocMulti6)
 	MYST3ENTRY_DVD(Common::ES_ESP, "SPANISH.m3u",  "e27e610fe8ce35223a3239ff170a85ec", "DVD", kLocMulti6)
 
+	// DVD release (1.27, original layout)
+	{
+		{
+			"myst3",
+			"DVD",
+			{
+				{ "RSRC.m3r",     0, "a2c8ed69800f60bf5667e5c76a88e481", 1223862 },
+				{ "ENGLISH.m3t",  0, "74726de866c0594d3f2a05ff754c973d", 3407120 },
+				{ "language.m3u", 0, "e27e610fe8ce35223a3239ff170a85ec", 2604318 }, // Use the spanish language file
+			},
+			Common::UNK_LANG,
+			Common::kPlatformWindows,
+			ADGF_NO_FLAGS,
+			GUIO_NONE
+		},
+		kLocMulti6 | kLayoutDVD
+	},
+
 	// Myst 3 Xbox (PAL)
 	MYST3ENTRY_XBOX(Common::EN_ANY, "ENGLISHX.m3t", "c4d012ab02b8ca7d0c7e79f4dbd4e676")
 	MYST3ENTRY_XBOX(Common::FR_FRA, "FRENCHX.m3t",  "94c9dcdec8794751e4d773776552751a")
@@ -228,6 +267,27 @@ public:
 	const DebugChannelDef *getDebugChannels() const override {
 		return debugFlagList;
 	}
+
+	DetectedGame toDetectedGame(const ADDetectedGame &adGame, ADDetectedGameExtraInfo *extraInfo) const {
+		DetectedGame game = AdvancedMetaEngineDetection::toDetectedGame(adGame);
+
+		// The AdvancedDetector model only allows specifying a single supported
+		// game language. The 10th anniversary edition Myst III is multilanguage.
+		// Here we amend the detected games to set the list of supported languages.
+		if ((reinterpret_cast<const Myst3::Myst3GameDescription *>(
+				adGame.desc)->flags & Myst3::kGameLayoutTypeMask) != Myst3::kLayoutFlattened) {
+			game.appendGUIOptions(Common::getGameGUIOptionsDescriptionLanguage(Common::EN_ANY));
+			game.appendGUIOptions(Common::getGameGUIOptionsDescriptionLanguage(Common::DE_DEU));
+			game.appendGUIOptions(Common::getGameGUIOptionsDescriptionLanguage(Common::ES_ESP));
+			game.appendGUIOptions(Common::getGameGUIOptionsDescriptionLanguage(Common::FR_FRA));
+			game.appendGUIOptions(Common::getGameGUIOptionsDescriptionLanguage(Common::IT_ITA));
+			game.appendGUIOptions(Common::getGameGUIOptionsDescriptionLanguage(Common::IT_ITA));
+			game.appendGUIOptions(Common::getGameGUIOptionsDescriptionLanguage(Common::NL_NLD));
+		}
+
+		return game;
+	}
+
 };
 
 } // End of namespace Myst3
diff --git a/engines/myst3/detection.h b/engines/myst3/detection.h
index c83a27f7210..5e742d389cf 100644
--- a/engines/myst3/detection.h
+++ b/engines/myst3/detection.h
@@ -26,17 +26,25 @@
 
 namespace Myst3 {
 
+static const uint32 kGameLocalizationTypeMask = 0xff;
 enum GameLocalizationType {
-	kLocMonolingual,
-	kLocMulti2,
-	kLocMulti6
+	kLocMonolingual = 0,
+	kLocMulti2 = 1,
+	kLocMulti6 = 2,
+};
+
+static const uint32 kGameLayoutTypeMask = 0xff << 8;
+enum GameLayoutType {
+	kLayoutFlattened = 0,
+	kLayoutCD = 1 << 8,
+	kLayoutDVD = 2 << 8,
 };
 
 struct Myst3GameDescription {
 	AD_GAME_DESCRIPTION_HELPERS(desc);
 
 	ADGameDescription desc;
-	uint32 localizationType;
+	uint32 flags;
 };
 
 #define GAMEOPTION_WIDESCREEN_MOD GUIO_GAMEOPTIONS1
diff --git a/engines/myst3/metaengine.cpp b/engines/myst3/metaengine.cpp
index 6bcd20e334e..974d924c191 100644
--- a/engines/myst3/metaengine.cpp
+++ b/engines/myst3/metaengine.cpp
@@ -171,7 +171,11 @@ Common::Language Myst3Engine::getGameLanguage() const {
 }
 
 uint32 Myst3Engine::getGameLocalizationType() const {
-	return _gameDescription->localizationType;
+	return _gameDescription->flags & kGameLocalizationTypeMask;
+}
+
+uint32 Myst3Engine::getGameLayoutType() const {
+	return _gameDescription->flags & kGameLayoutTypeMask;
 }
 
 } // End of namespace Myst3
diff --git a/engines/myst3/myst3.cpp b/engines/myst3/myst3.cpp
index 4e269dbe3bc..a9665548935 100644
--- a/engines/myst3/myst3.cpp
+++ b/engines/myst3/myst3.cpp
@@ -162,7 +162,13 @@ Common::Error Myst3Engine::run() {
 	_rnd = new Common::RandomSource("sprint");
 	setDebugger(new Console(this));
 	_scriptEngine = new Script(this);
-	_db = new Database(getPlatform(), getGameLanguage(), getGameLocalizationType());
+	Common::Language lang;
+	if (getGameLayoutType() != kLayoutFlattened) {
+		lang = Common::parseLanguage(ConfMan.get("language"));
+	} else {
+		lang = getGameLanguage();
+	}
+	_db = new Database(getPlatform(), lang, getGameLocalizationType());
 	_state = new GameState(getPlatform(), _db);
 	_scene = new Scene(this);
 	if (getPlatform() == Common::kPlatformXbox) {
@@ -251,39 +257,82 @@ void Myst3Engine::openArchives() {
 	Common::String menuLanguage;
 	Common::String textLanguage;
 
-	switch (getGameLanguage()) {
-	case Common::NL_NLD:
-		menuLanguage = "DUTCH";
-		break;
-	case Common::FR_FRA:
-		menuLanguage = "FRENCH";
-		break;
-	case Common::DE_DEU:
-		menuLanguage = "GERMAN";
-		break;
-	case Common::HE_ISR:
-		menuLanguage = "HEBREW";
-		break;
-	case Common::IT_ITA:
-		menuLanguage = "ITALIAN";
-		break;
-	case Common::ES_ESP:
-		menuLanguage = "SPANISH";
-		break;
-	case Common::JA_JPN:
-		menuLanguage = "JAPANESE";
-		break;
-	case Common::PL_POL:
-		menuLanguage = "POLISH";
-		break;
-	case Common::EN_ANY:
-	case Common::RU_RUS:
-	default:
-		menuLanguage = "ENGLISH";
-		break;
-	}
-
-	if (getGameLocalizationType() == kLocMulti6) {
+	const uint32 localizationType = getGameLocalizationType();
+	const uint32 layoutType = getGameLayoutType();
+
+	if (layoutType == kLayoutCD || layoutType == kLayoutDVD) {
+		const char *languageDir;
+		switch (_db->getGameLanguageCode()) {
+		case kDutch:
+			languageDir = "Dutch";
+			menuLanguage = "DUTCH";
+			break;
+		case kFrench:
+			languageDir = "French";
+			menuLanguage = "FRENCH";
+			break;
+		case kGerman:
+			languageDir = "German";
+			menuLanguage = "GERMAN";
+			break;
+		case kItalian:
+			languageDir = "Italian";
+			menuLanguage = "ITALIAN";
+			break;
+		case kSpanish:
+			languageDir = "Spanish";
+			menuLanguage = "SPANISH";
+			break;
+		case kEnglish:
+		default:
+			languageDir = "English";
+			menuLanguage = "ENGLISH";
+			break;
+		}
+		Common::Path path(ConfMan.getPath("path"));
+		if (layoutType == kLayoutDVD) {
+			path = path.appendComponent(Common::String::format("Myst III %s", languageDir));
+			menuLanguage = "language";
+		} else {
+			path = path.appendComponent(languageDir);
+		}
+		SearchMan.remove("MYST3_language_dir");
+		SearchMan.addDirectory("MYST3_language_dir", path);
+	} else {
+		switch (getGameLanguage()) {
+		case Common::NL_NLD:
+			menuLanguage = "DUTCH";
+			break;
+		case Common::FR_FRA:
+			menuLanguage = "FRENCH";
+			break;
+		case Common::DE_DEU:
+			menuLanguage = "GERMAN";
+			break;
+		case Common::HE_ISR:
+			menuLanguage = "HEBREW";
+			break;
+		case Common::IT_ITA:
+			menuLanguage = "ITALIAN";
+			break;
+		case Common::ES_ESP:
+			menuLanguage = "SPANISH";
+			break;
+		case Common::JA_JPN:
+			menuLanguage = "JAPANESE";
+			break;
+		case Common::PL_POL:
+			menuLanguage = "POLISH";
+			break;
+		case Common::EN_ANY:
+		case Common::RU_RUS:
+		default:
+			menuLanguage = "ENGLISH";
+			break;
+		}
+	}
+
+	if (localizationType == kLocMulti6) {
 		switch (ConfMan.getInt("text_language")) {
 		case kDutch:
 			textLanguage = "DUTCH";
@@ -308,14 +357,14 @@ void Myst3Engine::openArchives() {
 	} else if (getGameLanguage() == Common::HE_ISR) {
 		textLanguage = "ENGLISH"; // The Hebrew version does not have a "HEBREW.m3t" file
 	} else {
-		if (getGameLocalizationType() == kLocMonolingual || ConfMan.getInt("text_language")) {
+		if (localizationType == kLocMonolingual || ConfMan.getInt("text_language")) {
 			textLanguage = menuLanguage;
 		} else {
 			textLanguage = "ENGLISH";
 		}
 	}
 
-	if (getGameLocalizationType() != kLocMonolingual && getPlatform() != Common::kPlatformXbox && textLanguage == "ENGLISH") {
+	if (localizationType != kLocMonolingual && getPlatform() != Common::kPlatformXbox && textLanguage == "ENGLISH") {
 		textLanguage = "ENGLISHjp";
 	}
 
@@ -333,7 +382,7 @@ void Myst3Engine::openArchives() {
 
 	addArchive(textLanguage + ".m3t", true);
 
-	if (getGameLocalizationType() != kLocMonolingual || getPlatform() == Common::kPlatformXbox || getGameLanguage() == Common::HE_ISR) {
+	if (localizationType != kLocMonolingual || getPlatform() == Common::kPlatformXbox || getGameLanguage() == Common::HE_ISR) {
 		addArchive(menuLanguage + ".m3u", true);
 	}
 
@@ -1896,8 +1945,17 @@ void Myst3Engine::settingsApplyFromVars() {
 		ConfMan.setInt("overall_volume", _state->getOverallVolume() * 256 / 100);
 		ConfMan.setInt("music_volume", _state->getMusicVolume() * 256 / 100);
 		ConfMan.setInt("music_frequency", _state->getMusicFrequency());
-		ConfMan.setInt("audio_language", _state->getLanguageAudio());
-		ConfMan.setInt("text_language", _state->getLanguageText());
+		// Don't set languages if they are still the defaults
+		// This will allow the user to change the menu language in ScummVM and
+		// have the other settings follow the change
+		if (ConfMan.hasKey("audio_language") ||
+				ConfMan.getInt("audio_language") != _state->getLanguageAudio()) {
+			ConfMan.setInt("audio_language", _state->getLanguageAudio());
+		}
+		if (ConfMan.hasKey("text_language") ||
+				oldTextLanguage != _state->getLanguageText()) {
+			ConfMan.setInt("text_language", _state->getLanguageText());
+		}
 		ConfMan.setBool("water_effects", _state->getWaterEffects());
 
 		// The language changed, reload the correct archives
diff --git a/engines/myst3/myst3.h b/engines/myst3/myst3.h
index 497f67daf63..8cd0ecec72e 100644
--- a/engines/myst3/myst3.h
+++ b/engines/myst3/myst3.h
@@ -115,6 +115,7 @@ public:
 	Common::Platform getPlatform() const;
 	Common::Language getGameLanguage() const;
 	uint32 getGameLocalizationType() const;
+	uint32 getGameLayoutType() const;
 	bool isTextLanguageEnglish() const;
 	bool isWideScreenModEnabled() const;
 




More information about the Scummvm-git-logs mailing list