BEA (File Format): Difference between revisions

From Wexos's Wiki
Jump to navigationJump to search
(Documented v6.0.0)
 
(One intermediate revision by one other user not shown)
Line 17: Line 17:
| 0x0E || Byte || '''Alignment shift'''. 2 raised by this value is the alignment required by this file when loaded into memory.
| 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.
| 0x0F || Byte || '''Target address size'''. Size of a pointer in bits. Never set and therefore remains 0.
|-
|-
| 0x10 || UInt32 || '''Dummy value'''.
| 0x10 || UInt32 || '''Dummy value'''.
Line 30: Line 30:
|-
|-
| 0x20 || Int64 || '''Number of [[#Sub File|sub files]]''' in this archive.
| 0x20 || Int64 || '''Number of [[#Sub File|sub files]]''' in this archive.
|-
|- bgcolor="#AAFFAA"
| 0x28 || Int64 || '''Sub file offset table offset'''. Points an array of offsets which points to each [[#Sub File|sub files]].
| colspan="4" align="center" | '''If [[#Header|version]] ≥ 6.0.0'''
|-
|- bgcolor="#DDFFDD"
| 0x30 || Int64 || '''Sub file DICT offset'''. Points to a [[#Dictionary|dictionary]] containing the sub file names.
| 0x28 || Int64 || '''[[#Sub File|Sub file]] array offset'''.
|-
|- bgcolor="#DDFFDD"
| 0x30 || Int64 || '''Sub file offset table offset'''. Points an array of offsets which points to each [[#Sub File|sub files]].
|- bgcolor="#DDFFDD"
| 0x38 || Int64 || '''Sub file DICT offset'''. Points to a [[#Dictionary|dictionary]] containing the sub file names.
|- bgcolor="#DDFFDD"
| 0x40 || Int64 || '''Archive name offset'''.
|- bgcolor="#DDFFDD"
| 0x48 || Int64 ||  {{Unknown-left|'''Compression name offset'''? Seen as ''Zstd''.}}
|- bgcolor="#DDFFDD"
| 0x50 || Int64 || {{Unknown-left|'''Unknown'''. Only seen as 0.}}
|- bgcolor="#FFAAAA"
| colspan="4" align="center" | '''Else'''
|- bgcolor="#FFDDDD"
| 0x28 || Int64 || '''Sub file offset table offset'''.
|- bgcolor="#FFDDDD"
| 0x30 || Int64 || '''Sub file DICT offset'''.
|- bgcolor="#FFDDDD"
| 0x38 || Int64 || {{Unknown-left|'''Unknown'''. Only seen as 0.}}
| 0x38 || Int64 || {{Unknown-left|'''Unknown'''. Only seen as 0.}}
|-
|- bgcolor="#FFDDDD"
| 0x40 || Int64 || '''Archive name offset'''.
| 0x40 || Int64 || '''Archive name offset'''.
|}
|}
Line 62: Line 78:
|-
|-
| 0x1C || UInt32 || {{Unknown-left|'''Unknown'''. Only seen as 0.}}
| 0x1C || UInt32 || {{Unknown-left|'''Unknown'''. Only seen as 0.}}
|-
|- bgcolor="#AAFFAA"
| colspan="4" align="center" | '''If [[#Header|version]] ≥ 6.0.0'''
|- bgcolor="#DDFFDD"
| 0x20 || Int64 || {{Unknown-left|'''Unknown'''.}}
|- bgcolor="#DDFFDD"
| 0x28 || Byte[0x10] || {{Unknown-left|'''Unknown''', looks like a hash.}}
|- bgcolor="#DDFFDD"
| 0x38 || Int64 || '''Compressed file data offset'''.
|- bgcolor="#DDFFDD"
| 0x40 || Int64 || '''File name offset'''.
|- bgcolor="#FFAAAA"
| colspan="4" align="center" | '''Else'''
|- bgcolor="#FFDDDD"
| 0x20 || Int64 || '''Compressed file data offset'''.
| 0x20 || Int64 || '''Compressed file data offset'''.
|-
|- bgcolor="#FFDDDD"
| 0x28 || Int64 || '''File name offset'''.  
| 0x28 || Int64 || '''File name offset'''.  
|}
|}
Line 94: Line 122:
* [[WarioWare: Get It Together!]]
* [[WarioWare: Get It Together!]]
* [[WarioWare: Move It!]]
* [[WarioWare: Move It!]]
|-
| 6.0.0
|
* [[Super Mario Party Jamboree]]
|}
|}



Latest revision as of 09:14, 14 October 2024

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 therefore 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.
If version ≥ 6.0.0
0x28 Int64 Sub file array offset.
0x30 Int64 Sub file offset table offset. Points an array of offsets which points to each sub files.
0x38 Int64 Sub file DICT offset. Points to a dictionary containing the sub file names.
0x40 Int64 Archive name offset.
0x48 Int64 Compression name offset? Seen as Zstd.
0x50 Int64 Unknown. Only seen as 0.
Else
0x28 Int64 Sub file offset table offset.
0x30 Int64 Sub file DICT offset.
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.
If version ≥ 6.0.0
0x20 Int64 Unknown.
0x28 Byte[0x10] Unknown, looks like a hash.
0x38 Int64 Compressed file data offset.
0x40 Int64 File name offset.
Else
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
6.0.0

Tools

The following tools can handle BEA files:

  • (none)