benilla-re systems structs docs

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.

headerarrayelement
+0x08name1 byte
+0x14 to +0x2cglobal sequences, sequences, sequence lookup, playable table4, 0x44, 2, 4 bytes
+0x34, +0x3c, +0x44bones, key bone lookup, vertices0x6c, 2, 0x30 bytes
+0x4c, +0x54, +0x5cviews, colours, textures0x2c, 0x38, 0x10 bytes
+0x64, +0x6c, +0x74transparency, texture frames, texture transforms0x1c, 0x1c, 0x54 bytes
+0x7c to +0xacreplaceable lookup, materials, then five 16-bit lookups2, 4, 2 bytes
+0xec to +0xfccollision indices, vertices, normals2, 12, 12 bytes
+0x104 to +0x134attachments, attachment lookup, events, lights, cameras, camera lookup, ribbons0x30, 2, 0x2c, 0xd4, 0x7c, 2, 0xdc bytes
+0x13c; +0x144, +0x14cparticles; two 16-bit arrays in version 0x1010x1f8; 2 bytes

The derivation is in the doc.

Fields 72

offsetsizetypenamemeaningconfidencefinding
0x00004uint32_tm_magicHolds MD20verified, proof onemodels/shared#header-fixup
0x00044uint32_tm_versionHolds the version, 0x100 or 0x101verified, proof onemodels/shared#header-fixup
0x00084uint32_tm_nNameHolds the count of the nameverified, proof onemodels/shared#header-fixup
0x000c4void *m_nameHolds the name, a pointer after the fixupverified, proof onemodels/shared#header-fixup
0x00144uint32_tm_nGlobalSequencesHolds the count of the global sequence lengthsverified, proof onemodels/shared#header-fixup
0x00184void *m_globalSequencesHolds the global sequence lengths, a pointer after the fixupverified, proof onemodels/shared#header-fixup
0x001c4uint32_tm_nSequencesHolds the count of the sequences, 0x44 bytes eachverified, proof onemodels/shared#header-fixup
0x00204void *m_sequencesHolds the sequences, 0x44 bytes each, a pointer after the fixupverified, proof onemodels/shared#header-fixup
0x00244uint32_tm_nSequenceLookupHolds the count of the sequence lookupverified, proof onemodels/shared#header-fixup
0x00284void *m_sequenceLookupHolds the sequence lookup, a pointer after the fixupverified, proof onemodels/shared#header-fixup
0x002c4uint32_tm_nPlayableTableHolds the count of the playable animation pairsverified, proof onemodels/shared#header-fixup
0x00304void *m_playableTableHolds the playable animation pairs, a pointer after the fixupverified, proof onemodels/shared#header-fixup
0x00344uint32_tm_nBonesHolds the count of the bones, 0x6c bytes eachverified, proof onemodels/shared#header-fixup
0x00384void *m_bonesHolds the bones, 0x6c bytes each, a pointer after the fixupverified, proof onemodels/shared#header-fixup
0x003c4uint32_tm_nKeyBoneLookupHolds the count of the key bone lookupverified, proof onemodels/shared#header-fixup
0x00404void *m_keyBoneLookupHolds the key bone lookup, a pointer after the fixupverified, proof onemodels/shared#header-fixup
0x00444uint32_tm_nVerticesHolds the count of the vertices, 0x30 bytes eachverified, proof onemodels/shared#header-fixup
0x00484void *m_verticesHolds the vertices, 0x30 bytes each, a pointer after the fixupverified, proof onemodels/shared#header-fixup
0x004c4uint32_tm_nViewsHolds the count of the views, 0x2c bytes eachverified, proof onemodels/shared#header-fixup
0x00504void *m_viewsHolds the views, 0x2c bytes each, a pointer after the fixupverified, proof onemodels/shared#header-fixup
0x00544uint32_tm_nColorsHolds the count of the colours, 0x38 bytes eachverified, proof onemodels/shared#header-fixup
0x00584void *m_colorsHolds the colours, 0x38 bytes each, a pointer after the fixupverified, proof onemodels/shared#header-fixup
0x005c4uint32_tm_nTexturesHolds the count of the textures, 0x10 bytes eachverified, proof onemodels/shared#header-fixup
0x00604void *m_texturesHolds the textures, 0x10 bytes each, a pointer after the fixupverified, proof onemodels/shared#header-fixup
0x00644uint32_tm_nTransparencyHolds the count of the transparency tracksverified, proof onemodels/shared#header-fixup
0x00684void *m_transparencyHolds the transparency tracks, a pointer after the fixupverified, proof onemodels/shared#header-fixup
0x006c4uint32_tm_nTextureFramesHolds the count of the texture frame tracksverified, proof onemodels/shared#header-fixup
0x00704void *m_textureFramesHolds the texture frame tracks, a pointer after the fixupverified, proof onemodels/shared#header-fixup
0x00744uint32_tm_nTextureTransformsHolds the count of the texture transforms, 0x54 bytes eachverified, proof onemodels/shared#header-fixup
0x00784void *m_textureTransformsHolds the texture transforms, 0x54 bytes each, a pointer after the fixupverified, proof onemodels/shared#header-fixup
0x007c4uint32_tm_nReplaceableLookupHolds the count of the replaceable texture lookupverified, proof onemodels/shared#header-fixup
0x00804void *m_replaceableLookupHolds the replaceable texture lookup, a pointer after the fixupverified, proof onemodels/shared#header-fixup
0x00844uint32_tm_nMaterialsHolds the count of the materials, 4 bytes eachverified, proof onemodels/shared#header-fixup
0x00884void *m_materialsHolds the materials, 4 bytes each, a pointer after the fixupverified, proof onemodels/shared#header-fixup
0x008c4uint32_tm_nBoneLookupHolds the count of the bone lookupverified, proof onemodels/shared#header-fixup
0x00904void *m_boneLookupHolds the bone lookup, a pointer after the fixupverified, proof onemodels/shared#header-fixup
0x00944uint32_tm_nTextureLookupHolds the count of the texture lookupverified, proof onemodels/shared#header-fixup
0x00984void *m_textureLookupHolds the texture lookup, a pointer after the fixupverified, proof onemodels/shared#header-fixup
0x009c4uint32_tm_nTextureUnitLookupHolds the count of the texture unit lookupverified, proof onemodels/shared#header-fixup
0x00a04void *m_textureUnitLookupHolds the texture unit lookup, a pointer after the fixupverified, proof onemodels/shared#header-fixup
0x00a44uint32_tm_nTransparencyLookupHolds the count of the transparency lookupverified, proof onemodels/shared#header-fixup
0x00a84void *m_transparencyLookupHolds the transparency lookup, a pointer after the fixupverified, proof onemodels/shared#header-fixup
0x00ac4uint32_tm_nTextureTransformLookupHolds the count of the texture transform lookupverified, proof onemodels/shared#header-fixup
0x00b04void *m_textureTransformLookupHolds the texture transform lookup, a pointer after the fixupverified, proof onemodels/shared#header-fixup
0x00b424float[6]m_boundsHolds the bounding box, minimum then maximumverified, proof onemodels/shared#header-fixup
0x00cc4floatm_boundsRadiusHolds the bounding radiusverified, proof onemodels/shared#header-fixup
0x00d024float[6]m_collisionBoundsHolds the collision boxverified, proof onemodels/shared#header-fixup
0x00e84floatm_collisionRadiusHolds the collision radiusverified, proof onemodels/shared#header-fixup
0x00ec4uint32_tm_nCollisionIndicesHolds the count of the collision indicesverified, proof onemodels/shared#header-fixup
0x00f04void *m_collisionIndicesHolds the collision indices, a pointer after the fixupverified, proof onemodels/shared#header-fixup
0x00f44uint32_tm_nCollisionVerticesHolds the count of the collision verticesverified, proof onemodels/shared#header-fixup
0x00f84void *m_collisionVerticesHolds the collision vertices, a pointer after the fixupverified, proof onemodels/shared#header-fixup
0x00fc4uint32_tm_nCollisionNormalsHolds the count of the collision normalsverified, proof onemodels/shared#header-fixup
0x01004void *m_collisionNormalsHolds the collision normals, a pointer after the fixupverified, proof onemodels/shared#header-fixup
0x01044uint32_tm_nAttachmentsHolds the count of the attachments, 0x30 bytes eachverified, proof onemodels/shared#header-fixup
0x01084void *m_attachmentsHolds the attachments, 0x30 bytes each, a pointer after the fixupverified, proof onemodels/shared#header-fixup
0x010c4uint32_tm_nAttachmentLookupHolds the count of the attachment lookupverified, proof onemodels/shared#header-fixup
0x01104void *m_attachmentLookupHolds the attachment lookup, a pointer after the fixupverified, proof onemodels/shared#header-fixup
0x01144uint32_tm_nEventsHolds the count of the events, 0x2c bytes eachverified, proof onemodels/shared#header-fixup
0x01184void *m_eventsHolds the events, 0x2c bytes each, a pointer after the fixupverified, proof onemodels/shared#header-fixup
0x011c4uint32_tm_nLightsHolds the count of the lights, 0xd4 bytes eachverified, proof onemodels/shared#header-fixup
0x01204void *m_lightsHolds the lights, 0xd4 bytes each, a pointer after the fixupverified, proof onemodels/shared#header-fixup
0x01244uint32_tm_nCamerasHolds the count of the cameras, 0x7c bytes eachverified, proof onemodels/shared#header-fixup
0x01284void *m_camerasHolds the cameras, 0x7c bytes each, a pointer after the fixupverified, proof onemodels/shared#header-fixup
0x012c4uint32_tm_nCameraLookupHolds the count of the camera lookupverified, proof onemodels/shared#header-fixup
0x01304void *m_cameraLookupHolds the camera lookup, a pointer after the fixupverified, proof onemodels/shared#header-fixup
0x01344uint32_tm_nRibbonsHolds the count of the ribbon emitters, 0xdc bytes eachverified, proof onemodels/shared#header-fixup
0x01384void *m_ribbonsHolds the ribbon emitters, 0xdc bytes each, a pointer after the fixupverified, proof onemodels/shared#header-fixup
0x013c4uint32_tm_nParticlesHolds the count of the particle emitters, 0x1f8 bytes eachverified, proof onemodels/shared#header-fixup
0x01404void *m_particlesHolds the particle emitters, 0x1f8 bytes each, a pointer after the fixupverified, proof onemodels/shared#header-fixup
0x01444uint32_tm_nCombinersHolds the count of the version-0x101 combine wordsverified, proof onemodels/render#texture-stages
0x01484uint16_t *m_combinersHolds the version-0x101 combine words, one per stage, a pointer after the fixupverified, proof onemodels/render#texture-stages