Import of pkgsrc-2013Q2

This commit is contained in:
2013-09-26 17:14:40 +02:00
commit 785076ae39
74991 changed files with 4380255 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
legendary first person shoot'em up game
+10
View File
@@ -0,0 +1,10 @@
===========================================================================
$NetBSD: MESSAGE,v 1.1 2003/11/18 14:13:47 xtraeme Exp $
To run quake you need data files. The quakedata package, which contains
the shareware data, has been installed.
To start a game, run quake.x11 from a directory that contains
id1/pak0.pak, for example, ${PREFIX}/share/quake/.
===========================================================================
+61
View File
@@ -0,0 +1,61 @@
# $NetBSD: Makefile,v 1.48 2012/10/23 10:24:04 wiz Exp $
DISTNAME= q1source
PKGNAME= quake-2.30
PKGREVISION= 5
CATEGORIES= games x11
MASTER_SITES= ftp://ftp.fu-berlin.de/pc/msdos/games/idgames/idstuff/source/ \
ftp://ftp.idsoftware.com/idstuff/source/
EXTRACT_SUFX= .zip
MAINTAINER= pkgsrc-users@NetBSD.org
HOMEPAGE= http://www.idsoftware.com/
COMMENT= Legendary first person shoot'em up game
DEPENDS+= quakedata-[0-9]*:../../games/quakedata
ONLY_FOR_PLATFORM= *-*-i386
WRKSRC= ${WRKDIR}
USE_TOOLS+= gmake
MAKE_ENV+= MAINDIR=${WRKSRC:Q}
MAKE_ENV+= MESA_DIR=${BUILDLINK_PREFIX.Mesa}
MAKE_ENV+= X11BASE=${X11BASE:Q}
LDFLAGS+= ${LIBOSSAUDIO}
INSTALLATION_DIRS= bin
do-configure:
cd ${WRKSRC}/QW && ${LN} -fs Makefile.Linux ${MAKE_FILE}
cd ${WRKSRC}/WinQuake && ${LN} -fs Makefile.linuxi386 ${MAKE_FILE}
do-build:
( cd ${WRKSRC}/QW ; ${SETENV} ${MAKE_ENV} \
${GMAKE} MAINDIR=`pwd` CFLAGS="${CFLAGS}" all)
( cd ${WRKSRC}/WinQuake ; ${SETENV} ${MAKE_ENV} \
${GMAKE} MAINDIR=`pwd` CFLAGS="${CFLAGS}" \
WRKSRC="${WRKSRC}" all)
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/QW/release_version/qwsv \
${DESTDIR}${PREFIX}/bin
${INSTALL_PROGRAM} ${WRKSRC}/QW/release_version/qwcl.x11 \
${DESTDIR}${PREFIX}/bin
${INSTALL_PROGRAM} ${WRKSRC}/QW/release_version/glqwcl.glx \
${DESTDIR}${PREFIX}/bin
${INSTALL_PROGRAM} ${WRKSRC}/WinQuake/release_version/bin/glquake.glx \
${DESTDIR}${PREFIX}/bin
${INSTALL_PROGRAM} ${WRKSRC}/WinQuake/release_version/bin/quake.x11 \
${DESTDIR}${PREFIX}/bin
.include "../../graphics/MesaLib/buildlink3.mk"
.include "../../graphics/glu/buildlink3.mk"
.include "../../x11/libXext/buildlink3.mk"
.include "../../x11/libXxf86dga/buildlink3.mk"
.include "../../x11/libXxf86vm/buildlink3.mk"
.include "../../x11/xf86dgaproto/buildlink3.mk"
.include "../../mk/oss.buildlink3.mk"
.include "../../mk/bsd.pkg.mk"
+6
View File
@@ -0,0 +1,6 @@
@comment $NetBSD: PLIST,v 1.1 2001/11/01 00:55:07 zuntum Exp $
bin/qwsv
bin/qwcl.x11
bin/glqwcl.glx
bin/glquake.glx
bin/quake.x11
+21
View File
@@ -0,0 +1,21 @@
$NetBSD: distinfo,v 1.11 2011/09/14 19:19:37 marino Exp $
SHA1 (q1source.zip) = 1f607e549c6aa3921797e51b7d2038e95116c989
RMD160 (q1source.zip) = 57a750e8644116d0d07a273ea6ad0b6d3071c89f
Size (q1source.zip) = 3211531 bytes
SHA1 (patch-aa) = 7b4f06a9650a83c221a9c16b69fdaf107ea025c4
SHA1 (patch-ab) = 164aa9d8fbaf19b16aec17ce99cd632ee1986c8b
SHA1 (patch-ac) = f7dc2284fd997a0cc75644d0a19a4747eb138b53
SHA1 (patch-ad) = 187ba247c14324419383624b3dec054a098f0055
SHA1 (patch-ae) = 6164ee9bfaf748f241e5b1c763a0ffa681d45dc9
SHA1 (patch-af) = 57d5d0d88dcd745517b24bd4bdc9ceef494ef3a6
SHA1 (patch-ag) = c56b1704416427a2ef733ca0cbf2436ff22b4b09
SHA1 (patch-ah) = d7ab5fd7f7f834b254a068514ae473c35a43fef4
SHA1 (patch-ai) = 81e9fd2537c1cf1c73be9790f2f6dcf6445d09c3
SHA1 (patch-aj) = 5509d63f7856bc4760244a3d25c1984d16473e96
SHA1 (patch-ak) = 44e5305375e41277e902980f7fd398fb1fcbeba8
SHA1 (patch-al) = 1e40eb69839753348e023bc31f01331b6d4f51ef
SHA1 (patch-am) = 0aed65d5a82c99b79630c3955359829857289337
SHA1 (patch-an) = b769e61777a9f83b8a9c4479e3d70964755ff3d8
SHA1 (patch-ao) = 4cd94997797c56653d4b80dd2fb11d175ee5d700
SHA1 (patch-ap) = f65e0b73f26ff9a82be2c8c2c80c4f654e9ada18
+549
View File
@@ -0,0 +1,549 @@
$NetBSD: patch-aa,v 1.6 2009/08/29 19:26:01 wiz Exp $
--- QW/client/cd_linux.c.orig 1999-12-21 18:58:58.000000000 +0000
+++ QW/client/cd_linux.c
@@ -31,7 +31,23 @@ Foundation, Inc., 59 Temple Place - Suit
#include <time.h>
#include <errno.h>
+#ifdef __linux__
#include <linux/cdrom.h>
+#endif
+
+#if defined(__DragonFly__)
+#include <sys/cdio.h>
+#endif
+
+#if defined(__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 +62,296 @@ static byte remap[100];
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 __DragonFly__
+static char cd_dev[64] = "/dev/cd0d";
+#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 defined(__DragonFly__) || defined(__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");
+#elif defined(__DragonFly__)
+ ioctl(cdfile, CDIOCALLOW);
+ if ( ioctl(cdfile, CDIOCEJECT) == -1 )
+ Con_DPrintf("ioctl cdromeject failed\n");
+#elif defined(__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
+#if defined(__DragonFly__) || defined(__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
+#if defined(__DragonFly__) || defined(__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;
- }
+#if defined(__DragonFly__) || defined(__NetBSD__)
+if ( ioctl(cdfile, CDIOREADTOCHEADER, &tochdr) == -1 )
+{
+ Con_DPrintf("ioctl cdromreadtochdr failed\n");
+ return -1;
+}
+#endif
+
+#ifdef __linux__
+if (tochdr.cdth_trk0 < 1)
+ {
+ Con_DPrintf("CDAudio: no music tracks\n");
+ return -1;
+ }
+#endif
+#if defined(__DragonFly__) || defined(__NetBSD__)
+if (tochdr.starting_track < 1)
+ {
+ Con_DPrintf("CDAudio: no music tracks\n");
+ return -1;
+ }
+#endif
- cdValid = true;
- maxTrack = tochdr.cdth_trk1;
+cdValid = true;
+#ifdef __linux__
+maxTrack = tochdr.cdth_trk1;
+#endif
+#if defined(__DragonFly__) || defined(__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;
+#if defined(__DragonFly__) || defined(__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
- 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");
+#endif
+
+#if defined(__DragonFly__) || defined(__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;
}
- 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
+#if defined(__DragonFly__) || defined(__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;
- wasPlaying = playing;
- playing = false;
+#ifndef PAUSE_BY_STOPPING
+#ifdef __linux__
+ if ( ioctl(cdfile, CDROMPAUSE) == -1 )
+ Con_DPrintf("ioctl cdrompause failed\n");
+#endif
+
+#if defined(__DragonFly__) || defined(__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
+
+#if defined(__DragonFly__) || defined(__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 +474,72 @@ static void CD_f (void)
void CDAudio_Update(void)
{
- struct cdrom_subchnl subchnl;
- static time_t lastchk;
+#ifdef __linux__
+ struct cdrom_subchnl subchnl;
+#endif
+#if defined(__DragonFly__) || defined(__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
+#if defined(__DragonFly__) || defined(__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)
@@ -375,6 +551,8 @@ int CDAudio_Init(void)
return -1;
#endif
+ fprintf(stderr,"...... cdaudio_init .......\n");
+
if (COM_CheckParm("-nocdaudio"))
return -1;
@@ -384,9 +562,9 @@ int CDAudio_Init(void)
}
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++)
+13
View File
@@ -0,0 +1,13 @@
$NetBSD: patch-ab,v 1.5 2009/08/29 19:26:01 wiz Exp $
--- QW/client/gl_draw.c.orig 1999-12-21 15:46:06.000000000 +0000
+++ QW/client/gl_draw.c
@@ -1367,7 +1367,7 @@ void GL_SelectTexture (GLenum target)
{
if (!gl_mtexable)
return;
-#ifndef __linux__ // no multitexture under Linux yet
+#if !defined(__linux__) && !defined(__NetBSD__) && !defined(__DragonFly__) // no multitexture under Linux yet
qglSelectTextureSGIS(target);
#endif
if (target == oldtarget)
+43
View File
@@ -0,0 +1,43 @@
$NetBSD: patch-ac,v 1.5 2009/08/29 19:26:01 wiz Exp $
--- QW/client/gl_vidlinuxglx.c.orig 1999-12-21 18:45:54.000000000 +0000
+++ QW/client/gl_vidlinuxglx.c
@@ -20,7 +20,6 @@ Foundation, Inc., 59 Temple Place - Suit
#include <termios.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
-#include <sys/vt.h>
#include <stdarg.h>
#include <stdio.h>
#include <signal.h>
@@ -560,6 +559,9 @@ extern void gl3DfxSetPaletteEXT(GLuint *
void VID_Init8bitPalette(void)
{
+#if defined(__NetBSD__) || defined(__DragonFly__)
+ return;
+#else
// Check for 8bit Extensions and initialize them.
int i;
GLubyte table[256][4];
@@ -580,6 +582,7 @@ void VID_Init8bitPalette(void)
}
gl3DfxSetPaletteEXT((GLuint *)table);
is8bit = true;
+#endif
}
#endif
@@ -603,7 +606,12 @@ void VID_Init(unsigned char *palette)
Window root;
XVisualInfo *visinfo;
+ /* For some reason this is called. It causes trouble for NetBSD
+ and sound won't work */
+
+#if !defined(__NetBSD__) && !defined(__DragonFly__)
S_Init();
+#endif
Cvar_RegisterVariable (&vid_mode);
Cvar_RegisterVariable (&gl_ztrick);
+176
View File
@@ -0,0 +1,176 @@
$NetBSD: patch-ad,v 1.5 2009/08/29 19:26:01 wiz Exp $
--- QW/client/snd_linux.c.orig 1997-07-07 20:08:00.000000000 +0000
+++ QW/client/snd_linux.c
@@ -6,15 +6,42 @@
#include <sys/mman.h>
#include <sys/shm.h>
#include <sys/wait.h>
+
+#ifdef __NetBSD__
+#include <soundcard.h>
+#endif
+
+#if defined(__DragonFly__)
+#include <sys/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__
+const char *audio_device="/dev/dsp";
+#define MMAP_PROTECTION PROT_WRITE
+#endif
+
+#ifdef __NetBSD__
+const char *audio_device="/dev/audio";
+#define MMAP_PROTECTION PROT_WRITE|PROT_READ
+#endif
+
+#if defined(__DragonFly__)
+const char *audio_device="/dev/audio";
+#define MMAP_PROTECTION PROT_WRITE|PROT_READ
+#endif
+
qboolean SNDDMA_Init(void)
{
@@ -28,28 +55,29 @@ qboolean SNDDMA_Init(void)
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 +139,11 @@ qboolean SNDDMA_Init(void)
// 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 +154,8 @@ qboolean SNDDMA_Init(void)
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 +167,8 @@ qboolean SNDDMA_Init(void)
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 +179,7 @@ qboolean SNDDMA_Init(void)
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 +191,7 @@ qboolean SNDDMA_Init(void)
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 +199,7 @@ qboolean SNDDMA_Init(void)
}
else
{
- perror("/dev/dsp");
+ perror(audio_device);
Con_Printf("%d-bit sound not supported.", shm->samplebits);
close(audio_fd);
return 0;
@@ -183,7 +211,7 @@ qboolean SNDDMA_Init(void)
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 +220,7 @@ qboolean SNDDMA_Init(void)
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 +242,7 @@ int SNDDMA_GetDMAPos(void)
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;
+115
View File
@@ -0,0 +1,115 @@
$NetBSD: patch-ae,v 1.10 2011/09/14 19:19:37 marino Exp $
--- QW/Makefile.Linux.orig 1999-04-21 18:16:24.000000000 +0000
+++ QW/Makefile.Linux
@@ -27,41 +27,57 @@ ARCH=i386
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
+#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 \
- -fomit-frame-pointer -fexpensive-optimizations -malign-loops=2 \
- -malign-jumps=2 -malign-functions=2
+# 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) \
+ -mtune=i486 \
+ -ffast-math \
+ -funroll-loops \
+ -fomit-frame-pointer \
+ -fexpensive-optimizations \
+ -falign-loops=2 \
+ -falign-jumps=2 \
+ -falign-functions=2
endif
-GLCFLAGS=-DGLQUAKE -I/usr/local/src/Mesa-3.0/include -I/usr/include/glide
+GLCFLAGS=-DGLQUAKE -I${MESA_DIR}/include -I/usr/include/glide
-LDFLAGS=-lm
+LDFLAGS+=-lm
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
+XLDFLAGS=-L${X11BASE}/lib ${LDFLAGS} -lX11 -lXext
+GL_SVGA_LDFLAGS=-L${X11BASE}/lib ${LDFLAGS} -L${MESA_DIR}/lib -lm -lMesaGL -lglide2x -lX11 -lXext -lvga
+GL_X11_LDFLAGS=-L${X11BASE}/lib ${LDFLAGS} -L${MESA_DIR}/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 +87,7 @@ ifeq ($(ARCH),axp)
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 +501,7 @@ $(BUILDDIR)/client/wad.o : $(
$(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 +625,7 @@ GLQWCL_OBJS = \
$(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 +731,7 @@ $(BUILDDIR)/glclient/wad.o : $
$(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
+13
View File
@@ -0,0 +1,13 @@
$NetBSD: patch-af,v 1.4 2009/08/29 19:26:01 wiz Exp $
--- QW/server/sys_unix.c.orig 1999-12-21 18:45:14.000000000 +0000
+++ QW/server/sys_unix.c
@@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suit
#include <libc.h>
#endif
-#if defined(__linux__) || defined(sun)
+#if defined(__linux__) || defined(sun) || defined(__NetBSD__) || defined(__DragonFly__)
#include <sys/stat.h>
#include <unistd.h>
#include <sys/time.h>
+547
View File
@@ -0,0 +1,547 @@
$NetBSD: patch-ag,v 1.4 2009/08/29 19:26:01 wiz Exp $
--- WinQuake/cd_linux.c.orig 1999-12-21 18:40:50.000000000 +0000
+++ WinQuake/cd_linux.c
@@ -31,7 +31,23 @@ Foundation, Inc., 59 Temple Place - Suit
#include <time.h>
#include <errno.h>
+#ifdef __linux__
#include <linux/cdrom.h>
+#endif
+
+#if defined(__DragonFly__)
+#include <sys/cdio.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 +62,296 @@ static byte remap[100];
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
+
+#ifdef __DragonFly__
+static char cd_dev[64] = "/dev/cd0d";
+#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");
+#if defined(__NetBSD__) || defined(__DragonFly__)
+ 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");
+#elif defined(__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");
+#elif defined(__DragonFly__)
+ ioctl(cdfile, CDIOCALLOW);
+ if ( ioctl(cdfile, CDIOCEJECT) == -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
+#if defined(__NetBSD__) || defined(__DragonFly__)
+ if(ioctl(cdfile, CDIOCCLOSE, NULL) == -1) {
+ Con_DPrintf("ioctl cdromclosetray failed\n");
+ }
+#endif
}
static int CDAudio_GetAudioDiskInfo(void)
{
- struct cdrom_tochdr tochdr;
-
- cdValid = false;
+#ifdef __linux__
+struct cdrom_tochdr tochdr;
+#endif
+#if defined(__NetBSD__) || defined(__DragonFly__)
+struct ioc_toc_header tochdr;
+#endif
+
+cdValid = false;
+
+#ifdef __linux
+if ( ioctl(cdfile, CDROMREADTOCHDR, &tochdr) == -1 )
+{
+ Con_DPrintf("ioctl cdromreadtochdr failed\n");
+ return -1;
+}
+#endif
+
+#if defined(__NetBSD__) || defined(__DragonFly__)
+if ( ioctl(cdfile, CDIOREADTOCHEADER, &tochdr) == -1 )
+{
+ Con_DPrintf("ioctl cdromreadtochdr failed\n");
+ return -1;
+}
+#endif
+
+#ifdef __linux__
+if (tochdr.cdth_trk0 < 1)
+ {
+ Con_DPrintf("CDAudio: no music tracks\n");
+ return -1;
+ }
+#endif
+#if defined(__NetBSD__) || defined(__DragonFly__)
+if (tochdr.starting_track < 1)
+ {
+ Con_DPrintf("CDAudio: no music tracks\n");
+ return -1;
+ }
+#endif
+
+cdValid = true;
+#ifdef __linux__
+maxTrack = tochdr.cdth_trk1;
+#endif
+#if defined(__NetBSD__) || defined(__DragonFly__)
+maxTrack = tochdr.ending_track;
+#endif
- if ( ioctl(cdfile, CDROMREADTOCHDR, &tochdr) == -1 )
- {
- Con_DPrintf("ioctl cdromreadtochdr failed\n");
- return -1;
- }
-
- if (tochdr.cdth_trk0 < 1)
- {
- Con_DPrintf("CDAudio: no music tracks\n");
- return -1;
- }
-
- cdValid = true;
- maxTrack = tochdr.cdth_trk1;
-
- 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 defined(__NetBSD__) || defined(__DragonFly__)
+ 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
+
+#if defined(__NetBSD__) || defined(__DragonFly__)
+ 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
+#if defined(__NetBSD__) || defined(__DragonFly__)
+ 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;
-
- if ( ioctl(cdfile, CDROMPAUSE) == -1 )
- Con_DPrintf("ioctl cdrompause failed\n");
+#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
+
+#if defined(__NetBSD__) || defined(__DragonFly__)
+ 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;
+ 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
+
+#if defined(__NetBSD__) || defined(__DragonFly__)
+ 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 +474,72 @@ static void CD_f (void)
void CDAudio_Update(void)
{
- struct cdrom_subchnl subchnl;
- static time_t lastchk;
+#ifdef __linux__
+ struct cdrom_subchnl subchnl;
+#endif
+#if defined(__NetBSD__) || defined(__DragonFly__)
+ 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
+#if defined(__NetBSD__) || defined(__DragonFly__)
+ 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 +558,9 @@ int CDAudio_Init(void)
}
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++)
+14
View File
@@ -0,0 +1,14 @@
$NetBSD: patch-ah,v 1.3 2009/08/29 19:26:01 wiz Exp $
--- WinQuake/gl_vidlinuxglx.c Tue Dec 21 18:39:36 1999
+++ 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>
+84
View File
@@ -0,0 +1,84 @@
$NetBSD: patch-ai,v 1.10 2011/09/14 19:19:37 marino Exp $
--- WinQuake/Makefile.linuxi386.orig 1999-04-27 15:51:18.000000000 +0000
+++ WinQuake/Makefile.linuxi386
@@ -25,29 +25,31 @@ ARCH=i386
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
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
-RELEASE_CFLAGS=$(BASE_CFLAGS) -g -mpentiumpro -O6 -ffast-math -funroll-loops \
+BASE_CFLAGS=-Dstricmp=strcasecmp -I${X11BASE}/include ${CFLAGS}
+RELEASE_CFLAGS=$(BASE_CFLAGS) -g -mtune=pentiumpro -O6 -ffast-math -funroll-loops \
-fomit-frame-pointer -fexpensive-optimizations
DEBUG_CFLAGS=$(BASE_CFLAGS) -g
-LDFLAGS=-lm
+LDFLAGS+=-lm
SVGALDFLAGS=-lvga
-XLDFLAGS=-L/usr/X11R6/lib -lX11 -lXext -lXxf86dga
-XCFLAGS=-DX11
+XLDFLAGS=-L/usr/X11R6/lib ${LDFLAGS} -lX11 -lXext -lXxf86dga
+XCFLAGS=-DX11 -I${X11BASE}/include ${CFLAGS}
-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 ${LDFLAGS} -L${MESA_DIR}/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 +59,28 @@ DO_GL_DEBUG_CC=$(CC) $(DEBUG_CFLAGS) $(G
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 \
+#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
- # $(BUILDDIR)/bin/unixded
+
+#TARGETS=$(BUILDDIR)/bin/quake.x11
build_debug:
@-mkdir $(BUILD_DEBUG_DIR) \
+176
View File
@@ -0,0 +1,176 @@
$NetBSD: patch-aj,v 1.4 2009/08/29 19:26:01 wiz Exp $
--- WinQuake/snd_linux.c.orig 1999-12-21 18:40:36.000000000 +0000
+++ WinQuake/snd_linux.c
@@ -25,15 +25,42 @@ Foundation, Inc., 59 Temple Place - Suit
#include <sys/mman.h>
#include <sys/shm.h>
#include <sys/wait.h>
+
+#ifdef __NetBSD__
+#include <soundcard.h>
+#endif
+
+#if defined(__DragonFly__)
+#include <sys/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__
+const char *audio_device="/dev/dsp";
+#define MMAP_PROTECTION PROT_WRITE
+#endif
+
+#ifdef __NetBSD__
+const char *audio_device="/dev/audio";
+#define MMAP_PROTECTION PROT_WRITE|PROT_READ
+#endif
+
+#if defined(__DragonFly__)
+const char *audio_device="/dev/dsp";
+#define MMAP_PROTECTION PROT_WRITE|PROT_READ
+#endif
+
qboolean SNDDMA_Init(void)
{
@@ -47,28 +74,29 @@ qboolean SNDDMA_Init(void)
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 +158,11 @@ qboolean SNDDMA_Init(void)
// 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 +173,8 @@ qboolean SNDDMA_Init(void)
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 +186,8 @@ qboolean SNDDMA_Init(void)
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 +198,7 @@ qboolean SNDDMA_Init(void)
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 +210,7 @@ qboolean SNDDMA_Init(void)
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 +218,7 @@ qboolean SNDDMA_Init(void)
}
else
{
- perror("/dev/dsp");
+ perror(audio_device);
Con_Printf("%d-bit sound not supported.", shm->samplebits);
close(audio_fd);
return 0;
@@ -202,7 +230,7 @@ qboolean SNDDMA_Init(void)
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 +239,7 @@ qboolean SNDDMA_Init(void)
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 +261,7 @@ int SNDDMA_GetDMAPos(void)
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;
+14
View File
@@ -0,0 +1,14 @@
$NetBSD: patch-ak,v 1.3 2009/08/29 19:26:01 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);
}
+13
View File
@@ -0,0 +1,13 @@
$NetBSD: patch-al,v 1.4 2009/08/29 19:26:01 wiz Exp $
--- QW/server/asm_i386.h.orig Tue Feb 8 11:39:20 2000
+++ QW/server/asm_i386.h Tue Feb 8 11:39:37 2000
@@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suit
#ifndef __ASM_I386__
#define __ASM_I386__
-#ifdef ELF
+#if defined(ELF) || defined(__ELF__)
#define C(label) label
#else
#define C(label) _##label
+13
View File
@@ -0,0 +1,13 @@
$NetBSD: patch-am,v 1.4 2009/08/29 19:26:01 wiz Exp $
--- QW/client/asm_i386.h.orig Tue Feb 8 11:39:49 2000
+++ QW/client/asm_i386.h Tue Feb 8 11:40:03 2000
@@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suit
#ifndef __ASM_I386__
#define __ASM_I386__
-#ifdef ELF
+#if defined(ELF) || defined(__ELF__)
#define C(label) label
#else
#define C(label) _##label
+13
View File
@@ -0,0 +1,13 @@
$NetBSD: patch-an,v 1.4 2009/08/29 19:26:01 wiz Exp $
--- WinQuake/asm_i386.h.orig Tue Feb 8 11:40:46 2000
+++ WinQuake/asm_i386.h Tue Feb 8 11:40:59 2000
@@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suit
#ifndef __ASM_I386__
#define __ASM_I386__
-#ifdef ELF
+#if defined(ELF) || defined(__ELF__)
#define C(label) label
#else
#define C(label) _##label
+27
View File
@@ -0,0 +1,27 @@
$NetBSD: patch-ao,v 1.3 2009/08/29 19:26:01 wiz Exp $
--- QW/client/glquake.h.orig Tue Dec 21 15:49:06 1999
+++ QW/client/glquake.h
@@ -35,15 +35,15 @@
// Function prototypes for the Texture Object Extension routines
-typedef GLboolean (APIENTRY *ARETEXRESFUNCPTR)(GLsizei, const GLuint *,
+typedef GLboolean (GLAPIENTRY *ARETEXRESFUNCPTR)(GLsizei, const GLuint *,
const GLboolean *);
-typedef void (APIENTRY *BINDTEXFUNCPTR)(GLenum, GLuint);
-typedef void (APIENTRY *DELTEXFUNCPTR)(GLsizei, const GLuint *);
-typedef void (APIENTRY *GENTEXFUNCPTR)(GLsizei, GLuint *);
-typedef GLboolean (APIENTRY *ISTEXFUNCPTR)(GLuint);
-typedef void (APIENTRY *PRIORTEXFUNCPTR)(GLsizei, const GLuint *,
+typedef void (GLAPIENTRY *BINDTEXFUNCPTR)(GLenum, GLuint);
+typedef void (GLAPIENTRY *DELTEXFUNCPTR)(GLsizei, const GLuint *);
+typedef void (GLAPIENTRY *GENTEXFUNCPTR)(GLsizei, GLuint *);
+typedef GLboolean (GLAPIENTRY *ISTEXFUNCPTR)(GLuint);
+typedef void (GLAPIENTRY *PRIORTEXFUNCPTR)(GLsizei, const GLuint *,
const GLclampf *);
-typedef void (APIENTRY *TEXSUBIMAGEPTR)(int, int, int, int, int, int, int, int, void *);
+typedef void (GLAPIENTRY *TEXSUBIMAGEPTR)(int, int, int, int, int, int, int, int, void *);
extern BINDTEXFUNCPTR bindTexFunc;
extern DELTEXFUNCPTR delTexFunc;
+13
View File
@@ -0,0 +1,13 @@
$NetBSD: patch-ap,v 1.4 2009/08/29 19:26:01 wiz Exp $
--- WinQuake/net.h.orig 1999-12-21 15:54:20.000000000 +0000
+++ WinQuake/net.h
@@ -238,7 +238,7 @@ typedef struct
extern int hostCacheCount;
extern hostcache_t hostcache[HOSTCACHESIZE];
-#if !defined(_WIN32 ) && !defined (__linux__) && !defined (__sun__)
+#if !defined(_WIN32 ) && !defined (__linux__) && !defined (__sun__) && !defined (__NetBSD__) && defined(__DragonFly__)
#ifndef htonl
extern unsigned long htonl (unsigned long hostlong);
#endif