Byaml: Difference between revisions
(Minor update for version 10) |
m (Broken website moment (failed to delete apparently).) |
||
Line 34: | Line 34: | ||
|Root data offset (to ByamlContainer) | |Root data offset (to ByamlContainer) | ||
|} | |} | ||
=== Byaml Container === | === Byaml Container === | ||
{| class="wikitable" | {| class="wikitable" |
Revision as of 02:20, 27 December 2023
Byaml is Nintendo EPD's binary take on Yet Another Markup Language. It is handled by a dedicated library under the namespace "byaml" in later titles. Every version up to version 10 is supported by Nintendo's library as of Super Mario Wonder. Library supports both little and big endian.
Header
Offset | Size | Type | Description |
---|---|---|---|
0x0 | 0x2 | u16 | Magic ("YB" in little-endian, "BY" in big-endian) |
0x2 | 0x2 | u16 | Version (Up to 10 since Super Mario Wonder) |
0x4 | 0x4 | u32 | Key table offset (to ByamlContainer) |
0x8 | 0x4 | u32 | String table offset (to ByamlContainer) |
0xc | 0x4 | u32 | Root data offset (to ByamlContainer) |
Byaml Container
Offset | Size | Type | Description |
---|---|---|---|
0x0 | 0x1 | u8 (NodeDataType Enum) | Container data type |
0x1 | 0x3 | u24 | Count of container elements |
NodeDataType specific data |
As of version 10 the root data of a header can point to a non-container type, in which case the ByamlContainer header will contain only the data type, with the single value stored directly after the ByamlContainer header.
Node Data Types
u8 enum of node data types that can appear. "Value" describes what the Value in a NodeDataType + Value pair means. These pairs are found in every container type.
Name(unofficial) | Enum Value | Container "Value" Description |
---|---|---|
HashArray | 0x20-0x2f | Value is an absolute offset to a ByamlContainer of the Hash Array type |
HashArrayWithRemap | 0x30-0x3f | Same as above but when accessing elements by index that index is remapped |
StringIndex | 0xa0 | Value is an index into the string table |
BinaryData | 0xa1 | Value is an absolute offset from the header to size of binary data followed by the binary data |
BinaryDataWithAlignment | 0xa2 | Same as above but pointing to the size of the binary data, followed by alignment, followed by binary data |
Array | 0xc0 | Value is an absolute offset to a ByamlContainer of the Array type |
Dictionary | 0xc1 | Value is an absolute offset to a ByamlContainer of the Dictionary type |
Key/StringTable | 0xc2 | (Only found in ByamlContainer pointed to by header) |
DictionaryWithRemap | 0xc4 | Value is an absolute offset to a ByamlContainer of the Dictionary with remap type |
RelocatedKey/StringTable | 0xc5 | (Only found in ByamlContainer pointed to by header) |
MonoTypedArray | 0xc8 | Value is an absolute offset to a ByamlContainer of the Array with remap type |
Bool | 0xd0 | Value is a bool |
S32 | 0xd1 | Value is a signed 32-bit integer |
F32 | 0xd2 | Value is a 32-bit floating point number |
U32 | 0xd3 | Value is a unsigned 32-bit integer |
S64 | 0xd4 | Value is an absolute offset to a signed 64-bit integer |
U64 | 0xd5 | Value is an absolute offset to a unsigned 64-bit integer |
F64 | 0xd6 | Value is an absolute offset to a 64-bit floating point number |
Null | 0xff | Value is 0 (null) |
Key/String Tables (0xc2, 0xc5)
Only pointed to by the header, these tables are responsible for storing strings. The key table is used for dictionary containers and is sorted, the string table is for string data.
Key/String Table (0xc2)
Offset | Size | Type | Description |
---|---|---|---|
0x0 | 0x4 | ByamlContainer | |
0x4 | 0x4 * ByamlContainer count | u32 | String offset array, offsets relative to string table header |
string data | Array of strings |
Relocated Key/String Table (0xc5)
Offset | Size | Type | Description |
---|---|---|---|
0x0 | 0x4 | ByamlContainer | |
0x4 | 0x4 * ByamlContainer count | u32 | String offset array, except the first element, which is an offset to a u64 value to be added to the other string offsets |
Hash Array (0x20-0x2f)
Recent container types first noticed (to writer's knowledge) in the byaml library of the 3d All Stars menu. NodeDataType + Value pairs can be accessed through hash values and indices.
Hash Pair
Offset | Size | Type | Description |
---|---|---|---|
0x0 | (container NodeDataType & 0xf) * 0x4 | u32[N] | Hash |
0x4 | u32 | Value |
Hash Array (0x20-0x2f)
Offset | Size | Type | Description |
---|---|---|---|
0x0 | 0x4 | ByamlContainer | |
0x4 | 0xN * ByamlContainer count | HashPair | Hash + value array sorted by hash |
0x1 * ByamlContainer count | u8 | NodeDataType for HashPair value |
Hash Array With Remap (0x30-0x3f)
Offset | Size | Type | Description |
---|---|---|---|
0x0 | 0x4 | ByamlContainer | |
0x4 | 0xN * ByamlContainer count | HashPair | Hash + value array sorted by hash |
0x1 * ByamlContainer count | u8 | NodeDataType for HashPair value | |
(if count < 0x100) 0x1 * ByamlContainer count
(if count < 0x10000) 0x2 * ByamlContainer count (else) 0x4 * ByamlContainer count |
u8, u16, u32 | Index remap table |
Array (0xc0, 0xc8)
Container types where NodeDataType + Value pairs can be accessed through indices.
Array (0xc0)
Offset | Size | Type | Description |
---|---|---|---|
0x0 | 0x4 | ByamlContainer | |
0x4 | 0x1 * ByamlContainer count | u8 | NodeDataType array matching index of value |
0x4 * ByamlContainer count | u32 | Value array |
Mono-Typed Array (0xc8)
Offset | Size | Type | Description |
---|---|---|---|
0x0 | 0x4 | ByamlContainer | |
0x4 | 0x1 (aligned up by 0x4) | u8 | NodeDataType for every array value |
0x8 | 0x4 * ByamlContainer count | u32 | Value array |
Dictionary (0xc1, 0xc4)
Container types where NodeDataType + Value pairs can be accessed through a string key or indices.
Byaml Dictionary Pair
Offset | Size | Type | Description |
---|---|---|---|
0x0 | 0x3 | u24 | Key table index |
0x1 | 0x1 | u8 | Node Data Type |
0x4 | 0x4 | u32 | Value |
Dictionary (0xc1)
Offset | Size | Type | Description |
---|---|---|---|
0x0 | 0x4 | ByamlContainer | |
0x4 | 0x8 * ByamlContainer count | ByamlDictionaryPair | Dictionary pair array sorted by key index |
Dictionary With Remap (0xc4)
Offset | Size | Type | Description |
---|---|---|---|
0x0 | 0x4 | ByamlContainer | |
0x4 | 0x8 * ByamlContainer count | ByamlDictionaryPair | Dictionary pair array sorted by key index |
(if count < 0x100) 0x1 * ByamlContainer count
(if count < 0x10000) 0x2 * ByamlContainer count (else) 0x4 * ByamlContainer count |
u8, u16, u32 | Index remap table |