Skip to content

MAR, MCM

alice pellerin edited this page Feb 2, 2024 · 1 revision

MAR is an extremely simple archive format. Archived files aren't given names, and are referred to only by index.

               0x00          0x04          0x08
╭───────────────┼─────────────┼─────────────┼─────────────────────┬──────────────╮
│ Raw           │ 4D 41 52 00 │ 8B 01 00 00 │                     │              │
├───────────────┼─────────────┼─────────────┤                     │              │
│ Little-endian │ 0052414D    │ 0000018B    │ MCM file indexes... │ MCM files... │
├───────────────┼─────────────┼─────────────┤                     │              │
│ Formatted     │ "MAR"       │ 395         │                     │              │
╰───────────────┼─────────────┼─────────────┴─────────────────────┴──────────────╯
                ╰╴File Format ╰╴Number of MCM files

Source: model/battle/arc

MCM File Index

               0x00          0x04
╭───────────────┬─────────────┬─────────────╮
│ Raw           │ 60 0C 00 00 │ D4 06 00 00 │
├───────────────┼─────────────┼─────────────┤
│ Little-endian │ 00000C60    │ 000006D4    │
├───────────────┼─────────────┼─────────────┤
│ Formatted     │ 3,168       │ 1,748       │
╰───────────────┼─────────────┼─────────────╯
                │             ╰╴Decompressed size in bytes
                ╰╴MCM file offset (from MAR+0)

Source: model/battle/arc

MCM

MCM files are only found inside MAR archives, and they control the actual compression of files.

When creating an MCM file, the input is split into (usually 8kB) chunks, then compressed 0-2 times.

Code Compression type
0x00 None
0x01 RLE
0x02 LZSS
0x03 Huffman
               0x00          0x04          0x08          0x0C
╭───────────────┼─────────────┼─────────────┼─────────────┼─────────────╮
│ Raw           │ 4D 43 4D 00 │ D4 06 00 00 │ 00 20 00 00 │ 01 00 00 00 │
├───────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
│ Little-endian │ 004D434D    │ 000006D4    │ 00002000    │ 00000001    │
├───────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
│ Formatted     │ "MCM"       │ 1,748       │ 8,192       │ 1           │
╰───────────────┼─────────────┼─────────────┼─────────────┼─────────────╯
                ╰╴File format │             │             ╰╴Number of chunks
                              │             ╰╴Max size per chunk in bytes, usually 8kB
                              ╰╴Decompressed size in bytes

               0x10   0x11   0x12    0x14
╭───────────────┼──────┼──────┼───────┼──────────────────┬─────────────┬───────────╮
│ Raw           │ 02   │ 00   │ 00 00 │                  │ 78 02 00 00 │           │
├───────────────┼──────┼──────┼───────┤                  ├─────────────┤           │
│ Little-endian │ 02   │ 00   │ 0000  │ Chunk offsets... │ 00000278    │ Chunks... │
├───────────────┼──────┼──────┼───────┤                  ├─────────────┤           │
│ Formatted     │ LZSS │ None │ 0     │                  │ 632         │           │
╰───────────────┼──────┼──────┼───────┴──────────────────┼─────────────┴───────────╯
                │      │      ╰╴Padding                  ╰╴End of file offset (from MCM+0)
                │      ╰╴Compression type 2
                ╰╴Compression type 1

Source: model/battle/arc

Chunk offset

╭───────────────┬─────────────╮
│ Raw           │ 1C 00 00 00 │
├───────────────┼─────────────┤
│ Little-endian │ 0000001C    │
├───────────────┼─────────────┤
│ Formatted     │ 28          │
╰───────────────┼─────────────╯
                ╰╴Offset to chunk (from MCM+0)

Source: model/battle/arc

Additional notes

Most MAR archives only contain one MCM file. A common pattern is to have one 'table' MAR archive, with a large number of MCM files, and many index MAR archives with one MCM file each (see index files).

Found

Basically everywhere.

Resources

https://github.com/jianmingyong/Fossil-Fighters-Tool/wiki/Game-Archive-Header

Clone this wiki locally