37 report.
stage = std::move(stage);
38 report.
error = std::move(error);
47 report.
stage = std::format(
"skipped:{}", reason);
59 report.
stage = std::move(stage);
60 report.
error = std::move(error);
61 return std::move(report);
77 return failWith(report, std::move(stage), result.
error().message);
79 if (result->empty())
return skipped(
"empty-file");
104 catch (
const std::exception& e) {
105 return failed(
"exception", e.what());
108 return failed(
"exception",
"unknown exception");
119 if (original == rewritten)
return std::nullopt;
121 const std::size_t common = std::min(original.size(), rewritten.size());
123 while (at < common && original[at] == rewritten[at]) ++at;
124 return std::format(
"first divergence at {:#x} (sizes {} vs {})", at, original.size(), rewritten.size());
135 if (original == rewritten)
return std::nullopt;
137 const std::size_t common = std::min(original.size(), rewritten.size());
139 while (at < common && original[at] == rewritten[at]) ++at;
142 std::string inside =
"<no chunk>";
143 for (std::size_t pos = 0; pos + 8 <= original.size();) {
144 std::uint32_t fourcc = 0;
145 std::uint32_t size = 0;
146 std::memcpy(&fourcc, original.data() + pos, 4);
147 std::memcpy(&size, original.data() + pos + 4, 4);
148 if (at < pos + 8 + size) {
154 return std::format(
"first divergence at {:#x} inside chunk {} (sizes {} vs {})", at, inside, original.size(),
165 template <
typename F>
167 bool matched =
false;
169 if (!matched && v == V) {
171 f.template operator()<V>();
195 if (g == v)
return true;
203 return failed(
"dispatch", std::format(
204 "unrecognized client version {}.{}.{} (build {}) — not one of " "the targeted releases", v.
major,
The owning byte buffer file contents are read into.
The chunk framework, vocabulary and engine in one header.
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.
FourCC chunk identifiers: compile-time conversion of the four-letter codes to the host integers chunk...
RoundtripReport failWith(RoundtripReport &report, std::string stage, std::string error)
Mark report failed in place and hand it back — keeps the unknown-chunk tally gathered before the fail...
std::optional< RoundtripReport > classifyRead(RoundtripReport &report, std::string stage, const Result< FileBuffer > &result)
Classify a client-file read for the audit: content behind an unknown TACT key and zero-byte archive e...
bool withVersion(const ClientVersion v, F &&f)
Invoke f with the targeted release constant matching v as a compile-time template argument — the runt...
constexpr bool versionSupported(std::span< const ClientVersion > grid, const ClientVersion v)
Whether a format's instantiation grid carries v — the per-format if constexpr guard of the version di...
RoundtripReport skipped(std::string_view reason)
A skipped outcome — ok, tagged with the reason.
std::optional< std::string > firstDivergenceChunked(const FileBuffer &original, const FileBuffer &rewritten)
The first byte divergence between an original chunk stream and its rewrite, located within the enclos...
RoundtripReport guarded(F &&f)
Run one file's driver, converting any escaping exception into a failed outcome — one pathological fil...
std::optional< std::string > firstDivergence(const FileBuffer &original, const FileBuffer &rewritten)
The first byte divergence between an original and a rewrite, described by offset and sizes — the stab...
void tallyUnknown(RoundtripReport &report, const formats::ChunkExtras &extras, formats::FourCCEndian endian=formats::FourCCEndian::Reversed)
Append every unmodeled chunk of a parsed entity to the report's tally, one fourcc spelling per occurr...
RoundtripReport failed(std::string stage, std::string error)
A failed outcome.
RoundtripReport unrecognizedVersion(const ClientVersion v)
The dispatch-failure outcome for a version outside the targeted releases.
constexpr ClientVersion Shadowlands
constexpr ClientVersion Tww
constexpr ClientVersion Bfa
constexpr ClientVersion Mop
constexpr ClientVersion Wod
constexpr ClientVersion Tbc
constexpr ClientVersion Vanilla
constexpr ClientVersion Legion
constexpr ClientVersion Dragonflight
constexpr ClientVersion Cata
constexpr ClientVersion Wotlk
std::expected< T, Error > Result
Every fallible wowlib operation returns Result<T>; bindings translate the error branch into a target-...
@ EncryptedContent
Content is behind an unknown TACT encryption key.
std::vector< std::byte > FileBuffer
Owning byte buffer for file contents read out of a client storage.
The round-trip audit surface (namespace wowlib::audit): one welded entry point that read->write->comp...
std::uint16_t patch
Patch version within the minor release.
std::uint32_t build
Exact client build number, e.g.
std::uint16_t major
Expansion number, e.g.
std::uint16_t minor
Minor version within the expansion.
std::string error
The failure diagnostic; empty on success and on skips.
std::vector< std::string > unknownChunks
bool ok
Whether the round-trip succeeded; skipped files count as ok.