diff --git a/NUS Downloader.sln b/NUS Downloader.sln index 768526b..bed4484 100644 --- a/NUS Downloader.sln +++ b/NUS Downloader.sln @@ -1,6 +1,6 @@  Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual C# Express 2010 +# Visual Studio 2010 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NUS Downloader", "NUS Downloader\NUS Downloader.csproj", "{DB1289FA-BA83-408F-A576-326E5EC4CC6D}" EndProject Global diff --git a/NUS Downloader/Form1.Designer.cs b/NUS Downloader/Form1.Designer.cs index c1f8899..b2ecedc 100644 --- a/NUS Downloader/Form1.Designer.cs +++ b/NUS Downloader/Form1.Designer.cs @@ -65,46 +65,10 @@ this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); this.RegionCodesList = new System.Windows.Forms.ToolStripMenuItem(); this.MassUpdateList = new System.Windows.Forms.ToolStripMenuItem(); - this.truchabox = new System.Windows.Forms.CheckBox(); - this.tmdgpbox = new System.Windows.Forms.GroupBox(); - this.tmdversiontrucha = new System.Windows.Forms.TextBox(); - this.label5 = new System.Windows.Forms.Label(); - this.newtitleidbox = new System.Windows.Forms.TextBox(); - this.label4 = new System.Windows.Forms.Label(); - this.requiredIOSbox = new System.Windows.Forms.TextBox(); - this.label3 = new System.Windows.Forms.Label(); - this.ticketgpbox = new System.Windows.Forms.GroupBox(); - this.timelimitsecs = new System.Windows.Forms.TextBox(); - this.label11 = new System.Windows.Forms.Label(); - this.timelimitenabledcb = new System.Windows.Forms.ComboBox(); - this.label10 = new System.Windows.Forms.Label(); - this.ckeyindexcb = new System.Windows.Forms.ComboBox(); - this.label9 = new System.Windows.Forms.Label(); - this.dlcamntbox = new System.Windows.Forms.TextBox(); - this.label8 = new System.Windows.Forms.Label(); - this.titleIDIV = new System.Windows.Forms.TextBox(); - this.label7 = new System.Windows.Forms.Label(); - this.titlekeybox = new System.Windows.Forms.TextBox(); - this.label6 = new System.Windows.Forms.Label(); - this.button1 = new System.Windows.Forms.Button(); - this.button4 = new System.Windows.Forms.Button(); - this.button5 = new System.Windows.Forms.Button(); - this.button6 = new System.Windows.Forms.Button(); - this.button7 = new System.Windows.Forms.Button(); - this.shamelessvariablelabel = new System.Windows.Forms.Label(); + this.PALMassUpdate = new System.Windows.Forms.ToolStripMenuItem(); + this.NTSCMassUpdate = new System.Windows.Forms.ToolStripMenuItem(); + this.KoreaMassUpdate = new System.Windows.Forms.ToolStripMenuItem(); this.button3 = new System.Windows.Forms.Button(); - this.contentsEdit = new System.Windows.Forms.ListBox(); - this.contentModBox = new System.Windows.Forms.GroupBox(); - this.button16 = new System.Windows.Forms.Button(); - this.button13 = new System.Windows.Forms.Button(); - this.button15 = new System.Windows.Forms.Button(); - this.button14 = new System.Windows.Forms.Button(); - this.button12 = new System.Windows.Forms.Button(); - this.button8 = new System.Windows.Forms.Button(); - this.button11 = new System.Windows.Forms.Button(); - this.button9 = new System.Windows.Forms.Button(); - this.button10 = new System.Windows.Forms.Button(); - this.button17 = new System.Windows.Forms.Button(); this.extrasStrip = new System.Windows.Forms.ContextMenuStrip(this.components); this.loadInfoFromTMDToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); @@ -115,8 +79,6 @@ this.koreaToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator(); this.proxySettingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator(); - this.enableBETATruchaFeaturesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator6 = new System.Windows.Forms.ToolStripSeparator(); this.loadNUSScriptToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator7 = new System.Windows.Forms.ToolStripSeparator(); @@ -139,14 +101,7 @@ this.radioButton1 = new System.Windows.Forms.RadioButton(); this.radioButton2 = new System.Windows.Forms.RadioButton(); this.dlprogress = new wyDay.Controls.Windows7ProgressBar(); - this.PALMassUpdate = new System.Windows.Forms.ToolStripMenuItem(); - this.NTSCMassUpdate = new System.Windows.Forms.ToolStripMenuItem(); - this.KoreaMassUpdate = new System.Windows.Forms.ToolStripMenuItem(); - this.databaseStrip.SuspendLayout(); - this.tmdgpbox.SuspendLayout(); - this.ticketgpbox.SuspendLayout(); - this.contentModBox.SuspendLayout(); this.extrasStrip.SuspendLayout(); this.proxyBox.SuspendLayout(); this.ProxyVerifyBox.SuspendLayout(); @@ -454,290 +409,23 @@ this.MassUpdateList.Size = new System.Drawing.Size(166, 22); this.MassUpdateList.Text = "Download Scripts"; // - // truchabox + // PALMassUpdate // - this.truchabox.AutoSize = true; - this.truchabox.Location = new System.Drawing.Point(199, 463); - this.truchabox.Name = "truchabox"; - this.truchabox.Size = new System.Drawing.Size(60, 17); - this.truchabox.TabIndex = 21; - this.truchabox.Text = "Trucha"; - this.truchabox.UseVisualStyleBackColor = true; - this.truchabox.Visible = false; + this.PALMassUpdate.Name = "PALMassUpdate"; + this.PALMassUpdate.Size = new System.Drawing.Size(104, 22); + this.PALMassUpdate.Text = "PAL"; // - // tmdgpbox + // NTSCMassUpdate // - this.tmdgpbox.Controls.Add(this.tmdversiontrucha); - this.tmdgpbox.Controls.Add(this.label5); - this.tmdgpbox.Controls.Add(this.newtitleidbox); - this.tmdgpbox.Controls.Add(this.label4); - this.tmdgpbox.Controls.Add(this.requiredIOSbox); - this.tmdgpbox.Controls.Add(this.label3); - this.tmdgpbox.Location = new System.Drawing.Point(278, 12); - this.tmdgpbox.Name = "tmdgpbox"; - this.tmdgpbox.Size = new System.Drawing.Size(249, 77); - this.tmdgpbox.TabIndex = 22; - this.tmdgpbox.TabStop = false; - this.tmdgpbox.Text = "Fake (Trucha) TMD Signing..."; + this.NTSCMassUpdate.Name = "NTSCMassUpdate"; + this.NTSCMassUpdate.Size = new System.Drawing.Size(104, 22); + this.NTSCMassUpdate.Text = "NTSC"; // - // tmdversiontrucha + // KoreaMassUpdate // - this.tmdversiontrucha.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.tmdversiontrucha.Location = new System.Drawing.Point(181, 24); - this.tmdversiontrucha.MaxLength = 6; - this.tmdversiontrucha.Name = "tmdversiontrucha"; - this.tmdversiontrucha.Size = new System.Drawing.Size(62, 20); - this.tmdversiontrucha.TabIndex = 5; - this.tmdversiontrucha.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; - // - // label5 - // - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(130, 28); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(45, 13); - this.label5.TabIndex = 4; - this.label5.Text = "Version:"; - // - // newtitleidbox - // - this.newtitleidbox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.newtitleidbox.Location = new System.Drawing.Point(80, 50); - this.newtitleidbox.MaxLength = 16; - this.newtitleidbox.Name = "newtitleidbox"; - this.newtitleidbox.Size = new System.Drawing.Size(163, 20); - this.newtitleidbox.TabIndex = 3; - this.newtitleidbox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(6, 54); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(69, 13); - this.label4.TabIndex = 2; - this.label4.Text = "New Title ID:"; - // - // requiredIOSbox - // - this.requiredIOSbox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.requiredIOSbox.Location = new System.Drawing.Point(80, 24); - this.requiredIOSbox.MaxLength = 3; - this.requiredIOSbox.Name = "requiredIOSbox"; - this.requiredIOSbox.Size = new System.Drawing.Size(44, 20); - this.requiredIOSbox.TabIndex = 1; - this.requiredIOSbox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(6, 28); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(73, 13); - this.label3.TabIndex = 0; - this.label3.Text = "Requires IOS:"; - // - // ticketgpbox - // - this.ticketgpbox.Controls.Add(this.timelimitsecs); - this.ticketgpbox.Controls.Add(this.label11); - this.ticketgpbox.Controls.Add(this.timelimitenabledcb); - this.ticketgpbox.Controls.Add(this.label10); - this.ticketgpbox.Controls.Add(this.ckeyindexcb); - this.ticketgpbox.Controls.Add(this.label9); - this.ticketgpbox.Controls.Add(this.dlcamntbox); - this.ticketgpbox.Controls.Add(this.label8); - this.ticketgpbox.Controls.Add(this.titleIDIV); - this.ticketgpbox.Controls.Add(this.label7); - this.ticketgpbox.Controls.Add(this.titlekeybox); - this.ticketgpbox.Controls.Add(this.label6); - this.ticketgpbox.Location = new System.Drawing.Point(278, 127); - this.ticketgpbox.Name = "ticketgpbox"; - this.ticketgpbox.Size = new System.Drawing.Size(249, 180); - this.ticketgpbox.TabIndex = 23; - this.ticketgpbox.TabStop = false; - this.ticketgpbox.Text = "Fake (Trucha) Ticket Signing..."; - // - // timelimitsecs - // - this.timelimitsecs.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.timelimitsecs.Location = new System.Drawing.Point(95, 99); - this.timelimitsecs.MaxLength = 10; - this.timelimitsecs.Name = "timelimitsecs"; - this.timelimitsecs.Size = new System.Drawing.Size(148, 20); - this.timelimitsecs.TabIndex = 15; - this.timelimitsecs.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; - // - // label11 - // - this.label11.AutoSize = true; - this.label11.Location = new System.Drawing.Point(7, 101); - this.label11.Name = "label11"; - this.label11.Size = new System.Drawing.Size(84, 13); - this.label11.TabIndex = 14; - this.label11.Text = "Time (Seconds):"; - // - // timelimitenabledcb - // - this.timelimitenabledcb.FormattingEnabled = true; - this.timelimitenabledcb.Items.AddRange(new object[] { - "0 - Disabled", - "1 - Enabled"}); - this.timelimitenabledcb.Location = new System.Drawing.Point(95, 72); - this.timelimitenabledcb.Name = "timelimitenabledcb"; - this.timelimitenabledcb.Size = new System.Drawing.Size(149, 21); - this.timelimitenabledcb.TabIndex = 13; - // - // label10 - // - this.label10.AutoSize = true; - this.label10.Location = new System.Drawing.Point(7, 75); - this.label10.Name = "label10"; - this.label10.Size = new System.Drawing.Size(57, 13); - this.label10.TabIndex = 12; - this.label10.Text = "Time Limit:"; - // - // ckeyindexcb - // - this.ckeyindexcb.FormattingEnabled = true; - this.ckeyindexcb.Items.AddRange(new object[] { - "0 - Standard Key", - "1 - Korean Key"}); - this.ckeyindexcb.Location = new System.Drawing.Point(95, 45); - this.ckeyindexcb.Name = "ckeyindexcb"; - this.ckeyindexcb.Size = new System.Drawing.Size(149, 21); - this.ckeyindexcb.TabIndex = 11; - // - // label9 - // - this.label9.AutoSize = true; - this.label9.Location = new System.Drawing.Point(7, 48); - this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(72, 13); - this.label9.TabIndex = 10; - this.label9.Text = "Common Key:"; - // - // dlcamntbox - // - this.dlcamntbox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.dlcamntbox.Location = new System.Drawing.Point(95, 19); - this.dlcamntbox.MaxLength = 6; - this.dlcamntbox.Name = "dlcamntbox"; - this.dlcamntbox.Size = new System.Drawing.Size(148, 20); - this.dlcamntbox.TabIndex = 9; - this.dlcamntbox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; - // - // label8 - // - this.label8.AutoSize = true; - this.label8.Location = new System.Drawing.Point(7, 21); - this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size(82, 13); - this.label8.TabIndex = 8; - this.label8.Text = "Amount of DLC:"; - // - // titleIDIV - // - this.titleIDIV.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.titleIDIV.Location = new System.Drawing.Point(95, 151); - this.titleIDIV.MaxLength = 16; - this.titleIDIV.Name = "titleIDIV"; - this.titleIDIV.Size = new System.Drawing.Size(148, 20); - this.titleIDIV.TabIndex = 7; - this.titleIDIV.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; - // - // label7 - // - this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(7, 153); - this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(65, 13); - this.label7.TabIndex = 6; - this.label7.Text = "Title ID / IV:"; - // - // titlekeybox - // - this.titlekeybox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.titlekeybox.Location = new System.Drawing.Point(95, 125); - this.titlekeybox.MaxLength = 16; - this.titlekeybox.Name = "titlekeybox"; - this.titlekeybox.Size = new System.Drawing.Size(148, 20); - this.titlekeybox.TabIndex = 5; - this.titlekeybox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; - // - // label6 - // - this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(7, 127); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(51, 13); - this.label6.TabIndex = 4; - this.label6.Text = "Title Key:"; - // - // button1 - // - this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.button1.Location = new System.Drawing.Point(350, 95); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(177, 26); - this.button1.TabIndex = 24; - this.button1.Text = "Write Changes to TMD..."; - this.button1.UseVisualStyleBackColor = true; - this.button1.Click += new System.EventHandler(this.button1_Click_1); - // - // button4 - // - this.button4.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.button4.Location = new System.Drawing.Point(350, 313); - this.button4.Name = "button4"; - this.button4.Size = new System.Drawing.Size(177, 26); - this.button4.TabIndex = 25; - this.button4.Text = "Write Changes to Ticket..."; - this.button4.UseVisualStyleBackColor = true; - this.button4.Click += new System.EventHandler(this.button4_Click_1); - // - // button5 - // - this.button5.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.button5.Location = new System.Drawing.Point(278, 313); - this.button5.Name = "button5"; - this.button5.Size = new System.Drawing.Size(66, 26); - this.button5.TabIndex = 26; - this.button5.Text = "Revert"; - this.button5.UseVisualStyleBackColor = true; - this.button5.Click += new System.EventHandler(this.button5_Click); - // - // button6 - // - this.button6.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.button6.Location = new System.Drawing.Point(278, 95); - this.button6.Name = "button6"; - this.button6.Size = new System.Drawing.Size(66, 26); - this.button6.TabIndex = 27; - this.button6.Text = "Revert"; - this.button6.UseVisualStyleBackColor = true; - this.button6.Click += new System.EventHandler(this.button6_Click); - // - // button7 - // - this.button7.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.button7.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.button7.Location = new System.Drawing.Point(278, 377); - this.button7.Name = "button7"; - this.button7.Size = new System.Drawing.Size(249, 33); - this.button7.TabIndex = 28; - this.button7.Text = "Finished with Trucha Changes..."; - this.button7.UseVisualStyleBackColor = true; - this.button7.Click += new System.EventHandler(this.button7_Click); - // - // shamelessvariablelabel - // - this.shamelessvariablelabel.AutoSize = true; - this.shamelessvariablelabel.Location = new System.Drawing.Point(285, 322); - this.shamelessvariablelabel.Name = "shamelessvariablelabel"; - this.shamelessvariablelabel.Size = new System.Drawing.Size(0, 13); - this.shamelessvariablelabel.TabIndex = 30; - this.shamelessvariablelabel.Visible = false; + this.KoreaMassUpdate.Name = "KoreaMassUpdate"; + this.KoreaMassUpdate.Size = new System.Drawing.Size(104, 22); + this.KoreaMassUpdate.Text = "Korea"; // // button3 // @@ -750,145 +438,6 @@ this.button3.UseVisualStyleBackColor = true; this.button3.Click += new System.EventHandler(this.button3_Click_1); // - // contentsEdit - // - this.contentsEdit.FormattingEnabled = true; - this.contentsEdit.Location = new System.Drawing.Point(9, 19); - this.contentsEdit.Name = "contentsEdit"; - this.contentsEdit.ScrollAlwaysVisible = true; - this.contentsEdit.Size = new System.Drawing.Size(198, 173); - this.contentsEdit.TabIndex = 32; - // - // contentModBox - // - this.contentModBox.Controls.Add(this.button16); - this.contentModBox.Controls.Add(this.button13); - this.contentModBox.Controls.Add(this.button15); - this.contentModBox.Controls.Add(this.button14); - this.contentModBox.Controls.Add(this.button12); - this.contentModBox.Controls.Add(this.contentsEdit); - this.contentModBox.Controls.Add(this.button8); - this.contentModBox.Controls.Add(this.button11); - this.contentModBox.Controls.Add(this.button9); - this.contentModBox.Controls.Add(this.button10); - this.contentModBox.Location = new System.Drawing.Point(265, 146); - this.contentModBox.Name = "contentModBox"; - this.contentModBox.Size = new System.Drawing.Size(249, 329); - this.contentModBox.TabIndex = 41; - this.contentModBox.TabStop = false; - this.contentModBox.Text = "Edit Title Contents"; - this.contentModBox.Visible = false; - // - // button16 - // - this.button16.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.button16.Image = global::NUS_Downloader.Properties.Resources.bug_add; - this.button16.Location = new System.Drawing.Point(136, 198); - this.button16.Name = "button16"; - this.button16.Size = new System.Drawing.Size(26, 26); - this.button16.TabIndex = 44; - this.button16.UseVisualStyleBackColor = true; - this.button16.Click += new System.EventHandler(this.button16_Click); - // - // button13 - // - this.button13.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.button13.Image = global::NUS_Downloader.Properties.Resources.link; - this.button13.Location = new System.Drawing.Point(104, 198); - this.button13.Name = "button13"; - this.button13.Size = new System.Drawing.Size(26, 26); - this.button13.TabIndex = 43; - this.button13.UseVisualStyleBackColor = true; - this.button13.Click += new System.EventHandler(this.button13_Click); - // - // button15 - // - this.button15.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.button15.Location = new System.Drawing.Point(9, 235); - this.button15.Name = "button15"; - this.button15.Size = new System.Drawing.Size(230, 26); - this.button15.TabIndex = 42; - this.button15.Text = "Revert"; - this.button15.UseVisualStyleBackColor = true; - this.button15.Click += new System.EventHandler(this.button15_Click); - // - // button14 - // - this.button14.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.button14.Location = new System.Drawing.Point(9, 268); - this.button14.Name = "button14"; - this.button14.Size = new System.Drawing.Size(230, 50); - this.button14.TabIndex = 41; - this.button14.Text = "Overwrite Title Contents..."; - this.button14.UseVisualStyleBackColor = true; - this.button14.Click += new System.EventHandler(this.button14_Click); - // - // button12 - // - this.button12.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.button12.Image = ((System.Drawing.Image)(resources.GetObject("button12.Image"))); - this.button12.Location = new System.Drawing.Point(72, 198); - this.button12.Name = "button12"; - this.button12.Size = new System.Drawing.Size(26, 26); - this.button12.TabIndex = 40; - this.button12.UseVisualStyleBackColor = true; - this.button12.Click += new System.EventHandler(this.button12_Click); - // - // button8 - // - this.button8.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.button8.Image = ((System.Drawing.Image)(resources.GetObject("button8.Image"))); - this.button8.Location = new System.Drawing.Point(213, 19); - this.button8.Name = "button8"; - this.button8.Size = new System.Drawing.Size(26, 26); - this.button8.TabIndex = 33; - this.button8.UseVisualStyleBackColor = true; - this.button8.Click += new System.EventHandler(this.button8_Click); - // - // button11 - // - this.button11.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.button11.Image = ((System.Drawing.Image)(resources.GetObject("button11.Image"))); - this.button11.Location = new System.Drawing.Point(9, 198); - this.button11.Name = "button11"; - this.button11.Size = new System.Drawing.Size(26, 26); - this.button11.TabIndex = 36; - this.button11.UseVisualStyleBackColor = true; - this.button11.Click += new System.EventHandler(this.button11_Click); - // - // button9 - // - this.button9.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.button9.Image = ((System.Drawing.Image)(resources.GetObject("button9.Image"))); - this.button9.Location = new System.Drawing.Point(213, 53); - this.button9.Name = "button9"; - this.button9.Size = new System.Drawing.Size(26, 26); - this.button9.TabIndex = 34; - this.button9.UseVisualStyleBackColor = true; - this.button9.Click += new System.EventHandler(this.button9_Click); - // - // button10 - // - this.button10.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.button10.Image = ((System.Drawing.Image)(resources.GetObject("button10.Image"))); - this.button10.Location = new System.Drawing.Point(41, 198); - this.button10.Name = "button10"; - this.button10.Size = new System.Drawing.Size(26, 26); - this.button10.TabIndex = 35; - this.button10.UseVisualStyleBackColor = true; - this.button10.Click += new System.EventHandler(this.button10_Click); - // - // button17 - // - this.button17.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.button17.Location = new System.Drawing.Point(278, 345); - this.button17.Name = "button17"; - this.button17.Size = new System.Drawing.Size(249, 26); - this.button17.TabIndex = 42; - this.button17.Text = "Modify Individual Contents..."; - this.button17.UseVisualStyleBackColor = true; - this.button17.Click += new System.EventHandler(this.button17_Click); - // // extrasStrip // this.extrasStrip.AllowMerge = false; @@ -898,8 +447,6 @@ this.emulateUpdate, this.toolStripSeparator4, this.proxySettingsToolStripMenuItem, - this.toolStripSeparator5, - this.enableBETATruchaFeaturesToolStripMenuItem, this.toolStripSeparator6, this.loadNUSScriptToolStripMenuItem, this.toolStripSeparator7, @@ -907,7 +454,7 @@ this.toolStripSeparator2, this.updateDatabaseToolStripMenuItem}); this.extrasStrip.Name = "extrasStrip"; - this.extrasStrip.Size = new System.Drawing.Size(242, 194); + this.extrasStrip.Size = new System.Drawing.Size(242, 166); // // loadInfoFromTMDToolStripMenuItem // @@ -972,19 +519,6 @@ this.proxySettingsToolStripMenuItem.Text = "Proxy Settings"; this.proxySettingsToolStripMenuItem.Click += new System.EventHandler(this.proxySettingsToolStripMenuItem_Click); // - // toolStripSeparator5 - // - this.toolStripSeparator5.Name = "toolStripSeparator5"; - this.toolStripSeparator5.Size = new System.Drawing.Size(238, 6); - // - // enableBETATruchaFeaturesToolStripMenuItem - // - this.enableBETATruchaFeaturesToolStripMenuItem.Image = global::NUS_Downloader.Properties.Resources.bug_error; - this.enableBETATruchaFeaturesToolStripMenuItem.Name = "enableBETATruchaFeaturesToolStripMenuItem"; - this.enableBETATruchaFeaturesToolStripMenuItem.Size = new System.Drawing.Size(241, 22); - this.enableBETATruchaFeaturesToolStripMenuItem.Text = "Enable BETA Trucha Features"; - this.enableBETATruchaFeaturesToolStripMenuItem.Click += new System.EventHandler(this.enableBETATruchaFeaturesToolStripMenuItem_Click); - // // toolStripSeparator6 // this.toolStripSeparator6.Name = "toolStripSeparator6"; @@ -1196,61 +730,32 @@ this.dlprogress.Size = new System.Drawing.Size(250, 15); this.dlprogress.TabIndex = 47; // - // PALMassUpdate - // - this.PALMassUpdate.Name = "PALMassUpdate"; - this.PALMassUpdate.Size = new System.Drawing.Size(152, 22); - this.PALMassUpdate.Text = "PAL"; - // - // NTSCMassUpdate - // - this.NTSCMassUpdate.Name = "NTSCMassUpdate"; - this.NTSCMassUpdate.Size = new System.Drawing.Size(152, 22); - this.NTSCMassUpdate.Text = "NTSC"; - // - // KoreaMassUpdate - // - this.KoreaMassUpdate.Name = "KoreaMassUpdate"; - this.KoreaMassUpdate.Size = new System.Drawing.Size(152, 22); - this.KoreaMassUpdate.Text = "Korea"; - // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(539, 492); + this.ClientSize = new System.Drawing.Size(274, 492); this.Controls.Add(this.dlprogress); this.Controls.Add(this.deletecontentsbox); this.Controls.Add(this.button3); this.Controls.Add(this.ProxyVerifyBox); - this.Controls.Add(this.shamelessvariablelabel); - this.Controls.Add(this.button1); - this.Controls.Add(this.button17); - this.Controls.Add(this.ticketgpbox); - this.Controls.Add(this.tmdgpbox); this.Controls.Add(this.saveaswadbox); this.Controls.Add(this.databaseButton); - this.Controls.Add(this.button5); this.Controls.Add(this.proxyBox); - this.Controls.Add(this.button4); this.Controls.Add(this.wadnamebox); - this.Controls.Add(this.truchabox); this.Controls.Add(this.label2); this.Controls.Add(this.titleversion); this.Controls.Add(this.button2); this.Controls.Add(this.decryptbox); this.Controls.Add(this.label1); - this.Controls.Add(this.button7); this.Controls.Add(this.radioButton1); this.Controls.Add(this.radioButton2); - this.Controls.Add(this.contentModBox); this.Controls.Add(this.packbox); this.Controls.Add(this.statusbox); this.Controls.Add(this.ignoreticket); this.Controls.Add(this.downloadstartbtn); this.Controls.Add(this.titleidbox); this.Controls.Add(this.Extrasbtn); - this.Controls.Add(this.button6); this.Controls.Add(this.localuse); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); @@ -1261,11 +766,6 @@ this.Text = "NUSD"; this.Load += new System.EventHandler(this.Form1_Load); this.databaseStrip.ResumeLayout(false); - this.tmdgpbox.ResumeLayout(false); - this.tmdgpbox.PerformLayout(); - this.ticketgpbox.ResumeLayout(false); - this.ticketgpbox.PerformLayout(); - this.contentModBox.ResumeLayout(false); this.extrasStrip.ResumeLayout(false); this.proxyBox.ResumeLayout(false); this.proxyBox.PerformLayout(); @@ -1313,46 +813,7 @@ private System.Windows.Forms.ToolStripMenuItem TurboGrafxCDMenuList; private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; private System.Windows.Forms.ToolStripMenuItem RegionCodesList; - private System.Windows.Forms.CheckBox truchabox; - private System.Windows.Forms.GroupBox tmdgpbox; - private System.Windows.Forms.GroupBox ticketgpbox; - private System.Windows.Forms.Button button1; - private System.Windows.Forms.Button button4; - private System.Windows.Forms.Button button5; - private System.Windows.Forms.Button button6; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.TextBox newtitleidbox; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.TextBox requiredIOSbox; - private System.Windows.Forms.TextBox tmdversiontrucha; - private System.Windows.Forms.Label label5; - private System.Windows.Forms.TextBox dlcamntbox; - private System.Windows.Forms.Label label8; - private System.Windows.Forms.TextBox titleIDIV; - private System.Windows.Forms.Label label7; - private System.Windows.Forms.TextBox titlekeybox; - private System.Windows.Forms.Label label6; - private System.Windows.Forms.Label label9; - private System.Windows.Forms.ComboBox timelimitenabledcb; - private System.Windows.Forms.Label label10; - private System.Windows.Forms.ComboBox ckeyindexcb; - private System.Windows.Forms.TextBox timelimitsecs; - private System.Windows.Forms.Label label11; - private System.Windows.Forms.Button button7; - private System.Windows.Forms.Label shamelessvariablelabel; private System.Windows.Forms.Button button3; - private System.Windows.Forms.ListBox contentsEdit; - private System.Windows.Forms.Button button8; - private System.Windows.Forms.Button button9; - private System.Windows.Forms.Button button10; - private System.Windows.Forms.Button button11; - private System.Windows.Forms.Button button12; - private System.Windows.Forms.GroupBox contentModBox; - private System.Windows.Forms.Button button14; - private System.Windows.Forms.Button button15; - private System.Windows.Forms.Button button13; - private System.Windows.Forms.Button button16; - private System.Windows.Forms.Button button17; private System.Windows.Forms.ContextMenuStrip extrasStrip; private System.Windows.Forms.ToolStripMenuItem loadInfoFromTMDToolStripMenuItem; private System.Windows.Forms.ToolStripSeparator toolStripSeparator3; @@ -1377,8 +838,6 @@ private System.Windows.Forms.Label label14; private System.Windows.Forms.TextBox ProxyPwdBox; private wyDay.Controls.Windows7ProgressBar dlprogress; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator5; - private System.Windows.Forms.ToolStripMenuItem enableBETATruchaFeaturesToolStripMenuItem; private System.Windows.Forms.ToolStripSeparator toolStripSeparator6; private System.Windows.Forms.ToolStripMenuItem loadNUSScriptToolStripMenuItem; private System.Windows.Forms.ToolStripSeparator toolStripSeparator7; diff --git a/NUS Downloader/Form1.cs b/NUS Downloader/Form1.cs index 76e8ab4..f046ac2 100644 --- a/NUS Downloader/Form1.cs +++ b/NUS Downloader/Form1.cs @@ -456,9 +456,7 @@ namespace NUS_Downloader { 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)); return sysversion; } @@ -538,8 +536,7 @@ namespace NUS_Downloader /// The initial buffer length public static byte[] ReadFully(Stream stream, int initialLength) { - // If we've been passed an unhelpful initial length, just - // use 32K. + // If we've been passed an unhelpful initial length, just use 32K. if (initialLength < 1) { initialLength = 32768; @@ -1152,118 +1149,6 @@ namespace NUS_Downloader WriteStatus("NUS Download Finished."); - // Trucha signing... - if ((truchabox.Checked == true) && (wiimode == true)) - { - // Read information from TMD into signing GUI... - requiredIOSbox.Text = Convert.ToString(tmd[0x18B]); - tmdversiontrucha.Text = Convert.ToString((tmd[0x1DC]*256) + tmd[0x1DD]); - newtitleidbox.Text = titleid; - - // Add contents to contentEdit... - FillContentInfo(tmd); - - // Setup for NO IOS - if (requiredIOSbox.Text == "0") - requiredIOSbox.Enabled = false; - else - requiredIOSbox.Enabled = true; - - // Read information from TIK into signing GUI... - // Titlekey - for (int i = 0; i < 16; i++) - { - titlekey[i] = cetkbuf[0x1BF + i]; - } - //titlekeybox.Text = DisplayBytes(titlekey).Replace(" ", ""); - titlekeybox.Text = System.Text.Encoding.UTF7.GetString(titlekey); - - // IV (TITLEID+00000000s) - byte[] iv = new byte[16]; - for (int i = 0; i < 8; i++) - { - iv[i] = cetkbuf[0x1DC + i]; - } - for (int i = 0; i < 8; i++) - { - iv[i + 8] = 0x00; - } - titleIDIV.Text = DisplayBytes(iv, ""); - - //DLC - dlcamntbox.Text = Convert.ToString((cetkbuf[0x1E6]*256) + cetkbuf[0x1E7]); - - //keyindex - if (cetkbuf[0x1F1] == 0x00) - ckeyindexcb.SelectedIndex = 0; - else if (cetkbuf[0x1F1] == 0x01) - ckeyindexcb.SelectedIndex = 1; - else - ckeyindexcb.SelectedIndex = 0; - - //time enabled - if (cetkbuf[0x247] == 0x00) - timelimitenabledcb.SelectedIndex = 0; - else if (cetkbuf[0x247] == 0x01) - timelimitenabledcb.SelectedIndex = 1; - else - timelimitenabledcb.SelectedIndex = 0; - - //time in seconds - byte[] timelimit = new byte[4]; - for (int i = 0; i < timelimit.Length; i++) - { - timelimit[i] = cetkbuf[0x248 + 1]; - } - timelimitsecs.Text = Convert.ToString(System.BitConverter.ToInt32(timelimit, 0)); - - - // Resize form to max to show trucha options... - this.Size = this.MaximumSize; - - shamelessvariablelabel.Text = String.Format("{0},{1},{2}", titledirectory, tmdfull, contentstrnum); - - // Loop until user is finished... - while (this.Size == this.MaximumSize) - { - System.Threading.Thread.Sleep(1000); - } - - /* Re-Gather information... - byte[] tmdrefresh = FileLocationToByteArray(titledirectory + tmdfull); - tmdcontents = GetContentNames(tmd, ContentCount(tmdrefresh)); - tmdsizes = GetContentSizes(tmd, ContentCount(tmdrefresh)); - tmdhashes = GetContentHashes(tmd, ContentCount(tmdrefresh)); - tmdindices = GetContentIndices(tmd, ContentCount(tmdrefresh)); */ - - /* - WriteStatus("Trucha Signing TMD..."); - Array.Resize(ref tmd, 484 + (Convert.ToInt32(contentstrnum) * 36)); - - tmd = ZeroSignature(tmd); - tmd = TruchaSign(tmd); - - FileStream testtmd = new FileStream(titledirectory + tmdfull, FileMode.Open); - testtmd.Write(tmd, 0, tmd.Length); - testtmd.Close(); - - WriteStatus("Trucha Signing Ticket..."); - - // Create ticket file holder - FileStream cetkf = File.OpenRead(titledirectory + @"\cetk"); - byte[] cetkbuff = ReadFully(cetkf, 20); - cetkf.Close(); - - Array.Resize(ref cetkbuff, 0x2A4); - - cetkbuff = ZeroSignature(cetkbuff); - cetkbuff = TruchaSign(cetkbuff); - - FileStream testtik = new FileStream(titledirectory + "cetk", FileMode.Open); - testtik.Write(cetkbuff, 0, cetkbuff.Length); - testtik.Close(); */ - } - if ((packbox.Checked == true) && (wiimode == true)) { PackWAD(titleid, tmdfull, titledirectory); @@ -1519,9 +1404,6 @@ namespace NUS_Downloader wadnamebox.Enabled = false; wadnamebox.Text = ""; - - // Cannot doit - truchabox.Enabled = false; } } @@ -1533,7 +1415,6 @@ namespace NUS_Downloader // packbox.Checked = true; packbox.Enabled = true; decryptbox.Enabled = true; - truchabox.Enabled = true; } } @@ -1989,6 +1870,8 @@ namespace NUS_Downloader Debug.WriteLine("Oops - database error"); return; } + // SVN was messing with me and i lost track which of these was the latest... + //additionitem.Click += new ToolStripItemClickedEventHandler(upditem_clicked); //additionitem.Click += new EventHandler(upditem_itemclicked); } else @@ -2352,192 +2235,6 @@ namespace NUS_Downloader return array; } - private void button6_Click(object sender, EventArgs e) - { - // Revert to TMD information... - string[] fileinfo = shamelessvariablelabel.Text.Split(','); - - // Read the tmd as a stream... - byte[] tmd = FileLocationToByteArray(fileinfo[0] + fileinfo[1]); - - // Read information from TMD into signing GUI... - requiredIOSbox.Text = Convert.ToString(tmd[0x18B]); - // Lulzy cheap way of getting version... *256 - tmdversiontrucha.Text = Convert.ToString(((tmd[0x1DC]*256) + tmd[0x1DD])); - newtitleidbox.Text = titleidbox.Text; - - // Setup for NO IOS - if (requiredIOSbox.Text == "0") - requiredIOSbox.Enabled = false; - else - requiredIOSbox.Enabled = true; - } - - private void button5_Click(object sender, EventArgs e) - { - // Revert to Ticket information... - string[] fileinfo = shamelessvariablelabel.Text.Split(','); - - // Create ticket file holder - byte[] cetkbuff = FileLocationToByteArray(fileinfo[0] + Path.DirectorySeparatorChar.ToString() + @"cetk"); - - // Titlekey - byte[] titlekey = new byte[16]; - for (int i = 0; i < 16; i++) - { - titlekey[i] = cetkbuff[0x1BF + i]; - } - titlekeybox.Text = System.Text.Encoding.UTF7.GetString(titlekey); - - // IV (TITLEID+00000000s) - byte[] iv = new byte[16]; - for (int i = 0; i < 8; i++) - { - iv[i] = cetkbuff[0x1DC + i]; - } - for (int i = 0; i < 8; i++) - { - iv[i + 8] = 0x00; - } - titleIDIV.Text = DisplayBytes(iv, ""); - - //DLC - dlcamntbox.Text = Convert.ToString((cetkbuff[0x1E6]*256) + cetkbuff[0x1E7]); - - //keyindex - if (cetkbuff[0x1F1] == 0x00) - ckeyindexcb.SelectedIndex = 0; - else if (cetkbuff[0x1F1] == 0x01) - ckeyindexcb.SelectedIndex = 1; - else - ckeyindexcb.SelectedIndex = 0; - - //time enabled - if (cetkbuff[0x247] == 0x00) - timelimitenabledcb.SelectedIndex = 0; - else if (cetkbuff[0x247] == 0x01) - timelimitenabledcb.SelectedIndex = 1; - else - timelimitenabledcb.SelectedIndex = 0; - - //time in seconds - byte[] timelimit = new byte[4]; - for (int i = 0; i < timelimit.Length; i++) - { - timelimit[i] = cetkbuff[0x248 + i]; - } - timelimitsecs.Text = Convert.ToString(System.BitConverter.ToInt32(timelimit, 0)); - } - - private void button1_Click_1(object sender, EventArgs e) - { - // Write Trucha changes to TMD... - WriteStatus("Trucha Signing TMD..."); - - // Cheezy file info - string[] fileinfo = shamelessvariablelabel.Text.Split(','); - - // Read the tmd as a stream... - byte[] tmd = FileLocationToByteArray(fileinfo[0] + fileinfo[1]); - - // Resize to just TMD... - Array.Resize(ref tmd, 484 + (Convert.ToInt32(fileinfo[2]) * 36)); - - // Change Required IOS - if (requiredIOSbox.Text != "0") - { - tmd[0x18B] = Convert.ToByte(requiredIOSbox.Text); - } - - // Change Title Version - byte[] version = new byte[2]; - version = InttoByteArray(Convert.ToInt32(tmdversiontrucha.Text), version.Length); - tmd[0x1DC] = version[version.Length - 2]; - tmd[0x1DD] = version[version.Length - 1]; - - // Change Title ID - tmd[0x18C] = byte.Parse(newtitleidbox.Text.Substring(0, 2), System.Globalization.NumberStyles.HexNumber); - tmd[0x18D] = byte.Parse(newtitleidbox.Text.Substring(2, 2), System.Globalization.NumberStyles.HexNumber); - tmd[0x18E] = byte.Parse(newtitleidbox.Text.Substring(4, 2), System.Globalization.NumberStyles.HexNumber); - tmd[0x18F] = byte.Parse(newtitleidbox.Text.Substring(6, 2), System.Globalization.NumberStyles.HexNumber); - tmd[0x190] = byte.Parse(newtitleidbox.Text.Substring(8, 2), System.Globalization.NumberStyles.HexNumber); - tmd[0x191] = byte.Parse(newtitleidbox.Text.Substring(10, 2), System.Globalization.NumberStyles.HexNumber); - tmd[0x192] = byte.Parse(newtitleidbox.Text.Substring(12, 2), System.Globalization.NumberStyles.HexNumber); - tmd[0x193] = byte.Parse(newtitleidbox.Text.Substring(14, 2), System.Globalization.NumberStyles.HexNumber); - - tmd = ZeroSignature(tmd); - tmd = TruchaSign(tmd); - - FileStream testtmd = new FileStream(fileinfo[0] + fileinfo[1], FileMode.Open); - testtmd.Write(tmd, 0, tmd.Length); - testtmd.Close(); - } - - private void button4_Click_1(object sender, EventArgs e) - { - // Write Trucha changes to Ticket... - WriteStatus("Trucha Signing Ticket..."); - - // Cheezy file info - string[] fileinfo = shamelessvariablelabel.Text.Split(','); - - // Create ticket file holder - byte[] cetkbuff = FileLocationToByteArray(fileinfo[0] + Path.DirectorySeparatorChar.ToString() + @"cetk"); - - // Resize Ticket to actual size. - Array.Resize(ref cetkbuff, 0x2A4); - - // TODO: Title Key and IV changes! - WriteStatus("Title Key / IV are not available to change in this release :("); - - // Write DLC Amount. - byte[] dlcamount = new byte[2]; - dlcamount = InttoByteArray(Convert.ToInt32(dlcamntbox.Text), dlcamount.Length); - cetkbuff[0x1E6] = dlcamount[dlcamount.Length - 2]; - cetkbuff[0x1E7] = dlcamount[dlcamount.Length - 1]; - - // Common Key index. - if (ckeyindexcb.SelectedIndex == 0) - cetkbuff[0x1F1] = 0x00; - else if (ckeyindexcb.SelectedIndex == 1) - cetkbuff[0x1F1] = 0x01; - else - cetkbuff[0x1F1] = 0x00; - - // Time limit enable. - if (timelimitenabledcb.SelectedIndex == 0) - cetkbuff[0x247] = 0x00; - else if (timelimitenabledcb.SelectedIndex == 1) - cetkbuff[0x247] = 0x01; - else - cetkbuff[0x247] = 0x00; - - // The amount of time for the limit. - byte[] limitseconds = new byte[4]; - limitseconds = InttoByteArray(Convert.ToInt32(timelimitsecs.Text), 4); - - for (int i = 0; i < 4; i++) - { - cetkbuff[0x248 + i] = limitseconds[i]; - } - - // Trucha (Fake) Sign - cetkbuff = ZeroSignature(cetkbuff); - cetkbuff = TruchaSign(cetkbuff); - - // Write changes to cetk. - FileStream testtik = new FileStream(fileinfo[0] + "cetk", FileMode.Open); - testtik.Write(cetkbuff, 0, cetkbuff.Length); - testtik.Close(); - } - - private void button7_Click(object sender, EventArgs e) - { - // Proceed with process (BG worker waits for form to resize) - WriteStatus("Trucha modifications complete."); - this.Size = this.MinimumSize; - } - private void button3_Click_1(object sender, EventArgs e) { // Clear Statusbox.text @@ -2559,7 +2256,6 @@ namespace NUS_Downloader packbox.Enabled = enabled; localuse.Enabled = enabled; ignoreticket.Enabled = enabled; - truchabox.Enabled = enabled; decryptbox.Enabled = enabled; } @@ -2665,7 +2361,7 @@ namespace NUS_Downloader /// The title ID. /// New Ticket private byte[] GenerateTicket(byte[] EncTitleKey, byte[] TitleID) - { + { byte[] Ticket = new byte[0x2A4]; // RSA Signature Heading... @@ -2712,221 +2408,6 @@ namespace NUS_Downloader return Ticket; } - private void button15_Click(object sender, EventArgs e) - { - // Read Content info from TMD again (revert) - string[] fileinfo = shamelessvariablelabel.Text.Split(','); - - // Read the tmd as a stream... - byte[] tmd = FileLocationToByteArray(fileinfo[0] + fileinfo[1]); - - FillContentInfo(tmd); - } - - /// - /// Fills the content editor with info from TMD - /// - /// The TMD. - private void FillContentInfo(byte[] tmd) - { - // Clear anything existing... - contentsEdit.Items.Clear(); - - // # of Contents and BootIndex - int nbr_cont = ContentCount(tmd); - int boot_idx = GetBootIndex(tmd); - - string[] tmdcontents = GetContentNames(tmd, nbr_cont); - byte[] tmdindices = GetContentIndices(tmd, nbr_cont); - int[] tmdtypes = GetContentTypes(tmd, nbr_cont); - - // Loop and add contents to listbox... - for (int a = 0; a < nbr_cont; a++) - { - contentsEdit.Items.Add(String.Format("[{0}] [{1}]", tmdindices[a], tmdcontents[a])); - - if (tmdtypes[a] == 0x8001) - contentsEdit.Items[a] += " [S]"; - } - - - // Identify Boot Content... - contentsEdit.Items[boot_idx] += " [BOOT]"; - - } - - private void button8_Click(object sender, EventArgs e) - { - // Move selected content upwards (down an index)... - if (contentsEdit.SelectedIndex <= 0) - return; - - int sel_index = contentsEdit.SelectedIndex; - object sel_item = contentsEdit.SelectedItem; - - contentsEdit.Items.RemoveAt(sel_index); - contentsEdit.Items.Insert(sel_index - 1, sel_item); - - string sel_itm = contentsEdit.Items[sel_index].ToString(); - string other_itm = contentsEdit.Items[sel_index - 1].ToString(); - - sel_itm = sel_itm.Replace("[", ""); sel_itm = sel_itm.Replace("]", ""); - other_itm = other_itm.Replace("[", ""); other_itm = other_itm.Replace("]", ""); - - string[] selarray = sel_itm.Split(' '); - string[] otherary = other_itm.Split(' '); - - contentsEdit.Items[sel_index] = String.Format("[{0}]", sel_index); - contentsEdit.Items[sel_index - 1] = String.Format("[{0}]", sel_index - 1); - - for (int a = 0; a < selarray.Length; a++) - { - if (a != 0) - contentsEdit.Items[sel_index] += String.Format(" [{0}]", selarray[a]); - } - - for (int b = 0; b < otherary.Length; b++) - { - if (b != 0) - contentsEdit.Items[sel_index - 1] += String.Format(" [{0}]", otherary[b]); - } - /*int sel_idx = contentsEdit.SelectedIndex; - string sel_item = contentsEdit.Items[sel_idx].ToString(); - string lower_item = contentsEdit.Items[sel_idx - 1].ToString(); - - contentsEdit.Items[sel_idx] = String.Format("[{0}]{1}", sel_idx, lower_item.Substring(contentsEdit.SelectedItem.ToString().IndexOf(" ["), lower_item.Length - contentsEdit.SelectedItem.ToString().IndexOf(" ["))); - contentsEdit.Items[sel_idx - 1] = String.Format("[{0}]{1}", sel_idx - 1, sel_item.Substring(contentsEdit.SelectedItem.ToString().IndexOf(" ["), sel_item.Length - contentsEdit.SelectedItem.ToString().IndexOf(" ["))); - */ - contentsEdit.SelectedIndex = sel_index - 1; - } - - private void button9_Click(object sender, EventArgs e) - { - // Move selected content down (up an index)... - if (contentsEdit.SelectedIndex >= contentsEdit.Items.Count - 1) - return; - - int sel_index = contentsEdit.SelectedIndex; - object sel_item = contentsEdit.SelectedItem; - - contentsEdit.Items.RemoveAt(sel_index); - contentsEdit.Items.Insert(sel_index + 1, sel_item); - - string sel_itm = contentsEdit.Items[sel_index].ToString(); - string other_itm = contentsEdit.Items[sel_index + 1].ToString(); - - sel_itm = sel_itm.Replace("[", ""); sel_itm = sel_itm.Replace("]", ""); - other_itm = other_itm.Replace("[", ""); other_itm = other_itm.Replace("]", ""); - - string[] selarray = sel_itm.Split(' '); - string[] otherary = other_itm.Split(' '); - - contentsEdit.Items[sel_index] = String.Format("[{0}]", sel_index); - contentsEdit.Items[sel_index + 1] = String.Format("[{0}]", sel_index + 1); - - for (int a = 0; a < selarray.Length; a++) - { - if (a != 0) - contentsEdit.Items[sel_index] += String.Format(" [{0}]", selarray[a]); - } - - for (int b = 0; b < otherary.Length; b++) - { - if (b != 0) - contentsEdit.Items[sel_index + 1] += String.Format(" [{0}]", otherary[b]); - } - - /*int sel_idx = contentsEdit.SelectedIndex; - string sel_item = contentsEdit.Items[sel_idx].ToString(); - string upper_item = contentsEdit.Items[sel_idx + 1].ToString(); - - contentsEdit.Items[sel_idx] = String.Format("[{0}]{1}", sel_idx, upper_item.Substring(contentsEdit.SelectedItem.ToString().IndexOf(" ["), upper_item.Length - contentsEdit.SelectedItem.ToString().IndexOf(" ["))); - contentsEdit.Items[sel_idx + 1] = String.Format("[{0}]{1}", sel_idx + 1, sel_item.Substring(contentsEdit.SelectedItem.ToString().IndexOf(" ["), sel_item.Length - contentsEdit.SelectedItem.ToString().IndexOf(" ["))); - */ - contentsEdit.SelectedIndex = sel_index + 1; - } - - private void button12_Click(object sender, EventArgs e) - { - // Set a new boot index... - - // Handle help info first... - if (Control.ModifierKeys == Keys.Shift) - { - WriteStatus("[HELP INFO] Select a content, and press this to make it the 'boot' content. The boot content is the" + - " DOL file which is ran when the channel is started."); - return; - } - - if (contentsEdit.SelectedIndex < 0) - return; - - for (int a = 0; a < contentsEdit.Items.Count; a++) - { - if (contentsEdit.Items[a].ToString().Contains(" [BOOT]")) - contentsEdit.Items[a] = contentsEdit.Items[a].ToString().Substring(0, contentsEdit.Items[a].ToString().Length - 7); - } - - contentsEdit.Items[contentsEdit.SelectedIndex] += " [BOOT]"; - } - - private void button11_Click(object sender, EventArgs e) - { - // Add a file to the contents... - - // Handle help info first... - if (Control.ModifierKeys == Keys.Shift) - { - WriteStatus("[HELP INFO] This button will allow you to add a content to the title. You can browse " + - "and select an .app file (a decrypted content) to insert into the contents list."); - return; - } - - OpenFileDialog opencont = new OpenFileDialog(); - opencont.Filter = "Decrypted Contents|*.app|All Files|*"; - opencont.Multiselect = false; - opencont.Title = "Locate a Content"; - if (opencont.ShowDialog() != DialogResult.Cancel) - { - // OK WE MUST PREVENT: - // - NON HEX NAMING - // - FILE EXISTING WITH THE SAME NAME && THAT FILE != NEW FILE - // - - - - if ((OnlyHexInString(opencont.SafeFileName.Substring(0,8)) == false)) - { - MessageBox.Show("Please locate/rename a file to be (8 HEX CHARACTERS) long + (.app) extention!", "Bad!", MessageBoxButtons.OK); - return; - } - - for (int i = 0; i < contentsEdit.Items.Count; i++) - { - if (contentsEdit.Items[i].ToString().Contains(opencont.SafeFileName)) - { - MessageBox.Show("A file already exists in the title with that filename!", "Bad!", MessageBoxButtons.OK); - return; - } - } - - // D: TODO? - string[] fileinfo = shamelessvariablelabel.Text.Split(','); - - if (File.Exists(fileinfo[0] + opencont.SafeFileName) ) - { - MessageBox.Show("Rename the file you are adding, it already exists in the title directory!", "Bad!", MessageBoxButtons.OK); - return; - } - - if (fileinfo[0] + opencont.SafeFileName != opencont.FileName) - { - // Move the file into the directory... - File.Copy(opencont.FileName, fileinfo[0] + opencont.SafeFileName); - } - contentsEdit.Items.Add(String.Format("[{0}] [{1}]", contentsEdit.Items.Count, opencont.SafeFileName)); - } - } - /// /// Checks for a hex string. /// @@ -2937,303 +2418,11 @@ namespace NUS_Downloader return System.Text.RegularExpressions.Regex.IsMatch(test, @"\A\b[0-9a-fA-F]+\b\Z"); } - private void button10_Click(object sender, EventArgs e) - { - // Remove a content from the list... + - // Handle help info first... - if (Control.ModifierKeys == Keys.Shift) - { - WriteStatus("[HELP INFO] This button will allow you to remove a content from the title. Be careful, " + - "as most contents are necessary for proper channel usage!"); - return; - } + - if ((contentsEdit.SelectedIndex < 0) || (contentsEdit.Items.Count <= 1)) - return; - - string[] fileinfo = shamelessvariablelabel.Text.Split(','); - DialogResult question = MessageBox.Show("Delete the actual file as well?", "Delete content?", MessageBoxButtons.YesNoCancel); - - if (question == DialogResult.Yes) - File.Delete(fileinfo[0] + contentsEdit.SelectedItem.ToString().Substring(contentsEdit.SelectedItem.ToString().IndexOf("] [") + 3, 8)); - - if (question != DialogResult.Cancel) - contentsEdit.Items.RemoveAt(contentsEdit.SelectedIndex); - - RecalculateIndices(); - } - - private void button14_Click(object sender, EventArgs e) - { - UpdateTMDContents(); - } - - /// - /// Updates the TMD contents. - /// - private void UpdateTMDContents() - { - // Write changes to TMD of contents... - WriteStatus("Updating TMD with content information..."); - string[] fileinfo = shamelessvariablelabel.Text.Split(','); - - WriteStatus(" - Loading Title Key from Ticket..."); - byte[] ticket = FileLocationToByteArray(fileinfo[0] + "cetk"); - byte[] etitlekey = new byte[16]; - for (int a = 0; a < 16; a++) - { - etitlekey[a] = ticket[0x1BF + a]; - } - // TODO: Add more key support - byte[] commonkey = LoadCommonKey(Path.DirectorySeparatorChar.ToString() + @"key.bin"); - - // IV (TITLEID00000000) - byte[] iv = new byte[16]; - for (int b = 0; b < 8; b++) - { - iv[b] = ticket[0x1DC + b]; - } - for (int c = 0; c < 8; c++) - { - iv[c + 8] = 0x00; - } - - initCrypt(iv, commonkey); - byte[] dtitlekey = Decrypt(etitlekey); - - // Holds all the content data... - TitleContent[] contents = new TitleContent[contentsEdit.Items.Count]; - - // Previous TMD for analysis - byte[] tmd = FileLocationToByteArray(fileinfo[0] + fileinfo[1]); - - for (int c = 0; c < contentsEdit.Items.Count; c++) - { - string itemstr = contentsEdit.Items[c].ToString(); - contents[c] = new TitleContent(); - // Set boot index... - if (itemstr.Contains(" [BOOT]")) - { - tmd = SetBootIndex(tmd, c); - } - if (itemstr.Contains(".app")) - { - // This is already decrypted, we're going to add it to the TMD... - string filename = itemstr.Substring(itemstr.IndexOf("] [") + 3, 12); - byte[] contentbytes = FileLocationToByteArray(fileinfo[0] + filename); - WriteStatus(filename + " is a decrypted file..."); - WriteStatus(" - Encrypting " + filename + "..."); - - // Gather the contentID (crappy way to do it)... - contents[c].ContentID = new byte[4]; - contents[c].ContentID[0] = byte.Parse(filename.Substring(0, 2), System.Globalization.NumberStyles.HexNumber); - contents[c].ContentID[1] = byte.Parse(filename.Substring(2, 2), System.Globalization.NumberStyles.HexNumber); - contents[c].ContentID[2] = byte.Parse(filename.Substring(4, 2), System.Globalization.NumberStyles.HexNumber); - contents[c].ContentID[3] = byte.Parse(filename.Substring(6, 2), System.Globalization.NumberStyles.HexNumber); - - // Grab SHA1/size of file - contents[c].SHAHash = new byte[20]; - contents[c].SHAHash = ComputeSHA(contentbytes); - - contents[c].Size = new byte[8]; - // TODOCHECK THIS OVER - contents[c].Size = NewIntegertoByteArray(contentbytes.Length, 8); - - contents[c].Index = new byte[2]; - contents[c].Index = NewIntegertoByteArray(c, 2); - - contents[c].Type = new byte[2]; - contents[c].Type[1] = 0x01; - if (contentsEdit.Items[c].ToString().Contains(" [S]")) - contents[c].Type[0] = 0x80; - else - contents[c].Type[0] = 0x00; - - // Pad to be 16 byte aligned - contentbytes = PadToMultipleOf(contentbytes, 16); - - // Encrypt with correct index IV/titlekey - byte[] ivindex = new byte[16]; - for (int d = 0; d < ivindex.Length; d++) - { - ivindex[d] = 0x00; - } - ivindex[0] = contents[c].Index[0]; - ivindex[1] = contents[c].Index[1]; - - initCrypt(ivindex, dtitlekey); - - FileStream encryptwrite = new FileStream(fileinfo[0] + filename.Substring(0, 8), FileMode.Create); - encryptwrite.Write(Encrypt(contentbytes), 0, contentbytes.Length); - encryptwrite.Close(); - - WriteStatus(" - " + filename.Substring(0, 8) + " written!"); - } - else - { - // An encrypted content...it was from the original TMD - string filename = itemstr.Substring(itemstr.IndexOf("] [") + 3, 8); - byte[] contentbytes = FileLocationToByteArray(fileinfo[0] + filename); - WriteStatus(filename + " is encrypted and from the original TMD..."); - WriteStatus(" - Gathering " + filename + " information..."); - - // Grab previous values from TMD... - int nbr_cont = ContentCount(tmd); - string[] tmdoldcontents = GetContentNames(tmd, nbr_cont); - string[] tmdsizes = GetContentSizes(tmd, nbr_cont); - byte[] tmdhashes = GetContentHashes(tmd, nbr_cont); - - int thiscontentidx = 0; - - for (int f = 0; f < nbr_cont; f++) - { - if (tmdoldcontents[f] == filename) - thiscontentidx = f; - } - - // if index has been changed... - if (thiscontentidx != c) - { - // We have to decrypt the content, and then encrypt to keep IV in line... - WriteStatus(" - Index altered. Must change IV..."); - byte[] ivindex = new byte[16]; - for (int d = 0; d < ivindex.Length; d++) - { - ivindex[d] = 0x00; - } - // TODO: Complete this... - ivindex[0] = 0x00; - ivindex[1] = (byte)thiscontentidx; - - initCrypt(ivindex, dtitlekey); - - byte[] hash = new byte[20]; - for (int x = 0; x < 20; x++) - { - hash[x] = tmdhashes[(thiscontentidx * 20) + x]; - } - - byte[] decContent = Decrypt(contentbytes); - Array.Resize(ref decContent, int.Parse(tmdsizes[thiscontentidx], System.Globalization.NumberStyles.HexNumber)); - contents[c].Size = NewIntegertoByteArray(decContent.Length, 8); - if ((Convert.ToBase64String(ComputeSHA(decContent))) == Convert.ToBase64String(hash)) - { - WriteStatus(" - Hash Check: Content is Unchanged..."); - contents[c].SHAHash = hash; - //WriteStatus("HASH: " + DisplayBytes(hash, "")); - } - else - { - WriteStatus(" - Hash Check: Content changed (did you add an encrypted file from another title?)..."); - contents[c].SHAHash = ComputeSHA(decContent); - } - - // Re-encrypt - byte[] newiv = new byte[16]; - for (int g = 0; g < newiv.Length; g++) - { - newiv[g] = 0x00; - } - byte[] smallix = NewIntegertoByteArray(c, 2); - ivindex[0] = smallix[0]; - ivindex[1] = smallix[1]; - - //WriteStatus(" - Old Index: " + thiscontentidx + "; New Index: " + c); - - // Pad back to 0x16 alignment - //AlignByteArray(decContent, 0x16 - decContent = PadToMultipleOf(decContent, 16); - - initCrypt(newiv, dtitlekey); - - byte[] encContent = Encrypt(decContent); - - File.Delete(fileinfo[0] + filename.Substring(0, 8)); - - FileStream encryptwrite = new FileStream(fileinfo[0] + filename.Substring(0, 8), FileMode.OpenOrCreate); - encryptwrite.Write(encContent, 0, encContent.Length); - encryptwrite.Close(); - - WriteStatus(" - Encrypted Content Again!"); - } - else - { - // Hopefully this content has not been touched... - WriteStatus(" - Content has not changed Index."); - byte[] hash = new byte[20]; - for (int x = 0; x < 20; x++) - { - hash[x] = tmdhashes[(c * 20) + x]; - } - contents[c].SHAHash = hash; - - contents[c].Size = NewIntegertoByteArray(int.Parse(tmdsizes[c], System.Globalization.NumberStyles.HexNumber), 8); - } - - contents[c].ContentID = new byte[4]; - contents[c].ContentID[0] = byte.Parse(filename.Substring(0, 2), System.Globalization.NumberStyles.HexNumber); - contents[c].ContentID[1] = byte.Parse(filename.Substring(2, 2), System.Globalization.NumberStyles.HexNumber); - contents[c].ContentID[2] = byte.Parse(filename.Substring(4, 2), System.Globalization.NumberStyles.HexNumber); - contents[c].ContentID[3] = byte.Parse(filename.Substring(6, 2), System.Globalization.NumberStyles.HexNumber); - - contents[c].Index = new byte[2]; - contents[c].Index = NewIntegertoByteArray(c, 2); - - contents[c].Type = new byte[2]; - contents[c].Type[1] = 0x01; - if (contentsEdit.Items[c].ToString().Contains(" [S]")) - contents[c].Type[0] = 0x80; - else - contents[c].Type[0] = 0x00; - } - - } - - // Collect everything into a single byte[]... - byte[] contentSection = new byte[contents.Length * 36]; - for (int h = 0; h < contents.Length; h++) - { - for (int i = 0; i < contents[h].ContentID.Length; i++) - { - contentSection[(h * 36) + i] = contents[h].ContentID[i]; - } - - for (int j = 0; j < contents[h].Index.Length; j++) - { - contentSection[(h * 36) + (contents[h].ContentID.Length + j)] = contents[h].Index[j]; - } - - for (int k = 0; k < contents[h].Type.Length; k++) - { - contentSection[(h * 36) + (contents[h].ContentID.Length + contents[h].Index.Length + k)] = contents[h].Type[k]; - } - - for (int l = 0; l < contents[h].Size.Length; l++) - { - contentSection[(h * 36) + (contents[h].ContentID.Length + contents[h].Index.Length + contents[h].Type.Length + l)] = contents[h].Size[l]; - } - - for (int m = 0; m < contents[h].SHAHash.Length; m++) - { - contentSection[(h * 36) + (contents[h].ContentID.Length + contents[h].Index.Length + contents[h].Type.Length + contents[h].Size.Length + m)] = contents[h].SHAHash[m]; - } - } - - for (int n = 0; n < contentSection.Length; n++) - { - tmd[0x1E4 + n] = contentSection[n]; - } - - // Fakesign the TMD again... - tmd = ZeroSignature(tmd); - tmd = TruchaSign(tmd); - - // Write all this stuff to the TMD... - FileStream testtmd = new FileStream(fileinfo[0] + fileinfo[1], FileMode.Open); - testtmd.Write(tmd, 0, tmd.Length); - testtmd.Close(); - } + /// /// Pads to multiple of.... @@ -3250,49 +2439,9 @@ namespace NUS_Downloader } - private void button17_Click(object sender, EventArgs e) - { - // Move groupbox to display title modder... - if (button17.Text == "Modify Individual Contents...") - { - contentModBox.Location = new Point(278, 12); - contentModBox.Visible = true; - contentModBox.BringToFront(); - button17.Text = "Trucha Sign Title..."; - } - else if (button17.Text == "Trucha Sign Title...") - { - //contentModBox.Location = new Point(300, 300); - contentModBox.Visible = false; - contentModBox.SendToBack(); - button17.Text = "Modify Individual Contents..."; - } - } + - private void button13_Click(object sender, EventArgs e) - { - // Share/Unshare Contents in the list... - - // Handle help info first... - if (Control.ModifierKeys == Keys.Shift) - { - WriteStatus("[HELP INFO] Toggles the shared state of the content."); - return; - } - - if (contentsEdit.SelectedIndex < 0) - return; - - if (contentsEdit.Items[contentsEdit.SelectedIndex].ToString().Contains(" [S]")) - contentsEdit.Items[contentsEdit.SelectedIndex] = contentsEdit.SelectedItem.ToString().Replace(" [S]", ""); - else - { - if (contentsEdit.Items[contentsEdit.SelectedIndex].ToString().Contains(" [BOOT]")) - contentsEdit.Items[contentsEdit.SelectedIndex] = contentsEdit.SelectedItem.ToString().Replace(" [BOOT]", "") + " [S] [BOOT]"; - else - contentsEdit.Items[contentsEdit.SelectedIndex] = contentsEdit.SelectedItem.ToString() + " [S]"; - } - } + /// /// Determines whether OS is win7. @@ -3327,184 +2476,7 @@ namespace NUS_Downloader return resultArray; } - private void button16_Click(object sender, EventArgs e) - { - // add trucha bug to content... - - // Handle help info first... - if (Control.ModifierKeys == Keys.Shift) - { - WriteStatus("[HELP INFO] Inserts the trucha bug into the selected content, if the bug was fixed previously."); - return; - } - - if (contentsEdit.SelectedIndex < 0) - return; - - WriteStatus("Attempting to add 'bugs' back into content..."); - string[] fileinfo = shamelessvariablelabel.Text.Split(','); - byte[] new_hash_check = new byte[] {0x20, 0x07, 0x4B, 0x0B}; - byte[] old_hash_check = new byte[] {0x20, 0x07, 0x23, 0xA2}; - - // If decrypted... - // - check right away for bug... - // - add bug, then end... - // if encrypted... - // - decrypt content... - // - find bug/patch... - // - recalculate hash... - // - write back into TMD... - // - trucha sign content... - - if (contentsEdit.Items[contentsEdit.SelectedIndex].ToString().Contains(".app")) - { - // Content is decrypted/new to the title... - string filename = contentsEdit.Items[contentsEdit.SelectedIndex].ToString().Substring(contentsEdit.Items[contentsEdit.SelectedIndex].ToString().IndexOf("] [") + 3, 12); - byte[] contentbt = FileLocationToByteArray(fileinfo[0] + filename); - byte[] newvalues = new byte[4]; - newvalues[1] = 0x00; - - int[] oldresults = ByteArrayContainsByteArray(contentbt, old_hash_check); - int[] newresults = ByteArrayContainsByteArray(contentbt, new_hash_check); - - if (oldresults[0] != 0) - { - WriteStatus(String.Format(" - {0} Old-school ES Signing Fix(es) Found...", oldresults[0])); - for (int s = 1; s < oldresults.Length - 1; s++) - { - contentbt = PatchBinary(contentbt, oldresults[s], newvalues); - WriteStatus(String.Format(" - Bug restored at 0x{0}", int.Parse(oldresults[s].ToString(), System.Globalization.NumberStyles.HexNumber))); - } - } - - if (newresults[0] != 0) - { - WriteStatus(String.Format(" - {0} New-school ES Signing Fix(es) Found...", newresults[0])); - for (int s = 1; s < newresults.Length - 1; s++) - { - contentbt = PatchBinary(contentbt, newresults[s], newvalues); - WriteStatus(String.Format(" + Bug restored at 0x{0}.", int.Parse(newresults[s].ToString(), System.Globalization.NumberStyles.HexNumber))); - } - } - } - else - { - WriteStatus(" - The file you selected was encrypted, attempting to decrypt and patch..."); - string filename = contentsEdit.Items[contentsEdit.SelectedIndex].ToString().Substring(contentsEdit.Items[contentsEdit.SelectedIndex].ToString().IndexOf("] [") + 3, 8); - - byte[] ticket = FileLocationToByteArray(fileinfo[0] + "cetk"); - byte[] tmd = FileLocationToByteArray(fileinfo[0] + fileinfo[1]); - byte[] etitlekey = new byte[16]; - for (int a = 0; a < 16; a++) - { - etitlekey[a] = ticket[0x1BF + a]; - } - - // TODO: Add more key support - byte[] commonkey = LoadCommonKey(Path.DirectorySeparatorChar.ToString() + @"key.bin"); - - // IV (TITLEID00000000) - byte[] iv = new byte[16]; - for (int b = 0; b < 8; b++) - { - iv[b] = ticket[0x1DC + b]; - } - for (int c = 0; c < 8; c++) - { - iv[c + 8] = 0x00; - } - - initCrypt(iv, commonkey); - byte[] dtitlekey = Decrypt(etitlekey); - - // Decrypt this content (determine index) - string[] tmdcontents = GetContentNames(tmd, ContentCount(tmd)); - byte[] tmdindices = GetContentIndices(tmd, ContentCount(tmd)); - byte[] tmdhashes = GetContentHashes(tmd, ContentCount(tmd)); - string[] tmdsizes = GetContentSizes(tmd, ContentCount(tmd)); - - iv = new byte[16]; - for (int f = 0; f < 16; f++) - { - iv[f] = 0x00; - } - - byte[] hash = new byte[20]; - for (int d = 0; d < tmdcontents.Length; d++) - { - if (tmdcontents[d] == filename) - { - iv[0] = 0x00; // TODO: Add double index byte support - iv[1] = tmdindices[d]; - - for (int x = 0; x < 20; x++) - { - hash[x] = tmdhashes[(d*20) + x]; - } - } - } - initCrypt(iv, commonkey); - //DEBUG - WriteStatus(DisplayBytes(iv, " ")); - - byte[] decContent = Decrypt(FileLocationToByteArray(fileinfo[0] + filename)); - Array.Resize(ref decContent, int.Parse(tmdsizes[14], System.Globalization.NumberStyles.HexNumber)); - - if ((Convert.ToBase64String(ComputeSHA(decContent))) == Convert.ToBase64String(hash)) - { - WriteStatus(" - Hash Check: Content is Unchanged..."); - } - else - { - WriteStatus(" - Hash Check: Content changed (did you add an encrypted file from another title?)..."); - WriteStatus(" - Content Hash: " + DisplayBytes(ComputeSHA(decContent), "")); - WriteStatus(" - TMD Hash: " + DisplayBytes(hash, "")); - - } - - if (File.Exists(fileinfo[0] + filename + ".app")) - { - if (MessageBox.Show(fileinfo[0] + filename + ".app Exists! Delete the current file so we can move on?", "File Conflict", MessageBoxButtons.YesNo) == DialogResult.Yes) - File.Delete(fileinfo[0] + filename + ".app"); - else - return; - } - - byte[] newvalues = new byte[4]; - newvalues[1] = 0x00; - - int[] oldresults = ByteArrayContainsByteArray(decContent, old_hash_check); - int[] newresults = ByteArrayContainsByteArray(decContent, new_hash_check); - - if (oldresults[0] != 0) - { - WriteStatus(String.Format(" - {0} Old-school ES Signing Fix(es) Found...", oldresults[0])); - for (int s = 1; s < oldresults.Length - 1; s++) - { - decContent = PatchBinary(decContent, oldresults[s], newvalues); - WriteStatus(String.Format(" - Bug restored at 0x{0}", int.Parse(oldresults[s].ToString(), System.Globalization.NumberStyles.HexNumber))); - } - } - - if (newresults[0] != 0) - { - WriteStatus(String.Format(" - {0} New-school ES Signing Fix(es) Found...", newresults[0])); - for (int s = 1; s < newresults.Length - 1; s++) - { - decContent = PatchBinary(decContent, newresults[s], newvalues); - WriteStatus(String.Format(" + Bug restored at 0x{0}.", int.Parse(newresults[s].ToString(), System.Globalization.NumberStyles.HexNumber))); - } - } - - File.WriteAllBytes(fileinfo[0] + filename + ".app", decContent); - - contentsEdit.Items[contentsEdit.SelectedIndex] = contentsEdit.Items[contentsEdit.SelectedIndex].ToString().Replace(filename, filename + ".app"); - - UpdateTMDContents(); - - WriteStatus("Trucha signing complete!"); - } - } + /// /// Does byte[] contain byte[]? @@ -3535,42 +2507,6 @@ namespace NUS_Downloader return offset; } - /// - /// Patches the binary. - /// - /// The content. - /// The offset. - /// The newvalues. - /// - private byte[] PatchBinary(byte[] content, int offset, byte[] newvalues) - { - for (int a = 0; a < newvalues.Length; a++) - { - if (newvalues[a] >= 0) - content[offset + a] = newvalues[a]; - } - return content; - } - - /// - /// Recalculates the indices. - /// - private void RecalculateIndices() - { - for (int a = 0; a < contentsEdit.Items.Count; a++) - { - string item = contentsEdit.Items[a].ToString(); - item = item.Replace("[", ""); item = item.Replace("]", ""); - string[] itemparts = item.Split(' '); - contentsEdit.Items[a] = String.Format("[{0}]", a); - for (int b = 0; b < itemparts.Length; b++) - { - if (b != 0) - contentsEdit.Items[a] += String.Format(" [{0}]", itemparts[b]); - } - } - } - /// /// Retrieves the new database via WiiBrew. /// @@ -4136,11 +3072,6 @@ namespace NUS_Downloader " You will be prompted for your password each time you run NUSD, for privacy purposes."); } - private void enableBETATruchaFeaturesToolStripMenuItem_Click(object sender, EventArgs e) - { - truchabox.Visible = true; - } - private void loadNUSScriptToolStripMenuItem_Click(object sender, EventArgs e) { // Current directory... diff --git a/NUS Downloader/Form1.resx b/NUS Downloader/Form1.resx index cf53ee1..f7abce8 100644 --- a/NUS Downloader/Form1.resx +++ b/NUS Downloader/Form1.resx @@ -126,92 +126,10 @@ 394, 17 - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29m - dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAKgSURBVDhPlZPdT5JhGMY58MS/oDMO+zDXsuWSrVSm - K3WLrIOYbs5lztTFEDN0ipEmJMJ4FSHfXhUUSJyggMo08QPzIz8IdX6jZZnYah27JbarF1oumrZ58Jw9 - 92/X/XuuhwGAcZIj6diMFbUu+Quo+b2cupmk/w63ur6HNTm/MNUOH0vetcWpMK2rK01rkFtWUWVaxF3J - 6N6xAN3wt3Cyf3eyvvczlPYtyMxeKDq9IB2bqLWuoqjRjcSSvv1jARqHT9g8sAPz+C6Mw9toev0B9d3r - EBsWIGlbwG2xE7H5XXFHAkjnxmlpz8RPAz1I9W1B2r6M8tZ5PKJm8VTvQZZ8BFdzzZqAuxBAIDbVv2tV - dQ/8qJwoRoXNAZVtDUTXKvgN08ghxiBsnEKKwI4r6XpOCEA79DWsoc/n1Tl3EDiStpYD8agQ6YTtgP/i - Lcq0s0iTDOKhagxx99sQlUqxQgCqXh+TsH/8vfPINpSdaxCo2/e5NebipBLjQUaVE3mEC/dqBhF9pwmR - iXXMEEB153uWzLwB/dAnPO9YgbpnHaU6DzJlGr9okIfr/HrcemwDO8uI8wmE9yxbHhYCEOlXOE8MS8Fn - Cggrotx4ZpyDkJpCtqIcpf35iE5V+CPYSuuZ+OrwP+U7lMgjPXZp+yKUlhUIyGnk1o4js2YED4g3yKat - 38gV+y9xpOf+bW0QkKd2FwqbPVBYlmnLsxC1uIO2+ZqJ4N5JPAuibpLCoyrPoPssELx0o8IwH4xcpp1B - Bm07WWBFfLYJMVwtLqY0TEYmEIex/wYx0qrHUK6fowvyDjkKF5ILbYjJeKW5zNVxolJJ1oVkNTMigQgK - OzJBStkAbdqFLBm9J88aKAj7JL+TwS6wn7qWZwYr07QXzdXFnWQ4cPcXyBm6QmRn5bAAAAAASUVORK5C - YII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29m - dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAFHSURBVDhPY/j//z8DJRiv5uJj6ScLDqUewWcBTgOK - jqZd7DhV97/1RPX/jB2x53EZgmFAyfEMtqIjabfbT9X8X35t3v+lV+b8rz1Q/D9uTejNyGUBbOgGYRhQ - eDh1d97+pO/Nxyr/L74y6//CyzP+tx2u/R+xxP978DyvHQQNgClI3RL9f/6laf/nXJjyP3VN7P+gOZ4W - 2LyBMwzi14b9n3V+8v8Z5yb8D5jlAdSLPbZwGgD07/+pZ/r+Tz7d/d9rkhPpBgD9+3/iqa7/fSfb/zt3 - 2ZBugM9U1/89x1v/dx5r+m/bZEa6AW699v/bjzb+bz1c99+sypB0A+xbLf83Har933Cw6r9BkTbpBljW - Gv+vO1D5v2Z/2X/tbDXSDTAu1f1ftbfkf8Xeov9qqUqkG6Cbp/FfM1P1v2qK4n+lBDnSDSA2iwMA5nrY - LX6N1KIAAAAASUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29m - dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAMxSURBVDhPdZPrT5tlGIf7RRP/gSXzwz4ZQ2RTZ4wn - sgxxg85x0JhsiZ/YIprpEozRsMTNRcNGkbKSShejI1vMioSJo5WDFApjFmgZDFZoSylMOiinUvrCLFAK - 7+Xd6jRx803uPHmf3L/rPj4aQPMoG2vKSx+zHr7ua3yzw/uzdu//+T0k9rfk7xBxqc96OLroucTcgA7P - Twfvj9Yf0I/8mPXkf0H/AMZbCx4TcdFYU24gNGRka2MWdW2a1cnrrM9YCd74hDtX908N/7Dv5NCVjCce - gFIAf2tBtr85/+ZU7xesL9+RqzVQFRKRW4w3vMW6r4J4sJ5Vr4mA9Ti3a151Dn73Ul5SmxRf9jfnqRG/ - mVjYTeRuJ3dd4vhbOd5fP2ay7QQxXxWxobNsBGrYnK5nqb8UT+3b3DK9UKuRehPqRpB4eJCI20h4oJRQ - VzEByxGc1RlsLt2GmB8W21B/N4GnBGbMJCZKcRmfS2ikWcr2xj24P8rmTCMrQ+eJDZ8VO8WMJTd1x0IL - BL9H9Z4iZs9koXkfK54qnIY9isbbeEjZXhPAH+MC8UDYzrqnnJjrBAtNuSTGK2FCT9yhZanlFea7tMy3 - F6AM6+mrTFc0noYcZSsF8MGqpBt1CsRGImBkpfsI8ZtaFHsGSz05LNgPMtucxawlh+V+Hb1fpykame9f - ACkBxQWRTqn3F5hrQPWfJtqnZdHxBg31+Xx68SjvXyig8HwmNVfepafsaUUzUpcVVxNzMrlJid4t0Vth - /po06ipq8CLhXi11tYf48toxmkZNDM/aMLR/yFHDHj4r2bWlcZsz2yfsJayFugQSgGWBhMwwfVkA1Sx2 - Z3NMdwDLSBUWr1FGD/qOIgwdH/DayZ3bGtmsx2WzimQ5AlM3zrC13Ce9GJAs6lCnqpmzvU7u53tpGb2U - Ej/4rG4TL3+089+HJJu1Y+DbF8/JckRDjq+kqQKJOlhxV7C/eBcVtuOU2QpT+rK2wlQGAlh/6DH1f/N8 - uqvqWbPzwm41PGjgXmsxZ07v5h19GpW290hGTp7JfwHoH/mUkzveW/FMdk95Wqd02uE491SeOOvEVpNp - /33qkn5/AiEv99RPttotAAAAAElFTkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29m - dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAFESURBVDhPY/j//z8DJRin5pLjGf+Lj6X/LziU+j93 - XxLQDuwW4TSg6Gja/9U3Fv1feX3B/4wdsaQbkH8g+f/ya/P+L70y53/ypkjSDcjaHf9/8ZVZ/xdenvE/ - dlUw6Qakbon+P//StP9zLkz5H77Ij3QD4teG/Z91fvL/Gecm/A+Y5UG6AZHLAv5PPdP3f/Lp7v9ek5xI - NyB4ntf/iae6/vedbP/v3GVDugE+U13/9xxv/d95rOm/bZMZaQZ4T3G2CJ3l97/9aOP/1sN1/82qDIk3 - AOjfHa49tt9z1qb+bzpU+7/hYNX/gEne/3Vy1b9rZKjsRk+RGCkR6F82u2aLm+EzA//XHaj8X7O/7L93 - r9t/9TTl28pJCmwEDYApMC7VPe/b7/Hfq8f1v1qq0kWS8wJIg2am6hHVFMWT+HIrRVkZZDAAFl/VUw/P - Z/oAAAAASUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29m - dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAM9SURBVDhPdZNtTJtVGIZfw7bE/dMYYkz8sUTNIm7O - xZgtZBFRoG50zGhm/KtbsiVLZkgUNCqJYXMM2EgFY1QyY9ZJUDZAytdWCrNAy8f4GG0phY2Olo8W2he2 - tpSy9/Ipxpm4+SZP3uTk3Nd5zv3cRwGUR9V4kz5tvPHAFVf9/mvOy7pX/m/fQ2J388FUERe7Gg+EA46f - mBs4g+P3rLtjtW+V3fw185n/gh4AJlryNov46HhTrsc/ZGB9dRYtOsPK1BVivka8nfmMXHx9eviXfSeG - fk5//B/QBsDdkpftNh28Pt3zFbHQiCxFQVNJLPUzUXeImKuUuLeWFWcVnsYPuVG91zb4w2v6pDYpvuA2 - 6bUlt5FIcJSlWx3cssvGP0twtn7MVNtxIq4KIkNFrHqqWZupZbGvGMeld+iv2n1JkfsmtFUv8eAgS6MG - ggPF+C0n8TQcxlaZztriDYi4IdCGdrsKHAXgM5KYLMZueDmhiFnq/dU7cHeMNV89y0OniQwXSRXia8jd - WGOhGbw/ojkLiZgzWDDtY9lRge38DlVx1r+t3o8K4N6EQBwQNBNzlBCxH2ehKZfERDlMlhG36lhs3sO8 - Rcf81TzU4TJ6y9NUxVGXo65vAFywIu2GbQJpJ+ExsNx1mPh1Hao5ncXuHBbMWcyaMpltyCHUd4aes9tV - Reb7N0CugGqHpQ657x8wV4fm/oJwr46A9U1c53Zj/eAprmVuouPQVsZKcuj+5gVVuVmTGdcSczK5KTm9 - S05vgfnfxKiLaN7vCPboGC/fxcgne4iZysWHViI1+fSf2EnnsdSEMmrMuDppLiDqtwjEAyGB+I0wc0EA - lQS6srG8u5WoiDHI6AuegNPbCJ7NoH3/lpgiydoiyToq4fBMd37JeqhXvBiQLmrQpiuZa39jo21t8LLk - 5t8vXPR0cl17EGVJVurA96+eknCE/davxVSBhK0sj5Ziee9J7lV/BCJa/VQhJOU9lkJbVorvocfU9+2u - NHvFTqPt3EtacPA8d1pO0p2/A/uR57XZgm0EPtvM1JHHMOs3rbdmpXz+yKeczHhP6YvZ3SXbO8Rpq/XU - c3rr+88Wyom3k23LfyYpTu77C4h89ngRLmtIAAAAAElFTkSuQmCC - - 285, 17 + iVBORw0KGgoAAAANSUhEUgAAADYAAAAZCAYAAAB6v90+AAAABGdBTUEAALGOfPtRkwAAACBjSFJNAACH diff --git a/NUS Downloader/NUS Downloader.csproj b/NUS Downloader/NUS Downloader.csproj index 077c874..70a5f8e 100644 --- a/NUS Downloader/NUS Downloader.csproj +++ b/NUS Downloader/NUS Downloader.csproj @@ -77,7 +77,6 @@ Form1.cs PreserveNewest - @@ -107,7 +106,6 @@ Settings.settings True - Component diff --git a/NUS Downloader/NUS.cs b/NUS Downloader/NUS.cs deleted file mode 100644 index 3091fd1..0000000 --- a/NUS Downloader/NUS.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace NUS_Downloader -{ - class NUS - { - // NUS Urls - const string NUS_Wii = "http://nus.cdn.shop.wii.com/ccs/download/"; - const string NUS_DSi = "http://nus.cdn.t.shop.nintendowifi.net/ccs/download/"; - - // NUS Files - const string Ticket = "cetk"; - const string TMD = "tmd"; - - // Report Status back in EventHandler - public delegate void StatusChangedEventHandler(string status); - //public event StatusChangedEventHandler StatusChanged; - } -} diff --git a/NUS Downloader/TMD.cs b/NUS Downloader/TMD.cs deleted file mode 100644 index 2e85c70..0000000 --- a/NUS Downloader/TMD.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace NUS_Downloader -{ - class TMD - { - // TMD Variables - //public byte[] SignatureType; - - - - - /* Signature Types - public enum SigTypes : byte[] - { - RSA_2048 = new byte[4] {0x00, 0x01, 0x00, 0x01}, - RSA_4048 = new byte[4] {0x00, 0x01, 0x00, 0x01} - } */ - /* - * Title metadata is a format used to store information about a title (a single standalone game, channel, etc.) and all its installed contents, including which contents they consist of and their SHA1 hashes. - -Many operations are done in terms of 64-byte blocks, which means you will often see padding out to the nearest 64-byte boundary at the end of a field. -Contents - -Structure -Header -Start Length Description -0x000 4 Signature type -0x004 256 Signature -0x104 60 Padding modulo 64 -0x140 64 Issuer -0x180 1 Version -0x181 1 ca_crl_version -0x182 1 signer_crl_version -0x183 1 Padding modulo 64 -0x184 8 System Version (the ios that the title need) -0x18C 8 Title ID -0x194 4 Title type -0x198 2 Group ID -0x19A 62 reserved -0x1D8 4 Access rights (flags for DVD-video access and full PPC hardware access) -0x1DC 2 Title version -0x1DE 2 Number of contents (nbr_cont) -0x1E0 2 boot index -0x1E2 2 Padding modulo 64 -0x1E4 36*nbr_cont Contents -Content -Start Length Description -0x00 4 Content ID -0x04 2 Index -0x06 2 Type -0x08 8 Size -0x10 20 SHA1 hash -Certificates -Start Length Description -0x000 4 Signature type -0x004 256 Signature -0x104 32 Issuer -0x124 4 Tag -0x128 64 Name -0x168 Key -*/ - - - } -} diff --git a/NUS Downloader/WADPacker.cs b/NUS Downloader/WADPacker.cs index 01d1238..889d3c1 100644 --- a/NUS Downloader/WADPacker.cs +++ b/NUS Downloader/WADPacker.cs @@ -123,8 +123,6 @@ namespace NUS_Downloader /// public void PackWAD() { - //StatusChanged("Beginning WAD Pack..."); - if ((String.IsNullOrEmpty(Directory)) || (String.IsNullOrEmpty(FileName))) { StatusChanged("ERROR: No Directory/FileName provided!");