Format:RomFS (Switch)
| Vendor | Nintendo |
|---|---|
| Magic | none (first u64 is the header size 0x50) |
| Endianness | little |
| On this wiki | Facts · Code · Notes · Topics |
The read-only asset filesystem of Nintendo Switch titles (RomFS section of an NCA, and the RomFS appended to an NRO): a 0x50-byte header of ten u64 values locating a directory hash table, directory table, file hash table, file table and the file data, with 32-bit linked-list entries and a rotate-xor name hash.
Overview
Switch RomFS has the same idea as the 3DS format (Format:RomFS (3DS IVFC)) but all offsets are 64-bit and the header is 0x50 bytes. There is no magic: the first u64 is the header size, 0x50. In an NCA the RomFS section is wrapped in an IVFC hash tree (magic IVFC, a 0xE0-byte header with up to 6 levels, see Fact:RomFS (Switch)/struct/IVFC header); the file system proper is the data level of that tree. Unverified: that the data level is the last of the IVFC levels is from the 3DS layout and from the hactool structs, not from reading hactool's IVFC code. Homebrew Format:NRO files carry a RomFS in their asset section, and libnx's romfs_dev.c reads the header at offset 0 of the mounted image. Unverified: that the NRO's RomFS has no IVFC wrapper.
Header and tables
See Fact:RomFS (Switch)/struct/RomFS header. All offsets are relative to the start of the RomFS image. Directories and files are stored in two tables of variable-length entries; entry references are byte offsets inside their table (the root directory is at offset 0 of the directory table), and 0xFFFFFFFF means none. Each entry is a node of a tree: parent, sibling (next entry with the same parent), for directories the first child directory and first child file, a nextHash link to the next entry in the same hash bucket, a name length and the UTF-8 name. See Fact:RomFS (Switch)/struct/RomFS directory and file entries.
File contents are at file_data_offset + entry.data_offset.
Name hash
The hash tables are arrays of u32 bucket heads (bucket count = table size / 4). The bucket of a name is computed from the parent entry offset and the name bytes; see Fact:RomFS (Switch)/behavior/Name hash.
Related
Format:NCA, Format:NRO, Format:RomFS (3DS IVFC), Library:Libnx, Platform:Nintendo Switch.
Code & repositories
See below.
- https://github.com/switchbrew/libnx @
20cbcfd90567f7bf84df7725f27e345e2164fa6b· license: ISC
libnx (ISC): runtime/devices/romfs_dev.h and romfs_dev.c define the RomFS header, entries and name hash.
Tested on: source read, not run · checked 2026-10-19; last activity 2026-10-14