MREA (Metroid Prime 3): Difference between revisions
Jump to navigation
Jump to search
>Aruki mNo edit summary |
>Aruki m (→Header) |
||
Line 44: | Line 44: | ||
| u32 | | u32 | ||
| 4 | | 4 | ||
| '''Layer | | '''Layer count''' | ||
|- | |- | ||
| 0x40 | | 0x40 | ||
| u32 | | u32 | ||
| 4 | | 4 | ||
| '''Section | | '''Section count''' (SC) | ||
|- | |- | ||
| 0x44 | | 0x44 | ||
| u32 | | u32 | ||
| 4 | | 4 | ||
| '''Compressed | | '''Compressed block count''' | ||
|- | |- | ||
| 0x48 | | 0x48 | ||
| u32 | | u32 | ||
| 4 | | 4 | ||
| '''Section | | '''Section number count''' | ||
|- | |- | ||
| 0x4C | | 0x4C | ||
| u32[SC] | | u32[SC] | ||
| - | | - | ||
| '''Section | | '''Section numbers''' | ||
|- | |- | ||
| colspan=4 {{unknown|End of main header data; pad to 32 bytes before compressed section definitions}} | | colspan=4 {{unknown|End of main header data; pad to 32 bytes before compressed section definitions}} | ||
|} | |} | ||
==== Compressed | ==== Compressed Blocks ==== | ||
Compressed | Compressed blocks are defined in the same manner as Metroid Prime 2. The MREA format contains compressed blocks that can each contain a number of regular file sections within them. These blocks are compressed using segmented LZO1X-999 in Metroid Prime 3, and segmented zlib in Donkey Kong Country Returns. Compressed blocks are padded to 32 bytes, but their padding is located at the beginning of the block rather than the end, so it's required to account for the padding before you start decompressing. The compressed data is segmented, which means there's multiple segments of data that are compressed/decompressed separately. Each segment starts with a 16-bit size value. The size value is signed; a negative value indicates the segment is not compressed (this is done when compressing a segment doesn't reduce its size). Each segment is 0x4000 bytes large when decompressed (except the last one). | ||
Compressed | Compressed blocks are defined after the main header. After reading them, pad to 32 bytes before the section numbers portion of the header starts. | ||
{| class="wikitable" | {| class="wikitable" |