BEA (File Format)
BEA, pronounced as Bezel Engine Archive, is a format designed to store optionally compressed files into an archive.
Contents
Header
Each BEA archive starts out with a header.
Offset | Type | Description |
---|---|---|
0x00 | String | File magic. Always "SCNE" in ASCII. |
0x04 | Byte[4] | Padding. |
0x08 | UInt32 | Version. Always 0x10000. |
0x0C | UInt16 | Byte Order Mark (BOM): 0xFEFF for big endian and 0xFFFE for little endian. |
0x0E | Byte | Byte alignment. |
0x0F | Byte | Target address size. Usually 0. |
0x10 | Byte[6] | Padding. |
0x16 | UInt16 | Offset to the first asset. |
0x18 | UInt32 | Relocation table offset. |
0x1C | UInt32 | End of archive info. Any data after is optionally compressed data. |
0x20 | UInt64 | File count. |
0x28 | UInt64 | File information offset. |
0x30 | UInt64 | Dictionary offset. |
0x38 | UInt64 | Unknown. Seems to always be 0. |
0x40 | UInt64 | Offset to the file name. |
0x48 | UInt64 | Offset to the first asset. (Same as 0x16) |
0x50 | End of file header. |
Since the first asset is defined in the header, a table of asset offsets are defined right after the header.
Dictionary
The dictionary ("_DIC") section defines files as nodes in a tree.
Offset | Type | Description |
---|---|---|
0x00 | String | Section magic. Always "_DIC" in ASCII. |
0x04 | UInt32 | Number of nodes in this dictionary. This does NOT include the root node. |
0x08 | Dictionary Nodes | Node definitions. |
0x08 + (numNodes * 0x10) | End of dictionary. |
Dictionary Node
A node that is present in the dictionary section.
Offset | Type | Description |
---|---|---|
0x00 | UInt32 | Reference node. -1 for root node. |
0x04 | UInt16 | ID of the node to the left of this node. |
0x06 | UInt16 | ID of the node to the right of this node. |
0x08 | UInt64 | Offset to the string in the string table that is associated with this node. |
0x10 | End of dictionary node. |
Asset
This section defines assets, which point to the file data that is associated with file names. This section also contains information on the compressed data, such as uncompressed size, and more. The compression used for assets is Zstandard.
Offset | Type | Description |
---|---|---|
0x00 | String | Section magic. Always "ASST" in ASCII. |
0x04 | UInt32 | Section size. |
0x08 | UInt64 | Section size. |
0x10 | UInt16 | Unknown. |
0x12 | UInt16 | Unknown. |
0x14 | UInt32 | File size. |
0x18 | UInt64 | Uncompressed file size. |
0x20 | UInt64 | Offset to the data. |
0x28 | UInt64 | Offset to the file name in the string table. |
0x30 | End of asset entry. |
String Table
The string table ("_STR"), used for naming assets and naming dictionary nodes. Each string contains a prefixed short that defines the string length. Sometimes in the string table, each string is suffixed by two padding zeros.
Offset | Type | Description |
---|---|---|
0x00 | String | Section magic. Always "_STR" in ASCII. |
0x04 | Byte[4] | Padding. |
0x08 | UInt64 | Section size. |
0x10 | UInt64 | Number of strings in the string table. |
~ | End of dictionary node. |
Relocation Table
The relocation table is a table that contains pointers to certain assets in the file.
Header
Offset | Type | Description |
---|---|---|
0x00 | String | Section magic. Always "_RLT" in ASCII. |
0x04 | UInt32 | Current location. |
0x08 | UInt32 | Number of sections. |
0x0C | UInt32 | Padding. |
~ | End of relocation table header. |
After the header are the sections and entries.
Relocation Section
Offset | Type | Description |
---|---|---|
0x00 | UInt64 | Base pointer. |
0x08 | UInt32 | Current position. |
0x0C | UInt32 | Size. |
0x10 | Int32 | Entry index. |
0x14 | Int32 | Entry count. |
0x18 | End of relocation section. |
Relocation Entry
Offset | Type | Description |
---|---|---|
0x00 | UInt32 | Current position. |
0x04 | UInt16 | Structure count. |
0x06 | Byte | Offset count. |
0x07 | Byte | Padding count. |
0x08 | End of relocation section. |