From 4317db54b772e4aaa2a64697f0cc4f309836ab33 Mon Sep 17 00:00:00 2001 From: branch-fixup Date: Fri, 12 May 2006 12:40:10 +0000 Subject: [PATCH] Add files from parent branch HEAD: games/quake/distinfo games/quake/patches/patch-aa games/quake/patches/patch-ab games/quake/patches/patch-ac games/quake/patches/patch-ad games/quake/patches/patch-af games/quake/patches/patch-ag games/quake/patches/patch-aj games/quake/patches/patch-ap --- games/quake/distinfo | 21 ++ games/quake/patches/patch-aa | 549 +++++++++++++++++++++++++++++++++++ games/quake/patches/patch-ab | 13 + games/quake/patches/patch-ac | 43 +++ games/quake/patches/patch-ad | 176 +++++++++++ games/quake/patches/patch-af | 13 + games/quake/patches/patch-ag | 547 ++++++++++++++++++++++++++++++++++ games/quake/patches/patch-aj | 176 +++++++++++ games/quake/patches/patch-ap | 13 + 9 files changed, 1551 insertions(+) create mode 100644 games/quake/distinfo create mode 100644 games/quake/patches/patch-aa create mode 100644 games/quake/patches/patch-ab create mode 100644 games/quake/patches/patch-ac create mode 100644 games/quake/patches/patch-ad create mode 100644 games/quake/patches/patch-af create mode 100644 games/quake/patches/patch-ag create mode 100644 games/quake/patches/patch-aj create mode 100644 games/quake/patches/patch-ap diff --git a/games/quake/distinfo b/games/quake/distinfo new file mode 100644 index 000000000000..2af34a87e1fe --- /dev/null +++ b/games/quake/distinfo @@ -0,0 +1,21 @@ +$NetBSD: distinfo,v 1.7 2005/02/23 23:12:01 agc Exp $ + +SHA1 (q1source.zip) = 1f607e549c6aa3921797e51b7d2038e95116c989 +RMD160 (q1source.zip) = 57a750e8644116d0d07a273ea6ad0b6d3071c89f +Size (q1source.zip) = 3211531 bytes +SHA1 (patch-aa) = 23f2d2382a0b8e93a2403f8cec271fdb6577eb05 +SHA1 (patch-ab) = ea94d3a9ced047574e23b6f2904b178aac6e1a4d +SHA1 (patch-ac) = b10042114b1ad06e3abc9147c49e6adceae9d671 +SHA1 (patch-ad) = 28bf099b84e49c720ab5f6ff7b00f7543919dbcc +SHA1 (patch-ae) = 6c3863309d22a5295c48635a7841338b041d2817 +SHA1 (patch-af) = cf6f5aa9dd997023c608120bb0514eb7f422809c +SHA1 (patch-ag) = 002ad95816768ce517b13733f5ccdd56634b7d3c +SHA1 (patch-ah) = 23501badb57bf8d11bf75105c1dffb7adf19a64d +SHA1 (patch-ai) = 345747c3dd7ad8442a65c4589e0b89ec9d0f7038 +SHA1 (patch-aj) = 55bc1ee38782c21d039df323ef2f79b14358dbc3 +SHA1 (patch-ak) = b7b22a7b01a86522f3dfd510bf31a44c468279b9 +SHA1 (patch-al) = ca76927f36ad4f5f14ec64600bb4d40f0a758b71 +SHA1 (patch-am) = c64a9a46681ad48c4ea2fcca07d33b071f49f6d5 +SHA1 (patch-an) = 03e71dd225ab6ff371b33e51acee46b84a9e0d82 +SHA1 (patch-ao) = 43d50ff9845731bff3171be474129f184a427551 +SHA1 (patch-ap) = b4089b0ac1924136e7d50b71a0c5af5be8ce6f75 diff --git a/games/quake/patches/patch-aa b/games/quake/patches/patch-aa new file mode 100644 index 000000000000..c85485c07177 --- /dev/null +++ b/games/quake/patches/patch-aa @@ -0,0 +1,549 @@ +$NetBSD$ + +--- 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 + #include + ++#ifdef __linux__ + #include ++#endif ++ ++#if defined(__DragonFly__) ++#include ++#endif ++ ++#if defined(__NetBSD__) ++#include ++ ++/* 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++) diff --git a/games/quake/patches/patch-ab b/games/quake/patches/patch-ab new file mode 100644 index 000000000000..b93c5fe1e948 --- /dev/null +++ b/games/quake/patches/patch-ab @@ -0,0 +1,13 @@ +$NetBSD$ + +--- 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) diff --git a/games/quake/patches/patch-ac b/games/quake/patches/patch-ac new file mode 100644 index 000000000000..940b3c7111c1 --- /dev/null +++ b/games/quake/patches/patch-ac @@ -0,0 +1,43 @@ +$NetBSD$ + +--- 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 +-#include + #include + #include + #include +@@ -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); diff --git a/games/quake/patches/patch-ad b/games/quake/patches/patch-ad new file mode 100644 index 000000000000..49d5bc8dddd0 --- /dev/null +++ b/games/quake/patches/patch-ad @@ -0,0 +1,176 @@ +$NetBSD$ + +--- 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 ++ ++#ifdef __NetBSD__ ++#include ++#endif ++ ++#if defined(__DragonFly__) ++#include ++#endif ++ ++#ifdef __linux__ + #include ++#endif ++ + #include + #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; diff --git a/games/quake/patches/patch-af b/games/quake/patches/patch-af new file mode 100644 index 000000000000..6380a11cf464 --- /dev/null +++ b/games/quake/patches/patch-af @@ -0,0 +1,13 @@ +$NetBSD$ + +--- 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__) || defined(__DragonFly__) + #include + #include + #include diff --git a/games/quake/patches/patch-ag b/games/quake/patches/patch-ag new file mode 100644 index 000000000000..97ec9aa53fdb --- /dev/null +++ b/games/quake/patches/patch-ag @@ -0,0 +1,547 @@ +$NetBSD$ + +--- 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 + ++#ifdef __linux__ + #include ++#endif ++ ++#if defined(__DragonFly__) ++#include ++#endif ++ ++#ifdef __NetBSD__ ++#include ++ ++/* 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++) diff --git a/games/quake/patches/patch-aj b/games/quake/patches/patch-aj new file mode 100644 index 000000000000..13cb525e86de --- /dev/null +++ b/games/quake/patches/patch-aj @@ -0,0 +1,176 @@ +$NetBSD$ + +--- 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 ++ ++#ifdef __NetBSD__ ++#include ++#endif ++ ++#if defined(__DragonFly__) ++#include ++#endif ++ ++#ifdef __linux__ + #include ++#endif ++ + #include + #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; diff --git a/games/quake/patches/patch-ap b/games/quake/patches/patch-ap new file mode 100644 index 000000000000..248140d2fb25 --- /dev/null +++ b/games/quake/patches/patch-ap @@ -0,0 +1,13 @@ +$NetBSD$ + +--- 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 -- 2.41.0