38 return hasFlag(mphdFlags, AdtHasBigAlpha) ||
39 hasFlag(mphdFlags, AdtHasHeightTexturing)
49 std::string mapWdtOf(std::string_view tilePath) {
50 const auto lastSep = tilePath.rfind(
'\\');
51 if (lastSep == std::string_view::npos)
return {};
52 const std::string_view dir = tilePath.substr(0, lastSep);
53 const auto prevSep = dir.rfind(
'\\');
54 const std::string_view map = prevSep == std::string_view::npos ? dir : dir.substr(prevSep + 1);
55 if (map.empty())
return {};
56 return std::format(
"{}\\{}.wdt", dir, map);
66 template <ClientVersion V>
68 const std::string& path,
71 const std::string wdtPath = mapWdtOf(path);
74 "the tile path has no map directory to derive the WDT from");
75 const auto raw =
fs.readFile(
FileKey{wdtPath});
76 if (!raw || raw->empty()) {
86 if (
auto r = root.
read(*raw); !r)
88 alpha = alphaFormatOf(root.
header.flags);
99 template <ClientVersion V>
103 if (
auto fail = deriveAlpha<V>(
fs, path, report, alpha))
return *fail;
117 report,
"reparse", r.error().message);
123 report,
"compare", *divergence);
135 template <ClientVersion V>
139 if (
auto fail = deriveAlpha<V>(
fs, path, report, alpha))
return *fail;
148 constexpr std::array names{
"root",
"_tex0",
"_obj0"};
154 std::array<
FileBuffer, kinds.size()> firsts{};
155 for (std::size_t i = 0; i < kinds.size(); ++i) {
156 auto first = tile.
writeFile(kinds[i], alpha);
159 if (
auto r = reparsed.
parseFile(*first, kinds[i]); !r)
161 firsts[i] = std::move(*first);
165 if constexpr (
requires { tile.obj1Data; }) {
166 reparsed.obj1Data = tile.obj1Data;
167 reparsed.lodData = tile.lodData;
170 for (std::size_t i = 0; i < kinds.size(); ++i) {
171 const auto second = reparsed.
writeFile(kinds[i], alpha);
187 else report =
guarded([&] {
return roundtripAdtSplit<V>(
fs, path); });
The ADT terrain-tile entity (namespace wowlib::formats::adt): ADT<V>, one map tile,...
Named ClientVersion constants for the exact client builds format features appeared (or vanished) at —...
Internals of the round-trip audit (namespace wowlib::audit::detail): the per-format driver class — on...
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...
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...
RoundtripReport unrecognizedVersion(const ClientVersion v)
The dispatch-failure outcome for a version outside the targeted releases.
constexpr ClientVersion Cata
Cataclysm (any 4.x client).
@ 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 WDT entity (namespace wowlib::formats::wdt): a map description — the main .wdt file plus its era'...