From a69adf863e7e4ccc312e43ad592db4472e945df4 Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Fri, 27 Sep 2019 04:18:57 +0300 Subject: [PATCH] FS Access Header done --- .../NPDM/FSAccessHeaderController.java | 191 +++ .../NPDM/KernelAccessControlController.java | 2 +- .../Controllers/NPDM/NPDMController.java | 16 +- .../Tools/NPDM/{ => ACI0}/ACI0Provider.java | 6 +- .../{ => ACI0}/FSAccessHeaderProvider.java | 18 +- .../Tools/NPDM/ACID/ACIDProvider.java | 3 +- .../KernelAccessControlProvider.java | 2 +- .../konogonka/Tools/NPDM/NPDMProvider.java | 1 + .../ServiceAccessControlProvider.java | 2 +- .../FXML/NPDM/FSAccessControlTable.fxml | 2 +- .../FXML/NPDM/FSAccessHeaderTable.fxml | 1468 +++++++++++++++++ .../FXML/NPDM/KernelAccessControlTable.fxml | 2 +- src/main/resources/FXML/NPDM/NPDMTab.fxml | 1 + .../FXML/NPDM/ServiceAccessControlTable.fxml | 2 +- 14 files changed, 1681 insertions(+), 35 deletions(-) create mode 100644 src/main/java/konogonka/Controllers/NPDM/FSAccessHeaderController.java rename src/main/java/konogonka/Tools/NPDM/{ => ACI0}/ACI0Provider.java (95%) rename src/main/java/konogonka/Tools/NPDM/{ => ACI0}/FSAccessHeaderProvider.java (65%) rename src/main/java/konogonka/Tools/NPDM/{ACID => }/KernelAccessControlProvider.java (99%) rename src/main/java/konogonka/Tools/NPDM/{ACID => }/ServiceAccessControlProvider.java (95%) create mode 100644 src/main/resources/FXML/NPDM/FSAccessHeaderTable.fxml diff --git a/src/main/java/konogonka/Controllers/NPDM/FSAccessHeaderController.java b/src/main/java/konogonka/Controllers/NPDM/FSAccessHeaderController.java new file mode 100644 index 0000000..b081e56 --- /dev/null +++ b/src/main/java/konogonka/Controllers/NPDM/FSAccessHeaderController.java @@ -0,0 +1,191 @@ +package konogonka.Controllers.NPDM; + +import javafx.fxml.FXML; +import javafx.fxml.Initializable; +import javafx.scene.control.Label; +import javafx.scene.control.TextField; +import konogonka.Tools.NPDM.ACI0.FSAccessHeaderProvider; + +import java.net.URL; +import java.util.ResourceBundle; + +import static konogonka.LoperConverter.byteArrToHexString; +import static konogonka.LoperConverter.longToOctString; + +public class FSAccessHeaderController implements Initializable { + @FXML + private Label versionLbl, + paddingLbl, + permBitmskLbl, + dataSizeLbl, + sizeContOwnIdLbl, + dataSizePlusContOwnSizeLbl, + sizeOfSaveDataOwnSecLbl; + @FXML + private TextField unknownTf; + + @FXML + private Label mask0, + mask1, + mask2, + mask3, + mask4, + mask5, + mask6, + mask7, + mask8, + mask9, + mask10, + mask11, + mask12, + mask13, + mask14, + mask15, + mask16, + mask17, + mask18, + mask19, + mask20, + mask21, + mask22, + mask23, + mask24, + mask25, + mask26, + mask27, + mask28, + mask29, + mask30, + mask31, + mask32, + mask33, + mask34, + mask35, + mask36, + mask37, + mask38, + mask39, + mask40, + mask41, + mask42, + mask43, + mask44, + mask45, + mask46, + mask47, + mask48, + mask49, + mask50, + mask51, + mask52, + mask53, + mask54, + mask55, + mask56, + mask57, + mask58, + mask59, + mask60, + mask61, + mask62, + mask63; + + private Label[] masksArr; + + @Override + public void initialize(URL url, ResourceBundle resourceBundle) { + masksArr = new Label[64]; + masksArr[0] = mask0; + masksArr[1] = mask1; + masksArr[2] = mask2; + masksArr[3] = mask3; + masksArr[4] = mask4; + masksArr[5] = mask5; + masksArr[6] = mask6; + masksArr[7] = mask7; + masksArr[8] = mask8; + masksArr[9] = mask9; + masksArr[10] = mask10; + masksArr[11] = mask11; + masksArr[12] = mask12; + masksArr[13] = mask13; + masksArr[14] = mask14; + masksArr[15] = mask15; + masksArr[16] = mask16; + masksArr[17] = mask17; + masksArr[18] = mask18; + masksArr[19] = mask19; + masksArr[20] = mask20; + masksArr[21] = mask21; + masksArr[22] = mask22; + masksArr[23] = mask23; + masksArr[24] = mask24; + masksArr[25] = mask25; + masksArr[26] = mask26; + masksArr[27] = mask27; + masksArr[28] = mask28; + masksArr[29] = mask29; + masksArr[30] = mask30; + masksArr[31] = mask31; + masksArr[32] = mask32; + masksArr[33] = mask33; + masksArr[34] = mask34; + masksArr[35] = mask35; + masksArr[36] = mask36; + masksArr[37] = mask37; + masksArr[38] = mask38; + masksArr[39] = mask39; + masksArr[40] = mask40; + masksArr[41] = mask41; + masksArr[42] = mask42; + masksArr[43] = mask43; + masksArr[44] = mask44; + masksArr[45] = mask45; + masksArr[46] = mask46; + masksArr[47] = mask47; + masksArr[48] = mask48; + masksArr[49] = mask49; + masksArr[50] = mask50; + masksArr[51] = mask51; + masksArr[52] = mask52; + masksArr[53] = mask53; + masksArr[54] = mask54; + masksArr[55] = mask55; + masksArr[56] = mask56; + masksArr[57] = mask57; + masksArr[58] = mask58; + masksArr[59] = mask59; + masksArr[60] = mask60; + masksArr[61] = mask61; + masksArr[62] = mask62; + masksArr[63] = mask63; + } + + public void resetTab() { + versionLbl.setText("-"); + paddingLbl.setText("-"); + permBitmskLbl.setText("-"); + dataSizeLbl.setText("-"); + sizeContOwnIdLbl.setText("-"); + dataSizePlusContOwnSizeLbl.setText("-"); + sizeOfSaveDataOwnSecLbl.setText("-"); + unknownTf.setText("-"); + } + + public void populateFields(FSAccessHeaderProvider provider){ + versionLbl.setText(Integer.toString(provider.getVersion())); + paddingLbl.setText(byteArrToHexString(provider.getPadding())); + StringBuilder sb = new StringBuilder(longToOctString(provider.getPermissionsBitmask())); + sb.reverse(); + String mask = sb.toString(); + permBitmskLbl.setText(mask); + dataSizeLbl.setText(Integer.toString(provider.getDataSize())); + sizeContOwnIdLbl.setText(Integer.toString(provider.getContentOwnIdSectionSize())); + dataSizePlusContOwnSizeLbl.setText(Integer.toString(provider.getDataNownerSizes())); + sizeOfSaveDataOwnSecLbl.setText(Integer.toString(provider.getSaveDataOwnSectionSize())); + unknownTf.setText(byteArrToHexString(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/KernelAccessControlController.java b/src/main/java/konogonka/Controllers/NPDM/KernelAccessControlController.java index ea4b6f1..c549f56 100644 --- a/src/main/java/konogonka/Controllers/NPDM/KernelAccessControlController.java +++ b/src/main/java/konogonka/Controllers/NPDM/KernelAccessControlController.java @@ -6,7 +6,7 @@ import javafx.scene.control.Label; import javafx.scene.control.Separator; import javafx.scene.layout.HBox; import javafx.scene.layout.VBox; -import konogonka.Tools.NPDM.ACID.KernelAccessControlProvider; +import konogonka.Tools.NPDM.KernelAccessControlProvider; import java.util.Map; diff --git a/src/main/java/konogonka/Controllers/NPDM/NPDMController.java b/src/main/java/konogonka/Controllers/NPDM/NPDMController.java index 951a86f..c54190f 100644 --- a/src/main/java/konogonka/Controllers/NPDM/NPDMController.java +++ b/src/main/java/konogonka/Controllers/NPDM/NPDMController.java @@ -6,7 +6,7 @@ import javafx.scene.control.Label; import javafx.scene.control.TextField; import konogonka.Controllers.ITabController; import konogonka.Tools.ISuperProvider; -import konogonka.Tools.NPDM.ACI0Provider; +import konogonka.Tools.NPDM.ACI0.ACI0Provider; import konogonka.Tools.NPDM.ACID.ACIDProvider; import konogonka.Tools.NPDM.NPDMProvider; import konogonka.Workers.Analyzer; @@ -78,16 +78,15 @@ public class NPDMController implements ITabController { //ACID @FXML private FSAccessControlController ACIDFSAccessControlTableController; - @FXML private ServiceAccessControlController ACIDServiceAccessControlTableController; - @FXML private KernelAccessControlController ACIDKernelAccessControlTableController; // ACI0 @FXML + private FSAccessHeaderController ACI0FSAccessHeaderTableController; + @FXML private ServiceAccessControlController ACI0ServiceAccessControlTableController; - @FXML private KernelAccessControlController ACI0KernelAccessControlTableController; @@ -174,13 +173,14 @@ public class NPDMController implements ITabController { acidKernelAccessControlOffsetLbl.setText("-"); acidKernelAccessControlSizeLbl.setText("-"); acidReserved2Lbl.setText("-"); + // ACI0 + ACI0FSAccessHeaderTableController.resetTab(); + ACI0ServiceAccessControlTableController.resetTab(); + ACI0KernelAccessControlTableController.resetTab(); // ACID ACIDFSAccessControlTableController.resetTab(); ACIDServiceAccessControlTableController.resetTab(); ACIDKernelAccessControlTableController.resetTab(); - // ACI0 - ACI0ServiceAccessControlTableController.resetTab(); - ACI0KernelAccessControlTableController.resetTab(); } private void setData(NPDMProvider npdmProvider, File file) { if (npdmProvider == null) @@ -221,7 +221,7 @@ public class NPDMController implements ITabController { aci0KernelAccessControlSizeLbl.setText(Integer.toString(aci0.getKernelAccessControlSize())); aci0Reserved3Lbl.setText(byteArrToHexString(aci0.getReserved3())); - + ACI0FSAccessHeaderTableController.populateFields(aci0.getFsAccessHeaderProvider()); ACI0ServiceAccessControlTableController.populateFields(aci0.getServiceAccessControlProvider().getCollection()); ACI0KernelAccessControlTableController.populateFields(aci0.getKernelAccessControlProvider()); // ACID diff --git a/src/main/java/konogonka/Tools/NPDM/ACI0Provider.java b/src/main/java/konogonka/Tools/NPDM/ACI0/ACI0Provider.java similarity index 95% rename from src/main/java/konogonka/Tools/NPDM/ACI0Provider.java rename to src/main/java/konogonka/Tools/NPDM/ACI0/ACI0Provider.java index e79ecfa..0b6d9cf 100644 --- a/src/main/java/konogonka/Tools/NPDM/ACI0Provider.java +++ b/src/main/java/konogonka/Tools/NPDM/ACI0/ACI0Provider.java @@ -1,7 +1,7 @@ -package konogonka.Tools.NPDM; +package konogonka.Tools.NPDM.ACI0; -import konogonka.Tools.NPDM.ACID.KernelAccessControlProvider; -import konogonka.Tools.NPDM.ACID.ServiceAccessControlProvider; +import konogonka.Tools.NPDM.KernelAccessControlProvider; +import konogonka.Tools.NPDM.ServiceAccessControlProvider; import java.nio.charset.StandardCharsets; import java.util.Arrays; diff --git a/src/main/java/konogonka/Tools/NPDM/FSAccessHeaderProvider.java b/src/main/java/konogonka/Tools/NPDM/ACI0/FSAccessHeaderProvider.java similarity index 65% rename from src/main/java/konogonka/Tools/NPDM/FSAccessHeaderProvider.java rename to src/main/java/konogonka/Tools/NPDM/ACI0/FSAccessHeaderProvider.java index 4f294cf..69ae13e 100644 --- a/src/main/java/konogonka/Tools/NPDM/FSAccessHeaderProvider.java +++ b/src/main/java/konogonka/Tools/NPDM/ACI0/FSAccessHeaderProvider.java @@ -1,7 +1,6 @@ -package konogonka.Tools.NPDM; +package konogonka.Tools.NPDM.ACI0; import konogonka.LoperConverter; -import konogonka.RainbowHexDump; import java.util.Arrays; @@ -28,21 +27,6 @@ public class FSAccessHeaderProvider { dataNownerSizes = LoperConverter.getLEint(bytes, 0x14); saveDataOwnSectionSize = LoperConverter.getLEint(bytes, 0x18); unknownData = Arrays.copyOfRange(bytes, 0x1C, bytes.length); - // - System.out.println("version "+version); - System.out.print("padding "); - RainbowHexDump.hexDumpUTF8(padding); - System.out.print("Permissions Bitmask "); - RainbowHexDump.octDumpLong(permissionsBitmask); - System.out.println( - "DataSize "+dataSize+"\n"+ - "Content OwnId Section Size "+contentOwnIdSectionSize+"\n"+ - "Data + owner "+dataNownerSizes+"\n"+ - "Save Data Own Section Size "+saveDataOwnSectionSize - ); - RainbowHexDump.hexDumpUTF8(Arrays.copyOfRange(bytes, 0x1C, bytes.length)); - //*/ - //reserved = Arrays.copyOfRange(bytes, 0xC, 0x2C); } public byte getVersion() { return version; } diff --git a/src/main/java/konogonka/Tools/NPDM/ACID/ACIDProvider.java b/src/main/java/konogonka/Tools/NPDM/ACID/ACIDProvider.java index f8fe4ef..a673e6d 100644 --- a/src/main/java/konogonka/Tools/NPDM/ACID/ACIDProvider.java +++ b/src/main/java/konogonka/Tools/NPDM/ACID/ACIDProvider.java @@ -1,6 +1,7 @@ package konogonka.Tools.NPDM.ACID; -import konogonka.Tools.NPDM.ACI0Provider; +import konogonka.Tools.NPDM.KernelAccessControlProvider; +import konogonka.Tools.NPDM.ServiceAccessControlProvider; import java.nio.charset.StandardCharsets; import java.util.Arrays; diff --git a/src/main/java/konogonka/Tools/NPDM/ACID/KernelAccessControlProvider.java b/src/main/java/konogonka/Tools/NPDM/KernelAccessControlProvider.java similarity index 99% rename from src/main/java/konogonka/Tools/NPDM/ACID/KernelAccessControlProvider.java rename to src/main/java/konogonka/Tools/NPDM/KernelAccessControlProvider.java index 1237ce3..b6735db 100644 --- a/src/main/java/konogonka/Tools/NPDM/ACID/KernelAccessControlProvider.java +++ b/src/main/java/konogonka/Tools/NPDM/KernelAccessControlProvider.java @@ -1,4 +1,4 @@ -package konogonka.Tools.NPDM.ACID; +package konogonka.Tools.NPDM; import konogonka.LoperConverter; import konogonka.RainbowHexDump; diff --git a/src/main/java/konogonka/Tools/NPDM/NPDMProvider.java b/src/main/java/konogonka/Tools/NPDM/NPDMProvider.java index 01c0475..cec83d5 100644 --- a/src/main/java/konogonka/Tools/NPDM/NPDMProvider.java +++ b/src/main/java/konogonka/Tools/NPDM/NPDMProvider.java @@ -1,6 +1,7 @@ package konogonka.Tools.NPDM; import konogonka.Tools.ASuperInFileProvider; +import konogonka.Tools.NPDM.ACI0.ACI0Provider; import konogonka.Tools.NPDM.ACID.ACIDProvider; import java.io.*; diff --git a/src/main/java/konogonka/Tools/NPDM/ACID/ServiceAccessControlProvider.java b/src/main/java/konogonka/Tools/NPDM/ServiceAccessControlProvider.java similarity index 95% rename from src/main/java/konogonka/Tools/NPDM/ACID/ServiceAccessControlProvider.java rename to src/main/java/konogonka/Tools/NPDM/ServiceAccessControlProvider.java index bcea121..d45b0d9 100644 --- a/src/main/java/konogonka/Tools/NPDM/ACID/ServiceAccessControlProvider.java +++ b/src/main/java/konogonka/Tools/NPDM/ServiceAccessControlProvider.java @@ -1,4 +1,4 @@ -package konogonka.Tools.NPDM.ACID; +package konogonka.Tools.NPDM; import java.nio.charset.StandardCharsets; import java.util.LinkedHashMap; diff --git a/src/main/resources/FXML/NPDM/FSAccessControlTable.fxml b/src/main/resources/FXML/NPDM/FSAccessControlTable.fxml index 4f7ea7f..14d882d 100644 --- a/src/main/resources/FXML/NPDM/FSAccessControlTable.fxml +++ b/src/main/resources/FXML/NPDM/FSAccessControlTable.fxml @@ -14,7 +14,7 @@ - + diff --git a/src/main/resources/FXML/NPDM/FSAccessHeaderTable.fxml b/src/main/resources/FXML/NPDM/FSAccessHeaderTable.fxml new file mode 100644 index 0000000..2060d0e --- /dev/null +++ b/src/main/resources/FXML/NPDM/FSAccessHeaderTable.fxml @@ -0,0 +1,1468 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/FXML/NPDM/KernelAccessControlTable.fxml b/src/main/resources/FXML/NPDM/KernelAccessControlTable.fxml index 9616cd0..af3b6ac 100644 --- a/src/main/resources/FXML/NPDM/KernelAccessControlTable.fxml +++ b/src/main/resources/FXML/NPDM/KernelAccessControlTable.fxml @@ -12,7 +12,7 @@ - + diff --git a/src/main/resources/FXML/NPDM/NPDMTab.fxml b/src/main/resources/FXML/NPDM/NPDMTab.fxml index 2120e21..86242c9 100644 --- a/src/main/resources/FXML/NPDM/NPDMTab.fxml +++ b/src/main/resources/FXML/NPDM/NPDMTab.fxml @@ -735,6 +735,7 @@ + diff --git a/src/main/resources/FXML/NPDM/ServiceAccessControlTable.fxml b/src/main/resources/FXML/NPDM/ServiceAccessControlTable.fxml index be7a894..0ddd389 100644 --- a/src/main/resources/FXML/NPDM/ServiceAccessControlTable.fxml +++ b/src/main/resources/FXML/NPDM/ServiceAccessControlTable.fxml @@ -8,7 +8,7 @@ - +