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

Platform:Nintendo 3DS

From ReverseEngineering.wiki
Platform
Vendor Nintendo
Versions 3DS, 2DS, New 3DS, New 2DS
On this wiki Facts · Code · Notes · Topics

Nintendo's autostereoscopic handheld (2011): dual ARM11 MPCore (ARM11 userland, 3DS and New 3DS) plus an ARM9 security processor, PICA200 GPU. Games are NCSD cartridge images or CIA installs containing NCCH partitions with ExeFS and RomFS.

Overview

Applications are ARM11 processes loaded from an Format:NCCH container: an extended header (process capabilities, services), an Format:ExeFS (3DS) holding .code (often BLZ- or LZ11-compressed), icon and banner, and a Format:RomFS (3DS IVFC) for assets. Cartridge dumps wrap NCCH partitions in Format:NCSD. Homebrew uses Library:libctru and the 3DSX format (see below).

3DSX homebrew

The 3DSX executable format of homebrew is defined by devkitPro/3dstools (src/3dsx.h, src/3dsxtool.cpp, commit 718d6f2; the snapshot has no license file, so only format facts are taken, no code; checked by reading the source). Little endian.

Header (0x20 bytes, _3DSX_Header): u32 magic 0x58534433 (bytes 33 44 53 58, "3DSX"), u16 headerSize, u16 relocHdrSize, u32 formatVer (3dsxtool writes 0), u32 flags (written as 0), then u32 codeSegSize, rodataSegSize, dataSegSize, bssSize. 3dsxtool writes headerSize = 32, or 32 + 12 when an SMDH icon is embedded. The extended header adds three u32: file offset of the SMDH, size of the SMDH, file offset of the RomFS (4-byte aligned, present only when a RomFS is embedded).

After the header come the relocation headers of the code, rodata and data segments (each u32 cAbsolute, u32 cRelative, so relocHdrSize is 8 in the tool), then the segments, then the relocation tables. A relocation entry is u16 skip, u16 patch: skip that many words, then patch that many words. The entry point is always the start of the code segment, and the loader (not the file) clears the BSS, which is the tail of the data segment past its file size.

For reading a 3DSX: take headerSize as the real size (check > 0x20 for the SMDH/RomFS offsets), do not assume the version or flags are non-zero.

Related formats

Code & repositories

Library:libctru, Tool:3dstool.

  • 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/devkitPro/3dstools @ 718d6f2330dbef9dd5726573392425dcbd451677 · license: none
    devkitPro 3dstools: 3dsxtool (ELF to 3DSX converter), 3dsx.h with the 3DSX header and relocation structs, smdhtool and mkromfs3ds. The repository snapshot has no license file; only the format layout was taken.
    Tested on: source read, not run: Read 3dsx.h and 3dsxtool.cpp at this commit; not built. · checked 2026-10-18; last activity 2023-11-17; no license: not reusable
  • 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