diff options
| -rw-r--r-- | WinQuake/Makefile | 91 | ||||
| -rw-r--r-- | WinQuake/cvar.h | 6 | ||||
| -rw-r--r-- | WinQuake/debug/cd_linux.o | bin | 7640 -> 0 bytes | |||
| -rw-r--r-- | WinQuake/debug/chase.o | bin | 2788 -> 0 bytes | |||
| -rw-r--r-- | WinQuake/debug/cl_demo.o | bin | 6412 -> 0 bytes | |||
| -rw-r--r-- | WinQuake/debug/cl_input.o | bin | 12136 -> 0 bytes | |||
| -rw-r--r-- | WinQuake/debug/cl_main.o | bin | 12348 -> 0 bytes | |||
| -rw-r--r-- | WinQuake/debug/cl_parse.o | bin | 15316 -> 0 bytes | |||
| -rw-r--r-- | WinQuake/debug/cl_tent.o | bin | 6940 -> 0 bytes | |||
| -rw-r--r-- | WinQuake/debug/cmd.o | bin | 9572 -> 0 bytes | |||
| -rw-r--r-- | WinQuake/debug/common.o | bin | 23340 -> 0 bytes | |||
| -rw-r--r-- | WinQuake/debug/console.o | bin | 9512 -> 0 bytes | |||
| -rw-r--r-- | WinQuake/debug/crc.o | bin | 1716 -> 0 bytes | |||
| -rw-r--r-- | WinQuake/debug/cvar.o | bin | 3900 -> 0 bytes | |||
| -rw-r--r-- | WinQuake/debug/gl_draw.o | bin | 20128 -> 0 bytes | |||
| -rw-r--r-- | WinQuake/debug/gl_mesh.o | bin | 5956 -> 0 bytes | |||
| -rw-r--r-- | WinQuake/debug/gl_model.o | bin | 23368 -> 0 bytes | |||
| -rw-r--r-- | WinQuake/debug/gl_refrag.o | bin | 2628 -> 0 bytes | |||
| -rw-r--r-- | WinQuake/debug/gl_rlight.o | bin | 5300 -> 0 bytes | |||
| -rw-r--r-- | WinQuake/debug/gl_rmain.o | bin | 38656 -> 0 bytes | |||
| -rw-r--r-- | WinQuake/debug/gl_rmisc.o | bin | 9804 -> 0 bytes | |||
| -rw-r--r-- | WinQuake/debug/gl_rsurf.o | bin | 20416 -> 0 bytes | |||
| -rw-r--r-- | WinQuake/debug/gl_screen.o | bin | 14100 -> 0 bytes | |||
| -rw-r--r-- | WinQuake/debug/gl_test.o | bin | 647 -> 0 bytes | |||
| -rw-r--r-- | WinQuake/debug/gl_vidlinuxglx.o | bin | 21340 -> 0 bytes | |||
| -rw-r--r-- | WinQuake/debug/gl_warp.o | bin | 7476 -> 0 bytes | |||
| -rw-r--r-- | WinQuake/debug/host.o | bin | 17456 -> 0 bytes | |||
| -rw-r--r-- | WinQuake/debug/host_cmd.o | bin | 29116 -> 0 bytes | |||
| -rw-r--r-- | WinQuake/debug/keys.o | bin | 10648 -> 0 bytes | |||
| -rw-r--r-- | WinQuake/debug/math.o | bin | 1788 -> 0 bytes | |||
| -rw-r--r-- | WinQuake/debug/mathlib.o | bin | 5900 -> 0 bytes | |||
| -rw-r--r-- | WinQuake/debug/menu.o | bin | 60312 -> 0 bytes | |||
| -rw-r--r-- | WinQuake/debug/net_bsd.o | bin | 3928 -> 0 bytes | |||
| -rw-r--r-- | WinQuake/debug/net_dgrm.o | bin | 22472 -> 0 bytes | |||
| -rw-r--r-- | WinQuake/debug/net_loop.o | bin | 4192 -> 0 bytes | |||
| -rw-r--r-- | WinQuake/debug/net_main.o | bin | 15804 -> 0 bytes | |||
| -rw-r--r-- | WinQuake/debug/net_udp.o | bin | 6628 -> 0 bytes | |||
| -rw-r--r-- | WinQuake/debug/net_vcr.o | bin | 3372 -> 0 bytes | |||
| -rw-r--r-- | WinQuake/debug/pr_cmds.o | bin | 22508 -> 0 bytes | |||
| -rw-r--r-- | WinQuake/debug/pr_edict.o | bin | 18568 -> 0 bytes | |||
| -rw-r--r-- | WinQuake/debug/pr_exec.o | bin | 9636 -> 0 bytes | |||
| -rw-r--r-- | WinQuake/debug/r_part.o | bin | 12420 -> 0 bytes | |||
| -rw-r--r-- | WinQuake/debug/sbar.o | bin | 21232 -> 0 bytes | |||
| -rw-r--r-- | WinQuake/debug/snd_dma.o | bin | 14468 -> 0 bytes | |||
| -rw-r--r-- | WinQuake/debug/snd_linux.o | bin | 5072 -> 0 bytes | |||
| -rw-r--r-- | WinQuake/debug/snd_mem.o | bin | 5128 -> 0 bytes | |||
| -rw-r--r-- | WinQuake/debug/snd_mix.o | bin | 3236 -> 0 bytes | |||
| -rw-r--r-- | WinQuake/debug/snd_mixa.o | bin | 1468 -> 0 bytes | |||
| -rw-r--r-- | WinQuake/debug/sv_main.o | bin | 18472 -> 0 bytes | |||
| -rw-r--r-- | WinQuake/debug/sv_move.o | bin | 7296 -> 0 bytes | |||
| -rw-r--r-- | WinQuake/debug/sv_phys.o | bin | 16120 -> 0 bytes | |||
| -rw-r--r-- | WinQuake/debug/sv_user.o | bin | 10420 -> 0 bytes | |||
| -rw-r--r-- | WinQuake/debug/sys_dosa.o | bin | 1080 -> 0 bytes | |||
| -rw-r--r-- | WinQuake/debug/sys_linux.o | bin | 8016 -> 0 bytes | |||
| -rw-r--r-- | WinQuake/debug/view.o | bin | 16852 -> 0 bytes | |||
| -rw-r--r-- | WinQuake/debug/wad.o | bin | 2732 -> 0 bytes | |||
| -rw-r--r-- | WinQuake/debug/world.o | bin | 10292 -> 0 bytes | |||
| -rw-r--r-- | WinQuake/debug/worlda.o | bin | 812 -> 0 bytes | |||
| -rw-r--r-- | WinQuake/debug/zone.o | bin | 11900 -> 0 bytes | |||
| -rw-r--r-- | WinQuake/snd_dma.c | 13 | ||||
| -rw-r--r-- | WinQuake/snd_sdl.c | 213 | ||||
| -rw-r--r-- | WinQuake/sound.h | 6 |
62 files changed, 308 insertions, 21 deletions
diff --git a/WinQuake/Makefile b/WinQuake/Makefile index c23e812..4f111f5 100644 --- a/WinQuake/Makefile +++ b/WinQuake/Makefile @@ -6,6 +6,21 @@ # ELF only # +# wyatt: sdl2 audio, mostly borrowed from quakespasm with some tweaks for +# otherwise-vanilla Quake. +# _comment out_ USE_SDL2 definitions to disable (falls back to OSS DMA sound). +# non-1 values might work for SDL 1.x support, but this is currently +# untested (though likely to work). +USE_SDL2=1 + +ifeq ($(USE_SDL2),1) +SDL_CONFIG ?= sdl2-config +else +SDL_CONFIG ?= sdl-config +endif +SDL_CFLAGS := $(shell $(SDL_CONFIG) --cflags) -DUSE_SDL2 +SDL_LIBS := $(shell $(SDL_CONFIG) --libs) + BASEVERSION=1.09 VERSION=$(BASEVERSION)$(GLIBC) @@ -22,7 +37,8 @@ ARCH=i386 endif NOARCH=noarch -MOUNT_DIR=/home/wyatt/development/q1source/WinQuake +# Edit this path, or you probably will run into trouble. +MOUNT_DIR=/home/wyatt/development/Quake-LinuxUpdate/WinQuake MASTER_DIR=/grog/Projects/QuakeMaster MESA_DIR=/usr/local/src/Mesa-2.6 @@ -32,25 +48,33 @@ BUILD_RELEASE_DIR=release$(ARCH)$(GLIBC) EGCS=/usr/bin/gcc CC=$(EGCS) -BASE_CFLAGS=-Dstricmp=strcasecmp -RELEASE_CFLAGS=$(BASE_CFLAGS) -g -mtune=corei7 -O3 -march=corei7 +# GCC 10 seems to require -no-pie to function properly. It _definitely_ +# does require -fcommon. -m32 is because I am building on a 64-bit machine +# and this game still has some i386 (32-bit) assembly that I haven't replaced +# or otherwise added alternative, portable code for. +# Hopefully, I'll be able to run this game on PowerPC some day. +BASE_CFLAGS=-Dstricmp=strcasecmp -m32 -fcommon -no-pie +# might have to change these, too, if you are on another architecture or +# cross-compiling (don't use 'native'): +RELEASE_CFLAGS=$(BASE_CFLAGS) -g -mtune=native -O3 -march=native +# note that powerpc uses -mcpu instead of -march, if I ever do port it. DEBUG_CFLAGS=$(BASE_CFLAGS) -g -LDFLAGS=-lm +LDFLAGS=-lm -m32 SVGALDFLAGS=-lvga -XLDFLAGS=-L/usr/X11R6/lib -lX11 -lXext -lXxf86dga +XLDFLAGS=-L/usr/X11R6/lib -lX11 -lXext /usr/lib/i386-linux-gnu/libXxf86dga.so.1.0.0 XCFLAGS=-DX11 -#MESAGLLDFLAGS=-L/usr/X11/lib -L/usr/local/lib -L$(MESA_DIR)/lib -lMesaGL -lglide2x -lX11 -lXext -ldl -MESAGLLDFLAGS=-L/usr/X11/lib -L/usr/local/lib -L$(MESA_DIR)/lib -lMesaGL -lX11 -lXext -ldl -GLLDFLAGS=-L/usr/X11/lib -L/usr/local/lib -lGL -lX11 -lXext -ldl -lXxf86dga -lXxf86vm -lm -GLCFLAGS=-DGLQUAKE -I$(MESA_DIR)/include -I/usr/src/linux-headers-3.5.0-44-generic/include -I/usr/src/linux-headers-3.5.0-44/arch/x86/include -I/usr/include/glide +MESAGLLDFLAGS=-L/usr/lib/X11 -L/usr/local/lib -L$(MESA_DIR)/lib -lMesaGL -lglide2x -lX11 -lXext -ldl +TDFXGLLDFLAGS=-L$(TDFXGL_DIR)/release$(ARCH)$(GLIBC) -l3dfxgl -lglide2x -ldl +GLLDFLAGS=-L/usr/X11/lib -L/usr/local/lib -lGL -lX11 -lXext -ldl /usr/lib/i386-linux-gnu/libXxf86dga.so.1.0.0 /usr/lib/i386-linux-gnu/libXxf86vm.so.1.0.0 -lm +GLCFLAGS=-DGLQUAKE -I$(MESA_DIR)/include -I/usr/include/glide DO_CC=$(CC) $(CFLAGS) -o $@ -c $< DO_DEBUG_CC=$(CC) $(DEBUG_CFLAGS) -o $@ -c $< -DO_GL_CC=$(CC) $(CFLAGS) $(GLCFLAGS) -o $@ -c $< -DO_GL_DEBUG_CC=$(CC) $(DEBUG_CFLAGS) $(GLCFLAGS) -o $@ -c $< -DO_X11_CC=$(CC) $(CFLAGS) $(XCFLAGS) -o $@ -c $< -DO_X11_DEBUG_CC=$(CC) $(DEBUG_CFLAGS) $(XCFLAGS) -o $@ -c $< +DO_GL_CC=$(CC) $(CFLAGS) $(GLCFLAGS) $(SDL_CFLAGS) -o $@ -c $< +DO_GL_DEBUG_CC=$(CC) $(DEBUG_CFLAGS) $(GLCFLAGS) $(SDL_CFLAGS) -o $@ -c $< +DO_X11_CC=$(CC) $(CFLAGS) $(XCFLAGS) $(SDL_CFLAGS) -o $@ -c $< +DO_X11_DEBUG_CC=$(CC) $(DEBUG_CFLAGS) $(XCFLAGS) $(SDL_CFLAGS) -o $@ -c $< DO_O_CC=$(CC) -O $(CFLAGS) -o $@ -c $< DO_AS=$(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $< DO_GL_AS=$(CC) $(CFLAGS) $(GLCFLAGS) -DELF -x assembler-with-cpp -o $@ -c $< @@ -59,7 +83,11 @@ DO_GL_AS=$(CC) $(CFLAGS) $(GLCFLAGS) -DELF -x assembler-with-cpp -o $@ -c $< # SETUP AND BUILD ############################################################################# -TARGETS=$(BUILDDIR)/bin/glquake.glx +# GLQuake build: +# TARGETS=$(BUILDDIR)/bin/glquake.glx + +# X11 Quake (software-rendered) build: +TARGETS=$(BUILDDIR)/bin/quake.x11 build_debug: @-mkdir $(BUILD_DEBUG_DIR) \ @@ -86,6 +114,8 @@ targets: $(TARGETS) ############################################################################# # X11 Quake ############################################################################# +# REPLACED snd_linux.o with snd_sdl.o from quakespasm +# $(BUILDDIR)/x11/snd_linux.o \ X11_OBJS = \ $(BUILDDIR)/x11/cl_demo.o \ @@ -158,7 +188,6 @@ X11_OBJS = \ $(BUILDDIR)/x11/snd_dma.o \ $(BUILDDIR)/x11/snd_mem.o \ $(BUILDDIR)/x11/snd_mix.o \ - $(BUILDDIR)/x11/snd_linux.o \ \ $(BUILDDIR)/x11/d_draw.o \ $(BUILDDIR)/x11/d_draw16.o \ @@ -179,8 +208,18 @@ X11_OBJS = \ $(BUILDDIR)/x11/snd_mixa.o \ $(BUILDDIR)/x11/sys_dosa.o +ifeq ($(USE_SDL2),1) +# sdl sound +X11_OBJS := $(X11_OBJS) \ + $(BUILDDIR)/x11/snd_sdl.o +else +# OSS sound +X11_OBJS := $(X11_OBJS) \ + $(BUILDDIR)/x11/snd_linux.o +endif + $(BUILDDIR)/bin/quake.x11 : $(X11_OBJS) - $(CC) $(CFLAGS) -o $@ $(X11_OBJS) $(XLDFLAGS) $(LDFLAGS) + $(CC) $(CFLAGS) -o $@ $(X11_OBJS) $(XLDFLAGS) $(SDL_LIBS) $(LDFLAGS) #### @@ -397,6 +436,9 @@ $(BUILDDIR)/x11/snd_mix.o : $(MOUNT_DIR)/snd_mix.c $(BUILDDIR)/x11/snd_linux.o :$(MOUNT_DIR)/snd_linux.c $(DO_X11_CC) +$(BUILDDIR)/x11/snd_sdl.o :$(MOUNT_DIR)/snd_sdl.c + $(DO_X11_CC) + ##### $(BUILDDIR)/x11/d_copy.o : $(MOUNT_DIR)/d_copy.s @@ -514,25 +556,34 @@ GLQUAKE_OBJS= \ $(BUILDDIR)/glquake/snd_dma.o \ $(BUILDDIR)/glquake/snd_mem.o \ $(BUILDDIR)/glquake/snd_mix.o \ - $(BUILDDIR)/glquake/snd_linux.o \ \ $(BUILDDIR)/glquake/math.o \ $(BUILDDIR)/glquake/worlda.o \ $(BUILDDIR)/glquake/snd_mixa.o \ $(BUILDDIR)/glquake/sys_dosa.o +ifeq ($(USE_SDL2),1) +# sdl sound +GLQUAKE_OBJS := $(GLQUAKE_OBJS) \ + $(BUILDDIR)/glquake/snd_sdl.o +else +# OSS sound +GLQUAKE_OBJS := $(GLQUAkE_OBJS) \ + $(BUILDDIR)/glquake/snd_linux.o +endif + GLSVGA_OBJS=$(BUILDDIR)/glquake/gl_vidlinux.o GLX_OBJS=$(BUILDDIR)/glquake/gl_vidlinuxglx.o $(BUILDDIR)/bin/glquake : $(GLQUAKE_OBJS) $(GLSVGA_OBJS) - $(CC) $(CFLAGS) -o $@ $(GLQUAKE_OBJS) $(GLSVGA_OBJS) $(MESAGLLDFLAGS) $(SVGALDFLAGS) $(LDFLAGS) + $(CC) $(CFLAGS) -o $@ $(GLQUAKE_OBJS) $(GLSVGA_OBJS) $(MESAGLLDFLAGS) $(SVGALDFLAGS) $(SDL_LIBS) $(LDFLAGS) $(BUILDDIR)/bin/glquake.glx : $(GLQUAKE_OBJS) $(GLX_OBJS) - $(CC) $(CFLAGS) -o $@ $(GLQUAKE_OBJS) $(GLX_OBJS) $(GLLDFLAGS) $(LDFLAGS) + $(CC) $(CFLAGS) -o $@ $(GLQUAKE_OBJS) $(GLX_OBJS) $(GLLDFLAGS) $(SDL_LIBS) $(LDFLAGS) $(BUILDDIR)/bin/glquake.3dfxgl : $(GLQUAKE_OBJS) $(GLSVGA_OBJS) - $(CC) $(CFLAGS) -o $@ $(GLQUAKE_OBJS) $(GLSVGA_OBJS) $(TDFXGLLDFLAGS) $(SVGALDFLAGS) $(LDFLAGS) + $(CC) $(CFLAGS) -o $@ $(GLQUAKE_OBJS) $(GLSVGA_OBJS) $(TDFXGLLDFLAGS) $(SVGALDFLAGS) $(SDL_LIBS) $(LDFLAGS) $(BUILDDIR)/glquake/cl_demo.o : $(MOUNT_DIR)/cl_demo.c $(DO_GL_CC) diff --git a/WinQuake/cvar.h b/WinQuake/cvar.h index 771b340..ef5a0ed 100644 --- a/WinQuake/cvar.h +++ b/WinQuake/cvar.h @@ -53,6 +53,12 @@ Cvars are restricted from having the same names as commands to keep this interface from being ambiguous.
*/
+/* for sdl */
+#if defined(USE_SDL2)
+#define CVAR_NONE 0
+#endif
+/* sdl end */
+
typedef struct cvar_s
{
char *name;
diff --git a/WinQuake/debug/cd_linux.o b/WinQuake/debug/cd_linux.o Binary files differdeleted file mode 100644 index 7380399..0000000 --- a/WinQuake/debug/cd_linux.o +++ /dev/null diff --git a/WinQuake/debug/chase.o b/WinQuake/debug/chase.o Binary files differdeleted file mode 100644 index 83c9405..0000000 --- a/WinQuake/debug/chase.o +++ /dev/null diff --git a/WinQuake/debug/cl_demo.o b/WinQuake/debug/cl_demo.o Binary files differdeleted file mode 100644 index 1011e09..0000000 --- a/WinQuake/debug/cl_demo.o +++ /dev/null diff --git a/WinQuake/debug/cl_input.o b/WinQuake/debug/cl_input.o Binary files differdeleted file mode 100644 index 430f5c7..0000000 --- a/WinQuake/debug/cl_input.o +++ /dev/null diff --git a/WinQuake/debug/cl_main.o b/WinQuake/debug/cl_main.o Binary files differdeleted file mode 100644 index 0012826..0000000 --- a/WinQuake/debug/cl_main.o +++ /dev/null diff --git a/WinQuake/debug/cl_parse.o b/WinQuake/debug/cl_parse.o Binary files differdeleted file mode 100644 index b327f3e..0000000 --- a/WinQuake/debug/cl_parse.o +++ /dev/null diff --git a/WinQuake/debug/cl_tent.o b/WinQuake/debug/cl_tent.o Binary files differdeleted file mode 100644 index 4588c2f..0000000 --- a/WinQuake/debug/cl_tent.o +++ /dev/null diff --git a/WinQuake/debug/cmd.o b/WinQuake/debug/cmd.o Binary files differdeleted file mode 100644 index 19a00d7..0000000 --- a/WinQuake/debug/cmd.o +++ /dev/null diff --git a/WinQuake/debug/common.o b/WinQuake/debug/common.o Binary files differdeleted file mode 100644 index 3f87af1..0000000 --- a/WinQuake/debug/common.o +++ /dev/null diff --git a/WinQuake/debug/console.o b/WinQuake/debug/console.o Binary files differdeleted file mode 100644 index 0142f3e..0000000 --- a/WinQuake/debug/console.o +++ /dev/null diff --git a/WinQuake/debug/crc.o b/WinQuake/debug/crc.o Binary files differdeleted file mode 100644 index 152a743..0000000 --- a/WinQuake/debug/crc.o +++ /dev/null diff --git a/WinQuake/debug/cvar.o b/WinQuake/debug/cvar.o Binary files differdeleted file mode 100644 index bdf21cf..0000000 --- a/WinQuake/debug/cvar.o +++ /dev/null diff --git a/WinQuake/debug/gl_draw.o b/WinQuake/debug/gl_draw.o Binary files differdeleted file mode 100644 index a5e6a51..0000000 --- a/WinQuake/debug/gl_draw.o +++ /dev/null diff --git a/WinQuake/debug/gl_mesh.o b/WinQuake/debug/gl_mesh.o Binary files differdeleted file mode 100644 index 253e763..0000000 --- a/WinQuake/debug/gl_mesh.o +++ /dev/null diff --git a/WinQuake/debug/gl_model.o b/WinQuake/debug/gl_model.o Binary files differdeleted file mode 100644 index d701a01..0000000 --- a/WinQuake/debug/gl_model.o +++ /dev/null diff --git a/WinQuake/debug/gl_refrag.o b/WinQuake/debug/gl_refrag.o Binary files differdeleted file mode 100644 index fbdfd46..0000000 --- a/WinQuake/debug/gl_refrag.o +++ /dev/null diff --git a/WinQuake/debug/gl_rlight.o b/WinQuake/debug/gl_rlight.o Binary files differdeleted file mode 100644 index 85cdd09..0000000 --- a/WinQuake/debug/gl_rlight.o +++ /dev/null diff --git a/WinQuake/debug/gl_rmain.o b/WinQuake/debug/gl_rmain.o Binary files differdeleted file mode 100644 index a1c8f90..0000000 --- a/WinQuake/debug/gl_rmain.o +++ /dev/null diff --git a/WinQuake/debug/gl_rmisc.o b/WinQuake/debug/gl_rmisc.o Binary files differdeleted file mode 100644 index 3d239f0..0000000 --- a/WinQuake/debug/gl_rmisc.o +++ /dev/null diff --git a/WinQuake/debug/gl_rsurf.o b/WinQuake/debug/gl_rsurf.o Binary files differdeleted file mode 100644 index 51ed9ce..0000000 --- a/WinQuake/debug/gl_rsurf.o +++ /dev/null diff --git a/WinQuake/debug/gl_screen.o b/WinQuake/debug/gl_screen.o Binary files differdeleted file mode 100644 index f9e990a..0000000 --- a/WinQuake/debug/gl_screen.o +++ /dev/null diff --git a/WinQuake/debug/gl_test.o b/WinQuake/debug/gl_test.o Binary files differdeleted file mode 100644 index 11fc43f..0000000 --- a/WinQuake/debug/gl_test.o +++ /dev/null diff --git a/WinQuake/debug/gl_vidlinuxglx.o b/WinQuake/debug/gl_vidlinuxglx.o Binary files differdeleted file mode 100644 index e15483d..0000000 --- a/WinQuake/debug/gl_vidlinuxglx.o +++ /dev/null diff --git a/WinQuake/debug/gl_warp.o b/WinQuake/debug/gl_warp.o Binary files differdeleted file mode 100644 index 9411b36..0000000 --- a/WinQuake/debug/gl_warp.o +++ /dev/null diff --git a/WinQuake/debug/host.o b/WinQuake/debug/host.o Binary files differdeleted file mode 100644 index e5f3bf5..0000000 --- a/WinQuake/debug/host.o +++ /dev/null diff --git a/WinQuake/debug/host_cmd.o b/WinQuake/debug/host_cmd.o Binary files differdeleted file mode 100644 index 4b1d9be..0000000 --- a/WinQuake/debug/host_cmd.o +++ /dev/null diff --git a/WinQuake/debug/keys.o b/WinQuake/debug/keys.o Binary files differdeleted file mode 100644 index c541ed7..0000000 --- a/WinQuake/debug/keys.o +++ /dev/null diff --git a/WinQuake/debug/math.o b/WinQuake/debug/math.o Binary files differdeleted file mode 100644 index b191f55..0000000 --- a/WinQuake/debug/math.o +++ /dev/null diff --git a/WinQuake/debug/mathlib.o b/WinQuake/debug/mathlib.o Binary files differdeleted file mode 100644 index 0af36ee..0000000 --- a/WinQuake/debug/mathlib.o +++ /dev/null diff --git a/WinQuake/debug/menu.o b/WinQuake/debug/menu.o Binary files differdeleted file mode 100644 index e57e598..0000000 --- a/WinQuake/debug/menu.o +++ /dev/null diff --git a/WinQuake/debug/net_bsd.o b/WinQuake/debug/net_bsd.o Binary files differdeleted file mode 100644 index 0c7bef7..0000000 --- a/WinQuake/debug/net_bsd.o +++ /dev/null diff --git a/WinQuake/debug/net_dgrm.o b/WinQuake/debug/net_dgrm.o Binary files differdeleted file mode 100644 index 70e7714..0000000 --- a/WinQuake/debug/net_dgrm.o +++ /dev/null diff --git a/WinQuake/debug/net_loop.o b/WinQuake/debug/net_loop.o Binary files differdeleted file mode 100644 index 2b33c5b..0000000 --- a/WinQuake/debug/net_loop.o +++ /dev/null diff --git a/WinQuake/debug/net_main.o b/WinQuake/debug/net_main.o Binary files differdeleted file mode 100644 index 994719b..0000000 --- a/WinQuake/debug/net_main.o +++ /dev/null diff --git a/WinQuake/debug/net_udp.o b/WinQuake/debug/net_udp.o Binary files differdeleted file mode 100644 index bf52fa4..0000000 --- a/WinQuake/debug/net_udp.o +++ /dev/null diff --git a/WinQuake/debug/net_vcr.o b/WinQuake/debug/net_vcr.o Binary files differdeleted file mode 100644 index cb8eec2..0000000 --- a/WinQuake/debug/net_vcr.o +++ /dev/null diff --git a/WinQuake/debug/pr_cmds.o b/WinQuake/debug/pr_cmds.o Binary files differdeleted file mode 100644 index 6d26167..0000000 --- a/WinQuake/debug/pr_cmds.o +++ /dev/null diff --git a/WinQuake/debug/pr_edict.o b/WinQuake/debug/pr_edict.o Binary files differdeleted file mode 100644 index a3b5b2f..0000000 --- a/WinQuake/debug/pr_edict.o +++ /dev/null diff --git a/WinQuake/debug/pr_exec.o b/WinQuake/debug/pr_exec.o Binary files differdeleted file mode 100644 index ec3f66c..0000000 --- a/WinQuake/debug/pr_exec.o +++ /dev/null diff --git a/WinQuake/debug/r_part.o b/WinQuake/debug/r_part.o Binary files differdeleted file mode 100644 index bdfde22..0000000 --- a/WinQuake/debug/r_part.o +++ /dev/null diff --git a/WinQuake/debug/sbar.o b/WinQuake/debug/sbar.o Binary files differdeleted file mode 100644 index aa73e37..0000000 --- a/WinQuake/debug/sbar.o +++ /dev/null diff --git a/WinQuake/debug/snd_dma.o b/WinQuake/debug/snd_dma.o Binary files differdeleted file mode 100644 index 90543ae..0000000 --- a/WinQuake/debug/snd_dma.o +++ /dev/null diff --git a/WinQuake/debug/snd_linux.o b/WinQuake/debug/snd_linux.o Binary files differdeleted file mode 100644 index 3686ec7..0000000 --- a/WinQuake/debug/snd_linux.o +++ /dev/null diff --git a/WinQuake/debug/snd_mem.o b/WinQuake/debug/snd_mem.o Binary files differdeleted file mode 100644 index 5e4ed62..0000000 --- a/WinQuake/debug/snd_mem.o +++ /dev/null diff --git a/WinQuake/debug/snd_mix.o b/WinQuake/debug/snd_mix.o Binary files differdeleted file mode 100644 index 792f53a..0000000 --- a/WinQuake/debug/snd_mix.o +++ /dev/null diff --git a/WinQuake/debug/snd_mixa.o b/WinQuake/debug/snd_mixa.o Binary files differdeleted file mode 100644 index 025b831..0000000 --- a/WinQuake/debug/snd_mixa.o +++ /dev/null diff --git a/WinQuake/debug/sv_main.o b/WinQuake/debug/sv_main.o Binary files differdeleted file mode 100644 index 23b605d..0000000 --- a/WinQuake/debug/sv_main.o +++ /dev/null diff --git a/WinQuake/debug/sv_move.o b/WinQuake/debug/sv_move.o Binary files differdeleted file mode 100644 index 203b8c9..0000000 --- a/WinQuake/debug/sv_move.o +++ /dev/null diff --git a/WinQuake/debug/sv_phys.o b/WinQuake/debug/sv_phys.o Binary files differdeleted file mode 100644 index b487c53..0000000 --- a/WinQuake/debug/sv_phys.o +++ /dev/null diff --git a/WinQuake/debug/sv_user.o b/WinQuake/debug/sv_user.o Binary files differdeleted file mode 100644 index 315a3f8..0000000 --- a/WinQuake/debug/sv_user.o +++ /dev/null diff --git a/WinQuake/debug/sys_dosa.o b/WinQuake/debug/sys_dosa.o Binary files differdeleted file mode 100644 index 7cae92b..0000000 --- a/WinQuake/debug/sys_dosa.o +++ /dev/null diff --git a/WinQuake/debug/sys_linux.o b/WinQuake/debug/sys_linux.o Binary files differdeleted file mode 100644 index 6031a32..0000000 --- a/WinQuake/debug/sys_linux.o +++ /dev/null diff --git a/WinQuake/debug/view.o b/WinQuake/debug/view.o Binary files differdeleted file mode 100644 index 2d6ae1c..0000000 --- a/WinQuake/debug/view.o +++ /dev/null diff --git a/WinQuake/debug/wad.o b/WinQuake/debug/wad.o Binary files differdeleted file mode 100644 index 01783f4..0000000 --- a/WinQuake/debug/wad.o +++ /dev/null diff --git a/WinQuake/debug/world.o b/WinQuake/debug/world.o Binary files differdeleted file mode 100644 index 1e60223..0000000 --- a/WinQuake/debug/world.o +++ /dev/null diff --git a/WinQuake/debug/worlda.o b/WinQuake/debug/worlda.o Binary files differdeleted file mode 100644 index 3eb8db9..0000000 --- a/WinQuake/debug/worlda.o +++ /dev/null diff --git a/WinQuake/debug/zone.o b/WinQuake/debug/zone.o Binary files differdeleted file mode 100644 index 7a09c37..0000000 --- a/WinQuake/debug/zone.o +++ /dev/null diff --git a/WinQuake/snd_dma.c b/WinQuake/snd_dma.c index accb617..adb5504 100644 --- a/WinQuake/snd_dma.c +++ b/WinQuake/snd_dma.c @@ -74,6 +74,11 @@ cvar_t volume = {"volume", "0.7", true}; cvar_t nosound = {"nosound", "0"};
cvar_t precache = {"precache", "1"};
cvar_t loadas8bit = {"loadas8bit", "0"};
+/* for sdl */
+#if defined(USE_SDL2)
+cvar_t sndspeed = {"sndspeed", "11025", CVAR_NONE};
+cvar_t snd_mixspeed = {"snd_mixspeed", "44100", CVAR_NONE};
+#endif
cvar_t bgmbuffer = {"bgmbuffer", "4096"};
cvar_t ambient_level = {"ambient_level", "0.3"};
cvar_t ambient_fade = {"ambient_fade", "100"};
@@ -143,8 +148,14 @@ void S_Startup (void) if (!fakedma)
{
+#if defined(USE_SDL2)
+ /* Since I borrowed a lot of the SDL2 code from Quakespasm, I
+ found this to be the easiest way to retrofit it: */
+ rc = SNDDMA_Init(&sn);
+#else
+ /* in the original code from Id, no argument is used here: */
rc = SNDDMA_Init();
-
+#endif
if (!rc)
{
#ifndef _WIN32
diff --git a/WinQuake/snd_sdl.c b/WinQuake/snd_sdl.c new file mode 100644 index 0000000..326621a --- /dev/null +++ b/WinQuake/snd_sdl.c @@ -0,0 +1,213 @@ +/* + * snd_sdl.c - SDL audio driver for Hexen II: Hammer of Thyrion (uHexen2) + * based on implementations found in the quakeforge and ioquake3 projects. + * + * Copyright (C) 1999-2005 Id Software, Inc. + * Copyright (C) 2005-2012 O.Sezer <sezero@users.sourceforge.net> + * Copyright (C) 2010-2014 QuakeSpasm developers + * + * 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(SDL_FRAMEWORK) || defined(NO_SDL_CONFIG) +#if defined(USE_SDL2) +#include <SDL2/SDL.h> +#else +#include <SDL/SDL.h> +#endif +#else +#include "SDL.h" +#endif + +static int buffersize; + + +static void SDLCALL paint_audio (void *unused, Uint8 *stream, int len) +{ + int pos, tobufend; + int len1, len2; + + if (!shm) + { /* shouldn't happen, but just in case */ + memset(stream, 0, len); + return; + } + + pos = (shm->samplepos * (shm->samplebits / 8)); + if (pos >= buffersize) + shm->samplepos = pos = 0; + + tobufend = buffersize - pos; /* bytes to buffer's end. */ + len1 = len; + len2 = 0; + + if (len1 > tobufend) + { + len1 = tobufend; + len2 = len - len1; + } + + memcpy(stream, shm->buffer + pos, len1); + + if (len2 <= 0) + { + shm->samplepos += (len1 / (shm->samplebits / 8)); + } + else + { /* wraparound? */ + memcpy(stream + len1, shm->buffer, len2); + shm->samplepos = (len2 / (shm->samplebits / 8)); + } + + if (shm->samplepos >= buffersize) + shm->samplepos = 0; +} + +qboolean SNDDMA_Init (dma_t *dma) +{ + SDL_AudioSpec desired; + int tmp, val; + char drivername[128]; + + if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0) + { + Con_Printf("Couldn't init SDL audio: %s\n", SDL_GetError()); + return false; + } + + /* Set up the desired format */ +/* desired.freq = snd_mixspeed.value;*/ + desired.freq = 44100; + desired.format = (loadas8bit.value) ? AUDIO_U8 : AUDIO_S16SYS; + desired.channels = 2; /* = desired_channels; */ + if (desired.freq <= 11025) + desired.samples = 256; + else if (desired.freq <= 22050) + desired.samples = 512; + else if (desired.freq <= 44100) + desired.samples = 1024; + else if (desired.freq <= 56000) + desired.samples = 2048; /* for 48 kHz */ + else + desired.samples = 4096; /* for 96 kHz */ + desired.callback = paint_audio; + desired.userdata = NULL; + + /* Open the audio device */ + if (SDL_OpenAudio(&desired, NULL) == -1) + { + Con_Printf("Couldn't open SDL audio: %s\n", SDL_GetError()); + SDL_QuitSubSystem(SDL_INIT_AUDIO); + return false; + } + + memset ((void *) dma, 0, sizeof(dma_t)); + shm = dma; + + /* Fill the audio DMA information block */ + /* Since we passed NULL as the 'obtained' spec to SDL_OpenAudio(), + * SDL will convert to hardware format for us if needed, hence we + * directly use the desired values here. */ + shm->samplebits = (desired.format & 0xFF); /* first byte of format is bits */ +/* shm->signed8 = (desired.format == AUDIO_S8);*/ + shm->speed = desired.freq; + shm->channels = desired.channels; + tmp = (desired.samples * desired.channels) * 10; + if (tmp & (tmp - 1)) + { /* make it a power of two */ + val = 1; + while (val < tmp) + val <<= 1; + + tmp = val; + } + shm->samples = tmp; + shm->samplepos = 0; + shm->submission_chunk = 1; + + Con_Printf ("SDL audio spec : %d Hz, %d samples, %d channels\n", + desired.freq, desired.samples, desired.channels); +#if defined(USE_SDL2) + { + const char *driver = SDL_GetCurrentAudioDriver(); + const char *device = SDL_GetAudioDeviceName(0, SDL_FALSE); + snprintf(drivername, sizeof(drivername), "%s - %s", + driver != NULL ? driver : "(UNKNOWN)", + device != NULL ? device : "(UNKNOWN)"); + } +#else + if (SDL_AudioDriverName(drivername, sizeof(drivername)) == NULL) + strcpy(drivername, "(UNKNOWN)"); +#endif + buffersize = shm->samples * (shm->samplebits / 8); + Con_Printf ("SDL audio driver: %s, %d bytes buffer\n", drivername, buffersize); + + shm->buffer = (unsigned char *) calloc (1, buffersize); + if (!shm->buffer) + { + SDL_CloseAudio(); + SDL_QuitSubSystem(SDL_INIT_AUDIO); + shm = NULL; + Con_Printf ("Failed allocating memory for SDL audio\n"); + return false; + } + + SDL_PauseAudio(0); + + return true; +} + +int SNDDMA_GetDMAPos (void) +{ + return shm->samplepos; +} + +void SNDDMA_Shutdown (void) +{ + if (shm) + { + Con_Printf ("Shutting down SDL sound\n"); + SDL_CloseAudio(); + SDL_QuitSubSystem(SDL_INIT_AUDIO); + if (shm->buffer) + free (shm->buffer); + shm->buffer = NULL; + shm = NULL; + } +} + +void SNDDMA_LockBuffer (void) +{ + SDL_LockAudio (); +} + +void SNDDMA_Submit (void) +{ + SDL_UnlockAudio(); +} + +void SNDDMA_BlockSound (void) +{ + SDL_PauseAudio(1); +} + +void SNDDMA_UnblockSound (void) +{ + SDL_PauseAudio(0); +} + diff --git a/WinQuake/sound.h b/WinQuake/sound.h index 6410af2..f5e8b35 100644 --- a/WinQuake/sound.h +++ b/WinQuake/sound.h @@ -115,7 +115,13 @@ channel_t *SND_PickChannel(int entnum, int entchannel); void SND_Spatialize(channel_t *ch);
// initializes cycling through a DMA buffer and returns information on it
+#if defined(USE_SDL2)
+/* Probably the easiest way to retrofit quakespasm's SDL2 audio code into
+ Id Quake. */
+qboolean SNDDMA_Init(dma_t *dma);
+#else
qboolean SNDDMA_Init(void);
+#endif
// gets the current DMA position
int SNDDMA_GetDMAPos(void);
|
