Skip to content
This repository was archived by the owner on Dec 10, 2022. It is now read-only.

Commit 9e138fa

Browse files
committed
zCCSLib: fix improper reading of contents in binary archives
This is necessary for (at least) Gothic 1 Patch 1.08k from GOG. Previously the parser would fail at various stages and would omit the first three chars of the messages text as they were considered to be part of the 'subType'.
1 parent 732077c commit 9e138fa

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

zenload/zCCSLib.cpp

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,21 @@ void zCCSLib::readObjectData(ZenParser& parser)
7777
{
7878
ZenParser::ChunkHeader messageHeader;
7979
parser.readChunkStart(messageHeader);
80-
ReadObjectProperties(parser,
81-
Prop("subType", blk.atomicBlockData.command.subType),
82-
Prop("text", blk.atomicBlockData.command.text),
83-
Prop("name", blk.atomicBlockData.command.name));
80+
81+
if (parser.getZenHeader().fileType == ZenParser::FT_BINARY) {
82+
uint8_t subType;
83+
ReadObjectProperties(parser,
84+
Prop("subType", subType),
85+
Prop("text", blk.atomicBlockData.command.text),
86+
Prop("name", blk.atomicBlockData.command.name));
87+
blk.atomicBlockData.command.subType = subType;
88+
} else {
89+
ReadObjectProperties(parser,
90+
Prop("subType", blk.atomicBlockData.command.subType),
91+
Prop("text", blk.atomicBlockData.command.text),
92+
Prop("name", blk.atomicBlockData.command.name));
93+
}
94+
8495

8596
//LogInfo() << "Read message: " << blk.atomicBlockData.command.name;
8697
if(!parser.readChunkEnd())

0 commit comments

Comments
 (0)