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:NCCH container

From ReverseEngineering.wiki
Format
Magic 4E 43 43 48 ("NCCH") at offset 0x100
Extensions .cxi, .cfa, .app
Endianness little
On this wiki Facts · Code · Notes · Topics

The 3DS content container (.cxi executable, .cfa data): 0x100-byte RSA signature, 0x100-byte header with magic NCCH at 0x100, then extended header, logo, plain region, ExeFS and RomFS regions addressed in media units.

Header

See Fact:NCCH container/struct/Header. Offsets and sizes (plain region, logo, ExeFS, RomFS) are in media units of 0x200 << flags[6] bytes (3dstool ncch.cpp: m_nMediaUnitSize = 1LL << (Flags[SizeType] + 9)); ExeFS and RomFS also have hash-region sizes and SHA-256 superblock hashes. The product code is 16 ASCII bytes, the program id 8 bytes. Flags (index 3 = crypto method, 4 = platform, 5 = content type, 6 = size shift, 7 = flag bits such as no-crypto/fixed-key; names per 3dstool's CNcch::Index).

The extended header (Format:NCCH extended header: ctrtool's CxiHeader gives 0x400 bytes at 0x200 followed by a 0x400-byte access descriptor at 0x600, 0x800 together; the header field exhdr_size excludes the descriptor; sizes here from extendedheader.h in 3dstool, ExHeader_Info in libctru's exheader.h) holds the process name, text/rodata/data segment addresses and sizes, stack size, bss size, dependency list, save-data size, ARM11 service access list, kernel capability descriptors and ARM9 access control.

Encrypted NCCH parts cannot be read without keys; this wiki documents only the public structure.

Flag bits as azahar's NCCH_Header declares them (Fact:NCCH container/struct/Flags (azahar)): flags[3] secondary key slot, flags[4] platform, flags[5] content type bits (bit 0 data, bit 1 executable, bits 2-4 type: 0 application, 1 system update, 2 manual, 3 child, 4 trial), flags[6] content unit size exponent (unit = 0x200 << n), flags[7] bit 0 fixed key, bit 1 no RomFS, bit 2 no crypto, bit 5 seed crypto.

Related

Format:NCSD, Format:ExeFS (3DS), Format:RomFS (3DS IVFC).

Code & repositories

  • https://github.com/dnasdw/3dstool @ 3771ae967d64092370b646db86aa626401c279e8 · license: MIT
    3dstool: src/ncsd.h, ncch.h, extendedheader.h, exefs.h, romfs.h and compression codecs.
    Tested on: source read, not run: source read · checked 2026-10-18; last activity 2026-01-24; Note: the latest release ships binaries; the wiki links only the source, never the binaries
  • https://github.com/devkitPro/libctru @ 9b55eda44cf80b971503991e0c78f9bc8fe50425 · license: Zlib (declared by the contributor; GitHub's detector did not recognize a license file)
    libctru: libctru/include/3ds/exheader.h (NCCH extended header), romfs.h, services/*.h.
    Tested on: source read, not run: source read · checked 2026-10-18; last activity 2026-09-29
  • https://github.com/azahar-emu/azahar @ 987f18405073960622e1043bb44005989135c6e1 · license: GPL-3.0
    azahar (3DS emulator, GPL-2.0): src/core/loader/3dsx.cpp, src/core/file_sys/cia_container.h/.cpp, ncch_container.h. Read for format facts only.
    Tested on: source read, not run · checked 2026-10-18; last activity 2026-10-17; Note: the latest release ships binaries; the wiki links only the source, never the binaries
  • https://github.com/3DSGuy/Project_CTR @ d52c2b0e788c2d085763d7c5dcc4b2edd9ffb7d8 · license: MIT (declared by the contributor; GitHub's detector did not recognize a license file)
    Project_CTR (ctrtool, makerom): ctrtool/deps/libnintendo-n3ds/include/ntd/n3ds/ncch.h, exheader.h, exefs.h, cia.h, cro.h declare the NCCH, extended header, ExeFS, CIA and CRO structures with static size asserts. License taken from ctrtool/deps/libnintendo-n3ds/LICENSE (MIT); GitHub's detector found no top-level license.
    Tested on: source read, not run · checked 2026-10-19; last activity 2026-10-11; Note: the latest release ships binaries; the wiki links only the source, never the binaries