PDA

View Full Version : Switchtor - Nintendo Switch NSP repacker


elit
30-03-2022, 13:05
[Admin, we need a nintendo switch thread :)]

Switchtor is my new tool to help me (un)repack Nintendo Switch games. Features:
-scan nca|nsp|xci files(or whole dir) for information
-extract nca|nsp|xci files:
-nca and nsp are extracted fully
-xci are extracted into nca files it contain
-create nsp files from fully extracted game files
-automatic detection of titlekey and titleID
-use hacpack and hactool executables as a backend
-maintain its own text(editable) db file about extracted nca's
-one of the simplest tools out there for this task

To keep things simple, switchtor work with its own directory structure and a text db file. During unpacking of nsp, directory named "__extracted" and file named "__data_db.txt" are created inside newly created directory named same as nsp file minus extension. It is created in same dir as switchtor. Other files in that dir can be deleted.

When creating nsp, you point to a directory where this db file(and __extracted directory) are located. This directory can now be anywhere you prefer, so just point to the full path. Directories "__nsp_out" and "__nca_out" will be created. NCA's are just temporary files to create nsp and can be deleted. NSP inside "__nsp_out" is newly created nsp.

Key revision is maintained but can be simply overwritten in db file(as anything else there). Newly created nsp contain nca's created with '--plaintext' - unencrypted form and title key removed. These nsp's are intended for emulators.

During scan or extracting, titlekey is automatically detected, extracted and used, as well as title ID. Main point of switchtor is simplicity:
scan:
switchtor.exe -s file.(nca|nsp|xci) | dir

extract:
switchtor.exe -x file.(nca|xci)
switchtor.exe -x file.nsp [ --basenca=base_program.nca | --plaintext=plain_export.nca ]

repack:
switchtor.exe -c dir (dir with '__data_db.txt' file and '__extracted' directory)

Switchtor works with DLC's and updates, for updates however same limitation apply as for hactool and hacpack which switchtor rely on. You first use --plaintext on a base nsp(the game v1.0) and then use --basenca when extracting update - pointing to previously created base plaintext nca file. Extracted update will be in fact full sized updated game because that is how it works. Refer to hactool documentation. Also you should delete 'fragment'(data) files(whole nca dirs and their references in db file).

This tool is extremely simple thanks to way it works, no need to type(and figuring out) which nca is what, no multi-command options etc. Just a simple -x -c -s and in case you dealing with updates also --plaintext and --basenca. Tool is mainly to deal with nsp, for xci its better to use another tool to convert it to nsp first. It is reliable, I already repacked 18 games with it + tested and working on both emulators.

31454

Gehrman
28-06-2022, 12:00
Hi elit
Thanks, this tool works well.
The KEYS.dat file for this tool?