master_key_0a supported, fix issue #50 and more

Thanks for your great efforts on this work. This Pull Request add these functions:

1. masterkey_0a (or masterkey_10) support. Newest hactool is required for correct XCI information display;

2. small 1GB gamecard size capacity supported instead of "?";

3. now XCI-explorer support both "masterkey_0a" or "masterkey_0A" in "keys.txt" for users' convenience.

However, I am new to C# with few knowledge on its functions. Therefore, the efficiency of this modified code can be further improved. Please feel free to change anything if you need.

Moreover, now the code could only support no more than masterkey_0F from the future, and this also need to be fixed.
This commit is contained in:
zzpong 2020-03-01 15:55:47 +08:00
parent 72fc846986
commit dab1d0ab82
2 changed files with 39 additions and 3 deletions

View file

@ -124,6 +124,7 @@ namespace XCI_Explorer
where x.Length > 1
select x).ToDictionary((string[] x) => x[0].Trim(), (string[] x) => x[1]);
Mkey = "master_key_";
string MkeyL = "master_key_";
if (NCA.NCA_Headers[0].MasterKeyRev == 0 || NCA.NCA_Headers[0].MasterKeyRev == 1)
{
Mkey += "00";
@ -131,7 +132,12 @@ namespace XCI_Explorer
else if (NCA.NCA_Headers[0].MasterKeyRev < 17)
{
int num = NCA.NCA_Headers[0].MasterKeyRev - 1;
Mkey = Mkey + "0" + num.ToString();
string capchar = num.ToString("X");
Mkey = Mkey + "0" + capchar;
char cache1 = capchar[0];
int cache2 = cache1 + 32;
char lowchar = (char)cache2;
MkeyL = MkeyL + "0" + lowchar;
}
else if (NCA.NCA_Headers[0].MasterKeyRev >= 17)
{
@ -144,6 +150,15 @@ namespace XCI_Explorer
return true;
}
catch
{
int flag = 1;
}
try
{
MkeyL = dictionary[MkeyL].Replace(" ", "");
return true;
}
catch
{
return false;
}
@ -634,6 +649,7 @@ namespace XCI_Explorer
else if (strArray[0] == "Master Key Revision")
{
string MasterKey = strArray[1].Trim();
if (MasterKey.Contains("Unknown"))
{
int keyblob;
@ -641,8 +657,26 @@ namespace XCI_Explorer
{
MasterKey = Util.GetMkey((byte)(keyblob + 1)).Replace("MasterKey", "");
}
TB_MKeyRev.Text = "MasterKey" + MasterKey;
}
TB_MKeyRev.Text = "MasterKey" + MasterKey;
else
{
int keyvalue;
char masterkeychar = MasterKey[2];
if (masterkeychar - 'A' < 0)
{
keyvalue = masterkeychar - '0' + 1;
}
else
{
keyvalue = masterkeychar - 'A' + 10 + 1;
}
MasterKey = Util.GetMkey((byte)keyvalue);
TB_MKeyRev.Text = MasterKey;
}
break;
}
}

View file

@ -10,6 +10,8 @@ namespace XCI_Explorer
{
switch (id)
{
case 250:
return "1GB";
case 248:
return "2GB";
case 240:
@ -51,7 +53,7 @@ namespace XCI_Explorer
case 10:
return "MasterKey9 (9.0.0-9.0.1)";
case 11:
return "MasterKey10 (?)";
return "MasterKey10 (9.1.0)";
case 12:
return "MasterKey11 (?)";
case 13: