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

449 commits

Author SHA1 Message Date
Pablo Curiel
89b211c146 nca: fix impl issues in ncaInitializeContextCommon()
Other changes include:

* cnmt, nca: handle NcmContentId elements in a more uniform way.

* gamecard: add some comments to the GameCardFlags enum.

* nxdt_log: make sure log messages are horizontally aligned.
2024-08-12 12:10:34 +02:00
Pablo Curiel
a06a511ce7 nca: add ncaInitializeContextByHashFileSystemEntry
Other changes include:

* nca: move common logic from ncaInitializeContext() into ncaInitializeContextCommon().
2024-08-11 20:15:45 +02:00
Pablo Curiel
5a40167a13 title: pre-generate gamecard filenames
Changes include:

* title: define a global string array for the pre-generated gamecard filenames.
* title: move gamecard filename generation logic into a new function, _titleGenerateGameCardFileName().
* title: update background gamecard thread logic to make it generate gamecard filenames on any status changes.
* title: update titleGenerateFileName() to make it return a duplicate of the gamecard filename requested by the caller.
2024-08-11 12:59:22 +02:00
Pablo Curiel
00497b5181 nso: update read logic
Changes include:

* mem: change all references to `Rodata` to `RoData`.

* nso: change all references to `Rodata` to `RoData`.
* nso: update `NsoModStart` struct.
* nso: rename `NsoModuleInfo` struct to `NsoModulePath`.
* nso: add `NsoRoDataStart` struct.
* nso: update logic in both nsoIsNnSdkVersionWithinSegment() and nsoGetNnSdkVersion() functions to work entirely with memory-based offsets.
* nso: rename nsoGetModuleInfoName() to nsoGetModulePath().
* nso: update logic in nsoInitializeContext() to always validate and use the NsoNnSdkVersion block offset from the NsoModStart block.
2024-08-08 12:27:54 +02:00
Pablo Curiel
414780ada8 Some updates
* fs_ext: rename `sel_t1_key` field in `FsCardId2` struct to `card_security_number`.
* fs_ext: add `FsCardId2CardSecurityNumber` enum.

* gamecard: add `GameCardUid` struct.
* gamecard: add `GameCardUidMakerCode` enum.
* gamecard: add `GameCardUidCardType` enum.
* gamecard: update `GameCardSpecificData` struct to reflect the other changes.

* lz4: update to v1.10.0.

* npdm: update `NpdmMetaFlags` struct.

* nso: rename `entry_point` field in `NsoModStart` struct to `version`.
* nso: add `NsoNnSdkVersion` struct.
* nso: update code to make it retrieve nnSdk version info from input NSOs whenever possible.

* GameCardImageDumpTask: fix gamecard image dumping with prepended key areas.
2024-08-06 22:57:54 +02:00
Pablo Curiel
d64c4de092 utils: report IsT flag at startup 2024-05-26 13:31:43 +02:00
Pablo Curiel
503ce4c1a7 gamecard: add proper validation of root HFS partition headers in Terra gamecards 2024-05-20 23:06:36 +02:00
Pablo Curiel
7d5b904835 gamecard: disable hash checks on Terra gamecards 2024-05-19 20:55:36 +02:00
Pablo Curiel
b0ce6fc618 LayeredErrorFrame: use focus stack references
Other changes include:

* Codebase: remove `_i18n` operators from strings used in brls::i18n::getStr() calls.

* GameCardStatusTask: rename first_notification -> skip_notification.
* GameCardStatusTask: fire event before displaying a notification.

* libs: update borealis fork.

* TitlesTab: store application metadata pointer array and size into local variables.
2024-05-10 12:18:57 +02:00
Pablo Curiel
d9c8d93180 TitleMetadataTask: use a struct instead of a vector
The struct has been typedef'd as TitleApplicationMetadataInfo. It holds the pointer to the array returned by titleGetApplicationMetadataEntries(), as well as the number of elements available in the array.

There's no point in populating a vector when we already have an array we can work with.
2024-05-06 00:41:41 +02:00
Pablo Curiel
5cc387c9b6 title: migrate application metadata filtering logic to background thread
titleGetApplicationMetadataEntries() and titleGetGameCardApplicationMetadataEntries() will now return dynamically allocated copies of internal pre-filtered / pre-processed arrays, which are generated using the background gamecard thread. This results in less overhead for any potential calls to these functions.

Other changes include:

* title: rename TitleGameCardApplicationMetadataEntry -> TitleGameCardApplicationMetadata.
* title: add `has_patch` field to TitleGameCardApplicationMetadata struct.
* title: declare internal TitleApplicationMetadata arrays to hold pre-filtered application metadata.
* title: declare internal TitleGameCardApplicationMetadata array to hold pre-processed gamecard application metadata.
* title: move filtering logic from titleGetApplicationMetadataEntries() to a new function: titleGenerateFilteredApplicationMetadataPointerArray().
* title: move processing logic from titleGetGameCardApplicationMetadataEntries() to a new function: titleGenerateGameCardApplicationMetadataArray().
* title: rename titleGetPatchVersionString() -> titleGetDisplayVersionString().
* title: add extra debug log messages to some functions.
* title: update titleFreeApplicationMetadata() to also free the new internal metadata arrays.
* title: update background thread logic in titleGameCardInfoThreadFunc() to also regenerate the pre-filtered application metadata and gamecard application metadata arrays right after a successful call to titleRefreshGameCardTitleInfo().
* title: update titleGetDisplayVersionString() to also support base application titles.
* title: simplify string generation logic in titleGenerateGameCardFileName() by using the cached gamecard application metadata array.

* GameCardStatusTask: add GetGameCardStatus() method.

* GameCardTab: fix callback argument type in class constructor.
* GameCardTab: update ProcessGameCardStatus() to block user inputs while processing the new gamecard status.

* RootView: add GetGameCardStatus() method.

* StatusInfoTask: turn IsInternetConnectionAvailable() into an inline method.

* TitleMetadataTask: turn GetApplicationMetadata() into an inline method.
* TitleMetadataTask: move debug log messages around.

* TitlesTab: update PopulateList() to block user inputs while updating the titles list.

* UmsTask: turn GetUmsDevices() into an inline method.

* UsbHostTask: turn GetUsbHostSpeed() into an inline method.
2024-05-05 21:42:32 +02:00
Pablo Curiel
6acdb38d11 FileWriter: remove call to ftruncate()
ftruncate() may severely delay the start of a dump process for certain UMS devices, and the write speed differences when using the SD card seem to be negligible.

Other changes include:

* FileWriter: add log messages throughout all class methods.

* log: update generic log macros to use __PRETTY_FUNCTION__ instead of __func__.
* log: add logFormatFunctionName() function, which takes an input __PRETTY_FUNCTION__ string and parses the info we need from it.
* log: update _logWriteFormattedStringToLogFile() and logWriteFormattedStringToBuffer() functions to reflect the other changes.
2024-05-03 15:14:32 +02:00
Pablo Curiel
7dc0f76224 Remove all references to NSWDB.
Other changes include:

* config: remove ConfigChecksumLookupMethod enum.
* config: remove "gamecard/checksum_lookup_method" integer field.
* config: add "gamecard/lookup_checksum" boolean field.
* config: update default configuration file.
* defines: remove all NSWDB macros.

* GameCardImageDumpTask: update class to reflect the changes made to the configuration interface.

* GameCardImageDumpOptionsFrame: update class to reflect the changes made to the configuration interface.

* OptionsTab: remove OptionsTabUpdateFileDialog class.
* OptionsTab: remove "Update NSWDB XML" element.

* i18n: update localization files to reflect the rest of the changes.
2024-05-02 15:38:39 +02:00
Pablo Curiel
21f16ef020 OptionsTab: reset cached output storage value while resetting settings.
Other changes include:

* workflow: try manually cloning the repository instead of using the checkout action.
2024-05-01 13:56:49 +02:00
Pablo Curiel
1ff3df4eca OptionsTab: add reset settings option.
Other changes include:

* gamecard: set GameCardStatus_Processing as the current gamecard status before calling gamecardLoadInfo().

* workflow: try to fix the missing commit tag issue.
2024-05-01 12:50:36 +02:00
Pablo Curiel
50deeeb41b Improve directory layout while we still can.
The directory layout is partially based on the C++ namespaces we're currently using.

Other changes include:

* devoptab: move directory into "core".

* fatfs: move directory into "core".

* GameCardTab: move portions of logic from PopulateList() into their own methods.
* GameCardTab: use a macro to generate the properties table.
* GameCardTab: use a macro to add ListItem elements.
* GameCardTab: update AddApplicationMetadataItems() method to also display the number of DLCs available in the inserted gamecard for each application whenever possible.

* Makefile: remove all extra entries from the INCLUDES variable.

* nxdt_includes: move HOS version structs into their own header file.

* tasks: move code for each individual task into its own file(s).

* title: update titleGetGameCardApplicationMetadataEntries() to also count the number of DLCs available in the inserted gamecard for any given base application.
* title: reorder gamecard application metadata entries by name before returning the buffer in titleGetGameCardApplicationMetadataEntries().
2024-04-30 23:01:42 +02:00
Pablo Curiel
3e10421ec9 Add DataTransferTaskFrame and GameCardImageDumpTaskFrame classes
DataTransferTaskFrame is a template class that's derived from brls::AppletFrame, which automatically starts a background task using an internal object belonging to a class derived from DataTransferTask. A DataTransferProgressDisplay view is used to show progress updates. If the background task hits an error, the class takes care of switching to an ErrorFrame view with the corresponding error message.

GameCardImageDumpTaskFrame is a derived class of DataTransferTaskFrame that uses a GameCardImageDumpTask object as its background task. In layman's terms, this provides a way to fully dump gamecard images using the new UI.

DataTransferTaskFrame depends on the newly added is_base_template helper from goneskiing to check if the class for the provided task is derived from DataTransferTask.

Other changes include:

* DataTransferProgressDisplay: rename setProgress() method to SetProgress().

* DataTransferTask: move post-task-execution code into its own new private method, PostExecutionCallback(), and update both OnCancelled() and OnPostExecute() callbacks to invoke it.
* DataTransferTask: update OnProgressUpdate() to allow sending a last progress update to all event subscribers even if the background task was cancelled.
* DataTransferTask: update OnProgressUpdate() to allow sending a first progress update if no data has been transferred but the total transfer size is already known.
* DataTransferTask: update OnProgressUpdate() to avoid calculating the ETA if the speed isn't greater than 0.

* DumpOptionsFrame: remove UpdateOutputStorages() method.
* DumpOptionsFrame: update class to use the cached output storage value from our RootView.
* DumpOptionsFrame: add GenerateOutputStoragesVector() method, which is used to avoid setting dummy options while initializing the output storages SelectListItem.
* DumpOptionsFrame: update UMS task callback to add the rest of the leftover logic from UpdateOutputStorages().
* DumpOptionsFrame: update RegisterButtonListener() to use a wrapper callback around the user-provided callback to check if the USB host was selected as the output storage but no USB host connection is available.

* ErrorFrame: use const references for all input string arguments.

* FileWriter: fix a localization stirng name typo.
* FileWriter: fix an exception that was previously being thrown by a fmt::format() call because of a wrong format specifier.

* FocusableItem: add a static assert to check if the provided ViewType is derived from brls::View.

* gamecard: redefine global gamecard status variable as an atomic unsigned 8-bit integer, which fixes a "status-hopping" issue previously experienced by repeating tasks running under other threads that periodically call gamecardGetStatus().

* GameCardImageDumpOptionsFrame: define GAMECARD_TOGGLE_ITEM macro, which is used to initialize all ToggleListItem elements from the view.
* GameCardImageDumpOptionsFrame: update button callback to push a GameCardImageDumpTaskFrame view onto the borealis stack.

* GameCardImageDumpTask: move class into its own header and module files.
* GameCardImageDumpTask: update class to also take in the checksum lookup method (not yet implemented).
* GameCardImageDumpTask: update class to send its first progress update as soon as the gamecard image size is known.
* GameCardImageDumpTask: update class to avoid returning a string if the task was cancelled -- DataTransferTaskFrame offers logic to display the appropiate cancel message on its own.

* GameCardTab: update PopulateList() method to display the new version information available in TitleGameCardApplicationMetadataEntry elements as part of the generated TitlesTabItem objects.

* i18n: add new localization strings.

* OptionsTab: update background task callback logic to handle task cancellation, reflecting the changes made to DataTransferTask.
* OptionsTab: reflect changes made to DataTransferProgressDisplay.

* RootView: cache the currently selected output storage value at all times, which is propagated throughout different parts of the UI. Getter and setter helpers have been added to operate with this value.
* RootView: add GetUsbHostSpeed() helper, which can be used by child views to retrieve the USB host speed on demand.
* RootView: update UMS task callback to automatically reset the cached output storage value back to the SD card if a UMS device was previously selected.

* title: define TitleGameCardApplicationMetadataEntry struct, which also holds version-specific information retrieved from the gamecard titles.
* title: refactor titleGetGameCardApplicationMetadataEntries() to return a dynamically allocated array of TitleGameCardApplicationMetadataEntry elements.

* usb: redefine global endpoint max packet size variable as an atomic unsigned 16-bit integer, which fixes a "status-hopping" issue previously experienced by repeating tasks running under other threads that periodically call usbIsReady().

* UsbHostTask: add GetUsbHostSpeed() method.
2024-04-29 15:26:12 +02:00
Pablo Curiel
32c097c055 [ci skip] Add GameCardImageDumpTask and FileWriter classes
GameCardImageDumpTask is a derived class of DataTransferTask, and it's designed to dump a gamecard image using the options selected by the user (which must be passed from a GameCardImageDumpOptionsFrame object). It uses std::optional<std::string> as its return type -- the idea behind this is to return error strings that may later be displayed by an ErrorFrame during the dump process (views not yet implemented).

FileWriter is a class that encapsulates write operations to different storage mediums (SD card, USB host and UMS devices), based on the provided input path. It is used by GameCardImageDumpTask to painlessly write data to the right output storage without explicitly having to implement multiple code paths for all storage types as part of the actual dump code. Furthermore, FileWriter also supports writing split files to FAT-formatted UMS devices if an output file is >= 4 GiB -- part file handling is completely abstracted away from any callers.

Other changes include:

* AsyncTask: rename all class methods to use PascalCase naming.
* AsyncTask: rename get() -> GetResult().

* DataTransferTask: reflect the changes made to AsyncTask.
* DataTransferTask: pause the RepeatingTask right after LoopCallback() returns true instead of pausing it in the cancel/post-execute callbacks.
* DataTransferTask: add private FormatTimeString() method.
* DataTransferTask: remove superfluous override for DoInBackground() -- classes derived from DataTransferTask must provide it on their own, anyway.
* DataTransferTask: add public GetDurationString() method.

* defines: update FAT32_FILESIZE_LIMIT macro to use UINT32_MAX.
* defines: add CONCATENATION_FILE_PART_SIZE macro (used by the new FileWriter class).

* DownloadTask: reflect the changes made to AsyncTask.

* DumpOptionsFrame: file extension is no longer stored as a class member, nor required by the class constructor.
* DumpOptionsFrame: change the return type for GetOutputFilePath() to bool. The method now saves its output to a variable passed by reference.

* GameCardImageDumpOptionsFrame: reflect the changes made to DumpOptionsFrame.

* i18n: update localization strings where applicable.

* nxdt_utils: fix a potential buffer overflow in utilsGetFileSystemStatsByPath().

* OptionsTab: reflect the changes made to AsyncTask.

* usb: add const qualifier to the input buffer required by usbSendFileData().
* usb: add const qualifier to the input buffer required by usbSendNspHeader().
2024-04-25 01:49:04 +02:00
Pablo Curiel
56053e8105 gamecard: add smarter delay to detection thread
Lets us respond in a better way to sudden gamecard status changes during the 3 second wait period.
2024-04-21 13:27:06 +02:00
Pablo Curiel
ec993864fd [ci skip] GameCardImageDumpOptionsFrame: add gamecard task subscription
Lets us pop the frame itself from the view stack as soon as the gamecard is ejected. We're all about making this as fool-proof as possible.
2024-04-21 13:05:55 +02:00
Pablo Curiel
1181a95d17 [ci skip] DumpOptionsFrame: add GetOutputFilePath method
Other changes include:

* DumpOptionsFrame: update contructors to also take a base output path string.

* GameCardImageDumpOptionsFrame: simplify constructor by letting it take care of retrieving the title on its own.

* nxdt_utils: remove utilsCreateOutputDirectories() function -- we'll be using utilsCreateDirectoryTree() anyway, so it's okay.
2024-04-20 23:52:56 +02:00
Pablo Curiel
17ec42d812 [ci skip] Add GameCardImageDumpOptionsFrame class
This commit turns DumpOptionsFrame into a non-polymorphic, non-instantiable class with an overloaded constructor, and moves most of the generic logic from its header file into a proper C++ module.

GameCardImageDumpOptionsFrame is an inherited class of DumpOptionsFrame, which adds the extra option items it needs on its own.
2024-04-20 00:42:11 +02:00
Pablo Curiel
4af144486a gamecard: add support for Header2-related areas
These changes include:

* gamecard: add GAMECARD_HEADER2_OFFSET and GAMECARD_HEADER2_CERT_OFFSET macros.
* gamecard: rename GAMECARD_CERTIFICATE_OFFSET macro to GAMECARD_CERT_OFFSET.
* gamecard: add GameCardFlags2 enum.
* gamecard: update GameCardHeader struct to reflect the new Flags2 field.
* gamecard: add GameCardHeader2, GameCardHeader2EncryptedData and GameCardHeader2Certificate structs.
* gamecard: update gamecardReadHeader() to check if the `Has10Certificate` flag is set in the gamecard header. If it is, the function will read and log both Header2 and Header2Certificate areas, and it will also attempt to verify the RSA signature from the Header2 area.
* gamecard: if a Header2 area is detected, an error will always be triggered for the time being. If anyone comes across this error, please get in touch me.

* gamecard, fs_ext: fix signature field comments.
2024-04-19 15:58:16 +02:00
Pablo Curiel
6dfbb301df [ci skip] Remove void keyword from C++ ctors/dtors 2024-04-19 12:08:44 +02:00
Pablo Curiel
de71768380 [ci skip] Improve UI element spacing 2024-04-18 22:20:45 +02:00
Pablo Curiel
17e0edb61c [ci skip] OptionsTab: add option to unmount UMS devices
Uses a SelectListItem element with displayValue set to false to avoid displaying a value string. Furthermore, the default click event callback is replaced to check if any UMS devices are mounted before attempting to display the dropdown menu.

Other changes include:

* UmsTask: define UmsDeviceVectorEntry.
* UmsTask: redefine UmsDeviceVector as a UmsDeviceVectorEntry vector.
* UmsTask: migrate UMS device string generation logic from DumpOptionsFrame::UpdateStorages() to UmsTask::PopulateUmsDeviceVector().

* DumpOptionsFrame: simplify UpdateStorages() to reflect the changes made to UmsTask.
2024-04-18 21:58:47 +02:00
Pablo Curiel
7d7f2d58a8 [ci skip] UI code quality improvements
* Always use value references for periodic Borealis tasks.
* Always use nullptr instead of NULL in C++ headers and modules (except when dealing with functions with C name mangling).
* Update StatusInfoData to use a char array for the IP address instead of directly using the pointer returned by inet_ntoa().
2024-04-18 10:46:29 +02:00
Pablo Curiel
27465434d4 [ci skip] GamecardTab: fix transition to DumpOptionsFrame view 2024-04-15 13:47:50 +02:00
Pablo Curiel
9525f37e51 [ci skip] Add DataTransfer* classes.
Adds the DataTransferTask and DataTransferProgressDisplay classes, which use repurposed logic from the DownloadTask and EtaProgressDisplay classes, respectively. The EtaProgressDisplay class and EtaProgressInfo struct have been removed.

Other changes include:

* DownloadTask: heavily simplified logic by using DataTransferTask as the base class.

* DumpOptionsFrame: implement some additional/experimental changes.

* OptionsTab: update logic to use the new DataTransferProgressDisplay class.
2024-04-15 01:53:43 +02:00
Pablo Curiel
8f8fc6af37 [ci skip] Add EtaProgressDisplay class.
Also adds a nxdt::views::EtaProgressInfo struct that's used by EtaProgressDisplay's setProgress() method. It may also be used by child classes of AsyncTask.

Other changes include:

* DownloadTask: remove DownloadTaskProgress struct, update logic to use the new nxdt::views::EtaProgressInfo struct.

* DumpOptionsFrame, GameCardTab: minor formatting fixes.

* OptionsTab: remove OptionsTabUpdateProgress class, update logic to use the new nxdt::views::EtaProgressInfo struct.
2024-04-12 23:08:54 +02:00
Pablo Curiel
789a6d6eb8 [skip ci] GameCardTab: reflect current gamecard dump options
Other changes include:

* gamecard: rename gamecardGetDecryptedCardInfoArea() -> gamecardGetPlaintextCardInfoArea().

* FocusableItem, FocusableTable: add positional arguments for the FocusableItem class constructor.
2024-04-12 13:40:50 +02:00
Pablo Curiel
fc5226bfce [skip ci] Update copyright year. 2024-04-12 11:49:03 +02:00
Pablo Curiel
5e333bb92e keys: make latest mkey non-mandatory for older FWs 2024-04-09 02:05:44 +02:00
Pablo Curiel
a5e72a45e0 bktr: minor code cleanup
Removes all references to Compressed storages being used as substorages for Indirect storages.

I should have taken care of this in 0f1055c84e, but I guess I just forgot.
2024-04-06 04:41:47 +02:00
Pablo Curiel
54c5677cd0 QoL changes
* codebase: remove all references to Lockpick / Lockpick_RCM.

* keys: retrieve Atmosphère's key generation in keysLoadKeyset().
* keys: replace all "key_gen_val" references with "mkey_index".
* keys: move latest master key checks in keysReadKeysFromFile() to keysDeriveMasterKeys().
* keys: update latest master key checks to determine if nxdumptool's hardcoded master key vectors are outdated, using the key generation value from Atmosphère. If the master key vectors are outdated, and the newer master key(s) are not available, an error will be displayed.

* nxdt_utils: update logic in utilsReplaceIllegalCharacters() to replace consecutive illegal characters with a single underscore.
* nxdt_utils: move servicesGetExosphereApiVersion() to nxdt_utils as utilsGetExosphereApiVersion().
* nxdt_utils: define internal UtilsExosphereApiVersion struct, which is used to parse the output from utilsGetExosphereApiVersion().
* nxdt_utils: add utilsGetAtmosphereVersion(), utilsGetAtmosphereKeyGeneration() and utilsGetAtmosphereTargetFirmware() functions.

* services: remove servicesGetExosphereApiVersion().
* services: Atmosphère version is now retrieved via utilsGetAtmosphereVersion().
2024-04-05 23:25:32 +02:00
Pablo Curiel
e3cd2a15eb title: updated hardcoded titles list 2024-03-31 15:04:14 +02:00
Pablo Curiel
9e75a019a9 keys/nca: add new keydata for HOS 18.0.0. 2024-03-31 12:16:37 +02:00
Pablo Curiel
c5d6081f08 Fix building with latest libnx commit. 2024-02-16 23:57:08 +01:00
Pablo Curiel
7b707509c7 bktr: perform binary search in bktrGetTreeNodeEntryIndex()
Other changes include:

* poc: fix switching to a different title entry via L/R/ZL/ZR if the content counts don't match. Fixes issues with MGS Master Collection games.
2024-02-16 23:31:24 +01:00
Pablo Curiel
5ffe06508e log: make logGetLastMessage() return a heap buffer 2024-01-20 23:12:55 +01:00
Pablo Curiel
38ff475d9e title: handle NACPs with empty language entries.
Leftover ns application records for factory software yield NACP structs with no identifying strings.

I wasn't expecting this to be a thing.
2024-01-13 21:25:02 +01:00
Pablo Curiel
62c15ca7cf poc: add browser for gamecard HFS partitions
Just in time for New Year's Eve.

Other changes include:

* title: use snprintf() in filename generation functions + reduce array sizes.
2023-12-31 18:16:49 +01:00
Pablo Curiel
c585e8f9d3 poc: add file browser for NCA FS sections.
Takes advantage of the recently implemented devoptab interfaces. Supports individual file dumping and multiple file/dir dumping via highlighting. May possibly need some additional testing. The code could potentially be improved, but I'll look into it at a later time -- I just want to release this now.

Other changes include:

* devoptab: comment out log messages.

* utils: add utilsGetDirectorySize() function.
2023-12-26 01:25:29 +01:00
Pablo Curiel
364b3f39dc romfs: use hash buckets for FS entry lookups.
* romfs: add hash bucket fields to RomFileSystemContext struct.
* romfs: remove current offset fields from RomFileSystemContext struct and all functions that relied on them.
* romfs: add romfsCalculateEntryHash().
* romfs: update romfsInitializeContext() to also load file/directory hash buckets.
* romfs: update romfsGetTotalDataSize() to make up for the removed functions.
* romfs: update romfsGetChild*EntryByName() functions to use hash bucket lookups.

Other changes include:

* devoptab: add missing exit macros to some FS operations across all interfaces.

* poc: update extractedRomFsReadThreadFunc() to make up for the removed RomFS functions.
2023-12-22 12:20:27 +01:00
Pablo Curiel
ef03aa4cbe Custom devoptab wrappers (part 5).
This commit implements a devoptab wrapper for RomFS sections within NCAs, using code from romfs.c/h.

Other changes include:

* devoptab: add additional safety checks and some minor tweaks to both hfs_dev and pfs_dev calls.
2023-12-21 16:51:26 +01:00
Pablo Curiel
091747d197 Custom devoptab wrappers (part 4).
Improve dirnext() calls in both PFS and HFS devoptab wrappers to make them also return bogus "." and ".." directory entries.

The "st_ino" field is now also being filled for all file entries.

Other changes include:

* libs: update libusbhsfs.
2023-12-21 13:29:53 +01:00
Pablo Curiel
e6caff3b17 Custom devoptab wrappers (part 3).
Add some minor tweaks to the devoptab macros.
2023-12-21 02:20:37 +01:00
Pablo Curiel
c392a9f126 Custom devoptab wrappers (part 2).
This commit implements a devoptab wrapper for Hash FS sections within gamecard images, using code from hfs.c/h.

Other changes include:

* poc: disable buffering on FILE objects via setvbuf().
* gamecard: fix crash in gamecardInitializeHashFileSystemContext() while calculating the size for the root Hash FS partition.
2023-12-21 00:39:56 +01:00
Pablo Curiel
d402776032 Custom devoptab wrappers (part 1).
This commit implements a devoptab wrapper for Partition FS sections within NCAs, using code from pfs.c/h.

Other changes include:

* codebase: use NX_IGNORE_ARG macro where needed.

* hfs: slight tweaks to some of the static functions.

* pfs: slight tweaks to some of the static functions.
* pfs: use pfsIsValidContext() where needed.

* utils: update utilsInitializeResources() to use __system_argc and __system_argv variables from libnx.

* todo: update text file.
2023-12-20 20:32:48 +01:00
Pablo Curiel
bfdd9e056e poc: enable update option on ExeFS sections. 2023-12-17 19:03:08 +01:00