From b00049732f66eaeeb4abf57586201e60c186a008 Mon Sep 17 00:00:00 2001 From: sluicebox Date: Mon, 15 Apr 2019 07:17:23 -0700 Subject: SCI: Fix diskdump patch file headers Fix 'diskdump' debugger command creating an additional patch file header for resources that were loaded from patch files --- engines/sci/resource.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp index df91fb8f51..8e4a6d13b9 100644 --- a/engines/sci/resource.cpp +++ b/engines/sci/resource.cpp @@ -224,10 +224,14 @@ void Resource::unalloc() { } void Resource::writeToStream(Common::WriteStream *stream) const { - stream->writeByte(getType() | 0x80); // 0x80 is required by old Sierra SCI, otherwise it wont accept the patch file - stream->writeByte(_headerSize); - if (_headerSize > 0) + if (_headerSize == 0) { + // create patch file header + stream->writeByte(getType() | 0x80); // 0x80 is required by old Sierra SCI, otherwise it wont accept the patch file + stream->writeByte(_headerSize); + } else { + // use existing patch file header stream->write(_header, _headerSize); + } stream->write(_data, _size); } -- cgit v1.2.3