BYML: Difference between revisions
no edit summary
imported>Leoetlino (Created page with "'''BYML''' is a file format that is used as a generic data container throughout ''Breath of the Wild''. It is a simplified, binary form of YAML. Only the v...") |
imported>Leoetlino No edit summary |
||
Line 7: | Line 7: | ||
=== Header === | === Header === | ||
{|class="wikitable" | {| class="wikitable" | ||
!align="center" width="4%"| Offset | ! align="center" width="4%" | Offset | ||
!align="center" width="3%"| Size | ! align="center" width="3%" | Size | ||
!width="91%"| Description | ! width="91%" | Description | ||
|- | |- | ||
|align="center"| 0x00 | | align="center" | 0x00 | ||
|align="center"| 2 | | align="center" | 2 | ||
| String “BY” (big endian) or “YB” (little endian) in ASCII (file identifier). | | String “BY” (big endian) or “YB” (little endian) in ASCII (file identifier). | ||
|- | |- | ||
|align="center"| 0x02 | | align="center" | 0x02 | ||
|align="center"| 2 | | align="center" | 2 | ||
| Version 0x0002 in Breath of the Wild. Values of 1 and 3 are accepted as well. | | Version 0x0002 in Breath of the Wild. Values of 1 and 3 are accepted as well. | ||
|- | |- | ||
|align="center"| 0x04 | | align="center" | 0x04 | ||
|align="center"| 4 | | align="center" | 4 | ||
| Offset to the hash key table, relative to start (usually 0x010). May be 0 if no hash nodes are used. Must be a string value node (0xc2). | | Offset to the hash key table, relative to start (usually 0x010). May be 0 if no hash nodes are used. Must be a string value node (0xc2). | ||
|- | |- | ||
|align="center"| 0x08 | | align="center" | 0x08 | ||
|align="center"| 4 | | align="center" | 4 | ||
| Offset to the string table, relative to start. May be 0 if no strings are used. Must be a string value node (0xc2). | | Offset to the string table, relative to start. May be 0 if no strings are used. Must be a string value node (0xc2). | ||
|- | |- | ||
|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 a hash node (0xc1). | ||
|} | |} | ||
Line 37: | Line 37: | ||
Every node format has a unique one byte identifier as follows. Some nodes are considered value nodes as indicated below. The container nodes have a longer encoding in the file, which must be four byte aligned. The order of encoding full nodes within the file does not seem to matter. | Every node format has a unique one byte identifier as follows. Some nodes are considered value nodes as indicated below. The container nodes have a longer encoding in the file, which must be four byte aligned. The order of encoding full nodes within the file does not seem to matter. | ||
{|class="wikitable" | {| class="wikitable" | ||
!align="center" width="8%"| Identifier | ! align="center" width="8%" | Identifier | ||
!align="center" width="17%"| Type | ! align="center" width="17%" | Type | ||
!width="73%"| Description | ! width="73%" | Description | ||
|- | |- | ||
|align="center"| 0xA0 | | align="center" | 0xA0 | ||
|align="center"| Value (Index) | | align="center" | Value (Index) | ||
| String. Value is an index into the string table. | | String. Value is an index into the string table. | ||
|- | |- | ||
|align="center"| 0xC0 | | align="center" | 0xC0 | ||
|align="center"| Container | | align="center" | Container | ||
| Array. Node is an array of nodes, typically, though not necessarily, all of the same format. | | Array. Node is an array of nodes, typically, though not necessarily, all of the same format. | ||
|- | |- | ||
|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. | | Hash. Node is a mapping from strings in the hash key table to other nodes. | ||
|- | |- | ||
|align="center"| 0xC2 | | align="center" | 0xC2 | ||
|align="center"| Container (Special) | | align="center" | Container (Special) | ||
| String table. Special purpose node type only seen in the hash key table and the string table. | | String table. Special purpose node type only seen in the hash key table and the string table. | ||
|- | |- | ||
|align="center"| 0xD0 | | align="center" | 0xD0 | ||
|align="center"| Value | | align="center" | Value | ||
| Bool. Node is 1 or 0 representing true or false respectively. | | Bool. Node is 1 or 0 representing true or false respectively. | ||
|- | |- | ||
|align="center"| 0xD1 | | align="center" | 0xD1 | ||
|align="center"| Value | | align="center" | Value | ||
| Int. Node is a signed 32 bit integer value. | | Int. Node is a signed 32 bit integer value. | ||
|- | |- | ||
|align="center"| 0xD2 | | align="center" | 0xD2 | ||
|align="center"| Value | | align="center" | Value | ||
| Float. Node is a binary32 floating-point number. | | Float. Node is a binary32 floating-point number. | ||
|- | |- | ||
|align="center"| 0xD3 | | align="center" | 0xD3 | ||
|align="center"| Value | | align="center" | Value | ||
| UInt. Node is an unsigned 32 bit integer value. The game uses this for some CRC32 hashes and for masks. | | UInt. Node is an unsigned 32 bit integer value. The game uses this for some CRC32 hashes and for masks. | ||
|- | |- | ||
|align="center"| 0xD4 | | align="center" | 0xD4 | ||
|align="center"| Value (Special) | | align="center" | Value (Special) | ||
| Int64. Node is a 64 bit integer value. Not seen in Breath of the Wild. | | Int64. Node is a 64 bit integer value. Not seen in Breath of the Wild. | ||
|- | |- | ||
|align="center"| 0xD5 | | align="center" | 0xD5 | ||
|align="center"| Value (Special) | | align="center" | Value (Special) | ||
| UInt64. Node is an unsigned 64 bit integer value. Not seen in Breath of the Wild. | | UInt64. Node is an unsigned 64 bit integer value. Not seen in Breath of the Wild. | ||
|- | |- | ||
|align="center"| 0xD6 | | align="center" | 0xD6 | ||
|align="center"| Value (Special) | | align="center" | Value (Special) | ||
| Double. Node is a binary64 floating-point number. Not seen in Breath of the Wild. | | Double. Node is a binary64 floating-point number. Not seen in Breath of the Wild. | ||
|- | |- | ||
|align="center"| 0xFF | | align="center" | 0xFF | ||
|align="center"| Value | | align="center" | Value | ||
| Null. Value is always 0. Not seen in Breath of the Wild. | | Null. Value is always 0. Not seen in Breath of the Wild. | ||
|} | |} | ||
Line 101: | Line 101: | ||
==== 0xC0 - Array Node ==== | ==== 0xC0 - Array Node ==== | ||
{|class="wikitable" | {| class="wikitable" | ||
!align="center" width="12%"| Offset | ! align="center" width="12%" | Offset | ||
!align="center" width="6%"| Size | ! align="center" width="6%" | Size | ||
!width="81%"| Description | ! width="81%" | Description | ||
|- | |- | ||
|align="center"| 0x00 | | align="center" | 0x00 | ||
|align="center"| 1 | | align="center" | 1 | ||
| 0xC0 node type. | | 0xC0 node type. | ||
|- | |- | ||
|align="center"| 0x01 | | align="center" | 0x01 | ||
|align="center"| 3 | | align="center" | 3 | ||
| Number of entries in array. | | Number of entries in array. | ||
|- | |- | ||
|align="center"| 0x04 | | align="center" | 0x04 | ||
|align="center"| N | | align="center" | N | ||
| Array of N node types; the type of each element in the array. | | Array of N node types; the type of each element in the array. | ||
|- | |- | ||
|align="center"| 0x04 + N’ | | align="center" | 0x04 + N’ | ||
|align="center"| 4*N | | align="center" | 4*N | ||
| Array of N node values. For regular value nodes, this is a 4 byte node value. For other nodes, this is a 4 byte offset to the node relative to the start of the file. | | Array of N node values. For regular value nodes, this is a 4 byte node value. For other nodes, this is a 4 byte offset to the node relative to the start of the file. | ||
|} | |} | ||
Line 129: | Line 129: | ||
Hash / dictionary nodes are used to encode name value collections. The order of entries in the dictionary does not seem to matter. | Hash / dictionary nodes are used to encode name value collections. The order of entries in the dictionary does not seem to matter. | ||
{|class="wikitable" | {| class="wikitable" | ||
!align="center"| Offset | ! align="center" | Offset | ||
!align="center"| Size | ! align="center" | Size | ||
! Description | ! Description | ||
|- | |- | ||
|align="center"| 0x00 | | align="center" | 0x00 | ||
|align="center"| 1 | | align="center" | 1 | ||
| 0xC1 node type. | | 0xC1 node type. | ||
|- | |- | ||
|align="center"| 0x01 | | align="center" | 0x01 | ||
|align="center"| 3 | | align="center" | 3 | ||
| Number of entries in dictionary. | | Number of entries in dictionary. | ||
|} | |} | ||
Line 145: | Line 145: | ||
What then follows is a variable length array of dictionary entries. Each entry has the following structure. | What then follows is a variable length array of dictionary entries. Each entry has the following structure. | ||
{|class="wikitable" | {| class="wikitable" | ||
!align="center" width="5%"| Offset | ! align="center" width="5%" | Offset | ||
!align="center" width="3%"| Size | ! align="center" width="3%" | Size | ||
!width="90%"| Description | ! width="90%" | Description | ||
|- | |- | ||
|align="center"| 0x00 | | align="center" | 0x00 | ||
|align="center"| 3 | | align="center" | 3 | ||
| Name. Value is an index in the hash key table. | | Name. Value is an index in the hash key table. | ||
|- | |- | ||
|align="center"| 0x03 | | align="center" | 0x03 | ||
|align="center"| 1 | | align="center" | 1 | ||
| The node type. | | The node type. | ||
|- | |- | ||
|align="center"| 0x04 | | align="center" | 0x04 | ||
|align="center"| 4 | | 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. | | 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. | ||
|} | |} | ||
Line 165: | Line 165: | ||
==== 0xC2 - String Table Node ==== | ==== 0xC2 - String Table Node ==== | ||
{|class="wikitable" | {| class="wikitable" | ||
!align="center" width="4%"| Offset | ! align="center" width="4%" | Offset | ||
!align="center" width="7%"| Size | ! align="center" width="7%" | Size | ||
!width="87%"| Description | ! width="87%" | Description | ||
|- | |- | ||
|align="center"| 0x00 | | align="center" | 0x00 | ||
|align="center"| 1 | | align="center" | 1 | ||
| 0xC2 node type. | | 0xC2 node type. | ||
|- | |- | ||
|align="center"| 0x01 | | align="center" | 0x01 | ||
|align="center"| 3 | | align="center" | 3 | ||
| Number of entries in the string table. | | Number of entries in the string table. | ||
|- | |- | ||
|align="center"| 0x04 | | align="center" | 0x04 | ||
|align="center"| Y=4*(N+1) | | align="center" | Y=4*(N+1) | ||
| Array of N+1 offsets to each string relative to the start of the node. The last entry is an offset to the end of the last string. | | Array of N+1 offsets to each string relative to the start of the node. The last entry is an offset to the end of the last string. | ||
|- | |- | ||
|align="center"| 0x04+Y’ | | align="center" | 0x04+Y’ | ||
|align="center"| variable | | align="center" | variable | ||
| Array of N null-terminated strings stored in alphabetical order. | | Array of N null-terminated strings stored in alphabetical order. | ||
|} | |} | ||
Line 195: | Line 195: | ||
''This article was adapted from documentation in the [https://github.com/handsomematt/botw-modding/blob/master/docs/file_formats/byml.md handsomematt/botw-modding repo].'' | ''This article was adapted from documentation in the [https://github.com/handsomematt/botw-modding/blob/master/docs/file_formats/byml.md handsomematt/botw-modding repo].'' | ||
[[Category:File formats]] |