From b39c297762e002230b40d191a7a53f037caf9adb Mon Sep 17 00:00:00 2001 From: zicodxx <> Date: Mon, 14 Jun 2010 10:33:36 +0000 Subject: [PATCH] Small fix and improvement for Jukebox path detection --- CHANGELOG.txt | 1 + arch/sdl/jukebox.c | 23 ++++++++++++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index c8e4b2660..a85c837e5 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -3,6 +3,7 @@ D2X-Rebirth Changelog 20100614 -------- include/args.h, include/physfsx.h, main/inferno.c, main/menu.c, main/movie.c, main/songs.c, main/songs.h, main/switch.c, main/config.c, main/config.h, main/gameseq.c, main/digiobj.c, main/digi.h, main/game.c, main/gamecntl.c, misc/args.c, CHANGELOG.txt, d2x.ini, arch/sdl/digi_mixer.c, arch/sdl/digi_mixer_music.c, arch/sdl/init.c, arch/sdl/jukebox.c, arch/sdl/digi.c, arch/sdl/digi_audio.c, arch/include/digi_audio.h, arch/include/digi_mixer.h, arch/include/digi_mixer_music.h, arch/include/jukebox.h: Increased SDL_mixer music abilities to play non-hmp from HOGs, having Level-music path to play, options to specify non-level tracks and added various playing order methods; Abstracted SDL_mixer- and Redbook-interfaces; Simplified program flow through all music functions +arch/sdl/jukebox.c: Small fix and improvement for Jukebox path detection 20100503 -------- diff --git a/arch/sdl/jukebox.c b/arch/sdl/jukebox.c index f6a8b0147..e9c81a509 100644 --- a/arch/sdl/jukebox.c +++ b/arch/sdl/jukebox.c @@ -68,13 +68,26 @@ void jukebox_load() { strncat(GameCfg.CMLevelMusicPath, sep, PATH_MAX - 1 - strlen(GameCfg.CMLevelMusicPath)); } - PHYSFSX_getRealPath(GameCfg.CMLevelMusicPath,absolute_path); - PHYSFS_addToSearchPath(absolute_path, 0); - + PHYSFS_addToSearchPath(GameCfg.CMLevelMusicPath, 0); // as mountpoints are no option (yet), make sure only files originating from GameCfg.CMLevelMusicPath are aded to the list. - JukeboxSongs = PHYSFSX_findabsoluteFiles("", absolute_path, music_exts); + JukeboxSongs = PHYSFSX_findabsoluteFiles("", GameCfg.CMLevelMusicPath, music_exts); - if (JukeboxSongs != NULL) { + // If we do not find anything, try to see if given path is child of Searchpath + if (JukeboxSongs != NULL) + { + for (count = 0; JukeboxSongs[count]!=NULL; count++) {} + if (!count) + { + PHYSFSX_getRealPath(GameCfg.CMLevelMusicPath,absolute_path); + PHYSFS_addToSearchPath(absolute_path, 0); + JukeboxSongs = PHYSFSX_findabsoluteFiles("", absolute_path, music_exts); + } + } + + count = 0; + + if (JukeboxSongs != NULL) + { for (count = 0; JukeboxSongs[count]!=NULL; count++) {} if (count) {