From f3db60896d30a2a8a517efc94c380ed5b6cdccf9 Mon Sep 17 00:00:00 2001 From: givememystuffplease Date: Sat, 1 Aug 2009 17:48:32 +0000 Subject: [PATCH] Basically the RC of v1.2. Testing begins now. Trucha features disabled (click the progress bar to enable them). --- NUS Downloader/Form1.Designer.cs | 49 ++++++++-------- NUS Downloader/Form1.cs | 98 +++++++++++++++++++++++++++++--- NUS Downloader/Form1.resx | 4 +- 3 files changed, 115 insertions(+), 36 deletions(-) diff --git a/NUS Downloader/Form1.Designer.cs b/NUS Downloader/Form1.Designer.cs index 1ee83de..2187240 100644 --- a/NUS Downloader/Form1.Designer.cs +++ b/NUS Downloader/Form1.Designer.cs @@ -174,6 +174,7 @@ this.dlprogress.Size = new System.Drawing.Size(250, 15); this.dlprogress.Style = System.Windows.Forms.ProgressBarStyle.Continuous; this.dlprogress.TabIndex = 7; + this.dlprogress.Click += new System.EventHandler(this.dlprogress_Click); // // localuse // @@ -418,12 +419,14 @@ // truchabox // this.truchabox.AutoSize = true; + this.truchabox.Enabled = false; this.truchabox.Location = new System.Drawing.Point(184, 468); 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; // // tmdgpbox // @@ -513,7 +516,7 @@ 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, 125); + this.ticketgpbox.Size = new System.Drawing.Size(249, 180); this.ticketgpbox.TabIndex = 23; this.ticketgpbox.TabStop = false; this.ticketgpbox.Text = "Fake (Trucha) Ticket Signing..."; @@ -599,34 +602,31 @@ // titleIDIV // this.titleIDIV.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.titleIDIV.Location = new System.Drawing.Point(64, 145); + this.titleIDIV.Location = new System.Drawing.Point(95, 151); this.titleIDIV.MaxLength = 16; this.titleIDIV.Name = "titleIDIV"; - this.titleIDIV.Size = new System.Drawing.Size(149, 20); + this.titleIDIV.Size = new System.Drawing.Size(148, 20); this.titleIDIV.TabIndex = 7; this.titleIDIV.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; - this.titleIDIV.Visible = false; // // label7 // this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(7, 152); + 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:"; - this.label7.Visible = false; // // titlekeybox // this.titlekeybox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.titlekeybox.Location = new System.Drawing.Point(64, 125); + this.titlekeybox.Location = new System.Drawing.Point(95, 125); this.titlekeybox.MaxLength = 16; this.titlekeybox.Name = "titlekeybox"; - this.titlekeybox.Size = new System.Drawing.Size(149, 20); + this.titlekeybox.Size = new System.Drawing.Size(148, 20); this.titlekeybox.TabIndex = 5; this.titlekeybox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; - this.titlekeybox.Visible = false; // // label6 // @@ -636,7 +636,6 @@ this.label6.Size = new System.Drawing.Size(51, 13); this.label6.TabIndex = 4; this.label6.Text = "Title Key:"; - this.label6.Visible = false; // // button1 // @@ -652,7 +651,7 @@ // button4 // this.button4.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.button4.Location = new System.Drawing.Point(350, 258); + 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; @@ -663,7 +662,7 @@ // button5 // this.button5.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.button5.Location = new System.Drawing.Point(278, 258); + 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; @@ -686,9 +685,9 @@ // 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, 322); + this.button7.Location = new System.Drawing.Point(278, 377); this.button7.Name = "button7"; - this.button7.Size = new System.Drawing.Size(249, 27); + this.button7.Size = new System.Drawing.Size(249, 33); this.button7.TabIndex = 28; this.button7.Text = "Finished with Trucha Changes..."; this.button7.UseVisualStyleBackColor = true; @@ -735,9 +734,9 @@ 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(268, 208); + this.contentModBox.Location = new System.Drawing.Point(299, 433); this.contentModBox.Name = "contentModBox"; - this.contentModBox.Size = new System.Drawing.Size(249, 272); + this.contentModBox.Size = new System.Drawing.Size(249, 327); this.contentModBox.TabIndex = 41; this.contentModBox.TabStop = false; this.contentModBox.Text = "Edit Title Contents"; @@ -770,7 +769,7 @@ 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(70, 26); + this.button15.Size = new System.Drawing.Size(230, 26); this.button15.TabIndex = 42; this.button15.Text = "Revert"; this.button15.UseVisualStyleBackColor = true; @@ -779,9 +778,9 @@ // button14 // this.button14.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.button14.Location = new System.Drawing.Point(85, 235); + this.button14.Location = new System.Drawing.Point(9, 268); this.button14.Name = "button14"; - this.button14.Size = new System.Drawing.Size(158, 26); + this.button14.Size = new System.Drawing.Size(230, 50); this.button14.TabIndex = 41; this.button14.Text = "Overwrite Title Contents..."; this.button14.UseVisualStyleBackColor = true; @@ -869,11 +868,11 @@ // button17 // this.button17.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.button17.Location = new System.Drawing.Point(278, 290); + 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 Titles..."; + this.button17.Text = "Modify Individual Contents..."; this.button17.UseVisualStyleBackColor = true; this.button17.Click += new System.EventHandler(this.button17_Click); // @@ -883,21 +882,21 @@ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(539, 492); this.Controls.Add(this.contentModBox); - this.Controls.Add(this.button17); this.Controls.Add(this.button3); this.Controls.Add(this.shamelessvariablelabel); this.Controls.Add(this.button1); + this.Controls.Add(this.button17); this.Controls.Add(this.ticketgpbox); - this.Controls.Add(this.button5); - this.Controls.Add(this.button4); this.Controls.Add(this.tmdgpbox); this.Controls.Add(this.truchabox); this.Controls.Add(this.databaseButton); + this.Controls.Add(this.button5); + this.Controls.Add(this.button4); this.Controls.Add(this.decryptbox); - this.Controls.Add(this.button7); this.Controls.Add(this.ignoreticket); this.Controls.Add(this.wadnamebox); this.Controls.Add(this.getcerts); + this.Controls.Add(this.button7); this.Controls.Add(this.label2); this.Controls.Add(this.titleversion); this.Controls.Add(this.button2); diff --git a/NUS Downloader/Form1.cs b/NUS Downloader/Form1.cs index 9eb1b85..6dbe4db 100644 --- a/NUS Downloader/Form1.cs +++ b/NUS Downloader/Form1.cs @@ -153,7 +153,7 @@ namespace NUS_Downloader { this.Text = "NUSD - " + version + " - WB3000"; this.Size = this.MinimumSize; - + } @@ -652,7 +652,7 @@ namespace NUS_Downloader bool wiimode = radioButton1.Checked; // Set UserAgent to Wii value - generalWC.Headers.Add("User-Agent", "Opera/9.30 (Nintendo Wii; U; ; 2071; Wii Shop Channel/16.0(A); en)"); + generalWC.Headers.Add("User-Agent", "wii libnup/1.0"); // Get placement directory early... string titledirectory; @@ -1590,7 +1590,7 @@ namespace NUS_Downloader regitem.DropDownItems.Add("v" + versions[y]); } // TODO : wat... - regitem.DropDownItemClicked += new ToolStripItemClickedEventHandler(wwitem_regionclicked); + regitem.DropDownItemClicked += new ToolStripItemClickedEventHandler(deepitem_clicked); } } } @@ -1701,6 +1701,65 @@ namespace NUS_Downloader } } + void deepitem_clicked(object sender, ToolStripItemClickedEventArgs e) + { + // DEBUG: + //WriteStatus("item text: " + e.ClickedItem.Text); VERSION + //WriteStatus("Owner of item: " + e.ClickedItem.OwnerItem.Text); REGION + //WriteStatus("Owner of Owner of item: " + e.ClickedItem.OwnerItem.OwnerItem.Text); TITLE ID + + titleidbox.Text = e.ClickedItem.OwnerItem.OwnerItem.Text.Substring(0, 16); + titleidbox.Text = titleidbox.Text.Replace("XX", e.ClickedItem.OwnerItem.Text.Substring(0, 2)); + + if (e.ClickedItem.Text != "Latest Version") + { + if (e.ClickedItem.Text.Contains("v")) + { + if (e.ClickedItem.Text.Contains(" ")) + titleversion.Text = e.ClickedItem.Text.Substring(1, e.ClickedItem.Text.IndexOf(' ') - 1); + else + titleversion.Text = e.ClickedItem.Text.Substring(1, e.ClickedItem.Text.Length - 1); + } + } + else + { + titleversion.Text = ""; + } + + // Prepare StatusBox... + string titlename = e.ClickedItem.OwnerItem.OwnerItem.Text.Substring(19, (e.ClickedItem.OwnerItem.OwnerItem.Text.Length - 19)); + statusbox.Text = " --- " + titlename + " ---"; + + // Check if a ticket is present... + if ((e.ClickedItem.OwnerItem.OwnerItem.Image) == (orange) || (e.ClickedItem.OwnerItem.OwnerItem.Image) == (redorange)) + { + ignoreticket.Checked = true; + WriteStatus("Note: This title has no ticket and cannot be packed/decrypted!"); + packbox.Checked = false; + decryptbox.Checked = false; + } + else + { + ignoreticket.Checked = false; + } + + // Change WAD name if packed is already checked... + if (packbox.Checked) + { + if (titlename.Contains("IOS")) + wadnamebox.Text = titlename + "-64-[v].wad"; + else + wadnamebox.Text = titlename + "-NUS-[v].wad"; + if (titleversion.Text != "") + wadnamebox.Text = wadnamebox.Text.Replace("[v]", "v" + titleversion.Text); + } + + // Check for danger item + if ((e.ClickedItem.OwnerItem.OwnerItem.Image) == (redgreen) || (e.ClickedItem.OwnerItem.OwnerItem.Image) == (redorange)) + { + WriteStatus("\r\n" + e.ClickedItem.OwnerItem.OwnerItem.ToolTipText); + } + } void wwitem_regionclicked(object sender, ToolStripItemClickedEventArgs e) { titleidbox.Text = e.ClickedItem.OwnerItem.Text.Substring(0, 16); @@ -2088,6 +2147,7 @@ namespace NUS_Downloader 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]; @@ -2297,7 +2357,7 @@ namespace NUS_Downloader // # of Contents and BootIndex int nbr_cont = ContentCount(tmd); - int boot_idx = BootIndex(tmd); + int boot_idx = GetBootIndex(tmd); string[] tmdcontents = GetContentNames(tmd, nbr_cont); byte[] tmdindices = GetContentIndices(tmd, nbr_cont); @@ -2820,9 +2880,20 @@ namespace NUS_Downloader private void button17_Click(object sender, EventArgs e) { // Move groupbox to display title modder... - contentModBox.Location = new Point(278, 12); - contentModBox.Visible = true; - contentModBox.BringToFront(); + 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) @@ -2940,7 +3011,7 @@ namespace NUS_Downloader } else { - // Content is part of original TMD and must be decrypted... + /* Content is part of original TMD and must be decrypted... string filename = contentsEdit.Items[contentsEdit.SelectedIndex].ToString().Substring(contentsEdit.Items[contentsEdit.SelectedIndex].ToString().IndexOf("] [") + 3, 8); byte[] ticket = FileLocationToByteArray(fileinfo[0] + "cetk"); @@ -2965,7 +3036,9 @@ namespace NUS_Downloader } initCrypt(iv, commonkey); - byte[] dtitlekey = Decrypt(etitlekey); + byte[] dtitlekey = Decrypt(etitlekey); TODO ADD THIS SUPPORT */ + + MessageBox.Show("Currently you can only add the bug to decrypted contents. Sorry!"); } @@ -3019,5 +3092,12 @@ namespace NUS_Downloader } } } + + private void dlprogress_Click(object sender, EventArgs e) + { + // Enable BETA stuff? + truchabox.Enabled = !(truchabox.Enabled); + truchabox.Visible = !(truchabox.Visible); + } } } diff --git a/NUS Downloader/Form1.resx b/NUS Downloader/Form1.resx index 2eab66a..9b56599 100644 --- a/NUS Downloader/Form1.resx +++ b/NUS Downloader/Form1.resx @@ -253,7 +253,7 @@ XTesb3QPLh88M+QwdP6m681Lt7xuXbu94vbgcOjwnZHokdE77DtTd1PuvriXeW/h/sYH6AdFD6UeVjxS fNTws+7PbaOWo6fHXMf6Hwc/vj/OGn/2S8Yv7ycKnpCfVEyqTDZPmU2dmnafvvF05dOJZ+nPFmYKf5X+ tfa5zvMffnP8rX82YnbiBf/Fp99LXsq/PPRq2aueuYC5R69TXy/MF72Rf3P4LeNt37vwd5MLWe+x7ys/ - 6H7o/ujz8cGn1E+f/gUDmPP8usTo0wAAAAlwSFlzAAALDQAACw0B7QfALAAAAntJREFUWEftl6GOgkEM + 6H7o/ujz8cGn1E+f/gUDmPP8usTo0wAAAAlwSFlzAAALDAAACwwBP0AiyAAAAntJREFUWEftl6GOgkEM hHlwDAKHw+EwKCQWgcOikQjO8Ax795FMMtf0390EfsKRExsC2+3OtJ1umZRSJp+4PpIUiXorYrfb7QdT XkG1vexMF7Gv67Vo1cr2crmU8/k8CI6zAJQvgeXMarUqy+Wy7Pf7X+d973A4VH07tiYxHHOh1vF4TJ3z +2KxKPP5vGy329QG4iKAPwHdbDZlOp2W2Wx29+HBWa/Xg3u1IDeJEV1AcDErAw1g2QCOlQXgdDrd90SC @@ -314,7 +314,7 @@ XTesb3QPLh88M+QwdP6m681Lt7xuXbu94vbgcOjwnZHokdE77DtTd1PuvriXeW/h/sYH6AdFD6UeVjxS fNTws+7PbaOWo6fHXMf6Hwc/vj/OGn/2S8Yv7ycKnpCfVEyqTDZPmU2dmnafvvF05dOJZ+nPFmYKf5X+ tfa5zvMffnP8rX82YnbiBf/Fp99LXsq/PPRq2aueuYC5R69TXy/MF72Rf3P4LeNt37vwd5MLWe+x7ys/ - 6H7o/ujz8cGn1E+f/gUDmPP8usTo0wAAAAlwSFlzAAALDQAACw0B7QfALAAAAwJJREFUWEfdmNG1IUEQ + 6H7o/ujz8cGn1E+f/gUDmPP8usTo0wAAAAlwSFlzAAALDAAACwwBP0AiyAAAAwJJREFUWEfdmNG1IUEQ hrEBIAIyQASIgI1giYCzASADIkAEiAARLBFgA1g874Ne3+ypuT013YN73Qf3Yc7M9HRX1V/1199NyhiT +orXlwRFoV4S2GazMcvl0hwOhysGN+NeCli/3zfFYvFajpRJp9PBnff5fB4D+DLA2u12AESuWq0WAdjp /oyAewlgVMoG1Ww2zeVyMeVyORxPpzJmtVqF4EJg+/3eYKDX6wX3wWAQPvOuL76Px2OzXq+9PHfxHz+T