1
0
Fork 0
mirror of https://github.com/DarkMatterCore/nxdumptool.git synced 2024-11-13 22:16:45 +00:00
Commit graph

54 commits

Author SHA1 Message Date
Pablo Curiel
ae3b7266a0 Fix NACP bitflag checks. 2021-03-20 03:13:16 -04:00
Pablo Curiel
a7984de0c8 Send Git commit hash as part of the StartSession block. 2021-03-16 01:08:38 -04:00
Pablo Curiel
a01b7846de title: use dynamic pointer arrays.
* Added functions to deal with title info and application metadata reallocations, greatly reducing the number of references to realloc() throughout the code.

* Tweaked gamecardGetHashFileSystemContext() to not return a pointer to a dynamic context.

* Added a type field to Hash FS contexts.
2021-03-09 21:12:01 -04:00
Pablo Curiel
8be5460229 Store last log message using a small stack buffer.
Will be used to print error messages down the road.
2021-03-08 10:44:11 -04:00
Pablo Curiel
43f744326f Minor fixes.
* The new logfile handler should now work properly.

* A UTF-8 BOM is now written at the start of every new logfile.
2021-03-08 07:11:28 -04:00
Pablo Curiel
a384137636 Fix compatibility with latest libusbhsfs commit. 2021-03-02 00:39:51 -04:00
Pablo Curiel
6df7ff0cba Fix output filenames not being updated in usb_gc_dumper. 2021-02-20 14:52:07 -04:00
Pablo Curiel
de076f4908 More USB changes.
* usb: copy command ID and block size before moving command data within the USB transfer buffer.

* nsp_dumper_usb: now spans a background thread for the dump process, progress is now displayed, process can now be cancelled by holding B, updated to properly make use of the new usbCancelFileTransfer() behavior.

* usb_gc_dumper: updated to properly make use of the new usbCancelFileTransfer() behavior.

* usb_romfs_dumper: updated to properly make use of the new usbCancelFileTransfer() behavior.

* Updated ns-usbloader patch. Must be used on commit `8771d551a4e6fa2d645e519d504a377e34cbd730`.
2021-02-16 08:22:14 -04:00
Pablo Curiel
88793eceea Populate app_metadata pointer in TitleInfo elements that aren't system titles or user applications. 2021-01-31 05:16:05 -04:00
Pablo Curiel
bbf1d2f7ad NSP dumper PoCs: fix crash while dumping updates/DLCs without an available base application. 2021-01-31 03:34:09 -04:00
Pablo Curiel
232fe05587 Use LIBUSBHSFS_FS_TYPE_STR() macro from libusbhsfs instead of our own one. 2020-12-24 07:16:16 -04:00
Pablo Curiel
b4bf505d4f UMS changes.
* Temporarily changed tracked libusbhsfs branch from main to dev.

* Minor improvements in ums.c/h.

* Refactored nsp_dumper_sd into nsp_dumper_stor - now capable of dumping NSPs to a mounted partition from a UMS device.

* Fixed utilsWaitForButtonPress() when no button mask is provided.

* Refactored utilsGetFreeSpaceFromFileSystemByPath() into utilsGetFileSystemStatsByPath().
2020-12-24 04:49:38 -04:00
Pablo Curiel
c29f994b35 Support for HOS 11.0.0.
* Updated hardcoded system title list to match HOS 11.0.0.
* Updated NcaKeyGeneration_Current.
* Updated button input handling to match the new pad API from libnx.
2020-12-04 02:38:44 -04:00
Pablo Curiel
477c321773 Remove unnecessary code.
libusbhsfs doesn't return FsFileSystem objects, that's why.
2020-11-21 06:29:29 -04:00
Pablo Curiel
e8956c0e4b Various changes.
* Cancel USB file transfer if something goes wrong during a NSP transfer via USB.
* Added SD card RomFS dumper.
* Further optimizations to the *WriteNcaPatch() functions.
* Change struct naming in nso.c/h (thanks @0Liam !).
* Replace fsp-usb with libusbhsfs. ( ͡° ͜ʖ ͡°)
2020-11-08 15:08:30 -04:00
Pablo Curiel
0229124173 NACP changes.
Fixed types for some NACP struct entries (thanks @0Liam !) + added functions to generate and write NACP patches.
2020-10-28 18:48:46 -04:00
Pablo Curiel
278afbabfa Title handler bugfixes.
* Fixed possible invalid memory accesses using TitleInfo pointers from gamecard titles if the gamecard they belong to is taken out.
* Fixed invalid for loop condition in _titleGetInfoFromStorageByTitleId() if no gamecard titles have been retrieved.
2020-10-27 17:23:19 -04:00
Pablo Curiel
5c5f388feb Add NSP transfer mode to USB code + implement SendNspHeader USB command.
Completely untested.
2020-10-26 02:39:33 -04:00
Pablo Curiel
da5290189b Optimize modified NCA header(s) write code. 2020-10-25 20:03:02 -04:00
Pablo Curiel
7e2aa976b4 Rename KEY_NONE definition. 2020-10-22 16:13:00 -04:00
Pablo Curiel
974790944f More changes.
* Added NSP dumper PoC (SD card only atm, single-threaded).
* Cert: replaced a wrong strcmp() with a proper strncmp().
* CNMT: added functions to update content info entries and generate/write Partition FS patches.
* NCA: encrypt key area right after removing titlekey crypto.
* NPDM/ProgramInfo: changed function names.
* NPDM: check if the NCA has been modified before attempting to patch ACID data + calculate RSA-PSS signature *after* generating the PFS patch, not before. lol
* PFS: restore name table size value before writing the header padding.
* Tik: reworked the ticket lookup algorithm. Now uses information from ticket_list.bin to properly calculate the offset to the requested ticket in ticket.bin.
* Title: changed title type strings used for filename generation.
* Updated to-do list.
2020-10-22 00:38:14 -04:00
Pablo Curiel
15431ec2c8 Many changes.
* AES: moved CTR initializing/updating functions here from nca.c.
* BKTR/RomFS/PFS: check if we're dealing with a NCA with titlekey crypto and the titlekey hasn't been retrieved.
* BFTTF: use void pointers for output font data.
* Mem: Only exclude Unmapped/Uo/ThreadLocal/Reserved memory pages if dealing with FS.
* NCA: use content type context pointers inside NCA contexts to manage ContentMeta, ProgramInfo, Nacp and LegalInfo contexts.
* NCA: added 'written' bool elements to patch structs to indicate patch write completion.
* NPDM: remove unnecessary inline functions, generate PFS patch right after changing ACID data, add a pfsWriteEntryPatchToMemoryBuffer wrapper.
* PFS: added PartitionFileSystemFileContext and related functions to deal with NSP headers.
* ProgramInfo: removed unnecessary inline functions.
* Save: added commented code to dump a full system savefile - will probably use it down the road.
* Tik: added support for volatile tickets (thanks to @shchmue and @Whovian9369!), added a rights ID string representation to the Ticket struct, clear Volatile and ELicenseRequired flags in conversions to common tickets.
* Title: added a function to calculate the number of titles (current + siblings) from a TItleInfo block.
* Utils: added a function to generate a dynamically allocated path string using a prefix, a filename and a extension.
* Removed explicit offset checks throughout all the code.
* Codestyle fixes.
* Updated to-do.
2020-10-21 00:27:48 -04:00
Pablo Curiel
6f4cb98033 Cleanup startup logfile messages. 2020-10-14 19:08:01 -04:00
Pablo Curiel
e6bb15d608 Implemented BFTTF font loading and decoding.
Some people may call me a madman but I don't want to see any more nxdumptool screenshots with a Disney-like font. *war flashbacks*
2020-10-14 09:23:49 -04:00
Pablo Curiel
44965430b3 Even more code cleanup.
* Added a function to write re-encrypted NCA and/or FS section headers. Getting ready to re-implement NSP dumping.
* Added more CNMT XML fields (thanks 0Liam).
* Updated my to-do list because I'm dummy.
2020-10-13 20:15:21 -04:00
Pablo Curiel
ba4fdcd01c Code cleanup.
* Added 'encrypted_header' members to both NcaContext and NcaFsSectionContext. In-place re-encryption isn't desirable in this case.
* Fixed FsAccessControl-related type naming for ACI0 blocks.
2020-10-13 10:00:03 -04:00
Pablo Curiel
ebd97d7c82 Add FsAccessControlData to ProgramInfo XML.
Also:

* Fixed support for NSOs with invalid module_name, api_info, dynstr and/or dynsym offsets/sizes.
* Updated the XML generator example to generate XML data for all available NCAs, regardless of their ID offset values.
2020-10-12 16:35:47 -04:00
Pablo Curiel
4ab8f44003 Wipe more legacy code that has already been rewritten. 2020-10-12 12:17:29 -04:00
Pablo Curiel
40fc21b5a3 Fix ProgramInfo and NSO issues.
XML generation confirmed to be working. The new algorithm faithfully reproduces the same output from legacy nxdumptool with much less overhead and memory usage.
2020-10-11 20:40:54 -04:00
Pablo Curiel
3affe1f4d0 ProgramInfo AuthoringTool-like XML generation.
Untested. Completely reworked both Middleware and ELF symbol parsing from NSOs.
2020-10-11 15:55:01 -04:00
Pablo Curiel
495e331306 Fix support for NSOs without a valid .api_info section + ProgramInfo context.
ProgramInfo XML generation is still missing. Getting real close to reimplementing NSP dumping.
2020-10-11 14:13:09 -04:00
Pablo Curiel
1de967ed42 NSO structs (thanks 0Liam). 2020-10-10 11:35:14 -04:00
Pablo Curiel
3e59d15bc4 Minor template tweaks + LegalInfo fix. 2020-10-10 06:10:50 -04:00
Pablo Curiel
d1f0361725 Update NPDM structs (thanks to 0Liam) + LegalInformation XML retrieval.
From now on, I'll delete code from the legacy codebase directory as soon as specific features from it are rewritten... Because it's a mess to navigate.
2020-10-09 05:58:53 -04:00
Pablo Curiel
1c15a096b5 Codestyle fixes + prepare code for NPDM support. 2020-10-08 14:31:09 -04:00
Pablo Curiel
e943e84380 Unified XML generator + finished NACP parsing.
Big thanks to 0Liam.
2020-10-06 11:41:26 -04:00
Pablo Curiel
7573c53457 Fix silly bug in titleGetNcmContentMetaTypeName. 2020-10-04 06:40:56 -04:00
Pablo Curiel
1e41148c02 NACP parsing (part 2).
NeighborDetectionClientConfiguration and RequiredAddOnContentsSetBinaryDescriptor haven't been implemented (yet).
2020-10-04 03:05:05 -04:00
Pablo Curiel
fa1b9c70a5 NCA changes. 2020-10-02 22:37:05 -04:00
Pablo Curiel
98b7a309b3 CNMT AuthoringTool-like XML generation. 2020-10-02 05:53:58 -04:00
Pablo Curiel
6e32829cf1 CNMT parsing. 2020-10-01 02:17:59 -04:00
Pablo Curiel
b806c2e7d0 Support multi-program titles in the RomFS dumper. 2020-09-19 02:59:31 -04:00
Pablo Curiel
971d7fd72c Silly fix. 2020-08-20 23:49:57 -04:00
Pablo Curiel
f809d795e3 Update BKTR PoC to make it dump user application RomFS data if an update isn't available. 2020-08-19 13:20:26 -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
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
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
ca333bd71d Missing fs commit changes. 2020-08-01 00:52:40 -04:00