mirror of
https://github.com/developersu/ns-usbloader.git
synced 2025-05-15 15:44:55 -04:00
Minor fixes
This commit is contained in:
parent
4d7c6f6ef1
commit
29f29b7d31
24 changed files with 139 additions and 42 deletions
|
@ -144,4 +144,9 @@ public class AppPreferences {
|
|||
|
||||
public String getPatchesSaveToLocation(){ return FilesHelper.getRealFolder(preferences.get("patches_saveto", System.getProperty("user.home"))); }
|
||||
public void setPatchesSaveToLocation(String value){ preferences.put("patches_saveto", value); }
|
||||
|
||||
public boolean getPatchesTabInvisible(){return preferences.getBoolean("patches_tab_visible", true); }
|
||||
public void setPatchesTabInvisible(boolean value){preferences.putBoolean("patches_tab_visible", value);}
|
||||
public String getPatchOffset(String type, int moduleNumber, int offsetId){ return preferences.get(String.format("%s_%02x_%02x", type, moduleNumber, offsetId), ""); }
|
||||
public void setPatchOffset(String fullTypeSpecifier, String offset){ preferences.put(fullTypeSpecifier, offset); }
|
||||
}
|
||||
|
|
|
@ -70,9 +70,13 @@ public class NSLMainController implements Initializable {
|
|||
|
||||
MediatorControl.getInstance().setController(this);
|
||||
|
||||
if (AppPreferences.getInstance().getAutoCheckUpdates()){
|
||||
AppPreferences preferences = AppPreferences.getInstance();
|
||||
|
||||
if (preferences.getAutoCheckUpdates())
|
||||
checkForUpdates();
|
||||
}
|
||||
|
||||
if (preferences.getPatchesTabInvisible())
|
||||
mainTabPane.getTabs().remove(3);
|
||||
|
||||
openLastOpenedTab();
|
||||
}
|
||||
|
|
|
@ -24,7 +24,9 @@ import javafx.fxml.Initializable;
|
|||
import javafx.scene.input.DragEvent;
|
||||
import javafx.scene.input.TransferMode;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.net.URL;
|
||||
import java.util.List;
|
||||
import java.util.ResourceBundle;
|
||||
|
@ -128,7 +130,10 @@ public class PatchesController implements Initializable {
|
|||
List<File> filesDropped = event.getDragboard().getFiles();
|
||||
for (File file : filesDropped){
|
||||
if (file.isDirectory()) {
|
||||
locationFirmwareLbl.setText(file.getAbsolutePath());
|
||||
if (file.getName().toLowerCase().contains("atmosphe"))
|
||||
locationAtmosphereLbl.setText(file.getAbsolutePath());
|
||||
else
|
||||
locationFirmwareLbl.setText(file.getAbsolutePath());
|
||||
continue;
|
||||
}
|
||||
String fileName = file.getName().toLowerCase();
|
||||
|
@ -137,10 +142,42 @@ public class PatchesController implements Initializable {
|
|||
! fileName.equals("dev.keys") &&
|
||||
! fileName.equals("title.keys")))
|
||||
locationKeysLbl.setText(file.getAbsolutePath());
|
||||
else if (fileName.equals("offsets.txt"))
|
||||
setOffsets(file);
|
||||
}
|
||||
event.setDropCompleted(true);
|
||||
event.consume();
|
||||
}
|
||||
|
||||
private void setOffsets(File fileWithOffsets){
|
||||
AppPreferences preferences = AppPreferences.getInstance();
|
||||
|
||||
try (BufferedReader reader = new BufferedReader(new FileReader(fileWithOffsets))) {
|
||||
String fileLine;
|
||||
String[] lineValues;
|
||||
while ((fileLine = reader.readLine()) != null) {
|
||||
lineValues = fileLine.trim().split("\\s+?=\\s+?", 2);
|
||||
if (lineValues.length == 2) {
|
||||
String[] pointer = lineValues[0].split("_", 3);
|
||||
if (! pointer[0].equals("ES") && ! pointer[0].equals("FS"))
|
||||
continue;
|
||||
if (! pointer[1].matches("^([0-9A-Fa-f]{2})$"))
|
||||
continue;
|
||||
if (! pointer[2].matches("^([0-9A-Fa-f]{2})$"))
|
||||
continue;
|
||||
if (! lineValues[1].matches("^(([0-9A-Fa-f]{2})|\\.)+?$"))
|
||||
continue;
|
||||
preferences.setPatchOffset(lineValues[0], lineValues[1]);
|
||||
|
||||
System.out.println(pointer[0]+"_"+pointer[1]+"_"+pointer[2]+" = "+lineValues[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void selectFirmware(){
|
||||
DirectoryChooser directoryChooser = new DirectoryChooser();
|
||||
|
|
|
@ -32,9 +32,6 @@ import javafx.scene.layout.VBox;
|
|||
import javafx.stage.Stage;
|
||||
import nsusbloader.AppPreferences;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
public class DriversInstall {
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
package nsusbloader.Utilities.patches.es.finders;
|
||||
|
||||
import libKonogonka.Converter;
|
||||
import nsusbloader.AppPreferences;
|
||||
import nsusbloader.Utilities.patches.AHeuristic;
|
||||
import nsusbloader.Utilities.patches.BinToAsmPrinter;
|
||||
import nsusbloader.Utilities.patches.SimplyFind;
|
||||
|
@ -26,7 +27,7 @@ import nsusbloader.Utilities.patches.SimplyFind;
|
|||
import java.util.List;
|
||||
|
||||
class HeuristicEs1 extends AHeuristic {
|
||||
private static final String PATTERN = "1F90013128.8052";
|
||||
private static final String PATTERN = AppPreferences.getInstance().getPatchOffset("ES", 1, 0);
|
||||
|
||||
private final List<Integer> findings;
|
||||
private final byte[] where;
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
package nsusbloader.Utilities.patches.es.finders;
|
||||
|
||||
import libKonogonka.Converter;
|
||||
import nsusbloader.AppPreferences;
|
||||
import nsusbloader.Utilities.patches.AHeuristic;
|
||||
import nsusbloader.Utilities.patches.BinToAsmPrinter;
|
||||
import nsusbloader.Utilities.patches.SimplyFind;
|
||||
|
@ -27,7 +28,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
class HeuristicEs2 extends AHeuristic {
|
||||
private static final String PATTERN = ".D2.52";
|
||||
private static final String PATTERN = AppPreferences.getInstance().getPatchOffset("ES", 2, 0);
|
||||
|
||||
private List<Integer> findings;
|
||||
private final byte[] where;
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
package nsusbloader.Utilities.patches.es.finders;
|
||||
|
||||
import libKonogonka.Converter;
|
||||
import nsusbloader.AppPreferences;
|
||||
import nsusbloader.Utilities.patches.AHeuristic;
|
||||
import nsusbloader.Utilities.patches.BinToAsmPrinter;
|
||||
import nsusbloader.Utilities.patches.SimplyFind;
|
||||
|
@ -26,8 +27,8 @@ import nsusbloader.Utilities.patches.SimplyFind;
|
|||
import java.util.List;
|
||||
|
||||
class HeuristicEs3 extends AHeuristic {
|
||||
private static final String PATTERN0 = "..FF97";
|
||||
private static final String PATTERN1 = "......FF97"; // aka "E0230091..FF97";
|
||||
private static final String PATTERN0 = AppPreferences.getInstance().getPatchOffset("ES", 3, 0);
|
||||
private static final String PATTERN1 = AppPreferences.getInstance().getPatchOffset("ES", 3, 1);
|
||||
|
||||
private final List<Integer> findings;
|
||||
private final byte[] where;
|
||||
|
|
|
@ -77,9 +77,9 @@ public class FsIniMaker {
|
|||
private void makeFwVersionInformationNotice(boolean isFat32, byte[] fwVersion){
|
||||
String fwVersionFormatted = fwVersion[3]+"."+fwVersion[2]+"."+fwVersion[1]+"."+fwVersion[0];
|
||||
if (isFat32)
|
||||
firmwareVersionInformationNotice = "\n#FS "+fwVersionFormatted+"\n";
|
||||
firmwareVersionInformationNotice = "\n#FS (FAT)"+fwVersionFormatted+"\n";
|
||||
else
|
||||
firmwareVersionInformationNotice = "\n#FS "+fwVersionFormatted+"-ExFAT\n";
|
||||
firmwareVersionInformationNotice = "\n#FS (ExFAT) "+fwVersionFormatted+"\n";
|
||||
}
|
||||
|
||||
private void makeSectionDeclaration(String patchName){
|
||||
|
|
|
@ -88,13 +88,6 @@ public class FsPatch {
|
|||
logPrinter.print(" == Debug information ==\n"+wizard.getDebug(), EMsgType.NULL);
|
||||
}
|
||||
private KIP1Provider getKIP1Provider() throws Exception{
|
||||
System.out.println("ncaProvider "+ncaProvider);
|
||||
System.out.println("CONTENT "+ncaProvider.getNCAContentProvider(0));
|
||||
System.out.println("CONTENT "+ncaProvider.getNCAContentProvider(1));
|
||||
System.out.println("CONTENT "+ncaProvider.getNCAContentProvider(2));
|
||||
System.out.println("CONTENT "+ncaProvider.getNCAContentProvider(3));
|
||||
|
||||
|
||||
RomFsProvider romFsProvider = ncaProvider.getNCAContentProvider(0).getRomfs();
|
||||
|
||||
FileSystemEntry package2FsEntry = romFsProvider.getRootEntry().getContent()
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
package nsusbloader.Utilities.patches.fs.finders;
|
||||
|
||||
import libKonogonka.Converter;
|
||||
import nsusbloader.AppPreferences;
|
||||
import nsusbloader.Utilities.patches.AHeuristic;
|
||||
import nsusbloader.Utilities.patches.BinToAsmPrinter;
|
||||
import nsusbloader.Utilities.patches.SimplyFind;
|
||||
|
@ -27,7 +28,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
class HeuristicFs1 extends AHeuristic {
|
||||
private static final String PATTERN = "..0036....1F..71..0054..4839"; // TBZ
|
||||
private static final String PATTERN = AppPreferences.getInstance().getPatchOffset("FS", 1, 0); // TBZ
|
||||
|
||||
private final byte[] where;
|
||||
private final List<Integer> findings;
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
package nsusbloader.Utilities.patches.fs.finders;
|
||||
|
||||
import libKonogonka.Converter;
|
||||
import nsusbloader.AppPreferences;
|
||||
import nsusbloader.Utilities.patches.AHeuristic;
|
||||
import nsusbloader.Utilities.patches.BinToAsmPrinter;
|
||||
import nsusbloader.Utilities.patches.SimplyFind;
|
||||
|
@ -27,7 +28,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
class HeuristicFs2 extends AHeuristic {
|
||||
private static final String PATTERN = "...94081c00121f050071..0054"; // "...94"->BL "081c0012"->AND "1f050071"->CMP "..0054"->B.cond (only '54' is signature!)
|
||||
private static final String PATTERN = AppPreferences.getInstance().getPatchOffset("FS", 2, 0);
|
||||
|
||||
private final byte[] where;
|
||||
private final List<Integer> findings;
|
||||
|
|
|
@ -67,6 +67,11 @@ public class CommandLineInterface {
|
|||
new GoldLeafCli(arguments);
|
||||
return;
|
||||
}
|
||||
if (cli.hasOption("experimental")){
|
||||
final String[] arguments = cli.getOptionValues("experimental");
|
||||
new ExperimentalCli(arguments);
|
||||
return;
|
||||
}
|
||||
/*
|
||||
if (cli.hasOption("x") || cli.hasOption("nxdt")){
|
||||
final String[] arguments = cli.getOptionValues("nxdt");
|
||||
|
@ -153,6 +158,12 @@ public class CommandLineInterface {
|
|||
.hasArgs()
|
||||
.argName("...")
|
||||
.build();
|
||||
final Option experimentalOption = Option.builder()
|
||||
.longOpt("experimental")
|
||||
.desc("Enable testing and experimental functions")
|
||||
.hasArgs()
|
||||
.argName("y|n")
|
||||
.build();
|
||||
/* nxdumptool */
|
||||
/*
|
||||
final Option nxdtOption = Option.builder("x")
|
||||
|
@ -183,6 +194,7 @@ public class CommandLineInterface {
|
|||
group.addOption(helpOption);
|
||||
group.addOption(tinfoilOption);
|
||||
group.addOption(glOption);
|
||||
group.addOption(experimentalOption);
|
||||
//group.addOption(nxdtOption);
|
||||
group.addOption(splitOption);
|
||||
group.addOption(mergeOption);
|
||||
|
|
46
src/main/java/nsusbloader/cli/ExperimentalCli.java
Normal file
46
src/main/java/nsusbloader/cli/ExperimentalCli.java
Normal file
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
Copyright 2019-2023 Dmitry Isaenko
|
||||
|
||||
This file is part of NS-USBloader.
|
||||
|
||||
NS-USBloader is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
NS-USBloader is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with NS-USBloader. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package nsusbloader.cli;
|
||||
|
||||
import nsusbloader.AppPreferences;
|
||||
|
||||
public class ExperimentalCli {
|
||||
ExperimentalCli(String[] arguments) throws IncorrectSetupException{
|
||||
if (arguments == null || arguments.length == 0)
|
||||
throw new IncorrectSetupException("No arguments.\nShould be 'y' or 'n'");
|
||||
|
||||
if (arguments.length > 1)
|
||||
throw new IncorrectSetupException("Too many arguments.\nShould be 'y' or 'n' only");
|
||||
|
||||
String arg = arguments[0].toLowerCase().substring(0, 1);
|
||||
|
||||
if (arg.equals("y")) {
|
||||
AppPreferences.getInstance().setPatchesTabInvisible(false);
|
||||
System.out.println("Experimental functions enabled");
|
||||
return;
|
||||
}
|
||||
if (arg.equals("n")) {
|
||||
AppPreferences.getInstance().setPatchesTabInvisible(true);
|
||||
System.out.println("Experimental functions disabled");
|
||||
return;
|
||||
}
|
||||
|
||||
throw new IncorrectSetupException("Incorrect arguments.\nCould be 'y' or 'n' only");
|
||||
}
|
||||
}
|
|
@ -34,7 +34,7 @@ public class GoldLeafCli {
|
|||
|
||||
private int parseFileSince = 1;
|
||||
|
||||
public GoldLeafCli(String[] arguments) throws InterruptedException, IncorrectSetupException{
|
||||
GoldLeafCli(String[] arguments) throws InterruptedException, IncorrectSetupException{
|
||||
this.arguments = arguments;
|
||||
|
||||
checkArguments();
|
||||
|
@ -43,7 +43,7 @@ public class GoldLeafCli {
|
|||
runGoldLeafBackend();
|
||||
}
|
||||
|
||||
public void checkArguments() throws IncorrectSetupException{
|
||||
private void checkArguments() throws IncorrectSetupException{
|
||||
if (arguments == null || arguments.length == 0) {
|
||||
throw new IncorrectSetupException("No arguments.\n" +
|
||||
"Try 'ns-usbloader -g help' for more information.");
|
||||
|
@ -83,7 +83,7 @@ public class GoldLeafCli {
|
|||
return builder.toString();
|
||||
}
|
||||
|
||||
public void parseGoldLeafVersion() throws IncorrectSetupException{
|
||||
private void parseGoldLeafVersion() throws IncorrectSetupException{
|
||||
String argument1 = arguments[0];
|
||||
|
||||
if (! argument1.startsWith("ver=")) {
|
||||
|
@ -107,7 +107,7 @@ public class GoldLeafCli {
|
|||
getGlSupportedVersions());
|
||||
}
|
||||
|
||||
public void parseFilesArguments() throws IncorrectSetupException{
|
||||
private void parseFilesArguments() throws IncorrectSetupException{
|
||||
filesList = new ArrayList<>();
|
||||
File file;
|
||||
|
||||
|
@ -123,7 +123,7 @@ public class GoldLeafCli {
|
|||
}
|
||||
}
|
||||
|
||||
public void runGoldLeafBackend() throws InterruptedException {
|
||||
private void runGoldLeafBackend() throws InterruptedException {
|
||||
Runnable task = new UsbCommunications(filesList,
|
||||
"GoldLeaf"+goldLeafVersion,
|
||||
filterForNsp);
|
||||
|
|
|
@ -27,7 +27,7 @@ public class NxdtCli {
|
|||
private final String[] arguments;
|
||||
private String saveTo;
|
||||
|
||||
public NxdtCli(String[] arguments) throws InterruptedException, IncorrectSetupException{
|
||||
NxdtCli(String[] arguments) throws InterruptedException, IncorrectSetupException{
|
||||
this.arguments = arguments;
|
||||
parseArgument();
|
||||
runBackend();
|
||||
|
|
|
@ -29,7 +29,7 @@ public class TinfoilUsbCli {
|
|||
private final String[] arguments;
|
||||
private List<File> filesList;
|
||||
|
||||
public TinfoilUsbCli(String[] arguments) throws InterruptedException, IncorrectSetupException{
|
||||
TinfoilUsbCli(String[] arguments) throws InterruptedException, IncorrectSetupException{
|
||||
this.arguments = arguments;
|
||||
checkArguments();
|
||||
parseFilesArguments();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue