summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon Howard2011-03-06 21:08:32 +0000
committerSimon Howard2011-03-06 21:08:32 +0000
commit68f51552ff65668deaeef923fc8c496d64ea9a60 (patch)
treea23137a2b6124e33a31948690f751c15094d2174 /src
parent52db6da5814c867fc6dd6bb0ec5d51d76b1fcc4e (diff)
parentb0519667da8edcea1592a0ba7b0dfa4b4709e034 (diff)
downloadchocolate-doom-68f51552ff65668deaeef923fc8c496d64ea9a60.tar.gz
chocolate-doom-68f51552ff65668deaeef923fc8c496d64ea9a60.tar.bz2
chocolate-doom-68f51552ff65668deaeef923fc8c496d64ea9a60.zip
Merge from trunk.
Subversion-branch: /branches/raven-branch Subversion-revision: 2292
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;
+ }
}
}