wowlib 0.0.0
Read & write World of Warcraft client files — a C++26 core
Loading...
Searching...
No Matches
chunked.hpp
Go to the documentation of this file.
1#pragma once
2
15
16#include <array>
17#include <cstdint>
18#include <vector>
19
20#include <welder/vocabulary.hpp>
21
24#include <wowlib/core/lang.hpp>
28
31
39 struct [[
40 =welder::weld,
41 =welder::weld_as("M2ChunkedFile"),
43 =welder::doc(R"(
44 A chunked .m2 shell (Legion+), abstract over the client version.
45 Construct a concrete version with M2ChunkedFile.for_version(expansion); the
46 per-version M2ChunkedFile* classes are subclasses. See
47 https://wowdev.wiki/M2#Chunks.)")
49 bool operator==(const M2ChunkedFileBase&) const = default;
50 };
51
58 directly.
59 @tparam V the client version this shell targets.
60 @see https://wowdev.wiki/M2#Chunks */
61 template <ClientVersion V> requires (V >= M2ChunkedContainer)
62 struct [[
63 =welder::weld,
64 =welder::doc(R"(
65 The chunked .m2 shell for one Legion+ client version: the MD21 image
66 blob plus the satellite chunks. An untouched shell rewrites
67 byte-for-byte. See https://wowdev.wiki/M2#Chunks.)")
69 static constexpr ClientVersion Version = V;
71
72 [[
74 =welder::mark::exclude,
75 =welder::doc("The MD20 image TRANSPORT blob; offsets inside are "
76 "relative to this payload. Hidden from the bindings: a "
77 "chunk-level read keeps it verbatim, but the M2 assembly "
78 "decodes it into M2.root and drops the bytes — the "
79 "decoded body is the source of truth, and the assembly "
80 "write re-encodes it here.")]]
82
83 [[
87 =welder::mark::no_reassign,
88 =welder::doc(".phys FileDataID (PFID); 0 or 1 entries.")]]
89 std::vector<std::uint32_t> physFdid;
90
91 [[
95 =welder::mark::no_reassign,
96 =welder::doc(".skin FileDataIDs (SFID): num_skin_profiles view entries, "
97 "then the LOD-band skins.")]]
98 std::vector<std::uint32_t> skinFdids;
99
100 [[
104 =welder::mark::no_reassign,
105 =welder::doc(".anim FileDataIDs (AFID), one per external (animation, "
106 "variation) pair.")]]
107 std::vector<AnimFileEntry> animFdids;
109 [[
113 =welder::mark::no_reassign,
114 =welder::doc(".bone FileDataIDs (BFID), one per FacePose variant.")]]
115 std::vector<std::uint32_t> boneFdids;
117 [[
121 =welder::mark::no_reassign,
122 =welder::doc("Texture transform flags (TXAC), one 2-byte record per "
123 "material then per particle emitter.")]]
124 std::vector<std::array<std::uint8_t, 2>> textureAc;
125
126 [[
130 =welder::mark::no_reassign,
131 =welder::doc("Extended particle parameters (EXPT), one per emitter; "
132 "superseded by EXP2 when both exist.")]]
133 std::vector<M2ExtendedParticleSimple> extendedParticles;
134
135 [[
139 =welder::doc("Extended particle parameters with alpha-cutoff ramps "
140 "(EXP2), one per emitter.")]]
142
143 [[
147 =welder::doc("Parent-model sequence blacklist (PABC).")]]
149
150 [[
154 =welder::doc("Parent texture weights (PADC); offset-based track "
155 "payload kept verbatim.")]]
157
158 [[
162 =welder::doc("Parent sequence bounds (PSBC).")]]
165 [[
169 =welder::doc("Parent event data (PEDC); offset-based track payload "
170 "kept verbatim.")]]
173 [[
177 =welder::mark::no_reassign,
178 =welder::doc(".skel FileDataID (SKID); 0 or 1 entries.")]]
179 std::vector<std::uint32_t> skeletonFdid;
180
181 [[
185 =welder::mark::no_reassign,
186 =welder::doc("Texture FileDataIDs (TXID), replacing the in-image "
187 "texture filenames, one per texture.")]]
188 std::vector<std::uint32_t> textureFdids;
190 [[
194 =welder::doc("LOD data (LDV1); layout partially known, kept verbatim.")]]
195 ChunkBlob lodData;
196
197 [[
201 =welder::mark::no_reassign,
202 =welder::doc("Recursive (child-emitter) particle model FileDataIDs "
203 "(RPID), one per emitter.")]]
204 std::vector<std::uint32_t> recursiveParticleModelFdids;
205
206 [[
210 =welder::mark::no_reassign,
211 =welder::doc("Geometry particle model FileDataIDs (GPID), one per "
212 "emitter.")]]
213 std::vector<std::uint32_t> geometryParticleModelFdids;
214
215 [[
219 =welder::doc("Waterfall render path v1 (WFV1); undocumented, kept "
220 "verbatim.")]]
221 ChunkBlob waterfallV1;
222
223 [[
227 =welder::doc("Waterfall render path v2 (WFV2); undocumented, kept "
228 "verbatim.")]]
229 ChunkBlob waterfallV2;
230
231 [[
235 =welder::doc("Particle geoset data (PGD1), one geoset per emitter "
236 "(wowdev dates it to the 1.13.2.30172 classic build — "
237 "the 8.2.0 retail era).")]]
238 Pgd1Data particleGeosetData{};
239
240 [[
244 =welder::doc("Waterfall render path v3 (WFV3); shader parameter block, "
245 "kept verbatim.")]]
246 ChunkBlob waterfallV3;
247
248 [[
252 =welder::doc("Inline physics (PFDC): a whole .phys image plus "
253 "alignment padding, kept verbatim (structured PHYS is a "
254 "follow-up milestone). wowdev dates it to the 9.0.1 alpha, "
255 "but 8.3.7 shipped mid-alpha with the backport — 31 item "
256 "M2s in the fleet client carry it.")]]
257 ChunkBlob inlinePhys;
258
259 [[
263 =welder::doc("Edge fade data (EDGF), applied to batches with flags2 "
264 "0x8; kept verbatim.")]]
265 ChunkBlob edgeFade;
266
267 [[
271 =welder::doc("Distance-based model alpha attenuation coefficients "
272 "(NERF); kept verbatim.")]]
273 ChunkBlob alphaAttenuation;
274
275 [[
279 =welder::doc("Per-light detail overrides (DETL), kept verbatim: real "
280 "9.x files carry 16-byte records where wowdev documents "
281 "12 (see M2LightDetail for the known half).")]]
282 ChunkBlob lightDetails;
283
284 [[
288 =welder::doc("DBOC; undocumented (16 or 32 bytes seen), kept "
289 "verbatim.")]]
290 ChunkBlob dboc;
291
292 [[
296 =welder::doc("AFRA (Dragonflight+); not yet observed, kept verbatim.")]]
297 ChunkBlob afra;
298
299 [[
303 =welder::doc("Player-housing collision mesh (PCOL); offset-based "
304 "layout, kept verbatim.")]]
305 ChunkBlob housingCollision;
306
307 [[
311 =welder::doc("DPIV; undocumented, kept verbatim.")]]
312 ChunkBlob dpiv;
313
314 bool operator==(const M2ChunkedFile&) const = default;
315 };
316}
317
318namespace wowlib::formats::m2 {
324 template <ClientVersion V> requires (V >= M2ChunkedContainer)
326}
The chunk framework, vocabulary and engine in one header.
Named ClientVersion constants for the exact client builds format features appeared (or vanished) at —...
Client version identity, the flavor axis that separates a client's CONTENT version from the engine ge...
Binding-language identities welder's core does not name.
#define WOWLIB_CS_FAMILY_SURFACE
The C# rod's family-surface opt-in, spellable in every build.
Definition lang.hpp:44
The M2 version vocabulary: the layout pivots record/entity partial specializations key on,...
Legion+ companion-chunk records (namespace wowlib::formats::m2::chunked::record): the payload types o...
constexpr ClientVersion Legion_ShadowsOfArgus_24500
legion, Shadows of Argus PTR, 7.3.0 build 24500 (the .m2 parent-model and .skel satellite chunks).
constexpr ClientVersion BfA_RiseOfAzshara
BfA, Rise of Azshara, 8.2.0 build 30080 (WFV1/WFV2/PGD1).
constexpr ClientVersion DF
dragonflight (any 10.x client).
constexpr ClientVersion TWW_LegacyOfArathor
TWW, Legacy of Arathor, 11.1.7 build 60520 (PCOL/DPIV).
constexpr ClientVersion SL_Alpha_34365
shadowlands alpha, 9.0.1 build 34365 (DETL).
constexpr ClientVersion BfA_VisionsOfNzoth_35662
BfA, Visions of N'Zoth, 8.3.7 build 35662 (M2 PFDC inline physics — wowdev dates the chunk to the 9....
constexpr ClientVersion Legion_Alpha
legion alpha, 7.0.1 build 20740 — the first chunked-format build (the .m2 MD21 container,...
constexpr ClientVersion Legion
legion (any 7.x client).
constexpr ClientVersion SL_Alpha_33978
shadowlands alpha, 9.0.1 build 33978 (WFV3/EDGF/NERF/DBOC; PFDC is dated here by wowdev but reached l...
constexpr ClientVersion BfA_TidesOfVengeance
BfA, Tides of Vengeance PTR, 8.1.0 build 27826 (RPID/GPID, WMO MOSI/MODI).
constexpr ClientVersion BfA_Beta
Battle for Azeroth beta, 8.0.1 build 26629 (TXID/LDV1).
Companion-chunk payload records of the chunked .m2 shell.
Definition records.hpp:19
The Legion+ chunked .m2 shell (M2ChunkedFile) with its per-version classes and the companion-chunk pa...
Definition chunked.hpp:29
chunked::M2ChunkedFile< canonicalVersion(V, M2FilePivots, M2ChunkedVersions)> M2ChunkedFile
The chunked .m2 stream — the canonicalizing face of chunked::M2ChunkedFile: every Legion+ version map...
Definition chunked.hpp:189
constexpr ClientVersion M2ChunkedContainer
legion (7.0.1.20740): the on-disk .m2 becomes a chunked file — the MD20 image moves into the MD21 chu...
constexpr std::array M2FilePivots
M2ChunkedFile (the chunked stream): every chunk-introduction build — each documented since() value,...
constexpr std::array M2ChunkedVersions
The era subset the chunked container exists for (Legion+).
constexpr ClientVersion canonicalVersion(ClientVersion v, std::span< const ClientVersion > pivots, std::span< const ClientVersion > grid)
The canonical version v collapses to: the FIRST grid version in v's range.
constexpr detail::OptionalSpec Optional
Mark a chunk member the format does not require: absence on read is fine.
FourCCEndian
How a chunk's FourCC characters are laid out on disk.
Definition fourcc.hpp:14
@ Forward
The characters are stored as written: 'AFID' appears in the file as the bytes "AFID".
Definition fourcc.hpp:22
consteval detail::ChunkSpec chunk(const char(&cc)[5], FourCCEndian endian=FourCCEndian::Reversed)
Declare the chunk a member maps to.
consteval detail::SinceSpec since(ClientVersion v)
Restrict a member to entity versions >= v (inclusive).
An unparsed chunk payload, preserved verbatim for round-trip.
The serialization face of a chunked entity, mixed in CRTP-style: an entity struct E : ChunkedFile<E> ...
The version-agnostic base of every M2ChunkedFile<V> (welded as "M2ChunkedFile").
Definition chunked.hpp:44
bool operator==(const M2ChunkedFileBase &) const =default
The chunked .m2 shell for one Legion+ client version.
Definition chunked.hpp:58
bool operator==(const M2ChunkedFile &) const =default
The EXP2 chunk payload: extended particle records, one per particle emitter.
Definition records.hpp:94
The PABC chunk payload: the parent-model sequence-id blacklist ('BlacklistAnimData').
Definition records.hpp:108
The PGD1 chunk payload: per-particle-emitter geoset assignments.
Definition records.hpp:136
The PSBC chunk payload: parent sequence bounds.
Definition records.hpp:122