AAMP: Difference between revisions

2,498 bytes added ,  3 years ago
→‎Structure: fix struct definitions (offsets and counts are packed as a single u32; they are not separate fields)
imported>Leoetlino
mNo edit summary
(→‎Structure: fix struct definitions (offsets and counts are packed as a single u32; they are not separate fields))
 
(20 intermediate revisions by one other user not shown)
Line 2: Line 2:
'''AAMP'''s are parameter files (officially: binary resource parameter archives).
'''AAMP'''s are parameter files (officially: binary resource parameter archives).
</onlyinclude>
</onlyinclude>
Only version 2 is documented in this article since this is what ''Breath of the Wild'' and recent Nintendo games use.
== Structure ==
== Structure ==
{{expand section}}
AAMP is a (typically) little endian format.


Unlike some other file formats, AAMP files have the exact same structure and endianness on Wii U and Switch, so these files are interchangeable between the consoles.
Unlike some other file formats, AAMP files in ''Breath of the Wild'' have the exact same structure and endianness on Wii U and Switch, so these files are interchangeable between the consoles.


=== Parameter types ===
=== Introduction ===
* Parameters are a key-value pair. In the binary form, the key is a CRC32 hash.
* Parameter Objects are dicts that contain Parameters.
* Parameter Lists are structures that contain Parameter Objects and Parameter Lists.
* The root parameter list is called the Parameter IO. It is associated with a version and type string in the header which is checked by the AAMP library.
 
=== Section order ===
* Header
* Parameter lists
* Parameter objects
* Parameters
* Data section (to store parameter data)
* String section (to store strings)
* Unknown uint32 section (unused?)
 
For more information on the ordering, refer to the [https://github.com/zeldamods/oead/blob/v0.9.0-2/src/aamp.cpp#L262 oead source code].
 
=== Header ===
{| class="wikitable"
! Offset !! Type !! Description
|-
| 0x0 || char[4] || Magic ("AAMP")
|-
| 0x4 || u32 || Version (2)
|-
| 0x8 || u32 || Flags (LittleEndian: 1 << 0, UTF8: 1 << 1)
|-
| 0xc || u32 || File size
|-
| 0x10 || u32 || Parameter IO version
|-
| 0x14 || u32 || Offset to parameter IO relative to 0x30
|-
| 0x18 || u32 || Number of lists (including parameter IO)
|-
| 0x1c || u32 || Number of objects
|-
| 0x20 || u32 || Number of parameters
|-
| 0x24 || u32 || Data section size
|-
| 0x28 || u32 || String section size
|-
| 0x2c || u32 || Unknown: number of uint32s after the string section
|-
| 0x30 || char[] || Parameter IO type (typically <code>xml</code>)
|}
 
=== Parameter list ===
{| class="wikitable"
! Offset !! Type !! Description
|-
| 0x0 || u32 || Name CRC32
|-
| 0x4 || u32 ||
* Bits 0-15: Offset to child lists, divided by 4 and relative to parameter list start
* Bits 16-31: Number of child lists
|-
| 0x8 || u32 ||
* Bits 0-15: Offset to child objects, divided by 4 and relative to parameter list start
* Bits 16-31: Number of child objects
|}
 
=== Parameter object ===
{| class="wikitable"
! Offset !! Type !! Description
|-
| 0x0 || u32 || Name CRC32
|-
| 0x4 || u32 ||
* Bits 0-15: Offset to child parameters, divided by 4 and relative to parameter object start
* Bits 16-31: Number of child parameters
|}
 
=== Parameter ===
{| class="wikitable"
! Offset !! Type !! Description
|-
| 0x0 || u32 || Name CRC32
|-
| 0x4 || u32 ||
* Bits 0-23: Offset to data, divided by 4 and relative to parameter start.<br>For strings, this points to a string in the string section. For other parameter types, this points to the data section.
* Bits 24-31: Parameter type
|}
 
=== ParameterType ===
The following parameter type and class names are ''official'' and come from Nintendo's AAMP library.
The following parameter type and class names are ''official'' and come from Nintendo's AAMP library.


Line 105: Line 192:


== Usage in ''Breath of the Wild'' ==
== Usage in ''Breath of the Wild'' ==
AAMP files are used in ''Breath of the Wild'' to store parameters that define the game's behaviour. They are very frequently used inside .sbactorpack archives, where they define most of an Actor's characteristics.
AAMP files are used in ''Breath of the Wild'' to store parameters that define the game's behaviour. They are very frequently used inside [[actor pack]] archives, where they define most of an Actor's characteristics.


=== Naming conventions for arrays ===
=== Naming conventions for arrays ===
Line 123: Line 210:
AAMP files have a wide range of extensions. The file format is the same regardless of the extension, but the parameters defines inside it differ depending on the extension.
AAMP files have a wide range of extensions. The file format is the same regardless of the extension, but the parameters defines inside it differ depending on the extension.


<DynamicPageList>category = File extensions (AAMP)</DynamicPageList>
{{#dpl:
|category = File extensions (AAMP)
|columns=5
|rowcolformat=width=100%
}}


=== Internal usage ===
=== Internal usage ===
Line 156: Line 247:
== Tools ==
== Tools ==
The following tools can be used to convert AAMP files to an editable format, and back again:
The following tools can be used to convert AAMP files to an editable format, and back again:
 
{{Tool table|category=Tools (AAMP)}}
* [https://github.com/leoetlino/aamp <code>aamp</code>]
* [https://github.com/Zer0XoL/BotW-aampTool/releases aampTool] (doesn't display root nodes correctly)
[[Category:File formats]]
[[Category:File formats]]