AMS (File Format): Difference between revisions

From Wexos's Wiki
Jump to navigationJump to search
Line 105: Line 105:
| 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 || '''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).
| 0x06.5 || 3 bits || '''Number of vertex position data sections'''. Each section corresponds to one section data helper for the vertex position data plus one for its 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 131:
| 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 || '''Next data helper offset'''. Add 1 to this value, multiply by 4 and add to the current offset from the Section Data Helpers offset.
| 0x0A.5 || 3 bits || '''Number of normal data sections'''. Each section corresponds to one section data helper for the normal data plus one for its 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 157:
| 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 || '''Next data helper offset'''. Add 1 to this value, multiply by 4 and add to the current offset from the Section Data Helpers offset.
| 0x0E.5 || 3 bits || '''Number of color data sections'''. Each section corresponds to one section data helper for the color data plus one for its 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 185: Line 185:
| 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 || '''Next data helper offset'''. Add 1 to this value, multiply by 4 and add to the current offset from the Section Data Helpers offset.
| 0x12.5 || 3 bits || '''Number of UV data sections'''. Each section corresponds to one section data helper for the UV data plus one for its 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 209:
| 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 weight/bone data (?)}}
| 0x16 || 5 bits || {{Unknown-left|'''Unknown'''. Has something to do with the format of the bone ID 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.
| 0x16.5 || 3 bits || '''Number of bone ID data sections'''. Each section corresponds to one section data helper for the bone ID data.
|-
|-
| 0x17 || 4 bits || {{Unknown-left|'''Unknown'''. Weight/bone data usage flag (?)}}
| 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 || {{Unknown-left|'''Unknown'''. Has something to do with the format of the weight/bone data (?)}}
| 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 || Byte[2] || {{Unknown-left|'''Unknown'''.}}
| 0x1A || 5 bits || {{Unknown-left|'''Unknown'''. Has something to do with the format of the weight data.}}
|-
| 0x1A.5 || 3 bits || '''Number of weight data 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'''.}}

Revision as of 22:14, 19 June 2025

Under Construction
This article is not finished. Help improve it by adding accurate information or correcting grammar and spelling.

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.
  • A: Unknown (sets some value to 32)
  • B: Unknown. 4 floats come after the end of the header.
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 data sections. Each section corresponds to one section data helper for the vertex position data plus one for its index data.
0x07 4 bits Vertex position data bytes per index in the draw commands:
  • 0: Data not used; skip
  • 2: 2 bytes (UInt16)
  • Anything else: 1 byte
0x07.4 4 bits Vertex position format.
ID Description
0 Byte
1 SByte
2 UInt16
3 Int16
4 Float
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 data sections. Each section corresponds to one section data helper for the normal data plus one for its index data.
0x0B 4 bits Normal data bytes per index in the draw commands:
  • 0: Data not used; skip
  • 2: 2 bytes (UInt16)
  • Anything else: 1 byte
0x0B.4 4 bits Vertex normal format.
ID Description
0 Byte
1 SByte
2 UInt16
3 Int16
4 Float
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 data sections. Each section corresponds to one section data helper for the color data plus one for its index data.
0x0F 4 bits Color data bytes per index in the draw commands:
  • 0: Data not used; skip
  • 2: 2 bytes (UInt16)
  • Anything else: 1 byte
0x0F.4 4 bits Vertex color format.
ID Description
0 RGB565
1 RGB8
2 RGBX8
3 RGBA4
4 RGBA6
5 RGBA8
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 data sections. Each section corresponds to one section data helper for the UV data plus one for its index data.
0x13 4 bits UV data bytes per index in the draw commands:
  • 0: Data not used; skip
  • 2: 2 bytes (UInt16)
  • Anything else: 1 byte
0x13.4 4 bits UV format.
ID Description
0 Byte
1 SByte
2 UInt16
3 Int16
4 Float
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 data 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.
ID Description
0 Byte
1 SByte
2 UInt16
3 Int16
4 Float
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 data 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.
ID Description
0 Byte
1 SByte
2 UInt16
3 Int16
4 Float
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.

Format of a section data helper
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:

Draw Data 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:

Unknown Data 2 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)