Correct our interpretation of the first four bytes of the RSRC section in Mohawk archives.

svn-id: r47583
This commit is contained in:
Matthew Hoops 2010-01-26 23:05:52 +00:00
parent 77fe0215cd
commit d4f08cbe81
3 changed files with 10 additions and 3 deletions

View File

@ -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();

View File

@ -166,7 +166,8 @@ struct TypeTable {
};
struct RSRC_Header {
uint32 size;
uint16 version;
uint16 compaction;
uint32 filesize;
uint32 abs_offset;
uint16 file_table_offset;

View File

@ -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