Skip to content

BYAML File Format

Yannik Marchand edited this page Jun 18, 2021 · 25 revisions

AL / LP > Binary YAML

These files are similar to regular YAML files, but are encoded in binary form. They usually have the file extension .byml or .byaml.

This page describes version 1 of the file format.

Offsets in the header are absolute.

Offset Size Description
0x0 2 Magic number / BOM (BY: big endian, YB: little endian)
0x2 2 Version number
0x4 4 Offset to dictionary key table
0x8 4 Offset to string table
0xC 4 Offset to binary data table
0x10 4 Offset to root node (array or dictionary)

Node

A node starts with a single byte that indicates its type.

ID Type
0xA0 String
0xA1 Binary data
0xC0 Array
0xC1 Dictionary
0xC2 String table
0xC3 Binary table
0xD0 Bool
0xD1 Integer
0xD2 Float

For string and binary nodes, the value is simply an index into the string or binary table (see header).

Array

The type table contains one byte per element that indicates its node type.

If the number of elements is not a multiple of 4, additional null bytes are inserted between the type table and the data table such that the data table is aligned to 4 bytes.

The data table contains either an absolute offset to the node (for container nodes), or simply the value of the array element (for primitive nodes).

Offset Size Description
0x0 1 Node type (0xC0)
0x1 3 Number of elements (N)
0x4 N Type table
4 x N Data table

Dictionary

A dictionary contains key / value pairs. The pairs must be sorted by their keys, because a binary search algorithm is used to look them up.

Offset Size Description
0x0 1 Node type (0xC1)
0x1 3 Number of pairs (N)
0x4 8 x N Pair table

Every pair is stored as follows:

Offset Size Description
0x0 3 Index into dictionary key table (see header)
0x3 1 Node type
0x4 4 Value

Just like array elements, the value is either a primitive or an absolute offset to a container node.

String Table

A string table is a special kind of node.

The address table contains offsets to the strings, relative to the start of the string table node. It also contains an offset that points to the end of the string table (right behind the last string).

The address table and strings must both be sorted, because a binary search algorithm is used to find them.

Offset Size Description
0x0 1 Node type (0xC2)
0x1 3 Number of strings (N)
0x4 4 x (N + 1) Address table
Null-terminated strings

Binary Table

The address table contains offsets to the binary data, relative to the start of the binary table node. It also contains an offset that points to the end of the binary table (right behind the last binary blob).

The address table must be sorted, because the size of a binary blob is calculated from the difference between two offsets.

Offset Size Description
0x0 1 Node type (0xC3)
0x1 3 Number of binary blobs (N)
0x4 4 x N Address table
Binary data
Clone this wiki locally