From 182ad45eae0db5e469f2e61e238eedad30dfa248 Mon Sep 17 00:00:00 2001 From: Miro Kropacek Date: Wed, 22 Apr 2026 00:44:03 +1000 Subject: [PATCH] AUDIO: Introduce DISABLE_MAME_OPL Similar to DISABLE_DOSBOX_OPL and DISABLE_NUKED_OPL. Now with the null driver available, weaker backends can be completely OPL emulation free. --- audio/fmopl.cpp | 4 ++++ audio/softsynth/opl/mame.cpp | 4 ++++ audio/softsynth/opl/mame.h | 4 ++++ base/commandLine.cpp | 8 +++++++- 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/audio/fmopl.cpp b/audio/fmopl.cpp index e24cfff6642..8eba28c3cea 100644 --- a/audio/fmopl.cpp +++ b/audio/fmopl.cpp @@ -81,7 +81,9 @@ OPL::OPL() { const Config::EmulatorDescription Config::_drivers[] = { { "auto", "", kAuto, kFlagOpl2 | kFlagDualOpl2 | kFlagOpl3 }, { "null", _s("None"), kNull, kFlagOpl2 | kFlagDualOpl2 | kFlagOpl3 }, +#ifndef DISABLE_MAME_OPL { "mame", _s("MAME OPL emulator"), kMame, kFlagOpl2 }, +#endif #ifndef DISABLE_DOSBOX_OPL { "db", _s("DOSBox OPL emulator"), kDOSBox, kFlagOpl2 | kFlagDualOpl2 | kFlagOpl3 }, #endif @@ -201,12 +203,14 @@ OPL *Config::create(DriverId driver, OplType type) { } switch (driver) { +#ifndef DISABLE_MAME_OPL case kMame: if (type == kOpl2) return new MAME::OPL(); else warning("MAME OPL emulator only supports OPL2 emulation"); return nullptr; +#endif #ifndef DISABLE_DOSBOX_OPL case kDOSBox: diff --git a/audio/softsynth/opl/mame.cpp b/audio/softsynth/opl/mame.cpp index e2ac8891b4b..59a5dde5fd5 100644 --- a/audio/softsynth/opl/mame.cpp +++ b/audio/softsynth/opl/mame.cpp @@ -22,6 +22,8 @@ * */ +#ifndef DISABLE_MAME_OPL + #include #include #include @@ -1253,3 +1255,5 @@ FM_OPL *makeAdLibOPL(int rate) { } // End of namespace MAME } // End of namespace OPL + +#endif // !DISABLE_MAME_OPL diff --git a/audio/softsynth/opl/mame.h b/audio/softsynth/opl/mame.h index b0968f965ad..c313564a732 100644 --- a/audio/softsynth/opl/mame.h +++ b/audio/softsynth/opl/mame.h @@ -26,6 +26,8 @@ #ifndef AUDIO_SOFTSYNTH_OPL_MAME_H #define AUDIO_SOFTSYNTH_OPL_MAME_H +#ifndef DISABLE_MAME_OPL + #include "common/scummsys.h" #include "common/random.h" @@ -196,4 +198,6 @@ protected: } // End of namespace MAME } // End of namespace OPL +#endif // !DISABLE_MAME_OPL + #endif diff --git a/base/commandLine.cpp b/base/commandLine.cpp index c6255f22648..1f5ae0583c6 100644 --- a/base/commandLine.cpp +++ b/base/commandLine.cpp @@ -180,7 +180,13 @@ static const char HELP_STRING4[] = " --enable-gs Enable Roland GS mode for MIDI playback\n" " --output-channels=CHANNELS Select output channel count (e.g. 2 for stereo)\n" " --output-rate=RATE Select output sample rate in Hz (e.g. 22050)\n" - " --opl-driver=DRIVER Select AdLib (OPL) emulator (db, mame" + " --opl-driver=DRIVER Select AdLib (OPL) emulator (" +#ifndef DISABLE_MAME_OPL + "mame" +#endif +#ifndef DISABLE_DOSBOX_OPL + ", db" +#endif #ifndef DISABLE_NUKED_OPL ", nuked" #endif