diff options
author | Strangerke | 2016-01-04 14:07:56 +0100 |
---|---|---|
committer | Strangerke | 2016-01-04 14:07:56 +0100 |
commit | 1084fc023ccd94bec579db27115cc874b653cc24 (patch) | |
tree | e7d2eaaac98a8ef3c6651f19d80e6e593035e32f /engines | |
parent | 94809c4995ccd7a765ce86efdf24f2d3af175d4f (diff) | |
download | scummvm-rg350-1084fc023ccd94bec579db27115cc874b653cc24.tar.gz scummvm-rg350-1084fc023ccd94bec579db27115cc874b653cc24.tar.bz2 scummvm-rg350-1084fc023ccd94bec579db27115cc874b653cc24.zip |
TONY: As suggested by LordHoto, determine codec based on container signature instead of filename
Diffstat (limited to 'engines')
-rw-r--r-- | engines/tony/tony.cpp | 53 |
1 files changed, 17 insertions, 36 deletions
diff --git a/engines/tony/tony.cpp b/engines/tony/tony.cpp index 08e30cd409..47fd2e3ce3 100644 --- a/engines/tony/tony.cpp +++ b/engines/tony/tony.cpp @@ -574,48 +574,29 @@ void TonyEngine::loadState(CORO_PARAM, int n) { bool TonyEngine::openVoiceDatabase() { // Open the voices database - if (_vdbFP.open("voices.vdb")) - _vdbCodec = FPCODEC_ADPCM; - else if (_vdbFP.open("voices.mdb")) - _vdbCodec = FPCODEC_MP3; - else if (_vdbFP.open("voices.odb")) - _vdbCodec = FPCODEC_OGG; - else if (_vdbFP.open("voices.fdb")) - _vdbCodec = FPCODEC_FLAC; - else - return false; + if (!_vdbFP.open("voices.vdb")) + if (!_vdbFP.open("voices.mdb")) + if (!_vdbFP.open("voices.odb")) + if (!_vdbFP.open("voices.fdb")) + return false; _vdbFP.seek(-8, SEEK_END); uint32 numfiles = _vdbFP.readUint32LE(); + int32 id = _vdbFP.readUint32BE(); - switch (_vdbCodec) { - case FPCODEC_ADPCM: - if (_vdbFP.readUint32BE() != MKTAG('V', 'D', 'B', '1')) { - _vdbFP.close(); - return false; - } - break; - case FPCODEC_MP3: - if (_vdbFP.readUint32BE() != MKTAG('M', 'D', 'B', '1')) { - _vdbFP.close(); - return false; - } - break; - case FPCODEC_OGG: - if (_vdbFP.readUint32BE() != MKTAG('O', 'D', 'B', '1')) { - _vdbFP.close(); - return false; - } - break; - case FPCODEC_FLAC: - if (_vdbFP.readUint32BE() != MKTAG('F', 'D', 'B', '1')) { - _vdbFP.close(); - return false; - } - break; - default: + if (id == MKTAG('V', 'D', 'B', '1')) + _vdbCodec = FPCODEC_ADPCM; + else if (id == MKTAG('M', 'D', 'B', '1')) + _vdbCodec = FPCODEC_MP3; + else if (id == MKTAG('O', 'D', 'B', '1')) + _vdbCodec = FPCODEC_OGG; + else if (id == MKTAG('F', 'D', 'B', '1')) + _vdbCodec = FPCODEC_FLAC; + else { + _vdbFP.close(); return false; } + // Read in the index _vdbFP.seek(-8 - (numfiles * VOICE_HEADER_SIZE), SEEK_END); |