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

109 commits

Author SHA1 Message Date
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
b70da7e7bf nca: fix ctx init for NCAs with bogus Patch RomFS. 2022-07-14 14:10:03 +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
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
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
Pablo Curiel
4507af9e34 Add missing sparse layer checks to pfs/romfs. 2022-06-29 10:41:23 +02:00
Pablo Curiel
590495d012 bktr: added ID offset and title version checks. 2022-06-29 09:55:46 +02:00
Pablo Curiel
c1e3dc719f More NCA changes.
* Made ncaGenerateEncryptedFsSectionBlock() entirely private. There's no point in keeping it public.

* Moved NCA FS section context initialization into its own function, ncaInitializeFsSectionContext().

* Hash data boundaries are now checked while initializing each NCA FS section context, using ncaFsSectionValidateHashDataBoundaries(). Both ncaValidateHierarchicalSha256Offsets() and ncaValidateHierarchicalIntegrityOffsets() have been removed.

* Improved hash region access detection in _ncaReadFsSection() by implementing ncaFsSectionCheckHashRegionAccess().

* ncaGetFsSectionHashTargetProperties() is now used in pfs.c, romfs.c and bktr.c to retrieve the properties from the target hash layer.

* Updated sanity checks in pfsInitializeContext(), romfsInitializeContext() and bktrInitializeContext().
2022-06-29 08:55:35 +02:00
Pablo Curiel
ce4034852c Remove support for NPDM patching. 2022-06-26 03:34:31 +02:00
Pablo Curiel
f50071cf45 I swear to god I'm dumber than usual today. 2022-06-25 21:30:31 +02:00
Pablo Curiel
1bc1a05f96 Add SHA3 support. 2022-06-25 21:28:31 +02:00
Pablo Curiel
4b2cd46785 nca: fix bugs in plaintext hash layer reading.
SHA3-256 support is still missing.
2022-06-25 09:22:09 +02:00
Pablo Curiel
2c4ddac4c6 nca: skip hash layer crypto operations if needed.
ncaInitializeContext(), _ncaReadFsSection() and ncaGenerateHashDataPatch() were all updated to reflect this change.

SHA3-256 support is still missing.
2022-06-25 08:03:27 +02:00
Pablo Curiel
8ce253d13d More NCA changes. 2022-06-24 19:39:15 +02:00
Pablo Curiel
bd2bf2c8f4 Fix NCA context initialization for NCAs that hold a single sparse FS section. 2022-06-24 03:38:58 +02:00
Pablo Curiel
37b63aee60 More NCA parsing changes. 2022-06-24 02:22:01 +02:00
Pablo Curiel
b8992d1fdc Follow latest Switchbrew changes. 2022-04-18 23:59:25 +02:00
Pablo Curiel
215b677f02 keys: use __getline() to parse keys file.
* keysGetKeyAndValueFromFile() is now thread-safe -- may be useful for people reusing code from nxdumptool. The dynamic buffer allocated by __getline() must be freed by the caller. Furthermore, this fixes an out-of-bounds issue while writing data to the static array that was being used with fgets().
* Empty lines are now considered failures.
* keysGetKeyAndValueFromFile() now validates the value string and converts it to lowercase as well.
* Adjusted the example regex in the description for keysGetKeyAndValueFromFile() to accurately match what the function actually does.
* Added helper macros to keysReadKeysFromFile().
2022-04-18 23:38:18 +02:00
Pablo Curiel
77fa25e0e0 HOS 14.0.0 shenanigans. 2022-03-22 02:20:09 +01:00