MREA (Metroid Prime 2): Difference between revisions

>Aruki
>Aruki
Line 102: Line 102:


=== Compressed Sections ===
=== Compressed Sections ===
Following the section sizes comes an array defining the file's compressed sections. Each definition is 0x10 bytes and is formatted like this:
 
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 sections are padded to 32 bytes, but their padding is located at the beginning of the section 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. Each segment is 0x4000 bytes large when decompressed (except the last one).
 
Compressed sections are defined after the main header. After reading them, pad to 32 bytes before the main file data starts.


{| class="wikitable"
{| class="wikitable"
Anonymous user