Skip to content

Commit

Permalink
Add a compatibility option for preferring DUMB over OpenMPT.
Browse files Browse the repository at this point in the history
  • Loading branch information
SiegeLordEx authored and SiegeLord committed Nov 26, 2024
1 parent 1c4cfe7 commit f753355
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
14 changes: 13 additions & 1 deletion addons/acodec/acodec.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion addons/acodec/openmpt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}


Expand Down
3 changes: 3 additions & 0 deletions allegro5.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit f753355

Please sign in to comment.