MREA (Metroid Prime 2): Difference between revisions
Jump to navigation
Jump to search
→Format
>Aruki |
>Aruki (→Format) |
||
Line 10: | Line 10: | ||
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. | 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. | ||
These are the sections in each MREA file, in the order they appear in the file: | |||
{| class="wikitable" | |||
! Identifier | |||
! Name | |||
|- | |||
| {{none}} | |||
| [[#World Geometry|World Geometry]] | |||
|- | |||
| {{none}} | |||
| [[#Unknown Section 1|Unknown Section 1]] | |||
|- | |||
| <code>SCLY</code> | |||
| Script Layers | |||
|- | |||
| <code>SCGN</code> | |||
| Generated Script Objects | |||
|- | |||
| <code>0xDEAFBABE</code> | |||
| Collision | |||
|- | |||
| {{none}} | |||
| [[#MREA (Metroid Prime)#Unknown Section|Unknown Section 2]] | |||
|- | |||
| <code>0xBABEDEAD</code> | |||
| Lights | |||
|- | |||
| <code>VISI</code> | |||
| Visibility Tree | |||
|- | |||
| {{none}} | |||
| [[#Path|Path]] | |||
|- | |||
| {{none}} | |||
| [[#Portal Area|Portal Area]] | |||
|- | |||
| {{none}} | |||
| [[#Static Geometry Map|Static Geometry Map]] | |||
|} | |||
=== Header === | === Header === | ||
Line 143: | Line 183: | ||
|} | |} | ||
=== Compressed Blocks === | ==== Compressed Blocks ==== | ||
The MREA format contains compressed blocks that can each contain a number of regular file sections within them. The data defining these blocks is at the end of the MREA header; the beginning and end of the compressed block list is padded to 32 bytes. The decompressed size of a block is capped at 0x20000 bytes; each section contains as many MREA sections as it can fit under that size limit. There are two exceptions: | The MREA format contains compressed blocks that can each contain a number of regular file sections within them. The data defining these blocks is at the end of the MREA header; the beginning and end of the compressed block list is padded to 32 bytes. The decompressed size of a block is capped at 0x20000 bytes; each section contains as many MREA sections as it can fit under that size limit. There are two exceptions: | ||
Line 189: | Line 229: | ||
The actual data contained in these blocks is 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. Thee data is compressed using segmented LZO1X-999; the "segmented" part 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). | The actual data contained in these blocks is 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. Thee data is compressed using segmented LZO1X-999; the "segmented" part 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). | ||
=== | === World Geometry === | ||
''See [[MREA (Metroid Prime)#World Geometry]], [[Materials (Metroid Prime)]] and [[Geometry (Metroid Prime)]]'' | ''See [[MREA (Metroid Prime)#World Geometry]], [[Materials (Metroid Prime)]] and [[Geometry (Metroid Prime)]]'' | ||
Largely [[MREA (Metroid Prime)#World Geometry|the same as Prime 1]]. There are two new sections to watch out for on each world model (described on the [[Geometry (Metroid Prime)]] page). There's two sections that are now grouped under the same section number as world geometry. | Largely [[MREA (Metroid Prime)#World Geometry|the same as Prime 1]]. There are two new sections to watch out for on each world model (described on the [[Geometry (Metroid Prime)]] page). There's two sections that are now grouped under the same section number as world geometry. | ||
=== Area Octree === | |||
The [[MREA (Metroid Prime)#Area Octree|area octree]] section is back from Prime 1, but no longer has its own section number - it's now grouped under the same section number as world geometry. | The [[MREA (Metroid Prime)#Area Octree|area octree]] section is back from Prime 1, but no longer has its own section number - it's now grouped under the same section number as world geometry. | ||
=== Surface Group Bounding Boxes === | |||
This is a new section introduced in Metroid Prime 2, which is grouped under the world geometry section number and appears after the area octree. It contains an array of a structure that provides the bounding box for every surface group. The first entry in the array has the combined bounding box for all of the world geometry in the entire area, then each surface group is listed in order. | This is a new section introduced in Metroid Prime 2, which is grouped under the world geometry section number and appears after the area octree. It contains an array of a structure that provides the bounding box for every surface group. The first entry in the array has the combined bounding box for all of the world geometry in the entire area, then each surface group is listed in order. | ||
Line 259: | Line 259: | ||
|} | |} | ||
==== Group Bounds Entry ==== | |||
{| class="wikitable" | {| class="wikitable" | ||
Line 302: | Line 302: | ||
|} | |} | ||
=== Unknown Section 1 === | |||
This section appears to be related to world geometry. | This section appears to be related to world geometry. | ||
Line 330: | Line 330: | ||
|} | |} | ||
=== Path === | |||
This section only contains a single [[PATH (File Format)|PATH]] asset ID. | This section only contains a single [[PATH (File Format)|PATH]] asset ID. | ||
Line 346: | Line 346: | ||
|} | |} | ||
=== Portal Area === | |||
This section only contains a single [[PTLA (File Format)|PTLA]] asset ID. | This section only contains a single [[PTLA (File Format)|PTLA]] asset ID. | ||
Line 362: | Line 362: | ||
|} | |} | ||
=== Static Geometry Map === | |||
This section only contains a single [[EGMC (File Format)|EGMC]] asset ID. | This section only contains a single [[EGMC (File Format)|EGMC]] asset ID. |