Use (undocumented) Mix_LoadMUS_RW to load music physfslayer
authorunc0rr
Sat, 17 Nov 2012 22:07:17 +0400
branchphysfslayer
changeset 8046 4d3415927d2c
parent 8043 da083f8d95e6
child 8049 133e22b5c410
Use (undocumented) Mix_LoadMUS_RW to load music
hedgewars/SDLh.pas
hedgewars/uPhysFSLayer.pas
hedgewars/uSound.pas
--- a/hedgewars/SDLh.pas	Sat Nov 17 00:41:30 2012 +0400
+++ b/hedgewars/SDLh.pas	Sat Nov 17 22:07:17 2012 +0400
@@ -1024,7 +1024,7 @@
 procedure Mix_FreeMusic(music: PMixMusic); cdecl; external SDL_MixerLibName;
 
 function  Mix_LoadWAV_RW(src: PSDL_RWops; freesrc: LongInt): PMixChunk; cdecl; external SDL_MixerLibName;
-function  Mix_LoadMUS(const filename: PChar): PMixMusic; cdecl; external SDL_MixerLibName;
+function  Mix_LoadMUS_RW(src: PSDL_RWops): PMixMusic; cdecl; external SDL_MixerLibName;
 
 function  Mix_Playing(channel: LongInt): LongInt; cdecl; external SDL_MixerLibName;
 function  Mix_PlayingMusic: LongInt; cdecl; external SDL_MixerLibName;
--- a/hedgewars/uPhysFSLayer.pas	Sat Nov 17 00:41:30 2012 +0400
+++ b/hedgewars/uPhysFSLayer.pas	Sat Nov 17 22:07:17 2012 +0400
@@ -102,7 +102,7 @@
     i:= PHYSFS_mount(Str2PChar(PathPrefix), nil, true);
     AddFileLog('[PhysFS] mount ' + PathPrefix + ': ' + inttostr(i));
     i:= PHYSFS_mount(Str2PChar(UserPathPrefix + '/Data'), nil, true);
-    AddFileLog('[PhysFS] mount ' + UserPathPrefix + ': ' + inttostr(i));
+    AddFileLog('[PhysFS] mount ' + UserPathPrefix + '/Data: ' + inttostr(i));
 end;
 
 procedure freeModule;
--- a/hedgewars/uSound.pas	Sat Nov 17 00:41:30 2012 +0400
+++ b/hedgewars/uSound.pas	Sat Nov 17 22:07:17 2012 +0400
@@ -416,12 +416,10 @@
     if (not isSoundEnabled) or (MusicFN = '') or (not isMusicEnabled) then
         exit;
 
-    s:= UserPathPrefix + '/Data/Music/' + MusicFN;
-    if not FileExists(s) then
-        s:= PathPrefix + '/Music/' + MusicFN;
+    s:= '/Music/' + MusicFN;
     WriteToConsole(msgLoading + s + ' ');
 
-    Mus:= Mix_LoadMUS(Str2PChar(s));
+    Mus:= Mix_LoadMUS_RW(rwopsOpenRead(s));
     SDLTry(Mus <> nil, false);
     WriteLnToConsole(msgOK);