RetroReversing - The Home of Reverse Engineering Enthusiasts (2024)

RetroReversing - The Home of Reverse Engineering Enthusiasts (1)

Nintendo Switch File Formats

Edit on Github | Updated: 5th September 2020

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).

XCI - NX Cart Images

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.

Creating XCI Files

RetroReversing - The Home of Reverse Engineering Enthusiasts (2)

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.

Extracting XCI files

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.

Cutting XCI 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

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 - Nintendo Submission Package

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.

Creating NSP Files

The recommended way of creating NSP files is to use the NX Dump Tool homebrew available on GitHub.

RetroReversing - The Home of Reverse Engineering Enthusiasts (3)

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 - Nintendo Content Archives

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 - Executable file system (code)
  • ROMFS - Read Only file system (data)
  • PFS0 - P??? File system (data)

EXEFS (Executable filesystem partition)

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 (Content Meta Data) (*.cnmt.nca)

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.

NPDM (*.npdm)

The NPDM file contains information about the game for example the title and services that the game is allowed to access.

Nintendo Switch Object (NSO) Files

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.

rtld (Runtime Link editor NSO executable)

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

main (NSO executable)

There is a main NSO executable file in the EXEFS partition, this as its name suggests is where the main game code was compiled.

sdk (NSO executable)

There is a sdk executable in the EXEFS portion, this is presumably the build of the official Nintendo Switch SDK.

subsdk’s (nso executable)

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:

  • subsdk0
  • subsdk1

Archive Files

SZS (ARMS & Mario Kart)

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

RetroReversing - The Home of Reverse Engineering Enthusiasts (2024)

FAQs

What is a famous example of reverse engineering? ›

The German Enigma machine of World War II, an electro-mechanical encryption/decryption device, is a famous example. In fact, classic cryptanalysis is itself a form of reverse engineering applied to systems of symbols, but also, as in the case of the Enigma, the machines used to process those symbols.

Why is it hard to reverse engineer the brain? ›

Because each nerve cell receives messages from tens of thousands of others, and circuits of nerve cells link up in complex networks, it is extremely difficult to completely trace the signaling pathways.

How hard is reverse engineering? ›

This shortage of qualified candidates is partly due to the fact that reverse engineering is a specialized field. As all specialized fields, it requires a unique set of skills and knowledge. It's not a skill that can be learned quickly or easily. It takes time and experience to become proficient at it.

What is reverse engineering in simple words? ›

Reverse engineering, sometimes called back engineering, is a process in which software, machines, aircraft, architectural structures and other products are deconstructed to extract design information from them.

What is the most successful reverse engineering? ›

One of the most well-known examples of reverse engineering success is the case of the IBM PC. In the early 1980s, IBM was the dominant player in the computer industry, but they lacked a personal computer (PC) in their product lineup.

What is reverse engineering in life? ›

Reverse engineering your goals is basically thinking in first principles. That is, we need to take something apart to better understand how it's made. Reverse engineering goals means you're thinking backwards and unpacking larger goals into micro and nano ones.

Why is reverse engineering illegal? ›

Reverse engineering is generally legal. In trade secret law, similar to independent developing, reverse engineering is considered an allowed method to discover a trade secret. However, in patent law, because the patent owner has exclusive rights to use, own or develop the patent, reverse engineering is not a defense.

Does reverse engineering pay well? ›

How much does a Reverse Engineer make? The estimated total pay for a Reverse Engineer is $148,574 per year, with an average salary of $105,350 per year. These numbers represent the median, which is the midpoint of the ranges from our proprietary Total Pay Estimate model and based on salaries collected from our users.

Do you feel reverse engineering is unethical? ›

Conclusions. Both company employees agreed that reverse engineering was a valid practice; however, they agreed it must be done in with care. Learning from what others have done is a valid method, but copying what they have done is dishonest.

What is the best degree for reverse engineering? ›

How to Become a Reverse Engineer. The qualifications to become a reverse engineer are a bachelor's degree in computer science or computer engineering and significant experience working in a developer or programmer job.

What is the first step in reverse engineering? ›

5 steps for reverse engineering

The first step in backward engineering is collecting information about the product. This might mean measuring product dimensions, identifying source design and understanding the coding of the device.

What three things does reverse engineering include? ›

Although the process is specific to the object on which it is being performed, all reverse engineering processes consist of three basic steps: information extraction, modeling, and review.

What is another name for reverse engineering? ›

What is another word for reverse-engineering?
derivingduplicating
emulatinghacking
recreatingreplicating

What is a real example of reverse engineering? ›

Reverse engineering examples

Computer engineers could reverse engineer a computer or its parts to learn how to build one. This may be helpful for people who are new to building computers. A computer engineer could also disassemble a computer to replace its parts with newer pieces or run tests on a broken part.

Is decompiling code illegal? ›

Decompiling is absolutely legal, regardless of what the shills say. At most, you can be sued for unauthorized activity relating to software unless you're redistributing it.

Which of the following is an example of reverse engineering? ›

A common example is to adapt a program written for use with one microprocessor to another. Other examples include reconstructing lost source code, studying how a program performs certain operations, improving performance and fixing bugs or correcting errors when the source code is not available.

What are examples of reverse engineered products? ›

Contents
  • 2.1 Machines.
  • 2.2 Printed circuit boards.
  • 2.3 Software. 2.3.1 Binary software. 2.3.1.1 Binary software techniques. 2.3.2 Software classification.
  • 2.4 Source code.
  • 2.5 Protocols.
  • 2.6 Integrated circuits/smart cards.
  • 2.7 Military applications.
  • 2.8 Gene networks.

What is a common example of using reverse engineering to solve a problem? ›

Examples of Reverse Engineering

Military experts can analyze and understand how enemy technologies work through reverse engineering. This allows them to identify vulnerabilities and weaknesses that can be exploited during combat operations or used to develop countermeasures.

Which country is famous for reverse engineering? ›

While China has a rich history of successful reverse engineering, particularly in technology and industrial development, India has under-leveraged this potential. In the 1950s and 1960s, China caught up with Western technology largely through reverse engineering.

References

Top Articles
Latest Posts
Article information

Author: Van Hayes

Last Updated:

Views: 5237

Rating: 4.6 / 5 (46 voted)

Reviews: 85% of readers found this page helpful

Author information

Name: Van Hayes

Birthday: 1994-06-07

Address: 2004 Kling Rapid, New Destiny, MT 64658-2367

Phone: +512425013758

Job: National Farming Director

Hobby: Reading, Polo, Genealogy, amateur radio, Scouting, Stand-up comedy, Cryptography

Introduction: My name is Van Hayes, I am a thankful, friendly, smiling, calm, powerful, fine, enthusiastic person who loves writing and wants to share my knowledge and understanding with you.