Code:
##########################################################################################################################
---- General format ----
FORM
-> 'MAD ' chunk
-> -> NAME chunk
-> -> VERS chunk
-> -> INFO chunk
-> -> STRI chunk
-> -> MARK chunk
-> -> CURV chunk
---- end ----
---- NAME FORM ----
"NAME"
<length of this form, in bytes, BE>, {ulong}
<name of this MAD, this is "Homeworld2 MAD File"
---- end ----
---- VERS FORM ----
"VERS"
<length of this form, in bytes, BE>, {ulong}
<version, this is 260, consider it as 0x04010000, LE>, ulong
---- end ----
---- INFO FORM ----
"INFO"
<length of this form, in bytes, BE>, {ulong}
<fps, WHOLE NUMBER, LE>, {ulong}
<number of Anim MARKers, LE>, {ulong}
<number of Anim CURVes, LE>, {ulong}
<number of joint maps, LE>, {ulong}
<number of indices (?), LE>, {ulong}
---- end ----
---- STRI FORM ----
"STRI"
<length of this form, in bytes, BE>, {ulong}
<null terminated strings ( NOT starting with a null,. AND LAST ONE HAS A NULL )>, {char}
---- end ----
---- MARK FORM ----
"MARK"
<length of this form, in bytes, BE>, {ulong}
for each marker ( defined in INFO form):
<start time, LE>, {float}
<end time, LE>, {float}
<loop start time, LE>, {float}
<loop end time, LE>, {float}
<number of joints animated, LE>, {ulong}
for each joint:
<name, this is String Block Offset in the STRI form, starting zero, and ending is first NULL, LE>, {ulong}
<number of channels animated, LE>, {ulong}
for each channel:
<number of indices, LE>, {ulong}
---- end ----
---- CURV FORM ----
"CURV"
<length of this form, in bytes, BE>, {ulong}
for each animation CURV:
<name, this is String Block Offset in the STRI form, starting zero, and ending is first NULL, LE>, {ulong}
<number of key-frames, LE>, {ulong}
for each keyframe:
<time, LE>, {double}
<value, LE>, {double}
<inTangentX, LE>, {float}
<inTangentY, LE>, {float}
<outTangentX, LE>, {float}
<outTangentY, LE>, {float}
<Pre-Infinity, LE>, {float}
<Post-Infinity, LE>, {float}
---- end ----
##########################################################################################################################