From f75335567cd53be5f9e53b2df3357fa5e2c0887a Mon Sep 17 00:00:00 2001 From: Pavel Sountsov Date: Mon, 25 Nov 2024 19:08:06 -0800 Subject: [PATCH] Add a compatibility option for preferring DUMB over OpenMPT. --- addons/acodec/acodec.c | 14 +++++++++++++- addons/acodec/openmpt.c | 2 +- allegro5.cfg | 3 +++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/addons/acodec/acodec.c b/addons/acodec/acodec.c index bf8379249..646c2cec1 100644 --- a/addons/acodec/acodec.c +++ b/addons/acodec/acodec.c @@ -20,6 +20,12 @@ uint32_t al_get_allegro_acodec_version(void) */ bool al_init_acodec_addon(void) { + bool acodec_prefer_dumb = false; + const char* acodec_prefer_dumb_value = + al_get_config_value(al_get_system_config(), "compatibility", "acodec_prefer_dumb"); + if (acodec_prefer_dumb_value && strcmp(acodec_prefer_dumb_value, "true") == 0) + acodec_prefer_dumb = true; + bool ret = true; ret &= al_register_sample_loader(".wav", _al_load_wav); @@ -60,13 +66,19 @@ bool al_init_acodec_addon(void) #endif #ifdef ALLEGRO_CFG_ACODEC_DUMB - ret &= _al_register_dumb_loaders(); + if (!acodec_prefer_dumb) + ret &= _al_register_dumb_loaders(); #endif #ifdef ALLEGRO_CFG_ACODEC_OPENMPT ret &= _al_register_openmpt_loaders(); #endif +#ifdef ALLEGRO_CFG_ACODEC_DUMB + if (acodec_prefer_dumb) + ret &= _al_register_dumb_loaders(); +#endif + /* MP3 will mis-identify a lot of mod files, so put its identifier last */ #ifdef ALLEGRO_CFG_ACODEC_MP3 ret &= al_register_sample_loader(".mp3", _al_load_mp3); diff --git a/addons/acodec/openmpt.c b/addons/acodec/openmpt.c index 7224a2345..80fe54582 100644 --- a/addons/acodec/openmpt.c +++ b/addons/acodec/openmpt.c @@ -71,7 +71,7 @@ static int64_t stream_tell_func(void *stream) static void log_func(const char* message, void *user) { (void)user; - ALLEGRO_DEBUG("OpenMPT: %s", message); + ALLEGRO_DEBUG("OpenMPT: %s\n", message); } diff --git a/allegro5.cfg b/allegro5.cfg index 7f3752f46..7f529eee9 100644 --- a/allegro5.cfg +++ b/allegro5.cfg @@ -258,3 +258,6 @@ osx_tell_dock_outside_bundle = true # Allegro version that had the desired old behavior. # joystick_version = 5.2.9 # keyboard_version = 5.2.9 + +# Prefer using DUMB rather than OpenMPT to decode module files. +acodec_prefer_dumb = false