[Scummvm-git-logs] scummvm master -> 9c86add634a60287a76a452ec59f28466083ef39

sev- noreply at scummvm.org
Mon Aug 28 20:59:56 UTC 2023


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

Summary:
10e432f9aa SCUMM: Replace use of MetaEngineDetection::parseAndCustomizeGuiOptions()
c4a0d2210f AGI: Replace use of MetaEngineDetection::parseAndCustomizeGuiOptions()
9c86add634 ENGINES: Remove MetaEngineDetection::parseAndCustomizeGuiOptions()


Commit: 10e432f9aaa86fd7281024cd2e9842da864b4b32
    https://github.com/scummvm/scummvm/commit/10e432f9aaa86fd7281024cd2e9842da864b4b32
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2023-08-28T22:59:50+02:00

Commit Message:
SCUMM: Replace use of MetaEngineDetection::parseAndCustomizeGuiOptions()

Changed paths:
    engines/scumm/detection.cpp
    engines/scumm/detection_internal.h
    engines/scumm/metaengine.cpp


diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp
index de9f65065a5..fab985f5651 100644
--- a/engines/scumm/detection.cpp
+++ b/engines/scumm/detection.cpp
@@ -95,8 +95,6 @@ public:
 		return entries;
 	}
 
-	Common::String parseAndCustomizeGuiOptions(const Common::String &optionsString, const Common::String &domain) const override;
-
 	void dumpDetectionEntries() const override final {}
 };
 
@@ -150,7 +148,7 @@ DetectedGames ScummMetaEngineDetection::detectGames(const Common::FSList &fslist
 		// Based on generateComplexID() in advancedDetector.cpp.
 		game.preferredTarget = generatePreferredTarget(*x);
 
-		game.setGUIOptions(x->game.guioptions + MidiDriver::musicType2GUIO(x->game.midi));
+		game.setGUIOptions(customizeGuiOptions(*x));
 		game.appendGUIOptions(getGameGUIOptionsDescriptionLanguage(x->language));
 
 		detectedGames.push_back(game);
@@ -184,51 +182,4 @@ const char *ScummMetaEngineDetection::getOriginalCopyright() const {
 	       "Humongous SCUMM Games (C) Humongous";
 }
 
-Common::String ScummMetaEngineDetection::parseAndCustomizeGuiOptions(const Common::String &optionsString, const Common::String &domain) const {
-	Common::String result = MetaEngineDetection::parseAndCustomizeGuiOptions(optionsString, domain);
-	const char *defaultRenderOption = nullptr;
-
-	const Common::Platform platform = Common::parsePlatform(ConfMan.get("platform", domain));
-	const Common::String extra = ConfMan.get("extra", domain);
-
-	// Add default rendermode option for target. We don't put the default mode into the
-	// detection tables, due to the amount of targets we have. It it more convenient to
-	// add the option here.
-	switch (platform) {
-	case Common::kPlatformAmiga:
-		defaultRenderOption = GUIO_RENDERAMIGA;
-		break;
-	case Common::kPlatformApple2GS:
-		defaultRenderOption = GUIO_RENDERAPPLE2GS;
-		break;
-	case Common::kPlatformMacintosh:
-		defaultRenderOption = GUIO_RENDERMACINTOSH;
-		break;
-	case Common::kPlatformFMTowns:
-		defaultRenderOption = GUIO_RENDERFMTOWNS;
-		break;
-	case Common::kPlatformAtariST:
-		defaultRenderOption = GUIO_RENDERATARIST;
-		break;
-	case Common::kPlatformDOS:
-		defaultRenderOption = (extra.equalsIgnoreCase("EGA") || extra.equalsIgnoreCase("V1") || extra.equalsIgnoreCase("V2")) ? GUIO_RENDEREGA : GUIO_RENDERVGA;
-		break;
-	case Common::kPlatformUnknown:
-		// For targets that don't specify the platform (often happens with SCUMM6+ games) we stick with default VGA.
-		defaultRenderOption = GUIO_RENDERVGA;
-		break;
-	default:
-		// Leave this as nullptr for platforms that don't have a specific render option (SegaCD, NES, ...).
-		// These targets will then have the full set of render mode options in the launcher options dialog.
-		break;
-	}
-
-	// If the render option is already part of the string (specified in the
-	// detection tables) we don't add it again.
-	if (defaultRenderOption != nullptr && !result.contains(defaultRenderOption))
-		result += defaultRenderOption;
-
-	return result;
-}
-
 REGISTER_PLUGIN_STATIC(SCUMM_DETECTION, PLUGIN_TYPE_ENGINE_DETECTION, ScummMetaEngineDetection);
diff --git a/engines/scumm/detection_internal.h b/engines/scumm/detection_internal.h
index 70ecd8d9db1..4b5e10c0dfe 100644
--- a/engines/scumm/detection_internal.h
+++ b/engines/scumm/detection_internal.h
@@ -859,6 +859,49 @@ static bool testGame(const GameSettings *g, const DescMap &fileMD5Map, const Com
 	return true;
 }
 
+static Common::String customizeGuiOptions(const DetectorResult &res) {
+	Common::String guiOptions = res.game.guioptions + MidiDriver::musicType2GUIO(res.game.midi);
+	Common::String defaultRenderOption = "";
+
+	// Add default rendermode option for target. We don't put the default mode into the
+	// detection tables, due to the amount of targets we have. It it more convenient to
+	// add the option here.
+	switch (res.game.platform) {
+	case Common::kPlatformAmiga:
+		defaultRenderOption = GUIO_RENDERAMIGA;
+		break;
+	case Common::kPlatformApple2GS:
+		defaultRenderOption = GUIO_RENDERAPPLE2GS;
+		break;
+	case Common::kPlatformMacintosh:
+		defaultRenderOption = GUIO_RENDERMACINTOSH;
+		break;
+	case Common::kPlatformFMTowns:
+		defaultRenderOption = GUIO_RENDERFMTOWNS;
+		break;
+	case Common::kPlatformAtariST:
+		defaultRenderOption = GUIO_RENDERATARIST;
+		break;
+	case Common::kPlatformDOS:
+		defaultRenderOption = (!strcmp(res.extra, "EGA") || !strcmp(res.extra, "V1") || !strcmp(res.extra, "V2")) ? GUIO_RENDEREGA : GUIO_RENDERVGA;
+		break;
+	case Common::kPlatformUnknown:
+		// For targets that don't specify the platform (often happens with SCUMM6+ games) we stick with default VGA.
+		defaultRenderOption = GUIO_RENDERVGA;
+		break;
+	default:
+		// Leave this as nullptr for platforms that don't have a specific render option (SegaCD, NES, ...).
+		// These targets will then have the full set of render mode options in the launcher options dialog.
+		break;
+	}
+
+	// If the render option is already part of the string (specified in the
+	// detection tables) we don't add it again.
+	if (!guiOptions.contains(defaultRenderOption))
+		guiOptions += defaultRenderOption;
+
+	return guiOptions;
+}
 
 } // End of namespace Scumm
 
diff --git a/engines/scumm/metaengine.cpp b/engines/scumm/metaengine.cpp
index d7dd448fe46..835189a89a0 100644
--- a/engines/scumm/metaengine.cpp
+++ b/engines/scumm/metaengine.cpp
@@ -367,7 +367,7 @@ Common::Error ScummMetaEngine::createInstance(OSystem *syst, Engine **engine) {
 
 	// If the GUI options were updated, we catch this here and update them in the users config
 	// file transparently.
-	Common::updateGameGUIOptions(res.game.guioptions, getGameGUIOptionsDescriptionLanguage(res.language));
+	Common::updateGameGUIOptions(customizeGuiOptions(res), getGameGUIOptionsDescriptionLanguage(res.language));
 
 	// If the game was added really long ago, it may be missing its "extra"
 	// field. When adding game-specific options, it may be our only way of


Commit: c4a0d2210f2ae3b4074b55e68a17d5ece6805ed2
    https://github.com/scummvm/scummvm/commit/c4a0d2210f2ae3b4074b55e68a17d5ece6805ed2
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2023-08-28T22:59:50+02:00

Commit Message:
AGI: Replace use of MetaEngineDetection::parseAndCustomizeGuiOptions()

Changed paths:
    engines/agi/detection.cpp
    engines/agi/detection_tables.h


diff --git a/engines/agi/detection.cpp b/engines/agi/detection.cpp
index 4ee806405ca..aa803ff4f0e 100644
--- a/engines/agi/detection.cpp
+++ b/engines/agi/detection.cpp
@@ -88,7 +88,9 @@ class AgiMetaEngineDetection : public AdvancedMetaEngineDetection {
 
 public:
 	AgiMetaEngineDetection() : AdvancedMetaEngineDetection(Agi::gameDescriptions, sizeof(Agi::AGIGameDescription), agiGames) {
-		_guiOptions = GUIO1(GUIO_NOSPEECH);
+		_guiOptions = GUIO_NOSPEECH GUIO_RENDEREGA GUIO_RENDERCGA GUIO_RENDERHERCAMBER GUIO_RENDERHERCGREEN
+			GUIO_RENDERAMIGA GUIO_RENDERAPPLE2GS GUIO_RENDERATARIST GUIO_RENDERMACINTOSH;
+
 		_maxScanDepth = 2;
 		_flags = kADFlagMatchFullPaths;
 	}
@@ -110,7 +112,6 @@ public:
 	}
 
 	ADDetectedGame fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist, ADDetectedGameExtraInfo **extra) const override;
-	Common::String parseAndCustomizeGuiOptions(const Common::String &optionsString, const Common::String &domain) const override;
 };
 
 ADDetectedGame AgiMetaEngineDetection::fallbackDetect(const FileMap &allFilesXXX, const Common::FSList &fslist, ADDetectedGameExtraInfo **extra) const {
@@ -281,32 +282,4 @@ ADDetectedGame AgiMetaEngineDetection::fallbackDetect(const FileMap &allFilesXXX
 	return ADDetectedGame();
 }
 
-Common::String AgiMetaEngineDetection::parseAndCustomizeGuiOptions(const Common::String &optionsString, const Common::String &domain) const {
-	Common::String result = MetaEngineDetection::parseAndCustomizeGuiOptions(optionsString, domain);
-	Common::String renderOptions;
-
-	const Common::Platform platform = Common::parsePlatform(ConfMan.get("platform", domain));
-	const Common::String gid = ConfMan.get("gameid", domain);
-
-	renderOptions = GUIO_RENDEREGA GUIO_RENDERCGA GUIO_RENDERHERCAMBER GUIO_RENDERHERCGREEN
-		GUIO_RENDERAMIGA GUIO_RENDERAPPLE2GS GUIO_RENDERATARIST GUIO_RENDERMACINTOSH;
-
-	switch (platform) {
-	case Common::kPlatformDOS:
-		if (gid.contains("AGI256") || gid.contains("256 Colors"))
-			renderOptions += GUIO_RENDERVGA;
-		break;
-	default:
-		break;
-	}
-
-	for (Common::String::const_iterator i = renderOptions.begin(); i != renderOptions.end(); ++i) {
-		// If the render option is already part of the string (specified in the detection tables) we don't add it again.
-		if (!result.contains(*i))
-			result += *i;
-	}
-
-	return result;
-}
-
 REGISTER_PLUGIN_STATIC(AGI_DETECTION, PLUGIN_TYPE_ENGINE_DETECTION, AgiMetaEngineDetection);
diff --git a/engines/agi/detection_tables.h b/engines/agi/detection_tables.h
index 56494d00a64..242b5d8cf81 100644
--- a/engines/agi/detection_tables.h
+++ b/engines/agi/detection_tables.h
@@ -26,7 +26,9 @@ namespace Agi {
 #define GAMEOPTIONS_DEFAULT                   GUIO4(GAMEOPTION_ORIGINAL_SAVELOAD,GAMEOPTION_DISABLE_MOUSE,GAMEOPTION_USE_HERCULES_FONT,GAMEOPTION_COMMAND_PROMPT_WINDOW)
 #define GAMEOPTIONS_AMIGA                     GUIO4(GAMEOPTION_ORIGINAL_SAVELOAD,GAMEOPTION_AMIGA_ALTERNATIVE_PALETTE,GAMEOPTION_USE_HERCULES_FONT,GAMEOPTION_COMMAND_PROMPT_WINDOW)
 #define GAMEOPTIONS_APPLE2GS                  GUIO5(GAMEOPTION_ORIGINAL_SAVELOAD,GAMEOPTION_DISABLE_MOUSE,GAMEOPTION_USE_HERCULES_FONT,GAMEOPTION_COMMAND_PROMPT_WINDOW, GAMEOPTION_APPLE2GS_ADD_SPEED_MENU)
+#define GAMEOPTIONS_VGA                       GUIO5(GAMEOPTION_ORIGINAL_SAVELOAD,GAMEOPTION_DISABLE_MOUSE,GAMEOPTION_USE_HERCULES_FONT,GAMEOPTION_COMMAND_PROMPT_WINDOW,GUIO_RENDERVGA)
 #define GAMEOPTIONS_FANMADE_MOUSE             GUIO3(GAMEOPTION_ORIGINAL_SAVELOAD,GAMEOPTION_USE_HERCULES_FONT,GAMEOPTION_COMMAND_PROMPT_WINDOW)
+#define GAMEOPTIONS_FANMADE_MOUSE_VGA         GUIO4(GAMEOPTION_ORIGINAL_SAVELOAD,GAMEOPTION_USE_HERCULES_FONT,GAMEOPTION_COMMAND_PROMPT_WINDOW,GUIO_RENDERVGA)
 
 #define GAME_LVFPN(id,extra,fname,md5,size,lang,ver,features,gid,platform,interp,guioptions) { \
 		{ \
@@ -897,8 +899,8 @@ static const AGIGameDescription gameDescriptions[] = {
 	GAME("tetris", "", "7a874e2db2162e7a4ce31c9130248d8a", 0x2917, GID_FANMADE),
 	FANMADE("AGI Tetris (1998)", "1afcbc25bfafded2d5fb82de9da0bd9a"),
 	FANMADE_V("AGI Trek (Demo)", "c02882b8a8245b629c91caf7eb78eafe", 0x2440),
-	FANMADE_F("AGI256 Demo", "79261ac143b2e2773b2753674733b0d5", GF_AGI256),
-	FANMADE_F("AGI256-2 Demo", "3cad9b3aff1467cebf0c5c5b110985c5", GF_AGI256),
+	FANMADE_FO("AGI256 Demo", "79261ac143b2e2773b2753674733b0d5", GF_AGI256, GAMEOPTIONS_VGA),
+	FANMADE_FO("AGI256-2 Demo", "3cad9b3aff1467cebf0c5c5b110985c5", GF_AGI256, GAMEOPTIONS_VGA),
 	FANMADE_F("Abrah: L'orphelin de l'espace (v1.2)", "b7b6d1539e14d5a26fa3088288e1badc", Common::FR_FRA),	// AGIPAL
 	FANMADE("Acidopolis", "7017db1a4b726d0d59e65e9020f7d9f7"),
 	FANMADE("Agent 0055 (v1.0)", "c2b34a0c77acb05482781dda32895f24"),
@@ -936,7 +938,7 @@ static const AGIGameDescription gameDescriptions[] = {
 	FANMADE("DG: The Adventure Game (v1.1)", "0d6376d493fa7a21ec4da1a063e12b25"),
 	FANMADE_L("DG: The Adventure Game (v1.1)", "258bdb3bb8e61c92b71f2f456cc69e23", Common::FR_FRA),
 	FANMADE("Dashiki (16 Colors)", "9b2c7b9b0283ab9f12bedc0cb6770a07"),
-	FANMADE_FO("Dashiki (256 Colors)", "c68052bb209e23b39b55ff3d759958e6", GF_AGIMOUSE|GF_AGI256, GAMEOPTIONS_FANMADE_MOUSE),
+	FANMADE_FO("Dashiki (256 Colors)", "c68052bb209e23b39b55ff3d759958e6", GF_AGIMOUSE|GF_AGI256, GAMEOPTIONS_FANMADE_MOUSE_VGA),
 	FANMADE("Date Quest 1 (v1.0)", "ba3dcb2600645be53a13170aa1a12e69"),
 	FANMADE("Date Quest 2 (v1.0 Demo)", "1602d6a2874856e928d9a8c8d2d166e9"),
 	FANMADE("Date Quest 2 (v1.0)", "f13f6fc85aa3e6e02b0c20408fb63b47"),


Commit: 9c86add634a60287a76a452ec59f28466083ef39
    https://github.com/scummvm/scummvm/commit/9c86add634a60287a76a452ec59f28466083ef39
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2023-08-28T22:59:50+02:00

Commit Message:
ENGINES: Remove MetaEngineDetection::parseAndCustomizeGuiOptions()

Changed paths:
    engines/metaengine.cpp
    engines/metaengine.h
    engines/vcruise/detection.cpp
    gui/options.cpp


diff --git a/engines/metaengine.cpp b/engines/metaengine.cpp
index 96141c3240d..da13682a029 100644
--- a/engines/metaengine.cpp
+++ b/engines/metaengine.cpp
@@ -37,10 +37,6 @@
 #include "graphics/managed_surface.h"
 #include "graphics/thumbnail.h"
 
-Common::String MetaEngineDetection::parseAndCustomizeGuiOptions(const Common::String &optionsString, const Common::String &domain) const {
-	return parseGameGUIOptions(optionsString);
-}
-
 Common::String MetaEngine::getSavegameFile(int saveGameIdx, const char *target) const {
 	if (!target)
 		target = getName();
diff --git a/engines/metaengine.h b/engines/metaengine.h
index ea960f604a8..71bc6b3ec8d 100644
--- a/engines/metaengine.h
+++ b/engines/metaengine.h
@@ -173,19 +173,6 @@ public:
 	/** Returns formatted data from game descriptor for dumping into a file */
 	virtual void dumpDetectionEntries() const = 0;
 
-	/**
-	 * The default version of this method will just parse the options string from
-	 * the config manager. However it also allows the meta engine to post process
-	 * result and add/remove other options as needed.
-	 *
-	 * @param optionsString		Options string that from the config manager.
-	 * @param domain			Domain of the current target.
-	 *
-	 * @return    The fully processed options string that is usable by the GUI.
-	 *
-	 */
-	virtual Common::String parseAndCustomizeGuiOptions(const Common::String &optionsString, const Common::String &domain) const;
-
 	/**
 	 * Return a list of engine specified debug channels
 	 *
diff --git a/engines/vcruise/detection.cpp b/engines/vcruise/detection.cpp
index ff29fedfc4f..b88a1b7eb03 100644
--- a/engines/vcruise/detection.cpp
+++ b/engines/vcruise/detection.cpp
@@ -105,20 +105,6 @@ public:
 
 		return game;
 	}
-
-	/*
-	Common::String parseAndCustomizeGuiOptions(const Common::String &optionsString, const Common::String &domain) const {
-		Common::String guiOptions = AdvancedMetaEngineDetection::parseAndCustomizeGuiOptions(optionsString, domain);
-
-		if (domain.hasPrefix("reah")) {
-			guiOptions += " lang_Dutch lang_French lang_Italian lang_German lang_Polish lang_Spanish";
-		} else if (domain.hasPrefix("schizm")) {
-			guiOptions += " lang_Dutch lang_French lang_Italian lang_German lang_Greek lang_Polish lang_Russian lang_Spanish";
-		}
-
-		return guiOptions;
-	}
-	*/
 };
 
 REGISTER_PLUGIN_STATIC(VCRUISE_DETECTION, PLUGIN_TYPE_ENGINE_DETECTION, VCruiseMetaEngineDetection);
diff --git a/gui/options.cpp b/gui/options.cpp
index 377a898d009..61b52618f2f 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -256,15 +256,7 @@ void OptionsDialog::init() {
 	_guioptions.clear();
 	if (ConfMan.hasKey("guioptions", _domain)) {
 		_guioptionsString = ConfMan.get("guioptions", _domain);
-
-		const Plugin *plugin = nullptr;
-		EngineMan.findTarget(_domain, &plugin);
-		if (plugin) {
-			const MetaEngineDetection &metaEngineDetection = plugin->get<MetaEngineDetection>();
-			_guioptions = metaEngineDetection.parseAndCustomizeGuiOptions(_guioptionsString, _domain);
-		} else {
-			_guioptions = parseGameGUIOptions(_guioptionsString);
-		}
+		_guioptions = parseGameGUIOptions(_guioptionsString);
 	}
 }
 
@@ -273,15 +265,7 @@ void OptionsDialog::build() {
 	_guioptions.clear();
 	if (ConfMan.hasKey("guioptions", _domain)) {
 		_guioptionsString = ConfMan.get("guioptions", _domain);
-
-		const Plugin *plugin = nullptr;
-		EngineMan.findTarget(_domain, &plugin);
-		if (plugin) {
-			const MetaEngineDetection &metaEngineDetection = plugin->get<MetaEngineDetection>();
-			_guioptions = metaEngineDetection.parseAndCustomizeGuiOptions(_guioptionsString, _domain);
-		} else {
-			_guioptions = parseGameGUIOptions(_guioptionsString);
-		}
+		_guioptions = parseGameGUIOptions(_guioptionsString);
 	}
 
 	// Control options




More information about the Scummvm-git-logs mailing list