mirror of
https://bitbucket.org/CPMADevs/cnq3
synced 2025-02-22 03:41:21 +00:00
throwing a fatal error when com_soundMegs is too low for a map load
This commit is contained in:
parent
a4397252c3
commit
bb9e814837
4 changed files with 17 additions and 3 deletions
|
@ -21,6 +21,8 @@ chg: with r_backend GL3, depth fade with MSAA now requires GLSL 4.00 at a minimu
|
|||
|
||||
chg: with r_backend GL3, alpha to coverage now requires GLSL 4.00 at a minimum
|
||||
|
||||
fix: throwing a fatal error when com_soundMegs is too low to load a map instead of freezing
|
||||
|
||||
fix: /video produced .avi files that started with silence when they were not first in the sequence
|
||||
|
||||
fix: with r_backend D3D11, some device reset scenarios caused fatal errors instead of video restarts
|
||||
|
|
|
@ -1054,7 +1054,7 @@ static void S_UpdateBackgroundTrack()
|
|||
}
|
||||
|
||||
|
||||
void S_FreeOldestSound()
|
||||
qbool S_FreeOldestSound()
|
||||
{
|
||||
sfx_t* sfx;
|
||||
int oldest = Com_Milliseconds();
|
||||
|
@ -1068,6 +1068,9 @@ void S_FreeOldestSound()
|
|||
}
|
||||
}
|
||||
|
||||
if (slot == 0)
|
||||
return qfalse;
|
||||
|
||||
sfx = &s_knownSfx[slot];
|
||||
|
||||
Com_DPrintf( "S_FreeOldestSound: freeing sound %s\n", sfx->soundName );
|
||||
|
@ -1081,6 +1084,8 @@ void S_FreeOldestSound()
|
|||
|
||||
sfx->inMemory = qfalse;
|
||||
sfx->soundData = NULL;
|
||||
|
||||
return qtrue;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -162,6 +162,6 @@ void SND_setup();
|
|||
|
||||
void S_PaintChannels(int endtime);
|
||||
|
||||
void S_FreeOldestSound();
|
||||
qbool S_FreeOldestSound();
|
||||
|
||||
qbool S_Base_Init( soundInterface_t *si );
|
||||
|
|
|
@ -43,7 +43,14 @@ void SND_free( sndBuffer* v )
|
|||
sndBuffer* SND_malloc()
|
||||
{
|
||||
while (!freelist) {
|
||||
S_FreeOldestSound();
|
||||
if (!S_FreeOldestSound()) {
|
||||
// Throw an error instead of running an infinite loop.
|
||||
// It would be nicer to have a disconnect/drop type of error here,
|
||||
// but sadly that would leave the hunk allocator in a bad state.
|
||||
Com_Error (ERR_FATAL,
|
||||
"Not enough memory for audio.\n"
|
||||
"Please increase com_soundMegs accordingly.\n");
|
||||
}
|
||||
}
|
||||
|
||||
sndmem_avail -= sizeof(sndBuffer);
|
||||
|
|
Loading…
Reference in a new issue