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) { ...@@ -83,13 +83,13 @@ void SND_setup(void) {
scs = (cv->integer*1536); scs = (cv->integer*1536);
buffer = malloc(scs*sizeof(sndBuffer) ); if (buffer == NULL) buffer = malloc(scs*sizeof(sndBuffer) );
// allocate the stack based hunk allocator // 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; sfxScratchPointer = NULL;
inUse = scs*sizeof(sndBuffer); inUse = scs*sizeof(sndBuffer);
p = buffer;; p = buffer;
q = p + scs; q = p + scs;
while (--q > p) while (--q > p)
*(sndBuffer **)q = q-1; *(sndBuffer **)q = q-1;
...@@ -102,8 +102,8 @@ void SND_setup(void) { ...@@ -102,8 +102,8 @@ void SND_setup(void) {
void SND_shutdown(void) void SND_shutdown(void)
{ {
free(sfxScratchBuffer); //->free(sfxScratchBuffer);
free(buffer); //->free(buffer);
} }
/* /*
......
...@@ -57,6 +57,8 @@ static int audio_thread(int args, void *argp) ...@@ -57,6 +57,8 @@ static int audio_thread(int args, void *argp)
return 0; return 0;
} }
uint8_t psp2_inited = 0;
/* /*
=============== ===============
SNDDMA_Init SNDDMA_Init
...@@ -64,6 +66,8 @@ SNDDMA_Init ...@@ -64,6 +66,8 @@ SNDDMA_Init
*/ */
qboolean SNDDMA_Init(void) qboolean SNDDMA_Init(void)
{ {
if (psp2_inited) return qtrue;
psp2_inited = 1;
Com_Printf("Initializing audio device.\n"); Com_Printf("Initializing audio device.\n");
dma.samplebits = 16; dma.samplebits = 16;
dma.speed = SAMPLE_RATE; dma.speed = SAMPLE_RATE;
...@@ -115,8 +119,8 @@ void SNDDMA_Shutdown(void) ...@@ -115,8 +119,8 @@ void SNDDMA_Shutdown(void)
{ {
Com_Printf("Closing audio device...\n"); Com_Printf("Closing audio device...\n");
if(snd_inited){ if(snd_inited){
stop_audio = qtrue; //-> stop_audio = qtrue;
chn = -1; //-> 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