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(){
return name;
}
}

View file

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

View file

@ -34,27 +34,21 @@ public class Level6Header {
private long headerFileMetadataTableLength;
private long headerFileDataOffset;
private byte[] headerBytes;
private int i;
Level6Header(byte[] headerBytes){
int i = 0;
headerHeaderLength = LoperConverter.getLEint(headerBytes, i);
i += 0x8;
headerDirectoryHashTableOffset = LoperConverter.getLEint(headerBytes, i);
i += 0x8;
headerDirectoryHashTableLength = LoperConverter.getLEint(headerBytes, i);
i += 0x8;
headerDirectoryMetadataTableOffset = LoperConverter.getLEint(headerBytes, i);
i += 0x8;
headerDirectoryMetadataTableLength = LoperConverter.getLEint(headerBytes, i);
i += 0x8;
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);
this.headerBytes = headerBytes;
headerHeaderLength = getNext();
headerDirectoryHashTableOffset = getNext();
headerDirectoryHashTableLength = getNext();
headerDirectoryMetadataTableOffset = getNext();
headerDirectoryMetadataTableLength = getNext();
headerFileHashTableOffset = getNext();
headerFileHashTableLength = getNext();
headerFileMetadataTableOffset = getNext();
headerFileMetadataTableLength = getNext();
headerFileDataOffset = getNext();
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" +
@ -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 getHeaderDirectoryHashTableOffset() { return headerDirectoryHashTableOffset; }
public long getHeaderDirectoryHashTableLength() { return headerDirectoryHashTableLength; }