diff options
author | kristerw <kristerw> | 2002-06-29 01:48:52 +0000 |
---|---|---|
committer | kristerw <kristerw> | 2002-06-29 01:48:52 +0000 |
commit | e7a74ca1eeac0d462a1e3ec4715e6f036e1fe3d0 (patch) | |
tree | bd18ff737637f97f9672cf1254dce9d32f52cd8c /games/frotz | |
parent | 12c71c7e4e2ef719db5de118a35fe3a99ad206bb (diff) | |
download | pkgsrc-e7a74ca1eeac0d462a1e3ec4715e6f036e1fe3d0.tar.gz |
Correct sound support. Patch provided by David Griffith.
Solves PR 14061.
Diffstat (limited to 'games/frotz')
-rw-r--r-- | games/frotz/Makefile | 3 | ||||
-rw-r--r-- | games/frotz/distinfo | 6 | ||||
-rw-r--r-- | games/frotz/patches/patch-aa | 43 | ||||
-rw-r--r-- | games/frotz/patches/patch-ac | 99 | ||||
-rw-r--r-- | games/frotz/patches/patch-ad | 11 |
5 files changed, 144 insertions, 18 deletions
diff --git a/games/frotz/Makefile b/games/frotz/Makefile index cc5e3760bc7..d1612eb7941 100644 --- a/games/frotz/Makefile +++ b/games/frotz/Makefile @@ -1,7 +1,8 @@ -# $NetBSD: Makefile,v 1.8 2002/03/25 18:23:36 wiz Exp $ +# $NetBSD: Makefile,v 1.9 2002/06/29 01:48:52 kristerw Exp $ # DISTNAME= frotz-2.42 +PKGREVISION= 1 CATEGORIES= games # The maintainer has asked us to use the mirrors instead of www.cs.csubak.edu. #MASTER_SITES= http://www.cs.csubak.edu/~dgriffi/frotz/files/ diff --git a/games/frotz/distinfo b/games/frotz/distinfo index c7044bbd7a4..d18467aac1d 100644 --- a/games/frotz/distinfo +++ b/games/frotz/distinfo @@ -1,6 +1,8 @@ -$NetBSD: distinfo,v 1.6 2002/03/25 18:23:36 wiz Exp $ +$NetBSD: distinfo,v 1.7 2002/06/29 01:48:52 kristerw Exp $ SHA1 (frotz-2.42.tar.gz) = c447456d46a1dff833b32db0489aa753fdd4c5f2 Size (frotz-2.42.tar.gz) = 135337 bytes -SHA1 (patch-aa) = 4c97269519ef0d0d1073ff815dfaabc699dcaea3 +SHA1 (patch-aa) = bf5e5237b87ff1932cf2bd4d42ccc5b160d09939 SHA1 (patch-ab) = 4d619656c71758661f93acbaf5b04add8779d6c6 +SHA1 (patch-ac) = e0ff2a4e9fe2b3db04d395ef6e565bfc1c1cd46d +SHA1 (patch-ad) = 0fe19e34ecb7f850098f00ed81118a1604ff4173 diff --git a/games/frotz/patches/patch-aa b/games/frotz/patches/patch-aa index 030a1c2ae14..2cf26a9a389 100644 --- a/games/frotz/patches/patch-aa +++ b/games/frotz/patches/patch-aa @@ -1,7 +1,6 @@ -$NetBSD: patch-aa,v 1.5 2002/03/25 18:23:37 wiz Exp $ - +$NetBSD: patch-aa,v 1.6 2002/06/29 01:48:53 kristerw Exp $ --- Makefile.orig Sun Mar 10 01:24:16 2002 -+++ Makefile ++++ Makefile Sat Jun 29 03:32:34 2002 @@ -1,7 +1,7 @@ # Define your C compiler. I recommend gcc if you have it. # MacOS users should use "cc" even though it's really "gcc". @@ -29,7 +28,7 @@ $NetBSD: patch-aa,v 1.5 2002/03/25 18:23:37 wiz Exp $ #CONFIG_DIR = /etc #CONFIG_DIR = /usr/pkg/etc #CONFIG_DIR = -@@ -36,16 +36,16 @@ +@@ -36,16 +36,23 @@ # Uncomment this if you have an OSS soundcard driver and want classical # Infocom sound support. Currently this works only for Linux. # @@ -40,6 +39,13 @@ $NetBSD: patch-aa,v 1.5 2002/03/25 18:23:37 wiz Exp $ # -#SOUND_LIB = -lossaudio +SOUND_LIB = -lossaudio ++ ++# Define your sound device ++# This should probably be a command-line/config-file option. ++# ++SOUND_DEV = /dev/sound ++#SOUND_DEV = /dev/dsp ++#SOUND_DEV = /dev/audio # This should point to the location of your curses.h or ncurses.h include # file if your compiler doesn't know about it. @@ -49,7 +55,7 @@ $NetBSD: patch-aa,v 1.5 2002/03/25 18:23:37 wiz Exp $ #INCL = -I/usr/pkg/include #INCL = -I/usr/freeware/include #INCL = -I/5usr/include -@@ -55,7 +55,7 @@ +@@ -55,7 +62,7 @@ # linking with. Usually, this isn't necessary if /etc/ld.so.conf is set # up correctly. # @@ -58,7 +64,23 @@ $NetBSD: patch-aa,v 1.5 2002/03/25 18:23:37 wiz Exp $ #LIB = -L/usr/pkg/lib #LIB = -L/usr/freeware/lib #LIB = -L/5usr/lib -@@ -109,11 +109,12 @@ +@@ -86,7 +93,7 @@ + # Nothing under this line should need to be changed. + ##################################################### + +-VERSION = 2.42 ++VERSION = 2.42nb1 + + BINNAME = frotz + +@@ -103,17 +110,18 @@ + ux_audio_none.o ux_audio_oss.o + + OPT_DEFS = -DCONFIG_DIR="\"$(CONFIG_DIR)\"" $(CURSES_DEF) \ +- -DVERSION="\"$(VERSION)\"" ++ -DVERSION="\"$(VERSION)\"" -DSOUND_DEV="\"$(SOUND_DEV)\"" + + COMP_DEFS = $(OPT_DEFS) $(COLOR_DEFS) $(SOUND_DEFS) $(SOUNDCARD) \ $(MEMMOVE_DEF) @@ -73,12 +95,3 @@ $NetBSD: patch-aa,v 1.5 2002/03/25 18:23:37 wiz Exp $ all: $(BINNAME) -@@ -161,7 +162,7 @@ - rm -f $(BINNAME)$(EXTENSION) - -rm -rf $(distdir) - -rm -f $(distdir).tar $(distdir).tar.gz -- -+ - realclean: distclean - - clobber: distclean diff --git a/games/frotz/patches/patch-ac b/games/frotz/patches/patch-ac new file mode 100644 index 00000000000..f7308fbe261 --- /dev/null +++ b/games/frotz/patches/patch-ac @@ -0,0 +1,99 @@ +$NetBSD: patch-ac,v 1.1 2002/06/29 01:48:53 kristerw Exp $ +--- ux_audio_oss.c.orig Wed Nov 22 07:31:17 2000 ++++ ux_audio_oss.c Sat Jun 29 03:25:37 2002 +@@ -86,12 +86,37 @@ + + static void play_sound(int volume, int repeats) { + struct sigaction sa; ++ int format = AFMT_U8; ++ int channels = 1; + +- dsp_fd = open("/dev/dsp", O_WRONLY); ++ dsp_fd = open(SOUND_DEV, O_WRONLY); + if (dsp_fd < 0) { +- perror("/dev/dsp"); ++ perror(SOUND_DEV); + _exit(1); + } ++ ++ /* This section of code fixes the nasty problem of samples ++ * being played with pops and scratches when used with a ++ * non-Linux system implementing OSS sound. ++ */ ++ if (ioctl(dsp_fd, SNDCTL_DSP_SETFMT, &format) == -1) { ++ perror(SOUND_DEV); ++ exit(1); ++ } ++ if (format != AFMT_U8) { ++ fprintf(stderr, "bad sound format\n"); ++ exit(1); ++ } ++ if (ioctl(dsp_fd, SNDCTL_DSP_CHANNELS, &channels) == -1) { ++ perror(SOUND_DEV); ++ exit(1); ++ } ++ if (channels != 1) { ++ fprintf(stderr, "bad channels\n"); ++ exit(1); ++ } ++ /* End sound fix from Torbjorn Andersson */ ++ + ioctl(dsp_fd, SNDCTL_DSP_SPEED, &sample_rate); + + if (volume != 255) { +@@ -177,6 +202,7 @@ + char *filename; + const char *basename, *dotpos; + int namelen; ++ int read_length; + + if (sound_buffer != NULL && current_num == number) + return; +@@ -211,27 +237,38 @@ + fgetc(samples); fgetc(samples); + sound_length = fgetc(samples) << 8; + sound_length |= fgetc(samples); ++ sound_buffer = NULL; + ++ if (sound_length > 0) { + sound_buffer = malloc(sound_length); +- if (! sound_buffer) { ++ if (!sound_buffer) { + perror("malloc"); + return; + } +- +- if (sound_length < 0 || +- fread(sound_buffer, 1, sound_length, samples) < sound_length) { +- if (feof(samples)) +- fprintf(stderr, "%s: premature EOF\n", filename); +- else { ++ read_length = fread(sound_buffer, 1, sound_length, samples); ++ if (read_length < sound_length) { ++ if (feof(samples)) { ++ /* ++ * One of the Sherlock samples trigger this for me, so let's make it ++ * a non-fatal error. ++ */ ++ sound_buffer = realloc(sound_buffer, read_length); ++ if (! sound_buffer) { ++ perror("realloc"); ++ return; ++ } ++ sound_length = read_length; ++ } else { + errno = ferror(samples); + perror(filename); +- } + free(sound_buffer); + sound_buffer = NULL; + } +- ++ } ++ } + current_num = number; + }/* os_prepare_sample */ ++ + + static void sigchld_handler(int signal) { + int status; diff --git a/games/frotz/patches/patch-ad b/games/frotz/patches/patch-ad new file mode 100644 index 00000000000..b4c4bbddd40 --- /dev/null +++ b/games/frotz/patches/patch-ad @@ -0,0 +1,11 @@ +$NetBSD: patch-ad,v 1.1 2002/06/29 01:48:53 kristerw Exp $ +--- ux_init.c.orig Wed Feb 20 05:26:21 2002 ++++ ux_init.c Sat Jun 29 03:25:37 2002 +@@ -51,6 +51,7 @@ + #define INFORMATION "\ + - An interpreter for all Infocom and other Z-Machine games.\n\ + Complies with standard 1.0 of Graham Nelson's specification.\n\ ++Special NetBSD version. Patched so that sound works with the OSS driver.\n\ + \n\ + Syntax: frotz [options] story-file\n\ + \n\ |