diff options
Diffstat (limited to 'games/quake2forge/files/patch-aa')
-rw-r--r-- | games/quake2forge/files/patch-aa | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/games/quake2forge/files/patch-aa b/games/quake2forge/files/patch-aa new file mode 100644 index 000000000000..bac7f8e2ced4 --- /dev/null +++ b/games/quake2forge/files/patch-aa @@ -0,0 +1,69 @@ +--- src/snd.c.orig Fri Oct 18 16:08:56 2002 ++++ src/snd.c Tue Oct 15 17:56:17 2002 +@@ -211,12 +211,7 @@ + sndbits = Cvar_Get("sndbits", "16", CVAR_ARCHIVE); + sndspeed = Cvar_Get("sndspeed", "0", CVAR_ARCHIVE); + sndchannels = Cvar_Get("sndchannels", "2", CVAR_ARCHIVE); +-/* merged in from snd_bsd.c -- jaq */ +-#ifdef __linux__ + snddevice = Cvar_Get("snddevice", "/dev/dsp", CVAR_ARCHIVE); +-#else /* bsd */ +- snddevice = Cvar_Get("snddevice", "/dev/audio", CVAR_ARCHIVE); +-#endif + } + + // open /dev/dsp, check capability to mmap, and get size of dma buffer +@@ -321,24 +316,6 @@ + if (dma.channels < 1 || dma.channels > 2) + dma.channels = 2; + +- if (mmapped) { +- dma.samples = info.fragstotal * info.fragsize / (dma.samplebits/8); +- dma.submission_chunk = 1; +- +- // memory map the dma buffer +- +- if (!dma.buffer) +- dma.buffer = (unsigned char *) mmap(NULL, info.fragstotal +- * info.fragsize, PROT_WRITE, MAP_FILE|MAP_SHARED, audio_fd, 0); +- if (!dma.buffer || dma.buffer == MAP_FAILED) { +- perror(snddevice->string); +- Com_Printf("SNDDMA_Init: Could not mmap %s.\n", snddevice->string); +- close(audio_fd); +- audio_fd = -1; +- return 0; +- } +- } +- + tmp = 0; + if (dma.channels == 2) + tmp = 1; +@@ -432,6 +409,28 @@ + } else { + tmp = 0; + rc = ioctl(audio_fd, SNDCTL_DSP_SETTRIGGER, &tmp); ++ dma.samples = info.fragstotal * info.fragsize / (dma.samplebits/8); ++ dma.submission_chunk = 1; ++ ++ // memory map the dma buffer ++ ++ if (!dma.buffer) { ++ dma.buffer = (unsigned char *) mmap(NULL, info.fragstotal * info.fragsize, ++#if (defined(__FreeBSD__) && (__FreeBSD_version < 500000)) ++ PROT_READ|PROT_WRITE, ++#else ++ PROT_WRITE, ++#endif ++ MAP_FILE|MAP_SHARED, audio_fd, 0); ++ } ++ if (!dma.buffer || dma.buffer == MAP_FAILED) { ++ perror(snddevice->string); ++ Com_Printf("SNDDMA_Init: Could not mmap %s.\n", snddevice->string); ++ close(audio_fd); ++ audio_fd = -1; ++ return 0; ++ } ++ + if (rc < 0) { + perror(snddevice->string); + Com_Printf("SNDDMA_Init: Could not toggle. (1)\n"); |