From 347c28b71ac754aee20f8eeeae1df1a3b9a49d10 Mon Sep 17 00:00:00 2001 From: rubidium Date: Sun, 17 Jun 2007 15:48:57 +0000 Subject: (svn r10182) -Codechange: rewrite most part of the file loading/searching to be more flexible. -Codechange: add support for personal directories on Windows. -Fix [FS#153, FS#193, FS#502, FS#816, FS#854]: fix issues related to fixed names, fixed places of files/directories and application bundles. --- src/music_gui.cpp | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) (limited to 'src/music_gui.cpp') diff --git a/src/music_gui.cpp b/src/music_gui.cpp index 8566a9aa2..0d932cb26 100644 --- a/src/music_gui.cpp +++ b/src/music_gui.cpp @@ -7,6 +7,7 @@ #include "table/strings.h" #include "table/sprites.h" #include "functions.h" +#include "fileio.h" #include "window.h" #include "gfx.h" #include "sound.h" @@ -90,9 +91,9 @@ static void MusicVolumeChanged(byte new_vol) static void DoPlaySong() { - char filename[256]; - snprintf(filename, sizeof(filename), "%s%s", - _paths.gm_dir, origin_songs_specs[_music_wnd_cursong - 1].filename); + char filename[MAX_PATH]; + FioFindFullPath(filename, lengthof(filename), GM_DIR, + origin_songs_specs[_music_wnd_cursong - 1].filename); _music_driver->play_song(filename); } @@ -105,20 +106,14 @@ static void SelectSongToPlay() { uint i = 0; uint j = 0; - char filename[256]; memset(_cur_playlist, 0, sizeof(_cur_playlist)); do { - if (_playlists[msf.playlist][i] != 0) { // Don't evaluate playlist terminator - snprintf(filename, sizeof(filename), "%s%s", - _paths.gm_dir, origin_songs_specs[(_playlists[msf.playlist][i]) - 1].filename); - - /* we are now checking for the existence of that file prior - * to add it to the list of available songs */ - if (FileExists(filename)) { - _cur_playlist[j] = _playlists[msf.playlist][i]; - j++; - } + /* We are now checking for the existence of that file prior + * to add it to the list of available songs */ + if (FioCheckFileExists(origin_songs_specs[_playlists[msf.playlist][i]].filename, GM_DIR)) { + _cur_playlist[j] = _playlists[msf.playlist][i]; + j++; } } while (_playlists[msf.playlist][i++] != 0 && i < lengthof(_cur_playlist) - 1); -- cgit v1.2.3-54-g00ecf