mirror of
https://git.FreeBSD.org/ports.git
synced 2025-01-15 07:56:36 +00:00
- Update patches (remove old and add new ones).
This commit is contained in:
parent
b88d59d37a
commit
2a86c19553
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=199156
52
games/alienarena/files/patch-Makefile
Normal file
52
games/alienarena/files/patch-Makefile
Normal file
@ -0,0 +1,52 @@
|
||||
--- ../Makefile.orig Fri May 25 01:00:34 2007
|
||||
+++ ../Makefile Sat Jul 21 13:39:48 2007
|
||||
@@ -22,6 +22,10 @@
|
||||
# Build binary that uses SDL for sound when "1".
|
||||
SDLSOUND?=1
|
||||
|
||||
+# Adds DATADIR/LIBDIR (see below) to the data and library search path.
|
||||
+WITH_DATADIR?=no
|
||||
+WITH_LIBDIR?=no
|
||||
+
|
||||
# Selects the component to build; ALL, GAME, or DEDICATED
|
||||
BUILD?=ALL
|
||||
|
||||
@@ -53,6 +57,20 @@
|
||||
|
||||
BASE_CFLAGS=$(CFLAGS) -Dstricmp=strcasecmp -D_stricmp=strcasecmp -I$(X11BASE)/include
|
||||
|
||||
+# DATADIR / LIBDIR support.
|
||||
+
|
||||
+PREFIX?=/usr/local
|
||||
+
|
||||
+ifeq ($(strip $(WITH_DATADIR)),yes)
|
||||
+DATADIR?=$(PREFIX)/share/alienarena
|
||||
+BASE_CFLAGS+=-DDATADIR='\"$(DATADIR)\"'
|
||||
+endif
|
||||
+
|
||||
+ifeq ($(strip $(WITH_LIBDIR)),yes)
|
||||
+LIBDIR?=$(PREFIX)/lib/alienarena
|
||||
+BASE_CFLAGS+=-DLIBDIR='\"$(LIBDIR)\"'
|
||||
+endif
|
||||
+
|
||||
RELEASE_CFLAGS=$(BASE_CFLAGS)
|
||||
|
||||
ifeq ($(strip $(OPTIMIZED_CFLAGS)),yes)
|
||||
@@ -128,13 +146,13 @@
|
||||
$(BUILDDIR)/crx
|
||||
endif
|
||||
|
||||
+ifeq ($(strip $(BUILD)),CLIENT)
|
||||
+ TARGETS+=$(BUILDDIR)/crx
|
||||
+endif
|
||||
+
|
||||
ifeq ($(strip $(BUILD)),DEDICATED)
|
||||
SDLSOUND=0
|
||||
TARGETS+=$(BUILDDIR)/crded
|
||||
-endif
|
||||
-
|
||||
-ifeq ($(strip $(BUILD)),GAME)
|
||||
- TARGETS+=$(BUILDDIR)/crx
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(SDLSOUND)),1)
|
@ -1,12 +0,0 @@
|
||||
--- ./client/qmenu.c.orig Tue May 16 15:20:10 2006
|
||||
+++ ./client/qmenu.c Tue May 16 15:20:10 2006
|
||||
@@ -25,7 +25,8 @@
|
||||
|
||||
static void Action_DoEnter( menuaction_s *a );
|
||||
static void Action_Draw( menuaction_s *a );
|
||||
-static void Menu_DrawStatusBar( const char *string );
|
||||
+static void Menu_DrawStatusBar( const char *string );
|
||||
+void Menu_DrawString( int x, int y, const char *string );
|
||||
static void Menulist_DoEnter( menulist_s *l );
|
||||
static void MenuList_Draw( menulist_s *l );
|
||||
static void Separator_Draw( menuseparator_s *s );
|
@ -1,48 +0,0 @@
|
||||
--- ./client/snd_dma.c.orig Tue May 16 15:20:10 2006
|
||||
+++ ./client/snd_dma.c Tue May 16 15:20:10 2006
|
||||
@@ -771,8 +771,17 @@
|
||||
clear = 0;
|
||||
|
||||
SNDDMA_BeginPainting ();
|
||||
- if (dma.buffer)
|
||||
- memset(dma.buffer, clear, dma.samples * dma.samplebits/8);
|
||||
+ if (dma.buffer) {
|
||||
+ int i;
|
||||
+ unsigned char *ptr = (unsigned char *)dma.buffer;
|
||||
+
|
||||
+ /* clear it manually because the buffer might be writeonly (mmap) */
|
||||
+ i = dma.samples * dma.samplebits/8;
|
||||
+ while (i--) {
|
||||
+ *ptr = clear;
|
||||
+ ptr++;
|
||||
+ }
|
||||
+ }
|
||||
SNDDMA_Submit ();
|
||||
}
|
||||
|
||||
@@ -892,8 +901,23 @@
|
||||
ch->rightvol = right_total;
|
||||
ch->autosound = true; // remove next frame
|
||||
ch->sfx = sfx;
|
||||
- ch->pos = paintedtime % sc->length;
|
||||
- ch->end = paintedtime + sc->length - ch->pos;
|
||||
+ /*
|
||||
+ * PATCH: eliasm
|
||||
+ *
|
||||
+ * Sometimes, the sc->length argument can become 0,
|
||||
+ * and in that case we get a SIGFPE in the next
|
||||
+ * modulo operation. The workaround checks for this
|
||||
+ * situation and in that case, sets the pos and end
|
||||
+ * parameters to 0.
|
||||
+ */
|
||||
+ if( sc->length == 0 ) {
|
||||
+ ch->pos = 0;
|
||||
+ ch->end = 0;
|
||||
+ }
|
||||
+ else {
|
||||
+ ch->pos = paintedtime % sc->length;
|
||||
+ ch->end = paintedtime + sc->length - ch->pos;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
16
games/alienarena/files/patch-game__acesrc__acebot.h
Normal file
16
games/alienarena/files/patch-game__acesrc__acebot.h
Normal file
@ -0,0 +1,16 @@
|
||||
--- ./game/acesrc/acebot.h.orig Fri Jun 1 14:05:51 2007
|
||||
+++ ./game/acesrc/acebot.h Sat Jul 21 09:32:13 2007
|
||||
@@ -60,6 +60,13 @@
|
||||
#ifndef _ACEBOT_H
|
||||
#define _ACEBOT_H
|
||||
|
||||
+// Directory for reading files in "botinfo", writing is always done in "."
|
||||
+#ifdef DATADIR
|
||||
+#define BOTDIR DATADIR
|
||||
+#else
|
||||
+#define BOTDIR "."
|
||||
+#endif
|
||||
+
|
||||
// Only 100 allowed for now (probably never be enough edicts for 'em
|
||||
#define MAX_BOTS 100
|
||||
|
@ -1,10 +0,0 @@
|
||||
--- ./game/acesrc/acebot_compress.c.orig Tue May 16 15:20:10 2006
|
||||
+++ ./game/acesrc/acebot_compress.c Tue May 16 15:20:10 2006
|
||||
@@ -17,7 +17,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
-#include <malloc.h>
|
||||
|
||||
#define N 4096 /* size of ring buffer */
|
||||
#define F 18 /* upper limit for match_length */
|
15
games/alienarena/files/patch-game__acesrc__acebot_nodes.c
Normal file
15
games/alienarena/files/patch-game__acesrc__acebot_nodes.c
Normal file
@ -0,0 +1,15 @@
|
||||
--- ./game/acesrc/acebot_nodes.c.orig Fri Mar 23 23:28:55 2007
|
||||
+++ ./game/acesrc/acebot_nodes.c Sat Jul 21 09:32:49 2007
|
||||
@@ -726,11 +726,7 @@
|
||||
|
||||
safe_bprintf(PRINT_MEDIUM,"Saving node table...");
|
||||
|
||||
-#ifdef __linux__
|
||||
- strcpy(filename,"botinfo/nav/");
|
||||
-#else
|
||||
- strcpy(filename,"botinfo\\nav\\");
|
||||
-#endif
|
||||
+ strcpy(filename,BOTDIR"/botinfo/nav/");
|
||||
strcat(filename,level.mapname);
|
||||
strcat(filename,".nod");
|
||||
|
26
games/alienarena/files/patch-game__acesrc__acebot_spawn.c
Normal file
26
games/alienarena/files/patch-game__acesrc__acebot_spawn.c
Normal file
@ -0,0 +1,26 @@
|
||||
--- ./game/acesrc/acebot_spawn.c.orig Wed Apr 25 18:22:21 2007
|
||||
+++ ./game/acesrc/acebot_spawn.c Sat Jul 21 09:34:40 2007
|
||||
@@ -126,11 +126,11 @@
|
||||
|
||||
//bots and configurations will be loaded level specific
|
||||
if (((int)(dmflags->value) & DF_SKINTEAMS) || ctf->value || tca->value || cp->value)
|
||||
- strcpy(bot_filename, "botinfo/team.tmp");
|
||||
+ strcpy(bot_filename, BOTDIR"/botinfo/team.tmp");
|
||||
else if(sv_custombots->value)
|
||||
- sprintf(bot_filename, "botinfo/custom%i.tmp", sv_custombots->integer);
|
||||
+ sprintf(bot_filename, BOTDIR"/botinfo/custom%i.tmp", sv_custombots->integer);
|
||||
else
|
||||
- sprintf(bot_filename, "botinfo/%s.tmp", level.mapname);
|
||||
+ sprintf(bot_filename, BOTDIR"/botinfo/%s.tmp", level.mapname);
|
||||
|
||||
if((pIn = fopen(bot_filename, "rb" )) == NULL)
|
||||
return; // bail
|
||||
@@ -543,7 +543,7 @@
|
||||
//if not a respawn, load bot configuration file(specific to each bot)
|
||||
info = Info_ValueForKey (bot->client->pers.userinfo, "name");
|
||||
|
||||
- sprintf(bot_configfilename, "botinfo/%s.cfg", info);
|
||||
+ sprintf(bot_configfilename, BOTDIR"/botinfo/%s.cfg", info);
|
||||
ACECO_ReadConfig(bot_configfilename);
|
||||
|
||||
//set config items
|
@ -1,17 +0,0 @@
|
||||
--- ./game/g_phys.c.orig Tue May 16 15:20:10 2006
|
||||
+++ ./game/g_phys.c Tue May 16 15:20:10 2006
|
||||
@@ -356,7 +356,13 @@
|
||||
mask = MASK_SOLID;
|
||||
|
||||
trace = gi.trace (start, ent->mins, ent->maxs, end, ent, mask);
|
||||
-
|
||||
+
|
||||
+ if (trace.startsolid || trace.allsolid)
|
||||
+ {
|
||||
+ mask ^= CONTENTS_DEADMONSTER;
|
||||
+ trace = gi.trace (start, ent->mins, ent->maxs, end, ent, mask);
|
||||
+ }
|
||||
+
|
||||
VectorCopy (trace.endpos, ent->s.origin);
|
||||
gi.linkentity (ent);
|
||||
|
@ -1,176 +0,0 @@
|
||||
--- linux/Makefile.orig Fri Mar 30 23:06:46 2007
|
||||
+++ linux/Makefile Fri Mar 30 23:13:43 2007
|
||||
@@ -11,25 +11,14 @@
|
||||
GLIBC=
|
||||
endif
|
||||
|
||||
-ifneq (,$(findstring alpha,$(shell uname -m)))
|
||||
-ARCH=axp
|
||||
-else
|
||||
-ifneq (,$(findstring ppc,$(shell uname -m)))
|
||||
-ARCH=ppc
|
||||
-else
|
||||
-ifneq (,$(findstring x86_64,$(shell uname -m)))
|
||||
-ARCH=x86_64
|
||||
-else
|
||||
-ARCH=i386
|
||||
-endif
|
||||
-endif
|
||||
-endif
|
||||
+ARCH=$(shell uname -m)
|
||||
+
|
||||
NOARCH=noarch
|
||||
|
||||
MOUNT_DIR=..
|
||||
|
||||
-BUILD_DEBUG_DIR=debug$(ARCH)
|
||||
-BUILD_RELEASE_DIR=release$(ARCH)
|
||||
+BUILD_DEBUG_DIR=debug
|
||||
+BUILD_RELEASE_DIR=release
|
||||
CLIENT_DIR=$(MOUNT_DIR)/client
|
||||
SERVER_DIR=$(MOUNT_DIR)/server
|
||||
REF_GL_DIR=$(MOUNT_DIR)/ref_gl
|
||||
@@ -42,51 +31,31 @@
|
||||
|
||||
EGCS=/usr/local/egcs-1.1.2/bin/gcc
|
||||
|
||||
-CC=gcc
|
||||
-
|
||||
-ifeq ($(ARCH),x86_64)
|
||||
-_LIB := lib64
|
||||
-else
|
||||
-_LIB := lib
|
||||
-endif
|
||||
-
|
||||
-BASE_CFLAGS=-Dstricmp=strcasecmp -D_stricmp=strcasecmp -D__linux__
|
||||
-
|
||||
-ifeq ($(ARCH),axp)
|
||||
-RELEASE_CFLAGS=$(BASE_CFLAGS) -ffast-math -funroll-loops \
|
||||
- -fomit-frame-pointer -fexpensive-optimizations
|
||||
-endif
|
||||
+CC?=gcc
|
||||
|
||||
-ifeq ($(ARCH),ppc)
|
||||
-RELEASE_CFLAGS=$(BASE_CFLAGS) -O2 -ffast-math -funroll-loops \
|
||||
- -fomit-frame-pointer -fexpensive-optimizations
|
||||
-endif
|
||||
+CC?=gcc
|
||||
|
||||
-ifeq ($(ARCH),sparc)
|
||||
-RELEASE_CFLAGS=$(BASE_CFLAGS) -ffast-math -funroll-loops \
|
||||
+BASE_CFLAGS=$(CFLAGS) -Dstricmp=strcasecmp -D_stricmp=strcasecmp -I$(X11BASE)/include
|
||||
+RELEASE_CFLAGS=$(BASE_CFLAGS)
|
||||
+ifdef OPTIMIZED_CFLAGS
|
||||
+RELEASE_CFLAGS+=-O2 -ffast-math -funroll-loops \
|
||||
-fomit-frame-pointer -fexpensive-optimizations
|
||||
-endif
|
||||
-
|
||||
-ifeq ($(ARCH),i386)
|
||||
-RELEASE_CFLAGS=$(BASE_CFLAGS) -O2 -ffast-math -funroll-loops -falign-loops=2 \
|
||||
- -fomit-frame-pointer -falign-jumps=2 -falign-functions=2 -fno-strict-aliasing -ftree-vectorize
|
||||
-endif
|
||||
-
|
||||
-ifeq ($(ARCH),x86_64)
|
||||
-RELEASE_CFLAGS=$(BASE_CFLAGS) -O2 -ffast-math -funroll-loops -falign-loops=2 \
|
||||
- -fomit-frame-pointer -falign-jumps=2 -falign-functions=2 -fno-strict-aliasing -ftree-vectorize
|
||||
+ ifeq ($(ARCH),i386)
|
||||
+RELEASE_CFLAGS+=-falign-loops=2 -falign-jumps=2 -falign-functions=2 \
|
||||
+ -fno-strict-aliasing
|
||||
+ endif
|
||||
endif
|
||||
|
||||
ARENA_CFLAGS=-DARENA
|
||||
|
||||
DEBUG_CFLAGS=$(BASE_CFLAGS) -g
|
||||
-LDFLAGS=-ldl -lm
|
||||
+LDFLAGS=-lm
|
||||
SVGALDFLAGS=-lvga -lm
|
||||
-XLDFLAGS=-L/usr/X11R6/$(_LIB) -lX11 -lXext -lXxf86dga
|
||||
+XLDFLAGS=-L$(X11BASE)/lib -lX11 -lXext -lXxf86dga
|
||||
XCFLAGS=
|
||||
|
||||
-GLLDFLAGS=-L/usr/X11R6/$(_LIB) -L/usr/local/$(_LIB) -lX11 -lXext -lvga -lm
|
||||
-GLXLDFLAGS=-L/usr/X11R6/$(_LIB) -L/usr/local/$(_LIB) -lX11 -lXext -lXxf86dga -lXxf86vm -lm -ljpeg -lGL -lGLU
|
||||
+GLLDFLAGS=-L$(X11BASE)/lib -L$(LOCALBASE)/lib -lX11 -lXext -lvga -lm
|
||||
+GLXLDFLAGS=-L$(X11BASE)/lib -L$(LOCALBASE)/lib -lX11 -lXext -lXxf86dga -lXxf86vm -lm -ljpeg -lGL -lGLU
|
||||
|
||||
SDLCFLAGS=$(shell sdl-config --cflags)
|
||||
SDLLDFLAGS=$(shell sdl-config --libs)
|
||||
@@ -115,19 +84,19 @@
|
||||
# SETUP AND BUILD
|
||||
#############################################################################
|
||||
|
||||
-ifeq ($(ARCH),axp)
|
||||
-TARGETS=$(BUILDDIR)/crded.$(ARCH) \
|
||||
- $(BUILDDIR)/game$(ARCH).$(SHLIBEXT) \
|
||||
- $(BUILDDIR)/arena/game$(ARCH).$(SHLIBEXT)
|
||||
-else
|
||||
-TARGETS=$(BUILDDIR)/crded.$(ARCH) \
|
||||
- $(BUILDDIR)/crx.$(ARCH) \
|
||||
- $(BUILDDIR)/game$(ARCH).$(SHLIBEXT) \
|
||||
- $(BUILDDIR)/arena/game$(ARCH).$(SHLIBEXT)
|
||||
+TARGETS=$(BUILDDIR)/game.$(SHLIBEXT) \
|
||||
+ $(BUILDDIR)/arena/game.$(SHLIBEXT)
|
||||
+
|
||||
+ifeq ($(strip $(CLIENT)),1)
|
||||
+ TARGETS+=$(BUILDDIR)/crx
|
||||
+endif
|
||||
+
|
||||
+ifeq ($(strip $(DEDICATED)),1)
|
||||
+ TARGETS+=$(BUILDDIR)/crded
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(SDLSOUND)),1)
|
||||
- TARGETS+=$(BUILDDIR)/crx.sdl.$(ARCH)
|
||||
+ TARGETS+=$(BUILDDIR)/crx.sdl
|
||||
endif
|
||||
|
||||
build_debug:
|
||||
@@ -234,18 +203,14 @@
|
||||
SOUND_SDL_OBJS = \
|
||||
$(BUILDDIR)/client/snd_sdl.o
|
||||
|
||||
-ifeq ($(ARCH),axp)
|
||||
-CODERED_AS_OBJS = #blank
|
||||
-else
|
||||
CODERED_AS_OBJS = \
|
||||
$(BUILDDIR)/client/snd_mixa.o
|
||||
-endif
|
||||
|
||||
|
||||
-$(BUILDDIR)/crx.$(ARCH) : $(CODERED_OBJS) $(SOUND_OSS_OBJS) $(CODERED_AS_OBJS) $(REF_GL_OBJS) $(REF_GL_GLX_OBJS)
|
||||
+$(BUILDDIR)/crx : $(CODERED_OBJS) $(SOUND_OSS_OBJS) $(CODERED_AS_OBJS) $(REF_GL_OBJS) $(REF_GL_GLX_OBJS)
|
||||
$(CC) $(CFLAGS) -o $@ $(CODERED_OBJS) $(SOUND_OSS_OBJS) $(CODERED_AS_OBJS) $(LDFLAGS) $(REF_GL_OBJS) $(REF_GL_GLX_OBJS) $(GLXLDFLAGS)
|
||||
|
||||
-$(BUILDDIR)/crx.sdl.$(ARCH) : $(CODERED_OBJS) $(SOUND_SDL_OBJS) $(CODERED_AS_OBJS) $(REF_GL_OBJS) $(REF_GL_GLX_OBJS)
|
||||
+$(BUILDDIR)/crx.sdl : $(CODERED_OBJS) $(SOUND_SDL_OBJS) $(CODERED_AS_OBJS) $(REF_GL_OBJS) $(REF_GL_GLX_OBJS)
|
||||
$(CC) $(CFLAGS) -o $@ $(CODERED_OBJS) $(SOUND_SDL_OBJS) $(CODERED_AS_OBJS) $(LDFLAGS) $(REF_GL_OBJS) $(REF_GL_GLX_OBJS) $(GLXLDFLAGS) $(SDLLDFLAGS)
|
||||
|
||||
$(BUILDDIR)/client/cl_cin.o : $(CLIENT_DIR)/cl_cin.c
|
||||
@@ -478,7 +443,7 @@
|
||||
$(BUILDDIR)/ded/cl_null.o \
|
||||
$(BUILDDIR)/ded/cd_null.o
|
||||
|
||||
-$(BUILDDIR)/crded.$(ARCH) : $(CRDED_OBJS)
|
||||
+$(BUILDDIR)/crded : $(CRDED_OBJS)
|
||||
$(CC) $(CFLAGS) -o $@ $(CRDED_OBJS) $(LDFLAGS)
|
||||
|
||||
$(BUILDDIR)/ded/cmd.o : $(COMMON_DIR)/cmd.c
|
||||
@@ -597,7 +562,7 @@
|
||||
|
||||
|
||||
|
||||
-$(BUILDDIR)/game$(ARCH).$(SHLIBEXT) : $(GAME_OBJS)
|
||||
+$(BUILDDIR)/game.$(SHLIBEXT) : $(GAME_OBJS)
|
||||
$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(GAME_OBJS)
|
||||
|
||||
|
||||
@@ -753,7 +718,7 @@
|
||||
$(BUILDDIR)/arena/p_weapon.o \
|
||||
$(BUILDDIR)/arena/vehicles.o
|
||||
|
||||
-$(BUILDDIR)/arena/game$(ARCH).$(SHLIBEXT) : $(ARENA_OBJS)
|
||||
+$(BUILDDIR)/arena/game.$(SHLIBEXT) : $(ARENA_OBJS)
|
||||
$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(ARENA_OBJS)
|
||||
|
||||
|
@ -1,255 +0,0 @@
|
||||
--- ./linux/cd_linux.c.orig Tue May 16 15:20:10 2006
|
||||
+++ ./linux/cd_linux.c Tue May 16 15:20:10 2006
|
||||
@@ -31,7 +31,11 @@
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
|
||||
-#include <linux/cdrom.h>
|
||||
+#if defined(__FreeBSD__)
|
||||
+ #include <sys/cdio.h>
|
||||
+#else
|
||||
+ #include <linux/cdrom.h>
|
||||
+#endif
|
||||
|
||||
#include "../client/client.h"
|
||||
|
||||
@@ -61,8 +65,13 @@
|
||||
if (cdfile == -1 || !enabled)
|
||||
return; // no cd init'd
|
||||
|
||||
+#if defined(__FreeBSD__)
|
||||
+ if ( ioctl(cdfile, CDIOCEJECT) == -1 )
|
||||
+ Com_DPrintf("ioctl cdioeject failed\n");
|
||||
+#else
|
||||
if ( ioctl(cdfile, CDROMEJECT) == -1 )
|
||||
Com_DPrintf("ioctl cdromeject failed\n");
|
||||
+#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -71,30 +80,53 @@
|
||||
if (cdfile == -1 || !enabled)
|
||||
return; // no cd init'd
|
||||
|
||||
+#if defined(__FreeBSD__)
|
||||
+ if ( ioctl(cdfile, CDIOCCLOSE) == -1 )
|
||||
+ Com_DPrintf("ioctl cdiocclose failed\n");
|
||||
+#else
|
||||
if ( ioctl(cdfile, CDROMCLOSETRAY) == -1 )
|
||||
Com_DPrintf("ioctl cdromclosetray failed\n");
|
||||
+#endif
|
||||
}
|
||||
|
||||
static int CDAudio_GetAudioDiskInfo(void)
|
||||
{
|
||||
+#if defined(__FreeBSD__)
|
||||
+ struct ioc_toc_header tochdr;
|
||||
+#else
|
||||
struct cdrom_tochdr tochdr;
|
||||
+#endif
|
||||
|
||||
cdValid = false;
|
||||
|
||||
+#if defined(__FreeBSD__)
|
||||
+ if ( ioctl(cdfile, CDIOREADTOCHEADER, &tochdr) == -1 )
|
||||
+ {
|
||||
+ Com_DPrintf("ioctl cdioreadtocheader failed\n");
|
||||
+#else
|
||||
if ( ioctl(cdfile, CDROMREADTOCHDR, &tochdr) == -1 )
|
||||
{
|
||||
Com_DPrintf("ioctl cdromreadtochdr failed\n");
|
||||
+#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
+#if defined(__FreeBSD__)
|
||||
+ if (tochdr.starting_track < 1)
|
||||
+#else
|
||||
if (tochdr.cdth_trk0 < 1)
|
||||
+#endif
|
||||
{
|
||||
Com_DPrintf("CDAudio: no music tracks\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
cdValid = true;
|
||||
+#if defined(__FreeBSD__)
|
||||
+ maxTrack = tochdr.ending_track;
|
||||
+#else
|
||||
maxTrack = tochdr.cdth_trk1;
|
||||
+#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -102,8 +134,14 @@
|
||||
|
||||
void CDAudio_Play(int track, qboolean looping)
|
||||
{
|
||||
+#if defined(__FreeBSD__)
|
||||
+ struct ioc_read_toc_entry entry;
|
||||
+ struct cd_toc_entry toc_buffer;
|
||||
+ struct ioc_play_track ti;
|
||||
+#else
|
||||
struct cdrom_tocentry entry;
|
||||
struct cdrom_ti ti;
|
||||
+#endif
|
||||
|
||||
if (cdfile == -1 || !enabled)
|
||||
return;
|
||||
@@ -123,6 +161,21 @@
|
||||
return;
|
||||
}
|
||||
|
||||
+#if defined(__FreeBSD__)
|
||||
+ #define CDROM_DATA_TRACK 4
|
||||
+ bzero((char *)&toc_buffer, sizeof(toc_buffer));
|
||||
+ entry.data_len = sizeof(toc_buffer);
|
||||
+ entry.data = &toc_buffer;
|
||||
+ // don't try to play a non-audio track
|
||||
+ entry.starting_track = track;
|
||||
+ entry.address_format = CD_MSF_FORMAT;
|
||||
+ if ( ioctl(cdfile, CDIOREADTOCENTRYS, &entry) == -1 )
|
||||
+ {
|
||||
+ Com_DPrintf("ioctl cdromreadtocentry failed\n");
|
||||
+ return;
|
||||
+ }
|
||||
+ if (toc_buffer.control == CDROM_DATA_TRACK)
|
||||
+#else
|
||||
// don't try to play a non-audio track
|
||||
entry.cdte_track = track;
|
||||
entry.cdte_format = CDROM_MSF;
|
||||
@@ -132,6 +185,7 @@
|
||||
return;
|
||||
}
|
||||
if (entry.cdte_ctrl == CDROM_DATA_TRACK)
|
||||
+#endif
|
||||
{
|
||||
Com_Printf("CDAudio: track %i is not audio\n", track);
|
||||
return;
|
||||
@@ -144,18 +198,33 @@
|
||||
CDAudio_Stop();
|
||||
}
|
||||
|
||||
+#if defined(__FreeBSD__)
|
||||
+ ti.start_track = track;
|
||||
+ ti.end_track = track;
|
||||
+ ti.start_index = 1;
|
||||
+ ti.end_index = 99;
|
||||
+#else
|
||||
ti.cdti_trk0 = track;
|
||||
ti.cdti_trk1 = track;
|
||||
- ti.cdti_ind0 = 1;
|
||||
- ti.cdti_ind1 = 99;
|
||||
+ ti.cdti_ind0 = 0;
|
||||
+ ti.cdti_ind1 = 0;
|
||||
+#endif
|
||||
|
||||
- if ( ioctl(cdfile, CDROMPLAYTRKIND, &ti) == -1 )
|
||||
- {
|
||||
+#if defined(__FreeBSD__)
|
||||
+ if ( ioctl(cdfile, CDIOCPLAYTRACKS, &ti) == -1 )
|
||||
+#else
|
||||
+ if ( ioctl(cdfile, CDROMPLAYTRKIND, &ti) == -1 )
|
||||
+#endif
|
||||
+ {
|
||||
Com_DPrintf("ioctl cdromplaytrkind failed\n");
|
||||
return;
|
||||
}
|
||||
|
||||
- if ( ioctl(cdfile, CDROMRESUME) == -1 )
|
||||
+#if defined(__FreeBSD__)
|
||||
+ if ( ioctl(cdfile, CDIOCRESUME) == -1 )
|
||||
+#else
|
||||
+ if ( ioctl(cdfile, CDROMRESUME) == -1 )
|
||||
+#endif
|
||||
Com_DPrintf("ioctl cdromresume failed\n");
|
||||
|
||||
playLooping = looping;
|
||||
@@ -175,8 +244,13 @@
|
||||
if (!playing)
|
||||
return;
|
||||
|
||||
+#if defined(__FreeBSD__)
|
||||
+ if ( ioctl(cdfile, CDIOCSTOP) == -1 )
|
||||
+ Com_DPrintf("ioctl cdiocstop failed (%d)\n", errno);
|
||||
+#else
|
||||
if ( ioctl(cdfile, CDROMSTOP) == -1 )
|
||||
Com_DPrintf("ioctl cdromstop failed (%d)\n", errno);
|
||||
+#endif
|
||||
|
||||
wasPlaying = false;
|
||||
playing = false;
|
||||
@@ -190,8 +264,13 @@
|
||||
if (!playing)
|
||||
return;
|
||||
|
||||
+#if defined(__FreeBSD__)
|
||||
+ if ( ioctl(cdfile, CDIOCPAUSE) == -1 )
|
||||
+ Com_DPrintf("ioctl cdiocpause failed\n");
|
||||
+#else
|
||||
if ( ioctl(cdfile, CDROMPAUSE) == -1 )
|
||||
Com_DPrintf("ioctl cdrompause failed\n");
|
||||
+#endif
|
||||
|
||||
wasPlaying = playing;
|
||||
playing = false;
|
||||
@@ -209,8 +288,13 @@
|
||||
if (!wasPlaying)
|
||||
return;
|
||||
|
||||
+#if defined(__FreeBSD__)
|
||||
+ if ( ioctl(cdfile, CDIOCRESUME) == -1 )
|
||||
+ Com_DPrintf("ioctl cdiocresume failed\n");
|
||||
+#else
|
||||
if ( ioctl(cdfile, CDROMRESUME) == -1 )
|
||||
Com_DPrintf("ioctl cdromresume failed\n");
|
||||
+#endif
|
||||
playing = true;
|
||||
}
|
||||
|
||||
@@ -334,7 +418,12 @@
|
||||
|
||||
void CDAudio_Update(void)
|
||||
{
|
||||
+#if defined(__FreeBSD__)
|
||||
+ struct ioc_read_subchannel subchnl;
|
||||
+ struct cd_sub_channel_info data;
|
||||
+#else
|
||||
struct cdrom_subchnl subchnl;
|
||||
+#endif
|
||||
static time_t lastchk;
|
||||
|
||||
if (cdfile == -1 || !enabled)
|
||||
@@ -358,6 +447,24 @@
|
||||
|
||||
if (playing && lastchk < time(NULL)) {
|
||||
lastchk = time(NULL) + 2; //two seconds between chks
|
||||
+#if defined(__FreeBSD__)
|
||||
+ subchnl.address_format = CD_MSF_FORMAT;
|
||||
+ subchnl.data_format = CD_CURRENT_POSITION;
|
||||
+ subchnl.data_len = sizeof(data);
|
||||
+ subchnl.track = playTrack;
|
||||
+ subchnl.data = &data;
|
||||
+ if (ioctl(cdfile, CDIOCREADSUBCHANNEL, &subchnl) == -1 ) {
|
||||
+ Com_DPrintf("ioctl cdiocreadsubchannel failed\n");
|
||||
+ playing = false;
|
||||
+ return;
|
||||
+ }
|
||||
+ if (subchnl.data->header.audio_status != CD_AS_PLAY_IN_PROGRESS &&
|
||||
+ subchnl.data->header.audio_status != CD_AS_PLAY_PAUSED) {
|
||||
+ playing = false;
|
||||
+ if (playLooping)
|
||||
+ CDAudio_Play(playTrack, true);
|
||||
+ }
|
||||
+#else
|
||||
subchnl.cdsc_format = CDROM_MSF;
|
||||
if (ioctl(cdfile, CDROMSUBCHNL, &subchnl) == -1 ) {
|
||||
Com_DPrintf("ioctl cdromsubchnl failed\n");
|
||||
@@ -370,6 +477,7 @@
|
||||
if (playLooping)
|
||||
CDAudio_Play(playTrack, true);
|
||||
}
|
||||
+#endif
|
||||
}
|
||||
}
|
||||
|
@ -1,25 +0,0 @@
|
||||
--- ./linux/gl_glx.c.orig Tue May 16 15:20:09 2006
|
||||
+++ ./linux/gl_glx.c Tue May 16 15:20:10 2006
|
||||
@@ -34,7 +34,9 @@
|
||||
#include <termios.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/stat.h>
|
||||
+#ifdef __linux__
|
||||
#include <sys/vt.h>
|
||||
+#endif
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
@@ -342,10 +344,8 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
- mx = -((int)event.xmotion.x - mwx);// * 2;
|
||||
- my = -((int)event.xmotion.y - mwy);// * 2;
|
||||
- mwx = event.xmotion.x;
|
||||
- mwy = event.xmotion.y;
|
||||
+ mx += ((int)event.xmotion.x - mwx);
|
||||
+ my += ((int)event.xmotion.y - mwy);
|
||||
|
||||
if (mx || my)
|
||||
dowarp = true;
|
@ -1,56 +0,0 @@
|
||||
--- ./linux/q_shlinux.c.orig Tue May 16 15:20:09 2006
|
||||
+++ ./linux/q_shlinux.c Tue May 16 15:20:10 2006
|
||||
@@ -30,6 +30,11 @@
|
||||
|
||||
#include "../qcommon/qcommon.h"
|
||||
|
||||
+#ifndef __linux__
|
||||
+/* For round_page() macro. */
|
||||
+#include <machine/param.h>
|
||||
+#endif
|
||||
+
|
||||
//===============================================================================
|
||||
|
||||
byte *membase;
|
||||
@@ -42,7 +47,7 @@
|
||||
maxhunksize = maxsize + sizeof(int);
|
||||
curhunksize = 0;
|
||||
membase = mmap(0, maxhunksize, PROT_READ|PROT_WRITE,
|
||||
- MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
|
||||
+ MAP_PRIVATE|MAP_ANON, -1, 0);
|
||||
if (membase == NULL || membase == (byte *)-1)
|
||||
Sys_Error("unable to virtual allocate %d bytes", maxsize);
|
||||
|
||||
@@ -68,7 +73,32 @@
|
||||
{
|
||||
byte *n;
|
||||
|
||||
+#ifndef __linux__
|
||||
+ /*
|
||||
+ * The Linux system call mremap() is not present, so a wrapper is
|
||||
+ * needed. This code frees the unused part of the allocated memory
|
||||
+ * (equivalent to mremap() when shrinking a block of memory).
|
||||
+ */
|
||||
+
|
||||
+ size_t old_size = maxhunksize;
|
||||
+ size_t new_size = curhunksize + sizeof(int);
|
||||
+ void * unmap_base;
|
||||
+ size_t unmap_len;
|
||||
+
|
||||
+ new_size = round_page(new_size);
|
||||
+ old_size = round_page(old_size);
|
||||
+
|
||||
+ if (new_size > old_size)
|
||||
+ n = 0; /* error */
|
||||
+ else if (new_size < old_size)
|
||||
+ {
|
||||
+ unmap_base = (caddr_t)(membase + new_size);
|
||||
+ unmap_len = old_size - new_size;
|
||||
+ n = munmap(unmap_base, unmap_len) + membase;
|
||||
+ }
|
||||
+#else
|
||||
n = mremap(membase, maxhunksize, curhunksize + sizeof(int), 0);
|
||||
+#endif
|
||||
if (n != membase)
|
||||
Sys_Error("Hunk_End: Could not remap virtual block (%d)", errno);
|
||||
*((int *)membase) = curhunksize + sizeof(int);
|
@ -1,341 +0,0 @@
|
||||
--- linux/snd_linux.c.orig Tue Jan 9 17:56:35 2007
|
||||
+++ linux/snd_linux.c Tue Jan 9 17:58:43 2007
|
||||
@@ -25,13 +25,17 @@
|
||||
#include <sys/mman.h>
|
||||
#include <sys/shm.h>
|
||||
#include <sys/wait.h>
|
||||
+#ifdef __linux__
|
||||
#include <linux/soundcard.h>
|
||||
+#else
|
||||
+#include <sys/soundcard.h>
|
||||
+#endif
|
||||
#include <stdio.h>
|
||||
|
||||
#include "../client/client.h"
|
||||
#include "../client/snd_loc.h"
|
||||
|
||||
-int audio_fd;
|
||||
+int audio_fd = -1;
|
||||
int snd_inited;
|
||||
|
||||
cvar_t *sndbits;
|
||||
@@ -54,7 +58,9 @@
|
||||
extern uid_t saved_euid;
|
||||
|
||||
if (snd_inited)
|
||||
- return;
|
||||
+ return 1;
|
||||
+
|
||||
+ snd_inited = 0;
|
||||
|
||||
if (!snddevice) {
|
||||
sndbits = Cvar_Get("sndbits", "16", CVAR_ARCHIVE);
|
||||
@@ -65,165 +71,182 @@
|
||||
|
||||
// open /dev/dsp, confirm capability to mmap, and get size of dma buffer
|
||||
|
||||
- if (!audio_fd) {
|
||||
+ if (audio_fd == -1)
|
||||
+ {
|
||||
seteuid(saved_euid);
|
||||
|
||||
audio_fd = open(snddevice->string, O_RDWR);
|
||||
|
||||
- seteuid(getuid());
|
||||
-
|
||||
- if (audio_fd < 0)
|
||||
+ if (audio_fd == -1)
|
||||
{
|
||||
perror(snddevice->string);
|
||||
- Com_Printf("Could not open %s\n", snddevice->string);
|
||||
+ seteuid(getuid());
|
||||
+ Com_Printf("SNDDMA_Init: Could not open %s.\n", snddevice->string);
|
||||
return 0;
|
||||
}
|
||||
+ seteuid(getuid());
|
||||
}
|
||||
|
||||
- rc = ioctl(audio_fd, SNDCTL_DSP_RESET, 0);
|
||||
- if (rc < 0)
|
||||
+ rc = ioctl(audio_fd, SNDCTL_DSP_RESET, 0);
|
||||
+ if (rc == -1)
|
||||
{
|
||||
perror(snddevice->string);
|
||||
- Com_Printf("Could not reset %s\n", snddevice->string);
|
||||
+ Com_Printf("SNDDMA_Init: Could not reset %s.\n", snddevice->string);
|
||||
close(audio_fd);
|
||||
+ audio_fd = -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ioctl(audio_fd, SNDCTL_DSP_GETCAPS, &caps)==-1)
|
||||
{
|
||||
perror(snddevice->string);
|
||||
- Com_Printf("Sound driver too old\n");
|
||||
+ Com_Printf("SNDDMA_Init: Sound driver too old.\n");
|
||||
close(audio_fd);
|
||||
+ audio_fd = -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!(caps & DSP_CAP_TRIGGER) || !(caps & DSP_CAP_MMAP))
|
||||
{
|
||||
- Com_Printf("Sorry but your soundcard can't do this\n");
|
||||
+ Com_Printf("SNDDMA_Init: Sorry, but your soundcard doesn't support trigger or mmap. (%08x)\n", caps);
|
||||
close(audio_fd);
|
||||
+ audio_fd = -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
- if (ioctl(audio_fd, SNDCTL_DSP_GETOSPACE, &info)==-1)
|
||||
- {
|
||||
- perror("GETOSPACE");
|
||||
- Com_Printf("Um, can't do GETOSPACE?\n");
|
||||
+ if (ioctl(audio_fd, SNDCTL_DSP_GETOSPACE, &info)==-1)
|
||||
+ {
|
||||
+ perror("GETOSPACE");
|
||||
+ Com_Printf("SNDDMA_Init: GETOSPACE ioctl failed.\n");
|
||||
close(audio_fd);
|
||||
+ audio_fd = -1;
|
||||
return 0;
|
||||
- }
|
||||
+ }
|
||||
|
||||
// set sample bits & speed
|
||||
|
||||
- dma.samplebits = (int)sndbits->value;
|
||||
+ dma.samplebits = (int)sndbits->value;
|
||||
if (dma.samplebits != 16 && dma.samplebits != 8)
|
||||
- {
|
||||
- ioctl(audio_fd, SNDCTL_DSP_GETFMTS, &fmt);
|
||||
- if (fmt & AFMT_S16_LE) dma.samplebits = 16;
|
||||
- else if (fmt & AFMT_U8) dma.samplebits = 8;
|
||||
- }
|
||||
-
|
||||
- dma.speed = (int)sndspeed->value;
|
||||
- if (!dma.speed) {
|
||||
- for (i=0 ; i<sizeof(tryrates)/4 ; i++)
|
||||
- if (!ioctl(audio_fd, SNDCTL_DSP_SPEED, &tryrates[i])) break;
|
||||
- dma.speed = tryrates[i];
|
||||
- }
|
||||
-
|
||||
- dma.channels = (int)sndchannels->value;
|
||||
- if (dma.channels < 1 || dma.channels > 2)
|
||||
- dma.channels = 2;
|
||||
-
|
||||
- dma.samples = info.fragstotal * info.fragsize / (dma.samplebits/8);
|
||||
- dma.submission_chunk = 1;
|
||||
-
|
||||
-// memory map the dma buffer
|
||||
+ {
|
||||
+ ioctl(audio_fd, SNDCTL_DSP_GETFMTS, &fmt);
|
||||
+ if (fmt & AFMT_S16_LE) dma.samplebits = 16;
|
||||
+ else if (fmt & AFMT_U8) dma.samplebits = 8;
|
||||
+ }
|
||||
|
||||
- if (!dma.buffer)
|
||||
- dma.buffer = (unsigned char *) mmap(NULL, info.fragstotal
|
||||
- * info.fragsize, PROT_WRITE, MAP_FILE|MAP_SHARED, audio_fd, 0);
|
||||
- if (!dma.buffer)
|
||||
+ if (dma.samplebits == 16)
|
||||
+ {
|
||||
+ rc = AFMT_S16_LE;
|
||||
+ rc = ioctl(audio_fd, SNDCTL_DSP_SETFMT, &rc);
|
||||
+ if (rc < 0)
|
||||
+ {
|
||||
+ perror(snddevice->string);
|
||||
+ Com_Printf("SNDDMA_Init: Could not support 16-bit data. Try 8-bit.\n");
|
||||
+ close(audio_fd);
|
||||
+ audio_fd = -1;
|
||||
+ return 0;
|
||||
+ }
|
||||
+ }
|
||||
+ else if (dma.samplebits == 8)
|
||||
+ {
|
||||
+ rc = AFMT_U8;
|
||||
+ rc = ioctl(audio_fd, SNDCTL_DSP_SETFMT, &rc);
|
||||
+ if (rc < 0)
|
||||
+ {
|
||||
+ perror(snddevice->string);
|
||||
+ Com_Printf("SNDDMA_Init: Could not support 8-bit data.\n");
|
||||
+ close(audio_fd);
|
||||
+ audio_fd = -1;
|
||||
+ return 0;
|
||||
+ }
|
||||
+ }
|
||||
+ else
|
||||
{
|
||||
perror(snddevice->string);
|
||||
- Com_Printf("Could not mmap %s\n", snddevice->string);
|
||||
+ Com_Printf("SNDDMA_Init: %d-bit sound not supported.", dma.samplebits);
|
||||
close(audio_fd);
|
||||
+ audio_fd = -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
+ dma.speed = (int)sndspeed->value;
|
||||
+ if (!dma.speed)
|
||||
+ {
|
||||
+ for (i=0 ; i<sizeof(tryrates)/4 ; i++)
|
||||
+ if (!ioctl(audio_fd, SNDCTL_DSP_SPEED, &tryrates[i]))
|
||||
+ break;
|
||||
+ dma.speed = tryrates[i];
|
||||
+ }
|
||||
+
|
||||
+ dma.channels = (int)sndchannels->value;
|
||||
+ if (dma.channels < 1 || dma.channels > 2)
|
||||
+ dma.channels = 2;
|
||||
+
|
||||
tmp = 0;
|
||||
if (dma.channels == 2)
|
||||
tmp = 1;
|
||||
- rc = ioctl(audio_fd, SNDCTL_DSP_STEREO, &tmp);
|
||||
- if (rc < 0)
|
||||
- {
|
||||
+ rc = ioctl(audio_fd, SNDCTL_DSP_STEREO, &tmp); //FP: bugs here.
|
||||
+ if (rc < 0)
|
||||
+ {
|
||||
perror(snddevice->string);
|
||||
- Com_Printf("Could not set %s to stereo=%d", snddevice->string, dma.channels);
|
||||
+ Com_Printf("SNDDMA_Init: Could not set %s to stereo=%d.", snddevice->string, dma.channels);
|
||||
close(audio_fd);
|
||||
- return 0;
|
||||
- }
|
||||
+ audio_fd = -1;
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
if (tmp)
|
||||
dma.channels = 2;
|
||||
else
|
||||
dma.channels = 1;
|
||||
|
||||
- rc = ioctl(audio_fd, SNDCTL_DSP_SPEED, &dma.speed);
|
||||
- if (rc < 0)
|
||||
- {
|
||||
+
|
||||
+ rc = ioctl(audio_fd, SNDCTL_DSP_SPEED, &dma.speed);
|
||||
+ if (rc < 0)
|
||||
+ {
|
||||
perror(snddevice->string);
|
||||
- Com_Printf("Could not set %s speed to %d", snddevice->string, dma.speed);
|
||||
+ Com_Printf("SNDDMA_Init: Could not set %s speed to %d.", snddevice->string, dma.speed);
|
||||
close(audio_fd);
|
||||
- return 0;
|
||||
- }
|
||||
+ audio_fd = -1;
|
||||
+ return 0;
|
||||
+ }
|
||||
|
||||
- if (dma.samplebits == 16)
|
||||
- {
|
||||
- rc = AFMT_S16_LE;
|
||||
- rc = ioctl(audio_fd, SNDCTL_DSP_SETFMT, &rc);
|
||||
- if (rc < 0)
|
||||
- {
|
||||
- perror(snddevice->string);
|
||||
- Com_Printf("Could not support 16-bit data. Try 8-bit.\n");
|
||||
- close(audio_fd);
|
||||
- return 0;
|
||||
- }
|
||||
- }
|
||||
- else if (dma.samplebits == 8)
|
||||
- {
|
||||
- rc = AFMT_U8;
|
||||
- rc = ioctl(audio_fd, SNDCTL_DSP_SETFMT, &rc);
|
||||
- if (rc < 0)
|
||||
- {
|
||||
- perror(snddevice->string);
|
||||
- Com_Printf("Could not support 8-bit data.\n");
|
||||
- close(audio_fd);
|
||||
- return 0;
|
||||
- }
|
||||
- }
|
||||
- else
|
||||
+ dma.samples = info.fragstotal * info.fragsize / (dma.samplebits/8);
|
||||
+ dma.submission_chunk = 1;
|
||||
+
|
||||
+// memory map the dma buffer
|
||||
+
|
||||
+ if (!dma.buffer)
|
||||
+ dma.buffer = (unsigned char *) mmap(NULL, info.fragstotal
|
||||
+ * info.fragsize, PROT_WRITE|PROT_READ, MAP_FILE|MAP_SHARED, audio_fd, 0);
|
||||
+ if (!dma.buffer || dma.buffer == MAP_FAILED)
|
||||
{
|
||||
perror(snddevice->string);
|
||||
- Com_Printf("%d-bit sound not supported.", dma.samplebits);
|
||||
+ Com_Printf("SNDDMA_Init: Could not mmap %s.\n", snddevice->string);
|
||||
close(audio_fd);
|
||||
+ audio_fd = -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// toggle the trigger & start her up
|
||||
|
||||
- tmp = 0;
|
||||
- rc = ioctl(audio_fd, SNDCTL_DSP_SETTRIGGER, &tmp);
|
||||
+ tmp = 0;
|
||||
+ rc = ioctl(audio_fd, SNDCTL_DSP_SETTRIGGER, &tmp);
|
||||
if (rc < 0)
|
||||
{
|
||||
perror(snddevice->string);
|
||||
- Com_Printf("Could not toggle.\n");
|
||||
+ Com_Printf("SNDDMA_Init: Could not toggle. (1)\n");
|
||||
close(audio_fd);
|
||||
+ audio_fd = -1;
|
||||
return 0;
|
||||
}
|
||||
- tmp = PCM_ENABLE_OUTPUT;
|
||||
- rc = ioctl(audio_fd, SNDCTL_DSP_SETTRIGGER, &tmp);
|
||||
+ tmp = PCM_ENABLE_OUTPUT;
|
||||
+ rc = ioctl(audio_fd, SNDCTL_DSP_SETTRIGGER, &tmp);
|
||||
if (rc < 0)
|
||||
{
|
||||
perror(snddevice->string);
|
||||
- Com_Printf("Could not toggle.\n");
|
||||
+ Com_Printf("SNDDMA_Init: Could not toggle. (2)\n");
|
||||
close(audio_fd);
|
||||
+ audio_fd = -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -231,12 +254,10 @@
|
||||
|
||||
snd_inited = 1;
|
||||
return 1;
|
||||
-
|
||||
}
|
||||
|
||||
int SNDDMA_GetDMAPos(void)
|
||||
{
|
||||
-
|
||||
struct count_info count;
|
||||
|
||||
if (!snd_inited) return 0;
|
||||
@@ -244,8 +265,9 @@
|
||||
if (ioctl(audio_fd, SNDCTL_DSP_GETOPTR, &count)==-1)
|
||||
{
|
||||
perror(snddevice->string);
|
||||
- Com_Printf("Uh, sound dead.\n");
|
||||
+ Com_Printf("SNDDMA_GetDMAPos: GETOPTR failed.\n");
|
||||
close(audio_fd);
|
||||
+ audio_fd = -1;
|
||||
snd_inited = 0;
|
||||
return 0;
|
||||
}
|
||||
@@ -254,7 +276,6 @@
|
||||
dma.samplepos = count.ptr / (dma.samplebits / 8);
|
||||
|
||||
return dma.samplepos;
|
||||
-
|
||||
}
|
||||
|
||||
void SNDDMA_Shutdown(void)
|
||||
@@ -263,6 +284,7 @@
|
||||
if (snd_inited)
|
||||
{
|
||||
close(audio_fd);
|
||||
+ audio_fd = -1;
|
||||
snd_inited = 0;
|
||||
}
|
||||
#endif
|
@ -1,23 +0,0 @@
|
||||
--- ./linux/sys_linux.c.orig Tue May 16 15:20:10 2006
|
||||
+++ ./linux/sys_linux.c Tue May 16 15:20:10 2006
|
||||
@@ -217,19 +217,7 @@
|
||||
char name[MAX_OSPATH];
|
||||
char *path;
|
||||
char *str_p;
|
||||
-#if defined __i386__
|
||||
- const char *gamename = "gamei386.so";
|
||||
-#elif defined __x86_64__
|
||||
- const char *gamename = "gamex86_64.so";
|
||||
-#elif defined __alpha__
|
||||
- const char *gamename = "gameaxp.so";
|
||||
-#elif defined __powerpc__
|
||||
- const char *gamename = "gameppc.so";
|
||||
-#elif defined __sparc__
|
||||
- const char *gamename = "gamesparc.so";
|
||||
-#else
|
||||
-#error Unknown arch
|
||||
-#endif
|
||||
+ const char *gamename = "game.so";
|
||||
|
||||
setreuid(getuid(), getuid());
|
||||
setegid(getgid());
|
@ -1,25 +0,0 @@
|
||||
--- ./qcommon/cmd.c.orig Tue May 16 15:20:10 2006
|
||||
+++ ./qcommon/cmd.c Tue May 16 15:20:10 2006
|
||||
@@ -215,8 +215,10 @@
|
||||
if (text[i] == '\n')
|
||||
break;
|
||||
}
|
||||
-
|
||||
-
|
||||
+ // sku - removed potentional buffer overflow vulnerability
|
||||
+ if( i > sizeof( line ) - 1 ) {
|
||||
+ i = sizeof( line ) - 1;
|
||||
+ }
|
||||
memcpy (line, text, i);
|
||||
line[i] = 0;
|
||||
|
||||
@@ -657,7 +659,8 @@
|
||||
{
|
||||
int l;
|
||||
|
||||
- strcpy (cmd_args, text);
|
||||
+ // sku - removed potentional buffer overflow vulnerability
|
||||
+ strncpy( cmd_args, text, sizeof( cmd_args ) );
|
||||
|
||||
// strip off any trailing whitespace
|
||||
l = strlen(cmd_args) - 1;
|
@ -1,24 +0,0 @@
|
||||
--- ./qcommon/common.c.orig Tue May 16 15:20:10 2006
|
||||
+++ ./qcommon/common.c Tue May 16 15:20:10 2006
|
||||
@@ -781,7 +781,9 @@
|
||||
l = 0;
|
||||
do
|
||||
{
|
||||
- c = MSG_ReadChar (msg_read);
|
||||
+ // sku - replaced MSG_ReadChar with MSG_ReadByte to avoid
|
||||
+ // potentional vulnerability
|
||||
+ c = MSG_ReadByte (msg_read);
|
||||
if (c == -1 || c == 0)
|
||||
break;
|
||||
string[l] = c;
|
||||
@@ -801,7 +803,9 @@
|
||||
l = 0;
|
||||
do
|
||||
{
|
||||
- c = MSG_ReadChar (msg_read);
|
||||
+ // sku - replaced MSG_ReadChar with MSG_ReadByte to avoid
|
||||
+ // potentional vulnerability
|
||||
+ c = MSG_ReadByte (msg_read);
|
||||
if (c == -1 || c == 0 || c == '\n')
|
||||
break;
|
||||
string[l] = c;
|
35
games/alienarena/files/patch-qcommon__files.c
Normal file
35
games/alienarena/files/patch-qcommon__files.c
Normal file
@ -0,0 +1,35 @@
|
||||
--- ./qcommon/files.c.orig Wed Apr 18 14:28:43 2007
|
||||
+++ ./qcommon/files.c Sat Jul 21 09:36:05 2007
|
||||
@@ -776,6 +776,12 @@
|
||||
else
|
||||
{
|
||||
Cvar_FullSet ("gamedir", dir, CVAR_SERVERINFO|CVAR_NOSET);
|
||||
+#ifdef DATADIR
|
||||
+ FS_AddGameDirectory (va("%s/%s", DATADIR, dir) );
|
||||
+#endif
|
||||
+#ifdef LIBDIR
|
||||
+ FS_AddGameDirectory (va("%s/%s", LIBDIR, dir) );
|
||||
+#endif
|
||||
if (fs_cddir->string[0])
|
||||
FS_AddGameDirectory (va("%s/%s", fs_cddir->string, dir) );
|
||||
FS_AddGameDirectory (va("%s/%s", fs_basedir->string, dir) );
|
||||
@@ -1020,6 +1026,19 @@
|
||||
Cmd_AddCommand ("path", FS_Path_f);
|
||||
Cmd_AddCommand ("link", FS_Link_f);
|
||||
Cmd_AddCommand ("dir", FS_Dir_f );
|
||||
+
|
||||
+ //
|
||||
+ // DATADIR / LIBDIR support.
|
||||
+ // Both directories are used to load data and libraries from, allowing
|
||||
+ // different OSes to have them where they want, according to their
|
||||
+ // conventions.
|
||||
+ //
|
||||
+#ifdef DATADIR
|
||||
+ FS_AddGameDirectory (va("%s/"BASEDIRNAME, DATADIR));
|
||||
+#endif
|
||||
+#ifdef LIBDIR
|
||||
+ FS_AddGameDirectory (va("%s/"BASEDIRNAME, LIBDIR));
|
||||
+#endif
|
||||
|
||||
//
|
||||
// basedir <path>
|
18
games/alienarena/files/patch-ref_gl__qgl.h
Normal file
18
games/alienarena/files/patch-ref_gl__qgl.h
Normal file
@ -0,0 +1,18 @@
|
||||
--- ref_gl/qgl.h.orig Sat Jul 21 11:52:11 2007
|
||||
+++ ref_gl/qgl.h Sat Jul 21 11:54:16 2007
|
||||
@@ -393,6 +393,7 @@
|
||||
extern void ( APIENTRY * qglClientActiveTextureARB)( GLenum );
|
||||
|
||||
extern void ( APIENTRY * qglMultiTexCoord3fvARB)( GLenum, GLfloat * );
|
||||
+#if 0
|
||||
// jitwater - fragment programs (pixel shaders)
|
||||
typedef void (APIENTRY * PFNGLPROGRAMSTRINGARBPROC) (GLenum target, GLenum format, GLsizei len, const GLvoid *string);
|
||||
typedef void (APIENTRY * PFNGLBINDPROGRAMARBPROC) (GLenum target, GLuint program);
|
||||
@@ -412,6 +413,7 @@
|
||||
typedef void (APIENTRY * PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat *params);
|
||||
typedef void (APIENTRY * PFNGLGETPROGRAMIVARBPROC) (GLenum target, GLenum pname, GLint *params);
|
||||
typedef void (APIENTRY * PFNGLGETPROGRAMSTRINGARBPROC) (GLenum target, GLenum pname, GLvoid *string);
|
||||
+#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
|
@ -1,27 +0,0 @@
|
||||
--- server/sv_main.c.orig Fri Mar 30 23:15:20 2007
|
||||
+++ server/sv_main.c Fri Mar 30 23:16:36 2007
|
||||
@@ -450,8 +450,9 @@
|
||||
return;
|
||||
}
|
||||
|
||||
- strncpy (userinfo, Cmd_Argv(4), sizeof(userinfo)-1);
|
||||
- userinfo[sizeof(userinfo) - 1] = 0;
|
||||
+ // sku - reserve 32 bytes for the IP address
|
||||
+ strncpy (userinfo, Cmd_Argv(4), sizeof(userinfo)-32);
|
||||
+ userinfo[sizeof(userinfo) - 32] = 0;
|
||||
|
||||
//check it is not overflowed, save enough bytes for /ip/111.222.333.444:55555
|
||||
if (strlen(userinfo) + 25 >= sizeof(userinfo)-1)
|
||||
@@ -595,12 +596,6 @@
|
||||
Netchan_OutOfBandPrint (NS_SERVER, adr, "print\nConnection refused.\n" );
|
||||
Com_DPrintf ("Game rejected a connection.\n");
|
||||
return;
|
||||
- }
|
||||
-
|
||||
- if (userinfo[MAX_INFO_STRING-1])
|
||||
- {
|
||||
- //probably already crashed by now but worth a try
|
||||
- Com_Error (ERR_FATAL, "Userinfo string length overflowed after ClientConnect");
|
||||
}
|
||||
|
||||
// parse some info from the info strings
|
@ -1,51 +0,0 @@
|
||||
--- ./server/sv_user.c.orig Tue May 16 15:20:10 2006
|
||||
+++ ./server/sv_user.c Tue May 16 15:20:10 2006
|
||||
@@ -142,6 +142,9 @@
|
||||
}
|
||||
|
||||
start = atoi(Cmd_Argv(2));
|
||||
+ if( start < 0 ) {
|
||||
+ start = 0; // sku - catch negative offsets
|
||||
+ }
|
||||
|
||||
// write a packet full of data
|
||||
|
||||
@@ -150,9 +153,18 @@
|
||||
{
|
||||
if (sv.configstrings[start][0])
|
||||
{
|
||||
+ int length;
|
||||
+
|
||||
+ // sku - write configstrings that exceed MAX_QPATH in proper-sized chunks
|
||||
+ length = strlen( sv.configstrings[start] );
|
||||
+ if( length > MAX_QPATH ) {
|
||||
+ length = MAX_QPATH;
|
||||
+ }
|
||||
+
|
||||
MSG_WriteByte (&sv_client->netchan.message, svc_configstring);
|
||||
MSG_WriteShort (&sv_client->netchan.message, start);
|
||||
- MSG_WriteString (&sv_client->netchan.message, sv.configstrings[start]);
|
||||
+ SZ_Write (&sv_client->netchan.message, sv.configstrings[start], length);
|
||||
+ MSG_WriteByte (&sv_client->netchan.message, 0);
|
||||
}
|
||||
start++;
|
||||
}
|
||||
@@ -199,6 +211,9 @@
|
||||
}
|
||||
|
||||
start = atoi(Cmd_Argv(2));
|
||||
+ if( start < 0 ) {
|
||||
+ start = 0;
|
||||
+ }
|
||||
|
||||
memset (&nullstate, 0, sizeof(nullstate));
|
||||
|
||||
@@ -399,7 +414,7 @@
|
||||
*/
|
||||
void SV_ShowServerinfo_f (void)
|
||||
{
|
||||
- Info_Print (Cvar_Serverinfo());
|
||||
+// Info_Print (Cvar_Serverinfo());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user