From d4f08cbe818f2a7d80df10b468b30cc61975b422 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Tue, 26 Jan 2010 23:05:52 +0000 Subject: [PATCH] Correct our interpretation of the first four bytes of the RSRC section in Mohawk archives. svn-id: r47583 --- engines/mohawk/resource.cpp | 7 ++++++- engines/mohawk/resource.h | 3 ++- engines/mohawk/riven_saveload.cpp | 3 ++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/engines/mohawk/resource.cpp b/engines/mohawk/resource.cpp index 63f632de5f1..62a857b90b3 100644 --- a/engines/mohawk/resource.cpp +++ b/engines/mohawk/resource.cpp @@ -66,7 +66,12 @@ void MohawkArchive::open(Common::SeekableReadStream *stream) { if (_mhk->readUint32BE() != ID_RSRC) error ("Could not find tag \'RSRC\'"); - _rsrc.size = _mhk->readUint32BE(); + _rsrc.version = _mhk->readUint16BE(); + + if (_rsrc.version != 0x100) + error("Unsupported Mohawk resource version %d.%d", (_rsrc.version >> 8) & 0xff, _rsrc.version & 0xff); + + _rsrc.compaction = _mhk->readUint16BE(); // Only used in creation, not in reading _rsrc.filesize = _mhk->readUint32BE(); _rsrc.abs_offset = _mhk->readUint32BE(); _rsrc.file_table_offset = _mhk->readUint16BE(); diff --git a/engines/mohawk/resource.h b/engines/mohawk/resource.h index 6b32a32b8e0..bd63ae7f44e 100644 --- a/engines/mohawk/resource.h +++ b/engines/mohawk/resource.h @@ -166,7 +166,8 @@ struct TypeTable { }; struct RSRC_Header { - uint32 size; + uint16 version; + uint16 compaction; uint32 filesize; uint32 abs_offset; uint16 file_table_offset; diff --git a/engines/mohawk/riven_saveload.cpp b/engines/mohawk/riven_saveload.cpp index 74a40a179e7..51d92a09226 100644 --- a/engines/mohawk/riven_saveload.cpp +++ b/engines/mohawk/riven_saveload.cpp @@ -286,7 +286,8 @@ bool RivenSaveLoad::saveGame(Common::String filename) { // RSRC Header saveFile->writeUint32BE(ID_RSRC); - saveFile->writeUint32BE(16); // Size of RSRC + saveFile->writeUint16BE(0x100); // Resource Version (1.0) + saveFile->writeUint16BE(0); // No compaction saveFile->writeUint32BE(fileSize + 8); // Add on the 8 from the IFF header saveFile->writeUint32BE(28); // IFF + RSRC saveFile->writeUint16BE(62); // File Table Offset