JTegraNX Switch

From GameBrew
JTegraNX
Jtegranx.png
General
Authordylwedma11748
TypePayload Senders (Software)
Version1.6.9-R2
LicenseGPL-2.0
Last Updated2022/04/14
Links
Download
Website
Source

Another RCM payload injector written in Java and C++.

To run this program, you need Java 8 or higher installed on your computer. You can download Java here.

JTegraNX is supported on Windows, Linux, and Mac OS X.

Features

  • RCM payload injection.
  • Auto-injection.
  • RCM status indicator with transparent images.
  • Config system (similar to favorites in TegraRcmGUI).
  • Bundled payloads.
  • Tray icon with functionality.
  • SD card preparation.
  • APX driver detection/installation.
  • Portable mode.
  • Command line mode.
  • GPT restoration.

User guide

Normal mode:

  • Launch JTegraNX.jar normally to use the UI mode. Then select a payload and inject or use the other features if needed.

Command line mode:

  • Launch JTegraNX.jar from the command line like this:
    • java -jar JTegraNX.jar -cml

Linux support

Linux support has been added in v1.6.6, to use JTegraNX on Linux some preperation may be required.

  • JTegraNX on Linux must either be run as root or with udev rules configured. To configure your udev rules, follow this guide.
  • Payload injection on Linux requires the RCM device connecting to a port handled by xhci_hcd or a port with a patched EHCI driver.
    • My way of getting past this was creating an Ubuntu 21.04 VM in VMware with USB 3.1 enabled.

Mac OS X support

Mac OS X support has been added in v1.6.7, some things to take note on though.

  • If you try to use the browse payload function or prepare SD card function and it fails, open JTegraNX using the terminal and check for errors. If you recieve this error or something similar to it:
    • java[2748:110752] +[NSXPCSharedListener endpointForReply:withListenerName:]: an error occurred while attempting to obtain endpoint for listener 'com.apple.view-bridge': Connection interrupted
    • This error occurs when trying to open the FileChooser or DirectoryChooser. Similar issues have been reported by users of OBS Studio on Mac OS X. It is possible that running Catalina in a virtual machine could be a contributing factor (unsure).
  • When a notification gets sent to the tray, it doesn't show JTegraNX's icon.

JTegraNX on Mac OS X doesn't require any prior set up and should work out of the box. No drivers, no patches, nothing. Just download and go.

Command line mode

Command line mode is a new feature added in v1.6.7. This mode has most of JTegraNX's functionality stuffed into the command line.

  • To access command line mode, run JTegraNX.jar like this:
    • java -jar JTegraNX.jar -cml

These features are not usable in command line mode:

  • Device listeners (JTegraNX's inject function already checks for the device anyway).
    • Becuase of this, Auto-inject won't work either.
  • Changing configuration mode from standard to portable or vice versa.
  • Browsing for payloads using a dialog (it is a command line).
  • Restarting JTegraNX after an update.
    • This is due to how the restart function works.
      • It gets the running JAR file's path and executes it using Runime.getRuntime().exec(). In theory, it is possible tp launch command line mode in Runtime but it would then need to simultaneously have the Input, Output, and maybe even Error streams being monitored and used, but doing that while running a JVM inside a JVM would be very tedious.
  • Config system (Other than setting updates or bundled payloads).
  • Tray icon (again, it's a command line).

Using configs

The config system allows you to save what you entered in the "Payload Path" field and load it again in another session.

  • Loading a saved config - Simply click on "Load Config" to reveal the config list, then select the config you wish to use.
  • Saving a config - Simply click on "Save Config", input a name for the config, and hit enter.

Custom Settings

You can now customize JTegraNX's settings to your liking.

  • You can now toggle auto-checking for JTegraNX updates.
  • You can now toggle auto-checking for payload updates.
  • You can now choose which payloads you want to include with JTegraNX.
  • You can now toggle the tray icon being enabled or disabled.

SD Card preparation

This new feature with JTegraNX will download all the basic requirements for getting your Switch ready for CFW and copy them to the specified output path.

GPT restoration

This new feature added in v1.6.9 will inject gptrestore, which is now bundled with JTegraNX as a standard tool instead of a bundled payload.

APX driver detection/installation

JTegraNX can detect if the APX driver is missing or incorrect, and if this is the case, you have the option to install it from there.

Portable mode

JTegraNX's old behavior for handling data files has been re-implemented as a secondary option.

Portable mode make it to where the "Payloads" directory and the main config file are created in the working directory of where the JAR is executed. You can switch between standard and portable mode using the Settings menu.

Bundled Payloads

For any bundled payloads, JTegraNX will download them automatically, place them in the "Payloads" directory, and optionally check for updates on them each time the program is launched. If updates are enabled and an update for a payload is found, it will be taken care of.

Currently bundled payloads:

Screenshots

jtegranx3.png

Media

JTegraNX Demo and Showcase (7thousandnumbers)

Changelog

v1.6.9-R2 2022/04/13

  • Added offline mode.
  • Renamed fusee-primary to fusee.
  • Replaced GitHandler with kohsuke/github-api.
  • Added a preloader so that JTegraNX doesn't hang while preparing.
  • Updated the SDPrepare tool and replaced Checkpoint with JKSV.

v1.6.9-R1 2021/07/17

  • Fixed bug that caused JTegraNX launch to fail if it failed to extract gptrestore. #4
    • Issue will be closed once @gmonteir confirms that this fixed his problem.
  • Fixed potential Zip-Slip vulnerability with the ZipHandler.
    • There probably wasn't even an issue, GitHub's code scanner warned me about it so I decided to fix it.

v1.6.9 2021/07/14

  • Minor UI changes.
  • Added gptrestore as a bundled tool.
    • Two reasons why it's not on the bundled payloads list:
      • rajkosto doesn't post his releases on GitHub, so GitHandler won't be able to update them.
      • The latest commit in the gptrestore repository was back in 2018. I predict there won't be any updates for it anytime soon.
    • Because of these two reasons, gptrestore is bundled in the JAR file.
  • Re-worked the APX driver installer again to fix a bug that came with the first re-work.
    • I hope I don't have to fix this damn thing again...
  • General system stability improvements to enhance the user's experience.

v1.6.8 2021/07/10

  • Fixed issue with Hekate not updating.
  • Properly packaged JavaFX to support Java 11 and up. #2
  • General system stability improvements to enhance the user's experience.

v1.6.7 2021/07/06

  • Mac OS X support has arrived (sort of, there may still be some issues). #3
  • Added command line mode for those who prefer the command line over a GUI.
  • Reworked the APX driver installer for Windows to fix a bug that couldn't be fixed with the old installer.
  • Removed Incognito_RCM due to the risks it provides.
  • General system stability improvements to enhance the user's experience.

v1.6.6 2021/06/18

  • Linux support has arrived and is ready for use.
  • Added the libusbK installer for those who can't launch JTegraNX on Windows.
  • Fixed a bug with the payload path field text change listener.
  • General system stability improvements to enhance the user's experience.

v1.6.5 2021/06/17

  • Added Incognito_RCM to the tray because I forgot to do it before.
  • Fixed a bug with the include Incognito_RCM button.
  • The payload path field now checks if the specified payload exists and enables/disables the Inject button accordingly.
  • Disabling a bundled payload now clears the payload path field if it contains the path for it.
  • General system stability improvements to enhance the user's experience.

v1.6.4 2021/06/16

  • Redesigned the UI to be more user-friendly.
  • Replaced the default blue background with a dark theme.
  • Added Incognito_RCM to bundled payloads.
  • Fixed bundled payload system sometimes not updating.
  • General system stability improvements to enhance the user's experience.

v1.6.3 2021/06/07

  • Set the updater to use the JRE architecture just in case.
  • Fixed the restart after the update function.
  • Made some minor changes to the UI.
  • Added an about dialog.
  • General system stability improvements to enhance the user's experience.

v1.6.2 2021/06/03

  • Added portable mode.
    • This is just the same behavior as the older versions of JTegraNX when it came to creating data files, it's just been re-implemented as a secondary option.
    • If "JTegraNX.ini" is detected in the working directory of where the JAR is being launched, the portable mode will activate.
    • You can easily switch between Standard and Portable mode from the Settings menu
  • Enhanced the updater for the new deployment.
    • The updater now gets grabs the version based on your system's OS architecture, not the JRE architecture.
      • If this becomes a problem, I'll make it use JRE architecture.
    • The updater now also overwrites the currently running JAR file and prompts a restart.
      • If you choose not to restart when JTegraNX prompts you to, the "Check for JTegraNX updates" Menu Item is set to restart JTegraNX.
  • Hopefully corrected the deployment for x86 and x64 architectures.

v1.6.1 2021/06/02

  • Fixed a small bug with the device reconnect prompt when installing the APX driver.
  • Added a small head start for implementing portable mode.

v1.6 2021/06/01

  • JTegraNX no longer uses TegraRCMSmash, the functionality for RCM payload injection is now written into JTegraNX.
    • The payload injecting bit uses usb4java to get the job done.
      • Before the RCM device is initialized, JTegraNX checks to see if the payload file exists and can be used, if this is false, the RCM device doesn't get initialized, allowing you to choose a different payload without having to reboot your Switch into RCM mode.
    • The stack smashing uses <setupapi.h> instead of libusbK.
    • Custom arguments are no longer supported.
      • The main use for this was SD card mounting, which has also been removed because Hekate can be bundled with JTegraNX and Hekate has it covered. If an error occurs, the error gets printed to the log, instead of JTegraNX crashing.
  • RCM device listener now uses libusbK's HotK module.
    • This squishes two bugs.
      • One bug where the RCM device wouldn't be detected on launch even if it was connected.
      • The other bug where rebooting to RCM from a payload sometimes wouldn't be detected.
  • Added APX driver detection and installation.
    • Administrator privileges are required for driver installation.
    • JTegraNX can only detect if the APX driver is missing if the RCM device is connected when JTegraNX launches.
      • This is because the HotK and LstK modules in libusbK only detect devices that have a libusbK driver installed for them. So if a device isn't detected on startup using LstK, JTegraNX uses <setupapi.h> to check if a device matching the vendor and product IDs of a Switch in RCM mode is connected. If it finds one then it assumes that the APX driver is missing. Getting JTegraNX to detect the missing driver when the device is connected after it launches would require me to implement a second device listener outside of libusbK. Standard libusb won't work because it can only detect the RCM device if the APX driver is installed.
      • If you install the APX driver while the RCM device detected, there will be a prompt for you to reconnect the device. This is to prevent the 50/50 chance of an error while writing the payload to the device.
    • JTegraNX also detects if the incorrect APX driver is installed when the RCM device is connected on and after startup.
      • I shouldn't have to explain the difference between a missing driver and an incorrect driver.
  • The bundled payload system now uses a custom library of mine called GitHandler.
    • This makes the payload updating much more stable.
    • This also squishes a critical bug that occurred when the release tag for Hekate was v5.5.4-v2
      • This bug was caused by the old system attempting to parse v5.5.4-v2 to get the download link for Hekate, which failed because JTegraNX was expecting a String like v5.5.4 and instead got v5.5.4-v2. This caused JTegraNX to hang.
      • GitHandler gets past this by parsing each downloadable asset's download link per release per repository.
        if (line.contains("<a href=\"/CTCaer/hekate/releases/tag/")) {
            latestVersion = line.substring(line.indexOf("tag/") + 5, line.indexOf("\">"));
            latestNyxVersion = line.substring(line.indexOf("Nyx") + 5, line.length() - 4);
            success = true;
            break;
        }
  • Added SD card preparation:
    • When activated, JTegraNX will download all the basic requirements for getting your Switch ready for CFW (Based on this guide) and copy them to the specified output path, don't be afraid to point it to the root of your SD card.
    • This feature also uses GitHandler to ensure that the latest release of each prerequisite is downloaded.
  • Because I'm so confident in GitHandler, JTegraNX's self updater also uses it now.
  • The config system now only uses one config file for everything.
    • This includes UI settings, saved configs, and payload update information.
    • Loading external configs has also been removed because of the new system.
    • If the selected config is deleted, and the payload path field's text matches the deleted config's payload path, the payload path field's text is cleared.
  • The main config file and bundled payloads are now saved in "Documents/JTegraNX/".
  • The tray icon now has a button to simply inject the payload specified in the Payload Path field.
    • It automatically updates the label when the payload path is changed.
      • If the specified payload doesn't exist, it won't let you inject it.
      • The button will also not let you inject a payload if the APX driver is missing or incorrect.
    • Now you no longer have to rely on auto-inject when JTegraNX is minimized to the tray.
  • The tray icon now shows notifications when a payload is injected or when an error occurs.
    • The notifications only get triggered if JTegraNX is minimized to the tray.
  • Hiding the log has been removed because honestly, it seems pointless.
  • You can now customize JTegraNX's settings to your liking.
    • You can now toggle auto-checking for JTegraNX updates.
    • You can now toggle auto-checking for payload updates.
    • You can now choose which payloads you want to include with JTegraNX.
    • You can now toggle the tray icon being enabled or disabled.
  • New icons and more RCM status images were added.
    • Tooltips were added for buttons that have an icon with no text.

v1.5 2020/09/27

  • Added Hekate to bundled payloads.
  • Added the ability to load external configs.
  • Made some minor changes with the Menu Bar.
  • Payloads are now in their own seperate menu.
  • Squashed a few bugs hanging around.

v1.4 2020/06/20

  • What's new:
    • The GUI now uses JavaFX instead of Swing.
    • Re-designed the RCM device listener, it's much more stable and less CPU intensive.
    • Added the ability to clear the log.
    • Added the ability to overwrite the stack.
    • Minor bug fixes.
  • Config system changes:
    • The config system is now implemented into the main GUI, no longer in seperate dialogs.
    • The config system also loads a new main config file for the GUI settings.
    • Added duplicate detection to config saving along with the ability to overwrite dupicates.
    • Mounting SD cards is now a built-in option instead of being on a config file (May be removed in a future release).
    • Added the ability to delete configs.
  • New tray icon:
    • The tray icon is a major addition to JTegraNX, users can now do the following from the tray:
    • Change selected config.
    • Toggle auto-inject.
    • Close the program.
  • Bundled payloads:
  • Added fusee-primary to bundled payloads.

v1.3 2020/01/21

  • Updated the RCM device finder to use the proper vendor and product id's; No more dumping descriptors.
  • Added new RCM Status with auto-updating transperrent pictures.
  • Added new menu bar, some new features in future updates will go there.
  • Added an auto-injection feature.
  • Added the ability to hide the Log.
  • The updater no longer enables/disables the buttons on the GUI.
  • Removed reset button as it was causing issues with the new thread system and it was pointless.
  • Fixed a bug where switching from the "Mount SD Card" config to another config won't clear the Arguments field.
  • Did some minor clean-up in the code.

v1.2 2020/01/16

  • Added new icons.
  • Added Lockpick_RCM to bundled payloads.
  • Update checker now shows latest version if new update is found.
  • Fixed a bug where if no updates were found, it would print it twice in the Log.
  • Added verbose output to payload and program updating process.
  • Changed license from GPL-3.0 to GPL-2.0.

v1.1 2020/01/15

  • Added the ability to pass custom arguments to TegraRcmSmash.
  • Added the ability to mount your Switch's SD card using memloader.
  • Added the Config system.
  • Added the Update checker.
  • Added the Payload managing system for bundled payloads.
  • Added the File downloading system.
  • Added a reset button to clear the input fields and check for JTegraNX updates.

v1.0 2019/12/28

  • This is the first release of JTegraNX, it's not complete yet. This release only has basic payload injection.

Credits

External links

Advertising: