pkgsrc/games/xdoom/patches/patch-ah
abs fa022bb0af Update to 1.10nb1
Actually work with the supplied WAD file
        One file-to-patch per patchfile
        Remove strange 'post-patch' substitute X11_BASE phase
        Fix numerous coredumps
        Add a '-h' usage
        Handle the sndserver dying
        Make it work on little endian systems
        Add a '-volume X' flag, and skip all sound code if 0
        Other cleanup in some of the more repellant code areas.
2000-02-03 16:01:14 +00:00

59 lines
1.6 KiB
Text

$NetBSD: patch-ah,v 1.2 2000/02/03 16:01:15 abs Exp $
--- linuxdoom-1.10/i_sound.c.orig Mon Dec 22 19:57:15 1997
+++ linuxdoom-1.10/i_sound.c Thu Feb 3 02:56:08 2000
@@ -41,8 +41,11 @@
#include <unistd.h>
#include <sys/ioctl.h>
+#ifdef LINUX
// Linux voxware output.
#include <linux/soundcard.h>
+#endif
+
// Timer stuff. Experimental.
#include <time.h>
@@ -482,8 +485,12 @@
#ifdef SNDSERV
if (sndserver)
{
- fprintf(sndserver, "p%2.2x%2.2x%2.2x%2.2x\n", id, pitch, vol, sep);
- fflush(sndserver);
+ if (fprintf(sndserver, "p%2.2x%2.2x%2.2x%2.2x\n", id, pitch, vol, sep)
+ <= 0 || fflush(sndserver) )
+ {
+ fprintf(stderr, "Unable to write to sndserver - closing\n");
+ sndserver = 0;
+ }
}
// warning: control reaches end of non-void function.
return id;
@@ -745,13 +752,25 @@
getenv("DOOMWADDIR"),
sndserver_filename);
else
- sprintf(buffer, "%s", sndserver_filename);
+#ifdef INSTALL_PREFIX
+ {
+ sprintf(buffer, INSTALL_PREFIX"/bin/%s", sndserver_filename);
+ /* sndserver won't find its wadfile if DOMMWADDIR isn't set - HF */
+ if(!getenv("DOOMWADDIR"))
+ setenv("DOOMWADDIR", INSTALL_PREFIX"/share/doom", 1);
+ }
+#else
+ strcpy(buffer, sndserver_filename);
+#endif
+
// start sound process
- if ( !access(buffer, X_OK) )
+ if (!access(buffer, X_OK) )
{
strcat(buffer, " -quiet");
sndserver = popen(buffer, "w");
+ /* Don't die with SIGPIPE if the sndserver has problems */
+ signal(SIGPIPE, (void (*)(int)) SIG_IGN);
}
else
fprintf(stderr, "Could not start sound server [%s]\n", buffer);