From 84af01f92450b0c11573340ea05ef45586d6a624 Mon Sep 17 00:00:00 2001 From: Roman Kharitonov Date: Sat, 24 May 2025 20:24:02 +1000 Subject: [PATCH] Zanzarah: Fix unpacking (fixes #25) --- src/modules/zanzarah/zanzarah.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/modules/zanzarah/zanzarah.cpp b/src/modules/zanzarah/zanzarah.cpp index 5557076..f91315e 100644 --- a/src/modules/zanzarah/zanzarah.cpp +++ b/src/modules/zanzarah/zanzarah.cpp @@ -65,17 +65,12 @@ namespace extractor const auto block_offset = read_positive_or_zero_int32(stream); const auto block_size = read_positive_int32(stream); - [[maybe_unused]] constexpr int32_t data_block_footer = 0x202; - [[maybe_unused]] constexpr int32_t data_block_header = 0x101; - constexpr int32_t header_size = sizeof(data_block_header); - constexpr int32_t footer_size = sizeof(data_block_footer); + constexpr int32_t attr_size = 4; auto new_file = std::make_unique(); new_file->path = path; - new_file->offset = block_offset + header_size; - // [0x101, data, 0x202], [0x101, data, 0x202], ... - // No idea why we should subtract next data block header, but apparently that's the right way - new_file->compressed_body_size_in_bytes = block_size - 2 * header_size - footer_size; + new_file->offset = block_offset + attr_size; + new_file->compressed_body_size_in_bytes = block_size - attr_size; new_file->uncompressed_body_size_in_bytes = new_file->compressed_body_size_in_bytes; files.push_back(std::move(new_file));