summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/i_sdlsound.c14
-rw-r--r--src/setup/display.c10
2 files changed, 19 insertions, 5 deletions
diff --git a/src/i_sdlsound.c b/src/i_sdlsound.c
index 1cfafa6f..2bce2fb1 100644
--- a/src/i_sdlsound.c
+++ b/src/i_sdlsound.c
@@ -479,11 +479,23 @@ static boolean CacheSFX(sfxinfo_t *sfxinfo)
// If the header specifies that the length of the sound is greater than
// the length of the lump itself, this is an invalid sound lump
- if (length > lumplen - 8)
+ // We also discard sound lumps that are less than 49 samples long,
+ // as this is how DMX behaves - although the actual cut-off length
+ // seems to vary slightly depending on the sample rate. This needs
+ // further investigation to better understand the correct
+ // behavior.
+
+ if (length > lumplen - 8 || length <= 48)
{
return false;
}
+ // The DMX sound library seems to skip the first 16 and last 16
+ // bytes of the lump - reason unknown.
+
+ data += 16;
+ length -= 32;
+
// Sample rate conversion
ExpandSoundData(sfxinfo, data + 8, samplerate, length);
diff --git a/src/setup/display.c b/src/setup/display.c
index 1e5e9e31..9ed0ae5f 100644
--- a/src/setup/display.c
+++ b/src/setup/display.c
@@ -257,9 +257,7 @@ static int GetSupportedBPPIndex(char *description)
}
}
- // Shouldn't happen; fall back to the first in the list.
-
- return 0;
+ return -1;
}
// Set selected_bpp to match screen_bpp.
@@ -277,7 +275,11 @@ static int TrySetSelectedBPP(void)
if (pixel_depths[i].bpp == screen_bpp)
{
selected_bpp = GetSupportedBPPIndex(pixel_depths[i].description);
- return 1;
+
+ if (selected_bpp >= 0)
+ {
+ return 1;
+ }
}
}