Byaml: Difference between revisions

From EPD Wiki
Jump to navigation Jump to search
(Add category.)
(Minor update for version 10)
Line 1: Line 1:
Byaml is Nintendo EPD's binary take on Yet Another Markup Language. Version 4 through 7 are supported by Nintendo's library as of the 3d All Stars menu.
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 ===
=== Header ===
Line 17: Line 17:
|0x2
|0x2
|u16
|u16
|Version (4-7)
|Version (Up to 10 since Super Mario Wonder)
|-
|-
|0x4
|0x4
Line 32: Line 32:
|0x4
|0x4
|u32
|u32
|Root container offset (to ByamlContainer)
|Root data offset (to ByamlContainer)
|}
|}
As of version 10 the root data can point to a non-container type, in which the value will be stored directly after the ByamlContainer


=== Byaml Container ===
=== Byaml Container ===
Line 58: Line 59:
|NodeDataType specific data
|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 ===
=== Node Data Types ===
u8 enum of data types that can appear. "Value" describes what the Value in a NodeDataType + Value pair means. These pairs are found in every container type.
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.
{| class="wikitable"
{| class="wikitable"
|+Version 7
|+Version 7
!Name(unofficial)
!Name(unofficial)
!Value
!Enum Value
!Container "Value" Description
!Container "Value" Description
|-
|-
Line 171: Line 173:
|}
|}


==== Relocated Key/String Table (0xc2) (TODO) ====
==== Relocated Key/String Table (0xc5) ====
{| class="wikitable"
{| class="wikitable"
|+Version 7
|+Version 7
Line 184: Line 186:
|
|
|-
|-
|
|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) ===
=== Hash Array (0x20-0x2f) ===
Recent container types first appearing (to writer's knowledge) in the code of the byaml library in the 3d All Stars menu. NodeDataType + Value pairs can be accessed through hash values and indices.
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 ====
==== Hash Pair ====
Line 212: Line 204:
|-
|-
|0x0
|0x0
|(NodeDataType & 0xf) * 0x4
|(container NodeDataType & 0xf) * 0x4
|u32[N]
|u32[N]
|Hash
|Hash
Line 270: Line 262:
|-
|-
|
|
|0x1 * ByamlContainer count (if count < 0x100),
|(if count < 0x100) 0x1 * ByamlContainer count
0x2 * ByamlContainer count (if count < 0x10000),
(if count < 0x10000) 0x2 * ByamlContainer count
0x4 * ByamlContainer count (else)
 
(else) 0x4 * ByamlContainer count
|u8, u16, u32
|u8, u16, u32
|Index remap table
|Index remap table
Line 318: Line 311:
|-
|-
|0x4
|0x4
|0x1
|0x1 (aligned up by 0x4)
|u8
|u8
|NodeDataType for every array value
|NodeDataType for every array value
Line 393: Line 386:
|-
|-
|
|
|0x1 * ByamlContainer count (if count < 0x100),
|(if count < 0x100) 0x1 * ByamlContainer count
0x2 * ByamlContainer count (if count < 0x10000),
(if count < 0x10000) 0x2 * ByamlContainer count
0x4 * ByamlContainer count (else)
 
(else) 0x4 * ByamlContainer count
|u8, u16, u32
|u8, u16, u32
|Index remap table
|Index remap table
|}
|}
[[Category:File formats]]
[[Category:File formats]]

Revision as of 02:18, 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

Version 4-7
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)

As of version 10 the root data can point to a non-container type, in which the value will be stored directly after the ByamlContainer

Byaml Container

Version 4-7
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.

Version 7
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)

Version 4-7
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)

Version 7
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

Version 7
Offset Size Type Description
0x0 (container NodeDataType & 0xf) * 0x4 u32[N] Hash
0x4 u32 Value

Hash Array (0x20-0x2f)

Version 7
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)

Version 7
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)

Version 4-7
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)

Version 7
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

Version 4-7
Offset Size Type Description
0x0 0x3 u24 Key table index
0x1 0x1 u8 Node Data Type
0x4 0x4 u32 Value

Dictionary (0xc1)

Version 4-7
Offset Size Type Description
0x0 0x4 ByamlContainer
0x4 0x8 * ByamlContainer count ByamlDictionaryPair Dictionary pair array sorted by key index

Dictionary With Remap (0xc4)

Version 7
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