1
0
Fork 0
mirror of https://github.com/DarkMatterCore/nxdumptool.git synced 2024-09-16 20:13:25 +01:00
Commit graph

616 commits

Author SHA1 Message Date
Pablo Curiel 665a5baf7e Update libusbhsfs.
Also fixed a small bug in the gc_dumper PoC.
2023-01-05 01:30:12 +01:00
Pablo Curiel 3aae84a025 QoL changes.
* gc_dumper: add UMS device support.
* nsp_dumper: add DLC Update support.
* cnmt: add a reminder about the extended data size in NcmContentMetaType_DataPatch CNMTs.
* nca: update NcaKeyGeneration enum comment.
* title: update system titles array, severely overhaul the way linked lists work in Title* structs to properly support DLC updates.
2022-12-04 11:29:47 +01:00
Pablo Curiel 0f1055c84e Preliminar 15.x support.
This commit uses my yet unmerged libnx PR to update ncm_types.h.

PoC code hasn't been updated yet, so proper support for DLC updates will arrive at a later time.

Note to self: implement a way to provide access to loaded DataPatch TitleInfo entries (linked list hell).

* bktr: renamed bktrBucketInitializeSubStorageReadParams to bktrInitializeSubStorageReadParams to avoid redundancy, added debug code to dump BucketInfo and BucketTree tables if BucketTree storage initialization fails.

* cnmt: updated ContentMetaAddOnContentMetaExtendedHeader struct to its 15.x equivalent, added ContentMetaLegacyAddOnContentMetaExtendedHeader struct, added ContentMetaDataPatchMetaExtendedHeader struct, updated the cnmtGetRequiredTitleId and cnmtGetRequiredTitleVersion functions to support DataPatch titles, updated cnmtInitializeContext to support both the new AddOnContent extended header and DataPatch titles, added debug code to dump the whole CNMT if context initialization fails, updated cnmtGenerateAuthoringToolXml to support DataPatch titles.

* keys: updated block hashes to match 15.x keyset, use case-insensitive comparison while looking for entry names in keysReadKeysFromFile, make sure the eticket_rsa_kek is non-zero before proceeding in keysGetDecryptedEticketRsaDeviceKey.

* nca: updated NcaKeyGeneration enum, added reminder about updating NcaSignatureKeyGeneration if necessary, replaced ncaFsSectionCheckHashRegionAccess with ncaFsSectionCheckPlaintextHashRegionAccess, removed all extents checks on Patch RomFS and sparse sections, updated ncaGetFsSectionTypeName to reflect if a FS section holds a sparse layer or not.

* nca_storage: updated ncaStorageInitializeContext to avoid initializing a compressed storage if a sparse layer is also used (fixes issues with Them's Fightin' Herds), updated ncaStorageSetPatchOriginalSubStorage to enforce the presence of a compressed storage in a patch if the base FS holds a compressed storage.

* npdm: added reminder about updating NpdmSignatureKeyGeneration if necessary, updated NpdmFsAccessControlFlags enum, updated NpdmAccessibility enum, updated NpdmSystemCallId enum, fixed typos.

* title: updated all relevant functions that deal with NcmContentMetaType values to also handle DataPatch titles, added functions to handle DataPatchId values, removed titleConvertNcmContentSizeToU64 and titleConvertU64ToNcmContentSize functions in favor of ncmContentInfoSizeToU64 and ncmU64ToContentInfoSize from my unmerged libnx PR, updated internal arrays to match 15.x changes, renamed titleOrphanTitleInfoSortFunction to titleInfoEntrySortFunction and updated it to also sort entries by version and storage ID, updated titleGenerateTitleInfoEntriesForTitleStorage to sort TitleInfo entries, simplified titleDuplicateTitleInfo a bit by using macros.
2022-10-23 16:44:47 +02:00
Pablo Curiel 00dd3df4fc Update usb.c 2022-09-13 02:53:11 +02:00
Pablo Curiel 5be5a7b16d keys: implement NCA KAEK and titlekek validation.
Keyslots beyond the hardcoded "current" one won't be validated.
2022-09-13 02:22:15 +02:00
Pablo Curiel 7bb708e394 Many small changes (sorry, I need to push these).
* Use forward declarations for type definitions wherever suitable (e.g. NcaContext, BucketTreeContext).
* Replace references to "DumpDestination" with "OutputStorage".
* Replace references to "append key area" with "prepend key area".
* Update LZ4 to v1.9.4.
* Update Material Icons font to 2022-08-01.
* RootView: change USB-related icons, reflect how many UMS devices are currently connected to the console, provide a way for child views to retrieve the populated UMS devices vector.
* Tasks: implement GetUmsDevices().
* Update borealis.
* Update libusbhsfs.
* Begin implementation of a DumpOptionsFrame class to display configurable options before starting a new dump process.
* bktr: rename bktrIsValidSubstorage() to bktrIsValidSubStorage(), use bktrIsValidSubStorage() in bktrInitializeCompressedStorageContext(), fixed a bug in bktrReadCompressedStorage() where Sparse substorages wouldn't be allowed.
* GamecardTab: push a DumpOptionsFrame object onto the view stack if the XCI option is clicked.
2022-09-12 20:19:10 +02:00
Pablo Curiel 3cbdb5dc65 OptionsTab: let AppletFrame take care of registering the B button action. 2022-07-31 04:21:19 +02:00
Pablo Curiel 3b892e2179 OptionsTab: only make even lines focusable in changelog. 2022-07-31 01:47:40 +02:00
Pablo Curiel cc13552b08 OptionsTab: let borealis take care of hint mgmt. 2022-07-30 16:25:41 +02:00
Pablo Curiel 4d9cb8f19d Even (more) changes.
* TitlesTabItem: override playClickAnimation() to only play the animation when we really need it.

* Fix typos in the localization files.
2022-07-28 04:13:48 +02:00
Pablo Curiel eee1b2a771 More changes.
* Update libusbhsfs.

* Update borealis.

* nsp_dumper: force free size retrieval after dumping an NSP.

* title: add titleGetGameCardApplicationMetadataEntries().

* Makefile: remove -gdwarf-4 flag.

* nxdt_utils: treat NT_MAX_FILENAME_LENGTH as bytes instead of codepoints, add "TiB" to the array of supported size suffixes.

* GameCardTab: add ProcessGameCardStatus() and PopulateList(), manage list updates in the same fashion as TitlesTab, display message about how to mitigate launch errors after exiting the application, display available applications in the inserted gamecard, display message about how to perform individual operations on the gamecard titles.

* main: add a try/catch block to intercept any possible exceptions thrown while the application is running + use brls::Application::crash() to gracefully exit afterwards. Temporarily disable Applet Mode support.

* exception_handler: use LOG_LEVEL_ERROR.

* LayeredErrorFrame: add GetListFirstFocusableChild().
2022-07-28 00:53:52 +02:00
Pablo Curiel 2f85394117 Update libusbhsfs 2022-07-21 03:43:08 +02:00
Pablo Curiel b70da7e7bf nca: fix ctx init for NCAs with bogus Patch RomFS. 2022-07-14 14:10:03 +02:00
Pablo Curiel f5d418e0d3 Update libusbhsfs. 2022-07-14 12:28:40 +02:00
Pablo Curiel d6d277920b Adjust levels for some log messages. 2022-07-12 19:11:23 +02:00
Pablo Curiel 5cc83491c1 Use verbosity-level-based log macros everywhere.
Also, Result codes are now just printed using %X.
2022-07-12 18:34:49 +02:00
Pablo Curiel 9cb2a0440e Absolute bare minimum to get this to build.
Codebase still needs to be updated to properly use log levels, but at least it's building on all of them.
2022-07-12 05:27:30 +02:00
Pablo Curiel 5f59d0f444 Use nxdumptool's logger in borealis code.
Also updated submodules.
2022-07-12 03:31:39 +02:00
Pablo Curiel a9b5f7211c Some changes. Read full commit message.
* title: implemented titleGetNcmStorageIdName().

* nxdt_log: implemented log verbosity levels (debug, info, warning, error, none) and helper macros for each level. The rest of the codebase still needs to be updated to take advantange of this change.

* nxdt_log: implemented auxiliary logging via nxlink, if available.

* nxdt_utils: system CPU/MEM overclocking is now only applied through utilsSetLongRunningProcessState(), as it should have been from the beginning.

* nxdt_utils: nxlink initialization is now carried out without redirecting stdout and/or stderr, entirely removing the need for utilsRestoreConsoleOutput(). utilsGetNxLinkFileDescriptor() is used to send data to the nxlink host via dprintf() in log functions.
2022-07-12 02:27:03 +02:00
Pablo Curiel 243080f1a6 NSP dumper: re-enable AT option by default. 2022-07-10 19:45:18 +02:00
Pablo Curiel 1cd88b1cd4 bktr: handle compression in patches (part 3).
Updated bktrIsBlockWithinIndirectStorageRange().

Got confirmation that everything is now working as it should. Big thanks to BigKahuna.
2022-07-10 06:41:18 +02:00
Pablo Curiel df252d0d6e bktr: handle compression in patches (part 2).
Turns out, if we have a compression layer in patches, we can just ignore the one from the base NCA.

bktrIsBlockWithinIndirectStorageRange() still needs to be updated.
2022-07-09 18:10:55 +02:00
Pablo Curiel 59d0e0ba90 bktr: handle compression in patches (part 1).
Some parts of the code need to be still need to be slightly restructured.

bktrIsBlockWithinIndirectStorageRange() must be updated as well, too.
2022-07-09 14:56:44 +02:00
Pablo Curiel a1645e0c78 gamecard: remove attempt to fix HOS errors. 2022-07-07 13:21:27 +02:00
Pablo Curiel 2c5ff529ec Simplify bktrIsBlockWithinIndirectStorageRange().
Avoid pointer arithmetic and use a single do while loop.
2022-07-07 13:07:28 +02:00
Pablo Curiel 6bf314bcea romfs: implement romfsIsFileEntryUpdated().
Also modified romfsGetTotalDataSize() to add an 'only_updated' argument.
2022-07-07 02:30:45 +02:00
Pablo Curiel d8c0984115 romfs: slightly improve interface. 2022-07-06 11:57:31 +02:00
Pablo Curiel c910fe6c0a romfs: reintroduce support for missing base RomFS.
Also added a free space check and concatenation file creation to sd_romfs_dumper.
2022-07-05 06:01:07 +02:00
Pablo Curiel 942a407247 Codebase cleanup.
Remove legacy code and trailing whitespace from all files.
2022-07-05 03:04:28 +02:00
Pablo Curiel 91dc20b7f3 Fix some issues + update PoCs.
ncaStorageSetPatchOriginalSubStorage: allow Patch title version to be equal to the Base title version (e.g. sparse titles).

ncaStorageGetHashTargetExtents: actually set proper storage extents.

bktrGetTreeNodeEntryIndex: fix index lookup algorithm.

bktrStorageNodeFind: fix binary search.

bktrVisitorMoveNext / bktrVisitorMovePrevious: fix integer overflows.
2022-07-05 01:25:28 +02:00
Pablo Curiel de6eb1a7e8 romfs: add support for Patch RomFS.
Uses the new NCA storage interface.

Also implemented ncaStorageGetHashTargetExtents().
2022-07-04 14:30:48 +02:00
Pablo Curiel aad7af702f Fix some minor issues. 2022-07-04 02:20:51 +02:00
Pablo Curiel 8ac190686f romfs: use new NCA storage interface. 2022-07-04 02:01:12 +02:00
Pablo Curiel c2a8f025b3 pfs: use new NCA storage interface. 2022-07-04 01:36:01 +02:00
Pablo Curiel cc17c4a458 Implement layered NCA storage interface.
Updating PFS and RomFS comes next. Also fixed Sparse storages not being supported as an indirect storage's original substorage.
2022-07-04 00:14:03 +02:00
Pablo Curiel 010492c3ce Add missing compression layer checks. 2022-07-03 21:50:27 +02:00
Pablo Curiel f20ee66374 I was so excited I forgot to delete these lines. 2022-07-03 20:50:18 +02:00
Pablo Curiel b1fafa7d9f BKTR rewrite part 8: it's building! 2022-07-03 20:47:00 +02:00
Pablo Curiel 95b252b79d BKTR rewrite part 7: bktrReadCompressedStorage().
*Must* be tested.
2022-07-03 20:32:35 +02:00
Pablo Curiel 54046994a6 BKTR rewrite part 6: bktrReadAesCtrExStorage(). 2022-07-03 16:29:22 +02:00
Pablo Curiel ee9949179d God should I go get some sleep or what. 2022-07-03 12:27:26 +02:00
Pablo Curiel e85aace57c I'm dumb. 2022-07-03 12:09:26 +02:00
Pablo Curiel 7a8daf8ba5 BKTR rewrite part 5: finish bktrReadSubStorage(). 2022-07-03 12:05:30 +02:00
Pablo Curiel 19591d92c0 BKTR rewrite part 4: add set substorage methods.
bktrReadIndirectStorage() is now finished. bktrReadSubStorage() needs to be completed.
2022-07-03 10:35:25 +02:00
Pablo Curiel a427759dd1 BKTR rewrite part 3: finish BucketTreeVisitor.
Also fixed lots of storage table read bugs.

bktrReadIndirectStorage() is still incomplete -- check TODOs.
2022-07-03 00:37:13 +02:00
Pablo Curiel 7c38b6847d BKTR rewrite part 2: partially implement BucketTreeVisitor. 2022-07-02 16:07:08 +02:00
Pablo Curiel 29e5af2064 BKTR rewrite: part 1.
This is a mess. It won't build, so don't bother trying.
2022-07-02 12:09:49 +02:00
Pablo Curiel e372b97131 nca: parse CompressionInfo struct. 2022-06-30 23:04:54 +02:00
Pablo Curiel 8d81528619 Add support for sparse NCAs. 2022-06-30 18:46:45 +02:00
Pablo Curiel 8b0ed76011 Fix bugs + improve bktr interface.
* Check for sparse layers in nsp_dumper and xml_generator PoCs before attempting to initialize content-type-specific contexts.

* system_title_dumper now builds.

* gamecardCloseStorageArea() no longer returns prematurely on application exit.

* Fix section size for sparse sections in ncaInitializeFsSectionContext().

* Fix ncaFsSectionValidateHashDataBoundaries().

* Implement bktrInitializeIndirectStorage() and bktrInitializeAesCtrExStorage().
2022-06-29 14:41:58 +02:00