diff --git a/Linux/CodeBlocks/QuakeSpasm-SDL2.cbp b/Linux/CodeBlocks/QuakeSpasm-SDL2.cbp
index c50d05ab..677cd6b3 100644
--- a/Linux/CodeBlocks/QuakeSpasm-SDL2.cbp
+++ b/Linux/CodeBlocks/QuakeSpasm-SDL2.cbp
@@ -267,13 +267,22 @@
+
+
+
+
+
-
+
+
+
+
+
diff --git a/Linux/CodeBlocks/QuakeSpasm.cbp b/Linux/CodeBlocks/QuakeSpasm.cbp
index 50abd5e7..1aa14c8f 100644
--- a/Linux/CodeBlocks/QuakeSpasm.cbp
+++ b/Linux/CodeBlocks/QuakeSpasm.cbp
@@ -266,13 +266,22 @@
+
+
+
+
+
-
+
+
+
+
+
diff --git a/MacOSX/QuakeSpasm.xcodeproj/project.pbxproj b/MacOSX/QuakeSpasm.xcodeproj/project.pbxproj
index c531f24a..f03530cc 100644
--- a/MacOSX/QuakeSpasm.xcodeproj/project.pbxproj
+++ b/MacOSX/QuakeSpasm.xcodeproj/project.pbxproj
@@ -105,6 +105,8 @@
48E2EC8815FB516600B8D476 /* libvorbis.dylib in Copy Libraries */ = {isa = PBXBuildFile; fileRef = 48E2EC7B15FB507A00B8D476 /* libvorbis.dylib */; };
48E2EC8915FB516600B8D476 /* libvorbisfile.dylib in Copy Libraries */ = {isa = PBXBuildFile; fileRef = 48E2EC7C15FB507A00B8D476 /* libvorbisfile.dylib */; };
48FE585B0D3A82C8006BB491 /* QuakeArguments.m in Sources */ = {isa = PBXBuildFile; fileRef = 48FE585A0D3A82C8006BB491 /* QuakeArguments.m */; };
+ 6314786F27F1AEBD0023B20A /* snd_modplug.c in Sources */ = {isa = PBXBuildFile; fileRef = 6314786E27F1AEB20023B20A /* snd_modplug.c */; };
+ 6314787127F1AEC00023B20A /* snd_modplug.c in Sources */ = {isa = PBXBuildFile; fileRef = 6314786E27F1AEB20023B20A /* snd_modplug.c */; };
6348AF8626EA45B900E036E2 /* miniz.c in Sources */ = {isa = PBXBuildFile; fileRef = 6348AF8426EA45B900E036E2 /* miniz.c */; };
6348AF8726EA45B900E036E2 /* miniz.c in Sources */ = {isa = PBXBuildFile; fileRef = 6348AF8426EA45B900E036E2 /* miniz.c */; };
6348AF9126EA46F500E036E2 /* snd_xmp.c in Sources */ = {isa = PBXBuildFile; fileRef = 6348AF8F26EA46F500E036E2 /* snd_xmp.c */; };
@@ -443,7 +445,7 @@
4846EB500D329BEB00A108DE /* platform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = platform.h; path = ../Quake/platform.h; sourceTree = SOURCE_ROOT; };
4847CD5E12057F94000B560F /* sys_sdl_unix.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sys_sdl_unix.c; path = ../Quake/sys_sdl_unix.c; sourceTree = SOURCE_ROOT; };
484AA4B30D3FF6C0005D917A /* QuakeSpasm.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = QuakeSpasm.icns; sourceTree = ""; };
- 4854B1B01340C646004C9F45 /* snd_mp3.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = snd_mp3.c; path = ../Quake/snd_mp3.c; sourceTree = SOURCE_ROOT; };
+ 4854B1B01340C646004C9F45 /* snd_mp3.c */ = {isa = PBXFileReference; comments = "NOTE: snd_mp3.c and snd_mpg123.c are mutually exclusive - build only one."; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = snd_mp3.c; path = ../Quake/snd_mp3.c; sourceTree = SOURCE_ROOT; };
486577C80D31A22A00E7920A /* snd_dma.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = snd_dma.c; path = ../Quake/snd_dma.c; sourceTree = SOURCE_ROOT; };
486577C90D31A22A00E7920A /* snd_mem.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = snd_mem.c; path = ../Quake/snd_mem.c; sourceTree = SOURCE_ROOT; };
486577CA0D31A22A00E7920A /* snd_mix.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = snd_mix.c; path = ../Quake/snd_mix.c; sourceTree = SOURCE_ROOT; };
@@ -475,7 +477,9 @@
48E2EC7C15FB507A00B8D476 /* libvorbisfile.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libvorbisfile.dylib; path = codecs/lib/libvorbisfile.dylib; sourceTree = ""; };
48FE58590D3A82C8006BB491 /* QuakeArguments.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QuakeArguments.h; sourceTree = ""; };
48FE585A0D3A82C8006BB491 /* QuakeArguments.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QuakeArguments.m; sourceTree = ""; };
- 631F459F26EA4AF60054208C /* snd_mpg123.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = snd_mpg123.c; path = ../Quake/snd_mpg123.c; sourceTree = SOURCE_ROOT; };
+ 6314786D27F1AE850023B20A /* snd_modplug.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = snd_modplug.h; path = ../Quake/snd_modplug.h; sourceTree = SOURCE_ROOT; };
+ 6314786E27F1AEB20023B20A /* snd_modplug.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = snd_modplug.c; path = ../Quake/snd_modplug.c; sourceTree = SOURCE_ROOT; };
+ 631F459F26EA4AF60054208C /* snd_mpg123.c */ = {isa = PBXFileReference; comments = "NOTE: snd_mp3.c and snd_mpg123.c are mutually exclusive - build only one."; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = snd_mpg123.c; path = ../Quake/snd_mpg123.c; sourceTree = SOURCE_ROOT; };
6348AF7D26EA437E00E036E2 /* default_cfg.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = default_cfg.h; path = ../Quake/default_cfg.h; sourceTree = SOURCE_ROOT; };
6348AF7E26EA438E00E036E2 /* arch_def.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = arch_def.h; path = ../Quake/arch_def.h; sourceTree = SOURCE_ROOT; };
6348AF7F26EA439C00E036E2 /* filenames.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = filenames.h; path = ../Quake/filenames.h; sourceTree = SOURCE_ROOT; };
@@ -745,6 +749,7 @@
63D6EB3423A255900047028C /* snd_mp3tag.c */,
4885A84A179740A0000EC703 /* snd_opus.c */,
483A78640D2EEAF000CB2E4C /* snd_mikmod.c */,
+ 6314786E27F1AEB20023B20A /* snd_modplug.c */,
6348AF8F26EA46F500E036E2 /* snd_xmp.c */,
4818B0B012D5BA1A006DD66E /* snd_umx.c */,
4818B0B212D5BA1A006DD66E /* snd_vorbis.c */,
@@ -842,6 +847,7 @@
4818B0AD12D5B9ED006DD66E /* snd_codec.h */,
4818B0AF12D5BA1A006DD66E /* snd_codeci.h */,
6348AF8C26EA46B700E036E2 /* snd_mikmod.h */,
+ 6314786D27F1AE850023B20A /* snd_modplug.h */,
6348AF9026EA46F500E036E2 /* snd_xmp.h */,
6348AF8D26EA46D300E036E2 /* snd_umx.h */,
48281300179C3F13004E1D61 /* snd_flac.h */,
@@ -1072,6 +1078,7 @@
63D6EB3623A255900047028C /* snd_mp3tag.c in Sources */,
6348AF8726EA45B900E036E2 /* miniz.c in Sources */,
6348AF9226EA46F500E036E2 /* snd_xmp.c in Sources */,
+ 6314786F27F1AEBD0023B20A /* snd_modplug.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -1161,6 +1168,7 @@
63D6EB3523A255900047028C /* snd_mp3tag.c in Sources */,
6348AF8626EA45B900E036E2 /* miniz.c in Sources */,
6348AF9126EA46F500E036E2 /* snd_xmp.c in Sources */,
+ 6314787127F1AEC00023B20A /* snd_modplug.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/MacOSX/QuakeSpasmPPC.xcodeproj/project.pbxproj b/MacOSX/QuakeSpasmPPC.xcodeproj/project.pbxproj
index 62e75d3f..ae3e09aa 100644
--- a/MacOSX/QuakeSpasmPPC.xcodeproj/project.pbxproj
+++ b/MacOSX/QuakeSpasmPPC.xcodeproj/project.pbxproj
@@ -105,6 +105,7 @@
48E2EC8815FB516600B8D476 /* libvorbis.dylib in Copy Libraries */ = {isa = PBXBuildFile; fileRef = 48E2EC7B15FB507A00B8D476 /* libvorbis.dylib */; };
48E2EC8915FB516600B8D476 /* libvorbisfile.dylib in Copy Libraries */ = {isa = PBXBuildFile; fileRef = 48E2EC7C15FB507A00B8D476 /* libvorbisfile.dylib */; };
48FE585B0D3A82C8006BB491 /* QuakeArguments.m in Sources */ = {isa = PBXBuildFile; fileRef = 48FE585A0D3A82C8006BB491 /* QuakeArguments.m */; };
+ 6314789727F1AF3C0023B20A /* snd_modplug.c in Sources */ = {isa = PBXBuildFile; fileRef = 6314789627F1AF3C0023B20A /* snd_modplug.c */; };
6339437D26EA495D000D25C3 /* miniz.c in Sources */ = {isa = PBXBuildFile; fileRef = 6339437B26EA495D000D25C3 /* miniz.c */; };
6339438726EA49FE000D25C3 /* snd_xmp.c in Sources */ = {isa = PBXBuildFile; fileRef = 6339438526EA49FE000D25C3 /* snd_xmp.c */; };
63D6EB5F23A2563B0047028C /* snd_mp3tag.c in Sources */ = {isa = PBXBuildFile; fileRef = 63D6EB5E23A2563B0047028C /* snd_mp3tag.c */; };
@@ -270,7 +271,7 @@
4846EB500D329BEB00A108DE /* platform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = platform.h; path = ../Quake/platform.h; sourceTree = SOURCE_ROOT; };
4847CD5E12057F94000B560F /* sys_sdl_unix.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sys_sdl_unix.c; path = ../Quake/sys_sdl_unix.c; sourceTree = SOURCE_ROOT; };
484AA4B30D3FF6C0005D917A /* QuakeSpasm.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = QuakeSpasm.icns; sourceTree = ""; };
- 4854B1B01340C646004C9F45 /* snd_mp3.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = snd_mp3.c; path = ../Quake/snd_mp3.c; sourceTree = SOURCE_ROOT; };
+ 4854B1B01340C646004C9F45 /* snd_mp3.c */ = {isa = PBXFileReference; comments = "NOTE: snd_mp3.c and snd_mpg123.c are mutually exclusive - build only one."; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = snd_mp3.c; path = ../Quake/snd_mp3.c; sourceTree = SOURCE_ROOT; };
486577C80D31A22A00E7920A /* snd_dma.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = snd_dma.c; path = ../Quake/snd_dma.c; sourceTree = SOURCE_ROOT; };
486577C90D31A22A00E7920A /* snd_mem.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = snd_mem.c; path = ../Quake/snd_mem.c; sourceTree = SOURCE_ROOT; };
486577CA0D31A22A00E7920A /* snd_mix.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = snd_mix.c; path = ../Quake/snd_mix.c; sourceTree = SOURCE_ROOT; };
@@ -302,6 +303,8 @@
48E2EC7C15FB507A00B8D476 /* libvorbisfile.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libvorbisfile.dylib; path = codecs/lib/libvorbisfile.dylib; sourceTree = ""; };
48FE58590D3A82C8006BB491 /* QuakeArguments.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QuakeArguments.h; sourceTree = ""; };
48FE585A0D3A82C8006BB491 /* QuakeArguments.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QuakeArguments.m; sourceTree = ""; };
+ 6314789527F1AF1A0023B20A /* snd_modplug.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = snd_modplug.h; path = ../Quake/snd_modplug.h; sourceTree = SOURCE_ROOT; };
+ 6314789627F1AF3C0023B20A /* snd_modplug.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = snd_modplug.c; path = ../Quake/snd_modplug.c; sourceTree = SOURCE_ROOT; };
6339437326EA48EA000D25C3 /* arch_def.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = arch_def.h; path = ../Quake/arch_def.h; sourceTree = SOURCE_ROOT; };
6339437626EA48F9000D25C3 /* default_cfg.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = default_cfg.h; path = ../Quake/default_cfg.h; sourceTree = SOURCE_ROOT; };
6339437726EA4907000D25C3 /* filenames.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = filenames.h; path = ../Quake/filenames.h; sourceTree = SOURCE_ROOT; };
@@ -318,7 +321,7 @@
6339438426EA49EA000D25C3 /* stb_image_write.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = stb_image_write.h; path = ../Quake/stb_image_write.h; sourceTree = SOURCE_ROOT; };
6339438526EA49FE000D25C3 /* snd_xmp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = snd_xmp.c; path = ../Quake/snd_xmp.c; sourceTree = SOURCE_ROOT; };
6339438626EA49FE000D25C3 /* snd_xmp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = snd_xmp.h; path = ../Quake/snd_xmp.h; sourceTree = SOURCE_ROOT; };
- 6339438826EA4A25000D25C3 /* snd_mpg123.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = snd_mpg123.c; path = ../Quake/snd_mpg123.c; sourceTree = SOURCE_ROOT; };
+ 6339438826EA4A25000D25C3 /* snd_mpg123.c */ = {isa = PBXFileReference; comments = "NOTE: snd_mp3.c and snd_mpg123.c are mutually exclusive - build only one."; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = snd_mpg123.c; path = ../Quake/snd_mpg123.c; sourceTree = SOURCE_ROOT; };
63D6EB5E23A2563B0047028C /* snd_mp3tag.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = snd_mp3tag.c; path = ../Quake/snd_mp3tag.c; sourceTree = SOURCE_ROOT; };
664D98FB19CF6B78000D395C /* Info copy.plist */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Info copy.plist"; sourceTree = ""; };
664D990519CF6E16000D395C /* SDL2.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = SDL2.framework; sourceTree = SOURCE_ROOT; };
@@ -545,6 +548,7 @@
63D6EB5E23A2563B0047028C /* snd_mp3tag.c */,
4885A84A179740A0000EC703 /* snd_opus.c */,
483A78640D2EEAF000CB2E4C /* snd_mikmod.c */,
+ 6314789627F1AF3C0023B20A /* snd_modplug.c */,
6339438526EA49FE000D25C3 /* snd_xmp.c */,
4818B0B012D5BA1A006DD66E /* snd_umx.c */,
4818B0B212D5BA1A006DD66E /* snd_vorbis.c */,
@@ -647,6 +651,7 @@
4818B0B312D5BA1A006DD66E /* snd_vorbis.h */,
4818B0B512D5BA1A006DD66E /* snd_wave.h */,
6339438226EA49CC000D25C3 /* snd_mikmod.h */,
+ 6314789527F1AF1A0023B20A /* snd_modplug.h */,
6339438626EA49FE000D25C3 /* snd_xmp.h */,
6339438326EA49DD000D25C3 /* snd_umx.h */,
);
@@ -827,6 +832,7 @@
63D6EB5F23A2563B0047028C /* snd_mp3tag.c in Sources */,
6339437D26EA495D000D25C3 /* miniz.c in Sources */,
6339438726EA49FE000D25C3 /* snd_xmp.c in Sources */,
+ 6314789727F1AF3C0023B20A /* snd_modplug.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/Quake/Makefile b/Quake/Makefile
index 864ada52..ff2bb9c4 100644
--- a/Quake/Makefile
+++ b/Quake/Makefile
@@ -16,9 +16,10 @@ USE_CODEC_FLAC=0
USE_CODEC_MP3=1
USE_CODEC_VORBIS=1
USE_CODEC_OPUS=0
-# either mikmod or xmp
+# either xmp or mikmod (or modplug)
USE_CODEC_MIKMOD=0
USE_CODEC_XMP=0
+USE_CODEC_MODPLUG=0
USE_CODEC_UMX=0
# which library to use for mp3 decoding: mad or mpg123
@@ -169,6 +170,10 @@ ifeq ($(USE_CODEC_XMP),1)
CFLAGS+= -DUSE_CODEC_XMP
CODECLIBS+= -lxmp
endif
+ifeq ($(USE_CODEC_MODPLUG),1)
+CFLAGS+= -DUSE_CODEC_MODPLUG
+CODECLIBS+= -lmodplug
+endif
ifeq ($(USE_CODEC_UMX),1)
CFLAGS+= -DUSE_CODEC_UMX
endif
@@ -205,6 +210,7 @@ MUSIC_OBJS:= bgmusic.o \
$(mp3_obj).o \
snd_mp3tag.o \
snd_mikmod.o \
+ snd_modplug.o \
snd_xmp.o \
snd_umx.o
COMOBJ_SND := snd_dma.o snd_mix.o snd_mem.o $(MUSIC_OBJS)
diff --git a/Quake/Makefile.darwin b/Quake/Makefile.darwin
index a7dddb1d..97aa88cd 100644
--- a/Quake/Makefile.darwin
+++ b/Quake/Makefile.darwin
@@ -18,9 +18,10 @@ USE_CODEC_FLAC=1
USE_CODEC_MP3=1
USE_CODEC_VORBIS=1
USE_CODEC_OPUS=1
-# either mikmod or xmp
+# either xmp or mikmod (or modplug)
USE_CODEC_MIKMOD=1
USE_CODEC_XMP=0
+USE_CODEC_MODPLUG=0
USE_CODEC_UMX=1
# which library to use for mp3 decoding: mad or mpg123
@@ -198,6 +199,12 @@ CODEC_INC = -I../MacOSX/codecs/include
CODEC_LINK= -L../MacOSX/codecs/lib
CODECLIBS+= -lxmp
endif
+ifeq ($(USE_CODEC_MODPLUG),1)
+CFLAGS+= -DUSE_CODEC_MODPLUG
+CODEC_INC = -I../MacOSX/codecs/include
+CODEC_LINK= -L../MacOSX/codecs/lib
+CODECLIBS+= -lmodplug
+endif
ifeq ($(USE_CODEC_UMX),1)
CFLAGS+= -DUSE_CODEC_UMX
endif
@@ -239,6 +246,7 @@ MUSIC_OBJS:= bgmusic.o \
$(mp3_obj).o \
snd_mp3tag.o \
snd_mikmod.o \
+ snd_modplug.o \
snd_xmp.o \
snd_umx.o
COMOBJ_SND := snd_dma.o snd_mix.o snd_mem.o $(MUSIC_OBJS)
diff --git a/Quake/Makefile.w32 b/Quake/Makefile.w32
index ba8686af..89700438 100644
--- a/Quake/Makefile.w32
+++ b/Quake/Makefile.w32
@@ -14,9 +14,10 @@ USE_CODEC_FLAC=1
USE_CODEC_MP3=1
USE_CODEC_VORBIS=1
USE_CODEC_OPUS=1
-# either mikmod or xmp
+# either xmp or mikmod (or modplug)
USE_CODEC_MIKMOD=1
USE_CODEC_XMP=0
+USE_CODEC_MODPLUG=0
USE_CODEC_UMX=1
# which library to use for mp3 decoding: mad or mpg123
@@ -157,6 +158,12 @@ CODEC_INC = -I../Windows/codecs/include
CODEC_LINK= -L../Windows/codecs/x86
CODECLIBS+= -lxmp
endif
+ifeq ($(USE_CODEC_MODPLUG),1)
+CFLAGS+= -DUSE_CODEC_MODPLUG
+CODEC_INC = -I../Windows/codecs/include
+CODEC_LINK= -L../Windows/codecs/x86
+CODECLIBS+= -lmodplug
+endif
ifeq ($(USE_CODEC_UMX),1)
CFLAGS+= -DUSE_CODEC_UMX
endif
@@ -196,6 +203,7 @@ MUSIC_OBJS:= bgmusic.o \
$(mp3_obj).o \
snd_mp3tag.o \
snd_mikmod.o \
+ snd_modplug.o \
snd_xmp.o \
snd_umx.o
COMOBJ_SND := snd_dma.o snd_mix.o snd_mem.o $(MUSIC_OBJS)
diff --git a/Quake/Makefile.w64 b/Quake/Makefile.w64
index 58282506..b79e046e 100644
--- a/Quake/Makefile.w64
+++ b/Quake/Makefile.w64
@@ -13,9 +13,10 @@ USE_CODEC_FLAC=1
USE_CODEC_MP3=1
USE_CODEC_VORBIS=1
USE_CODEC_OPUS=1
-# either mikmod or xmp
+# either xmp or mikmod (or modplug)
USE_CODEC_MIKMOD=1
USE_CODEC_XMP=0
+USE_CODEC_MODPLUG=0
USE_CODEC_UMX=1
# which library to use for mp3 decoding: mad or mpg123
@@ -150,6 +151,12 @@ CODEC_INC = -I../Windows/codecs/include
CODEC_LINK= -L../Windows/codecs/x64
CODECLIBS+= -lxmp
endif
+ifeq ($(USE_CODEC_MODPLUG),1)
+CFLAGS+= -DUSE_CODEC_MODPLUG
+CODEC_INC = -I../Windows/codecs/include
+CODEC_LINK= -L../Windows/codecs/x64
+CODECLIBS+= -lmodplug
+endif
ifeq ($(USE_CODEC_UMX),1)
CFLAGS+= -DUSE_CODEC_UMX
endif
@@ -189,6 +196,7 @@ MUSIC_OBJS:= bgmusic.o \
$(mp3_obj).o \
snd_mp3tag.o \
snd_mikmod.o \
+ snd_modplug.o \
snd_xmp.o \
snd_umx.o
COMOBJ_SND := snd_dma.o snd_mix.o snd_mem.o $(MUSIC_OBJS)
diff --git a/Quake/Makefile.wat b/Quake/Makefile.wat
index f581882c..e4f04876 100644
--- a/Quake/Makefile.wat
+++ b/Quake/Makefile.wat
@@ -1,5 +1,5 @@
# makefile to build quakespasm.exe for Windows using Open Watcom:
-# wmake -f OWMakefile.win32
+# wmake -f Makefile.wat
### Enable/disable SDL2
USE_SDL2=0
@@ -10,9 +10,10 @@ USE_CODEC_FLAC=1
USE_CODEC_MP3=1
USE_CODEC_VORBIS=1
USE_CODEC_OPUS=1
-# either mikmod or xmp
+# either xmp or mikmod (or modplug)
USE_CODEC_MIKMOD=1
USE_CODEC_XMP=0
+USE_CODEC_MODPLUG=0
USE_CODEC_UMX=1
# which library to use for mp3 decoding: mad or mpg123
@@ -102,6 +103,11 @@ CFLAGS+= -DUSE_CODEC_XMP
CFLAGS+= -DXMP_NO_DLL
CODECLIBS+= $(LIBCODEC)libxmp.lib
!endif
+!ifeq USE_CODEC_MODPLUG 1
+CFLAGS+= -DUSE_CODEC_MODPLUG
+CFLAGS+= -DMODPLUG_STATIC
+CODECLIBS+= $(LIBCODEC)modplug.lib
+!endif
!ifeq USE_CODEC_UMX 1
CFLAGS+= -DUSE_CODEC_UMX
!endif
@@ -145,6 +151,7 @@ MUSIC_OBJS= bgmusic.obj &
$(mp3_obj).obj &
snd_mp3tag.obj &
snd_mikmod.obj &
+ snd_modplug.obj &
snd_xmp.obj &
snd_umx.obj
COMOBJ_SND = snd_dma.obj snd_mix.obj snd_mem.obj $(MUSIC_OBJS)
diff --git a/Quake/snd_codec.c b/Quake/snd_codec.c
index a38c28cb..7c332e7f 100644
--- a/Quake/snd_codec.c
+++ b/Quake/snd_codec.c
@@ -29,6 +29,7 @@
/* headers for individual codecs */
#include "snd_mikmod.h"
+#include "snd_modplug.h"
#include "snd_xmp.h"
#include "snd_umx.h"
#include "snd_wave.h"
@@ -66,6 +67,9 @@ void S_CodecInit (void)
#ifdef USE_CODEC_UMX
S_CodecRegister(&umx_codec);
#endif
+#ifdef USE_CODEC_MODPLUG
+ S_CodecRegister(&modplug_codec);
+#endif
#ifdef USE_CODEC_MIKMOD
S_CodecRegister(&mikmod_codec);
#endif
diff --git a/Quake/snd_modplug.c b/Quake/snd_modplug.c
new file mode 100644
index 00000000..806c09a7
--- /dev/null
+++ b/Quake/snd_modplug.c
@@ -0,0 +1,125 @@
+/*
+ * tracker music (module file) decoding support using libmodplug
+ *
+ * Copyright (C) 2013 O.Sezer
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "quakedef.h"
+
+#if defined(USE_CODEC_MODPLUG)
+#include "snd_codec.h"
+#include "snd_codeci.h"
+#include "snd_modplug.h"
+#include
+
+static void S_MODPLUG_SetSettings (snd_stream_t *stream)
+{
+ ModPlug_Settings settings;
+
+ ModPlug_GetSettings(&settings);
+ settings.mFlags = MODPLUG_ENABLE_OVERSAMPLING;
+ settings.mChannels = shm->channels;
+ settings.mBits = shm->samplebits;
+ settings.mFrequency = shm->speed;
+ settings.mResamplingMode = MODPLUG_RESAMPLE_SPLINE;/*MODPLUG_RESAMPLE_FIR*/
+ settings.mLoopCount = -1; /* to enable module internal loops */
+ ModPlug_SetSettings(&settings);
+
+ if (stream) {
+ stream->info.rate = shm->speed;
+ stream->info.bits = shm->samplebits;
+ stream->info.width = stream->info.bits / 8;
+ stream->info.channels = shm->channels;
+ }
+}
+
+static qboolean S_MODPLUG_CodecInitialize (void)
+{
+ return true;
+}
+
+static void S_MODPLUG_CodecShutdown (void)
+{
+}
+
+static qboolean S_MODPLUG_CodecOpenStream (snd_stream_t *stream)
+{
+/* need to load the whole file into memory and pass it to libmodplug */
+ byte *moddata;
+ long len;
+ int mark;
+
+ len = FS_filelength (&stream->fh);
+ mark = Hunk_LowMark();
+ moddata = (byte *) Hunk_Alloc(len);
+ FS_fread(moddata, 1, len, &stream->fh);
+
+ S_MODPLUG_SetSettings(stream);
+ stream->priv = ModPlug_Load(moddata, len);
+ Hunk_FreeToLowMark(mark); /* free original file data */
+ if (!stream->priv)
+ {
+ Con_DPrintf("Could not load module %s\n", stream->name);
+ return false;
+ }
+
+ ModPlug_Seek((ModPlugFile*)stream->priv, 0);
+ /* default volume (128) sounds rather low? */
+ ModPlug_SetMasterVolume((ModPlugFile*)stream->priv, 384); /* 0-512 */
+ return true;
+}
+
+static int S_MODPLUG_CodecReadStream (snd_stream_t *stream, int bytes, void *buffer)
+{
+ return ModPlug_Read((ModPlugFile*)stream->priv, buffer, bytes);
+}
+
+static void S_MODPLUG_CodecCloseStream (snd_stream_t *stream)
+{
+ ModPlug_Unload((ModPlugFile*)stream->priv);
+ S_CodecUtilClose(&stream);
+}
+
+static int S_MODPLUG_CodecJumpToOrder (snd_stream_t *stream, int to)
+{
+ ModPlug_SeekOrder((ModPlugFile*)stream->priv, to);
+ return 0;
+}
+
+static int S_MODPLUG_CodecRewindStream (snd_stream_t *stream)
+{
+ ModPlug_Seek((ModPlugFile*)stream->priv, 0);
+ return 0;
+}
+
+snd_codec_t modplug_codec =
+{
+ CODECTYPE_MOD,
+ true, /* always available. */
+ "s3m",
+ S_MODPLUG_CodecInitialize,
+ S_MODPLUG_CodecShutdown,
+ S_MODPLUG_CodecOpenStream,
+ S_MODPLUG_CodecReadStream,
+ S_MODPLUG_CodecRewindStream,
+ S_MODPLUG_CodecJumpToOrder,
+ S_MODPLUG_CodecCloseStream,
+ NULL
+};
+
+#endif /* USE_CODEC_MODPLUG */
diff --git a/Quake/snd_modplug.h b/Quake/snd_modplug.h
new file mode 100644
index 00000000..40f6397b
--- /dev/null
+++ b/Quake/snd_modplug.h
@@ -0,0 +1,12 @@
+/* module tracker decoding support using libmodplug */
+#if !defined(_SND_MODPLUG_H_)
+#define _SND_MODPLUG_H_
+
+#if defined(USE_CODEC_MODPLUG)
+
+extern snd_codec_t modplug_codec;
+
+#endif /* USE_CODEC_MODPLUG */
+
+#endif /* ! _SND_MODPLUG_H_ */
+
diff --git a/Windows/CodeBlocks/QuakeSpasm-SDL2.cbp b/Windows/CodeBlocks/QuakeSpasm-SDL2.cbp
index 643cc803..34de08f0 100644
--- a/Windows/CodeBlocks/QuakeSpasm-SDL2.cbp
+++ b/Windows/CodeBlocks/QuakeSpasm-SDL2.cbp
@@ -285,13 +285,22 @@
+
+
+
+
+
-
+
+
++
++
+
diff --git a/Windows/CodeBlocks/QuakeSpasm.cbp b/Windows/CodeBlocks/QuakeSpasm.cbp
index 0bdb4bc5..26fc99cc 100644
--- a/Windows/CodeBlocks/QuakeSpasm.cbp
+++ b/Windows/CodeBlocks/QuakeSpasm.cbp
@@ -284,13 +284,22 @@
+
+
+
+
+
-
+
+
++
++
+
diff --git a/Windows/VisualStudio/quakespasm-sdl2.vcproj b/Windows/VisualStudio/quakespasm-sdl2.vcproj
index 2c61dd10..cfc921e9 100644
--- a/Windows/VisualStudio/quakespasm-sdl2.vcproj
+++ b/Windows/VisualStudio/quakespasm-sdl2.vcproj
@@ -561,6 +561,10 @@
RelativePath="..\..\Quake\snd_mix.c"
>
+
+
@@ -569,6 +573,42 @@
RelativePath="..\..\Quake\snd_mp3tag.c"
>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -843,6 +883,10 @@
RelativePath="..\..\Quake\snd_mikmod.h"
>
+
+
diff --git a/Windows/VisualStudio/quakespasm.vcproj b/Windows/VisualStudio/quakespasm.vcproj
index b1c00707..ff72e50a 100644
--- a/Windows/VisualStudio/quakespasm.vcproj
+++ b/Windows/VisualStudio/quakespasm.vcproj
@@ -561,6 +561,10 @@
RelativePath="..\..\Quake\snd_mix.c"
>
+
+
@@ -569,6 +573,42 @@
RelativePath="..\..\Quake\snd_mp3tag.c"
>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -847,6 +887,10 @@
RelativePath="..\..\Quake\snd_mikmod.h"
>
+
+