Fix few errors, make app to be in line with current libKonogonka implementation
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone Build is passing

This commit is contained in:
Dmitry Isaenko 2022-09-25 15:22:08 +03:00
parent 9a80d759e9
commit dc45dabd34
6 changed files with 28 additions and 34 deletions

View file

@ -115,9 +115,9 @@ public class NPDMController implements ITabController {
public void analyze(File file) { analyze(file, 0); }
@Override
public void analyze(ISuperProvider parentProvider, int fileNo) throws Exception {
Task analyzer = Analyzer.analyzeNPDM(parentProvider, fileNo);
Task<NPDMProvider> analyzer = Analyzer.analyzeNPDM(parentProvider, fileNo);
analyzer.setOnSucceeded(e->{
NPDMProvider npdm = (NPDMProvider) analyzer.getValue();
NPDMProvider npdm = analyzer.getValue();
setData(npdm, null);
});
Thread workThread = new Thread(analyzer);
@ -126,9 +126,9 @@ public class NPDMController implements ITabController {
}
@Override
public void analyze(File file, long offset) {
Task analyzer = Analyzer.analyzeNPDM(file, offset);
Task<NPDMProvider> analyzer = Analyzer.analyzeNPDM(file, offset);
analyzer.setOnSucceeded(e->{
NPDMProvider npdm = (NPDMProvider) analyzer.getValue();
NPDMProvider npdm = analyzer.getValue();
if (offset == 0)
setData(npdm, file);
else

View file

@ -29,9 +29,9 @@ import libKonogonka.Tools.ISuperProvider;
import libKonogonka.Tools.RomFs.FileSystemEntry;
import libKonogonka.Tools.RomFs.IRomFsProvider;
import libKonogonka.Tools.RomFs.Level6Header;
import libKonogonka.Tools.RomFs.RomFsDecryptedProvider;
import konogonka.Workers.Analyzer;
import konogonka.Workers.DumbRomFsExtractor;
import libKonogonka.Tools.RomFs.RomFsProvider;
import java.io.File;
import java.net.URL;
@ -155,9 +155,9 @@ public class RomFsController implements ITabController {
catch (Exception e){
e.printStackTrace();
}
Task<RomFsDecryptedProvider> analyzer = Analyzer.analyzeRomFS(file, lv6offset);
Task<RomFsProvider> analyzer = Analyzer.analyzeRomFS(file, lv6offset);
analyzer.setOnSucceeded(e->{
RomFsDecryptedProvider provider = analyzer.getValue();
RomFsProvider provider = analyzer.getValue();
this.setData(provider);
});
Thread workThread = new Thread(analyzer);

View file

@ -157,13 +157,8 @@ public class Hfs0TableViewController implements Initializable {
}
});
uploadColumn.setCellFactory(new Callback<TableColumn<Hfs0RowModel, Boolean>, TableCell<Hfs0RowModel, Boolean>>() {
@Override
public TableCell<Hfs0RowModel, Boolean> call(TableColumn<Hfs0RowModel, Boolean> paramFeatures) {
CheckBoxTableCell<Hfs0RowModel, Boolean> cell = new CheckBoxTableCell<>();
return cell;
}
});
uploadColumn.setCellFactory(paramFeatures -> new CheckBoxTableCell<>());
table.setRowFactory( // this shit is made to implement context menu. It's such a pain..
new Callback<TableView<Hfs0RowModel>, TableRow<Hfs0RowModel>>() {
@Override
@ -185,16 +180,14 @@ public class Hfs0TableViewController implements Initializable {
row.contextMenuProperty().bind(
Bindings.when(Bindings.isNotNull(row.itemProperty())).then(contextMenu).otherwise((ContextMenu)null)
);
row.setOnMouseClicked(new EventHandler<MouseEvent>() { // Just.. don't ask..
@Override
public void handle(MouseEvent mouseEvent) {
if (!row.isEmpty() && mouseEvent.getButton() == MouseButton.PRIMARY){
Hfs0RowModel thisItem = row.getItem();
thisItem.setMarkSelected(!thisItem.isMarkSelected());
table.refresh();
}
mouseEvent.consume();
// Just.. don't ask..
row.setOnMouseClicked(mouseEvent -> {
if (!row.isEmpty() && mouseEvent.getButton() == MouseButton.PRIMARY){
Hfs0RowModel thisItem = row.getItem();
thisItem.setMarkSelected(!thisItem.isMarkSelected());
table.refresh();
}
mouseEvent.consume();
});
return row;
}

View file

@ -117,9 +117,9 @@ public class XCIController implements ITabController {
public void analyze(File selectedFile){
HFSBlockController.setSelectedFile(selectedFile);
Task analyzer = Analyzer.analyzeXCI(selectedFile, AppPreferences.getInstance().getXciHeaderKey());
Task<XCIProvider> analyzer = Analyzer.analyzeXCI(selectedFile, AppPreferences.getInstance().getXciHeaderKey());
analyzer.setOnSucceeded(e->{
populateFields((XCIProvider) analyzer.getValue());
populateFields(analyzer.getValue());
});
Thread workThread = new Thread(analyzer);
workThread.setDaemon(true);

View file

@ -27,6 +27,7 @@ import konogonka.MainFx;
import java.io.IOException;
import java.util.Locale;
import java.util.Objects;
import java.util.ResourceBundle;
public class SettingsWindow {
@ -50,10 +51,10 @@ public class SettingsWindow {
stageSettings.setTitle(resourceBundle.getString("settings_SettingsName"));
stageSettings.getIcons().addAll(
new Image(MainFx.class.getResourceAsStream("/res/settings_icon32x32.png")),
new Image(MainFx.class.getResourceAsStream("/res/settings_icon48x48.png")),
new Image(MainFx.class.getResourceAsStream("/res/settings_icon64x64.png")),
new Image(MainFx.class.getResourceAsStream("/res/settings_icon128x128.png"))
new Image(Objects.requireNonNull(MainFx.class.getResourceAsStream("/res/settings_icon32x32.png"))),
new Image(Objects.requireNonNull(MainFx.class.getResourceAsStream("/res/settings_icon48x48.png"))),
new Image(Objects.requireNonNull(MainFx.class.getResourceAsStream("/res/settings_icon64x64.png"))),
new Image(Objects.requireNonNull(MainFx.class.getResourceAsStream("/res/settings_icon128x128.png")))
);
Scene settingsScene = new Scene(parentAbout, 800, 800);

View file

@ -25,7 +25,7 @@ import libKonogonka.Tools.ISuperProvider;
import libKonogonka.Tools.NCA.NCAProvider;
import libKonogonka.Tools.NPDM.NPDMProvider;
import libKonogonka.Tools.PFS0.PFS0Provider;
import libKonogonka.Tools.RomFs.RomFsDecryptedProvider;
import libKonogonka.Tools.RomFs.RomFsProvider;
import libKonogonka.Tools.TIK.TIKProvider;
import libKonogonka.Tools.XCI.XCIProvider;
@ -161,14 +161,14 @@ public class Analyzer {
};
}
public static Task<RomFsDecryptedProvider> analyzeRomFS(File file, long lv6offset){
public static Task<RomFsProvider> analyzeRomFS(File file, long lv6offset){
LogPrinter logPrinter = new LogPrinter();
return new Task<RomFsDecryptedProvider>() {
return new Task<RomFsProvider>() {
@Override
protected RomFsDecryptedProvider call() {
protected RomFsProvider call() {
logPrinter.print("\tStart chain: RomFS", EMsgType.INFO);
try {
return new RomFsDecryptedProvider(file, lv6offset);
return new RomFsProvider(file, lv6offset);
} catch (Exception e) {
logPrinter.print(e.getMessage(), EMsgType.FAIL);
return null;