nstool
nstool copied to clipboard
[FEATURE] When processing PFS0 archives, intelligently detect when it is NSP
About
NSPs are PFS0 archives that contain a bunch of *.nca files, at least one of which is a *.cnmt.nca file. This *.cnmt.nca file, contains in partition 0, a <TitleType>_<TitleId>.cnmt file, which contains metadata about the title, including which NCAs comprise this title, and what role each one has.
With this information, a composite filesystem can be created with all the NCAs. However a NSP can have more than one title included.
Additionally all of the *.tik files should be loaded/processed automatically.
Additionally, since *.cnmt includes hashes for the NCA files, verification should include verifying those hashes.
Example Data
File: Just Dance 2022 [0100EA6014BB8000][v0].nsp
Output of reading *.nsp
[PartitionFs]
Type: PFS0
FileNum: 7
[PartitionFs/Tree]
Root:/
0100ea6014bb8000000000000000000b.tik
0100ea6014bb8000000000000000000b.cert
8b354a1c9a11cdd3d0b012e5f3b00bb0.cnmt.nca
d5bdc4b294e5fdb8b4845510c0512a2f.nca
f9e374d924fdaa8af4505b753aee6b9c.nca
f0143905d50e559aaf78b34b638b1a56.nca
24aec9556b304f835480dadb6c4288ef.nca
Output of reading 8b354a1c9a11cdd3d0b012e5f3b00bb0.cnmt.nca
[NCA Header]
Format Type: NCA3
Dist. Type: Download
Content Type: Meta
Key Generation: 11
Sig. Generation: 0
Kaek Index: Application (0)
Size: 0xe00
ProgID: 0x0100ea6014bb8000
Content Index: 0
SdkAddon Ver.: 12.0.0 (v201326592)
[ContentArchive/Tree]
meta:/
0/
Application_0100ea6014bb8000.cnmt
Output of reading *.cnmt file
[ContentMeta]
TitleId: 0x0100ea6014bb8000
Version: 0.0.0-0.0 (v0)
Type: Application (128)
Attributes: 0x0
StorageId: None (0)
ContentInstallType: Full (0)
RequiredDownloadSystemVersion: 0.0.0-0.0 (v0)
ApplicationExtendedHeader:
RequiredApplicationVersion: 0.0.0-0.0 (v0)
RequiredSystemVersion: 12.1.0-0.0 (v806354944)
PatchId: 0x0100ea6014bb8800
ContentInfo:
0
Type: Program (1)
Id: d5bdc4b294e5fdb8b4845510c0512a2f
Size: 0x1a37e0000
Hash: d5bdc4b294e5fdb8b4845510c0512a2f5bc8185766ddbfb7d9fe9c0c40939cd2
1
Type: Control (3)
Id: f9e374d924fdaa8af4505b753aee6b9c
Size: 0x176400
Hash: f9e374d924fdaa8af4505b753aee6b9c2a66fbaa2f057718afe0ee5f5578038e
2
Type: LegalInformation (5)
Id: f0143905d50e559aaf78b34b638b1a56
Size: 0x4f000
Hash: f0143905d50e559aaf78b34b638b1a5621ea8ca75a1d1d708c8c3315fd122684
3
Type: HtmlDocument (4)
Id: 24aec9556b304f835480dadb6c4288ef
Size: 0x1c000
Hash: 24aec9556b304f835480dadb6c4288ef5fe31581c8245b95414da2ccf5199b57
Digest: 5a154739b19383ecb5d2f7589bd5685a1caf1d9878df737988048405e6355625
Output of reading the Program NCA
[NCA Header]
Format Type: NCA3
Dist. Type: Download
Content Type: Program
Key Generation: 11
Sig. Generation: 0
Kaek Index: Application (0)
Size: 0x1a37e0000
ProgID: 0x0100ea6014bb8000
Content Index: 0
SdkAddon Ver.: 11.4.3 (v184812288)
RightsId: 0100EA6014BB8000000000000000000B
[ContentArchive/Tree]
program:/
0/
main
main.npdm
rtld
sdk
subsdk0
1/
adventurerkids_nx.ipk
baiana_nx.ipk
balletkids_nx.ipk
believer_nx.ipk
blackmam_nx.ipk
blackmamalt_nx.ipk
boombayah_nx.ipk
boombayahalt_nx.ipk
bosswitch_nx.ipk
buildab_nx.ipk
bundle_nx.ipk
chacarron_nx.ipk
chandelier_nx.ipk
chandelieralt_nx.ipk
chefkids_nx.ipk
china_nx.ipk
chinaalt_nx.ipk
fearlesspiratekids_nx.ipk
firemenkids_nx.ipk
flashpose_nx.ipk
freedfromdesire_nx.ipk
funk_nx.ipk
funkyrobotkids_nx.ipk
girllikeme_nx.ipk
girllikemealt_nx.ipk
happierthanever_nx.ipk
human_nx.ipk
imouttalove_nx.ipk
jerusalema_nx.ipk
jopping_nx.ipk
joppingalt_nx.ipk
judas_nx.ipk
levelup_nx.ipk
levitating_nx.ipk
levitatingalt_nx.ipk
lovestory_nx.ipk
medievalkids_nx.ipk
mightyreal_nx.ipk
monstersacademykids_nx.ipk
mood_nx.ipk
mrbluesky_nx.ipk
nailships_nx.ipk
nailshipsjd_nx.ipk
popstars_nx.ipk
rockyourbody_nx.ipk
saveyourtears_nx.ipk
secure_fat.gf
siargo_nx.ipk
smalltownboy_nx.ipk
stopdropandroll_nx.ipk
suacara_nx.ipk
suacaraalt_nx.ipk
tgif_nx.ipk
thinkaboutthings_nx.ipk
whorun_nx.ipk
whorunaltretake_nx.ipk
youcandance_nx.ipk
2/
NintendoLogo.png
StartupMovie.gif
Output of reading the Control NCA
[NCA Header]
Format Type: NCA3
Dist. Type: Download
Content Type: Control
Key Generation: 11
Sig. Generation: 0
Kaek Index: Application (0)
Size: 0x176400
ProgID: 0x0100ea6014bb8000
Content Index: 0
SdkAddon Ver.: 11.4.3 (v184812288)
[ContentArchive/Tree]
control:/
0/
control.nacp
icon_AmericanEnglish.dat
icon_BrazilianPortuguese.dat
icon_BritishEnglish.dat
icon_CanadianFrench.dat
icon_Dutch.dat
icon_French.dat
icon_German.dat
icon_Italian.dat
icon_Japanese.dat
icon_Korean.dat
icon_LatinAmericanSpanish.dat
icon_Portuguese.dat
icon_Russian.dat
icon_SimplifiedChinese.dat
icon_Spanish.dat
icon_TraditionalChinese.dat
Output of reading the LegalInformation NCA
[NCA Header]
Format Type: NCA3
Dist. Type: Download
Content Type: Manual
Key Generation: 11
Sig. Generation: 0
Kaek Index: Application (0)
Size: 0x4f000
ProgID: 0x0100ea6014bb8000
Content Index: 0
SdkAddon Ver.: 11.4.3 (v184812288)
[ContentArchive/Tree]
manual:/
0/
legalinfo.xml
important.htdocs/
index.html
style.css
ipnotices.htdocs/
index.html
style.css
support.htdocs/
index.html
index_All.html
index_China.html
index_EU.html
index_HongKongTaiwanKorea.html
index_JP.html
index_US.html
regions.js
style.css
Output of reading the HtmlDocument NCA
[NCA Header]
Format Type: NCA3
Dist. Type: Download
Content Type: Manual
Key Generation: 11
Sig. Generation: 0
Kaek Index: Application (0)
Size: 0x1c000
ProgID: 0x0100ea6014bb8000
Content Index: 0
SdkAddon Ver.: 11.4.3 (v184812288)
RightsId: 0100EA6014BB8000000000000000000B
[ContentArchive/Tree]
manual:/
0/
accessible-urls/
accessible-urls.txt