From 2470cc9bbb8ad72ea723cf6a553e3a0578c7fc3e Mon Sep 17 00:00:00 2001 From: joerg Date: Fri, 12 May 2006 12:40:10 +0000 Subject: Add DragonFly support. --- games/quake/patches/patch-aa | 99 ++++++++++++++++++++++++-------------------- games/quake/patches/patch-ab | 10 ++--- games/quake/patches/patch-ac | 18 ++++---- games/quake/patches/patch-ad | 41 +++++++++++------- games/quake/patches/patch-af | 10 ++--- games/quake/patches/patch-ag | 99 +++++++++++++++++++++++++------------------- games/quake/patches/patch-aj | 41 +++++++++++------- games/quake/patches/patch-ap | 8 ++-- 8 files changed, 185 insertions(+), 141 deletions(-) (limited to 'games/quake/patches') diff --git a/games/quake/patches/patch-aa b/games/quake/patches/patch-aa index 3f45d69d996..38d788b6df8 100644 --- a/games/quake/patches/patch-aa +++ b/games/quake/patches/patch-aa @@ -1,8 +1,8 @@ -$NetBSD: patch-aa,v 1.4 2002/01/02 10:01:35 hubertf Exp $ +$NetBSD: patch-aa,v 1.5 2006/05/12 12:40:10 joerg Exp $ ---- qw/client/cd_linux.c.orig Tue Dec 21 18:58:58 1999 +--- qw/client/cd_linux.c.orig 1999-12-21 18:58:58.000000000 +0000 +++ qw/client/cd_linux.c -@@ -31,7 +31,19 @@ +@@ -31,7 +31,23 @@ Foundation, Inc., 59 Temple Place - Suit #include #include @@ -10,7 +10,11 @@ $NetBSD: patch-aa,v 1.4 2002/01/02 10:01:35 hubertf Exp $ #include +#endif + -+#ifdef __NetBSD__ ++#if defined(__DragonFly__) ++#include ++#endif ++ ++#if defined(__NetBSD__) +#include + +/* resume seems to have some trouble right now. xcdplayer also can not resume @@ -22,7 +26,7 @@ $NetBSD: patch-aa,v 1.4 2002/01/02 10:01:35 hubertf Exp $ #include "quakedef.h" -@@ -46,165 +58,289 @@ +@@ -46,165 +62,296 @@ static byte remap[100]; static byte playTrack; static byte maxTrack; @@ -36,6 +40,10 @@ $NetBSD: patch-aa,v 1.4 2002/01/02 10:01:35 hubertf Exp $ 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 @@ -44,7 +52,7 @@ $NetBSD: patch-aa,v 1.4 2002/01/02 10:01:35 hubertf Exp $ { - if (cdfile == -1 || !enabled) - return; // no cd init'd -+#ifdef __NetBSD__ ++#if defined(__DragonFly__) || defined(__NetBSD__) + int arg=0; +#endif @@ -56,8 +64,11 @@ $NetBSD: patch-aa,v 1.4 2002/01/02 10:01:35 hubertf Exp $ +#ifdef __linux__ + if ( ioctl(cdfile, CDROMEJECT) == -1 ) + Con_DPrintf("ioctl cdromeject failed\n"); -+#endif -+#ifdef __NetBSD__ ++#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; @@ -80,7 +91,7 @@ $NetBSD: patch-aa,v 1.4 2002/01/02 10:01:35 hubertf Exp $ + if ( ioctl(cdfile, CDROMCLOSETRAY) == -1 ) + Con_DPrintf("ioctl cdromclosetray failed\n"); +#endif -+#ifdef __NetBSD__ ++#if defined(__DragonFly__) || defined(__NetBSD__) + if(ioctl(cdfile, CDIOCCLOSE, NULL) == -1) { + Con_DPrintf("ioctl cdromclosetray failed\n"); + } @@ -93,7 +104,7 @@ $NetBSD: patch-aa,v 1.4 2002/01/02 10:01:35 hubertf Exp $ +#ifdef __linux__ +struct cdrom_tochdr tochdr; +#endif -+#ifdef __NetBSD__ ++#if defined(__DragonFly__) || defined(__NetBSD__) +struct ioc_toc_header tochdr; +#endif @@ -118,16 +129,14 @@ $NetBSD: patch-aa,v 1.4 2002/01/02 10:01:35 hubertf Exp $ - Con_DPrintf("CDAudio: no music tracks\n"); - return -1; - } -+#ifdef __NetBSD__ ++#if defined(__DragonFly__) || defined(__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) + { @@ -135,19 +144,21 @@ $NetBSD: patch-aa,v 1.4 2002/01/02 10:01:35 hubertf Exp $ + return -1; + } +#endif -+#ifdef __NetBSD__ ++#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 -+#ifdef __NetBSD__ ++#if defined(__DragonFly__) || defined(__NetBSD__) +maxTrack = tochdr.ending_track; +#endif @@ -167,7 +178,7 @@ $NetBSD: patch-aa,v 1.4 2002/01/02 10:01:35 hubertf Exp $ - if (cdfile == -1 || !enabled) - return; -+#ifdef __NetBSD__ ++#if defined(__DragonFly__) || defined(__NetBSD__) + struct ioc_read_toc_entry entry; + struct ioc_play_track ti; + int arg=1; @@ -238,43 +249,43 @@ $NetBSD: patch-aa,v 1.4 2002/01/02 10:01:35 hubertf Exp $ - 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; + } - -- 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__ ++ ++#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; ++ { + Con_DPrintf("ioctl cdromplaytrkind failed\n"); + return; } @@ -317,7 +328,7 @@ $NetBSD: patch-aa,v 1.4 2002/01/02 10:01:35 hubertf Exp $ + if ( ioctl(cdfile, CDROMSTOP) == -1 ) + Con_DPrintf("ioctl cdromstop failed (%d)\n", errno); +#endif -+#ifdef __NetBSD__ ++#if defined(__DragonFly__) || defined(__NetBSD__) + if ( ioctl(cdfile, CDIOCSTOP) == -1 ) + Con_DPrintf("ioctl cdromstop failed (%d)\n", errno); +#endif @@ -345,16 +356,16 @@ $NetBSD: patch-aa,v 1.4 2002/01/02 10:01:35 hubertf Exp $ - 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 - -- wasPlaying = playing; -- playing = false; -+#ifdef __NetBSD__ ++ ++#if defined(__DragonFly__) || defined(__NetBSD__) + if ( ioctl(cdfile, CDIOCPAUSE) == -1 ) + Con_DPrintf("ioctl cdrompause failed\n"); +#endif @@ -397,7 +408,7 @@ $NetBSD: patch-aa,v 1.4 2002/01/02 10:01:35 hubertf Exp $ + Con_DPrintf("ioctl cdromresume failed\n"); +#endif + -+#ifdef __NetBSD__ ++#if defined(__DragonFly__) || defined(__NetBSD__) + if ( ioctl(cdfile, CDIOCRESUME) == -1 ) + Con_DPrintf("ioctl cdromresume failed\n"); +#endif @@ -409,7 +420,7 @@ $NetBSD: patch-aa,v 1.4 2002/01/02 10:01:35 hubertf Exp $ } static void CD_f (void) -@@ -327,43 +463,72 @@ +@@ -327,43 +474,72 @@ static void CD_f (void) void CDAudio_Update(void) { @@ -418,7 +429,7 @@ $NetBSD: patch-aa,v 1.4 2002/01/02 10:01:35 hubertf Exp $ +#ifdef __linux__ + struct cdrom_subchnl subchnl; +#endif -+#ifdef __NetBSD__ ++#if defined(__DragonFly__) || defined(__NetBSD__) + struct ioc_read_subchannel subchnl; + struct cd_sub_channel_info data; +#endif @@ -490,7 +501,7 @@ $NetBSD: patch-aa,v 1.4 2002/01/02 10:01:35 hubertf Exp $ + CDAudio_Play(playTrack, true); + } +#endif -+#ifdef __NetBSD__ ++#if defined(__DragonFly__) || defined(__NetBSD__) + subchnl.address_format = CD_MSF_FORMAT; + subchnl.data_format = CD_CURRENT_POSITION; + subchnl.data_len = sizeof(data); @@ -514,7 +525,7 @@ $NetBSD: patch-aa,v 1.4 2002/01/02 10:01:35 hubertf Exp $ } int CDAudio_Init(void) -@@ -375,6 +540,8 @@ +@@ -375,6 +551,8 @@ int CDAudio_Init(void) return -1; #endif @@ -523,7 +534,7 @@ $NetBSD: patch-aa,v 1.4 2002/01/02 10:01:35 hubertf Exp $ if (COM_CheckParm("-nocdaudio")) return -1; -@@ -384,9 +551,9 @@ +@@ -384,9 +562,9 @@ int CDAudio_Init(void) } if ((cdfile = open(cd_dev, O_RDONLY)) == -1) { diff --git a/games/quake/patches/patch-ab b/games/quake/patches/patch-ab index 73426865de2..03cbe237b14 100644 --- a/games/quake/patches/patch-ab +++ b/games/quake/patches/patch-ab @@ -1,13 +1,13 @@ -$NetBSD: patch-ab,v 1.3 2002/01/02 10:01:35 hubertf Exp $ +$NetBSD: patch-ab,v 1.4 2006/05/12 12:40:10 joerg Exp $ ---- 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 @@ +--- 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__) // no multitexture under Linux yet ++#if !defined(__linux__) && !defined(__NetBSD__) && !defined(__DragonFly__) // no multitexture under Linux yet qglSelectTextureSGIS(target); #endif if (target == oldtarget) diff --git a/games/quake/patches/patch-ac b/games/quake/patches/patch-ac index ccc98c6cb80..8a905b7fde8 100644 --- a/games/quake/patches/patch-ac +++ b/games/quake/patches/patch-ac @@ -1,8 +1,8 @@ -$NetBSD: patch-ac,v 1.3 2002/01/02 10:01:35 hubertf Exp $ +$NetBSD: patch-ac,v 1.4 2006/05/12 12:40:10 joerg Exp $ ---- 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 @@ +--- 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 #include #include @@ -10,17 +10,17 @@ $NetBSD: patch-ac,v 1.3 2002/01/02 10:01:35 hubertf Exp $ #include #include #include -@@ -560,6 +559,9 @@ +@@ -560,6 +559,9 @@ extern void gl3DfxSetPaletteEXT(GLuint * void VID_Init8bitPalette(void) { -+#ifdef __NetBSD__ ++#if defined(__NetBSD__) || defined(__DragonFly__) + return; +#else // Check for 8bit Extensions and initialize them. int i; GLubyte table[256][4]; -@@ -580,6 +582,7 @@ +@@ -580,6 +582,7 @@ void VID_Init8bitPalette(void) } gl3DfxSetPaletteEXT((GLuint *)table); is8bit = true; @@ -28,14 +28,14 @@ $NetBSD: patch-ac,v 1.3 2002/01/02 10:01:35 hubertf Exp $ } #endif -@@ -603,7 +606,12 @@ +@@ -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 */ + -+#ifndef __NetBSD__ ++#if !defined(__NetBSD__) && !defined(__DragonFly__) S_Init(); +#endif diff --git a/games/quake/patches/patch-ad b/games/quake/patches/patch-ad index cdaf54964c9..12cfb9274e7 100644 --- a/games/quake/patches/patch-ad +++ b/games/quake/patches/patch-ad @@ -1,8 +1,8 @@ -$NetBSD: patch-ad,v 1.3 2002/01/02 10:01:35 hubertf Exp $ +$NetBSD: patch-ad,v 1.4 2006/05/12 12:40:10 joerg Exp $ ---- 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 @@ +--- qw/client/snd_linux.c.orig 1997-07-07 20:08:00.000000000 +0000 ++++ qw/client/snd_linux.c +@@ -6,15 +6,42 @@ #include #include #include @@ -11,6 +11,10 @@ $NetBSD: patch-ad,v 1.3 2002/01/02 10:01:35 hubertf Exp $ +#include +#endif + ++#if defined(__DragonFly__) ++#include ++#endif ++ +#ifdef __linux__ #include +#endif @@ -25,19 +29,24 @@ $NetBSD: patch-ad,v 1.3 2002/01/02 10:01:35 hubertf Exp $ static int tryrates[] = { 11025, 22051, 44100, 8000 }; +#ifdef __linux__ -+char *audio_device="/dev/dsp"; ++const char *audio_device="/dev/dsp"; +#define MMAP_PROTECTION PROT_WRITE +#endif + +#ifdef __NetBSD__ -+char *audio_device="/dev/audio"; ++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 +46,29 @@ +@@ -28,28 +55,29 @@ qboolean SNDDMA_Init(void) snd_inited = 0; @@ -74,7 +83,7 @@ $NetBSD: patch-ad,v 1.3 2002/01/02 10:01:35 hubertf Exp $ Con_Printf("Sound driver too old\n"); close(audio_fd); return 0; -@@ -111,11 +130,11 @@ +@@ -111,11 +139,11 @@ qboolean SNDDMA_Init(void) // memory map the dma buffer shm->buffer = (unsigned char *) mmap(NULL, info.fragstotal @@ -89,7 +98,7 @@ $NetBSD: patch-ad,v 1.3 2002/01/02 10:01:35 hubertf Exp $ close(audio_fd); return 0; } -@@ -126,8 +145,8 @@ +@@ -126,8 +154,8 @@ qboolean SNDDMA_Init(void) rc = ioctl(audio_fd, SNDCTL_DSP_STEREO, &tmp); if (rc < 0) { @@ -100,7 +109,7 @@ $NetBSD: patch-ad,v 1.3 2002/01/02 10:01:35 hubertf Exp $ close(audio_fd); return 0; } -@@ -139,8 +158,8 @@ +@@ -139,8 +167,8 @@ qboolean SNDDMA_Init(void) rc = ioctl(audio_fd, SNDCTL_DSP_SPEED, &shm->speed); if (rc < 0) { @@ -111,7 +120,7 @@ $NetBSD: patch-ad,v 1.3 2002/01/02 10:01:35 hubertf Exp $ close(audio_fd); return 0; } -@@ -151,7 +170,7 @@ +@@ -151,7 +179,7 @@ qboolean SNDDMA_Init(void) rc = ioctl(audio_fd, SNDCTL_DSP_SETFMT, &rc); if (rc < 0) { @@ -120,7 +129,7 @@ $NetBSD: patch-ad,v 1.3 2002/01/02 10:01:35 hubertf Exp $ Con_Printf("Could not support 16-bit data. Try 8-bit.\n"); close(audio_fd); return 0; -@@ -163,7 +182,7 @@ +@@ -163,7 +191,7 @@ qboolean SNDDMA_Init(void) rc = ioctl(audio_fd, SNDCTL_DSP_SETFMT, &rc); if (rc < 0) { @@ -129,7 +138,7 @@ $NetBSD: patch-ad,v 1.3 2002/01/02 10:01:35 hubertf Exp $ Con_Printf("Could not support 8-bit data.\n"); close(audio_fd); return 0; -@@ -171,7 +190,7 @@ +@@ -171,7 +199,7 @@ qboolean SNDDMA_Init(void) } else { @@ -138,7 +147,7 @@ $NetBSD: patch-ad,v 1.3 2002/01/02 10:01:35 hubertf Exp $ Con_Printf("%d-bit sound not supported.", shm->samplebits); close(audio_fd); return 0; -@@ -183,7 +202,7 @@ +@@ -183,7 +211,7 @@ qboolean SNDDMA_Init(void) rc = ioctl(audio_fd, SNDCTL_DSP_SETTRIGGER, &tmp); if (rc < 0) { @@ -147,7 +156,7 @@ $NetBSD: patch-ad,v 1.3 2002/01/02 10:01:35 hubertf Exp $ Con_Printf("Could not toggle.\n"); close(audio_fd); return 0; -@@ -192,7 +211,7 @@ +@@ -192,7 +220,7 @@ qboolean SNDDMA_Init(void) rc = ioctl(audio_fd, SNDCTL_DSP_SETTRIGGER, &tmp); if (rc < 0) { @@ -156,7 +165,7 @@ $NetBSD: patch-ad,v 1.3 2002/01/02 10:01:35 hubertf Exp $ Con_Printf("Could not toggle.\n"); close(audio_fd); return 0; -@@ -214,7 +233,7 @@ +@@ -214,7 +242,7 @@ int SNDDMA_GetDMAPos(void) if (ioctl(audio_fd, SNDCTL_DSP_GETOPTR, &count)==-1) { diff --git a/games/quake/patches/patch-af b/games/quake/patches/patch-af index 43ec65ef98a..6b56c2c7c60 100644 --- a/games/quake/patches/patch-af +++ b/games/quake/patches/patch-af @@ -1,13 +1,13 @@ -$NetBSD: patch-af,v 1.2 2002/01/02 10:01:35 hubertf Exp $ +$NetBSD: patch-af,v 1.3 2006/05/12 12:40:10 joerg 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 @@ +--- 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 #endif -#if defined(__linux__) || defined(sun) -+#if defined(__linux__) || defined(sun) || defined(__NetBSD__) ++#if defined(__linux__) || defined(sun) || defined(__NetBSD__) || defined(__DragonFly__) #include #include #include diff --git a/games/quake/patches/patch-ag b/games/quake/patches/patch-ag index cb23a329102..8ff19330d84 100644 --- a/games/quake/patches/patch-ag +++ b/games/quake/patches/patch-ag @@ -1,8 +1,8 @@ -$NetBSD: patch-ag,v 1.2 2002/01/02 10:01:35 hubertf Exp $ +$NetBSD: patch-ag,v 1.3 2006/05/12 12:40:10 joerg 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 @@ +--- 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 #include @@ -10,6 +10,10 @@ $NetBSD: patch-ag,v 1.2 2002/01/02 10:01:35 hubertf Exp $ #include +#endif + ++#if defined(__DragonFly__) ++#include ++#endif ++ +#ifdef __NetBSD__ +#include + @@ -22,7 +26,7 @@ $NetBSD: patch-ag,v 1.2 2002/01/02 10:01:35 hubertf Exp $ #include "quakedef.h" -@@ -46,165 +58,289 @@ +@@ -46,165 +62,296 @@ static byte remap[100]; static byte playTrack; static byte maxTrack; @@ -38,6 +42,10 @@ $NetBSD: patch-ag,v 1.2 2002/01/02 10:01:35 hubertf Exp $ + +#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) @@ -47,7 +55,7 @@ $NetBSD: patch-ag,v 1.2 2002/01/02 10:01:35 hubertf Exp $ - - if ( ioctl(cdfile, CDROMEJECT) == -1 ) - Con_DPrintf("ioctl cdromeject failed\n"); -+#ifdef __NetBSD__ ++#if defined(__NetBSD__) || defined(__DragonFly__) + int arg=0; +#endif + @@ -57,13 +65,16 @@ $NetBSD: patch-ag,v 1.2 2002/01/02 10:01:35 hubertf Exp $ +#ifdef __linux__ + if ( ioctl(cdfile, CDROMEJECT) == -1 ) + Con_DPrintf("ioctl cdromeject failed\n"); -+#endif -+#ifdef __NetBSD__ ++#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 } @@ -81,7 +92,7 @@ $NetBSD: patch-ag,v 1.2 2002/01/02 10:01:35 hubertf Exp $ + if ( ioctl(cdfile, CDROMCLOSETRAY) == -1 ) + Con_DPrintf("ioctl cdromclosetray failed\n"); +#endif -+#ifdef __NetBSD__ ++#if defined(__NetBSD__) || defined(__DragonFly__) + if(ioctl(cdfile, CDIOCCLOSE, NULL) == -1) { + Con_DPrintf("ioctl cdromclosetray failed\n"); + } @@ -91,21 +102,17 @@ $NetBSD: patch-ag,v 1.2 2002/01/02 10:01:35 hubertf Exp $ static int CDAudio_GetAudioDiskInfo(void) { - struct cdrom_tochdr tochdr; +- +- cdValid = false; +#ifdef __linux__ +struct cdrom_tochdr tochdr; +#endif -+#ifdef __NetBSD__ ++#if defined(__NetBSD__) || defined(__DragonFly__) +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 ) +{ @@ -113,22 +120,15 @@ $NetBSD: patch-ag,v 1.2 2002/01/02 10:01:35 hubertf Exp $ + return -1; +} +#endif - -- if (tochdr.cdth_trk0 < 1) -- { -- Con_DPrintf("CDAudio: no music tracks\n"); -- return -1; -- } -+#ifdef __NetBSD__ ++ ++#if defined(__NetBSD__) || defined(__DragonFly__) +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) + { @@ -136,7 +136,7 @@ $NetBSD: patch-ag,v 1.2 2002/01/02 10:01:35 hubertf Exp $ + return -1; + } +#endif -+#ifdef __NetBSD__ ++#if defined(__NetBSD__) || defined(__DragonFly__) +if (tochdr.starting_track < 1) + { + Con_DPrintf("CDAudio: no music tracks\n"); @@ -148,10 +148,25 @@ $NetBSD: patch-ag,v 1.2 2002/01/02 10:01:35 hubertf Exp $ +#ifdef __linux__ +maxTrack = tochdr.cdth_trk1; +#endif -+#ifdef __NetBSD__ ++#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; } @@ -166,7 +181,7 @@ $NetBSD: patch-ag,v 1.2 2002/01/02 10:01:35 hubertf Exp $ + struct cdrom_ti ti; +#endif + -+#ifdef __NetBSD__ ++#if defined(__NetBSD__) || defined(__DragonFly__) + struct ioc_read_toc_entry entry; + struct ioc_play_track ti; + int arg=1; @@ -271,7 +286,7 @@ $NetBSD: patch-ag,v 1.2 2002/01/02 10:01:35 hubertf Exp $ + Con_DPrintf("ioctl cdromresume failed\n"); +#endif + -+#ifdef __NetBSD__ ++#if defined(__NetBSD__) || defined(__DragonFly__) + ti.start_track = track; + ti.end_track = track; + ti.start_index = 1; @@ -318,7 +333,7 @@ $NetBSD: patch-ag,v 1.2 2002/01/02 10:01:35 hubertf Exp $ + if ( ioctl(cdfile, CDROMSTOP) == -1 ) + Con_DPrintf("ioctl cdromstop failed (%d)\n", errno); +#endif -+#ifdef __NetBSD__ ++#if defined(__NetBSD__) || defined(__DragonFly__) + if ( ioctl(cdfile, CDIOCSTOP) == -1 ) + Con_DPrintf("ioctl cdromstop failed (%d)\n", errno); +#endif @@ -336,6 +351,9 @@ $NetBSD: patch-ag,v 1.2 2002/01/02 10:01:35 hubertf Exp $ - - if (!playing) - return; +- +- if ( ioctl(cdfile, CDROMPAUSE) == -1 ) +- Con_DPrintf("ioctl cdrompause failed\n"); +#ifdef PAUSE_BY_STOPPING + qboolean t; +#endif @@ -352,7 +370,7 @@ $NetBSD: patch-ag,v 1.2 2002/01/02 10:01:35 hubertf Exp $ + Con_DPrintf("ioctl cdrompause failed\n"); +#endif + -+#ifdef __NetBSD__ ++#if defined(__NetBSD__) || defined(__DragonFly__) + if ( ioctl(cdfile, CDIOCPAUSE) == -1 ) + Con_DPrintf("ioctl cdrompause failed\n"); +#endif @@ -364,9 +382,6 @@ $NetBSD: patch-ag,v 1.2 2002/01/02 10:01:35 hubertf Exp $ + playing=t; +#endif -- if ( ioctl(cdfile, CDROMPAUSE) == -1 ) -- Con_DPrintf("ioctl cdrompause failed\n"); -- - wasPlaying = playing; - playing = false; + wasPlaying = playing; @@ -400,7 +415,7 @@ $NetBSD: patch-ag,v 1.2 2002/01/02 10:01:35 hubertf Exp $ + Con_DPrintf("ioctl cdromresume failed\n"); +#endif + -+#ifdef __NetBSD__ ++#if defined(__NetBSD__) || defined(__DragonFly__) + if ( ioctl(cdfile, CDIOCRESUME) == -1 ) + Con_DPrintf("ioctl cdromresume failed\n"); +#endif @@ -412,7 +427,7 @@ $NetBSD: patch-ag,v 1.2 2002/01/02 10:01:35 hubertf Exp $ } static void CD_f (void) -@@ -327,43 +463,72 @@ +@@ -327,43 +474,72 @@ static void CD_f (void) void CDAudio_Update(void) { @@ -421,7 +436,7 @@ $NetBSD: patch-ag,v 1.2 2002/01/02 10:01:35 hubertf Exp $ +#ifdef __linux__ + struct cdrom_subchnl subchnl; +#endif -+#ifdef __NetBSD__ ++#if defined(__NetBSD__) || defined(__DragonFly__) + struct ioc_read_subchannel subchnl; + struct cd_sub_channel_info data; +#endif @@ -493,7 +508,7 @@ $NetBSD: patch-ag,v 1.2 2002/01/02 10:01:35 hubertf Exp $ + CDAudio_Play(playTrack, true); + } +#endif -+#ifdef __NetBSD__ ++#if defined(__NetBSD__) || defined(__DragonFly__) + subchnl.address_format = CD_MSF_FORMAT; + subchnl.data_format = CD_CURRENT_POSITION; + subchnl.data_len = sizeof(data); @@ -517,7 +532,7 @@ $NetBSD: patch-ag,v 1.2 2002/01/02 10:01:35 hubertf Exp $ } int CDAudio_Init(void) -@@ -382,9 +547,9 @@ +@@ -382,9 +558,9 @@ int CDAudio_Init(void) } if ((cdfile = open(cd_dev, O_RDONLY)) == -1) { diff --git a/games/quake/patches/patch-aj b/games/quake/patches/patch-aj index 50be61af72e..28d92b4e732 100644 --- a/games/quake/patches/patch-aj +++ b/games/quake/patches/patch-aj @@ -1,8 +1,8 @@ -$NetBSD: patch-aj,v 1.2 2002/01/02 10:01:36 hubertf Exp $ +$NetBSD: patch-aj,v 1.3 2006/05/12 12:40:10 joerg 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 @@ +--- 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 #include #include @@ -11,6 +11,10 @@ $NetBSD: patch-aj,v 1.2 2002/01/02 10:01:36 hubertf Exp $ +#include +#endif + ++#if defined(__DragonFly__) ++#include ++#endif ++ +#ifdef __linux__ #include +#endif @@ -25,19 +29,24 @@ $NetBSD: patch-aj,v 1.2 2002/01/02 10:01:36 hubertf Exp $ static int tryrates[] = { 11025, 22051, 44100, 8000 }; +#ifdef __linux__ -+char *audio_device="/dev/dsp"; ++const char *audio_device="/dev/dsp"; +#define MMAP_PROTECTION PROT_WRITE +#endif + +#ifdef __NetBSD__ -+char *audio_device="/dev/audio"; ++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 +46,29 @@ +@@ -47,28 +74,29 @@ qboolean SNDDMA_Init(void) snd_inited = 0; @@ -74,7 +83,7 @@ $NetBSD: patch-aj,v 1.2 2002/01/02 10:01:36 hubertf Exp $ Con_Printf("Sound driver too old\n"); close(audio_fd); return 0; -@@ -130,11 +130,11 @@ +@@ -130,11 +158,11 @@ qboolean SNDDMA_Init(void) // memory map the dma buffer shm->buffer = (unsigned char *) mmap(NULL, info.fragstotal @@ -89,7 +98,7 @@ $NetBSD: patch-aj,v 1.2 2002/01/02 10:01:36 hubertf Exp $ close(audio_fd); return 0; } -@@ -145,8 +145,8 @@ +@@ -145,8 +173,8 @@ qboolean SNDDMA_Init(void) rc = ioctl(audio_fd, SNDCTL_DSP_STEREO, &tmp); if (rc < 0) { @@ -100,7 +109,7 @@ $NetBSD: patch-aj,v 1.2 2002/01/02 10:01:36 hubertf Exp $ close(audio_fd); return 0; } -@@ -158,8 +158,8 @@ +@@ -158,8 +186,8 @@ qboolean SNDDMA_Init(void) rc = ioctl(audio_fd, SNDCTL_DSP_SPEED, &shm->speed); if (rc < 0) { @@ -111,7 +120,7 @@ $NetBSD: patch-aj,v 1.2 2002/01/02 10:01:36 hubertf Exp $ close(audio_fd); return 0; } -@@ -170,7 +170,7 @@ +@@ -170,7 +198,7 @@ qboolean SNDDMA_Init(void) rc = ioctl(audio_fd, SNDCTL_DSP_SETFMT, &rc); if (rc < 0) { @@ -120,7 +129,7 @@ $NetBSD: patch-aj,v 1.2 2002/01/02 10:01:36 hubertf Exp $ Con_Printf("Could not support 16-bit data. Try 8-bit.\n"); close(audio_fd); return 0; -@@ -182,7 +182,7 @@ +@@ -182,7 +210,7 @@ qboolean SNDDMA_Init(void) rc = ioctl(audio_fd, SNDCTL_DSP_SETFMT, &rc); if (rc < 0) { @@ -129,7 +138,7 @@ $NetBSD: patch-aj,v 1.2 2002/01/02 10:01:36 hubertf Exp $ Con_Printf("Could not support 8-bit data.\n"); close(audio_fd); return 0; -@@ -190,7 +190,7 @@ +@@ -190,7 +218,7 @@ qboolean SNDDMA_Init(void) } else { @@ -138,7 +147,7 @@ $NetBSD: patch-aj,v 1.2 2002/01/02 10:01:36 hubertf Exp $ Con_Printf("%d-bit sound not supported.", shm->samplebits); close(audio_fd); return 0; -@@ -202,7 +202,7 @@ +@@ -202,7 +230,7 @@ qboolean SNDDMA_Init(void) rc = ioctl(audio_fd, SNDCTL_DSP_SETTRIGGER, &tmp); if (rc < 0) { @@ -147,7 +156,7 @@ $NetBSD: patch-aj,v 1.2 2002/01/02 10:01:36 hubertf Exp $ Con_Printf("Could not toggle.\n"); close(audio_fd); return 0; -@@ -211,7 +211,7 @@ +@@ -211,7 +239,7 @@ qboolean SNDDMA_Init(void) rc = ioctl(audio_fd, SNDCTL_DSP_SETTRIGGER, &tmp); if (rc < 0) { @@ -156,7 +165,7 @@ $NetBSD: patch-aj,v 1.2 2002/01/02 10:01:36 hubertf Exp $ Con_Printf("Could not toggle.\n"); close(audio_fd); return 0; -@@ -233,7 +233,7 @@ +@@ -233,7 +261,7 @@ int SNDDMA_GetDMAPos(void) if (ioctl(audio_fd, SNDCTL_DSP_GETOPTR, &count)==-1) { diff --git a/games/quake/patches/patch-ap b/games/quake/patches/patch-ap index a385251b842..c279a21b745 100644 --- a/games/quake/patches/patch-ap +++ b/games/quake/patches/patch-ap @@ -1,13 +1,13 @@ -$NetBSD: patch-ap,v 1.2 2002/01/02 10:01:36 hubertf Exp $ +$NetBSD: patch-ap,v 1.3 2006/05/12 12:40:10 joerg Exp $ ---- winquake/net.h.orig Tue Dec 21 15:54:20 1999 +--- winquake/net.h.orig 1999-12-21 15:54:20.000000000 +0000 +++ winquake/net.h -@@ -238,7 +238,7 @@ +@@ -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__) ++#if !defined(_WIN32 ) && !defined (__linux__) && !defined (__sun__) && !defined (__NetBSD__) && defined(__DragonFly__) #ifndef htonl extern unsigned long htonl (unsigned long hostlong); #endif -- cgit v1.2.3