Fix sound system restart crash with high res music pack

git-svn-id: https://svn.eduke32.com/eduke32@1000 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2008-08-22 23:10:54 +00:00
parent 73a9dbc80e
commit 37767e0caf
6 changed files with 32 additions and 28 deletions

View file

@ -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

View file

@ -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);

View file

@ -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;
}

View file

@ -33,9 +33,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <stdio.h>
#include <string.h>
#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;

View file

@ -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();

View file

@ -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
}