Fixing issue introduced in rev1139: Game could of course not open music files which are not inside Searchpath or added to it - re-added playing over absolute path

This commit is contained in:
zicodxx 2010-07-05 07:41:30 +00:00
parent 8a7e7de051
commit 2f95d5933f
2 changed files with 9 additions and 3 deletions

View file

@ -3,6 +3,7 @@ D1X-Rebirth Changelog
20100705
--------
main/kconfig.c: Fixing issue when assigning mouse button if a citem is still pointed out; Fixing still processing key commands even if we want to assign a key
arch/sdl/digi_mixer_music.c: Fixing issue introduced in rev1139: Game could of course not open music files which are not inside Searchpath or added to it - re-added playing over absolute path
20100704
--------

View file

@ -72,7 +72,7 @@ int mix_play_file(char *filename, int loop, void (*hook_finished_track)())
{
SDL_RWops *rw = NULL;
PHYSFS_file *filehandle = NULL;
char tmp_file[PATH_MAX], real_filename[PATH_MAX], real_filename_absolute[PATH_MAX];
char tmp_file[PATH_MAX], real_filename[PATH_MAX];
char *basedir = "music", *fptr, *buf = NULL;
int bufsize = 0;
@ -101,7 +101,12 @@ int mix_play_file(char *filename, int loop, void (*hook_finished_track)())
loop = loop ? -1 : 1; // loop means loop infinitely, otherwise play once
filehandle = PHYSFS_openRead(real_filename);
// try loading music via given filename
current_music = Mix_LoadMUS(real_filename);
// no luck. so either it's in an archive or Searchpath
if (!current_music)
filehandle = PHYSFS_openRead(real_filename);
if (filehandle != NULL)
{
buf = realloc(buf, sizeof(char *)*PHYSFS_fileLength(filehandle));
@ -119,7 +124,7 @@ int mix_play_file(char *filename, int loop, void (*hook_finished_track)())
}
else
{
con_printf(CON_CRITICAL,"Music %s could not be loaded\n", real_filename_absolute);
con_printf(CON_CRITICAL,"Music %s could not be loaded\n", real_filename);
Mix_HaltMusic();
}