nstool icon indicating copy to clipboard operation
nstool copied to clipboard

Extracting a patch file with a ticket

Open hgdagon opened this issue 2 years ago • 11 comments

I had no issues extracting the base game with this command:

nstool --tik maintik.tik -x ./game mainnca.nca

But I can't figure out how to extract the patch. The patch comes with it's own ticket, and I can only provide one. If I provide the main ticket:

nstool -x ./patch --tik ../main/maintik.tik --basenca ../main/mainnca.nca patchnca.nca

Nothing is extracted and I see this output:

[WARNING] NCA Partition 0 not readable. (AES-CTR Key was not determined)
[WARNING] NCA Partition 1 not readable. (AES-CTR Key was not determined)

If I provide the patch ticket:

nstool -x ./patch --tik patchtik.tik --basenca ../main/mainnca.nca patchnca.nca

Only partition 0 is extracted and I get this output:

[WARNING] NCA Partition 1 not readable. (Cannot determine RomFs from base nca.)

hgdagon avatar Oct 12 '23 02:10 hgdagon

Oh dear. I hadn't considered this, but I guess it's rather obvious that if both the base game and patch were digital downloads they'd have separate tickets & right ids.

I'll see what I can do about allowing the user to specify multiple tickets.

jakcron avatar Oct 13 '23 05:10 jakcron

@jakcron While you're at it, do you think you can add support for extracted nca? i.e instead of --basenca, pass --basedir and avoid the ticket problem altogether? I don't know which one would be easier to implement, but eh... just an idea.

hgdagon avatar Oct 13 '23 20:10 hgdagon

@jakcron Any update on this? I'm running into the same issue, and I tried poking around in the code for a bit to see if I could add something like a --base-tik argument but I can't say I understand much

thonkinator avatar Dec 29 '23 16:12 thonkinator

actually scratch that, i got it to work. it's definitely ugly but i'll clean it up and PR, i suppose? i'm gonna make it so you can specify as many tickets as you want (all with --tik)

thonkinator avatar Dec 29 '23 16:12 thonkinator

actually scratch that, i got it to work. it's definitely ugly but i'll clean it up and PR, i suppose? i'm gonna make it so you can specify as many tickets as you want (all with --tik)

That's actually a good idea, specifying as many tickets as required using --tik. Feel free to make a PR.

jakcron avatar Dec 31 '23 15:12 jakcron

After sleeping on this I felt motivated to do this myself, see here https://github.com/jakcron/nstool/tree/feature-106-multipletickets

I'm also adding support for automatically reading ~/.switch/title.keys (same format as used by hactool and everything else)

jakcron avatar Jan 01 '24 05:01 jakcron

I just need to make some documentation updates to explain how to use this, and specify the title.keys file.

jakcron avatar Jan 01 '24 05:01 jakcron

@jakcron While you're at it, do you think you can add support for extracted nca? i.e instead of --basenca, pass --basedir and avoid the ticket problem altogether? I don't know which one would be easier to implement, but eh... just an idea.

Sadly the way patches work makes this very difficult to implement.

jakcron avatar Jan 01 '24 05:01 jakcron

Hey @hgdagon @thonkinator can you try using NSTool v1.9.0 (https://github.com/jakcron/nstool/releases/tag/v1.9.0)?

You should be able to specify two tickets by invoking --tik for each ticket file.

jakcron avatar Jan 20 '24 09:01 jakcron

Works as expected on my end!

hgdagon avatar Jan 21 '24 02:01 hgdagon

sorry @jakcron totally forgot about this issue. it worked fine. i'm running into an issue with a newer patch for the same game though, although i'm not sure whether it's the same issue or a related issue or what. it's #115. thanks for making this tool!

thonkinator avatar May 14 '24 21:05 thonkinator