AMS (File Format)
AMS (Aqualead MeSh) is a file format developed by Aqualead and found in some Wii and 3DS games (and suspected to be used in GameCube titles as well), such as One Piece: Unlimited Adventure, One Piece: Unlimited Cruise Episode 1 - The Treasure Beneath The Waves, One Piece: Unlimited Cruise Episode 2: Awakening of a Hero, One Piece: Unlimited Cruise SP and One Piece: Unlimited Cruise SP 2.
File Format
The file byte order can be either big endian (Wii) or little endian (3DS).
Header
The file starts with the following header:
| Offset | Type | Description |
|---|---|---|
| 0x00 | Char[4] | File magic. Always ALMS in ASCII. |
| 0x04 | Byte | Unknown. Format type? Values seen are 2 and 8. |
| 0x05 | Byte | Unknown. Posibly bit flags, but files either use 0x80 or 0x81. |
| 0x06 | Byte | Number of materials (M). |
| 0x07 | Byte | Number of texture references (T). |
| 0x08 | Byte | Number of shapes (S). |
| 0x09 | Byte | Number of bones (B). |
| 0x0A | Byte | Unknown. |
| 0x0B | Byte | Unknown. |
| 0x0C | Float[2] | Unknown. Seems to be some kind of minimum values, perhaps for a 2D bounding box? |
| 0x14 | Float[2] | Unknown. Seems to be some kind of maximum values, perhaps for a 2D bounding box? |
| 0x1C | UInt16 | Section 1 offset. |
| 0x1E | UInt16 | Section 2 offset. |
| 0x20 | UInt16 | Section 3 offset. |
| 0x22 | UInt16 | Section 4 offset. |
Section 1
This section defines M 0x18 material entries.
Material
TBD
Section 2
This section defines T 0x4-byte texture references.
Texture Reference
| Offset | Type | Description |
|---|---|---|
| 0x00 | Byte | Padding. |
| 0x01 | UInt24 | Asset link identifier of the texture. |
Section 3
This section defines B 0x30 bone entries.
Bone
| Offset | Type | Description |
|---|---|---|
| 0x00 | float[3] | XYZ position. |
| 0x0C | Char[4] | Bone name. Hardcoded to be 4 characters long. |
| 0x10 | float[4] | Rotation, using quaternions. |
| 0x20 | float[4] | Unknown. |
Section 4
This section defines S shape entries.
| Offset | Type | Description |
|---|---|---|
| 0x00 | Int32[S] | Shape offsets. |
Shape Header
Each shape starts with a 0x20 byte header.
| Offset | Type | Description |
|---|---|---|
| 0x00 | Byte | Unknown. Seems to be some kind of debugging flag? |
| 0x01 | Byte | Unknown. Always 1? |
| 0x02 | Byte | Flag: xxxA xxxB.
|
| 0x03 | Byte | Unknown. Always 3? |
| 0x04 | UInt16 | Number of Unknown Data 1 (S?). |
| 0x06 | 5 bits | Unknown. Has something to do with the format of the vertex data. |
| 0x06.5 | 3 bits | Next data helper offset. Add 1 to this value, multiply by 4 and add to the current offset from the Section Data Helpers offset (starting at the offset defined at 0x1E, or if 0, depending on the last bit of 0x2; see the explanation of 0x1E). |
| 0x07 | 4 bits | Vertex data bytes per index in the draw commands:
|
| 0x07.4 | 4 bits | Unknown. Has something to do with the format of the vertex data. |
| 0x08 | UInt16 | Number of vertices (SV). |
| 0x0A | 5 bits | Unknown. Has something to do with the format of the normal data. |
| 0x0A.5 | 3 bits | Next data helper offset. Add 1 to this value, multiply by 4 and add to the current offset from the Section Data Helpers offset. |
| 0x0B | 4 bits | Normal data bytes per index in the draw commands:
|
| 0x0B.4 | 4 bits | Unknown. Has something to do with the format of the normal data. |
| 0x0C | UInt16 | Number of normals (SN). Normal data is usually always attached to the vertex data, so it's the same as the number of vertices (?) |
| 0x0E | 5 bits | Unknown. Has something to do with the format of the color data. |
| 0x0E.5 | 3 bits | Next data helper offset. Add 1 to this value, multiply by 4 and add to the current offset from the Section Data Helpers offset. |
| 0x0F | 4 bits | Color data bytes per index in the draw commands:
|
| 0x0F.4 | 4 bits | Unknown. Has something to do with the format of the color data. |
| 0x10 | UInt16 | Number of colors (SC). |
| 0x12 | 5 bits | Unknown. Has something to do with the format of the UV data. |
| 0x12.5 | 3 bits | Next data helper offset. Add 1 to this value, multiply by 4 and add to the current offset from the Section Data Helpers offset. |
| 0x13 | 4 bits | UV data bytes per index in the draw commands:
|
| 0x13.4 | 4 bits | Unknown. Has something to do with the format of the UV data. |
| 0x14 | UInt16 | Number of UVs (SU). |
| 0x16 | 5 bits | Unknown. Has something to do with the format of the weight/bone data (?) |
| 0x16.5 | 3 bits | Next data helper offset. Add 1 to this value, multiply by 4 and add to the current offset from the Section Data Helpers offset. |
| 0x17 | 4 bits | Unknown. Weight/bone data usage flag (?) |
| 0x17.4 | 4 bits | Unknown. Has something to do with the format of the weight/bone data (?) |
| 0x18 | UInt16 | Number of bone entries (SB). |
| 0x1A | Byte[2] | Unknown. |
| 0x1C | Byte[2] | Unknown. |
| 0x1E | UInt16 | Section Data Helpers offset. Usually 0x20 or 0x30. If the value is 0, the Section Data Helpers come either at 0x20 (if the last bit of the value at 0x2 from this header is 0) or at 0x30 (if the value is 1). |
Section Data Helpers
These entries seem to contain the offsets of the first instance for each of the entries defined in the Shape Header. Commonly, the first 4-byte entry is always related to the unit data, and the second one to its first draw command unit ID. For weight/bone data, it only has one entry, as they are not referenced by the draw commands. All offsets are relative to the start of the Shape Header.
| Offset | Type | Description |
|---|---|---|
| 0x00 | Byte | Stride of an entire entry unit in bytes. |
| 0x01 | UInt24 | Data offset for the first instance of the entry. These offsets indicate the first entry for each entry type defined by the Shape Header, including overlapping entries that may share a common data array. For example, the vertex data array may contain normal and weight data attached to each vertex, but the entries for position, normal and weight data are separate. As for the offsets of the unit indices, it correlates to the specific part of the first draw command that references the entry type. |
Unknown Data 1
This section follows directly after the Section Data Helpers and contains S? entries, seen in UInt16 format, unless specified somewhere in the Shape Header (perhaps by 0x06 from the Shape Header?). The purpose of this section is unknown, and it is also currently not possible to know how the offset to this section is calculated, as it does not seem to be referenced by the Section Data Helpers either.
Bone References
This section follows directly after the Unknown Data 1 and contains SB entries, seen in Byte format, unless specified somewhere else in the Shape Header (perhaps by 0x1A from the Shape Header?). This section seems to list the indices of the bones in order. It is currently not possible to know how the offset to this section is calculated, as it does not seem to be referenced by the Section Data Helpers either.
Vertex Data
This section follows after the Bone References and contains SV entries. It seems to correspond to the first entry from the Section Data Helpers. The vertex data for each unit may contain position, normal, bone indices, weight data and perhaps color indices; the format of each defined by the Section Header.
Color Data
SC vertex color entries seem to come after the Vertex Data, if present; the format of each defined by the Section Header.
UV Data
SU UV entries seem to come after the Color Data, if present; the format of each defined by the Section Header.
Draw Data
After the UV entries comes the Draw Data. This section starts with a 4-byte header:
| Offset | Type | Description |
|---|---|---|
| 0x00 | Byte | Unknown. Always 0x80? Perhaps this value indicates that the data is made of Wii Graphics' commands. |
| 0x01 | UInt24 | Length of the draw commands in bytes. |
Directly after the header there are the Wii Draw Commands.
Unknown Data 2
After the Draw Data comes an Unknown Data section. It starts with a 2-byte header:
| Offset | Type | Description |
|---|---|---|
| 0x00 | UInt16 | Length of the data in bytes. |
Directly after the header there is the unknown data.
Tools
The following tools can handle AMS files:
- (none)