M2FixupHeader
function · models · orchestration
- Address
0x71cdf0· 1225 bytes, up to0x71d2b8- Meaning
- Checks an MD20 header and turns every array offset in it into a pointer, refusing any past the file
- Confidence
- verified, proof one
- Finding
- models/shared#header-fixup
Finding: Header fixup in models: the shared model
The file starts with an MD20 header of version 0x100 or 0x101 and at least 0x154 bytes. Every
array is a count and an offset; the fixup checks that the array ends inside the file and replaces
the offset with a pointer, or with 0 for an empty array, and does the same inside the views,
colours, textures, transparencies, texture frames, texture transforms, attachments, events,
lights, cameras, ribbons and particles. Any check that fails makes the load fail.
| header | array | element |
|---|---|---|
+0x08 | name | 1 byte |
+0x14 to +0x2c | global sequences, sequences, sequence lookup, playable table | 4, 0x44, 2, 4 bytes |
+0x34, +0x3c, +0x44 | bones, key bone lookup, vertices | 0x6c, 2, 0x30 bytes |
+0x4c, +0x54, +0x5c | views, colours, textures | 0x2c, 0x38, 0x10 bytes |
+0x64, +0x6c, +0x74 | transparency, texture frames, texture transforms | 0x1c, 0x1c, 0x54 bytes |
+0x7c to +0xac | replaceable lookup, materials, then five 16-bit lookups | 2, 4, 2 bytes |
+0xec to +0xfc | collision indices, vertices, normals | 2, 12, 12 bytes |
+0x104 to +0x134 | attachments, attachment lookup, events, lights, cameras, camera lookup, ribbons | 0x30, 2, 0x2c, 0xd4, 0x7c, 2, 0xdc bytes |
+0x13c; +0x144, +0x14c | particles; two 16-bit arrays in version 0x101 | 0x1f8; 2 bytes |
The derivation is in the doc.
Callers 1
- CM2Shared::FinishLoad models
Callees 19
- M2FixupArray8 models
- M2FixupArray4 models
- M2FixupArray2 models
- M2FixupArray12 models
- M2FixupVertices models
- M2FixupViews models
- M2FixupColors models
- M2FixupTextures models
- M2FixupTransparency models
- M2FixupFlipbooks models
- M2FixupTextureTransforms models
- M2FixupMaterials models
- M2FixupAttachments models
- M2FixupEvents models
- M2FixupLights models
- M2FixupCameras models
- M2FixupRibbons models
- M2FixupParticles models
- M2FixupArray16 models
Calls and jumps by a bare address, from tables/calls.tsv.