MREA (Metroid Prime 2)

The MREA format defines areas (rooms) in Metroid Prime 2. It serves the same purpose as the MREA files from Prime 1, but in Echoes it was updated with new features, including some new data sections and the ability to compress most of the data in the file.

Format
Like CMDL, MREA files are split up into a number of 32-byte aligned sections. Every section both starts and ends on a 32-byte boundary. These are used to separate different parts of the file; different types of sections typically indicate different sets of data. The header declares the section count and the size of each one; using these is the only way to navigate the file.

Following the section sizes comes an array defining the file's compressed cluster. Each definition is 0x10 bytes and is formatted like this:

{{ class="wikitable" ! Offset ! Size ! Description
 * 0x0
 * 4
 * Buffer size (usually 0x120 bytes bigger than uncompressed size)
 * 0x4
 * 4
 * Uncompressed size
 * 0x8
 * 4
 * Compressed size (if 0, that indicates an uncompressed cluster)
 * 0xC
 * 4
 * Section count (the number of regular sections contained in this cluster)
 * 0x10
 * colspan=2 | Cluster definition end
 * }
 * Section count (the number of regular sections contained in this cluster)
 * 0x10
 * colspan=2 | Cluster definition end
 * }
 * }