aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsluicebox2019-04-15 07:17:23 -0700
committerFilippos Karapetis2019-04-15 22:48:19 +0300
commitb00049732f66eaeeb4abf57586201e60c186a008 (patch)
tree8baf4d142afbe14b44b213fba93c2d20197da37a
parent8c15b41dd73e2f44e59b4918bdaaa522d22c5526 (diff)
downloadscummvm-rg350-b00049732f66eaeeb4abf57586201e60c186a008.tar.gz
scummvm-rg350-b00049732f66eaeeb4abf57586201e60c186a008.tar.bz2
scummvm-rg350-b00049732f66eaeeb4abf57586201e60c186a008.zip
SCI: Fix diskdump patch file headers
Fix 'diskdump' debugger command creating an additional patch file header for resources that were loaded from patch files
-rw-r--r--engines/sci/resource.cpp10
1 files 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);
}