[Scummvm-git-logs] scummvm master -> 2a18e903cb3ec4f390b1a51577d8a6f81464ee3a

athrxx noreply at scummvm.org
Thu May 30 18:11:34 UTC 2024


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

Summary:
d7e8a54756 AUDIO/GUI: add Mac sound option
2a18e903cb SCUMM: (Amiga/Mac/C64) - improve launcher sound options


Commit: d7e8a547561f10d40e04b6bec333be5b84ede042
    https://github.com/scummvm/scummvm/commit/d7e8a547561f10d40e04b6bec333be5b84ede042
Author: athrxx (athrxx at scummvm.org)
Date: 2024-05-30T20:10:51+02:00

Commit Message:
AUDIO/GUI: add Mac sound option

Changed paths:
  A audio/mac_plugin.cpp
    audio/mididrv.cpp
    audio/mididrv.h
    audio/module.mk
    base/plugins.cpp
    common/gui_options.cpp
    common/gui_options.h
    engines/scumm/detection_internal.h
    gui/options.cpp


diff --git a/audio/mac_plugin.cpp b/audio/mac_plugin.cpp
new file mode 100644
index 00000000000..9a3f3d75e8b
--- /dev/null
+++ b/audio/mac_plugin.cpp
@@ -0,0 +1,56 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "audio/musicplugin.h"
+#include "common/error.h"
+#include "common/translation.h"
+
+// This is more or less a null plugin, with the sole purpose of having a Mac sound option in the GUI.
+class MacintoshMusicPlugin : public MusicPluginObject {
+public:
+	const char *getName() const override {
+		return _s("Apple Macintosh Audio");
+	}
+
+	const char *getId() const override {
+		return "mac";
+	}
+
+	MusicDevices getDevices() const override;
+	Common::Error createInstance(MidiDriver **mididriver, MidiDriver::DeviceHandle = 0) const override;
+};
+
+Common::Error MacintoshMusicPlugin::createInstance(MidiDriver **mididriver, MidiDriver::DeviceHandle) const {
+	*mididriver = nullptr;
+	return Common::kUnknownError;
+}
+
+MusicDevices MacintoshMusicPlugin::getDevices() const {
+	MusicDevices devices;
+	devices.push_back(MusicDevice(this, "", MT_MACINTOSH));
+	return devices;
+}
+
+//#if PLUGIN_ENABLED_DYNAMIC(NULL)
+	//REGISTER_PLUGIN_DYNAMIC(NULL, PLUGIN_TYPE_MUSIC, NullMusicPlugin);
+//#else
+	REGISTER_PLUGIN_STATIC(MACINTOSH, PLUGIN_TYPE_MUSIC, MacintoshMusicPlugin);
+//#endif
diff --git a/audio/mididrv.cpp b/audio/mididrv.cpp
index ad09a293dde..50b95777106 100644
--- a/audio/mididrv.cpp
+++ b/audio/mididrv.cpp
@@ -72,6 +72,7 @@ static const struct {
 	{ MT_SEGACD,	GUIO_MIDISEGACD },
 	{ MT_GM,		GUIO_MIDIGM },
 	{ MT_MT32,		GUIO_MIDIMT32 },
+	{ MT_MACINTOSH,	GUIO_MIDIMAC},
 	{ 0,			nullptr },
 };
 
@@ -190,6 +191,11 @@ MidiDriver::DeviceHandle MidiDriver::detectDevice(int flags) {
 			reslt = hdl;
 		break;
 
+	case MT_MACINTOSH:
+		if (flags & MDT_MACINTOSH)
+			reslt = hdl;
+		break;
+
 	case MT_SEGACD:
 	if (flags & MDT_SEGACD)
 		reslt = hdl;
@@ -357,6 +363,9 @@ MidiDriver::DeviceHandle MidiDriver::detectDevice(int flags) {
 		} else if (flags & MDT_APPLEIIGS) {
 			tp = MT_APPLEIIGS;
 			flags &= ~MDT_APPLEIIGS;
+		} else if (flags & MDT_MACINTOSH) {
+			tp = MT_MACINTOSH;
+			flags &= ~MDT_MACINTOSH;
 		} else if (flags & MDT_MIDI) {
 			// If we haven't tried to find a MIDI device yet we do this now.
 			skipMidi = false;
diff --git a/audio/mididrv.h b/audio/mididrv.h
index dd9981847cb..4f5f12a9f27 100644
--- a/audio/mididrv.h
+++ b/audio/mididrv.h
@@ -59,7 +59,8 @@ enum MusicType {
 	MT_MT32,			// MT-32
 	MT_GS,				// Roland GS
 	MT_MT540,			// Casio MT-540
-	MT_CT460			// Casio CT-460 / CSM-1
+	MT_CT460,			// Casio CT-460 / CSM-1
+	MT_MACINTOSH		// Apple Macintosh
 };
 
 /**
diff --git a/audio/module.mk b/audio/module.mk
index 8f7e9a77af3..309433766b1 100644
--- a/audio/module.mk
+++ b/audio/module.mk
@@ -7,6 +7,7 @@ MODULE_OBJS := \
 	casio.o \
 	cms.o \
 	fmopl.o \
+	mac_plugin.o \
 	mididrv.o \
 	mididrv_ms.o \
 	midiparser_qt.o \
diff --git a/base/plugins.cpp b/base/plugins.cpp
index 59b92601cbe..ebdfd65fd5e 100644
--- a/base/plugins.cpp
+++ b/base/plugins.cpp
@@ -147,6 +147,7 @@ public:
 		#endif
 		LINK_PLUGIN(AMIGA)
 		LINK_PLUGIN(APPLEIIGS)
+		LINK_PLUGIN(MACINTOSH)
 		LINK_PLUGIN(TOWNS)
 		LINK_PLUGIN(PC98)
 		LINK_PLUGIN(SEGACD)
diff --git a/common/gui_options.cpp b/common/gui_options.cpp
index 7733b9dbc16..e5280d7f1d4 100644
--- a/common/gui_options.cpp
+++ b/common/gui_options.cpp
@@ -57,6 +57,7 @@ const struct GameOpt {
 	{ GUIO_MIDISEGACD,   "midiSegaCD" },
 	{ GUIO_MIDIMT32,     "midiMt32" },
 	{ GUIO_MIDIGM,       "midiGM" },
+	{ GUIO_MIDIMAC,      "midiMac" },
 
 	{ GUIO_NOASPECT,     "noAspect" },
 
diff --git a/common/gui_options.h b/common/gui_options.h
index 9308f536fac..4da34344b4a 100644
--- a/common/gui_options.h
+++ b/common/gui_options.h
@@ -48,6 +48,7 @@
 #define GUIO_MIDISEGACD      "\x10"
 #define GUIO_MIDIMT32        "\x11"
 #define GUIO_MIDIGM          "\x12"
+#define GUIO_MIDIMAC		 "\x17"
 
 #define GUIO_NOASPECT        "\x13"
 
diff --git a/engines/scumm/detection_internal.h b/engines/scumm/detection_internal.h
index ce1a215dbf5..15d688afe44 100644
--- a/engines/scumm/detection_internal.h
+++ b/engines/scumm/detection_internal.h
@@ -868,6 +868,7 @@ static Common::String customizeGuiOptions(const DetectorResult &res) {
 		if (res.game.midi & (1 << i))
 			guiOptions += MidiDriver::musicType2GUIO(mtypes[i]);
 	}
+
 	if (res.game.midi & MDT_MIDI) {
 		guiOptions += MidiDriver::musicType2GUIO(MT_GM);
 		guiOptions += MidiDriver::musicType2GUIO(MT_MT32);
diff --git a/gui/options.cpp b/gui/options.cpp
index 863e9f54c76..c82f8797e00 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -1719,8 +1719,8 @@ void OptionsDialog::addAudioControls(GuiObject *boss, const Common::String &pref
 		for (MusicDevices::iterator d = i.begin(); d != i.end(); ++d) {
 			Common::String deviceGuiOption = MidiDriver::musicType2GUIO(d->getMusicType());
 
-			if ((_domain == Common::ConfigManager::kApplicationDomain && d->getMusicType() != MT_TOWNS  // global dialog - skip useless FM-Towns, C64, Amiga, AppleIIGS and SegaCD options there
-				 && d->getMusicType() != MT_C64 && d->getMusicType() != MT_AMIGA && d->getMusicType() != MT_APPLEIIGS && d->getMusicType() != MT_PC98 && d->getMusicType() != MT_SEGACD)
+			if ((_domain == Common::ConfigManager::kApplicationDomain && d->getMusicType() != MT_TOWNS  // global dialog - skip useless FM-Towns, C64, Amiga, AppleIIGS, Macintosh and SegaCD options there
+				 && d->getMusicType() != MT_C64 && d->getMusicType() != MT_AMIGA && d->getMusicType() != MT_APPLEIIGS && d->getMusicType() != MT_PC98 && d->getMusicType() != MT_MACINTOSH && d->getMusicType() != MT_SEGACD)
 				|| (_domain != Common::ConfigManager::kApplicationDomain && !hasMidiDefined) // No flags are specified
 				|| (_guioptions.contains(deviceGuiOption)) // flag is present
 				// HACK/FIXME: For now we have to show GM devices, even when the game only has GUIO_MIDIMT32 set,


Commit: 2a18e903cb3ec4f390b1a51577d8a6f81464ee3a
    https://github.com/scummvm/scummvm/commit/2a18e903cb3ec4f390b1a51577d8a6f81464ee3a
Author: athrxx (athrxx at scummvm.org)
Date: 2024-05-30T20:10:56+02:00

Commit Message:
SCUMM: (Amiga/Mac/C64) - improve launcher sound options

Changed paths:
    engines/scumm/detection_internal.h
    engines/scumm/detection_tables.h


diff --git a/engines/scumm/detection_internal.h b/engines/scumm/detection_internal.h
index 15d688afe44..d78b72ee7aa 100644
--- a/engines/scumm/detection_internal.h
+++ b/engines/scumm/detection_internal.h
@@ -862,38 +862,55 @@ static bool testGame(const GameSettings *g, const DescMap &fileMD5Map, const Com
 static Common::String customizeGuiOptions(const DetectorResult &res) {
 	Common::String guiOptions = res.game.guioptions;
 
-	static const uint mtypes[] = { MT_PCSPK, MT_CMS, MT_PCJR, MT_ADLIB, MT_C64, MT_AMIGA, MT_APPLEIIGS, MT_TOWNS, MT_PC98, MT_SEGACD };
+	int midiflags = res.game.midi;
+	// These games often have no detection entries of their own and therefore come with all the DOS audio options.
+	// We clear them here to avoid confusion and add the appropriate default sound option below. The games from
+	// version 5 onwards seem to have correct sound options in the detection tables.
+	if (res.game.version < 5 && (res.game.platform == Common::kPlatformAmiga || res.game.platform == Common::kPlatformMacintosh || res.game.platform == Common::kPlatformC64))
+		midiflags = MDT_NONE;
+
+	static const uint mtypes[] = {MT_PCSPK, MT_CMS, MT_PCJR, MT_ADLIB, MT_C64, MT_AMIGA, MT_APPLEIIGS, MT_TOWNS, MT_PC98, MT_SEGACD, 0, 0, 0, 0, MT_MACINTOSH};
 
 	for (int i = 0; i < ARRAYSIZE(mtypes); ++i) {
-		if (res.game.midi & (1 << i))
+		if (mtypes[i] && (midiflags & (1 << i)))
 			guiOptions += MidiDriver::musicType2GUIO(mtypes[i]);
 	}
 
-	if (res.game.midi & MDT_MIDI) {
+	if (midiflags & MDT_MIDI) {
 		guiOptions += MidiDriver::musicType2GUIO(MT_GM);
 		guiOptions += MidiDriver::musicType2GUIO(MT_MT32);
 	}
 	
 	Common::String defaultRenderOption = "";
+	Common::String defaultSoundOption = "";
 
-	// 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 default rendermode and sound option for target. We don't always put the default modes
+	// 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::kPlatformC64:
+		defaultRenderOption = GUIO_RENDERC64;
+		defaultSoundOption = GUIO_MIDIC64;
+		break;
 	case Common::kPlatformAmiga:
 		defaultRenderOption = GUIO_RENDERAMIGA;
+		defaultSoundOption = GUIO_MIDIAMIGA;
 		break;
 	case Common::kPlatformApple2GS:
 		defaultRenderOption = GUIO_RENDERAPPLE2GS;
+		// No default sound here, since we don't support it.
 		break;
 	case Common::kPlatformMacintosh:
 		defaultRenderOption = GUIO_RENDERMACINTOSH;
+		defaultSoundOption = GUIO_MIDIMAC;
 		break;
 	case Common::kPlatformFMTowns:
 		defaultRenderOption = GUIO_RENDERFMTOWNS;
+		// No default sound here, it is all in the detection tables.
 		break;
 	case Common::kPlatformAtariST:
 		defaultRenderOption = GUIO_RENDERATARIST;
+		// No default sound here, since we don't support it.
 		break;
 	case Common::kPlatformDOS:
 		defaultRenderOption = (!strcmp(res.extra, "EGA") || !strcmp(res.extra, "V1") || !strcmp(res.extra, "V2")) ? GUIO_RENDEREGA : GUIO_RENDERVGA;
@@ -912,6 +929,9 @@ static Common::String customizeGuiOptions(const DetectorResult &res) {
 	// detection tables) we don't add it again.
 	if (!guiOptions.contains(defaultRenderOption))
 		guiOptions += defaultRenderOption;
+	// Same for sound...
+	if (!defaultSoundOption.empty() && !guiOptions.contains(defaultSoundOption))
+		guiOptions += defaultSoundOption;
 
 	return guiOptions;
 }
diff --git a/engines/scumm/detection_tables.h b/engines/scumm/detection_tables.h
index 775e0edc0b0..2cebbf8d75a 100644
--- a/engines/scumm/detection_tables.h
+++ b/engines/scumm/detection_tables.h
@@ -193,7 +193,7 @@ static const GameSettings gameVariantsTable[] = {
 	{"monkey", "No AdLib", "ega", GID_MONKEY_EGA, 4, 0, MDT_PCSPK | MDT_PCJR,                        GF_16COLOR,     Common::kPlatformAtariST, GUIO4(GUIO_NOSPEECH, GUIO_NOMIDI, GUIO_ENHANCEMENTS, GUIO_ORIGINALGUI)},
 	{"monkey", "Demo",     "ega", GID_MONKEY_EGA, 4, 0, MDT_PCSPK | MDT_PCJR | MDT_CMS | MDT_ADLIB,            GF_16COLOR | GF_DEMO,     Common::kPlatformDOS, GUIO6(GUIO_NOSPEECH, GUIO_NOMIDI, GUIO_RENDERHERCGREEN, GUIO_RENDERHERCAMBER, GUIO_RENDERCGA, GUIO_ORIGINALGUI)},
 	{"monkey", "CD",           0, GID_MONKEY,     5, 0, MDT_ADLIB,                        GF_AUDIOTRACKS, UNK, GUIO5(GUIO_NOSPEECH, GUIO_NOMIDI, GUIO_RENDEREGA, GUIO_ENHANCEMENTS, GUIO_ORIGINALGUI)},
-	{"monkey", "Mac",    0, GID_MONKEY,     5, 0, MDT_ADLIB,                        0, UNK, GUIO4(GUIO_NOSPEECH, GUIO_NOMIDI, GUIO_ENHANCEMENTS, GUIO_ORIGINALGUI)},
+	{"monkey", "Mac",		   0, GID_MONKEY,     5, 0, MDT_MACINTOSH,                    0, UNK, GUIO4(GUIO_NOSPEECH, GUIO_NOMIDI, GUIO_ENHANCEMENTS, GUIO_ORIGINALGUI)},
 	{"monkey", "FM-TOWNS",     0, GID_MONKEY,     5, 0, MDT_TOWNS,                        GF_AUDIOTRACKS, Common::kPlatformFMTowns, GUIO6(GUIO_NOSPEECH, GUIO_NOMIDI, GUIO_MIDITOWNS, GUIO_TRIM_FMTOWNS_TO_200_PIXELS, GUIO_ENHANCEMENTS, GUIO_ORIGINALGUI)},
 	{"monkey", "SEGA",         0, GID_MONKEY,     5, 0, MDT_NONE,                         GF_AUDIOTRACKS, Common::kPlatformSegaCD, GUIO4(GUIO_NOSPEECH, GUIO_NOMIDI, GUIO_ENHANCEMENTS, GUIO_ORIGINALGUI)},
 	{"monkey", "SE Talkie",    0, GID_MONKEY,     5, 0, MDT_ADLIB | MDT_MIDI | MDT_PREFER_MT32, GF_AUDIOTRACKS | GF_ULTIMATE_TALKIE, UNK, GUIO2(GUIO_RENDEREGA, GUIO_ORIGINALGUI)},




More information about the Scummvm-git-logs mailing list