From fa1530cbbbe8f355ce72c1a3e0fd26f2a8c6383c Mon Sep 17 00:00:00 2001 From: klks Date: Tue, 26 Jun 2018 12:58:25 +0800 Subject: [PATCH 1/4] Fixed language loading --- Properties/AssemblyInfo.cs | 4 ++-- XCI_Explorer/MainForm.cs | 17 +++++++---------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index 990d09b..f26bd82 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -16,5 +16,5 @@ using System.Runtime.Versioning; [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("206c6c47-87b1-477f-b6e6-f7e7c1a92f8f")] -[assembly: AssemblyFileVersion("1.2.1.0")] -[assembly: AssemblyVersion("1.2.1.0")] +[assembly: AssemblyFileVersion("1.2.2.0")] +[assembly: AssemblyVersion("1.2.2.0")] diff --git a/XCI_Explorer/MainForm.cs b/XCI_Explorer/MainForm.cs index 7126390..e7dc351 100644 --- a/XCI_Explorer/MainForm.cs +++ b/XCI_Explorer/MainForm.cs @@ -280,20 +280,15 @@ namespace XCI_Explorer if (NACP.NACP_Strings[i].Check != 0) { CB_RegionName.Items.Add(Language[i]); - try + string icon_filename = "data\\icon_" + Language[i].Replace(" ", "") + ".dat"; + if (File.Exists(icon_filename)) { - using (Bitmap original = new Bitmap("data\\icon_" + Language[i].Replace(" ", "") + ".dat")) + using (Bitmap original = new Bitmap(icon_filename)) { Icons[i] = new Bitmap(original); + PB_GameIcon.BackgroundImage = Icons[i]; } } - catch - { - // using bad coding practices as a temporary fix until someone can figure out the problem - // Problem: Doesn't find icon dat for some supported languages (info located somewhere else?) - CB_RegionName.Items.Remove(Language[i]); - } - PB_GameIcon.BackgroundImage = Icons[i]; } } TB_GameRev.Text = NACP.NACP_Datas[0].GameVer; @@ -720,7 +715,9 @@ namespace XCI_Explorer private void CB_RegionName_SelectedIndexChanged(object sender, EventArgs e) { int num = Array.FindIndex(Language, (string element) => element.StartsWith(CB_RegionName.Text, StringComparison.Ordinal)); - PB_GameIcon.BackgroundImage = Icons[num]; + PB_GameIcon.BackgroundImage = null; + if (Icons[num] != null) + PB_GameIcon.BackgroundImage = Icons[num]; TB_Name.Text = NACP.NACP_Strings[num].GameName; TB_Dev.Text = NACP.NACP_Strings[num].GameAuthor; } From 1d4b9786c41b06f793debe2d67ed9a4f177485c8 Mon Sep 17 00:00:00 2001 From: klks Date: Tue, 26 Jun 2018 13:06:22 +0800 Subject: [PATCH 2/4] Update --- XCI_Explorer/MainForm.cs | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/XCI_Explorer/MainForm.cs b/XCI_Explorer/MainForm.cs index 9546924..90fa068 100644 --- a/XCI_Explorer/MainForm.cs +++ b/XCI_Explorer/MainForm.cs @@ -289,16 +289,6 @@ namespace XCI_Explorer PB_GameIcon.BackgroundImage = Icons[i]; } } -<<<<<<< HEAD -======= - catch - { - // using bad coding practices as a temporary fix until someone can figure out the problem - // Problem: Doesn't find icon dat for some supported languages (info located somewhere else?) [1-2 Switch] - CB_RegionName.Items.Remove(Language[i]); - } - PB_GameIcon.BackgroundImage = Icons[i]; ->>>>>>> ee7864e453dc32866f78efc55d7dfe3c5cc66907 } } TB_GameRev.Text = NACP.NACP_Datas[0].GameVer; From 2ed6cf776905857bf051caddd098970781e8de72 Mon Sep 17 00:00:00 2001 From: klks Date: Tue, 26 Jun 2018 13:13:05 +0800 Subject: [PATCH 3/4] Update2 --- XCI_Explorer/MainForm.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/XCI_Explorer/MainForm.cs b/XCI_Explorer/MainForm.cs index 90fa068..c891cf6 100644 --- a/XCI_Explorer/MainForm.cs +++ b/XCI_Explorer/MainForm.cs @@ -724,9 +724,7 @@ namespace XCI_Explorer private void CB_RegionName_SelectedIndexChanged(object sender, EventArgs e) { int num = Array.FindIndex(Language, (string element) => element.StartsWith(CB_RegionName.Text, StringComparison.Ordinal)); - PB_GameIcon.BackgroundImage = null; - if (Icons[num] != null) - PB_GameIcon.BackgroundImage = Icons[num]; + PB_GameIcon.BackgroundImage = Icons[num]; TB_Name.Text = NACP.NACP_Strings[num].GameName; TB_Dev.Text = NACP.NACP_Strings[num].GameAuthor; } From 3489c6a5986855e1774173a2de88f064daeae11f Mon Sep 17 00:00:00 2001 From: klks Date: Tue, 26 Jun 2018 17:27:54 +0800 Subject: [PATCH 4/4] Disable losing focus of treeview --- XCI Explorer.csproj | 5 +++++ XCI_Explorer/MainForm.cs | 5 +++-- XCI_Explorer/NACP.cs | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/XCI Explorer.csproj b/XCI Explorer.csproj index 93deeca..95f5446 100644 --- a/XCI Explorer.csproj +++ b/XCI Explorer.csproj @@ -72,5 +72,10 @@ + + + MainForm.cs + + \ No newline at end of file diff --git a/XCI_Explorer/MainForm.cs b/XCI_Explorer/MainForm.cs index c891cf6..28d848f 100644 --- a/XCI_Explorer/MainForm.cs +++ b/XCI_Explorer/MainForm.cs @@ -273,10 +273,10 @@ namespace XCI_Explorer if (File.Exists("data\\control.nacp")) { byte[] source = File.ReadAllBytes("data\\control.nacp"); - NACP.NACP_Datas[0] = new NACP.NACP_Data(source.Skip(12288).Take(4096).ToArray()); + NACP.NACP_Datas[0] = new NACP.NACP_Data(source.Skip(0x3000).Take(0x1000).ToArray()); for (int i = 0; i < NACP.NACP_Strings.Length; i++) { - NACP.NACP_Strings[i] = new NACP.NACP_String(source.Skip(i * 768).Take(768).ToArray()); + NACP.NACP_Strings[i] = new NACP.NACP_String(source.Skip(i * 0x300).Take(0x300).ToArray()); if (NACP.NACP_Strings[i].Check != 0) { CB_RegionName.Items.Add(Language[i]); @@ -1276,6 +1276,7 @@ namespace XCI_Explorer // TV_Partitions // this.TV_Partitions.Dock = System.Windows.Forms.DockStyle.Top; + this.TV_Partitions.HideSelection = false; this.TV_Partitions.Location = new System.Drawing.Point(3, 3); this.TV_Partitions.Name = "TV_Partitions"; this.TV_Partitions.Size = new System.Drawing.Size(341, 361); diff --git a/XCI_Explorer/NACP.cs b/XCI_Explorer/NACP.cs index f1d1641..86bf151 100644 --- a/XCI_Explorer/NACP.cs +++ b/XCI_Explorer/NACP.cs @@ -35,8 +35,8 @@ namespace XCI_Explorer public NACP_Data(byte[] data) { Data = data; - GameVer = Encoding.UTF8.GetString(Data.Skip(96).Take(16).ToArray()); - GameProd = Encoding.UTF8.GetString(Data.Skip(168).Take(8).ToArray()); + GameVer = Encoding.UTF8.GetString(Data.Skip(0x60).Take(16).ToArray()); + GameProd = Encoding.UTF8.GetString(Data.Skip(0xA8).Take(8).ToArray()); } }