Commit Graph

31 Commits

Author SHA1 Message Date
Pablo Curiel fc5226bfce [skip ci] Update copyright year. 2024-04-12 11:49:03 +02:00
Pablo Curiel 643847be39 host: drop Nuitka's "--onefile" arg
Fixes false-positive AV warnings.
2024-01-20 23:11:21 +01:00
Pablo Curiel bfdd9e056e poc: enable update option on ExeFS sections. 2023-12-17 19:03:08 +01:00
Pablo Curiel bd1b56e5c2 host: switch to Nuitka-based EXE building.
Other changes include:

* host: rename windows_install_deps.py -> install_deps.py and update it to support multiple operating systems.
* host: restore assertions and fix most static analysis errors related to type aliases and checks.
* host: catch exceptions thrown by usb.core.find() in usbGetDeviceEndpoints().
* host: move code to unconditionally enable 32-bit paths under Windows to uiStartServer() and cliInitialize(), respectively.
* host: remove incomplete file if the ongoing transfer was cancelled and we're not dealing with a NSP file.
2023-11-26 22:10:42 +01:00
bilditup1 300c650b8f
Support for >260 char filenames on Windows (#146)
Co-authored-by: bilditup1 <git@github.com>
2023-11-23 22:33:13 +01:00
Pablo Curiel 9272978039 host: be a little more explicit about new cmds 2023-11-12 11:53:03 +01:00
Pablo Curiel 315a052ddf usb: bump ABI version. 2023-11-11 21:50:02 +01:00
Pablo Curiel dcd1f66790 usb: add extra cmds for extracted FS handling
Implements both `StartExtractedFsDump` and `EndExtractedFsDump` commands into both nxdumptool and the Python host script.

Other changes include:

* poc: wake the write thread up if a preprocessing error occurs in all extracted FS dump functions. Fixes previously unhandled hangups.
* poc: verify current NCA hash before sending its last data chunk while dumping a NSP.

* host: update command handler to support CancelFileTransfer commands issued in-between SendFileProperties commands.
* host: update Markdown document.

* usb: use UsbCommandType_Count for the safety check in usbPrepareCommandHeader().
* usb: log both USB command header and command block whenever an error is reported by the host side.
2023-11-11 21:39:41 +01:00
Pablo Curiel 95b603142a host: update Markdown document. 2023-11-11 12:19:27 +01:00
Pablo Curiel 32bb5fd46e nxdt_utils: add more helpers.
Implement utilsParseHexString() and utilsAppletLoopDelay().

Other changes include:

* defines: add THIRTY_FPS_DELAY define.
* defines: remove unused CERT_PATH define.

* gamecard: restore original reserved_2 field in GameCardInfo struct. The last 16 bytes weren't being properly due to an issue within libnx's AES-CBC implementation.
* gamecard: rename GAMECARD_ACCESS_WAIT_TIME -> GAMECARD_ACCESS_DELAY.

* host: improve ABI documentation (thanks @v1993).

* keys: remove keysConvertHexDigitToBinary().
* keys: change keysParseHexKey() function signature + update it to use utilsParseHexString() instead.

* nso: change "NRO" to "NSO" in some misleading log error messages (thanks @liamadvance).

* nxdt_rw_poc: replace svcSleepThread() calls with utilsAppletLoopDelay().

* nxdt_utils: rename utilsGenerateHexStringFromData() -> utilsGenerateHexString().
* nxdt_utils: add static utilsConvertHexDigitToBinary() function, used by utilsParseHexString().
* nxdt_utils: update utilsAppendFormattedStringToBuffer() to avoid logging an error string if resources haven't been initialized.
* nxdt_utils: use a single call to sprintf() with a variable precision argument in utilsGenerateFormattedSizeString().
* nxdt_utils: call utilsAppletLoopDelay() in the while loop from utilsPrintConsoleError().
* nxdt_utils: remove unused utilsCloseFileDescriptor() function.

* tik: log input rights ID at the start of tikRetrieveTicketByRightsId().
2023-10-23 00:44:40 +02:00
Andy Dirnberger bbe11be667
Support host script on Python 3.9 (#141)
The host script can’t run on Python 3.9 because of [PEP 604][pep]-style annotations. Adding a future import can fix this. The `print_function` import is being removed since it is unnecessary on all releases of Python 3.

[pep]: https://peps.python.org/pep-0604/
2023-10-19 23:56:38 +02:00
Pablo Curiel af0db8b0ee host: fix exception message dup under CLI mode. 2023-06-04 20:58:46 +02:00
Pablo Curiel 0e17edace1 host: improve Windows EXE build generation
A virtual environment is now created and used to generate the EXE build, which helps to keep its size down to ~10 MiB.
2023-06-04 20:45:17 +02:00
Pablo Curiel 158d7c1e92 host: add verbose output toggle
Provided as a checkbox in the GUI and a command line argument in the CLI.

Exception information is now also printed to the GUI textbox if the verbose output checkbox is enabled.
2023-06-03 17:27:24 +02:00
Pablo Curiel fb58d20fe3 I'm a terrible person and an even worse developer.
And I don't need anyone to tell me so, thank you very much.

* PoC: remove gc_dumper and nsp_dumper PoC; create nxdt_rw_poc with all gc_dumper and nsp_dumper capabilities + standalone ticket dumping + raw NCA dumping; use ftruncate() to set output file sizes whenever possible. PoC code is a mess, as always. Expect the features from the rest of the PoCs to be implemented into nxdt_rw_poc soon.

* workflow: temporarily disable borealis build generation; comment out manual installation of up-to-date packages from Leseratte's mirrors because the latest devkitA64 Docker image has them all.

* borealis: update to fix building issues with latest devkitA64.

* bfttf: error out on invalid NCA signatures.

* config: save configuration to the current working directory; parse and validate new "gamecard/write_raw_hfs_partition" flag.

* defines: remove CONFIG_PATH macro; rename CONFIG_FILE_NAME.

* gamecard: rename fs_ctx -> hfs_ctx everywhere; use HFS function calls to retrieve partition names.

* hfs: move GameCardHashFileSystemPartitionType enum from gamecard.h and rename it to HashFileSystemPartitionType; add hfsIsValidContext(); add hfsGetPartitionNameString().

* nca/npdm: update comments to reflect latest HOS version.

* nxdt_bfsar: always generate absolute SD card paths with the device name; error out on an invalid NCA signature.

* nxdt_includes: include dirent.h; refactor Version struct to make it a union of all known *Version structs.

* nxdt_log: don't write session separator if the logfile is empty.

* nxdt_utils: log appletIsGamePlayRecordingSupported() errors; add utilsDeleteDirectoryRecursively().

* rsa: provide clearer function descriptions in header file.

* services: handle usb:ds initialization.

* tik: update tikConvertPersonalizedTicketToCommonTicket() to allow NULL input pointers as raw certificate chain arguments (much needed for standalone ticket dumping).

* title: add titleGetApplicationIdByMetaKey().

* usb: refactor interface (de)initialization code; slightly improve ABI usage (console-side only); redefine ABI version field in StartSession command blocks; upgrade ABI to v1.1.

* FatFs: rename DIR -> FDIR to avoid conflicts with definitions from stdlib's dirent.h.

* gamecard_tab: display package ID from the inserted gamecard; fix displayed version numbers from bundled system updates below 3.0.0.

* todo: add notes about creating devoptab devices for HFS/PFS/RomFS file tree dumping.
2023-05-24 21:05:34 +02:00
Pablo Curiel 9a4b8b573d Update copyright year 2023-04-08 13:42:22 +02:00
Pablo Curiel 942a407247 Codebase cleanup.
Remove legacy code and trailing whitespace from all files.
2022-07-05 03:04:28 +02:00
enderghast13 4a512db93c
nxdt_host.py: update license (#108) 2022-03-31 04:37:23 +02:00
Pablo Curiel 2fa61dc228 Update copyright year. 2022-03-17 13:58:40 +01:00
Pablo Curiel 278cb5c72a Some changes.
* nxdt_includes: renamed VersionType1 to Version and tweaked it to add the application_version struct, renamed VersionType2 to SdkAddOnVersion.

* gc_dumper: use utilsGeneratePath() to truncate generated filenames to safe filesystem limits. Thanks to n0tw0rk for reporting the issue and testing the changes!

* nxdt_host.py: fixed a string formatting issue that made it impossible to unpack data from the SendFileProperties command block under certain circumstances.

* gamecard: modified GameCardKeySource to add a value field, added GameCardFlags_HasCa10Certificate flag.

* utils: utilsGeneratePath() no longer adds a dot on its own if it's not part of the provided extension string.
2022-03-17 13:37:24 +01:00
Pablo Curiel fea5f8803d gc_dumper: generate text file with dump info. 2022-02-06 03:30:42 +01:00
Pablo Curiel ffd2d8f8a4 nxdt_host.py: small fixes. 2021-12-01 13:18:31 +01:00
Pablo Curiel eb97ae3de5 Implement DownloadTask, DownloadFileTask and DownloadDataTask classes.
Other changes include:

* AsyncTask: use a recursive mutex instead of atomics. Fixes build issues related to non-trivially-copyable elements.
* http: remove CURLOPT_ACCEPT_ENCODING option in httpPerformGetRequest().
2021-07-27 11:00:09 -04:00
Pablo Curiel a1ba535d3b Update requirements. 2021-07-15 12:19:03 -04:00
Pablo Curiel 119b5c8a90 nxdt_host.py: fix SendFileProperties messages not being displayed. 2021-06-05 19:04:42 -04:00
Pablo Curiel 5bb5f0c858 nxdt_host.py: add CLI mode. 2021-06-03 20:19:19 -04:00
Pablo Curiel 4c0c7d2c56 Small code refactor.
* Refactored keydata handling.

* Sealed NCA KAEKs are now generated at startup, and NCA key area entries are now decrypted by keysDecryptNcaKeyAreaEntry(), reducing the number of calls to spl functions.

* The eTicket RSA device key is now retrieved and decrypted at startup. RSA-OAEP wrapped titlekeys are now decrypted by keysDecryptRsaOaepWrappedTitleKey().

* Renamed titlekek -> ticket common key throughout the codebase.

* Added NcaKeyAreaEncryptionKeyIndex_Count and NcaKeyGeneration_Max enum values to nca.h.

* Proper usage of strcasecmp() in some functions.

* Moved syscall hint checks from keys.c to mem.c.

* Define illegal FS characters as an array rather than a char pointer.

* Services are now initialized before the CFW type checks.

* Fixed pcv/clkrst service initialization.

* Implemented additional thread safety and logfile output to service functions.

* Slightly tweaked running service checks.

* Added proper Markdown documentation for the USB ABI.
2021-05-11 02:00:33 -04:00
Pablo Curiel ae3b7266a0 Fix NACP bitflag checks. 2021-03-20 03:13:16 -04:00
Pablo Curiel ecefbe6163 Use latest PyInstaller instead of cx_Freeze to generate a standalone Windows EXE. 2021-03-20 00:47:57 -04:00
Pablo Curiel 2bc9bae11b Small icon correction.
Looks a bit better now. Mad Paint skillz.
2021-03-19 22:36:04 -04:00
Pablo Curiel a016ba92db More host script changes.
* Added text files with required module information, which can be used with pip.

* Added a batch file to build a ZIP archive with a standalone copy of the script, which can be used to run it under Windows systems without Python.

* Further tweaked the way the progress bar window works.

* Debug messages are no longer printed to the log.

* Rearranged some parts of the code.
2021-03-19 21:59:53 -04:00