From owner-freebsd-bugs Sat Jan 27 18:10:28 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 0453B37B404 for ; Sat, 27 Jan 2001 18:10:01 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f0S2A0722630; Sat, 27 Jan 2001 18:10:00 -0800 (PST) (envelope-from gnats) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 830DB37B402 for ; Sat, 27 Jan 2001 18:07:20 -0800 (PST) Received: (from nobody@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f0S27KR22431; Sat, 27 Jan 2001 18:07:20 -0800 (PST) (envelope-from nobody) Message-Id: <200101280207.f0S27KR22431@freefall.freebsd.org> Date: Sat, 27 Jan 2001 18:07:20 -0800 (PST) From: cyberwin@mail.ru To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-1.0 Subject: misc/24687: QUAKE FORGE & SVGALIB Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 24687 >Category: misc >Synopsis: QUAKE FORGE & SVGALIB >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Jan 27 18:10:00 PST 2001 >Closed-Date: >Last-Modified: >Originator: Kovirshin Alexey >Release: 4.1-R >Organization: >Environment: FreeBSD orb.ru 4.1-RELEASE FreeBSD 4.1-RELEASE #2: Thu Jan 18 22:36:37 MSK 2001 root@orb.ru:/usr/src/sys/compile/PENTIUM i386 >Description: Some patches for qf-0.1.1 and qf-0.2.99beta6 >How-To-Repeat: >Fix: Note: QuakeForge works with svgalibs, but mouse must be gpm and dev/sysmouse in /usr/local/etc/vga/libvga.conf here patch for qf-0.1.1 -----patch-aa-- --- common/snd_oss.c.orig Wed Jan 19 13:01:04 2000 +++ common/snd_oss.c Thu Mar 30 17:41:06 2000 @@ -22,6 +22,7 @@ #include "quakedef.h" #include +#ifndef SDL #include #ifdef HAVE_UNISTD_H #include @@ -50,9 +51,30 @@ static int snd_inited; static int tryrates[] = { 11025, 22051, 44100, 8000 }; +#else /* SDL */ +#include "SDL_audio.h" +#include "SDL_byteorder.h" + +static dma_t the_shm; +static int snd_inited; + +extern int desired_speed; +extern int desired_bits; + +static void paint_audio(void *unused, Uint8 *stream, int len) +{ + if ( shm ) { + shm->buffer = stream; + shm->samplepos += len/(shm->samplebits/8); + // Check for samplepos overflow? + S_PaintChannels (shm->samplepos); + } +} +#endif /*SDL */ qboolean SNDDMA_Init(void) { +#ifndef SDL int rc; int fmt; @@ -147,7 +169,7 @@ // 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, PROT_READ | PROT_WRITE, MAP_FILE|MAP_SHARED, audio_fd, 0); if (shm->buffer == MAP_FAILED) { @@ -240,11 +262,87 @@ snd_inited = 1; return 1; +#else /* SDL */ + + SDL_AudioSpec desired, obtained; + + snd_inited = 0; + + /* Set up the desired format */ + desired.freq = desired_speed; + switch (desired_bits) { + case 8: + desired.format = AUDIO_U8; + break; + case 16: + if ( SDL_BYTEORDER == SDL_BIG_ENDIAN ) + desired.format = AUDIO_S16MSB; + else + desired.format = AUDIO_S16LSB; + break; + default: + Con_Printf("Unknown number of audio bits: %d\n", + desired_bits); + return 0; + } + desired.channels = 2; + desired.samples = 512; + desired.callback = paint_audio; + + /* Open the audio device */ + if ( SDL_OpenAudio(&desired, &obtained) < 0 ) { + Con_Printf("Couldn't open SDL audio: %s\n", SDL_GetError()); + return 0; + } + + /* Make sure we can support the audio format */ + switch (obtained.format) { + case AUDIO_U8: + /* Supported */ + break; + case AUDIO_S16LSB: + case AUDIO_S16MSB: + if ( ((obtained.format == AUDIO_S16LSB) && + (SDL_BYTEORDER == SDL_LIL_ENDIAN)) || + ((obtained.format == AUDIO_S16MSB) && + (SDL_BYTEORDER == SDL_BIG_ENDIAN)) ) { + /* Supported */ + break; + } + /* Unsupported, fall through */; + default: + /* Not supported -- force SDL to do our bidding */ + SDL_CloseAudio(); + if ( SDL_OpenAudio(&desired, NULL) < 0 ) { + Con_Printf("Couldn't open SDL audio: %s\n", + SDL_GetError()); + return 0; + } + memcpy(&obtained, &desired, sizeof(desired)); + break; + } + SDL_PauseAudio(0); + + /* Fill the audio DMA information block */ + shm = &the_shm; + shm->splitbuffer = 0; + shm->samplebits = (obtained.format & 0xFF); + shm->speed = obtained.freq; + shm->channels = obtained.channels; + shm->samples = obtained.samples*shm->channels; + shm->samplepos = 0; + shm->submission_chunk = 1; + shm->buffer = NULL; + + snd_inited = 1; + return 1; +#endif /* SDL */ } int SNDDMA_GetDMAPos(void) { +#ifndef SDL struct count_info count; if (!snd_inited) return 0; @@ -260,6 +358,7 @@ // shm->samplepos = (count.bytes / (shm->samplebits / 8)) & (shm->samples-1); // fprintf(stderr, "%d \r", count.ptr); shm->samplepos = count.ptr / (shm->samplebits / 8); +#endif /* SDL */ return shm->samplepos; @@ -267,11 +366,17 @@ void SNDDMA_Shutdown(void) { + if (snd_inited) { +#ifndef SDL close(audio_fd); +#else /* SDL */ + SDL_CloseAudio(); +#endif snd_inited = 0; } + } /* ----patch-ab--- --- configure.in.orig Sun Feb 27 14:26:03 2000 +++ configure.in Wed Dec 20 00:44:43 2000 @@ -185,7 +185,7 @@ HAS_SVGA=$withval, HAS_SVGA=auto) if test "x$HAS_SVGA" != xno; then if test "x$HAS_SVGA" != xauto; then - SVGA_CFLAGS="$SVGA_CFLAGS= -I$withval/include" + SVGA_CFLAGS="$SVGA_CFLAGS -I$withval/include" SVGA_LIBS="$SVGA_LIBS -L$withval/lib" dnl The default system location is /usr/include or /usr/local/include dnl and we (obviously) do not need to set CFLAGS for that @@ -335,7 +335,7 @@ dnl Make sure -lpthread works (for SDL) if test "x$HAS_SDL" = xyes; then AC_CHECK_LIB(pthread, pthread_exit ,SDL_LIBS="$SDL_LIBS -lpthread" - HAS_SDL=yes, HAS_SDL=no, [$SDL_LIBS]) + HAS_SDL=yes, HAS_SDL=yes, [$SDL_LIBS]) fi if test "x$HAS_SDL" != xyes; then SDL_CFLAGS="" SDL_LIBS="" ---patch-ac---- --- uquake/Makefile.in.orig Wed Jan 19 04:24:41 2000 +++ uquake/Makefile.in Wed Dec 20 00:40:46 2000 @@ -282,10 +282,13 @@ $(COMMON_DIR)/@X11_VID_SRC@ $(CC) $(CFLAGS) $(X11_CFLAGS) -o $@ -c $< +$(BUILD_DIR)/soft/snd_oss.@OBJEXT@: $(COMMON_DIR)/snd_oss.c + $(CC) $(CFLAGS) $(SDL_CFLAGS) -o $@ -c $< + $(X11QUAKE): soft_DIR $(BUILD_DIR)/../$(X11QUAKE) $(BUILD_DIR)/../$(X11QUAKE): $(ALL_X11_OBJS) - $(CC) $(CFLAGS) $(ALL_X11_OBJS) $(X11_LDFLAGS) $(LDFLAGS) $(LIBS) \ + $(CC) $(CFLAGS) $(ALL_X11_OBJS) $(X11_LDFLAGS) $(SDL_LDFLAGS) $(LDFLAGS) $(LIBS) \ -o $(BUILD_DIR)/../$(X11QUAKE) endif @@ -305,6 +308,9 @@ $(BUILD_DIR)/soft/vid_svgalib.@OBJEXT@: $(COMMON_DIR)/vid_svgalib.c $(CC) $(CFLAGS) $(SVGA_CFLAGS) -O -o $@ -c $< +$(BUILD_DIR)/soft/in_svgalib.@OBJEXT@: $(COMMON_DIR)/in_svgalib.c + $(CC) $(CFLAGS) $(SVGA_CFLAGS) -O -o $@ -c $< + $(BUILD_DIR)/soft/d_copy.@OBJEXT@: $(COMMON_DIR)/d_copy.s $(CC) $(CFLAGS) -x assembler-with-cpp -o $@ -c $< @@ -358,6 +364,9 @@ $(BUILD_DIR)/soft/cd_sdl.@OBJEXT@: $(COMMON_DIR)/cd_sdl.c $(CC) $(CFLAGS) $(SDL_CFLAGS) -o $@ -c $< +$(BUILD_DIR)/soft/snd_oss.@OBJEXT@: $(COMMON_DIR)/snd_oss.c + $(CC) $(CFLAGS) $(SDL_CFLAGS) -o $@ -c $< + $(SDLQUAKE): soft_DIR $(BUILD_DIR)/../$(SDLQUAKE) $(BUILD_DIR)/../$(SDLQUAKE): $(ALL_SDL_OBJS) @@ -438,10 +447,13 @@ $(BUILD_DIR)/gl/dga_check.@OBJEXT@: $(COMMON_DIR)/dga_check.c $(CC) $(CFLAGS) $(X11_CFLAGS) -o $@ -c $< +$(BUILD_DIR)/soft/snd_oss.@OBJEXT@: $(COMMON_DIR)/snd_oss.c + $(CC) $(CFLAGS) $(SDL_CFLAGS) -o $@ -c $< + $(GLQUAKE): gl_DIR $(BUILD_DIR)/../$(GLQUAKE) $(BUILD_DIR)/../$(GLQUAKE): $(ALL_GL_OBJS) - $(CC) $(CFLAGS) $(ALL_GL_OBJS) $(GL_LDFLAGS) $(LDFLAGS) $(LIBS) \ + $(CC) $(CFLAGS) $(ALL_GL_OBJS) $(GL_LDFLAGS) $(SDL_LDFLAGS) $(LDFLAGS) $(LIBS) \ -o $(BUILD_DIR)/../$(GLQUAKE) endif ---patch-ad--- --- qw_client/Makefile.in.orig Wed Jan 19 04:24:41 2000 +++ qw_client/Makefile.in Wed Dec 20 00:38:14 2000 @@ -277,10 +277,13 @@ $(COMMON_DIR)/@X11_VID_SRC@ $(CC) $(CFLAGS) $(X11_CFLAGS) -o $@ -c $< +$(BUILD_DIR)/soft/snd_oss.@OBJEXT@: $(COMMON_DIR)/snd_oss.c + $(CC) $(CFLAGS) $(SDL_CFLAGS) -o $@ -c $< + $(X11QUAKE): soft_DIR $(BUILD_DIR)/../$(X11QUAKE) $(BUILD_DIR)/../$(X11QUAKE): $(ALL_X11_OBJS) - $(CC) $(CFLAGS) $(ALL_X11_OBJS) $(X11_LDFLAGS) $(LDFLAGS) $(LIBS) \ + $(CC) $(CFLAGS) $(ALL_X11_OBJS) $(X11_LDFLAGS) $(SDL_LDFLAGS) $(LDFLAGS) $(LIBS) \ -o $(BUILD_DIR)/../$(X11QUAKE) endif @@ -300,6 +303,9 @@ $(BUILD_DIR)/soft/vid_svgalib.@OBJEXT@: $(COMMON_DIR)/vid_svgalib.c $(CC) -O $(CFLAGS) $(SVGA_CFLAGS) -o $@ -c $< +$(BUILD_DIR)/soft/in_svgalib.@OBJEXT@: $(COMMON_DIR)/in_svgalib.c + $(CC) -O $(CFLAGS) $(SVGA_CFLAGS) -o $@ -c $< + $(BUILD_DIR)/soft/d_copy.@OBJEXT@: $(COMMON_DIR)/d_copy.s $(CC) $(CFLAGS) -x assembler-with-cpp -o $@ -c $< @@ -353,6 +359,9 @@ $(BUILD_DIR)/soft/cd_sdl.@OBJEXT@: $(COMMON_DIR)/cd_sdl.c $(CC) $(CFLAGS) $(SDL_CFLAGS) -o $@ -c $< +$(BUILD_DIR)/soft/snd_oss.@OBJEXT@: $(COMMON_DIR)/snd_oss.c + $(CC) $(CFLAGS) $(SDL_CFLAGS) -o $@ -c $< + $(SDLQUAKE): soft_DIR $(BUILD_DIR)/../$(SDLQUAKE) $(BUILD_DIR)/../$(SDLQUAKE): $(ALL_SDL_OBJS) @@ -402,10 +411,13 @@ $(BUILD_DIR)/gl/dga_check.@OBJEXT@: $(COMMON_DIR)/dga_check.c $(CC) $(CFLAGS) $(X11_CFLAGS) -o $@ -c $< +$(BUILD_DIR)/soft/snd_oss.@OBJEXT@: $(COMMON_DIR)/snd_oss.c + $(CC) $(CFLAGS) $(SDL_CFLAGS) -o $@ -c $< + $(GLQUAKE): gl_DIR $(BUILD_DIR)/../$(GLQUAKE) $(BUILD_DIR)/../$(GLQUAKE): $(ALL_GL_OBJS) - $(CC) $(CFLAGS) $(ALL_GL_OBJS) $(GL_LDFLAGS) $(LDFLAGS) $(LIBS) \ + $(CC) $(CFLAGS) $(ALL_GL_OBJS) $(GL_LDFLAGS) $(SDL_LDFLAGS) $(LDFLAGS) $(LIBS) \ -o $(BUILD_DIR)/../$(GLQUAKE) endif ---patch-ae------ common/vid_svgalib.c.orig Wed Jan 19 14:01:04 2000 +++ common/vid_svgalib.c Wed Dec 20 00:33:56 2000 @@ -90,10 +90,10 @@ if (VGA_planar) { for (plane=0 ; plane<4 ; plane++) { /* Select the correct plane for reading and writing */ - outb(0x02, 0x3C4); - outb(1 << plane, 0x3C5); - outb(4, 0x3CE); - outb(plane, 0x3CF); + _outb(0x02, 0x3C4); + _outb(1 << plane, 0x3C5); + _outb(4, 0x3CE); + _outb(plane, 0x3CF); for (i=0 ; i<(height << repshift) ; i += reps) { for (k=0 ; k -#ifdef HAVE_NETINET_IN_H -# include -#endif - #ifdef HAVE_WINSOCK_H # include #endif @@ -89,6 +85,10 @@ #include "view.h" #include "va.h" #include "winquake.h" + +#ifdef HAVE_NETINET_IN_H +# include +#endif #ifdef __sun /* Sun's model_t in sys/model.h conflicts w/ Quake's model_t */ --- ../../qf/source/vid_svgalib.c Tue Jan 9 03:03:08 2001 +++ vid_svgalib.c Sat Jan 27 12:41:09 2001 @@ -58,6 +58,7 @@ void VGA_UpdatePlanarScreen (void *srcbuffer); +void _outb (unsigned, unsigned); unsigned short d_8to16table[256]; @@ -107,10 +108,10 @@ if (VGA_planar) { for (plane = 0; plane < 4; plane++) { /* Select the correct plane for reading and writing */ - outb (0x02, 0x3C4); - outb (1 << plane, 0x3C5); - outb (4, 0x3CE); - outb (plane, 0x3CF); + _outb (0x02, 0x3C4); + _outb (1 << plane, 0x3C5); + _outb (4, 0x3CE); + _outb (plane, 0x3CF); for (i = 0; i < (height << repshift); i += reps) { for (k = 0; k < reps; k++) { @@ -165,10 +166,10 @@ if (VGA_planar) { for (plane = 0; plane < 4; plane++) { /* Select the correct plane for writing */ - outb (2, 0x3C4); - outb (1 << plane, 0x3C5); - outb (4, 0x3CE); - outb (plane, 0x3CF); + _outb (2, 0x3C4); + _outb (1 << plane, 0x3C5); + _outb (4, 0x3CE); + _outb (plane, 0x3CF); for (i = 0; i < (height << repshift); i += reps) { for (k = 0; k < reps; k++) { ---end-of-patch-qf.0.2.99beta6--- Have Fun Quake Playing! all questions to E-mail :) >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message