[Scummvm-git-logs] scummvm master -> 93c75a46806810838b595a8b8d320595eca878f7

bgK bastien.bouclet at gmail.com
Fri Jul 7 19:39:30 CEST 2017


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
93c75a4680 MOHAWK: Fix computing the size of tMOV resources


Commit: 93c75a46806810838b595a8b8d320595eca878f7
    https://github.com/scummvm/scummvm/commit/93c75a46806810838b595a8b8d320595eca878f7
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2017-07-07T19:39:23+02:00

Commit Message:
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.

Changed paths:
    engines/mohawk/resource.cpp


diff --git a/engines/mohawk/resource.cpp b/engines/mohawk/resource.cpp
index b9ecdb3..430361d 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;
 





More information about the Scummvm-git-logs mailing list