1
0
Fork 0
mirror of https://github.com/DarkMatterCore/nxdumptool.git synced 2024-11-26 04:02:11 +00:00
Commit graph

462 commits

Author SHA1 Message Date
Pablo Curiel
97d9603e93 BKTR: add support for games with base Program NCAs without a RomFS section. 2020-09-26 06:49:18 -04:00
Pablo Curiel
1a6f2ee50c Rename some reserved fields. 2020-09-24 13:03:26 -04:00
Pablo Curiel
38f19351a9 Add build script. 2020-09-22 21:13:39 -04:00
Pablo Curiel
083874bd4e Fix unaligned reads from the gamecard secure storage area.
Big thanks to Whovian for finding the bug and testing the change.
2020-09-19 06:21:23 -04:00
Pablo Curiel
b806c2e7d0 Support multi-program titles in the RomFS dumper. 2020-09-19 02:59:31 -04:00
Pablo Curiel
01ff151946 Update fs_ext.h 2020-09-18 23:18:32 -04:00
Pablo Curiel
679aa170b5 Some small changes.
* tik: check for common certificate availability before attempting to convert a personalized ticket to a common one. The raw common certificate chain data for the ticket signature issuer is now returned.

* usb: skip waitMulti call in the USB background thread if an invalid endpoint max packet size was received from the USB host in the previous while loop iteration.
2020-08-27 15:18:31 -04:00
Pablo Curiel
d6cdfe5c06 Perform title sorting at startup and in the background gamecard title info thread, not while retrieving data using non-static functions.
Orphan titles are now sorted by title ID.
2020-08-20 20:18:05 -04:00
Pablo Curiel
a19d3f2338 Ditched C threads in favor of libnx threads.
Preemptive multithreading is still used, just like libnx's newlib implementation.

Also changed the version number because the rewrite deserves it.
2020-08-18 01:04:13 -04:00
Pablo Curiel
1e50cec315 Update usb.c 2020-08-17 17:31:24 -04:00
Pablo Curiel
dfa425790a Get endpoint max packet size from USB host to properly enable ZLT packets when needed.
Also updated the diff patch for ns-usbloader.
2020-08-17 17:30:47 -04:00
Pablo Curiel
f724eaa9a9 Update utils.c 2020-08-15 17:25:40 -04:00
Pablo Curiel
6b8b3184ac Fixes for development units + diff patch for ns-usbloader.
Big thanks to ZachyCatGames.
2020-08-15 17:22:49 -04:00
Pablo Curiel
ace4732fda Functions to generate gamecard/title filenames + fix CRC32 calculation.
Updated the threaded gamecard dumper to reflect these changes.
2020-08-13 22:31:02 -04:00
Pablo Curiel
7606f7b40a Clear previous and next pointers from user application entries while freeing gamecard title info entries. 2020-08-13 14:20:53 -04:00
Pablo Curiel
90c6d8a9f8 Use linked lists to deal with user applications available in multiple storages at the same time. 2020-08-13 14:12:33 -04:00
Pablo Curiel
ad401d559d New template: threaded gamecard dumper via USB.
Key area and certificate can be optionally appended and/or preserved, respectively. Trimming is supported.

Also added a bunch of ZLT packet related fixes to usb.c, as well as a function to properly cancel an ongoing file transfer.
2020-08-13 02:01:23 -04:00
Pablo Curiel
e26637125b Add slightly better scrolling + title counter. 2020-08-03 17:41:00 -04:00
Pablo Curiel
3105540c99 Block HOME button presses during dumping operations in code templates. 2020-08-03 14:13:24 -04:00
Pablo Curiel
032a4fc22c Perform gamecard initial data area lookup only on demand. 2020-08-01 01:17:08 -04:00
Pablo Curiel
ca333bd71d Missing fs commit changes. 2020-08-01 00:52:40 -04:00
Pablo Curiel
64f3a566f8 Commit filesystem changes when needed. 2020-08-01 00:43:55 -04:00
Pablo Curiel
b11df5e732 Remove unnecessary line breaks. 2020-07-30 18:42:53 -04:00
Pablo Curiel
5d1944b43c Move title info dump code to a template. 2020-07-30 18:40:02 -04:00
Pablo Curiel
3f837cef05 Simple functions to deal with orphan titles...
... No way to avoid them, I guess.
2020-07-30 18:37:45 -04:00
Pablo Curiel
bb8cba1eaa Threaded gamecard title info/metadata retrieval. 2020-07-30 17:43:50 -04:00
Pablo Curiel
cd8afd2cd8 Fixed gamecard key area template. 2020-07-30 16:01:26 -04:00
Pablo Curiel
7c4e7a4db0 New test app: system title NCA section dumper. 2020-07-29 17:02:21 -04:00
Pablo Curiel
5320260b4e Better names for TITLE_* defines. 2020-07-28 02:20:19 -04:00
Pablo Curiel
64766be416 Update title.c 2020-07-27 23:38:45 -04:00
Pablo Curiel
98f3f85a31 Bunch of title related changes.
* Improved patch and add-on content title ID verification against a base application title ID.
* Implemented linked lists in TitleInfo structs, which make it easier to deal with multiple patches / add-on contents belonging to the same application.
* TitleApplicationMetadata elements are retrieved with titleGetApplicationMetadataEntries() and used by the UI to display title entries. An 'is_system' filter argument is used to determine which kind of metadata should be retrieved. These are ordered by ID (system titles) or alphabetically (user applications) using qsort().
* Added TitleUserApplicationData struct, which is populated when an user application is selected.
* Tweaked titleRefreshGameCardTitleInfo() behaviour a little bit. Now returns true whenever there are title info changes, so the UI can reload the list.
* Temporarily commented out title info logging from titleInitialize().
* Fixed decrypted key retrieval from the NCA key area for patches with titlekey crypto removed.
* Implemented a very small menu to select a title to dump.
2020-07-27 23:32:08 -04:00
Pablo Curiel
62366327ee Reduce memory footprint + hardcode system title names.
Also increased the USB timeout again, since 1 second seems to be too low for gamecard transfers.

Big thanks to Whovian for helping me format that long system title list.
2020-07-26 04:00:54 -04:00
Pablo Curiel
158e424b96 List content infos as part of title list entries.
Finally got rid of location resolver stuff.
2020-07-26 00:57:12 -04:00
Pablo Curiel
2521ac3f15 List titles from the inserted gamecard. 2020-07-25 14:50:42 -04:00
Pablo Curiel
e4a6e0e77a Begin work on title listing stuff. 2020-07-25 01:56:35 -04:00
Pablo Curiel
8a54ea4823 Supress unnecessary log messages. 2020-07-23 17:57:43 -04:00
Pablo Curiel
ee5a08f5d9 Trivial changes. 2020-07-23 17:30:01 -04:00
Pablo Curiel
e7f2c927c2 FIx small overlook. 2020-07-22 21:34:13 -04:00
Pablo Curiel
c8c062e7fa Test unified NCA hash layer write function (works gucci). 2020-07-22 20:37:02 -04:00
Pablo Curiel
b8d80bf260 Functions and wrappers to write generated NCA hash layer patches. 2020-07-22 16:35:23 -04:00
Pablo Curiel
90e0f057bc Bunch of changes.
* Updated NCA structs (including NcaSparseInfo).
* Changed the way NCA header + NCA FS header decryption is handled.
* Changed the way the NCA encrypted key area is handled.
* Unified hierarchical patch generation functions.
* Updated PFS, RomFS and BKTR functions accordingly to reflect NCA handling changes.
* Logfile path is now relative.
* Gamecard initial data lookup code now uses the initial data hash from the gamecard header (a tad bit slower, but way more failproof).
2020-07-22 04:03:28 -04:00
Pablo Curiel
cddf57363c Remove wrong references to ECC data in gamecards. 2020-07-17 14:42:48 -04:00
Pablo Curiel
6bee2c5d20 Tweaked gamecard code.
Modified gamecard handle retrieval and storage area mounting. Added gamecard status codes.
2020-07-17 01:01:31 -04:00
Pablo Curiel
95d5bda83a Update main.c 2020-07-15 19:45:06 -04:00
Pablo Curiel
88d3e0de8d Support for the "boot" partition in Terra gamecards. 2020-07-15 19:43:58 -04:00
Pablo Curiel
eba26a59a5 Changes to the gamecard key area handling. 2020-07-15 18:50:34 -04:00
Pablo Curiel
5082a54571 Glorified Patch RomFS dumper. lol 2020-07-13 12:33:22 -04:00
Pablo Curiel
73861bc52f Normalize goto tag names + support for gamecard key area.
Big thanks to SciresM.
2020-07-13 02:36:17 -04:00
Pablo Curiel
8baa5800a1 Proper USB background thread exit. 2020-07-12 12:37:03 -04:00
Pablo Curiel
400cab42a0 USB tweaks. 2020-07-12 11:29:08 -04:00
Pablo Curiel
90951f9baa Check the right event index. 2020-07-07 12:39:20 -04:00
Pablo Curiel
8c90f64d7f Codestyle fixes. 2020-07-07 11:51:33 -04:00
Pablo Curiel
85748c99c5 Small NCA0 change. 2020-07-07 11:20:29 -04:00
Pablo Curiel
0c34ef84ac Check the key generation value from the eticket device key. 2020-07-07 08:58:17 -04:00
Pablo Curiel
11e9d6612a Forgot to update bktr.c/h accordingly. 2020-07-07 07:55:37 -04:00
Pablo Curiel
b71f0d7b87 Some more changes.
* Codestyle fixes.
* NCA contexts for NCAs with titlekey crypto will now be generated even if the ticket can't be retrieved, in order to be able to use ncaReadContentFile() with them.
* Moved aes128XtsNintendoCrypt() out of nca.c.
2020-07-05 20:10:07 -04:00
Pablo Curiel
99429fd7b4 Bunch of changes.
* Updated disclaimer in all source files.
* Improved signed payload (certificate, ticket) handling.
* Prefer strlen + strcmp over strncmp whenever possible.
* Simplify header file inclusions in source files.
* Simplify background gamecard thread logic.
* Properly close keys file handle if there's a key parse error.
* Update NcaKeyGeneration enum.
* Small changes to save.c/h.

Will probably have to revert some USB changes...
2020-07-03 05:31:22 -04:00
Pablo Curiel
3e47dd180d Fix compatibility with libnx v3.2.0. 2020-05-14 22:59:57 -04:00
Pablo Curiel
1ebc106b79 Manage USB transfer session using a background thread. 2020-05-13 10:09:51 -04:00
Pablo Curiel
a3790dd0d6 Mooore USB fixes. 2020-05-11 15:12:03 -04:00
Pablo Curiel
d6179f77fb USB optimizations. 2020-05-11 08:11:06 -04:00
Pablo Curiel
a02c806b60 Extracted RomFS dumping via USB. 2020-05-10 12:40:12 -04:00
Pablo Curiel
b39ab27a52 Silly correction. 2020-05-10 05:07:31 -04:00
Pablo Curiel
d629f21e8c Fix fatals. 2020-05-09 13:09:22 -04:00
Pablo Curiel
47297daf3a Some more USB fixes. 2020-05-09 09:49:02 -04:00
Pablo Curiel
1f05a39560 Update usb.c 2020-05-09 02:32:01 -04:00
Pablo Curiel
daedae88a8 Small USB status codes update. 2020-05-09 00:48:46 -04:00
Pablo Curiel
a7698e435e USB protocol updated. 2020-05-07 23:48:22 -04:00
Pablo Curiel
61fb465e2a Additional USB changes. 2020-05-07 07:08:54 -04:00
Pablo Curiel
97f7a46a91 Fix deadlock. 2020-05-06 10:36:17 -04:00
Pablo Curiel
257e1c8dfd Some more USB related changes. 2020-05-06 10:04:10 -04:00
Pablo Curiel
5c46bfe2ab Update usb.h 2020-05-06 02:05:25 -04:00
Pablo Curiel
bd6f67d57a Protocol -> ABI.
Also add this to the handshake command block.
2020-05-06 02:01:00 -04:00
Pablo Curiel
253e72786b Tweaks to utilsReplaceIllegalCharacters.
We won't need to replace characters outside of the ASCII range for USB transfers.
2020-05-05 14:04:23 -04:00
Pablo Curiel
298676ae46 Preliminar Switch <-> PC protocol using usb:ds. 2020-05-05 11:22:16 -04:00
Pablo Curiel
444c82b7c0 Save exception info to logfile.
Benchmark test updated to dump the inserted gamecard.
2020-05-04 14:15:03 -04:00
Pablo Curiel
76b19aed96 Threaded I/O test.
Takes roughly 15 minutes to dump SSBU's data.arc - basically a whole GiB per minute. Which is real nice, considering all the crypto layers we're dealing with.
2020-05-03 10:55:13 -04:00
Pablo Curiel
08b2aed130 Gamecard usermode status change event.
Useful to wait for gamecard status changes on other threads.
2020-05-03 04:40:08 -04:00
Pablo Curiel
109913cb18 Fix gamecard deadlock. 2020-05-02 20:36:09 -04:00
Pablo Curiel
2e48a22f8c Improve thread-safety. 2020-05-02 19:40:50 -04:00
Pablo Curiel
9148b4e0dd Looks better this way. 2020-05-01 11:22:08 -04:00
Pablo Curiel
050f881cf6 derp 2020-05-01 11:11:18 -04:00
Pablo Curiel
91fdff7816 Codestyle fixes. 2020-05-01 11:06:24 -04:00
Pablo Curiel
e2b4ebc5d4 BKTR: updated file entry detection. 2020-05-01 00:34:30 -04:00
Pablo Curiel
efb9b2d103 BKTR finished. 2020-04-30 07:24:08 -04:00
Pablo Curiel
4774aeae9c BKTR done, needs testing. 2020-04-30 04:25:03 -04:00
Pablo Curiel
e1e38bcfc2 derp 2020-04-29 17:16:59 -04:00
Pablo Curiel
b64bcf5451 Fix mem leaks in PFS/RomFS initializers.
Also renamed Ecsda240 -> Ecc480 and added a new Hmac160 signature type.
2020-04-29 17:11:27 -04:00
Pablo Curiel
7e8fa96829 Remove NcaEncryptionType_Nca0 + BKTR start. 2020-04-29 08:59:28 -04:00
Pablo Curiel
7aa72dc618 Remove unnecessary RomFS context members. 2020-04-29 07:55:23 -04:00
Pablo Curiel
08bfb89adb Another PFS patch test, works gucci. 2020-04-29 06:55:20 -04:00
Pablo Curiel
18531961ca RomFS file entry patching working. 2020-04-29 05:54:40 -04:00
Pablo Curiel
e1b1dfc648 Reworked FS section patching. 2020-04-28 04:58:17 -04:00
Pablo Curiel
226fbd0e21 Small PFS fix. 2020-04-28 00:38:24 -04:00
Pablo Curiel
2c252c03b2 Control.nacp reading.
First step towards RomFS modification.
2020-04-27 22:33:38 -04:00
Pablo Curiel
278142fd22 RomFS done.
Modifications method still missing though.
2020-04-27 19:30:35 -04:00
Pablo Curiel
efe76093e4 RomFS (almost) done.
Need to test read functions.
2020-04-27 18:37:15 -04:00
Pablo Curiel
bc93001525 RomFS ctx working.
Need to create filepath methods.
2020-04-26 06:04:31 -04:00
Pablo Curiel
c6eaf3c8b6 PFS0 mod data + RomFS start. 2020-04-26 04:35:01 -04:00
Pablo Curiel
dccb33ab0c PFS0 read improved. 2020-04-24 14:42:16 -04:00
Pablo Curiel
7c8bf5c831 PFS0 context. 2020-04-24 05:38:13 -04:00
Pablo Curiel
76550adab8 NCA read finished. 2020-04-22 16:53:20 -04:00
Pablo Curiel
0e5683b880 NCA read (almost) done.
Missing BKTR stuff.
2020-04-21 06:23:33 -04:00
Pablo Curiel
ccf36f4963 NCA process done. 2020-04-20 06:39:41 -04:00
Pablo Curiel
cf8ab4d4ac More improvements. 2020-04-19 18:44:22 -04:00
Pablo Curiel
1b45cdf05a Mooooore baby steps.
I can finally continue the NCA handler.
2020-04-17 17:59:05 -04:00
Pablo Curiel
9679eb72bb Hash FS start. 2020-04-16 06:13:11 -04:00
Pablo Curiel
d3ad9d84b6 More changes. 2020-04-16 00:37:16 -04:00
Pablo Curiel
c83858311b More baby steps. 2020-04-15 20:06:41 -04:00
Pablo Curiel
eccd3f0c1c Baby steps. 2020-04-15 16:50:07 -04:00
Pablo Curiel
65e40e7600 Gamecard rewrite. 2020-04-15 01:59:12 -04:00
Pablo Curiel
e5a4532a63 First commit. 2020-04-11 01:28:26 -04:00