[Scummvm-cvs-logs] SF.net SVN: scummvm:[54772] tools/trunk/engines/mohawk/archive.cpp

mthreepwood at users.sourceforge.net mthreepwood at users.sourceforge.net
Sun Dec 5 01:36:43 CET 2010


Revision: 54772
          http://scummvm.svn.sourceforge.net/scummvm/?rev=54772&view=rev
Author:   mthreepwood
Date:     2010-12-05 00:36:43 +0000 (Sun, 05 Dec 2010)

Log Message:
-----------
TOOLS: Fix extract_mohawk for tMOV resources at the end of the list (thanks, fuzzie)

Modified Paths:
--------------
    tools/trunk/engines/mohawk/archive.cpp

Modified: tools/trunk/engines/mohawk/archive.cpp
===================================================================
--- tools/trunk/engines/mohawk/archive.cpp	2010-12-04 23:48:31 UTC (rev 54771)
+++ tools/trunk/engines/mohawk/archive.cpp	2010-12-05 00:36:43 UTC (rev 54772)
@@ -217,12 +217,13 @@
 	// We need to do this because of the way Mohawk is set up (this is much more "proper"
 	// than passing _mhk at the right offset). We may want to do that in the future, though.
 	if (_types[typeIndex].tag == ID_TMOV) {
-		if (fileTableIndex == _fileTableAmount)
+		if (fileTableIndex == _fileTableAmount - 1)
 			output.stream = new Common::SeekableSubReadStream(_mhk, _fileTable[fileTableIndex].offset, _mhk->size());
 		else
 			output.stream = new Common::SeekableSubReadStream(_mhk, _fileTable[fileTableIndex].offset, _fileTable[fileTableIndex + 1].offset);
 	} else
 		output.stream = new Common::SeekableSubReadStream(_mhk, _fileTable[fileTableIndex].offset, _fileTable[fileTableIndex].offset + _fileTable[fileTableIndex].dataSize);
+
 	output.tag = tag;
 	output.id = id;
 	output.index = fileTableIndex;
@@ -255,9 +256,12 @@
 
 	// For some unknown reason, all tMOV resources have incorrect sizes. We correct this by getting the differences between offsets.
 	uint32 dataSize = 0;
-	if (_types[_curExType].tag == ID_TMOV)
-		dataSize = _fileTable[fileTableIndex + 1].offset - _fileTable[fileTableIndex].offset;
-	else
+	if (_types[_curExType].tag == ID_TMOV) {
+		if (fileTableIndex == _fileTableAmount - 1)
+			dataSize = _mhk->size() - _fileTable[fileTableIndex].offset;
+		else
+			dataSize = _fileTable[fileTableIndex + 1].offset - _fileTable[fileTableIndex].offset;
+	} else
 		dataSize = _fileTable[fileTableIndex].dataSize;
 
 	output.stream = new Common::SeekableSubReadStream(_mhk, _fileTable[fileTableIndex].offset, _fileTable[fileTableIndex].offset + dataSize, false);


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list