Last active
July 2, 2023 20:34
-
-
Save john-peterson/064c75803def76c88160aea903084408 to your computer and use it in GitHub Desktop.
Merge base and update NSP into a single file. We used to call it slipstream when we used windows
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mkdir .switch base update exefs romfs nca nsp | |
basensp=diablo3.nsp | |
updatensp=diablo3u.nsp | |
cp .local/share/yuzu/keys/prod.keys .switch/ | |
sed 's/|[^|]*$//' .local/share/yuzu/keys/title.keys | sed 's/|/=/' > .switch/title.keys | |
hactool -t pfs0 $basensp --outdir base | |
hactool -t pfs0 $updatensp --outdir update | |
for i in base/*.nca; do type=$(hactool --disablekeywarns $i | grep -oP "(?<=Content Type:\s{23}).*"); echo $i $type; if [ $type == "Program" ]; then basenca=$i; fi; done | |
for i in update/*.nca; do type=$(hactool --disablekeywarns $i | grep -oP "(?<=Content Type:\s{23}).*"); echo $i $type; if [ $type == "Program" ]; then updatenca=$i; elif [ $type == "Control" ]; then controlnca=$i; fi; done | |
# parse Title ID from base program NCA | |
titleid=$(hactool --disablekeywarns $basenca | grep -oP "(?<=Title ID:\s{27}).*") | |
# extract base and update NCAs into romfs end exefs | |
hactool --basenca $basenca $updatenca --romfsdir romfs --exefsdir exefs | |
# pack romfs and exefs into one NCA | |
hacpack --type nca --ncatype program --plaintext --exefsdir=exefs --romfsdir romfs --titleid $titleid --outdir nca | |
patchednca=$(ls nca) | |
# generate meta NCA from patched NCA and control NCA | |
hacpack --type="nca" --ncatype="meta" --titletype="application" --programnca="nca/$patchednca" --controlnca="$controlnca" --titleid="$titleid" --outdir="nca" | |
# pack all three NCAs into an NSP | |
hacpack --type="nsp" --ncadir="nca" --titleid="$titleid" --outdir="nsp" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
SOMEHOW I suspected that