Mtar (Motion Archive) is an archive file which contains MGSV's animation files (.gani). There appears to be two slightly differing formats for .mtar files. The first format is very easy to read and extract files from. For example, TppPlayer2Facial.mtar is an Mtar Type 1. The second format is much more confusing with scattered animation chunks and .ganis that do not have headers. For example, player2_resident is an Mtar Type 2. The only way to see which type of Mtar a file is, is to open it in a hex editor. If the file list in the beginning has two lines for each file, it is a Type 2. If it only has one per file, it is a Type 1. Both formats are Little-Endian.
Mtar Type 1 Format (i.e. TppPlayer2Facial.mtar)
Mtar Type 1 Header
- 0x0 - 0x3 (32): Signature? 9C A8 FF 0B = Gzs, 72 2B 01 0C = Tpp
- 0x4 - 0x7 (32): Number of files. Each line starting at 0x20 seems to indicate a file.
- 0x8 - 0xB (32): Bone Group 1.
- 0xC - 0xF (32): Bone Group 2.
- 0x10 - 0x1F: Padding.
File declaring/listing begins at 0x20. All files in the list follow this format
- 0x20 - 0x27 (64): Hashed name of file. I.e. 63 0C 20 DA FA AF 53 FC = 3affada200c63.gani
- 0x28 - 0x2B (32): File location offset.
- 0x2C - 0x2F (32): File length.
Gani Type 1 File Format
- 0x0 - 0x3 (32): Signature (D2 A2 FC 0B).
- 0x4 - 0x7 (32): Unknown.
- 0x8 - 0xB (32): File length.
- 0xC - 0xF (32): Padding.
Mtar Type 2 Format (i.e. player2_resident.mtar)
Mtar Type 2 Header
- 0x0 - 0x3 (32): Signature? 72 2B 01 0C = Tpp
- 0x4 - 0x7 (32): Number of files. Each 2 lines starting at 0x20 to indicates a file.
- 0x8 - 0xB (32): Bone Group 1.
- 0xC - 0xF (32): Padding.
- 0x10 - 0x13 (32): Bone Group 2.
- 0x14 - 0x17 (32): Offset for main animation tracks' description. Signature (EF AA BD 4F).
- 0x18 - 0x1F (80): Padding.
A chunk with an unknown purpose will follow the main animation tracks' description. Known signatures can be 4B 53 E4 91 or 84 77 9A 3B. More possibilities for this signature may exist.
File declaring/listing begins at 0x20. All files in the list follow this format
- 0x20 - 0x27 (64): Hashed name of file. I.e. 63 0C 20 DA FA AF 53 FC = 3affada200c63.gani
- 0x28 - 0x2B (32): File location offset.
- 0x2C - 0x2D (16): File length divided by 10 (multiply by 10 to get the length).
- 0x2E - 0x2F (16): File length may appear here as well. If it does, the .gani file has an extra chunk (.exchnk) of animation.
- 0x30 - 0x31 (16): If the file has an .exchunk, its length will appear here. .exchunk data immediately follow the .gani file data.
- 0x32 - 0x37 (48): Padding.
- 0x38 - 0x3B (32): Offset for another chunk of animation data, tied to the .gani, at the end of the .mtar (.enchnk).
- 0x3C - 0x3F (32): Padding.