Skip to content

Instantly share code, notes, and snippets.

@john-peterson
Last active July 2, 2023 20:34
Show Gist options
  • Save john-peterson/064c75803def76c88160aea903084408 to your computer and use it in GitHub Desktop.
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
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"
@john-peterson
Copy link
Author

Struggling for hours with title.keys. It doesn't like the yuzu format with brackets. Someone could have patched that years ago. I guess they don't like eachother

@john-peterson
Copy link
Author

Now if someone could populate the torrents with UPDATED UNPACKED files.... The strength.... .....

@john-peterson
Copy link
Author

Whenever I see a fitgirl torrent with thousands seeders.... Imagine how dumb they are that they prefer that. It's a PhD project to extract that in wine

@john-peterson
Copy link
Author

Screenshot_20230702-220151

Massive disk usage

@john-peterson
Copy link
Author

There is no real solid script. Like quickemu. That does this. Just type by hand and wait for hours. It's disk bound. IOPS

@john-peterson
Copy link
Author

john-peterson commented Jul 2, 2023

nstool --fstree diablo3c.nsp
[PartitionFs]
  Type:        PFS0
  FileNum:     2
[PartitionFs/Tree]
 Root:/
  a5bf6d6bf266646c1b6d8d5129ad1a1c.nca
  448d8ff40bce53176e29dd1e458f863a.cnmt.nca

nstool --fstree diablo3.nsp
[PartitionFs]
  Type:        PFS0
  FileNum:     8
[PartitionFs/Tree]
 Root:/
  01001b300b9be0000000000000000005.cert
  01001b300b9be0000000000000000005.tik
  244b84153edddf42407aa2a03572202a.nca
  ade5aee315b23e0d209fc8b3bb7965eb.nca
  93a483f1d8853d85ac98071070f5a547.nca
  87812cfdcc986b599d340eda9746d428.cnmt.nca
  87812cfdcc986b599d340eda9746d428.cnmt.xml
  e0197ee7f5aa5837643e8d982d4e3344.nca

@john-peterson
Copy link
Author

Tons of stuff missing in this repack. Would be surprised if it runs. How can it run without tik etc

@john-peterson
Copy link
Author

Should try this on a smaller file. Are there any updates for Touryst? What other small ones are there with seeders. And updates. And not strange packaging

@john-peterson
Copy link
Author

john-peterson commented Jul 2, 2023

Is all that bundled in the new NCA?? How does this work. Can s

@john-peterson
Copy link
Author

./yuzu-mainline-20230623-3a991f3ae.AppImage -f -g /home/dev/diablo3c.nsp
Unhandled SIGSEGV at rip 0x00000000008d4023
Segmentation fault (core dumped)

SOMEHOW I suspected that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment