Hacking How to repack an NSP with custom files? Is there a manual somewhere

Reploid

Well-Known Member
OP
Member
Joined
Jan 20, 2010
Messages
2,830
Trophies
2
XP
6,277
Country
Serbia, Republic of
I saw people doing cool stuff with switch games, like removing extra languages or inserting translation and graphical mods directly into the package, without relying on LFS.

I've actually tried to do something like this myself a couple of times, but never was able to correctly put an NCA file back together. But it is definitely possible, I would like to do something like this myself. Maybe there is a sensible tutorial that explains things step by step?

I want to take a game, latest update, insert some mods, delete bloated stuff and get a single customized NSP files. If you used an app like UMDgen back in the day, you prolly know what I'm talking about.
 
Last edited by Reploid,

fate6

Haha, I killed a Pumpkin!
Member
Joined
Aug 2, 2014
Messages
422
Trophies
0
Location
[fate6@Canterlot ~]$
XP
2,263
Country
United States
Haven't done it in some time but i recall using a combo of hactool to dump contents and hacpack to put it back together, Just make sure you remake the nca's/nsp with retail keys.
Never bothered to merge updates so IDK about that part.


Nothing like UMDGen but it did the job.
 

Reploid

Well-Known Member
OP
Member
Joined
Jan 20, 2010
Messages
2,830
Trophies
2
XP
6,277
Country
Serbia, Republic of
Haven't done it in some time but i recall using a combo of hactool to dump contents and hacpack to put it back together, Just make sure you remake the nca's/nsp with retail keys.
Never bothered to merge updates so IDK about that part.


Nothing like UMDGen but it did the job.
I've tried something like that, but my problem was that when I try to put back NCA with trimmed contents back together it always appears really small, since romfs contents are never included, which is the most data. No error reporting, no nothing, so I had no idea how to fix that.
 

fate6

Haha, I killed a Pumpkin!
Member
Joined
Aug 2, 2014
Messages
422
Trophies
0
Location
[fate6@Canterlot ~]$
XP
2,263
Country
United States
I wrote a readme for myself back then and i happen to still have it, its kinda just some random rambelings but it is what i used to do and it did produce working nsp's

Reading this back it seems I did used to merge updates into the base game, neat i guess.

Unpack NSP
./hactool.exe -t pfs0 --pfs0dir="Whatever named directory" "drag and drop nsp here"

If a "tik" file is extracted then it has the titlekey! open it in a hex editor and look for "Root-CA", under that should be the 32 digits that are the titlekey!
If there is no tif file then install game on prod and dump keys with lockpick.

Extract Largest NCA
./hactool.exe -k prod.keys -t nca --romfsdir=romfs --exefsdir=exefs --titlekey=XXXXXXXX "drag and drop largest nca file here"

Extract Controlromfs, It's in diffrent smaller nca
./hactool.exe -k prod.keys -t nca --romfsdir=controlromfs --titlekey=XXXXXXXX "drag and drop nca"

If using update then use control from the update nsp so it shows the correct version

Using hacPack GUI or CLI remake the "Program" NCA
./hacpack -o outNCA --type=nca --ncatype=program --titleid=XXXXXXXX --titlekey=XXXXXXXX --exefsdir= --romfsdir=

Once "Program" NCA is done, build "Control" NCA using the RomFS Dir to the Controlromfs
./hacpack -o outNCA --type=nca --ncatype=control --titleid=XXXXXXXX --romfsdir=

Creat a "META" NCA using the "Program" and "Control" NCA's
./hacpack -o outNCA --type=nca --ncatype=meta --titletype application --titleid=XXXXXXXX --programnca= --controlnca=

Finally build the NSP from the NSP tab.
./hacpack -o outNSP --type=nsp --titleid=XXXXXXXX --ncadir=outNCA

Extract with UPDATE
./hactool.exe -k prod.keys --romfsdir=romfs --exefsdir=exefs --titlekey="update titlekey" --basenca="drag and drop base game NCA file here" "drag and drop update NCA file here"

For UPDATE extract to work you must use a plain text version of the base main NCA

Check info for the NCA
./hactool.exe -k prod.keys --titlekey=XXXXXXXX -i "drag and drop NCA file here"

Decrypt NCA for use with UPDATE
./hactool.exe -k prod.keys --titlekey=XXXXXXXX --plaintext="name to save decrypted NCA as" "drag and drop encrypted NCA here"
 
  • Like
Reactions: CymraegAce

AinzOoalGown

Member
Newcomer
Joined
Jan 27, 2023
Messages
5
Trophies
0
XP
77
Country
France
I wrote a readme for myself back then and i happen to still have it, its kinda just some random rambelings but it is what i used to do and it did produce working nsp's

Reading this back it seems I did used to merge updates into the base game, neat i guess.
Hello ,
from there I did not understand, the NCA Program I take the original one ? or I create a new Program NCA ?

I followed your instructions but there is an error ( Failed to open \main.npdm! )

hacpack.exe -o outNCA --type=nca --ncatype=program --titleid=010********** --titlekey=************* --exefsdir= --romfsdir=

hacPack v1.36 by The-4n
----> Preparing:
[WARN]: Failed to match key ..... Here this error.

Removing existing temp directory
Creating temp directory
Creating out directory
Creating backup directory

----> Processing NPDM
Failed to open \main.npdm!

Thank you -_-
 

fate6

Haha, I killed a Pumpkin!
Member
Joined
Aug 2, 2014
Messages
422
Trophies
0
Location
[fate6@Canterlot ~]$
XP
2,263
Country
United States
Hello ,
from there I did not understand, the NCA Program I take the original one ? or I create a new Program NCA ?

I followed your instructions but there is an error ( Failed to open \main.npdm! )

hacpack.exe -o outNCA --type=nca --ncatype=program --titleid=010********** --titlekey=************* --exefsdir= --romfsdir=

hacPack v1.36 by The-4n
----> Preparing:
[WARN]: Failed to match key ..... Here this error.

Removing existing temp directory
Creating temp directory
Creating out directory
Creating backup directory

----> Processing NPDM
Failed to open \main.npdm!

Thank you -_-

It's been years since i last messed around with the switch let alone this repack stuff.

Looking at that error i assume you got the title key wrong
 

AinzOoalGown

Member
Newcomer
Joined
Jan 27, 2023
Messages
5
Trophies
0
XP
77
Country
France
It's been years since i last messed around with the switch let alone this repack stuff.

Looking at that error i assume you got the title key wrong
All right . the title key is right, i used it to extract my nsp file.
I think I found a solution, I'll do a tutorial after testing it twice.
 
  • Love
Reactions: binkinator

binkinator

Garfield’s Fitness Coach
Member
GBAtemp Patron
Joined
Mar 29, 2021
Messages
6,511
Trophies
2
XP
6,155
Country
United States
All right . the title key is right, i used it to extract my nsp file.
I think I found a solution, I'll do a tutorial after testing it twice.
A tut would be awesome!

I’m going down a similar path. This thread has helped a bit.
 

binkinator

Garfield’s Fitness Coach
Member
GBAtemp Patron
Joined
Mar 29, 2021
Messages
6,511
Trophies
2
XP
6,155
Country
United States
I can't put the tutorial on the site because it has forbidden words, I'll give you the link
github AinzOoalGown-fun/Nsp-XCI-Nca-unpack/blob/main/README.md
Appreciated! Will give this an idiot test after work!

(I somehow didn’t see any bad words.)
 

Kiriox

New Member
Newbie
Joined
Jul 2, 2022
Messages
3
Trophies
0
Age
22
Location
sss
XP
39
Country
France
I can't put the tutorial on the site because it has forbidden words, I'll give you the link
github AinzOoalGown-fun/Nsp-XCI-Nca-unpack/blob/main/README.md
This tutorial helped me a lot but there are still a few things that I need help with already how can I use this method to create an update that only includes the files that I want to modify like this the .nsp can be shared freely also I would like to be able to change the icon and the title of the game (always just with an update file) thanks in advance
 

newc22

Member
Newcomer
Joined
Jan 16, 2024
Messages
7
Trophies
0
Age
42
XP
52
Country
Hungary
If I modify one file how can I repack the New file to my nsp file?! and what it's mean dump keys with lockpick? I use PC. Thx the Reply!
 

kasai2713

Member
Newcomer
Joined
Jan 30, 2024
Messages
5
Trophies
0
XP
17
Country
United States
Does this work for update data alone? Since new switches can't be modded, is it possible to install mods through the update data and DLC themselves?
 

kasai2713

Member
Newcomer
Joined
Jan 30, 2024
Messages
5
Trophies
0
XP
17
Country
United States
Wrong.

And how do you want to install modified update or DLC with unhacked Switch?
You have to take apart your Switch if it's a newer model right? The DLC is in the update data which is stored on the SD card, but I just want to change some music and models. Is it possible to modify the update data without a hacked Switch? I have the update data from the SD card but it is packed and I do not know what file type it is. Also it looks like it is missing some bytes compared to an online dump of the same update that is in the NSP file format.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • TwoSpikedHands @ TwoSpikedHands:
    yall im torn... ive been hacking away at tales of phantasia GBA (the USA version) and have so many documents of reverse engineering i've done
  • TwoSpikedHands @ TwoSpikedHands:
    I just found out that the EU version is better in literally every way, better sound quality, better lighting, and there's even a patch someone made to make the text look nicer
  • TwoSpikedHands @ TwoSpikedHands:
    Do I restart now using what i've learned on the EU version since it's a better overall experience? or do I continue with the US version since that is what ive been using, and if someone decides to play my hack, it would most likely be that version?
  • Sicklyboy @ Sicklyboy:
    @TwoSpikedHands, I'll preface this with the fact that I know nothing about the game, but, I think it depends on what your goals are. Are you trying to make a definitive version of the game? You may want to refocus your efforts on the EU version then. Or, are you trying to make a better US version? In which case, the only way to make a better US version is to keep on plugging away at that one ;)
  • Sicklyboy @ Sicklyboy:
    I'm not familiar with the technicalities of the differences between the two versions, but I'm wondering if at least some of those differences are things that you could port over to the US version in your patch without having to include copyrighted assets from the EU version
  • TwoSpikedHands @ TwoSpikedHands:
    @Sicklyboy I am wanting to fully change the game and bend it to my will lol. I would like to eventually have the ability to add more characters, enemies, even have a completely different story if i wanted. I already have the ability to change the tilemaps in the US version, so I can basically make my own map and warp to it in game - so I'm pretty far into it!
  • TwoSpikedHands @ TwoSpikedHands:
    I really would like to make a hack that I would enjoy playing, and maybe other people would too. swapping to the EU version would also mean my US friends could not legally play it
  • TwoSpikedHands @ TwoSpikedHands:
    I am definitely considering porting over some of the EU features without using the actual ROM itself, tbh that would probably be the best way to go about it... but i'm sad that the voice acting is so.... not good on the US version. May not be a way around that though
  • TwoSpikedHands @ TwoSpikedHands:
    I appreciate the insight!
  • The Real Jdbye @ The Real Jdbye:
    @TwoSpikedHands just switch, all the knowledge you learned still applies and most of the code and assets should be the same anyway
  • The Real Jdbye @ The Real Jdbye:
    and realistically they wouldn't

    be able to play it legally anyway since they need a ROM and they probably don't have the means to dump it themselves
  • The Real Jdbye @ The Real Jdbye:
    why the shit does the shitbox randomly insert newlines in my messages
  • Veho @ Veho:
    It does that when I edit a post.
  • Veho @ Veho:
    It inserts a newline in a random spot.
  • The Real Jdbye @ The Real Jdbye:
    never had that i don't think
  • Karma177 @ Karma177:
    do y'all think having an sd card that has a write speed of 700kb/s is a bad idea?
    trying to restore emunand rn but it's taking ages... (also when I finished the first time hekate decided to delete all my fucking files :wacko:)
  • The Real Jdbye @ The Real Jdbye:
    @Karma177 that sd card is 100% faulty so yes, its a bad idea
  • The Real Jdbye @ The Real Jdbye:
    even the slowest non-sdhc sd cards are a few MB/s
  • Karma177 @ Karma177:
    @The Real Jdbye it hasn't given me any error trying to write things on it so I don't really think it's faulty (pasted 40/50gb+ folders and no write errors)
  • DinohScene @ DinohScene:
    run h2testw on it
    +1
  • DinohScene @ DinohScene:
    when SD cards/microSD write speeds drop below a meg a sec, they're usually on the verge of dying
    +1
  • Psionic Roshambo @ Psionic Roshambo:
    Samsung SD format can sometimes fix them too
  • Purple_Heart @ Purple_Heart:
    yes looks like an faulty sd
  • Purple_Heart @ Purple_Heart:
    @Psionic Roshambo i may try that with my dead sd cards
    Purple_Heart @ Purple_Heart: @Psionic Roshambo i may try that with my dead sd cards