From 88c105103b1fcd6b43aa1ad2c1b586adfbdc5597 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Wed, 6 May 2026 02:18:37 -0700 Subject: [PATCH] fix(content-pack): validateZone accepts WOM2/WOM3 as valid WOM files ContentPacker.validateZone only matched WOM1 magic (0x314D4F57). Any zone exported with animated (WOM2) or multi-batch (WOM3) models was scored as having invalid WOM files, lowering the open-format score from 7/7 to 6/7 even though everything is correct. Now accepts the WOM family. --- tools/editor/content_pack.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/tools/editor/content_pack.cpp b/tools/editor/content_pack.cpp index c59c578f..28559693 100644 --- a/tools/editor/content_pack.cpp +++ b/tools/editor/content_pack.cpp @@ -194,6 +194,17 @@ static bool checkMagic(const std::string& path, uint32_t expectedMagic) { return magic == expectedMagic; } +// Returns true if `magic` matches any of the WOM family magics (WOM1/WOM2/WOM3). +static bool checkAnyMagic(const std::string& path, + std::initializer_list expected) { + std::ifstream f(path, std::ios::binary); + if (!f) return false; + uint32_t magic = 0; + f.read(reinterpret_cast(&magic), 4); + for (uint32_t e : expected) if (magic == e) return true; + return false; +} + ContentPacker::ValidationResult ContentPacker::validateZone(const std::string& zoneDir) { namespace fs = std::filesystem; ValidationResult r; @@ -201,6 +212,8 @@ ContentPacker::ValidationResult ContentPacker::validateZone(const std::string& z static constexpr uint32_t WHM_MAGIC = 0x314D4857; // "WHM1" static constexpr uint32_t WOM_MAGIC = 0x314D4F57; // "WOM1" + static constexpr uint32_t WOM2_MAGIC = 0x324D4F57; // "WOM2" + static constexpr uint32_t WOM3_MAGIC = 0x334D4F57; // "WOM3" static constexpr uint32_t WOB_MAGIC = 0x31424F57; // "WOB1" static constexpr uint32_t WOC_MAGIC = 0x31434F57; // "WOC1" @@ -215,7 +228,8 @@ ContentPacker::ValidationResult ContentPacker::validateZone(const std::string& z } if (ext == ".wom") { r.hasWom = true; - if (checkMagic(entry.path().string(), WOM_MAGIC)) r.womValid = true; + if (checkAnyMagic(entry.path().string(), {WOM_MAGIC, WOM2_MAGIC, WOM3_MAGIC})) + r.womValid = true; } if (ext == ".wob") { r.hasWob = true;