diff options
author | Bastien Bouclet | 2017-07-07 19:32:15 +0200 |
---|---|---|
committer | Bastien Bouclet | 2017-07-07 19:39:23 +0200 |
commit | 93c75a46806810838b595a8b8d320595eca878f7 (patch) | |
tree | 03a83426241e5b0b328e9cc3aeeb772ab64b37e9 /engines | |
parent | dc913a31f81003133bbb9c216029970e0e9a09f3 (diff) | |
download | scummvm-rg350-93c75a46806810838b595a8b8d320595eca878f7.tar.gz scummvm-rg350-93c75a46806810838b595a8b8d320595eca878f7.tar.bz2 scummvm-rg350-93c75a46806810838b595a8b8d320595eca878f7.zip |
MOHAWK: Fix computing the size of tMOV resources
When two entries in the file table shared the same data in the archive,
the resource size of the first entry was incorrectly set to zero.
Fixes #9905.
Diffstat (limited to 'engines')
-rw-r--r-- | engines/mohawk/resource.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/engines/mohawk/resource.cpp b/engines/mohawk/resource.cpp index b9ecdb38ee..430361d88c 100644 --- a/engines/mohawk/resource.cpp +++ b/engines/mohawk/resource.cpp @@ -291,13 +291,22 @@ bool MohawkArchive::openStream(Common::SeekableReadStream *stream) { // WORKAROUND: tMOV resources pretty much ignore the size part of the file table, // as the original just passed the full Mohawk file to QuickTime and the offset. + // We set the resource size to the number of bytes till the beginning of the next + // resource in the archive. // We need to do this because of the way Mohawk is set up (this is much more "proper" // than passing _stream at the right offset). We may want to do that in the future, though. if (tag == ID_TMOV) { - if (index == fileTable.size()) - res.size = stream->size() - fileTable[index - 1].offset; - else - res.size = fileTable[index].offset - fileTable[index - 1].offset; + uint16 nextFileIndex = index; + while (res.size == 0) { + if (nextFileIndex == fileTable.size()) + res.size = stream->size() - fileTable[index - 1].offset; + else + res.size = fileTable[nextFileIndex].offset - fileTable[index - 1].offset; + + // Loop because two entries in the file table may point to the same data + // in the archive. + nextFileIndex++; + } } else res.size = fileTable[index - 1].size; |