From b02bc7ed2dfa243bacbc8a2ec6ddce8a7d813114 Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Tue, 10 Aug 2021 17:00:33 +0300 Subject: [PATCH] Using idea from #90: Replace 'Tinfoil' by 'Awoo' everywhere on the front end. Also touched translation files (hope didn't broke it, but could be) Add 'Fusee Geelee' and 'RCM' labels used on 'RCM' tab to 'properties' files in case someone wants to translate it.. I don't think if someone should but there is an option. (note: CLI arguments remains the same while only description updated) --- README.md | 43 +++++++------- pom.xml | 4 +- src/main/java/nsusbloader/AppPreferences.java | 14 +++-- .../Controllers/GamesController.java | 41 +++++++------ .../nsusbloader/cli/CommandLineInterface.java | 4 +- .../java/nsusbloader/com/usb/TinFoil.java | 54 ++++++++--------- src/main/resources/RcmTab.fxml | 4 +- src/main/resources/SettingsBlockTinfoil.fxml | 2 +- src/main/resources/locale.properties | 11 ++-- src/main/resources/locale_ar_AR.properties | 1 + src/main/resources/locale_cs_CZ.properties | 5 +- src/main/resources/locale_de_DE.properties | 7 ++- src/main/resources/locale_en_US.properties | 10 ++-- src/main/resources/locale_es_ES.properties | 4 +- src/main/resources/locale_fr_FR.properties | 4 +- src/main/resources/locale_it_IT.properties | 4 +- src/main/resources/locale_ko_KR.properties | 5 +- src/main/resources/locale_pt_BR.properties | 4 +- src/main/resources/locale_ro_RO.properties | 4 +- src/main/resources/locale_ru_RU.properties | 9 ++- src/main/resources/locale_uk_UA.properties | 9 ++- src/main/resources/locale_vi_VN.properties | 4 +- src/main/resources/locale_zh_CN.properties | 58 +++++++++---------- src/main/resources/locale_zh_TW.properties | 4 +- 24 files changed, 164 insertions(+), 145 deletions(-) diff --git a/README.md b/README.md index 35e7358..a1560b0 100644 --- a/README.md +++ b/README.md @@ -5,11 +5,12 @@ [Support author](#support-this-app) NS-USBloader is: -* A PC-side installer for **[Adubbz/TinFoil (v0.2.1)](https://github.com/Adubbz/Tinfoil/)**, **[Huntereb/Awoo-Installer](https://github.com/Huntereb/Awoo-Installer)** (USB and Network supported) and **[XorTroll/GoldLeaf](https://github.com/XorTroll/Goldleaf)** (USB) NSP installer. -Replacement for default **usb_install_pc.py**, **remote_install_pc.py**, **GoldTree**/**Quark**. +* A PC-side installer for **[Huntereb/Awoo-Installer](https://github.com/Huntereb/Awoo-Installer)** / other compatible installers (USB and Network supported) and **[XorTroll/GoldLeaf](https://github.com/XorTroll/Goldleaf)** (USB) NSP installer. +Alternative to default **usb_install_pc.py**, **remote_install_pc.py**, **GoldTree**/**Quark**. * This application also could be used as RCM payload on Windows, MacOS and Linux (supported arch: x86, x86_64 and Raspberry Pi). -* And of course it's a tool for split files! -* And also for merging split-files into one :) +* It's a tool for creating split files! +* Also you can use it for merging split-files into one :) + [Click here for Android version ;)](https://github.com/developersu/ns-usbloader-mobile) @@ -49,6 +50,7 @@ Sometimes I add new posts about this project [on my home page](https://developer * Czech by [Spenaat](https://github.com/spenaat) * Chinese (Traditional) by [qazrfv1234](https://github.com/qazrfv1234) * Arabic by [eslamabdel](https://github.com/eslamabdel) +* Romanian by [Călin Ilie](https://github.com/calini) ### System requirements @@ -67,11 +69,13 @@ JDK 11 for MacOS and Linux where '+' means 'any next NS-USBloader version'. -### Awoo Installer support +### Awoo Installer and compatible applications support + +Awoo Installer uses the same command-set (or 'protocol') to [Adubbz/Tinfoil](https://github.com/Adubbz/Tinfoil/). -Awoo Installer uses the same command-set (or 'protocol') to TinFoil. So just select 'TinFoil' in case you're going to use Awoo. +A lot of other forks/apps uses the same command-set. To stop speculating about the name it's now called 'Awoo'. It WAS called 'TinFoil' before. Not any more. -Also, please go to 'Settings' tab of NS-USBloader after first installation and check 'Allow XCI / NSZ / XCZ files selection for TinFoil' option. This installer can install not only NSPs but a way more formats! +Also, please go to 'Settings' tab of NS-USBloader after first installation and check 'Allow XCI / NSZ / XCZ files selection for Awoo' option. This installer can install not only NSPs but a way more formats! ### Usage ##### Linux: @@ -121,9 +125,9 @@ Set 'Security & Privacy' settings if needed. #### And how to use it? -The first thing you should do it install TinFoil ([Adubbz](https://github.com/Adubbz/Tinfoil/)), GoldLeaf ([XorTroll](https://github.com/XorTroll/Goldleaf)) or Awoo ([Huntereb](https://github.com/Huntereb/Awoo-Installer)) on your NS. +The first thing you should do it install Awoo ([Huntereb](https://github.com/Huntereb/Awoo-Installer)) or GoldLeaf ([XorTroll](https://github.com/XorTroll/Goldleaf)) on your NS. -Take a look on app, find where is the option to install from USB and/or Network. Maybe [this article (about TinFoil)](https://developersu.blogspot.com/2019/02/ns-usbloader-en.html) will be helpful. +Take a look on app, find where is the option to install from USB and/or Network. Maybe (very old) [this article (about TinFoil)](https://developersu.blogspot.com/2019/02/ns-usbloader-en.html) will be helpful. #### In details @@ -137,7 +141,7 @@ Then you may drag-n-drop files (split-files aka folders) to application or use ' Table. -There you can select checkbox for files that will be send to application (TF/GL). ~~Since GoldLeaf allow you only one file transmission per time, only one file is available for selection.~~ +There you can select checkbox for files that will be sent to application (AW/GL). ~~Since GoldLeaf v0.5 allow you only one file transmission per time, only one file is available for selection.~~ Also you can use space to select/un-select files and 'delete' button for deleting. By right-mouse-click you can see context menu where you can delete one OR all items from the table. @@ -151,11 +155,11 @@ On this tab you can select payloader like Hekate or LockPick_RCM and send it to ##### 'Folder with arrows and zeroes' tab -On this tab you can split and merge files. Select 'Split' or 'Merge' and split (or merge). +On this tab you can split and merge files. Select 'Split' or 'Merge' and split (or merge). BTW Drag-n-drop supported. ##### 'Gears' tab. -Here you can configure settings for network file transmission. Usually you shouldn't change anything. But it you're cool hacker, go ahead! The most interesting option here is 'Don't serve requests'. Architecture of the TinFoil's NET part is working interesting way. When you select in TF network NSP transfer, application will wait at port 2000 for the information about where should it take files from. Like '192.168.1.5:6060/my file.nsp'. Usually NS-USBloader serves requests by implementing simplified HTTP server and bringing it up and so on. But if this option selected, you can define path to remote location of the files. For example if you set in settings '192.168.4.2:80/ROMS/NS/' and add in table file 'my file.nsp' then NS-USBloader will simply tell TinFoil "Hey, go take files from '192.168.4.2:80/ROMS/NS/my%20file.nsp' ". Of course you have to bring '192.168.4.2' host up and make file accessible from such address (just go install nginx). As I said, this feature is interesting, but I guess won't be popular. +Here you can configure settings for network file transmission. Usually you shouldn't change anything. But it you're cool hacker, go ahead! The most interesting option here is 'Don't serve requests'. Architecture of the Awoo's NET part is working interesting way. When you select in Awoo network NSP transfer, application will wait at port 2000 for the information about where should it take files from. Like '192.168.1.5:6060/my file.nsp'. Usually NS-USBloader serves requests by implementing simplified HTTP server and bringing it up and so on. But if this option selected, you can define path to remote location of the files. For example if you set in settings '192.168.4.2:80/ROMS/NS/' and add in table file 'my file.nsp' then NS-USBloader will simply tell Awoo "Hey, go take files from '192.168.4.2:80/ROMS/NS/my%20file.nsp' ". Of course you have to bring '192.168.4.2' host up and make file accessible from such address (just go install nginx). As I said, this feature is interesting, but I guess won't be popular. Also here you can: * Set 'Auto-check for updates' for checking for updates when application starts, or click button to verify if new version released immediately. @@ -175,10 +179,10 @@ To get help run ``$ java -jar ns-usbloader-4.0.jar --help`` -g,--goldleaf <...> Install via GoldLeaf mode. Check '-g help' for information. -h,--help Show this help -m,--merge <...> Merge files. Check '-m help' for information. - -n,--tfn <...> Install via Tinfoil/Awoo Network mode. Check '-n help' for information. + -n,--tfn <...> Install via Awoo Network mode. Check '-n help' for information. -r,--rcm <[PATH/]payload.bin> Send payload -s,--split <...> Split files. Check '-s help' for information. - -t,--tinfoil Install via Tinfoil/Awoo USB mode. + -t,--tinfoil Install via Awoo USB mode. -v,--version Show application version ``` @@ -214,23 +218,20 @@ $ java -jar ns-usbloader-4.0.jar -m /tmp/ ~/*.nsp ### Other notes 'Status' = 'Uploaded' that appears in the table does not mean that file has been installed. It means that it has been sent to NS without any issues! That's what this app about. -Handling successful/failed installation is a purpose of the other side application: TinFoil or GoldLeaf. And they don't provide any feedback interfaces so I can't detect success/failure. +Handling successful/failed installation is a purpose of the other side application: Awoo/Awoo-like or GoldLeaf. And they don't provide any feedback interfaces so I can't detect success/failure. usb4java since NS-USBloader-v0.2.3 switched to 1.2.0 instead of 1.3.0. This should not impact anyone except users of macOS High Sierra (and Sierra, and El Capitan) where previous versions of NS-USBloader didn't work. Now builds with usb4java-1.2.0 marked as '-legacy' and builds with usb4java-1.3.0 doesn't have postfixes. ### Translators! + If you want to see this app translated to your language, go grab [this file](https://github.com/developersu/ns-usbloader/blob/master/src/main/resources/locale.properties) and translate it. Upload somewhere (create PR, use pastebin/google drive/whatever else). [Create new issue](https://github.com/developersu/ns-usbloader/issues) and post a link. I'll grab it and add. To convert files of any locale to readable format (and vise-versa) you can use this site [https://itpro.cz/juniconv/](https://itpro.cz/juniconv/) -#### TODO (maybe): -- [x] [Android support](https://github.com/developersu/ns-usbloader-mobile) - ## Support this app - If you like this app, just give a star. If you want to make a donation*, please see below: @@ -239,9 +240,9 @@ If you want to make a donation*, please see below: PayPal Logo -[Yandex.Money](https://money.yandex.ru/to/410014301951665) +[yoomoney](https://yoomoney.ru/to/410014301951665) -* Please note: this is non-commercial application. +*Please note: this is non-commercial application. Thanks diff --git a/pom.xml b/pom.xml index 22da049..036329b 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ https://github.com/developersu/ns-usbloader/ - NSP USB loader for TinFoil (USB and Network) and GoldLeaf + NSP USB loader for Awoo Installer and compatible (USB and Network) and GoldLeaf 2019 @@ -257,7 +257,7 @@ 1.0.0.0 ${project.version} - TinFoil and GoldLeaf installer for your NS + Awoo and GoldLeaf installer for your NS GNU General Public License v3, 2019 ${project.organization.name}. Russia/LPR. 1.0.0.0 ${project.version} diff --git a/src/main/java/nsusbloader/AppPreferences.java b/src/main/java/nsusbloader/AppPreferences.java index b5caac3..52a60fc 100644 --- a/src/main/java/nsusbloader/AppPreferences.java +++ b/src/main/java/nsusbloader/AppPreferences.java @@ -41,12 +41,14 @@ public String getTheme(){ theme = "/res/app_dark.css"; return theme; } - public String getProtocol(){ - String protocol = preferences.get("PROTOCOL", "TinFoil"); // Don't let user to change settings manually - if (!protocol.matches("(^TinFoil$)|(^GoldLeaf$)")) - protocol = "TinFoil"; - return protocol; + public int getProtocol(){ + int protocolIndex = preferences.getInt("protocol_index", 0); // Don't let user to change settings manually + if (protocolIndex < 0 || protocolIndex > 1) + protocolIndex = 0; + return protocolIndex; } + public void setProtocol(int protocolIndex){ preferences.putInt("protocol_index", protocolIndex); } + public String getNetUsb(){ String netUsb = preferences.get("NETUSB", "USB"); // Don't let user to change settings manually if (!netUsb.matches("(^USB$)|(^NET$)")) @@ -55,7 +57,7 @@ public String getNetUsb(){ } public void setTheme(String theme){ preferences.put("THEME", theme); } - public void setProtocol(String protocol){ preferences.put("PROTOCOL", protocol); } + public void setNetUsb(String netUsb){ preferences.put("NETUSB", netUsb); } public void setNsIp(String ip){preferences.put("NSIP", ip);} diff --git a/src/main/java/nsusbloader/Controllers/GamesController.java b/src/main/java/nsusbloader/Controllers/GamesController.java index 3ccccd9..39bb64d 100644 --- a/src/main/java/nsusbloader/Controllers/GamesController.java +++ b/src/main/java/nsusbloader/Controllers/GamesController.java @@ -78,13 +78,13 @@ public void initialize(URL url, ResourceBundle resourceBundle) { this.resourceBundle = resourceBundle; AppPreferences preferences = AppPreferences.getInstance(); - ObservableList choiceProtocolList = FXCollections.observableArrayList("TinFoil", "GoldLeaf"); + ObservableList choiceProtocolList = FXCollections.observableArrayList("Awoo", "GoldLeaf"); choiceProtocol.setItems(choiceProtocolList); choiceProtocol.getSelectionModel().select(preferences.getProtocol()); choiceProtocol.setOnAction(e-> { - tableFilesListController.setNewProtocol(getSelectedProtocol()); - if (getSelectedProtocol().equals("GoldLeaf")) { + tableFilesListController.setNewProtocol(getSelectedProtocolByName()); + if (isGoldLeaf()) { choiceNetUsb.setDisable(true); choiceNetUsb.getSelectionModel().select("USB"); nsIpLbl.setVisible(false); @@ -100,12 +100,12 @@ public void initialize(URL url, ResourceBundle resourceBundle) { // Really bad disable-enable upload button function disableUploadStopBtn(tableFilesListController.isFilesForUploadListEmpty()); }); // Add listener to notify tableView controller - tableFilesListController.setNewProtocol(getSelectedProtocol()); // Notify tableView controller + tableFilesListController.setNewProtocol(getSelectedProtocolByName()); // Notify tableView controller ObservableList choiceNetUsbList = FXCollections.observableArrayList("USB", "NET"); choiceNetUsb.setItems(choiceNetUsbList); choiceNetUsb.getSelectionModel().select(preferences.getNetUsb()); - if (getSelectedProtocol().equals("GoldLeaf")) { + if (isGoldLeaf()) { choiceNetUsb.setDisable(true); choiceNetUsb.getSelectionModel().select("USB"); } @@ -121,7 +121,7 @@ public void initialize(URL url, ResourceBundle resourceBundle) { }); // Set and configure NS IP field behavior nsIpTextField.setText(preferences.getNsIp()); - if (getSelectedProtocol().equals("TinFoil") && getSelectedNetUsb().equals("NET")){ + if (isTinfoil() && getSelectedNetUsb().equals("NET")){ nsIpLbl.setVisible(true); nsIpTextField.setVisible(true); } @@ -145,7 +145,7 @@ public void initialize(URL url, ResourceBundle resourceBundle) { selectSplitNspBtn.getStyleClass().add("buttonSelect"); uploadStopBtn.setOnAction(e-> uploadBtnAction()); - uploadStopBtn.setDisable(getSelectedProtocol().equals("TinFoil")); + uploadStopBtn.setDisable(isTinfoil()); this.btnUpStopImage = new Region(); btnUpStopImage.getStyleClass().add("regionUpload"); @@ -174,30 +174,33 @@ private void switchTheme(){ AppPreferences.getInstance().setTheme(styleSheets.get(0)); } /** - * Get selected protocol (GL/TF) + * Get selected protocol index (GL/Awoo) * */ - String getSelectedProtocol(){ + private int getSelectedProtocolByIndex(){ + return choiceProtocol.getSelectionModel().getSelectedIndex(); + } + private String getSelectedProtocolByName(){ return choiceProtocol.getSelectionModel().getSelectedItem(); } /** * Get selected protocol (USB/NET) * */ - String getSelectedNetUsb(){ + private String getSelectedNetUsb(){ return choiceNetUsb.getSelectionModel().getSelectedItem(); } /** * Get NS IP address * */ - String getNsIp(){ + private String getNsIp(){ return nsIpTextField.getText(); } private boolean isGoldLeaf() { - return getSelectedProtocol().equals("GoldLeaf"); + return getSelectedProtocolByName().equals("GoldLeaf"); } private boolean isTinfoil() { - return getSelectedProtocol().equals("TinFoil"); + return getSelectedProtocolByName().equals("Awoo"); } private boolean isAllFiletypesAllowedForGL() { @@ -290,7 +293,7 @@ private void selectFoldersBtnAction() { * @param startFolder where to start * @param filesRegex for filenames */ - // TODO: Too sophisticated. Should be moved to simple class to keep things simplier + // TODO: Too sophisticated. Should be moved to simple class to keep things simpler private void collectFiles(List storage, File startFolder, @@ -353,7 +356,7 @@ private void uploadBtnAction(){ TextArea logArea = MediatorControl.getInstance().getContoller().logArea; - if (getSelectedProtocol().equals("TinFoil") && tableFilesListController.getFilesForUpload() == null) { + if (isTinfoil() && tableFilesListController.getFilesForUpload() == null) { logArea.setText(resourceBundle.getString("tab3_Txt_NoFolderOrFileSelected")); return; } @@ -369,11 +372,11 @@ private void uploadBtnAction(){ SettingsController settings = MediatorControl.getInstance().getSettingsController(); // If USB selected - if (getSelectedProtocol().equals("GoldLeaf") ){ + if (isGoldLeaf()){ final SettingsBlockGoldleafController goldleafSettings = settings.getGoldleafSettings(); usbNetCommunications = new UsbCommunications(nspToUpload, "GoldLeaf" + goldleafSettings.getGlVer(), goldleafSettings.getNSPFileFilterForGL()); } - else if (( getSelectedProtocol().equals("TinFoil") && getSelectedNetUsb().equals("USB") )){ + else if (( isTinfoil() && getSelectedNetUsb().equals("USB") )){ usbNetCommunications = new UsbCommunications(nspToUpload, "TinFoil", false); } else { // NET INSTALL OVER TINFOIL @@ -477,7 +480,7 @@ public void notifyThreadStarted(boolean isActive, EModule type){ * Crunch. This function called from NSTableViewController * */ public void disableUploadStopBtn(boolean disable){ - if (getSelectedProtocol().equals("TinFoil")) + if (isTinfoil()) uploadStopBtn.setDisable(disable); else uploadStopBtn.setDisable(false); @@ -522,7 +525,7 @@ public String getRecentPath(){ public void updatePreferencesOnExit(){ AppPreferences preferences = AppPreferences.getInstance(); - preferences.setProtocol(getSelectedProtocol()); + preferences.setProtocol(getSelectedProtocolByIndex()); preferences.setRecent(getRecentPath()); preferences.setNetUsb(getSelectedNetUsb()); preferences.setNsIp(getNsIp()); diff --git a/src/main/java/nsusbloader/cli/CommandLineInterface.java b/src/main/java/nsusbloader/cli/CommandLineInterface.java index 21f9a06..bf18aee 100644 --- a/src/main/java/nsusbloader/cli/CommandLineInterface.java +++ b/src/main/java/nsusbloader/cli/CommandLineInterface.java @@ -136,14 +136,14 @@ private Options createCliOptions(){ /* Tinfoil network mode options */ final Option tinfoilNetOption = Option.builder("n") .longOpt("tfn") - .desc("Install via Tinfoil/Awoo Network mode. Check '-n help' for information.") + .desc("Install via Awoo Network mode. Check '-n help' for information.") .hasArgs() .argName("...") .build(); /* Tinfoil/Awoo USB */ final Option tinfoilOption = Option.builder("t") .longOpt("tinfoil") - .desc("Install via Tinfoil/Awoo USB mode.") + .desc("Install via Awoo USB mode.") .hasArgs() .argName("FILE...") .build(); diff --git a/src/main/java/nsusbloader/com/usb/TinFoil.java b/src/main/java/nsusbloader/com/usb/TinFoil.java index 33114bf..d4aa9e4 100644 --- a/src/main/java/nsusbloader/com/usb/TinFoil.java +++ b/src/main/java/nsusbloader/com/usb/TinFoil.java @@ -50,7 +50,7 @@ class TinFoil extends TransferModule { TinFoil(DeviceHandle handler, LinkedHashMap nspMap, CancellableRunnable task, ILogPrinter logPrinter){ super(handler, nspMap, task, logPrinter); - print("============= Tinfoil =============", EMsgType.INFO); + print("======== Awoo Installer and compatibles ========", EMsgType.INFO); if (! sendListOfFiles()) return; @@ -69,25 +69,25 @@ private boolean sendListOfFiles(){ byte[] padding = new byte[8]; if (writeUsb(TUL0)) { - print("TF Send list of files: handshake [1/4]", EMsgType.FAIL); + print("Send list of files: handshake [1/4]", EMsgType.FAIL); return false; } if (writeUsb(nspListNamesSize)) { // size of the list we can transfer - print("TF Send list of files: list length [2/4]", EMsgType.FAIL); + print("Send list of files: list length [2/4]", EMsgType.FAIL); return false; } if (writeUsb(padding)) { - print("TF Send list of files: padding [3/4]", EMsgType.FAIL); + print("Send list of files: padding [3/4]", EMsgType.FAIL); return false; } if (writeUsb(nspListNames)) { - print("TF Send list of files: list itself [4/4]", EMsgType.FAIL); + print("Send list of files: list itself [4/4]", EMsgType.FAIL); return false; } - print("TF Send list of files complete.", EMsgType.PASS); + print("Send list of files complete.", EMsgType.PASS); return true; } @@ -114,7 +114,7 @@ private byte[] getFileNamesLengthToSendAsBytes(byte[] fileNamesListToSendAsBytes * After we sent commands to NS, this chain starts * */ private boolean proceedCommands(){ - print("TF Awaiting for NS commands.", EMsgType.INFO); + print("Awaiting for NS commands.", EMsgType.INFO); try{ byte[] deviceReply; byte command; @@ -127,11 +127,11 @@ private boolean proceedCommands(){ switch (command){ case CMD_EXIT: - print("TF Transfer complete.", EMsgType.PASS); + print("Transfer complete.", EMsgType.PASS); return true; case CMD_FILE_RANGE_DEFAULT: case CMD_FILE_RANGE_ALTERNATIVE: - //print("TF Received 'FILE RANGE' command [0x0"+command+"].", EMsgType.PASS); + //print("Received 'FILE RANGE' command [0x0"+command+"].", EMsgType.PASS); if (fileRangeCmd()) return false; // catches exception } @@ -169,7 +169,7 @@ private boolean fileRangeCmd(){ String nspFileName = new String(receivedArray, StandardCharsets.UTF_8); - print(String.format("TF Reply to: %s" + + print(String.format("Reply to: %s" + "\n Offset: %-20d 0x%x" + "\n Size: %-20d 0x%x", nspFileName, @@ -188,16 +188,16 @@ private boolean fileRangeCmd(){ else sendNormalFile(nspFile, size, offset); } catch (IOException ioe){ - print("TF IOException:\n "+ioe.getMessage(), EMsgType.FAIL); + print("IOException:\n "+ioe.getMessage(), EMsgType.FAIL); ioe.printStackTrace(); return true; } catch (ArithmeticException ae){ - print("TF ArithmeticException (can't cast 'offset end' - 'offsets current' to 'integer'):" + + print("ArithmeticException (can't cast 'offset end' - 'offsets current' to 'integer'):" + "\n "+ae.getMessage(), EMsgType.FAIL); ae.printStackTrace(); return true; } catch (NullPointerException npe){ - print("TF NullPointerException (in some moment application didn't find something. Something important.):" + + print("NullPointerException (in some moment application didn't find something. Something important.):" + "\n "+npe.getMessage(), EMsgType.FAIL); npe.printStackTrace(); return true; @@ -216,7 +216,7 @@ void sendSplitFile(File nspFile, long size, long offset) throws Exception { NSSplitReader nsSplitReader = new NSSplitReader(nspFile, size); if (nsSplitReader.seek(offset) != offset) - throw new IOException("TF Requested offset is out of file size. Nothing to transmit."); + throw new IOException("Requested offset is out of file size. Nothing to transmit."); while (currentOffset < size){ if ((currentOffset + chunk) >= size ) @@ -226,10 +226,10 @@ void sendSplitFile(File nspFile, long size, long offset) throws Exception { readBuffer = new byte[chunk]; // TODO: not perfect moment, consider refactoring. if (nsSplitReader.read(readBuffer) != chunk) - throw new IOException("TF Reading from stream suddenly ended."); + throw new IOException("Reading from stream suddenly ended."); if (writeUsb(readBuffer)) - throw new IOException("TF Failure during file transfer."); + throw new IOException("Failure during file transfer."); currentOffset += chunk; logPrinter.updateProgress((double)currentOffset / (double)size); } @@ -245,7 +245,7 @@ void sendNormalFile(File nspFile, long size, long offset) throws Exception { BufferedInputStream bufferedInStream = new BufferedInputStream(new FileInputStream(nspFile)); if (bufferedInStream.skip(offset) != offset) - throw new IOException("TF Requested offset is out of file size. Nothing to transmit."); + throw new IOException("Requested offset is out of file size. Nothing to transmit."); while (currentOffset < size) { if ((currentOffset + chunk) >= size) @@ -255,10 +255,10 @@ void sendNormalFile(File nspFile, long size, long offset) throws Exception { readBuffer = new byte[chunk]; if (bufferedInStream.read(readBuffer) != chunk) - throw new IOException("TF Reading from stream suddenly ended."); + throw new IOException("Reading from stream suddenly ended."); if (writeUsb(readBuffer)) - throw new IOException("TF Failure during file transfer."); + throw new IOException("Failure during file transfer."); currentOffset += chunk; logPrinter.updateProgress((double)currentOffset / (double)size); } @@ -278,17 +278,17 @@ private boolean sendMetaInfoForFile(byte[] sizeAsBytes){ final byte[] twelveZeroBytes = new byte[12]; if (writeUsb(standardReplyBytes)){ // Send integer value of '1' in Little-endian format. - print("TF Sending response failed [1/3]", EMsgType.FAIL); + print("Sending response failed [1/3]", EMsgType.FAIL); return true; } if(writeUsb(sizeAsBytes)) { // Send EXACTLY what has been received - print("TF Sending response failed [2/3]", EMsgType.FAIL); + print("Sending response failed [2/3]", EMsgType.FAIL); return true; } if(writeUsb(twelveZeroBytes)) { // kinda another one padding - print("TF Sending response failed [3/3]", EMsgType.FAIL); + print("Sending response failed [3/3]", EMsgType.FAIL); return true; } return false; @@ -317,7 +317,7 @@ private boolean writeUsb(byte[] message) { case LibUsb.SUCCESS: if (writeBufTransferred.get() == message.length) return false; - print("TF Data transfer issue [write]" + + print("Data transfer issue [write]" + "\n Requested: "+message.length+ "\n Transferred: "+writeBufTransferred.get(), EMsgType.FAIL); return true; @@ -326,13 +326,13 @@ private boolean writeUsb(byte[] message) { //writeBufTransferred.clear(); // MUST BE HERE IF WE 'GET()' IT continue; default: - print("TF Data transfer issue [write]" + + print("Data transfer issue [write]" + "\n Returned: "+ UsbErrorCodes.getErrCode(result) + "\n (execution stopped)", EMsgType.FAIL); return true; } } - print("TF Execution interrupted", EMsgType.INFO); + print("Execution interrupted", EMsgType.INFO); return true; } /** @@ -357,11 +357,11 @@ private byte[] readUsb() throws Exception{ case LibUsb.ERROR_TIMEOUT: continue; default: - throw new Exception("TF Data transfer issue [read]" + + throw new Exception("Data transfer issue [read]" + "\n Returned: " + UsbErrorCodes.getErrCode(result)+ "\n (execution stopped)"); } } - throw new InterruptedException("TF Execution interrupted"); + throw new InterruptedException("Execution interrupted"); } } diff --git a/src/main/resources/RcmTab.fxml b/src/main/resources/RcmTab.fxml index ea765c2..adb7750 100644 --- a/src/main/resources/RcmTab.fxml +++ b/src/main/resources/RcmTab.fxml @@ -21,7 +21,7 @@ -