Quake now playable on NetBSD-1.4.x-i386. Heavily based on pkg/9270 by

Brad Spencer <brad@anduin.eldar.org>, with some modifications.

Caveats: ELF builds fail; shareware WADs (level files) have to be
gotten separately; playing audio from CDs seems to have problems (see
pkg/9270); GLX Quakeworld client probably doesn't work; Quakeworld
code perhaps triggers optimization bug?

Committed mainly to avoid duplication of work, and for the 1.4.x/i386
users/gamers :-)
This commit is contained in:
wiz 2000-02-01 02:30:29 +00:00
parent 08e833403e
commit 4eb5e8ac6f
17 changed files with 1748 additions and 148 deletions

View file

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.2 2000/01/13 00:35:04 wiz Exp $
# $NetBSD: Makefile,v 1.3 2000/02/01 02:30:29 wiz Exp $
DISTNAME= q1source
PKGNAME= quake-2.30
@ -7,6 +7,7 @@ MASTER_SITES= ftp://ftp.cdrom.com/pub/idgames/idstuff/source/ \
ftp://ftp.fu-berlin.de/pub/pc/msdos/games/idgames/idstuff/source/ \
ftp://ftp.idsoftware.com/idstuff/source/
EXTRACT_SUFX= .zip
ONLY_FOR_PLATFORMS= NetBSD-1.4.[1-9]-i386
MAINTAINER= tron@netbsd.org
HOMEPAGE= http://www.idsoftware.com/
@ -15,18 +16,48 @@ BUILD_DEPENDS+= ${UNZIP}:../../archivers/unzip
DEPENDS+= Mesa-*:../../graphics/Mesa
USE_GMAKE= yes
.include "../../mk/bsd.prefs.mk"
BROKEN= untested, only compiles on a.out for now
.if (${OBJECT_FMT} == "ELF")
CFLAGS+=-DELF
.else
CFLAGS+=-DAOUT
.endif
EXTRACT_CMD= ${UNZIP} -q ${DISTDIR}/${EXTRACT_ONLY}
MAKE_ENV+= MAINDIR=${WRKSRC}
UNZIP= ${LOCALBASE}/bin/unzip
WRKSRC= ${WRKDIR}/QW
post-extract:
@${CHMOD} -R g-w,o-w ${WRKDIR}
WRKSRC= ${WRKDIR}
USE_X11BASE= yes
do-configure:
cd ${WRKSRC} && ${LN} -fs Makefile.Linux ${MAKEFILE}
cd ${WRKSRC}/QW && ${LN} -fs Makefile.Linux ${MAKEFILE}
cd ${WRKSRC}/WinQuake && ${LN} -fs Makefile.linuxi386 ${MAKEFILE}
#pre-build:
# cd ${WRKSRC}/WinQuake && \
# ${MV} common.c common.c.orig && \
# ${SED} "s@GAMENAME, basedir@GAMENAME, \"${PREFIX}/share/quake/\"@" \
# < common.c.orig > common.c
do-build:
@( cd ${WRKSRC}/QW ; ${GMAKE} MAINDIR=`pwd` CFLAGS="${CFLAGS}" all)
@( cd ${WRKSRC}/WinQuake ; ${GMAKE} MAINDIR=`pwd` CFLAGS="${CFLAGS}" \
WRKSRC="${WRKSRC}" all)
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/QW/release_version/qwsv ${PREFIX}/bin
${INSTALL_PROGRAM} ${WRKSRC}/QW/release_version/qwcl.x11 ${PREFIX}/bin
${INSTALL_PROGRAM} ${WRKSRC}/QW/release_version/glqwcl.glx ${PREFIX}/bin
${INSTALL_PROGRAM} ${WRKSRC}/WinQuake/release_version/bin/glquake.glx ${PREFIX}/bin
${INSTALL_PROGRAM} ${WRKSRC}/WinQuake/release_version/bin/quake.x11 ${PREFIX}/bin
post-install:
@ ${ECHO}
@ ${ECHO} =====================================================================
@ ${ECHO} For running quake you need data files. Look for quakesw-1.0.6.tar.gz.
@ ${ECHO} Extract it somewhere, and start quake from the same directory, e.g.
@ ${ECHO} by running \'quake.x11\'.
@ ${ECHO} =====================================================================
.include "../../mk/bsd.pkg.mk"

View file

@ -1,7 +1,13 @@
$NetBSD: patch-sum,v 1.2 2000/01/13 00:35:05 wiz Exp $
$NetBSD: patch-sum,v 1.3 2000/02/01 02:30:32 wiz Exp $
MD5 (patch-aa) = 2ad2bccf016e39d2928159e7092d066a
MD5 (patch-ab) = 03a47b0964a42164cbbdd7b8ba5229f0
MD5 (patch-ac) = 36885bcf121b8d622a3a688241bc47de
MD5 (patch-ad) = b916ba6ef25b49062ac915a73a9435a9
MD5 (patch-ae) = 4d041b8bdf2862e4e9df6ee096529db2
MD5 (patch-aa) = ca8929f5c8caf73b43b48fa14c09b281
MD5 (patch-ab) = 39706631f63064d4299b7ccd6767bc0a
MD5 (patch-ac) = 1dad1922b2ea70fd119b132d36358142
MD5 (patch-ad) = 3a81e2a769af2835c972e702c4345b63
MD5 (patch-ae) = 991067fdd68b9c9b0555572c3ed0ba61
MD5 (patch-af) = 827982b68b784dfcfe124deb6ba3ac69
MD5 (patch-ag) = 814d77ae3065fbb3f3411da64e3fd176
MD5 (patch-ah) = 6201cef494a01730ae5a1d500bc46ed1
MD5 (patch-ai) = c11c25e087be53b7ea548d43642040e3
MD5 (patch-aj) = de649d1277ee2426491bd6a4f7ed5eba
MD5 (patch-ak) = 293084381e6cafe33d7c79cb1571880b

View file

@ -1,95 +1,547 @@
$NetBSD: patch-aa,v 1.2 2000/01/13 00:35:05 wiz Exp $
$NetBSD: patch-aa,v 1.3 2000/02/01 02:30:32 wiz Exp $
--- Makefile.Linux.orig Wed Apr 21 20:16:24 1999
+++ Makefile.Linux Thu Jan 13 01:05:47 2000
@@ -27,8 +27,6 @@
RPMARCH=i386
endif
--- QW/client/cd_linux.c Tue Dec 21 18:58:58 1999
+++ ../work/QW/client/cd_linux.c Sun Jan 16 19:56:16 2000
@@ -10,7 +10,7 @@
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-See the included (GNU.txt) GNU General Public License for more details.
+See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
@@ -31,7 +31,19 @@
#include <time.h>
#include <errno.h>
-MAINDIR=/grog/Projects/QW
+#ifdef __linux__
#include <linux/cdrom.h>
+#endif
+
+#ifdef __NetBSD__
+#include <sys/cdio.h>
+
+/* resume seems to have some trouble right now. xcdplayer also can not resume
+ the drive correctly. It appears to play, but no audio is heard */
+
+#define PAUSE_BY_STOPPING 1
+
+#endif
#include "quakedef.h"
@@ -46,165 +58,289 @@
static byte playTrack;
static byte maxTrack;
+#ifdef PAUSE_BY_STOPPING
+static qboolean t_playLooping;
+static byte t_playTrack;
+#endif
+
static int cdfile = -1;
+#ifdef __linux__
static char cd_dev[64] = "/dev/cdrom";
+#endif
+
+#ifdef __NetBSD__
+static char cd_dev[64] = "/dev/rcd0d";
+#endif
static void CDAudio_Eject(void)
{
- if (cdfile == -1 || !enabled)
- return; // no cd init'd
+#ifdef __NetBSD__
+ int arg=0;
+#endif
- if ( ioctl(cdfile, CDROMEJECT) == -1 )
- Con_DPrintf("ioctl cdromeject failed\n");
+ if (cdfile == -1 || !enabled)
+ return; // no cd init'd
+
+#ifdef __linux__
+ if ( ioctl(cdfile, CDROMEJECT) == -1 )
+ Con_DPrintf("ioctl cdromeject failed\n");
+#endif
+#ifdef __NetBSD__
+ if(ioctl(cdfile, DIOCLOCK, &arg) == -1)
+ Con_DPrintf("ioctl cdromunlock failed\n");
+ arg = 1;
+ if ( ioctl(cdfile, DIOCEJECT, &arg) == -1 )
+ Con_DPrintf("ioctl cdromeject failed\n");
+#endif
}
static void CDAudio_CloseDoor(void)
{
- if (cdfile == -1 || !enabled)
- return; // no cd init'd
+if (cdfile == -1 || !enabled)
+ return; // no cd init'd
- if ( ioctl(cdfile, CDROMCLOSETRAY) == -1 )
- Con_DPrintf("ioctl cdromclosetray failed\n");
+#ifdef __linux__
+ if ( ioctl(cdfile, CDROMCLOSETRAY) == -1 )
+ Con_DPrintf("ioctl cdromclosetray failed\n");
+#endif
+#ifdef __NetBSD__
+ if(ioctl(cdfile, CDIOCCLOSE, NULL) == -1) {
+ Con_DPrintf("ioctl cdromclosetray failed\n");
+ }
+#endif
}
static int CDAudio_GetAudioDiskInfo(void)
{
- struct cdrom_tochdr tochdr;
+#ifdef __linux__
+struct cdrom_tochdr tochdr;
+#endif
+#ifdef __NetBSD__
+struct ioc_toc_header tochdr;
+#endif
- cdValid = false;
+cdValid = false;
- if ( ioctl(cdfile, CDROMREADTOCHDR, &tochdr) == -1 )
- {
- Con_DPrintf("ioctl cdromreadtochdr failed\n");
- return -1;
- }
+#ifdef __linux
+if ( ioctl(cdfile, CDROMREADTOCHDR, &tochdr) == -1 )
+{
+ Con_DPrintf("ioctl cdromreadtochdr failed\n");
+ return -1;
+}
+#endif
- if (tochdr.cdth_trk0 < 1)
- {
- Con_DPrintf("CDAudio: no music tracks\n");
- return -1;
- }
+#ifdef __NetBSD__
+if ( ioctl(cdfile, CDIOREADTOCHEADER, &tochdr) == -1 )
+{
+ Con_DPrintf("ioctl cdromreadtochdr failed\n");
+ return -1;
+}
+#endif
- cdValid = true;
- maxTrack = tochdr.cdth_trk1;
+#ifdef __linux__
+if (tochdr.cdth_trk0 < 1)
+ {
+ Con_DPrintf("CDAudio: no music tracks\n");
+ return -1;
+ }
+#endif
+#ifdef __NetBSD__
+if (tochdr.starting_track < 1)
+ {
+ Con_DPrintf("CDAudio: no music tracks\n");
+ return -1;
+ }
+#endif
+
+cdValid = true;
+#ifdef __linux__
+maxTrack = tochdr.cdth_trk1;
+#endif
+#ifdef __NetBSD__
+maxTrack = tochdr.ending_track;
+#endif
- return 0;
+return 0;
}
void CDAudio_Play(byte track, qboolean looping)
{
- struct cdrom_tocentry entry;
- struct cdrom_ti ti;
+#ifdef __linux__
+ struct cdrom_tocentry entry;
+ struct cdrom_ti ti;
+#endif
- if (cdfile == -1 || !enabled)
- return;
+#ifdef __NetBSD__
+ struct ioc_read_toc_entry entry;
+ struct ioc_play_track ti;
+ int arg=1;
+#endif
+
+ if (cdfile == -1 || !enabled)
+ return;
- if (!cdValid)
- {
- CDAudio_GetAudioDiskInfo();
- if (!cdValid)
- return;
- }
+ if (!cdValid)
+ {
+ CDAudio_GetAudioDiskInfo();
+ if (!cdValid)
+ return;
+ }
- track = remap[track];
+ track = remap[track];
- if (track < 1 || track > maxTrack)
- {
- Con_DPrintf("CDAudio: Bad track number %u.\n", track);
- return;
- }
+ if (track < 1 || track > maxTrack)
+ {
+ Con_DPrintf("CDAudio: Bad track number %u.\n", track);
+ return;
+ }
- // don't try to play a non-audio track
- entry.cdte_track = track;
- entry.cdte_format = CDROM_MSF;
- if ( ioctl(cdfile, CDROMREADTOCENTRY, &entry) == -1 )
- {
- Con_DPrintf("ioctl cdromreadtocentry failed\n");
- return;
- }
- if (entry.cdte_ctrl == CDROM_DATA_TRACK)
- {
- Con_Printf("CDAudio: track %i is not audio\n", track);
- return;
- }
+#ifdef __linux__ /* Not sure what the equiv is for NetBSD */
+ /* don't try to play a non-audio track */
+ entry.cdte_track = track;
+ entry.cdte_format = CDROM_MSF;
+ if ( ioctl(cdfile, CDROMREADTOCENTRY, &entry) == -1 )
+ {
+ Con_DPrintf("ioctl cdromreadtocentry failed\n");
+ return;
+ }
+ if (entry.cdte_ctrl == CDROM_DATA_TRACK)
+ {
+ Con_Printf("CDAudio: track %i is not audio\n", track);
+ return;
+ }
- if (playing)
- {
- if (playTrack == track)
- return;
- CDAudio_Stop();
- }
+#endif
+
+ if (playing)
+ {
+ if (playTrack == track)
+ return;
+ CDAudio_Stop();
+ }
+
+#ifdef __linux__
+ ti.cdti_trk0 = track;
+ ti.cdti_trk1 = track;
+ ti.cdti_ind0 = 1;
+ ti.cdti_ind1 = 99;
+ if ( ioctl(cdfile, CDROMPLAYTRKIND, &ti) == -1 )
+ {
+ Con_DPrintf("ioctl cdromplaytrkind failed\n");
+ return;
+ }
- ti.cdti_trk0 = track;
- ti.cdti_trk1 = track;
- ti.cdti_ind0 = 1;
- ti.cdti_ind1 = 99;
+ if ( ioctl(cdfile, CDROMRESUME) == -1 )
+ Con_DPrintf("ioctl cdromresume failed\n");
+#endif
- if ( ioctl(cdfile, CDROMPLAYTRKIND, &ti) == -1 )
+#ifdef __NetBSD__
+ ti.start_track = track;
+ ti.end_track = track;
+ ti.start_index = 1;
+ ti.end_index = 99;
+ if ( ioctl(cdfile, CDIOCPLAYTRACKS, &ti) == -1 )
{
- Con_DPrintf("ioctl cdromplaytrkind failed\n");
- return;
+ Con_DPrintf("ioctl cdromplaytrkind failed\n");
+ return;
}
- if ( ioctl(cdfile, CDROMRESUME) == -1 )
- Con_DPrintf("ioctl cdromresume failed\n");
+ if ( ioctl(cdfile, CDIOCRESUME, &arg) == -1 )
+ Con_DPrintf("ioctl cdromresume failed\n");
+#endif
- playLooping = looping;
- playTrack = track;
- playing = true;
+ playLooping = looping;
+ playTrack = track;
+ playing = true;
- if (cdvolume == 0.0)
- CDAudio_Pause ();
+ if (cdvolume == 0.0)
+ CDAudio_Pause ();
}
void CDAudio_Stop(void)
{
- if (cdfile == -1 || !enabled)
- return;
+ if (cdfile == -1 || !enabled)
+ return;
- if (!playing)
- return;
+ if (!playing)
+ return;
- if ( ioctl(cdfile, CDROMSTOP) == -1 )
- Con_DPrintf("ioctl cdromstop failed (%d)\n", errno);
+#ifdef __linux__
+ if ( ioctl(cdfile, CDROMSTOP) == -1 )
+ Con_DPrintf("ioctl cdromstop failed (%d)\n", errno);
+#endif
+#ifdef __NetBSD__
+ if ( ioctl(cdfile, CDIOCSTOP) == -1 )
+ Con_DPrintf("ioctl cdromstop failed (%d)\n", errno);
+#endif
- wasPlaying = false;
- playing = false;
+ wasPlaying = false;
+ playing = false;
}
void CDAudio_Pause(void)
{
- if (cdfile == -1 || !enabled)
- return;
+#ifdef PAUSE_BY_STOPPING
+ qboolean t;
+#endif
- if (!playing)
- return;
+ if (cdfile == -1 || !enabled)
+ return;
- if ( ioctl(cdfile, CDROMPAUSE) == -1 )
- Con_DPrintf("ioctl cdrompause failed\n");
+ if (!playing)
+ return;
+
+#ifndef PAUSE_BY_STOPPING
+#ifdef __linux__
+ if ( ioctl(cdfile, CDROMPAUSE) == -1 )
+ Con_DPrintf("ioctl cdrompause failed\n");
+#endif
- wasPlaying = playing;
- playing = false;
+#ifdef __NetBSD__
+ if ( ioctl(cdfile, CDIOCPAUSE) == -1 )
+ Con_DPrintf("ioctl cdrompause failed\n");
+#endif
+#else
+ t_playLooping = playLooping;
+ t_playTrack=playTrack;
+ t=playing;
+ CDAudio_Stop();
+ playing=t;
+#endif
+
+ wasPlaying = playing;
+ playing = false;
}
void CDAudio_Resume(void)
{
- if (cdfile == -1 || !enabled)
- return;
+ if (cdfile == -1 || !enabled)
+ return;
- if (!cdValid)
- return;
+ if (!cdValid)
+ return;
- if (!wasPlaying)
- return;
+ if (!wasPlaying)
+ return;
- if ( ioctl(cdfile, CDROMRESUME) == -1 )
- Con_DPrintf("ioctl cdromresume failed\n");
- playing = true;
+#ifndef PAUSE_BY_STOPPING
+#ifdef __linux__
+ if ( ioctl(cdfile, CDROMRESUME) == -1 )
+ Con_DPrintf("ioctl cdromresume failed\n");
+#endif
+
+#ifdef __NetBSD__
+ if ( ioctl(cdfile, CDIOCRESUME) == -1 )
+ Con_DPrintf("ioctl cdromresume failed\n");
+#endif
+#else
+ CDAudio_Play(t_playTrack, t_playLooping);
+#endif
+
+ playing = true;
}
static void CD_f (void)
@@ -327,43 +463,72 @@
void CDAudio_Update(void)
{
- struct cdrom_subchnl subchnl;
- static time_t lastchk;
+#ifdef __linux__
+ struct cdrom_subchnl subchnl;
+#endif
+#ifdef __NetBSD__
+ struct ioc_read_subchannel subchnl;
+ struct cd_sub_channel_info data;
+#endif
+ static time_t lastchk;
- if (!enabled)
- return;
+ if (!enabled)
+ return;
- if (bgmvolume.value != cdvolume)
+ if (bgmvolume.value != cdvolume)
+ {
+ if (cdvolume)
{
- if (cdvolume)
- {
- Cvar_SetValue ("bgmvolume", 0.0);
- cdvolume = bgmvolume.value;
- CDAudio_Pause ();
- }
- else
- {
- Cvar_SetValue ("bgmvolume", 1.0);
- cdvolume = bgmvolume.value;
- CDAudio_Resume ();
- }
+ Cvar_SetValue ("bgmvolume", 0.0);
+ cdvolume = bgmvolume.value;
+ CDAudio_Pause ();
}
-
BUILD_DEBUG_DIR=debug$(ARCH)$(GLIBC)
BUILD_RELEASE_DIR=release$(ARCH)$(GLIBC)
CLIENT_DIR=$(MAINDIR)/client
@@ -37,7 +35,8 @@
MESA_DIR=/usr/local/src/Mesa-3.0
- if (playing && lastchk < time(NULL)) {
- lastchk = time(NULL) + 2; //two seconds between chks
- subchnl.cdsc_format = CDROM_MSF;
- if (ioctl(cdfile, CDROMSUBCHNL, &subchnl) == -1 ) {
- Con_DPrintf("ioctl cdromsubchnl failed\n");
- playing = false;
- return;
- }
- if (subchnl.cdsc_audiostatus != CDROM_AUDIO_PLAY &&
- subchnl.cdsc_audiostatus != CDROM_AUDIO_PAUSED) {
- playing = false;
- if (playLooping)
- CDAudio_Play(playTrack, true);
- }
+ else
+ {
+ Cvar_SetValue ("bgmvolume", 1.0);
+ cdvolume = bgmvolume.value;
+ CDAudio_Resume ();
}
+ }
+
+
+ if (playing && lastchk < time(NULL)) {
+ lastchk = time(NULL) + 2; /* two seconds between chks */
+#ifdef __linux
+ subchnl.cdsc_format = CDROM_MSF;
+ if (ioctl(cdfile, CDROMSUBCHNL, &subchnl) == -1 ) {
+ Con_DPrintf("ioctl cdromsubchnl failed\n");
+ playing = false;
+ return;
+ }
+ if (subchnl.cdsc_audiostatus != CDROM_AUDIO_PLAY &&
+ subchnl.cdsc_audiostatus != CDROM_AUDIO_PAUSED) {
+ playing = false;
+ if (playLooping)
+ CDAudio_Play(playTrack, true);
+ }
+#endif
+#ifdef __NetBSD__
+ 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 ) {
+ Con_DPrintf("ioctl cdromsubchnl 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);
+ }
+#endif
+ }
+
}
CC=gcc
-BASE_CFLAGS=-Wall -Dstricmp=strcasecmp -I$(CLIENT_DIR) -I$(SERVER_DIR)
+BASE_CFLAGS=-Wall -Dstricmp=strcasecmp -I$(CLIENT_DIR) -I$(SERVER_DIR) \
+ ${CFLAGS} -I${X11BASE}/include
DEBUG_CFLAGS=$(BASE_CFLAGS) -g
ifeq ($(ARCH),axp)
RELEASE_CFLAGS=$(BASE_CFLAGS) -ffast-math -funroll-loops \
@@ -49,19 +48,21 @@
endif
GLCFLAGS=-DGLQUAKE -I/usr/local/src/Mesa-3.0/include -I/usr/include/glide
int CDAudio_Init(void)
@@ -375,6 +540,8 @@
return -1;
#endif
-LDFLAGS=-lm
+LDFLAGS=-lm -lossaudio
SVGALDFLAGS=-lvga
XLDFLAGS=-L/usr/X11R6/lib -lX11 -lXext
-GL_SVGA_LDFLAGS=-L/usr/X11/lib -L/usr/local/src/Mesa-3.0/lib -lm -lMesaGL -lglide2x -lX11 -lXext -lvga
-GL_X11_LDFLAGS=-L/usr/X11/lib -L/usr/local/src/Mesa-3.0/lib -lm -lGL -lX11 -lXext
+GL_SVGA_LDFLAGS=-L/usr/X11R6/lib -L/usr/local/src/Mesa-3.0/lib -lm -lMesaGL -lglide2x -lX11 -lXext -lvga
+GL_X11_LDFLAGS=-L/usr/X11R6/lib -L/usr/local/src/Mesa-3.0/lib -lm -lGL -lX11 -lXext
+ fprintf(stderr,"...... cdaudio_init .......\n");
+
if (COM_CheckParm("-nocdaudio"))
return -1;
DO_CC=$(CC) $(CFLAGS) -o $@ -c $<
DO_O_CC=$(CC) -O $(CFLAGS) -o $@ -c $<
DO_GL_CC=$(CC) $(CFLAGS) $(GLCFLAGS) -o $@ -c $<
DO_SERVER_CC=$(CC) -DSERVERONLY $(CFLAGS) -o $@ -c $<
@@ -384,9 +551,9 @@
}
-DO_AS=$(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
-DO_GL_AS=$(CC) $(CFLAGS) $(GLCFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
+DO_AS=$(CC) $(CFLAGS) -DAOUT -x assembler-with-cpp -o $@ -c $<
+#DO_AS=$(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
+DO_GL_AS=$(CC) $(CFLAGS) $(GLCFLAGS) -DAOUT -x assembler-with-cpp -o $@ -c $<
+#DO_GL_AS=$(CC) $(CFLAGS) $(GLCFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
if ((cdfile = open(cd_dev, O_RDONLY)) == -1) {
- Con_Printf("CDAudio_Init: open of \"%s\" failed (%i)\n", cd_dev, errno);
- cdfile = -1;
- return -1;
+ Con_Printf("CDAudio_Init: open of \"%s\" failed (%i)\n", cd_dev, errno);
+ cdfile = -1;
+ return -1;
}
#############################################################################
# SETUP AND BUILD
@@ -71,7 +72,7 @@
TARGETS=$(BUILDDIR)/qwsv
#$(BUILDDIR)/qwcl.x11
else
-TARGETS=$(BUILDDIR)/qwsv $(BUILDDIR)/qwcl $(BUILDDIR)/qwcl.x11 $(BUILDDIR)/glqwcl $(BUILDDIR)/glqwcl.glx
+TARGETS=$(BUILDDIR)/qwsv $(BUILDDIR)/qwcl.x11 $(BUILDDIR)/glqwcl.glx
endif
build_debug:
@@ -269,7 +270,7 @@
$(BUILDDIR)/client/view.o \
$(BUILDDIR)/client/wad.o \
$(BUILDDIR)/client/zone.o \
- $(BUILDDIR)/client/cd_linux.o \
+ $(BUILDDIR)/client/cd_null.o \
$(BUILDDIR)/client/sys_linux.o \
$(BUILDDIR)/client/snd_linux.o \
@@ -485,7 +486,7 @@
$(BUILDDIR)/client/zone.o : $(CLIENT_DIR)/zone.c
$(DO_CC)
-$(BUILDDIR)/client/cd_linux.o : $(CLIENT_DIR)/cd_linux.c
+$(BUILDDIR)/client/cd_null.o : $(CLIENT_DIR)/cd_null.c
$(DO_CC)
$(BUILDDIR)/client/sys_linux.o : $(CLIENT_DIR)/sys_linux.c
@@ -590,7 +591,7 @@
$(BUILDDIR)/glclient/view.o \
$(BUILDDIR)/glclient/wad.o \
$(BUILDDIR)/glclient/zone.o \
- $(BUILDDIR)/glclient/cd_linux.o \
+ $(BUILDDIR)/glclient/cd_null.o \
$(BUILDDIR)/glclient/sys_linux.o \
$(BUILDDIR)/glclient/snd_linux.o \
\
@@ -715,7 +716,7 @@
$(BUILDDIR)/glclient/zone.o : $(CLIENT_DIR)/zone.c
$(DO_GL_CC)
-$(BUILDDIR)/glclient/cd_linux.o : $(CLIENT_DIR)/cd_linux.c
+$(BUILDDIR)/glclient/cd_null.o : $(CLIENT_DIR)/cd_null.c
$(DO_GL_CC)
$(BUILDDIR)/glclient/sys_linux.o : $(CLIENT_DIR)/sys_linux.c
for (i = 0; i < 100; i++)

View file

@ -1,13 +1,13 @@
$NetBSD: patch-ab,v 1.1 2000/01/13 00:35:05 wiz Exp $
$NetBSD: patch-ab,v 1.2 2000/02/01 02:30:32 wiz Exp $
--- server/sys_unix.c.orig Thu Jan 13 00:13:37 2000
+++ server/sys_unix.c Thu Jan 13 00:13:58 2000
@@ -24,7 +24,7 @@
#include <libc.h>
--- QW/client/gl_draw.c Tue Dec 21 15:46:06 1999
+++ ../work/QW/client/gl_draw.c Sat Jan 15 23:08:00 2000
@@ -1367,7 +1367,7 @@
{
if (!gl_mtexable)
return;
-#ifndef __linux__ // no multitexture under Linux yet
+#if !defined(__linux__) && !defined(__NetBSD__) // no multitexture under Linux yet
qglSelectTextureSGIS(target);
#endif
-#if defined(__linux__) || defined(sun)
+#if defined(__linux__) || defined(sun) || defined(__NetBSD__)
#include <sys/stat.h>
#include <unistd.h>
#include <sys/time.h>
if (target == oldtarget)

View file

@ -1,16 +1,43 @@
$NetBSD: patch-ac,v 1.1 2000/01/13 00:35:06 wiz Exp $
$NetBSD: patch-ac,v 1.2 2000/02/01 02:30:33 wiz Exp $
--- client/snd_linux.c.orig Mon Jul 7 20:08:00 1997
+++ client/snd_linux.c Thu Jan 13 00:29:11 2000
@@ -6,7 +6,11 @@
#include <sys/mman.h>
#include <sys/shm.h>
#include <sys/wait.h>
+#ifdef __NetBSD__
+#include <soundcard.h>
+#else
#include <linux/soundcard.h>
+#endif
--- QW/client/gl_vidlinuxglx.c Tue Dec 21 18:45:54 1999
+++ ../work/QW/client/gl_vidlinuxglx.c Wed Jan 19 21:58:20 2000
@@ -20,7 +20,6 @@
#include <termios.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
-#include <sys/vt.h>
#include <stdarg.h>
#include <stdio.h>
#include "quakedef.h"
#include <signal.h>
@@ -560,6 +559,9 @@
void VID_Init8bitPalette(void)
{
+#ifdef __NetBSD__
+ return;
+#else
// Check for 8bit Extensions and initialize them.
int i;
GLubyte table[256][4];
@@ -580,6 +582,7 @@
}
gl3DfxSetPaletteEXT((GLuint *)table);
is8bit = true;
+#endif
}
#endif
@@ -603,7 +606,12 @@
Window root;
XVisualInfo *visinfo;
+ /* For some reason this is called. It causes trouble for NetBSD
+ and sound won't work */
+
+#ifndef __NetBSD__
S_Init();
+#endif
Cvar_RegisterVariable (&vid_mode);
Cvar_RegisterVariable (&gl_ztrick);

View file

@ -1,14 +1,167 @@
$NetBSD: patch-ad,v 1.1 2000/01/13 00:35:06 wiz Exp $
$NetBSD: patch-ad,v 1.2 2000/02/01 02:30:33 wiz Exp $
--- client/cd_null.c~ Mon Jul 7 20:08:00 1997
+++ client/cd_null.c Thu Jan 13 00:59:02 2000
@@ -9,6 +9,9 @@
{
}
--- QW/client/snd_linux.c Mon Jul 7 20:08:00 1997
+++ ../work/QW/client/snd_linux.c Sun Jan 16 19:35:45 2000
@@ -6,15 +6,33 @@
#include <sys/mman.h>
#include <sys/shm.h>
#include <sys/wait.h>
+
+#ifdef __NetBSD__
+#include <soundcard.h>
+#endif
+
+#ifdef __linux__
#include <linux/soundcard.h>
+#endif
+
#include <stdio.h>
#include "quakedef.h"
+void CDAudio_Pause(void)
+{
+}
-int audio_fd;
+int audio_fd = -1;
int snd_inited;
void CDAudio_Resume(void)
static int tryrates[] = { 11025, 22051, 44100, 8000 };
+#ifdef __linux__
+char *audio_device="/dev/dsp";
+#define MMAP_PROTECTION PROT_WRITE
+#endif
+
+#ifdef __NetBSD__
+char *audio_device="/dev/audio";
+#define MMAP_PROTECTION PROT_WRITE|PROT_READ
+#endif
+
qboolean SNDDMA_Init(void)
{
@@ -28,28 +46,29 @@
snd_inited = 0;
-// open /dev/dsp, confirm capability to mmap, and get size of dma buffer
+// open /dev/dsp or whatever, confirm capability to mmap, and get size of
+// dma buffer
- audio_fd = open("/dev/dsp", O_RDWR);
+ audio_fd = open(audio_device, O_RDWR);
if (audio_fd < 0)
{
- perror("/dev/dsp");
- Con_Printf("Could not open /dev/dsp\n");
+ perror(audio_device);
+ Con_Printf("Could not open %s\n",audio_device);
return 0;
}
rc = ioctl(audio_fd, SNDCTL_DSP_RESET, 0);
if (rc < 0)
{
- perror("/dev/dsp");
- Con_Printf("Could not reset /dev/dsp\n");
+ perror(audio_device);
+ Con_Printf("Could not reset %s\n",audio_device);
close(audio_fd);
return 0;
}
if (ioctl(audio_fd, SNDCTL_DSP_GETCAPS, &caps)==-1)
{
- perror("/dev/dsp");
+ perror(audio_device);
Con_Printf("Sound driver too old\n");
close(audio_fd);
return 0;
@@ -111,11 +130,11 @@
// memory map the dma buffer
shm->buffer = (unsigned char *) mmap(NULL, info.fragstotal
- * info.fragsize, PROT_WRITE, MAP_FILE|MAP_SHARED, audio_fd, 0);
+ * info.fragsize, MMAP_PROTECTION, MAP_FILE|MAP_SHARED, audio_fd, 0);
if (!shm->buffer)
{
- perror("/dev/dsp");
- Con_Printf("Could not mmap /dev/dsp\n");
+ perror(audio_device);
+ Con_Printf("Could not mmap %s\n",audio_device);
close(audio_fd);
return 0;
}
@@ -126,8 +145,8 @@
rc = ioctl(audio_fd, SNDCTL_DSP_STEREO, &tmp);
if (rc < 0)
{
- perror("/dev/dsp");
- Con_Printf("Could not set /dev/dsp to stereo=%d", shm->channels);
+ perror(audio_device);
+ Con_Printf("Could not set %s to stereo=%d", audio_device, shm->channels);
close(audio_fd);
return 0;
}
@@ -139,8 +158,8 @@
rc = ioctl(audio_fd, SNDCTL_DSP_SPEED, &shm->speed);
if (rc < 0)
{
- perror("/dev/dsp");
- Con_Printf("Could not set /dev/dsp speed to %d", shm->speed);
+ perror(audio_device);
+ Con_Printf("Could not set %s speed to %d", audio_device, shm->speed);
close(audio_fd);
return 0;
}
@@ -151,7 +170,7 @@
rc = ioctl(audio_fd, SNDCTL_DSP_SETFMT, &rc);
if (rc < 0)
{
- perror("/dev/dsp");
+ perror(audio_device);
Con_Printf("Could not support 16-bit data. Try 8-bit.\n");
close(audio_fd);
return 0;
@@ -163,7 +182,7 @@
rc = ioctl(audio_fd, SNDCTL_DSP_SETFMT, &rc);
if (rc < 0)
{
- perror("/dev/dsp");
+ perror(audio_device);
Con_Printf("Could not support 8-bit data.\n");
close(audio_fd);
return 0;
@@ -171,7 +190,7 @@
}
else
{
- perror("/dev/dsp");
+ perror(audio_device);
Con_Printf("%d-bit sound not supported.", shm->samplebits);
close(audio_fd);
return 0;
@@ -183,7 +202,7 @@
rc = ioctl(audio_fd, SNDCTL_DSP_SETTRIGGER, &tmp);
if (rc < 0)
{
- perror("/dev/dsp");
+ perror(audio_device);
Con_Printf("Could not toggle.\n");
close(audio_fd);
return 0;
@@ -192,7 +211,7 @@
rc = ioctl(audio_fd, SNDCTL_DSP_SETTRIGGER, &tmp);
if (rc < 0)
{
- perror("/dev/dsp");
+ perror(audio_device);
Con_Printf("Could not toggle.\n");
close(audio_fd);
return 0;
@@ -214,7 +233,7 @@
if (ioctl(audio_fd, SNDCTL_DSP_GETOPTR, &count)==-1)
{
- perror("/dev/dsp");
+ perror(audio_device);
Con_Printf("Uh, sound dead.\n");
close(audio_fd);
snd_inited = 0;

View file

@ -1,12 +1,104 @@
$NetBSD: patch-ae,v 1.1 2000/01/13 00:35:06 wiz Exp $
$NetBSD: patch-ae,v 1.2 2000/02/01 02:30:33 wiz Exp $
--- client/gl_vidlinuxglx.c~ Tue Dec 21 18:45:54 1999
+++ client/gl_vidlinuxglx.c Thu Jan 13 01:02:59 2000
@@ -20,7 +20,6 @@
#include <termios.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
-#include <sys/vt.h>
#include <stdarg.h>
#include <stdio.h>
#include <signal.h>
--- QW/Makefile.Linux Wed Apr 21 20:16:24 1999
+++ ../work/QW/Makefile.Linux Wed Jan 19 21:37:30 2000
@@ -27,41 +27,51 @@
RPMARCH=i386
endif
-MAINDIR=/grog/Projects/QW
-
-BUILD_DEBUG_DIR=debug$(ARCH)$(GLIBC)
-BUILD_RELEASE_DIR=release$(ARCH)$(GLIBC)
+#BUILD_DEBUG_DIR=debug$(ARCH)$(GLIBC)
+#BUILD_RELEASE_DIR=release$(ARCH)$(GLIBC)
+BUILD_DEBUG_DIR=debug_version
+BUILD_RELEASE_DIR=release_version
CLIENT_DIR=$(MAINDIR)/client
SERVER_DIR=$(MAINDIR)/server
MESA_DIR=/usr/local/src/Mesa-3.0
CC=gcc
-BASE_CFLAGS=-Wall -Dstricmp=strcasecmp -I$(CLIENT_DIR) -I$(SERVER_DIR)
+BASE_CFLAGS=-Wall -Dstricmp=strcasecmp -I$(CLIENT_DIR) -I$(SERVER_DIR) \
+ ${CFLAGS} -I${X11BASE}/include -O0
DEBUG_CFLAGS=$(BASE_CFLAGS) -g
ifeq ($(ARCH),axp)
RELEASE_CFLAGS=$(BASE_CFLAGS) -ffast-math -funroll-loops \
-fomit-frame-pointer -fexpensive-optimizations
else
-RELEASE_CFLAGS=$(BASE_CFLAGS) -m486 -O6 -ffast-math -funroll-loops \
+# Optimizer bug?!?!?
+#RELEASE_CFLAGS=$(BASE_CFLAGS) -m486 -O6 -ffast-math -funroll-loops \
+# -fomit-frame-pointer -fexpensive-optimizations -malign-loops=2 \
+# -malign-jumps=2 -malign-functions=2
+RELEASE_CFLAGS=$(BASE_CFLAGS) -m486 -ffast-math -funroll-loops \
-fomit-frame-pointer -fexpensive-optimizations -malign-loops=2 \
-malign-jumps=2 -malign-functions=2
endif
GLCFLAGS=-DGLQUAKE -I/usr/local/src/Mesa-3.0/include -I/usr/include/glide
-LDFLAGS=-lm
+LDFLAGS=-lm -lossaudio
SVGALDFLAGS=-lvga
XLDFLAGS=-L/usr/X11R6/lib -lX11 -lXext
-GL_SVGA_LDFLAGS=-L/usr/X11/lib -L/usr/local/src/Mesa-3.0/lib -lm -lMesaGL -lglide2x -lX11 -lXext -lvga
-GL_X11_LDFLAGS=-L/usr/X11/lib -L/usr/local/src/Mesa-3.0/lib -lm -lGL -lX11 -lXext
+GL_SVGA_LDFLAGS=-L/usr/X11R6/lib -L/usr/local/src/Mesa-3.0/lib -lm -lMesaGL -lglide2x -lX11 -lXext -lvga
+GL_X11_LDFLAGS=-L/usr/X11R6/lib -L/usr/local/src/Mesa-3.0/lib -lm -lGL -lX11 -lXext
DO_CC=$(CC) $(CFLAGS) -o $@ -c $<
-DO_O_CC=$(CC) -O $(CFLAGS) -o $@ -c $<
+#DO_O_CC=$(CC) -O $(CFLAGS) -o $@ -c $<
+DO_O_CC=$(CC) $(CFLAGS) -o $@ -c $<
DO_GL_CC=$(CC) $(CFLAGS) $(GLCFLAGS) -o $@ -c $<
DO_SERVER_CC=$(CC) -DSERVERONLY $(CFLAGS) -o $@ -c $<
-DO_AS=$(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
-DO_GL_AS=$(CC) $(CFLAGS) $(GLCFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
+DO_AS=$(CC) $(CFLAGS) -x assembler-with-cpp -o $@ -c $<
+#DO_AS=$(CC) $(CFLAGS) -DAOUT -x assembler-with-cpp -o $@ -c $<
+#DO_AS=$(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
+DO_GL_AS=$(CC) $(CFLAGS) $(GLCFLAGS) -x assembler-with-cpp -o $@ -c $<
+#DO_GL_AS=$(CC) $(CFLAGS) $(GLCFLAGS) -DAOUT -x assembler-with-cpp -o $@ -c $<
+#DO_GL_AS=$(CC) $(CFLAGS) $(GLCFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
#############################################################################
# SETUP AND BUILD
@@ -71,7 +81,7 @@
TARGETS=$(BUILDDIR)/qwsv
#$(BUILDDIR)/qwcl.x11
else
-TARGETS=$(BUILDDIR)/qwsv $(BUILDDIR)/qwcl $(BUILDDIR)/qwcl.x11 $(BUILDDIR)/glqwcl $(BUILDDIR)/glqwcl.glx
+TARGETS=$(BUILDDIR)/qwsv $(BUILDDIR)/qwcl.x11 $(BUILDDIR)/glqwcl.glx
endif
build_debug:
@@ -485,7 +495,7 @@
$(BUILDDIR)/client/zone.o : $(CLIENT_DIR)/zone.c
$(DO_CC)
-$(BUILDDIR)/client/cd_linux.o : $(CLIENT_DIR)/cd_linux.c
+$(BUILDDIR)/client/cd_linux.o : $(CLIENT_DIR)/cd_linux.c
$(DO_CC)
$(BUILDDIR)/client/sys_linux.o : $(CLIENT_DIR)/sys_linux.c
@@ -609,7 +619,7 @@
$(BUILDDIR)/glclient/math.o \
$(BUILDDIR)/glclient/snd_mixa.o \
$(BUILDDIR)/glclient/sys_dosa.o
-
+
GLQWCL_SVGA_OBJS = $(BUILDDIR)/glclient/gl_vidlinux.o
GLQWCL_X11_OBJS = $(BUILDDIR)/glclient/gl_vidlinuxglx.o
@@ -715,7 +725,7 @@
$(BUILDDIR)/glclient/zone.o : $(CLIENT_DIR)/zone.c
$(DO_GL_CC)
-$(BUILDDIR)/glclient/cd_linux.o : $(CLIENT_DIR)/cd_linux.c
+$(BUILDDIR)/glclient/cd_linux.o : $(CLIENT_DIR)/cd_linux.c
$(DO_GL_CC)
$(BUILDDIR)/glclient/sys_linux.o : $(CLIENT_DIR)/sys_linux.c

View file

@ -0,0 +1,13 @@
$NetBSD: patch-af,v 1.1 2000/02/01 02:30:33 wiz Exp $
--- QW/server/sys_unix.c Tue Dec 21 18:45:14 1999
+++ ../work/QW/server/sys_unix.c Sat Jan 15 23:02:46 2000
@@ -24,7 +24,7 @@
#include <libc.h>
#endif
-#if defined(__linux__) || defined(sun)
+#if defined(__linux__) || defined(sun) || defined(__NetBSD__)
#include <sys/stat.h>
#include <unistd.h>
#include <sys/time.h>

View file

@ -0,0 +1,532 @@
$NetBSD: patch-ag,v 1.1 2000/02/01 02:30:34 wiz Exp $
--- WinQuake/cd_linux.c Tue Dec 21 18:40:50 1999
+++ ../work/WinQuake/cd_linux.c Sat Jan 15 10:52:27 2000
@@ -31,7 +31,19 @@
#include <time.h>
#include <errno.h>
+#ifdef __linux__
#include <linux/cdrom.h>
+#endif
+
+#ifdef __NetBSD__
+#include <sys/cdio.h>
+
+/* resume seems to have some trouble right now. xcdplayer also can not resume
+ the drive correctly. It appears to play, but no audio is heard */
+
+#define PAUSE_BY_STOPPING 1
+
+#endif
#include "quakedef.h"
@@ -46,165 +58,289 @@
static byte playTrack;
static byte maxTrack;
+#ifdef PAUSE_BY_STOPPING
+static qboolean t_playLooping;
+static byte t_playTrack;
+#endif
+
static int cdfile = -1;
+#ifdef __linux__
static char cd_dev[64] = "/dev/cdrom";
+#endif
+
+#ifdef __NetBSD__
+static char cd_dev[64] = "/dev/rcd0d";
+#endif
static void CDAudio_Eject(void)
{
- if (cdfile == -1 || !enabled)
- return; // no cd init'd
-
- if ( ioctl(cdfile, CDROMEJECT) == -1 )
- Con_DPrintf("ioctl cdromeject failed\n");
+#ifdef __NetBSD__
+ int arg=0;
+#endif
+
+ if (cdfile == -1 || !enabled)
+ return; // no cd init'd
+
+#ifdef __linux__
+ if ( ioctl(cdfile, CDROMEJECT) == -1 )
+ Con_DPrintf("ioctl cdromeject failed\n");
+#endif
+#ifdef __NetBSD__
+ if(ioctl(cdfile, DIOCLOCK, &arg) == -1)
+ Con_DPrintf("ioctl cdromunlock failed\n");
+ arg = 1;
+ if ( ioctl(cdfile, DIOCEJECT, &arg) == -1 )
+ Con_DPrintf("ioctl cdromeject failed\n");
+#endif
}
static void CDAudio_CloseDoor(void)
{
- if (cdfile == -1 || !enabled)
- return; // no cd init'd
+if (cdfile == -1 || !enabled)
+ return; // no cd init'd
- if ( ioctl(cdfile, CDROMCLOSETRAY) == -1 )
- Con_DPrintf("ioctl cdromclosetray failed\n");
+#ifdef __linux__
+ if ( ioctl(cdfile, CDROMCLOSETRAY) == -1 )
+ Con_DPrintf("ioctl cdromclosetray failed\n");
+#endif
+#ifdef __NetBSD__
+ if(ioctl(cdfile, CDIOCCLOSE, NULL) == -1) {
+ Con_DPrintf("ioctl cdromclosetray failed\n");
+ }
+#endif
}
static int CDAudio_GetAudioDiskInfo(void)
{
- struct cdrom_tochdr tochdr;
+#ifdef __linux__
+struct cdrom_tochdr tochdr;
+#endif
+#ifdef __NetBSD__
+struct ioc_toc_header tochdr;
+#endif
- cdValid = false;
+cdValid = false;
- if ( ioctl(cdfile, CDROMREADTOCHDR, &tochdr) == -1 )
- {
- Con_DPrintf("ioctl cdromreadtochdr failed\n");
- return -1;
- }
+#ifdef __linux
+if ( ioctl(cdfile, CDROMREADTOCHDR, &tochdr) == -1 )
+{
+ Con_DPrintf("ioctl cdromreadtochdr failed\n");
+ return -1;
+}
+#endif
- if (tochdr.cdth_trk0 < 1)
- {
- Con_DPrintf("CDAudio: no music tracks\n");
- return -1;
- }
+#ifdef __NetBSD__
+if ( ioctl(cdfile, CDIOREADTOCHEADER, &tochdr) == -1 )
+{
+ Con_DPrintf("ioctl cdromreadtochdr failed\n");
+ return -1;
+}
+#endif
- cdValid = true;
- maxTrack = tochdr.cdth_trk1;
+#ifdef __linux__
+if (tochdr.cdth_trk0 < 1)
+ {
+ Con_DPrintf("CDAudio: no music tracks\n");
+ return -1;
+ }
+#endif
+#ifdef __NetBSD__
+if (tochdr.starting_track < 1)
+ {
+ Con_DPrintf("CDAudio: no music tracks\n");
+ return -1;
+ }
+#endif
+
+cdValid = true;
+#ifdef __linux__
+maxTrack = tochdr.cdth_trk1;
+#endif
+#ifdef __NetBSD__
+maxTrack = tochdr.ending_track;
+#endif
- return 0;
+return 0;
}
void CDAudio_Play(byte track, qboolean looping)
{
- struct cdrom_tocentry entry;
- struct cdrom_ti ti;
+#ifdef __linux__
+ struct cdrom_tocentry entry;
+ struct cdrom_ti ti;
+#endif
+
+#ifdef __NetBSD__
+ struct ioc_read_toc_entry entry;
+ struct ioc_play_track ti;
+ int arg=1;
+#endif
- if (cdfile == -1 || !enabled)
- return;
+ if (cdfile == -1 || !enabled)
+ return;
- if (!cdValid)
- {
- CDAudio_GetAudioDiskInfo();
- if (!cdValid)
- return;
- }
+ if (!cdValid)
+ {
+ CDAudio_GetAudioDiskInfo();
+ if (!cdValid)
+ return;
+ }
- track = remap[track];
+ track = remap[track];
- if (track < 1 || track > maxTrack)
- {
- Con_DPrintf("CDAudio: Bad track number %u.\n", track);
- return;
- }
+ if (track < 1 || track > maxTrack)
+ {
+ Con_DPrintf("CDAudio: Bad track number %u.\n", track);
+ return;
+ }
- // don't try to play a non-audio track
- entry.cdte_track = track;
- entry.cdte_format = CDROM_MSF;
- if ( ioctl(cdfile, CDROMREADTOCENTRY, &entry) == -1 )
- {
- Con_DPrintf("ioctl cdromreadtocentry failed\n");
- return;
- }
- if (entry.cdte_ctrl == CDROM_DATA_TRACK)
- {
- Con_Printf("CDAudio: track %i is not audio\n", track);
- return;
- }
+#ifdef __linux__ /* Not sure what the equiv is for NetBSD */
+ /* don't try to play a non-audio track */
+ entry.cdte_track = track;
+ entry.cdte_format = CDROM_MSF;
+ if ( ioctl(cdfile, CDROMREADTOCENTRY, &entry) == -1 )
+ {
+ Con_DPrintf("ioctl cdromreadtocentry failed\n");
+ return;
+ }
+ if (entry.cdte_ctrl == CDROM_DATA_TRACK)
+ {
+ Con_Printf("CDAudio: track %i is not audio\n", track);
+ return;
+ }
- if (playing)
- {
- if (playTrack == track)
- return;
- CDAudio_Stop();
- }
+#endif
- ti.cdti_trk0 = track;
- ti.cdti_trk1 = track;
- ti.cdti_ind0 = 1;
- ti.cdti_ind1 = 99;
+ if (playing)
+ {
+ if (playTrack == track)
+ return;
+ CDAudio_Stop();
+ }
- if ( ioctl(cdfile, CDROMPLAYTRKIND, &ti) == -1 )
+#ifdef __linux__
+ ti.cdti_trk0 = track;
+ ti.cdti_trk1 = track;
+ ti.cdti_ind0 = 1;
+ ti.cdti_ind1 = 99;
+ if ( ioctl(cdfile, CDROMPLAYTRKIND, &ti) == -1 )
{
- Con_DPrintf("ioctl cdromplaytrkind failed\n");
- return;
+ Con_DPrintf("ioctl cdromplaytrkind failed\n");
+ return;
}
- if ( ioctl(cdfile, CDROMRESUME) == -1 )
- Con_DPrintf("ioctl cdromresume failed\n");
+ if ( ioctl(cdfile, CDROMRESUME) == -1 )
+ Con_DPrintf("ioctl cdromresume failed\n");
+#endif
+
+#ifdef __NetBSD__
+ ti.start_track = track;
+ ti.end_track = track;
+ ti.start_index = 1;
+ ti.end_index = 99;
+ if ( ioctl(cdfile, CDIOCPLAYTRACKS, &ti) == -1 )
+ {
+ Con_DPrintf("ioctl cdromplaytrkind failed\n");
+ return;
+ }
- playLooping = looping;
- playTrack = track;
- playing = true;
+ if ( ioctl(cdfile, CDIOCRESUME, &arg) == -1 )
+ Con_DPrintf("ioctl cdromresume failed\n");
+#endif
+
+ playLooping = looping;
+ playTrack = track;
+ playing = true;
- if (cdvolume == 0.0)
- CDAudio_Pause ();
+ if (cdvolume == 0.0)
+ CDAudio_Pause ();
}
void CDAudio_Stop(void)
{
- if (cdfile == -1 || !enabled)
- return;
+ if (cdfile == -1 || !enabled)
+ return;
- if (!playing)
- return;
+ if (!playing)
+ return;
- if ( ioctl(cdfile, CDROMSTOP) == -1 )
- Con_DPrintf("ioctl cdromstop failed (%d)\n", errno);
+#ifdef __linux__
+ if ( ioctl(cdfile, CDROMSTOP) == -1 )
+ Con_DPrintf("ioctl cdromstop failed (%d)\n", errno);
+#endif
+#ifdef __NetBSD__
+ if ( ioctl(cdfile, CDIOCSTOP) == -1 )
+ Con_DPrintf("ioctl cdromstop failed (%d)\n", errno);
+#endif
- wasPlaying = false;
- playing = false;
+ wasPlaying = false;
+ playing = false;
}
void CDAudio_Pause(void)
{
- if (cdfile == -1 || !enabled)
- return;
-
- if (!playing)
- return;
+#ifdef PAUSE_BY_STOPPING
+ qboolean t;
+#endif
+
+ if (cdfile == -1 || !enabled)
+ return;
+
+ if (!playing)
+ return;
+
+#ifndef PAUSE_BY_STOPPING
+#ifdef __linux__
+ if ( ioctl(cdfile, CDROMPAUSE) == -1 )
+ Con_DPrintf("ioctl cdrompause failed\n");
+#endif
+
+#ifdef __NetBSD__
+ if ( ioctl(cdfile, CDIOCPAUSE) == -1 )
+ Con_DPrintf("ioctl cdrompause failed\n");
+#endif
+#else
+ t_playLooping = playLooping;
+ t_playTrack=playTrack;
+ t=playing;
+ CDAudio_Stop();
+ playing=t;
+#endif
- if ( ioctl(cdfile, CDROMPAUSE) == -1 )
- Con_DPrintf("ioctl cdrompause failed\n");
-
- wasPlaying = playing;
- playing = false;
+ wasPlaying = playing;
+ playing = false;
}
void CDAudio_Resume(void)
{
- if (cdfile == -1 || !enabled)
- return;
+ if (cdfile == -1 || !enabled)
+ return;
- if (!cdValid)
- return;
+ if (!cdValid)
+ return;
- if (!wasPlaying)
- return;
+ if (!wasPlaying)
+ return;
- if ( ioctl(cdfile, CDROMRESUME) == -1 )
- Con_DPrintf("ioctl cdromresume failed\n");
- playing = true;
+#ifndef PAUSE_BY_STOPPING
+#ifdef __linux__
+ if ( ioctl(cdfile, CDROMRESUME) == -1 )
+ Con_DPrintf("ioctl cdromresume failed\n");
+#endif
+
+#ifdef __NetBSD__
+ if ( ioctl(cdfile, CDIOCRESUME) == -1 )
+ Con_DPrintf("ioctl cdromresume failed\n");
+#endif
+#else
+ CDAudio_Play(t_playTrack, t_playLooping);
+#endif
+
+ playing = true;
}
static void CD_f (void)
@@ -327,43 +463,72 @@
void CDAudio_Update(void)
{
- struct cdrom_subchnl subchnl;
- static time_t lastchk;
+#ifdef __linux__
+ struct cdrom_subchnl subchnl;
+#endif
+#ifdef __NetBSD__
+ struct ioc_read_subchannel subchnl;
+ struct cd_sub_channel_info data;
+#endif
+ static time_t lastchk;
- if (!enabled)
- return;
+ if (!enabled)
+ return;
- if (bgmvolume.value != cdvolume)
+ if (bgmvolume.value != cdvolume)
+ {
+ if (cdvolume)
{
- if (cdvolume)
- {
- Cvar_SetValue ("bgmvolume", 0.0);
- cdvolume = bgmvolume.value;
- CDAudio_Pause ();
- }
- else
- {
- Cvar_SetValue ("bgmvolume", 1.0);
- cdvolume = bgmvolume.value;
- CDAudio_Resume ();
- }
+ Cvar_SetValue ("bgmvolume", 0.0);
+ cdvolume = bgmvolume.value;
+ CDAudio_Pause ();
}
-
- if (playing && lastchk < time(NULL)) {
- lastchk = time(NULL) + 2; //two seconds between chks
- subchnl.cdsc_format = CDROM_MSF;
- if (ioctl(cdfile, CDROMSUBCHNL, &subchnl) == -1 ) {
- Con_DPrintf("ioctl cdromsubchnl failed\n");
- playing = false;
- return;
- }
- if (subchnl.cdsc_audiostatus != CDROM_AUDIO_PLAY &&
- subchnl.cdsc_audiostatus != CDROM_AUDIO_PAUSED) {
- playing = false;
- if (playLooping)
- CDAudio_Play(playTrack, true);
- }
+ else
+ {
+ Cvar_SetValue ("bgmvolume", 1.0);
+ cdvolume = bgmvolume.value;
+ CDAudio_Resume ();
}
+ }
+
+
+ if (playing && lastchk < time(NULL)) {
+ lastchk = time(NULL) + 2; /* two seconds between chks */
+#ifdef __linux
+ subchnl.cdsc_format = CDROM_MSF;
+ if (ioctl(cdfile, CDROMSUBCHNL, &subchnl) == -1 ) {
+ Con_DPrintf("ioctl cdromsubchnl failed\n");
+ playing = false;
+ return;
+ }
+ if (subchnl.cdsc_audiostatus != CDROM_AUDIO_PLAY &&
+ subchnl.cdsc_audiostatus != CDROM_AUDIO_PAUSED) {
+ playing = false;
+ if (playLooping)
+ CDAudio_Play(playTrack, true);
+ }
+#endif
+#ifdef __NetBSD__
+ 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 ) {
+ Con_DPrintf("ioctl cdromsubchnl 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);
+ }
+#endif
+ }
+
}
int CDAudio_Init(void)
@@ -382,9 +547,9 @@
}
if ((cdfile = open(cd_dev, O_RDONLY)) == -1) {
- Con_Printf("CDAudio_Init: open of \"%s\" failed (%i)\n", cd_dev, errno);
- cdfile = -1;
- return -1;
+ Con_Printf("CDAudio_Init: open of \"%s\" failed (%i)\n", cd_dev, errno);
+ cdfile = -1;
+ return -1;
}
for (i = 0; i < 100; i++)

View file

@ -0,0 +1,14 @@
$NetBSD: patch-ah,v 1.1 2000/02/01 02:30:34 wiz Exp $
--- WinQuake/gl_vidlinuxglx.c Tue Dec 21 18:39:36 1999
+++ ../work/WinQuake/gl_vidlinuxglx.c Thu Jan 13 22:29:03 2000
@@ -20,7 +20,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 <signal.h>

View file

@ -0,0 +1,83 @@
$NetBSD: patch-ai,v 1.1 2000/02/01 02:30:34 wiz Exp $
--- WinQuake/Makefile.linuxi386 Tue Apr 27 17:51:18 1999
+++ ../work/WinQuake/Makefile.linuxi386 Wed Jan 19 21:38:00 2000
@@ -25,29 +25,32 @@
endif
NOARCH=noarch
-MOUNT_DIR=/grog/Projects/WinQuake
+MOUNT_DIR=${WRKSRC}/WinQuake
MASTER_DIR=/grog/Projects/QuakeMaster
-MESA_DIR=/usr/local/src/Mesa-2.6
+#MESA_DIR=/usr/local/src/Mesa-2.6
+MESA_DIR=${X11BASE}
TDFXGL_DIR = /home/zoid/3dfxgl
-BUILD_DEBUG_DIR=debug$(ARCH)$(GLIBC)
-BUILD_RELEASE_DIR=release$(ARCH)$(GLIBC)
+#BUILD_DEBUG_DIR=debug$(ARCH)$(GLIBC)
+#BUILD_RELEASE_DIR=release$(ARCH)$(GLIBC)
+BUILD_DEBUG_DIR=debug_version
+BUILD_RELEASE_DIR=release_version
EGCS=/usr/local/egcs-1.1.2/bin/gcc
-CC=$(EGCS)
+#CC=$(EGCS)
-BASE_CFLAGS=-Dstricmp=strcasecmp
+BASE_CFLAGS=-Dstricmp=strcasecmp -I${X11BASE}/include
RELEASE_CFLAGS=$(BASE_CFLAGS) -g -mpentiumpro -O6 -ffast-math -funroll-loops \
-fomit-frame-pointer -fexpensive-optimizations
DEBUG_CFLAGS=$(BASE_CFLAGS) -g
-LDFLAGS=-lm
+LDFLAGS=-lm -lossaudio
SVGALDFLAGS=-lvga
XLDFLAGS=-L/usr/X11R6/lib -lX11 -lXext -lXxf86dga
-XCFLAGS=-DX11
+XCFLAGS=-DX11 -I${X11BASE}/include
-MESAGLLDFLAGS=-L/usr/X11/lib -L/usr/local/lib -L$(MESA_DIR)/lib -lMesaGL -lglide2x -lX11 -lXext -ldl
+MESAGLLDFLAGS=-L${X11BASE}/lib -L${LOCALBASE}/lib -L$(MESA_DIR)/lib -lMesaGL -lX11 -lXext
TDFXGLLDFLAGS=-L$(TDFXGL_DIR)/release$(ARCH)$(GLIBC) -l3dfxgl -lglide2x -ldl
-GLLDFLAGS=-L/usr/X11/lib -L/usr/local/lib -lGL -lX11 -lXext -ldl -lXxf86dga -lXxf86vm -lm
+GLLDFLAGS=-L${X11BASE}/lib -L${LOCALBASE}/lib -lGL -lX11 -lXext -lXxf86dga -lXxf86vm -lm
GLCFLAGS=-DGLQUAKE -I$(MESA_DIR)/include -I/usr/include/glide
DO_CC=$(CC) $(CFLAGS) -o $@ -c $<
@@ -57,19 +60,28 @@
DO_X11_CC=$(CC) $(CFLAGS) $(XCFLAGS) -o $@ -c $<
DO_X11_DEBUG_CC=$(CC) $(DEBUG_CFLAGS) $(XCFLAGS) -o $@ -c $<
DO_O_CC=$(CC) -O $(CFLAGS) -o $@ -c $<
-DO_AS=$(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
-DO_GL_AS=$(CC) $(CFLAGS) $(GLCFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
+#DO_AS=$(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
+#DO_AS=$(CC) $(CFLAGS) -DAOUT -x assembler-with-cpp -o $@ -c $<
+DO_AS=$(CC) $(CFLAGS) -x assembler-with-cpp -o $@ -c $<
+#DO_GL_AS=$(CC) $(CFLAGS) $(GLCFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
+#DO_GL_AS=$(CC) $(CFLAGS) $(GLCFLAGS) -DAOUT -x assembler-with-cpp -o $@ -c $<
+DO_GL_AS=$(CC) $(CFLAGS) $(GLCFLAGS) -x assembler-with-cpp -o $@ -c $<
#############################################################################
# SETUP AND BUILD
#############################################################################
-TARGETS=$(BUILDDIR)/bin/squake \
- $(BUILDDIR)/bin/glquake \
- $(BUILDDIR)/bin/glquake.glx \
- $(BUILDDIR)/bin/glquake.3dfxgl \
- $(BUILDDIR)/bin/quake.x11
+#TARGETS=$(BUILDDIR)/bin/squake \
+# $(BUILDDIR)/bin/glquake \
+# $(BUILDDIR)/bin/glquake.glx \
+# $(BUILDDIR)/bin/glquake.3dfxgl \
+# $(BUILDDIR)/bin/quake.x11
# $(BUILDDIR)/bin/unixded
+
+TARGETS=$(BUILDDIR)/bin/glquake.glx \
+ $(BUILDDIR)/bin/quake.x11
+
+#TARGETS=$(BUILDDIR)/bin/quake.x11
build_debug:
@-mkdir $(BUILD_DEBUG_DIR) \

View file

@ -0,0 +1,167 @@
$NetBSD: patch-aj,v 1.1 2000/02/01 02:30:35 wiz Exp $
--- WinQuake/snd_linux.c Tue Dec 21 18:40:36 1999
+++ ../work/WinQuake/snd_linux.c Thu Jan 20 21:52:45 2000
@@ -25,15 +6,33 @@
#include <sys/mman.h>
#include <sys/shm.h>
#include <sys/wait.h>
+
+#ifdef __NetBSD__
+#include <soundcard.h>
+#endif
+
+#ifdef __linux__
#include <linux/soundcard.h>
+#endif
+
#include <stdio.h>
#include "quakedef.h"
-int audio_fd;
+int audio_fd = -1;
int snd_inited;
static int tryrates[] = { 11025, 22051, 44100, 8000 };
+#ifdef __linux__
+char *audio_device="/dev/dsp";
+#define MMAP_PROTECTION PROT_WRITE
+#endif
+
+#ifdef __NetBSD__
+char *audio_device="/dev/audio";
+#define MMAP_PROTECTION PROT_WRITE|PROT_READ
+#endif
+
qboolean SNDDMA_Init(void)
{
@@ -47,28 +46,29 @@
snd_inited = 0;
-// open /dev/dsp, confirm capability to mmap, and get size of dma buffer
+// open /dev/dsp or whatever, confirm capability to mmap, and get size of
+// dma buffer
- audio_fd = open("/dev/dsp", O_RDWR);
+ audio_fd = open(audio_device, O_RDWR);
if (audio_fd < 0)
{
- perror("/dev/dsp");
- Con_Printf("Could not open /dev/dsp\n");
+ perror(audio_device);
+ Con_Printf("Could not open %s\n",audio_device);
return 0;
}
rc = ioctl(audio_fd, SNDCTL_DSP_RESET, 0);
if (rc < 0)
{
- perror("/dev/dsp");
- Con_Printf("Could not reset /dev/dsp\n");
+ perror(audio_device);
+ Con_Printf("Could not reset %s\n",audio_device);
close(audio_fd);
return 0;
}
if (ioctl(audio_fd, SNDCTL_DSP_GETCAPS, &caps)==-1)
{
- perror("/dev/dsp");
+ perror(audio_device);
Con_Printf("Sound driver too old\n");
close(audio_fd);
return 0;
@@ -130,11 +130,11 @@
// memory map the dma buffer
shm->buffer = (unsigned char *) mmap(NULL, info.fragstotal
- * info.fragsize, PROT_WRITE, MAP_FILE|MAP_SHARED, audio_fd, 0);
+ * info.fragsize, MMAP_PROTECTION, MAP_FILE|MAP_SHARED, audio_fd, 0);
if (!shm->buffer || shm->buffer == (unsigned char *)-1)
{
- perror("/dev/dsp");
- Con_Printf("Could not mmap /dev/dsp\n");
+ perror(audio_device);
+ Con_Printf("Could not mmap %s\n",audio_device);
close(audio_fd);
return 0;
}
@@ -145,8 +145,8 @@
rc = ioctl(audio_fd, SNDCTL_DSP_STEREO, &tmp);
if (rc < 0)
{
- perror("/dev/dsp");
- Con_Printf("Could not set /dev/dsp to stereo=%d", shm->channels);
+ perror(audio_device);
+ Con_Printf("Could not set %s to stereo=%d", audio_device, shm->channels);
close(audio_fd);
return 0;
}
@@ -158,8 +158,8 @@
rc = ioctl(audio_fd, SNDCTL_DSP_SPEED, &shm->speed);
if (rc < 0)
{
- perror("/dev/dsp");
- Con_Printf("Could not set /dev/dsp speed to %d", shm->speed);
+ perror(audio_device);
+ Con_Printf("Could not set %s speed to %d", audio_device, shm->speed);
close(audio_fd);
return 0;
}
@@ -170,7 +170,7 @@
rc = ioctl(audio_fd, SNDCTL_DSP_SETFMT, &rc);
if (rc < 0)
{
- perror("/dev/dsp");
+ perror(audio_device);
Con_Printf("Could not support 16-bit data. Try 8-bit.\n");
close(audio_fd);
return 0;
@@ -182,7 +182,7 @@
rc = ioctl(audio_fd, SNDCTL_DSP_SETFMT, &rc);
if (rc < 0)
{
- perror("/dev/dsp");
+ perror(audio_device);
Con_Printf("Could not support 8-bit data.\n");
close(audio_fd);
return 0;
@@ -190,7 +190,7 @@
}
else
{
- perror("/dev/dsp");
+ perror(audio_device);
Con_Printf("%d-bit sound not supported.", shm->samplebits);
close(audio_fd);
return 0;
@@ -202,7 +202,7 @@
rc = ioctl(audio_fd, SNDCTL_DSP_SETTRIGGER, &tmp);
if (rc < 0)
{
- perror("/dev/dsp");
+ perror(audio_device);
Con_Printf("Could not toggle.\n");
close(audio_fd);
return 0;
@@ -211,7 +211,7 @@
rc = ioctl(audio_fd, SNDCTL_DSP_SETTRIGGER, &tmp);
if (rc < 0)
{
- perror("/dev/dsp");
+ perror(audio_device);
Con_Printf("Could not toggle.\n");
close(audio_fd);
return 0;
@@ -233,7 +233,7 @@
if (ioctl(audio_fd, SNDCTL_DSP_GETOPTR, &count)==-1)
{
- perror("/dev/dsp");
+ perror(audio_device);
Con_Printf("Uh, sound dead.\n");
close(audio_fd);
snd_inited = 0;

View file

@ -0,0 +1,14 @@
$NetBSD: patch-ak,v 1.1 2000/02/01 02:30:35 wiz Exp $
--- WinQuake/vid_x.c.orig Tue Dec 21 18:40:22 1999
+++ WinQuake/vid_x.c Fri Jan 28 23:34:06 2000
@@ -711,6 +711,9 @@
void VID_Shutdown (void)
{
Con_Printf("VID_Shutdown\n");
+ /* if display hasn't been initialised, we don't have to close it */
+ if (!x_disp)
+ return;
XAutoRepeatOn(x_disp);
XCloseDisplay(x_disp);
}

View file

@ -1 +1 @@
legendary 1st person shoot'em up game
legendary first person shoot'em up game

View file

@ -1 +1 @@
legendary 1st person shoot'em up game
legendary first person shoot'em up game

11
games/quake/pkg/INSTALL Normal file
View file

@ -0,0 +1,11 @@
#!/bin/sh
if [ "$2" = "POST-INSTALL" ]
then
echo
echo =====================================================================
echo For running quake you need data files. Look for quakesw-1.0.6.tar.gz.
echo Extract it somewhere, and start quake from the same directory, e.g.
echo by running \'quake.x11\'.
echo =====================================================================
fi

View file

@ -1 +1,6 @@
@comment $NetBSD: PLIST,v 1.1.1.1 1999/12/28 14:20:42 tron Exp $
@comment $NetBSD: PLIST,v 1.2 2000/02/01 02:30:37 wiz Exp $
bin/qwsv
bin/qwcl.x11
bin/glqwcl.glx
bin/glquake.glx
bin/quake.x11