From 8f5481ab3e459b0d9aca17cf88229212dfead503 Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Mon, 26 Dec 2022 07:40:34 +0300 Subject: [PATCH] Correct application to be in line with libKonogonka --- .../Controllers/NCA/NCAController.java | 38 +++++++------- .../NCA/NCAFsHeaderController.java | 50 +++++++++---------- .../NCA/NCASectionContentController.java | 2 +- .../Controllers/NCA/NCATableController.java | 6 +-- .../NPDM/FSAccessControlController.java | 6 +-- .../NPDM/FSAccessHeaderController.java | 6 +-- .../Controllers/NPDM/NPDMController.java | 26 +++++----- .../Controllers/NSP/NSPController.java | 4 +- .../Controllers/TIK/TIKController.java | 24 ++++----- .../Controllers/XCI/HFSBlockController.java | 4 +- .../Controllers/XCI/XCIController.java | 44 ++++++++-------- 11 files changed, 105 insertions(+), 105 deletions(-) diff --git a/src/main/java/konogonka/Controllers/NCA/NCAController.java b/src/main/java/konogonka/Controllers/NCA/NCAController.java index 0135565..243cc20 100644 --- a/src/main/java/konogonka/Controllers/NCA/NCAController.java +++ b/src/main/java/konogonka/Controllers/NCA/NCAController.java @@ -34,7 +34,7 @@ import java.net.URL; import java.util.HashMap; import java.util.ResourceBundle; -import static libKonogonka.Converter.byteArrToHexString; +import static libKonogonka.Converter.byteArrToHexStringAsLE; public class NCAController implements ITabController { @@ -182,37 +182,37 @@ public class NCAController implements ITabController { private void populateFields(NCAProvider ncaProvider) { if (ncaProvider == null) return; - rsa2048oneTF.setText(byteArrToHexString(ncaProvider.getRsa2048one())); - rsa2048twoTF.setText(byteArrToHexString(ncaProvider.getRsa2048two())); + rsa2048oneTF.setText(byteArrToHexStringAsLE(ncaProvider.getRsa2048one())); + rsa2048twoTF.setText(byteArrToHexStringAsLE(ncaProvider.getRsa2048two())); magicnumLbl.setText(ncaProvider.getMagicnum()); systemOrGcIndLbl.setText(Byte.toString(ncaProvider.getSystemOrGcIndicator())); contentTypeLbl.setText(Byte.toString(ncaProvider.getContentType())); cryptoType1Lbl.setText(Byte.toString(ncaProvider.getCryptoType1())); keyIndexLbl.setText(Byte.toString(ncaProvider.getKeyIndex())); ncaSizeLbl.setText(Long.toString(ncaProvider.getNcaSize())); - titleIdLbl.setText(byteArrToHexString(ncaProvider.getTitleId())); - contentIndexLbl.setText(byteArrToHexString(ncaProvider.getContentIndx())); // + titleIdLbl.setText(byteArrToHexStringAsLE(ncaProvider.getTitleId())); + contentIndexLbl.setText(byteArrToHexStringAsLE(ncaProvider.getContentIndx())); // sdkVersionLbl.setText(ncaProvider.getSdkVersion()[3] +"."+ncaProvider.getSdkVersion()[2] +"."+ncaProvider.getSdkVersion()[1] +"."+ncaProvider.getSdkVersion()[0]); cryptoType2Lbl.setText(Byte.toString(ncaProvider.getCryptoType2())); header1SignatureKeyGenerationLbl.setText(Byte.toString(ncaProvider.getHeader1SignatureKeyGeneration())); - keyGenerationReservedLbl.setText(byteArrToHexString(ncaProvider.getKeyGenerationReserved())); - ticketLbl.setText(byteArrToHexString(ncaProvider.getRightsId())); - sha256section1TF.setText(byteArrToHexString(ncaProvider.getSha256hash0())); - sha256section2TF.setText(byteArrToHexString(ncaProvider.getSha256hash1())); - sha256section3TF.setText(byteArrToHexString(ncaProvider.getSha256hash2())); - sha256section4TF.setText(byteArrToHexString(ncaProvider.getSha256hash3())); - keyAreaEnKey0TF.setText(byteArrToHexString(ncaProvider.getEncryptedKey0())); - keyAreaEnKey1TF.setText(byteArrToHexString(ncaProvider.getEncryptedKey1())); - keyAreaEnKey2TF.setText(byteArrToHexString(ncaProvider.getEncryptedKey2())); - keyAreaEnKey3TF.setText(byteArrToHexString(ncaProvider.getEncryptedKey3())); + keyGenerationReservedLbl.setText(byteArrToHexStringAsLE(ncaProvider.getKeyGenerationReserved())); + ticketLbl.setText(byteArrToHexStringAsLE(ncaProvider.getRightsId())); + sha256section1TF.setText(byteArrToHexStringAsLE(ncaProvider.getSha256hash0())); + sha256section2TF.setText(byteArrToHexStringAsLE(ncaProvider.getSha256hash1())); + sha256section3TF.setText(byteArrToHexStringAsLE(ncaProvider.getSha256hash2())); + sha256section4TF.setText(byteArrToHexStringAsLE(ncaProvider.getSha256hash3())); + keyAreaEnKey0TF.setText(byteArrToHexStringAsLE(ncaProvider.getEncryptedKey0())); + keyAreaEnKey1TF.setText(byteArrToHexStringAsLE(ncaProvider.getEncryptedKey1())); + keyAreaEnKey2TF.setText(byteArrToHexStringAsLE(ncaProvider.getEncryptedKey2())); + keyAreaEnKey3TF.setText(byteArrToHexStringAsLE(ncaProvider.getEncryptedKey3())); - keyAreaDecKey0TF.setText(byteArrToHexString(ncaProvider.getDecryptedKey0())); - keyAreaDecKey1TF.setText(byteArrToHexString(ncaProvider.getDecryptedKey1())); - keyAreaDecKey2TF.setText(byteArrToHexString(ncaProvider.getDecryptedKey2())); - keyAreaDecKey3TF.setText(byteArrToHexString(ncaProvider.getDecryptedKey3())); + keyAreaDecKey0TF.setText(byteArrToHexStringAsLE(ncaProvider.getDecryptedKey0())); + keyAreaDecKey1TF.setText(byteArrToHexStringAsLE(ncaProvider.getDecryptedKey1())); + keyAreaDecKey2TF.setText(byteArrToHexStringAsLE(ncaProvider.getDecryptedKey2())); + keyAreaDecKey3TF.setText(byteArrToHexStringAsLE(ncaProvider.getDecryptedKey3())); // Tables NCATable1Controller.populateTab(ncaProvider.getTableEntry0()); NCATable2Controller.populateTab(ncaProvider.getTableEntry1()); diff --git a/src/main/java/konogonka/Controllers/NCA/NCAFsHeaderController.java b/src/main/java/konogonka/Controllers/NCA/NCAFsHeaderController.java index 7d8e40e..57303fc 100644 --- a/src/main/java/konogonka/Controllers/NCA/NCAFsHeaderController.java +++ b/src/main/java/konogonka/Controllers/NCA/NCAFsHeaderController.java @@ -27,7 +27,7 @@ import libKonogonka.Tools.NCA.NCASectionTableBlock.MetaDataHashDataInfo; import libKonogonka.Tools.NCA.NCASectionTableBlock.NcaFsHeader; import libKonogonka.Tools.NCA.NCASectionTableBlock.SparseInfo; -import static libKonogonka.Converter.byteArrToHexString; +import static libKonogonka.Converter.byteArrToHexStringAsLE; public class NCAFsHeaderController { @FXML @@ -234,7 +234,7 @@ public class NCAFsHeaderController { } public void populateTab(NcaFsHeader ncaFsHeader){ - versionLbl.setText(byteArrToHexString(ncaFsHeader.getVersion())); + versionLbl.setText(byteArrToHexStringAsLE(ncaFsHeader.getVersion())); StringBuilder sb = new StringBuilder(); sb.append(String.format("0x%02x ", ncaFsHeader.getFsType())); if (ncaFsHeader.getFsType() == 0) @@ -277,7 +277,7 @@ public class NCAFsHeaderController { metaDataHashTypeLbl.setText(String.format("%d", ncaFsHeader.getMetaDataHashType())); } - paddingLbl.setText(byteArrToHexString(ncaFsHeader.getPadding())); + paddingLbl.setText(byteArrToHexStringAsLE(ncaFsHeader.getPadding())); if ((ncaFsHeader.getFsType() == 0) && (ncaFsHeader.getHashType() == 0x3)){ romFsMagicLbl.setText(ncaFsHeader.getSuperBlockIVFC().getMagic()); romFsMagicNumberLbl.setText(ncaFsHeader.getSuperBlockIVFC().getMagic() @@ -287,48 +287,48 @@ public class NCAFsHeaderController { romFsLvl1OffsetLbl.setText(getCuteDecHexRepresentation(ncaFsHeader.getSuperBlockIVFC().getLvl1Offset())); romFsLvl1SizeLbl.setText(getCuteDecHexRepresentation(ncaFsHeader.getSuperBlockIVFC().getLvl1Size())); romFsLvl1SBlockSizeLbl.setText(Integer.toString(ncaFsHeader.getSuperBlockIVFC().getLvl1SBlockSize())); - romFsReserved1Lbl.setText(byteArrToHexString(ncaFsHeader.getSuperBlockIVFC().getReserved1())); + romFsReserved1Lbl.setText(byteArrToHexStringAsLE(ncaFsHeader.getSuperBlockIVFC().getReserved1())); romFsLvl2OffsetLbl.setText(getCuteDecHexRepresentation(ncaFsHeader.getSuperBlockIVFC().getLvl2Offset())); romFsLvl2SizeLbl.setText(getCuteDecHexRepresentation(ncaFsHeader.getSuperBlockIVFC().getLvl2Size())); romFsLvl2SBlockSizeLbl.setText(Integer.toString(ncaFsHeader.getSuperBlockIVFC().getLvl2SBlockSize())); - romFsReserved2Lbl.setText(byteArrToHexString(ncaFsHeader.getSuperBlockIVFC().getReserved2())); + romFsReserved2Lbl.setText(byteArrToHexStringAsLE(ncaFsHeader.getSuperBlockIVFC().getReserved2())); romFsLvl3OffsetLbl.setText(getCuteDecHexRepresentation(ncaFsHeader.getSuperBlockIVFC().getLvl3Offset())); romFsLvl3SizeLbl.setText(getCuteDecHexRepresentation(ncaFsHeader.getSuperBlockIVFC().getLvl3Size())); romFsLvl3SBlockSizeLbl.setText(Integer.toString(ncaFsHeader.getSuperBlockIVFC().getLvl3SBlockSize())); - romFsReserved3Lbl.setText(byteArrToHexString(ncaFsHeader.getSuperBlockIVFC().getReserved3())); + romFsReserved3Lbl.setText(byteArrToHexStringAsLE(ncaFsHeader.getSuperBlockIVFC().getReserved3())); romFsLvl4OffsetLbl.setText(getCuteDecHexRepresentation(ncaFsHeader.getSuperBlockIVFC().getLvl4Offset())); romFsLvl4SizeLbl.setText(getCuteDecHexRepresentation(ncaFsHeader.getSuperBlockIVFC().getLvl4Size())); romFsLvl4SBlockSizeLbl.setText(Integer.toString(ncaFsHeader.getSuperBlockIVFC().getLvl4SBlockSize())); - romFsReserved4Lbl.setText(byteArrToHexString(ncaFsHeader.getSuperBlockIVFC().getReserved4())); + romFsReserved4Lbl.setText(byteArrToHexStringAsLE(ncaFsHeader.getSuperBlockIVFC().getReserved4())); romFsLvl5OffsetLbl.setText(getCuteDecHexRepresentation(ncaFsHeader.getSuperBlockIVFC().getLvl5Offset())); romFsLvl5SizeLbl.setText(getCuteDecHexRepresentation(ncaFsHeader.getSuperBlockIVFC().getLvl5Size())); romFsLvl5SBlockSizeLbl.setText(Integer.toString(ncaFsHeader.getSuperBlockIVFC().getLvl5SBlockSize())); - romFsReserved5Lbl.setText(byteArrToHexString(ncaFsHeader.getSuperBlockIVFC().getReserved5())); + romFsReserved5Lbl.setText(byteArrToHexStringAsLE(ncaFsHeader.getSuperBlockIVFC().getReserved5())); romFsLvl6OffsetLbl.setText(getCuteDecHexRepresentation(ncaFsHeader.getSuperBlockIVFC().getLvl6Offset())); romFsLvl6SizeLbl.setText(getCuteDecHexRepresentation(ncaFsHeader.getSuperBlockIVFC().getLvl6Size())); romFsLvl6SBlockSizeLbl.setText(Integer.toString(ncaFsHeader.getSuperBlockIVFC().getLvl6SBlockSize())); - romFsReserved6Lbl.setText(byteArrToHexString(ncaFsHeader.getSuperBlockIVFC().getReserved6())); + romFsReserved6Lbl.setText(byteArrToHexStringAsLE(ncaFsHeader.getSuperBlockIVFC().getReserved6())); - signatureSaltTf.setText(byteArrToHexString(ncaFsHeader.getSuperBlockIVFC().getSignatureSalt())); - romFsMasterHashTf.setText(byteArrToHexString(ncaFsHeader.getSuperBlockIVFC().getMasterHash())); - romFsReservedTailLbl.setText(byteArrToHexString(ncaFsHeader.getSuperBlockIVFC().getReservedTail())); + signatureSaltTf.setText(byteArrToHexStringAsLE(ncaFsHeader.getSuperBlockIVFC().getSignatureSalt())); + romFsMasterHashTf.setText(byteArrToHexStringAsLE(ncaFsHeader.getSuperBlockIVFC().getMasterHash())); + romFsReservedTailLbl.setText(byteArrToHexStringAsLE(ncaFsHeader.getSuperBlockIVFC().getReservedTail())); pfs0TitlePanel.setDisable(true); } else if ((ncaFsHeader.getFsType() == 0x1) && (ncaFsHeader.getHashType() == 0x2)){ - pfs0SHA256hashTf.setText(byteArrToHexString(ncaFsHeader.getSuperBlockPFS0().getSHA256hash())); + pfs0SHA256hashTf.setText(byteArrToHexStringAsLE(ncaFsHeader.getSuperBlockPFS0().getSHA256hash())); pfs0blockSizeLbl.setText(Integer.toString(ncaFsHeader.getSuperBlockPFS0().getBlockSize())); pfs0LayerCountLbl.setText(Integer.toString(ncaFsHeader.getSuperBlockPFS0().getLayerCount())); pfs0hashTableOffsetLbl.setText(Long.toString(ncaFsHeader.getSuperBlockPFS0().getHashTableOffset())); pfs0hashTableSizeLbl.setText(Long.toString(ncaFsHeader.getSuperBlockPFS0().getHashTableSize())); pfs0relativeToSectionStartOffsetLbl.setText(Long.toString(ncaFsHeader.getSuperBlockPFS0().getPfs0offset())); pfs0sizePfs0Lbl.setText(Long.toString(ncaFsHeader.getSuperBlockPFS0().getPfs0size())); - pfs0zeroesTf.setText(byteArrToHexString(ncaFsHeader.getSuperBlockPFS0().getZeroes())); + pfs0zeroesTf.setText(byteArrToHexStringAsLE(ncaFsHeader.getSuperBlockPFS0().getZeroes())); romFsTitlePanel.setDisable(true); } else { @@ -341,15 +341,15 @@ public class NCAFsHeaderController { indirectInfoMagicLbl.setText(ncaFsHeader.getPatchInfoMagicSection1()); indirectInfoVersionLbl.setText(Long.toString(ncaFsHeader.getPatchInfoSizeSection1())); indirectInfoEntryCountLbl.setText(Integer.toString(ncaFsHeader.getEntryCountSection1())); - indirectInfoUnknownLbl.setText(byteArrToHexString(ncaFsHeader.getPatchInfoUnknownSection1())); + indirectInfoUnknownLbl.setText(byteArrToHexStringAsLE(ncaFsHeader.getPatchInfoUnknownSection1())); aesCtrExOffsetLbl.setText(Long.toString(ncaFsHeader.getPatchInfoOffsetSection2())); aesCtrExSizeLbl.setText(Long.toString(ncaFsHeader.getPatchInfoSizeSection2())); aesCtrExMagicLbl.setText(ncaFsHeader.getPatchInfoMagicSection2()); aesCtrExVersionLbl.setText(Integer.toString(ncaFsHeader.getPatchInfoVersionSection2())); aesCtrExEntryCountLbl.setText(Integer.toString(ncaFsHeader.getEntryCountSection2())); - aesCtrExUnknownLbl.setText(byteArrToHexString(ncaFsHeader.getPatchInfoUnknownSection2())); - sectionCTRLbl.setText(byteArrToHexString(ncaFsHeader.getSectionCTR())); - generationLbl.setText(byteArrToHexString(ncaFsHeader.getGeneration())); + aesCtrExUnknownLbl.setText(byteArrToHexStringAsLE(ncaFsHeader.getPatchInfoUnknownSection2())); + sectionCTRLbl.setText(byteArrToHexStringAsLE(ncaFsHeader.getSectionCTR())); + generationLbl.setText(byteArrToHexStringAsLE(ncaFsHeader.getGeneration())); SparseInfo sparseInfo = ncaFsHeader.getSparseInfo(); sparseInfoTableOffsetLbl.setText(Long.toString(sparseInfo.getOffset())); @@ -357,10 +357,10 @@ public class NCAFsHeaderController { sparseInfoMagicLbl.setText(sparseInfo.getBktrMagic()); sparseInfoVersionLbl.setText(Long.toString(sparseInfo.getBktrVersion())); sparseInfoEntryCountLbl.setText(Integer.toString(sparseInfo.getBktrEntryCount())); - sparseInfoUnknownLbl.setText(byteArrToHexString(sparseInfo.getBktrUnknown())); + sparseInfoUnknownLbl.setText(byteArrToHexStringAsLE(sparseInfo.getBktrUnknown())); sparseInfoPhysicalOffsetLbl.setText(Long.toString(sparseInfo.getPhysicalOffset())); - sparseInfoGenerationLbl.setText(byteArrToHexString(sparseInfo.getGeneration())); - sparseInfoReseredLbl.setText(byteArrToHexString(sparseInfo.getUnknown())); + sparseInfoGenerationLbl.setText(byteArrToHexStringAsLE(sparseInfo.getGeneration())); + sparseInfoReseredLbl.setText(byteArrToHexStringAsLE(sparseInfo.getUnknown())); CompressionInfo compressionInfo = ncaFsHeader.getCompressionInfo(); compressionInfoTableOffsetLbl.setText(Long.toString(compressionInfo.getOffset())); @@ -368,15 +368,15 @@ public class NCAFsHeaderController { compressionMagicLbl.setText(compressionInfo.getBktrMagic()); compressionInfoVersionLbl.setText(Long.toString(compressionInfo.getBktrVersion())); compressionInfoEntryCountLbl.setText(Integer.toString(compressionInfo.getBktrEntryCount())); - compressionInfoUnknownLbl.setText(byteArrToHexString(compressionInfo.getBktrUnknown())); - compressionInfoReservedLbl.setText(byteArrToHexString(compressionInfo.getUnknown())); + compressionInfoUnknownLbl.setText(byteArrToHexStringAsLE(compressionInfo.getBktrUnknown())); + compressionInfoReservedLbl.setText(byteArrToHexStringAsLE(compressionInfo.getUnknown())); MetaDataHashDataInfo metaDataHashDataInfo = ncaFsHeader.getMetaDataHashDataInfo(); metaDataHashDataTableOffsetLbl.setText(Long.toString(metaDataHashDataInfo.getOffset())); metaDataHashDataTableSizeLbl.setText(Long.toString(metaDataHashDataInfo.getSize())); - metaDataHashDataTableHashLbl.setText(byteArrToHexString(metaDataHashDataInfo.getTableHash())); + metaDataHashDataTableHashLbl.setText(byteArrToHexStringAsLE(metaDataHashDataInfo.getTableHash())); - unknwnEndPaddingTF.setText(byteArrToHexString(ncaFsHeader.getUnknownEndPadding())); + unknwnEndPaddingTF.setText(byteArrToHexStringAsLE(ncaFsHeader.getUnknownEndPadding())); } private String getCuteDecHexRepresentation(long value){ diff --git a/src/main/java/konogonka/Controllers/NCA/NCASectionContentController.java b/src/main/java/konogonka/Controllers/NCA/NCASectionContentController.java index d13116d..b5f931e 100644 --- a/src/main/java/konogonka/Controllers/NCA/NCASectionContentController.java +++ b/src/main/java/konogonka/Controllers/NCA/NCASectionContentController.java @@ -99,7 +99,7 @@ public class NCASectionContentController implements Initializable { for (int i = 0; i < sha256hashList.size(); i++){ Label numberLblTmp = new Label(String.format("%10d", i)); numberLblTmp.setPadding(new Insets(5.0, 5.0, 5.0, 5.0)); - Label sha256LblTmp = new Label(Converter.byteArrToHexString(sha256hashList.get(i))); + Label sha256LblTmp = new Label(Converter.byteArrToHexStringAsLE(sha256hashList.get(i))); sha256LblTmp.setPadding(new Insets(5.0, 5.0, 5.0, 5.0)); sha256pane.getChildren().add(new HBox(numberLblTmp, sha256LblTmp)); diff --git a/src/main/java/konogonka/Controllers/NCA/NCATableController.java b/src/main/java/konogonka/Controllers/NCA/NCATableController.java index 10e91ca..f148369 100644 --- a/src/main/java/konogonka/Controllers/NCA/NCATableController.java +++ b/src/main/java/konogonka/Controllers/NCA/NCATableController.java @@ -22,7 +22,7 @@ import javafx.fxml.FXML; import javafx.scene.control.Label; import libKonogonka.Tools.NCA.NCAHeaderTableEntry; -import static libKonogonka.Converter.byteArrToHexString; +import static libKonogonka.Converter.byteArrToHexStringAsLE; public class NCATableController { @FXML @@ -42,7 +42,7 @@ public class NCATableController { public void populateTab(NCAHeaderTableEntry ncaHeaderTableEntry){ mediaStartOffsetLbl.setText(Long.toString(ncaHeaderTableEntry.getMediaStartOffset())); mediaEndOffsetLbl.setText(Long.toString(ncaHeaderTableEntry.getMediaEndOffset())); - unknwn1Lbl.setText(byteArrToHexString(ncaHeaderTableEntry.getUnknwn1())); - unknwn2Lbl.setText(byteArrToHexString(ncaHeaderTableEntry.getUnknwn2())); + unknwn1Lbl.setText(byteArrToHexStringAsLE(ncaHeaderTableEntry.getUnknwn1())); + unknwn2Lbl.setText(byteArrToHexStringAsLE(ncaHeaderTableEntry.getUnknwn2())); } } diff --git a/src/main/java/konogonka/Controllers/NPDM/FSAccessControlController.java b/src/main/java/konogonka/Controllers/NPDM/FSAccessControlController.java index 887710b..8a3dce0 100644 --- a/src/main/java/konogonka/Controllers/NPDM/FSAccessControlController.java +++ b/src/main/java/konogonka/Controllers/NPDM/FSAccessControlController.java @@ -27,7 +27,7 @@ import libKonogonka.Tools.NPDM.ACID.FSAccessControlProvider; import java.net.URL; import java.util.ResourceBundle; -import static libKonogonka.Converter.byteArrToHexString; +import static libKonogonka.Converter.byteArrToHexStringAsLE; import static libKonogonka.Converter.longToOctString; public class FSAccessControlController implements Initializable { @@ -186,12 +186,12 @@ public class FSAccessControlController implements Initializable { public void populateFields(FSAccessControlProvider provider){ ACID_FSAcccessControlVersionLbl.setText(String.format("0x%02x", provider.getVersion())); - ACID_FSAcccessControlPaddingLbl.setText(byteArrToHexString(provider.getPadding())); + ACID_FSAcccessControlPaddingLbl.setText(byteArrToHexStringAsLE(provider.getPadding())); StringBuilder sb = new StringBuilder(longToOctString(provider.getPermissionsBitmask())); sb.reverse(); String mask = sb.toString(); ACID_FSAcccessControlBitbaskLbl.setText(mask); - ACID_FSAcccessControlReservedTf.setText(byteArrToHexString(provider.getReserved())); + ACID_FSAcccessControlReservedTf.setText(byteArrToHexStringAsLE(provider.getReserved())); for (int i = 0; i < 64; i++) masksArr[i].setText(mask.substring(i, i+1)); diff --git a/src/main/java/konogonka/Controllers/NPDM/FSAccessHeaderController.java b/src/main/java/konogonka/Controllers/NPDM/FSAccessHeaderController.java index 23ec467..e4d7b67 100644 --- a/src/main/java/konogonka/Controllers/NPDM/FSAccessHeaderController.java +++ b/src/main/java/konogonka/Controllers/NPDM/FSAccessHeaderController.java @@ -27,7 +27,7 @@ import libKonogonka.Tools.NPDM.ACI0.FSAccessHeaderProvider; import java.net.URL; import java.util.ResourceBundle; -import static libKonogonka.Converter.byteArrToHexString; +import static libKonogonka.Converter.byteArrToHexStringAsLE; import static libKonogonka.Converter.longToOctString; public class FSAccessHeaderController implements Initializable { @@ -192,7 +192,7 @@ public class FSAccessHeaderController implements Initializable { public void populateFields(FSAccessHeaderProvider provider){ versionLbl.setText(Integer.toString(provider.getVersion())); - paddingLbl.setText(byteArrToHexString(provider.getPadding())); + paddingLbl.setText(byteArrToHexStringAsLE(provider.getPadding())); StringBuilder sb = new StringBuilder(longToOctString(provider.getPermissionsBitmask())); sb.reverse(); String mask = sb.toString(); @@ -201,7 +201,7 @@ public class FSAccessHeaderController implements Initializable { sizeContOwnIdLbl.setText(Integer.toString(provider.getContentOwnIdSectionSize())); dataSizePlusContOwnSizeLbl.setText(Integer.toString(provider.getDataNownerSizes())); sizeOfSaveDataOwnSecLbl.setText(Integer.toString(provider.getSaveDataOwnSectionSize())); - unknownTf.setText(byteArrToHexString(provider.getUnknownData())); + unknownTf.setText(byteArrToHexStringAsLE(provider.getUnknownData())); for (int i = 0; i < 64; i++) masksArr[i].setText(mask.substring(i, i+1)); diff --git a/src/main/java/konogonka/Controllers/NPDM/NPDMController.java b/src/main/java/konogonka/Controllers/NPDM/NPDMController.java index ec45e77..bd788f2 100644 --- a/src/main/java/konogonka/Controllers/NPDM/NPDMController.java +++ b/src/main/java/konogonka/Controllers/NPDM/NPDMController.java @@ -33,7 +33,7 @@ import java.io.File; import java.net.URL; import java.util.ResourceBundle; -import static libKonogonka.Converter.byteArrToHexString; +import static libKonogonka.Converter.byteArrToHexStringAsLE; public class NPDMController implements ITabController { @@ -209,18 +209,18 @@ public class NPDMController implements ITabController { npdmFileSize.setText("skipping calculation for in-file ticket"); magicNumLbl.setText(npdmProvider.getMagicNum()); - reserved1Lbl.setText(byteArrToHexString(npdmProvider.getReserved1())); + reserved1Lbl.setText(byteArrToHexStringAsLE(npdmProvider.getReserved1())); MMUFlagsLbl.setText(npdmProvider.getMMUFlags()+" (0b"+String.format("%8s", Integer.toBinaryString(npdmProvider.getMMUFlags() & 0xFF)).replace(' ', '0')+")"); reserved2Lbl.setText(String.format("0x%02x", npdmProvider.getReserved2())); mainThreadPrioLbl.setText(Byte.toString(npdmProvider.getMainThreadPrio())); mainThreadCoreNumLbl.setText(Byte.toString(npdmProvider.getMainThreadCoreNum())); - reserved3Lbl.setText(byteArrToHexString(npdmProvider.getReserved3())); + reserved3Lbl.setText(byteArrToHexStringAsLE(npdmProvider.getReserved3())); personalMmHeapSizeLbl.setText(Integer.toString(npdmProvider.getPersonalMmHeapSize())); versionLbl.setText(Integer.toString(npdmProvider.getVersion())); mainThreadStackSizeLbl.setText(Long.toString(npdmProvider.getMainThreadStackSize())); titleNameTf.setText(npdmProvider.getTitleName()); - productCodeTf.setText(byteArrToHexString(npdmProvider.getProductCode())); - reserved4Tf.setText(byteArrToHexString(npdmProvider.getReserved4())); + productCodeTf.setText(byteArrToHexStringAsLE(npdmProvider.getProductCode())); + reserved4Tf.setText(byteArrToHexStringAsLE(npdmProvider.getReserved4())); aci0offsetLbl.setText(Integer.toString(npdmProvider.getAci0offset())); aci0sizeLbl.setText(Integer.toString(npdmProvider.getAci0size())); acidOffsetLbl.setText(Integer.toString(npdmProvider.getAcidOffset())); @@ -228,27 +228,27 @@ public class NPDMController implements ITabController { // ACI0 ACI0Provider aci0 = npdmProvider.getAci0(); aci0MagicNumLbl.setText(aci0.getMagicNum()); - aci0Reserved1Lbl.setText(byteArrToHexString(aci0.getReserved1())); - aci0TitleIDLbl.setText(byteArrToHexString(aci0.getTitleID())); - aci0Reserved2Lbl.setText(byteArrToHexString(aci0.getReserved2())); + aci0Reserved1Lbl.setText(byteArrToHexStringAsLE(aci0.getReserved1())); + aci0TitleIDLbl.setText(byteArrToHexStringAsLE(aci0.getTitleID())); + aci0Reserved2Lbl.setText(byteArrToHexStringAsLE(aci0.getReserved2())); aci0FsAccessHeaderOffsetLbl.setText(Integer.toString(aci0.getFsAccessHeaderOffset())); aci0FsAccessHeaderSizeLbl.setText(Integer.toString(aci0.getFsAccessHeaderSize())); aci0ServiceAccessControlOffsetLbl.setText(Integer.toString(aci0.getServiceAccessControlOffset())); aci0ServiceAccessControlSizeLbl.setText(Integer.toString(aci0.getServiceAccessControlSize())); aci0KernelAccessControlOffsetLbl.setText(Integer.toString(aci0.getKernelAccessControlOffset())); aci0KernelAccessControlSizeLbl.setText(Integer.toString(aci0.getKernelAccessControlSize())); - aci0Reserved3Lbl.setText(byteArrToHexString(aci0.getReserved3())); + aci0Reserved3Lbl.setText(byteArrToHexStringAsLE(aci0.getReserved3())); ACI0FSAccessHeaderTableController.populateFields(aci0.getFsAccessHeaderProvider()); ACI0ServiceAccessControlTableController.populateFields(aci0.getServiceAccessControlProvider().getCollection()); ACI0KernelAccessControlTableController.populateFields(aci0.getKernelAccessControlProvider()); // ACID ACIDProvider acid = npdmProvider.getAcid(); - acidRsa2048signatureTf.setText(byteArrToHexString(acid.getRsa2048signature())); - acidRsa2048publicKeyTf.setText(byteArrToHexString(acid.getRsa2048publicKey())); + acidRsa2048signatureTf.setText(byteArrToHexStringAsLE(acid.getRsa2048signature())); + acidRsa2048publicKeyTf.setText(byteArrToHexStringAsLE(acid.getRsa2048publicKey())); acidMagicNumLbl.setText(acid.getMagicNum()); acidDataSizeLbl.setText(Integer.toString(acid.getDataSize())); - acidReserved1Lbl.setText(byteArrToHexString(acid.getReserved1())); + acidReserved1Lbl.setText(byteArrToHexStringAsLE(acid.getReserved1())); acidFlag1Lbl.setText(String.format("0x%02x", acid.getFlag1())); acidFlag2Lbl.setText(String.format("0x%02x", acid.getFlag2())); acidFlag3Lbl.setText(String.format("0x%02x", acid.getFlag3())); @@ -261,7 +261,7 @@ public class NPDMController implements ITabController { acidServiceAccessControlSizeLbl.setText(Integer.toString(acid.getServiceAccessControlSize())); acidKernelAccessControlOffsetLbl.setText(Integer.toString(acid.getKernelAccessControlOffset())); acidKernelAccessControlSizeLbl.setText(Integer.toString(acid.getKernelAccessControlSize())); - acidReserved2Lbl.setText(byteArrToHexString(acid.getReserved2())); + acidReserved2Lbl.setText(byteArrToHexStringAsLE(acid.getReserved2())); ACIDFSAccessControlTableController.populateFields(acid.getFsAccessControlProvider()); ACIDServiceAccessControlTableController.populateFields(acid.getServiceAccessControlProvider().getCollection()); diff --git a/src/main/java/konogonka/Controllers/NSP/NSPController.java b/src/main/java/konogonka/Controllers/NSP/NSPController.java index 5b4e439..91a90cc 100644 --- a/src/main/java/konogonka/Controllers/NSP/NSPController.java +++ b/src/main/java/konogonka/Controllers/NSP/NSPController.java @@ -36,7 +36,7 @@ import java.net.URL; import java.util.List; import java.util.ResourceBundle; -import static libKonogonka.Converter.byteArrToHexString; +import static libKonogonka.Converter.byteArrToHexStringAsLE; public class NSPController implements ITabController { @@ -148,7 +148,7 @@ public class NSPController implements ITabController { extractBtn.setDisable(false); magicLbl.setText(pfs0.getHeader().getMagic()); stringTableSizeLbl.setText(Integer.toString(pfs0.getHeader().getStringTableSize())); - paddingLbl.setText(byteArrToHexString(pfs0.getHeader().getPadding())); + paddingLbl.setText(byteArrToHexStringAsLE(pfs0.getHeader().getPadding())); fileEntryTableSizeLbl.setText(String.format("0x%02x", 0x18* pfs0.getHeader().getFilesCount())); stringsTableSizeLbl.setText(String.format("0x%02x", pfs0.getHeader().getStringTableSize())); diff --git a/src/main/java/konogonka/Controllers/TIK/TIKController.java b/src/main/java/konogonka/Controllers/TIK/TIKController.java index ea5014c..44be0fd 100644 --- a/src/main/java/konogonka/Controllers/TIK/TIKController.java +++ b/src/main/java/konogonka/Controllers/TIK/TIKController.java @@ -33,7 +33,7 @@ import java.io.File; import java.net.URL; import java.util.ResourceBundle; -import static libKonogonka.Converter.byteArrToHexString; +import static libKonogonka.Converter.byteArrToHexStringAsLE; public class TIKController implements ITabController { @FXML @@ -109,7 +109,7 @@ public class TIKController implements ITabController { else tikSizeLbl.setText("skipping calculation for in-file ticket"); - sigTypeLbl.setText(byteArrToHexString(tikProvider.getSigType())); + sigTypeLbl.setText(byteArrToHexStringAsLE(tikProvider.getSigType())); switch (sigTypeLbl.getText()){ case "00000100": sigTypeStrLbl.setText("RSA_4096 SHA1"); @@ -154,21 +154,21 @@ public class TIKController implements ITabController { pSizeLbl.setText("???"); break; } - signatureTF.setText(byteArrToHexString(tikProvider.getSignature())); + signatureTF.setText(byteArrToHexStringAsLE(tikProvider.getSignature())); issuerTf.setText(tikProvider.getIssuer()); - titleKeyBlockStartTf.setText(byteArrToHexString(tikProvider.getTitleKeyBlockStartingBytes())); - titleKeyBlockEndTf.setText(byteArrToHexString(tikProvider.getTitleKeyBlockEndingBytes())); + titleKeyBlockStartTf.setText(byteArrToHexStringAsLE(tikProvider.getTitleKeyBlockStartingBytes())); + titleKeyBlockEndTf.setText(byteArrToHexStringAsLE(tikProvider.getTitleKeyBlockEndingBytes())); unknown1Lbl.setText(String.format("0x%02x", tikProvider.getUnknown1())); titleKeyTypeLbl.setText(String.format("0x%02x", tikProvider.getTitleKeyType())); - unknown2Lbl.setText(byteArrToHexString(tikProvider.getUnknown2())); + unknown2Lbl.setText(byteArrToHexStringAsLE(tikProvider.getUnknown2())); masterKeyRevisionLbl.setText(String.format("0x%02x", tikProvider.getMasterKeyRevision())); - unknown3Lbl.setText(byteArrToHexString(tikProvider.getUnknown3())); - ticketIdLbl.setText(byteArrToHexString(tikProvider.getTicketId())); - deviceIdLbl.setText(byteArrToHexString(tikProvider.getDeviceId())); - rightsIdTf.setText(byteArrToHexString(tikProvider.getRightsId())); - accountIdLbl.setText(byteArrToHexString(tikProvider.getAccountId())); - unknown4Lbl.setText(byteArrToHexString(tikProvider.getUnknown4())); + unknown3Lbl.setText(byteArrToHexStringAsLE(tikProvider.getUnknown3())); + ticketIdLbl.setText(byteArrToHexStringAsLE(tikProvider.getTicketId())); + deviceIdLbl.setText(byteArrToHexStringAsLE(tikProvider.getDeviceId())); + rightsIdTf.setText(byteArrToHexStringAsLE(tikProvider.getRightsId())); + accountIdLbl.setText(byteArrToHexStringAsLE(tikProvider.getAccountId())); + unknown4Lbl.setText(byteArrToHexStringAsLE(tikProvider.getUnknown4())); btnImport.setDisable(false); } @Override diff --git a/src/main/java/konogonka/Controllers/XCI/HFSBlockController.java b/src/main/java/konogonka/Controllers/XCI/HFSBlockController.java index d63fab6..8f63372 100644 --- a/src/main/java/konogonka/Controllers/XCI/HFSBlockController.java +++ b/src/main/java/konogonka/Controllers/XCI/HFSBlockController.java @@ -35,7 +35,7 @@ import java.net.URL; import java.util.List; import java.util.ResourceBundle; -import static libKonogonka.Converter.byteArrToHexString; +import static libKonogonka.Converter.byteArrToHexStringAsLE; public class HFSBlockController implements Initializable { @FXML @@ -96,7 +96,7 @@ public class HFSBlockController implements Initializable { hfs0mainMagicNumLbl.setText(hfs0Provider.getMagic()); hfs0mainFileCntLbl.setText(Integer.toString(hfs0Provider.getFilesCount())); hfs0mainStrTblSizeLbl.setText(Integer.toString(hfs0Provider.getStringTableSize())); - hfs0mainPaddingLbl.setText(byteArrToHexString(hfs0Provider.getPadding())); + hfs0mainPaddingLbl.setText(byteArrToHexStringAsLE(hfs0Provider.getPadding())); hfs0mainRawFileDataStartLbl.setText(Long.toString(hfs0Provider.getRawFileDataStart())); hfs0tableFilesListMainController.setContentToTable(hfs0Provider); if (hfs0Provider.getFilesCount() > 0) diff --git a/src/main/java/konogonka/Controllers/XCI/XCIController.java b/src/main/java/konogonka/Controllers/XCI/XCIController.java index 5bbf695..6254411 100644 --- a/src/main/java/konogonka/Controllers/XCI/XCIController.java +++ b/src/main/java/konogonka/Controllers/XCI/XCIController.java @@ -32,7 +32,7 @@ import java.io.File; import java.net.URL; import java.util.ResourceBundle; -import static libKonogonka.Converter.byteArrToHexString; +import static libKonogonka.Converter.byteArrToHexStringAsLE; public class XCIController implements ITabController { @@ -189,11 +189,11 @@ public class XCIController implements ITabController { private void populateFields(XCIProvider xci){ if (xci != null){ /* Header */ - rsa2048pkcs1TF.setText(byteArrToHexString(xci.getGCHeader().getRsa2048PKCS1sig())); + rsa2048pkcs1TF.setText(byteArrToHexStringAsLE(xci.getGCHeader().getRsa2048PKCS1sig())); //RainbowHexDump.hexDumpUTF8(xci.getGCHeader().getRsa2048PKCS1sig()); headLbl.setText(Boolean.toString(xci.getGCHeader().isMagicHeadOk())); //System.out.println(xci.getGCHeader().isMagicHeadOk()); - secureAreaStartAddrTF.setText(byteArrToHexString(xci.getGCHeader().getSecureAreaStartAddr())); + secureAreaStartAddrTF.setText(byteArrToHexStringAsLE(xci.getGCHeader().getSecureAreaStartAddr())); //System.out.println(xci.getGCHeader().isSecureAreaStartAddrOk()); bkupAreaStartAddrLbl.setText(Boolean.toString(xci.getGCHeader().isBkupAreaStartAddrOk())); //System.out.println(xci.getGCHeader().isBkupAreaStartAddrOk()); @@ -231,19 +231,19 @@ public class XCIController implements ITabController { //System.out.println(String.format("%02x", xci.getGCHeader().getGcVersion())); gcFlags.setText(String.format("%02x", xci.getGCHeader().getGcFlags())); //System.out.println(String.format("%02x", xci.getGCHeader().getGcFlags())); - pkgIdTF.setText(byteArrToHexString(xci.getGCHeader().getPkgID())); + pkgIdTF.setText(byteArrToHexStringAsLE(xci.getGCHeader().getPkgID())); //RainbowHexDump.hexDumpUTF8(xci.getGCHeader().getPkgID()); vDataEndAddrLbl.setText(Long.toString(xci.getGCHeader().getValDataEndAddr())); //System.out.println(xci.getGCHeader().getValDataEndAddr()); - gcInfoIVTF.setText(byteArrToHexString(xci.getGCHeader().getGcInfoIV())); + gcInfoIVTF.setText(byteArrToHexStringAsLE(xci.getGCHeader().getGcInfoIV())); //RainbowHexDump.hexDumpUTF8(xci.getGCHeader().getGcInfoIV()); hfs0partOffLbl.setText(Long.toString(xci.getGCHeader().getHfs0partOffset())); //System.out.println(xci.getGCHeader().getHfs0partOffset()); hfs0hdrSizeLbl.setText(Long.toString(xci.getGCHeader().getHfs0headerSize())); //System.out.println(xci.getGCHeader().getHfs0headerSize()); - Hfs0headerSHA256Lbl.setText(byteArrToHexString(xci.getGCHeader().getHfs0headerSHA256())); + Hfs0headerSHA256Lbl.setText(byteArrToHexStringAsLE(xci.getGCHeader().getHfs0headerSHA256())); //RainbowHexDump.hexDumpUTF8(xci.getGCHeader().getHfs0headerSHA256()); - Hfs0initDataSHA256Lbl.setText(byteArrToHexString(xci.getGCHeader().getHfs0initDataSHA256())); + Hfs0initDataSHA256Lbl.setText(byteArrToHexStringAsLE(xci.getGCHeader().getHfs0initDataSHA256())); //RainbowHexDump.hexDumpUTF8(xci.getGCHeader().getHfs0initDataSHA256() ); secureModeFlagLbl.setText(xci.getGCHeader().isSecureModeFlagOk()+" ("+xci.getGCHeader().getSecureModeFlag()+")"); //System.out.print(xci.getGCHeader().getSecureModeFlag()); @@ -254,12 +254,12 @@ public class XCIController implements ITabController { keyFlagLbl.setText(xci.getGCHeader().iskeyFlagOk()+" ("+xci.getGCHeader().getKeyFlag()+")"); //System.out.print(xci.getGCHeader().getKeyFlag()); //System.out.println(xci.getGCHeader().iskeyFlagOk()); - normAreaEndAddrTF.setText(byteArrToHexString(xci.getGCHeader().getNormAreaEndAddr())); + normAreaEndAddrTF.setText(byteArrToHexStringAsLE(xci.getGCHeader().getNormAreaEndAddr())); //System.out.println(xci.getGCHeader().isNormAreaEndAddrOk()); /* GC Info */ fwVersionLbl.setText(Long.toString(xci.getGCInfo().getFwVersion())); - String tempACF = byteArrToHexString(xci.getGCInfo().getAccessCtrlFlags()); + String tempACF = byteArrToHexStringAsLE(xci.getGCInfo().getAccessCtrlFlags()); if (tempACF.equals("1100a100")) accessCtrlFlagsLbl.setText("25Mhz [0x1100a100]"); else if(tempACF.equals("1000a100")) @@ -270,25 +270,25 @@ public class XCIController implements ITabController { readWaitTime2Lbl.setText(Long.toString(xci.getGCInfo().getReadWaitTime2())); writeWaitTime1.setText(Long.toString(xci.getGCInfo().getWriteWaitTime1())); writeWaitTime2.setText(Long.toString(xci.getGCInfo().getWriteWaitTime2())); - fwModeTF.setText(byteArrToHexString(xci.getGCInfo().getFwMode())); - cupVersionTF.setText(byteArrToHexString(xci.getGCInfo().getCupVersion())); + fwModeTF.setText(byteArrToHexStringAsLE(xci.getGCInfo().getFwMode())); + cupVersionTF.setText(byteArrToHexStringAsLE(xci.getGCInfo().getCupVersion())); emptyPadding1Lbl.setText(Boolean.toString(xci.getGCInfo().isEmptyPadding1())); - emptyPadding1TF.setText(byteArrToHexString(xci.getGCInfo().getEmptyPadding1())); - updPartHashTF.setText(byteArrToHexString(xci.getGCInfo().getUpdPartHash())); - cupIDTF.setText(byteArrToHexString(xci.getGCInfo().getCupID())); + emptyPadding1TF.setText(byteArrToHexStringAsLE(xci.getGCInfo().getEmptyPadding1())); + updPartHashTF.setText(byteArrToHexStringAsLE(xci.getGCInfo().getUpdPartHash())); + cupIDTF.setText(byteArrToHexStringAsLE(xci.getGCInfo().getCupID())); emptyPadding2Lbl.setText(Boolean.toString(xci.getGCInfo().isEmptyPadding2())); - emptyPadding2TF.setText(byteArrToHexString(xci.getGCInfo().getEmptyPadding2())); + emptyPadding2TF.setText(byteArrToHexStringAsLE(xci.getGCInfo().getEmptyPadding2())); /* Certificate */ - rsa2048PKCS1sigCertTF.setText(byteArrToHexString(xci.getGCCert().getRsa2048PKCS1sig())); - magicCertCertTF.setText(byteArrToHexString(xci.getGCCert().getMagicCert())); + rsa2048PKCS1sigCertTF.setText(byteArrToHexStringAsLE(xci.getGCCert().getRsa2048PKCS1sig())); + magicCertCertTF.setText(byteArrToHexStringAsLE(xci.getGCCert().getMagicCert())); magicCertCertOkLbl.setText(Boolean.toString(xci.getGCCert().isMagicCertOk())); - unknown1CertTF.setText(byteArrToHexString(xci.getGCCert().getUnknown1())); + unknown1CertTF.setText(byteArrToHexStringAsLE(xci.getGCCert().getUnknown1())); kekIndexCertLbl.setText(String.format("%02x", xci.getGCCert().getKekIndex())); - unknown2CertTF.setText(byteArrToHexString(xci.getGCCert().getUnknown2())); - deviceIDCertTF.setText(byteArrToHexString(xci.getGCCert().getDeviceID())); - unknown3CertTF.setText(byteArrToHexString(xci.getGCCert().getUnknown3())); - encryptedDataCertTF.setText(byteArrToHexString(xci.getGCCert().getEncryptedData())); + unknown2CertTF.setText(byteArrToHexStringAsLE(xci.getGCCert().getUnknown2())); + deviceIDCertTF.setText(byteArrToHexStringAsLE(xci.getGCCert().getDeviceID())); + unknown3CertTF.setText(byteArrToHexStringAsLE(xci.getGCCert().getUnknown3())); + encryptedDataCertTF.setText(byteArrToHexStringAsLE(xci.getGCCert().getEncryptedData())); /* HFS0 */ HFSBlockMainController.populateTab(xci.getHfs0ProviderMain());