wowlib 0.0.0
Read & write World of Warcraft client files — a C++26 core
Loading...
Searching...
No Matches
roundtrip.hpp
Go to the documentation of this file.
1#pragma once
2
9
10#include <string>
11#include <string_view>
12#include <vector>
13
14#include <welder/vocabulary.hpp>
15
18
19namespace wowlib::audit {
20 struct [[
21 =welder::weld,
22 =welder::doc(R"(
23 The outcome of one file's round-trip: whether the file survived, the
24 stage that failed (or the reason it was skipped), the diagnostic, and
25 every unmodeled chunk encountered along the way. A plain value — a
26 sweep accumulates these without exception handling.)")
28 [[=welder::doc(
29 "Whether the round-trip succeeded; skipped files count as ok.")]]
30 bool ok = true;
31
32 [[=welder::doc(R"(
33 The failed stage ("root compare", "skin 1 write", ...) when ok is
34 false; a "skipped:*" tag ("skipped:wmo-group", "skipped:aux-wdt",
35 "skipped:unsupported-version", "skipped:unknown-format", ...) for
36 files the audit does not round-trip; empty on a clean round-trip.)")]]
37 std::string stage;
38
39 [[=welder::doc("The failure diagnostic; empty on success and on skips.")]]
40 std::string error;
41
42 [[=welder::doc(R"(
43 Every unmodeled chunk encountered while parsing, as fourcc spellings —
44 one entry per occurrence (ready for counting), still round-tripped
45 verbatim by the chunk framework.)")]]
46 std::vector<std::string> unknownChunks;
47 };
48
49 struct [[
50 =welder::weld,
51 =welder::doc(R"(
52 The exhaustive round-trip audit: feed it one client file at a time
53 (enumerate them with FileSystem.enumerate_paths) and it round-trips
54 the file with the format entity matching the path's extension,
55 reporting the outcome as a value. Byte-perfect formats (WMO, WDT, WDL,
56 BLP) compare the rewrite against the original bytes; offset/derived
57 formats (M2, ADT) run a write -> parse -> write-again stability
58 compare instead. No semantic validation happens — round-trips only.)")
59 ]] Auditor {
60 [[=welder::doc(R"(
61 Round-trip one file, dispatching on the path's extension: .wmo roots
62 (group files and _lod variants are covered through their root and
63 report as skipped), .m2 (satellite .skin/.anim/.skel files are baked
64 into the model's round-trip), main .wdt files (satellite _occ/_lgt/...
65 files report as skipped:aux-wdt), .wdl, .blp, and root .adt tiles
66 (split _tex0/_obj0/... siblings are covered through their root). An
67 ADT's on-disk alpha-map bit depth is a per-map property, so each .adt
68 call re-derives it by reading the map's own WDT next to the tile —
69 nothing is cached, keeping calls independent. Formats without an
70 instantiation for the client's version report skipped:unsupported-version.
71 Failures never raise; they come back in the report.)"),
72 =welder::returns("the file's outcome report")]]
73 static RoundtripReport roundtrip(fs::FileSystem& fs [[=welder::doc("the opened client filesystem")]],
74 std::string_view path [[=welder::doc(
75 "the client-internal file path (any spelling)")]],
76 ClientVersion version [[=welder::doc(
77 "the client's version; selects the format layouts")]]);
78 };
79}
Client version identity, the flavor axis that separates a client's CONTENT version from the engine ge...
The runtime facade over the static compositions — the primary welder binding surface of the fs layer.
static RoundtripReport roundtrip(fs::FileSystem &fs, std::string_view path, ClientVersion version)
Definition roundtrip.cpp:43
std::string error
The failure diagnostic; empty on success and on skips.
Definition roundtrip.hpp:27
std::vector< std::string > unknownChunks
Definition roundtrip.hpp:29
bool ok
Whether the round-trip succeeded; skipped files count as ok.
Definition roundtrip.hpp:22