Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Format:BNTX

From ReverseEngineering.wiki
Format
On this wiki Facts · Code · Notes · Topics

Switch texture container (.bntx, also inside BFRES and SARC): magic BNTX at 0, an NX header at 0x20 with the texture count, then a BRTI info block per texture (tile mode, size, mip count, format id such as 0x0B01 RGBA8, 0x1A01 BC1, 0x2D01 ASTC 4x4) with GOB block-linear swizzled data.

Overview

BNTX stores textures for Nintendo Switch games (NVN). Facts here come from the BNTX-Extractor python script (GPL-3.0, KillzXGaming; bntx_extract.py) and from Switch-Toolbox's BNTX handler (GPL-3.0). Files can be little endian; the BOM bytes at +0x0C are FF FE for little endian and FE FF for big endian.

Header

In the script's structure: 0x00 8-byte magic (BNTX and 4 zero bytes); 0x08 u32 version; 0x0C u16 BOM; 0x0E u16 revision; 0x10 offset of the file name; 0x16 offset of the string table (a signed 16-bit value h after two skipped padding bytes at 0x14, struct format 8si2Hi2xh2i in bntx_extract.py at 2c08e8e, lines 131-143; Unverified: whether the real field is wider than the script reads); 0x18 relocation table offset (i32); 0x1C file size (i32). Switch-Toolbox also accepts a BNTX that starts 80 bytes into a file (a Kill la Kill container, checked by signature at 80).

At 0x20 the NX header: u32 texture count, u64 offset of the array of texture info pointers, u64 data block offset, u64 dictionary offset, u32 string dictionary size. Switch-Toolbox uses the platform string NX of the binary texture file to tell NX from other targets.

Texture info (BRTI)

Each pointer in the array leads to a BRTI block with, in order: size fields, tile mode (0 pitch, 1 tiled), dimension, flags, swizzle value, mip count, format id, width, height, face count, size range, image size, alignment, channel selector, type, name offset, parent offset and an offset to the array of per-mip data pointers. The name is a u16 length followed by the characters. The format id is (type << 8 | data type), data types 01 UNORM, 02 SNORM, 06 SRGB:

Id Format
0x0201 R8 UNORM
0x0701 R5G6B5 UNORM
0x0901 R8G8 UNORM
0x0B01 / 0x0B06 R8G8B8A8 UNORM / SRGB
0x1A BC1
0x1B BC2
0x1C BC3
0x1D BC4
0x1E BC5
0x1F BC6H (UF16 01, SF16 02)
0x20 BC7
0x2D to 0x3A ASTC 4x4, 5x4, 5x5, 6x5, 6x6, 8x5, 8x6, 8x8, 10x5, 10x6, 10x8, 10x10, 12x10, 12x12

Tiled textures use the Tegra X1 block-linear layout (the script ships a swizzle module). In swizzle.py the block height (in GOBs of 8 rows) is 1 << sizeRange with sizeRange asserted to be 0 to 5; width and height are first divided (rounded up) by the block size, the pitch is the width in bytes rounded up to 64, and the surface size rounds the height up to block_height * 8 rows and then up to the alignment field; the address function follows the Tegra X1 TRM GOB layout (512-byte GOBs of 64 x 8 bytes, getAddrBlockLinear), all in BNTX-Extractor at 2c08e8e, swizzle.py lines 9-70.

Related

Format:BFRES, Format:SARC archive, Platform:Nintendo Switch.

Code & repositories

  • https://github.com/KillzXGaming/BNTX-Extractor @ 2c08e8e55fcc666ba6568a102f36dabd6c584e25 · license: GPL-3.0
    Python BNTX decoder; bntx_extract.py has the header, NX header and BRTI structures, the format id table and the swizzle code
    Tested on: source read, not run: source read, not run · checked 2026-10-18; last activity 2018-05-03