1
0
Fork 0
mirror of https://github.com/DarkMatterCore/nxdumptool.git synced 2024-11-10 12:41:47 +00:00
Commit graph

51 commits

Author SHA1 Message Date
Pablo Curiel
0ec60092df Keep indexes and counters for all supported storage IDs.
Speeds up title lookups using a specific storage ID.

Also reworked a bit the way orphan titles are handled. Should be better now.
2021-03-10 09:10:43 -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
3bc14696ec New logfile handler.
* Ported the logfile handler from libusbhsfs, with some slight modifications.

* Rewrote hash file system handling from scratch. I had been wanting to do this for some months now, it's a lot better now.

* Code cleanup.
2021-03-07 19:22:49 -04:00
Pablo Curiel
56a4b2f747 Update utils.c 2021-02-27 05:55:25 -04:00
Pablo Curiel
5eb96cbece services: completely ditch smRegisterService() and just use the AtmosphereHasService SM API extension.
This extension was already being used - however, smRegisterService() was also being used as a fallback method.

More than a year and a half has already passed since this feature was introduced, and both SX OS and ReiNX apparently support it now, so it's a justified change.
2021-02-24 23:36:53 -04:00
Pablo Curiel
e77c72b0db Some changes.
* gamecard: added more comments, modified gamecardGetBundledFirmwareUpdateVersion() to fill a VersionType1 pointer instead of a u32, fallback to manually reading the gamecard certificate if fsDeviceOperatorGetGameCardDeviceCertificate() fails, updated GameCardFwVersion enum.

* title: tweaked conditions for some functions.

* usb: explicitly defined values for previously omitted struct members while initializing USB comms, imported libusb structs to make it easier to work with the USB BOS, added a few more comments and changed around some code.

* utils: tweaked the illegal filesystem character array to remove some chars that are actually allowed.
2021-02-12 16:35:23 -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
fbd250a417 Update copyright years. 2020-12-23 13:48:57 -04:00
Pablo Curiel
ae12e48678 Added UMS interface based around libusbhsfs.
Also normalized Initialized -> Init in names from global variables.
2020-12-07 00:26:59 -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
9732bf9adf libusbhsfs-related changes.
* Free space is now retrieved via statvfs() for all filesystems, including the SD card.
* Updated Makefile to reflect latest libusbhsfs changes (dev branch).
2020-12-02 02:28:35 -04:00
Pablo Curiel
7899fc419c Update usbHsFsInitialize() call to reflect changes in libusbhsfs. 2020-11-28 02:56:54 -04:00
Pablo Curiel
dff9b1defa Revert "Rename FatFs functions to avoid linking issues with libusbhsfs."
This reverts commit 6715242fed.
2020-11-28 02:38:01 -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
6715242fed Rename FatFs functions to avoid linking issues with libusbhsfs. 2020-11-20 04:56:12 -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
5f0f281e2d Added USB ABI specs. 2020-11-01 11:04:38 -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
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
bd98fd4c32 Replace unnecessary strlen() calls with pointer dereferences or calculations using info available at runtime (when possible).
This should probably improve performance a little bit in certain sections.
2020-10-14 20:06:53 -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
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
1c15a096b5 Codestyle fixes + prepare code for NPDM support. 2020-10-08 14:31:09 -04:00
Pablo Curiel
98b7a309b3 CNMT AuthoringTool-like XML generation. 2020-10-02 05:53:58 -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
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
64f3a566f8 Commit filesystem changes when needed. 2020-08-01 00:43:55 -04:00
Pablo Curiel
7c4e7a4db0 New test app: system title NCA section dumper. 2020-07-29 17:02:21 -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
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
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
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
73861bc52f Normalize goto tag names + support for gamecard key area.
Big thanks to SciresM.
2020-07-13 02:36:17 -04:00
Pablo Curiel
400cab42a0 USB tweaks. 2020-07-12 11:29:08 -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
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
2e48a22f8c Improve thread-safety. 2020-05-02 19:40:50 -04:00
Pablo Curiel
0e5683b880 NCA read (almost) done.
Missing BKTR stuff.
2020-04-21 06:23:33 -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
c83858311b More baby steps. 2020-04-15 20:06:41 -04:00