wowlib 0.0.0
Read & write World of Warcraft client files — a C++26 core
Loading...
Searching...
No Matches
wowlib.hpp
Go to the documentation of this file.
1#pragma once
2
6
7#include <welder/vocabulary.hpp>
8
9namespace
10[[=welder::doc(R"(
11 Reading and writing World of Warcraft client files: client filesystem access
12 (MPQ and CASC), listfile databases, and a project-directory overlay for
13 modding.)")]]
14wowlib {}
15
18#include <wowlib/core/error.hpp>
21#include <wowlib/core/path.hpp>
23
24// The fs namespace must first open AFTER the core types: welder's module walk
25// binds namespace members in declaration order, and FileSystemSettings' NSDMI
26// defaults (a FileDataID value) convert EAGERLY at registration — the types
27// they name have to be registered before the fs submodule welds.
28namespace wowlib {
29 namespace
30 [[=welder::doc(R"(
31 Client filesystem access: storage backends, listfile databases, the
32 project-directory overlay and the FileSystem gateway.)")]]
33 fs {}
34}
35
47
48// formats opens after fs for the same reason fs opens after core: welder binds
49// namespace members in declaration order, and format entities name fs types
50// (FileSystem, FileKey) in their signatures.
51namespace wowlib {
52 namespace
53 [[=welder::doc(R"(
54 Client file formats: chunked binary serialization with byte-perfect
55 round-trips. Versioned formats are flat suffixed classes (WMOWotlk,
56 WMOShadowlands, ...) plus for_version factories keyed on an Expansion or
57 on a full ClientVersion — the latter being the only axis that can name a
58 Classic client.)")]]
59 formats {}
60}
61
68
69// The wmo namespace must first open AFTER the common binary primitives: its
70// structs carry NSDMI defaults of common types (SMOHeader's CArgb ambient
71// color, CAaBox bounds), and those values convert EAGERLY when the aggregate
72// field constructor registers — declaring wmo inside the formats block above
73// would make it formats' FIRST member and weld it before CArgb exists.
74namespace wowlib::formats {
75 namespace
76 [[=welder::doc(R"(
77 The WMO (world map object) format: the WMO assembly and its per-version
78 classes, split into submodules that mirror the C++ layout (root, root.chunks,
79 group, group.chunks). The pre-declaration order is the submodule weld order —
80 within each of root/group the chunks binary structs are declared first, so they
81 weld before the entities that name them as NSDMI defaults.)")]]
82 wmo {
83 namespace
84 [[=welder::doc("The WMO root-file entity: WMORoot and its per-version "
85 "classes.")]]
86 root {
87 namespace
88 [[=welder::doc("WMO root-file chunk binary structs (MOHD, MOMT, lights, "
89 "doodads, fog, ambient volumes) and their flag enums.")]]
90 chunks {}
91 }
92
93 namespace
94 [[=welder::doc("The WMO group-file entities: WMOGroup, WMOGroupBody and "
95 "their per-version classes.")]]
96 group {
97 namespace
98 [[=welder::doc(
99 "WMO group-file chunk binary structs (the MOGP header, render "
100 "batches, BSP nodes, group lights) and their flag enums.")]]
101 chunks {}
102 }
103 }
104}
105
106// The m2 namespace likewise first opens AFTER the common binary primitives (its
107// records carry NSDMI defaults of common types — C3Vector pivots, CAaBox
108// bounds) and after wmo, fixing the submodule weld order. Within m2 the
109// sub-namespaces mirror the directory tree (root with its record structs,
110// chunked with its own, skin, bone); they pre-declare before m2's own
111// entities so every record welds before the entities that name them as NSDMI
112// defaults.
113namespace wowlib::formats {
114 namespace
115 [[=welder::doc(R"(
116 The M2 model format: the M2 assembly (the MD20 body plus every baked
117 satellite file) and the shared Skeleton entity, with the per-family
118 submodules mirroring the C++ layout (root, root.record, chunked,
119 chunked.record, skin, bone).)")]]
120 m2 {
121 namespace
122 [[=welder::doc("The MD20 model body (M2Root) with its per-version "
123 "classes.")]]
124 root {
125 namespace
126 [[=welder::doc("M2 body record structs (sequences, bones, tracks, "
127 "textures, cameras, emitters) and their flag enums.")]]
128 record {}
129 }
130
131 namespace
132 [[=welder::doc("The Legion+ chunked .m2 shell (M2ChunkedFile) with its "
133 "per-version classes and the companion-chunk payload "
134 "records (AFID entries, extended particles, parent-model "
135 "overrides).")]]
136 chunked {
137 namespace
138 [[=welder::doc("Companion-chunk payload records of the chunked .m2 "
139 "shell.")]]
140 record {}
141 }
142
143 namespace
144 [[=welder::doc("The external LOD view entity (.skin file, WotLK+) and the "
145 "skin profile records (submeshes, render batches).")]]
146 skin {}
147
148 namespace
149 [[=welder::doc("The .bone facial-pose file entity (WoD+).")]]
150 bone {}
151 }
152}
153
154// The wdt namespace opens after m2 for the same submodule-order reason; its
155// sub-namespaces (root, occlusion, lights, fogs, mpv — mirroring the
156// directory tree) each pre-declare their chunks binary structs first, so they
157// weld before the entities that name them as NSDMI defaults.
158namespace wowlib::formats {
159 namespace
160 [[=welder::doc(R"(
161 The WDT map-description format: the WDT assembly (the main .wdt file plus
162 its era's _occ/_lgt/_fogs/_mpv satellite files) with the per-file
163 submodules mirroring the C++ layout (root, occlusion, lights, fogs,
164 mpv).)")]]
165 wdt {
166 namespace
167 [[=welder::doc("The WDT main-file entity: WDTRoot and its per-version "
168 "classes.")]]
169 root {
170 namespace
171 [[=welder::doc(
172 "WDT main-file chunk binary structs (the MPHD map header, MAIN "
173 "tile table, MAID FileDataIDs) and their flag enums.")]]
174 chunks {}
175 }
176
177 namespace
178 [[=welder::doc("The _occ.wdt occlusion satellite entity (WoD+).")]]
179 occlusion {
180 namespace
181 [[=welder::doc("_occ.wdt chunk binary structs (the MAOI tile index).")]]
182 chunks {}
183 }
184
185 namespace
186 [[=welder::doc("The _lgt.wdt lights satellite entity (WoD+).")]]
187 lights {
188 namespace
189 [[=welder::doc(
190 "_lgt.wdt chunk binary structs (point lights, spot lights, "
191 "light animations).")]]
192 chunks {}
193 }
194
195 namespace
196 [[=welder::doc("The _fogs.wdt volumetric-fog satellite entity (Legion "
197 "7.2.5+).")]]
198 fogs {
199 namespace
200 [[=welder::doc(
201 "_fogs.wdt chunk binary structs (volumetric fogs and their "
202 "extensions).")]]
203 chunks {}
204 }
205
206 namespace
207 [[=welder::doc("The _mpv.wdt particulate-volume satellite entity (BfA+).")]]
208 mpv {
209 namespace
210 [[=welder::doc("_mpv.wdt chunk binary structs (particulate points and "
211 "bounds).")]]
212 chunks {}
213 }
214 }
215}
216
217// The wdl namespace opens after wdt, fixing the submodule weld order; its
218// chunks binary structs pre-declare before the entity that names them.
219namespace wowlib::formats {
220 namespace
221 [[=welder::doc(R"(
222 The WDL low-resolution heightmap format: the WDL entity and its
223 per-version classes, with the chunk binary structs in the chunks
224 submodule.)")]]
225 wdl {
226 namespace
227 [[=welder::doc(
228 "WDL chunk binary structs (per-tile heightmaps, hole and ocean "
229 "masks, low-resolution placements, sky scenes).")]]
230 chunks {}
231 }
232}
233
234// The adt namespace opens after wdl, fixing the submodule weld order; its
235// chunks binary structs pre-declare before the MapChunk/ADT entities that name
236// them as NSDMI defaults.
237namespace wowlib::formats {
238 namespace
239 [[=welder::doc(R"(
240 The ADT terrain-tile format: the ADT tile entity and its 256 MapChunk
241 terrain cells (both per-version classes), the structured MH2O/MCLQ liquid,
242 and the chunk binary structs in the chunks submodule. One unified ADT spans
243 the pre-Cataclysm single .adt and the Cataclysm+ root/_tex0/_obj0 split.)")
244 ]]
245 adt {
246 namespace
247 [[=welder::doc(
248 "ADT chunk binary structs (the MCNK cell header, texture layers, "
249 "liquid records, flying bounds) and their flag enums.")]]
250 chunks {}
251 }
252}
253
254// The blp namespace opens after adt, fixing the submodule weld order. BLP is
255// version-stable across every client release, so the namespace holds one
256// unversioned entity (plus the Image/EncodeSettings vocabulary) — no chunks
257// submodule and no per-version classes.
258namespace wowlib::formats {
259 namespace
260 [[=welder::doc(R"(
261 The BLP texture format: the version-stable BLP2 entity with byte-perfect
262 round-trips, RGBA8 decode of every shipped encoding (palettized,
263 DXT1/3/5, BC5, raw BGRA) and full re-encoding (palette quantization, DXT
264 compression, mip-chain generation).)")]]
265 blp {}
266}
267
273
274// The format entities carry their fs-level read/write definitions inline
275// (implicit instantiation — the library ships no explicit instantiations).
282
283// The audit namespace opens last: its entry point names fs::FileSystem and
284// ClientVersion in signatures, and everything it touches is registered by now.
285namespace wowlib {
286 namespace
287 [[=welder::doc(R"(
288 Exhaustive round-trip auditing: enumerate a client's files (see
289 FileSystem.enumerate_paths) and round-trip them one at a time through
290 the matching format entity, collecting per-file outcome reports —
291 read->write->compare only, no semantic validation.)")]]
292 audit {}
293}
294
ADT version conversion (namespace wowlib::formats): the ADT's contribution to the generic convert<to>...
The ADT terrain-tile entity (namespace wowlib::formats::adt): ADT<V>, one map tile,...
The BLP entity (namespace wowlib::formats::blp): Blizzard's texture format.
The owning byte buffer file contents are read into.
The CascLib-backed storage for CASC-era clients.
The chunk framework, vocabulary and engine in one header.
The static composition of one client's file access.
Reading a client installation's own identity off disk: which product it is, which build,...
Client version identity, the flavor axis that separates a client's CONTENT version from the engine ge...
Version conversion scaffolding: convert<to>() composes hand-written adjacent-version steps along a fo...
The CSV-backed listfile provider: one working file ('fileDataId;filepath' per line) that is both read...
The error-handling vocabulary: ErrorCode, Error and the Result<T> alias every fallible wowlib operati...
The Expansion enum — the coarse, enumerable version axis the scripting bindings key on — and its mapp...
The monotonic allocator behind custom (non-Blizzard) FileDataIDs.
File identity types: the strong FileDataID and the FileKey a read request travels as.
The runtime facade over the static compositions — the primary welder binding surface of the fs layer.
Flag-testing convenience for the binary formats' bit-mask enums.
The pluggable listfile-provider contract and the no-database provider for clients that need none.
M2 version conversion (namespace wowlib::formats): the M2's contribution to the generic convert<to>()...
The M2 entity (namespace wowlib::formats::m2): a whole model with its satellite files baked in,...
The map-placement binary records SHARED across the world file formats (namespace wowlib::formats::com...
Per-version MPQ archive chain tables and their expansion against a real or fake Data/ directory.
The StormLib-backed storage for MPQ-era clients.
Client-internal path canonicalization.
The project-directory overlay: a local directory acting as the ultimate patch over any client storage...
Internal C++26 reflection utilities (<meta> based).
The round-trip audit surface (namespace wowlib::audit): one welded entry point that read->write->comp...
The storage-backend concept ClientFileSystem composes over.
StringBlock — the decoded representation of a chunk of zero-terminated strings (MOTX,...
The binary-level math and color primitives shared across WoW file formats (wowdev....
WDL version conversion (namespace wowlib::formats): the WDL's contribution to the generic convert<to>...
The WDL entity (namespace wowlib::formats::wdl): a map's low-resolution heightmap — the background mo...
WDT version conversion (namespace wowlib::formats): the WDT's contribution to the generic convert<to>...
The WDT entity (namespace wowlib::formats::wdt): a map description — the main .wdt file plus its era'...
WMO version conversion (namespace wowlib::formats): the WMO's contribution to the generic convert<to>...
The WMO entity (namespace wowlib::formats::wmo): a v17 world map object with its root file (wmo::root...