Correct application to be in line with rapidly changing libKonogonka [so-called] api
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
dc45dabd34
commit
f7d3317bf5
12 changed files with 73 additions and 160 deletions
30
pom.xml
30
pom.xml
|
@ -54,28 +54,28 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.openjfx</groupId>
|
<groupId>org.openjfx</groupId>
|
||||||
<artifactId>javafx-controls</artifactId>
|
<artifactId>javafx-controls</artifactId>
|
||||||
<version>11</version>
|
<version>19</version>
|
||||||
<classifier>linux</classifier>
|
<classifier>linux</classifier>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.openjfx</groupId>
|
<groupId>org.openjfx</groupId>
|
||||||
<artifactId>javafx-media</artifactId>
|
<artifactId>javafx-media</artifactId>
|
||||||
<version>11</version>
|
<version>19</version>
|
||||||
<classifier>linux</classifier>
|
<classifier>linux</classifier>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.openjfx</groupId>
|
<groupId>org.openjfx</groupId>
|
||||||
<artifactId>javafx-fxml</artifactId>
|
<artifactId>javafx-fxml</artifactId>
|
||||||
<version>11</version>
|
<version>19</version>
|
||||||
<classifier>linux</classifier>
|
<classifier>linux</classifier>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.openjfx</groupId>
|
<groupId>org.openjfx</groupId>
|
||||||
<artifactId>javafx-graphics</artifactId>
|
<artifactId>javafx-graphics</artifactId>
|
||||||
<version>11</version>
|
<version>19</version>
|
||||||
<classifier>linux</classifier>
|
<classifier>linux</classifier>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
@ -83,28 +83,28 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.openjfx</groupId>
|
<groupId>org.openjfx</groupId>
|
||||||
<artifactId>javafx-controls</artifactId>
|
<artifactId>javafx-controls</artifactId>
|
||||||
<version>11</version>
|
<version>19</version>
|
||||||
<classifier>win</classifier>
|
<classifier>win</classifier>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.openjfx</groupId>
|
<groupId>org.openjfx</groupId>
|
||||||
<artifactId>javafx-media</artifactId>
|
<artifactId>javafx-media</artifactId>
|
||||||
<version>11</version>
|
<version>19</version>
|
||||||
<classifier>win</classifier>
|
<classifier>win</classifier>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.openjfx</groupId>
|
<groupId>org.openjfx</groupId>
|
||||||
<artifactId>javafx-fxml</artifactId>
|
<artifactId>javafx-fxml</artifactId>
|
||||||
<version>11</version>
|
<version>19</version>
|
||||||
<classifier>win</classifier>
|
<classifier>win</classifier>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.openjfx</groupId>
|
<groupId>org.openjfx</groupId>
|
||||||
<artifactId>javafx-graphics</artifactId>
|
<artifactId>javafx-graphics</artifactId>
|
||||||
<version>11</version>
|
<version>19</version>
|
||||||
<classifier>win</classifier>
|
<classifier>win</classifier>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
@ -112,28 +112,28 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.openjfx</groupId>
|
<groupId>org.openjfx</groupId>
|
||||||
<artifactId>javafx-controls</artifactId>
|
<artifactId>javafx-controls</artifactId>
|
||||||
<version>11</version>
|
<version>19</version>
|
||||||
<classifier>mac</classifier>
|
<classifier>mac</classifier>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.openjfx</groupId>
|
<groupId>org.openjfx</groupId>
|
||||||
<artifactId>javafx-media</artifactId>
|
<artifactId>javafx-media</artifactId>
|
||||||
<version>11</version>
|
<version>19</version>
|
||||||
<classifier>mac</classifier>
|
<classifier>mac</classifier>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.openjfx</groupId>
|
<groupId>org.openjfx</groupId>
|
||||||
<artifactId>javafx-fxml</artifactId>
|
<artifactId>javafx-fxml</artifactId>
|
||||||
<version>11</version>
|
<version>19</version>
|
||||||
<classifier>mac</classifier>
|
<classifier>mac</classifier>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.openjfx</groupId>
|
<groupId>org.openjfx</groupId>
|
||||||
<artifactId>javafx-graphics</artifactId>
|
<artifactId>javafx-graphics</artifactId>
|
||||||
<version>11</version>
|
<version>19</version>
|
||||||
<classifier>mac</classifier>
|
<classifier>mac</classifier>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
@ -148,19 +148,19 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.junit.jupiter</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit-jupiter-engine</artifactId>
|
<artifactId>junit-jupiter-engine</artifactId>
|
||||||
<version>5.5.2</version>
|
<version>5.9.0</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.junit.jupiter</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit-jupiter-api</artifactId>
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
<version>5.5.2</version>
|
<version>5.9.0</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.junit.jupiter</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit-jupiter-params</artifactId>
|
<artifactId>junit-jupiter-params</artifactId>
|
||||||
<version>5.5.2</version>
|
<version>5.9.0</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- Consider removing
|
<!-- Consider removing
|
||||||
|
|
|
@ -30,6 +30,7 @@ import libKonogonka.Tools.ISuperProvider;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
public class ChildWindow {
|
public class ChildWindow {
|
||||||
|
@ -69,11 +70,11 @@ public class ChildWindow {
|
||||||
|
|
||||||
// TODO: fix?
|
// TODO: fix?
|
||||||
if(model.getFileName().endsWith(".xml")){
|
if(model.getFileName().endsWith(".xml")){
|
||||||
XMLController myController = loaderSettings.<XMLController>getController();
|
XMLController myController = loaderSettings.getController();
|
||||||
myController.analyze(provider.getFile(), provider.getRawFileDataStart()+model.getFileOffset(), model.getFileSize());
|
myController.analyze(provider.getFile(), provider.getRawFileDataStart()+model.getFileOffset(), model.getFileSize());
|
||||||
}
|
}
|
||||||
else if (model.getFileName().endsWith(".npdm")){
|
else if (model.getFileName().endsWith(".npdm")){
|
||||||
ITabController myController = loaderSettings.<ITabController>getController();
|
ITabController myController = loaderSettings.getController();
|
||||||
try {
|
try {
|
||||||
myController.analyze(provider, model.getNumber());
|
myController.analyze(provider, model.getNumber());
|
||||||
}
|
}
|
||||||
|
@ -82,17 +83,17 @@ public class ChildWindow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ITabController myController = loaderSettings.<ITabController>getController();
|
ITabController myController = loaderSettings.getController();
|
||||||
myController.analyze(provider.getFile(), provider.getRawFileDataStart()+model.getFileOffset());
|
myController.analyze(provider.getFile(), provider.getRawFileDataStart()+model.getFileOffset());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
stageSettings.setTitle(model.getFileName());
|
stageSettings.setTitle(model.getFileName());
|
||||||
stageSettings.getIcons().addAll(
|
stageSettings.getIcons().addAll(
|
||||||
new Image(getClass().getResourceAsStream("/res/app_icon32x32.png")),
|
new Image(Objects.requireNonNull(getClass().getResourceAsStream("/res/app_icon32x32.png"))),
|
||||||
new Image(getClass().getResourceAsStream("/res/app_icon48x48.png")),
|
new Image(Objects.requireNonNull(getClass().getResourceAsStream("/res/app_icon48x48.png"))),
|
||||||
new Image(getClass().getResourceAsStream("/res/app_icon64x64.png")),
|
new Image(Objects.requireNonNull(getClass().getResourceAsStream("/res/app_icon64x64.png"))),
|
||||||
new Image(getClass().getResourceAsStream("/res/app_icon128x128.png"))
|
new Image(Objects.requireNonNull(getClass().getResourceAsStream("/res/app_icon128x128.png")))
|
||||||
);
|
);
|
||||||
Scene settingsScene = new Scene(parentAbout, 800, 800);
|
Scene settingsScene = new Scene(parentAbout, 800, 800);
|
||||||
settingsScene.getStylesheets().add("/res/app_light.css");
|
settingsScene.getStylesheets().add("/res/app_light.css");
|
||||||
|
|
|
@ -262,7 +262,6 @@ public class MainController implements Initializable {
|
||||||
catch (IOException e){
|
catch (IOException e){
|
||||||
logArea.appendText("\nUnable to create windows for "+model.getFileName()+"\n"+e.getMessage());
|
logArea.appendText("\nUnable to create windows for "+model.getFileName()+"\n"+e.getMessage());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
|
||||||
public void exit(){ AppPreferences.getInstance().setRecentPath(previouslyOpenedPath); }
|
public void exit(){ AppPreferences.getInstance().setRecentPath(previouslyOpenedPath); }
|
||||||
}
|
}
|
|
@ -33,7 +33,7 @@ import libKonogonka.Converter;
|
||||||
import konogonka.MediatorControl;
|
import konogonka.MediatorControl;
|
||||||
import libKonogonka.Tools.NCA.NCAContent;
|
import libKonogonka.Tools.NCA.NCAContent;
|
||||||
import konogonka.Workers.DumbNCA3ContentExtractor;
|
import konogonka.Workers.DumbNCA3ContentExtractor;
|
||||||
import libKonogonka.Tools.PFS0.IPFS0Provider;
|
import libKonogonka.Tools.PFS0.PFS0Provider;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
@ -86,7 +86,7 @@ public class NCASectionContentController implements Initializable {
|
||||||
if (ncaContent.getPfs0() != null)
|
if (ncaContent.getPfs0() != null)
|
||||||
SectionPFS0Controller.setData(ncaContent.getPfs0(), null);;
|
SectionPFS0Controller.setData(ncaContent.getPfs0(), null);;
|
||||||
|
|
||||||
IPFS0Provider ipfs0Provider = ncaContent.getPfs0();
|
PFS0Provider ipfs0Provider = ncaContent.getPfs0();
|
||||||
|
|
||||||
if (ipfs0Provider == null)
|
if (ipfs0Provider == null)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -27,7 +27,6 @@ import konogonka.Controllers.IRowModel;
|
||||||
import konogonka.Controllers.ITabController;
|
import konogonka.Controllers.ITabController;
|
||||||
import konogonka.MediatorControl;
|
import konogonka.MediatorControl;
|
||||||
import libKonogonka.Tools.ISuperProvider;
|
import libKonogonka.Tools.ISuperProvider;
|
||||||
import libKonogonka.Tools.PFS0.IPFS0Provider;
|
|
||||||
import libKonogonka.Tools.PFS0.PFS0Provider;
|
import libKonogonka.Tools.PFS0.PFS0Provider;
|
||||||
import konogonka.Workers.Analyzer;
|
import konogonka.Workers.Analyzer;
|
||||||
import konogonka.Workers.Extractor;
|
import konogonka.Workers.Extractor;
|
||||||
|
@ -70,7 +69,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(AppPreferences.getInstance().getExtractFilesDir()+File.separator+provider+" extracted");
|
||||||
try {
|
try {
|
||||||
dir.mkdir();
|
dir.mkdir();
|
||||||
}
|
}
|
||||||
|
@ -132,12 +131,12 @@ public class NSPController implements ITabController {
|
||||||
/**
|
/**
|
||||||
* Just populate fields by already analyzed PFS0
|
* Just populate fields by already analyzed PFS0
|
||||||
* */
|
* */
|
||||||
public void setData(IPFS0Provider pfs0, File fileWithNca){
|
public void setData(PFS0Provider pfs0, File fileWithNca){
|
||||||
if (pfs0 == null)
|
if (pfs0 == null)
|
||||||
return;
|
return;
|
||||||
this.selectedFile = fileWithNca;
|
this.selectedFile = fileWithNca;
|
||||||
|
|
||||||
filesCountLbl.setText(Integer.toString(pfs0.getFilesCount()));
|
filesCountLbl.setText(Integer.toString(pfs0.getHeader().getFilesCount()));
|
||||||
RawDataStartLbl.setText(Long.toString(pfs0.getRawFileDataStart()));
|
RawDataStartLbl.setText(Long.toString(pfs0.getRawFileDataStart()));
|
||||||
rawFileDataStart = pfs0.getRawFileDataStart();
|
rawFileDataStart = pfs0.getRawFileDataStart();
|
||||||
tableFilesListController.setNSPToTable(pfs0);
|
tableFilesListController.setNSPToTable(pfs0);
|
||||||
|
@ -147,13 +146,14 @@ public class NSPController implements ITabController {
|
||||||
NSPSizeLbl.setText(Long.toString(selectedFile.length()));
|
NSPSizeLbl.setText(Long.toString(selectedFile.length()));
|
||||||
|
|
||||||
extractBtn.setDisable(false);
|
extractBtn.setDisable(false);
|
||||||
magicLbl.setText(pfs0.getMagic());
|
magicLbl.setText(pfs0.getHeader().getMagic());
|
||||||
stringTableSizeLbl.setText(Integer.toString(pfs0.getStringTableSize()));
|
stringTableSizeLbl.setText(Integer.toString(pfs0.getHeader().getStringTableSize()));
|
||||||
paddingLbl.setText(byteArrToHexString(pfs0.getPadding()));
|
paddingLbl.setText(byteArrToHexString(pfs0.getHeader().getPadding()));
|
||||||
|
|
||||||
fileEntryTableSizeLbl.setText(String.format("0x%02x", 0x18* pfs0.getFilesCount()));
|
fileEntryTableSizeLbl.setText(String.format("0x%02x", 0x18* pfs0.getHeader().getFilesCount()));
|
||||||
stringsTableSizeLbl.setText(String.format("0x%02x", pfs0.getStringTableSize()));
|
stringsTableSizeLbl.setText(String.format("0x%02x", pfs0.getHeader().getStringTableSize()));
|
||||||
stringsTableOffsetLbl.setText(String.format("0x%02x", 0x18* pfs0.getFilesCount()+0x10));
|
stringsTableOffsetLbl.setText(String.format("0x%02x", 0x18* pfs0.getHeader().getFilesCount()+0x10));
|
||||||
rawFileDataOffsetLbl.setText(String.format("0x%02x", 0x18* pfs0.getFilesCount()+0x10+ pfs0.getStringTableSize())); // same to RawFileDataStart for NSP ONLY
|
rawFileDataOffsetLbl.setText(String.format("0x%02x", 0x18* pfs0.getHeader().getFilesCount()+0x10+
|
||||||
|
pfs0.getHeader().getStringTableSize())); // same to RawFileDataStart for NSP ONLY
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,8 @@ import javafx.scene.input.MouseButton;
|
||||||
import konogonka.Controllers.IRowModel;
|
import konogonka.Controllers.IRowModel;
|
||||||
import konogonka.MediatorControl;
|
import konogonka.MediatorControl;
|
||||||
import libKonogonka.Tools.ISuperProvider;
|
import libKonogonka.Tools.ISuperProvider;
|
||||||
import libKonogonka.Tools.PFS0.IPFS0Provider;
|
import libKonogonka.Tools.PFS0.PFS0Provider;
|
||||||
|
import libKonogonka.Tools.PFS0.PFS0subFile;
|
||||||
|
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -166,7 +167,7 @@ public class Pfs0TableViewController implements Initializable {
|
||||||
/**
|
/**
|
||||||
* Add files when user selected them
|
* Add files when user selected them
|
||||||
* */
|
* */
|
||||||
public void setNSPToTable(IPFS0Provider pfs){
|
public void setNSPToTable(PFS0Provider pfs){
|
||||||
this.provider = pfs;
|
this.provider = pfs;
|
||||||
rowsObsLst.clear();
|
rowsObsLst.clear();
|
||||||
Pfs0RowModel.resetNumCnt();
|
Pfs0RowModel.resetNumCnt();
|
||||||
|
@ -174,12 +175,12 @@ public class Pfs0TableViewController implements Initializable {
|
||||||
table.refresh();
|
table.refresh();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
PFS0subFile pfs0subFiles[] = pfs.getHeader().getPfs0subFiles();
|
||||||
for (int i=0; i < pfs.getFilesCount(); i++){
|
for (int i=0; i < pfs.getHeader().getFilesCount(); i++){
|
||||||
rowsObsLst.add(new Pfs0RowModel(
|
rowsObsLst.add(new Pfs0RowModel(
|
||||||
pfs.getPfs0subFiles()[i].getName(),
|
pfs0subFiles[i].getName(),
|
||||||
pfs.getPfs0subFiles()[i].getSize(),
|
pfs0subFiles[i].getSize(),
|
||||||
pfs.getPfs0subFiles()[i].getOffset()
|
pfs0subFiles[i].getOffset()
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
table.refresh();
|
table.refresh();
|
||||||
|
|
|
@ -27,7 +27,6 @@ import konogonka.Controllers.ITabController;
|
||||||
import konogonka.MediatorControl;
|
import konogonka.MediatorControl;
|
||||||
import libKonogonka.Tools.ISuperProvider;
|
import libKonogonka.Tools.ISuperProvider;
|
||||||
import libKonogonka.Tools.RomFs.FileSystemEntry;
|
import libKonogonka.Tools.RomFs.FileSystemEntry;
|
||||||
import libKonogonka.Tools.RomFs.IRomFsProvider;
|
|
||||||
import libKonogonka.Tools.RomFs.Level6Header;
|
import libKonogonka.Tools.RomFs.Level6Header;
|
||||||
import konogonka.Workers.Analyzer;
|
import konogonka.Workers.Analyzer;
|
||||||
import konogonka.Workers.DumbRomFsExtractor;
|
import konogonka.Workers.DumbRomFsExtractor;
|
||||||
|
@ -66,7 +65,7 @@ public class RomFsController implements ITabController {
|
||||||
@FXML
|
@FXML
|
||||||
private TreeView<RFSModelEntry> filesTreeView;
|
private TreeView<RFSModelEntry> filesTreeView;
|
||||||
|
|
||||||
private IRomFsProvider provider;
|
private RomFsProvider provider;
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private RFSFolderTableViewController RFSTableViewController;
|
private RFSFolderTableViewController RFSTableViewController;
|
||||||
|
@ -87,7 +86,7 @@ public class RomFsController implements ITabController {
|
||||||
extractBtn.setOnAction(event -> extractSelectedBtn());
|
extractBtn.setOnAction(event -> extractSelectedBtn());
|
||||||
}
|
}
|
||||||
private void extractRootBtn(){
|
private void extractRootBtn(){
|
||||||
File dir = new File(AppPreferences.getInstance().getExtractFilesDir()+File.separator+ provider.getFile().getName()+" extracted");
|
File dir = new File(AppPreferences.getInstance().getExtractFilesDir()+File.separator+provider.toString()+" extracted");
|
||||||
try {
|
try {
|
||||||
dir.mkdir();
|
dir.mkdir();
|
||||||
}
|
}
|
||||||
|
@ -164,7 +163,7 @@ public class RomFsController implements ITabController {
|
||||||
workThread.start();
|
workThread.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setData(IRomFsProvider provider) {
|
public void setData(RomFsProvider provider) {
|
||||||
try {
|
try {
|
||||||
this.provider = provider;
|
this.provider = provider;
|
||||||
Level6Header header = provider.getHeader();
|
Level6Header header = provider.getHeader();
|
||||||
|
|
|
@ -25,13 +25,13 @@ public class Hfs0RowModel implements IRowModel {
|
||||||
private static int numberCnt = 0;
|
private static int numberCnt = 0;
|
||||||
public static void resetNumCnt(){ numberCnt = 0; }
|
public static void resetNumCnt(){ numberCnt = 0; }
|
||||||
|
|
||||||
private int number;
|
private final int number;
|
||||||
private String fileName;
|
private final String fileName;
|
||||||
private long fileSize;
|
private final long fileSize;
|
||||||
private long fileOffset;
|
private final long fileOffset;
|
||||||
private long hashedRegionSize;
|
private final long hashedRegionSize;
|
||||||
private boolean padding;
|
private final boolean padding;
|
||||||
private String SHA256Hash;
|
private final String SHA256Hash;
|
||||||
private boolean markForUpload;
|
private boolean markForUpload;
|
||||||
|
|
||||||
Hfs0RowModel(String fileName, long size, long offset, long hashedRegionSize, boolean padding, byte[] SHA256Hash){
|
Hfs0RowModel(String fileName, long size, long offset, long hashedRegionSize, boolean padding, byte[] SHA256Hash){
|
||||||
|
|
|
@ -34,7 +34,6 @@ import javafx.scene.control.cell.PropertyValueFactory;
|
||||||
import javafx.scene.input.KeyCode;
|
import javafx.scene.input.KeyCode;
|
||||||
import javafx.scene.input.KeyEvent;
|
import javafx.scene.input.KeyEvent;
|
||||||
import javafx.scene.input.MouseButton;
|
import javafx.scene.input.MouseButton;
|
||||||
import javafx.scene.input.MouseEvent;
|
|
||||||
import javafx.util.Callback;
|
import javafx.util.Callback;
|
||||||
import konogonka.Controllers.IRowModel;
|
import konogonka.Controllers.IRowModel;
|
||||||
import konogonka.MediatorControl;
|
import konogonka.MediatorControl;
|
||||||
|
|
|
@ -107,7 +107,7 @@ public class Analyzer {
|
||||||
protected NPDMProvider call() {
|
protected NPDMProvider call() {
|
||||||
logPrinter.print("\tStart chain: NPDM [stream]", EMsgType.INFO);
|
logPrinter.print("\tStart chain: NPDM [stream]", EMsgType.INFO);
|
||||||
try{
|
try{
|
||||||
return new NPDMProvider(parentProvider.getProviderSubFilePipedInpStream(fileNo));
|
return new NPDMProvider(parentProvider.getStreamProducer(fileNo));
|
||||||
}
|
}
|
||||||
catch (Exception e){
|
catch (Exception e){
|
||||||
logPrinter.print("\tException: "+e.getMessage(), EMsgType.FAIL);
|
logPrinter.print("\tException: "+e.getMessage(), EMsgType.FAIL);
|
||||||
|
|
|
@ -4,31 +4,26 @@ import javafx.concurrent.Task;
|
||||||
import konogonka.ModelControllers.EMsgType;
|
import konogonka.ModelControllers.EMsgType;
|
||||||
import konogonka.ModelControllers.LogPrinter;
|
import konogonka.ModelControllers.LogPrinter;
|
||||||
import libKonogonka.Tools.RomFs.FileSystemEntry;
|
import libKonogonka.Tools.RomFs.FileSystemEntry;
|
||||||
import libKonogonka.Tools.RomFs.IRomFsProvider;
|
import libKonogonka.Tools.RomFs.RomFsProvider;
|
||||||
|
|
||||||
import java.io.BufferedOutputStream;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.PipedInputStream;
|
|
||||||
import java.nio.file.Files;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class DumbRomFsExtractor extends Task<Void> {
|
public class DumbRomFsExtractor extends Task<Void> {
|
||||||
|
|
||||||
private IRomFsProvider provider;
|
private final RomFsProvider provider;
|
||||||
private FileSystemEntry entry;
|
private FileSystemEntry entry;
|
||||||
private List<FileSystemEntry> entries;
|
private List<FileSystemEntry> entries;
|
||||||
private LogPrinter logPrinter;
|
private final LogPrinter logPrinter;
|
||||||
private String filesDestPath;
|
private final String filesDestPath;
|
||||||
|
|
||||||
public DumbRomFsExtractor(IRomFsProvider provider, List<FileSystemEntry> entries, String filesDestPath){
|
public DumbRomFsExtractor(RomFsProvider provider, List<FileSystemEntry> entries, String filesDestPath){
|
||||||
this.provider = provider;
|
this.provider = provider;
|
||||||
this.entries = entries;
|
this.entries = entries;
|
||||||
this.filesDestPath = filesDestPath;
|
this.filesDestPath = filesDestPath;
|
||||||
this.logPrinter = new LogPrinter();
|
this.logPrinter = new LogPrinter();
|
||||||
}
|
}
|
||||||
|
|
||||||
public DumbRomFsExtractor(IRomFsProvider provider, FileSystemEntry entry, String filesDestPath){
|
public DumbRomFsExtractor(RomFsProvider provider, FileSystemEntry entry, String filesDestPath){
|
||||||
this.provider = provider;
|
this.provider = provider;
|
||||||
this.entry = entry;
|
this.entry = entry;
|
||||||
this.filesDestPath = filesDestPath;
|
this.filesDestPath = filesDestPath;
|
||||||
|
@ -40,21 +35,13 @@ public class DumbRomFsExtractor extends Task<Void> {
|
||||||
try {
|
try {
|
||||||
if (this.entries == null){
|
if (this.entries == null){
|
||||||
logPrinter.print("\tStart dummy extracting from 'RomFs' image: \n"+filesDestPath+entry.getName(), EMsgType.INFO);
|
logPrinter.print("\tStart dummy extracting from 'RomFs' image: \n"+filesDestPath+entry.getName(), EMsgType.INFO);
|
||||||
if (entry.isFile())
|
provider.exportContent(filesDestPath, entry);
|
||||||
exportSingleFile(entry, filesDestPath);
|
|
||||||
else
|
|
||||||
exportFolderContent(entry, filesDestPath);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
logPrinter.print("\tStart dummy extracting from 'RomFs' image: \n"+filesDestPath+"...", EMsgType.INFO);
|
logPrinter.print("\tStart dummy extracting from 'RomFs' image: \n"+filesDestPath+"...", EMsgType.INFO);
|
||||||
for (FileSystemEntry e : entries){
|
for (FileSystemEntry e : entries)
|
||||||
if (e.isFile())
|
provider.exportContent(filesDestPath, e);
|
||||||
exportSingleFile(e, filesDestPath);
|
|
||||||
else
|
|
||||||
exportFolderContent(e, filesDestPath);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception ioe) {
|
} catch (Exception ioe) {
|
||||||
logPrinter.print("\tDummy extracting from 'RomFs' image issue\n\t" + ioe.getMessage(), EMsgType.INFO);
|
logPrinter.print("\tDummy extracting from 'RomFs' image issue\n\t" + ioe.getMessage(), EMsgType.INFO);
|
||||||
return null;
|
return null;
|
||||||
|
@ -64,47 +51,4 @@ public class DumbRomFsExtractor extends Task<Void> {
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// TODO: Update # backend and then here
|
|
||||||
private void exportSingleFile(FileSystemEntry entry, String saveToLocation) throws Exception{
|
|
||||||
File contentFile = new File(saveToLocation + entry.getName());
|
|
||||||
|
|
||||||
BufferedOutputStream extractedFileBOS = new BufferedOutputStream(Files.newOutputStream(contentFile.toPath()));
|
|
||||||
PipedInputStream pis = provider.getContent(entry);
|
|
||||||
|
|
||||||
byte[] readBuf = new byte[0x200]; // 8mb NOTE: consider switching to 1mb 1048576
|
|
||||||
int readSize;
|
|
||||||
//*** PROGRESS BAR VARS START
|
|
||||||
long progressHandleFSize = entry.getSize();
|
|
||||||
int progressHandleFRead = 0;
|
|
||||||
//*** PROGRESS BAR VARS END
|
|
||||||
while ((readSize = pis.read(readBuf)) > -1) {
|
|
||||||
extractedFileBOS.write(readBuf, 0, readSize);
|
|
||||||
readBuf = new byte[0x200];
|
|
||||||
//*** PROGRESS BAR DECORCATIONS START
|
|
||||||
progressHandleFRead += readSize;
|
|
||||||
//System.out.println(readSize);
|
|
||||||
try {
|
|
||||||
logPrinter.updateProgress((progressHandleFRead)/(progressHandleFSize/100.0) / 100.0);
|
|
||||||
}catch (InterruptedException ignore){}
|
|
||||||
//*** PROGRESS BAR DECORCATIONS END
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
logPrinter.updateProgress(1.0);
|
|
||||||
}
|
|
||||||
catch (InterruptedException ignored){}
|
|
||||||
|
|
||||||
extractedFileBOS.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void exportFolderContent(FileSystemEntry entry, String saveToLocation) throws Exception{
|
|
||||||
File contentFile = new File(saveToLocation + entry.getName());
|
|
||||||
contentFile.mkdirs();
|
|
||||||
String currentDirPath = saveToLocation + entry.getName() + File.separator;
|
|
||||||
for (FileSystemEntry fse : entry.getContent()){
|
|
||||||
if (fse.isDirectory())
|
|
||||||
exportFolderContent(fse, currentDirPath);
|
|
||||||
else
|
|
||||||
exportSingleFile(fse, currentDirPath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -24,61 +24,31 @@ import konogonka.ModelControllers.EMsgType;
|
||||||
import konogonka.ModelControllers.LogPrinter;
|
import konogonka.ModelControllers.LogPrinter;
|
||||||
import libKonogonka.Tools.ISuperProvider;
|
import libKonogonka.Tools.ISuperProvider;
|
||||||
|
|
||||||
import java.io.*;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class Extractor extends Task<Void> {
|
public class Extractor extends Task<Void> {
|
||||||
|
|
||||||
private ISuperProvider provider;
|
private final ISuperProvider provider;
|
||||||
private List<IRowModel> models;
|
private final List<IRowModel> models;
|
||||||
private LogPrinter logPrinter;
|
private final LogPrinter logPrinter;
|
||||||
|
|
||||||
private String filesDestPath;
|
private final String filesDestinationPath;
|
||||||
|
|
||||||
public Extractor(ISuperProvider provider, List<IRowModel> models, String filesDestPath){
|
public Extractor(ISuperProvider provider, List<IRowModel> models, String filesDestinationPath){
|
||||||
this.provider = provider;
|
this.provider = provider;
|
||||||
this.models = models;
|
this.models = models;
|
||||||
this.filesDestPath = filesDestPath;
|
this.filesDestinationPath = filesDestinationPath;
|
||||||
this.logPrinter = new LogPrinter();
|
this.logPrinter = new LogPrinter();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Void call() {
|
protected Void call() {
|
||||||
for (IRowModel model : models) {
|
for (IRowModel model : models) {
|
||||||
logPrinter.print("\tStart extracting: \n"+filesDestPath+model.getFileName(), EMsgType.INFO);
|
logPrinter.print("\tStart extracting: \n"+ filesDestinationPath +model.getFileName(), EMsgType.INFO);
|
||||||
File contentFile = new File(filesDestPath + model.getFileName());
|
|
||||||
try {
|
try {
|
||||||
BufferedOutputStream extractedFileBOS = new BufferedOutputStream(new FileOutputStream(contentFile));
|
provider.exportContent(filesDestinationPath, model.getNumber());
|
||||||
PipedInputStream pis = provider.getProviderSubFilePipedInpStream(model.getNumber());
|
|
||||||
|
|
||||||
byte[] readBuf = new byte[0x800000]; // 8mb NOTE: consider switching to 1mb 1048576
|
|
||||||
int readSize;
|
|
||||||
//*** PROGRESS BAR VARS START
|
|
||||||
long progressHandleFSize = model.getFileSize();
|
|
||||||
int progressHandleFRead = 0;
|
|
||||||
//*** PROGRESS BAR VARS END
|
|
||||||
while ((readSize = pis.read(readBuf)) > -1) {
|
|
||||||
extractedFileBOS.write(readBuf, 0, readSize);
|
|
||||||
readBuf = new byte[0x800000];
|
|
||||||
//*** PROGRESS BAR DECORCATIONS START
|
|
||||||
progressHandleFRead += readSize;
|
|
||||||
//System.out.println(readSize);
|
|
||||||
try {
|
|
||||||
logPrinter.updateProgress((progressHandleFRead)/(progressHandleFSize/100.0) / 100.0);
|
|
||||||
}catch (InterruptedException ie){
|
|
||||||
getException().printStackTrace(); // TODO: Do something with this
|
|
||||||
}
|
|
||||||
//*** PROGRESS BAR DECORCATIONS END
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
logPrinter.updateProgress(1.0);
|
|
||||||
}catch (InterruptedException ie){
|
|
||||||
getException().printStackTrace(); // TODO: Do something with this
|
|
||||||
}
|
|
||||||
extractedFileBOS.close();
|
|
||||||
} catch (Exception ioe) {
|
} catch (Exception ioe) {
|
||||||
logPrinter.print("\tExtracting issue\n\t" + ioe.getMessage(), EMsgType.INFO);
|
logPrinter.print("\tExtracting issue\n\t" + ioe.getMessage(), EMsgType.INFO);
|
||||||
return null;
|
|
||||||
} finally {
|
} finally {
|
||||||
logPrinter.print("\tEnd extracting", EMsgType.INFO);
|
logPrinter.print("\tEnd extracting", EMsgType.INFO);
|
||||||
logPrinter.close();
|
logPrinter.close();
|
||||||
|
|
Loading…
Reference in a new issue