v0.4:
GoldLeaf v0.5 support added Pay attention! All previous GoldLeaf versions are incompatible with this application
This commit is contained in:
parent
4b2402f801
commit
20e4197e45
4 changed files with 73 additions and 48 deletions
2
pom.xml
2
pom.xml
|
@ -8,7 +8,7 @@
|
|||
<name>NS-USBloader</name>
|
||||
|
||||
<artifactId>ns-usbloader</artifactId>
|
||||
<version>0.3.2-SNAPSHOT</version>
|
||||
<version>0.4-SNAPSHOT</version>
|
||||
|
||||
<url>https://github.com/developersu/ns-usbloader/</url>
|
||||
<description>
|
||||
|
|
|
@ -91,6 +91,7 @@ public class NSLMainController implements Initializable {
|
|||
tableFilesListController.setNewProtocol(choiceProtocol.getSelectionModel().getSelectedItem());
|
||||
if (choiceProtocol.getSelectionModel().getSelectedItem().equals("GoldLeaf")) {
|
||||
choiceNetUsb.setDisable(true);
|
||||
choiceNetUsb.getSelectionModel().select("USB");
|
||||
nsIpLbl.setVisible(false);
|
||||
nsIpTextField.setVisible(false);
|
||||
}
|
||||
|
@ -109,6 +110,7 @@ public class NSLMainController implements Initializable {
|
|||
choiceNetUsb.getSelectionModel().select(AppPreferences.getInstance().getNetUsb());
|
||||
if (choiceProtocol.getSelectionModel().getSelectedItem().equals("GoldLeaf")) {
|
||||
choiceNetUsb.setDisable(true);
|
||||
choiceNetUsb.getSelectionModel().select("USB");
|
||||
}
|
||||
choiceNetUsb.setOnAction(e->{
|
||||
if (choiceNetUsb.getSelectionModel().getSelectedItem().equals("NET")){
|
||||
|
|
|
@ -12,7 +12,7 @@ import java.util.Locale;
|
|||
import java.util.ResourceBundle;
|
||||
|
||||
public class NSLMain extends Application {
|
||||
public static final String appVersion = "v0.3.2";
|
||||
public static final String appVersion = "v0.4";
|
||||
@Override
|
||||
public void start(Stage primaryStage) throws Exception{
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ import javafx.concurrent.Task;
|
|||
import nsusbloader.ModelControllers.LogPrinter;
|
||||
import nsusbloader.NSLDataTypes.EFileStatus;
|
||||
import nsusbloader.NSLDataTypes.EMsgType;
|
||||
import nsusbloader.RainbowHexDump;
|
||||
import nsusbloader.USB.PFS.PFSProvider;
|
||||
import org.usb4java.*;
|
||||
|
||||
|
@ -456,15 +457,16 @@ public class UsbCommunications extends Task<Void> {
|
|||
* */
|
||||
private class GoldLeaf{
|
||||
// CMD G L U C ID 0 0 0
|
||||
private final byte[] CMD_ConnectionRequest = new byte[]{0x47, 0x4c, 0x55, 0x43, 0x00, 0x00, 0x00, 0x00}; // Write-only command
|
||||
private final byte[] CMD_NSPName = new byte[]{0x47, 0x4c, 0x55, 0x43, 0x02, 0x00, 0x00, 0x00}; // Write-only command
|
||||
private final byte[] CMD_NSPData = new byte[]{0x47, 0x4c, 0x55, 0x43, 0x04, 0x00, 0x00, 0x00}; // Write-only command
|
||||
private final byte[] CMD_GLUC = new byte[]{0x47, 0x4c, 0x55, 0x43};
|
||||
private final byte[] CMD_ConnectionRequest = new byte[]{0x00, 0x00, 0x00, 0x00}; // Write-only command
|
||||
private final byte[] CMD_NSPName = new byte[]{0x02, 0x00, 0x00, 0x00}; // Write-only command
|
||||
private final byte[] CMD_NSPData = new byte[]{0x04, 0x00, 0x00, 0x00}; // Write-only command
|
||||
|
||||
private final byte[] CMD_ConnectionResponse = new byte[]{0x47, 0x4c, 0x55, 0x43, 0x01, 0x00, 0x00, 0x00};
|
||||
private final byte[] CMD_Start = new byte[]{0x47, 0x4c, 0x55, 0x43, 0x03, 0x00, 0x00, 0x00};
|
||||
private final byte[] CMD_NSPContent = new byte[]{0x47, 0x4c, 0x55, 0x43, 0x05, 0x00, 0x00, 0x00};
|
||||
private final byte[] CMD_NSPTicket = new byte[]{0x47, 0x4c, 0x55, 0x43, 0x06, 0x00, 0x00, 0x00};
|
||||
private final byte[] CMD_Finish = new byte[]{0x47, 0x4c, 0x55, 0x43, 0x07, 0x00, 0x00, 0x00};
|
||||
private final byte[] CMD_ConnectionResponse = new byte[]{0x01, 0x00, 0x00, 0x00};
|
||||
private final byte[] CMD_Start = new byte[]{0x03, 0x00, 0x00, 0x00};
|
||||
private final byte[] CMD_NSPContent = new byte[]{0x05, 0x00, 0x00, 0x00};
|
||||
private final byte[] CMD_NSPTicket = new byte[]{0x06, 0x00, 0x00, 0x00};
|
||||
private final byte[] CMD_Finish = new byte[]{0x07, 0x00, 0x00, 0x00};
|
||||
|
||||
GoldLeaf(){
|
||||
logPrinter.print("===========================================================================", EMsgType.INFO);
|
||||
|
@ -484,17 +486,26 @@ public class UsbCommunications extends Task<Void> {
|
|||
byte[] readByte;
|
||||
|
||||
// Go connect to GoldLeaf
|
||||
if (writeToUsb(CMD_ConnectionRequest))
|
||||
logPrinter.print("GL Initiating GoldLeaf connection", EMsgType.PASS);
|
||||
if (writeToUsb(CMD_GLUC))
|
||||
logPrinter.print("GL Initiating GoldLeaf connection: 1/2", EMsgType.PASS);
|
||||
else {
|
||||
logPrinter.print("GL Initiating GoldLeaf connection", EMsgType.FAIL);
|
||||
logPrinter.print("GL Initiating GoldLeaf connection: 1/2", EMsgType.FAIL);
|
||||
return false;
|
||||
}
|
||||
if (writeToUsb(CMD_ConnectionRequest))
|
||||
logPrinter.print("GL Initiating GoldLeaf connection: 2/2", EMsgType.PASS);
|
||||
else {
|
||||
logPrinter.print("GL Initiating GoldLeaf connection: 2/2", EMsgType.FAIL);
|
||||
return false;
|
||||
}
|
||||
while (true) {
|
||||
readByte = readFromUsb();
|
||||
if (readByte == null)
|
||||
return false;
|
||||
|
||||
if (Arrays.equals(readByte, CMD_GLUC)) {
|
||||
readByte = readFromUsb();
|
||||
if (readByte == null)
|
||||
return false;
|
||||
if (Arrays.equals(readByte, CMD_ConnectionResponse)) {
|
||||
if (!handleConnectionResponse(pfsElement))
|
||||
return false;
|
||||
|
@ -524,6 +535,7 @@ public class UsbCommunications extends Task<Void> {
|
|||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
|
@ -531,23 +543,28 @@ public class UsbCommunications extends Task<Void> {
|
|||
* */
|
||||
private boolean handleConnectionResponse(PFSProvider pfsElement){
|
||||
logPrinter.print("GL 'ConnectionResponse' command:", EMsgType.INFO);
|
||||
if (!writeToUsb(CMD_NSPName)) {
|
||||
logPrinter.print(" [1/3]", EMsgType.FAIL);
|
||||
if (!writeToUsb(CMD_GLUC)) {
|
||||
logPrinter.print(" [1/4]", EMsgType.FAIL);
|
||||
return false;
|
||||
}
|
||||
logPrinter.print(" [1/3]", EMsgType.PASS);
|
||||
logPrinter.print(" [1/4]", EMsgType.PASS);
|
||||
if (!writeToUsb(CMD_NSPName)) {
|
||||
logPrinter.print(" [2/4]", EMsgType.FAIL);
|
||||
return false;
|
||||
}
|
||||
logPrinter.print(" [2/4]", EMsgType.PASS);
|
||||
|
||||
if (!writeToUsb(pfsElement.getBytesNspFileNameLength())) {
|
||||
logPrinter.print(" [2/3]", EMsgType.FAIL);
|
||||
logPrinter.print(" [3/4]", EMsgType.FAIL);
|
||||
return false;
|
||||
}
|
||||
logPrinter.print(" [2/3]", EMsgType.PASS);
|
||||
logPrinter.print(" [3/4]", EMsgType.PASS);
|
||||
|
||||
if (!writeToUsb(pfsElement.getBytesNspFileName())) {
|
||||
logPrinter.print(" [3/3]", EMsgType.FAIL);
|
||||
logPrinter.print(" [4/4]", EMsgType.FAIL);
|
||||
return false;
|
||||
}
|
||||
logPrinter.print(" [3/3]", EMsgType.PASS);
|
||||
logPrinter.print(" [4/4]", EMsgType.PASS);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -556,6 +573,12 @@ public class UsbCommunications extends Task<Void> {
|
|||
* */
|
||||
private boolean handleStart(PFSProvider pfsElement){
|
||||
logPrinter.print("GL Handle 'Start' command:", EMsgType.INFO);
|
||||
if (!writeToUsb(CMD_GLUC)) {
|
||||
logPrinter.print(" [Send command prepare]", EMsgType.FAIL);
|
||||
return false;
|
||||
}
|
||||
logPrinter.print(" [Send command prepare]", EMsgType.PASS);
|
||||
|
||||
if (!writeToUsb(CMD_NSPData)) {
|
||||
logPrinter.print(" [Send command]", EMsgType.FAIL);
|
||||
return false;
|
||||
|
@ -602,7 +625,7 @@ public class UsbCommunications extends Task<Void> {
|
|||
* */
|
||||
private boolean handleNSPContent(PFSProvider pfsElement, boolean isItRawRequest){
|
||||
int requestedNcaID;
|
||||
boolean isProgessBarInitiated = false;
|
||||
|
||||
if (isItRawRequest) {
|
||||
logPrinter.print("GL Handle 'Content' command", EMsgType.INFO);
|
||||
byte[] readByte = readFromUsb();
|
||||
|
|
Loading…
Reference in a new issue