Drafts for RomFs support Ad-Hoc fix: POC for Lvl 6 header

This commit is contained in:
Dmitry Isaenko 2020-04-19 04:56:13 +03:00
parent 33ef6c5bf8
commit 5c0b037fa8
3 changed files with 32 additions and 22 deletions

View file

@ -33,4 +33,5 @@ public class RFSFolderEntry {
public String toString(){ public String toString(){
return name; return name;
} }
}
}

View file

@ -25,6 +25,7 @@ import javafx.scene.layout.Region;
import javafx.scene.layout.VBox; import javafx.scene.layout.VBox;
import konogonka.Controllers.ITabController; import konogonka.Controllers.ITabController;
import konogonka.Tools.ISuperProvider; import konogonka.Tools.ISuperProvider;
import konogonka.Tools.RomFs.RomFsDecryptedProvider;
import java.io.File; import java.io.File;
import java.net.URL; import java.net.URL;
@ -37,6 +38,8 @@ public class RomFsController implements ITabController {
@FXML @FXML
private VBox folderContentVBox; private VBox folderContentVBox;
private RomFsDecryptedProvider RomFsProvider;
@Override @Override
public void initialize(URL url, ResourceBundle resourceBundle) { public void initialize(URL url, ResourceBundle resourceBundle) {
TreeItem<RFSFolderEntry> rootTest = getEmptyRoot(); TreeItem<RFSFolderEntry> rootTest = getEmptyRoot();
@ -54,6 +57,12 @@ public class RomFsController implements ITabController {
@Override @Override
public void analyze(File file, long offset) { public void analyze(File file, long offset) {
try {
this.RomFsProvider = new RomFsDecryptedProvider(file);
}
catch (Exception e){ // TODO: FIX
e.printStackTrace();
}
TreeItem<RFSFolderEntry> rootItem = getEmptyRoot(); TreeItem<RFSFolderEntry> rootItem = getEmptyRoot();
filesTreeView.setRoot(rootItem); filesTreeView.setRoot(rootItem);

View file

@ -33,28 +33,22 @@ public class Level6Header {
private long headerFileMetadataTableOffset; private long headerFileMetadataTableOffset;
private long headerFileMetadataTableLength; private long headerFileMetadataTableLength;
private long headerFileDataOffset; private long headerFileDataOffset;
private byte[] headerBytes;
private int i;
Level6Header(byte[] headerBytes){ Level6Header(byte[] headerBytes){
int i = 0; this.headerBytes = headerBytes;
headerHeaderLength = LoperConverter.getLEint(headerBytes, i); headerHeaderLength = getNext();
i += 0x8; headerDirectoryHashTableOffset = getNext();
headerDirectoryHashTableOffset = LoperConverter.getLEint(headerBytes, i); headerDirectoryHashTableLength = getNext();
i += 0x8; headerDirectoryMetadataTableOffset = getNext();
headerDirectoryHashTableLength = LoperConverter.getLEint(headerBytes, i); headerDirectoryMetadataTableLength = getNext();
i += 0x8; headerFileHashTableOffset = getNext();
headerDirectoryMetadataTableOffset = LoperConverter.getLEint(headerBytes, i); headerFileHashTableLength = getNext();
i += 0x8; headerFileMetadataTableOffset = getNext();
headerDirectoryMetadataTableLength = LoperConverter.getLEint(headerBytes, i); headerFileMetadataTableLength = getNext();
i += 0x8; headerFileDataOffset = getNext();
headerFileHashTableOffset = LoperConverter.getLEint(headerBytes, i);
i += 0x8;
headerFileHashTableLength = LoperConverter.getLEint(headerBytes, i);
i += 0x8;
headerFileMetadataTableOffset = LoperConverter.getLEint(headerBytes, i);
i += 0x8;
headerFileMetadataTableLength = LoperConverter.getLEint(headerBytes, i);
i += 0x8;
headerFileDataOffset = LoperConverter.getLEint(headerBytes, i);
System.out.println("== Level 6 Header ==\n" + System.out.println("== Level 6 Header ==\n" +
"Header Length (always 0x50 ?) "+ RainbowDump.formatDecHexString(headerHeaderLength)+" (size of this structure within first 0x200 block of LEVEL 6 part)\n" + "Header Length (always 0x50 ?) "+ RainbowDump.formatDecHexString(headerHeaderLength)+" (size of this structure within first 0x200 block of LEVEL 6 part)\n" +
@ -71,6 +65,12 @@ public class Level6Header {
); );
} }
private long getNext(){
final long result = LoperConverter.getLEint(headerBytes, i);
i += 0x8;
return result;
}
public long getHeaderHeaderLength() { return headerHeaderLength; } public long getHeaderHeaderLength() { return headerHeaderLength; }
public long getHeaderDirectoryHashTableOffset() { return headerDirectoryHashTableOffset; } public long getHeaderDirectoryHashTableOffset() { return headerDirectoryHashTableOffset; }
public long getHeaderDirectoryHashTableLength() { return headerDirectoryHashTableLength; } public long getHeaderDirectoryHashTableLength() { return headerDirectoryHashTableLength; }