<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://www.metroid2002.com/retromodding/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Aruki</id>
		<title>Retro Modding Wiki - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="http://www.metroid2002.com/retromodding/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Aruki"/>
		<link rel="alternate" type="text/html" href="http://www.metroid2002.com/retromodding/wiki/Special:Contributions/Aruki"/>
		<updated>2026-06-18T14:00:23Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.24.1</generator>

	<entry>
		<id>http://www.metroid2002.com/retromodding/index.php?title=MLVL_(File_Format)&amp;diff=1990</id>
		<title>MLVL (File Format)</title>
		<link rel="alternate" type="text/html" href="http://www.metroid2002.com/retromodding/index.php?title=MLVL_(File_Format)&amp;diff=1990"/>
				<updated>2019-08-10T16:13:53Z</updated>
		
		<summary type="html">&lt;p&gt;Aruki: /* Area Dependencies */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The '''MLVL format''' defines worlds in the Metroid Prime trilogy and Donkey Kong Country Returns. While the [[MREA (File Format)|MREA format]] defines individual areas, the MLVL is what links together all the areas to create a single cohesive world.&lt;br /&gt;
&lt;br /&gt;
{{research|minor|There's a couple unknown values in this format, but they all seem to have constant values.}}&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Format ==&lt;br /&gt;
&lt;br /&gt;
The format largely defines properties related to each area in general and how they link together, as well as things that apply to the world on a global scale across all areas, such as the skybox.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
! MP1&lt;br /&gt;
! MP2&lt;br /&gt;
! MP3&lt;br /&gt;
! DKCR&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Magic'''&lt;br /&gt;
| Always &amp;lt;code&amp;gt;0xDEAFBABE&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Version'''&lt;br /&gt;
| [[#Version|See below]]&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| Asset ID ([[STRG (File Format)|STRG]])&lt;br /&gt;
| 1&lt;br /&gt;
| '''World Name ID'''&lt;br /&gt;
| [[STRG (File Format)|STRG]] file for the world name.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| Asset ID ([[STRG (File Format)|STRG]])&lt;br /&gt;
| 1&lt;br /&gt;
| '''Dark World Name ID'''&lt;br /&gt;
| [[STRG (File Format)|STRG]] file for the Dark World name.&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Temple Key World Index'''&lt;br /&gt;
| Controls which temple key icons appear on the map screen. Appears in Prime 3 but always 0.&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| bool&lt;br /&gt;
| 1&lt;br /&gt;
| '''Has Time Attack'''&lt;br /&gt;
| Indicates whether this world has a Time Attack mode. '''If false, the next five values are not present.'''&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| string&lt;br /&gt;
| 1&lt;br /&gt;
| '''Level Number'''&lt;br /&gt;
| String of the world/level number; for example, &amp;quot;1-1&amp;quot;. Purpose unknown.&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| float&lt;br /&gt;
| 1&lt;br /&gt;
| '''Time Attack Bronze Time'''&lt;br /&gt;
| Target time for a bronze medal in Time Attack.&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| float&lt;br /&gt;
| 1&lt;br /&gt;
| '''Time Attack Silver Time'''&lt;br /&gt;
| Target time for a silver medal in Time Attack.&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| float&lt;br /&gt;
| 1&lt;br /&gt;
| '''Time Attack Gold Time'''&lt;br /&gt;
| Target time for a gold medal in Time Attack.&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| float&lt;br /&gt;
| 1&lt;br /&gt;
| '''Time Attack Shiny Gold Time'''&lt;br /&gt;
| Target time for a shiny gold medal in Time Attack.&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| Asset ID ([[SAVW (File Format)|SAVW]])&lt;br /&gt;
| 1&lt;br /&gt;
| '''World Save Info ID'''&lt;br /&gt;
| Asset ID for this world's [[SAVW (File Format)|SAVW]] file.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| Asset ID ([[CMDL (File Format)|CMDL]])&lt;br /&gt;
| 1&lt;br /&gt;
| '''Default Skybox ID'''&lt;br /&gt;
| [[CMDL (File Format)|CMDL]] file for this world's default skybox model. This can be overridden per-area by AreaAttributes objects.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Memory Relay Count'''&lt;br /&gt;
| Count of all outgoing connections from Memory Relay instances in this world.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| [[#Memory Relay|Memory Relay]]&lt;br /&gt;
| ''Memory Relay Count''&lt;br /&gt;
| '''Memory Relay Array'''&lt;br /&gt;
| Array describing all outgoing Memory Relay connections in this world. Memory Relays connected to multiple objects are listed multiple times.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Area Count'''&lt;br /&gt;
| Count of areas in this world.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| Always 1?&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| [[#Area|Area]]&lt;br /&gt;
| ''Area Count''&lt;br /&gt;
| '''Area Array'''&lt;br /&gt;
| Array defining all areas that appear in this world.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| Asset ID ([[MAPW (File Format)|MAPW]])&lt;br /&gt;
| 1&lt;br /&gt;
| '''World Map ID'''&lt;br /&gt;
| ID of this world's [[MAPW (File Format)|MAPW]] file.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| u8&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| This is presumably the same unknown value as at the beginning of the [[Scriptable Layers (Metroid Prime)|SCLY]] format. Always 0.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Script Instance Count'''&lt;br /&gt;
| The MLVL format embeds a script layer. This script layer is used in the MP1 demo for storing Dock instances, but it's unused in all retail builds, so this is always 0.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Audio Group Count'''&lt;br /&gt;
| Count of all audio groups used in this world.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| [[#Audio Group|Audio Group]]&lt;br /&gt;
| ''Audio Group Count''&lt;br /&gt;
| '''Audio Group Array'''&lt;br /&gt;
| Array describing all audio groups used in this world.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| string&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| Always empty, so the only value that ever appears here is the terminating 0.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Area Count'''&lt;br /&gt;
| Will be equal to the earlier area count.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| [[#Area Layer Flags|Area Layer Flags]]&lt;br /&gt;
| ''Area Count''&lt;br /&gt;
| '''Area Layer Flags'''&lt;br /&gt;
| This array initializes the default active state for all script layers in each area.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Layer Name Count'''&lt;br /&gt;
| Count of layer names in the next array.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| string&lt;br /&gt;
| ''Layer Name Count''&lt;br /&gt;
| '''Layer Name Array'''&lt;br /&gt;
| Array of all layer names in the world.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Layer GUID Count'''&lt;br /&gt;
| Count of layer GUIDs in the next array.&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| [[GUID]]&lt;br /&gt;
| ''Layer GUID Count''&lt;br /&gt;
| '''Layer GUID Array'''&lt;br /&gt;
| Array of GUIDs for each layer. These GUIDs are responsible for storing the layer's ''Active'' state in the save file and are referenced by ScriptLayerController objects.&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Area Count'''&lt;br /&gt;
| Identical to the previous two area counts.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| ''Area Count''&lt;br /&gt;
| '''Area Layer Name Offset Array'''&lt;br /&gt;
| Each value is an offset into the layer name array and points to where the layer names for each area begins.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| colspan=8 {{unknown|End of file}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Version ===&lt;br /&gt;
&lt;br /&gt;
These are the known version numbers:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! ID&lt;br /&gt;
! Game&lt;br /&gt;
|-&lt;br /&gt;
| 0xD&lt;br /&gt;
| Metroid Prime Demo&lt;br /&gt;
|-&lt;br /&gt;
| 0x11&lt;br /&gt;
| Metroid Prime&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| Metroid Prime 2 Demo&lt;br /&gt;
|-&lt;br /&gt;
| 0x17&lt;br /&gt;
| Metroid Prime 2&lt;br /&gt;
|-&lt;br /&gt;
| 0x19&lt;br /&gt;
| Metroid Prime 3&lt;br /&gt;
|-&lt;br /&gt;
| 0x1B&lt;br /&gt;
| Donkey Kong Country Returns&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Memory Relay ===&lt;br /&gt;
&lt;br /&gt;
This structure only appears in Prime 1. It describes an outgoing connection from a Memory Relay to another script instance. Any Memory Relays connected to multiple objects will appear in the array multiple times.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| u32&lt;br /&gt;
| '''Memory Relay Instance ID'''&lt;br /&gt;
| Instance ID of the sender Memory Relay.&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| u32&lt;br /&gt;
| '''Target Instance ID'''&lt;br /&gt;
| Instance ID of the receiver object.&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| u16&lt;br /&gt;
| '''Message'''&lt;br /&gt;
| Script message sent to the receiver object.&lt;br /&gt;
|-&lt;br /&gt;
| 0xA&lt;br /&gt;
| bool&lt;br /&gt;
| '''Active'''&lt;br /&gt;
| Whether this Memory Relay object is active by default; almost always 0.&lt;br /&gt;
|-&lt;br /&gt;
| 0xB&lt;br /&gt;
| colspan=3 {{unknown|End of Memory Relay connection}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Area ===&lt;br /&gt;
&lt;br /&gt;
This structure defines a single area and describes its position in the world and how it connects to other areas.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
! MP1&lt;br /&gt;
! MP2&lt;br /&gt;
! MP3&lt;br /&gt;
! DKCR&lt;br /&gt;
|-&lt;br /&gt;
| Asset ID ([[STRG (File Format)|STRG]])&lt;br /&gt;
| 1&lt;br /&gt;
| '''Area Name ID'''&lt;br /&gt;
| [[STRG (File Format)|STRG]] ID for the area name.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| float&lt;br /&gt;
| 12&lt;br /&gt;
| '''Area Transform'''&lt;br /&gt;
| Area's transform matrix. Most area data is pre-transformed, but there are a few things that need to be transformed by this matrix.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| float&lt;br /&gt;
| 6&lt;br /&gt;
| '''Area Bounding Box'''&lt;br /&gt;
| This is the bounding box of the area's collision mesh and is equivalent to the bounding box found in the [[MREA (File Format)|MREA]] collision section.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| Asset ID ([[MREA (File Format)|MREA]])&lt;br /&gt;
| 1&lt;br /&gt;
| '''Area MREA ID'''&lt;br /&gt;
| ID of this area's [[MREA (File Format)|MREA]] file.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| Asset ID&lt;br /&gt;
| 1&lt;br /&gt;
| '''Internal Area ID'''&lt;br /&gt;
| Doesn't actually refer to an asset, but has the same length as an asset ID. This ID is used internally by some things to refer to this area, such as Script Layer Controllers.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Attached Area Count'''&lt;br /&gt;
| Count of areas attached to this one.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| u16&lt;br /&gt;
| ''Attached Area Count''&lt;br /&gt;
| '''Attached Area Index Array'''&lt;br /&gt;
| Array of area indices attached to this one.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| [[#Area Dependencies|Area Dependencies]]&lt;br /&gt;
| 1&lt;br /&gt;
| '''Dependencies'''&lt;br /&gt;
| Asset dependencies in this area. See below for details. Starting in Prime 3, this section has been moved inside the [[MREA (File Format)|MREA]] file.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Dock Count'''&lt;br /&gt;
| Count of Dock instances in this area.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| [[#Dock|Dock]]&lt;br /&gt;
| ''Dock Count''&lt;br /&gt;
| '''Dock Array'''&lt;br /&gt;
| Array describing all docks in this area.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| [[#Area Module Dependencies|Area Module Dependencies]]&lt;br /&gt;
| 1&lt;br /&gt;
| '''Module Dependencies'''&lt;br /&gt;
| REL module dependencies in this area. See below for details. The equivalent section in Prime 3 and DKCR describing RSO modules has been moved inside the [[MREA (File Format)|MREA]] format.&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| Always 0?&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| string&lt;br /&gt;
| 1&lt;br /&gt;
| '''Internal Area Name'''&lt;br /&gt;
| Internal name of this area. This name will be used ingame on the map screen if no ''Area Name ID'' is specified, prefixed with &amp;quot;!!&amp;quot;.&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| colspan=8 {{unknown|End of area}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Area Dependencies ====&lt;br /&gt;
&lt;br /&gt;
This is a data chunk appearing in the area definition in Metroid Prime 1 and 2 that lists all assets needed to load the area. It's extremely important that this list be optimized and complete, as all assets listed here will be perpetually kept in memory as long as the area itself is in memory; the list also specifies the order that assets are loaded in, so '''it must be grouped by load order to roughly match the [[PAK (File Format)|PAK]] file for optimized load times'''. Assets that are missing will still be dynamically loaded after the area itself is loaded, but this will cause the game to freeze up until the load is finished. There are a few exceptions that are excluded from this list in the original game files (and should be excluded in custom MLVLs as well to avoid out-of-memory crashes):&lt;br /&gt;
&lt;br /&gt;
* [[SCAN (File Format)|SCAN]] files and their dependencies are not included in the list in MP1. These are loaded dynamically after the area itself is finished loading, presumably so that scan dependencies are not kept in memory when the scan isn't actually in use. In MP2, SCANs are actually included in the list but their dependencies aren't.&lt;br /&gt;
* [[ANCS (File Format)|ANCS]] per-character dependencies for PlayerActor script instances are not included; this allows the game to avoid keeping assets in memory for suits that the player doesn't have. The exception is the Empty Suit character (character index 5 in MP1, and index 3 in MP2), which is a low-memory-overhead character that allows for the list to include all common assets that are stored in the file per-character (such as particle effects).&lt;br /&gt;
* The skybox model and its dependencies are not included.&lt;br /&gt;
&lt;br /&gt;
The dependency list is split by layer; after the dependencies itself, an array of offsets into the dependency list is provided that allows the game to only load assets for layers that are currently active. The last offset points to all common resources used by the area that aren't layer-specific. With that in mind, every layer needs to have a full list of its required assets even if they're also used by other layers. There's no harm in including an asset multiple times, as if an asset is already in memory then it'll simply be skipped over.&lt;br /&gt;
&lt;br /&gt;
This data chunk still exists in Prime 3 and DKCR, but it's been moved inside the [[MREA (File Format)|MREA]] format.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| Always 0?&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Dependency Count'''&lt;br /&gt;
| Count of dependencies.&lt;br /&gt;
|-&lt;br /&gt;
| [[#Dependency|Dependency]]&lt;br /&gt;
| ''Dependency Count''&lt;br /&gt;
| '''Dependency Array'''&lt;br /&gt;
| Array of all asset dependencies in this area.&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Dependency Offset Count'''&lt;br /&gt;
| Count of dependency offsets. This will be equal to the area script layer count + 1.&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| ''Dependency Offset Count''&lt;br /&gt;
| '''Dependency Offset Array'''&lt;br /&gt;
| Array of offsets into the dependency array. There is one offset per script layer, with the offset referring to the index of that layer's first dependency. There is a final extra offset that points to area dependencies that are not layer-specific.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== Dependency =====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| Asset ID&lt;br /&gt;
| 1&lt;br /&gt;
| '''Dependency Asset ID'''&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| char&lt;br /&gt;
| 4&lt;br /&gt;
| '''Dependency Asset Type'''&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Dock ====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Connecting Dock Count'''&lt;br /&gt;
| Count of docks connecting to this one. Typically 1 (but there are docks in Prime 3 that connect to multiple areas).&lt;br /&gt;
|-&lt;br /&gt;
| [[#Connecting Dock|Connecting Dock]]&lt;br /&gt;
| ''Connecting Dock Count''&lt;br /&gt;
| '''Connecting Dock Array'''&lt;br /&gt;
| Array describing all docks connected to this one.&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Dock Coordinate Count'''&lt;br /&gt;
| Array of dock coordinates in the next array.&lt;br /&gt;
|-&lt;br /&gt;
| Vector3&lt;br /&gt;
| ''Dock Coordinate Count''&lt;br /&gt;
| '''Dock Coordinates'''&lt;br /&gt;
| Exact purpose/function of this is not known yet.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== Connecting Dock =====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| u32&lt;br /&gt;
| '''Area Index'''&lt;br /&gt;
| Index of the area this dock is in.&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| u32&lt;br /&gt;
| '''Dock Index'''&lt;br /&gt;
| Index of this dock within its area.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Area Module Dependencies ====&lt;br /&gt;
&lt;br /&gt;
This is a data chunk appearing in the area definitions that describes all REL modules that must be linked in for this area to run. These are tied to script objects. The list is split per-layer so that only modules being used by the active layer are linked in; modules will appear once in the list for each layer that uses it. After the REL list, there is an array of offsets that points to the starting index in the list for each script layer, similar to the regular area dependencies list. For an unknown reason, the offsets list contains two offsets per layer. The first one refers to the layer's start index while the second one is usually empty, which effectively makes it an end index.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''REL Module Count'''&lt;br /&gt;
| Count of REL modules in the next array.&lt;br /&gt;
|-&lt;br /&gt;
| string&lt;br /&gt;
| ''REL Module Count''&lt;br /&gt;
| '''REL Module Array'''&lt;br /&gt;
| REL modules used by this area. Each array entry is the filename of a .REL module.&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''REL Offset Count'''&lt;br /&gt;
| Count of REL offsets in the next array. Should be equal to the area script layer count * 2.&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| ''REL Offset Count''&lt;br /&gt;
| '''REL Offset Array'''&lt;br /&gt;
| Array of offsets into the ''REL Module Array''. There are two offsets per script layer, with the first one being that layer's start index and the second one effectively being that layer's end index.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Audio Group ===&lt;br /&gt;
&lt;br /&gt;
This structure is only present in Prime 1 and describes an [[AGSC (File Format)|AGSC]] file being used in this world.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| u32&lt;br /&gt;
| '''Group ID'''&lt;br /&gt;
| Group ID for this audio group. This is the same value that can be found in the Project chunk in the referenced [[AGSC (File Format)|AGSC]] file.&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| Asset ID ([[AGSC (File Format)|AGSC]])&lt;br /&gt;
| '''AGSC ID'''&lt;br /&gt;
| The [[AGSC (File Format)|AGSC]] file for this audio group.&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| colspan=3 {{unknown|End of audio group definition}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Area Layer Flags ===&lt;br /&gt;
&lt;br /&gt;
This is a small structure that determines which areas are active by default. It contains a layer count and then a 64-bit flag, with each bit corresponding to a particular layer; if the bit is set, then the layer will be active on a new save file. The low-order bits correspond to the lower layer indices. Bits for layers that don't exist are defaulted to on.&lt;br /&gt;
&lt;br /&gt;
Note that due to the size of these flags as well as a few other pieces of data in other formats, the maximum number of layers that can be contained in a single area is 64.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| u32&lt;br /&gt;
| '''Layer Count'''&lt;br /&gt;
| Count of layers in this area.&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| u64&lt;br /&gt;
| '''Layer Flags'''&lt;br /&gt;
| See above for a description of how these work.&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| colspan=3 {{unknown|End of area layer flags}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:File Formats]]&lt;br /&gt;
[[Category:Metroid Prime]]&lt;br /&gt;
[[Category:Metroid Prime 2: Echoes]]&lt;br /&gt;
[[Category:Metroid Prime 3: Corruption]]&lt;br /&gt;
[[Category:Donkey Kong Country Returns]]&lt;/div&gt;</summary>
		<author><name>Aruki</name></author>	</entry>

	<entry>
		<id>http://www.metroid2002.com/retromodding/index.php?title=MLVL_(File_Format)&amp;diff=1989</id>
		<title>MLVL (File Format)</title>
		<link rel="alternate" type="text/html" href="http://www.metroid2002.com/retromodding/index.php?title=MLVL_(File_Format)&amp;diff=1989"/>
				<updated>2019-08-09T20:28:46Z</updated>
		
		<summary type="html">&lt;p&gt;Aruki: /* Memory Relay */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The '''MLVL format''' defines worlds in the Metroid Prime trilogy and Donkey Kong Country Returns. While the [[MREA (File Format)|MREA format]] defines individual areas, the MLVL is what links together all the areas to create a single cohesive world.&lt;br /&gt;
&lt;br /&gt;
{{research|minor|There's a couple unknown values in this format, but they all seem to have constant values.}}&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Format ==&lt;br /&gt;
&lt;br /&gt;
The format largely defines properties related to each area in general and how they link together, as well as things that apply to the world on a global scale across all areas, such as the skybox.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
! MP1&lt;br /&gt;
! MP2&lt;br /&gt;
! MP3&lt;br /&gt;
! DKCR&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Magic'''&lt;br /&gt;
| Always &amp;lt;code&amp;gt;0xDEAFBABE&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Version'''&lt;br /&gt;
| [[#Version|See below]]&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| Asset ID ([[STRG (File Format)|STRG]])&lt;br /&gt;
| 1&lt;br /&gt;
| '''World Name ID'''&lt;br /&gt;
| [[STRG (File Format)|STRG]] file for the world name.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| Asset ID ([[STRG (File Format)|STRG]])&lt;br /&gt;
| 1&lt;br /&gt;
| '''Dark World Name ID'''&lt;br /&gt;
| [[STRG (File Format)|STRG]] file for the Dark World name.&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Temple Key World Index'''&lt;br /&gt;
| Controls which temple key icons appear on the map screen. Appears in Prime 3 but always 0.&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| bool&lt;br /&gt;
| 1&lt;br /&gt;
| '''Has Time Attack'''&lt;br /&gt;
| Indicates whether this world has a Time Attack mode. '''If false, the next five values are not present.'''&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| string&lt;br /&gt;
| 1&lt;br /&gt;
| '''Level Number'''&lt;br /&gt;
| String of the world/level number; for example, &amp;quot;1-1&amp;quot;. Purpose unknown.&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| float&lt;br /&gt;
| 1&lt;br /&gt;
| '''Time Attack Bronze Time'''&lt;br /&gt;
| Target time for a bronze medal in Time Attack.&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| float&lt;br /&gt;
| 1&lt;br /&gt;
| '''Time Attack Silver Time'''&lt;br /&gt;
| Target time for a silver medal in Time Attack.&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| float&lt;br /&gt;
| 1&lt;br /&gt;
| '''Time Attack Gold Time'''&lt;br /&gt;
| Target time for a gold medal in Time Attack.&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| float&lt;br /&gt;
| 1&lt;br /&gt;
| '''Time Attack Shiny Gold Time'''&lt;br /&gt;
| Target time for a shiny gold medal in Time Attack.&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| Asset ID ([[SAVW (File Format)|SAVW]])&lt;br /&gt;
| 1&lt;br /&gt;
| '''World Save Info ID'''&lt;br /&gt;
| Asset ID for this world's [[SAVW (File Format)|SAVW]] file.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| Asset ID ([[CMDL (File Format)|CMDL]])&lt;br /&gt;
| 1&lt;br /&gt;
| '''Default Skybox ID'''&lt;br /&gt;
| [[CMDL (File Format)|CMDL]] file for this world's default skybox model. This can be overridden per-area by AreaAttributes objects.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Memory Relay Count'''&lt;br /&gt;
| Count of all outgoing connections from Memory Relay instances in this world.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| [[#Memory Relay|Memory Relay]]&lt;br /&gt;
| ''Memory Relay Count''&lt;br /&gt;
| '''Memory Relay Array'''&lt;br /&gt;
| Array describing all outgoing Memory Relay connections in this world. Memory Relays connected to multiple objects are listed multiple times.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Area Count'''&lt;br /&gt;
| Count of areas in this world.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| Always 1?&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| [[#Area|Area]]&lt;br /&gt;
| ''Area Count''&lt;br /&gt;
| '''Area Array'''&lt;br /&gt;
| Array defining all areas that appear in this world.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| Asset ID ([[MAPW (File Format)|MAPW]])&lt;br /&gt;
| 1&lt;br /&gt;
| '''World Map ID'''&lt;br /&gt;
| ID of this world's [[MAPW (File Format)|MAPW]] file.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| u8&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| This is presumably the same unknown value as at the beginning of the [[Scriptable Layers (Metroid Prime)|SCLY]] format. Always 0.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Script Instance Count'''&lt;br /&gt;
| The MLVL format embeds a script layer. This script layer is used in the MP1 demo for storing Dock instances, but it's unused in all retail builds, so this is always 0.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Audio Group Count'''&lt;br /&gt;
| Count of all audio groups used in this world.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| [[#Audio Group|Audio Group]]&lt;br /&gt;
| ''Audio Group Count''&lt;br /&gt;
| '''Audio Group Array'''&lt;br /&gt;
| Array describing all audio groups used in this world.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| string&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| Always empty, so the only value that ever appears here is the terminating 0.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Area Count'''&lt;br /&gt;
| Will be equal to the earlier area count.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| [[#Area Layer Flags|Area Layer Flags]]&lt;br /&gt;
| ''Area Count''&lt;br /&gt;
| '''Area Layer Flags'''&lt;br /&gt;
| This array initializes the default active state for all script layers in each area.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Layer Name Count'''&lt;br /&gt;
| Count of layer names in the next array.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| string&lt;br /&gt;
| ''Layer Name Count''&lt;br /&gt;
| '''Layer Name Array'''&lt;br /&gt;
| Array of all layer names in the world.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Layer GUID Count'''&lt;br /&gt;
| Count of layer GUIDs in the next array.&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| [[GUID]]&lt;br /&gt;
| ''Layer GUID Count''&lt;br /&gt;
| '''Layer GUID Array'''&lt;br /&gt;
| Array of GUIDs for each layer. These GUIDs are responsible for storing the layer's ''Active'' state in the save file and are referenced by ScriptLayerController objects.&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Area Count'''&lt;br /&gt;
| Identical to the previous two area counts.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| ''Area Count''&lt;br /&gt;
| '''Area Layer Name Offset Array'''&lt;br /&gt;
| Each value is an offset into the layer name array and points to where the layer names for each area begins.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| colspan=8 {{unknown|End of file}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Version ===&lt;br /&gt;
&lt;br /&gt;
These are the known version numbers:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! ID&lt;br /&gt;
! Game&lt;br /&gt;
|-&lt;br /&gt;
| 0xD&lt;br /&gt;
| Metroid Prime Demo&lt;br /&gt;
|-&lt;br /&gt;
| 0x11&lt;br /&gt;
| Metroid Prime&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| Metroid Prime 2 Demo&lt;br /&gt;
|-&lt;br /&gt;
| 0x17&lt;br /&gt;
| Metroid Prime 2&lt;br /&gt;
|-&lt;br /&gt;
| 0x19&lt;br /&gt;
| Metroid Prime 3&lt;br /&gt;
|-&lt;br /&gt;
| 0x1B&lt;br /&gt;
| Donkey Kong Country Returns&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Memory Relay ===&lt;br /&gt;
&lt;br /&gt;
This structure only appears in Prime 1. It describes an outgoing connection from a Memory Relay to another script instance. Any Memory Relays connected to multiple objects will appear in the array multiple times.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| u32&lt;br /&gt;
| '''Memory Relay Instance ID'''&lt;br /&gt;
| Instance ID of the sender Memory Relay.&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| u32&lt;br /&gt;
| '''Target Instance ID'''&lt;br /&gt;
| Instance ID of the receiver object.&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| u16&lt;br /&gt;
| '''Message'''&lt;br /&gt;
| Script message sent to the receiver object.&lt;br /&gt;
|-&lt;br /&gt;
| 0xA&lt;br /&gt;
| bool&lt;br /&gt;
| '''Active'''&lt;br /&gt;
| Whether this Memory Relay object is active by default; almost always 0.&lt;br /&gt;
|-&lt;br /&gt;
| 0xB&lt;br /&gt;
| colspan=3 {{unknown|End of Memory Relay connection}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Area ===&lt;br /&gt;
&lt;br /&gt;
This structure defines a single area and describes its position in the world and how it connects to other areas.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
! MP1&lt;br /&gt;
! MP2&lt;br /&gt;
! MP3&lt;br /&gt;
! DKCR&lt;br /&gt;
|-&lt;br /&gt;
| Asset ID ([[STRG (File Format)|STRG]])&lt;br /&gt;
| 1&lt;br /&gt;
| '''Area Name ID'''&lt;br /&gt;
| [[STRG (File Format)|STRG]] ID for the area name.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| float&lt;br /&gt;
| 12&lt;br /&gt;
| '''Area Transform'''&lt;br /&gt;
| Area's transform matrix. Most area data is pre-transformed, but there are a few things that need to be transformed by this matrix.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| float&lt;br /&gt;
| 6&lt;br /&gt;
| '''Area Bounding Box'''&lt;br /&gt;
| This is the bounding box of the area's collision mesh and is equivalent to the bounding box found in the [[MREA (File Format)|MREA]] collision section.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| Asset ID ([[MREA (File Format)|MREA]])&lt;br /&gt;
| 1&lt;br /&gt;
| '''Area MREA ID'''&lt;br /&gt;
| ID of this area's [[MREA (File Format)|MREA]] file.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| Asset ID&lt;br /&gt;
| 1&lt;br /&gt;
| '''Internal Area ID'''&lt;br /&gt;
| Doesn't actually refer to an asset, but has the same length as an asset ID. This ID is used internally by some things to refer to this area, such as Script Layer Controllers.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Attached Area Count'''&lt;br /&gt;
| Count of areas attached to this one.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| u16&lt;br /&gt;
| ''Attached Area Count''&lt;br /&gt;
| '''Attached Area Index Array'''&lt;br /&gt;
| Array of area indices attached to this one.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| [[#Area Dependencies|Area Dependencies]]&lt;br /&gt;
| 1&lt;br /&gt;
| '''Dependencies'''&lt;br /&gt;
| Asset dependencies in this area. See below for details. Starting in Prime 3, this section has been moved inside the [[MREA (File Format)|MREA]] file.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Dock Count'''&lt;br /&gt;
| Count of Dock instances in this area.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| [[#Dock|Dock]]&lt;br /&gt;
| ''Dock Count''&lt;br /&gt;
| '''Dock Array'''&lt;br /&gt;
| Array describing all docks in this area.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| [[#Area Module Dependencies|Area Module Dependencies]]&lt;br /&gt;
| 1&lt;br /&gt;
| '''Module Dependencies'''&lt;br /&gt;
| REL module dependencies in this area. See below for details. The equivalent section in Prime 3 and DKCR describing RSO modules has been moved inside the [[MREA (File Format)|MREA]] format.&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| Always 0?&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| string&lt;br /&gt;
| 1&lt;br /&gt;
| '''Internal Area Name'''&lt;br /&gt;
| Internal name of this area. This name will be used ingame on the map screen if no ''Area Name ID'' is specified, prefixed with &amp;quot;!!&amp;quot;.&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| colspan=8 {{unknown|End of area}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Area Dependencies ====&lt;br /&gt;
&lt;br /&gt;
This is a data chunk appearing in the area definition in Metroid Prime 1 and 2 that lists all assets needed to load the area. It's extremely important that this list be optimized and complete, as all assets listed here will be perpetually kept in memory as long as the area itself is in memory; the list also specifies the order that assets are loaded in, so '''it must be grouped by load order to roughly match the [[PAK (File Format)|PAK]] file for optimized load times'''. Assets that are missing will still be dynamically loaded after the area itself is loaded, but this will cause the game to freeze up until the load is finished. There are a few exceptions that are excluded from this list in the original game files (and should be excluded in custom MLVLs as well to avoid out-of-memory crashes):&lt;br /&gt;
&lt;br /&gt;
* [[SCAN (File Format)|SCAN]] files and their dependencies are not included in the list in MP1. These are loaded dynamically after the area itself is finished loading, presumably so that scan dependencies are not kept in memory when the scan isn't actually in use. In MP2, SCANs are actually included in the list but their dependencies aren't.&lt;br /&gt;
* [[ANCS (File Format)|ANCS]] per-character dependencies for PlayerActor script instances are not included; this allows the game to avoid keeping assets in memory for suits that the player doesn't have. The exception is the Empty Suit character (character index 5 in MP1, and index 3 in MP2), which is a low-memory-overhead character that allows for the list to include all common assets that are stored in the file per-character (such as particle effects).&lt;br /&gt;
* The skybox model and its dependencies are not included.&lt;br /&gt;
&lt;br /&gt;
The dependency list is split by layer; after the dependencies itself, an array of offsets into the dependency list is provided that allows the game to only load assets for layers that are currently active. The last offset points to all common resources used by the area that aren't layer-specific. With that in mind, every layer needs to have a full list of its required assets even if they're also used by other layers. There's no harm in including an asset multiple times, as if an asset is already in memory then it'll simply be skipped over.&lt;br /&gt;
&lt;br /&gt;
This data chunk still exists in Prime 3 and DKCR, but it's been moved inside the [[MREA (File Format)|MREA]] format.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Dependency Count'''&lt;br /&gt;
| Count of dependencies.&lt;br /&gt;
|-&lt;br /&gt;
| [[#Dependency|Dependency]]&lt;br /&gt;
| ''Dependency Count''&lt;br /&gt;
| '''Dependency Array'''&lt;br /&gt;
| Array of all asset dependencies in this area.&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Dependency Offset Count'''&lt;br /&gt;
| Count of dependency offsets. This will be equal to the area script layer count + 1.&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| ''Dependency Offset Count''&lt;br /&gt;
| '''Dependency Offset Array'''&lt;br /&gt;
| Array of offsets into the dependency array. There is one offset per script layer, with the offset referring to the index of that layer's first dependency. There is a final extra offset that points to area dependencies that are not layer-specific.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== Dependency =====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| Asset ID&lt;br /&gt;
| 1&lt;br /&gt;
| '''Dependency Asset ID'''&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| char&lt;br /&gt;
| 4&lt;br /&gt;
| '''Dependency Asset Type'''&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Dock ====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Connecting Dock Count'''&lt;br /&gt;
| Count of docks connecting to this one. Typically 1 (but there are docks in Prime 3 that connect to multiple areas).&lt;br /&gt;
|-&lt;br /&gt;
| [[#Connecting Dock|Connecting Dock]]&lt;br /&gt;
| ''Connecting Dock Count''&lt;br /&gt;
| '''Connecting Dock Array'''&lt;br /&gt;
| Array describing all docks connected to this one.&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Dock Coordinate Count'''&lt;br /&gt;
| Array of dock coordinates in the next array.&lt;br /&gt;
|-&lt;br /&gt;
| Vector3&lt;br /&gt;
| ''Dock Coordinate Count''&lt;br /&gt;
| '''Dock Coordinates'''&lt;br /&gt;
| Exact purpose/function of this is not known yet.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== Connecting Dock =====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| u32&lt;br /&gt;
| '''Area Index'''&lt;br /&gt;
| Index of the area this dock is in.&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| u32&lt;br /&gt;
| '''Dock Index'''&lt;br /&gt;
| Index of this dock within its area.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Area Module Dependencies ====&lt;br /&gt;
&lt;br /&gt;
This is a data chunk appearing in the area definitions that describes all REL modules that must be linked in for this area to run. These are tied to script objects. The list is split per-layer so that only modules being used by the active layer are linked in; modules will appear once in the list for each layer that uses it. After the REL list, there is an array of offsets that points to the starting index in the list for each script layer, similar to the regular area dependencies list. For an unknown reason, the offsets list contains two offsets per layer. The first one refers to the layer's start index while the second one is usually empty, which effectively makes it an end index.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''REL Module Count'''&lt;br /&gt;
| Count of REL modules in the next array.&lt;br /&gt;
|-&lt;br /&gt;
| string&lt;br /&gt;
| ''REL Module Count''&lt;br /&gt;
| '''REL Module Array'''&lt;br /&gt;
| REL modules used by this area. Each array entry is the filename of a .REL module.&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''REL Offset Count'''&lt;br /&gt;
| Count of REL offsets in the next array. Should be equal to the area script layer count * 2.&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| ''REL Offset Count''&lt;br /&gt;
| '''REL Offset Array'''&lt;br /&gt;
| Array of offsets into the ''REL Module Array''. There are two offsets per script layer, with the first one being that layer's start index and the second one effectively being that layer's end index.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Audio Group ===&lt;br /&gt;
&lt;br /&gt;
This structure is only present in Prime 1 and describes an [[AGSC (File Format)|AGSC]] file being used in this world.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| u32&lt;br /&gt;
| '''Group ID'''&lt;br /&gt;
| Group ID for this audio group. This is the same value that can be found in the Project chunk in the referenced [[AGSC (File Format)|AGSC]] file.&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| Asset ID ([[AGSC (File Format)|AGSC]])&lt;br /&gt;
| '''AGSC ID'''&lt;br /&gt;
| The [[AGSC (File Format)|AGSC]] file for this audio group.&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| colspan=3 {{unknown|End of audio group definition}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Area Layer Flags ===&lt;br /&gt;
&lt;br /&gt;
This is a small structure that determines which areas are active by default. It contains a layer count and then a 64-bit flag, with each bit corresponding to a particular layer; if the bit is set, then the layer will be active on a new save file. The low-order bits correspond to the lower layer indices. Bits for layers that don't exist are defaulted to on.&lt;br /&gt;
&lt;br /&gt;
Note that due to the size of these flags as well as a few other pieces of data in other formats, the maximum number of layers that can be contained in a single area is 64.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| u32&lt;br /&gt;
| '''Layer Count'''&lt;br /&gt;
| Count of layers in this area.&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| u64&lt;br /&gt;
| '''Layer Flags'''&lt;br /&gt;
| See above for a description of how these work.&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| colspan=3 {{unknown|End of area layer flags}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:File Formats]]&lt;br /&gt;
[[Category:Metroid Prime]]&lt;br /&gt;
[[Category:Metroid Prime 2: Echoes]]&lt;br /&gt;
[[Category:Metroid Prime 3: Corruption]]&lt;br /&gt;
[[Category:Donkey Kong Country Returns]]&lt;/div&gt;</summary>
		<author><name>Aruki</name></author>	</entry>

	<entry>
		<id>http://www.metroid2002.com/retromodding/index.php?title=Template:Mainpagelinks&amp;diff=1987</id>
		<title>Template:Mainpagelinks</title>
		<link rel="alternate" type="text/html" href="http://www.metroid2002.com/retromodding/index.php?title=Template:Mainpagelinks&amp;diff=1987"/>
				<updated>2019-06-30T16:41:00Z</updated>
		
		<summary type="html">&lt;p&gt;Aruki: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{|cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;3&amp;quot; align=&amp;quot;center&amp;quot; style=&amp;quot;text-align:center; margin-bottom:20px; float:center; border:1px solid; box-shadow: 0 0 5px #6DBACD; border-radius:6px; border-color:#6dbacd;&amp;quot;  ! width=&amp;quot;45%&amp;quot;&lt;br /&gt;
|[[File:Powercannon_render3.png|200px]]&lt;br /&gt;
|'''Help us research and document!'''&lt;br /&gt;
'''Join the discussion: [https://discord.gg/6YTN7q6 Metroid Prime Hacking Discord]'''&lt;br /&gt;
{|align=&amp;quot;center&amp;quot; style=&amp;quot;text-align:center;&amp;quot;&lt;br /&gt;
|[[File:Morphball_wire.png|50px|link=Category:Major research needed]]&lt;br /&gt;
|[[File:Morphball_wirerender.png|50px|link=Category:Moderate research needed]]&lt;br /&gt;
|[[File:Morphball_render.png|50px|link=Category:Minor research needed]]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;small&amp;gt;[[:Category:Major research needed|'''File formats that need major research''']]&amp;lt;/small&amp;gt;&lt;br /&gt;
|&amp;lt;small&amp;gt;[[:Category:Moderate research needed|'''File formats that need moderate research''']]&amp;lt;/small&amp;gt;&lt;br /&gt;
|&amp;lt;small&amp;gt;[[:Category:Minor research needed|'''File formats that need minor research''']]&amp;lt;/small&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:Templates]]&lt;/div&gt;</summary>
		<author><name>Aruki</name></author>	</entry>

	<entry>
		<id>http://www.metroid2002.com/retromodding/index.php?title=TXTR_(Metroid_Prime)&amp;diff=1986</id>
		<title>TXTR (Metroid Prime)</title>
		<link rel="alternate" type="text/html" href="http://www.metroid2002.com/retromodding/index.php?title=TXTR_(Metroid_Prime)&amp;diff=1986"/>
				<updated>2019-04-18T09:16:22Z</updated>
		
		<summary type="html">&lt;p&gt;Aruki: /* Image Formats */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''See [[TXTR (File Format)]] for the other revisions of this format.''&lt;br /&gt;
&lt;br /&gt;
'''TXTR''' is, as the name suggests, the Retro Studios texture format. The format remains completely unchanged from Metroid Prime all the way up to Donkey Kong Country Returns.&lt;br /&gt;
&lt;br /&gt;
{{todo|Could possibly use some more information on how the formats work and how to decode them, but then again the Custom Mario Kart Wiiki has this covered pretty nicely already.}}&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Format ==&lt;br /&gt;
&lt;br /&gt;
TXTR files contain a very short 12-byte header, followed by the image data.&lt;br /&gt;
&lt;br /&gt;
=== Header ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 4&lt;br /&gt;
| '''Image format'''. Possible values range from 0x0 to 0xA; see below for more details.&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 2&lt;br /&gt;
| '''Width'''&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 2&lt;br /&gt;
| '''Height'''&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 4&lt;br /&gt;
| '''Mipmap count'''&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| colspan=2 {{unknown|End of header}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Palettes ===&lt;br /&gt;
&lt;br /&gt;
The C4 and C8 image formats contain a palette table after the header, before the image data begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 4&lt;br /&gt;
| '''Palette format'''. Possible values range from 0 to 2.&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 2&lt;br /&gt;
| '''Width'''. always 1 in C4, 256 in C8&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| 2&lt;br /&gt;
| '''Height'''. always 16 in C4, 1 in C8&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| Varies&lt;br /&gt;
| '''Palette colors'''. 16-bit color values; 16 colors in C4, 256 in C8.&lt;br /&gt;
|-&lt;br /&gt;
| colspan=3 {{unknown|End of palette table; image data begins immediately after}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Image Formats ==&lt;br /&gt;
&lt;br /&gt;
There are 11 different image formats supported by the hardware. Rather than storing pixels in a linear left-to-right order, GameCube textures are swizzled in blocks. Blocks are 32 bytes large (except for RGBA8), with their dimensions varying depending on the BPP of the image format. &lt;br /&gt;
&lt;br /&gt;
For example, suppose you have a format that stores 4x4 blocks. Pixels 1-4 of the image will make up the first row of the first block; pixels 5-8 will make up the second row; 9-12 will make up the third row; 13-16 will make up the fourth row, completing the block; and then 17-20 will begin the first row of the second block, appearing directly to the right of the first row of the first block.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! ID&lt;br /&gt;
! Name&lt;br /&gt;
! Bits per pixel&lt;br /&gt;
! Block size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| I4&lt;br /&gt;
| 4&lt;br /&gt;
| 8x8&lt;br /&gt;
| 4-bit greyscale intensity values. Two pixels per byte.&lt;br /&gt;
|-&lt;br /&gt;
| 0x1&lt;br /&gt;
| I8&lt;br /&gt;
| 8&lt;br /&gt;
| 8x4&lt;br /&gt;
| 8-bit greyscale intensity values.&lt;br /&gt;
|-&lt;br /&gt;
| 0x2&lt;br /&gt;
| IA4&lt;br /&gt;
| 8&lt;br /&gt;
| 8x4&lt;br /&gt;
| 4-bit greyscale intensity values with an additional 4-bit alpha channel.&lt;br /&gt;
|-&lt;br /&gt;
| 0x3&lt;br /&gt;
| IA8&lt;br /&gt;
| 16&lt;br /&gt;
| 4x4&lt;br /&gt;
| 8-bit greyscale intensity values with an additional 8-bit alpha channel.&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| C4&lt;br /&gt;
| 4&lt;br /&gt;
| 8x8&lt;br /&gt;
| 4-bit palette indices.&lt;br /&gt;
|-&lt;br /&gt;
| 0x5&lt;br /&gt;
| C8&lt;br /&gt;
| 8&lt;br /&gt;
| 8x4&lt;br /&gt;
| 8-bit palette indices.&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| C14x2&lt;br /&gt;
| 16&lt;br /&gt;
| 4x4&lt;br /&gt;
| Another palette format. Not used by any official textures.&lt;br /&gt;
|-&lt;br /&gt;
| 0x7&lt;br /&gt;
| RGB565&lt;br /&gt;
| 16&lt;br /&gt;
| 4x4&lt;br /&gt;
| 16-bit colors without alpha.&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| RGB5A3&lt;br /&gt;
| 16&lt;br /&gt;
| 4x4&lt;br /&gt;
| 16-bit colors with alpha.&lt;br /&gt;
|-&lt;br /&gt;
| 0x9&lt;br /&gt;
| RGBA8&lt;br /&gt;
| 32&lt;br /&gt;
| 4x4&lt;br /&gt;
| Uncompressed 32-bit colors with alpha.&lt;br /&gt;
|-&lt;br /&gt;
| 0xA&lt;br /&gt;
| CMPR&lt;br /&gt;
| 4&lt;br /&gt;
| 8x8&lt;br /&gt;
| Compressed textures (almost the same as DXT1, but with a couple small differences)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
&lt;br /&gt;
* [http://wiki.tockdom.com/wiki/Image_Formats Custom Mario Kart Wiki]: More detailed information on each format, and how to decode them.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:File Formats]]&lt;br /&gt;
[[Category:Metroid Prime]]&lt;br /&gt;
[[Category:Metroid Prime 2: Echoes]]&lt;br /&gt;
[[Category:Metroid Prime 3: Corruption]]&lt;br /&gt;
[[Category:Donkey Kong Country Returns]]&lt;/div&gt;</summary>
		<author><name>Aruki</name></author>	</entry>

	<entry>
		<id>http://www.metroid2002.com/retromodding/index.php?title=PAK_(Tropical_Freeze)&amp;diff=1985</id>
		<title>PAK (Tropical Freeze)</title>
		<link rel="alternate" type="text/html" href="http://www.metroid2002.com/retromodding/index.php?title=PAK_(Tropical_Freeze)&amp;diff=1985"/>
				<updated>2019-04-13T01:33:09Z</updated>
		
		<summary type="html">&lt;p&gt;Aruki: /* Tools */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''See [[PAK (File Format)]] for the other revisions of this format.''&lt;br /&gt;
&lt;br /&gt;
The '''PAK format''' in Donkey Kong Country: Tropical Freeze is the third version of the .pak format, with another layout overhaul, file IDs being extended from 64 bits to 128 bits (as they now use a new GUID system that is used to associate IDs with various objects across the entire game), and the addition of an extra metadata section.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Format ==&lt;br /&gt;
&lt;br /&gt;
The Tropical Freeze pak format contains three main header sections: [[#Resource Directory|the resource directory]], [[#Metadata|metadata]], and [[#Name Tags|name tags]].&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| [[Form Descriptor (Tropical Freeze)|Form Descriptor]]&lt;br /&gt;
| 1&lt;br /&gt;
| '''Package Form Descriptor'''&lt;br /&gt;
| Data type is &amp;lt;code&amp;gt;PACK&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| [[Form Descriptor (Tropical Freeze)|Form Descriptor]]&lt;br /&gt;
| 1&lt;br /&gt;
| '''Table of Contents Form Descriptor'''&lt;br /&gt;
| Data type is &amp;lt;code&amp;gt;TOCC&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| colspan=4 {{unknown|Header data sections (ADIR, META, and STRG) begin}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Asset Directory ===&lt;br /&gt;
&lt;br /&gt;
The asset directory contains a list of every asset in the pak, associating a GUID with an offset/size in the file. Assets are sorted by their GUID in numerical order, which is often not the same order that they actually appear in the file.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| [[Chunk Descriptor (Tropical Freeze)|Chunk Descriptor]]&lt;br /&gt;
| 1&lt;br /&gt;
| '''Asset Directory Chunk Descriptor'''&lt;br /&gt;
| Data type is &amp;lt;code&amp;gt;ADIR&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Asset Count'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| [[#Asset Entry|Asset Entry]]&lt;br /&gt;
| ''Asset Count''&lt;br /&gt;
| '''Asset Directory'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| colspan=5 {{unknown|End of &amp;lt;code&amp;gt;ADIR&amp;lt;/code&amp;gt; section}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Asset Entry ====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| char&lt;br /&gt;
| 4&lt;br /&gt;
| '''Asset Type'''&lt;br /&gt;
| This is an abbreviated fourCC that doubles as the asset's cooked file extension.&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| GUID&lt;br /&gt;
| 1&lt;br /&gt;
| '''Asset ID'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| u64&lt;br /&gt;
| 1&lt;br /&gt;
| '''Offset'''&lt;br /&gt;
| This is an absolute offset relative to the start of the pak file.&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| u64&lt;br /&gt;
| 1&lt;br /&gt;
| '''Size'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| colspan=4 {{unknown|End of asset entry}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Metadata ===&lt;br /&gt;
&lt;br /&gt;
The metadata section lists extra metadata for some asset types, which are associated with them via their file ID. The structure and contents of a &amp;lt;code&amp;gt;META&amp;lt;/code&amp;gt; entry varies depending on the asset type; check that type's page on the Wiki to check the structure of its &amp;lt;code&amp;gt;META&amp;lt;/code&amp;gt; entries.&lt;br /&gt;
&lt;br /&gt;
Note that a lot of formats don't have any extra metadata. If there's no assets with extra metadata in the entire pak, then the &amp;lt;code&amp;gt;META&amp;lt;/code&amp;gt; section won't appear in the file at all.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| [[Chunk Descriptor (Tropical Freeze)|Chunk Descriptor]]&lt;br /&gt;
| 1&lt;br /&gt;
| '''Metadata Chunk Descriptor'''&lt;br /&gt;
| Data type is &amp;lt;code&amp;gt;META&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Metadata Entry Count'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| [[#Metadata Entry|Metadata Entry]]&lt;br /&gt;
| ''Metadata Entry Count''&lt;br /&gt;
| '''Metadata Entry Table'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| colspan=5 {{unknown|End of &amp;lt;code&amp;gt;META&amp;lt;/code&amp;gt; section}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Metadata Entry ====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| GUID&lt;br /&gt;
| 1&lt;br /&gt;
| '''Asset ID'''&lt;br /&gt;
| This is the ID of the asset that this metadata entry is associated with&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Metadata Offset'''&lt;br /&gt;
| Relative to the start of the &amp;lt;code&amp;gt;META&amp;lt;/code&amp;gt; section.&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| colspan=4 {{unknown|End of metadata entry}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Name Tags===&lt;br /&gt;
&lt;br /&gt;
The name tags section associates certain assets with string names. These are the &amp;quot;main&amp;quot; assets of the pak; any asset that does not have a name is a dependency of one of the ones that do.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| [[Chunk Descriptor (Tropical Freeze)|Chunk Descriptor]]&lt;br /&gt;
| 1&lt;br /&gt;
| '''Name Tags Chunk Descriptor'''&lt;br /&gt;
| Data type is &amp;lt;code&amp;gt;STRG&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Name Tag Count'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| [[#Name Tag|Name Tag]]&lt;br /&gt;
| ''Name Tag Count''&lt;br /&gt;
| '''Name Tag Table'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| colspan=5 {{unknown|End of &amp;lt;code&amp;gt;STRG&amp;lt;/code&amp;gt; section}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Name Tag ====&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| char&lt;br /&gt;
| 4&lt;br /&gt;
| '''Asset Type'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| GUID&lt;br /&gt;
| 1&lt;br /&gt;
| '''Asset ID'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| string&lt;br /&gt;
| 1&lt;br /&gt;
| '''Asset Name'''&lt;br /&gt;
| Zero-terminated.&lt;br /&gt;
|-&lt;br /&gt;
| colspan=5 {{unknown|End of name tag}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
* [https://www.dropbox.com/s/bba2n9jzj719by4/PakTool.rar?dl=0 PakTool] by Aruki; can extract and decompress files from Tropical Freeze paks, but doesn't support repacking or recompressing them&lt;br /&gt;
&lt;br /&gt;
[[Category:File Formats]]&lt;br /&gt;
[[Category:Donkey Kong Country: Tropical Freeze]]&lt;/div&gt;</summary>
		<author><name>Aruki</name></author>	</entry>

	<entry>
		<id>http://www.metroid2002.com/retromodding/index.php?title=PAK_(Metroid_Prime_3)&amp;diff=1984</id>
		<title>PAK (Metroid Prime 3)</title>
		<link rel="alternate" type="text/html" href="http://www.metroid2002.com/retromodding/index.php?title=PAK_(Metroid_Prime_3)&amp;diff=1984"/>
				<updated>2019-04-13T01:32:53Z</updated>
		
		<summary type="html">&lt;p&gt;Aruki: /* Tools */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''See [[PAK (File Format)]] for the other revisions of this format.''&lt;br /&gt;
&lt;br /&gt;
The '''.pak format''' in Metroid Prime 3 and Donkey Kong Country Returns is a new version of the pak format with some slight changes. The most notable change is that resource IDs have been extended from 32 bits to 64 bits. The new format also aligns to 64-byte boundaries, rather than 32. Aside from that, the other changes are mainly organizational; it's still largely the same data as older versions of the format.&lt;br /&gt;
&lt;br /&gt;
Note that the Metroid Prime 3 E3 prototype uses a slightly modified version of the Metroid Prime pak format, not this one. See the [[PAK (Metroid Prime)]] page for more info on that revision of the format.&lt;br /&gt;
&lt;br /&gt;
{{research|1|Research needs to be done on how to order files to optimize loads. Also, the very first part of the header is mostly unknown.}}&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Format==&lt;br /&gt;
&lt;br /&gt;
The header is split into a number of smaller chunks that are each padded to the next 64-byte offset.&lt;br /&gt;
&lt;br /&gt;
=== Header ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 4&lt;br /&gt;
| {{unknown|'''Unknown'''. Always 2.}}&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 4&lt;br /&gt;
| '''Header size'''&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 16&lt;br /&gt;
| '''MD5 hash''' of the entire pak after the first 64 bytes.&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| colspan=2 {{unknown|End of header; pad to 64 bytes}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Table of Contents ===&lt;br /&gt;
&lt;br /&gt;
The next part of the file, starting at 0x40, is a brief list of each section in the pak and its size. Although it uses a count value, this section always lists the same data in the same order.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 4&lt;br /&gt;
| '''Section count'''; always 3&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 4&lt;br /&gt;
| '''&amp;quot;STRG&amp;quot; fourCC'''&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 4&lt;br /&gt;
| '''Named Resources section size'''&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 4&lt;br /&gt;
| '''&amp;quot;RSHD&amp;quot; fourCC'''&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 4&lt;br /&gt;
| '''Resource Table section size'''&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 4&lt;br /&gt;
| '''&amp;quot;DATA&amp;quot; fourCC'''&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 4&lt;br /&gt;
| '''File data section size'''&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| colspan=2 {{unknown|End of ToC; pad to 64 bytes}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Named Resources ===&lt;br /&gt;
&lt;br /&gt;
This section, always starting at 0x80, lists named resources. These are the files that the game has direct access to; every other file in the pak will be a dependency of one of these.&lt;br /&gt;
&lt;br /&gt;
It starts with a 32-bit count, followed by the table itself; each entry of the table is structured as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type&lt;br /&gt;
! Size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| string&lt;br /&gt;
| -&lt;br /&gt;
| '''Name'''; zero-terminated&lt;br /&gt;
|-&lt;br /&gt;
| fourCC&lt;br /&gt;
| 4&lt;br /&gt;
| '''Resource type'''&lt;br /&gt;
|-&lt;br /&gt;
| u64&lt;br /&gt;
| 8&lt;br /&gt;
| '''Resource ID'''&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Resource Table ===&lt;br /&gt;
&lt;br /&gt;
The final table contains a list of every resource in the pak. Following a 32-bit count value, each resource entry is structured as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 4&lt;br /&gt;
| '''Compression flag'''; this will either be 0 or 1, with 1 denoting a compressed file.&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 4&lt;br /&gt;
| '''Resource type''' fourCC.&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 8&lt;br /&gt;
| '''Resource ID'''&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 4&lt;br /&gt;
| '''Size''' (note: always a multiple of 64; the end of the file is padded with 0xFF if necessary)&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 4&lt;br /&gt;
| '''Offset''' (relative to the start of the DATA section)&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| colspan=2 {{unknown|End of entry}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Compression ==&lt;br /&gt;
&lt;br /&gt;
Some files within paks are compressed; in Prime 3, files are compressed with segmented LZO1X, just like Prime 2. In DKCR, on the other hand, files are compressed as a single zlib stream, like Prime 1. In either game, every compressed file is formatted the same way, starting with some metadata detailing the structure of the compressed data.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 4&lt;br /&gt;
| '''&amp;quot;CMPD&amp;quot; fourCC'''&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 4&lt;br /&gt;
| '''Compressed block count'''&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each compressed block is structured as follows.&lt;br /&gt;
&lt;br /&gt;
For each block, if the compressed and decompressed sizes match, that indicates the block is uncompressed.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 1&lt;br /&gt;
| '''Flag'''&lt;br /&gt;
|-&lt;br /&gt;
| 0x1&lt;br /&gt;
| 3&lt;br /&gt;
| '''Compressed size'''&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 4&lt;br /&gt;
| '''Decompressed size''' &lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| colspan=2 {{unknown|End of entry}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The flag value can be set to the following possible values:&lt;br /&gt;
&lt;br /&gt;
* If the block count is 1, it will be 0xA0 on block 1.&lt;br /&gt;
* If blocks 2/3 are compressed, they will have it set to 0xC0.&lt;br /&gt;
* If blocks 2/3 are uncompressed, they will have it set to 0x40.&lt;br /&gt;
* 0 in all other circumstances.&lt;br /&gt;
&lt;br /&gt;
Files are left uncompressed if the compressed data is larger than the uncompressed data. Barring that, the following formats are always compressed:&lt;br /&gt;
&lt;br /&gt;
* [[TXTR (Metroid Prime)|TXTR]]&lt;br /&gt;
* [[CMDL (Metroid Prime)|CMDL]]&lt;br /&gt;
* [[CSKR (File Format)|CSKR]]&lt;br /&gt;
* [[CHAR (File Format)|CHAR]]&lt;br /&gt;
* [[SAND (File Format)|SAND]]&lt;br /&gt;
* [[ANIM (File Format)|ANIM]]&lt;br /&gt;
* [[SCAN (Metroid Prime 2)|SCAN]]&lt;br /&gt;
* [[FONT (File Format)|FONT]]&lt;br /&gt;
* [[CSMP (File Format)|CSMP]]&lt;br /&gt;
* [[STRG (File Format)|STRG]]&lt;br /&gt;
* [[CAAD (File Format)|CAAD]]&lt;br /&gt;
* [[DCLN (File Format)|DCLN]]&lt;br /&gt;
* [[USRC (File Format)|USRC]]&lt;br /&gt;
&lt;br /&gt;
The following formats are compressed when their uncompressed size is at least 0x80 bytes:&lt;br /&gt;
&lt;br /&gt;
* [[PART (File Format)|PART]]&lt;br /&gt;
* [[ELSC (File Format)|ELSC]]&lt;br /&gt;
* [[SWHC (File Format)|SWHC]]&lt;br /&gt;
* [[WPSC (File Format)|WPSC]]&lt;br /&gt;
* [[CRSC (File Format)|CRSC]]&lt;br /&gt;
* [[BFRC (File Format)|BFRC]]&lt;br /&gt;
* [[SPSC (File Format)|SPSC]]&lt;br /&gt;
* [[DPSC (File Format)|DPSC]]&lt;br /&gt;
&lt;br /&gt;
== File Order ==&lt;br /&gt;
&lt;br /&gt;
File order matters significantly and easily makes the difference between a pak loading quickly and optimally, or taking 30+ seconds on every door. While more research is required to figure out exactly how files should be ordered to optimize loading, the game generally clusters together resources that are used together, and a file's dependencies generally appear directly before the file itself. The game also often duplicates assets that are used multiple times within the same pak; there might be 10-11 copies of the same model file in order to allow the game to more easily find and load that file when it needs it.&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
* [https://www.dropbox.com/s/bba2n9jzj719by4/PakTool.rar?dl=0 PakTool] by Aruki&lt;br /&gt;
&lt;br /&gt;
[[Category:File Formats]]&lt;br /&gt;
[[Category:Metroid Prime 3: Corruption]]&lt;br /&gt;
[[Category:Donkey Kong Country Returns]]&lt;/div&gt;</summary>
		<author><name>Aruki</name></author>	</entry>

	<entry>
		<id>http://www.metroid2002.com/retromodding/index.php?title=PAK_(Metroid_Prime)&amp;diff=1983</id>
		<title>PAK (Metroid Prime)</title>
		<link rel="alternate" type="text/html" href="http://www.metroid2002.com/retromodding/index.php?title=PAK_(Metroid_Prime)&amp;diff=1983"/>
				<updated>2019-04-13T01:31:46Z</updated>
		
		<summary type="html">&lt;p&gt;Aruki: /* Tools */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''See [[PAK (File Format)]] for the other revisions of this format.''&lt;br /&gt;
&lt;br /&gt;
The '''.pak format''' in Metroid Prime and Metroid Prime 2 is a fairly simple packfile format; files are stored with a 32-bit file ID, and can optionally be compressed with zlib (Metroid Prime) or LZO1X-999 (Metroid Prime 2). The assets in a pak are split into two groups: named resources and dependencies. In general, only named resources are accessed directly by the game; the rest are dependencies of the named resources, and are accessed indirectly in the process of parsing those files.&lt;br /&gt;
&lt;br /&gt;
Note that the Metroid Prime 3 E3 prototype uses this pak format as well, but has 64-bit file IDs. This is the only difference; the version number is still the same, so there isn't an easy way to check for this variation of the format.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Format==&lt;br /&gt;
&lt;br /&gt;
=== Header ===&lt;br /&gt;
&lt;br /&gt;
The pak starts with a short 8-byte header:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| int16&lt;br /&gt;
| '''Version Number Major'''&lt;br /&gt;
| Always 3&lt;br /&gt;
|-&lt;br /&gt;
| 0x2&lt;br /&gt;
| int16&lt;br /&gt;
| '''Version Number Minor'''&lt;br /&gt;
| Always 5&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| int32&lt;br /&gt;
| '''Unused'''&lt;br /&gt;
| Always 0&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| colspan=3 {{unknown|End of header}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Named Resources ===&lt;br /&gt;
&lt;br /&gt;
The named resource table lists files that the game has direct access to. On world paks, this will generally only contain the MLVL file; in other paks, this table is usually quite a bit larger. Note that in non-world paks, the names are hardcoded and are how the game knows where to find the files; if you repack, you need to make sure you keep the names the same.&lt;br /&gt;
&lt;br /&gt;
This section of the file begins with a 32-bit named resource count, followed by a table.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| {{FourCC}}&lt;br /&gt;
| 1&lt;br /&gt;
| '''Asset Type'''&lt;br /&gt;
| Indicates the type of asset (texture, model, area, etc) and usually doubles as the asset's cooked file extension.&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| int32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Asset ID'''&lt;br /&gt;
| Unique identifier for this asset.&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| int32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Name Length'''&lt;br /&gt;
| Length of the name string&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| char&lt;br /&gt;
| ''Name Length''&lt;br /&gt;
| '''Name String'''&lt;br /&gt;
| Name of the asset. Not zero-terminated. This name usually corresponds to a hardcoded string that the game uses to look up the asset, so this generally can't be changed.&lt;br /&gt;
|-&lt;br /&gt;
| colspan=5 {{unknown|End of entry}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Resource Table ===&lt;br /&gt;
&lt;br /&gt;
This could be considered the main table of contents of the pak. This table begins with a 32-bit resource count, followed by one entry per file; each entry is 0x14 bytes large.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| int32&lt;br /&gt;
| '''Compression Flag'''&lt;br /&gt;
| Value will be either 0 or 1, with 1 denoting that the asset is compressed.&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| {{FourCC}}&lt;br /&gt;
| '''Asset Type'''&lt;br /&gt;
| Indicates the type of asset (texture, model, area, etc) and usually doubles as the asset's cooked file extension.&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| int32&lt;br /&gt;
| '''Asset ID'''&lt;br /&gt;
| Unique identifier for this asset. This ID is used by other assets to reference this one.&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| int32&lt;br /&gt;
| '''Size'''&lt;br /&gt;
| Size of the asset data in the pak. This is always 32-byte-aligned. The end of the asset is padded with 0xFF.&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| int32&lt;br /&gt;
| '''Offset'''&lt;br /&gt;
| Offset of the asset data within the pak. This is an absolute offset.&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| colspan=4 {{unknown|End of entry}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Compression ==&lt;br /&gt;
&lt;br /&gt;
Compressed files begin with their 32-bit decompressed size, followed by the compressed file data. Metroid Prime uses zlib, which is easily recognized from zlib's 0x78DA header at the start of the compressed data. Each file is compressed as a single zlib stream.&lt;br /&gt;
&lt;br /&gt;
Metroid Prime 2 uses segmented LZO1X-999, and gets slightly more complicated. Metroid Prime 2's compressed files are split up into multiple segments of compressed data, each of which is 0x4000 bytes large when decompressed (except for the last one) and should be compressed and decompressed separately. Each segment begins with a 16-bit size value before its actual compressed data begins.&lt;br /&gt;
&lt;br /&gt;
Only certain formats are compressed. The following formats are always compressed:&lt;br /&gt;
&lt;br /&gt;
* [[TXTR (Metroid Prime)|TXTR]]&lt;br /&gt;
* [[CMDL (Metroid Prime)|CMDL]]&lt;br /&gt;
* [[CSKR (File Format)|CSKR]]&lt;br /&gt;
* [[ANCS (File Format)|ANCS]]&lt;br /&gt;
* [[ANIM (File Format)|ANIM]]&lt;br /&gt;
* [[FONT (File Format)|FONT]]&lt;br /&gt;
&lt;br /&gt;
The following formats are compressed when their uncompressed size is at least 0x400 bytes (0x40 bytes in the MP3 prototype):&lt;br /&gt;
&lt;br /&gt;
* [[PART (File Format)|PART]]&lt;br /&gt;
* [[ELSC (File Format)|ELSC]]&lt;br /&gt;
* [[SWHC (File Format)|SWHC]]&lt;br /&gt;
* [[WPSC (File Format)|WPSC]]&lt;br /&gt;
* [[DPSC (File Format)|DPSC]]&lt;br /&gt;
* [[CRSC (File Format)|CRSC]]&lt;br /&gt;
&lt;br /&gt;
Additionally, in Prime 2 any files can be left uncompressed if the compressed file is larger than the uncompressed one. This is not the case in Prime 1 (although custom repacking implementations should probably do this regardless, as there's no benefit to the compression in this scenario).&lt;br /&gt;
&lt;br /&gt;
== Optimizing Load Times ==&lt;br /&gt;
&lt;br /&gt;
When rebuilding new paks, it's extremely important that asset order be optimized in order to minimize the distance the game has to seek on the disc in order to load any given asset. A poorly optimized pak can easily have 30+ second load times on small rooms. There are three main things that are done in order to keep load times fast.&lt;br /&gt;
&lt;br /&gt;
* In world paks, assets are often duplicated so they appear multiple times within the pak; if an asset is used by a lot of different areas this can help reduce seek distance, but has the downside of bloating the total file size of the pak. To ensure the best balance between the two, asset duplication was flagged on a per-area basis, as larger areas take longer to load and would benefit from the faster load speed, whereas small rooms tend to load quickly anyway even without duplicates. The flag that was used for this only existed in Retro's raw files and isn't present in the final game's cooked data. You can recreate it by analyzing the pak and noting down which rooms have duplicate assets (bearing in mind that the assets used by a room always precede that room's MREA asset). If you are working strictly from a pre-unpacked pak, you can't replicate the flag.&lt;br /&gt;
* Assets are generally grouped by load order - things that are used together are adjacent in the pak, and an asset's dependencies typically appear immediately preceding the asset itself. This grouping helps ensure that even when assets aren't duplicated the game will still be able to do just one large seek and then load a bunch of assets at once, instead of having to do a separate seek for each asset.&lt;br /&gt;
* Once you have assets stored in the pak in the right order, you need to make sure the game actually reads them in that order! The exact order that assets are loaded in is specified by the dependency list in the [[MLVL (File Format)|MLVL]] file; as such, the MLVL list should also have assets grouped in the same way and the same order and should at least roughly match the order files are positioned in the pak.&lt;br /&gt;
&lt;br /&gt;
For every asset loaded, the game checks every copy of the asset in the pak and loads whichever duplicate is the shortest distance from the last read position (the end of the last asset that was loaded). When loading an area, this is the order the game loads assets in:&lt;br /&gt;
* First the game goes down the area dependency list in the [[MLVL (File Format)|MLVL]] file and loads every file in the list for every active layer. The game follows the exact order specified by the list.&lt;br /&gt;
* After loading all area dependencies, the area itself is loaded.&lt;br /&gt;
* Finally the game loads assets being used by the new area that are missing from the list. This primarily means [[SCAN (File Format)|SCAN]] files (in MP1), the skybox model, and assets being used by PlayerActor animsets (this avoids loading PlayerActor assets for suits that the player doesn't have). If any other assets were missing from the list, they are loaded here. It's very important to know that contrary to the previous steps, assets that still aren't in memory at this point are loaded ''synchronously'', which means the game will hang until loading is complete; therefore, you want as few assets as possible to be left to load at this point. (You can observe this hang even in the base game - there is a small freeze towards the end of loading Artifact Temple.)&lt;br /&gt;
* Note that any assets that are already in memory will be skipped.&lt;br /&gt;
&lt;br /&gt;
'''Note:''' There are some discrepancies between the order assets appear in the pak and the actual load order specified by the MLVL file. There might be some more research needed to fully explain all the quirks behind Retro's pak optimization.&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
* [https://www.dropbox.com/s/bba2n9jzj719by4/PakTool.rar?dl=0 PakTool] by Aruki&lt;br /&gt;
&lt;br /&gt;
[[Category:File Formats]]&lt;br /&gt;
[[Category:Metroid Prime]]&lt;br /&gt;
[[Category:Metroid Prime 2: Echoes]]&lt;/div&gt;</summary>
		<author><name>Aruki</name></author>	</entry>

	<entry>
		<id>http://www.metroid2002.com/retromodding/index.php?title=Lights_(Metroid_Prime)&amp;diff=1982</id>
		<title>Lights (Metroid Prime)</title>
		<link rel="alternate" type="text/html" href="http://www.metroid2002.com/retromodding/index.php?title=Lights_(Metroid_Prime)&amp;diff=1982"/>
				<updated>2019-03-27T04:30:29Z</updated>
		
		<summary type="html">&lt;p&gt;Aruki: /* Metroid Prime 3 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The '''lights''' section in Metroid Prime areas defines several different types of lights: local ambient, directional, spot, and custom. Every light type has the same structure in the file; however, different types are utilized in different ways by the engine.&lt;br /&gt;
&lt;br /&gt;
{{research|minor|Lights are mostly figured out; the remaining unknowns are very likely unused, because the game's code never accesses them or passes them to the main light class, but it would be good to have some double-checking. There's also more unknowns in the Prime 3 lights format that probably -are- used.}}&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Format==&lt;br /&gt;
&lt;br /&gt;
The lights section has a very brief header consisting of the magic value &amp;lt;code&amp;gt;0xBABEDEAD&amp;lt;/code&amp;gt;. It's then followed by a number of '''light layers'''. Each light layer consists of a count value, then an array of lights. Each layer represents a separate set of lights; actors can choose with set they're lit with through an object property in LightParameters. The number of light layers is static, but it varies from game to game; Prime 1 and 2 can have up to two light layers, while Prime 3 can have four.&lt;br /&gt;
&lt;br /&gt;
=== Metroid Prime 1/2 ===&lt;br /&gt;
&lt;br /&gt;
Each light is a 0x41-byte struct. Note that the same structure is used for every light type, but not every value is used by every type; in fact, some of them aren't used by any of them.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Description&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| long&lt;br /&gt;
| '''Light Type'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| float3&lt;br /&gt;
| '''Color'''&lt;br /&gt;
| There is no alpha component.&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| float3&lt;br /&gt;
| '''Position'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| float3&lt;br /&gt;
| '''Direction'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| float&lt;br /&gt;
| '''Brightness'''&lt;br /&gt;
| Multiplied by color for local ambient, used to calculate distance attenuation coefficients for spot/custom&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| float&lt;br /&gt;
| '''Spot Cutoff'''&lt;br /&gt;
| Used to calculate angle attenuation coefficients for spotlights&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| float&lt;br /&gt;
| {{unknown|'''Unknown'''}}&lt;br /&gt;
| Possibly unused&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| bool&lt;br /&gt;
| {{unknown|'''Unknown'''}}&lt;br /&gt;
| Possibly unused&lt;br /&gt;
|-&lt;br /&gt;
| 0x35&lt;br /&gt;
| float&lt;br /&gt;
| {{unknown|'''Unknown'''}}&lt;br /&gt;
| Possibly unused&lt;br /&gt;
|-&lt;br /&gt;
| 0x39&lt;br /&gt;
| long&lt;br /&gt;
| '''Falloff Type'''&lt;br /&gt;
| Possible values: 0 - Constant; 1 - Linear; 2 - Quadratic&lt;br /&gt;
|-&lt;br /&gt;
| 0x3D&lt;br /&gt;
| float&lt;br /&gt;
| {{unknown|'''Unknown'''}}&lt;br /&gt;
| Possibly unused&lt;br /&gt;
|-&lt;br /&gt;
| 0x41&lt;br /&gt;
| colspan=3 {{unknown|End of light}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Metroid Prime 3 ===&lt;br /&gt;
&lt;br /&gt;
Prime 3's light format is very similar, but there's a number of new fields introduced (most of which are currently unknown).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Description&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| long&lt;br /&gt;
| '''Light Type'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| float4&lt;br /&gt;
| '''Color'''&lt;br /&gt;
| This color ''does'' have an alpha component, unlike Prime 1 lights.&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| float3&lt;br /&gt;
| '''Position'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| float3&lt;br /&gt;
| '''Direction'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| float3&lt;br /&gt;
| '''Codirection'''&lt;br /&gt;
| The light's up vector&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| float&lt;br /&gt;
| '''Brightness'''&lt;br /&gt;
| Multiplied by color for local ambient, used to calculate distance attenuation coefficients for spot/custom&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| float&lt;br /&gt;
| '''Spot Cutoff'''&lt;br /&gt;
| Used to calculate angle attenuation coefficients for spotlights&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| float&lt;br /&gt;
| {{unknown|'''Unknown'''}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| bool&lt;br /&gt;
| {{unknown|'''Unknown'''}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x45&lt;br /&gt;
| float&lt;br /&gt;
| {{unknown|'''Unknown'''}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x49&lt;br /&gt;
| u32&lt;br /&gt;
| '''Falloff Type'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x4D&lt;br /&gt;
| float&lt;br /&gt;
| {{unknown|'''Unknown'''}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x51&lt;br /&gt;
| float&lt;br /&gt;
| {{unknown|'''Unknown'''}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x55&lt;br /&gt;
| float&lt;br /&gt;
| {{unknown|'''Unknown'''}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x59&lt;br /&gt;
| float&lt;br /&gt;
| {{unknown|'''Unknown'''}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x5D&lt;br /&gt;
| float&lt;br /&gt;
| {{unknown|'''Unknown'''}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x61&lt;br /&gt;
| u32&lt;br /&gt;
| {{unknown|'''Unknown'''}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x65&lt;br /&gt;
| colspan=3 {{unknown|End of light}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Light Types ===&lt;br /&gt;
&lt;br /&gt;
The first value in each light is a type value. These are the possible values:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type&lt;br /&gt;
! Name&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| Local Ambient&lt;br /&gt;
|-&lt;br /&gt;
| 0x1&lt;br /&gt;
| Directional&lt;br /&gt;
|-&lt;br /&gt;
| 0x3&lt;br /&gt;
| Spot&lt;br /&gt;
|-&lt;br /&gt;
| Other&lt;br /&gt;
| Custom&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note that although the game supports point lights, those can't be set through the MREA files; custom lights are used for omnidirectional lights.&lt;br /&gt;
&lt;br /&gt;
== Light Functionality ==&lt;br /&gt;
&lt;br /&gt;
=== Local Ambient ===&lt;br /&gt;
&lt;br /&gt;
Ambient lights represent the brightness/color of an area in the absence of any regular lights. There's typically one of these per area; it's not known how they interact if there's more than one. For ambient lights, the color is not used directly; it's multiplied by the Multiplier value and then clamped between 0 and 1, and the result is used as the ambient color.&lt;br /&gt;
&lt;br /&gt;
=== Directional ===&lt;br /&gt;
&lt;br /&gt;
Directional lights are lights that have a constant direction for every vertex in the scene. Since GX doesn't have any built-in functions for handling directional lights, the way the game implements this is by taking the light's direction, inverting it, and then multiplying it by 1048576; the result is used as the light's position.&lt;br /&gt;
&lt;br /&gt;
=== Spot ===&lt;br /&gt;
&lt;br /&gt;
Spot lights shine in a specific direction from a specific position. Distance attenuation is calculated the same way as with custom lights. For angular attenuation, this is calculated using the spot cutoff parameter. The cutoff value from the file is halved and converted from degrees to radians, and the cosine of the result is calculated. Then the angular attenuation coefficients are calculated as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;(0.0, -CosCutoff / (1.0 - CosCutoff), 1.0 / (1.0 - CosCutoff))&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Custom ===&lt;br /&gt;
&lt;br /&gt;
While the other light types only use a couple of the value to generate lights out of what's essentially a preset setup, custom lights allow for much greater control and customization of the light properties. They're commonly used to represent omnidirectional lights; as such they're by far the most common light type in the game. For attenuation, angular attenuation is set to (1.0, 0.0, 0.0). Distance attenuation is calculated differently depending on the falloff type.&lt;br /&gt;
&lt;br /&gt;
Each falloff type will set one distance attenuation coefficient, with the other two set to 0. For each type:&lt;br /&gt;
&lt;br /&gt;
* 0: '''Constant''': Coefficient A is set to &amp;lt;code&amp;gt;2.0 / Brightness&amp;lt;/code&amp;gt;&lt;br /&gt;
* 1: '''Linear''': Coefficient B is set to &amp;lt;code&amp;gt;250 / Brightness&amp;lt;/code&amp;gt;&lt;br /&gt;
* 2: '''Quadratic''': Coefficient C is set to &amp;lt;code&amp;gt;25000 / Brightness&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:File Formats]]&lt;br /&gt;
[[Category:Metroid Prime]]&lt;br /&gt;
[[Category:Metroid Prime 2: Echoes]]&lt;/div&gt;</summary>
		<author><name>Aruki</name></author>	</entry>

	<entry>
		<id>http://www.metroid2002.com/retromodding/index.php?title=Lights_(Metroid_Prime)&amp;diff=1981</id>
		<title>Lights (Metroid Prime)</title>
		<link rel="alternate" type="text/html" href="http://www.metroid2002.com/retromodding/index.php?title=Lights_(Metroid_Prime)&amp;diff=1981"/>
				<updated>2019-03-27T04:30:18Z</updated>
		
		<summary type="html">&lt;p&gt;Aruki: /* Custom */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The '''lights''' section in Metroid Prime areas defines several different types of lights: local ambient, directional, spot, and custom. Every light type has the same structure in the file; however, different types are utilized in different ways by the engine.&lt;br /&gt;
&lt;br /&gt;
{{research|minor|Lights are mostly figured out; the remaining unknowns are very likely unused, because the game's code never accesses them or passes them to the main light class, but it would be good to have some double-checking. There's also more unknowns in the Prime 3 lights format that probably -are- used.}}&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Format==&lt;br /&gt;
&lt;br /&gt;
The lights section has a very brief header consisting of the magic value &amp;lt;code&amp;gt;0xBABEDEAD&amp;lt;/code&amp;gt;. It's then followed by a number of '''light layers'''. Each light layer consists of a count value, then an array of lights. Each layer represents a separate set of lights; actors can choose with set they're lit with through an object property in LightParameters. The number of light layers is static, but it varies from game to game; Prime 1 and 2 can have up to two light layers, while Prime 3 can have four.&lt;br /&gt;
&lt;br /&gt;
=== Metroid Prime 1/2 ===&lt;br /&gt;
&lt;br /&gt;
Each light is a 0x41-byte struct. Note that the same structure is used for every light type, but not every value is used by every type; in fact, some of them aren't used by any of them.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Description&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| long&lt;br /&gt;
| '''Light Type'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| float3&lt;br /&gt;
| '''Color'''&lt;br /&gt;
| There is no alpha component.&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| float3&lt;br /&gt;
| '''Position'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| float3&lt;br /&gt;
| '''Direction'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| float&lt;br /&gt;
| '''Brightness'''&lt;br /&gt;
| Multiplied by color for local ambient, used to calculate distance attenuation coefficients for spot/custom&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| float&lt;br /&gt;
| '''Spot Cutoff'''&lt;br /&gt;
| Used to calculate angle attenuation coefficients for spotlights&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| float&lt;br /&gt;
| {{unknown|'''Unknown'''}}&lt;br /&gt;
| Possibly unused&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| bool&lt;br /&gt;
| {{unknown|'''Unknown'''}}&lt;br /&gt;
| Possibly unused&lt;br /&gt;
|-&lt;br /&gt;
| 0x35&lt;br /&gt;
| float&lt;br /&gt;
| {{unknown|'''Unknown'''}}&lt;br /&gt;
| Possibly unused&lt;br /&gt;
|-&lt;br /&gt;
| 0x39&lt;br /&gt;
| long&lt;br /&gt;
| '''Falloff Type'''&lt;br /&gt;
| Possible values: 0 - Constant; 1 - Linear; 2 - Quadratic&lt;br /&gt;
|-&lt;br /&gt;
| 0x3D&lt;br /&gt;
| float&lt;br /&gt;
| {{unknown|'''Unknown'''}}&lt;br /&gt;
| Possibly unused&lt;br /&gt;
|-&lt;br /&gt;
| 0x41&lt;br /&gt;
| colspan=3 {{unknown|End of light}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Metroid Prime 3 ===&lt;br /&gt;
&lt;br /&gt;
Prime 3's light format is very similar, but there's a number of new fields introduced (most of which are currently unknown).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Description&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| long&lt;br /&gt;
| '''Light Type'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| float4&lt;br /&gt;
| '''Color'''&lt;br /&gt;
| This color ''does'' have an alpha component, unlike Prime 1 lights.&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| float3&lt;br /&gt;
| '''Position'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| float3&lt;br /&gt;
| '''Direction'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| float3&lt;br /&gt;
| '''Codirection'''&lt;br /&gt;
| The light's up vector&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| float&lt;br /&gt;
| '''Brightness'''&lt;br /&gt;
| Multiplied by color for local ambient, used to calculate distance attenuation coefficients for spot/custom&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| float&lt;br /&gt;
| '''Spot Cutoff'''&lt;br /&gt;
| Used to calculate angle attenuation coefficients for spotlights&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| float&lt;br /&gt;
| {{unknown|'''Unknown'''}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| bool&lt;br /&gt;
| {{unknown|'''Unknown'''}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x45&lt;br /&gt;
| float&lt;br /&gt;
| {{unknown|'''Unknown'''}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x49&lt;br /&gt;
| u32&lt;br /&gt;
| Falloff Type&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x4D&lt;br /&gt;
| float&lt;br /&gt;
| {{unknown|'''Unknown'''}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x51&lt;br /&gt;
| float&lt;br /&gt;
| {{unknown|'''Unknown'''}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x55&lt;br /&gt;
| float&lt;br /&gt;
| {{unknown|'''Unknown'''}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x59&lt;br /&gt;
| float&lt;br /&gt;
| {{unknown|'''Unknown'''}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x5D&lt;br /&gt;
| float&lt;br /&gt;
| {{unknown|'''Unknown'''}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x61&lt;br /&gt;
| u32&lt;br /&gt;
| {{unknown|'''Unknown'''}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x65&lt;br /&gt;
| colspan=3 {{unknown|End of light}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Light Types ===&lt;br /&gt;
&lt;br /&gt;
The first value in each light is a type value. These are the possible values:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type&lt;br /&gt;
! Name&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| Local Ambient&lt;br /&gt;
|-&lt;br /&gt;
| 0x1&lt;br /&gt;
| Directional&lt;br /&gt;
|-&lt;br /&gt;
| 0x3&lt;br /&gt;
| Spot&lt;br /&gt;
|-&lt;br /&gt;
| Other&lt;br /&gt;
| Custom&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note that although the game supports point lights, those can't be set through the MREA files; custom lights are used for omnidirectional lights.&lt;br /&gt;
&lt;br /&gt;
== Light Functionality ==&lt;br /&gt;
&lt;br /&gt;
=== Local Ambient ===&lt;br /&gt;
&lt;br /&gt;
Ambient lights represent the brightness/color of an area in the absence of any regular lights. There's typically one of these per area; it's not known how they interact if there's more than one. For ambient lights, the color is not used directly; it's multiplied by the Multiplier value and then clamped between 0 and 1, and the result is used as the ambient color.&lt;br /&gt;
&lt;br /&gt;
=== Directional ===&lt;br /&gt;
&lt;br /&gt;
Directional lights are lights that have a constant direction for every vertex in the scene. Since GX doesn't have any built-in functions for handling directional lights, the way the game implements this is by taking the light's direction, inverting it, and then multiplying it by 1048576; the result is used as the light's position.&lt;br /&gt;
&lt;br /&gt;
=== Spot ===&lt;br /&gt;
&lt;br /&gt;
Spot lights shine in a specific direction from a specific position. Distance attenuation is calculated the same way as with custom lights. For angular attenuation, this is calculated using the spot cutoff parameter. The cutoff value from the file is halved and converted from degrees to radians, and the cosine of the result is calculated. Then the angular attenuation coefficients are calculated as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;(0.0, -CosCutoff / (1.0 - CosCutoff), 1.0 / (1.0 - CosCutoff))&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Custom ===&lt;br /&gt;
&lt;br /&gt;
While the other light types only use a couple of the value to generate lights out of what's essentially a preset setup, custom lights allow for much greater control and customization of the light properties. They're commonly used to represent omnidirectional lights; as such they're by far the most common light type in the game. For attenuation, angular attenuation is set to (1.0, 0.0, 0.0). Distance attenuation is calculated differently depending on the falloff type.&lt;br /&gt;
&lt;br /&gt;
Each falloff type will set one distance attenuation coefficient, with the other two set to 0. For each type:&lt;br /&gt;
&lt;br /&gt;
* 0: '''Constant''': Coefficient A is set to &amp;lt;code&amp;gt;2.0 / Brightness&amp;lt;/code&amp;gt;&lt;br /&gt;
* 1: '''Linear''': Coefficient B is set to &amp;lt;code&amp;gt;250 / Brightness&amp;lt;/code&amp;gt;&lt;br /&gt;
* 2: '''Quadratic''': Coefficient C is set to &amp;lt;code&amp;gt;25000 / Brightness&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:File Formats]]&lt;br /&gt;
[[Category:Metroid Prime]]&lt;br /&gt;
[[Category:Metroid Prime 2: Echoes]]&lt;/div&gt;</summary>
		<author><name>Aruki</name></author>	</entry>

	<entry>
		<id>http://www.metroid2002.com/retromodding/index.php?title=Lights_(Metroid_Prime)&amp;diff=1980</id>
		<title>Lights (Metroid Prime)</title>
		<link rel="alternate" type="text/html" href="http://www.metroid2002.com/retromodding/index.php?title=Lights_(Metroid_Prime)&amp;diff=1980"/>
				<updated>2019-03-27T04:29:53Z</updated>
		
		<summary type="html">&lt;p&gt;Aruki: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The '''lights''' section in Metroid Prime areas defines several different types of lights: local ambient, directional, spot, and custom. Every light type has the same structure in the file; however, different types are utilized in different ways by the engine.&lt;br /&gt;
&lt;br /&gt;
{{research|minor|Lights are mostly figured out; the remaining unknowns are very likely unused, because the game's code never accesses them or passes them to the main light class, but it would be good to have some double-checking. There's also more unknowns in the Prime 3 lights format that probably -are- used.}}&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Format==&lt;br /&gt;
&lt;br /&gt;
The lights section has a very brief header consisting of the magic value &amp;lt;code&amp;gt;0xBABEDEAD&amp;lt;/code&amp;gt;. It's then followed by a number of '''light layers'''. Each light layer consists of a count value, then an array of lights. Each layer represents a separate set of lights; actors can choose with set they're lit with through an object property in LightParameters. The number of light layers is static, but it varies from game to game; Prime 1 and 2 can have up to two light layers, while Prime 3 can have four.&lt;br /&gt;
&lt;br /&gt;
=== Metroid Prime 1/2 ===&lt;br /&gt;
&lt;br /&gt;
Each light is a 0x41-byte struct. Note that the same structure is used for every light type, but not every value is used by every type; in fact, some of them aren't used by any of them.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Description&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| long&lt;br /&gt;
| '''Light Type'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| float3&lt;br /&gt;
| '''Color'''&lt;br /&gt;
| There is no alpha component.&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| float3&lt;br /&gt;
| '''Position'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| float3&lt;br /&gt;
| '''Direction'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| float&lt;br /&gt;
| '''Brightness'''&lt;br /&gt;
| Multiplied by color for local ambient, used to calculate distance attenuation coefficients for spot/custom&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| float&lt;br /&gt;
| '''Spot Cutoff'''&lt;br /&gt;
| Used to calculate angle attenuation coefficients for spotlights&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| float&lt;br /&gt;
| {{unknown|'''Unknown'''}}&lt;br /&gt;
| Possibly unused&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| bool&lt;br /&gt;
| {{unknown|'''Unknown'''}}&lt;br /&gt;
| Possibly unused&lt;br /&gt;
|-&lt;br /&gt;
| 0x35&lt;br /&gt;
| float&lt;br /&gt;
| {{unknown|'''Unknown'''}}&lt;br /&gt;
| Possibly unused&lt;br /&gt;
|-&lt;br /&gt;
| 0x39&lt;br /&gt;
| long&lt;br /&gt;
| '''Falloff Type'''&lt;br /&gt;
| Possible values: 0 - Constant; 1 - Linear; 2 - Quadratic&lt;br /&gt;
|-&lt;br /&gt;
| 0x3D&lt;br /&gt;
| float&lt;br /&gt;
| {{unknown|'''Unknown'''}}&lt;br /&gt;
| Possibly unused&lt;br /&gt;
|-&lt;br /&gt;
| 0x41&lt;br /&gt;
| colspan=3 {{unknown|End of light}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Metroid Prime 3 ===&lt;br /&gt;
&lt;br /&gt;
Prime 3's light format is very similar, but there's a number of new fields introduced (most of which are currently unknown).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Description&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| long&lt;br /&gt;
| '''Light Type'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| float4&lt;br /&gt;
| '''Color'''&lt;br /&gt;
| This color ''does'' have an alpha component, unlike Prime 1 lights.&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| float3&lt;br /&gt;
| '''Position'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| float3&lt;br /&gt;
| '''Direction'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| float3&lt;br /&gt;
| '''Codirection'''&lt;br /&gt;
| The light's up vector&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| float&lt;br /&gt;
| '''Brightness'''&lt;br /&gt;
| Multiplied by color for local ambient, used to calculate distance attenuation coefficients for spot/custom&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| float&lt;br /&gt;
| '''Spot Cutoff'''&lt;br /&gt;
| Used to calculate angle attenuation coefficients for spotlights&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| float&lt;br /&gt;
| {{unknown|'''Unknown'''}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| bool&lt;br /&gt;
| {{unknown|'''Unknown'''}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x45&lt;br /&gt;
| float&lt;br /&gt;
| {{unknown|'''Unknown'''}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x49&lt;br /&gt;
| u32&lt;br /&gt;
| Falloff Type&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x4D&lt;br /&gt;
| float&lt;br /&gt;
| {{unknown|'''Unknown'''}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x51&lt;br /&gt;
| float&lt;br /&gt;
| {{unknown|'''Unknown'''}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x55&lt;br /&gt;
| float&lt;br /&gt;
| {{unknown|'''Unknown'''}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x59&lt;br /&gt;
| float&lt;br /&gt;
| {{unknown|'''Unknown'''}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x5D&lt;br /&gt;
| float&lt;br /&gt;
| {{unknown|'''Unknown'''}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x61&lt;br /&gt;
| u32&lt;br /&gt;
| {{unknown|'''Unknown'''}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x65&lt;br /&gt;
| colspan=3 {{unknown|End of light}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Light Types ===&lt;br /&gt;
&lt;br /&gt;
The first value in each light is a type value. These are the possible values:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type&lt;br /&gt;
! Name&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| Local Ambient&lt;br /&gt;
|-&lt;br /&gt;
| 0x1&lt;br /&gt;
| Directional&lt;br /&gt;
|-&lt;br /&gt;
| 0x3&lt;br /&gt;
| Spot&lt;br /&gt;
|-&lt;br /&gt;
| Other&lt;br /&gt;
| Custom&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note that although the game supports point lights, those can't be set through the MREA files; custom lights are used for omnidirectional lights.&lt;br /&gt;
&lt;br /&gt;
== Light Functionality ==&lt;br /&gt;
&lt;br /&gt;
=== Local Ambient ===&lt;br /&gt;
&lt;br /&gt;
Ambient lights represent the brightness/color of an area in the absence of any regular lights. There's typically one of these per area; it's not known how they interact if there's more than one. For ambient lights, the color is not used directly; it's multiplied by the Multiplier value and then clamped between 0 and 1, and the result is used as the ambient color.&lt;br /&gt;
&lt;br /&gt;
=== Directional ===&lt;br /&gt;
&lt;br /&gt;
Directional lights are lights that have a constant direction for every vertex in the scene. Since GX doesn't have any built-in functions for handling directional lights, the way the game implements this is by taking the light's direction, inverting it, and then multiplying it by 1048576; the result is used as the light's position.&lt;br /&gt;
&lt;br /&gt;
=== Spot ===&lt;br /&gt;
&lt;br /&gt;
Spot lights shine in a specific direction from a specific position. Distance attenuation is calculated the same way as with custom lights. For angular attenuation, this is calculated using the spot cutoff parameter. The cutoff value from the file is halved and converted from degrees to radians, and the cosine of the result is calculated. Then the angular attenuation coefficients are calculated as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;(0.0, -CosCutoff / (1.0 - CosCutoff), 1.0 / (1.0 - CosCutoff))&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Custom ===&lt;br /&gt;
&lt;br /&gt;
While the other light types only use a couple of the value to generate lights out of what's essentially a preset setup, custom lights allow for much greater control and customization of the light properties. They're commonly used to represent omnidirectional lights; as such they're by far the most common light type in the game. For attenuation, angular attenuation is set to (1.0, 0.0, 0.0). Distance attenuation is calculated differently depending on the falloff type.&lt;br /&gt;
&lt;br /&gt;
Each falloff type will set one distance attenuation coefficient, with the other two set to 0. For each type:&lt;br /&gt;
&lt;br /&gt;
* 0: '''Constant''': Coefficient A is set to &amp;lt;code&amp;gt;2.0 / Multiplier&amp;lt;/code&amp;gt;&lt;br /&gt;
* 1: '''Linear''': Coefficient B is set to &amp;lt;code&amp;gt;250 / Multiplier&amp;lt;/code&amp;gt;&lt;br /&gt;
* 2: '''Quadratic''': Coefficient C is set to &amp;lt;code&amp;gt;25000 / Multiplier&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:File Formats]]&lt;br /&gt;
[[Category:Metroid Prime]]&lt;br /&gt;
[[Category:Metroid Prime 2: Echoes]]&lt;/div&gt;</summary>
		<author><name>Aruki</name></author>	</entry>

	<entry>
		<id>http://www.metroid2002.com/retromodding/index.php?title=GUID&amp;diff=1961</id>
		<title>GUID</title>
		<link rel="alternate" type="text/html" href="http://www.metroid2002.com/retromodding/index.php?title=GUID&amp;diff=1961"/>
				<updated>2019-02-05T07:19:58Z</updated>
		
		<summary type="html">&lt;p&gt;Aruki: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A '''GUID''' is a 128-bit ID used to uniquely identify an object. They are used in [[Metroid Prime 3: Corruption]] and [[Donkey Kong Country Returns]] to uniquely identify a value stored in the save file. They are also commonly used in [[Donkey Kong Country: Tropical Freeze]] as identifiers for all sorts of objects.&lt;br /&gt;
&lt;br /&gt;
== MP3/DKCR ==&lt;br /&gt;
&lt;br /&gt;
Script objects that need to preserve data between play sessions will have a GUID listed as a property (with property ID 0x16D9A75D, which hashes to &amp;quot;ObjectId&amp;quot;). That ID is also stored in the [[SAVW (File Format)|SAVW]] file and associated with the object's instance ID. At runtime, when the object is loaded it uses the GUID to look up the value of the parameter and then updates itself accordingly. The GUIDs declared from the SAVW file are only valid within the world the SAVW file is associated with; reusing the same GUID from a different world is treated as a separate value.&lt;br /&gt;
&lt;br /&gt;
GUIDs are also used by script layers to track whether the layer is active. The GUIDs associated with each layer can be found in the [[MLVL (File Format)|MLVL]] file. Layer GUIDs are different from the other IDs in that they are valid across the entire game, when referenced from any world.&lt;br /&gt;
&lt;br /&gt;
GUIDs are used by the following objects:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Object&lt;br /&gt;
! Usage&lt;br /&gt;
! MP3&lt;br /&gt;
! DKCR&lt;br /&gt;
|-&lt;br /&gt;
| Script Layer&lt;br /&gt;
| Tracks whether the layer is active or not.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| CinematicCamera&lt;br /&gt;
| Tracks whether the cutscene has been watched before. If so, cinematic skip can be enabled. (CinematicCameras that don't have cinematic skip enabled don't have a GUID.)&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| MemoryRelay&lt;br /&gt;
| Tracks whether the relay is active.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| Door&lt;br /&gt;
| Tracks whether the door has been opened at some point during gameplay. This is used to change the door color on the map.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| Pickup&lt;br /&gt;
| Tracks whether the pickup has been acquired before. &lt;br /&gt;
* In MP3, this is used to remove upgrades and expansions that the player has already collected from the map.&lt;br /&gt;
* In DKCR, this is used to grey out puzzle pieces that the player has already collected and prevent them from being collecting a second time.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:Metroid Prime 3: Corruption]]&lt;br /&gt;
[[Category:Donkey Kong Country Returns]]&lt;/div&gt;</summary>
		<author><name>Aruki</name></author>	</entry>

	<entry>
		<id>http://www.metroid2002.com/retromodding/index.php?title=SAVA_(File_Format)&amp;diff=1960</id>
		<title>SAVA (File Format)</title>
		<link rel="alternate" type="text/html" href="http://www.metroid2002.com/retromodding/index.php?title=SAVA_(File_Format)&amp;diff=1960"/>
				<updated>2019-02-05T07:19:20Z</updated>
		
		<summary type="html">&lt;p&gt;Aruki: removing some speculation&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The '''SAVA format''' is the area-specific counterpart of the [[SAVW (File Format)|SAVW format]]. Although every Retro game up to DKCR seems to have some support for the format (judging by its appearance in the dol's cooked extension list going as far back as Prime 1), SAVA files are very rare; there is only one SAVA file that appears in any of the retail release builds of any of the games, which is used with the main menu in Metroid Prime 3 and Metroid Prime Trilogy. The [[Metroid Prime 3 Prototype|Metroid Prime 3 E3 prototype]] has more; Metroid.pak contains a SAVA file for each area.&lt;br /&gt;
&lt;br /&gt;
The structure of a SAVA file is the same as a [[SAVW (File Format)|SAVW file]], except the data it contains applies to a particular area rather than the entire world. The &amp;lt;code&amp;gt;0xC001D00D&amp;lt;/code&amp;gt; magic from SAVW is missing, along with the area count. The version is still present as the first value in the file but uses different version numbers than SAVW.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Version&lt;br /&gt;
! Game&lt;br /&gt;
|-&lt;br /&gt;
| 0x7&lt;br /&gt;
| Metroid Prime 3 Prototype&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| Metroid Prime 3: Corruption&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:File Formats]]&lt;br /&gt;
[[Category:Metroid Prime 3 Prototype]]&lt;br /&gt;
[[Category:Metroid Prime 3: Corruption]]&lt;/div&gt;</summary>
		<author><name>Aruki</name></author>	</entry>

	<entry>
		<id>http://www.metroid2002.com/retromodding/index.php?title=SAVW_(File_Format)&amp;diff=1959</id>
		<title>SAVW (File Format)</title>
		<link rel="alternate" type="text/html" href="http://www.metroid2002.com/retromodding/index.php?title=SAVW_(File_Format)&amp;diff=1959"/>
				<updated>2019-02-05T07:18:04Z</updated>
		
		<summary type="html">&lt;p&gt;Aruki: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The '''SAVW format''' describes save data in the Metroid Prime series and Donkey Kong Country Returns. It allows any data used by the game's script data that needs to be preserved between play sessions to be saved and retrieved from the save file without the executable having to know anything about it. This is used for, for instance, saving whether a particular MemoryRelay has been activated, or whether a specific layer has been toggled on.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Format ==&lt;br /&gt;
&lt;br /&gt;
The format is basically just a series of arrays. The structure remains more or less the same across every game, just with arrays being added or removed. The main difference between formats is that starting in Metroid Prime 3, the engine stores references to saved variables through a combination of a 128-bit state ID and an instance ID instead of implicitly associating them via instance IDs alone. The state ID is mirrored in another file (usually on the object via a property).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
! MP1&lt;br /&gt;
! MP2&lt;br /&gt;
! MP3&lt;br /&gt;
! DKCR&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Magic'''&lt;br /&gt;
| Always &amp;lt;code&amp;gt;0xC001D00D&amp;lt;/code&amp;gt;.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Version'''&lt;br /&gt;
| [[#Version|See below]] for a list of possible version numbers.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Area Count'''&lt;br /&gt;
| Number of areas contained in this world. Always 1 in DKCR.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Cinematic Skip Count'''&lt;br /&gt;
| Count of skippable cinematics.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| [[#Saved State Descriptor|Saved State Descriptor]]&lt;br /&gt;
| ''Cinematic Skip Count''&lt;br /&gt;
| '''Cinematic Skip Array'''&lt;br /&gt;
| Array describing all skippable cinematics in the world. Points to Cinematic Skip SpecialFunctions (MP1) or cameras with cinematic skip enabled (MP2+).&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Memory Relay Count'''&lt;br /&gt;
| Count of Memory Relay instances.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| [[#Saved State Descriptor|Saved State Descriptor]]&lt;br /&gt;
| ''Memory Relay Count''&lt;br /&gt;
| '''Memory Relay Array'''&lt;br /&gt;
| Array describing all Memory Relays in the world.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Layer Toggle Count'''&lt;br /&gt;
| Count of layers that can be toggled on/off from this world.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| [[#Layer Toggle|Layer Toggle]]&lt;br /&gt;
| ''Layer Toggle Count''&lt;br /&gt;
| '''Layer Toggle Array'''&lt;br /&gt;
| Array specifying every layer toggleable from this world (referenced by a ScriptLayerController). The layers specified can be in other worlds.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Door Count'''&lt;br /&gt;
| Count of DoorArea/Door instances.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| [[#Saved State Descriptor|Saved State Descriptor]]&lt;br /&gt;
| ''Door Count''&lt;br /&gt;
| '''Door Array'''&lt;br /&gt;
| Array describing all DoorArea/Door instances in the world.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Scannable Object Count'''&lt;br /&gt;
| Count of scannable objects in the next array.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| [[#Scannable Object|Scannable Object]]&lt;br /&gt;
| ''Scannable Object Count''&lt;br /&gt;
| '''Scannable Object Array'''&lt;br /&gt;
| Array describing every scannable object in this world.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''System State Env Var Count'''&lt;br /&gt;
| Count of system state env vars modified from this world.&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| [[#Environment Variable|Environment Variable]]&lt;br /&gt;
| ''System State Env Var Count''&lt;br /&gt;
| '''System State Env Var Array'''&lt;br /&gt;
| Array of env vars affecting the entire system.&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Game State Env Var Count'''&lt;br /&gt;
| Count of game state env vars modified from this world.&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| [[#Environment Variable|Environment Variable]]&lt;br /&gt;
| ''Game State Env Var Count''&lt;br /&gt;
| '''Game State Env Var Array'''&lt;br /&gt;
| Array of env vars affecting only this save slot.&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Unmappable Object Count'''&lt;br /&gt;
| Count of unmappable objects in the world.&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| [[#Saved State Descriptor|Saved State Descriptor]]&lt;br /&gt;
| ''Unmappable Object Count''&lt;br /&gt;
| '''Unmappable Object Array'''&lt;br /&gt;
| Array describing every instance that can be removed from the map. Primarily Translator Door Location SpecialFunctions in MP2 and Pickups in MP3.&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Puzzle Piece Count'''&lt;br /&gt;
| Count of Puzzle Piece Pickups in this world. (This value also controls the level puzzle piece count that displays on the HUD ingame.)&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| [[#Saved State Descriptor|Saved State Descriptor]]&lt;br /&gt;
| ''Puzzle Piece Count''&lt;br /&gt;
| '''Puzzle Piece Array'''&lt;br /&gt;
| Array describing all Puzzle Piece Pickups.&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| colspan=8 {{unknown|End of file}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Version ===&lt;br /&gt;
&lt;br /&gt;
Each revision of the SAVW format has a unique version number, which corresponds to the following games:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Version&lt;br /&gt;
! Game&lt;br /&gt;
|-&lt;br /&gt;
| 0x3&lt;br /&gt;
| Metroid Prime&lt;br /&gt;
|-&lt;br /&gt;
| 0x5&lt;br /&gt;
| Metroid Prime 2: Echoes&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| Metroid Prime 3: Corruption&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| Donkey Kong Country Returns&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Saved State Descriptor ===&lt;br /&gt;
&lt;br /&gt;
In Metroid Prime 1 and 2, saved state values were referenced only via the instance ID of the object that the state is for. In Prime 3 and DKCR, a 128-bit [[GUID]] was introduced that handles references to save file data, and is stored in the file in conjunction with the instance IDs.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
! MP1&lt;br /&gt;
! MP2&lt;br /&gt;
! MP3&lt;br /&gt;
! DKCR&lt;br /&gt;
|-&lt;br /&gt;
| [[GUID]]&lt;br /&gt;
| '''GUID'''&lt;br /&gt;
| ID of this saved state.&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| '''Instance ID'''&lt;br /&gt;
| Instance ID of the object that uses this saved state.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| colspan=7 {{unknown|End of descriptor}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Layer Toggle ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| '''Area ID'''&lt;br /&gt;
| Internal area ID (not the MREA ID).&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| '''Layer Index'''&lt;br /&gt;
| Index of the layer that can be toggled.&lt;br /&gt;
|-&lt;br /&gt;
| colspan=3 {{unknown|End of layer}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Scannable Object ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| Asset ID&lt;br /&gt;
| '''SCAN Asset ID'''&lt;br /&gt;
| Asset ID of a [[SCAN (Metroid Prime)|SCAN]] file.&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| '''Logbook Category'''&lt;br /&gt;
| Enum describing which logbook category this scan is part of. Always 0 in MP2 and MP3. See below for possible values for MP1.&lt;br /&gt;
|-&lt;br /&gt;
| colspan=3 {{unknown|End of scan}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Possible logbook category values (MP1 only):&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! ID&lt;br /&gt;
! Category&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| Non-Logbook&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| Space Pirate Data&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| Chozo Lore&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| Creatures&lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| Research&lt;br /&gt;
|-&lt;br /&gt;
| 5&lt;br /&gt;
| Artifacts&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Environment Variable ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| string&lt;br /&gt;
| '''Variable Name'''&lt;br /&gt;
| Name of the environment variable as a zero-terminated string.&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| Always 0?&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| Always 1?&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| Always 0?&lt;br /&gt;
|-&lt;br /&gt;
| colspan=3 {{unknown|End of environment variable}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:File Formats]]&lt;br /&gt;
[[Category:Metroid Prime]]&lt;br /&gt;
[[Category:Metroid Prime 2 Demo]]&lt;br /&gt;
[[Category:Metroid Prime 2: Echoes]]&lt;br /&gt;
[[Category:Metroid Prime 3 Prototype]]&lt;br /&gt;
[[Category:Metroid Prime 3: Corruption]]&lt;br /&gt;
[[Category:Donkey Kong Country Returns]]&lt;/div&gt;</summary>
		<author><name>Aruki</name></author>	</entry>

	<entry>
		<id>http://www.metroid2002.com/retromodding/index.php?title=MLVL_(File_Format)&amp;diff=1958</id>
		<title>MLVL (File Format)</title>
		<link rel="alternate" type="text/html" href="http://www.metroid2002.com/retromodding/index.php?title=MLVL_(File_Format)&amp;diff=1958"/>
				<updated>2019-02-05T07:16:46Z</updated>
		
		<summary type="html">&lt;p&gt;Aruki: /* Format */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The '''MLVL format''' defines worlds in the Metroid Prime trilogy and Donkey Kong Country Returns. While the [[MREA (File Format)|MREA format]] defines individual areas, the MLVL is what links together all the areas to create a single cohesive world.&lt;br /&gt;
&lt;br /&gt;
{{research|minor|There's a couple unknown values in this format, but they all seem to have constant values.}}&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Format ==&lt;br /&gt;
&lt;br /&gt;
The format largely defines properties related to each area in general and how they link together, as well as things that apply to the world on a global scale across all areas, such as the skybox.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
! MP1&lt;br /&gt;
! MP2&lt;br /&gt;
! MP3&lt;br /&gt;
! DKCR&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Magic'''&lt;br /&gt;
| Always &amp;lt;code&amp;gt;0xDEAFBABE&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Version'''&lt;br /&gt;
| [[#Version|See below]]&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| Asset ID ([[STRG (File Format)|STRG]])&lt;br /&gt;
| 1&lt;br /&gt;
| '''World Name ID'''&lt;br /&gt;
| [[STRG (File Format)|STRG]] file for the world name.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| Asset ID ([[STRG (File Format)|STRG]])&lt;br /&gt;
| 1&lt;br /&gt;
| '''Dark World Name ID'''&lt;br /&gt;
| [[STRG (File Format)|STRG]] file for the Dark World name.&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Temple Key World Index'''&lt;br /&gt;
| Controls which temple key icons appear on the map screen. Appears in Prime 3 but always 0.&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| bool&lt;br /&gt;
| 1&lt;br /&gt;
| '''Has Time Attack'''&lt;br /&gt;
| Indicates whether this world has a Time Attack mode. '''If false, the next five values are not present.'''&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| string&lt;br /&gt;
| 1&lt;br /&gt;
| '''Level Number'''&lt;br /&gt;
| String of the world/level number; for example, &amp;quot;1-1&amp;quot;. Purpose unknown.&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| float&lt;br /&gt;
| 1&lt;br /&gt;
| '''Time Attack Bronze Time'''&lt;br /&gt;
| Target time for a bronze medal in Time Attack.&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| float&lt;br /&gt;
| 1&lt;br /&gt;
| '''Time Attack Silver Time'''&lt;br /&gt;
| Target time for a silver medal in Time Attack.&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| float&lt;br /&gt;
| 1&lt;br /&gt;
| '''Time Attack Gold Time'''&lt;br /&gt;
| Target time for a gold medal in Time Attack.&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| float&lt;br /&gt;
| 1&lt;br /&gt;
| '''Time Attack Shiny Gold Time'''&lt;br /&gt;
| Target time for a shiny gold medal in Time Attack.&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| Asset ID ([[SAVW (File Format)|SAVW]])&lt;br /&gt;
| 1&lt;br /&gt;
| '''World Save Info ID'''&lt;br /&gt;
| Asset ID for this world's [[SAVW (File Format)|SAVW]] file.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| Asset ID ([[CMDL (File Format)|CMDL]])&lt;br /&gt;
| 1&lt;br /&gt;
| '''Default Skybox ID'''&lt;br /&gt;
| [[CMDL (File Format)|CMDL]] file for this world's default skybox model. This can be overridden per-area by AreaAttributes objects.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Memory Relay Count'''&lt;br /&gt;
| Count of all outgoing connections from Memory Relay instances in this world.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| [[#Memory Relay|Memory Relay]]&lt;br /&gt;
| ''Memory Relay Count''&lt;br /&gt;
| '''Memory Relay Array'''&lt;br /&gt;
| Array describing all outgoing Memory Relay connections in this world. Memory Relays connected to multiple objects are listed multiple times.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Area Count'''&lt;br /&gt;
| Count of areas in this world.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| Always 1?&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| [[#Area|Area]]&lt;br /&gt;
| ''Area Count''&lt;br /&gt;
| '''Area Array'''&lt;br /&gt;
| Array defining all areas that appear in this world.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| Asset ID ([[MAPW (File Format)|MAPW]])&lt;br /&gt;
| 1&lt;br /&gt;
| '''World Map ID'''&lt;br /&gt;
| ID of this world's [[MAPW (File Format)|MAPW]] file.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| u8&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| This is presumably the same unknown value as at the beginning of the [[Scriptable Layers (Metroid Prime)|SCLY]] format. Always 0.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Script Instance Count'''&lt;br /&gt;
| The MLVL format embeds a script layer. This script layer is used in the MP1 demo for storing Dock instances, but it's unused in all retail builds, so this is always 0.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Audio Group Count'''&lt;br /&gt;
| Count of all audio groups used in this world.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| [[#Audio Group|Audio Group]]&lt;br /&gt;
| ''Audio Group Count''&lt;br /&gt;
| '''Audio Group Array'''&lt;br /&gt;
| Array describing all audio groups used in this world.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| string&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| Always empty, so the only value that ever appears here is the terminating 0.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Area Count'''&lt;br /&gt;
| Will be equal to the earlier area count.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| [[#Area Layer Flags|Area Layer Flags]]&lt;br /&gt;
| ''Area Count''&lt;br /&gt;
| '''Area Layer Flags'''&lt;br /&gt;
| This array initializes the default active state for all script layers in each area.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Layer Name Count'''&lt;br /&gt;
| Count of layer names in the next array.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| string&lt;br /&gt;
| ''Layer Name Count''&lt;br /&gt;
| '''Layer Name Array'''&lt;br /&gt;
| Array of all layer names in the world.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Layer GUID Count'''&lt;br /&gt;
| Count of layer GUIDs in the next array.&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| [[GUID]]&lt;br /&gt;
| ''Layer GUID Count''&lt;br /&gt;
| '''Layer GUID Array'''&lt;br /&gt;
| Array of GUIDs for each layer. These GUIDs are responsible for storing the layer's ''Active'' state in the save file and are referenced by ScriptLayerController objects.&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Area Count'''&lt;br /&gt;
| Identical to the previous two area counts.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| ''Area Count''&lt;br /&gt;
| '''Area Layer Name Offset Array'''&lt;br /&gt;
| Each value is an offset into the layer name array and points to where the layer names for each area begins.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| colspan=8 {{unknown|End of file}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Version ===&lt;br /&gt;
&lt;br /&gt;
These are the known version numbers:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! ID&lt;br /&gt;
! Game&lt;br /&gt;
|-&lt;br /&gt;
| 0xD&lt;br /&gt;
| Metroid Prime Demo&lt;br /&gt;
|-&lt;br /&gt;
| 0x11&lt;br /&gt;
| Metroid Prime&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| Metroid Prime 2 Demo&lt;br /&gt;
|-&lt;br /&gt;
| 0x17&lt;br /&gt;
| Metroid Prime 2&lt;br /&gt;
|-&lt;br /&gt;
| 0x19&lt;br /&gt;
| Metroid Prime 3&lt;br /&gt;
|-&lt;br /&gt;
| 0x1B&lt;br /&gt;
| Donkey Kong Country Returns&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Memory Relay ===&lt;br /&gt;
&lt;br /&gt;
This structure only appears in Prime 1. It describes an outgoing connection from a Memory Relay to another script instance. Any Memory Relays connected to multiple objects will appear in the array multiple times.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| u32&lt;br /&gt;
| '''Memory Relay Instance ID'''&lt;br /&gt;
| Instance ID of the sender Memory Relay.&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| u32&lt;br /&gt;
| '''Target Instance ID'''&lt;br /&gt;
| Instance ID of the receiver object.&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| u16&lt;br /&gt;
| '''Message'''&lt;br /&gt;
| Script message sent to the receiver object.&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| bool&lt;br /&gt;
| '''Active'''&lt;br /&gt;
| Whether this Memory Relay object is active by default; almost always 0.&lt;br /&gt;
|-&lt;br /&gt;
| 0x11&lt;br /&gt;
| colspan=3 {{unknown|End of Memory Relay connection}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Area ===&lt;br /&gt;
&lt;br /&gt;
This structure defines a single area and describes its position in the world and how it connects to other areas.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
! MP1&lt;br /&gt;
! MP2&lt;br /&gt;
! MP3&lt;br /&gt;
! DKCR&lt;br /&gt;
|-&lt;br /&gt;
| Asset ID ([[STRG (File Format)|STRG]])&lt;br /&gt;
| 1&lt;br /&gt;
| '''Area Name ID'''&lt;br /&gt;
| [[STRG (File Format)|STRG]] ID for the area name.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| float&lt;br /&gt;
| 12&lt;br /&gt;
| '''Area Transform'''&lt;br /&gt;
| Area's transform matrix. Most area data is pre-transformed, but there are a few things that need to be transformed by this matrix.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| float&lt;br /&gt;
| 6&lt;br /&gt;
| '''Area Bounding Box'''&lt;br /&gt;
| This is the bounding box of the area's collision mesh and is equivalent to the bounding box found in the [[MREA (File Format)|MREA]] collision section.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| Asset ID ([[MREA (File Format)|MREA]])&lt;br /&gt;
| 1&lt;br /&gt;
| '''Area MREA ID'''&lt;br /&gt;
| ID of this area's [[MREA (File Format)|MREA]] file.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| Asset ID&lt;br /&gt;
| 1&lt;br /&gt;
| '''Internal Area ID'''&lt;br /&gt;
| Doesn't actually refer to an asset, but has the same length as an asset ID. This ID is used internally by some things to refer to this area, such as Script Layer Controllers.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Attached Area Count'''&lt;br /&gt;
| Count of areas attached to this one.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| u16&lt;br /&gt;
| ''Attached Area Count''&lt;br /&gt;
| '''Attached Area Index Array'''&lt;br /&gt;
| Array of area indices attached to this one.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| [[#Area Dependencies|Area Dependencies]]&lt;br /&gt;
| 1&lt;br /&gt;
| '''Dependencies'''&lt;br /&gt;
| Asset dependencies in this area. See below for details. Starting in Prime 3, this section has been moved inside the [[MREA (File Format)|MREA]] file.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Dock Count'''&lt;br /&gt;
| Count of Dock instances in this area.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| [[#Dock|Dock]]&lt;br /&gt;
| ''Dock Count''&lt;br /&gt;
| '''Dock Array'''&lt;br /&gt;
| Array describing all docks in this area.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| [[#Area Module Dependencies|Area Module Dependencies]]&lt;br /&gt;
| 1&lt;br /&gt;
| '''Module Dependencies'''&lt;br /&gt;
| REL module dependencies in this area. See below for details. The equivalent section in Prime 3 and DKCR describing RSO modules has been moved inside the [[MREA (File Format)|MREA]] format.&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| Always 0?&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| string&lt;br /&gt;
| 1&lt;br /&gt;
| '''Internal Area Name'''&lt;br /&gt;
| Internal name of this area. This name will be used ingame on the map screen if no ''Area Name ID'' is specified, prefixed with &amp;quot;!!&amp;quot;.&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| colspan=8 {{unknown|End of area}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Area Dependencies ====&lt;br /&gt;
&lt;br /&gt;
This is a data chunk appearing in the area definition in Metroid Prime 1 and 2 that lists all assets needed to load the area. It's extremely important that this list be optimized and complete, as all assets listed here will be perpetually kept in memory as long as the area itself is in memory; the list also specifies the order that assets are loaded in, so '''it must be grouped by load order to roughly match the [[PAK (File Format)|PAK]] file for optimized load times'''. Assets that are missing will still be dynamically loaded after the area itself is loaded, but this will cause the game to freeze up until the load is finished. There are a few exceptions that are excluded from this list in the original game files (and should be excluded in custom MLVLs as well to avoid out-of-memory crashes):&lt;br /&gt;
&lt;br /&gt;
* [[SCAN (File Format)|SCAN]] files and their dependencies are not included in the list in MP1. These are loaded dynamically after the area itself is finished loading, presumably so that scan dependencies are not kept in memory when the scan isn't actually in use. In MP2, SCANs are actually included in the list but their dependencies aren't.&lt;br /&gt;
* [[ANCS (File Format)|ANCS]] per-character dependencies for PlayerActor script instances are not included; this allows the game to avoid keeping assets in memory for suits that the player doesn't have. The exception is the Empty Suit character (character index 5 in MP1, and index 3 in MP2), which is a low-memory-overhead character that allows for the list to include all common assets that are stored in the file per-character (such as particle effects).&lt;br /&gt;
* The skybox model and its dependencies are not included.&lt;br /&gt;
&lt;br /&gt;
The dependency list is split by layer; after the dependencies itself, an array of offsets into the dependency list is provided that allows the game to only load assets for layers that are currently active. The last offset points to all common resources used by the area that aren't layer-specific. With that in mind, every layer needs to have a full list of its required assets even if they're also used by other layers. There's no harm in including an asset multiple times, as if an asset is already in memory then it'll simply be skipped over.&lt;br /&gt;
&lt;br /&gt;
This data chunk still exists in Prime 3 and DKCR, but it's been moved inside the [[MREA (File Format)|MREA]] format.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Dependency Count'''&lt;br /&gt;
| Count of dependencies.&lt;br /&gt;
|-&lt;br /&gt;
| [[#Dependency|Dependency]]&lt;br /&gt;
| ''Dependency Count''&lt;br /&gt;
| '''Dependency Array'''&lt;br /&gt;
| Array of all asset dependencies in this area.&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Dependency Offset Count'''&lt;br /&gt;
| Count of dependency offsets. This will be equal to the area script layer count + 1.&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| ''Dependency Offset Count''&lt;br /&gt;
| '''Dependency Offset Array'''&lt;br /&gt;
| Array of offsets into the dependency array. There is one offset per script layer, with the offset referring to the index of that layer's first dependency. There is a final extra offset that points to area dependencies that are not layer-specific.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== Dependency =====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| Asset ID&lt;br /&gt;
| 1&lt;br /&gt;
| '''Dependency Asset ID'''&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| char&lt;br /&gt;
| 4&lt;br /&gt;
| '''Dependency Asset Type'''&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Dock ====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Connecting Dock Count'''&lt;br /&gt;
| Count of docks connecting to this one. Typically 1 (but there are docks in Prime 3 that connect to multiple areas).&lt;br /&gt;
|-&lt;br /&gt;
| [[#Connecting Dock|Connecting Dock]]&lt;br /&gt;
| ''Connecting Dock Count''&lt;br /&gt;
| '''Connecting Dock Array'''&lt;br /&gt;
| Array describing all docks connected to this one.&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Dock Coordinate Count'''&lt;br /&gt;
| Array of dock coordinates in the next array.&lt;br /&gt;
|-&lt;br /&gt;
| Vector3&lt;br /&gt;
| ''Dock Coordinate Count''&lt;br /&gt;
| '''Dock Coordinates'''&lt;br /&gt;
| Exact purpose/function of this is not known yet.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== Connecting Dock =====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| u32&lt;br /&gt;
| '''Area Index'''&lt;br /&gt;
| Index of the area this dock is in.&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| u32&lt;br /&gt;
| '''Dock Index'''&lt;br /&gt;
| Index of this dock within its area.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Area Module Dependencies ====&lt;br /&gt;
&lt;br /&gt;
This is a data chunk appearing in the area definitions that describes all REL modules that must be linked in for this area to run. These are tied to script objects. The list is split per-layer so that only modules being used by the active layer are linked in; modules will appear once in the list for each layer that uses it. After the REL list, there is an array of offsets that points to the starting index in the list for each script layer, similar to the regular area dependencies list. For an unknown reason, the offsets list contains two offsets per layer. The first one refers to the layer's start index while the second one is usually empty, which effectively makes it an end index.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''REL Module Count'''&lt;br /&gt;
| Count of REL modules in the next array.&lt;br /&gt;
|-&lt;br /&gt;
| string&lt;br /&gt;
| ''REL Module Count''&lt;br /&gt;
| '''REL Module Array'''&lt;br /&gt;
| REL modules used by this area. Each array entry is the filename of a .REL module.&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''REL Offset Count'''&lt;br /&gt;
| Count of REL offsets in the next array. Should be equal to the area script layer count * 2.&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| ''REL Offset Count''&lt;br /&gt;
| '''REL Offset Array'''&lt;br /&gt;
| Array of offsets into the ''REL Module Array''. There are two offsets per script layer, with the first one being that layer's start index and the second one effectively being that layer's end index.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Audio Group ===&lt;br /&gt;
&lt;br /&gt;
This structure is only present in Prime 1 and describes an [[AGSC (File Format)|AGSC]] file being used in this world.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| u32&lt;br /&gt;
| '''Group ID'''&lt;br /&gt;
| Group ID for this audio group. This is the same value that can be found in the Project chunk in the referenced [[AGSC (File Format)|AGSC]] file.&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| Asset ID ([[AGSC (File Format)|AGSC]])&lt;br /&gt;
| '''AGSC ID'''&lt;br /&gt;
| The [[AGSC (File Format)|AGSC]] file for this audio group.&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| colspan=3 {{unknown|End of audio group definition}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Area Layer Flags ===&lt;br /&gt;
&lt;br /&gt;
This is a small structure that determines which areas are active by default. It contains a layer count and then a 64-bit flag, with each bit corresponding to a particular layer; if the bit is set, then the layer will be active on a new save file. The low-order bits correspond to the lower layer indices. Bits for layers that don't exist are defaulted to on.&lt;br /&gt;
&lt;br /&gt;
Note that due to the size of these flags as well as a few other pieces of data in other formats, the maximum number of layers that can be contained in a single area is 64.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| u32&lt;br /&gt;
| '''Layer Count'''&lt;br /&gt;
| Count of layers in this area.&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| u64&lt;br /&gt;
| '''Layer Flags'''&lt;br /&gt;
| See above for a description of how these work.&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| colspan=3 {{unknown|End of area layer flags}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:File Formats]]&lt;br /&gt;
[[Category:Metroid Prime]]&lt;br /&gt;
[[Category:Metroid Prime 2: Echoes]]&lt;br /&gt;
[[Category:Metroid Prime 3: Corruption]]&lt;br /&gt;
[[Category:Donkey Kong Country Returns]]&lt;/div&gt;</summary>
		<author><name>Aruki</name></author>	</entry>

	<entry>
		<id>http://www.metroid2002.com/retromodding/index.php?title=MLVL_(File_Format)&amp;diff=1957</id>
		<title>MLVL (File Format)</title>
		<link rel="alternate" type="text/html" href="http://www.metroid2002.com/retromodding/index.php?title=MLVL_(File_Format)&amp;diff=1957"/>
				<updated>2019-02-05T07:16:24Z</updated>
		
		<summary type="html">&lt;p&gt;Aruki: /* Format */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The '''MLVL format''' defines worlds in the Metroid Prime trilogy and Donkey Kong Country Returns. While the [[MREA (File Format)|MREA format]] defines individual areas, the MLVL is what links together all the areas to create a single cohesive world.&lt;br /&gt;
&lt;br /&gt;
{{research|minor|There's a couple unknown values in this format, but they all seem to have constant values.}}&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Format ==&lt;br /&gt;
&lt;br /&gt;
The format largely defines properties related to each area in general and how they link together, as well as things that apply to the world on a global scale across all areas, such as the skybox.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
! MP1&lt;br /&gt;
! MP2&lt;br /&gt;
! MP3&lt;br /&gt;
! DKCR&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Magic'''&lt;br /&gt;
| Always &amp;lt;code&amp;gt;0xDEAFBABE&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Version'''&lt;br /&gt;
| [[#Version|See below]]&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| Asset ID ([[STRG (File Format)|STRG]])&lt;br /&gt;
| 1&lt;br /&gt;
| '''World Name ID'''&lt;br /&gt;
| [[STRG (File Format)|STRG]] file for the world name.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| Asset ID ([[STRG (File Format)|STRG]])&lt;br /&gt;
| 1&lt;br /&gt;
| '''Dark World Name ID'''&lt;br /&gt;
| [[STRG (File Format)|STRG]] file for the Dark World name.&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Temple Key World Index'''&lt;br /&gt;
| Controls which temple key icons appear on the map screen. Appears in Prime 3 but always 0.&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| bool&lt;br /&gt;
| 1&lt;br /&gt;
| '''Has Time Attack'''&lt;br /&gt;
| Indicates whether this world has a Time Attack mode. '''If false, the next five values are not present.'''&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| string&lt;br /&gt;
| 1&lt;br /&gt;
| '''Level Number'''&lt;br /&gt;
| String of the world/level number; for example, &amp;quot;1-1&amp;quot;. Purpose unknown.&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| float&lt;br /&gt;
| 1&lt;br /&gt;
| '''Time Attack Bronze Time'''&lt;br /&gt;
| Target time for a bronze medal in Time Attack.&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| float&lt;br /&gt;
| 1&lt;br /&gt;
| '''Time Attack Silver Time'''&lt;br /&gt;
| Target time for a silver medal in Time Attack.&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| float&lt;br /&gt;
| 1&lt;br /&gt;
| '''Time Attack Gold Time'''&lt;br /&gt;
| Target time for a gold medal in Time Attack.&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| float&lt;br /&gt;
| 1&lt;br /&gt;
| '''Time Attack Shiny Gold Time'''&lt;br /&gt;
| Target time for a shiny gold medal in Time Attack.&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| Asset ID ([[SAVW (File Format)|SAVW]])&lt;br /&gt;
| 1&lt;br /&gt;
| '''World Save Info ID'''&lt;br /&gt;
| Asset ID for this world's [[SAVW (File Format)|SAVW]] file.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| Asset ID ([[CMDL (File Format)|CMDL]])&lt;br /&gt;
| 1&lt;br /&gt;
| '''Default Skybox ID'''&lt;br /&gt;
| [[CMDL (File Format)|CMDL]] file for this world's default skybox model. This can be overridden per-area by AreaAttributes objects.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Memory Relay Count'''&lt;br /&gt;
| Count of all outgoing connections from Memory Relay instances in this world.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| [[#Memory Relay|Memory Relay]]&lt;br /&gt;
| ''Memory Relay Count''&lt;br /&gt;
| '''Memory Relay Array'''&lt;br /&gt;
| Array describing all outgoing Memory Relay connections in this world. Memory Relays connected to multiple objects are listed multiple times.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Area Count'''&lt;br /&gt;
| Count of areas in this world.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| Always 1?&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| [[#Area|Area]]&lt;br /&gt;
| ''Area Count''&lt;br /&gt;
| '''Area Array'''&lt;br /&gt;
| Array defining all areas that appear in this world.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| Asset ID ([[MAPW (File Format)|MAPW]])&lt;br /&gt;
| 1&lt;br /&gt;
| '''World Map ID'''&lt;br /&gt;
| ID of this world's [[MAPW (File Format)|MAPW]] file.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| u8&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| This is presumably the same unknown value as at the beginning of the [[Scriptable Layers (Metroid Prime)|SCLY]] format. Always 0.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Script Instance Count'''&lt;br /&gt;
| The MLVL format embeds a script layer. This script layer is used in the MP1 demo for storing Dock instances, but it's unused in all retail builds, so this is always 0.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Audio Group Count'''&lt;br /&gt;
| Count of all audio groups used in this world.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| [[#Audio Group|Audio Group]]&lt;br /&gt;
| ''Audio Group Count''&lt;br /&gt;
| '''Audio Group Array'''&lt;br /&gt;
| Array describing all audio groups used in this world.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| string&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| Always empty, so the only value that ever appears here is the terminating 0.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Area Count'''&lt;br /&gt;
| Will be equal to the earlier area count.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| [[#Area Layer Flags|Area Layer Flags]]&lt;br /&gt;
| ''Area Count''&lt;br /&gt;
| '''Area Layer Flags'''&lt;br /&gt;
| This array initializes the default active state for all script layers in each area.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Layer Name Count'''&lt;br /&gt;
| Count of layer names in the next array.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| string&lt;br /&gt;
| ''Layer Name Count''&lt;br /&gt;
| '''Layer Name Array'''&lt;br /&gt;
| Array of all layer names in the world.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Layer State ID Count'''&lt;br /&gt;
| Count of layer state IDs in the next array.&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| [[GUID]]&lt;br /&gt;
| ''Layer GUID Count''&lt;br /&gt;
| '''Layer GUID Array'''&lt;br /&gt;
| Array of GUIDs for each layer. These GUIDs are responsible for storing the layer's active state in the save file and are referenced by ScriptLayerController objects.&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Area Count'''&lt;br /&gt;
| Identical to the previous two area counts.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| ''Area Count''&lt;br /&gt;
| '''Area Layer Name Offset Array'''&lt;br /&gt;
| Each value is an offset into the layer name array and points to where the layer names for each area begins.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| colspan=8 {{unknown|End of file}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Version ===&lt;br /&gt;
&lt;br /&gt;
These are the known version numbers:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! ID&lt;br /&gt;
! Game&lt;br /&gt;
|-&lt;br /&gt;
| 0xD&lt;br /&gt;
| Metroid Prime Demo&lt;br /&gt;
|-&lt;br /&gt;
| 0x11&lt;br /&gt;
| Metroid Prime&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| Metroid Prime 2 Demo&lt;br /&gt;
|-&lt;br /&gt;
| 0x17&lt;br /&gt;
| Metroid Prime 2&lt;br /&gt;
|-&lt;br /&gt;
| 0x19&lt;br /&gt;
| Metroid Prime 3&lt;br /&gt;
|-&lt;br /&gt;
| 0x1B&lt;br /&gt;
| Donkey Kong Country Returns&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Memory Relay ===&lt;br /&gt;
&lt;br /&gt;
This structure only appears in Prime 1. It describes an outgoing connection from a Memory Relay to another script instance. Any Memory Relays connected to multiple objects will appear in the array multiple times.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| u32&lt;br /&gt;
| '''Memory Relay Instance ID'''&lt;br /&gt;
| Instance ID of the sender Memory Relay.&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| u32&lt;br /&gt;
| '''Target Instance ID'''&lt;br /&gt;
| Instance ID of the receiver object.&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| u16&lt;br /&gt;
| '''Message'''&lt;br /&gt;
| Script message sent to the receiver object.&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| bool&lt;br /&gt;
| '''Active'''&lt;br /&gt;
| Whether this Memory Relay object is active by default; almost always 0.&lt;br /&gt;
|-&lt;br /&gt;
| 0x11&lt;br /&gt;
| colspan=3 {{unknown|End of Memory Relay connection}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Area ===&lt;br /&gt;
&lt;br /&gt;
This structure defines a single area and describes its position in the world and how it connects to other areas.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
! MP1&lt;br /&gt;
! MP2&lt;br /&gt;
! MP3&lt;br /&gt;
! DKCR&lt;br /&gt;
|-&lt;br /&gt;
| Asset ID ([[STRG (File Format)|STRG]])&lt;br /&gt;
| 1&lt;br /&gt;
| '''Area Name ID'''&lt;br /&gt;
| [[STRG (File Format)|STRG]] ID for the area name.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| float&lt;br /&gt;
| 12&lt;br /&gt;
| '''Area Transform'''&lt;br /&gt;
| Area's transform matrix. Most area data is pre-transformed, but there are a few things that need to be transformed by this matrix.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| float&lt;br /&gt;
| 6&lt;br /&gt;
| '''Area Bounding Box'''&lt;br /&gt;
| This is the bounding box of the area's collision mesh and is equivalent to the bounding box found in the [[MREA (File Format)|MREA]] collision section.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| Asset ID ([[MREA (File Format)|MREA]])&lt;br /&gt;
| 1&lt;br /&gt;
| '''Area MREA ID'''&lt;br /&gt;
| ID of this area's [[MREA (File Format)|MREA]] file.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| Asset ID&lt;br /&gt;
| 1&lt;br /&gt;
| '''Internal Area ID'''&lt;br /&gt;
| Doesn't actually refer to an asset, but has the same length as an asset ID. This ID is used internally by some things to refer to this area, such as Script Layer Controllers.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Attached Area Count'''&lt;br /&gt;
| Count of areas attached to this one.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| u16&lt;br /&gt;
| ''Attached Area Count''&lt;br /&gt;
| '''Attached Area Index Array'''&lt;br /&gt;
| Array of area indices attached to this one.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| [[#Area Dependencies|Area Dependencies]]&lt;br /&gt;
| 1&lt;br /&gt;
| '''Dependencies'''&lt;br /&gt;
| Asset dependencies in this area. See below for details. Starting in Prime 3, this section has been moved inside the [[MREA (File Format)|MREA]] file.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Dock Count'''&lt;br /&gt;
| Count of Dock instances in this area.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| [[#Dock|Dock]]&lt;br /&gt;
| ''Dock Count''&lt;br /&gt;
| '''Dock Array'''&lt;br /&gt;
| Array describing all docks in this area.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| [[#Area Module Dependencies|Area Module Dependencies]]&lt;br /&gt;
| 1&lt;br /&gt;
| '''Module Dependencies'''&lt;br /&gt;
| REL module dependencies in this area. See below for details. The equivalent section in Prime 3 and DKCR describing RSO modules has been moved inside the [[MREA (File Format)|MREA]] format.&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| Always 0?&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| string&lt;br /&gt;
| 1&lt;br /&gt;
| '''Internal Area Name'''&lt;br /&gt;
| Internal name of this area. This name will be used ingame on the map screen if no ''Area Name ID'' is specified, prefixed with &amp;quot;!!&amp;quot;.&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| colspan=8 {{unknown|End of area}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Area Dependencies ====&lt;br /&gt;
&lt;br /&gt;
This is a data chunk appearing in the area definition in Metroid Prime 1 and 2 that lists all assets needed to load the area. It's extremely important that this list be optimized and complete, as all assets listed here will be perpetually kept in memory as long as the area itself is in memory; the list also specifies the order that assets are loaded in, so '''it must be grouped by load order to roughly match the [[PAK (File Format)|PAK]] file for optimized load times'''. Assets that are missing will still be dynamically loaded after the area itself is loaded, but this will cause the game to freeze up until the load is finished. There are a few exceptions that are excluded from this list in the original game files (and should be excluded in custom MLVLs as well to avoid out-of-memory crashes):&lt;br /&gt;
&lt;br /&gt;
* [[SCAN (File Format)|SCAN]] files and their dependencies are not included in the list in MP1. These are loaded dynamically after the area itself is finished loading, presumably so that scan dependencies are not kept in memory when the scan isn't actually in use. In MP2, SCANs are actually included in the list but their dependencies aren't.&lt;br /&gt;
* [[ANCS (File Format)|ANCS]] per-character dependencies for PlayerActor script instances are not included; this allows the game to avoid keeping assets in memory for suits that the player doesn't have. The exception is the Empty Suit character (character index 5 in MP1, and index 3 in MP2), which is a low-memory-overhead character that allows for the list to include all common assets that are stored in the file per-character (such as particle effects).&lt;br /&gt;
* The skybox model and its dependencies are not included.&lt;br /&gt;
&lt;br /&gt;
The dependency list is split by layer; after the dependencies itself, an array of offsets into the dependency list is provided that allows the game to only load assets for layers that are currently active. The last offset points to all common resources used by the area that aren't layer-specific. With that in mind, every layer needs to have a full list of its required assets even if they're also used by other layers. There's no harm in including an asset multiple times, as if an asset is already in memory then it'll simply be skipped over.&lt;br /&gt;
&lt;br /&gt;
This data chunk still exists in Prime 3 and DKCR, but it's been moved inside the [[MREA (File Format)|MREA]] format.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Dependency Count'''&lt;br /&gt;
| Count of dependencies.&lt;br /&gt;
|-&lt;br /&gt;
| [[#Dependency|Dependency]]&lt;br /&gt;
| ''Dependency Count''&lt;br /&gt;
| '''Dependency Array'''&lt;br /&gt;
| Array of all asset dependencies in this area.&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Dependency Offset Count'''&lt;br /&gt;
| Count of dependency offsets. This will be equal to the area script layer count + 1.&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| ''Dependency Offset Count''&lt;br /&gt;
| '''Dependency Offset Array'''&lt;br /&gt;
| Array of offsets into the dependency array. There is one offset per script layer, with the offset referring to the index of that layer's first dependency. There is a final extra offset that points to area dependencies that are not layer-specific.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== Dependency =====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| Asset ID&lt;br /&gt;
| 1&lt;br /&gt;
| '''Dependency Asset ID'''&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| char&lt;br /&gt;
| 4&lt;br /&gt;
| '''Dependency Asset Type'''&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Dock ====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Connecting Dock Count'''&lt;br /&gt;
| Count of docks connecting to this one. Typically 1 (but there are docks in Prime 3 that connect to multiple areas).&lt;br /&gt;
|-&lt;br /&gt;
| [[#Connecting Dock|Connecting Dock]]&lt;br /&gt;
| ''Connecting Dock Count''&lt;br /&gt;
| '''Connecting Dock Array'''&lt;br /&gt;
| Array describing all docks connected to this one.&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Dock Coordinate Count'''&lt;br /&gt;
| Array of dock coordinates in the next array.&lt;br /&gt;
|-&lt;br /&gt;
| Vector3&lt;br /&gt;
| ''Dock Coordinate Count''&lt;br /&gt;
| '''Dock Coordinates'''&lt;br /&gt;
| Exact purpose/function of this is not known yet.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== Connecting Dock =====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| u32&lt;br /&gt;
| '''Area Index'''&lt;br /&gt;
| Index of the area this dock is in.&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| u32&lt;br /&gt;
| '''Dock Index'''&lt;br /&gt;
| Index of this dock within its area.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Area Module Dependencies ====&lt;br /&gt;
&lt;br /&gt;
This is a data chunk appearing in the area definitions that describes all REL modules that must be linked in for this area to run. These are tied to script objects. The list is split per-layer so that only modules being used by the active layer are linked in; modules will appear once in the list for each layer that uses it. After the REL list, there is an array of offsets that points to the starting index in the list for each script layer, similar to the regular area dependencies list. For an unknown reason, the offsets list contains two offsets per layer. The first one refers to the layer's start index while the second one is usually empty, which effectively makes it an end index.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''REL Module Count'''&lt;br /&gt;
| Count of REL modules in the next array.&lt;br /&gt;
|-&lt;br /&gt;
| string&lt;br /&gt;
| ''REL Module Count''&lt;br /&gt;
| '''REL Module Array'''&lt;br /&gt;
| REL modules used by this area. Each array entry is the filename of a .REL module.&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''REL Offset Count'''&lt;br /&gt;
| Count of REL offsets in the next array. Should be equal to the area script layer count * 2.&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| ''REL Offset Count''&lt;br /&gt;
| '''REL Offset Array'''&lt;br /&gt;
| Array of offsets into the ''REL Module Array''. There are two offsets per script layer, with the first one being that layer's start index and the second one effectively being that layer's end index.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Audio Group ===&lt;br /&gt;
&lt;br /&gt;
This structure is only present in Prime 1 and describes an [[AGSC (File Format)|AGSC]] file being used in this world.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| u32&lt;br /&gt;
| '''Group ID'''&lt;br /&gt;
| Group ID for this audio group. This is the same value that can be found in the Project chunk in the referenced [[AGSC (File Format)|AGSC]] file.&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| Asset ID ([[AGSC (File Format)|AGSC]])&lt;br /&gt;
| '''AGSC ID'''&lt;br /&gt;
| The [[AGSC (File Format)|AGSC]] file for this audio group.&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| colspan=3 {{unknown|End of audio group definition}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Area Layer Flags ===&lt;br /&gt;
&lt;br /&gt;
This is a small structure that determines which areas are active by default. It contains a layer count and then a 64-bit flag, with each bit corresponding to a particular layer; if the bit is set, then the layer will be active on a new save file. The low-order bits correspond to the lower layer indices. Bits for layers that don't exist are defaulted to on.&lt;br /&gt;
&lt;br /&gt;
Note that due to the size of these flags as well as a few other pieces of data in other formats, the maximum number of layers that can be contained in a single area is 64.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| u32&lt;br /&gt;
| '''Layer Count'''&lt;br /&gt;
| Count of layers in this area.&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| u64&lt;br /&gt;
| '''Layer Flags'''&lt;br /&gt;
| See above for a description of how these work.&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| colspan=3 {{unknown|End of area layer flags}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:File Formats]]&lt;br /&gt;
[[Category:Metroid Prime]]&lt;br /&gt;
[[Category:Metroid Prime 2: Echoes]]&lt;br /&gt;
[[Category:Metroid Prime 3: Corruption]]&lt;br /&gt;
[[Category:Donkey Kong Country Returns]]&lt;/div&gt;</summary>
		<author><name>Aruki</name></author>	</entry>

	<entry>
		<id>http://www.metroid2002.com/retromodding/index.php?title=GUID&amp;diff=1956</id>
		<title>GUID</title>
		<link rel="alternate" type="text/html" href="http://www.metroid2002.com/retromodding/index.php?title=GUID&amp;diff=1956"/>
				<updated>2019-02-05T07:15:40Z</updated>
		
		<summary type="html">&lt;p&gt;Aruki: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A '''GUID''' is a 128-bit ID used to uniquely identify an object. They are used in [[Metroid Prime 3: Corruption]] and [[Donkey Kong Country Returns]] to uniquely identify a value stored in the save file. They are also commonly used in [[Donkey Kong Country: Tropical Freeze]] as identifiers for all sorts of objects.&lt;br /&gt;
&lt;br /&gt;
== MP3/DKCR ==&lt;br /&gt;
&lt;br /&gt;
Script objects that need to preserve data between play sessions will have a GUID listed as a property (with property ID 0x16D9A75D). That ID is also stored in the [[SAVW (File Format)|SAVW]] file and associated with the object's instance ID. At runtime, when the object is loaded it uses the GUID to look up the value of the parameter and then updates itself accordingly. The GUIDs declared from the SAVW file are only valid within the world the SAVW file is associated with; reusing the same GUID from a different world is treated as a separate value.&lt;br /&gt;
&lt;br /&gt;
GUIDs are also used by script layers to track whether the layer is active. The GUIDs associated with each layer can be found in the [[MLVL (File Format)|MLVL]] file. Layer GUIDs are different from the other IDs in that they are valid across the entire game, when referenced from any world.&lt;br /&gt;
&lt;br /&gt;
GUIDs are used by the following objects:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Object&lt;br /&gt;
! Usage&lt;br /&gt;
! MP3&lt;br /&gt;
! DKCR&lt;br /&gt;
|-&lt;br /&gt;
| Script Layer&lt;br /&gt;
| Tracks whether the layer is active or not.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| CinematicCamera&lt;br /&gt;
| Tracks whether the cutscene has been watched before. If so, cinematic skip can be enabled. (CinematicCameras that don't have cinematic skip enabled don't have a GUID.)&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| MemoryRelay&lt;br /&gt;
| Tracks whether the relay is active.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| Door&lt;br /&gt;
| Tracks whether the door has been opened at some point during gameplay. This is used to change the door color on the map.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| Pickup&lt;br /&gt;
| Tracks whether the pickup has been acquired before. &lt;br /&gt;
* In MP3, this is used to remove upgrades and expansions that the player has already collected from the map.&lt;br /&gt;
* In DKCR, this is used to grey out puzzle pieces that the player has already collected and prevent them from being collecting a second time.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:Metroid Prime 3: Corruption]]&lt;br /&gt;
[[Category:Donkey Kong Country Returns]]&lt;/div&gt;</summary>
		<author><name>Aruki</name></author>	</entry>

	<entry>
		<id>http://www.metroid2002.com/retromodding/index.php?title=Saved_State_ID&amp;diff=1955</id>
		<title>Saved State ID</title>
		<link rel="alternate" type="text/html" href="http://www.metroid2002.com/retromodding/index.php?title=Saved_State_ID&amp;diff=1955"/>
				<updated>2019-02-05T07:13:23Z</updated>
		
		<summary type="html">&lt;p&gt;Aruki: Aruki moved page Saved State ID to GUID&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[GUID]]&lt;/div&gt;</summary>
		<author><name>Aruki</name></author>	</entry>

	<entry>
		<id>http://www.metroid2002.com/retromodding/index.php?title=GUID&amp;diff=1954</id>
		<title>GUID</title>
		<link rel="alternate" type="text/html" href="http://www.metroid2002.com/retromodding/index.php?title=GUID&amp;diff=1954"/>
				<updated>2019-02-05T07:13:22Z</updated>
		
		<summary type="html">&lt;p&gt;Aruki: Aruki moved page Saved State ID to GUID&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A '''Saved State ID''' (unofficial name) is a 128-bit ID used in [[Metroid Prime 3: Corruption]] and [[Donkey Kong Country Returns]]. They're used to uniquely identify a value stored in the save file. Script objects that need to preserve data between play sessions will have one of these IDs listed as a property (with property ID 0x16D9A75D). That ID is also stored in the [[SAVW (File Format)|SAVW]] file and associated with the object's instance ID. At runtime, when the object is loaded it uses the ID to look up the value of the parameter and then updates itself accordingly. The IDs declared from the SAVW file are only valid within the world the SAVW file is associated with; reusing the same ID from a different world is treated as a separate value.&lt;br /&gt;
&lt;br /&gt;
Saved State IDs are also used by script layers to track whether the layer is active. The IDs associated with each layer can be found in the [[MLVL (File Format)|MLVL]] file. Layer state IDs are different from the other IDs in that they are valid across the entire game, when referenced from any world.&lt;br /&gt;
&lt;br /&gt;
Saved State IDs are used by the following objects:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Object&lt;br /&gt;
! Usage&lt;br /&gt;
! MP3&lt;br /&gt;
! DKCR&lt;br /&gt;
|-&lt;br /&gt;
| Script Layer&lt;br /&gt;
| Tracks whether the layer is active or not.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| CinematicCamera&lt;br /&gt;
| Tracks whether the cutscene has been watched before. If so, cinematic skip can be enabled. (CinematicCameras that don't have cinematic skip enabled don't have a state ID.)&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| MemoryRelay&lt;br /&gt;
| Tracks whether the relay is active.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| Door&lt;br /&gt;
| Tracks whether the door has been opened at some point during gameplay. This is used to change the door color on the map.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| Pickup&lt;br /&gt;
| Tracks whether the pickup has been acquired before. &lt;br /&gt;
* In MP3, this is used to remove upgrades and expansions that the player has already collected from the map.&lt;br /&gt;
* In DKCR, this is used to grey out puzzle pieces that the player has already collected and prevent them from being collecting a second time.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:Metroid Prime 3: Corruption]]&lt;br /&gt;
[[Category:Donkey Kong Country Returns]]&lt;/div&gt;</summary>
		<author><name>Aruki</name></author>	</entry>

	<entry>
		<id>http://www.metroid2002.com/retromodding/index.php?title=SCAN_(Metroid_Prime)&amp;diff=1953</id>
		<title>SCAN (Metroid Prime)</title>
		<link rel="alternate" type="text/html" href="http://www.metroid2002.com/retromodding/index.php?title=SCAN_(Metroid_Prime)&amp;diff=1953"/>
				<updated>2019-01-13T16:21:50Z</updated>
		
		<summary type="html">&lt;p&gt;Aruki: /* Logbook Category */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''This article is for the SCAN format from Metroid Prime. For other revisions of this format, see [[SCAN (File Format)]].''&lt;br /&gt;
&lt;br /&gt;
The '''SCAN file format''' describes scannable objects. It is a relatively simple format and has a static size.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Format ==&lt;br /&gt;
&lt;br /&gt;
The SCAN format is very simple; it has a header with data that contains general settings related to the scan, and then four structs defining how the scan images work. Even if a scan doesn't use four images, there are always four image structs, which means that the SCAN format has a static size; every SCAN file is 0x89 bytes (or 0xA0 bytes padded).&lt;br /&gt;
&lt;br /&gt;
=== Header ===&lt;br /&gt;
&lt;br /&gt;
The header is rather simple, and consists of the following:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 4&lt;br /&gt;
| '''Version'''; 3 for the demo, 5 for the final&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 4&lt;br /&gt;
| '''Magic'''; always 0x0BADBEEF&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 4&lt;br /&gt;
| '''[[FRME (File Format)|FRME]] ID'''&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 4&lt;br /&gt;
| '''Scan text [[STRG (File Format)|STRG]] ID'''&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 4&lt;br /&gt;
| '''Scan Speed Flag'''; 0 = normal fast scan, 1 = slower scan (usually found in boss fights)&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 4&lt;br /&gt;
| '''Logbook Category'''; see below&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 1&lt;br /&gt;
| '''Scan Icon Flag'''; 0 = orange icon, 1 = red icon&lt;br /&gt;
|-&lt;br /&gt;
| 0x19&lt;br /&gt;
| colspan=2 {{unknown|End of header}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Logbook Category ====&lt;br /&gt;
&lt;br /&gt;
There are six possible values:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! ID&lt;br /&gt;
! Category&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| Not a logbook scan&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| Space Pirate Data&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| Chozo Lore&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| Creatures&lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| Research&lt;br /&gt;
|-&lt;br /&gt;
| 5&lt;br /&gt;
| Artifacts&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Scan Images ===&lt;br /&gt;
Following the header is an array of four structs that contain settings for up to four scan images. Although there can be anywhere from 0 to 4 scan images attached to a scan, there are always four scan image entries here. Entries that aren't used have their TXTR ID set to 0xFFFFFFFF, with the rest of the settings mostly left at defaults. They follow this format:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Size&lt;br /&gt;
! Type&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 4&lt;br /&gt;
| long&lt;br /&gt;
| '''[[TXTR (Metroid Prime)|TXTR]] ID'''&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 4&lt;br /&gt;
| float&lt;br /&gt;
| '''Appearance %'''; image will appear when the scan is this% complete. Should range from 0 to 1.&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 4&lt;br /&gt;
| long&lt;br /&gt;
| '''Image Position'''; See below.&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 4&lt;br /&gt;
| long&lt;br /&gt;
| '''Width'''; 0 = no animation&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 4&lt;br /&gt;
| long&lt;br /&gt;
| '''Height'''; 0 = no animation&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 4&lt;br /&gt;
| float&lt;br /&gt;
| '''Interval'''; 0.0 = no animation&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 4&lt;br /&gt;
| float&lt;br /&gt;
| '''Fade Duration'''; 0.0 = no fade&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| colspan=3 {{unknown|End of entry}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Image Position ====&lt;br /&gt;
&lt;br /&gt;
There are 20 possible values for the scan image's position; there are ten for the left side, and ten for the right:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Value&lt;br /&gt;
! Size&lt;br /&gt;
! Position&lt;br /&gt;
! FRME_ScanHud Widget&lt;br /&gt;
|-&lt;br /&gt;
| 0x00&lt;br /&gt;
| 1/4&lt;br /&gt;
| Top-left corner&lt;br /&gt;
| imagepane_pane0&lt;br /&gt;
|-&lt;br /&gt;
| 0x01&lt;br /&gt;
| 1/4&lt;br /&gt;
| Upper-middle-left&lt;br /&gt;
| imagepane_pane1&lt;br /&gt;
|-&lt;br /&gt;
| 0x02&lt;br /&gt;
| 1/4&lt;br /&gt;
| Lower-middle-left&lt;br /&gt;
| imagepane_pane2&lt;br /&gt;
|-&lt;br /&gt;
| 0x03&lt;br /&gt;
| 1/4&lt;br /&gt;
| Bottom-left corner&lt;br /&gt;
| imagepane_pane3&lt;br /&gt;
|-&lt;br /&gt;
| 0x04&lt;br /&gt;
| 1/2&lt;br /&gt;
| Top-left corner&lt;br /&gt;
| imagepane_pane01&lt;br /&gt;
|-&lt;br /&gt;
| 0x05&lt;br /&gt;
| 1/2&lt;br /&gt;
| Middle-left&lt;br /&gt;
| imagepane_pane12&lt;br /&gt;
|-&lt;br /&gt;
| 0x06&lt;br /&gt;
| 1/2&lt;br /&gt;
| Bottom-left corner&lt;br /&gt;
| imagepane_pane23&lt;br /&gt;
|-&lt;br /&gt;
| 0x07&lt;br /&gt;
| 3/4&lt;br /&gt;
| Top-left corner&lt;br /&gt;
| imagepane_pane012&lt;br /&gt;
|-&lt;br /&gt;
| 0x08&lt;br /&gt;
| 3/4&lt;br /&gt;
| Bottom-left corner&lt;br /&gt;
| imagepane_pane123&lt;br /&gt;
|-&lt;br /&gt;
| 0x09&lt;br /&gt;
| 1&lt;br /&gt;
| Left side&lt;br /&gt;
| imagepane_pane0123&lt;br /&gt;
|-&lt;br /&gt;
| 0x0A&lt;br /&gt;
| 1/4&lt;br /&gt;
| Top-right corner&lt;br /&gt;
| imagepane_pane4&lt;br /&gt;
|-&lt;br /&gt;
| 0x0B&lt;br /&gt;
| 1/4&lt;br /&gt;
| Upper-middle-right&lt;br /&gt;
| imagepane_pane5&lt;br /&gt;
|-&lt;br /&gt;
| 0x0C&lt;br /&gt;
| 1/4&lt;br /&gt;
| Lower-middle-right&lt;br /&gt;
| imagepane_pane6&lt;br /&gt;
|-&lt;br /&gt;
| 0x0D&lt;br /&gt;
| 1/4&lt;br /&gt;
| Bottom-right corner&lt;br /&gt;
| imagepane_pane7&lt;br /&gt;
|-&lt;br /&gt;
| 0x0E&lt;br /&gt;
| 1/2&lt;br /&gt;
| Top-right corner&lt;br /&gt;
| imagepane_pane45&lt;br /&gt;
|-&lt;br /&gt;
| 0x0F&lt;br /&gt;
| 1/2&lt;br /&gt;
| Middle-right&lt;br /&gt;
| imagepane_pane56&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 1/2&lt;br /&gt;
| Bottom-right corner&lt;br /&gt;
| imagepane_pane67&lt;br /&gt;
|-&lt;br /&gt;
| 0x11&lt;br /&gt;
| 3/4&lt;br /&gt;
| Top-right corner&lt;br /&gt;
| imagepane_pane456&lt;br /&gt;
|-&lt;br /&gt;
| 0x12&lt;br /&gt;
| 3/4&lt;br /&gt;
| Bottom-right corner&lt;br /&gt;
| imagepane_pane567&lt;br /&gt;
|-&lt;br /&gt;
| 0x13&lt;br /&gt;
| 1&lt;br /&gt;
| Right side&lt;br /&gt;
| imagepane_pane4567&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=packed heights=200px&amp;gt;&lt;br /&gt;
File:Scan_offsets_1.png|Image positions 0x00, 0x01, and 0x02&lt;br /&gt;
File:Scan_offsets_3.png|Image positions for 0x04, 0x06, 0x0E, and 0x10&lt;br /&gt;
File:Scan_offset_101.png|Image positions for 0x03, 0x05, and 0x0F. Note that 0x03 appears only for this scan (Omega Pirate's projectiles) and no others.&lt;br /&gt;
File:Scan_offsets_10.png|Image positions for 0x09 and 0x13&lt;br /&gt;
File:Scan_position_10000.png|This unused Chozo Elder scan (hacked onto Parasite Queen) shows image positions 0x0A and 0x0D. This scan is the only one where these positions are used.&lt;br /&gt;
File:Scan_position_99.png|Image positions for 0x0B and 0x0C (unused)&lt;br /&gt;
File:Scan_offset_11.png|Image positions for 0x07 and 0x11 (unused)&lt;br /&gt;
File:Scan_offset_12.png|Image positions for 0x08 and 0x12 (unused)&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Fly In Behavior ====&lt;br /&gt;
&lt;br /&gt;
The first scan image to appear (based on the appearance percent value) will &amp;quot;fly in&amp;quot; from the side of the screen toward the center. The remaining images will &amp;quot;fade in&amp;quot; without moving. The only exception to this is when the first image to appear is a &amp;quot;blank&amp;quot; image with no associated [[TXTR (Metroid Prime)|TXTR]]. In this case, no image will fly in (i.e., all images will fade in).&lt;br /&gt;
&lt;br /&gt;
==== Scan Animations ====&lt;br /&gt;
[[Image:AnimatedscanFinal.gif|thumb|The terminal with an animated scan image in the Map Facility.]]&lt;br /&gt;
An extremely small number of scans display animated images in Metroid Prime. In the final version of the game, only a terminal in the Map Facility displays an animated image. In the demo version of the game, the aforementioned terminal scan and the Parasite Queen scan both display animated images. For most SCAN files, the last 32 bits of the scan image entry are zeroed out, but for the animated scans, these 32 bits have actual values in them. Strangely, the terminal directly to the left of the animated terminal in the Map Facility also has non-zero values for these 32 bits, even though it does not display any animated images.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:File Formats]]&lt;br /&gt;
[[Category:Metroid Prime]]&lt;/div&gt;</summary>
		<author><name>Aruki</name></author>	</entry>

	<entry>
		<id>http://www.metroid2002.com/retromodding/index.php?title=SAVW_(File_Format)&amp;diff=1952</id>
		<title>SAVW (File Format)</title>
		<link rel="alternate" type="text/html" href="http://www.metroid2002.com/retromodding/index.php?title=SAVW_(File_Format)&amp;diff=1952"/>
				<updated>2019-01-13T16:14:25Z</updated>
		
		<summary type="html">&lt;p&gt;Aruki: /* Scannable Object */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The '''SAVW format''' describes save data in the Metroid Prime series and Donkey Kong Country Returns. It allows any data used by the game's script data that needs to be preserved between play sessions to be saved and retrieved from the save file without the executable having to know anything about it. This is used for, for instance, saving whether a particular MemoryRelay has been activated, or whether a specific layer has been toggled on.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Format ==&lt;br /&gt;
&lt;br /&gt;
The format is basically just a series of arrays. The structure remains more or less the same across every game, just with arrays being added or removed. The main difference between formats is that starting in Metroid Prime 3, the engine stores references to saved variables through a combination of a 128-bit state ID and an instance ID instead of implicitly associating them via instance IDs alone. The state ID is mirrored in another file (usually on the object via a property).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
! MP1&lt;br /&gt;
! MP2&lt;br /&gt;
! MP3&lt;br /&gt;
! DKCR&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Magic'''&lt;br /&gt;
| Always &amp;lt;code&amp;gt;0xC001D00D&amp;lt;/code&amp;gt;.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Version'''&lt;br /&gt;
| [[#Version|See below]] for a list of possible version numbers.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Area Count'''&lt;br /&gt;
| Number of areas contained in this world. Always 1 in DKCR.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Cinematic Skip Count'''&lt;br /&gt;
| Count of skippable cinematics.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| [[#Saved State Descriptor|Saved State Descriptor]]&lt;br /&gt;
| ''Cinematic Skip Count''&lt;br /&gt;
| '''Cinematic Skip Array'''&lt;br /&gt;
| Array describing all skippable cinematics in the world. Points to Cinematic Skip SpecialFunctions (MP1) or cameras with cinematic skip enabled (MP2+).&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Memory Relay Count'''&lt;br /&gt;
| Count of Memory Relay instances.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| [[#Saved State Descriptor|Saved State Descriptor]]&lt;br /&gt;
| ''Memory Relay Count''&lt;br /&gt;
| '''Memory Relay Array'''&lt;br /&gt;
| Array describing all Memory Relays in the world.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Layer Toggle Count'''&lt;br /&gt;
| Count of layers that can be toggled on/off from this world.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| [[#Layer Toggle|Layer Toggle]]&lt;br /&gt;
| ''Layer Toggle Count''&lt;br /&gt;
| '''Layer Toggle Array'''&lt;br /&gt;
| Array specifying every layer toggleable from this world (referenced by a ScriptLayerController). The layers specified can be in other worlds.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Door Count'''&lt;br /&gt;
| Count of DoorArea/Door instances.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| [[#Saved State Descriptor|Saved State Descriptor]]&lt;br /&gt;
| ''Door Count''&lt;br /&gt;
| '''Door Array'''&lt;br /&gt;
| Array describing all DoorArea/Door instances in the world.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Scannable Object Count'''&lt;br /&gt;
| Count of scannable objects in the next array.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| [[#Scannable Object|Scannable Object]]&lt;br /&gt;
| ''Scannable Object Count''&lt;br /&gt;
| '''Scannable Object Array'''&lt;br /&gt;
| Array describing every scannable object in this world.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''System State Env Var Count'''&lt;br /&gt;
| Count of system state env vars modified from this world.&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| [[#Environment Variable|Environment Variable]]&lt;br /&gt;
| ''System State Env Var Count''&lt;br /&gt;
| '''System State Env Var Array'''&lt;br /&gt;
| Array of env vars affecting the entire system.&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Game State Env Var Count'''&lt;br /&gt;
| Count of game state env vars modified from this world.&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| [[#Environment Variable|Environment Variable]]&lt;br /&gt;
| ''Game State Env Var Count''&lt;br /&gt;
| '''Game State Env Var Array'''&lt;br /&gt;
| Array of env vars affecting only this save slot.&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Unmappable Object Count'''&lt;br /&gt;
| Count of unmappable objects in the world.&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| [[#Saved State Descriptor|Saved State Descriptor]]&lt;br /&gt;
| ''Unmappable Object Count''&lt;br /&gt;
| '''Unmappable Object Array'''&lt;br /&gt;
| Array describing every instance that can be removed from the map. Primarily Translator Door Location SpecialFunctions in MP2 and Pickups in MP3.&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Puzzle Piece Count'''&lt;br /&gt;
| Count of Puzzle Piece Pickups in this world. (This value also controls the level puzzle piece count that displays on the HUD ingame.)&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| [[#Saved State Descriptor|Saved State Descriptor]]&lt;br /&gt;
| ''Puzzle Piece Count''&lt;br /&gt;
| '''Puzzle Piece Array'''&lt;br /&gt;
| Array describing all Puzzle Piece Pickups.&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| colspan=8 {{unknown|End of file}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Version ===&lt;br /&gt;
&lt;br /&gt;
Each revision of the SAVW format has a unique version number, which corresponds to the following games:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Version&lt;br /&gt;
! Game&lt;br /&gt;
|-&lt;br /&gt;
| 0x3&lt;br /&gt;
| Metroid Prime&lt;br /&gt;
|-&lt;br /&gt;
| 0x5&lt;br /&gt;
| Metroid Prime 2: Echoes&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| Metroid Prime 3: Corruption&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| Donkey Kong Country Returns&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Saved State Descriptor ===&lt;br /&gt;
&lt;br /&gt;
In Metroid Prime 1 and 2, saved state values were referenced only via the instance ID of the object that the state is for. In Prime 3 and DKCR, a 128-bit [[Saved State ID]] was introduced that handles references to save file data, and is stored in the file in conjunction with the instance IDs.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
! MP1&lt;br /&gt;
! MP2&lt;br /&gt;
! MP3&lt;br /&gt;
! DKCR&lt;br /&gt;
|-&lt;br /&gt;
| [[Saved State ID]]&lt;br /&gt;
| '''Saved State ID'''&lt;br /&gt;
| ID of this saved state.&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{nocheck}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| '''Instance ID'''&lt;br /&gt;
| Instance ID of the object that uses this saved state.&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
| {{check}}&lt;br /&gt;
|-&lt;br /&gt;
| colspan=7 {{unknown|End of descriptor}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Layer Toggle ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| '''Area ID'''&lt;br /&gt;
| Internal area ID (not the MREA ID).&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| '''Layer Index'''&lt;br /&gt;
| Index of the layer that can be toggled.&lt;br /&gt;
|-&lt;br /&gt;
| colspan=3 {{unknown|End of layer}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Scannable Object ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| Asset ID&lt;br /&gt;
| '''SCAN Asset ID'''&lt;br /&gt;
| Asset ID of a [[SCAN (Metroid Prime)|SCAN]] file.&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| '''Logbook Category'''&lt;br /&gt;
| Enum describing which logbook category this scan is part of. Always 0 in MP2 and MP3. See below for possible values for MP1.&lt;br /&gt;
|-&lt;br /&gt;
| colspan=3 {{unknown|End of scan}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Possible logbook category values (MP1 only):&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! ID&lt;br /&gt;
! Category&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| Non-Logbook&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| Space Pirate Data&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| Chozo Lore&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| Creatures&lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| Research&lt;br /&gt;
|-&lt;br /&gt;
| 5&lt;br /&gt;
| Artifacts&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Environment Variable ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| string&lt;br /&gt;
| '''Variable Name'''&lt;br /&gt;
| Name of the environment variable as a zero-terminated string.&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| Always 0?&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| Always 1?&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| Always 0?&lt;br /&gt;
|-&lt;br /&gt;
| colspan=3 {{unknown|End of environment variable}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:File Formats]]&lt;br /&gt;
[[Category:Metroid Prime]]&lt;br /&gt;
[[Category:Metroid Prime 2 Demo]]&lt;br /&gt;
[[Category:Metroid Prime 2: Echoes]]&lt;br /&gt;
[[Category:Metroid Prime 3 Prototype]]&lt;br /&gt;
[[Category:Metroid Prime 3: Corruption]]&lt;br /&gt;
[[Category:Donkey Kong Country Returns]]&lt;/div&gt;</summary>
		<author><name>Aruki</name></author>	</entry>

	<entry>
		<id>http://www.metroid2002.com/retromodding/index.php?title=PAK_(Metroid_Prime)&amp;diff=1932</id>
		<title>PAK (Metroid Prime)</title>
		<link rel="alternate" type="text/html" href="http://www.metroid2002.com/retromodding/index.php?title=PAK_(Metroid_Prime)&amp;diff=1932"/>
				<updated>2018-06-14T19:54:42Z</updated>
		
		<summary type="html">&lt;p&gt;Aruki: /* Named Resources */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''See [[PAK (File Format)]] for the other revisions of this format.''&lt;br /&gt;
&lt;br /&gt;
The '''.pak format''' in Metroid Prime and Metroid Prime 2 is a fairly simple packfile format; files are stored with a 32-bit file ID, and can optionally be compressed with zlib (Metroid Prime) or LZO1X-999 (Metroid Prime 2). The assets in a pak are split into two groups: named resources and dependencies. In general, only named resources are accessed directly by the game; the rest are dependencies of the named resources, and are accessed indirectly in the process of parsing those files.&lt;br /&gt;
&lt;br /&gt;
Note that the Metroid Prime 3 E3 prototype uses this pak format as well, but has 64-bit file IDs. This is the only difference; the version number is still the same, so there isn't an easy way to check for this variation of the format.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Format==&lt;br /&gt;
&lt;br /&gt;
=== Header ===&lt;br /&gt;
&lt;br /&gt;
The pak starts with a short 8-byte header:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| int16&lt;br /&gt;
| '''Version Number Major'''&lt;br /&gt;
| Always 3&lt;br /&gt;
|-&lt;br /&gt;
| 0x2&lt;br /&gt;
| int16&lt;br /&gt;
| '''Version Number Minor'''&lt;br /&gt;
| Always 5&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| int32&lt;br /&gt;
| '''Unused'''&lt;br /&gt;
| Always 0&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| colspan=3 {{unknown|End of header}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Named Resources ===&lt;br /&gt;
&lt;br /&gt;
The named resource table lists files that the game has direct access to. On world paks, this will generally only contain the MLVL file; in other paks, this table is usually quite a bit larger. Note that in non-world paks, the names are hardcoded and are how the game knows where to find the files; if you repack, you need to make sure you keep the names the same.&lt;br /&gt;
&lt;br /&gt;
This section of the file begins with a 32-bit named resource count, followed by a table.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| {{FourCC}}&lt;br /&gt;
| 1&lt;br /&gt;
| '''Asset Type'''&lt;br /&gt;
| Indicates the type of asset (texture, model, area, etc) and usually doubles as the asset's cooked file extension.&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| int32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Asset ID'''&lt;br /&gt;
| Unique identifier for this asset.&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| int32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Name Length'''&lt;br /&gt;
| Length of the name string&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| char&lt;br /&gt;
| ''Name Length''&lt;br /&gt;
| '''Name String'''&lt;br /&gt;
| Name of the asset. Not zero-terminated. This name usually corresponds to a hardcoded string that the game uses to look up the asset, so this generally can't be changed.&lt;br /&gt;
|-&lt;br /&gt;
| colspan=5 {{unknown|End of entry}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Resource Table ===&lt;br /&gt;
&lt;br /&gt;
This could be considered the main table of contents of the pak. This table begins with a 32-bit resource count, followed by one entry per file; each entry is 0x14 bytes large.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| int32&lt;br /&gt;
| '''Compression Flag'''&lt;br /&gt;
| Value will be either 0 or 1, with 1 denoting that the asset is compressed.&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| {{FourCC}}&lt;br /&gt;
| '''Asset Type'''&lt;br /&gt;
| Indicates the type of asset (texture, model, area, etc) and usually doubles as the asset's cooked file extension.&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| int32&lt;br /&gt;
| '''Asset ID'''&lt;br /&gt;
| Unique identifier for this asset. This ID is used by other assets to reference this one.&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| int32&lt;br /&gt;
| '''Size'''&lt;br /&gt;
| Size of the asset data in the pak. This is always 32-byte-aligned. The end of the asset is padded with 0xFF.&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| int32&lt;br /&gt;
| '''Offset'''&lt;br /&gt;
| Offset of the asset data within the pak. This is an absolute offset.&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| colspan=4 {{unknown|End of entry}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Compression ==&lt;br /&gt;
&lt;br /&gt;
Compressed files begin with their 32-bit decompressed size, followed by the compressed file data. Metroid Prime uses zlib, which is easily recognized from zlib's 0x78DA header at the start of the compressed data. Each file is compressed as a single zlib stream.&lt;br /&gt;
&lt;br /&gt;
Metroid Prime 2 uses segmented LZO1X-999, and gets slightly more complicated. Metroid Prime 2's compressed files are split up into multiple segments of compressed data, each of which is 0x4000 bytes large when decompressed (except for the last one) and should be compressed and decompressed separately. Each segment begins with a 16-bit size value before its actual compressed data begins.&lt;br /&gt;
&lt;br /&gt;
Only certain formats are compressed. The following formats are always compressed:&lt;br /&gt;
&lt;br /&gt;
* [[TXTR (Metroid Prime)|TXTR]]&lt;br /&gt;
* [[CMDL (Metroid Prime)|CMDL]]&lt;br /&gt;
* [[CSKR (File Format)|CSKR]]&lt;br /&gt;
* [[ANCS (File Format)|ANCS]]&lt;br /&gt;
* [[ANIM (File Format)|ANIM]]&lt;br /&gt;
* [[FONT (File Format)|FONT]]&lt;br /&gt;
&lt;br /&gt;
The following formats are compressed when their uncompressed size is at least 0x400 bytes (0x40 bytes in the MP3 prototype):&lt;br /&gt;
&lt;br /&gt;
* [[PART (File Format)|PART]]&lt;br /&gt;
* [[ELSC (File Format)|ELSC]]&lt;br /&gt;
* [[SWHC (File Format)|SWHC]]&lt;br /&gt;
* [[WPSC (File Format)|WPSC]]&lt;br /&gt;
* [[DPSC (File Format)|DPSC]]&lt;br /&gt;
* [[CRSC (File Format)|CRSC]]&lt;br /&gt;
&lt;br /&gt;
Additionally, in Prime 2 any files can be left uncompressed if the compressed file is larger than the uncompressed one. This is not the case in Prime 1 (although custom repacking implementations should probably do this regardless, as there's no benefit to the compression in this scenario).&lt;br /&gt;
&lt;br /&gt;
== Optimizing Load Times ==&lt;br /&gt;
&lt;br /&gt;
When rebuilding new paks, it's extremely important that asset order be optimized in order to minimize the distance the game has to seek on the disc in order to load any given asset. A poorly optimized pak can easily have 30+ second load times on small rooms. There are three main things that are done in order to keep load times fast.&lt;br /&gt;
&lt;br /&gt;
* In world paks, assets are often duplicated so they appear multiple times within the pak; if an asset is used by a lot of different areas this can help reduce seek distance, but has the downside of bloating the total file size of the pak. To ensure the best balance between the two, asset duplication was flagged on a per-area basis, as larger areas take longer to load and would benefit from the faster load speed, whereas small rooms tend to load quickly anyway even without duplicates. The flag that was used for this only existed in Retro's raw files and isn't present in the final game's cooked data. You can recreate it by analyzing the pak and noting down which rooms have duplicate assets (bearing in mind that the assets used by a room always precede that room's MREA asset). If you are working strictly from a pre-unpacked pak, you can't replicate the flag.&lt;br /&gt;
* Assets are generally grouped by load order - things that are used together are adjacent in the pak, and an asset's dependencies typically appear immediately preceding the asset itself. This grouping helps ensure that even when assets aren't duplicated the game will still be able to do just one large seek and then load a bunch of assets at once, instead of having to do a separate seek for each asset.&lt;br /&gt;
* Once you have assets stored in the pak in the right order, you need to make sure the game actually reads them in that order! The exact order that assets are loaded in is specified by the dependency list in the [[MLVL (File Format)|MLVL]] file; as such, the MLVL list should also have assets grouped in the same way and the same order and should at least roughly match the order files are positioned in the pak.&lt;br /&gt;
&lt;br /&gt;
For every asset loaded, the game checks every copy of the asset in the pak and loads whichever duplicate is the shortest distance from the last read position (the end of the last asset that was loaded). When loading an area, this is the order the game loads assets in:&lt;br /&gt;
* First the game goes down the area dependency list in the [[MLVL (File Format)|MLVL]] file and loads every file in the list for every active layer. The game follows the exact order specified by the list.&lt;br /&gt;
* After loading all area dependencies, the area itself is loaded.&lt;br /&gt;
* Finally the game loads assets being used by the new area that are missing from the list. This primarily means [[SCAN (File Format)|SCAN]] files (in MP1), the skybox model, and assets being used by PlayerActor animsets (this avoids loading PlayerActor assets for suits that the player doesn't have). If any other assets were missing from the list, they are loaded here. It's very important to know that contrary to the previous steps, assets that still aren't in memory at this point are loaded ''synchronously'', which means the game will hang until loading is complete; therefore, you want as few assets as possible to be left to load at this point. (You can observe this hang even in the base game - there is a small freeze towards the end of loading Artifact Temple.)&lt;br /&gt;
* Note that any assets that are already in memory will be skipped.&lt;br /&gt;
&lt;br /&gt;
'''Note:''' There are some discrepancies between the order assets appear in the pak and the actual load order specified by the MLVL file. There might be some more research needed to fully explain all the quirks behind Retro's pak optimization.&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
* [https://drive.google.com/file/d/0B9MLV21H7SDvcGc1QjRfSTFJNk0/view?usp=sharing PakTool] by Aruki&lt;br /&gt;
&lt;br /&gt;
[[Category:File Formats]]&lt;br /&gt;
[[Category:Metroid Prime]]&lt;br /&gt;
[[Category:Metroid Prime 2: Echoes]]&lt;/div&gt;</summary>
		<author><name>Aruki</name></author>	</entry>

	<entry>
		<id>http://www.metroid2002.com/retromodding/index.php?title=PAK_(Metroid_Prime)&amp;diff=1931</id>
		<title>PAK (Metroid Prime)</title>
		<link rel="alternate" type="text/html" href="http://www.metroid2002.com/retromodding/index.php?title=PAK_(Metroid_Prime)&amp;diff=1931"/>
				<updated>2018-06-14T19:54:29Z</updated>
		
		<summary type="html">&lt;p&gt;Aruki: /* Named Resources */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''See [[PAK (File Format)]] for the other revisions of this format.''&lt;br /&gt;
&lt;br /&gt;
The '''.pak format''' in Metroid Prime and Metroid Prime 2 is a fairly simple packfile format; files are stored with a 32-bit file ID, and can optionally be compressed with zlib (Metroid Prime) or LZO1X-999 (Metroid Prime 2). The assets in a pak are split into two groups: named resources and dependencies. In general, only named resources are accessed directly by the game; the rest are dependencies of the named resources, and are accessed indirectly in the process of parsing those files.&lt;br /&gt;
&lt;br /&gt;
Note that the Metroid Prime 3 E3 prototype uses this pak format as well, but has 64-bit file IDs. This is the only difference; the version number is still the same, so there isn't an easy way to check for this variation of the format.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Format==&lt;br /&gt;
&lt;br /&gt;
=== Header ===&lt;br /&gt;
&lt;br /&gt;
The pak starts with a short 8-byte header:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| int16&lt;br /&gt;
| '''Version Number Major'''&lt;br /&gt;
| Always 3&lt;br /&gt;
|-&lt;br /&gt;
| 0x2&lt;br /&gt;
| int16&lt;br /&gt;
| '''Version Number Minor'''&lt;br /&gt;
| Always 5&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| int32&lt;br /&gt;
| '''Unused'''&lt;br /&gt;
| Always 0&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| colspan=3 {{unknown|End of header}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Named Resources ===&lt;br /&gt;
&lt;br /&gt;
The named resource table lists files that the game has direct access to. On world paks, this will generally only contain the MLVL file; in other paks, this table is usually quite a bit larger. Note that in non-world paks, the names are hardcoded and are how the game knows where to find the files; if you repack, you need to make sure you keep the names the same.&lt;br /&gt;
&lt;br /&gt;
This section of the file begins with a 32-bit named resource count, followed by a table.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| {{FourCC}}&lt;br /&gt;
| 1&lt;br /&gt;
| '''Asset Type'''&lt;br /&gt;
| Indicates the type of asset (texture, model, area, etc) and usually doubles as the asset's cooked file extension.&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| int32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Asset ID'''&lt;br /&gt;
| Unique identifier for this asset.&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| int32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Name Length'''&lt;br /&gt;
| Length of the name string&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| char&lt;br /&gt;
| ''Name Length''&lt;br /&gt;
| '''Name String'''&lt;br /&gt;
| Name of the asset. This name usually corresponds to a hardcoded string that the game uses to look up the asset, so this generally can't be changed. Not zero-terminated.&lt;br /&gt;
|-&lt;br /&gt;
| colspan=5 {{unknown|End of entry}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Resource Table ===&lt;br /&gt;
&lt;br /&gt;
This could be considered the main table of contents of the pak. This table begins with a 32-bit resource count, followed by one entry per file; each entry is 0x14 bytes large.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| int32&lt;br /&gt;
| '''Compression Flag'''&lt;br /&gt;
| Value will be either 0 or 1, with 1 denoting that the asset is compressed.&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| {{FourCC}}&lt;br /&gt;
| '''Asset Type'''&lt;br /&gt;
| Indicates the type of asset (texture, model, area, etc) and usually doubles as the asset's cooked file extension.&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| int32&lt;br /&gt;
| '''Asset ID'''&lt;br /&gt;
| Unique identifier for this asset. This ID is used by other assets to reference this one.&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| int32&lt;br /&gt;
| '''Size'''&lt;br /&gt;
| Size of the asset data in the pak. This is always 32-byte-aligned. The end of the asset is padded with 0xFF.&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| int32&lt;br /&gt;
| '''Offset'''&lt;br /&gt;
| Offset of the asset data within the pak. This is an absolute offset.&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| colspan=4 {{unknown|End of entry}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Compression ==&lt;br /&gt;
&lt;br /&gt;
Compressed files begin with their 32-bit decompressed size, followed by the compressed file data. Metroid Prime uses zlib, which is easily recognized from zlib's 0x78DA header at the start of the compressed data. Each file is compressed as a single zlib stream.&lt;br /&gt;
&lt;br /&gt;
Metroid Prime 2 uses segmented LZO1X-999, and gets slightly more complicated. Metroid Prime 2's compressed files are split up into multiple segments of compressed data, each of which is 0x4000 bytes large when decompressed (except for the last one) and should be compressed and decompressed separately. Each segment begins with a 16-bit size value before its actual compressed data begins.&lt;br /&gt;
&lt;br /&gt;
Only certain formats are compressed. The following formats are always compressed:&lt;br /&gt;
&lt;br /&gt;
* [[TXTR (Metroid Prime)|TXTR]]&lt;br /&gt;
* [[CMDL (Metroid Prime)|CMDL]]&lt;br /&gt;
* [[CSKR (File Format)|CSKR]]&lt;br /&gt;
* [[ANCS (File Format)|ANCS]]&lt;br /&gt;
* [[ANIM (File Format)|ANIM]]&lt;br /&gt;
* [[FONT (File Format)|FONT]]&lt;br /&gt;
&lt;br /&gt;
The following formats are compressed when their uncompressed size is at least 0x400 bytes (0x40 bytes in the MP3 prototype):&lt;br /&gt;
&lt;br /&gt;
* [[PART (File Format)|PART]]&lt;br /&gt;
* [[ELSC (File Format)|ELSC]]&lt;br /&gt;
* [[SWHC (File Format)|SWHC]]&lt;br /&gt;
* [[WPSC (File Format)|WPSC]]&lt;br /&gt;
* [[DPSC (File Format)|DPSC]]&lt;br /&gt;
* [[CRSC (File Format)|CRSC]]&lt;br /&gt;
&lt;br /&gt;
Additionally, in Prime 2 any files can be left uncompressed if the compressed file is larger than the uncompressed one. This is not the case in Prime 1 (although custom repacking implementations should probably do this regardless, as there's no benefit to the compression in this scenario).&lt;br /&gt;
&lt;br /&gt;
== Optimizing Load Times ==&lt;br /&gt;
&lt;br /&gt;
When rebuilding new paks, it's extremely important that asset order be optimized in order to minimize the distance the game has to seek on the disc in order to load any given asset. A poorly optimized pak can easily have 30+ second load times on small rooms. There are three main things that are done in order to keep load times fast.&lt;br /&gt;
&lt;br /&gt;
* In world paks, assets are often duplicated so they appear multiple times within the pak; if an asset is used by a lot of different areas this can help reduce seek distance, but has the downside of bloating the total file size of the pak. To ensure the best balance between the two, asset duplication was flagged on a per-area basis, as larger areas take longer to load and would benefit from the faster load speed, whereas small rooms tend to load quickly anyway even without duplicates. The flag that was used for this only existed in Retro's raw files and isn't present in the final game's cooked data. You can recreate it by analyzing the pak and noting down which rooms have duplicate assets (bearing in mind that the assets used by a room always precede that room's MREA asset). If you are working strictly from a pre-unpacked pak, you can't replicate the flag.&lt;br /&gt;
* Assets are generally grouped by load order - things that are used together are adjacent in the pak, and an asset's dependencies typically appear immediately preceding the asset itself. This grouping helps ensure that even when assets aren't duplicated the game will still be able to do just one large seek and then load a bunch of assets at once, instead of having to do a separate seek for each asset.&lt;br /&gt;
* Once you have assets stored in the pak in the right order, you need to make sure the game actually reads them in that order! The exact order that assets are loaded in is specified by the dependency list in the [[MLVL (File Format)|MLVL]] file; as such, the MLVL list should also have assets grouped in the same way and the same order and should at least roughly match the order files are positioned in the pak.&lt;br /&gt;
&lt;br /&gt;
For every asset loaded, the game checks every copy of the asset in the pak and loads whichever duplicate is the shortest distance from the last read position (the end of the last asset that was loaded). When loading an area, this is the order the game loads assets in:&lt;br /&gt;
* First the game goes down the area dependency list in the [[MLVL (File Format)|MLVL]] file and loads every file in the list for every active layer. The game follows the exact order specified by the list.&lt;br /&gt;
* After loading all area dependencies, the area itself is loaded.&lt;br /&gt;
* Finally the game loads assets being used by the new area that are missing from the list. This primarily means [[SCAN (File Format)|SCAN]] files (in MP1), the skybox model, and assets being used by PlayerActor animsets (this avoids loading PlayerActor assets for suits that the player doesn't have). If any other assets were missing from the list, they are loaded here. It's very important to know that contrary to the previous steps, assets that still aren't in memory at this point are loaded ''synchronously'', which means the game will hang until loading is complete; therefore, you want as few assets as possible to be left to load at this point. (You can observe this hang even in the base game - there is a small freeze towards the end of loading Artifact Temple.)&lt;br /&gt;
* Note that any assets that are already in memory will be skipped.&lt;br /&gt;
&lt;br /&gt;
'''Note:''' There are some discrepancies between the order assets appear in the pak and the actual load order specified by the MLVL file. There might be some more research needed to fully explain all the quirks behind Retro's pak optimization.&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
* [https://drive.google.com/file/d/0B9MLV21H7SDvcGc1QjRfSTFJNk0/view?usp=sharing PakTool] by Aruki&lt;br /&gt;
&lt;br /&gt;
[[Category:File Formats]]&lt;br /&gt;
[[Category:Metroid Prime]]&lt;br /&gt;
[[Category:Metroid Prime 2: Echoes]]&lt;/div&gt;</summary>
		<author><name>Aruki</name></author>	</entry>

	<entry>
		<id>http://www.metroid2002.com/retromodding/index.php?title=PAK_(Metroid_Prime)&amp;diff=1930</id>
		<title>PAK (Metroid Prime)</title>
		<link rel="alternate" type="text/html" href="http://www.metroid2002.com/retromodding/index.php?title=PAK_(Metroid_Prime)&amp;diff=1930"/>
				<updated>2018-06-14T19:53:23Z</updated>
		
		<summary type="html">&lt;p&gt;Aruki: /* Format */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''See [[PAK (File Format)]] for the other revisions of this format.''&lt;br /&gt;
&lt;br /&gt;
The '''.pak format''' in Metroid Prime and Metroid Prime 2 is a fairly simple packfile format; files are stored with a 32-bit file ID, and can optionally be compressed with zlib (Metroid Prime) or LZO1X-999 (Metroid Prime 2). The assets in a pak are split into two groups: named resources and dependencies. In general, only named resources are accessed directly by the game; the rest are dependencies of the named resources, and are accessed indirectly in the process of parsing those files.&lt;br /&gt;
&lt;br /&gt;
Note that the Metroid Prime 3 E3 prototype uses this pak format as well, but has 64-bit file IDs. This is the only difference; the version number is still the same, so there isn't an easy way to check for this variation of the format.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Format==&lt;br /&gt;
&lt;br /&gt;
=== Header ===&lt;br /&gt;
&lt;br /&gt;
The pak starts with a short 8-byte header:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| int16&lt;br /&gt;
| '''Version Number Major'''&lt;br /&gt;
| Always 3&lt;br /&gt;
|-&lt;br /&gt;
| 0x2&lt;br /&gt;
| int16&lt;br /&gt;
| '''Version Number Minor'''&lt;br /&gt;
| Always 5&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| int32&lt;br /&gt;
| '''Unused'''&lt;br /&gt;
| Always 0&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| colspan=3 {{unknown|End of header}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Named Resources ===&lt;br /&gt;
&lt;br /&gt;
The named resource table lists files that the game has direct access to. On world paks, this will generally only contain the MLVL file; in other paks, this table is usually quite a bit larger. Note that in non-world paks, the names are hardcoded and are how the game knows where to find the files; if you repack, you need to make sure you keep the names the same.&lt;br /&gt;
&lt;br /&gt;
This section of the file begins with a 32-bit named resource count, followed by a table.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| {{FourCC}}&lt;br /&gt;
| 1&lt;br /&gt;
| '''Asset Type'''&lt;br /&gt;
| Indicates the type of asset (texture, model, area, etc) and usually doubles as the asset's cooked file extension.&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| int32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Asset ID'''&lt;br /&gt;
| Unique identifier for this asset.&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| int32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Name Length'''&lt;br /&gt;
| Length of the name string&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| char&lt;br /&gt;
| ''Name Length''&lt;br /&gt;
| '''Name String'''&lt;br /&gt;
| Name of the asset. This name usually corresponds to a hardcoded string that the game uses to look up the asset, so this generally can't be changed.&lt;br /&gt;
|-&lt;br /&gt;
| colspan=5 {{unknown|End of entry}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Resource Table ===&lt;br /&gt;
&lt;br /&gt;
This could be considered the main table of contents of the pak. This table begins with a 32-bit resource count, followed by one entry per file; each entry is 0x14 bytes large.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| int32&lt;br /&gt;
| '''Compression Flag'''&lt;br /&gt;
| Value will be either 0 or 1, with 1 denoting that the asset is compressed.&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| {{FourCC}}&lt;br /&gt;
| '''Asset Type'''&lt;br /&gt;
| Indicates the type of asset (texture, model, area, etc) and usually doubles as the asset's cooked file extension.&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| int32&lt;br /&gt;
| '''Asset ID'''&lt;br /&gt;
| Unique identifier for this asset. This ID is used by other assets to reference this one.&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| int32&lt;br /&gt;
| '''Size'''&lt;br /&gt;
| Size of the asset data in the pak. This is always 32-byte-aligned. The end of the asset is padded with 0xFF.&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| int32&lt;br /&gt;
| '''Offset'''&lt;br /&gt;
| Offset of the asset data within the pak. This is an absolute offset.&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| colspan=4 {{unknown|End of entry}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Compression ==&lt;br /&gt;
&lt;br /&gt;
Compressed files begin with their 32-bit decompressed size, followed by the compressed file data. Metroid Prime uses zlib, which is easily recognized from zlib's 0x78DA header at the start of the compressed data. Each file is compressed as a single zlib stream.&lt;br /&gt;
&lt;br /&gt;
Metroid Prime 2 uses segmented LZO1X-999, and gets slightly more complicated. Metroid Prime 2's compressed files are split up into multiple segments of compressed data, each of which is 0x4000 bytes large when decompressed (except for the last one) and should be compressed and decompressed separately. Each segment begins with a 16-bit size value before its actual compressed data begins.&lt;br /&gt;
&lt;br /&gt;
Only certain formats are compressed. The following formats are always compressed:&lt;br /&gt;
&lt;br /&gt;
* [[TXTR (Metroid Prime)|TXTR]]&lt;br /&gt;
* [[CMDL (Metroid Prime)|CMDL]]&lt;br /&gt;
* [[CSKR (File Format)|CSKR]]&lt;br /&gt;
* [[ANCS (File Format)|ANCS]]&lt;br /&gt;
* [[ANIM (File Format)|ANIM]]&lt;br /&gt;
* [[FONT (File Format)|FONT]]&lt;br /&gt;
&lt;br /&gt;
The following formats are compressed when their uncompressed size is at least 0x400 bytes (0x40 bytes in the MP3 prototype):&lt;br /&gt;
&lt;br /&gt;
* [[PART (File Format)|PART]]&lt;br /&gt;
* [[ELSC (File Format)|ELSC]]&lt;br /&gt;
* [[SWHC (File Format)|SWHC]]&lt;br /&gt;
* [[WPSC (File Format)|WPSC]]&lt;br /&gt;
* [[DPSC (File Format)|DPSC]]&lt;br /&gt;
* [[CRSC (File Format)|CRSC]]&lt;br /&gt;
&lt;br /&gt;
Additionally, in Prime 2 any files can be left uncompressed if the compressed file is larger than the uncompressed one. This is not the case in Prime 1 (although custom repacking implementations should probably do this regardless, as there's no benefit to the compression in this scenario).&lt;br /&gt;
&lt;br /&gt;
== Optimizing Load Times ==&lt;br /&gt;
&lt;br /&gt;
When rebuilding new paks, it's extremely important that asset order be optimized in order to minimize the distance the game has to seek on the disc in order to load any given asset. A poorly optimized pak can easily have 30+ second load times on small rooms. There are three main things that are done in order to keep load times fast.&lt;br /&gt;
&lt;br /&gt;
* In world paks, assets are often duplicated so they appear multiple times within the pak; if an asset is used by a lot of different areas this can help reduce seek distance, but has the downside of bloating the total file size of the pak. To ensure the best balance between the two, asset duplication was flagged on a per-area basis, as larger areas take longer to load and would benefit from the faster load speed, whereas small rooms tend to load quickly anyway even without duplicates. The flag that was used for this only existed in Retro's raw files and isn't present in the final game's cooked data. You can recreate it by analyzing the pak and noting down which rooms have duplicate assets (bearing in mind that the assets used by a room always precede that room's MREA asset). If you are working strictly from a pre-unpacked pak, you can't replicate the flag.&lt;br /&gt;
* Assets are generally grouped by load order - things that are used together are adjacent in the pak, and an asset's dependencies typically appear immediately preceding the asset itself. This grouping helps ensure that even when assets aren't duplicated the game will still be able to do just one large seek and then load a bunch of assets at once, instead of having to do a separate seek for each asset.&lt;br /&gt;
* Once you have assets stored in the pak in the right order, you need to make sure the game actually reads them in that order! The exact order that assets are loaded in is specified by the dependency list in the [[MLVL (File Format)|MLVL]] file; as such, the MLVL list should also have assets grouped in the same way and the same order and should at least roughly match the order files are positioned in the pak.&lt;br /&gt;
&lt;br /&gt;
For every asset loaded, the game checks every copy of the asset in the pak and loads whichever duplicate is the shortest distance from the last read position (the end of the last asset that was loaded). When loading an area, this is the order the game loads assets in:&lt;br /&gt;
* First the game goes down the area dependency list in the [[MLVL (File Format)|MLVL]] file and loads every file in the list for every active layer. The game follows the exact order specified by the list.&lt;br /&gt;
* After loading all area dependencies, the area itself is loaded.&lt;br /&gt;
* Finally the game loads assets being used by the new area that are missing from the list. This primarily means [[SCAN (File Format)|SCAN]] files (in MP1), the skybox model, and assets being used by PlayerActor animsets (this avoids loading PlayerActor assets for suits that the player doesn't have). If any other assets were missing from the list, they are loaded here. It's very important to know that contrary to the previous steps, assets that still aren't in memory at this point are loaded ''synchronously'', which means the game will hang until loading is complete; therefore, you want as few assets as possible to be left to load at this point. (You can observe this hang even in the base game - there is a small freeze towards the end of loading Artifact Temple.)&lt;br /&gt;
* Note that any assets that are already in memory will be skipped.&lt;br /&gt;
&lt;br /&gt;
'''Note:''' There are some discrepancies between the order assets appear in the pak and the actual load order specified by the MLVL file. There might be some more research needed to fully explain all the quirks behind Retro's pak optimization.&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
* [https://drive.google.com/file/d/0B9MLV21H7SDvcGc1QjRfSTFJNk0/view?usp=sharing PakTool] by Aruki&lt;br /&gt;
&lt;br /&gt;
[[Category:File Formats]]&lt;br /&gt;
[[Category:Metroid Prime]]&lt;br /&gt;
[[Category:Metroid Prime 2: Echoes]]&lt;/div&gt;</summary>
		<author><name>Aruki</name></author>	</entry>

	<entry>
		<id>http://www.metroid2002.com/retromodding/index.php?title=PAK_(Metroid_Prime)&amp;diff=1929</id>
		<title>PAK (Metroid Prime)</title>
		<link rel="alternate" type="text/html" href="http://www.metroid2002.com/retromodding/index.php?title=PAK_(Metroid_Prime)&amp;diff=1929"/>
				<updated>2018-06-14T19:46:34Z</updated>
		
		<summary type="html">&lt;p&gt;Aruki: /* Compression */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''See [[PAK (File Format)]] for the other revisions of this format.''&lt;br /&gt;
&lt;br /&gt;
The '''.pak format''' in Metroid Prime and Metroid Prime 2 is a fairly simple packfile format; files are stored with a 32-bit file ID, and can optionally be compressed with zlib (Metroid Prime) or LZO1X-999 (Metroid Prime 2). The assets in a pak are split into two groups: named resources and dependencies. In general, only named resources are accessed directly by the game; the rest are dependencies of the named resources, and are accessed indirectly in the process of parsing those files.&lt;br /&gt;
&lt;br /&gt;
Note that the Metroid Prime 3 E3 prototype uses this pak format as well, but has 64-bit file IDs. This is the only difference; the version number is still the same, so there isn't an easy way to check for this variation of the format.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Format==&lt;br /&gt;
&lt;br /&gt;
=== Header ===&lt;br /&gt;
&lt;br /&gt;
The pak starts with a short 8-byte header:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 4&lt;br /&gt;
| '''Version number'''. Always 0x00030005.&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 4&lt;br /&gt;
| '''Unused'''; always 0&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| colspan=2 {{unknown|End of header}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Named Resources ===&lt;br /&gt;
&lt;br /&gt;
The named resource table lists files that the game has direct access to. On world paks, this will generally only contain the MLVL file; in other paks, this table is usually quite a bit larger. Note that in non-world paks, the names are hardcoded and are how the game knows where to find the files; if you repack, you need to make sure you keep the names the same.&lt;br /&gt;
&lt;br /&gt;
This section of the file begins with a 32-bit named resource count, followed by a table.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 4&lt;br /&gt;
| '''File type''' fourCC.&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 4&lt;br /&gt;
| '''File ID'''.&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 4&lt;br /&gt;
| '''Name length''' (NL)&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| NL&lt;br /&gt;
| '''Name'''; not zero-terminated&lt;br /&gt;
|-&lt;br /&gt;
| 0xC + NL&lt;br /&gt;
| colspan=2 {{unknown|End of entry}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Resource Table ===&lt;br /&gt;
&lt;br /&gt;
This could be considered the main table of contents of the pak. This table begins with a 32-bit resource count, followed by one entry per file; each entry is 0x14 bytes large.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 4&lt;br /&gt;
| '''Compression flag'''; this will either be 0 or 1, with 1 denoting a compressed file.&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 4&lt;br /&gt;
| '''File type''' fourCC.&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 4&lt;br /&gt;
| '''File ID'''&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 4&lt;br /&gt;
| '''Size''' (note: always a multiple of 32. The end of the file is padded with 0xFF in order to be 32-byte aligned.)&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 4&lt;br /&gt;
| '''Offset'''&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| colspan=2 {{unknown|End of entry}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Compression ==&lt;br /&gt;
&lt;br /&gt;
Compressed files begin with their 32-bit decompressed size, followed by the compressed file data. Metroid Prime uses zlib, which is easily recognized from zlib's 0x78DA header at the start of the compressed data. Each file is compressed as a single zlib stream.&lt;br /&gt;
&lt;br /&gt;
Metroid Prime 2 uses segmented LZO1X-999, and gets slightly more complicated. Metroid Prime 2's compressed files are split up into multiple segments of compressed data, each of which is 0x4000 bytes large when decompressed (except for the last one) and should be compressed and decompressed separately. Each segment begins with a 16-bit size value before its actual compressed data begins.&lt;br /&gt;
&lt;br /&gt;
Only certain formats are compressed. The following formats are always compressed:&lt;br /&gt;
&lt;br /&gt;
* [[TXTR (Metroid Prime)|TXTR]]&lt;br /&gt;
* [[CMDL (Metroid Prime)|CMDL]]&lt;br /&gt;
* [[CSKR (File Format)|CSKR]]&lt;br /&gt;
* [[ANCS (File Format)|ANCS]]&lt;br /&gt;
* [[ANIM (File Format)|ANIM]]&lt;br /&gt;
* [[FONT (File Format)|FONT]]&lt;br /&gt;
&lt;br /&gt;
The following formats are compressed when their uncompressed size is at least 0x400 bytes (0x40 bytes in the MP3 prototype):&lt;br /&gt;
&lt;br /&gt;
* [[PART (File Format)|PART]]&lt;br /&gt;
* [[ELSC (File Format)|ELSC]]&lt;br /&gt;
* [[SWHC (File Format)|SWHC]]&lt;br /&gt;
* [[WPSC (File Format)|WPSC]]&lt;br /&gt;
* [[DPSC (File Format)|DPSC]]&lt;br /&gt;
* [[CRSC (File Format)|CRSC]]&lt;br /&gt;
&lt;br /&gt;
Additionally, in Prime 2 any files can be left uncompressed if the compressed file is larger than the uncompressed one. This is not the case in Prime 1 (although custom repacking implementations should probably do this regardless, as there's no benefit to the compression in this scenario).&lt;br /&gt;
&lt;br /&gt;
== Optimizing Load Times ==&lt;br /&gt;
&lt;br /&gt;
When rebuilding new paks, it's extremely important that asset order be optimized in order to minimize the distance the game has to seek on the disc in order to load any given asset. A poorly optimized pak can easily have 30+ second load times on small rooms. There are three main things that are done in order to keep load times fast.&lt;br /&gt;
&lt;br /&gt;
* In world paks, assets are often duplicated so they appear multiple times within the pak; if an asset is used by a lot of different areas this can help reduce seek distance, but has the downside of bloating the total file size of the pak. To ensure the best balance between the two, asset duplication was flagged on a per-area basis, as larger areas take longer to load and would benefit from the faster load speed, whereas small rooms tend to load quickly anyway even without duplicates. The flag that was used for this only existed in Retro's raw files and isn't present in the final game's cooked data. You can recreate it by analyzing the pak and noting down which rooms have duplicate assets (bearing in mind that the assets used by a room always precede that room's MREA asset). If you are working strictly from a pre-unpacked pak, you can't replicate the flag.&lt;br /&gt;
* Assets are generally grouped by load order - things that are used together are adjacent in the pak, and an asset's dependencies typically appear immediately preceding the asset itself. This grouping helps ensure that even when assets aren't duplicated the game will still be able to do just one large seek and then load a bunch of assets at once, instead of having to do a separate seek for each asset.&lt;br /&gt;
* Once you have assets stored in the pak in the right order, you need to make sure the game actually reads them in that order! The exact order that assets are loaded in is specified by the dependency list in the [[MLVL (File Format)|MLVL]] file; as such, the MLVL list should also have assets grouped in the same way and the same order and should at least roughly match the order files are positioned in the pak.&lt;br /&gt;
&lt;br /&gt;
For every asset loaded, the game checks every copy of the asset in the pak and loads whichever duplicate is the shortest distance from the last read position (the end of the last asset that was loaded). When loading an area, this is the order the game loads assets in:&lt;br /&gt;
* First the game goes down the area dependency list in the [[MLVL (File Format)|MLVL]] file and loads every file in the list for every active layer. The game follows the exact order specified by the list.&lt;br /&gt;
* After loading all area dependencies, the area itself is loaded.&lt;br /&gt;
* Finally the game loads assets being used by the new area that are missing from the list. This primarily means [[SCAN (File Format)|SCAN]] files (in MP1), the skybox model, and assets being used by PlayerActor animsets (this avoids loading PlayerActor assets for suits that the player doesn't have). If any other assets were missing from the list, they are loaded here. It's very important to know that contrary to the previous steps, assets that still aren't in memory at this point are loaded ''synchronously'', which means the game will hang until loading is complete; therefore, you want as few assets as possible to be left to load at this point. (You can observe this hang even in the base game - there is a small freeze towards the end of loading Artifact Temple.)&lt;br /&gt;
* Note that any assets that are already in memory will be skipped.&lt;br /&gt;
&lt;br /&gt;
'''Note:''' There are some discrepancies between the order assets appear in the pak and the actual load order specified by the MLVL file. There might be some more research needed to fully explain all the quirks behind Retro's pak optimization.&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
* [https://drive.google.com/file/d/0B9MLV21H7SDvcGc1QjRfSTFJNk0/view?usp=sharing PakTool] by Aruki&lt;br /&gt;
&lt;br /&gt;
[[Category:File Formats]]&lt;br /&gt;
[[Category:Metroid Prime]]&lt;br /&gt;
[[Category:Metroid Prime 2: Echoes]]&lt;/div&gt;</summary>
		<author><name>Aruki</name></author>	</entry>

	<entry>
		<id>http://www.metroid2002.com/retromodding/index.php?title=PAK_(Metroid_Prime)&amp;diff=1928</id>
		<title>PAK (Metroid Prime)</title>
		<link rel="alternate" type="text/html" href="http://www.metroid2002.com/retromodding/index.php?title=PAK_(Metroid_Prime)&amp;diff=1928"/>
				<updated>2018-06-14T19:44:23Z</updated>
		
		<summary type="html">&lt;p&gt;Aruki: /* Optimizing Load Times */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''See [[PAK (File Format)]] for the other revisions of this format.''&lt;br /&gt;
&lt;br /&gt;
The '''.pak format''' in Metroid Prime and Metroid Prime 2 is a fairly simple packfile format; files are stored with a 32-bit file ID, and can optionally be compressed with zlib (Metroid Prime) or LZO1X-999 (Metroid Prime 2). The assets in a pak are split into two groups: named resources and dependencies. In general, only named resources are accessed directly by the game; the rest are dependencies of the named resources, and are accessed indirectly in the process of parsing those files.&lt;br /&gt;
&lt;br /&gt;
Note that the Metroid Prime 3 E3 prototype uses this pak format as well, but has 64-bit file IDs. This is the only difference; the version number is still the same, so there isn't an easy way to check for this variation of the format.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Format==&lt;br /&gt;
&lt;br /&gt;
=== Header ===&lt;br /&gt;
&lt;br /&gt;
The pak starts with a short 8-byte header:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 4&lt;br /&gt;
| '''Version number'''. Always 0x00030005.&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 4&lt;br /&gt;
| '''Unused'''; always 0&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| colspan=2 {{unknown|End of header}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Named Resources ===&lt;br /&gt;
&lt;br /&gt;
The named resource table lists files that the game has direct access to. On world paks, this will generally only contain the MLVL file; in other paks, this table is usually quite a bit larger. Note that in non-world paks, the names are hardcoded and are how the game knows where to find the files; if you repack, you need to make sure you keep the names the same.&lt;br /&gt;
&lt;br /&gt;
This section of the file begins with a 32-bit named resource count, followed by a table.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 4&lt;br /&gt;
| '''File type''' fourCC.&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 4&lt;br /&gt;
| '''File ID'''.&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 4&lt;br /&gt;
| '''Name length''' (NL)&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| NL&lt;br /&gt;
| '''Name'''; not zero-terminated&lt;br /&gt;
|-&lt;br /&gt;
| 0xC + NL&lt;br /&gt;
| colspan=2 {{unknown|End of entry}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Resource Table ===&lt;br /&gt;
&lt;br /&gt;
This could be considered the main table of contents of the pak. This table begins with a 32-bit resource count, followed by one entry per file; each entry is 0x14 bytes large.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 4&lt;br /&gt;
| '''Compression flag'''; this will either be 0 or 1, with 1 denoting a compressed file.&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 4&lt;br /&gt;
| '''File type''' fourCC.&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 4&lt;br /&gt;
| '''File ID'''&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 4&lt;br /&gt;
| '''Size''' (note: always a multiple of 32. The end of the file is padded with 0xFF in order to be 32-byte aligned.)&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 4&lt;br /&gt;
| '''Offset'''&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| colspan=2 {{unknown|End of entry}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Compression ==&lt;br /&gt;
&lt;br /&gt;
Compressed files begin with their 32-bit decompressed size, followed by the compressed file data. Metroid Prime uses zlib, which is easily recognized from zlib's 0x78DA header at the start of the compressed data. Each file is compressed as a single zlib stream.&lt;br /&gt;
&lt;br /&gt;
Metroid Prime 2 uses segmented LZO1X-999, and gets slightly more complicated. Metroid Prime 2's compressed files are split up into multiple segments of compressed data, each of which is 0x4000 bytes large when decompressed (except for the last one) and should be compressed and decompressed separately. Each segment begins with a 16-bit size value before its actual compressed data begins.&lt;br /&gt;
&lt;br /&gt;
Only certain formats are compressed. The following formats are always compressed:&lt;br /&gt;
&lt;br /&gt;
* [[TXTR (Metroid Prime)|TXTR]]&lt;br /&gt;
* [[CMDL (Metroid Prime)|CMDL]]&lt;br /&gt;
* [[CSKR (File Format)|CSKR]]&lt;br /&gt;
* [[ANCS (File Format)|ANCS]]&lt;br /&gt;
* [[ANIM (File Format)|ANIM]]&lt;br /&gt;
* [[FONT (File Format)|FONT]]&lt;br /&gt;
&lt;br /&gt;
The following formats are compressed when their uncompressed size is at least 0x400 bytes (0x40 bytes in the MP3 prototype):&lt;br /&gt;
&lt;br /&gt;
* [[PART (File Format)|PART]]&lt;br /&gt;
* [[ELSC (File Format)|ELSC]]&lt;br /&gt;
* [[SWHC (File Format)|SWHC]]&lt;br /&gt;
* [[WPSC (File Format)|WPSC]]&lt;br /&gt;
* [[DPSC (File Format)|DPSC]]&lt;br /&gt;
* [[CRSC (File Format)|CRSC]]&lt;br /&gt;
&lt;br /&gt;
Additionally, in Prime 2 any files can be left uncompressed if the compressed file is larger than the uncompressed one. This is not the case in Prime 1 (although custom repacking implementations should probably do this regardless).&lt;br /&gt;
&lt;br /&gt;
== Optimizing Load Times ==&lt;br /&gt;
&lt;br /&gt;
When rebuilding new paks, it's extremely important that asset order be optimized in order to minimize the distance the game has to seek on the disc in order to load any given asset. A poorly optimized pak can easily have 30+ second load times on small rooms. There are three main things that are done in order to keep load times fast.&lt;br /&gt;
&lt;br /&gt;
* In world paks, assets are often duplicated so they appear multiple times within the pak; if an asset is used by a lot of different areas this can help reduce seek distance, but has the downside of bloating the total file size of the pak. To ensure the best balance between the two, asset duplication was flagged on a per-area basis, as larger areas take longer to load and would benefit from the faster load speed, whereas small rooms tend to load quickly anyway even without duplicates. The flag that was used for this only existed in Retro's raw files and isn't present in the final game's cooked data. You can recreate it by analyzing the pak and noting down which rooms have duplicate assets (bearing in mind that the assets used by a room always precede that room's MREA asset). If you are working strictly from a pre-unpacked pak, you can't replicate the flag.&lt;br /&gt;
* Assets are generally grouped by load order - things that are used together are adjacent in the pak, and an asset's dependencies typically appear immediately preceding the asset itself. This grouping helps ensure that even when assets aren't duplicated the game will still be able to do just one large seek and then load a bunch of assets at once, instead of having to do a separate seek for each asset.&lt;br /&gt;
* Once you have assets stored in the pak in the right order, you need to make sure the game actually reads them in that order! The exact order that assets are loaded in is specified by the dependency list in the [[MLVL (File Format)|MLVL]] file; as such, the MLVL list should also have assets grouped in the same way and the same order and should at least roughly match the order files are positioned in the pak.&lt;br /&gt;
&lt;br /&gt;
For every asset loaded, the game checks every copy of the asset in the pak and loads whichever duplicate is the shortest distance from the last read position (the end of the last asset that was loaded). When loading an area, this is the order the game loads assets in:&lt;br /&gt;
* First the game goes down the area dependency list in the [[MLVL (File Format)|MLVL]] file and loads every file in the list for every active layer. The game follows the exact order specified by the list.&lt;br /&gt;
* After loading all area dependencies, the area itself is loaded.&lt;br /&gt;
* Finally the game loads assets being used by the new area that are missing from the list. This primarily means [[SCAN (File Format)|SCAN]] files (in MP1), the skybox model, and assets being used by PlayerActor animsets (this avoids loading PlayerActor assets for suits that the player doesn't have). If any other assets were missing from the list, they are loaded here. It's very important to know that contrary to the previous steps, assets that still aren't in memory at this point are loaded ''synchronously'', which means the game will hang until loading is complete; therefore, you want as few assets as possible to be left to load at this point. (You can observe this hang even in the base game - there is a small freeze towards the end of loading Artifact Temple.)&lt;br /&gt;
* Note that any assets that are already in memory will be skipped.&lt;br /&gt;
&lt;br /&gt;
'''Note:''' There are some discrepancies between the order assets appear in the pak and the actual load order specified by the MLVL file. There might be some more research needed to fully explain all the quirks behind Retro's pak optimization.&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
* [https://drive.google.com/file/d/0B9MLV21H7SDvcGc1QjRfSTFJNk0/view?usp=sharing PakTool] by Aruki&lt;br /&gt;
&lt;br /&gt;
[[Category:File Formats]]&lt;br /&gt;
[[Category:Metroid Prime]]&lt;br /&gt;
[[Category:Metroid Prime 2: Echoes]]&lt;/div&gt;</summary>
		<author><name>Aruki</name></author>	</entry>

	<entry>
		<id>http://www.metroid2002.com/retromodding/index.php?title=PAK_(Metroid_Prime)&amp;diff=1927</id>
		<title>PAK (Metroid Prime)</title>
		<link rel="alternate" type="text/html" href="http://www.metroid2002.com/retromodding/index.php?title=PAK_(Metroid_Prime)&amp;diff=1927"/>
				<updated>2018-06-14T19:37:50Z</updated>
		
		<summary type="html">&lt;p&gt;Aruki: /* Optimizing Load Times */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''See [[PAK (File Format)]] for the other revisions of this format.''&lt;br /&gt;
&lt;br /&gt;
The '''.pak format''' in Metroid Prime and Metroid Prime 2 is a fairly simple packfile format; files are stored with a 32-bit file ID, and can optionally be compressed with zlib (Metroid Prime) or LZO1X-999 (Metroid Prime 2). The assets in a pak are split into two groups: named resources and dependencies. In general, only named resources are accessed directly by the game; the rest are dependencies of the named resources, and are accessed indirectly in the process of parsing those files.&lt;br /&gt;
&lt;br /&gt;
Note that the Metroid Prime 3 E3 prototype uses this pak format as well, but has 64-bit file IDs. This is the only difference; the version number is still the same, so there isn't an easy way to check for this variation of the format.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Format==&lt;br /&gt;
&lt;br /&gt;
=== Header ===&lt;br /&gt;
&lt;br /&gt;
The pak starts with a short 8-byte header:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 4&lt;br /&gt;
| '''Version number'''. Always 0x00030005.&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 4&lt;br /&gt;
| '''Unused'''; always 0&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| colspan=2 {{unknown|End of header}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Named Resources ===&lt;br /&gt;
&lt;br /&gt;
The named resource table lists files that the game has direct access to. On world paks, this will generally only contain the MLVL file; in other paks, this table is usually quite a bit larger. Note that in non-world paks, the names are hardcoded and are how the game knows where to find the files; if you repack, you need to make sure you keep the names the same.&lt;br /&gt;
&lt;br /&gt;
This section of the file begins with a 32-bit named resource count, followed by a table.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 4&lt;br /&gt;
| '''File type''' fourCC.&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 4&lt;br /&gt;
| '''File ID'''.&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 4&lt;br /&gt;
| '''Name length''' (NL)&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| NL&lt;br /&gt;
| '''Name'''; not zero-terminated&lt;br /&gt;
|-&lt;br /&gt;
| 0xC + NL&lt;br /&gt;
| colspan=2 {{unknown|End of entry}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Resource Table ===&lt;br /&gt;
&lt;br /&gt;
This could be considered the main table of contents of the pak. This table begins with a 32-bit resource count, followed by one entry per file; each entry is 0x14 bytes large.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 4&lt;br /&gt;
| '''Compression flag'''; this will either be 0 or 1, with 1 denoting a compressed file.&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 4&lt;br /&gt;
| '''File type''' fourCC.&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 4&lt;br /&gt;
| '''File ID'''&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 4&lt;br /&gt;
| '''Size''' (note: always a multiple of 32. The end of the file is padded with 0xFF in order to be 32-byte aligned.)&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 4&lt;br /&gt;
| '''Offset'''&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| colspan=2 {{unknown|End of entry}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Compression ==&lt;br /&gt;
&lt;br /&gt;
Compressed files begin with their 32-bit decompressed size, followed by the compressed file data. Metroid Prime uses zlib, which is easily recognized from zlib's 0x78DA header at the start of the compressed data. Each file is compressed as a single zlib stream.&lt;br /&gt;
&lt;br /&gt;
Metroid Prime 2 uses segmented LZO1X-999, and gets slightly more complicated. Metroid Prime 2's compressed files are split up into multiple segments of compressed data, each of which is 0x4000 bytes large when decompressed (except for the last one) and should be compressed and decompressed separately. Each segment begins with a 16-bit size value before its actual compressed data begins.&lt;br /&gt;
&lt;br /&gt;
Only certain formats are compressed. The following formats are always compressed:&lt;br /&gt;
&lt;br /&gt;
* [[TXTR (Metroid Prime)|TXTR]]&lt;br /&gt;
* [[CMDL (Metroid Prime)|CMDL]]&lt;br /&gt;
* [[CSKR (File Format)|CSKR]]&lt;br /&gt;
* [[ANCS (File Format)|ANCS]]&lt;br /&gt;
* [[ANIM (File Format)|ANIM]]&lt;br /&gt;
* [[FONT (File Format)|FONT]]&lt;br /&gt;
&lt;br /&gt;
The following formats are compressed when their uncompressed size is at least 0x400 bytes (0x40 bytes in the MP3 prototype):&lt;br /&gt;
&lt;br /&gt;
* [[PART (File Format)|PART]]&lt;br /&gt;
* [[ELSC (File Format)|ELSC]]&lt;br /&gt;
* [[SWHC (File Format)|SWHC]]&lt;br /&gt;
* [[WPSC (File Format)|WPSC]]&lt;br /&gt;
* [[DPSC (File Format)|DPSC]]&lt;br /&gt;
* [[CRSC (File Format)|CRSC]]&lt;br /&gt;
&lt;br /&gt;
Additionally, in Prime 2 any files can be left uncompressed if the compressed file is larger than the uncompressed one. This is not the case in Prime 1 (although custom repacking implementations should probably do this regardless).&lt;br /&gt;
&lt;br /&gt;
== Optimizing Load Times ==&lt;br /&gt;
&lt;br /&gt;
When rebuilding new paks, it's extremely important that asset order be optimized in order to minimize the distance the game has to seek on the disc in order to load any given asset. A poorly optimized pak can easily have 30+ second load times on small rooms. There are three main things that are done in order to keep load times fast.&lt;br /&gt;
&lt;br /&gt;
* In world paks, assets are often duplicated so they appear multiple times within the pak; if an asset is used by a lot of different areas this can help reduce seek distance, but has the downside of bloating the total file size of the pak. To ensure the best balance between the two, asset duplication was flagged on a per-area basis, as larger areas take longer to load and would benefit from the faster load speed, whereas small rooms tend to load quickly anyway even without duplicates. The flag that was used for this only existed in Retro's raw files and isn't present in the final game's cooked data. You can recreate it by analyzing the pak and noting down which rooms have duplicate assets (bearing in mind that the assets used by a room always precede that room's MREA asset). If you are working strictly from a pre-unpacked pak, you can't replicate the flag.&lt;br /&gt;
* Assets are generally grouped by load order - things that are used together are adjacent in the pak, and an asset's dependencies typically appear immediately preceding the asset itself. This grouping helps ensure that even when assets aren't duplicated the game will still be able to do just one large seek and then load a bunch of assets at once, instead of having to do a separate seek for each asset.&lt;br /&gt;
* Once you have assets stored in the pak in the right order, you need to make sure the game actually reads them in that order! The exact order that assets are loaded in is specified by the dependency list in the [[MLVL (File Format)|MLVL]] file; as such, the MLVL list should also have assets grouped in the same way and the same order and should at least roughly match the order files are positioned in the pak.&lt;br /&gt;
&lt;br /&gt;
For every asset loaded, the game checks every copy of the asset in the pak and loads whichever duplicate is the shortest distance from the last read position (the end of the last asset that was loaded). When loading an area, this is the order the game loads assets in:&lt;br /&gt;
* First the game goes down the area dependency list in the [[MLVL (File Format)|MLVL]] file and loads every file in the list for every active layer. The game follows the exact order specified by the list.&lt;br /&gt;
* After loading all area dependencies, the area itself is loaded.&lt;br /&gt;
* Finally the game loads assets being used by the new area that are missing from the list. This primarily means [[SCAN (File Format)|SCAN]] files (in MP1), the skybox model, and assets being used by PlayerActor animsets (this avoids loading PlayerActor assets for suits that the player doesn't have). If anything else is missing from the list, they will still be loaded, but this step will cause the game to hang until the load is finished.&lt;br /&gt;
* Note that any assets that are already in memory will be skipped.&lt;br /&gt;
&lt;br /&gt;
'''Note:''' There are some discrepancies between the order assets appear in the pak and the actual load order specified by the MLVL file. There might be some more research needed to fully explain all the quirks behind Retro's pak optimization.&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
* [https://drive.google.com/file/d/0B9MLV21H7SDvcGc1QjRfSTFJNk0/view?usp=sharing PakTool] by Aruki&lt;br /&gt;
&lt;br /&gt;
[[Category:File Formats]]&lt;br /&gt;
[[Category:Metroid Prime]]&lt;br /&gt;
[[Category:Metroid Prime 2: Echoes]]&lt;/div&gt;</summary>
		<author><name>Aruki</name></author>	</entry>

	<entry>
		<id>http://www.metroid2002.com/retromodding/index.php?title=Materials_(Metroid_Prime)&amp;diff=1924</id>
		<title>Materials (Metroid Prime)</title>
		<link rel="alternate" type="text/html" href="http://www.metroid2002.com/retromodding/index.php?title=Materials_(Metroid_Prime)&amp;diff=1924"/>
				<updated>2018-03-04T19:41:27Z</updated>
		
		<summary type="html">&lt;p&gt;Aruki: /* Flags */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The format for '''materials''' is seen in both the [[CMDL (Metroid Prime)|CMDL]] and [[MREA (File Format)|MREA]] formats and is identical in both. This particular material format appears in both Metroid Prime and Metroid Prime 2 with minor differences.&lt;br /&gt;
&lt;br /&gt;
{{research|minor|MP1's materials are completely understood, but MP2 introduced two new values that are both unknown.}}&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== GX Overview ==&lt;br /&gt;
&lt;br /&gt;
The materials system in Metroid Prime is heavily dependent on the GameCube and Wii's graphics system, GX. GX is a fixed-function graphics pipeline, similar to old versions of OpenGL. In GX, rendering is done through a series of steps called '''T'''exture '''E'''n'''V'''ironment Stages, or or TEV stages for short.&lt;br /&gt;
&lt;br /&gt;
Lighting calculations and tex coord generation are done per-vertex and passed along to TEV; the results of the lighting calculations are saved into up to two color channels that can be used as TEV inputs (as the rasterized vertex color). Each TEV stage takes in four color inputs and four alpha inputs, from one of eight sources. Then these four input colors are combined into one output color, and the output is saved into one of four registers, which can subsequently be used as input in the next TEV stages. The final stage must always save its output into the &amp;quot;previous TEV stage&amp;quot; register; that register is used as the final pixel color that gets displayed onscreen.&lt;br /&gt;
&lt;br /&gt;
== Material Set Format ==&lt;br /&gt;
&lt;br /&gt;
Materials come as part of a set; often there will only be one set per file, but many CMDLs can have more than one. The set begins with a short header before the actual material data begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type&lt;br /&gt;
!Count&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| long&lt;br /&gt;
| 1&lt;br /&gt;
| '''Texture count''' (TC)&lt;br /&gt;
|-&lt;br /&gt;
| long&lt;br /&gt;
| TC&lt;br /&gt;
| '''Texture file IDs'''&lt;br /&gt;
|-&lt;br /&gt;
| long&lt;br /&gt;
| 1&lt;br /&gt;
| '''Material count''' (MC)&lt;br /&gt;
|-&lt;br /&gt;
| long&lt;br /&gt;
| MC&lt;br /&gt;
| '''Material end offsets''' (relative to the start of the first material)&lt;br /&gt;
|-&lt;br /&gt;
| colspan=3 | Materials begin&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Material Format ==&lt;br /&gt;
&lt;br /&gt;
=== General Settings ===&lt;br /&gt;
&lt;br /&gt;
Each material begins with a flags value, followed by a list of texture indices:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type&lt;br /&gt;
!Count&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| long&lt;br /&gt;
| 1&lt;br /&gt;
| '''Flags'''&lt;br /&gt;
|-&lt;br /&gt;
| long&lt;br /&gt;
| 1&lt;br /&gt;
| '''Texture count''' (TC)&lt;br /&gt;
|-&lt;br /&gt;
| long&lt;br /&gt;
| TC&lt;br /&gt;
| '''Texture indices''' (these are indices into the material set texture array)&lt;br /&gt;
|-&lt;br /&gt;
| long&lt;br /&gt;
| 1&lt;br /&gt;
| '''Vertex attribute flags'''&lt;br /&gt;
|-&lt;br /&gt;
| long&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|'''Unknown''' ''(note: only in Echoes)''}}&lt;br /&gt;
|-&lt;br /&gt;
| long&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|'''Unknown''' ''(note: only in Echoes)''}}&lt;br /&gt;
|-&lt;br /&gt;
| long&lt;br /&gt;
| 1&lt;br /&gt;
| '''Group index'''&lt;br /&gt;
|-&lt;br /&gt;
| long&lt;br /&gt;
| 1&lt;br /&gt;
| '''Konst count''' (KC); max setting is 4. ''(note: only present if flag 0x8 is set!)''&lt;br /&gt;
|-&lt;br /&gt;
| long&lt;br /&gt;
| KC&lt;br /&gt;
| '''Konst colors''' - 32-bit RGBA colors ''(note: not present if the Konst count isn't)''&lt;br /&gt;
|-&lt;br /&gt;
| short&lt;br /&gt;
| 1&lt;br /&gt;
| '''Blend destination factor'''&lt;br /&gt;
|-&lt;br /&gt;
| short&lt;br /&gt;
| 1&lt;br /&gt;
| '''Blend source factor'''&lt;br /&gt;
|-&lt;br /&gt;
| long&lt;br /&gt;
| 1&lt;br /&gt;
| '''Reflection indirect texture slot index''' ''(note: only present if flag 0x400 is set!)''&lt;br /&gt;
|-&lt;br /&gt;
| long&lt;br /&gt;
| 1&lt;br /&gt;
| '''Color channel count''' (CC)&lt;br /&gt;
|-&lt;br /&gt;
| long&lt;br /&gt;
| CC&lt;br /&gt;
| '''Color channel flags''' ''(note: only one flag value, but you must advance 4*CC bytes instead of 4 for some reason)''&lt;br /&gt;
|-&lt;br /&gt;
| long&lt;br /&gt;
| 1&lt;br /&gt;
| '''TEV stage count'''&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Flags ====&lt;br /&gt;
&lt;br /&gt;
These are simple boolean settings that can be toggled on and off on each material. These are the known flag settings:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Bit&lt;br /&gt;
! Hex&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| 0x1&lt;br /&gt;
| Unused, always set ''(never set in Echoes)''&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| 0x2&lt;br /&gt;
| Unused, always set&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unused, never set&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| 0x8&lt;br /&gt;
| Has Konst values&lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| 0x10&lt;br /&gt;
| Transparent&lt;br /&gt;
|-&lt;br /&gt;
| 5&lt;br /&gt;
| 0x20&lt;br /&gt;
| Masked alpha (compare threshold is hardcoded at 0.25)&lt;br /&gt;
|-&lt;br /&gt;
| 6&lt;br /&gt;
| 0x40&lt;br /&gt;
| Enable Samus's reflection&lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| 0x80&lt;br /&gt;
| Enable Z-writes&lt;br /&gt;
|-&lt;br /&gt;
| 8&lt;br /&gt;
| 0x100&lt;br /&gt;
| Enable Samus's reflection, using the eye position and projection direction from the surface header&lt;br /&gt;
|-&lt;br /&gt;
| 9&lt;br /&gt;
| 0x200&lt;br /&gt;
| Shadow occluder mesh; meshes using this material are not rendered, but can be used to cast dynamic shadows on actors&lt;br /&gt;
|-&lt;br /&gt;
| 10&lt;br /&gt;
| 0x400&lt;br /&gt;
| Enable indirect texture stage for reflections&lt;br /&gt;
|-&lt;br /&gt;
| 11&lt;br /&gt;
| 0x800&lt;br /&gt;
| Indicates a lightmap is present; no ingame effect&lt;br /&gt;
|-&lt;br /&gt;
| 12&lt;br /&gt;
| 0x1000&lt;br /&gt;
| Unused, always set ''(never set in Echoes)''&lt;br /&gt;
|-&lt;br /&gt;
| 13&lt;br /&gt;
| 0x2000&lt;br /&gt;
| Enable first UV coordinate to use short array instead of float array (used for world lightmaps)&lt;br /&gt;
|-&lt;br /&gt;
| 14&lt;br /&gt;
| 0x4000&lt;br /&gt;
| {{unknown|In MP1, unused, never set; in Echoes, unknown}}&lt;br /&gt;
|-&lt;br /&gt;
| 15&lt;br /&gt;
| 0x8000&lt;br /&gt;
| {{unknown|In MP1, unused, never set; in Echoes, unknown}}&lt;br /&gt;
|-&lt;br /&gt;
| 16-31&lt;br /&gt;
| 0xFFFF0000&lt;br /&gt;
| TEV texture flags; a bit set indicates that the corresponding TEV stage uses a texture. No ingame effect.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Vertex Attribute Flags ====&lt;br /&gt;
&lt;br /&gt;
These flags are generally toggled in pairs, with each pair corresponding to a vertex attribute; if a pair is set, then vertices using this material will have the corresponding attribute. This is vital for reading geometry. Starting in Echoes, each pair is used to indicate the size of the attribute indices in the geometry data, with 3 meaning a 16-bit index and 2 meaning an 8-bit index. (This isn't actually used, though; the original game data always uses 16-bit indices.)&lt;br /&gt;
&lt;br /&gt;
GX supports up to 8 texture coords per vertex, but the game doesn't seem to allow you to assign more than 7 (though this could do with some double-checking).&lt;br /&gt;
&lt;br /&gt;
These are the possible attributes:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Bit pair&lt;br /&gt;
! Attribute&lt;br /&gt;
|-&lt;br /&gt;
| 0x3&lt;br /&gt;
| Position&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| Normal&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| Color 0&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0&lt;br /&gt;
| Color 1&lt;br /&gt;
|-&lt;br /&gt;
| 0x300&lt;br /&gt;
| Tex 0&lt;br /&gt;
|-&lt;br /&gt;
| 0xC00&lt;br /&gt;
| Tex 1&lt;br /&gt;
|-&lt;br /&gt;
| 0x3000&lt;br /&gt;
| Tex 2&lt;br /&gt;
|-&lt;br /&gt;
| 0xC000&lt;br /&gt;
| Tex 3&lt;br /&gt;
|-&lt;br /&gt;
| 0x30000&lt;br /&gt;
| Tex 4&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0000&lt;br /&gt;
| Tex 5&lt;br /&gt;
|-&lt;br /&gt;
| 0x300000&lt;br /&gt;
| Tex 6&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Echoes introduces some new attributes using the top byte of the flags value; unlike the other flags, these are not set in pairs. Each individual bit indicates the presence of a different attribute. The indices in the geometry data are always 8 bits.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Bit&lt;br /&gt;
! Attribute&lt;br /&gt;
|-&lt;br /&gt;
| 0x1&lt;br /&gt;
| Position Matrix Index&lt;br /&gt;
|-&lt;br /&gt;
| 0x2&lt;br /&gt;
| Tex0 Matrix Index&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| Tex1 Matrix Index&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| Tex2 Matrix Index&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| Tex3 Matrix Index&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| Tex4 Matrix Index&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| Tex5 Matrix Index&lt;br /&gt;
|-&lt;br /&gt;
| 0x80&lt;br /&gt;
| Tex6 Matrix Index&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Group Index ====&lt;br /&gt;
&lt;br /&gt;
The group index marks groups of materials that all have the same settings, but different textures. The game will check the value after loading the textures (but prior to the vertex attribute flags), and check whether the group index set on the material matches the material currently set up. If it does, it will skip the rest of the material setup. The value typically starts at 0 on the first material and increments by 1 on each new group with different settings.&lt;br /&gt;
&lt;br /&gt;
==== Konst Colors ====&lt;br /&gt;
&lt;br /&gt;
These values are only present when flag 0x8 is enabled. These allow you to set Konstant values, which can subsequently be used as inputs in TEV stages. The maximum number of Konst values you can set on one material is 4. The colors themselves are simply 32-bit RGBA values.&lt;br /&gt;
&lt;br /&gt;
==== Blend Mode ====&lt;br /&gt;
&lt;br /&gt;
The two blend factors set the blending mode used. The most common values you'll see are 0/1, which is used on opaque materials; transparent materials will usually have either 1/1, for additive blending, or 5/4, for alpha blending. Here's the full range of possible settings for each value:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Value&lt;br /&gt;
! Blend factor&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| GX_BL_ZERO&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| GX_BL_ONE&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| GX_BL_SRCCLR / GX_BL_DSTCLR&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| GX_BL_INVSRCCLR / GX_BL_INVSRCCLR&lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| GX_BL_SRCALPHA&lt;br /&gt;
|-&lt;br /&gt;
| 5&lt;br /&gt;
| GX_BL_INVSRCALPHA&lt;br /&gt;
|-&lt;br /&gt;
| 6&lt;br /&gt;
| GX_BL_DSTALPHA&lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| GX_BL_INVDSTALPHA&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Color Channels ====&lt;br /&gt;
&lt;br /&gt;
The color channels data consists of a count value indicating the number of color channels, and then one set of flags that controls the COLOR0 channel. The flags correspond to arguments passed to [http://libogc.devkitpro.org/gx_8h.html#a87d79cf2375217d06237c887ba027cc2 GX_SetChanCtrl()]. These are the settings:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Bits&lt;br /&gt;
! Hex&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| 0x1&lt;br /&gt;
| '''Enable lighting''' (enable)&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| 0x2&lt;br /&gt;
| '''Ambient color source''' (ambsrc)&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| 0x4&lt;br /&gt;
| '''Material color source''' (matsrc)&lt;br /&gt;
|-&lt;br /&gt;
| 3-10&lt;br /&gt;
| 0x7F8&lt;br /&gt;
| '''Light mask'''; always 0, filled in at runtime ([http://libogc.devkitpro.org/group__lightid.html litmask])&lt;br /&gt;
|-&lt;br /&gt;
| 11-12&lt;br /&gt;
| 0x1800&lt;br /&gt;
| '''Diffuse function''' ([http://libogc.devkitpro.org/group__difffn.html diff_fn])&lt;br /&gt;
|-&lt;br /&gt;
| 13-14&lt;br /&gt;
| 0x6000&lt;br /&gt;
| '''Attenuation function''' ([http://libogc.devkitpro.org/group__attenfunc.html attn_fn])&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
There's only one set of flags, which operates on COLOR0. COLOR1 is reserved for dynamic shadows (terrain casting shadows on actors), so its settings can't be directly modified. Here's how the other color channel settings work.&lt;br /&gt;
&lt;br /&gt;
COLOR1A1's settings vary depending on whether shadowmaps are enabled:&lt;br /&gt;
&lt;br /&gt;
* No processing will be done if the count value is 0. Otherwise, the count value is ignored; the game will always set up both color channels.&lt;br /&gt;
* COLOR1A1's ambient color is black, and its material color is white.&lt;br /&gt;
* COLOR1 will use the diffuse function GX_DF_CLAMP and the attenuation function GX_AF_SPOT. It will have lighting disabled entirely if there are no lights in range&lt;br /&gt;
&lt;br /&gt;
If shadowmaps are disabled:&lt;br /&gt;
&lt;br /&gt;
* COLOR1 is disabled if the count value is not 2. If it is 2, then its ambient color will be black and its material color will be white.&lt;br /&gt;
&lt;br /&gt;
COLOR0 is set up the same way either way:&lt;br /&gt;
&lt;br /&gt;
* COLOR0 will use the flags from the material, with the light mask merged in. It will also have lighting disabled if there are no lights in range.&lt;br /&gt;
* If there are no lights in range, COLOR0A0 will have its material color set to match its ambient color. Otherwise, its material color will be set to white.&lt;br /&gt;
&lt;br /&gt;
Finally, an important note is that the formatting of the color channel info is bugged. There is always a color channel count and a single set of flags; 8 bytes total. However, for some reason the game is expecting one set of flags per color channel. To reach the TEV stages, you need to advance (4 * count) bytes past the count value, rather than 4. A likely explanation is that there was one set of flags per channel earlier in development, and the material loading code wasn't fully updated when this was changed. It's not normally an issue because the count is always 1 in every file the game uses, but beware for experimentation/custom materials.&lt;br /&gt;
&lt;br /&gt;
=== TEV Stages ===&lt;br /&gt;
&lt;br /&gt;
There'll be one of these structures per TEV stage:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 4&lt;br /&gt;
| '''Color Input Flags'''&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 4&lt;br /&gt;
| '''Alpha Input Flags'''&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 4&lt;br /&gt;
| '''Color Combine Flags'''&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 4&lt;br /&gt;
| '''Alpha Combine Flags'''&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 1&lt;br /&gt;
| '''Padding'''&lt;br /&gt;
|-&lt;br /&gt;
| 0x11&lt;br /&gt;
| 1&lt;br /&gt;
| '''Konst Alpha Input''' ([http://libogc.devkitpro.org/group__tevkalphasel.html possible values])&lt;br /&gt;
|-&lt;br /&gt;
| 0x12&lt;br /&gt;
| 1&lt;br /&gt;
| '''Konst Color Input''' ([http://libogc.devkitpro.org/group__tevkcolorsel.html possible values])&lt;br /&gt;
|-&lt;br /&gt;
| 0x13&lt;br /&gt;
| 1&lt;br /&gt;
| '''Rasterized Color Input''' ([http://libogc.devkitpro.org/group__channelid.html possible values])&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| colspan=2 {{unknown|End of TEV stage}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
After looping through each TEV stage, there will be one of these structures per stage:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 2&lt;br /&gt;
| '''Padding'''&lt;br /&gt;
|-&lt;br /&gt;
| 0x2&lt;br /&gt;
| 1&lt;br /&gt;
| '''Texture TEV Input'''&lt;br /&gt;
|-&lt;br /&gt;
| 0x3&lt;br /&gt;
| 1&lt;br /&gt;
| '''Tex Coord TEV Input'''&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| colspan=2 {{unknown|End of structure}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Color Input Flags ====&lt;br /&gt;
&lt;br /&gt;
These flags set the four color inputs that are used by the TEV stage. Each color is allocated 5 bits, even though only 4 are actually used; the lower bits correspond to the lower input numbers (eg. the bottom 5 bits refer to the first input).&lt;br /&gt;
&lt;br /&gt;
There are 16 possible color sources:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Binary&lt;br /&gt;
! Hex&lt;br /&gt;
! Color Source&lt;br /&gt;
|-&lt;br /&gt;
| 00000&lt;br /&gt;
| 0x0&lt;br /&gt;
| Previous stage RGB&lt;br /&gt;
|-&lt;br /&gt;
| 00001&lt;br /&gt;
| 0x1&lt;br /&gt;
| Previous stage AAA&lt;br /&gt;
|-&lt;br /&gt;
| 00010&lt;br /&gt;
| 0x2&lt;br /&gt;
| Color 0 RGB&lt;br /&gt;
|-&lt;br /&gt;
| 00011&lt;br /&gt;
| 0x3&lt;br /&gt;
| Color 0 AAA&lt;br /&gt;
|-&lt;br /&gt;
| 00100&lt;br /&gt;
| 0x4&lt;br /&gt;
| Color 1 RGB&lt;br /&gt;
|-&lt;br /&gt;
| 00101&lt;br /&gt;
| 0x5&lt;br /&gt;
| Color 1 AAA&lt;br /&gt;
|-&lt;br /&gt;
| 00110&lt;br /&gt;
| 0x6&lt;br /&gt;
| Color 2 RGB&lt;br /&gt;
|-&lt;br /&gt;
| 00111&lt;br /&gt;
| 0x7&lt;br /&gt;
| Color 2 AAA&lt;br /&gt;
|-&lt;br /&gt;
| 01000&lt;br /&gt;
| 0x8&lt;br /&gt;
| Texture RGB&lt;br /&gt;
|-&lt;br /&gt;
| 01001&lt;br /&gt;
| 0x9&lt;br /&gt;
| Texture AAA&lt;br /&gt;
|-&lt;br /&gt;
| 01010&lt;br /&gt;
| 0xA&lt;br /&gt;
| Rasterized RGB&lt;br /&gt;
|-&lt;br /&gt;
| 01011&lt;br /&gt;
| 0xB&lt;br /&gt;
| Rasterized AAA&lt;br /&gt;
|-&lt;br /&gt;
| 01100&lt;br /&gt;
| 0xC&lt;br /&gt;
| One&lt;br /&gt;
|-&lt;br /&gt;
| 01101&lt;br /&gt;
| 0xD&lt;br /&gt;
| Half&lt;br /&gt;
|-&lt;br /&gt;
| 01110&lt;br /&gt;
| 0xE&lt;br /&gt;
| Konstant RGB&lt;br /&gt;
|-&lt;br /&gt;
| 01111&lt;br /&gt;
| 0xF&lt;br /&gt;
| Zero&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Alpha Input Flags ====&lt;br /&gt;
&lt;br /&gt;
Similar to the color input flags, these set the four alpha inputs used by the TEV stage. Each value is allocated 5 bits, although only 3 are used. The main difference with alpha is that there are only 8 possible sources instead of 16:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Binary&lt;br /&gt;
! Hex&lt;br /&gt;
! Alpha Source&lt;br /&gt;
|-&lt;br /&gt;
| 00000&lt;br /&gt;
| 0x0&lt;br /&gt;
| Previous stage alpha&lt;br /&gt;
|-&lt;br /&gt;
| 00001&lt;br /&gt;
| 0x1&lt;br /&gt;
| Color 0 alpha&lt;br /&gt;
|-&lt;br /&gt;
| 00010&lt;br /&gt;
| 0x2&lt;br /&gt;
| Color 1 alpha&lt;br /&gt;
|-&lt;br /&gt;
| 00011&lt;br /&gt;
| 0x3&lt;br /&gt;
| Color 2 alpha&lt;br /&gt;
|-&lt;br /&gt;
| 00100&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture alpha&lt;br /&gt;
|-&lt;br /&gt;
| 00101&lt;br /&gt;
| 0x5&lt;br /&gt;
| Rasterized alpha&lt;br /&gt;
|-&lt;br /&gt;
| 00110&lt;br /&gt;
| 0x6&lt;br /&gt;
| Konstant alpha&lt;br /&gt;
|-&lt;br /&gt;
| 00111&lt;br /&gt;
| 0x7&lt;br /&gt;
| Zero&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Color Combine Flags ====&lt;br /&gt;
&lt;br /&gt;
These flags specify how the operation that combines the four input colors into one output color is performed.&lt;br /&gt;
&lt;br /&gt;
This is the combiner function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;tevrigid = (d (tevop) ((1.0-c)*a + c*b) + tevbias) * tevscale;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The values set in the color operation flags correspond to the parameters passed to [http://libogc.devkitpro.org/gx_8h.html#a067b875ff1e3e6760d0d7d7838c6c4c2 GX_SetTevColorOp()]. These are the settings:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Bits&lt;br /&gt;
! Hex&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0-3&lt;br /&gt;
| 0xF&lt;br /&gt;
| '''Combiner operator''' ([http://libogc.devkitpro.org/group__tevop.html tevop])&lt;br /&gt;
|-&lt;br /&gt;
| 4-5&lt;br /&gt;
| 0x30&lt;br /&gt;
| '''Bias''' ([http://libogc.devkitpro.org/group__tevbias.html tevbias]); 00 does nothing; 01 adds 0.5; 10 subtracts 0.5; 11 does nothing.&lt;br /&gt;
|-&lt;br /&gt;
| 6-7&lt;br /&gt;
| 0xC0&lt;br /&gt;
| '''Scale''' ([http://libogc.devkitpro.org/group__tevscale.html tevscale]); 00 does nothing; 01 multiples by 2; 10 multiplies by 4; 11 divides by 2.&lt;br /&gt;
|-&lt;br /&gt;
| 8&lt;br /&gt;
| 0x100&lt;br /&gt;
| '''Clamp flag'''; enabling this will clamp the output color between 0 and 1.&lt;br /&gt;
|-&lt;br /&gt;
| 9-10&lt;br /&gt;
| 0x600&lt;br /&gt;
| '''Output register''' ([http://libogc.devkitpro.org/group__tevcoloutreg.html tevrigid]); can be Previous Stage or Color 0/1/2&lt;br /&gt;
|-&lt;br /&gt;
| 11+&lt;br /&gt;
| 0xFFFFF800&lt;br /&gt;
| Unused.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note that the vast majority of materials in the game, if not all of them, don't really bother with any of this; they enable clamping, set an output register, and leave everything else at their defaults of 0.&lt;br /&gt;
&lt;br /&gt;
==== Alpha Combine Flags ====&lt;br /&gt;
&lt;br /&gt;
This is exactly the same as the color combine flags; the only difference is it operates on alpha instead of color.&lt;br /&gt;
&lt;br /&gt;
=== Texgen ===&lt;br /&gt;
&lt;br /&gt;
After the TEV stages comes a sequence of flags determining how texgen is executed. Texgen is the process of taking input values and using them to generate texture coordinates (or UV coordinates), which can then be used by the TEV stages. It's important to note that any vertex attribute can be used as a texgen input; in fact, it's rather common for materials to use the vertex normal as an input to simulate reflections. That means ''the number of texture coords present on each vertex is not the same as the number of texture coords available to TEV''.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| long&lt;br /&gt;
| 1&lt;br /&gt;
| '''Texgen count''' (TC)&lt;br /&gt;
|-&lt;br /&gt;
| long&lt;br /&gt;
| TC&lt;br /&gt;
| '''Texgen flags'''&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The flags correspond to arguments passed to [http://libogc.devkitpro.org/gx_8h.html#a55a426a3ff796db584302bddd829f002 GX_SetTexCoordGen2()]. These are the settings:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Bits&lt;br /&gt;
! Hex&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0-3&lt;br /&gt;
| 0xF&lt;br /&gt;
| '''Texture coord generation type''' ([http://libogc.devkitpro.org/group__texgentyp.html tgen_typ])&lt;br /&gt;
|-&lt;br /&gt;
| 4-8&lt;br /&gt;
| 0x1F0&lt;br /&gt;
| '''Texture coord source''' ([http://libogc.devkitpro.org/group__texgensrc.html tgen_src])&lt;br /&gt;
|-&lt;br /&gt;
| 9-13&lt;br /&gt;
| 0x3E00&lt;br /&gt;
| '''Texture matrix index''' ([http://libogc.devkitpro.org/group__texmtx.html mtxsrc] - add 30)&lt;br /&gt;
|-&lt;br /&gt;
| 14&lt;br /&gt;
| 0x4000&lt;br /&gt;
| '''Normalize flag''' - normalizes texture coord after it's multiplied by the texture matrix (normalize)&lt;br /&gt;
|-&lt;br /&gt;
| 15-20&lt;br /&gt;
| 0x1F8000&lt;br /&gt;
| '''Post-transform texture matrix index''' ([http://libogc.devkitpro.org/group__dttmtx.html postmtx] - add 64)&lt;br /&gt;
|-&lt;br /&gt;
| 21+&lt;br /&gt;
| 0xFFE00000&lt;br /&gt;
| Unused&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== UV Animations ===&lt;br /&gt;
&lt;br /&gt;
'' See [[UV Animations]]''&lt;br /&gt;
&lt;br /&gt;
The UV animations section immediately follows the texgen flags. Its purpose is to generate texture matrices and post-transform matrices, which are then used to transform UV coordinates. This is commonly used to animate textures via simple UV scrolls, but it's also often used to simulate reflective surfaces that move with the camera. Materials can have multiple UV animations; in that case, each animation generates a separate texture/post-transform matrix and are loaded into GX sequentially. Texgen is used to set which matrices are used by which UV coordinates (if any).&lt;br /&gt;
&lt;br /&gt;
The section starts with this short header:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 4&lt;br /&gt;
| '''Material animations section size''' (includes animation count, so will be 4 at minimum)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 4&lt;br /&gt;
| '''Animation count'''&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
For info on how to read the animation data and how each animation mode works, see [[UV Animations]].&lt;br /&gt;
&lt;br /&gt;
[[Category:File Formats]]&lt;br /&gt;
[[Category:Metroid Prime]]&lt;br /&gt;
[[Category:Metroid Prime 2: Echoes]]&lt;/div&gt;</summary>
		<author><name>Aruki</name></author>	</entry>

	<entry>
		<id>http://www.metroid2002.com/retromodding/index.php?title=Materials_(Metroid_Prime)&amp;diff=1923</id>
		<title>Materials (Metroid Prime)</title>
		<link rel="alternate" type="text/html" href="http://www.metroid2002.com/retromodding/index.php?title=Materials_(Metroid_Prime)&amp;diff=1923"/>
				<updated>2018-03-04T19:40:13Z</updated>
		
		<summary type="html">&lt;p&gt;Aruki: /* Flags */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The format for '''materials''' is seen in both the [[CMDL (Metroid Prime)|CMDL]] and [[MREA (File Format)|MREA]] formats and is identical in both. This particular material format appears in both Metroid Prime and Metroid Prime 2 with minor differences.&lt;br /&gt;
&lt;br /&gt;
{{research|minor|MP1's materials are completely understood, but MP2 introduced two new values that are both unknown.}}&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== GX Overview ==&lt;br /&gt;
&lt;br /&gt;
The materials system in Metroid Prime is heavily dependent on the GameCube and Wii's graphics system, GX. GX is a fixed-function graphics pipeline, similar to old versions of OpenGL. In GX, rendering is done through a series of steps called '''T'''exture '''E'''n'''V'''ironment Stages, or or TEV stages for short.&lt;br /&gt;
&lt;br /&gt;
Lighting calculations and tex coord generation are done per-vertex and passed along to TEV; the results of the lighting calculations are saved into up to two color channels that can be used as TEV inputs (as the rasterized vertex color). Each TEV stage takes in four color inputs and four alpha inputs, from one of eight sources. Then these four input colors are combined into one output color, and the output is saved into one of four registers, which can subsequently be used as input in the next TEV stages. The final stage must always save its output into the &amp;quot;previous TEV stage&amp;quot; register; that register is used as the final pixel color that gets displayed onscreen.&lt;br /&gt;
&lt;br /&gt;
== Material Set Format ==&lt;br /&gt;
&lt;br /&gt;
Materials come as part of a set; often there will only be one set per file, but many CMDLs can have more than one. The set begins with a short header before the actual material data begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type&lt;br /&gt;
!Count&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| long&lt;br /&gt;
| 1&lt;br /&gt;
| '''Texture count''' (TC)&lt;br /&gt;
|-&lt;br /&gt;
| long&lt;br /&gt;
| TC&lt;br /&gt;
| '''Texture file IDs'''&lt;br /&gt;
|-&lt;br /&gt;
| long&lt;br /&gt;
| 1&lt;br /&gt;
| '''Material count''' (MC)&lt;br /&gt;
|-&lt;br /&gt;
| long&lt;br /&gt;
| MC&lt;br /&gt;
| '''Material end offsets''' (relative to the start of the first material)&lt;br /&gt;
|-&lt;br /&gt;
| colspan=3 | Materials begin&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Material Format ==&lt;br /&gt;
&lt;br /&gt;
=== General Settings ===&lt;br /&gt;
&lt;br /&gt;
Each material begins with a flags value, followed by a list of texture indices:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type&lt;br /&gt;
!Count&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| long&lt;br /&gt;
| 1&lt;br /&gt;
| '''Flags'''&lt;br /&gt;
|-&lt;br /&gt;
| long&lt;br /&gt;
| 1&lt;br /&gt;
| '''Texture count''' (TC)&lt;br /&gt;
|-&lt;br /&gt;
| long&lt;br /&gt;
| TC&lt;br /&gt;
| '''Texture indices''' (these are indices into the material set texture array)&lt;br /&gt;
|-&lt;br /&gt;
| long&lt;br /&gt;
| 1&lt;br /&gt;
| '''Vertex attribute flags'''&lt;br /&gt;
|-&lt;br /&gt;
| long&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|'''Unknown''' ''(note: only in Echoes)''}}&lt;br /&gt;
|-&lt;br /&gt;
| long&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|'''Unknown''' ''(note: only in Echoes)''}}&lt;br /&gt;
|-&lt;br /&gt;
| long&lt;br /&gt;
| 1&lt;br /&gt;
| '''Group index'''&lt;br /&gt;
|-&lt;br /&gt;
| long&lt;br /&gt;
| 1&lt;br /&gt;
| '''Konst count''' (KC); max setting is 4. ''(note: only present if flag 0x8 is set!)''&lt;br /&gt;
|-&lt;br /&gt;
| long&lt;br /&gt;
| KC&lt;br /&gt;
| '''Konst colors''' - 32-bit RGBA colors ''(note: not present if the Konst count isn't)''&lt;br /&gt;
|-&lt;br /&gt;
| short&lt;br /&gt;
| 1&lt;br /&gt;
| '''Blend destination factor'''&lt;br /&gt;
|-&lt;br /&gt;
| short&lt;br /&gt;
| 1&lt;br /&gt;
| '''Blend source factor'''&lt;br /&gt;
|-&lt;br /&gt;
| long&lt;br /&gt;
| 1&lt;br /&gt;
| '''Reflection indirect texture slot index''' ''(note: only present if flag 0x400 is set!)''&lt;br /&gt;
|-&lt;br /&gt;
| long&lt;br /&gt;
| 1&lt;br /&gt;
| '''Color channel count''' (CC)&lt;br /&gt;
|-&lt;br /&gt;
| long&lt;br /&gt;
| CC&lt;br /&gt;
| '''Color channel flags''' ''(note: only one flag value, but you must advance 4*CC bytes instead of 4 for some reason)''&lt;br /&gt;
|-&lt;br /&gt;
| long&lt;br /&gt;
| 1&lt;br /&gt;
| '''TEV stage count'''&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Flags ====&lt;br /&gt;
&lt;br /&gt;
These are simple boolean settings that can be toggled on and off on each material. These are the known flag settings:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Bit&lt;br /&gt;
! Hex&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| 0x1&lt;br /&gt;
| Unused, always set ''(never set in Echoes)''&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| 0x2&lt;br /&gt;
| Unused, always set&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unused, never set&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| 0x8&lt;br /&gt;
| Enable Konst values&lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| 0x10&lt;br /&gt;
| Enable depth sorting for transparent materials&lt;br /&gt;
|-&lt;br /&gt;
| 5&lt;br /&gt;
| 0x20&lt;br /&gt;
| Enable masked alpha&lt;br /&gt;
|-&lt;br /&gt;
| 6&lt;br /&gt;
| 0x40&lt;br /&gt;
| Enable Samus's reflection&lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| 0x80&lt;br /&gt;
| Enable depth writing&lt;br /&gt;
|-&lt;br /&gt;
| 8&lt;br /&gt;
| 0x100&lt;br /&gt;
| Enable Samus's reflection, using the eye position and projection direction from the surface header&lt;br /&gt;
|-&lt;br /&gt;
| 9&lt;br /&gt;
| 0x200&lt;br /&gt;
| Shadow occluder mesh; meshes using this material are not rendered, but can be used to cast dynamic shadows on actors&lt;br /&gt;
|-&lt;br /&gt;
| 10&lt;br /&gt;
| 0x400&lt;br /&gt;
| Enable indirect texture stage for reflections&lt;br /&gt;
|-&lt;br /&gt;
| 11&lt;br /&gt;
| 0x800&lt;br /&gt;
| Indicates a lightmap is present; no ingame effect&lt;br /&gt;
|-&lt;br /&gt;
| 12&lt;br /&gt;
| 0x1000&lt;br /&gt;
| Unused, always set ''(never set in Echoes)''&lt;br /&gt;
|-&lt;br /&gt;
| 13&lt;br /&gt;
| 0x2000&lt;br /&gt;
| Enable first UV coordinate to use short array instead of float array (used for world lightmaps)&lt;br /&gt;
|-&lt;br /&gt;
| 14&lt;br /&gt;
| 0x4000&lt;br /&gt;
| {{unknown|In MP1, unused, never set; in Echoes, unknown}}&lt;br /&gt;
|-&lt;br /&gt;
| 15&lt;br /&gt;
| 0x8000&lt;br /&gt;
| {{unknown|In MP1, unused, never set; in Echoes, unknown}}&lt;br /&gt;
|-&lt;br /&gt;
| 16-31&lt;br /&gt;
| 0xFFFF0000&lt;br /&gt;
| TEV texture flags; a bit set indicates that the corresponding TEV stage uses a texture. No ingame effect.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Vertex Attribute Flags ====&lt;br /&gt;
&lt;br /&gt;
These flags are generally toggled in pairs, with each pair corresponding to a vertex attribute; if a pair is set, then vertices using this material will have the corresponding attribute. This is vital for reading geometry. Starting in Echoes, each pair is used to indicate the size of the attribute indices in the geometry data, with 3 meaning a 16-bit index and 2 meaning an 8-bit index. (This isn't actually used, though; the original game data always uses 16-bit indices.)&lt;br /&gt;
&lt;br /&gt;
GX supports up to 8 texture coords per vertex, but the game doesn't seem to allow you to assign more than 7 (though this could do with some double-checking).&lt;br /&gt;
&lt;br /&gt;
These are the possible attributes:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Bit pair&lt;br /&gt;
! Attribute&lt;br /&gt;
|-&lt;br /&gt;
| 0x3&lt;br /&gt;
| Position&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| Normal&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| Color 0&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0&lt;br /&gt;
| Color 1&lt;br /&gt;
|-&lt;br /&gt;
| 0x300&lt;br /&gt;
| Tex 0&lt;br /&gt;
|-&lt;br /&gt;
| 0xC00&lt;br /&gt;
| Tex 1&lt;br /&gt;
|-&lt;br /&gt;
| 0x3000&lt;br /&gt;
| Tex 2&lt;br /&gt;
|-&lt;br /&gt;
| 0xC000&lt;br /&gt;
| Tex 3&lt;br /&gt;
|-&lt;br /&gt;
| 0x30000&lt;br /&gt;
| Tex 4&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0000&lt;br /&gt;
| Tex 5&lt;br /&gt;
|-&lt;br /&gt;
| 0x300000&lt;br /&gt;
| Tex 6&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Echoes introduces some new attributes using the top byte of the flags value; unlike the other flags, these are not set in pairs. Each individual bit indicates the presence of a different attribute. The indices in the geometry data are always 8 bits.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Bit&lt;br /&gt;
! Attribute&lt;br /&gt;
|-&lt;br /&gt;
| 0x1&lt;br /&gt;
| Position Matrix Index&lt;br /&gt;
|-&lt;br /&gt;
| 0x2&lt;br /&gt;
| Tex0 Matrix Index&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| Tex1 Matrix Index&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| Tex2 Matrix Index&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| Tex3 Matrix Index&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| Tex4 Matrix Index&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| Tex5 Matrix Index&lt;br /&gt;
|-&lt;br /&gt;
| 0x80&lt;br /&gt;
| Tex6 Matrix Index&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Group Index ====&lt;br /&gt;
&lt;br /&gt;
The group index marks groups of materials that all have the same settings, but different textures. The game will check the value after loading the textures (but prior to the vertex attribute flags), and check whether the group index set on the material matches the material currently set up. If it does, it will skip the rest of the material setup. The value typically starts at 0 on the first material and increments by 1 on each new group with different settings.&lt;br /&gt;
&lt;br /&gt;
==== Konst Colors ====&lt;br /&gt;
&lt;br /&gt;
These values are only present when flag 0x8 is enabled. These allow you to set Konstant values, which can subsequently be used as inputs in TEV stages. The maximum number of Konst values you can set on one material is 4. The colors themselves are simply 32-bit RGBA values.&lt;br /&gt;
&lt;br /&gt;
==== Blend Mode ====&lt;br /&gt;
&lt;br /&gt;
The two blend factors set the blending mode used. The most common values you'll see are 0/1, which is used on opaque materials; transparent materials will usually have either 1/1, for additive blending, or 5/4, for alpha blending. Here's the full range of possible settings for each value:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Value&lt;br /&gt;
! Blend factor&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| GX_BL_ZERO&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| GX_BL_ONE&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| GX_BL_SRCCLR / GX_BL_DSTCLR&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| GX_BL_INVSRCCLR / GX_BL_INVSRCCLR&lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| GX_BL_SRCALPHA&lt;br /&gt;
|-&lt;br /&gt;
| 5&lt;br /&gt;
| GX_BL_INVSRCALPHA&lt;br /&gt;
|-&lt;br /&gt;
| 6&lt;br /&gt;
| GX_BL_DSTALPHA&lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| GX_BL_INVDSTALPHA&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Color Channels ====&lt;br /&gt;
&lt;br /&gt;
The color channels data consists of a count value indicating the number of color channels, and then one set of flags that controls the COLOR0 channel. The flags correspond to arguments passed to [http://libogc.devkitpro.org/gx_8h.html#a87d79cf2375217d06237c887ba027cc2 GX_SetChanCtrl()]. These are the settings:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Bits&lt;br /&gt;
! Hex&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| 0x1&lt;br /&gt;
| '''Enable lighting''' (enable)&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| 0x2&lt;br /&gt;
| '''Ambient color source''' (ambsrc)&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| 0x4&lt;br /&gt;
| '''Material color source''' (matsrc)&lt;br /&gt;
|-&lt;br /&gt;
| 3-10&lt;br /&gt;
| 0x7F8&lt;br /&gt;
| '''Light mask'''; always 0, filled in at runtime ([http://libogc.devkitpro.org/group__lightid.html litmask])&lt;br /&gt;
|-&lt;br /&gt;
| 11-12&lt;br /&gt;
| 0x1800&lt;br /&gt;
| '''Diffuse function''' ([http://libogc.devkitpro.org/group__difffn.html diff_fn])&lt;br /&gt;
|-&lt;br /&gt;
| 13-14&lt;br /&gt;
| 0x6000&lt;br /&gt;
| '''Attenuation function''' ([http://libogc.devkitpro.org/group__attenfunc.html attn_fn])&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
There's only one set of flags, which operates on COLOR0. COLOR1 is reserved for dynamic shadows (terrain casting shadows on actors), so its settings can't be directly modified. Here's how the other color channel settings work.&lt;br /&gt;
&lt;br /&gt;
COLOR1A1's settings vary depending on whether shadowmaps are enabled:&lt;br /&gt;
&lt;br /&gt;
* No processing will be done if the count value is 0. Otherwise, the count value is ignored; the game will always set up both color channels.&lt;br /&gt;
* COLOR1A1's ambient color is black, and its material color is white.&lt;br /&gt;
* COLOR1 will use the diffuse function GX_DF_CLAMP and the attenuation function GX_AF_SPOT. It will have lighting disabled entirely if there are no lights in range&lt;br /&gt;
&lt;br /&gt;
If shadowmaps are disabled:&lt;br /&gt;
&lt;br /&gt;
* COLOR1 is disabled if the count value is not 2. If it is 2, then its ambient color will be black and its material color will be white.&lt;br /&gt;
&lt;br /&gt;
COLOR0 is set up the same way either way:&lt;br /&gt;
&lt;br /&gt;
* COLOR0 will use the flags from the material, with the light mask merged in. It will also have lighting disabled if there are no lights in range.&lt;br /&gt;
* If there are no lights in range, COLOR0A0 will have its material color set to match its ambient color. Otherwise, its material color will be set to white.&lt;br /&gt;
&lt;br /&gt;
Finally, an important note is that the formatting of the color channel info is bugged. There is always a color channel count and a single set of flags; 8 bytes total. However, for some reason the game is expecting one set of flags per color channel. To reach the TEV stages, you need to advance (4 * count) bytes past the count value, rather than 4. A likely explanation is that there was one set of flags per channel earlier in development, and the material loading code wasn't fully updated when this was changed. It's not normally an issue because the count is always 1 in every file the game uses, but beware for experimentation/custom materials.&lt;br /&gt;
&lt;br /&gt;
=== TEV Stages ===&lt;br /&gt;
&lt;br /&gt;
There'll be one of these structures per TEV stage:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 4&lt;br /&gt;
| '''Color Input Flags'''&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 4&lt;br /&gt;
| '''Alpha Input Flags'''&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 4&lt;br /&gt;
| '''Color Combine Flags'''&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 4&lt;br /&gt;
| '''Alpha Combine Flags'''&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 1&lt;br /&gt;
| '''Padding'''&lt;br /&gt;
|-&lt;br /&gt;
| 0x11&lt;br /&gt;
| 1&lt;br /&gt;
| '''Konst Alpha Input''' ([http://libogc.devkitpro.org/group__tevkalphasel.html possible values])&lt;br /&gt;
|-&lt;br /&gt;
| 0x12&lt;br /&gt;
| 1&lt;br /&gt;
| '''Konst Color Input''' ([http://libogc.devkitpro.org/group__tevkcolorsel.html possible values])&lt;br /&gt;
|-&lt;br /&gt;
| 0x13&lt;br /&gt;
| 1&lt;br /&gt;
| '''Rasterized Color Input''' ([http://libogc.devkitpro.org/group__channelid.html possible values])&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| colspan=2 {{unknown|End of TEV stage}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
After looping through each TEV stage, there will be one of these structures per stage:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 2&lt;br /&gt;
| '''Padding'''&lt;br /&gt;
|-&lt;br /&gt;
| 0x2&lt;br /&gt;
| 1&lt;br /&gt;
| '''Texture TEV Input'''&lt;br /&gt;
|-&lt;br /&gt;
| 0x3&lt;br /&gt;
| 1&lt;br /&gt;
| '''Tex Coord TEV Input'''&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| colspan=2 {{unknown|End of structure}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Color Input Flags ====&lt;br /&gt;
&lt;br /&gt;
These flags set the four color inputs that are used by the TEV stage. Each color is allocated 5 bits, even though only 4 are actually used; the lower bits correspond to the lower input numbers (eg. the bottom 5 bits refer to the first input).&lt;br /&gt;
&lt;br /&gt;
There are 16 possible color sources:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Binary&lt;br /&gt;
! Hex&lt;br /&gt;
! Color Source&lt;br /&gt;
|-&lt;br /&gt;
| 00000&lt;br /&gt;
| 0x0&lt;br /&gt;
| Previous stage RGB&lt;br /&gt;
|-&lt;br /&gt;
| 00001&lt;br /&gt;
| 0x1&lt;br /&gt;
| Previous stage AAA&lt;br /&gt;
|-&lt;br /&gt;
| 00010&lt;br /&gt;
| 0x2&lt;br /&gt;
| Color 0 RGB&lt;br /&gt;
|-&lt;br /&gt;
| 00011&lt;br /&gt;
| 0x3&lt;br /&gt;
| Color 0 AAA&lt;br /&gt;
|-&lt;br /&gt;
| 00100&lt;br /&gt;
| 0x4&lt;br /&gt;
| Color 1 RGB&lt;br /&gt;
|-&lt;br /&gt;
| 00101&lt;br /&gt;
| 0x5&lt;br /&gt;
| Color 1 AAA&lt;br /&gt;
|-&lt;br /&gt;
| 00110&lt;br /&gt;
| 0x6&lt;br /&gt;
| Color 2 RGB&lt;br /&gt;
|-&lt;br /&gt;
| 00111&lt;br /&gt;
| 0x7&lt;br /&gt;
| Color 2 AAA&lt;br /&gt;
|-&lt;br /&gt;
| 01000&lt;br /&gt;
| 0x8&lt;br /&gt;
| Texture RGB&lt;br /&gt;
|-&lt;br /&gt;
| 01001&lt;br /&gt;
| 0x9&lt;br /&gt;
| Texture AAA&lt;br /&gt;
|-&lt;br /&gt;
| 01010&lt;br /&gt;
| 0xA&lt;br /&gt;
| Rasterized RGB&lt;br /&gt;
|-&lt;br /&gt;
| 01011&lt;br /&gt;
| 0xB&lt;br /&gt;
| Rasterized AAA&lt;br /&gt;
|-&lt;br /&gt;
| 01100&lt;br /&gt;
| 0xC&lt;br /&gt;
| One&lt;br /&gt;
|-&lt;br /&gt;
| 01101&lt;br /&gt;
| 0xD&lt;br /&gt;
| Half&lt;br /&gt;
|-&lt;br /&gt;
| 01110&lt;br /&gt;
| 0xE&lt;br /&gt;
| Konstant RGB&lt;br /&gt;
|-&lt;br /&gt;
| 01111&lt;br /&gt;
| 0xF&lt;br /&gt;
| Zero&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Alpha Input Flags ====&lt;br /&gt;
&lt;br /&gt;
Similar to the color input flags, these set the four alpha inputs used by the TEV stage. Each value is allocated 5 bits, although only 3 are used. The main difference with alpha is that there are only 8 possible sources instead of 16:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Binary&lt;br /&gt;
! Hex&lt;br /&gt;
! Alpha Source&lt;br /&gt;
|-&lt;br /&gt;
| 00000&lt;br /&gt;
| 0x0&lt;br /&gt;
| Previous stage alpha&lt;br /&gt;
|-&lt;br /&gt;
| 00001&lt;br /&gt;
| 0x1&lt;br /&gt;
| Color 0 alpha&lt;br /&gt;
|-&lt;br /&gt;
| 00010&lt;br /&gt;
| 0x2&lt;br /&gt;
| Color 1 alpha&lt;br /&gt;
|-&lt;br /&gt;
| 00011&lt;br /&gt;
| 0x3&lt;br /&gt;
| Color 2 alpha&lt;br /&gt;
|-&lt;br /&gt;
| 00100&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture alpha&lt;br /&gt;
|-&lt;br /&gt;
| 00101&lt;br /&gt;
| 0x5&lt;br /&gt;
| Rasterized alpha&lt;br /&gt;
|-&lt;br /&gt;
| 00110&lt;br /&gt;
| 0x6&lt;br /&gt;
| Konstant alpha&lt;br /&gt;
|-&lt;br /&gt;
| 00111&lt;br /&gt;
| 0x7&lt;br /&gt;
| Zero&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Color Combine Flags ====&lt;br /&gt;
&lt;br /&gt;
These flags specify how the operation that combines the four input colors into one output color is performed.&lt;br /&gt;
&lt;br /&gt;
This is the combiner function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;tevrigid = (d (tevop) ((1.0-c)*a + c*b) + tevbias) * tevscale;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The values set in the color operation flags correspond to the parameters passed to [http://libogc.devkitpro.org/gx_8h.html#a067b875ff1e3e6760d0d7d7838c6c4c2 GX_SetTevColorOp()]. These are the settings:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Bits&lt;br /&gt;
! Hex&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0-3&lt;br /&gt;
| 0xF&lt;br /&gt;
| '''Combiner operator''' ([http://libogc.devkitpro.org/group__tevop.html tevop])&lt;br /&gt;
|-&lt;br /&gt;
| 4-5&lt;br /&gt;
| 0x30&lt;br /&gt;
| '''Bias''' ([http://libogc.devkitpro.org/group__tevbias.html tevbias]); 00 does nothing; 01 adds 0.5; 10 subtracts 0.5; 11 does nothing.&lt;br /&gt;
|-&lt;br /&gt;
| 6-7&lt;br /&gt;
| 0xC0&lt;br /&gt;
| '''Scale''' ([http://libogc.devkitpro.org/group__tevscale.html tevscale]); 00 does nothing; 01 multiples by 2; 10 multiplies by 4; 11 divides by 2.&lt;br /&gt;
|-&lt;br /&gt;
| 8&lt;br /&gt;
| 0x100&lt;br /&gt;
| '''Clamp flag'''; enabling this will clamp the output color between 0 and 1.&lt;br /&gt;
|-&lt;br /&gt;
| 9-10&lt;br /&gt;
| 0x600&lt;br /&gt;
| '''Output register''' ([http://libogc.devkitpro.org/group__tevcoloutreg.html tevrigid]); can be Previous Stage or Color 0/1/2&lt;br /&gt;
|-&lt;br /&gt;
| 11+&lt;br /&gt;
| 0xFFFFF800&lt;br /&gt;
| Unused.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note that the vast majority of materials in the game, if not all of them, don't really bother with any of this; they enable clamping, set an output register, and leave everything else at their defaults of 0.&lt;br /&gt;
&lt;br /&gt;
==== Alpha Combine Flags ====&lt;br /&gt;
&lt;br /&gt;
This is exactly the same as the color combine flags; the only difference is it operates on alpha instead of color.&lt;br /&gt;
&lt;br /&gt;
=== Texgen ===&lt;br /&gt;
&lt;br /&gt;
After the TEV stages comes a sequence of flags determining how texgen is executed. Texgen is the process of taking input values and using them to generate texture coordinates (or UV coordinates), which can then be used by the TEV stages. It's important to note that any vertex attribute can be used as a texgen input; in fact, it's rather common for materials to use the vertex normal as an input to simulate reflections. That means ''the number of texture coords present on each vertex is not the same as the number of texture coords available to TEV''.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| long&lt;br /&gt;
| 1&lt;br /&gt;
| '''Texgen count''' (TC)&lt;br /&gt;
|-&lt;br /&gt;
| long&lt;br /&gt;
| TC&lt;br /&gt;
| '''Texgen flags'''&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The flags correspond to arguments passed to [http://libogc.devkitpro.org/gx_8h.html#a55a426a3ff796db584302bddd829f002 GX_SetTexCoordGen2()]. These are the settings:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Bits&lt;br /&gt;
! Hex&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0-3&lt;br /&gt;
| 0xF&lt;br /&gt;
| '''Texture coord generation type''' ([http://libogc.devkitpro.org/group__texgentyp.html tgen_typ])&lt;br /&gt;
|-&lt;br /&gt;
| 4-8&lt;br /&gt;
| 0x1F0&lt;br /&gt;
| '''Texture coord source''' ([http://libogc.devkitpro.org/group__texgensrc.html tgen_src])&lt;br /&gt;
|-&lt;br /&gt;
| 9-13&lt;br /&gt;
| 0x3E00&lt;br /&gt;
| '''Texture matrix index''' ([http://libogc.devkitpro.org/group__texmtx.html mtxsrc] - add 30)&lt;br /&gt;
|-&lt;br /&gt;
| 14&lt;br /&gt;
| 0x4000&lt;br /&gt;
| '''Normalize flag''' - normalizes texture coord after it's multiplied by the texture matrix (normalize)&lt;br /&gt;
|-&lt;br /&gt;
| 15-20&lt;br /&gt;
| 0x1F8000&lt;br /&gt;
| '''Post-transform texture matrix index''' ([http://libogc.devkitpro.org/group__dttmtx.html postmtx] - add 64)&lt;br /&gt;
|-&lt;br /&gt;
| 21+&lt;br /&gt;
| 0xFFE00000&lt;br /&gt;
| Unused&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== UV Animations ===&lt;br /&gt;
&lt;br /&gt;
'' See [[UV Animations]]''&lt;br /&gt;
&lt;br /&gt;
The UV animations section immediately follows the texgen flags. Its purpose is to generate texture matrices and post-transform matrices, which are then used to transform UV coordinates. This is commonly used to animate textures via simple UV scrolls, but it's also often used to simulate reflective surfaces that move with the camera. Materials can have multiple UV animations; in that case, each animation generates a separate texture/post-transform matrix and are loaded into GX sequentially. Texgen is used to set which matrices are used by which UV coordinates (if any).&lt;br /&gt;
&lt;br /&gt;
The section starts with this short header:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 4&lt;br /&gt;
| '''Material animations section size''' (includes animation count, so will be 4 at minimum)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 4&lt;br /&gt;
| '''Animation count'''&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
For info on how to read the animation data and how each animation mode works, see [[UV Animations]].&lt;br /&gt;
&lt;br /&gt;
[[Category:File Formats]]&lt;br /&gt;
[[Category:Metroid Prime]]&lt;br /&gt;
[[Category:Metroid Prime 2: Echoes]]&lt;/div&gt;</summary>
		<author><name>Aruki</name></author>	</entry>

	<entry>
		<id>http://www.metroid2002.com/retromodding/index.php?title=Chunk_Descriptor_(Tropical_Freeze)&amp;diff=1922</id>
		<title>Chunk Descriptor (Tropical Freeze)</title>
		<link rel="alternate" type="text/html" href="http://www.metroid2002.com/retromodding/index.php?title=Chunk_Descriptor_(Tropical_Freeze)&amp;diff=1922"/>
				<updated>2018-01-31T08:28:43Z</updated>
		
		<summary type="html">&lt;p&gt;Aruki: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The '''chunk descriptor''' is a very common 24-byte header that describes different data sections, found in many different Donkey Kong Country: Tropical Freeze formats.&lt;br /&gt;
&lt;br /&gt;
{{research|2|A few unknown values.}}&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Format ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| {{FourCC}}&lt;br /&gt;
| '''Chunk ID'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| u64&lt;br /&gt;
| '''Chunk Size'''&lt;br /&gt;
| The size does not include the chunk descriptor itself.&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| u32&lt;br /&gt;
| {{unknown}}&lt;br /&gt;
| Usually 1.&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| u64&lt;br /&gt;
| {{unknown}}&lt;br /&gt;
| Usually 0.&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| colspan=3 {{unknown|End of Chunk Descriptor}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:Donkey Kong Country: Tropical Freeze]]&lt;/div&gt;</summary>
		<author><name>Aruki</name></author>	</entry>

	<entry>
		<id>http://www.metroid2002.com/retromodding/index.php?title=Geometry_(Metroid_Prime)&amp;diff=1921</id>
		<title>Geometry (Metroid Prime)</title>
		<link rel="alternate" type="text/html" href="http://www.metroid2002.com/retromodding/index.php?title=Geometry_(Metroid_Prime)&amp;diff=1921"/>
				<updated>2018-01-20T17:16:23Z</updated>
		
		<summary type="html">&lt;p&gt;Aruki: /* Surface */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The format for '''geometry''' appears in both the [[CMDL (File Format)|CMDL]] and [[MREA (File Format)|MREA]] formats, and is identical between both. This format is used in all three Prime games, and is largely unchanged between all of them (with the exception of an extra vertex attribute that was added in Echoes and Corruption).&lt;br /&gt;
&lt;br /&gt;
{{research|1|There's two unknowns in the surface headers that appear in Prime 2.}}&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Format ==&lt;br /&gt;
&lt;br /&gt;
An important thing to note off the bat is that both CMDL and MREA files are split up into a number of 32-byte-aligned ''sections''; their respective headers both declare a section count, and list the sizes of each section contained in the file. This is required to navigate to different parts of the file, and is required in order to read the geometry data correctly. Sections are generally split based on the type of data contained in them, so one section might contain vertex coordinates, while another contains a surface (submesh) definition. For the purposes of this article, each subheader will mark the start of a new section; use that as your cue to advance to the next one. Check the CMDL or MREA pages for more info on how the sections work.&lt;br /&gt;
&lt;br /&gt;
In the CMDL format, and in the MP1/2 MREA format, all data sections appear in the order that they are listed in this page. In the Prime 3/DKCR MREA format, the surface definitions, surface group IDs, and surface lookup table are shifted to a different part of the file.&lt;br /&gt;
&lt;br /&gt;
For vertex attributes, note that there's no count value present anywhere. If you want a rough count, you can divide the size of that attribute's section by the attribute's size; this approach doesn't account for padding, however.&lt;br /&gt;
&lt;br /&gt;
=== Vertex Coordinates ===&lt;br /&gt;
&lt;br /&gt;
These are stored as a sequence of three floats. &lt;br /&gt;
&lt;br /&gt;
=== Normals ===&lt;br /&gt;
&lt;br /&gt;
Normals can appear as either floats or shorts. In CMDL, this usually corresponds to the 0x2 bit in the flags value, and in MREA they will always appear as shorts; this is technically supposed to be set by the vertex format flag in the primitive data, though. If they appear as shorts, they should be divided by the mantissa value that appears on each surface (that value is always 0x8000).&lt;br /&gt;
&lt;br /&gt;
=== Vertex Color ===&lt;br /&gt;
&lt;br /&gt;
These are theoretically stored as 32-bit RGBA values, but vertex color isn't actually used by any mesh in any Retro games, so this section always appears completely empty.&lt;br /&gt;
&lt;br /&gt;
=== Float UV Coordinates ===&lt;br /&gt;
&lt;br /&gt;
These are stored as a sequence of two floats.&lt;br /&gt;
&lt;br /&gt;
=== Short UV Coordinates ===&lt;br /&gt;
&lt;br /&gt;
These are stored as a sequence of two shorts. Like normals, these should be divided by the surface's mantissa value. The short UV array is generally only used by terrain lightmaps, and as such this section always appears completely empty (listed with a size of 0) on CMDL. This array can only be used by the first UV coordinate on a given vertex, and whether it's used or not depends on one of the flags on the material. The rest will use the float array.&lt;br /&gt;
&lt;br /&gt;
=== Surface Offsets ===&lt;br /&gt;
&lt;br /&gt;
This section is very small and simple; it simply declares a surface count and then lists the offsets to the end of each surface. Following this section, there'll be one additional section per surface.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Surface Count'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| u32&lt;br /&gt;
| ''Surface Count''&lt;br /&gt;
| '''Surface Offsets'''&lt;br /&gt;
| Relative to the start address of the first surface.&lt;br /&gt;
|-&lt;br /&gt;
| colspan=5 {{unknown|Surface sections begin}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Surface ===&lt;br /&gt;
&lt;br /&gt;
There will be one of these sections per surface. Each surface starts with a small header; following the end of the header, the file is padded with 0s to the next 32-byte boundary, then the primitive data begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| float&lt;br /&gt;
| 3&lt;br /&gt;
| '''Center Point'''&lt;br /&gt;
| Used for depth sorting on CMDL and used as the eye position for reflections&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Material Index'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| u16&lt;br /&gt;
| 1&lt;br /&gt;
| '''Mantissa'''&lt;br /&gt;
| Always 0x8000.&lt;br /&gt;
|-&lt;br /&gt;
| 0x12&lt;br /&gt;
| u16&lt;br /&gt;
| 1&lt;br /&gt;
| '''Display List Size''' &lt;br /&gt;
| '''Important: this value is not always reliable'''&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Parent Model Pointer Storage'''&lt;br /&gt;
| Always 0; the game uses this space at runtime to store a pointer to the parent CCubeModel instance&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Next Surface Pointer Storage'''&lt;br /&gt;
| Always 0; the game uses this space at runtime to store a pointer to the next surface&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Extra Data Size'''&lt;br /&gt;
| Amount of space taken up by extra data. Always 0 on CMDLs, 0x18 on MREAs.&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| float&lt;br /&gt;
| 3&lt;br /&gt;
| '''Surface Normal'''&lt;br /&gt;
| On materials that use the Samus reflection, this is used to project the reflection onto the surface&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| u16&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| Not in Prime 1.&lt;br /&gt;
|-&lt;br /&gt;
| 0x2E&lt;br /&gt;
| u16&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| Not in Prime 1.&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| u8&lt;br /&gt;
| ''Extra Data Size''&lt;br /&gt;
| '''Extra Data'''&lt;br /&gt;
| Empty on CMDL; contains a bounding box used for depth sorting on MREA.&lt;br /&gt;
|-&lt;br /&gt;
| colspan=5 {{unknown|End of surface header; pad to multiple of 32 before primitive data starts}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The primitive data is a GX display list. Each primitive begins with a byte that contains the primitive type in the upper 5 bits, and the vertex format setting in the lower 3; see below for possible settings. After that is a 16-bit vertex count, followed by a series of 16-bit vertex attribute indices.&lt;br /&gt;
&lt;br /&gt;
Note that you'll need to check some settings on the material to read the primitive data properly; the material determines which vertex attributes are present. The material also determines whether the surface is using lightmaps; if it is, then the first UV coordinate will be read out of the short UV array instead of the float one.&lt;br /&gt;
&lt;br /&gt;
There is no primitive count value; you'll need to continue reading data until you hit the end of the display list. There are a couple values you can use for reference; either the surface's section size, or the surface's end offset. '''Do not use the display list size setting from the surface header, though'''; it's usually accurate, but on some models it will give you a size smaller than the table actually is, and you'll miss a bunch of data. See Metroid3/4a11192a.CMDL from Prime 1 (icicle Ridley) or Metroid1/05778239.CMDL from Echoes (Samus's gunship) for an example of this.&lt;br /&gt;
&lt;br /&gt;
There are 7 primitive types supported by GX, indicated in the upper 5 bits of the flag value. Note that the game only ever actually uses triangles, triangle strips, and triangle fans; however, all of these primitives are supported by GX and are therefore supported by the game, and so they could be used in custom model files.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Value&lt;br /&gt;
! Primitive&lt;br /&gt;
|-&lt;br /&gt;
| 0x80&lt;br /&gt;
| Quads&lt;br /&gt;
|-&lt;br /&gt;
| 0x90&lt;br /&gt;
| Triangles&lt;br /&gt;
|-&lt;br /&gt;
| 0x98&lt;br /&gt;
| Triangle Strip&lt;br /&gt;
|-&lt;br /&gt;
| 0xA0&lt;br /&gt;
| Triangle Fan&lt;br /&gt;
|-&lt;br /&gt;
| 0xA8&lt;br /&gt;
| Lines&lt;br /&gt;
|-&lt;br /&gt;
| 0xB0&lt;br /&gt;
| Line Strip&lt;br /&gt;
|-&lt;br /&gt;
| 0xB8&lt;br /&gt;
| Points&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In addition, the game uses three vertex formats, indicated in the lower 3 bits of the flag value (0x7). The only attributes that change between formats are nrm and tex0, so those are the only ones listed in the table below.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Format&lt;br /&gt;
! GX_VA_NRM type/size&lt;br /&gt;
! GX_VA_TEX0 type/size&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| GX_NRM_XYZ / GX_F32&lt;br /&gt;
| GX_TEX_ST / GX_F32&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| GX_NRM_XYZ / GX_S16&lt;br /&gt;
| GX_TEX_ST / GX_F32&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| GX_NRM_XYZ / GX_S16&lt;br /&gt;
| GX_TEX_ST / GX_S16&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Surface Group IDs ===&lt;br /&gt;
&lt;br /&gt;
This section (and the following one) appears in [[MREA (File Format)|MREA files]] starting in Metroid Prime 2. Starting in MP2, surfaces in world geometry are now merged together to create as few meshes as possible (meshes are now only split when the vertex count exceeds 65535). Two extra data sections are present to manage the resulting super-meshes to enable the game to extract smaller meshes out when needed.&lt;br /&gt;
&lt;br /&gt;
This first section assigns a group ID to each surface, forming smaller meshes. This ID is used in various places that operate on world geometry, including in the [[AROT (MREA Section)|area octree]] as well as in the [[EGMC (File Format)|EGMC format]], among others.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| u16&lt;br /&gt;
| 1&lt;br /&gt;
| '''Surface Count'''&lt;br /&gt;
| Matches the world model surface count&lt;br /&gt;
|-&lt;br /&gt;
| [[#Surface Group ID|Surface Group ID]]&lt;br /&gt;
| ''Surface Count''&lt;br /&gt;
| '''Surface Group ID Array'''&lt;br /&gt;
| Sequentially assigns a surface group ID to every surface in the mesh.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Surface Group ID ====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| u16&lt;br /&gt;
| '''Model-Relative Surface Group ID'''&lt;br /&gt;
| This is the ID of the group this surface belongs to, relative to the groups in this model (starting from 0).&lt;br /&gt;
|-&lt;br /&gt;
| 0x2&lt;br /&gt;
| u16&lt;br /&gt;
| '''Surface Group ID'''&lt;br /&gt;
| Same ID, except area-relative (starting where the previous world model's group IDs left off). This is generally the ID that appears in other places to reference this group.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Surface Lookup Table ===&lt;br /&gt;
&lt;br /&gt;
This is the second new [[MREA (File Format)|MREA]]-exclusive section introduced in Metroid Prime 2. It provides a mapping of each surface group to the surfaces contained in it, so that surfaces can be quickly accessed by group ID.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| u16&lt;br /&gt;
| 1&lt;br /&gt;
| '''Surface Group Count'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| u16&lt;br /&gt;
| ''Surface Group Count''&lt;br /&gt;
| '''Lookup Table Index Array'''&lt;br /&gt;
| The value of each element corresponds to the end index of the surfaces for this group in the lookup table. Each element is equal to the previous element + the number of surfaces contained in this group.&lt;br /&gt;
|-&lt;br /&gt;
| u16&lt;br /&gt;
| ''Surface Count''&lt;br /&gt;
| '''Surface Lookup Table'''&lt;br /&gt;
| List of surface indices ordered by group ID. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:File Formats]]&lt;br /&gt;
[[Category:Metroid Prime]]&lt;br /&gt;
[[Category:Metroid Prime 2: Echoes]]&lt;br /&gt;
[[Category:Metroid Prime 3: Corruption]]&lt;/div&gt;</summary>
		<author><name>Aruki</name></author>	</entry>

	<entry>
		<id>http://www.metroid2002.com/retromodding/index.php?title=TXTR_(Tropical_Freeze)&amp;diff=1918</id>
		<title>TXTR (Tropical Freeze)</title>
		<link rel="alternate" type="text/html" href="http://www.metroid2002.com/retromodding/index.php?title=TXTR_(Tropical_Freeze)&amp;diff=1918"/>
				<updated>2017-12-17T21:04:32Z</updated>
		
		<summary type="html">&lt;p&gt;Aruki: /* PAK Metadata */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''See [[TXTR (File Format)]] for the other revisions of this format.''&lt;br /&gt;
&lt;br /&gt;
The '''TXTR''' format is Tropical Freeze's texture format. The image data in the GPU buffer is compressed using [[LZSS Compression|LZSS compression]].&lt;br /&gt;
&lt;br /&gt;
{{research|moderate|There are a couple unknowns in the header. It would also be good to have some documentation on how to deswizzle/decompress different texture formats.}}&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Format ==&lt;br /&gt;
&lt;br /&gt;
The format starts with the typical [[Form Descriptor (Tropical Freeze)|form descriptor]] found in every Tropical Freeze format. Following that, there's a HEAD header section that contains most of the texture parameters, then the GPU section containing the actual compressed image data. This is the structure of the HEAD section:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! style=&amp;quot;width:110px;&amp;quot;|Type&lt;br /&gt;
! style=&amp;quot;width:100px;&amp;quot;|Count&lt;br /&gt;
! style=&amp;quot;width:170px;&amp;quot;|Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| [[Chunk Descriptor (Tropical Freeze)|Chunk Descriptor]]&lt;br /&gt;
| 1&lt;br /&gt;
| '''HEAD Chunk Descriptor'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Type|'''Texture Type''']]&lt;br /&gt;
| Describes the type/dimensionality of the texture (2D texture, 3D texture, cubemap, array of 2D images, etc).&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Format|'''Texture Format''']]&lt;br /&gt;
| Describes the format that the image data is encoded in.&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Width'''&lt;br /&gt;
| Texture X resolution.&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Height'''&lt;br /&gt;
| Texture Y resolution.&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Depth'''&lt;br /&gt;
| Texture Z resolution.&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Tile Mode'''&lt;br /&gt;
| Indicates how the texture image data is tiled.&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Swizzle'''&lt;br /&gt;
| Indicates how the texture image data is swizzled.&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Mipmap Count'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| u32&lt;br /&gt;
| ''Mipmap Count''&lt;br /&gt;
| '''Mipmap Sizes'''&lt;br /&gt;
| The size of the base level mipmap is calculated with padding and alignment taken into account. The size of subsequent mipmaps is calculated as Width*Height*Depth*BPP/8. This does '''not''' take padding and alignment into account, and so it does not accurately reflect the amount of space the mipmap takes up in the file, and it cannot be used to accurately locate and read mipmap data. The offset and size needs to be calculated from the other parameters in the header. The game calculates this data by calling GX2CalcSurfaceSizeAndAlignment.&lt;br /&gt;
|-&lt;br /&gt;
| {{none}}&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| This parameter is part of NTextureFormat::STextureSamplerData (along with the next 4 parameters)&lt;br /&gt;
|-&lt;br /&gt;
| {{none}}&lt;br /&gt;
| u8&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Filter|'''Texture Filter''']]&lt;br /&gt;
| Determines how the texture is filtered when sampled.&lt;br /&gt;
|-&lt;br /&gt;
| {{none}}&lt;br /&gt;
| u8&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Wrap|'''Texture Wrap X''']]&lt;br /&gt;
| Determines how the texture wraps on the X coordinate.&lt;br /&gt;
|-&lt;br /&gt;
| {{none}}&lt;br /&gt;
| u8&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Wrap|'''Texture Wrap Y''']]&lt;br /&gt;
| Determines how the texture wraps on the Y coordinate.&lt;br /&gt;
|-&lt;br /&gt;
| {{none}}&lt;br /&gt;
| u8&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Wrap|'''Texture Wrap Z''']]&lt;br /&gt;
| Determines how the texture wraps on the Z coordinate.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Texture Type ===&lt;br /&gt;
&lt;br /&gt;
This enum basically maps directly to a GX2SurfaceDim enum.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! ID&lt;br /&gt;
! Type&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| 1D Texture&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| 2D Texture&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| 3D Texture&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| Cube Texture&lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| 1D Texture Array&lt;br /&gt;
|-&lt;br /&gt;
| 5&lt;br /&gt;
| 2D Texture Array&lt;br /&gt;
|-&lt;br /&gt;
| 6&lt;br /&gt;
| Multisampled 2D Texture&lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| Multisampled 2D Texture Array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Texture Format ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! ID&lt;br /&gt;
! GX2SurfaceFormat&lt;br /&gt;
|-&lt;br /&gt;
| 0x00&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R8_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x01&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R8_SNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x02&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R8_UINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x03&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R8_SINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x04&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCD_R16_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x05&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_SNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x06&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_UINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x07&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_SINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x08&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x09&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R32_UINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x0A&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R32_SINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x0B&lt;br /&gt;
| GX2_SURFACE_FORMAT_INVALID&lt;br /&gt;
|-&lt;br /&gt;
| 0x0C&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCS_R8_G8_B8_A8_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x0D&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCS_R8_G8_B8_A8_SRGB&lt;br /&gt;
|-&lt;br /&gt;
| 0x0E&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_G16_B16_A16_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x0F&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R32_G32_B32_A32_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCD_R16_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x11&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCD_R16_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x12&lt;br /&gt;
| GX2_SURFACE_FORMAT_D_D24_S8_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x13&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCD_R32_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC1_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x15&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC1_SRGB&lt;br /&gt;
|-&lt;br /&gt;
| 0x16&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC2_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x17&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC2_SRGB&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC3_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x19&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC3_SRGB&lt;br /&gt;
|-&lt;br /&gt;
| 0x1A&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC4_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x1B&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC4_SNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC5_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x1D&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC5_SNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x1E&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R11_G11_B10_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x1F&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCD_R32_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_G16_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x21&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R8_G8_UNORM&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Texture Filter ===&lt;br /&gt;
&lt;br /&gt;
Invalid values default to 1 (linear).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! ID&lt;br /&gt;
! GX2TexMipFilterType&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| GX2_TEX_MIP_FILTER_POINT&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| GX2_TEX_MIP_FILTER_LINEAR&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Texture Wrap ===&lt;br /&gt;
&lt;br /&gt;
Invalid values default to 0 (clamp).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! ID&lt;br /&gt;
! GX2TexClamp&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| GX2_TEX_CLAMP_CLAMP&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| GX2_TEX_CLAMP_WRAP&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| GX2_TEX_CLAMP_MIRROR&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| GX2_TEX_CLAMP_MIRROR_ONCE&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== PAK Metadata ==&lt;br /&gt;
&lt;br /&gt;
The pak metadata for the TXTR format primarily contains compression-related information and provides the values required to decompress it.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| Always 4&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''GPU Section Offset'''&lt;br /&gt;
| Relative to the start of the file&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Base Alignment'''&lt;br /&gt;
| Alignment of the surface image data&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''GPU Data Start'''&lt;br /&gt;
| This is the offset to the start of the GPU data, immediately after the GPU section header.&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''GPU Section Size'''&lt;br /&gt;
| Matches the size from the GPU section header.&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Compressed Buffer Count'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| [[#Compressed Buffer|Compressed Buffer]]&lt;br /&gt;
| ''Compressed Buffer Count''&lt;br /&gt;
| '''Compressed Buffer Array'''&lt;br /&gt;
| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Compressed Buffer ===&lt;br /&gt;
&lt;br /&gt;
This is a small struct that defines a compressed data buffer within the GPU section.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| u32&lt;br /&gt;
| '''Decompressed Size'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| u32&lt;br /&gt;
| '''Compressed Size'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| u32&lt;br /&gt;
| '''Offset'''&lt;br /&gt;
| Relative to after the GPU section header&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:File Formats]]&lt;br /&gt;
[[Category:Donkey Kong Country: Tropical Freeze]]&lt;/div&gt;</summary>
		<author><name>Aruki</name></author>	</entry>

	<entry>
		<id>http://www.metroid2002.com/retromodding/index.php?title=TXTR_(Tropical_Freeze)&amp;diff=1917</id>
		<title>TXTR (Tropical Freeze)</title>
		<link rel="alternate" type="text/html" href="http://www.metroid2002.com/retromodding/index.php?title=TXTR_(Tropical_Freeze)&amp;diff=1917"/>
				<updated>2017-12-17T19:27:02Z</updated>
		
		<summary type="html">&lt;p&gt;Aruki: /* PAK Metadata */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''See [[TXTR (File Format)]] for the other revisions of this format.''&lt;br /&gt;
&lt;br /&gt;
The '''TXTR''' format is Tropical Freeze's texture format. The image data in the GPU buffer is compressed using [[LZSS Compression|LZSS compression]].&lt;br /&gt;
&lt;br /&gt;
{{research|moderate|There are a couple unknowns in the header. It would also be good to have some documentation on how to deswizzle/decompress different texture formats.}}&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Format ==&lt;br /&gt;
&lt;br /&gt;
The format starts with the typical [[Form Descriptor (Tropical Freeze)|form descriptor]] found in every Tropical Freeze format. Following that, there's a HEAD header section that contains most of the texture parameters, then the GPU section containing the actual compressed image data. This is the structure of the HEAD section:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! style=&amp;quot;width:110px;&amp;quot;|Type&lt;br /&gt;
! style=&amp;quot;width:100px;&amp;quot;|Count&lt;br /&gt;
! style=&amp;quot;width:170px;&amp;quot;|Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| [[Chunk Descriptor (Tropical Freeze)|Chunk Descriptor]]&lt;br /&gt;
| 1&lt;br /&gt;
| '''HEAD Chunk Descriptor'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Type|'''Texture Type''']]&lt;br /&gt;
| Describes the type/dimensionality of the texture (2D texture, 3D texture, cubemap, array of 2D images, etc).&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Format|'''Texture Format''']]&lt;br /&gt;
| Describes the format that the image data is encoded in.&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Width'''&lt;br /&gt;
| Texture X resolution.&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Height'''&lt;br /&gt;
| Texture Y resolution.&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Depth'''&lt;br /&gt;
| Texture Z resolution.&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Tile Mode'''&lt;br /&gt;
| Indicates how the texture image data is tiled.&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Swizzle'''&lt;br /&gt;
| Indicates how the texture image data is swizzled.&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Mipmap Count'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| u32&lt;br /&gt;
| ''Mipmap Count''&lt;br /&gt;
| '''Mipmap Sizes'''&lt;br /&gt;
| The size of the base level mipmap is calculated with padding and alignment taken into account. The size of subsequent mipmaps is calculated as Width*Height*Depth*BPP/8. This does '''not''' take padding and alignment into account, and so it does not accurately reflect the amount of space the mipmap takes up in the file, and it cannot be used to accurately locate and read mipmap data. The offset and size needs to be calculated from the other parameters in the header. The game calculates this data by calling GX2CalcSurfaceSizeAndAlignment.&lt;br /&gt;
|-&lt;br /&gt;
| {{none}}&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| This parameter is part of NTextureFormat::STextureSamplerData (along with the next 4 parameters)&lt;br /&gt;
|-&lt;br /&gt;
| {{none}}&lt;br /&gt;
| u8&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Filter|'''Texture Filter''']]&lt;br /&gt;
| Determines how the texture is filtered when sampled.&lt;br /&gt;
|-&lt;br /&gt;
| {{none}}&lt;br /&gt;
| u8&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Wrap|'''Texture Wrap X''']]&lt;br /&gt;
| Determines how the texture wraps on the X coordinate.&lt;br /&gt;
|-&lt;br /&gt;
| {{none}}&lt;br /&gt;
| u8&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Wrap|'''Texture Wrap Y''']]&lt;br /&gt;
| Determines how the texture wraps on the Y coordinate.&lt;br /&gt;
|-&lt;br /&gt;
| {{none}}&lt;br /&gt;
| u8&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Wrap|'''Texture Wrap Z''']]&lt;br /&gt;
| Determines how the texture wraps on the Z coordinate.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Texture Type ===&lt;br /&gt;
&lt;br /&gt;
This enum basically maps directly to a GX2SurfaceDim enum.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! ID&lt;br /&gt;
! Type&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| 1D Texture&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| 2D Texture&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| 3D Texture&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| Cube Texture&lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| 1D Texture Array&lt;br /&gt;
|-&lt;br /&gt;
| 5&lt;br /&gt;
| 2D Texture Array&lt;br /&gt;
|-&lt;br /&gt;
| 6&lt;br /&gt;
| Multisampled 2D Texture&lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| Multisampled 2D Texture Array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Texture Format ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! ID&lt;br /&gt;
! GX2SurfaceFormat&lt;br /&gt;
|-&lt;br /&gt;
| 0x00&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R8_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x01&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R8_SNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x02&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R8_UINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x03&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R8_SINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x04&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCD_R16_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x05&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_SNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x06&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_UINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x07&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_SINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x08&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x09&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R32_UINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x0A&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R32_SINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x0B&lt;br /&gt;
| GX2_SURFACE_FORMAT_INVALID&lt;br /&gt;
|-&lt;br /&gt;
| 0x0C&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCS_R8_G8_B8_A8_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x0D&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCS_R8_G8_B8_A8_SRGB&lt;br /&gt;
|-&lt;br /&gt;
| 0x0E&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_G16_B16_A16_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x0F&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R32_G32_B32_A32_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCD_R16_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x11&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCD_R16_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x12&lt;br /&gt;
| GX2_SURFACE_FORMAT_D_D24_S8_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x13&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCD_R32_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC1_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x15&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC1_SRGB&lt;br /&gt;
|-&lt;br /&gt;
| 0x16&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC2_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x17&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC2_SRGB&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC3_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x19&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC3_SRGB&lt;br /&gt;
|-&lt;br /&gt;
| 0x1A&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC4_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x1B&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC4_SNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC5_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x1D&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC5_SNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x1E&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R11_G11_B10_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x1F&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCD_R32_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_G16_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x21&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R8_G8_UNORM&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Texture Filter ===&lt;br /&gt;
&lt;br /&gt;
Invalid values default to 1 (linear).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! ID&lt;br /&gt;
! GX2TexMipFilterType&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| GX2_TEX_MIP_FILTER_POINT&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| GX2_TEX_MIP_FILTER_LINEAR&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Texture Wrap ===&lt;br /&gt;
&lt;br /&gt;
Invalid values default to 0 (clamp).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! ID&lt;br /&gt;
! GX2TexClamp&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| GX2_TEX_CLAMP_CLAMP&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| GX2_TEX_CLAMP_WRAP&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| GX2_TEX_CLAMP_MIRROR&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| GX2_TEX_CLAMP_MIRROR_ONCE&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== PAK Metadata ==&lt;br /&gt;
&lt;br /&gt;
The pak metadata for the TXTR format primarily contains compression-related information and provides the values required to decompress it.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| Always 4&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| Always 0&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''GPU Section Offset'''&lt;br /&gt;
| Relative to the start of the file&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Base Alignment'''&lt;br /&gt;
| Alignment of the surface image data&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''GPU Data Start'''&lt;br /&gt;
| This is the offset to the start of the GPU data, immediately after the GPU section header.&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''GPU Section Size'''&lt;br /&gt;
| Matches the size from the GPU section header.&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Compressed Buffer Count'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| [[#Compressed Buffer|Compressed Buffer]]&lt;br /&gt;
| ''Compressed Buffer Count''&lt;br /&gt;
| '''Compressed Buffer Array'''&lt;br /&gt;
| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Compressed Buffer ===&lt;br /&gt;
&lt;br /&gt;
This is a small struct that defines a compressed data buffer within the GPU section.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| u32&lt;br /&gt;
| '''Decompressed Size'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| u32&lt;br /&gt;
| '''Compressed Size'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| u32&lt;br /&gt;
| '''Offset'''&lt;br /&gt;
| Relative to after the GPU section header&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:File Formats]]&lt;br /&gt;
[[Category:Donkey Kong Country: Tropical Freeze]]&lt;/div&gt;</summary>
		<author><name>Aruki</name></author>	</entry>

	<entry>
		<id>http://www.metroid2002.com/retromodding/index.php?title=TXTR_(Tropical_Freeze)&amp;diff=1916</id>
		<title>TXTR (Tropical Freeze)</title>
		<link rel="alternate" type="text/html" href="http://www.metroid2002.com/retromodding/index.php?title=TXTR_(Tropical_Freeze)&amp;diff=1916"/>
				<updated>2017-12-16T19:55:08Z</updated>
		
		<summary type="html">&lt;p&gt;Aruki: /* Texture Type */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''See [[TXTR (File Format)]] for the other revisions of this format.''&lt;br /&gt;
&lt;br /&gt;
The '''TXTR''' format is Tropical Freeze's texture format. The image data in the GPU buffer is compressed using [[LZSS Compression|LZSS compression]].&lt;br /&gt;
&lt;br /&gt;
{{research|moderate|There are a couple unknowns in the header. It would also be good to have some documentation on how to deswizzle/decompress different texture formats.}}&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Format ==&lt;br /&gt;
&lt;br /&gt;
The format starts with the typical [[Form Descriptor (Tropical Freeze)|form descriptor]] found in every Tropical Freeze format. Following that, there's a HEAD header section that contains most of the texture parameters, then the GPU section containing the actual compressed image data. This is the structure of the HEAD section:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! style=&amp;quot;width:110px;&amp;quot;|Type&lt;br /&gt;
! style=&amp;quot;width:100px;&amp;quot;|Count&lt;br /&gt;
! style=&amp;quot;width:170px;&amp;quot;|Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| [[Chunk Descriptor (Tropical Freeze)|Chunk Descriptor]]&lt;br /&gt;
| 1&lt;br /&gt;
| '''HEAD Chunk Descriptor'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Type|'''Texture Type''']]&lt;br /&gt;
| Describes the type/dimensionality of the texture (2D texture, 3D texture, cubemap, array of 2D images, etc).&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Format|'''Texture Format''']]&lt;br /&gt;
| Describes the format that the image data is encoded in.&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Width'''&lt;br /&gt;
| Texture X resolution.&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Height'''&lt;br /&gt;
| Texture Y resolution.&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Depth'''&lt;br /&gt;
| Texture Z resolution.&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Tile Mode'''&lt;br /&gt;
| Indicates how the texture image data is tiled.&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Swizzle'''&lt;br /&gt;
| Indicates how the texture image data is swizzled.&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Mipmap Count'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| u32&lt;br /&gt;
| ''Mipmap Count''&lt;br /&gt;
| '''Mipmap Sizes'''&lt;br /&gt;
| The size of the base level mipmap is calculated with padding and alignment taken into account. The size of subsequent mipmaps is calculated as Width*Height*Depth*BPP/8. This does '''not''' take padding and alignment into account, and so it does not accurately reflect the amount of space the mipmap takes up in the file, and it cannot be used to accurately locate and read mipmap data. The offset and size needs to be calculated from the other parameters in the header. The game calculates this data by calling GX2CalcSurfaceSizeAndAlignment.&lt;br /&gt;
|-&lt;br /&gt;
| {{none}}&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| This parameter is part of NTextureFormat::STextureSamplerData (along with the next 4 parameters)&lt;br /&gt;
|-&lt;br /&gt;
| {{none}}&lt;br /&gt;
| u8&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Filter|'''Texture Filter''']]&lt;br /&gt;
| Determines how the texture is filtered when sampled.&lt;br /&gt;
|-&lt;br /&gt;
| {{none}}&lt;br /&gt;
| u8&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Wrap|'''Texture Wrap X''']]&lt;br /&gt;
| Determines how the texture wraps on the X coordinate.&lt;br /&gt;
|-&lt;br /&gt;
| {{none}}&lt;br /&gt;
| u8&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Wrap|'''Texture Wrap Y''']]&lt;br /&gt;
| Determines how the texture wraps on the Y coordinate.&lt;br /&gt;
|-&lt;br /&gt;
| {{none}}&lt;br /&gt;
| u8&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Wrap|'''Texture Wrap Z''']]&lt;br /&gt;
| Determines how the texture wraps on the Z coordinate.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Texture Type ===&lt;br /&gt;
&lt;br /&gt;
This enum basically maps directly to a GX2SurfaceDim enum.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! ID&lt;br /&gt;
! Type&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| 1D Texture&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| 2D Texture&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| 3D Texture&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| Cube Texture&lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| 1D Texture Array&lt;br /&gt;
|-&lt;br /&gt;
| 5&lt;br /&gt;
| 2D Texture Array&lt;br /&gt;
|-&lt;br /&gt;
| 6&lt;br /&gt;
| Multisampled 2D Texture&lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| Multisampled 2D Texture Array&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Texture Format ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! ID&lt;br /&gt;
! GX2SurfaceFormat&lt;br /&gt;
|-&lt;br /&gt;
| 0x00&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R8_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x01&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R8_SNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x02&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R8_UINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x03&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R8_SINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x04&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCD_R16_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x05&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_SNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x06&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_UINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x07&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_SINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x08&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x09&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R32_UINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x0A&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R32_SINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x0B&lt;br /&gt;
| GX2_SURFACE_FORMAT_INVALID&lt;br /&gt;
|-&lt;br /&gt;
| 0x0C&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCS_R8_G8_B8_A8_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x0D&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCS_R8_G8_B8_A8_SRGB&lt;br /&gt;
|-&lt;br /&gt;
| 0x0E&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_G16_B16_A16_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x0F&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R32_G32_B32_A32_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCD_R16_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x11&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCD_R16_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x12&lt;br /&gt;
| GX2_SURFACE_FORMAT_D_D24_S8_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x13&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCD_R32_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC1_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x15&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC1_SRGB&lt;br /&gt;
|-&lt;br /&gt;
| 0x16&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC2_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x17&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC2_SRGB&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC3_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x19&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC3_SRGB&lt;br /&gt;
|-&lt;br /&gt;
| 0x1A&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC4_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x1B&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC4_SNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC5_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x1D&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC5_SNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x1E&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R11_G11_B10_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x1F&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCD_R32_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_G16_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x21&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R8_G8_UNORM&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Texture Filter ===&lt;br /&gt;
&lt;br /&gt;
Invalid values default to 1 (linear).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! ID&lt;br /&gt;
! GX2TexMipFilterType&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| GX2_TEX_MIP_FILTER_POINT&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| GX2_TEX_MIP_FILTER_LINEAR&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Texture Wrap ===&lt;br /&gt;
&lt;br /&gt;
Invalid values default to 0 (clamp).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! ID&lt;br /&gt;
! GX2TexClamp&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| GX2_TEX_CLAMP_CLAMP&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| GX2_TEX_CLAMP_WRAP&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| GX2_TEX_CLAMP_MIRROR&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| GX2_TEX_CLAMP_MIRROR_ONCE&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== PAK Metadata ==&lt;br /&gt;
&lt;br /&gt;
The pak metadata for the TXTR format primarily contains compression-related information and provides the values required to decompress it.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''GPU Section Offset'''&lt;br /&gt;
| Relative to the start of the file&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''GPU Data Start'''&lt;br /&gt;
| This is the offset to the start of the GPU data, immediately after the GPU section header.&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''GPU Section Size'''&lt;br /&gt;
| Matches the size from the GPU section header.&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Compressed Buffer Count'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| [[#Compressed Buffer|Compressed Buffer]]&lt;br /&gt;
| ''Compressed Buffer Count''&lt;br /&gt;
| '''Compressed Buffer Array'''&lt;br /&gt;
| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Compressed Buffer ===&lt;br /&gt;
&lt;br /&gt;
This is a small struct that defines a compressed data buffer within the GPU section.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| u32&lt;br /&gt;
| '''Decompressed Size'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| u32&lt;br /&gt;
| '''Compressed Size'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| u32&lt;br /&gt;
| '''Offset'''&lt;br /&gt;
| Relative to after the GPU section header&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:File Formats]]&lt;br /&gt;
[[Category:Donkey Kong Country: Tropical Freeze]]&lt;/div&gt;</summary>
		<author><name>Aruki</name></author>	</entry>

	<entry>
		<id>http://www.metroid2002.com/retromodding/index.php?title=TXTR_(Tropical_Freeze)&amp;diff=1915</id>
		<title>TXTR (Tropical Freeze)</title>
		<link rel="alternate" type="text/html" href="http://www.metroid2002.com/retromodding/index.php?title=TXTR_(Tropical_Freeze)&amp;diff=1915"/>
				<updated>2017-12-16T08:23:16Z</updated>
		
		<summary type="html">&lt;p&gt;Aruki: /* Format */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''See [[TXTR (File Format)]] for the other revisions of this format.''&lt;br /&gt;
&lt;br /&gt;
The '''TXTR''' format is Tropical Freeze's texture format. The image data in the GPU buffer is compressed using [[LZSS Compression|LZSS compression]].&lt;br /&gt;
&lt;br /&gt;
{{research|moderate|There are a couple unknowns in the header. It would also be good to have some documentation on how to deswizzle/decompress different texture formats.}}&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Format ==&lt;br /&gt;
&lt;br /&gt;
The format starts with the typical [[Form Descriptor (Tropical Freeze)|form descriptor]] found in every Tropical Freeze format. Following that, there's a HEAD header section that contains most of the texture parameters, then the GPU section containing the actual compressed image data. This is the structure of the HEAD section:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! style=&amp;quot;width:110px;&amp;quot;|Type&lt;br /&gt;
! style=&amp;quot;width:100px;&amp;quot;|Count&lt;br /&gt;
! style=&amp;quot;width:170px;&amp;quot;|Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| [[Chunk Descriptor (Tropical Freeze)|Chunk Descriptor]]&lt;br /&gt;
| 1&lt;br /&gt;
| '''HEAD Chunk Descriptor'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Type|'''Texture Type''']]&lt;br /&gt;
| Describes the type/dimensionality of the texture (2D texture, 3D texture, cubemap, array of 2D images, etc).&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Format|'''Texture Format''']]&lt;br /&gt;
| Describes the format that the image data is encoded in.&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Width'''&lt;br /&gt;
| Texture X resolution.&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Height'''&lt;br /&gt;
| Texture Y resolution.&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Depth'''&lt;br /&gt;
| Texture Z resolution.&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Tile Mode'''&lt;br /&gt;
| Indicates how the texture image data is tiled.&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Swizzle'''&lt;br /&gt;
| Indicates how the texture image data is swizzled.&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Mipmap Count'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| u32&lt;br /&gt;
| ''Mipmap Count''&lt;br /&gt;
| '''Mipmap Sizes'''&lt;br /&gt;
| The size of the base level mipmap is calculated with padding and alignment taken into account. The size of subsequent mipmaps is calculated as Width*Height*Depth*BPP/8. This does '''not''' take padding and alignment into account, and so it does not accurately reflect the amount of space the mipmap takes up in the file, and it cannot be used to accurately locate and read mipmap data. The offset and size needs to be calculated from the other parameters in the header. The game calculates this data by calling GX2CalcSurfaceSizeAndAlignment.&lt;br /&gt;
|-&lt;br /&gt;
| {{none}}&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| This parameter is part of NTextureFormat::STextureSamplerData (along with the next 4 parameters)&lt;br /&gt;
|-&lt;br /&gt;
| {{none}}&lt;br /&gt;
| u8&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Filter|'''Texture Filter''']]&lt;br /&gt;
| Determines how the texture is filtered when sampled.&lt;br /&gt;
|-&lt;br /&gt;
| {{none}}&lt;br /&gt;
| u8&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Wrap|'''Texture Wrap X''']]&lt;br /&gt;
| Determines how the texture wraps on the X coordinate.&lt;br /&gt;
|-&lt;br /&gt;
| {{none}}&lt;br /&gt;
| u8&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Wrap|'''Texture Wrap Y''']]&lt;br /&gt;
| Determines how the texture wraps on the Y coordinate.&lt;br /&gt;
|-&lt;br /&gt;
| {{none}}&lt;br /&gt;
| u8&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Wrap|'''Texture Wrap Z''']]&lt;br /&gt;
| Determines how the texture wraps on the Z coordinate.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Texture Type ===&lt;br /&gt;
&lt;br /&gt;
This enum basically maps directly to a GX2SurfaceDim enum.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! ID&lt;br /&gt;
! GX2SurfaceDim&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| GX2_SURFACE_DIM_1D&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| GX2_SURFACE_DIM_2D&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| GX2_SURFACE_DIM_3D&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| GX2_SURFACE_DIM_CUBE&lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| GX2_SURFACE_DIM_1D_ARRAY&lt;br /&gt;
|-&lt;br /&gt;
| 5&lt;br /&gt;
| GX2_SURFACE_DIM_2D_ARRAY&lt;br /&gt;
|-&lt;br /&gt;
| 6&lt;br /&gt;
| GX2_SURFACE_DIM_2D_MSAA&lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| GX2_SURFACE_DIM_2D_MSAA_ARRAY&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Texture Format ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! ID&lt;br /&gt;
! GX2SurfaceFormat&lt;br /&gt;
|-&lt;br /&gt;
| 0x00&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R8_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x01&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R8_SNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x02&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R8_UINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x03&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R8_SINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x04&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCD_R16_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x05&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_SNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x06&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_UINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x07&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_SINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x08&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x09&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R32_UINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x0A&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R32_SINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x0B&lt;br /&gt;
| GX2_SURFACE_FORMAT_INVALID&lt;br /&gt;
|-&lt;br /&gt;
| 0x0C&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCS_R8_G8_B8_A8_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x0D&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCS_R8_G8_B8_A8_SRGB&lt;br /&gt;
|-&lt;br /&gt;
| 0x0E&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_G16_B16_A16_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x0F&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R32_G32_B32_A32_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCD_R16_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x11&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCD_R16_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x12&lt;br /&gt;
| GX2_SURFACE_FORMAT_D_D24_S8_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x13&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCD_R32_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC1_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x15&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC1_SRGB&lt;br /&gt;
|-&lt;br /&gt;
| 0x16&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC2_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x17&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC2_SRGB&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC3_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x19&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC3_SRGB&lt;br /&gt;
|-&lt;br /&gt;
| 0x1A&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC4_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x1B&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC4_SNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC5_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x1D&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC5_SNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x1E&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R11_G11_B10_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x1F&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCD_R32_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_G16_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x21&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R8_G8_UNORM&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Texture Filter ===&lt;br /&gt;
&lt;br /&gt;
Invalid values default to 1 (linear).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! ID&lt;br /&gt;
! GX2TexMipFilterType&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| GX2_TEX_MIP_FILTER_POINT&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| GX2_TEX_MIP_FILTER_LINEAR&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Texture Wrap ===&lt;br /&gt;
&lt;br /&gt;
Invalid values default to 0 (clamp).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! ID&lt;br /&gt;
! GX2TexClamp&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| GX2_TEX_CLAMP_CLAMP&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| GX2_TEX_CLAMP_WRAP&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| GX2_TEX_CLAMP_MIRROR&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| GX2_TEX_CLAMP_MIRROR_ONCE&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== PAK Metadata ==&lt;br /&gt;
&lt;br /&gt;
The pak metadata for the TXTR format primarily contains compression-related information and provides the values required to decompress it.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''GPU Section Offset'''&lt;br /&gt;
| Relative to the start of the file&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''GPU Data Start'''&lt;br /&gt;
| This is the offset to the start of the GPU data, immediately after the GPU section header.&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''GPU Section Size'''&lt;br /&gt;
| Matches the size from the GPU section header.&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Compressed Buffer Count'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| [[#Compressed Buffer|Compressed Buffer]]&lt;br /&gt;
| ''Compressed Buffer Count''&lt;br /&gt;
| '''Compressed Buffer Array'''&lt;br /&gt;
| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Compressed Buffer ===&lt;br /&gt;
&lt;br /&gt;
This is a small struct that defines a compressed data buffer within the GPU section.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| u32&lt;br /&gt;
| '''Decompressed Size'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| u32&lt;br /&gt;
| '''Compressed Size'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| u32&lt;br /&gt;
| '''Offset'''&lt;br /&gt;
| Relative to after the GPU section header&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:File Formats]]&lt;br /&gt;
[[Category:Donkey Kong Country: Tropical Freeze]]&lt;/div&gt;</summary>
		<author><name>Aruki</name></author>	</entry>

	<entry>
		<id>http://www.metroid2002.com/retromodding/index.php?title=TXTR_(Tropical_Freeze)&amp;diff=1914</id>
		<title>TXTR (Tropical Freeze)</title>
		<link rel="alternate" type="text/html" href="http://www.metroid2002.com/retromodding/index.php?title=TXTR_(Tropical_Freeze)&amp;diff=1914"/>
				<updated>2017-12-15T08:09:22Z</updated>
		
		<summary type="html">&lt;p&gt;Aruki: /* Format */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''See [[TXTR (File Format)]] for the other revisions of this format.''&lt;br /&gt;
&lt;br /&gt;
The '''TXTR''' format is Tropical Freeze's texture format. The image data in the GPU buffer is compressed using [[LZSS Compression|LZSS compression]].&lt;br /&gt;
&lt;br /&gt;
{{research|moderate|There are a couple unknowns in the header. It would also be good to have some documentation on how to deswizzle/decompress different texture formats.}}&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Format ==&lt;br /&gt;
&lt;br /&gt;
The format starts with the typical [[Form Descriptor (Tropical Freeze)|form descriptor]] found in every Tropical Freeze format. Following that, there's a HEAD header section that contains most of the texture parameters, then the GPU section containing the actual compressed image data. This is the structure of the HEAD section:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! style=&amp;quot;width:110px;&amp;quot;|Type&lt;br /&gt;
! style=&amp;quot;width:100px;&amp;quot;|Count&lt;br /&gt;
! style=&amp;quot;width:170px;&amp;quot;|Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| [[Chunk Descriptor (Tropical Freeze)|Chunk Descriptor]]&lt;br /&gt;
| 1&lt;br /&gt;
| '''HEAD Chunk Descriptor'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Type|'''Texture Type''']]&lt;br /&gt;
| Describes the type/dimensionality of the texture (2D texture, 3D texture, cubemap, array of 2D images, etc).&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Format|'''Texture Format''']]&lt;br /&gt;
| Describes the format that the image data is encoded in.&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Width'''&lt;br /&gt;
| Texture X resolution.&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Height'''&lt;br /&gt;
| Texture Y resolution.&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Depth'''&lt;br /&gt;
| Texture Z resolution.&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Tile Mode'''&lt;br /&gt;
| Indicates how the texture image data is tiled.&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Swizzle'''&lt;br /&gt;
| Indicates how the texture image data is swizzled.&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Mipmap Count'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| u32&lt;br /&gt;
| ''Mipmap Count''&lt;br /&gt;
| '''Mipmap Sizes'''&lt;br /&gt;
| The size of the base level mipmap is calculated with padding and alignment taken into account. The size of subsequent mipmaps is calculated as Width*Height*Depth*BPP/8. This does '''not''' take padding and alignment into account so it cannot be used to accurately locate and read mipmap data in the file. The offset and size needs to be calculated from the other parameters in the header. The game calculates this data by calling GX2CalcSurfaceSizeAndAlignment.&lt;br /&gt;
|-&lt;br /&gt;
| {{none}}&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| This parameter is part of NTextureFormat::STextureSamplerData (along with the next 4 parameters)&lt;br /&gt;
|-&lt;br /&gt;
| {{none}}&lt;br /&gt;
| u8&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Filter|'''Texture Filter''']]&lt;br /&gt;
| Determines how the texture is filtered when sampled.&lt;br /&gt;
|-&lt;br /&gt;
| {{none}}&lt;br /&gt;
| u8&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Wrap|'''Texture Wrap X''']]&lt;br /&gt;
| Determines how the texture wraps on the X coordinate.&lt;br /&gt;
|-&lt;br /&gt;
| {{none}}&lt;br /&gt;
| u8&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Wrap|'''Texture Wrap Y''']]&lt;br /&gt;
| Determines how the texture wraps on the Y coordinate.&lt;br /&gt;
|-&lt;br /&gt;
| {{none}}&lt;br /&gt;
| u8&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Wrap|'''Texture Wrap Z''']]&lt;br /&gt;
| Determines how the texture wraps on the Z coordinate.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Texture Type ===&lt;br /&gt;
&lt;br /&gt;
This enum basically maps directly to a GX2SurfaceDim enum.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! ID&lt;br /&gt;
! GX2SurfaceDim&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| GX2_SURFACE_DIM_1D&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| GX2_SURFACE_DIM_2D&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| GX2_SURFACE_DIM_3D&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| GX2_SURFACE_DIM_CUBE&lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| GX2_SURFACE_DIM_1D_ARRAY&lt;br /&gt;
|-&lt;br /&gt;
| 5&lt;br /&gt;
| GX2_SURFACE_DIM_2D_ARRAY&lt;br /&gt;
|-&lt;br /&gt;
| 6&lt;br /&gt;
| GX2_SURFACE_DIM_2D_MSAA&lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| GX2_SURFACE_DIM_2D_MSAA_ARRAY&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Texture Format ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! ID&lt;br /&gt;
! GX2SurfaceFormat&lt;br /&gt;
|-&lt;br /&gt;
| 0x00&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R8_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x01&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R8_SNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x02&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R8_UINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x03&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R8_SINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x04&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCD_R16_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x05&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_SNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x06&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_UINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x07&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_SINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x08&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x09&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R32_UINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x0A&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R32_SINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x0B&lt;br /&gt;
| GX2_SURFACE_FORMAT_INVALID&lt;br /&gt;
|-&lt;br /&gt;
| 0x0C&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCS_R8_G8_B8_A8_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x0D&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCS_R8_G8_B8_A8_SRGB&lt;br /&gt;
|-&lt;br /&gt;
| 0x0E&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_G16_B16_A16_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x0F&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R32_G32_B32_A32_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCD_R16_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x11&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCD_R16_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x12&lt;br /&gt;
| GX2_SURFACE_FORMAT_D_D24_S8_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x13&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCD_R32_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC1_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x15&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC1_SRGB&lt;br /&gt;
|-&lt;br /&gt;
| 0x16&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC2_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x17&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC2_SRGB&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC3_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x19&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC3_SRGB&lt;br /&gt;
|-&lt;br /&gt;
| 0x1A&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC4_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x1B&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC4_SNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC5_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x1D&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC5_SNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x1E&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R11_G11_B10_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x1F&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCD_R32_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_G16_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x21&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R8_G8_UNORM&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Texture Filter ===&lt;br /&gt;
&lt;br /&gt;
Invalid values default to 1 (linear).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! ID&lt;br /&gt;
! GX2TexMipFilterType&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| GX2_TEX_MIP_FILTER_POINT&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| GX2_TEX_MIP_FILTER_LINEAR&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Texture Wrap ===&lt;br /&gt;
&lt;br /&gt;
Invalid values default to 0 (clamp).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! ID&lt;br /&gt;
! GX2TexClamp&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| GX2_TEX_CLAMP_CLAMP&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| GX2_TEX_CLAMP_WRAP&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| GX2_TEX_CLAMP_MIRROR&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| GX2_TEX_CLAMP_MIRROR_ONCE&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== PAK Metadata ==&lt;br /&gt;
&lt;br /&gt;
The pak metadata for the TXTR format primarily contains compression-related information and provides the values required to decompress it.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''GPU Section Offset'''&lt;br /&gt;
| Relative to the start of the file&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''GPU Data Start'''&lt;br /&gt;
| This is the offset to the start of the GPU data, immediately after the GPU section header.&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''GPU Section Size'''&lt;br /&gt;
| Matches the size from the GPU section header.&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Compressed Buffer Count'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| [[#Compressed Buffer|Compressed Buffer]]&lt;br /&gt;
| ''Compressed Buffer Count''&lt;br /&gt;
| '''Compressed Buffer Array'''&lt;br /&gt;
| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Compressed Buffer ===&lt;br /&gt;
&lt;br /&gt;
This is a small struct that defines a compressed data buffer within the GPU section.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| u32&lt;br /&gt;
| '''Decompressed Size'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| u32&lt;br /&gt;
| '''Compressed Size'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| u32&lt;br /&gt;
| '''Offset'''&lt;br /&gt;
| Relative to after the GPU section header&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:File Formats]]&lt;br /&gt;
[[Category:Donkey Kong Country: Tropical Freeze]]&lt;/div&gt;</summary>
		<author><name>Aruki</name></author>	</entry>

	<entry>
		<id>http://www.metroid2002.com/retromodding/index.php?title=TXTR_(Tropical_Freeze)&amp;diff=1913</id>
		<title>TXTR (Tropical Freeze)</title>
		<link rel="alternate" type="text/html" href="http://www.metroid2002.com/retromodding/index.php?title=TXTR_(Tropical_Freeze)&amp;diff=1913"/>
				<updated>2017-12-14T21:21:22Z</updated>
		
		<summary type="html">&lt;p&gt;Aruki: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''See [[TXTR (File Format)]] for the other revisions of this format.''&lt;br /&gt;
&lt;br /&gt;
The '''TXTR''' format is Tropical Freeze's texture format. The image data in the GPU buffer is compressed using [[LZSS Compression|LZSS compression]].&lt;br /&gt;
&lt;br /&gt;
{{research|moderate|There are a couple unknowns in the header. It would also be good to have some documentation on how to deswizzle/decompress different texture formats.}}&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Format ==&lt;br /&gt;
&lt;br /&gt;
The format starts with the typical [[Form Descriptor (Tropical Freeze)|form descriptor]] found in every Tropical Freeze format. Following that, there's a HEAD header section that contains most of the texture parameters, then the GPU section containing the actual compressed image data. This is the structure of the HEAD section:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| [[Chunk Descriptor (Tropical Freeze)|Chunk Descriptor]]&lt;br /&gt;
| 1&lt;br /&gt;
| '''HEAD Chunk Descriptor'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Type|'''Texture Type''']]&lt;br /&gt;
| Describes the type/dimensionality of the texture (2D texture, 3D texture, cubemap, array of 2D images, etc).&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Format|'''Texture Format''']]&lt;br /&gt;
| Describes the format that the image data is encoded in.&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Width'''&lt;br /&gt;
| Texture X resolution.&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Height'''&lt;br /&gt;
| Texture Y resolution.&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Depth'''&lt;br /&gt;
| Texture Z resolution.&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Tile Mode'''&lt;br /&gt;
| Indicates how the texture image data is tiled.&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Swizzle'''&lt;br /&gt;
| Indicates how the texture image data is swizzled.&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Mipmap Count'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| u32&lt;br /&gt;
| ''Mipmap Count''&lt;br /&gt;
| '''Mipmap Sizes'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| {{none}}&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| This parameter is part of NTextureFormat::STextureSamplerData (along with the next 4 parameters)&lt;br /&gt;
|-&lt;br /&gt;
| {{none}}&lt;br /&gt;
| u8&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Filter|'''Texture Filter''']]&lt;br /&gt;
| Determines how the texture is filtered when sampled.&lt;br /&gt;
|-&lt;br /&gt;
| {{none}}&lt;br /&gt;
| u8&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Wrap|'''Texture Wrap X''']]&lt;br /&gt;
| Determines how the texture wraps on the X coordinate.&lt;br /&gt;
|-&lt;br /&gt;
| {{none}}&lt;br /&gt;
| u8&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Wrap|'''Texture Wrap Y''']]&lt;br /&gt;
| Determines how the texture wraps on the Y coordinate.&lt;br /&gt;
|-&lt;br /&gt;
| {{none}}&lt;br /&gt;
| u8&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Wrap|'''Texture Wrap Z''']]&lt;br /&gt;
| Determines how the texture wraps on the Z coordinate.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Texture Type ===&lt;br /&gt;
&lt;br /&gt;
This enum basically maps directly to a GX2SurfaceDim enum.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! ID&lt;br /&gt;
! GX2SurfaceDim&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| GX2_SURFACE_DIM_1D&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| GX2_SURFACE_DIM_2D&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| GX2_SURFACE_DIM_3D&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| GX2_SURFACE_DIM_CUBE&lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| GX2_SURFACE_DIM_1D_ARRAY&lt;br /&gt;
|-&lt;br /&gt;
| 5&lt;br /&gt;
| GX2_SURFACE_DIM_2D_ARRAY&lt;br /&gt;
|-&lt;br /&gt;
| 6&lt;br /&gt;
| GX2_SURFACE_DIM_2D_MSAA&lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| GX2_SURFACE_DIM_2D_MSAA_ARRAY&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Texture Format ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! ID&lt;br /&gt;
! GX2SurfaceFormat&lt;br /&gt;
|-&lt;br /&gt;
| 0x00&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R8_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x01&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R8_SNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x02&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R8_UINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x03&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R8_SINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x04&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCD_R16_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x05&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_SNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x06&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_UINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x07&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_SINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x08&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x09&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R32_UINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x0A&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R32_SINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x0B&lt;br /&gt;
| GX2_SURFACE_FORMAT_INVALID&lt;br /&gt;
|-&lt;br /&gt;
| 0x0C&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCS_R8_G8_B8_A8_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x0D&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCS_R8_G8_B8_A8_SRGB&lt;br /&gt;
|-&lt;br /&gt;
| 0x0E&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_G16_B16_A16_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x0F&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R32_G32_B32_A32_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCD_R16_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x11&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCD_R16_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x12&lt;br /&gt;
| GX2_SURFACE_FORMAT_D_D24_S8_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x13&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCD_R32_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC1_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x15&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC1_SRGB&lt;br /&gt;
|-&lt;br /&gt;
| 0x16&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC2_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x17&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC2_SRGB&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC3_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x19&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC3_SRGB&lt;br /&gt;
|-&lt;br /&gt;
| 0x1A&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC4_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x1B&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC4_SNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC5_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x1D&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC5_SNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x1E&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R11_G11_B10_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x1F&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCD_R32_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_G16_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x21&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R8_G8_UNORM&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Texture Filter ===&lt;br /&gt;
&lt;br /&gt;
Invalid values default to 1 (linear).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! ID&lt;br /&gt;
! GX2TexMipFilterType&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| GX2_TEX_MIP_FILTER_POINT&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| GX2_TEX_MIP_FILTER_LINEAR&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Texture Wrap ===&lt;br /&gt;
&lt;br /&gt;
Invalid values default to 0 (clamp).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! ID&lt;br /&gt;
! GX2TexClamp&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| GX2_TEX_CLAMP_CLAMP&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| GX2_TEX_CLAMP_WRAP&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| GX2_TEX_CLAMP_MIRROR&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| GX2_TEX_CLAMP_MIRROR_ONCE&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== PAK Metadata ==&lt;br /&gt;
&lt;br /&gt;
The pak metadata for the TXTR format primarily contains compression-related information and provides the values required to decompress it.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''GPU Section Offset'''&lt;br /&gt;
| Relative to the start of the file&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''GPU Data Start'''&lt;br /&gt;
| This is the offset to the start of the GPU data, immediately after the GPU section header.&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''GPU Section Size'''&lt;br /&gt;
| Matches the size from the GPU section header.&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Compressed Buffer Count'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| [[#Compressed Buffer|Compressed Buffer]]&lt;br /&gt;
| ''Compressed Buffer Count''&lt;br /&gt;
| '''Compressed Buffer Array'''&lt;br /&gt;
| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Compressed Buffer ===&lt;br /&gt;
&lt;br /&gt;
This is a small struct that defines a compressed data buffer within the GPU section.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| u32&lt;br /&gt;
| '''Decompressed Size'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| u32&lt;br /&gt;
| '''Compressed Size'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| u32&lt;br /&gt;
| '''Offset'''&lt;br /&gt;
| Relative to after the GPU section header&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:File Formats]]&lt;br /&gt;
[[Category:Donkey Kong Country: Tropical Freeze]]&lt;/div&gt;</summary>
		<author><name>Aruki</name></author>	</entry>

	<entry>
		<id>http://www.metroid2002.com/retromodding/index.php?title=TXTR_(Tropical_Freeze)&amp;diff=1912</id>
		<title>TXTR (Tropical Freeze)</title>
		<link rel="alternate" type="text/html" href="http://www.metroid2002.com/retromodding/index.php?title=TXTR_(Tropical_Freeze)&amp;diff=1912"/>
				<updated>2017-11-29T08:13:30Z</updated>
		
		<summary type="html">&lt;p&gt;Aruki: I'm like 90% sure this is accurate right now...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''See [[TXTR (File Format)]] for the other revisions of this format.''&lt;br /&gt;
&lt;br /&gt;
The '''TXTR''' format is Tropical Freeze's texture format. The image data in the GPU buffer is compressed using [[LZSS Compression|LZSS compression]].&lt;br /&gt;
&lt;br /&gt;
{{research|moderate|There are a couple unknowns in the header. It would also be good to have some documentation on how to deswizzle/decompress different texture formats.}}&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Format ==&lt;br /&gt;
&lt;br /&gt;
The format starts with the typical [[Form Descriptor (Tropical Freeze)|form descriptor]] found in every Tropical Freeze format. Following that, there's a HEAD header section that contains most of the texture parameters, then the GPU section containing the actual compressed image data. This is the structure of the HEAD section:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| [[Chunk Descriptor (Tropical Freeze)|Chunk Descriptor]]&lt;br /&gt;
| 1&lt;br /&gt;
| '''HEAD Chunk Descriptor'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Type|'''Texture Type''']]&lt;br /&gt;
| Describes the type/dimensionality of the texture (2D texture, 3D texture, cubemap, array of 2D images, etc).&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Format|'''Texture Format''']]&lt;br /&gt;
| Describes the format that the image data is encoded in.&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Width'''&lt;br /&gt;
| Texture X resolution.&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Height'''&lt;br /&gt;
| Texture Y resolution.&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Depth'''&lt;br /&gt;
| Texture Z resolution.&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Tile Mode'''&lt;br /&gt;
| Indicates how the texture image data is tiled.&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Swizzle'''&lt;br /&gt;
| Indicates how the texture image data is swizzled.&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Mipmap Count'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| u32&lt;br /&gt;
| ''Mipmap Count''&lt;br /&gt;
| {{unknown|Unknown array}}&lt;br /&gt;
| Appears to be mipmap sizes, but it doesn't match the size of the image data (unless there's 1)...&lt;br /&gt;
|-&lt;br /&gt;
| {{none}}&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| This parameter is part of NTextureFormat::STextureSamplerData (along with the next 4 parameters)&lt;br /&gt;
|-&lt;br /&gt;
| {{none}}&lt;br /&gt;
| u8&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Filter|'''Texture Filter''']]&lt;br /&gt;
| Determines how the texture is filtered when sampled.&lt;br /&gt;
|-&lt;br /&gt;
| {{none}}&lt;br /&gt;
| u8&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Wrap|'''Texture Wrap X''']]&lt;br /&gt;
| Determines how the texture wraps on the X coordinate.&lt;br /&gt;
|-&lt;br /&gt;
| {{none}}&lt;br /&gt;
| u8&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Wrap|'''Texture Wrap Y''']]&lt;br /&gt;
| Determines how the texture wraps on the Y coordinate.&lt;br /&gt;
|-&lt;br /&gt;
| {{none}}&lt;br /&gt;
| u8&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Wrap|'''Texture Wrap Z''']]&lt;br /&gt;
| Determines how the texture wraps on the Z coordinate.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Texture Type ===&lt;br /&gt;
&lt;br /&gt;
This enum basically maps directly to a GX2SurfaceDim enum.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! ID&lt;br /&gt;
! GX2SurfaceDim&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| GX2_SURFACE_DIM_1D&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| GX2_SURFACE_DIM_2D&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| GX2_SURFACE_DIM_3D&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| GX2_SURFACE_DIM_CUBE&lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| GX2_SURFACE_DIM_1D_ARRAY&lt;br /&gt;
|-&lt;br /&gt;
| 5&lt;br /&gt;
| GX2_SURFACE_DIM_2D_ARRAY&lt;br /&gt;
|-&lt;br /&gt;
| 6&lt;br /&gt;
| GX2_SURFACE_DIM_2D_MSAA&lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| GX2_SURFACE_DIM_2D_MSAA_ARRAY&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Texture Format ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! ID&lt;br /&gt;
! GX2SurfaceFormat&lt;br /&gt;
|-&lt;br /&gt;
| 0x00&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R8_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x01&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R8_SNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x02&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R8_UINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x03&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R8_SINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x04&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCD_R16_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x05&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_SNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x06&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_UINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x07&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_SINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x08&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x09&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R32_UINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x0A&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R32_SINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x0B&lt;br /&gt;
| GX2_SURFACE_FORMAT_INVALID&lt;br /&gt;
|-&lt;br /&gt;
| 0x0C&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCS_R8_G8_B8_A8_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x0D&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCS_R8_G8_B8_A8_SRGB&lt;br /&gt;
|-&lt;br /&gt;
| 0x0E&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_G16_B16_A16_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x0F&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R32_G32_B32_A32_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCD_R16_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x11&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCD_R16_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x12&lt;br /&gt;
| GX2_SURFACE_FORMAT_D_D24_S8_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x13&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCD_R32_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC1_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x15&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC1_SRGB&lt;br /&gt;
|-&lt;br /&gt;
| 0x16&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC2_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x17&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC2_SRGB&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC3_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x19&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC3_SRGB&lt;br /&gt;
|-&lt;br /&gt;
| 0x1A&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC4_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x1B&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC4_SNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC5_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x1D&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC5_SNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x1E&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R11_G11_B10_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x1F&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCD_R32_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_G16_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x21&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R8_G8_UNORM&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Texture Filter ===&lt;br /&gt;
&lt;br /&gt;
Invalid values default to 1 (linear).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! ID&lt;br /&gt;
! GX2TexMipFilterType&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| GX2_TEX_MIP_FILTER_POINT&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| GX2_TEX_MIP_FILTER_LINEAR&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Texture Wrap ===&lt;br /&gt;
&lt;br /&gt;
Invalid values default to 0 (clamp).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! ID&lt;br /&gt;
! GX2TexClamp&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| GX2_TEX_CLAMP_CLAMP&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| GX2_TEX_CLAMP_WRAP&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| GX2_TEX_CLAMP_MIRROR&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| GX2_TEX_CLAMP_MIRROR_ONCE&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== PAK Metadata ==&lt;br /&gt;
&lt;br /&gt;
The pak metadata for the TXTR format primarily contains compression-related information and provides the values required to decompress it.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''GPU Section Offset'''&lt;br /&gt;
| Relative to the start of the file&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''GPU Data Start'''&lt;br /&gt;
| This is the offset to the start of the GPU data, immediately after the GPU section header.&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''GPU Section Size'''&lt;br /&gt;
| Matches the size from the GPU section header.&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Compressed Buffer Count'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| [[#Compressed Buffer|Compressed Buffer]]&lt;br /&gt;
| ''Compressed Buffer Count''&lt;br /&gt;
| '''Compressed Buffer Array'''&lt;br /&gt;
| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Compressed Buffer ===&lt;br /&gt;
&lt;br /&gt;
This is a small struct that defines a compressed data buffer within the GPU section.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| u32&lt;br /&gt;
| '''Decompressed Size'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| u32&lt;br /&gt;
| '''Compressed Size'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| u32&lt;br /&gt;
| '''Offset'''&lt;br /&gt;
| Relative to after the GPU section header&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:File Formats]]&lt;br /&gt;
[[Category:Donkey Kong Country: Tropical Freeze]]&lt;/div&gt;</summary>
		<author><name>Aruki</name></author>	</entry>

	<entry>
		<id>http://www.metroid2002.com/retromodding/index.php?title=TXTR_(Tropical_Freeze)&amp;diff=1911</id>
		<title>TXTR (Tropical Freeze)</title>
		<link rel="alternate" type="text/html" href="http://www.metroid2002.com/retromodding/index.php?title=TXTR_(Tropical_Freeze)&amp;diff=1911"/>
				<updated>2017-11-27T06:17:24Z</updated>
		
		<summary type="html">&lt;p&gt;Aruki: /* Texture Type */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''See [[TXTR (File Format)]] for the other revisions of this format.''&lt;br /&gt;
&lt;br /&gt;
The '''TXTR''' format is Tropical Freeze's texture format. The image data in the GPU buffer is compressed using [[LZSS Compression|LZSS compression]].&lt;br /&gt;
&lt;br /&gt;
{{research|moderate|There are a couple unknowns in the header. It would also be good to have some documentation on how to deswizzle/decompress different texture formats.}}&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Format ==&lt;br /&gt;
&lt;br /&gt;
The format starts with the typical [[Form Descriptor (Tropical Freeze)|form descriptor]] found in every Tropical Freeze format. Following that, there's a HEAD header section that contains most of the texture parameters, then the GPU section containing the actual compressed image data. This is the structure of the HEAD section:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| [[Chunk Descriptor (Tropical Freeze)|Chunk Descriptor]]&lt;br /&gt;
| 1&lt;br /&gt;
| '''HEAD Chunk Descriptor'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Type|'''Texture Type''']]&lt;br /&gt;
| Describes the type/dimensionality of the texture (2D texture, 3D texture, cubemap, array of 2D images, etc).&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Format|'''Texture Format''']]&lt;br /&gt;
| Describes the format that the image data is encoded in.&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Width'''&lt;br /&gt;
| Texture X resolution.&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Height'''&lt;br /&gt;
| Texture Y resolution.&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Depth'''&lt;br /&gt;
| Texture Z resolution.&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Swizzle'''&lt;br /&gt;
| Indicates how the texture image data is swizzled.&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Mipmap Count'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| u32&lt;br /&gt;
| ''Mipmap Count''&lt;br /&gt;
| {{unknown|Unknown array}}&lt;br /&gt;
| Appears to be mipmap sizes, but it doesn't match the size of the image data (unless there's 1)...&lt;br /&gt;
|-&lt;br /&gt;
| {{none}}&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| This parameter is part of NTextureFormat::STextureSamplerData (along with the next 4 parameters)&lt;br /&gt;
|-&lt;br /&gt;
| {{none}}&lt;br /&gt;
| u8&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Filter|'''Texture Filter''']]&lt;br /&gt;
| Determines how the texture is filtered when sampled.&lt;br /&gt;
|-&lt;br /&gt;
| {{none}}&lt;br /&gt;
| u8&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Wrap|'''Texture Wrap X''']]&lt;br /&gt;
| Determines how the texture wraps on the X coordinate.&lt;br /&gt;
|-&lt;br /&gt;
| {{none}}&lt;br /&gt;
| u8&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Wrap|'''Texture Wrap Y''']]&lt;br /&gt;
| Determines how the texture wraps on the Y coordinate.&lt;br /&gt;
|-&lt;br /&gt;
| {{none}}&lt;br /&gt;
| u8&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Wrap|'''Texture Wrap Z''']]&lt;br /&gt;
| Determines how the texture wraps on the Z coordinate.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Texture Type ===&lt;br /&gt;
&lt;br /&gt;
This enum basically maps directly to a GX2SurfaceDim enum.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! ID&lt;br /&gt;
! GX2SurfaceDim&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| GX2_SURFACE_DIM_1D&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| GX2_SURFACE_DIM_2D&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| GX2_SURFACE_DIM_3D&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| GX2_SURFACE_DIM_CUBE&lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| GX2_SURFACE_DIM_1D_ARRAY&lt;br /&gt;
|-&lt;br /&gt;
| 5&lt;br /&gt;
| GX2_SURFACE_DIM_2D_ARRAY&lt;br /&gt;
|-&lt;br /&gt;
| 6&lt;br /&gt;
| GX2_SURFACE_DIM_2D_MSAA&lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| GX2_SURFACE_DIM_2D_MSAA_ARRAY&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Texture Format ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! ID&lt;br /&gt;
! GX2SurfaceFormat&lt;br /&gt;
|-&lt;br /&gt;
| 0x00&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R8_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x01&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R8_SNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x02&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R8_UINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x03&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R8_SINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x04&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCD_R16_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x05&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_SNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x06&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_UINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x07&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_SINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x08&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x09&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R32_UINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x0A&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R32_SINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x0B&lt;br /&gt;
| GX2_SURFACE_FORMAT_INVALID&lt;br /&gt;
|-&lt;br /&gt;
| 0x0C&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCS_R8_G8_B8_A8_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x0D&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCS_R8_G8_B8_A8_SRGB&lt;br /&gt;
|-&lt;br /&gt;
| 0x0E&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_G16_B16_A16_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x0F&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R32_G32_B32_A32_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCD_R16_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x11&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCD_R16_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x12&lt;br /&gt;
| GX2_SURFACE_FORMAT_D_D24_S8_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x13&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCD_R32_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC1_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x15&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC1_SRGB&lt;br /&gt;
|-&lt;br /&gt;
| 0x16&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC2_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x17&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC2_SRGB&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC3_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x19&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC3_SRGB&lt;br /&gt;
|-&lt;br /&gt;
| 0x1A&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC4_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x1B&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC4_SNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC5_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x1D&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC5_SNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x1E&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R11_G11_B10_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x1F&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCD_R32_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_G16_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x21&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R8_G8_UNORM&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Texture Filter ===&lt;br /&gt;
&lt;br /&gt;
Invalid values default to 1 (linear).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! ID&lt;br /&gt;
! GX2TexMipFilterType&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| GX2_TEX_MIP_FILTER_POINT&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| GX2_TEX_MIP_FILTER_LINEAR&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Texture Wrap ===&lt;br /&gt;
&lt;br /&gt;
Invalid values default to 0 (clamp).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! ID&lt;br /&gt;
! GX2TexClamp&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| GX2_TEX_CLAMP_CLAMP&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| GX2_TEX_CLAMP_WRAP&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| GX2_TEX_CLAMP_MIRROR&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| GX2_TEX_CLAMP_MIRROR_ONCE&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== PAK Metadata ==&lt;br /&gt;
&lt;br /&gt;
The pak metadata for the TXTR format primarily contains compression-related information and provides the values required to decompress it.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''GPU Section Offset'''&lt;br /&gt;
| Relative to the start of the file&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''GPU Data Start'''&lt;br /&gt;
| This is the offset to the start of the GPU data, immediately after the GPU section header.&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''GPU Section Size'''&lt;br /&gt;
| Matches the size from the GPU section header.&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Compressed Buffer Count'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| [[#Compressed Buffer|Compressed Buffer]]&lt;br /&gt;
| ''Compressed Buffer Count''&lt;br /&gt;
| '''Compressed Buffer Array'''&lt;br /&gt;
| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Compressed Buffer ===&lt;br /&gt;
&lt;br /&gt;
This is a small struct that defines a compressed data buffer within the GPU section.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| u32&lt;br /&gt;
| '''Decompressed Size'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| u32&lt;br /&gt;
| '''Compressed Size'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| u32&lt;br /&gt;
| '''Offset'''&lt;br /&gt;
| Relative to after the GPU section header&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:File Formats]]&lt;br /&gt;
[[Category:Donkey Kong Country: Tropical Freeze]]&lt;/div&gt;</summary>
		<author><name>Aruki</name></author>	</entry>

	<entry>
		<id>http://www.metroid2002.com/retromodding/index.php?title=TXTR_(Tropical_Freeze)&amp;diff=1910</id>
		<title>TXTR (Tropical Freeze)</title>
		<link rel="alternate" type="text/html" href="http://www.metroid2002.com/retromodding/index.php?title=TXTR_(Tropical_Freeze)&amp;diff=1910"/>
				<updated>2017-11-26T21:23:35Z</updated>
		
		<summary type="html">&lt;p&gt;Aruki: /* Format */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''See [[TXTR (File Format)]] for the other revisions of this format.''&lt;br /&gt;
&lt;br /&gt;
The '''TXTR''' format is Tropical Freeze's texture format. The image data in the GPU buffer is compressed using [[LZSS Compression|LZSS compression]].&lt;br /&gt;
&lt;br /&gt;
{{research|moderate|There are a couple unknowns in the header. It would also be good to have some documentation on how to deswizzle/decompress different texture formats.}}&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Format ==&lt;br /&gt;
&lt;br /&gt;
The format starts with the typical [[Form Descriptor (Tropical Freeze)|form descriptor]] found in every Tropical Freeze format. Following that, there's a HEAD header section that contains most of the texture parameters, then the GPU section containing the actual compressed image data. This is the structure of the HEAD section:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| [[Chunk Descriptor (Tropical Freeze)|Chunk Descriptor]]&lt;br /&gt;
| 1&lt;br /&gt;
| '''HEAD Chunk Descriptor'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Type|'''Texture Type''']]&lt;br /&gt;
| Describes the type/dimensionality of the texture (2D texture, 3D texture, cubemap, array of 2D images, etc).&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Format|'''Texture Format''']]&lt;br /&gt;
| Describes the format that the image data is encoded in.&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Width'''&lt;br /&gt;
| Texture X resolution.&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Height'''&lt;br /&gt;
| Texture Y resolution.&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Depth'''&lt;br /&gt;
| Texture Z resolution.&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Swizzle'''&lt;br /&gt;
| Indicates how the texture image data is swizzled.&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Mipmap Count'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| u32&lt;br /&gt;
| ''Mipmap Count''&lt;br /&gt;
| {{unknown|Unknown array}}&lt;br /&gt;
| Appears to be mipmap sizes, but it doesn't match the size of the image data (unless there's 1)...&lt;br /&gt;
|-&lt;br /&gt;
| {{none}}&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| This parameter is part of NTextureFormat::STextureSamplerData (along with the next 4 parameters)&lt;br /&gt;
|-&lt;br /&gt;
| {{none}}&lt;br /&gt;
| u8&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Filter|'''Texture Filter''']]&lt;br /&gt;
| Determines how the texture is filtered when sampled.&lt;br /&gt;
|-&lt;br /&gt;
| {{none}}&lt;br /&gt;
| u8&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Wrap|'''Texture Wrap X''']]&lt;br /&gt;
| Determines how the texture wraps on the X coordinate.&lt;br /&gt;
|-&lt;br /&gt;
| {{none}}&lt;br /&gt;
| u8&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Wrap|'''Texture Wrap Y''']]&lt;br /&gt;
| Determines how the texture wraps on the Y coordinate.&lt;br /&gt;
|-&lt;br /&gt;
| {{none}}&lt;br /&gt;
| u8&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Wrap|'''Texture Wrap Z''']]&lt;br /&gt;
| Determines how the texture wraps on the Z coordinate.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Texture Type ===&lt;br /&gt;
&lt;br /&gt;
This enum basically maps directly to a GX2SurfaceDim enum.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! ID&lt;br /&gt;
! GX2SurfaceType&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| GX2_SURFACE_DIM_1D&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| GX2_SURFACE_DIM_2D&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| GX2_SURFACE_DIM_3D&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| GX2_SURFACE_DIM_CUBE&lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| GX2_SURFACE_DIM_1D_ARRAY&lt;br /&gt;
|-&lt;br /&gt;
| 5&lt;br /&gt;
| GX2_SURFACE_DIM_2D_ARRAY&lt;br /&gt;
|-&lt;br /&gt;
| 6&lt;br /&gt;
| GX2_SURFACE_DIM_2D_MSAA&lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| GX2_SURFACE_DIM_2D_MSAA_ARRAY&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Texture Format ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! ID&lt;br /&gt;
! GX2SurfaceFormat&lt;br /&gt;
|-&lt;br /&gt;
| 0x00&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R8_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x01&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R8_SNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x02&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R8_UINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x03&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R8_SINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x04&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCD_R16_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x05&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_SNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x06&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_UINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x07&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_SINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x08&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x09&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R32_UINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x0A&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R32_SINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x0B&lt;br /&gt;
| GX2_SURFACE_FORMAT_INVALID&lt;br /&gt;
|-&lt;br /&gt;
| 0x0C&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCS_R8_G8_B8_A8_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x0D&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCS_R8_G8_B8_A8_SRGB&lt;br /&gt;
|-&lt;br /&gt;
| 0x0E&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_G16_B16_A16_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x0F&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R32_G32_B32_A32_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCD_R16_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x11&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCD_R16_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x12&lt;br /&gt;
| GX2_SURFACE_FORMAT_D_D24_S8_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x13&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCD_R32_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC1_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x15&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC1_SRGB&lt;br /&gt;
|-&lt;br /&gt;
| 0x16&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC2_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x17&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC2_SRGB&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC3_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x19&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC3_SRGB&lt;br /&gt;
|-&lt;br /&gt;
| 0x1A&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC4_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x1B&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC4_SNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC5_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x1D&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC5_SNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x1E&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R11_G11_B10_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x1F&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCD_R32_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_G16_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x21&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R8_G8_UNORM&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Texture Filter ===&lt;br /&gt;
&lt;br /&gt;
Invalid values default to 1 (linear).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! ID&lt;br /&gt;
! GX2TexMipFilterType&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| GX2_TEX_MIP_FILTER_POINT&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| GX2_TEX_MIP_FILTER_LINEAR&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Texture Wrap ===&lt;br /&gt;
&lt;br /&gt;
Invalid values default to 0 (clamp).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! ID&lt;br /&gt;
! GX2TexClamp&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| GX2_TEX_CLAMP_CLAMP&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| GX2_TEX_CLAMP_WRAP&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| GX2_TEX_CLAMP_MIRROR&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| GX2_TEX_CLAMP_MIRROR_ONCE&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== PAK Metadata ==&lt;br /&gt;
&lt;br /&gt;
The pak metadata for the TXTR format primarily contains compression-related information and provides the values required to decompress it.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''GPU Section Offset'''&lt;br /&gt;
| Relative to the start of the file&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''GPU Data Start'''&lt;br /&gt;
| This is the offset to the start of the GPU data, immediately after the GPU section header.&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''GPU Section Size'''&lt;br /&gt;
| Matches the size from the GPU section header.&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Compressed Buffer Count'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| [[#Compressed Buffer|Compressed Buffer]]&lt;br /&gt;
| ''Compressed Buffer Count''&lt;br /&gt;
| '''Compressed Buffer Array'''&lt;br /&gt;
| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Compressed Buffer ===&lt;br /&gt;
&lt;br /&gt;
This is a small struct that defines a compressed data buffer within the GPU section.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| u32&lt;br /&gt;
| '''Decompressed Size'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| u32&lt;br /&gt;
| '''Compressed Size'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| u32&lt;br /&gt;
| '''Offset'''&lt;br /&gt;
| Relative to after the GPU section header&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:File Formats]]&lt;br /&gt;
[[Category:Donkey Kong Country: Tropical Freeze]]&lt;/div&gt;</summary>
		<author><name>Aruki</name></author>	</entry>

	<entry>
		<id>http://www.metroid2002.com/retromodding/index.php?title=TXTR_(Tropical_Freeze)&amp;diff=1909</id>
		<title>TXTR (Tropical Freeze)</title>
		<link rel="alternate" type="text/html" href="http://www.metroid2002.com/retromodding/index.php?title=TXTR_(Tropical_Freeze)&amp;diff=1909"/>
				<updated>2017-11-26T17:00:34Z</updated>
		
		<summary type="html">&lt;p&gt;Aruki: /* Format */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''See [[TXTR (File Format)]] for the other revisions of this format.''&lt;br /&gt;
&lt;br /&gt;
The '''TXTR''' format is Tropical Freeze's texture format. The image data in the GPU buffer is compressed using [[LZSS Compression|LZSS compression]].&lt;br /&gt;
&lt;br /&gt;
{{research|moderate|There are a couple unknowns in the header. It would also be good to have some documentation on how to deswizzle/decompress different texture formats.}}&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Format ==&lt;br /&gt;
&lt;br /&gt;
The format starts with the typical [[Form Descriptor (Tropical Freeze)|form descriptor]] found in every Tropical Freeze format. Following that, there's a HEAD header section that contains most of the texture parameters, then the GPU section containing the actual compressed image data. This is the structure of the HEAD section:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| [[Chunk Descriptor (Tropical Freeze)|Chunk Descriptor]]&lt;br /&gt;
| 1&lt;br /&gt;
| '''HEAD Chunk Descriptor'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Type|'''Texture Type''']]&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Format|'''Texture Format''']]&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Width'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Height'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Depth'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Swizzle'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Mipmap Count'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| u32&lt;br /&gt;
| ''Mipmap Count''&lt;br /&gt;
| {{unknown|Unknown array}}&lt;br /&gt;
| Appears to be mipmap sizes, but it doesn't match the size of the image data (unless there's 1)...&lt;br /&gt;
|-&lt;br /&gt;
| {{none}}&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| This parameter is part of NTextureFormat::STextureSamplerData (along with the next 4 parameters)&lt;br /&gt;
|-&lt;br /&gt;
| {{none}}&lt;br /&gt;
| u8&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Filter|'''Texture Filter''']]&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| {{none}}&lt;br /&gt;
| u8&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Wrap|'''Texture Wrap X''']]&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| {{none}}&lt;br /&gt;
| u8&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Wrap|'''Texture Wrap Y''']]&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| {{none}}&lt;br /&gt;
| u8&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Wrap|'''Texture Wrap Z''']]&lt;br /&gt;
| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Texture Type ===&lt;br /&gt;
&lt;br /&gt;
This enum basically maps directly to a GX2SurfaceDim enum.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! ID&lt;br /&gt;
! GX2SurfaceType&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| GX2_SURFACE_DIM_1D&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| GX2_SURFACE_DIM_2D&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| GX2_SURFACE_DIM_3D&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| GX2_SURFACE_DIM_CUBE&lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| GX2_SURFACE_DIM_1D_ARRAY&lt;br /&gt;
|-&lt;br /&gt;
| 5&lt;br /&gt;
| GX2_SURFACE_DIM_2D_ARRAY&lt;br /&gt;
|-&lt;br /&gt;
| 6&lt;br /&gt;
| GX2_SURFACE_DIM_2D_MSAA&lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| GX2_SURFACE_DIM_2D_MSAA_ARRAY&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Texture Format ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! ID&lt;br /&gt;
! GX2SurfaceFormat&lt;br /&gt;
|-&lt;br /&gt;
| 0x00&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R8_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x01&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R8_SNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x02&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R8_UINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x03&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R8_SINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x04&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCD_R16_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x05&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_SNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x06&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_UINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x07&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_SINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x08&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x09&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R32_UINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x0A&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R32_SINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x0B&lt;br /&gt;
| GX2_SURFACE_FORMAT_INVALID&lt;br /&gt;
|-&lt;br /&gt;
| 0x0C&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCS_R8_G8_B8_A8_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x0D&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCS_R8_G8_B8_A8_SRGB&lt;br /&gt;
|-&lt;br /&gt;
| 0x0E&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_G16_B16_A16_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x0F&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R32_G32_B32_A32_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCD_R16_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x11&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCD_R16_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x12&lt;br /&gt;
| GX2_SURFACE_FORMAT_D_D24_S8_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x13&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCD_R32_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC1_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x15&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC1_SRGB&lt;br /&gt;
|-&lt;br /&gt;
| 0x16&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC2_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x17&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC2_SRGB&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC3_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x19&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC3_SRGB&lt;br /&gt;
|-&lt;br /&gt;
| 0x1A&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC4_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x1B&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC4_SNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC5_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x1D&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC5_SNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x1E&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R11_G11_B10_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x1F&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCD_R32_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_G16_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x21&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R8_G8_UNORM&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Texture Filter ===&lt;br /&gt;
&lt;br /&gt;
Invalid values default to 1 (linear).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! ID&lt;br /&gt;
! GX2TexMipFilterType&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| GX2_TEX_MIP_FILTER_POINT&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| GX2_TEX_MIP_FILTER_LINEAR&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Texture Wrap ===&lt;br /&gt;
&lt;br /&gt;
Invalid values default to 0 (clamp).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! ID&lt;br /&gt;
! GX2TexClamp&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| GX2_TEX_CLAMP_CLAMP&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| GX2_TEX_CLAMP_WRAP&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| GX2_TEX_CLAMP_MIRROR&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| GX2_TEX_CLAMP_MIRROR_ONCE&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== PAK Metadata ==&lt;br /&gt;
&lt;br /&gt;
The pak metadata for the TXTR format primarily contains compression-related information and provides the values required to decompress it.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''GPU Section Offset'''&lt;br /&gt;
| Relative to the start of the file&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''GPU Data Start'''&lt;br /&gt;
| This is the offset to the start of the GPU data, immediately after the GPU section header.&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''GPU Section Size'''&lt;br /&gt;
| Matches the size from the GPU section header.&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Compressed Buffer Count'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| [[#Compressed Buffer|Compressed Buffer]]&lt;br /&gt;
| ''Compressed Buffer Count''&lt;br /&gt;
| '''Compressed Buffer Array'''&lt;br /&gt;
| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Compressed Buffer ===&lt;br /&gt;
&lt;br /&gt;
This is a small struct that defines a compressed data buffer within the GPU section.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| u32&lt;br /&gt;
| '''Decompressed Size'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| u32&lt;br /&gt;
| '''Compressed Size'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| u32&lt;br /&gt;
| '''Offset'''&lt;br /&gt;
| Relative to after the GPU section header&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:File Formats]]&lt;br /&gt;
[[Category:Donkey Kong Country: Tropical Freeze]]&lt;/div&gt;</summary>
		<author><name>Aruki</name></author>	</entry>

	<entry>
		<id>http://www.metroid2002.com/retromodding/index.php?title=TXTR_(Tropical_Freeze)&amp;diff=1908</id>
		<title>TXTR (Tropical Freeze)</title>
		<link rel="alternate" type="text/html" href="http://www.metroid2002.com/retromodding/index.php?title=TXTR_(Tropical_Freeze)&amp;diff=1908"/>
				<updated>2017-11-26T16:55:31Z</updated>
		
		<summary type="html">&lt;p&gt;Aruki: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''See [[TXTR (File Format)]] for the other revisions of this format.''&lt;br /&gt;
&lt;br /&gt;
The '''TXTR''' format is Tropical Freeze's texture format. The image data in the GPU buffer is compressed using [[LZSS Compression|LZSS compression]].&lt;br /&gt;
&lt;br /&gt;
{{research|moderate|There are a couple unknowns in the header. It would also be good to have some documentation on how to deswizzle/decompress different texture formats.}}&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Format ==&lt;br /&gt;
&lt;br /&gt;
The format starts with the typical [[Form Descriptor (Tropical Freeze)|form descriptor]] found in every Tropical Freeze format. Following that, there's a HEAD header section that contains most of the texture parameters, then the GPU section containing the actual compressed image data. This is the structure of the HEAD section:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| [[Chunk Descriptor (Tropical Freeze)|Chunk Descriptor]]&lt;br /&gt;
| 1&lt;br /&gt;
| '''HEAD Chunk Descriptor'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Type|'''Texture Type''']]&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Format|'''Texture Format''']]&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Width'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Height'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Depth'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Swizzle'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Mipmap Count'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| u32&lt;br /&gt;
| ''Mipmap Count''&lt;br /&gt;
| {{unknown|Unknown array}}&lt;br /&gt;
| Appears to be mipmap sizes, but it doesn't match the size of the image data (unless there's 1)...&lt;br /&gt;
|-&lt;br /&gt;
| {{none}}&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| This parameter is part of NTextureFormat::STextureSamplerData (along with the next 4 parameters)&lt;br /&gt;
|-&lt;br /&gt;
| {{none}}&lt;br /&gt;
| u8&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Filter|'''Texture Filter''']]&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| {{none}}&lt;br /&gt;
| u8&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Wrap|'''Texture Wraps X''']]&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| {{none}}&lt;br /&gt;
| u8&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Wrap|'''Texture Wrap Y''']]&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| {{none}}&lt;br /&gt;
| u8&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Wrap|'''Texture Wrap Z''']]&lt;br /&gt;
| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Texture Type ===&lt;br /&gt;
&lt;br /&gt;
This enum basically maps directly to a GX2SurfaceDim enum.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! ID&lt;br /&gt;
! GX2SurfaceType&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| GX2_SURFACE_DIM_1D&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| GX2_SURFACE_DIM_2D&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| GX2_SURFACE_DIM_3D&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| GX2_SURFACE_DIM_CUBE&lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| GX2_SURFACE_DIM_1D_ARRAY&lt;br /&gt;
|-&lt;br /&gt;
| 5&lt;br /&gt;
| GX2_SURFACE_DIM_2D_ARRAY&lt;br /&gt;
|-&lt;br /&gt;
| 6&lt;br /&gt;
| GX2_SURFACE_DIM_2D_MSAA&lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| GX2_SURFACE_DIM_2D_MSAA_ARRAY&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Texture Format ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! ID&lt;br /&gt;
! GX2SurfaceFormat&lt;br /&gt;
|-&lt;br /&gt;
| 0x00&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R8_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x01&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R8_SNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x02&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R8_UINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x03&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R8_SINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x04&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCD_R16_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x05&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_SNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x06&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_UINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x07&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_SINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x08&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x09&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R32_UINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x0A&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R32_SINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x0B&lt;br /&gt;
| GX2_SURFACE_FORMAT_INVALID&lt;br /&gt;
|-&lt;br /&gt;
| 0x0C&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCS_R8_G8_B8_A8_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x0D&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCS_R8_G8_B8_A8_SRGB&lt;br /&gt;
|-&lt;br /&gt;
| 0x0E&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_G16_B16_A16_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x0F&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R32_G32_B32_A32_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCD_R16_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x11&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCD_R16_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x12&lt;br /&gt;
| GX2_SURFACE_FORMAT_D_D24_S8_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x13&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCD_R32_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC1_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x15&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC1_SRGB&lt;br /&gt;
|-&lt;br /&gt;
| 0x16&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC2_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x17&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC2_SRGB&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC3_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x19&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC3_SRGB&lt;br /&gt;
|-&lt;br /&gt;
| 0x1A&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC4_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x1B&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC4_SNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC5_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x1D&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC5_SNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x1E&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R11_G11_B10_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x1F&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCD_R32_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_G16_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x21&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R8_G8_UNORM&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Texture Filter ===&lt;br /&gt;
&lt;br /&gt;
Invalid values default to 1 (linear).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! ID&lt;br /&gt;
! GX2TexMipFilterType&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| GX2_TEX_MIP_FILTER_POINT&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| GX2_TEX_MIP_FILTER_LINEAR&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Texture Wrap ===&lt;br /&gt;
&lt;br /&gt;
Invalid values default to 0 (clamp).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! ID&lt;br /&gt;
! GX2TexClamp&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| GX2_TEX_CLAMP_CLAMP&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| GX2_TEX_CLAMP_WRAP&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| GX2_TEX_CLAMP_MIRROR&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| GX2_TEX_CLAMP_MIRROR_ONCE&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== PAK Metadata ==&lt;br /&gt;
&lt;br /&gt;
The pak metadata for the TXTR format primarily contains compression-related information and provides the values required to decompress it.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''GPU Section Offset'''&lt;br /&gt;
| Relative to the start of the file&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''GPU Data Start'''&lt;br /&gt;
| This is the offset to the start of the GPU data, immediately after the GPU section header.&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''GPU Section Size'''&lt;br /&gt;
| Matches the size from the GPU section header.&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Compressed Buffer Count'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| [[#Compressed Buffer|Compressed Buffer]]&lt;br /&gt;
| ''Compressed Buffer Count''&lt;br /&gt;
| '''Compressed Buffer Array'''&lt;br /&gt;
| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Compressed Buffer ===&lt;br /&gt;
&lt;br /&gt;
This is a small struct that defines a compressed data buffer within the GPU section.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| u32&lt;br /&gt;
| '''Decompressed Size'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| u32&lt;br /&gt;
| '''Compressed Size'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| u32&lt;br /&gt;
| '''Offset'''&lt;br /&gt;
| Relative to after the GPU section header&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:File Formats]]&lt;br /&gt;
[[Category:Donkey Kong Country: Tropical Freeze]]&lt;/div&gt;</summary>
		<author><name>Aruki</name></author>	</entry>

	<entry>
		<id>http://www.metroid2002.com/retromodding/index.php?title=TXTR_(Tropical_Freeze)&amp;diff=1907</id>
		<title>TXTR (Tropical Freeze)</title>
		<link rel="alternate" type="text/html" href="http://www.metroid2002.com/retromodding/index.php?title=TXTR_(Tropical_Freeze)&amp;diff=1907"/>
				<updated>2017-11-26T16:54:52Z</updated>
		
		<summary type="html">&lt;p&gt;Aruki: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''See [[TXTR (File Format)]] for the other revisions of this format.''&lt;br /&gt;
&lt;br /&gt;
The '''TXTR''' format is Tropical Freeze's texture format. The image data in the GPU buffer is compressed using [[LZSS Compression|LZSS compression]].&lt;br /&gt;
&lt;br /&gt;
{{research|major|Most everything in the header + image compression formats needs to be cracked + documented.}}&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Format ==&lt;br /&gt;
&lt;br /&gt;
The format starts with the typical [[Form Descriptor (Tropical Freeze)|form descriptor]] found in every Tropical Freeze format. Following that, there's a HEAD header section that contains most of the texture parameters, then the GPU section containing the actual compressed image data. This is the structure of the HEAD section:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| [[Chunk Descriptor (Tropical Freeze)|Chunk Descriptor]]&lt;br /&gt;
| 1&lt;br /&gt;
| '''HEAD Chunk Descriptor'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Type|'''Texture Type''']]&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Format|'''Texture Format''']]&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Width'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Height'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Depth'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Swizzle'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Mipmap Count'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| u32&lt;br /&gt;
| ''Mipmap Count''&lt;br /&gt;
| {{unknown|Unknown array}}&lt;br /&gt;
| Appears to be mipmap sizes, but it doesn't match the size of the image data (unless there's 1)...&lt;br /&gt;
|-&lt;br /&gt;
| {{none}}&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| This parameter is part of NTextureFormat::STextureSamplerData (along with the next 4 parameters)&lt;br /&gt;
|-&lt;br /&gt;
| {{none}}&lt;br /&gt;
| u8&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Filter|'''Texture Filter''']]&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| {{none}}&lt;br /&gt;
| u8&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Wrap|'''Texture Wraps X''']]&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| {{none}}&lt;br /&gt;
| u8&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Wrap|'''Texture Wrap Y''']]&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| {{none}}&lt;br /&gt;
| u8&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Texture Wrap|'''Texture Wrap Z''']]&lt;br /&gt;
| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Texture Type ===&lt;br /&gt;
&lt;br /&gt;
This enum basically maps directly to a GX2SurfaceDim enum.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! ID&lt;br /&gt;
! GX2SurfaceType&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| GX2_SURFACE_DIM_1D&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| GX2_SURFACE_DIM_2D&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| GX2_SURFACE_DIM_3D&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| GX2_SURFACE_DIM_CUBE&lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| GX2_SURFACE_DIM_1D_ARRAY&lt;br /&gt;
|-&lt;br /&gt;
| 5&lt;br /&gt;
| GX2_SURFACE_DIM_2D_ARRAY&lt;br /&gt;
|-&lt;br /&gt;
| 6&lt;br /&gt;
| GX2_SURFACE_DIM_2D_MSAA&lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| GX2_SURFACE_DIM_2D_MSAA_ARRAY&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Texture Format ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! ID&lt;br /&gt;
! GX2SurfaceFormat&lt;br /&gt;
|-&lt;br /&gt;
| 0x00&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R8_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x01&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R8_SNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x02&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R8_UINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x03&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R8_SINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x04&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCD_R16_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x05&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_SNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x06&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_UINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x07&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_SINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x08&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x09&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R32_UINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x0A&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R32_SINT&lt;br /&gt;
|-&lt;br /&gt;
| 0x0B&lt;br /&gt;
| GX2_SURFACE_FORMAT_INVALID&lt;br /&gt;
|-&lt;br /&gt;
| 0x0C&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCS_R8_G8_B8_A8_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x0D&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCS_R8_G8_B8_A8_SRGB&lt;br /&gt;
|-&lt;br /&gt;
| 0x0E&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_G16_B16_A16_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x0F&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R32_G32_B32_A32_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCD_R16_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x11&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCD_R16_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x12&lt;br /&gt;
| GX2_SURFACE_FORMAT_D_D24_S8_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x13&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCD_R32_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC1_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x15&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC1_SRGB&lt;br /&gt;
|-&lt;br /&gt;
| 0x16&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC2_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x17&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC2_SRGB&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC3_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x19&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC3_SRGB&lt;br /&gt;
|-&lt;br /&gt;
| 0x1A&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC4_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x1B&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC4_SNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC5_UNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x1D&lt;br /&gt;
| GX2_SURFACE_FORMAT_T_BC5_SNORM&lt;br /&gt;
|-&lt;br /&gt;
| 0x1E&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R11_G11_B10_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x1F&lt;br /&gt;
| GX2_SURFACE_FORMAT_TCD_R32_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R16_G16_FLOAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x21&lt;br /&gt;
| GX2_SURFACE_FORMAT_TC_R8_G8_UNORM&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Texture Filter ===&lt;br /&gt;
&lt;br /&gt;
Invalid values default to 1 (linear).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! ID&lt;br /&gt;
! GX2TexMipFilterType&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| GX2_TEX_MIP_FILTER_POINT&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| GX2_TEX_MIP_FILTER_LINEAR&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Texture Wrap ===&lt;br /&gt;
&lt;br /&gt;
Invalid values default to 0 (clamp).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! ID&lt;br /&gt;
! GX2TexClamp&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| GX2_TEX_CLAMP_CLAMP&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| GX2_TEX_CLAMP_WRAP&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| GX2_TEX_CLAMP_MIRROR&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| GX2_TEX_CLAMP_MIRROR_ONCE&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== PAK Metadata ==&lt;br /&gt;
&lt;br /&gt;
The pak metadata for the TXTR format primarily contains compression-related information and provides the values required to decompress it.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''GPU Section Offset'''&lt;br /&gt;
| Relative to the start of the file&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''GPU Data Start'''&lt;br /&gt;
| This is the offset to the start of the GPU data, immediately after the GPU section header.&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''GPU Section Size'''&lt;br /&gt;
| Matches the size from the GPU section header.&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Compressed Buffer Count'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| [[#Compressed Buffer|Compressed Buffer]]&lt;br /&gt;
| ''Compressed Buffer Count''&lt;br /&gt;
| '''Compressed Buffer Array'''&lt;br /&gt;
| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Compressed Buffer ===&lt;br /&gt;
&lt;br /&gt;
This is a small struct that defines a compressed data buffer within the GPU section.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| u32&lt;br /&gt;
| '''Decompressed Size'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| u32&lt;br /&gt;
| '''Compressed Size'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| u32&lt;br /&gt;
| '''Offset'''&lt;br /&gt;
| Relative to after the GPU section header&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:File Formats]]&lt;br /&gt;
[[Category:Donkey Kong Country: Tropical Freeze]]&lt;/div&gt;</summary>
		<author><name>Aruki</name></author>	</entry>

	<entry>
		<id>http://www.metroid2002.com/retromodding/index.php?title=UINF_(File_Format)&amp;diff=1906</id>
		<title>UINF (File Format)</title>
		<link rel="alternate" type="text/html" href="http://www.metroid2002.com/retromodding/index.php?title=UINF_(File_Format)&amp;diff=1906"/>
				<updated>2017-11-04T19:14:19Z</updated>
		
		<summary type="html">&lt;p&gt;Aruki: /* Area Info */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The '''UINF format''' sets up the global game universe. The extension stands for ''Universe Info''.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Format ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| [[Form Descriptor (Tropical Freeze)|Form Descriptor]]&lt;br /&gt;
| 1&lt;br /&gt;
| '''UINF Form Descriptor'''&lt;br /&gt;
| Data type is &amp;lt;code&amp;gt;UINF&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| Asset ID ([[MSBT (File Format)|MSBT]])&lt;br /&gt;
| 1&lt;br /&gt;
| '''Level Names MSBT'''&lt;br /&gt;
| Reference to the MSBT file containing all level names.&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| Asset ID ([[MSBT (File Format)|MSBT]])&lt;br /&gt;
| 1&lt;br /&gt;
| '''Act Number Strings MSBT'''&lt;br /&gt;
| Reference to the MSBT file containing all act number strings.&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| Asset ID ([[CAUD (File Format)|CAUD]])&lt;br /&gt;
| 1&lt;br /&gt;
| '''Loading Screen Music CAUD'''&lt;br /&gt;
| Reference to the CAUD file containing the loading screen music.&lt;br /&gt;
|-&lt;br /&gt;
| 0x50&lt;br /&gt;
| [[#Area Info|Area Info]]&lt;br /&gt;
| ''Varies''&lt;br /&gt;
| '''Area Info Array'''&lt;br /&gt;
| Array describing all areas/levels in the game. There is no count; read until you reach the end of the UINF form.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Area Info ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| [[Chunk Descriptor (Tropical Freeze)|Chunk Descriptor]]&lt;br /&gt;
| 1&lt;br /&gt;
| '''ROOM Descriptor'''&lt;br /&gt;
| Data type is &amp;lt;code&amp;gt;ROOM&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Asset ID ([[ROOM (File Format)|ROOM]])&lt;br /&gt;
| 1&lt;br /&gt;
| '''ROOM ID'''&lt;br /&gt;
| Asset ID of the ROOM asset for this area&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Area Name Length'''&lt;br /&gt;
| Length of the area name string&lt;br /&gt;
|-&lt;br /&gt;
| char&lt;br /&gt;
| ''Area Name Length''&lt;br /&gt;
| '''Area Name'''&lt;br /&gt;
| Internal area name. This is probably used for name lookups in the MSBT file and might also be used to look up the pak file for this area.&lt;br /&gt;
|-&lt;br /&gt;
| u8&lt;br /&gt;
| 1&lt;br /&gt;
| '''World Number'''&lt;br /&gt;
| World number that this level belongs to. (1 = Mangroves, 2 = Alps, 3 = Savannah, etc)&lt;br /&gt;
|-&lt;br /&gt;
| u8&lt;br /&gt;
| 1&lt;br /&gt;
| '''Act Number'''&lt;br /&gt;
| Act number of this level.&lt;br /&gt;
|-&lt;br /&gt;
| u8&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| u16&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:File Formats]]&lt;br /&gt;
[[Category:Donkey Kong Country: Tropical Freeze]]&lt;/div&gt;</summary>
		<author><name>Aruki</name></author>	</entry>

	<entry>
		<id>http://www.metroid2002.com/retromodding/index.php?title=UINF_(File_Format)&amp;diff=1905</id>
		<title>UINF (File Format)</title>
		<link rel="alternate" type="text/html" href="http://www.metroid2002.com/retromodding/index.php?title=UINF_(File_Format)&amp;diff=1905"/>
				<updated>2017-11-04T19:14:06Z</updated>
		
		<summary type="html">&lt;p&gt;Aruki: /* Area Info */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The '''UINF format''' sets up the global game universe. The extension stands for ''Universe Info''.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Format ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| [[Form Descriptor (Tropical Freeze)|Form Descriptor]]&lt;br /&gt;
| 1&lt;br /&gt;
| '''UINF Form Descriptor'''&lt;br /&gt;
| Data type is &amp;lt;code&amp;gt;UINF&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| Asset ID ([[MSBT (File Format)|MSBT]])&lt;br /&gt;
| 1&lt;br /&gt;
| '''Level Names MSBT'''&lt;br /&gt;
| Reference to the MSBT file containing all level names.&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| Asset ID ([[MSBT (File Format)|MSBT]])&lt;br /&gt;
| 1&lt;br /&gt;
| '''Act Number Strings MSBT'''&lt;br /&gt;
| Reference to the MSBT file containing all act number strings.&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| Asset ID ([[CAUD (File Format)|CAUD]])&lt;br /&gt;
| 1&lt;br /&gt;
| '''Loading Screen Music CAUD'''&lt;br /&gt;
| Reference to the CAUD file containing the loading screen music.&lt;br /&gt;
|-&lt;br /&gt;
| 0x50&lt;br /&gt;
| [[#Area Info|Area Info]]&lt;br /&gt;
| ''Varies''&lt;br /&gt;
| '''Area Info Array'''&lt;br /&gt;
| Array describing all areas/levels in the game. There is no count; read until you reach the end of the UINF form.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Area Info ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| [[Chunk Descriptor (Tropical Freeze)|Chunk Descriptor]]&lt;br /&gt;
| 1&lt;br /&gt;
| '''ROOM Descriptor'''&lt;br /&gt;
| Data type is &amp;lt;code&amp;gt;ROOM&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Asset ID ([[ROOM (File Format)|ROOM]])&lt;br /&gt;
| 1&lt;br /&gt;
| '''ROOM ID'''&lt;br /&gt;
| Asset ID of the ROOM asset for this area&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Area Name Length'''&lt;br /&gt;
| Length of the area name string&lt;br /&gt;
|-&lt;br /&gt;
| char&lt;br /&gt;
| ''Area Name Length''&lt;br /&gt;
| '''Area Name'''&lt;br /&gt;
| Internal area name. This is probably used for name lookups in the MSBT file and might also be used to look up the pak file for this area.&lt;br /&gt;
|-&lt;br /&gt;
| u8&lt;br /&gt;
| 1&lt;br /&gt;
| '''World Number'''&lt;br /&gt;
| World number that this level belongs to. (1 = Mangroves, 2 = Alps, 3 = Savannah, etc)&lt;br /&gt;
|-&lt;br /&gt;
| u8&lt;br /&gt;
| 1&lt;br /&gt;
| '''Act Index'''&lt;br /&gt;
| Act number of this level.&lt;br /&gt;
|-&lt;br /&gt;
| u8&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| u16&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:File Formats]]&lt;br /&gt;
[[Category:Donkey Kong Country: Tropical Freeze]]&lt;/div&gt;</summary>
		<author><name>Aruki</name></author>	</entry>

	<entry>
		<id>http://www.metroid2002.com/retromodding/index.php?title=UINF_(File_Format)&amp;diff=1904</id>
		<title>UINF (File Format)</title>
		<link rel="alternate" type="text/html" href="http://www.metroid2002.com/retromodding/index.php?title=UINF_(File_Format)&amp;diff=1904"/>
				<updated>2017-11-04T19:13:59Z</updated>
		
		<summary type="html">&lt;p&gt;Aruki: /* Area Info */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The '''UINF format''' sets up the global game universe. The extension stands for ''Universe Info''.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Format ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| [[Form Descriptor (Tropical Freeze)|Form Descriptor]]&lt;br /&gt;
| 1&lt;br /&gt;
| '''UINF Form Descriptor'''&lt;br /&gt;
| Data type is &amp;lt;code&amp;gt;UINF&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| Asset ID ([[MSBT (File Format)|MSBT]])&lt;br /&gt;
| 1&lt;br /&gt;
| '''Level Names MSBT'''&lt;br /&gt;
| Reference to the MSBT file containing all level names.&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| Asset ID ([[MSBT (File Format)|MSBT]])&lt;br /&gt;
| 1&lt;br /&gt;
| '''Act Number Strings MSBT'''&lt;br /&gt;
| Reference to the MSBT file containing all act number strings.&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| Asset ID ([[CAUD (File Format)|CAUD]])&lt;br /&gt;
| 1&lt;br /&gt;
| '''Loading Screen Music CAUD'''&lt;br /&gt;
| Reference to the CAUD file containing the loading screen music.&lt;br /&gt;
|-&lt;br /&gt;
| 0x50&lt;br /&gt;
| [[#Area Info|Area Info]]&lt;br /&gt;
| ''Varies''&lt;br /&gt;
| '''Area Info Array'''&lt;br /&gt;
| Array describing all areas/levels in the game. There is no count; read until you reach the end of the UINF form.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Area Info ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| [[Chunk Descriptor (Tropical Freeze)|Chunk Descriptor]]&lt;br /&gt;
| 1&lt;br /&gt;
| '''ROOM Descriptor'''&lt;br /&gt;
| Data type is &amp;lt;code&amp;gt;ROOM&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Asset ID ([[ROOM (File Format)|ROOM]])&lt;br /&gt;
| 1&lt;br /&gt;
| '''ROOM ID'''&lt;br /&gt;
| Asset ID of the ROOM asset for this area&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Area Name Length'''&lt;br /&gt;
| Length of the area name string&lt;br /&gt;
|-&lt;br /&gt;
| char&lt;br /&gt;
| ''Area Name Length''&lt;br /&gt;
| '''Area Name'''&lt;br /&gt;
| Internal area name. This is probably used for name lookups in the MSBT file and might also be used to look up the pak file for this area.&lt;br /&gt;
|-&lt;br /&gt;
| u8&lt;br /&gt;
| 1&lt;br /&gt;
| '''World Number'''&lt;br /&gt;
| World number that this level belongs to. (1 = Mangroves, 2 = Alps, 3 = Savannah, etc)&lt;br /&gt;
|-&lt;br /&gt;
| u8&lt;br /&gt;
| 1&lt;br /&gt;
| '''Act Index'''&lt;br /&gt;
| Act number of this level.&lt;br /&gt;
|-&lt;br /&gt;
| bool&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| u16&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:File Formats]]&lt;br /&gt;
[[Category:Donkey Kong Country: Tropical Freeze]]&lt;/div&gt;</summary>
		<author><name>Aruki</name></author>	</entry>

	<entry>
		<id>http://www.metroid2002.com/retromodding/index.php?title=UINF_(File_Format)&amp;diff=1903</id>
		<title>UINF (File Format)</title>
		<link rel="alternate" type="text/html" href="http://www.metroid2002.com/retromodding/index.php?title=UINF_(File_Format)&amp;diff=1903"/>
				<updated>2017-11-04T19:10:44Z</updated>
		
		<summary type="html">&lt;p&gt;Aruki: /* Area Info */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The '''UINF format''' sets up the global game universe. The extension stands for ''Universe Info''.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Format ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| [[Form Descriptor (Tropical Freeze)|Form Descriptor]]&lt;br /&gt;
| 1&lt;br /&gt;
| '''UINF Form Descriptor'''&lt;br /&gt;
| Data type is &amp;lt;code&amp;gt;UINF&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| Asset ID ([[MSBT (File Format)|MSBT]])&lt;br /&gt;
| 1&lt;br /&gt;
| '''Level Names MSBT'''&lt;br /&gt;
| Reference to the MSBT file containing all level names.&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| Asset ID ([[MSBT (File Format)|MSBT]])&lt;br /&gt;
| 1&lt;br /&gt;
| '''Act Number Strings MSBT'''&lt;br /&gt;
| Reference to the MSBT file containing all act number strings.&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| Asset ID ([[CAUD (File Format)|CAUD]])&lt;br /&gt;
| 1&lt;br /&gt;
| '''Loading Screen Music CAUD'''&lt;br /&gt;
| Reference to the CAUD file containing the loading screen music.&lt;br /&gt;
|-&lt;br /&gt;
| 0x50&lt;br /&gt;
| [[#Area Info|Area Info]]&lt;br /&gt;
| ''Varies''&lt;br /&gt;
| '''Area Info Array'''&lt;br /&gt;
| Array describing all areas/levels in the game. There is no count; read until you reach the end of the UINF form.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Area Info ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| [[Chunk Descriptor (Tropical Freeze)|Chunk Descriptor]]&lt;br /&gt;
| 1&lt;br /&gt;
| '''ROOM Descriptor'''&lt;br /&gt;
| Data type is &amp;lt;code&amp;gt;ROOM&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Asset ID ([[ROOM (File Format)|ROOM]])&lt;br /&gt;
| 1&lt;br /&gt;
| '''ROOM ID'''&lt;br /&gt;
| Asset ID of the ROOM asset for this area&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Area Name Length'''&lt;br /&gt;
| Length of the area name string&lt;br /&gt;
|-&lt;br /&gt;
| char&lt;br /&gt;
| ''Area Name Length''&lt;br /&gt;
| '''Area Name'''&lt;br /&gt;
| Internal area name. This is probably used for name lookups in the MSBT file and might also be used to look up the pak file for this area.&lt;br /&gt;
|-&lt;br /&gt;
| u8&lt;br /&gt;
| 1&lt;br /&gt;
| '''World Number'''&lt;br /&gt;
| World number that this level belongs to. (1 = Mangroves, 2 = Alps, 3 = Savannah, etc)&lt;br /&gt;
|-&lt;br /&gt;
| u8&lt;br /&gt;
| 1&lt;br /&gt;
| '''Act Index'''&lt;br /&gt;
| Act number of this level.&lt;br /&gt;
|-&lt;br /&gt;
| bool&lt;br /&gt;
| 1&lt;br /&gt;
| '''Is Boss?'''&lt;br /&gt;
| True if this level is a boss fight, false otherwise.&lt;br /&gt;
|-&lt;br /&gt;
| u16&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:File Formats]]&lt;br /&gt;
[[Category:Donkey Kong Country: Tropical Freeze]]&lt;/div&gt;</summary>
		<author><name>Aruki</name></author>	</entry>

	<entry>
		<id>http://www.metroid2002.com/retromodding/index.php?title=PAS_Database&amp;diff=1900</id>
		<title>PAS Database</title>
		<link rel="alternate" type="text/html" href="http://www.metroid2002.com/retromodding/index.php?title=PAS_Database&amp;diff=1900"/>
				<updated>2017-07-08T06:45:37Z</updated>
		
		<summary type="html">&lt;p&gt;Aruki: /* Anim State */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The '''Parameterized Animation State Database''' is an animation-related thing that appears in every Retro game. It can be found in the [[ANCS (File Format)|ANCS format]] in Metroid Prime 1 and 2, and the [[CHAR (File Format)|CHAR format]] in Metroid Prime 3, Donkey Kong Country Returns, and Donkey Kong Country: Tropical Freeze.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Format ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| {{FourCC}}&lt;br /&gt;
| 1&lt;br /&gt;
| '''Magic'''&lt;br /&gt;
| Always &amp;lt;code&amp;gt;PAS4&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Anim State Count'''&lt;br /&gt;
| Number of anim states&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Default Anim State'''&lt;br /&gt;
| Anim state used by the character by default. If there are no anim states, this will be set to -1.&lt;br /&gt;
|-&lt;br /&gt;
| [[#Anim State|Anim State]]&lt;br /&gt;
| ''Anim State Count''&lt;br /&gt;
| '''Anim State Array'''&lt;br /&gt;
| Array of anim states.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Anim State ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| enum&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Anim State Type|Anim State Type]]&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Parm Info Count'''&lt;br /&gt;
| Number of parameters&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Anim Info Count'''&lt;br /&gt;
| Number of animations&lt;br /&gt;
|-&lt;br /&gt;
| [[#Parm Info|Parm Info]]&lt;br /&gt;
| ''Parm Info Count''&lt;br /&gt;
| '''Parm Info Array'''&lt;br /&gt;
| Describes parameters in this anim state&lt;br /&gt;
|-&lt;br /&gt;
| [[#Anim Info|Anim Info]]&lt;br /&gt;
| ''Anim Info Count''&lt;br /&gt;
| '''Anim Info Array'''&lt;br /&gt;
| Describes animations in this anim state&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Anim State Type ====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! ID&lt;br /&gt;
! State&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| Fall&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| Get Up&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| Lie On Ground&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| Step&lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| Death&lt;br /&gt;
|-&lt;br /&gt;
| 5&lt;br /&gt;
| Locomotion&lt;br /&gt;
|-&lt;br /&gt;
| 6&lt;br /&gt;
| Knock Back&lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| Melee Attack&lt;br /&gt;
|-&lt;br /&gt;
| 8&lt;br /&gt;
| Turn&lt;br /&gt;
|-&lt;br /&gt;
| 9&lt;br /&gt;
| Loop Attack&lt;br /&gt;
|-&lt;br /&gt;
| 10&lt;br /&gt;
| Loop Reaction&lt;br /&gt;
|-&lt;br /&gt;
| 11&lt;br /&gt;
| Ground Hit&lt;br /&gt;
|-&lt;br /&gt;
| 12&lt;br /&gt;
| Generate&lt;br /&gt;
|-&lt;br /&gt;
| 13&lt;br /&gt;
| Jump&lt;br /&gt;
|-&lt;br /&gt;
| 14&lt;br /&gt;
| Hurled&lt;br /&gt;
|-&lt;br /&gt;
| 15&lt;br /&gt;
| Slide&lt;br /&gt;
|-&lt;br /&gt;
| 16&lt;br /&gt;
| Taunt&lt;br /&gt;
|-&lt;br /&gt;
| 17&lt;br /&gt;
| Scripted&lt;br /&gt;
|-&lt;br /&gt;
| 18&lt;br /&gt;
| Projectile Attack&lt;br /&gt;
|-&lt;br /&gt;
| 19&lt;br /&gt;
| Cover&lt;br /&gt;
|-&lt;br /&gt;
| 20&lt;br /&gt;
| Wall Hang&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Parm Info ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Parm Type|'''Parm Type''']]&lt;br /&gt;
| Parameter type. This value controls the type of other values in the Parm Info and Anim Info structures.&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| [[#Weight Function|'''Weight Function''']]&lt;br /&gt;
| Specifies the weighting algorithm used for this parameter during selection.&lt;br /&gt;
|-&lt;br /&gt;
| float&lt;br /&gt;
| 1&lt;br /&gt;
| '''Weight'''&lt;br /&gt;
| Specifies how much influence this parameter has during selection.&lt;br /&gt;
|-&lt;br /&gt;
| ''Parm Type''&lt;br /&gt;
| 1&lt;br /&gt;
| '''Minimum Value'''&lt;br /&gt;
| Minimum value this parameter can represent. The exact meaning depends on the context within the class implementation that uses it.&lt;br /&gt;
|-&lt;br /&gt;
| ''Parm Type''&lt;br /&gt;
| 1&lt;br /&gt;
| '''Maximum Value'''&lt;br /&gt;
| Maximum value this parameter can represent. The exact meaning depends on the context within the class implementation that uses it.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Parm Type ====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! ID&lt;br /&gt;
! Type&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| Int32&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| Uint32&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| Real&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| Bool&lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| Enum&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Weight Function ====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! ID&lt;br /&gt;
! Type&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| Exact Match&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| Percent Error&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| Angular Percent&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| No Weight&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Anim Info ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Anim ID'''&lt;br /&gt;
| This is a character-relative anim index. In Prime 1/2, this should be indexed into the character's anim list to get the animset-relative index.&lt;br /&gt;
|-&lt;br /&gt;
| ''Parm Type''&lt;br /&gt;
| ''Parm Info Count''&lt;br /&gt;
| '''Parm Values Array'''&lt;br /&gt;
| This array contains one value per Parm Info. The type of each value is determined by the corresponding Parm Info's ''Parm Type'' value.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:File Formats]]&lt;br /&gt;
[[Category:Metroid Prime Demo]]&lt;br /&gt;
[[Category:Metroid Prime]]&lt;br /&gt;
[[Category:Metroid Prime 2 Demo]]&lt;br /&gt;
[[Category:Metroid Prime 2: Echoes]]&lt;br /&gt;
[[Category:Metroid Prime 3 Prototype]]&lt;br /&gt;
[[Category:Metroid Prime 3: Corruption]]&lt;br /&gt;
[[Category:Donkey Kong Country Returns]]&lt;br /&gt;
[[Category:Donkey Kong Country: Tropical Freeze]]&lt;/div&gt;</summary>
		<author><name>Aruki</name></author>	</entry>

	<entry>
		<id>http://www.metroid2002.com/retromodding/index.php?title=Scriptable_Layers_(Metroid_Prime_2)&amp;diff=1899</id>
		<title>Scriptable Layers (Metroid Prime 2)</title>
		<link rel="alternate" type="text/html" href="http://www.metroid2002.com/retromodding/index.php?title=Scriptable_Layers_(Metroid_Prime_2)&amp;diff=1899"/>
				<updated>2017-06-27T06:22:07Z</updated>
		
		<summary type="html">&lt;p&gt;Aruki: /* Generated Objects */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''This article is for the scriptable layers format from Metroid Prime 2, 3, and Donkey Kong Country Returns. See [[Scriptable Layers (File Format)]] for other revisions of this format.''&lt;br /&gt;
&lt;br /&gt;
'''Scriptable layers''' are a data section found in the MREA format, denoted by the fourCC identifier &amp;lt;code&amp;gt;SCLY&amp;lt;/code&amp;gt;. It contains script object instances which are used to set the object layout of each room. Rooms can contain multiple layers, with each being able to be toggled on and off independently, allowing for the layout of a room to be updated after significant ingame events, which is done using a ScriptLayerController object. Each instance has a large number of parameters that can be toggled to customize the appearance and behavior of that instance, and they're capable of sending messages to other objects, allowing for fairly complex interactions between objects to be scripted.&lt;br /&gt;
&lt;br /&gt;
In Echoes, the SCLY format was overhauled. The most notable change is that all properties now have a 32-bit ID and a size value listed, allowing the game to match properties in the file with data members by ID rather than by their position in the file; this was presumably done to avoid breaking cooked data when objects were modified during development, since this change meant the file could still be read correctly if properties were added or removed from an object and the script data hadn't been recooked. Another change is that there's now a separate layer for generated objects (ie objects that are spawned using a Generator or a PickupGenerator), which uses the fourCC &amp;lt;code&amp;gt;SCGN&amp;lt;/code&amp;gt;. Aside from minor changes in the header, the &amp;lt;code&amp;gt;SCGN&amp;lt;/code&amp;gt; layer is identical to &amp;lt;code&amp;gt;SCLY&amp;lt;/code&amp;gt; layers.&lt;br /&gt;
&lt;br /&gt;
In Donkey Kong Country Returns, the format is identical, but the way the data is cooked was slightly modified. In every game starting with Prime 2, the engine assigns an arbitrary default value to every object property before reading in the values from the file. In the Prime series, this didn't have much of an effect, since (almost) every property for every object is written to the file anyway. But starting in Donkey Kong Country Returns, any properties whose value matches the internal default value are left out of the file in order to speed up loading times. This means a full list of properties and their internal default value is required to correctly read/write DKCR files. (This change could also be applied in the Prime series with custom script data.)&lt;br /&gt;
&lt;br /&gt;
Although this format is primarily found in MREA files, it's also occasionally reused in other formats, such as [[SCAN (Metroid Prime 2)|SCAN]].&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Format ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| char&lt;br /&gt;
| 4&lt;br /&gt;
| '''Magic'''&lt;br /&gt;
| Always &amp;lt;code&amp;gt;SCLY&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;SCGN&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| char&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x5&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| Appears to be layer self-index. Not present in SCGN.&lt;br /&gt;
|-&lt;br /&gt;
| 0x9&lt;br /&gt;
| char&lt;br /&gt;
| 1&lt;br /&gt;
| '''Version'''&lt;br /&gt;
| Always 1&lt;br /&gt;
|-&lt;br /&gt;
| 0xA&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Instance Count'''&lt;br /&gt;
| Count of instances in this layer.&lt;br /&gt;
|-&lt;br /&gt;
| 0xE&lt;br /&gt;
| [[#Script Instance|Script Instance]]&lt;br /&gt;
| ''Instance Count''&lt;br /&gt;
| '''Script Instances'''&lt;br /&gt;
| Layer instance data.&lt;br /&gt;
|-&lt;br /&gt;
| colspan=5 {{unknown|End of layer}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Script Instance ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| char&lt;br /&gt;
| 4&lt;br /&gt;
| '''Instance Type'''&lt;br /&gt;
| FourCC representing the type of object this is.&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| u16&lt;br /&gt;
| 1&lt;br /&gt;
| '''Instance Size'''&lt;br /&gt;
| Size of this instance, relative to after the size value.&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Instance ID'''&lt;br /&gt;
| ID used by other objects to reference this instance. The bottom 16 bits is an area-relative instance ID. The next 10 bits up are the world-relative area index. The top 6 bits are the layer index. The layer index isn't technically part of the ID, as the game removes it for ID-based lookups.&lt;br /&gt;
|-&lt;br /&gt;
| 0xA&lt;br /&gt;
| u16&lt;br /&gt;
| 1&lt;br /&gt;
| '''Connection Count'''&lt;br /&gt;
| Count of outgoing script connections.&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| [[#Connection|Connection]]&lt;br /&gt;
| ''Connection Count''&lt;br /&gt;
| '''Connection Array'''&lt;br /&gt;
| Array of outgoing script connections.&lt;br /&gt;
|-&lt;br /&gt;
| {{none}}&lt;br /&gt;
| [[#Property Struct|Property Struct]]&lt;br /&gt;
| 1&lt;br /&gt;
| '''Base Struct'''&lt;br /&gt;
| This is the instance's base struct, which contains all properties in this instance. The property ID is always 0xFFFFFFFF.&lt;br /&gt;
|-&lt;br /&gt;
| colspan=5 {{unknown|End of instance}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Connection ===&lt;br /&gt;
&lt;br /&gt;
A connection is used to script interactions between objects; when this instance enters the given ''state'', it sends the target instance the given ''message''.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| char&lt;br /&gt;
| 4&lt;br /&gt;
| '''State'''&lt;br /&gt;
| When the instance enters this state, the connection will activate.&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| char&lt;br /&gt;
| 4&lt;br /&gt;
| '''Message'''&lt;br /&gt;
| Message that will be sent to the target instance when the connection activates.&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Target Instance ID'''&lt;br /&gt;
| ID of the target instance.&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| colspan=4 {{unknown|End of connection}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Property Struct ===&lt;br /&gt;
&lt;br /&gt;
A property struct is a property that contains other properties. These are often modular pieces that are present on multiple objects (for example, the PatternedAI struct that appears on all enemies). Structs can contain other structs as sub-properties.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Property ID'''&lt;br /&gt;
| Property ID for this struct property.&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| u16&lt;br /&gt;
| 1&lt;br /&gt;
| '''Property Size'''&lt;br /&gt;
| Size of this struct including all sub-properties.&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| u16&lt;br /&gt;
| 1&lt;br /&gt;
| '''Sub-Property Count'''&lt;br /&gt;
| Count of sub-properties contained in this struct.&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| [[#Property|Property]]&lt;br /&gt;
| ''Sub-Property Count''&lt;br /&gt;
| '''Sub-Properties'''&lt;br /&gt;
| Array of this struct's sub-properties.&lt;br /&gt;
|-&lt;br /&gt;
| colspan=5 {{unknown|End of struct}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Property ===&lt;br /&gt;
&lt;br /&gt;
A property represents a single data value on a script instance. The type of each property varies depending on the ID.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Property ID'''&lt;br /&gt;
| ID that uniquely identifies this property.&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| u16&lt;br /&gt;
| 1&lt;br /&gt;
| '''Property Size'''&lt;br /&gt;
| Size of this property. This is used by the game to skip over the property if it encounters an unrecognized ID.&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| Varies&lt;br /&gt;
| 1&lt;br /&gt;
| '''Property Data'''&lt;br /&gt;
| The actual data for this property. The type and size of this data varies depending on which property it is (ie. depending on the ID).&lt;br /&gt;
|-&lt;br /&gt;
| colspan=5 {{unknown|End of property}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Generated Objects ==&lt;br /&gt;
&lt;br /&gt;
Generated objects are stored on a separate layer, denoted with &amp;lt;code&amp;gt;SCGN&amp;lt;/code&amp;gt;. The SCGN layer isn't a real layer; it doesn't store a self-index and instances on the layer still contain the index of their original SCLY script layer in their instance ID. These are the stipulations that cause an instance to be written to SCGN:&lt;br /&gt;
&lt;br /&gt;
* Any instance that receives a Generate/Activate message (MP2) or a Generate/Attach, Generate0/Attach, or Generate1/Attach message (MP3, DKCR) is written to SCGN instead of SCLY.&lt;br /&gt;
* In DKCR, all GenericCreature instances are written to both SCLY and SCGN. (The generated one is spawned if you scroll the creature offscreen and come back.)&lt;br /&gt;
&lt;br /&gt;
[[Category:File Formats]]&lt;br /&gt;
[[Category:Metroid Prime 2 Demo]]&lt;br /&gt;
[[Category:Metroid Prime 2: Echoes]]&lt;br /&gt;
[[Category:Metroid Prime 3 Prototype]]&lt;br /&gt;
[[Category:Metroid Prime 3: Corruption]]&lt;br /&gt;
[[Category:Donkey Kong Country Returns]]&lt;/div&gt;</summary>
		<author><name>Aruki</name></author>	</entry>

	<entry>
		<id>http://www.metroid2002.com/retromodding/index.php?title=Scriptable_Layers_(Metroid_Prime_2)&amp;diff=1898</id>
		<title>Scriptable Layers (Metroid Prime 2)</title>
		<link rel="alternate" type="text/html" href="http://www.metroid2002.com/retromodding/index.php?title=Scriptable_Layers_(Metroid_Prime_2)&amp;diff=1898"/>
				<updated>2017-06-27T05:09:18Z</updated>
		
		<summary type="html">&lt;p&gt;Aruki: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''This article is for the scriptable layers format from Metroid Prime 2, 3, and Donkey Kong Country Returns. See [[Scriptable Layers (File Format)]] for other revisions of this format.''&lt;br /&gt;
&lt;br /&gt;
'''Scriptable layers''' are a data section found in the MREA format, denoted by the fourCC identifier &amp;lt;code&amp;gt;SCLY&amp;lt;/code&amp;gt;. It contains script object instances which are used to set the object layout of each room. Rooms can contain multiple layers, with each being able to be toggled on and off independently, allowing for the layout of a room to be updated after significant ingame events, which is done using a ScriptLayerController object. Each instance has a large number of parameters that can be toggled to customize the appearance and behavior of that instance, and they're capable of sending messages to other objects, allowing for fairly complex interactions between objects to be scripted.&lt;br /&gt;
&lt;br /&gt;
In Echoes, the SCLY format was overhauled. The most notable change is that all properties now have a 32-bit ID and a size value listed, allowing the game to match properties in the file with data members by ID rather than by their position in the file; this was presumably done to avoid breaking cooked data when objects were modified during development, since this change meant the file could still be read correctly if properties were added or removed from an object and the script data hadn't been recooked. Another change is that there's now a separate layer for generated objects (ie objects that are spawned using a Generator or a PickupGenerator), which uses the fourCC &amp;lt;code&amp;gt;SCGN&amp;lt;/code&amp;gt;. Aside from minor changes in the header, the &amp;lt;code&amp;gt;SCGN&amp;lt;/code&amp;gt; layer is identical to &amp;lt;code&amp;gt;SCLY&amp;lt;/code&amp;gt; layers.&lt;br /&gt;
&lt;br /&gt;
In Donkey Kong Country Returns, the format is identical, but the way the data is cooked was slightly modified. In every game starting with Prime 2, the engine assigns an arbitrary default value to every object property before reading in the values from the file. In the Prime series, this didn't have much of an effect, since (almost) every property for every object is written to the file anyway. But starting in Donkey Kong Country Returns, any properties whose value matches the internal default value are left out of the file in order to speed up loading times. This means a full list of properties and their internal default value is required to correctly read/write DKCR files. (This change could also be applied in the Prime series with custom script data.)&lt;br /&gt;
&lt;br /&gt;
Although this format is primarily found in MREA files, it's also occasionally reused in other formats, such as [[SCAN (Metroid Prime 2)|SCAN]].&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Format ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| char&lt;br /&gt;
| 4&lt;br /&gt;
| '''Magic'''&lt;br /&gt;
| Always &amp;lt;code&amp;gt;SCLY&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;SCGN&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| char&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x5&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
| Appears to be layer self-index. Not present in SCGN.&lt;br /&gt;
|-&lt;br /&gt;
| 0x9&lt;br /&gt;
| char&lt;br /&gt;
| 1&lt;br /&gt;
| '''Version'''&lt;br /&gt;
| Always 1&lt;br /&gt;
|-&lt;br /&gt;
| 0xA&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Instance Count'''&lt;br /&gt;
| Count of instances in this layer.&lt;br /&gt;
|-&lt;br /&gt;
| 0xE&lt;br /&gt;
| [[#Script Instance|Script Instance]]&lt;br /&gt;
| ''Instance Count''&lt;br /&gt;
| '''Script Instances'''&lt;br /&gt;
| Layer instance data.&lt;br /&gt;
|-&lt;br /&gt;
| colspan=5 {{unknown|End of layer}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Script Instance ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| char&lt;br /&gt;
| 4&lt;br /&gt;
| '''Instance Type'''&lt;br /&gt;
| FourCC representing the type of object this is.&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| u16&lt;br /&gt;
| 1&lt;br /&gt;
| '''Instance Size'''&lt;br /&gt;
| Size of this instance, relative to after the size value.&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Instance ID'''&lt;br /&gt;
| ID used by other objects to reference this instance. The bottom 16 bits is an area-relative instance ID. The next 10 bits up are the world-relative area index. The top 6 bits are the layer index. The layer index isn't technically part of the ID, as the game removes it for ID-based lookups.&lt;br /&gt;
|-&lt;br /&gt;
| 0xA&lt;br /&gt;
| u16&lt;br /&gt;
| 1&lt;br /&gt;
| '''Connection Count'''&lt;br /&gt;
| Count of outgoing script connections.&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| [[#Connection|Connection]]&lt;br /&gt;
| ''Connection Count''&lt;br /&gt;
| '''Connection Array'''&lt;br /&gt;
| Array of outgoing script connections.&lt;br /&gt;
|-&lt;br /&gt;
| {{none}}&lt;br /&gt;
| [[#Property Struct|Property Struct]]&lt;br /&gt;
| 1&lt;br /&gt;
| '''Base Struct'''&lt;br /&gt;
| This is the instance's base struct, which contains all properties in this instance. The property ID is always 0xFFFFFFFF.&lt;br /&gt;
|-&lt;br /&gt;
| colspan=5 {{unknown|End of instance}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Connection ===&lt;br /&gt;
&lt;br /&gt;
A connection is used to script interactions between objects; when this instance enters the given ''state'', it sends the target instance the given ''message''.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| char&lt;br /&gt;
| 4&lt;br /&gt;
| '''State'''&lt;br /&gt;
| When the instance enters this state, the connection will activate.&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| char&lt;br /&gt;
| 4&lt;br /&gt;
| '''Message'''&lt;br /&gt;
| Message that will be sent to the target instance when the connection activates.&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Target Instance ID'''&lt;br /&gt;
| ID of the target instance.&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| colspan=4 {{unknown|End of connection}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Property Struct ===&lt;br /&gt;
&lt;br /&gt;
A property struct is a property that contains other properties. These are often modular pieces that are present on multiple objects (for example, the PatternedAI struct that appears on all enemies). Structs can contain other structs as sub-properties.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Property ID'''&lt;br /&gt;
| Property ID for this struct property.&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| u16&lt;br /&gt;
| 1&lt;br /&gt;
| '''Property Size'''&lt;br /&gt;
| Size of this struct including all sub-properties.&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| u16&lt;br /&gt;
| 1&lt;br /&gt;
| '''Sub-Property Count'''&lt;br /&gt;
| Count of sub-properties contained in this struct.&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| [[#Property|Property]]&lt;br /&gt;
| ''Sub-Property Count''&lt;br /&gt;
| '''Sub-Properties'''&lt;br /&gt;
| Array of this struct's sub-properties.&lt;br /&gt;
|-&lt;br /&gt;
| colspan=5 {{unknown|End of struct}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Property ===&lt;br /&gt;
&lt;br /&gt;
A property represents a single data value on a script instance. The type of each property varies depending on the ID.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Name&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| u32&lt;br /&gt;
| 1&lt;br /&gt;
| '''Property ID'''&lt;br /&gt;
| ID that uniquely identifies this property.&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| u16&lt;br /&gt;
| 1&lt;br /&gt;
| '''Property Size'''&lt;br /&gt;
| Size of this property. This is used by the game to skip over the property if it encounters an unrecognized ID.&lt;br /&gt;
|-&lt;br /&gt;
| 0x6&lt;br /&gt;
| Varies&lt;br /&gt;
| 1&lt;br /&gt;
| '''Property Data'''&lt;br /&gt;
| The actual data for this property. The type and size of this data varies depending on which property it is (ie. depending on the ID).&lt;br /&gt;
|-&lt;br /&gt;
| colspan=5 {{unknown|End of property}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Generated Objects ==&lt;br /&gt;
&lt;br /&gt;
Generated objects are stored on a separate layer, denoted with &amp;lt;code&amp;gt;SCGN&amp;lt;/code&amp;gt;. The SCGN layer isn't a real layer; it doesn't store a self-index and instances on the layer still contain the index of their original SCLY script layer in their instance ID. These are the stipulations that cause an instance to be written to SCGN:&lt;br /&gt;
&lt;br /&gt;
* Any instance that receives a Generate/Activate message (MP2) or a Generate/Attach message (MP3, DKCR) is written to SCGN instead of SCLY.&lt;br /&gt;
* In DKCR, all GenericCreature instances are written to both SCLY and SCGN. (The generated one is spawned if you scroll the creature offscreen and come back.)&lt;br /&gt;
&lt;br /&gt;
[[Category:File Formats]]&lt;br /&gt;
[[Category:Metroid Prime 2 Demo]]&lt;br /&gt;
[[Category:Metroid Prime 2: Echoes]]&lt;br /&gt;
[[Category:Metroid Prime 3 Prototype]]&lt;br /&gt;
[[Category:Metroid Prime 3: Corruption]]&lt;br /&gt;
[[Category:Donkey Kong Country Returns]]&lt;/div&gt;</summary>
		<author><name>Aruki</name></author>	</entry>

	<entry>
		<id>http://www.metroid2002.com/retromodding/index.php?title=SpecialFunction&amp;diff=1897</id>
		<title>SpecialFunction</title>
		<link rel="alternate" type="text/html" href="http://www.metroid2002.com/retromodding/index.php?title=SpecialFunction&amp;diff=1897"/>
				<updated>2017-06-24T00:12:52Z</updated>
		
		<summary type="html">&lt;p&gt;Aruki: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;SpecialFunctions are script objects that can do a multitude of things depending what the Function enum is set to.&lt;br /&gt;
&lt;br /&gt;
=== PlayerInArea ===&lt;br /&gt;
&lt;br /&gt;
* Sends messages on the &amp;quot;Entered&amp;quot; state when the player enters the area.&lt;br /&gt;
* Sends messages on the &amp;quot;Exited&amp;quot; state when the player leaves the area.&lt;/div&gt;</summary>
		<author><name>Aruki</name></author>	</entry>

	</feed>