M2 chunks — the Legion+ shell¶
From Legion (7.0.1) on, the on-disk .m2 is a chunked stream: the MD20 image
moves into the MD21 chunk — the M2 root, offsets intact — joined
by satellite chunks: FileDataID references, extended particle data,
parent-model overrides, inline physics. Chunk ids are not reversed on disk,
unlike every other WoW chunk format. Each field below carries its chunk
FourCC (linking to wowdev.wiki) plus an expansion badge when the chunk is
version-restricted (both ends inclusive); an untouched shell rewrites
byte-for-byte.
The M2ChunkedFile base¶
M2ChunkedFile
¶
A chunked .m2 shell (Legion+), abstract over the client version. Construct a concrete version with M2ChunkedFile.for_version(expansion); the per-version M2ChunkedFile* classes are subclasses. See https://wowdev.wiki/M2#Chunks.
for_version staticmethod¶
for_version(expansion: Expansion) -> M2ChunkedFile⟨version⟩Construct the concrete M2ChunkedFile for a client version — the abstract M2ChunkedFile is never instantiated directly. The return type narrows per expansion (a typed overload per Expansion member), so for_version(Expansion.Legion) returns a M2ChunkedFileLegion; a runtime Expansion value yields the AnyM2ChunkedFile union.
validate
¶
Check the logical integrity contracts this file must satisfy to LOAD in the client, which write() deliberately never enforces. Call it before writing when you want to know the result will load. A file read from a client and left unmodified reports no errors; warnings mark states real client files ship.
Returns:
| Type | Description |
|---|---|
ValidationReport
|
every violated contract, each with its member path |
ensure_valid
¶
Validate and raise on the first error instead of returning a report — the assert-style face of validate().
Returns:
| Type | Description |
|---|---|
None
|
nothing; raises when validate() finds any error |
Chunks¶
Render extensions¶
LOD, waterfall shading, edge fade, alpha attenuation, inline physics and the still-undocumented tails.