From 2f95d5933f9f95fa96ac13f8c104fe71f80ebab2 Mon Sep 17 00:00:00 2001 From: zicodxx <> Date: Mon, 5 Jul 2010 07:41:30 +0000 Subject: [PATCH] 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 --- CHANGELOG.txt | 1 + arch/sdl/digi_mixer_music.c | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index dc4480d55..1dba5e1e5 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -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 -------- diff --git a/arch/sdl/digi_mixer_music.c b/arch/sdl/digi_mixer_music.c index dc2011afd..1a62195b6 100644 --- a/arch/sdl/digi_mixer_music.c +++ b/arch/sdl/digi_mixer_music.c @@ -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(); }