From 16a55fac4019d8b579d881e81e8a962859960c21 Mon Sep 17 00:00:00 2001 From: Manuel Borrajo Date: Thu, 11 Feb 2021 18:08:50 -0300 Subject: [PATCH 1/4] Add option Awoo-installer The option added is the same that tinfoil. i changed all aparences of "getSelectedProtocol.equals("Tinfoil") to isTinfoil( ). I hope the change is well done. --- .../Controllers/GamesController.java | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/main/java/nsusbloader/Controllers/GamesController.java b/src/main/java/nsusbloader/Controllers/GamesController.java index 3ccccd9..1f006ea 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("TinFoil", "Awoo-installer", "GoldLeaf"); choiceProtocol.setItems(choiceProtocolList); choiceProtocol.getSelectionModel().select(preferences.getProtocol()); choiceProtocol.setOnAction(e-> { tableFilesListController.setNewProtocol(getSelectedProtocol()); - if (getSelectedProtocol().equals("GoldLeaf")) { + if (isGoldleaf()) { choiceNetUsb.setDisable(true); choiceNetUsb.getSelectionModel().select("USB"); nsIpLbl.setVisible(false); @@ -105,7 +105,7 @@ public void initialize(URL url, ResourceBundle resourceBundle) { 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"); @@ -197,7 +197,7 @@ private boolean isGoldLeaf() { } private boolean isTinfoil() { - return getSelectedProtocol().equals("TinFoil"); + return getSelectedProtocol().equals("TinFoil") || getSelectedProtocol().equals("Awoo-installer"); } private boolean isAllFiletypesAllowedForGL() { @@ -353,7 +353,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 +369,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 +477,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); @@ -527,4 +527,4 @@ public void updatePreferencesOnExit(){ preferences.setNetUsb(getSelectedNetUsb()); preferences.setNsIp(getNsIp()); } -} \ No newline at end of file +} From e33f4d2ffc79129899897f72c89dd5d07a763352 Mon Sep 17 00:00:00 2001 From: Manuel Borrajo Date: Thu, 11 Feb 2021 18:30:01 -0300 Subject: [PATCH 2/4] Fix scope functions --- .../java/nsusbloader/Controllers/GamesController.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/nsusbloader/Controllers/GamesController.java b/src/main/java/nsusbloader/Controllers/GamesController.java index 1f006ea..1d2f123 100644 --- a/src/main/java/nsusbloader/Controllers/GamesController.java +++ b/src/main/java/nsusbloader/Controllers/GamesController.java @@ -84,7 +84,7 @@ public void initialize(URL url, ResourceBundle resourceBundle) { choiceProtocol.getSelectionModel().select(preferences.getProtocol()); choiceProtocol.setOnAction(e-> { tableFilesListController.setNewProtocol(getSelectedProtocol()); - if (isGoldleaf()) { + if (getSelectedProtocol().equals("GoldLeaf")) { choiceNetUsb.setDisable(true); choiceNetUsb.getSelectionModel().select("USB"); nsIpLbl.setVisible(false); @@ -105,7 +105,7 @@ public void initialize(URL url, ResourceBundle resourceBundle) { ObservableList choiceNetUsbList = FXCollections.observableArrayList("USB", "NET"); choiceNetUsb.setItems(choiceNetUsbList); choiceNetUsb.getSelectionModel().select(preferences.getNetUsb()); - if (isGoldLeaf()) { + if (getSelectedProtocol().equals("GoldLeaf")) { 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 (isTinfoil() && getSelectedNetUsb().equals("NET")){ + if (( getSelectedProtocol().equals("TinFoil") || getSelectedProtocol().equals("Awoo-installer") ) && 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(isTinfoil()); + uploadStopBtn.setDisable(( getSelectedProtocol().equals("TinFoil") || getSelectedProtocol().equals("Awoo-installer") )); this.btnUpStopImage = new Region(); btnUpStopImage.getStyleClass().add("regionUpload"); From ec77105174ca426472591b3a2f6e5d85c3f60cc9 Mon Sep 17 00:00:00 2001 From: Manuel Borrajo Date: Thu, 11 Feb 2021 18:35:07 -0300 Subject: [PATCH 3/4] Fix scope functions --- .../nsusbloader/Controllers/GamesController.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/nsusbloader/Controllers/GamesController.java b/src/main/java/nsusbloader/Controllers/GamesController.java index 1d2f123..6b77241 100644 --- a/src/main/java/nsusbloader/Controllers/GamesController.java +++ b/src/main/java/nsusbloader/Controllers/GamesController.java @@ -196,7 +196,7 @@ private boolean isGoldLeaf() { return getSelectedProtocol().equals("GoldLeaf"); } - private boolean isTinfoil() { + private boolean ( getSelectedProtocol().equals("TinFoil") || getSelectedProtocol().equals("Awoo-installer") ) { return getSelectedProtocol().equals("TinFoil") || getSelectedProtocol().equals("Awoo-installer"); } @@ -216,7 +216,7 @@ private boolean isXciNszXczSupport() { * etc.. */ private String getRegexForFiles() { - if (isTinfoil() && isXciNszXczSupport()) + if (( getSelectedProtocol().equals("TinFoil") || getSelectedProtocol().equals("Awoo-installer") ) && isXciNszXczSupport()) return REGEX_ALLFILES_TINFOIL; else if (isGoldLeaf() && isAllFiletypesAllowedForGL()) return REGEX_ALLFILES; @@ -241,7 +241,7 @@ private void selectFilesBtnAction() { fileChooser.setInitialDirectory(new File(FilesHelper.getRealFolder(previouslyOpenedPath))); - if (isTinfoil() && isXciNszXczSupport()) { + if (( getSelectedProtocol().equals("TinFoil") || getSelectedProtocol().equals("Awoo-installer") ) && isXciNszXczSupport()) { fileChooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("NSP/XCI/NSZ/XCZ", "*.nsp", "*.xci", "*.nsz", "*.xcz")); } else if (isGoldLeaf() && isAllFiletypesAllowedForGL()) { @@ -353,7 +353,7 @@ private void uploadBtnAction(){ TextArea logArea = MediatorControl.getInstance().getContoller().logArea; - if (isTinfoil() && tableFilesListController.getFilesForUpload() == null) { + if (( getSelectedProtocol().equals("TinFoil") || getSelectedProtocol().equals("Awoo-installer")) && tableFilesListController.getFilesForUpload() == null) { logArea.setText(resourceBundle.getString("tab3_Txt_NoFolderOrFileSelected")); return; } @@ -369,11 +369,11 @@ private void uploadBtnAction(){ SettingsController settings = MediatorControl.getInstance().getSettingsController(); // If USB selected - if (isGoldLeaf()){ + if (getSelectedProtocol().equals("GoldLeaf")){ final SettingsBlockGoldleafController goldleafSettings = settings.getGoldleafSettings(); usbNetCommunications = new UsbCommunications(nspToUpload, "GoldLeaf" + goldleafSettings.getGlVer(), goldleafSettings.getNSPFileFilterForGL()); } - else if (( isTinfoil() && getSelectedNetUsb().equals("USB") )){ + else if (( ( getSelectedProtocol().equals("TinFoil") || getSelectedProtocol().equals("Awoo-installer") ) && getSelectedNetUsb().equals("USB") )){ usbNetCommunications = new UsbCommunications(nspToUpload, "TinFoil", false); } else { // NET INSTALL OVER TINFOIL @@ -477,7 +477,7 @@ public void notifyThreadStarted(boolean isActive, EModule type){ * Crunch. This function called from NSTableViewController * */ public void disableUploadStopBtn(boolean disable){ - if (isTinfoil()) + if (( getSelectedProtocol().equals("TinFoil") || getSelectedProtocol().equals("Awoo-installer") )) uploadStopBtn.setDisable(disable); else uploadStopBtn.setDisable(false); From 85d46d5efa043959e4553e73fe26bdd620de4a47 Mon Sep 17 00:00:00 2001 From: Manuel Borrajo Date: Thu, 11 Feb 2021 18:39:22 -0300 Subject: [PATCH 4/4] Fix function name --- src/main/java/nsusbloader/Controllers/GamesController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/nsusbloader/Controllers/GamesController.java b/src/main/java/nsusbloader/Controllers/GamesController.java index 6b77241..6f18647 100644 --- a/src/main/java/nsusbloader/Controllers/GamesController.java +++ b/src/main/java/nsusbloader/Controllers/GamesController.java @@ -196,7 +196,7 @@ private boolean isGoldLeaf() { return getSelectedProtocol().equals("GoldLeaf"); } - private boolean ( getSelectedProtocol().equals("TinFoil") || getSelectedProtocol().equals("Awoo-installer") ) { + private boolean isTinfoil() { return getSelectedProtocol().equals("TinFoil") || getSelectedProtocol().equals("Awoo-installer"); }