The Nintendo Switch development scene has introduced a lot of new file formats, some completely new and others are extensions of what had been used on the Wii and Wii U.
Full Game files come in two standard formats depending if they are game cartridges (XCI) or EShop downloads (NSP).
The XCI format was created as a way to dump entire game cartridges to a single file.
XCI files are encrypted using the firmware specific master key and so can be run on any switch, just like game cartridges 1.
NXDumpTool - Dump your Games to XCI
The recommended way of creating XCI files is to use the NX Dump Tool available on GitHub
You can also dump game cartridges if you are using SX OS using the homebrew app SX Dumper
.
As XCI files are just a container for individual NCA files you can extract the contents of an XCI file with a tool called hactool
.
Here is an example
./hactool --outdir ./output -x -t xci yourgame.xci
This will create 4 folders in the output directory:
For more information about the extracted files see the section on NCA files.
As XCI files are a 1:1 copy of the data stored on the eMMC chip of a game cartridge it can also contain blank space at the end of the file if the game is smaller than the eMMC chip’s capacity.
XCI-Cutter - A tool to remove unused space from XCI-Dumps
You can remove this extra space with a tool such as XCI-Cutter
XCI File Format Spec
If you are interested in the internals of the file format, the site `SwitchBrew` has an excellent page with what each byte represents
NSP files is the format for games downloaded from the Switch EShop, similar to .apk on Android or .app on iOS.
NSP files are encrypted using master keys and rightsId keys and are encrypted for a specific user 1.
The recommended way of creating NSP files is to use the NX Dump Tool
homebrew available on GitHub.
NXDumpTool - Dump your Games to NSP
The recommended way of creating NSP files is to use the NX Dump Tool available on GitHub
Even although NSP is the format for Eshop games the application NX Dump Tool
allows you to dump cartridges as NSP files.
These files store part of the game and are normally included inside other file formats.
NCA files are compressed archives (think zip) that contain game data, normally multiple NCA files can be extracted from a single XCI or NSP file.
There are multiple types of NCA file depending on what they contain:
ExeFS stands for Executable filesystem and is part of the largest Nintendo Content Archive (NCA) file for a game. It is a file system that contains Nintendo Switch executables known as NSO’s 2.
There are a few files contains in the executable filesystem that we will cover in this section.
If you want to mod a game to change the actual behaviour (executable code) then this is the where you start, there are also multiple ways to apply an ExeFS mod which will be covered in another section.
CNMT files are small meta data files that are inside an XCI or NSP archive.
CNMT File Format Spec
If you are interested in the internals of the file format, the site `SwitchBrew` has an excellent page with what each byte represents
This section covers the game code which is all stored in the executable Filesystem partition or EXEFS.
The NPDM file contains information about the game for example the title and services that the game is allowed to access.
NSO files are compiled Nintendo Switch executable code and can only be run if they are in the EXEFS partition of the game. These are compile from source files, normally from the official Nintendo Switch Software Development Kit.
Basically the runtime Link editor executable is the first code that runs when a game is started. Its job is to manage the other executable code modules (NSO files) in memory.
Runtime Link Editor (RTLD)
If you are interested in the internals of how the RTLD works, the site `SwitchBrew` has an excellent page
There is a main
NSO executable file in the EXEFS partition, this as its name suggests is where the main game code was compiled.
There is a sdk
executable in the EXEFS portion, this is presumably the build of the official Nintendo Switch SDK.
It is still unclear what the sub SDK executable are, my guess would be they are dynamic libraries of code. It is possible these are optional libraries bundled with the official Switch SDK.
For example:
The SZS file format is used in many of Nintendos first party games on the switch such as ARMS
and actually comes from the Wii version of Mario Kart. It is an archive file that compresses game assets such as Models and Textures 3.
SZS Modifier
ChadSoft has created a tool to modify SZS files aptly called the SZS Modifier