M2Header
struct · models · 340 bytes
- Meaning
- Holds an MD20 file header: magic, version and the count and offset of every array
- 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.
Fields 72
| offset | size | type | name | meaning | confidence | finding |
|---|---|---|---|---|---|---|
0x0000 | 4 | uint32_t | m_magic | Holds MD20 | verified, proof one | models/shared#header-fixup |
0x0004 | 4 | uint32_t | m_version | Holds the version, 0x100 or 0x101 | verified, proof one | models/shared#header-fixup |
0x0008 | 4 | uint32_t | m_nName | Holds the count of the name | verified, proof one | models/shared#header-fixup |
0x000c | 4 | void * | m_name | Holds the name, a pointer after the fixup | verified, proof one | models/shared#header-fixup |
0x0014 | 4 | uint32_t | m_nGlobalSequences | Holds the count of the global sequence lengths | verified, proof one | models/shared#header-fixup |
0x0018 | 4 | void * | m_globalSequences | Holds the global sequence lengths, a pointer after the fixup | verified, proof one | models/shared#header-fixup |
0x001c | 4 | uint32_t | m_nSequences | Holds the count of the sequences, 0x44 bytes each | verified, proof one | models/shared#header-fixup |
0x0020 | 4 | void * | m_sequences | Holds the sequences, 0x44 bytes each, a pointer after the fixup | verified, proof one | models/shared#header-fixup |
0x0024 | 4 | uint32_t | m_nSequenceLookup | Holds the count of the sequence lookup | verified, proof one | models/shared#header-fixup |
0x0028 | 4 | void * | m_sequenceLookup | Holds the sequence lookup, a pointer after the fixup | verified, proof one | models/shared#header-fixup |
0x002c | 4 | uint32_t | m_nPlayableTable | Holds the count of the playable animation pairs | verified, proof one | models/shared#header-fixup |
0x0030 | 4 | void * | m_playableTable | Holds the playable animation pairs, a pointer after the fixup | verified, proof one | models/shared#header-fixup |
0x0034 | 4 | uint32_t | m_nBones | Holds the count of the bones, 0x6c bytes each | verified, proof one | models/shared#header-fixup |
0x0038 | 4 | void * | m_bones | Holds the bones, 0x6c bytes each, a pointer after the fixup | verified, proof one | models/shared#header-fixup |
0x003c | 4 | uint32_t | m_nKeyBoneLookup | Holds the count of the key bone lookup | verified, proof one | models/shared#header-fixup |
0x0040 | 4 | void * | m_keyBoneLookup | Holds the key bone lookup, a pointer after the fixup | verified, proof one | models/shared#header-fixup |
0x0044 | 4 | uint32_t | m_nVertices | Holds the count of the vertices, 0x30 bytes each | verified, proof one | models/shared#header-fixup |
0x0048 | 4 | void * | m_vertices | Holds the vertices, 0x30 bytes each, a pointer after the fixup | verified, proof one | models/shared#header-fixup |
0x004c | 4 | uint32_t | m_nViews | Holds the count of the views, 0x2c bytes each | verified, proof one | models/shared#header-fixup |
0x0050 | 4 | void * | m_views | Holds the views, 0x2c bytes each, a pointer after the fixup | verified, proof one | models/shared#header-fixup |
0x0054 | 4 | uint32_t | m_nColors | Holds the count of the colours, 0x38 bytes each | verified, proof one | models/shared#header-fixup |
0x0058 | 4 | void * | m_colors | Holds the colours, 0x38 bytes each, a pointer after the fixup | verified, proof one | models/shared#header-fixup |
0x005c | 4 | uint32_t | m_nTextures | Holds the count of the textures, 0x10 bytes each | verified, proof one | models/shared#header-fixup |
0x0060 | 4 | void * | m_textures | Holds the textures, 0x10 bytes each, a pointer after the fixup | verified, proof one | models/shared#header-fixup |
0x0064 | 4 | uint32_t | m_nTransparency | Holds the count of the transparency tracks | verified, proof one | models/shared#header-fixup |
0x0068 | 4 | void * | m_transparency | Holds the transparency tracks, a pointer after the fixup | verified, proof one | models/shared#header-fixup |
0x006c | 4 | uint32_t | m_nTextureFrames | Holds the count of the texture frame tracks | verified, proof one | models/shared#header-fixup |
0x0070 | 4 | void * | m_textureFrames | Holds the texture frame tracks, a pointer after the fixup | verified, proof one | models/shared#header-fixup |
0x0074 | 4 | uint32_t | m_nTextureTransforms | Holds the count of the texture transforms, 0x54 bytes each | verified, proof one | models/shared#header-fixup |
0x0078 | 4 | void * | m_textureTransforms | Holds the texture transforms, 0x54 bytes each, a pointer after the fixup | verified, proof one | models/shared#header-fixup |
0x007c | 4 | uint32_t | m_nReplaceableLookup | Holds the count of the replaceable texture lookup | verified, proof one | models/shared#header-fixup |
0x0080 | 4 | void * | m_replaceableLookup | Holds the replaceable texture lookup, a pointer after the fixup | verified, proof one | models/shared#header-fixup |
0x0084 | 4 | uint32_t | m_nMaterials | Holds the count of the materials, 4 bytes each | verified, proof one | models/shared#header-fixup |
0x0088 | 4 | void * | m_materials | Holds the materials, 4 bytes each, a pointer after the fixup | verified, proof one | models/shared#header-fixup |
0x008c | 4 | uint32_t | m_nBoneLookup | Holds the count of the bone lookup | verified, proof one | models/shared#header-fixup |
0x0090 | 4 | void * | m_boneLookup | Holds the bone lookup, a pointer after the fixup | verified, proof one | models/shared#header-fixup |
0x0094 | 4 | uint32_t | m_nTextureLookup | Holds the count of the texture lookup | verified, proof one | models/shared#header-fixup |
0x0098 | 4 | void * | m_textureLookup | Holds the texture lookup, a pointer after the fixup | verified, proof one | models/shared#header-fixup |
0x009c | 4 | uint32_t | m_nTextureUnitLookup | Holds the count of the texture unit lookup | verified, proof one | models/shared#header-fixup |
0x00a0 | 4 | void * | m_textureUnitLookup | Holds the texture unit lookup, a pointer after the fixup | verified, proof one | models/shared#header-fixup |
0x00a4 | 4 | uint32_t | m_nTransparencyLookup | Holds the count of the transparency lookup | verified, proof one | models/shared#header-fixup |
0x00a8 | 4 | void * | m_transparencyLookup | Holds the transparency lookup, a pointer after the fixup | verified, proof one | models/shared#header-fixup |
0x00ac | 4 | uint32_t | m_nTextureTransformLookup | Holds the count of the texture transform lookup | verified, proof one | models/shared#header-fixup |
0x00b0 | 4 | void * | m_textureTransformLookup | Holds the texture transform lookup, a pointer after the fixup | verified, proof one | models/shared#header-fixup |
0x00b4 | 24 | float[6] | m_bounds | Holds the bounding box, minimum then maximum | verified, proof one | models/shared#header-fixup |
0x00cc | 4 | float | m_boundsRadius | Holds the bounding radius | verified, proof one | models/shared#header-fixup |
0x00d0 | 24 | float[6] | m_collisionBounds | Holds the collision box | verified, proof one | models/shared#header-fixup |
0x00e8 | 4 | float | m_collisionRadius | Holds the collision radius | verified, proof one | models/shared#header-fixup |
0x00ec | 4 | uint32_t | m_nCollisionIndices | Holds the count of the collision indices | verified, proof one | models/shared#header-fixup |
0x00f0 | 4 | void * | m_collisionIndices | Holds the collision indices, a pointer after the fixup | verified, proof one | models/shared#header-fixup |
0x00f4 | 4 | uint32_t | m_nCollisionVertices | Holds the count of the collision vertices | verified, proof one | models/shared#header-fixup |
0x00f8 | 4 | void * | m_collisionVertices | Holds the collision vertices, a pointer after the fixup | verified, proof one | models/shared#header-fixup |
0x00fc | 4 | uint32_t | m_nCollisionNormals | Holds the count of the collision normals | verified, proof one | models/shared#header-fixup |
0x0100 | 4 | void * | m_collisionNormals | Holds the collision normals, a pointer after the fixup | verified, proof one | models/shared#header-fixup |
0x0104 | 4 | uint32_t | m_nAttachments | Holds the count of the attachments, 0x30 bytes each | verified, proof one | models/shared#header-fixup |
0x0108 | 4 | void * | m_attachments | Holds the attachments, 0x30 bytes each, a pointer after the fixup | verified, proof one | models/shared#header-fixup |
0x010c | 4 | uint32_t | m_nAttachmentLookup | Holds the count of the attachment lookup | verified, proof one | models/shared#header-fixup |
0x0110 | 4 | void * | m_attachmentLookup | Holds the attachment lookup, a pointer after the fixup | verified, proof one | models/shared#header-fixup |
0x0114 | 4 | uint32_t | m_nEvents | Holds the count of the events, 0x2c bytes each | verified, proof one | models/shared#header-fixup |
0x0118 | 4 | void * | m_events | Holds the events, 0x2c bytes each, a pointer after the fixup | verified, proof one | models/shared#header-fixup |
0x011c | 4 | uint32_t | m_nLights | Holds the count of the lights, 0xd4 bytes each | verified, proof one | models/shared#header-fixup |
0x0120 | 4 | void * | m_lights | Holds the lights, 0xd4 bytes each, a pointer after the fixup | verified, proof one | models/shared#header-fixup |
0x0124 | 4 | uint32_t | m_nCameras | Holds the count of the cameras, 0x7c bytes each | verified, proof one | models/shared#header-fixup |
0x0128 | 4 | void * | m_cameras | Holds the cameras, 0x7c bytes each, a pointer after the fixup | verified, proof one | models/shared#header-fixup |
0x012c | 4 | uint32_t | m_nCameraLookup | Holds the count of the camera lookup | verified, proof one | models/shared#header-fixup |
0x0130 | 4 | void * | m_cameraLookup | Holds the camera lookup, a pointer after the fixup | verified, proof one | models/shared#header-fixup |
0x0134 | 4 | uint32_t | m_nRibbons | Holds the count of the ribbon emitters, 0xdc bytes each | verified, proof one | models/shared#header-fixup |
0x0138 | 4 | void * | m_ribbons | Holds the ribbon emitters, 0xdc bytes each, a pointer after the fixup | verified, proof one | models/shared#header-fixup |
0x013c | 4 | uint32_t | m_nParticles | Holds the count of the particle emitters, 0x1f8 bytes each | verified, proof one | models/shared#header-fixup |
0x0140 | 4 | void * | m_particles | Holds the particle emitters, 0x1f8 bytes each, a pointer after the fixup | verified, proof one | models/shared#header-fixup |
0x0144 | 4 | uint32_t | m_nCombiners | Holds the count of the version-0x101 combine words | verified, proof one | models/render#texture-stages |
0x0148 | 4 | uint16_t * | m_combiners | Holds the version-0x101 combine words, one per stage, a pointer after the fixup | verified, proof one | models/render#texture-stages |