From 37767e0caf144ba87cb133a9ce41afe8d1eb5dd6 Mon Sep 17 00:00:00 2001 From: terminx Date: Fri, 22 Aug 2008 23:10:54 +0000 Subject: [PATCH] Fix sound system restart crash with high res music pack git-svn-id: https://svn.eduke32.com/eduke32@1000 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/build/src/glbuild.c | 4 ++-- polymer/eduke32/source/game.c | 4 ++-- polymer/eduke32/source/grpscan.c | 6 ++++- polymer/eduke32/source/jaudiolib/dsoundout.c | 6 ----- polymer/eduke32/source/jaudiolib/multivoc.c | 17 --------------- polymer/eduke32/source/jaudiolib/music.c | 23 ++++++++++++++++++++ 6 files changed, 32 insertions(+), 28 deletions(-) diff --git a/polymer/build/src/glbuild.c b/polymer/build/src/glbuild.c index 9c294f326..f2a104274 100644 --- a/polymer/build/src/glbuild.c +++ b/polymer/build/src/glbuild.c @@ -232,7 +232,7 @@ int loadgldriver(const char *driver) if (!driver) { #ifdef _WIN32 - driver = "OPENGL32.DLL"; + driver = "opengl32.dll"; #elif defined __APPLE__ driver = "/System/Library/Frameworks/OpenGL.framework/OpenGL"; #else @@ -625,7 +625,7 @@ int loadglulibrary(const char *driver) if (!driver) { #ifdef _WIN32 - driver = "GLU32.DLL"; + driver = "glu32.dll"; #elif defined __APPLE__ driver = "/System/Library/Frameworks/OpenGL.framework/OpenGL"; // FIXME: like I know anything about Apple. Hah. #else diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 96d3f4c83..d9cba10f7 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -10120,14 +10120,14 @@ static void genspriteremaps(void) g_NumPalettes = (g_NumPalettes * (uint64)0x0202020202 & (uint64)0x010884422010) % 1023; #endif - for (j=0;j < g_NumPalettes;j++) + for (j=g_NumPalettes-1;j>=0;j--) { kread(fp,(signed char *)&look_pos,1); kread(fp,tempbuf,256); makepalookup((int)look_pos,tempbuf,0,0,0,1); } - for (j = 0; j < 256; j++) + for (j = 255; j>=0; j--) tempbuf[j] = j; g_NumPalettes++; makepalookup(g_NumPalettes, tempbuf, 15, 15, 15, 1); diff --git a/polymer/eduke32/source/grpscan.c b/polymer/eduke32/source/grpscan.c index 5b9e03036..aaae289fe 100644 --- a/polymer/eduke32/source/grpscan.c +++ b/polymer/eduke32/source/grpscan.c @@ -171,6 +171,7 @@ int ScanGroups(void) if (usedgrpcache) { + int i = 0; FILE *fp; fp = fopen(GRPCACHEFILE, "wt"); if (fp) @@ -180,11 +181,14 @@ int ScanGroups(void) fgg = fg->next; fprintf(fp, "\"%s\" %d %d %d\n", fg->name, fg->size, fg->mtime, fg->crcval); free(fg); + i++; } fclose(fp); } + initprintf("Found %d recognized GRP files.\n",i); + return 0; } - + initprintf("Found no recognized GRP files!\n"); return 0; } diff --git a/polymer/eduke32/source/jaudiolib/dsoundout.c b/polymer/eduke32/source/jaudiolib/dsoundout.c index 2d3779a3e..850db79ed 100644 --- a/polymer/eduke32/source/jaudiolib/dsoundout.c +++ b/polymer/eduke32/source/jaudiolib/dsoundout.c @@ -33,9 +33,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include #include "dsound.h" -#ifdef USE_OPENAL -#include "openal.h" -#endif #include "compat.h" #include "winlayer.h" @@ -427,9 +424,6 @@ static DWORD WINAPI isr(LPVOID parm) while (1) { -#ifdef USE_OPENAL - AL_Update(); -#endif rv = WaitForMultipleObjects(1+_DSOUND_NumBuffers, handles, FALSE, INFINITE); if (!(rv >= WAIT_OBJECT_0 && rv <= WAIT_OBJECT_0+1+_DSOUND_NumBuffers)) return -1; diff --git a/polymer/eduke32/source/jaudiolib/multivoc.c b/polymer/eduke32/source/jaudiolib/multivoc.c index feabb1cfd..ef36fc2c5 100644 --- a/polymer/eduke32/source/jaudiolib/multivoc.c +++ b/polymer/eduke32/source/jaudiolib/multivoc.c @@ -2896,20 +2896,6 @@ int MV_Init(int soundcard, int MixRate, int Voices, int numchannels, int sampleb { MV_SetErrorCode(MV_BlasterError); } -#ifdef USE_OPENAL - else if (AL_Init()) - { - int i; - - // no AL support so shitcan the ogg definitions - for (i=(MAXLEVELS*(MAXVOLUMES+1))-1;i>=0;i--) // +1 volume for "intro", "briefing" music - { - if (map[i].musicfn1 != NULL) - Bfree(map[i].musicfn1); - map[i].musicfn1 = NULL; - } - } -#endif #else status = DSL_Init(); if (status != DSL_Ok) @@ -3005,9 +2991,6 @@ int MV_Shutdown(void) // Shutdown the sound card #if defined(_WIN32) -#ifdef USE_OPENAL - AL_Shutdown(); -#endif DSOUND_Shutdown(); #else DSL_Shutdown(); diff --git a/polymer/eduke32/source/jaudiolib/music.c b/polymer/eduke32/source/jaudiolib/music.c index 1edb73121..20fee2eca 100644 --- a/polymer/eduke32/source/jaudiolib/music.c +++ b/polymer/eduke32/source/jaudiolib/music.c @@ -38,6 +38,7 @@ Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com) #ifdef USE_OPENAL #include "openal.h" #endif +#include "duke3d.h" #ifndef TRUE #define TRUE ( 1 == 1 ) @@ -149,6 +150,21 @@ int MUSIC_Init status = MUSIC_InitMidi(SoundCard, &MUSIC_MidiFunctions, Address); +#ifdef USE_OPENAL + if (AL_Init()) + { + int i; + + // no AL support so shitcan the ogg definitions + for (i=(MAXLEVELS*(MAXVOLUMES+1))-1;i>=0;i--) // +1 volume for "intro", "briefing" music + { + if (map[i].musicfn1 != NULL) + Bfree(map[i].musicfn1); + map[i].musicfn1 = NULL; + } + } +#endif + return(status); } @@ -173,6 +189,10 @@ int MUSIC_Shutdown //MPU_Reset(); +#ifdef USE_OPENAL + AL_Shutdown(); +#endif + return(status); } @@ -610,5 +630,8 @@ void MUSIC_RegisterTimbreBank void MUSIC_Update(void) { MIDI_UpdateMusic(); +#ifdef USE_OPENAL + AL_Update(); +#endif }