aboutsummaryrefslogtreecommitdiff
path: root/audio/decoders
diff options
context:
space:
mode:
authorJohannes Schickel2012-06-11 20:34:42 +0200
committerJohannes Schickel2012-06-11 20:37:04 +0200
commit9c14f4419b4b9f573d4a955be136108e575266fe (patch)
tree7899b613e21ca48a5ef414c41aaa06afd0639937 /audio/decoders
parentea06210b92a45f8fca6b9be19057bcd607988ee7 (diff)
downloadscummvm-rg350-9c14f4419b4b9f573d4a955be136108e575266fe.tar.gz
scummvm-rg350-9c14f4419b4b9f573d4a955be136108e575266fe.tar.bz2
scummvm-rg350-9c14f4419b4b9f573d4a955be136108e575266fe.zip
AUDIO: Make VOC decoder a bit more failsafe by still playing parts of invalid VOC files.
Formerly when an unsupported block was found the opening would fail. Instead now all the valid blocks till that occasion will be played. This fixes an missing sound in Full Throttle (thanks to clone2727 for reporting), which is using a VOC file which fails to specify the proper block length for its sound block.
Diffstat (limited to 'audio/decoders')
-rw-r--r--audio/decoders/voc.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/audio/decoders/voc.cpp b/audio/decoders/voc.cpp
index f0b5b2777d..fa330c6f2c 100644
--- a/audio/decoders/voc.cpp
+++ b/audio/decoders/voc.cpp
@@ -321,9 +321,14 @@ void VocStream::preProcess() {
// In case we hit a "Terminator" block we also break here.
if (_stream->eos() || block.code == 0)
break;
- // We also allow 128 as terminator, since Simon 1 Amiga CD32 uses it.
- if (block.code == 128) {
- debug(3, "VocStream::preProcess: Caught 128 as terminator");
+ // We will allow invalid block numbers as terminators. This is needed,
+ // since some games ship broken VOC files. The following occasions are
+ // known:
+ // - 128 is used as terminator in Simon 1 Amiga CD32
+ // - Full Throttle contains a VOC file with an incorrect block length
+ // resulting in a sample (127) to be read as block code.
+ if (block.code > 9) {
+ warning("VocStream::preProcess: Caught %d as terminator", block.code);
break;
}
@@ -482,7 +487,8 @@ void VocStream::preProcess() {
default:
warning("Unhandled code %d in VOC file (len %d)", block.code, block.length);
- return;
+ // Skip the whole block and try to use the next one.
+ skip = block.length;
}
// Premature end of stream => error!