NSO (File Format)

From Wexos's Wiki
(Redirected from NSO)
Jump to navigationJump to search
Under Construction
This article is not finished. Help improve it by adding accurate information or correcting grammar and spelling.

NSO is a file format used on the Nintendo Switch for storing executable code. All Switch game store code as NSO files.

File Format

Header

The file starts with a header. It has the following structure.

Offset Type Description
0x00 Char[4] File magic. Always NSO0 in ASCII.
0x04 UInt32 Version number of the file format.
0x08 Byte[4] Reserved.
0x0C UInt32 Flag. xxxx xxxx xxxx xxxx xxxx xxxx xxAB CDEF.
  • A: verify .data hash.
  • B: verify .rodata hash.
  • C: verify .text hash.
  • D: sets whether .data is compressed.
  • E: sets whether ..rodata is compressed.
  • F: sets whether text is compressed.
0x10 UInt32 .text section offset.
0x14 UInt32 .text memory offset.
0x18 UInt32 .text decomopressed size in bytes.
0x1C UInt32 Module offset.
0x20 UInt32 .rodata section offset.
0x24 UInt32 .rodata memory offset.
0x28 UInt32 .rodata decomopressed size in bytes.
0x2C UInt32 Module size in bytes.
0x30 UInt32 .data section offset.
0x34 UInt32 .data memory offset.
0x38 UInt32 .data decomopressed size in bytes.
0x3C UInt32 .bss size.
0x40 Byte[0x20] Build ID. Identical to .note section from an ELF.
0x60 UInt32 .text compressed size in bytes.
0x64 UInt32 .rodata compressed size in bytes.
0x68 UInt32 .data compressed size in bytes.
0x6C Byte[0x1C] Padding.
0x88 UInt32 API .rodata region offset.
0x8C UInt32 API .rodata region size in bytes.
0x90 UInt32 Dynstr .rodata region offset.
0x94 UInt32 Dynstr .rodata region size in bytes.
0x98 UInt32 Dynsym .rodata region offset.
0x9C UInt32 Dynsym .rodata region size in bytes.
0xA0 Byte[0x20] .text decompressed data SHA-256 hash
0xC0 Byte[0x20] .rodata decompressed data SHA-256 hash
0xE0 Byte[0x20] .data decompressed data SHA-256 hash

Tools

The following tools can handle NSO files:

  • (none)