BYML: Difference between revisions

2,567 bytes added ,  1 year ago
Updated file format to version 7 for TotK
imported>Leoetlino
(Updated file format to version 7 for TotK)
 
Line 18: Line 18:
| align="center" | 0x02
| align="center" | 0x02
| align="center" | 2
| align="center" | 2
| Version 0x0002 in ''Breath of the Wild''. 1, 3 and 4 are also valid version numbers.
| Version 2 in ''Breath of the Wild'', Versions 4 to 7 in ''Tears of the Kingdom''. 1 and 3 are also valid version numbers.
|-
|-
| align="center" | 0x04
| align="center" | 0x04
Line 30: Line 30:
| align="center" | 0x0c
| align="center" | 0x0c
| align="center" | 4
| align="center" | 4
| Offset to the root node, relative to start. May be 0 if the document is totally empty. Must be either an array node (0xc0) or a hash node (0xc1).
| Offset to the root node, relative to start. May be 0 if the document is totally empty. Must be either an array node (0xc0) or one of the hash nodes (0x20, 0x21 or 0xc1).
|}
|}


Line 42: Line 42:
! width="63%" | Description
! width="63%" | Description
! width="10%" | Version
! width="10%" | Version
|-
| align="center" | 0x20
| align="center" | Container
| Plain hash. Node is a mapping from 32-bit hashes to other nodes.
| 7+
|-
| align="center" | 0x21
| align="center" | Container
| Value hash. Node is a mapping from 32-bit hashes to other nodes and a second 4 byte value.
| 7+
|-
|-
| align="center" | 0xA0
| align="center" | 0xA0
Line 52: Line 62:
| Binary data.
| Binary data.
| 4+
| 4+
|-
| align="center" | 0xA2
| align="center" | Value (Special)
| File data. Node contains the binary data of another file.
| 5+
|-
|-
| align="center" | 0xC0
| align="center" | 0xC0
Line 60: Line 75:
| align="center" | 0xC1
| align="center" | 0xC1
| align="center" | Container
| align="center" | Container
| Hash. Node is a mapping from strings in the hash key table to other nodes.
| String hash. Node is a mapping from strings in the hash key table to other nodes.
| 2+
| 2+
|-
|-
Line 116: Line 131:


For special value nodes, the value is an offset relative to the start of the file.
For special value nodes, the value is an offset relative to the start of the file.
==== 0x20 - Hash Node ====
Hash / dictionary nodes are used to encode name value collections. Entries must sorted by their hash value.
{| class="wikitable"
! align="center" | Offset
! align="center" | Size
! Description
|-
| align="center" | 0x00
| align="center" | 1
| 0x20 node type.
|-
| align="center" | 0x01
| align="center" | 3
| Number of entries in dictionary.
|-
| align="center" | 0x04
| align="center" | 8*N
| Dictionary entries.
|-
| align="center" | 0x04+8*N
| align="center" | 1*N
| Array of N types, on for each entry in the dictionary. This is padded to 4 bytes.
|}
Each entry in the dictionary has the following structure.
{| class="wikitable"
! align="center" width="5%" | Offset
! align="center" width="3%" | Size
! width="90%" | Description
|-
| align="center" | 0x00
| align="center" | 4
| Hash. A 32-bit hash of the key.
|-
| align="center" | 0x04
| align="center" | 4
| Value. For regular value nodes, this is the 4 byte node value. For other nodes, this is a 4 byte offset to the node relative to the start of the file.
|}
==== 0x21 - Value Hash Node ====
This type is the similar to the hash node with the addition of a 4-byte value in each dictionary entry.
{| class="wikitable"
! align="center" width="5%" | Offset
! align="center" width="3%" | Size
! width="90%" | Description
|-
| align="center" | 0x00
| align="center" | 4
| Value. For regular value nodes, this is the 4 byte node value. For other nodes, this is a 4 byte offset to the node relative to the start of the file.
|-
| align="center" | 0x04
| align="center" | 4
| Hash. A 32-bit hash of the key.
|-
| align="center" | 0x08
| align="center" | 4
| Unknown. Always 0 in ''Tears of the Kingdom''.
|}


==== 0xA1 - Binary Data Node ====
==== 0xA1 - Binary Data Node ====
Line 130: Line 209:
| align="center" | variable
| align="center" | variable
| Data
| Data
|}
==== 0xA2 - File Node ====
{| class="wikitable"
! align="center" | Offset
! align="center" | Size
! Description
|-
| align="center" | 0x00
| align="center" | 4
| File length
|-
| align="center" | 0x04
| align="center" | 4
| Unknown. Always 0x1000.
|-
| align="center" | 0x08
| align="center" | variable
| File data
|}
|}


Line 158: Line 256:
N’ is N rounded up to the nearest multiple of 4.
N’ is N rounded up to the nearest multiple of 4.


==== 0xC1 - Hash Node ====
==== 0xC1 - String Hash Node ====


Hash / dictionary nodes are used to encode name value collections. Entries must be lexicographically sorted<ref>Nintendo's BYML library performs a binary search when looking up items by key in a hash node.</ref>.
Hash / dictionary nodes are used to encode name value collections. Entries must be lexicographically sorted<ref>Nintendo's BYML library performs a binary search when looking up items by key in a hash node.</ref>.
Line 247: Line 345:
* [[Bquestpack|.bquestpack]]
* [[Bquestpack|.bquestpack]]
* [[BYML|.byml]]
* [[BYML|.byml]]
* [[BYML|.byaml]]
* [[Mubin|.mubin]]
* [[Mubin|.mubin]]
TotK has added the following extensions:
* .bgyml


== Tools ==
== Tools ==
2

edits