aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);
}