AMS (File Format): Difference between revisions
No edit summary |
|||
| (16 intermediate revisions by the same user not shown) | |||
| Line 13: | Line 13: | ||
| 0x00 || Char[4] || '''File magic'''. Always ''ALMS'' in ASCII. | | 0x00 || Char[4] || '''File magic'''. Always ''ALMS'' in ASCII. | ||
|- | |- | ||
| 0x04 || Byte || {{Unknown-left|'''Unknown'''. Format type? Values seen are 2 and 8.}} | | 0x04 || Byte || {{Unknown-left|'''Unknown'''. Format type or version? Values seen are 2, 3, 4, 5, 6, 7 and 8.}} | ||
|- | |- | ||
| 0x05 || Byte || {{Unknown-left|'''Unknown'''. Posibly bit flags, but files either use 0x80 or 0x81.}} | | 0x05 || Byte || {{Unknown-left|'''Unknown'''. Posibly bit flags, but files either use 0x80 or 0x81.}} | ||
| Line 25: | Line 25: | ||
| 0x09 || Byte || '''Number of bones''' ('''B'''). | | 0x09 || Byte || '''Number of bones''' ('''B'''). | ||
|- | |- | ||
| 0x0A || Byte | | | 0x0A || Byte || '''Number of shape groups''' ('''G'''). | ||
|- | |- | ||
| 0x0B || Byte | | | 0x0B || Byte || '''Length of each material section''' in bytes. | ||
|- | |- | ||
| 0x0C || Float[ | | 0x0C || Float[3] || '''XYZ position''' of the model (does not apply to bones). | ||
|- | |- | ||
| | | 0x18 || Float || '''Scale''' of the model (does not apply to bones). | ||
|- | |- | ||
| 0x1C || UInt16 || '''[[#Section 1|Section 1]] offset'''. | | 0x1C || UInt16 || '''[[#Section 1|Section 1]] offset'''. | ||
| Line 43: | Line 43: | ||
== Section 1 == | == Section 1 == | ||
This section defines '''M''' | This section defines '''M''' material entries. | ||
=== Material === | === Material === | ||
'' | {| class="wikitable" | ||
! Offset !! Type !! Description | |||
|- | |||
| 0x00 || Byte || {{Unknown-left|'''Unknown'''.}} | |||
|- | |||
| 0x01 || Byte || {{Unknown-left|'''Unknown'''.}} | |||
|- | |||
| 0x02 || Byte || {{Unknown-left|'''Unknown'''.}} | |||
|- | |||
| 0x03 || Byte || {{Unknown-left|'''Unknown'''. Always 0xB2?}} | |||
|- | |||
| 0x04 || Byte || '''Texture reference ID'''. 0xFF if none. | |||
|- | |||
| 0x05 || Byte || {{Unknown-left|'''Unknown'''.}} | |||
|- | |||
| 0x06 || Byte || {{Unknown-left|'''Unknown'''.}} | |||
|- | |||
| 0x07 || Byte || {{Unknown-left|'''Unknown'''.}} | |||
|- | |||
| 0x08 || Byte || {{Unknown-left|'''Unknown'''.}} | |||
|- | |||
| 0x09 || Byte || {{Unknown-left|'''Unknown'''.}} | |||
|- | |||
| 0x0A || Byte || {{Unknown-left|'''Unknown'''.}} | |||
|- | |||
| 0x0B || Byte || {{Unknown-left|'''Unknown'''.}} | |||
|} | |||
== Section 2 == | == Section 2 == | ||
| Line 61: | Line 87: | ||
== Section 3 == | == Section 3 == | ||
This section defines '''B''' | This section defines '''B''' bone entries. | ||
=== Bone === | === Bone === | ||
{| class="wikitable" | {| class="wikitable" | ||
! Offset !! Type !! Description | ! Offset !! Type !! Description | ||
|- | |- bgcolor="#AAFFAA" | ||
| colspan="3" align="center" | '''If [[#Header|format]] = 7''' | |||
|- bgcolor="#DDFFDD" | |||
| 0x00 || Char[4] || '''Bone name/ID'''. Hardcoded to be 4 characters long. | |||
|- bgcolor="#FFAAAA" | |||
| colspan="3" align="center" | '''Else''' | |||
|- bgcolor="#FFDDDD" | |||
| 0x00 || float[3] || '''XYZ position'''. | | 0x00 || float[3] || '''XYZ position'''. | ||
|- | |- bgcolor="#FFDDDD" | ||
| 0x0C || Char[4] || '''Bone name'''. Hardcoded to be 4 characters long. | | 0x0C || Char[4] || '''Bone name/ID'''. Hardcoded to be 4 characters long. | ||
|- | |- bgcolor="#FFDDDD" | ||
| 0x10 || float[4] || '''Rotation''', using quaternions. | | 0x10 || float[4] || '''Rotation''', using quaternions. | ||
|- | |- bgcolor="#FFDDDD" | ||
| 0x20 || float[4] || {{Unknown-left|'''Unknown'''.}} | | 0x20 || float[4] || {{Unknown-left|'''Unknown'''.}} | ||
|} | |} | ||
== Section 4 == | == Section 4 == | ||
This section defines '''S''' shape entries. | This section defines '''S''' * '''G''' shape entries. | ||
{| class="wikitable" | {| class="wikitable" | ||
| Line 91: | Line 123: | ||
! Offset !! Type !! Description | ! Offset !! Type !! Description | ||
|- | |- | ||
| 0x00 || Byte | | | 0x00 || Byte || '''Material ID'''. | ||
|- | |- | ||
| 0x01 || Byte || {{Unknown-left|'''Unknown'''. | | 0x01 || Byte || {{Unknown-left|'''Unknown'''.}} | ||
|- | |- | ||
| 0x02 || Byte || '''Flag''': xxx'''A''' xxx'''B'''. | | 0x02 || Byte || '''Flag''': xxx'''A''' xxx'''B'''. | ||
| Line 105: | Line 137: | ||
| 0x06 || 5 bits || {{Unknown-left|'''Unknown'''. Has something to do with the format of the vertex data.}} | | 0x06 || 5 bits || {{Unknown-left|'''Unknown'''. Has something to do with the format of the vertex data.}} | ||
|- | |- | ||
| 0x06.5 || 3 bits || ''' | | 0x06.5 || 3 bits || '''Number of vertex position sections'''. Each section corresponds to one section data helper for the vertex positions' index data. | ||
|- | |- | ||
| 0x07 || 4 bits || '''Vertex data bytes per index''' in the draw commands: | | 0x07 || 4 bits || '''Vertex position data bytes per index''' in the draw commands: | ||
* '''0''': Data not used; skip | * '''0''': Data not used; skip | ||
* '''2''': 2 bytes (UInt16) | * '''2''': 2 bytes (UInt16) | ||
| Line 131: | Line 163: | ||
| 0x0A || 5 bits || {{Unknown-left|'''Unknown'''. Has something to do with the format of the normal data.}} | | 0x0A || 5 bits || {{Unknown-left|'''Unknown'''. Has something to do with the format of the normal data.}} | ||
|- | |- | ||
| 0x0A.5 || 3 bits || ''' | | 0x0A.5 || 3 bits || '''Number of normal sections'''. Each section corresponds to one section data helper for the normals' index data. | ||
|- | |- | ||
| 0x0B || 4 bits || '''Normal data bytes per index''' in the draw commands: | | 0x0B || 4 bits || '''Normal data bytes per index''' in the draw commands: | ||
| Line 157: | Line 189: | ||
| 0x0E || 5 bits || {{Unknown-left|'''Unknown'''. Has something to do with the format of the color data.}} | | 0x0E || 5 bits || {{Unknown-left|'''Unknown'''. Has something to do with the format of the color data.}} | ||
|- | |- | ||
| 0x0E.5 || 3 bits || ''' | | 0x0E.5 || 3 bits || '''Number of color sections'''. Each section corresponds to one section data helper for the colors' index data. | ||
|- | |- | ||
| 0x0F || 4 bits || '''Color data bytes per index''' in the draw commands: | | 0x0F || 4 bits || '''Color data bytes per index''' in the draw commands: | ||
| Line 168: | Line 200: | ||
! ID !! Description | ! ID !! Description | ||
|- | |- | ||
| 0 || | | 0 || RGBA8 | ||
|- | |- | ||
| 1 || RGB8 | | 1 || RGB8 | ||
| Line 178: | Line 210: | ||
| 4 || RGBA6 | | 4 || RGBA6 | ||
|- | |- | ||
| 5 || | | 5 || RGB565 | ||
|} | |} | ||
|- | |- | ||
| Line 185: | Line 217: | ||
| 0x12 || 5 bits || {{Unknown-left|'''Unknown'''. Has something to do with the format of the UV data.}} | | 0x12 || 5 bits || {{Unknown-left|'''Unknown'''. Has something to do with the format of the UV data.}} | ||
|- | |- | ||
| 0x12.5 || 3 bits || ''' | | 0x12.5 || 3 bits || '''Number of UV sections'''. Each section corresponds to one section data helper for the UVs' index data. | ||
|- | |- | ||
| 0x13 || 4 bits || '''UV data bytes per index''' in the draw commands: | | 0x13 || 4 bits || '''UV data bytes per index''' in the draw commands: | ||
| Line 209: | Line 241: | ||
| 0x14 || UInt16 || Number of '''UVs''' ('''SU'''). | | 0x14 || UInt16 || Number of '''UVs''' ('''SU'''). | ||
|- | |- | ||
| 0x16 || 5 bits || {{Unknown-left|'''Unknown'''. Has something to do with the format of the | | 0x16 || 5 bits || {{Unknown-left|'''Unknown'''. Has something to do with the format of the bone ID data.}} | ||
|- | |- | ||
| 0x16.5 || 3 bits || ''' | | 0x16.5 || 3 bits || '''Number of bone ID sections'''. Each section corresponds to one section data helper for the bone ID data. | ||
|- | |- | ||
| 0x17 || 4 bits || {{Unknown-left|'''Unknown'''. | | 0x17 || 4 bits || {{Unknown-left|'''Unknown'''. This value would correspond to the bone ID data bytes per index, but instead each entry corresponds to a vertex position. If bones are used, this value is always 1 (?)}} | ||
|- | |- | ||
| 0x17.4 || 4 bits | | | 0x17.4 || 4 bits || '''Bone ID format'''. | ||
{| class="wikitable" | |||
! ID !! Description | |||
|- | |||
| 0 || Byte | |||
|- | |||
| 1 || SByte | |||
|- | |||
| 2 || UInt16 | |||
|- | |||
| 3 || Int16 | |||
|- | |||
| 4 || Float | |||
|} | |||
|- | |- | ||
| 0x18 || UInt16 || Number of '''bone entries''' ('''SB'''). | | 0x18 || UInt16 || Number of '''bone entries''' ('''SB'''). | ||
|- | |- | ||
| 0x1A || | | 0x1A || 5 bits || {{Unknown-left|'''Unknown'''. Has something to do with the format of the weight data.}} | ||
|- | |||
| 0x1A.5 || 3 bits || '''Number of weight sections'''. Each section corresponds to one section data helper for the weight data. | |||
|- | |||
| 0x1B || 4 bits || {{Unknown-left|'''Unknown'''. This value would correspond to the weight data bytes per index, but instead each entry corresponds to a vertex position. Always 0 (?)}} | |||
|- | |||
| 0x1B.4 || 4 bits || '''Weight format'''. | |||
{| class="wikitable" | |||
! ID !! Description | |||
|- | |||
| 0 || Byte | |||
|- | |||
| 1 || SByte | |||
|- | |||
| 2 || UInt16 | |||
|- | |||
| 3 || Int16 | |||
|- | |||
| 4 || Float | |||
|} | |||
|- | |- | ||
| 0x1C || Byte[2] || {{Unknown-left|'''Unknown'''.}} | | 0x1C || Byte[2] || {{Unknown-left|'''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). | | 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). This value is always aligned by 4 bytes. | ||
|} | |} | ||
| Line 239: | Line 303: | ||
=== Unknown Data 1 === | === 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 | This section follows directly after the Section Data Helpers and contains '''S?''' entries, seen in UInt16 format, unless specified somewhere in the Shape Header. The purpose of this section is unknown and it does not seem to be referenced by the Section Data Helpers. | ||
=== Bone References === | === 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 | 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. This section seems to list the indices of the bones in order. This section does not seem to be referenced by the Section Data Helpers. | ||
=== Vertex Position Data === | === Vertex Position Data === | ||
| Line 270: | Line 334: | ||
Directly after the header there are the Wii Draw Commands. | Directly after the header there are the Wii Draw Commands. | ||
=== | === Bone Index Palette === | ||
After the Draw Data comes | After the Draw Data comes a section that contains a (compressed?) palette of bone indices, presumably linking position matrix IDs from the draw commands to multiple bone IDs. | ||
{| class="wikitable" | {| class="wikitable" | ||
| Line 277: | Line 341: | ||
! Offset !! Type !! Description | ! Offset !! Type !! Description | ||
|- | |- | ||
| 0x00 || UInt16 || '''Length of the | | 0x00 || UInt16 || '''Length of the palette''' in bytes ('''P'''). | ||
|- | |||
| 0x00 || Byte || '''Number of bones'''. | |||
|- | |||
| 0x01 || Byte['''P''' - 1] || {{Unknown-left|'''Unknown'''. Index data seems to be compressed/mixed in some way?}} | |||
|} | |} | ||
= Tools = | = Tools = | ||
Latest revision as of 13:13, 31 August 2025
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 or version? Values seen are 2, 3, 4, 5, 6, 7 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 | Number of shape groups (G). |
| 0x0B | Byte | Length of each material section in bytes. |
| 0x0C | Float[3] | XYZ position of the model (does not apply to bones). |
| 0x18 | Float | Scale of the model (does not apply to bones). |
| 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 material entries.
Material
| Offset | Type | Description |
|---|---|---|
| 0x00 | Byte | Unknown. |
| 0x01 | Byte | Unknown. |
| 0x02 | Byte | Unknown. |
| 0x03 | Byte | Unknown. Always 0xB2? |
| 0x04 | Byte | Texture reference ID. 0xFF if none. |
| 0x05 | Byte | Unknown. |
| 0x06 | Byte | Unknown. |
| 0x07 | Byte | Unknown. |
| 0x08 | Byte | Unknown. |
| 0x09 | Byte | Unknown. |
| 0x0A | Byte | Unknown. |
| 0x0B | Byte | Unknown. |
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 bone entries.
Bone
| Offset | Type | Description |
|---|---|---|
| If format = 7 | ||
| 0x00 | Char[4] | Bone name/ID. Hardcoded to be 4 characters long. |
| Else | ||
| 0x00 | float[3] | XYZ position. |
| 0x0C | Char[4] | Bone name/ID. Hardcoded to be 4 characters long. |
| 0x10 | float[4] | Rotation, using quaternions. |
| 0x20 | float[4] | Unknown. |
Section 4
This section defines S * G 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 | Material ID. | ||||||||||||||
| 0x01 | Byte | Unknown. | ||||||||||||||
| 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 | Number of vertex position sections. Each section corresponds to one section data helper for the vertex positions' index data. | ||||||||||||||
| 0x07 | 4 bits | Vertex position data bytes per index in the draw commands:
| ||||||||||||||
| 0x07.4 | 4 bits | Vertex position format.
| ||||||||||||||
| 0x08 | UInt16 | Number of vertex positions (SP). | ||||||||||||||
| 0x0A | 5 bits | Unknown. Has something to do with the format of the normal data. | ||||||||||||||
| 0x0A.5 | 3 bits | Number of normal sections. Each section corresponds to one section data helper for the normals' index data. | ||||||||||||||
| 0x0B | 4 bits | Normal data bytes per index in the draw commands:
| ||||||||||||||
| 0x0B.4 | 4 bits | Vertex normal format.
| ||||||||||||||
| 0x0C | UInt16 | Number of vertex 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 | Number of color sections. Each section corresponds to one section data helper for the colors' index data. | ||||||||||||||
| 0x0F | 4 bits | Color data bytes per index in the draw commands:
| ||||||||||||||
| 0x0F.4 | 4 bits | Vertex color format.
| ||||||||||||||
| 0x10 | UInt16 | Number of vertex colors (SC). | ||||||||||||||
| 0x12 | 5 bits | Unknown. Has something to do with the format of the UV data. | ||||||||||||||
| 0x12.5 | 3 bits | Number of UV sections. Each section corresponds to one section data helper for the UVs' index data. | ||||||||||||||
| 0x13 | 4 bits | UV data bytes per index in the draw commands:
| ||||||||||||||
| 0x13.4 | 4 bits | UV format.
| ||||||||||||||
| 0x14 | UInt16 | Number of UVs (SU). | ||||||||||||||
| 0x16 | 5 bits | Unknown. Has something to do with the format of the bone ID data. | ||||||||||||||
| 0x16.5 | 3 bits | Number of bone ID sections. Each section corresponds to one section data helper for the bone ID data. | ||||||||||||||
| 0x17 | 4 bits | Unknown. This value would correspond to the bone ID data bytes per index, but instead each entry corresponds to a vertex position. If bones are used, this value is always 1 (?) | ||||||||||||||
| 0x17.4 | 4 bits | Bone ID format.
| ||||||||||||||
| 0x18 | UInt16 | Number of bone entries (SB). | ||||||||||||||
| 0x1A | 5 bits | Unknown. Has something to do with the format of the weight data. | ||||||||||||||
| 0x1A.5 | 3 bits | Number of weight sections. Each section corresponds to one section data helper for the weight data. | ||||||||||||||
| 0x1B | 4 bits | Unknown. This value would correspond to the weight data bytes per index, but instead each entry corresponds to a vertex position. Always 0 (?) | ||||||||||||||
| 0x1B.4 | 4 bits | Weight format.
| ||||||||||||||
| 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). This value is always aligned by 4 bytes. |
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. The purpose of this section is unknown and it does not seem to be referenced by the Section Data Helpers.
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. This section seems to list the indices of the bones in order. This section does not seem to be referenced by the Section Data Helpers.
Vertex Position Data
This section follows after the Bone References and contains SP entries; the format of each defined by the Section Header. Sometimes vertex positions, normals and weight/bone indices may be packed together in this section.
Vertex Normal Data
SN vertex normal entries seem to come after the Vertex Position Data, if present; the format of each defined by the Section Header.
Vertex Color Data
SC vertex color entries seem to come after the Vertex Normal 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.
Bone Index Palette
After the Draw Data comes a section that contains a (compressed?) palette of bone indices, presumably linking position matrix IDs from the draw commands to multiple bone IDs.
| Offset | Type | Description |
|---|---|---|
| 0x00 | UInt16 | Length of the palette in bytes (P). |
| 0x00 | Byte | Number of bones. |
| 0x01 | Byte[P - 1] | Unknown. Index data seems to be compressed/mixed in some way? |
Tools
The following tools can handle AMS files:
- (none)