Now possible to set location of the exported files via Settings.
This commit is contained in:
parent
3fc0aad7a1
commit
4eace88e86
10 changed files with 70 additions and 37 deletions
|
@ -1,5 +1,6 @@
|
||||||
package konogonka;
|
package konogonka;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.util.prefs.Preferences;
|
import java.util.prefs.Preferences;
|
||||||
|
|
||||||
public class AppPreferences {
|
public class AppPreferences {
|
||||||
|
@ -25,6 +26,9 @@ public class AppPreferences {
|
||||||
titleKeysCount = getTitleKeysCount();
|
titleKeysCount = getTitleKeysCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setExtractFilesDir(String path){preferences.put("extract_path", path);}
|
||||||
|
public String getExtractFilesDir(){return preferences.get("extract_path", System.getProperty("user.dir"));}
|
||||||
|
|
||||||
public void setAll(
|
public void setAll(
|
||||||
String xciHeaderKey,
|
String xciHeaderKey,
|
||||||
String headerKey
|
String headerKey
|
||||||
|
|
|
@ -89,7 +89,7 @@ public class MainController implements Initializable {
|
||||||
fileChooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("NS files", "*.nsp", "*.xci", "*.nca", "*.tik", "*.xml", "*.npdm"));
|
fileChooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("NS files", "*.nsp", "*.xci", "*.nca", "*.tik", "*.xml", "*.npdm"));
|
||||||
|
|
||||||
this.selectedFile = fileChooser.showOpenDialog(analyzeBtn.getScene().getWindow());
|
this.selectedFile = fileChooser.showOpenDialog(analyzeBtn.getScene().getWindow());
|
||||||
|
// todo: fix
|
||||||
analyzeBtn.setDisable(true);
|
analyzeBtn.setDisable(true);
|
||||||
NSPTabController.resetTab();
|
NSPTabController.resetTab();
|
||||||
XCITabController.resetTab();
|
XCITabController.resetTab();
|
||||||
|
|
|
@ -6,10 +6,10 @@ import javafx.geometry.Insets;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
import javafx.scene.layout.HBox;
|
import javafx.scene.layout.HBox;
|
||||||
import javafx.scene.layout.VBox;
|
import javafx.scene.layout.VBox;
|
||||||
import konogonka.Tools.NPDM.LCollectionEntry;
|
|
||||||
|
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
public class ServiceAccessControlController implements Initializable {
|
public class ServiceAccessControlController implements Initializable {
|
||||||
|
@ -25,13 +25,12 @@ public class ServiceAccessControlController implements Initializable {
|
||||||
SACPane.getChildren().clear();
|
SACPane.getChildren().clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void populateFields(LinkedList<LCollectionEntry> collection){
|
public void populateFields(LinkedHashMap<String, Byte> collection){
|
||||||
resetTab();
|
resetTab();
|
||||||
|
|
||||||
for (LCollectionEntry entry : collection) {
|
for (Map.Entry entry : collection.entrySet()) {
|
||||||
|
Label control = new Label(String.format("0x%02x", (Byte) entry.getValue()));
|
||||||
Label control = new Label(String.format("0x%02x", entry.getKey()));
|
Label serviceName = new Label((String) entry.getKey());
|
||||||
Label serviceName = new Label(entry.getValue());
|
|
||||||
|
|
||||||
control.setPadding(new Insets(5.0, 5.0, 5.0, 5.0));
|
control.setPadding(new Insets(5.0, 5.0, 5.0, 5.0));
|
||||||
serviceName.setPadding(new Insets(5.0, 5.0, 5.0, 5.0));
|
serviceName.setPadding(new Insets(5.0, 5.0, 5.0, 5.0));
|
||||||
|
|
|
@ -4,6 +4,7 @@ import javafx.concurrent.Task;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.scene.control.Button;
|
import javafx.scene.control.Button;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
|
import konogonka.AppPreferences;
|
||||||
import konogonka.Controllers.IRowModel;
|
import konogonka.Controllers.IRowModel;
|
||||||
import konogonka.Controllers.ITabController;
|
import konogonka.Controllers.ITabController;
|
||||||
import konogonka.MediatorControl;
|
import konogonka.MediatorControl;
|
||||||
|
@ -51,9 +52,7 @@ public class NSPController implements ITabController {
|
||||||
List<IRowModel> models = tableFilesListController.getFilesForDump();
|
List<IRowModel> models = tableFilesListController.getFilesForDump();
|
||||||
ISuperProvider provider = tableFilesListController.getProvider();
|
ISuperProvider provider = tableFilesListController.getProvider();
|
||||||
if (models != null && !models.isEmpty() && (provider != null)){
|
if (models != null && !models.isEmpty() && (provider != null)){
|
||||||
|
File dir = new File(AppPreferences.getInstance().getExtractFilesDir()+File.separator+provider.getFile().getName()+" extracted");
|
||||||
//File dir = new File(System.getProperty("user.dir")+File.separator+selectedFile.getName()+" extracted"); // todo: move option to settings
|
|
||||||
File dir = new File(System.getProperty("user.dir")+File.separator+provider.getFile().getName()+" extracted"); // todo: move option to settings
|
|
||||||
try {
|
try {
|
||||||
dir.mkdir();
|
dir.mkdir();
|
||||||
}
|
}
|
||||||
|
@ -65,7 +64,6 @@ public class NSPController implements ITabController {
|
||||||
|
|
||||||
extractBtn.setDisable(true);
|
extractBtn.setDisable(true);
|
||||||
|
|
||||||
//Extractor extractor = new Extractor(rawFileDataStart, models, dir.getAbsolutePath()+File.separator, selectedFile); //TODO: REMOVE
|
|
||||||
Extractor extractor = new Extractor(provider, models, dir.getAbsolutePath()+File.separator);
|
Extractor extractor = new Extractor(provider, models, dir.getAbsolutePath()+File.separator);
|
||||||
extractor.setOnSucceeded(e->{
|
extractor.setOnSucceeded(e->{
|
||||||
extractBtn.setDisable(false);
|
extractBtn.setDisable(false);
|
||||||
|
|
|
@ -5,6 +5,7 @@ import javafx.fxml.Initializable;
|
||||||
import javafx.scene.control.Button;
|
import javafx.scene.control.Button;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
import javafx.scene.control.TitledPane;
|
import javafx.scene.control.TitledPane;
|
||||||
|
import konogonka.AppPreferences;
|
||||||
import konogonka.Controllers.IRowModel;
|
import konogonka.Controllers.IRowModel;
|
||||||
import konogonka.MediatorControl;
|
import konogonka.MediatorControl;
|
||||||
import konogonka.Tools.ISuperProvider;
|
import konogonka.Tools.ISuperProvider;
|
||||||
|
@ -94,7 +95,7 @@ public class HFSBlockController implements Initializable {
|
||||||
ISuperProvider provider = hfs0tableFilesListMainController.getProvider();
|
ISuperProvider provider = hfs0tableFilesListMainController.getProvider();
|
||||||
|
|
||||||
if (models != null && !models.isEmpty() && (provider != null)){
|
if (models != null && !models.isEmpty() && (provider != null)){
|
||||||
File dir = new File(System.getProperty("user.dir")+File.separator+selectedFile.getName()+" "+type+" extracted");
|
File dir = new File(AppPreferences.getInstance().getExtractFilesDir()+File.separator+selectedFile.getName()+" "+type+" extracted");
|
||||||
try {
|
try {
|
||||||
dir.mkdir();
|
dir.mkdir();
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,10 @@ package konogonka.Settings;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.fxml.Initializable;
|
import javafx.fxml.Initializable;
|
||||||
import javafx.scene.control.Button;
|
import javafx.scene.control.Button;
|
||||||
|
import javafx.scene.control.Label;
|
||||||
import javafx.scene.control.TextField;
|
import javafx.scene.control.TextField;
|
||||||
import javafx.scene.control.TextFormatter;
|
import javafx.scene.control.TextFormatter;
|
||||||
|
import javafx.stage.DirectoryChooser;
|
||||||
import javafx.stage.FileChooser;
|
import javafx.stage.FileChooser;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
import konogonka.AppPreferences;
|
import konogonka.AppPreferences;
|
||||||
|
@ -33,8 +35,22 @@ public class SettingsController implements Initializable {
|
||||||
xciHdrKeyTF,
|
xciHdrKeyTF,
|
||||||
hdrKeyTF;
|
hdrKeyTF;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private Button extractFilesToBtn;
|
||||||
|
@FXML
|
||||||
|
private Label extractFilesPathLbl;
|
||||||
@Override
|
@Override
|
||||||
public void initialize(URL url, ResourceBundle resourceBundle) {
|
public void initialize(URL url, ResourceBundle resourceBundle) {
|
||||||
|
extractFilesPathLbl.setText(AppPreferences.getInstance().getExtractFilesDir());
|
||||||
|
extractFilesToBtn.setOnAction(e -> {
|
||||||
|
DirectoryChooser dirChooser = new DirectoryChooser();
|
||||||
|
dirChooser.setTitle("Extract files to...");
|
||||||
|
dirChooser.setInitialDirectory(new File(System.getProperty("user.home")));
|
||||||
|
File dir = dirChooser.showDialog(extractFilesToBtn.getScene().getWindow());
|
||||||
|
if (dir != null && dir.exists())
|
||||||
|
extractFilesPathLbl.setText(dir.getAbsolutePath());
|
||||||
|
});
|
||||||
|
|
||||||
ListSelectorKAEKAppController.initSelector(32, "key_area_key_application_");
|
ListSelectorKAEKAppController.initSelector(32, "key_area_key_application_");
|
||||||
ListSelectorKAEKOceanController.initSelector(32, "key_area_key_ocean_");
|
ListSelectorKAEKOceanController.initSelector(32, "key_area_key_ocean_");
|
||||||
ListSelectorKAEKSysController.initSelector(32, "key_area_key_system_");
|
ListSelectorKAEKSysController.initSelector(32, "key_area_key_system_");
|
||||||
|
@ -227,6 +243,7 @@ public class SettingsController implements Initializable {
|
||||||
for (int i = 0; i < titleKeysSet.length; i++)
|
for (int i = 0; i < titleKeysSet.length; i++)
|
||||||
AppPreferences.getInstance().setTitleKey(i, titleKeysSet[i]);
|
AppPreferences.getInstance().setTitleKey(i, titleKeysSet[i]);
|
||||||
}
|
}
|
||||||
|
AppPreferences.getInstance().setExtractFilesDir(extractFilesPathLbl.getText());
|
||||||
thisStage.close();
|
thisStage.close();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
package konogonka.Tools.NPDM.ACID;
|
package konogonka.Tools.NPDM.ACID;
|
||||||
|
|
||||||
|
import konogonka.RainbowHexDump;
|
||||||
|
|
||||||
public class KernelAccessControlProvider {
|
public class KernelAccessControlProvider {
|
||||||
|
|
||||||
KernelAccessControlProvider(byte[] bytes){
|
KernelAccessControlProvider(byte[] bytes){
|
||||||
|
RainbowHexDump.hexDumpUTF8(bytes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +1,14 @@
|
||||||
package konogonka.Tools.NPDM.ACID;
|
package konogonka.Tools.NPDM.ACID;
|
||||||
|
|
||||||
import konogonka.Tools.NPDM.LCollectionEntry;
|
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedHashMap;
|
||||||
|
|
||||||
public class ServiceAccessControlProvider {
|
public class ServiceAccessControlProvider {
|
||||||
|
|
||||||
private LinkedList<LCollectionEntry> collection;
|
private LinkedHashMap<String, Byte> collection;
|
||||||
|
|
||||||
public ServiceAccessControlProvider(byte[] bytes){
|
public ServiceAccessControlProvider(byte[] bytes){
|
||||||
collection = new LinkedList<>();
|
collection = new LinkedHashMap<>();
|
||||||
byte key;
|
byte key;
|
||||||
String value;
|
String value;
|
||||||
|
|
||||||
|
@ -19,7 +17,7 @@ public class ServiceAccessControlProvider {
|
||||||
while (i < bytes.length){
|
while (i < bytes.length){
|
||||||
key = bytes[i];
|
key = bytes[i];
|
||||||
value = new String(bytes, i+1, getSize(key), StandardCharsets.UTF_8);
|
value = new String(bytes, i+1, getSize(key), StandardCharsets.UTF_8);
|
||||||
collection.add(new LCollectionEntry(key, value));
|
collection.put(value, key);
|
||||||
i += getSize(key)+1;
|
i += getSize(key)+1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,5 +26,5 @@ public class ServiceAccessControlProvider {
|
||||||
return ((byte) 0x7 & control) + (byte) 0x01;
|
return ((byte) 0x7 & control) + (byte) 0x01;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LinkedList<LCollectionEntry> getCollection() { return collection; }
|
public LinkedHashMap<String, Byte> getCollection() { return collection; }
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
package konogonka.Tools.NPDM;
|
|
||||||
|
|
||||||
public class LCollectionEntry {
|
|
||||||
private byte key;
|
|
||||||
private String value;
|
|
||||||
|
|
||||||
public LCollectionEntry(byte key, String value){
|
|
||||||
this.key = key;
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public byte getKey() { return key; }
|
|
||||||
|
|
||||||
public String getValue() { return value; }
|
|
||||||
}
|
|
|
@ -22,7 +22,36 @@
|
||||||
<content>
|
<content>
|
||||||
<ScrollPane fitToWidth="true">
|
<ScrollPane fitToWidth="true">
|
||||||
<content>
|
<content>
|
||||||
<VBox prefHeight="200.0" prefWidth="100.0" spacing="5.0">
|
<VBox spacing="5.0">
|
||||||
|
<padding>
|
||||||
|
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||||
|
</padding>
|
||||||
|
<children>
|
||||||
|
<HBox alignment="CENTER_LEFT" spacing="5.0">
|
||||||
|
<children>
|
||||||
|
<Button fx:id="extractFilesToBtn" mnemonicParsing="false" text="Extract files to:" />
|
||||||
|
<Label fx:id="extractFilesPathLbl" />
|
||||||
|
</children>
|
||||||
|
</HBox>
|
||||||
|
</children>
|
||||||
|
</VBox>
|
||||||
|
</content>
|
||||||
|
</ScrollPane>
|
||||||
|
</content>
|
||||||
|
<graphic>
|
||||||
|
<VBox alignment="TOP_CENTER" spacing="5.0">
|
||||||
|
<children>
|
||||||
|
<SVGPath content="M12,15.5A3.5,3.5 0 0,1 8.5,12A3.5,3.5 0 0,1 12,8.5A3.5,3.5 0 0,1 15.5,12A3.5,3.5 0 0,1 12,15.5M19.43,12.97C19.47,12.65 19.5,12.33 19.5,12C19.5,11.67 19.47,11.34 19.43,11L21.54,9.37C21.73,9.22 21.78,8.95 21.66,8.73L19.66,5.27C19.54,5.05 19.27,4.96 19.05,5.05L16.56,6.05C16.04,5.66 15.5,5.32 14.87,5.07L14.5,2.42C14.46,2.18 14.25,2 14,2H10C9.75,2 9.54,2.18 9.5,2.42L9.13,5.07C8.5,5.32 7.96,5.66 7.44,6.05L4.95,5.05C4.73,4.96 4.46,5.05 4.34,5.27L2.34,8.73C2.21,8.95 2.27,9.22 2.46,9.37L4.57,11C4.53,11.34 4.5,11.67 4.5,12C4.5,12.33 4.53,12.65 4.57,12.97L2.46,14.63C2.27,14.78 2.21,15.05 2.34,15.27L4.34,18.73C4.46,18.95 4.73,19.03 4.95,18.95L7.44,17.94C7.96,18.34 8.5,18.68 9.13,18.93L9.5,21.58C9.54,21.82 9.75,22 10,22H14C14.25,22 14.46,21.82 14.5,21.58L14.87,18.93C15.5,18.67 16.04,18.34 16.56,17.94L19.05,18.95C19.27,19.03 19.54,18.95 19.66,18.73L21.66,15.27C21.78,15.05 21.73,14.78 21.54,14.63L19.43,12.97Z" />
|
||||||
|
<Label text="Application" />
|
||||||
|
</children>
|
||||||
|
</VBox>
|
||||||
|
</graphic>
|
||||||
|
</Tab>
|
||||||
|
<Tab closable="false">
|
||||||
|
<content>
|
||||||
|
<ScrollPane fitToWidth="true">
|
||||||
|
<content>
|
||||||
|
<VBox prefHeight="100.0" spacing="5.0">
|
||||||
<children>
|
<children>
|
||||||
<Label text="Used for XCI" />
|
<Label text="Used for XCI" />
|
||||||
<HBox alignment="CENTER_LEFT" spacing="5.0">
|
<HBox alignment="CENTER_LEFT" spacing="5.0">
|
||||||
|
|
Loading…
Reference in a new issue