1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-30 10:38:37 +00:00

AA2K6 is the latest in a series of standalone games based on a classic Sci-Fi

theme with a modern, updated visual experience. With 25 levels, five modes of
play, mutators, built-in bots, 9 characters, 8 weapons (3 with alt-fire
modes), the game has an endless supply of replayability. Billed as the sequel
to 2004's CodeRED: Alien Arena, AA2K6 is much more than that. With the trials
and tribulations of software development, endless hours of playing, gathering
feedback, COR Entertainment has been able to not only fine tune and perfect
it's flagship game, but add completely new dimensions to it.

WWW: http://red.planetarena.org/

PR:		ports/91803
Approved by:	garga (mentor)
This commit is contained in:
Alejandro Pulver 2006-05-18 17:28:15 +00:00
parent 456ebe191c
commit b02d4abd83
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=162720
23 changed files with 1267 additions and 0 deletions

View File

@ -28,6 +28,7 @@
SUBDIR += airrox
SUBDIR += alephone
SUBDIR += alephone-data
SUBDIR += alienarena
SUBDIR += alienarena-data
SUBDIR += alienblaster
SUBDIR += alienwave

95
games/alienarena/Makefile Normal file
View File

@ -0,0 +1,95 @@
# New ports collection makefile for: alienarena
# Date created: 11 May 2006
# Whom: alepulver
#
# $FreeBSD$
#
PORTNAME= alienarena
DISTVERSION= 2006.ge
CATEGORIES= games
MASTER_SITES= http://offload1.icculus.org/~ravage/alienarena2006/ \
http://cor.planetquake.gamespy.com/codered/files/
DISTFILES= ${PORTNAME}-2006ge-x86.run \
aa2k6updateGE501c-x86.zip
MAINTAINER= alepulver@FreeBSD.org
COMMENT= Alien Arena 2006 (native version)
LIB_DEPENDS= jpeg.9:${PORTSDIR}/graphics/jpeg
RUN_DEPENDS= ${DATADIR}/arena/default.cfg:${PORTSDIR}/games/alienarena-data
USE_X_PREFIX= yes
USE_ZIP= yes
USE_DOS2UNIX= yes
USE_GCC= 3.2+
USE_GL= yes
USE_GMAKE= yes
BUILD_WRKSRC= ${WRKDIR}/source/linux
WRKSRC= ${WRKDIR}/source
ALL_TARGET= build_release
OPTIONS= OPTIMIZED_CFLAGS "Enable compilation optimizations" on \
SDL "Build client that uses SDL for sound" on
SUB_FILES= alienarena alienarena-ded
SUB_LIST= LIBDIR=${LIBDIR}
PLIST_SUB= LIBDIR=${LIBDIR:S/${PREFIX}\///}
LIBDIR= ${PREFIX}/lib/${PORTNAME}
.include <bsd.port.pre.mk>
EXE_TARGETS= crx crded
SCRIPTS= alienarena alienarena-ded
.if !defined(WITHOUT_OPTIMIZED_CFLAGS)
MAKE_ENV+= OPTIMIZED_CFLAGS=YES
.endif
.if !defined(WITHOUT_SDL)
USE_SDL= sdl
MAKE_ENV+= SDLSOUND=1
EXE_TARGETS+= crx.sdl
SCRIPTS+= alienarena-sdl
SUB_FILES+= alienarena-sdl
PLIST_SUB+= SDL=""
.else
PLIST_SUB+= SDL="@comment "
.endif
post-patch:
@${FIND} ${WRKSRC} -type f | ${GREP} -Ev \
'(game/g_main|linux/(gl_glx|(q_sh|snd_)linux))\.c' | \
${XARGS} ${REINPLACE_CMD} -e 's/__linux__/__unix__/g'
do-extract:
@${MKDIR} ${WRKDIR}
@cd ${WRKDIR} && \
${TAIL} -c +8814 ${DISTDIR}/${PORTNAME}-2006ge-x86.run | \
${TAR} zxf -
@${TAR} zxf ${WRKDIR}/alienarena-2006ge-src.tar.gz -C ${WRKDIR}
@${UNZIP_CMD} -qod ${WRKDIR} ${DISTDIR}/aa2k6updateGE501c-x86.zip
do-install:
${MKDIR} ${LIBDIR}/arena ${LIBDIR}/data1
cd ${BUILD_WRKSRC}/release && \
${INSTALL_PROGRAM} arena/game.so ${LIBDIR}/arena && \
${INSTALL_PROGRAM} game.so ${LIBDIR}/data1
${LN} -s ${DATADIR}/arena/* ${LIBDIR}/arena
${LN} -s ${DATADIR}/botinfo ${LIBDIR}
${LN} -s ${DATADIR}/data1/* ${LIBDIR}/data1
.for f in ${EXE_TARGETS}
${INSTALL_PROGRAM} ${BUILD_WRKSRC}/release/${f} ${LIBDIR}
.endfor
.for f in ${SCRIPTS}
${INSTALL_SCRIPT} ${WRKDIR}/${f} ${PREFIX}/bin
.endfor
post-install:
@${ECHO_CMD}
@${CAT} ${PKGMESSAGE}
@${ECHO_CMD}
.include <bsd.port.post.mk>

View File

@ -0,0 +1,6 @@
MD5 (alienarena-2006ge-x86.run) = f27923b13dc586b649134d7a4bfc0709
SHA256 (alienarena-2006ge-x86.run) = ce6b47c86bde5b3aefc572897c0e46fc5e8b2cafa178293835ee074951b50e1a
SIZE (alienarena-2006ge-x86.run) = 164160207
MD5 (aa2k6updateGE501c-x86.zip) = 87266deb278b2d88be0c5c08f16b4885
SHA256 (aa2k6updateGE501c-x86.zip) = f08207ce05c8862fcf1a59344e4a815904486b636601d28287e54c10328fecc8
SIZE (aa2k6updateGE501c-x86.zip) = 10860682

View File

@ -0,0 +1,5 @@
#!/bin/sh
cd %%LIBDIR%% || exit 1
exec ./crded +set game arena "$@"

View File

@ -0,0 +1,5 @@
#!/bin/sh
cd %%LIBDIR%% || exit 1
exec ./crx.sdl +set game arena "$@"

View File

@ -0,0 +1,5 @@
#!/bin/sh
cd %%LIBDIR%% || exit 1
exec ./crx +set game arena "$@"

View File

@ -0,0 +1,12 @@
--- ./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 );

View File

@ -0,0 +1,48 @@
--- ./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;
+ }
}
}

View File

@ -0,0 +1,10 @@
--- ./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 */

View File

@ -0,0 +1,17 @@
--- ./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);

View File

@ -0,0 +1,142 @@
--- ./linux/Makefile.orig Tue May 16 15:20:10 2006
+++ ./linux/Makefile Tue May 16 15:22:41 2006
@@ -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,54 +31,38 @@
EGCS=/usr/local/egcs-1.1.2/bin/gcc
-CC=gcc
+CC?=gcc
-ifeq ($(ARCH),x86_64)
-_LIB := lib64
-else
-_LIB := lib
-endif
+BASE_CFLAGS=$(CFLAGS) -Dstricmp=strcasecmp -D_stricmp=strcasecmp
-BASE_CFLAGS=-Dstricmp=strcasecmp -D_stricmp=strcasecmp -D__linux__
+RELEASE_CFLAGS=$(BASE_CFLAGS)
-ifeq ($(ARCH),axp)
-RELEASE_CFLAGS=$(BASE_CFLAGS) -ffast-math -funroll-loops \
+ifdef OPTIMIZED_CFLAGS
+RELEASE_CFLAGS+=-O2 -ffast-math -funroll-loops \
-fomit-frame-pointer -fexpensive-optimizations
+ ifeq ($(ARCH),i386)
+RELEASE_CFLAGS+=-falign-loops=2 -falign-jumps=2 -falign-functions=2 \
+ -fno-strict-aliasing
+ endif
endif
-ifeq ($(ARCH),ppc)
-RELEASE_CFLAGS=$(BASE_CFLAGS) -O2 -ffast-math -funroll-loops \
- -fomit-frame-pointer -fexpensive-optimizations
-endif
+ARENA_CFLAGS=-DARENA
-ifeq ($(ARCH),sparc)
-RELEASE_CFLAGS=$(BASE_CFLAGS) -ffast-math -funroll-loops \
- -fomit-frame-pointer -fexpensive-optimizations
-endif
+DEBUG_CFLAGS=$(BASE_CFLAGS) -g
-ifeq ($(ARCH),i386)
-RELEASE_CFLAGS=$(BASE_CFLAGS) -O2 -ffast-math -funroll-loops -falign-loops=2 \
- -falign-jumps=2 -falign-functions=2 -fno-strict-aliasing
-endif
+LDFLAGS+=-lm
-ifeq ($(ARCH),x86_64)
-RELEASE_CFLAGS=$(BASE_CFLAGS) -O2 -ffast-math -funroll-loops \
- -fomit-frame-pointer -fexpensive-optimizations -fno-strict-aliasing
-endif
+SVGALDFLAGS=-lvga -lm
-ARENA_CFLAGS=-DARENA
+GLCFLAGS=-I$(X11BASE)/include
-DEBUG_CFLAGS=$(BASE_CFLAGS) -g
-LDFLAGS=-ldl -lm
-SVGALDFLAGS=-lvga -lm
-XLDFLAGS=-L/usr/X11R6/$(_LIB) -lX11 -lXext -lXxf86dga
-XCFLAGS=
+XLDFLAGS=-L$(X11BASE)/lib -lX11 -lXext -lXxf86dga
-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)
+SDLCFLAGS=$(shell $(SDL_CONFIG) --cflags)
+SDLLDFLAGS=$(shell $(SDL_CONFIG) --libs)
SHLIBEXT=so
@@ -117,13 +90,13 @@
ifeq ($(ARCH),axp)
TARGETS=$(BUILDDIR)/crded \
- $(BUILDDIR)/game$(ARCH).$(SHLIBEXT) \
- $(BUILDDIR)/arena/game$(ARCH).$(SHLIBEXT)
+ $(BUILDDIR)/game.$(SHLIBEXT) \
+ $(BUILDDIR)/arena/game.$(SHLIBEXT)
else
TARGETS=$(BUILDDIR)/crded \
$(BUILDDIR)/crx \
- $(BUILDDIR)/game$(ARCH).$(SHLIBEXT) \
- $(BUILDDIR)/arena/game$(ARCH).$(SHLIBEXT)
+ $(BUILDDIR)/game.$(SHLIBEXT) \
+ $(BUILDDIR)/arena/game.$(SHLIBEXT)
endif
ifeq ($(strip $(SDLSOUND)),1)
@@ -617,7 +590,7 @@
-$(BUILDDIR)/game$(ARCH).$(SHLIBEXT) : $(GAME_OBJS)
+$(BUILDDIR)/game.$(SHLIBEXT) : $(GAME_OBJS)
$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(GAME_OBJS)
@@ -853,7 +826,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)

View File

@ -0,0 +1,255 @@
--- ./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
}
}

View File

@ -0,0 +1,25 @@
--- ./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) * 2;
+ my += ((int)event.xmotion.y - mwy) * 2;
if (mx || my)
dowarp = true;

View File

@ -0,0 +1,56 @@
--- ./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);

View File

@ -0,0 +1,363 @@
--- ./linux/snd_linux.c.orig Tue May 16 15:20:09 2006
+++ ./linux/snd_linux.c Tue May 16 15:20:10 2006
@@ -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;
@@ -39,24 +43,26 @@
cvar_t *sndchannels;
cvar_t *snddevice;
-static int tryrates[] = { 11025, 22051, 44100, 8000 };
+static int tryrates[] = { 11025, 22051, 44100, 48000, 8000 };
qboolean SNDDMA_Init(void)
{
int rc;
- int fmt;
+ int fmt;
int tmp;
- int i;
- char *s;
+ int i;
struct audio_buf_info info;
int caps;
extern uid_t saved_euid;
if (snd_inited)
- return;
+ return 1;
- if (!snddevice) {
+ snd_inited = 0;
+
+ if (!snddevice)
+ {
sndbits = Cvar_Get("sndbits", "16", CVAR_ARCHIVE);
sndspeed = Cvar_Get("sndspeed", "0", CVAR_ARCHIVE);
sndchannels = Cvar_Get("sndchannels", "2", 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

View File

@ -0,0 +1,23 @@
--- ./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());

View File

@ -0,0 +1,25 @@
--- ./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;

View File

@ -0,0 +1,24 @@
--- ./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;

View File

@ -0,0 +1,40 @@
--- ./server/sv_main.c.orig Tue May 16 15:20:10 2006
+++ ./server/sv_main.c Tue May 16 15:20:10 2006
@@ -445,8 +445,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)
@@ -502,8 +503,11 @@
{
if (NET_CompareBaseAdr (net_from, svs.challenges[i].adr))
{
- if (challenge == svs.challenges[i].challenge)
+ // sku - ignore zero challenges
+ if( svs.challenges[i].challenge && challenge == svs.challenges[i].challenge ) {
+ svs.challenges[i].challenge = 0;
break; // good
+ }
Netchan_OutOfBandPrint (NS_SERVER, adr, "print\nBad challenge.\n");
return;
}
@@ -588,12 +592,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

View File

@ -0,0 +1,51 @@
--- ./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());
}

View File

@ -0,0 +1,10 @@
AA2K6 is the latest in a series of standalone games based on a classic Sci-Fi
theme with a modern, updated visual experience. With 25 levels, five modes of
play, mutators, built-in bots, 9 characters, 8 weapons (3 with alt-fire
modes), the game has an endless supply of replayability. Billed as the sequel
to 2004's CodeRED: Alien Arena, AA2K6 is much more than that. With the trials
and tribulations of software development, endless hours of playing, gathering
feedback, COR Entertainment has been able to not only fine tune and perfect
it's flagship game, but add completely new dimensions to it.
WWW: http://red.planetarena.org/

View File

@ -0,0 +1,15 @@
==============================================================================
Alien Arena 2006 (native version) has been installed.
The OSS (native FreeBSD sound) version of Alien Arena 2006 (named
"alienarena") uses by default a slow sound speed, which causes a notable
delay. To solve this you have to run it once like this:
alienarena +set sndspeed <speed>
Where <speed> could be 22050 and 44100 for example (the default that has the
delay is 11025, and the SDL version uses 22050). The value of "sndspeed" will
be saved in the configuration file for future runs.
==============================================================================

View File

@ -0,0 +1,34 @@
bin/alienarena
bin/alienarena-ded
%%SDL%%bin/alienarena-sdl
%%LIBDIR%%/arena/ctf.cfg
%%LIBDIR%%/arena/default.cfg
%%LIBDIR%%/arena/game.so
%%LIBDIR%%/arena/maps.lst
%%LIBDIR%%/arena/motd.txt
%%LIBDIR%%/arena/pics
%%LIBDIR%%/arena/server.cfg
%%LIBDIR%%/arena/video
%%LIBDIR%%/botinfo
%%LIBDIR%%/crded
%%LIBDIR%%/crx
%%SDL%%%%LIBDIR%%/crx.sdl
%%LIBDIR%%/data1/default.cfg
%%LIBDIR%%/data1/env
%%LIBDIR%%/data1/game.so
%%LIBDIR%%/data1/gfx
%%LIBDIR%%/data1/levelshots
%%LIBDIR%%/data1/maps
%%LIBDIR%%/data1/maps.lst
%%LIBDIR%%/data1/models
%%LIBDIR%%/data1/particles
%%LIBDIR%%/data1/pics
%%LIBDIR%%/data1/players
%%LIBDIR%%/data1/scripts
%%LIBDIR%%/data1/sound
%%LIBDIR%%/data1/sprites
%%LIBDIR%%/data1/textures
%%LIBDIR%%/data1/vehicles
@dirrm %%LIBDIR%%/data1
@dirrm %%LIBDIR%%/arena
@dirrm %%LIBDIR%%