diff --git a/NUS Downloader/Form1.Designer.cs b/NUS Downloader/Form1.Designer.cs index 1064fa5..b7ea77c 100644 --- a/NUS Downloader/Form1.Designer.cs +++ b/NUS Downloader/Form1.Designer.cs @@ -41,8 +41,6 @@ this.titleversion = new System.Windows.Forms.TextBox(); this.label1 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); - this.radioButton2 = new System.Windows.Forms.RadioButton(); - this.radioButton1 = new System.Windows.Forms.RadioButton(); this.button2 = new System.Windows.Forms.Button(); this.getcerts = new System.Windows.Forms.Button(); this.wadnamebox = new System.Windows.Forms.TextBox(); @@ -96,6 +94,8 @@ this.label12 = new System.Windows.Forms.Label(); this.shamelessvariablelabel = new System.Windows.Forms.Label(); this.button3 = new System.Windows.Forms.Button(); + this.radioButton1 = new System.Windows.Forms.RadioButton(); + this.radioButton2 = new System.Windows.Forms.RadioButton(); this.databaseStrip.SuspendLayout(); this.tmdgpbox.SuspendLayout(); this.ticketgpbox.SuspendLayout(); @@ -210,30 +210,6 @@ this.label2.TabIndex = 11; this.label2.Text = "Enter a Title ID Below:"; // - // radioButton2 - // - this.radioButton2.Image = global::NUS_Downloader.Properties.Resources.dsi; - this.radioButton2.ImageAlign = System.Drawing.ContentAlignment.TopCenter; - this.radioButton2.Location = new System.Drawing.Point(78, 385); - this.radioButton2.Name = "radioButton2"; - this.radioButton2.Size = new System.Drawing.Size(74, 31); - this.radioButton2.TabIndex = 13; - this.radioButton2.UseVisualStyleBackColor = true; - this.radioButton2.CheckedChanged += new System.EventHandler(this.radioButton2_CheckedChanged); - // - // radioButton1 - // - this.radioButton1.BackColor = System.Drawing.Color.Transparent; - this.radioButton1.Checked = true; - this.radioButton1.Image = global::NUS_Downloader.Properties.Resources.wilolgoi; - this.radioButton1.Location = new System.Drawing.Point(12, 385); - this.radioButton1.Name = "radioButton1"; - this.radioButton1.Size = new System.Drawing.Size(60, 31); - this.radioButton1.TabIndex = 12; - this.radioButton1.TabStop = true; - this.radioButton1.UseVisualStyleBackColor = false; - this.radioButton1.CheckedChanged += new System.EventHandler(this.radioButton1_CheckedChanged); - // // button2 // this.button2.FlatStyle = System.Windows.Forms.FlatStyle.Popup; @@ -309,7 +285,8 @@ this.toolStripSeparator1, this.RegionCodesList}); this.databaseStrip.Name = "databaseStrip"; - this.databaseStrip.Size = new System.Drawing.Size(155, 120); + this.databaseStrip.ShowItemToolTips = false; + this.databaseStrip.Size = new System.Drawing.Size(155, 142); // // SystemMenuList // @@ -328,16 +305,16 @@ // this.VCMenuList.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.C64MenuList, + this.GenesisMenuList, + this.MSXMenuList, + this.N64MenuList, this.NeoGeoMenuList, this.NESMenuList, - this.SNESMenuList, - this.N64MenuList, - this.MSXMenuList, - this.TurboGrafx16MenuList, this.SegaMSMenuList, - this.GenesisMenuList, - this.VCArcadeMenuList, - this.TurboGrafxCDMenuList}); + this.SNESMenuList, + this.TurboGrafx16MenuList, + this.TurboGrafxCDMenuList, + this.VCArcadeMenuList}); this.VCMenuList.Name = "VCMenuList"; this.VCMenuList.Size = new System.Drawing.Size(154, 22); this.VCMenuList.Text = "Virtual Console"; @@ -533,9 +510,9 @@ // this.timelimitsecs.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.timelimitsecs.Location = new System.Drawing.Point(95, 99); - this.timelimitsecs.MaxLength = 200; + this.timelimitsecs.MaxLength = 10; this.timelimitsecs.Name = "timelimitsecs"; - this.timelimitsecs.Size = new System.Drawing.Size(62, 20); + this.timelimitsecs.Size = new System.Drawing.Size(148, 20); this.timelimitsecs.TabIndex = 15; this.timelimitsecs.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; // @@ -594,7 +571,7 @@ this.dlcamntbox.Location = new System.Drawing.Point(95, 19); this.dlcamntbox.MaxLength = 6; this.dlcamntbox.Name = "dlcamntbox"; - this.dlcamntbox.Size = new System.Drawing.Size(62, 20); + this.dlcamntbox.Size = new System.Drawing.Size(148, 20); this.dlcamntbox.TabIndex = 9; this.dlcamntbox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; // @@ -735,6 +712,30 @@ this.button3.UseVisualStyleBackColor = true; this.button3.Click += new System.EventHandler(this.button3_Click_1); // + // radioButton1 + // + this.radioButton1.BackColor = System.Drawing.Color.Transparent; + this.radioButton1.Checked = true; + this.radioButton1.Image = global::NUS_Downloader.Properties.Resources.wilolgoi; + this.radioButton1.Location = new System.Drawing.Point(12, 385); + this.radioButton1.Name = "radioButton1"; + this.radioButton1.Size = new System.Drawing.Size(60, 31); + this.radioButton1.TabIndex = 12; + this.radioButton1.TabStop = true; + this.radioButton1.UseVisualStyleBackColor = false; + this.radioButton1.CheckedChanged += new System.EventHandler(this.radioButton1_CheckedChanged); + // + // radioButton2 + // + this.radioButton2.Image = global::NUS_Downloader.Properties.Resources.dsi; + this.radioButton2.ImageAlign = System.Drawing.ContentAlignment.TopCenter; + this.radioButton2.Location = new System.Drawing.Point(78, 385); + this.radioButton2.Name = "radioButton2"; + this.radioButton2.Size = new System.Drawing.Size(74, 31); + this.radioButton2.TabIndex = 13; + this.radioButton2.UseVisualStyleBackColor = true; + this.radioButton2.CheckedChanged += new System.EventHandler(this.radioButton2_CheckedChanged); + // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); diff --git a/NUS Downloader/Form1.cs b/NUS Downloader/Form1.cs index bef8cc5..e2758f4 100644 --- a/NUS Downloader/Form1.cs +++ b/NUS Downloader/Form1.cs @@ -4,6 +4,7 @@ using System.IO; using System.Net; using System.Security.Cryptography; using System.Xml; +using System.Drawing; namespace NUS_Downloader { @@ -11,11 +12,19 @@ namespace NUS_Downloader { const string NUSURL = "http://nus.cdn.shop.wii.com/ccs/download/"; const string DSiNUSURL = "http://nus.cdn.t.shop.nintendowifi.net/ccs/download/"; + // TODO: Always remember to change version! string version = "v1.2 Beta"; WebClient generalWC = new WebClient(); static RijndaelManaged rijndaelCipher; static bool dsidecrypt = false; + // Images do not compare unless globalized... + Image green = Properties.Resources.bullet_green; + Image orange = Properties.Resources.bullet_orange; + Image redorb = Properties.Resources.bullet_red; + Image redgreen = Properties.Resources.bullet_redgreen; + Image redorange = Properties.Resources.bullet_redorange; + public struct WADHeader { public int HeaderSize; @@ -196,7 +205,7 @@ namespace NUS_Downloader } // Check for DSi common key bin file... - if (File.Exists(currentdir + "dskey.bin") == false) + if (File.Exists(currentdir + "dsikey.bin") == false) { // Do not pester about DSi key } @@ -228,6 +237,7 @@ namespace NUS_Downloader ClearDatabaseStrip(); FillDatabaseStrip(); LoadRegionCodes(); + ShowInnerToolTips(false); } return result; @@ -544,6 +554,10 @@ namespace NUS_Downloader WriteStatus("Please enter SOME info..."); return; } + else + { + statusbox.Text = " --- " + titleidbox.Text + " ---"; + } // Running Downloads in background so no form freezing NUSDownloader.RunWorkerAsync(); @@ -662,7 +676,7 @@ namespace NUS_Downloader // Standard/Korea bool koreankey = false; - WriteStatus("0x01F1: " + Convert.ToString(cetkbuf[0x01F1])); + //WriteStatus("0x01F1: " + Convert.ToString(cetkbuf[0x01F1])); if (cetkbuf[0x01F1] == 0x01) { WriteStatus("Key Type: Korean"); @@ -683,7 +697,7 @@ namespace NUS_Downloader keyBytes = LoadCommonKey(@"\key.bin"); } else - keyBytes = LoadCommonKey(@"\dskey.bin"); + keyBytes = LoadCommonKey(@"\dsikey.bin"); initCrypt(iv, keyBytes); @@ -704,6 +718,16 @@ namespace NUS_Downloader } titleversion.Text = Convert.ToString(int.Parse(tmdversion, System.Globalization.NumberStyles.HexNumber)); + // Read System Version (Needed IOS) + string sysversion = ""; + for (int i = 0; i < 8; i++) + { + sysversion += MakeProperLength(ConvertToHex(Convert.ToString(tmd[0x184 + i]))); + } + sysversion = Convert.ToString(int.Parse(sysversion.Substring(14, 2), System.Globalization.NumberStyles.HexNumber)); + if (sysversion != "0") + WriteStatus("Requires: IOS" + sysversion); + // Renaming would be ideal, but gives too many errors... /*if ((currentdir + titleid + "v" + titleversion.Text + @"\") != titledirectory) { @@ -1232,9 +1256,9 @@ namespace NUS_Downloader WriteStatus("Wii Korea Decryption: OK"); } - if (File.Exists(currentdir + "dskey.bin") == false) + if (File.Exists(currentdir + "dsikey.bin") == false) { - WriteStatus("DSi Decryption: Need (dskey.bin)"); + WriteStatus("DSi Decryption: Need (dsikey.bin)"); } else { @@ -1255,7 +1279,9 @@ namespace NUS_Downloader WriteStatus(" * Crediar for his wadmaker tool + source, and for the advice!"); WriteStatus(" * SquidMan/Galaxy/comex/Xuzz for advice/sources."); WriteStatus(" * Pasta for database compilation assistance."); - WriteStatus(" * #WiiDev for general assistance whenever I had questions."); + WriteStatus(" * #WiiDev for answering the tough questions."); + WriteStatus(" * Anyone who helped beta test on GBATemp!"); + WriteStatus(" * Famfamfam for the Silk Icon Set."); } private void getcerts_Click(object sender, EventArgs e) @@ -1557,7 +1583,9 @@ namespace NUS_Downloader string titleID = ""; string descname = ""; string stticket = ""; - + bool dangerous = false; + bool ticket = true; + // Lol. XmlNodeList ChildrenOfTheNode = XMLSpecificNodeTypeList[x].ChildNodes; @@ -1604,15 +1632,21 @@ namespace NUS_Downloader default: break; case "ticket": - bool ticket = Convert.ToBoolean(ChildrenOfTheNode[z].InnerText); - if (!ticket) + ticket = Convert.ToBoolean(ChildrenOfTheNode[z].InnerText); + /*if (!ticket) stticket += "(-)"; else - stticket += "(+)"; + stticket += "(+)"; */ + break; + case "danger": + dangerous = true; + string dangertext = ChildrenOfTheNode[z].InnerText; + XMLToolStripItem.ToolTipText = dangertext; break; } + XMLToolStripItem.Image = SelectItemImage(ticket, dangerous); XMLToolStripItem.Text = titleID + " " + stticket + " " + descname; - XMLToolStripItem.Text = String.Format("{0} {1} {2}", titleID, stticket, descname); + XMLToolStripItem.Text = String.Format("{0} - {1}", titleID, descname); } AddToolStripItemToStrip(i, XMLToolStripItem, XMLAttributes); } @@ -1626,10 +1660,10 @@ namespace NUS_Downloader { switch (attributes[0].Value) { - case "Commodore 64": + case "C64": C64MenuList.DropDownItems.Add(additionitem); break; - case "NeoGeo": + case "NEO": NeoGeoMenuList.DropDownItems.Add(additionitem); break; case "NES": @@ -1641,10 +1675,10 @@ namespace NUS_Downloader case "N64": N64MenuList.DropDownItems.Add(additionitem); break; - case "TurboGrafx16": + case "TG16": TurboGrafx16MenuList.DropDownItems.Add(additionitem); break; - case "TurboGrafxCD": + case "TGCD": TurboGrafxCDMenuList.DropDownItems.Add(additionitem); break; case "MSX": @@ -1653,10 +1687,10 @@ namespace NUS_Downloader case "SMS": SegaMSMenuList.DropDownItems.Add(additionitem); break; - case "Genesis": + case "GEN": GenesisMenuList.DropDownItems.Add(additionitem); break; - case "VCArcade": + case "ARC": VCArcadeMenuList.DropDownItems.Add(additionitem); break; default: @@ -1690,7 +1724,12 @@ namespace NUS_Downloader titleidbox.Text = e.ClickedItem.OwnerItem.Text.Substring(0, 16); titleversion.Text = ""; titleidbox.Text = titleidbox.Text.Replace("XX", e.ClickedItem.Text.Substring(0, 2)); - if (e.ClickedItem.OwnerItem.Text.Contains("(-)")) + + // Prepare StatusBox... + statusbox.Text = " --- " + e.ClickedItem.OwnerItem.Text.Substring(19, (e.ClickedItem.OwnerItem.Text.Length - 19)) + " ---"; + + // Check if a ticket is present... + if ((e.ClickedItem.OwnerItem.Image) == (orange) || (e.ClickedItem.OwnerItem.Image) == (redorange)) { ignoreticket.Checked = true; WriteStatus("Note: This title has no ticket and cannot be packed/decrypted!"); @@ -1701,6 +1740,12 @@ namespace NUS_Downloader { ignoreticket.Checked = false; } + + // Check for danger item + if ((e.ClickedItem.OwnerItem.Image) == (redgreen) || (e.ClickedItem.OwnerItem.Image) == (redorange)) + { + WriteStatus("\r\n" + e.ClickedItem.OwnerItem.ToolTipText); + } } void sysitem_versionclicked(object sender, ToolStripItemClickedEventArgs e) @@ -1725,7 +1770,11 @@ namespace NUS_Downloader { titleversion.Text = ""; } - if (e.ClickedItem.OwnerItem.Text.Contains("(-)")) + + // Prepare StatusBox... + statusbox.Text = " --- " + e.ClickedItem.OwnerItem.Text.Substring(19, (e.ClickedItem.OwnerItem.Text.Length - 19)) + " ---"; + + if ((e.ClickedItem.OwnerItem.Image) == (orange) || (e.ClickedItem.OwnerItem.Image) == (redorange)) { ignoreticket.Checked = true; WriteStatus("Note: This title has no ticket and cannot be packed/decrypted!"); @@ -1736,6 +1785,12 @@ namespace NUS_Downloader { ignoreticket.Checked = false; } + + // Check for danger item + if ((e.ClickedItem.OwnerItem.Image) == (redgreen) || (e.ClickedItem.OwnerItem.Image) == (redorange)) + { + WriteStatus("\n" + e.ClickedItem.OwnerItem.ToolTipText); + } } void HandleMismatch(int contentsize, int actualsize) @@ -2085,12 +2140,56 @@ namespace NUS_Downloader private void SetEnableforDownload(bool enabled) { + // Disable things the user should not mess with during download... downloadstartbtn.Enabled = enabled; titleidbox.Enabled = enabled; titleversion.Enabled = enabled; TMDButton.Enabled = enabled; databaseButton.Enabled = enabled; + packbox.Enabled = enabled; + localuse.Enabled = enabled; + ignoreticket.Enabled = enabled; + truchabox.Enabled = enabled; + decryptbox.Enabled = enabled; } + private void ShowInnerToolTips(bool enabled) + { + // Force tooltips to GTFO in sub menus... + foreach (ToolStripItem item in databaseStrip.Items) + { + try + { + ToolStripMenuItem menuitem = (ToolStripMenuItem)item; + menuitem.DropDown.ShowItemToolTips = false; + } + catch (Exception) + { + // Do nothing, some objects will not cast. + } + + } + } + + private System.Drawing.Image SelectItemImage(bool ticket, bool danger) + { + // All is good, go green... + if ((ticket) && (!danger)) + return green; + + // There's no ticket, but danger is clear... + if ((!ticket) && (!danger)) + return orange; + + // DANGER WILL ROBINSON... + if ((ticket) && (danger)) + return redgreen; + + // Double bad... + if ((!ticket) && (danger)) + return redorange; + + return null; + } } } diff --git a/NUS Downloader/NUS Downloader.csproj b/NUS Downloader/NUS Downloader.csproj index e3685bd..cf67e5c 100644 --- a/NUS Downloader/NUS Downloader.csproj +++ b/NUS Downloader/NUS Downloader.csproj @@ -30,7 +30,7 @@ false false true - 5 + 6 1.0.0.%2a false true @@ -102,6 +102,11 @@ + + + + + diff --git a/NUS Downloader/Properties/Resources.Designer.cs b/NUS Downloader/Properties/Resources.Designer.cs index c4b5c1e..2286bbc 100644 --- a/NUS Downloader/Properties/Resources.Designer.cs +++ b/NUS Downloader/Properties/Resources.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:2.0.50727.3506 +// Runtime Version:2.0.50727.4918 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -60,6 +60,41 @@ namespace NUS_Downloader.Properties { } } + internal static System.Drawing.Bitmap bullet_green { + get { + object obj = ResourceManager.GetObject("bullet_green", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap bullet_orange { + get { + object obj = ResourceManager.GetObject("bullet_orange", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap bullet_red { + get { + object obj = ResourceManager.GetObject("bullet_red", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap bullet_redgreen { + get { + object obj = ResourceManager.GetObject("bullet_redgreen", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap bullet_redorange { + get { + object obj = ResourceManager.GetObject("bullet_redorange", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + internal static System.Drawing.Bitmap dsi { get { object obj = ResourceManager.GetObject("dsi", resourceCulture); diff --git a/NUS Downloader/Properties/Resources.resx b/NUS Downloader/Properties/Resources.resx index 7750e12..3757dc4 100644 --- a/NUS Downloader/Properties/Resources.resx +++ b/NUS Downloader/Properties/Resources.resx @@ -124,4 +124,19 @@ ..\Resources\dsi.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\bullet_red.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\bullet_green.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\bullet_orange.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\bullet_redorange.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\bullet_redgreen.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/NUS Downloader/Resources/bullet_green.png b/NUS Downloader/Resources/bullet_green.png new file mode 100644 index 0000000..058ad26 Binary files /dev/null and b/NUS Downloader/Resources/bullet_green.png differ diff --git a/NUS Downloader/Resources/bullet_orange.png b/NUS Downloader/Resources/bullet_orange.png new file mode 100644 index 0000000..fa63024 Binary files /dev/null and b/NUS Downloader/Resources/bullet_orange.png differ diff --git a/NUS Downloader/Resources/bullet_red.png b/NUS Downloader/Resources/bullet_red.png new file mode 100644 index 0000000..0cd8031 Binary files /dev/null and b/NUS Downloader/Resources/bullet_red.png differ diff --git a/NUS Downloader/Resources/bullet_redgreen.png b/NUS Downloader/Resources/bullet_redgreen.png new file mode 100644 index 0000000..fb50ca8 Binary files /dev/null and b/NUS Downloader/Resources/bullet_redgreen.png differ diff --git a/NUS Downloader/Resources/bullet_redorange.png b/NUS Downloader/Resources/bullet_redorange.png new file mode 100644 index 0000000..339d374 Binary files /dev/null and b/NUS Downloader/Resources/bullet_redorange.png differ