BEA (File Format)
BEA (Bezel Engine Archive) is a file format used by Nintendo Switch games that is developed with Nintendo's game engine Bezel Engine, for example Super Mario Party. Each sub file is compressed using ZStandard.
File Format
Header
The file starts with the following header:
Offset | Type | Description |
---|---|---|
0x00 | Char[8] | File magic. Always SCNE\0\0\0\0 in ASCII, or 53 43 4E 45 00 00 00 00. |
0x08 | UInt32 | Version number. |
0x0C | UInt16 | Byte-order-mark. FE FF for big endian, FF FE for little endian. |
0x0E | Byte | Alignment shift. 2 raised by this value is the alignment required by this file when loaded into memory. |
0x0F | Byte | Target address size. Size of a pointer in bits. Never set and there remains 0. |
0x10 | UInt32 | Dummy value. |
0x14 | UInt16 | A flag which is only used on runtime. One bit sets wether the file is relocated. |
0x16 | UInt16 | Offset to the first section. |
0x18 | UInt32 | Relocation table offset. |
0x1C | UInt32 | Size until start of file data in bytes. |
0x20 | Int64 | Number of sub files in this archive. |
0x28 | Int64 | Sub file offset table offset. Points an array of offsets which points to each sub files. |
0x30 | Int64 | Sub file DICT offset. Points to a dictionary containing the sub file names. |
0x38 | Int64 | Unknown. Only seen as 0. |
0x40 | Int64 | Archive name offset. |
Sub File
Each sub file contains ZStandard-compressed data. Each entry has the following structure:
Offset | Type | Description |
---|---|---|
0x00 | Char[4] | Section magic. Always ASST in ASCII. |
0x04 | UInt32 | Next section offset. |
0x08 | UInt32 | Size of this section in bytes. |
0x0C | UInt32 | Reserved. |
0x10 | UInt32 | Unknown. Most likely a flag. |
0x14 | UInt32 | Compressed file size in bytes. |
0x18 | UInt32 | Decompressed file size in bytes. |
0x1C | UInt32 | Unknown. Only seen as 0. |
0x20 | Int64 | Compressed file data offset. |
0x28 | Int64 | File name offset. |
String Table
The string table is a table where all strings are stored. Each string has first the length written, which is a 16-bit integer, and then the string is stored as a null-terminated string. The string length does not include the null byte, and the 16-bit string length value is always aligned by 2. The string sorting algorithm is unknown.
Offset | Type | Description |
---|---|---|
0x00 | Char[4] | Section magic. Always _STR in ASCII. |
0x04 | UInt32 | Next section offset. |
0x08 | UInt32 | Size of this section in bytes. |
0x0C | Byte[4] | Reserved. |
0x10 | Int32 | Number of strings stored in the string table. The first string is always an empty string ("") and is not included in this count. |
Dictionary
A dictionary (sometimes known as DICT) is a common structure used in many Nintendo formats such as BFRES and BNTX. It is used for fast name look-up, in order to find a specific array item by its name. It starts with the following structure:
Offset | Type | Description |
---|---|---|
0x00 | Char[4] | Section magic. Always _DIC in ASCII. Note that in BFRES this magic is set to 00 00 00 00, most likely due to an export error. |
0x04 | Int32 | Number of entries. This does not include the root entry. |
After, the entries are specified. The root entry follows first, then all other entries are stored. Each entry has the following structure:
Offset | Type | Description |
---|---|---|
0x00 | Int32 | Ref bit. |
0x04 | UInt16[2] | Child node indices. First the left node, then the right node. |
0x08 | Int64 | Key offset, which points to the key name this entry stores. |
Relocation Table
Offset | Type | Description |
---|---|---|
0x00 | Char[4] | Section magic. Always _RLT in ASCII. |
0x04 | UInt32 | Table offset. The offset where this table starts. |
0x08 | Int32 | Number of sections. |
0x0C | Byte[4] | Padding. |
Offset | Type | Description |
---|---|---|
0x00 | Int64 | Section pointer, set on runtime. |
0x08 | UInt32 | Section offset. |
0x0C | UInt32 | Section size. |
0x10 | UInt32 | Entry ID. |
0x14 | UInt32 | Number of entries. |
Offset | Type | Description |
---|---|---|
0x00 | UInt32 | Entry offset. |
0x04 | UInt16 | Array count. |
0x06 | Byte | Offset count. |
0x07 | Byte | Padding size. |
Version List
Version | Found in |
---|---|
1.0.0 | |
1.1.0 |
Tools
The following tools can handle BEA files:
- (none)