Commit 6eeea01d authored by Rinnegatamante's avatar Rinnegatamante
Browse files

Fixed random crashes when joining online servers.

parent 09f9d048
......@@ -83,13 +83,13 @@ void SND_setup(void) {
scs = (cv->integer*1536);
buffer = malloc(scs*sizeof(sndBuffer) );
if (buffer == NULL) buffer = malloc(scs*sizeof(sndBuffer) );
// allocate the stack based hunk allocator
sfxScratchBuffer = malloc(SND_CHUNK_SIZE * sizeof(short) * 4); //Hunk_Alloc(SND_CHUNK_SIZE * sizeof(short) * 4);
if (sfxScratchBuffer == NULL) sfxScratchBuffer = malloc(SND_CHUNK_SIZE * sizeof(short) * 4); //Hunk_Alloc(SND_CHUNK_SIZE * sizeof(short) * 4);
sfxScratchPointer = NULL;
inUse = scs*sizeof(sndBuffer);
p = buffer;;
p = buffer;
q = p + scs;
while (--q > p)
*(sndBuffer **)q = q-1;
......@@ -102,8 +102,8 @@ void SND_setup(void) {
void SND_shutdown(void)
{
free(sfxScratchBuffer);
free(buffer);
//->free(sfxScratchBuffer);
//->free(buffer);
}
/*
......
......@@ -57,6 +57,8 @@ static int audio_thread(int args, void *argp)
return 0;
}
uint8_t psp2_inited = 0;
/*
===============
SNDDMA_Init
......@@ -64,6 +66,8 @@ SNDDMA_Init
*/
qboolean SNDDMA_Init(void)
{
if (psp2_inited) return qtrue;
psp2_inited = 1;
Com_Printf("Initializing audio device.\n");
dma.samplebits = 16;
dma.speed = SAMPLE_RATE;
......@@ -115,8 +119,8 @@ void SNDDMA_Shutdown(void)
{
Com_Printf("Closing audio device...\n");
if(snd_inited){
stop_audio = qtrue;
chn = -1;
//-> stop_audio = qtrue;
//-> chn = -1;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment