diff --git a/src/game_config.cc b/src/game_config.cc index 75620c2..5772982 100644 --- a/src/game_config.cc +++ b/src/game_config.cc @@ -4,6 +4,7 @@ #include #include +#include "db.h" #include "main.h" #include "platform_compat.h" @@ -121,6 +122,22 @@ bool gameConfigInit(bool isMapper, int argc, char** argv) configSetInt(&gGameConfig, GAME_CONFIG_MAPPER_KEY, GAME_CONFIG_SORT_SCRIPT_LIST_KEY, 0); } + // CE: Detect alternative default music directory. + char alternativeMusicPath[COMPAT_MAX_PATH]; + strcpy(alternativeMusicPath, "data\\sound\\music\\*.acm"); + compat_windows_path_to_native(alternativeMusicPath); + compat_resolve_path(alternativeMusicPath); + + char** acms; + int acmsLength = fileNameListInit(alternativeMusicPath, &acms, 0, 0); + if (acmsLength != -1) { + if (acmsLength > 0) { + configSetString(&gGameConfig, GAME_CONFIG_SOUND_KEY, GAME_CONFIG_MUSIC_PATH1_KEY, "data\\sound\\music\\"); + configSetString(&gGameConfig, GAME_CONFIG_SOUND_KEY, GAME_CONFIG_MUSIC_PATH2_KEY, "data\\sound\\music\\"); + } + fileNameListFree(&acms, 0); + } + // SFALL: Custom config file name. char* customConfigFileName = nullptr; configGetString(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_CONFIG_FILE, &customConfigFileName);