BNBSHPK (File Format)

From Wexos's Wiki
Jump to navigationJump to search

BNBSHPK (Binary NX Bezel SHader PacKage) is an archive format used to store BFSHA files.

File Format

Header

The file starts with the following header:

Offset Type Description
0x00 Char[8] File magic. Always BEZSHAPK in ASCII.
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 of the file in bytes.
0x20 Int64 File entry array offset.
0x28 UInt32 Number of file entries in this archive.
0x3C Byte[4] Padding?

File Entry

Offset Type Description
0x00 Int64 BFSHA file data offset.
0x08 ? More data? It is currently unknown how this structure looks since the only file seen only has one file entry.

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.

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

Tools

The following tools can handle BNBSHPK files:

  • (none)