From: nyov Date: Sun, 16 Nov 2014 08:26:05 +0000 (+0000) Subject: Merge branch 'nyov/keep-modplug' into nyov/allthemodules X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=refs%2Fheads%2Fnyov%2Fallthemodules;p=xonotic%2Fdarkplaces.git Merge branch 'nyov/keep-modplug' into nyov/allthemodules --- b51a25413ba77e63604d81c731f672529e277604 diff --cc BSDmakefile index 8cf3315e,0472e345..95b89358 --- a/BSDmakefile +++ b/BSDmakefile @@@ -28,7 -28,7 +28,8 @@@ DP_LINK_JPEG?=share DP_LINK_ODE?=dlopen DP_LINK_CRYPTO?=dlopen DP_LINK_CRYPTO_RIJNDAEL?=dlopen +DP_LINK_XMP?=dlopen + DP_LINK_MODPLUG?=dlopen ###### Optional features ##### DP_CDDA?=enabled @@@ -127,15 -127,15 +128,24 @@@ LIB_CRYPTO_RIJNDAEL CFLAGS_CRYPTO_RIJNDAEL= .endif +# xmp +.if $(DP_LINK_XMP) == "shared" +CFLAGS_SND_XMP=-DLINK_TO_LIBXMP +LIB_SND_XMP=-lxmp +.else +CFLAGS_SND_XMP= +LIB_SND_XMP= +.endif + + # modplug + .if $(DP_LINK_MODPLUG) == "shared" + CFLAGS_SND_MODPLUG=-DLINK_TO_LIBMODPLUG + LIB_SND_MODPLUG=-lmodplug + .else + CFLAGS_SND_MODPLUG= + LIB_SND_MODPLUG= + .endif + .endif diff --cc makefile index 9dcc1644,e2bfdd5e..f479a5aa --- a/makefile +++ b/makefile @@@ -112,7 -112,7 +112,8 @@@ ifeq ($(DP_MAKE_TARGET), linux DP_LINK_ODE?=dlopen DP_LINK_CRYPTO?=dlopen DP_LINK_CRYPTO_RIJNDAEL?=dlopen + DP_LINK_XMP?=dlopen + DP_LINK_MODPLUG?=dlopen endif # Mac OS X configuration @@@ -148,7 -148,7 +149,8 @@@ ifeq ($(DP_MAKE_TARGET), macosx DP_LINK_ODE?=dlopen DP_LINK_CRYPTO?=dlopen DP_LINK_CRYPTO_RIJNDAEL?=dlopen + DP_LINK_XMP?=dlopen + DP_LINK_MODPLUG?=dlopen # on OS X, we don't build the CL by default because it uses deprecated # and not-implemented-in-64bit Carbon @@@ -190,7 -190,7 +192,8 @@@ ifeq ($(DP_MAKE_TARGET), sunos DP_LINK_ODE?=dlopen DP_LINK_CRYPTO?=dlopen DP_LINK_CRYPTO_RIJNDAEL?=dlopen + DP_LINK_XMP?=dlopen + DP_LINK_MODPLUG?=dlopen endif # BSD configuration @@@ -226,7 -226,7 +229,8 @@@ endi DP_LINK_ODE?=dlopen DP_LINK_CRYPTO?=dlopen DP_LINK_CRYPTO_RIJNDAEL?=dlopen + DP_LINK_XMP?=dlopen + DP_LINK_MODPLUG?=dlopen endif # Win32 configuration @@@ -286,7 -286,7 +290,8 @@@ ifeq ($(DP_MAKE_TARGET), mingw DP_LINK_ODE?=dlopen DP_LINK_CRYPTO?=dlopen DP_LINK_CRYPTO_RIJNDAEL?=dlopen + DP_LINK_XMP?=dlopen + DP_LINK_MODPLUG?=dlopen endif # set these to "" if you want to use dynamic loading instead @@@ -339,16 -339,17 +344,27 @@@ ifeq ($(DP_LINK_CRYPTO_RIJNDAEL), dlope CFLAGS_CRYPTO_RIJNDAEL= endif +# xmp +ifeq ($(DP_LINK_XMP), shared) + CFLAGS_SND_XMP=-DLINK_TO_LIBXMP + LIB_SND_XMP=-lxmp +endif +ifeq ($(DP_LINK_XMP), dlopen) + CFLAGS_SND_XMP= + LIB_SND_XMP= +endif + + # modplug + ifeq ($(DP_LINK_MODPLUG), shared) + CFLAGS_SND_MODPLUG=-DLINK_TO_LIBMODPLUG + LIB_SND_MODPLUG=-lmodplug + endif + ifeq ($(DP_LINK_MODPLUG), dlopen) + CFLAGS_SND_MODPLUG= + LIB_SND_MODPLUG= + endif + + ##### Sound configuration ##### ifndef DP_SOUND_API diff --cc makefile.inc index a8892fb5,7b793151..447e7a15 --- a/makefile.inc +++ b/makefile.inc @@@ -41,7 -41,7 +41,7 @@@ STRIP?=stri ###### Sound and audio CD ##### - OBJ_SND_COMMON=snd_main.o snd_mem.o snd_mix.o snd_ogg.o snd_wav.o snd_xmp.o -OBJ_SND_COMMON=snd_main.o snd_mem.o snd_mix.o snd_ogg.o snd_wav.o snd_modplug.o ++OBJ_SND_COMMON=snd_main.o snd_mem.o snd_mix.o snd_ogg.o snd_wav.o snd_xmp.o snd_modplug.o # No sound OBJ_SND_NULL=snd_null.o @@@ -49,23 -49,23 +49,23 @@@ LIB_SND_NULL # Open Sound System (Linux, FreeBSD and Solaris) OBJ_SND_OSS=$(OBJ_SND_COMMON) snd_oss.o - LIB_SND_OSS=$(LIB_SND_XMP) -LIB_SND_OSS=$(LIB_SND_MODPLUG) ++LIB_SND_OSS=$(LIB_SND_XMP) $(LIB_SND_MODPLUG) # Advanced Linux Sound Architecture (Linux) OBJ_SND_ALSA=$(OBJ_SND_COMMON) snd_alsa.o - LIB_SND_ALSA=-lasound $(LIB_SND_XMP) -LIB_SND_ALSA=-lasound $(LIB_SND_MODPLUG) ++LIB_SND_ALSA=-lasound $(LIB_SND_XMP) $(LIB_SND_MODPLUG) # Core Audio (Mac OS X) OBJ_SND_COREAUDIO=$(OBJ_SND_COMMON) snd_coreaudio.o - LIB_SND_COREAUDIO=-framework CoreAudio $(LIB_SND_XMP) -LIB_SND_COREAUDIO=-framework CoreAudio $(LIB_SND_MODPLUG) ++LIB_SND_COREAUDIO=-framework CoreAudio $(LIB_SND_XMP) $(LIB_SND_MODPLUG) # BSD / Sun audio API (NetBSD and OpenBSD) OBJ_SND_BSD=$(OBJ_SND_COMMON) snd_bsd.o - LIB_SND_BSD=$(LIB_SND_XMP) -LIB_SND_BSD=$(LIB_SND_MODPLUG) ++LIB_SND_BSD=$(LIB_SND_XMP) $(LIB_SND_MODPLUG) # DirectX and Win32 WAVE output (Win32) OBJ_SND_WIN=$(OBJ_SND_COMMON) snd_win.o - LIB_SND_WIN=$(LIB_SND_XMP) -LIB_SND_WIN=$(LIB_SND_MODPLUG) ++LIB_SND_WIN=$(LIB_SND_XMP) $(LIB_SND_MODPLUG) # Qantourisc's 3D Realtime Acoustic Lib (3D RAS) OBJ_SND_3DRAS=snd_3dras.o @@@ -207,12 -207,12 +207,12 @@@ OBJ_GLX= builddate.c sys_linux.o vid_gl LDFLAGS_UNIXCOMMON=-lm $(LIB_ODE) $(LIB_Z) $(LIB_JPEG) $(LIB_CRYPTO) $(LIB_CRYPTO_RIJNDAEL) LDFLAGS_UNIXCL=-L$(UNIX_X11LIBPATH) -lX11 -lXpm -lXext -lXxf86vm -pthread $(LIB_SOUND) - LDFLAGS_UNIXCL_PRELOAD=-lz -ljpeg -lpng -logg -ltheora -lvorbis -lvorbisenc -lvorbisfile -lcurl -lxmp -LDFLAGS_UNIXCL_PRELOAD=-lz -ljpeg -lpng -logg -ltheora -lvorbis -lvorbisenc -lvorbisfile -lcurl -lmodplug ++LDFLAGS_UNIXCL_PRELOAD=-lz -ljpeg -lpng -logg -ltheora -lvorbis -lvorbisenc -lvorbisfile -lcurl -lxmp -lmodplug LDFLAGS_UNIXSV_PRELOAD=-lz -ljpeg -lpng -lcurl - LDFLAGS_UNIXSDL_PRELOAD=-lz -ljpeg -lpng -logg -ltheora -lvorbis -lvorbisenc -lvorbisfile -lcurl -lxmp -LDFLAGS_UNIXSDL_PRELOAD=-lz -ljpeg -lpng -logg -ltheora -lvorbis -lvorbisenc -lvorbisfile -lcurl -lmodplug ++LDFLAGS_UNIXSDL_PRELOAD=-lz -ljpeg -lpng -logg -ltheora -lvorbis -lvorbisenc -lvorbisfile -lcurl -lxmp -lmodplug CFLAGS_UNIX_PRELOAD=-DPREFER_PRELOAD - LDFLAGS_UNIXSDL=$(SDLCONFIG_LIBS) $(LIB_SND_XMP) -LDFLAGS_UNIXSDL=$(SDLCONFIG_LIBS) $(LIB_SND_MODPLUG) ++LDFLAGS_UNIXSDL=$(SDLCONFIG_LIBS) $(LIB_SND_XMP) $(LIB_SND_MODPLUG) EXE_UNIXCL=darkplaces-glx EXE_UNIXSV=darkplaces-dedicated EXE_UNIXSDL=darkplaces-sdl @@@ -266,7 -266,7 +266,7 @@@ LDFLAGS_SUNOSSDL=$(LDFLAGS_UNIXCOMMON) # Link LDFLAGS_BSDCL=$(LDFLAGS_UNIXCOMMON) -lutil $(LDFLAGS_UNIXCL) --LDFLAGS_BSDSV=$(LDFLAGS_UNIXCOMMON) ++LDFLAGS_BSDSV=$(LDFLAGS_UNIXCOMMON) LDFLAGS_BSDSDL=$(LDFLAGS_UNIXCOMMON) $(LDFLAGS_UNIXSDL) @@@ -280,7 -280,7 +280,7 @@@ OBJ_WGL= builddate.c sys_win.o vid_wgl. # see LDFLAGS_WINCOMMON in makefile LDFLAGS_WINCL=$(LDFLAGS_WINCOMMON) $(LIB_CRYPTO) $(LIB_CRYPTO_RIJNDAEL) -mwindows -lwinmm -luser32 -lgdi32 -ldxguid -ldinput -lcomctl32 -lws2_32 $(LDFLAGS_D3D) $(LIB_Z) $(LIB_JPEG) LDFLAGS_WINSV=$(LDFLAGS_WINCOMMON) $(LIB_CRYPTO) $(LIB_CRYPTO_RIJNDAEL) -mconsole -lwinmm -lws2_32 $(LIB_Z) $(LIB_JPEG) - LDFLAGS_WINSDL=$(LDFLAGS_WINCOMMON) $(LIB_CRYPTO) $(LIB_CRYPTO_RIJNDAEL) $(SDLCONFIG_LIBS) $(LIB_SND_XMP) -lwinmm -lws2_32 $(LIB_Z) $(LIB_JPEG) -LDFLAGS_WINSDL=$(LDFLAGS_WINCOMMON) $(LIB_CRYPTO) $(LIB_CRYPTO_RIJNDAEL) $(SDLCONFIG_LIBS) $(LIB_SND_MODPLUG) -lwinmm -lws2_32 $(LIB_Z) $(LIB_JPEG) ++LDFLAGS_WINSDL=$(LDFLAGS_WINCOMMON) $(LIB_CRYPTO) $(LIB_CRYPTO_RIJNDAEL) $(SDLCONFIG_LIBS) $(LIB_SND_XMP) $(LIB_SND_MODPLUG) -lwinmm -lws2_32 $(LIB_Z) $(LIB_JPEG) EXE_WINCL=darkplaces.exe EXE_WINSV=darkplaces-dedicated.exe EXE_WINSDL=darkplaces-sdl.exe @@@ -490,10 -490,10 +490,14 @@@ prepare $(CMD_CP) makefile.inc $(BUILD_DIR)/ $(CMD_CP) $(MAKEFILE) $(BUILD_DIR)/ +snd_xmp.o: snd_xmp.c + $(CHECKLEVEL2) + $(DO_CC) $(CFLAGS_SND_XMP) + + snd_modplug.o: snd_modplug.c + $(CHECKLEVEL2) + $(DO_CC) $(CFLAGS_SND_MODPLUG) + #this checks USEODE when compiling so it needs the ODE flags as well prvm_cmds.o: prvm_cmds.c $(CHECKLEVEL2) diff --cc snd_main.c index e4c8a1ee,325d3dfb..a73a5946 --- a/snd_main.c +++ b/snd_main.c @@@ -23,7 -23,7 +23,8 @@@ Foundation, Inc., 59 Temple Place - Sui #include "snd_main.h" #include "snd_ogg.h" +#include "snd_xmp.h" + #include "snd_modplug.h" #include "csprogs.h" #include "cl_collision.h" #ifdef CONFIG_CD @@@ -917,7 -917,7 +918,8 @@@ void S_Init(void memset(channels, 0, MAX_CHANNELS * sizeof(channel_t)); OGG_OpenLibrary (); + XMP_OpenLibrary (); + ModPlug_OpenLibrary (); } @@@ -931,7 -931,7 +933,8 @@@ Shutdown and free all resource void S_Terminate (void) { S_Shutdown (); + ModPlug_CloseLibrary (); + XMP_CloseLibrary (); OGG_CloseLibrary (); // Free all SFXs diff --cc snd_mem.c index 2e5ae02d,8778b0cc..2cd9b144 --- a/snd_mem.c +++ b/snd_mem.c @@@ -24,7 -24,7 +24,8 @@@ Foundation, Inc., 59 Temple Place - Sui #include "snd_main.h" #include "snd_ogg.h" #include "snd_wav.h" +#include "snd_xmp.h" + #include "snd_modplug.h" /* @@@ -344,10 -344,10 +345,13 @@@ qboolean S_LoadSound (sfx_t *sfx, qbool if (OGG_LoadVorbisFile (namebuffer, sfx)) goto loaded; } - else + else if (len >= 1) { + if (XMP_LoadModFile (namebuffer, sfx)) + goto loaded; ++ + if (ModPlug_LoadModPlugFile (namebuffer, sfx)) + goto loaded; } } @@@ -368,10 -368,10 +372,13 @@@ if (OGG_LoadVorbisFile (namebuffer, sfx)) goto loaded; } - else + else if (len >= 1) { + if (XMP_LoadModFile (namebuffer, sfx)) + goto loaded; ++ + if (ModPlug_LoadModPlugFile (namebuffer, sfx)) + goto loaded; } // Can't load the sound!