diff options
author | Alejandro Pulver <alepulver@FreeBSD.org> | 2006-05-21 21:35:18 +0000 |
---|---|---|
committer | Alejandro Pulver <alepulver@FreeBSD.org> | 2006-05-21 21:35:18 +0000 |
commit | 333f37c2c756d3e5660415163b3cc174460ec632 (patch) | |
tree | 813d65e135cf255e410c136dcfbe0fefc47aabf1 /games/r1q2/files | |
parent | 3128f146cd1da2b0e0f3dc69fa7bd7caff7f1b74 (diff) | |
download | ports-333f37c2c756d3e5660415163b3cc174460ec632.tar.gz ports-333f37c2c756d3e5660415163b3cc174460ec632.zip |
Notes
Diffstat (limited to 'games/r1q2/files')
-rw-r--r-- | games/r1q2/files/patch-Makefile | 101 | ||||
-rw-r--r-- | games/r1q2/files/patch-client__cl_main.c | 29 | ||||
-rw-r--r-- | games/r1q2/files/patch-client__menu.c | 10 | ||||
-rw-r--r-- | games/r1q2/files/patch-client__qal.h | 13 | ||||
-rw-r--r-- | games/r1q2/files/patch-client__snd_openal.h | 28 | ||||
-rw-r--r-- | games/r1q2/files/patch-game__q_shared.c | 11 | ||||
-rw-r--r-- | games/r1q2/files/patch-game__q_shared.h | 11 | ||||
-rw-r--r-- | games/r1q2/files/patch-linux__al_linux.h | 11 | ||||
-rw-r--r-- | games/r1q2/files/patch-linux__cd_linux.c | 319 | ||||
-rw-r--r-- | games/r1q2/files/patch-linux__q_shlinux.c | 65 | ||||
-rw-r--r-- | games/r1q2/files/patch-linux__snd_linux.c | 12 | ||||
-rw-r--r-- | games/r1q2/files/patch-linux__sys_linux.c | 52 | ||||
-rw-r--r-- | games/r1q2/files/patch-linux__vid_so.c | 29 | ||||
-rw-r--r-- | games/r1q2/files/patch-qcommon__common.c | 20 | ||||
-rw-r--r-- | games/r1q2/files/patch-qcommon__files.c | 63 | ||||
-rw-r--r-- | games/r1q2/files/patch-qcommon__qcommon.h | 10 | ||||
-rw-r--r-- | games/r1q2/files/patch-ref_gl__gl_local.h | 11 | ||||
-rw-r--r-- | games/r1q2/files/patch-ref_gl__qgl.h | 11 |
18 files changed, 806 insertions, 0 deletions
diff --git a/games/r1q2/files/patch-Makefile b/games/r1q2/files/patch-Makefile new file mode 100644 index 000000000000..f5b9c58c7722 --- /dev/null +++ b/games/r1q2/files/patch-Makefile @@ -0,0 +1,101 @@ +--- ./Makefile.orig Wed May 17 22:21:33 2006 ++++ ./Makefile Wed May 17 22:47:04 2006 +@@ -21,25 +21,25 @@ + #===============================# + # Quake 2 dedicated server only # + #===============================# +-BUILD_DEDICATED=YES ++#BUILD_DEDICATED=YES + + #===============================# + # Quake 2 SDL Options # + # Uses SDL for cdrom and sound # + # SDL OpenGL ref library # + #===============================# +-BUILD_SDL=YES +-BUILD_SDLGL=YES ++#BUILD_SDL=YES ++#BUILD_SDLGL=YES + + #===============================# + # HTTP download stuff # + #===============================# +-WITH_HTTP_DOWNLOAD_SUPPORT=YES ++#WITH_HTTP_DOWNLOAD_SUPPORT=YES + + #===============================# + # OpenAL stuff # + #===============================# +-WITH_OPENAL_SUPPORT=YES ++#WITH_OPENAL_SUPPORT=YES + + #===============================# + # CD Audio # +@@ -61,18 +61,21 @@ + REF_GL_DIR=$(MOUNT_DIR)/ref_gl + SERVER_DIR=$(MOUNT_DIR)/server + +-CC=gcc ++CC?=gcc + +-BASE_CFLAGS= -DLINUX -ffloat-store +-RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG -O2 -ffast-math -funroll-loops -fno-strict-aliasing ++BASE_CFLAGS=$(CFLAGS) -DDATADIR='\"$(Q2DIR)\"' -DLIBDIR='\"$(LIBDIR)\"' -I$(LOCALBASE)/include -I$(X11BASE)/include -DLINUX -ffloat-store ++RELEASE_CFLAGS=$(BASE_CFLAGS) + +-ifeq ($(ARCH),i386) +- RELEASE_CFLAGS+=-falign-loops=2 -falign-jumps=2 -falign-functions=2 ++ifdef OPTIMIZED_CFLAGS ++RELEASE_CFLAGS+=-DNDEBUG -O2 -ffast-math -funroll-loops -fno-strict-aliasing ++ ifeq ($(ARCH),i386) ++RELEASE_CFLAGS+=-falign-loops=2 -falign-jumps=2 -falign-functions=2 ++ endif + endif + + DEBUG_CFLAGS=$(BASE_CFLAGS) -g -ggdb -Wall -pipe + +-LDFLAGS+=-lm -lz ++LDFLAGS+=-L$(LOCALBASE)/lib -L$(X11BASE)/lib -lm -lz + + ifeq ($(OSTYPE),Linux) + LDFLAGS+=-ldl +@@ -91,16 +94,16 @@ + endif + + ifeq ($(strip $(WITH_HTTP_DOWNLOAD_SUPPORT)),YES) +-#LDFLAGS+= -lcurl +-LDFLAGS+= /usr/local/lib/libcurl.a # Statically linked, note the path, if curl is not installed in your system, ++LDFLAGS+= -lcurl ++#LDFLAGS+= /usr/local/lib/libcurl.a # Statically linked, note the path, if curl is not installed in your system, + # set to NO in the build options + BASE_CFLAGS+= -DUSE_CURL + endif + +-GLXLDFLAGS=-L/usr/X11R6/lib -L/usr/local/lib -lX11 -lXext -lXxf86dga -lXxf86vm -lGL -lpng -ljpeg ++GLXLDFLAGS=-L$(LOCALBASE)/lib -L$(X11BASE)/lib -lX11 -lXext -lXxf86dga -lXxf86vm -lGL -lpng -ljpeg + +-SDLCFLAGS=$(shell sdl-config --cflags) +-SDLLDFLAGS=$(shell sdl-config --libs) ++SDLCFLAGS=$(shell $(SDL_CONFIG) --cflags) ++SDLLDFLAGS=$(shell $(SDL_CONFIG) --libs) + SDLGLCFLAGS=$(SDLCFLAGS) -DOPENGL + SDLGLLDFLAGS=$(SDLLDFLAGS) + +@@ -122,7 +125,7 @@ + $(BINDIR)/ref_r1gl.$(SHLIBEXT) + + ifeq ($(strip $(BUILD_GAME)),YES) +- TARGETS+=$(BINDIR)/baseq2/game$(ARCH).$(SHLIBEXT) ++ TARGETS+=$(BINDIR)/baseq2/game.$(SHLIBEXT) + endif + + ifeq ($(strip $(BUILD_DEDICATED)),YES) +@@ -618,7 +621,7 @@ + $(BUILDDIR)/objects/game/p_weapon.o \ + $(BUILDDIR)/objects/game/m_flash.o + +-$(BINDIR)/baseq2/game$(ARCH).$(SHLIBEXT) : $(GAME_OBJS) ++$(BINDIR)/baseq2/game.$(SHLIBEXT) : $(GAME_OBJS) + $(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(GAME_OBJS) + + $(BUILDDIR)/objects/game/g_ai.o : $(GAME_DIR)/g_ai.c diff --git a/games/r1q2/files/patch-client__cl_main.c b/games/r1q2/files/patch-client__cl_main.c new file mode 100644 index 000000000000..edb0c1245813 --- /dev/null +++ b/games/r1q2/files/patch-client__cl_main.c @@ -0,0 +1,29 @@ +--- ./client/cl_main.c.orig Wed May 17 22:21:33 2006 ++++ ./client/cl_main.c Wed May 17 22:27:30 2006 +@@ -3629,7 +3629,7 @@ + //jec - updates all input events
+
+ void CL_RefreshCmd (void);
+-#if (defined JOYSTICK) || (defined LINUX)
++#if (defined JOYSTICK) || (defined __unix__)
+ extern void IN_Commands (void);
+ #endif
+ void CL_RefreshInputs (void)
+@@ -3637,7 +3637,7 @@ + // process new key events
+ Sys_SendKeyEvents ();
+
+-#if (defined JOYSTICK) || (defined LINUX)
++#if (defined JOYSTICK) || (defined __unix__)
+ // process mice & joystick events
+ IN_Commands ();
+ #endif
+@@ -4032,7 +4032,7 @@ + Cbuf_Execute ();
+
+ Con_Init ();
+-#if defined __linux__ || defined __sgi || defined __FreeBSD__
++#if defined __unix__ || defined __sgi
+ S_Init (true);
+
+ VID_Init ();
diff --git a/games/r1q2/files/patch-client__menu.c b/games/r1q2/files/patch-client__menu.c new file mode 100644 index 000000000000..1334a53aff66 --- /dev/null +++ b/games/r1q2/files/patch-client__menu.c @@ -0,0 +1,10 @@ +--- client/menu.c.orig Wed Jan 4 05:16:38 2006 ++++ client/menu.c Sat May 20 13:45:54 2006 +@@ -587,6 +587,7 @@ + {
+ {"+attack", "attack"},
+ {"weapnext", "next weapon"},
++{"weapprev", "previous weapon"},
+ {"+forward", "walk forward"},
+ {"+back", "backpedal"},
+ {"+left", "turn left"},
diff --git a/games/r1q2/files/patch-client__qal.h b/games/r1q2/files/patch-client__qal.h new file mode 100644 index 000000000000..f65a12056783 --- /dev/null +++ b/games/r1q2/files/patch-client__qal.h @@ -0,0 +1,13 @@ +--- client/qal.h.orig Sat Jun 26 15:20:12 2004 ++++ client/qal.h Thu May 18 20:40:19 2006 +@@ -22,6 +22,10 @@ + #ifndef __QAL_H__
+ #define __QAL_H__
+
++#undef ALCAPI
++#define ALCAPI
++#undef ALAPI
++#define ALAPI
+
+ qboolean QAL_Init (const char *driver);
+ void QAL_Shutdown (void);
diff --git a/games/r1q2/files/patch-client__snd_openal.h b/games/r1q2/files/patch-client__snd_openal.h new file mode 100644 index 000000000000..8a5c555b45f3 --- /dev/null +++ b/games/r1q2/files/patch-client__snd_openal.h @@ -0,0 +1,28 @@ +--- client/snd_openal.h.orig Mon Dec 5 21:03:34 2005 ++++ client/snd_openal.h Thu May 18 20:09:05 2006 +@@ -3,7 +3,6 @@ + #ifdef USE_OPENAL
+ #include <AL/al.h>
+ #include <AL/alc.h>
+-#include <AL/altypes.h>
+
+ #include "client.h"
+
+@@ -14,7 +13,7 @@ + #ifdef _WIN32
+ #include "../win32/alw_win.h"
+ #endif
+-#ifdef __linux__
++#ifdef __unix__
+ #include "../linux/al_linux.h"
+ #endif
+ #endif
+@@ -158,7 +157,7 @@ + #define ALimp_Shutdown ALW_Shutdown
+
+ #else
+-#ifdef __linux__
++#ifdef __unix__
+
+ #define AL_DRIVER_OPENAL "/usr/lib/libopenal.so"
+
diff --git a/games/r1q2/files/patch-game__q_shared.c b/games/r1q2/files/patch-game__q_shared.c new file mode 100644 index 000000000000..276de6bbce50 --- /dev/null +++ b/games/r1q2/files/patch-game__q_shared.c @@ -0,0 +1,11 @@ +--- ./game/q_shared.c.orig Wed May 17 22:21:33 2006 ++++ ./game/q_shared.c Wed May 17 22:28:01 2006 +@@ -421,7 +421,7 @@ + Returns 1, 2, or 1 + 2
+ ==================
+ */
+-#if !id386 || defined __linux__ || defined __FreeBSD__
++#if !id386 || defined __unix__
+ int BoxOnPlaneSide (vec3_t emins, vec3_t emaxs, struct cplane_s *p)
+ {
+ float dist1, dist2;
diff --git a/games/r1q2/files/patch-game__q_shared.h b/games/r1q2/files/patch-game__q_shared.h new file mode 100644 index 000000000000..ef2c67513e30 --- /dev/null +++ b/games/r1q2/files/patch-game__q_shared.h @@ -0,0 +1,11 @@ +--- ./game/q_shared.h.orig Wed May 17 22:21:33 2006 ++++ ./game/q_shared.h Wed May 17 22:28:23 2006 +@@ -315,7 +315,7 @@ + //float Q_fabs (float f);
+ //#define fabs(f) Q_fabs(f)
+ //extern int sse2_enabled;
+-#if !defined C_ONLY && !defined __linux__ && !defined __sgi && !defined SSE2 && !defined __FreeBSD__
++#if !defined C_ONLY && !defined __unix__ && !defined __sgi && !defined SSE2
+ //extern void __cdecl Q_sseinit (void);
+ void __cdecl Q_ftol2( float f, int *out );
+ int __cdecl Q_ftol( float f );
diff --git a/games/r1q2/files/patch-linux__al_linux.h b/games/r1q2/files/patch-linux__al_linux.h new file mode 100644 index 000000000000..aa4904d71dd7 --- /dev/null +++ b/games/r1q2/files/patch-linux__al_linux.h @@ -0,0 +1,11 @@ +--- ./linux/al_linux.h.orig Sat Sep 24 16:18:00 2005 ++++ ./linux/al_linux.h Wed May 17 22:28:37 2006 +@@ -23,7 +23,7 @@ + #define __AL_LINUX_H__ + + +-#ifndef __linux__ ++#ifndef __unix__ + #error "You should not be including this file on this platform" + #endif + diff --git a/games/r1q2/files/patch-linux__cd_linux.c b/games/r1q2/files/patch-linux__cd_linux.c new file mode 100644 index 000000000000..8639ead1d186 --- /dev/null +++ b/games/r1q2/files/patch-linux__cd_linux.c @@ -0,0 +1,319 @@ +--- ./linux/cd_linux.c.orig Wed May 17 22:21:33 2006 ++++ ./linux/cd_linux.c Wed May 17 22:42:46 2006 +@@ -13,7 +13,12 @@ + #include <time.h>
+ #include <errno.h>
+
++#ifdef __FreeBSD__
++#include <sys/cdio.h>
++#define CDROM_DATA_TRACK 4
++#else
+ #include <linux/cdrom.h>
++#endif
+
+ #include "../client/client.h"
+
+@@ -43,8 +48,13 @@ + if (cdfile == -1 || !enabled)
+ return; // no cd init'd
+
++#ifdef __FreeBSD__
++ if (ioctl(cdfile, CDIOCEJECT) == -1)
++ Com_DPrintf ("ioctl cdioceject failed\n");
++#else
+ if ( ioctl(cdfile, CDROMEJECT) == -1 )
+ Com_DPrintf("ioctl cdromeject failed\n");
++#endif
+ }
+
+
+@@ -53,30 +63,53 @@ + if (cdfile == -1 || !enabled)
+ return; // no cd init'd
+
++#ifdef __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)
+ {
++#ifdef __FreeBSD__
++ struct ioc_toc_header tochdr;
++#else
+ struct cdrom_tochdr tochdr;
++#endif
+
+ cdValid = false;
+
++#ifdef __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;
+ }
+
++#ifdef __FreeBSD__
++ if (tochdr.starting_track < 1)
++#else
+ if (tochdr.cdth_trk0 < 1)
++#endif
+ {
+ Com_DPrintf("CDAudio: no music tracks\n");
+ return -1;
+ }
+
+ cdValid = true;
++#ifdef __FreeBSD__
++ maxTrack = tochdr.ending_track;
++#else
+ maxTrack = tochdr.cdth_trk1;
++#endif
+
+ return 0;
+ }
+@@ -84,8 +117,14 @@ +
+ void CDAudio_Play(int track, qboolean looping)
+ {
++#ifdef __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;
+@@ -105,6 +144,20 @@ + return;
+ }
+
++#ifdef __FreeBSD__
++ 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;
+@@ -114,6 +167,7 @@ + return;
+ }
+ if (entry.cdte_ctrl == CDROM_DATA_TRACK)
++#endif
+ {
+ Com_Printf("CDAudio: track %i is not audio\n", LOG_CLIENT, track);
+ return;
+@@ -126,19 +180,37 @@ + CDAudio_Stop();
+ }
+
++#ifdef __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;
++#endif
+
++#ifdef __FreeBSD__
++ if (ioctl(cdfile, CDIOCPLAYTRACKS, &ti) == -1)
++ {
++ Com_DPrintf ("ioctl cdiocplaytracks failed\n");
++#else
+ if ( ioctl(cdfile, CDROMPLAYTRKIND, &ti) == -1 )
+ {
+ Com_DPrintf("ioctl cdromplaytrkind failed\n");
++#endif
+ return;
+ }
+
++#ifdef __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
+
+ playLooping = looping;
+ playTrack = track;
+@@ -153,8 +225,14 @@ + int track, i = 0, free_tracks = 0, remap_track;
+ float f;
+ byte *track_bools;
++#ifdef __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;
+@@ -167,13 +245,25 @@ + // create array of available audio tracknumbers
+
+ for (; i < maxTrack; i++) {
++#ifdef __FreeBSD__
++ 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 = remap[i];
++ entry.address_format = CD_LBA_FORMAT;
++ if (ioctl(cdfile, CDIOREADTOCENTRYS, &entry) == -1)
++ track_bools[i] = 0;
++ else
++ track_bools[i] = (toc_buffer.control != CDROM_DATA_TRACK);
++#else
+ entry.cdte_track = remap[i];
+ entry.cdte_format = CDROM_LBA;
+ if (ioctl(cdfile, CDROMREADTOCENTRY, &entry) == -1) {
+ track_bools[i] = 0;
+ } else
+ track_bools[i] = (entry.cdte_ctrl != CDROM_DATA_TRACK);
+-
++#endif
+ free_tracks += track_bools[i];
+ }
+
+@@ -197,12 +287,23 @@ + }
+ CDAudio_Stop();
+ }
++#ifdef __FreeBSD__
++ ti.start_track = remap_track;
++ ti.end_track = remap_track;
++ ti.start_index = 0;
++ ti.end_index = 0;
++#else
+ ti.cdti_trk0 = remap_track;
+ ti.cdti_trk1 = remap_track;
+ ti.cdti_ind0 = 0;
+ ti.cdti_ind1 = 0;
++#endif
+
++#ifdef __FreeBSD__
++ if (ioctl(cdfile, CDIOCPLAYTRACKS, &ti) == -1) {
++#else
+ if (ioctl(cdfile, CDROMPLAYTRKIND, &ti) == -1) {
++#endif
+ track_bools[track] = 0;
+ free_tracks--;
+ } else {
+@@ -227,8 +328,13 @@ + if (!playing)
+ return;
+
++#ifdef __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;
+@@ -242,8 +348,13 @@ + if (!playing)
+ return;
+
++#ifdef __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;
+@@ -261,8 +372,13 @@ + if (!wasPlaying)
+ return;
+
++#ifdef __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;
+ }
+
+@@ -391,7 +507,12 @@ +
+ void CDAudio_Update(void)
+ {
++#ifdef __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)
+@@ -415,6 +536,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");
+@@ -427,6 +566,7 @@ + if (playLooping)
+ CDAudio_Play(playTrack, true);
+ }
++#endif
+ }
+ }
+
diff --git a/games/r1q2/files/patch-linux__q_shlinux.c b/games/r1q2/files/patch-linux__q_shlinux.c new file mode 100644 index 000000000000..dbefc8dded25 --- /dev/null +++ b/games/r1q2/files/patch-linux__q_shlinux.c @@ -0,0 +1,65 @@ +--- linux/q_shlinux.c.orig Sat Feb 19 22:17:58 2005 ++++ linux/q_shlinux.c Fri May 19 20:26:48 2006 +@@ -12,25 +12,23 @@ +
+ #include "../qcommon/qcommon.h"
+
++#ifndef __linux__
++#include <machine/param.h>
++#endif
++
+ //===============================================================================
+
+ byte *membase;
+ int maxhunksize;
+ int curhunksize;
+
+-#ifdef __FreeBSD__
+-#define MMAP_ANON MAP_ANON
+-#else
+-#define MMAP_ANON MAP_ANONYMOUS
+-#endif
+-
+ void *Hunk_Begin (int maxsize)
+ {
+ // reserve a huge chunk of memory, but don't commit any yet
+ maxhunksize = maxsize + sizeof(int);
+ curhunksize = 0;
+ membase = mmap(0, maxhunksize, PROT_READ|PROT_WRITE,
+- MAP_PRIVATE|MMAP_ANON, -1, 0);
++ MAP_PRIVATE|MAP_ANON, -1, 0);
+ if (membase == NULL || membase == (byte *)-1)
+ Sys_Error("unable to virtual allocate %d bytes", maxsize);
+
+@@ -54,14 +52,29 @@ +
+ int Hunk_End (void)
+ {
+-#ifndef __FreeBSD__
+ byte *n;
+
++#ifndef __linux__
++ 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);
+-#endif
+
+ return curhunksize;
+ }
diff --git a/games/r1q2/files/patch-linux__snd_linux.c b/games/r1q2/files/patch-linux__snd_linux.c new file mode 100644 index 000000000000..2111ecd7670f --- /dev/null +++ b/games/r1q2/files/patch-linux__snd_linux.c @@ -0,0 +1,12 @@ +--- ./linux/snd_linux.c.orig Wed May 17 22:21:33 2006 ++++ ./linux/snd_linux.c Wed May 17 22:28:57 2006 +@@ -8,8 +8,7 @@ + #include <sys/wait.h>
+ #if defined (__linux__)
+ #include <linux/soundcard.h>
+-#endif
+-#if defined (__FreeBSD__)
++#else
+ #include <sys/soundcard.h>
+ #endif
+ #include <stdio.h>
diff --git a/games/r1q2/files/patch-linux__sys_linux.c b/games/r1q2/files/patch-linux__sys_linux.c new file mode 100644 index 000000000000..11bf85dd6fbf --- /dev/null +++ b/games/r1q2/files/patch-linux__sys_linux.c @@ -0,0 +1,52 @@ +--- linux/sys_linux.c.orig Fri May 19 18:31:30 2006 ++++ linux/sys_linux.c Fri May 19 18:32:04 2006 +@@ -230,7 +230,7 @@ +
+ size = backtrace (array, sizeof(array)/sizeof(void*));
+
+-#ifndef __x86_64__
++#if !defined(__x86_64__) && !defined(__FreeBSD__)
+ array[1] = (void *) uc->uc_mcontext.gregs[REG_EIP];
+ #endif
+
+@@ -414,29 +414,17 @@ + void *(*GetGameAPI) (void *);
+
+ char name[MAX_OSPATH];
+- char curpath[MAX_OSPATH];
+ char *path;
+-#ifdef __i386__
+- const char *gamename = "gamei386.so";
+-#elif defined __alpha__
+- const char *gamename = "gameaxp.so";
+-#elif defined __x86_64__
+- const char *gamename = "gamex86_64.so";
+-#else
+-#error "Don't know what kind of dynamic objects to use for this architecture."
+-#endif
++ const char *gamename = "game.so";
+
+ if (game_library)
+ Com_Error (ERR_FATAL, "Sys_GetGameAPI without Sys_UnloadingGame");
+
+- getcwd(curpath, sizeof(curpath)-1);
+- curpath[sizeof(curpath)-1] = 0;
+-
+ Com_Printf("------- Loading %s -------\n", LOG_SERVER|LOG_NOTICE, gamename);
+
+ if (baseq2)
+ {
+- Com_sprintf (name, sizeof(name), "%s/%s/%s", curpath, BASEDIRNAME, gamename);
++ Com_sprintf (name, sizeof(name), "%s/%s", BASEDIRNAME, gamename);
+ game_library = dlopen (name, RTLD_NOW );
+ }
+ else
+@@ -448,7 +436,7 @@ + path = FS_NextPath (path);
+ if (!path)
+ return NULL; // couldn't find one anywhere
+- Com_sprintf (name, sizeof(name), "%s/%s/%s", curpath, path, gamename);
++ Com_sprintf (name, sizeof(name), "%s/%s", path, gamename);
+ game_library = dlopen (name, RTLD_NOW );
+ if (game_library)
+ {
diff --git a/games/r1q2/files/patch-linux__vid_so.c b/games/r1q2/files/patch-linux__vid_so.c new file mode 100644 index 000000000000..ad62b938fde4 --- /dev/null +++ b/games/r1q2/files/patch-linux__vid_so.c @@ -0,0 +1,29 @@ +--- ./linux/vid_so.c.orig Fri May 19 17:48:09 2006 ++++ ./linux/vid_so.c Fri May 19 17:49:23 2006 +@@ -196,7 +196,6 @@ +
+ char fn[MAX_OSPATH];
+ struct stat st;
+- char *path;
+
+ if ( reflib_active )
+ {
+@@ -212,17 +211,12 @@ +
+ Com_Printf( "------- Loading %s -------\n", LOG_CLIENT, name);
+
+- path = Cvar_Get ("basedir", ".", CVAR_NOSET)->string;
+- snprintf (fn, MAX_OSPATH, "%s/%s", path, name );
++ snprintf (fn, MAX_OSPATH, "%s/%s", LIBDIR, name );
+
+ if (stat(fn, &st) == -1) {
+ Com_Printf( "LoadLibrary(\"%s\") failed: %s\n", LOG_CLIENT, name, strerror(errno));
+ return false;
+ }
+-
+- strcpy (fn, ".");
+- strcat(fn, "/");
+- strcat(fn, name);
+
+ if ( ( reflib_library = dlopen( fn, RTLD_NOW ) ) == 0 )
+ {
diff --git a/games/r1q2/files/patch-qcommon__common.c b/games/r1q2/files/patch-qcommon__common.c new file mode 100644 index 000000000000..e3e4de4d7f2d --- /dev/null +++ b/games/r1q2/files/patch-qcommon__common.c @@ -0,0 +1,20 @@ +--- ./qcommon/common.c.orig Wed May 17 22:21:33 2006 ++++ ./qcommon/common.c Wed May 17 22:29:35 2006 +@@ -1986,7 +1986,7 @@ +
+ #if defined _WIN32
+ z->allocationLocation = _ReturnAddress ();
+-#elif defined LINUX
++#elif defined __unix__
+ z->allocationLocation = __builtin_return_address (0);
+ #else
+ //FIXME: other OSes/CCs
+@@ -2046,7 +2046,7 @@ +
+ #if defined _WIN32
+ retAddr = _ReturnAddress ();
+-#elif defined LINUX
++#elif defined __unix__
+ retAddr = __builtin_return_address (0);
+ #else
+ //FIXME: other OSes/CCs
diff --git a/games/r1q2/files/patch-qcommon__files.c b/games/r1q2/files/patch-qcommon__files.c new file mode 100644 index 000000000000..43379f7d6ac9 --- /dev/null +++ b/games/r1q2/files/patch-qcommon__files.c @@ -0,0 +1,63 @@ +--- qcommon/files.c.orig Sat May 20 09:53:45 2006 ++++ qcommon/files.c Sat May 20 09:59:37 2006 +@@ -1232,11 +1232,6 @@ +
+ Q_strncpy (fs_gamedir, dir, sizeof(fs_gamedir)-1);
+
+-#if defined (__unix__)
+- // Create directory if it does not exist
+- Sys_Mkdir(fs_gamedir);
+-#endif
+-
+ Com_DPrintf ("FS_AddGameDirectory: Added '%s'\n", dir);
+
+ //
+@@ -1391,6 +1386,17 @@ + FS_AddGameDirectory (va("%s/%s", fs_basedir->string, dir) );
+ }
+
++void FS_AddHomeAsGameDirectory(char *dir)
++{
++ char gdir[MAX_OSPATH]; /* Game directory. */
++ char *homedir; /* Home directory. */
++
++ if ((homedir = getenv("HOME")) != NULL) {
++ Com_sprintf(gdir, sizeof(gdir), "%s/.r1q2/%s", homedir, dir);
++ FS_AddGameDirectory(gdir);
++ }
++}
++
+ /*
+ ================
+ FS_SetGamedir
+@@ -1449,7 +1455,10 @@ + {
+ Com_sprintf (fs_gamedir, sizeof(fs_gamedir), "%s/%s", fs_basedir->string, dir);
+ Cvar_FullSet ("gamedir", dir, CVAR_SERVERINFO|CVAR_NOSET);
++ FS_AddGameDirectory (va("%s/%s", DATADIR, dir) );
++ FS_AddGameDirectory (va("%s/%s", LIBDIR, dir) );
+ FS_AddGameDirectory (va("%s/%s", fs_basedir->string, dir) );
++ FS_AddHomeAsGameDirectory(dir);
+ }
+ }
+
+@@ -1707,7 +1716,10 @@ + //
+ // start up with baseq2 by default
+ //
++ FS_AddGameDirectory(va("%s/"BASEDIRNAME, DATADIR));
++ FS_AddGameDirectory(va("%s/"BASEDIRNAME, LIBDIR));
+ FS_AddGameDirectory (va("%s/"BASEDIRNAME, fs_basedir->string) );
++ FS_AddHomeAsGameDirectory(BASEDIRNAME);
+
+ // any set gamedirs will be freed up to here
+ fs_base_searchpaths = fs_searchpaths;
+@@ -1716,4 +1728,8 @@ + fs_gamedirvar = Cvar_Get ("game", "", CVAR_LATCH|CVAR_SERVERINFO);
+ if (fs_gamedirvar->string[0])
+ FS_SetGamedir (fs_gamedirvar->string);
++
++ FS_CreatePath(fs_gamedir);
++ Sys_Mkdir(fs_gamedir);
++ Com_Printf("Using '%s' for writing.\n", LOG_GENERAL, fs_gamedir);
+ }
diff --git a/games/r1q2/files/patch-qcommon__qcommon.h b/games/r1q2/files/patch-qcommon__qcommon.h new file mode 100644 index 000000000000..4b02dd32c5ca --- /dev/null +++ b/games/r1q2/files/patch-qcommon__qcommon.h @@ -0,0 +1,10 @@ +--- ./qcommon/qcommon.h.orig Wed Mar 15 17:18:50 2006 ++++ ./qcommon/qcommon.h Wed May 17 22:31:34 2006 +@@ -88,6 +88,7 @@ +
+ #define BUILDSTRING "FreeBSD"
+
++ #define __cdecl
+ #ifdef __i386__
+ #define CPUSTRING "i386"
+ #elif defined __x86_64__
diff --git a/games/r1q2/files/patch-ref_gl__gl_local.h b/games/r1q2/files/patch-ref_gl__gl_local.h new file mode 100644 index 000000000000..3695e333a27a --- /dev/null +++ b/games/r1q2/files/patch-ref_gl__gl_local.h @@ -0,0 +1,11 @@ +--- ./ref_gl/gl_local.h.orig Mon Apr 24 14:23:20 2006 ++++ ./ref_gl/gl_local.h Wed May 17 22:29:52 2006 +@@ -28,7 +28,7 @@ + #include <GL/glu.h>
+ #include <math.h>
+
+-#ifndef __linux__
++#ifndef __unix__
+ #ifndef GL_COLOR_INDEX8_EXT
+ #define GL_COLOR_INDEX8_EXT GL_COLOR_INDEX
+ #endif
diff --git a/games/r1q2/files/patch-ref_gl__qgl.h b/games/r1q2/files/patch-ref_gl__qgl.h new file mode 100644 index 000000000000..fab293290ec0 --- /dev/null +++ b/games/r1q2/files/patch-ref_gl__qgl.h @@ -0,0 +1,11 @@ +--- ./ref_gl/qgl.h.orig Wed May 17 22:21:33 2006 ++++ ./ref_gl/qgl.h Wed May 17 22:29:57 2006 +@@ -436,7 +436,7 @@ +
+ #endif
+
+-#ifdef __linux__
++#ifdef __unix__
+
+ // local function in dll
+ extern void *qwglGetProcAddress(char *symbol);
|