diff --git a/NUS Downloader/Form1.Designer.cs b/NUS Downloader/Form1.Designer.cs
index b77128b..eb3e0b4 100644
--- a/NUS Downloader/Form1.Designer.cs
+++ b/NUS Downloader/Form1.Designer.cs
@@ -314,7 +314,6 @@
this.databaseStrip.Name = "databaseStrip";
this.databaseStrip.ShowItemToolTips = false;
this.databaseStrip.Size = new System.Drawing.Size(164, 170);
- //this.databaseStrip.Opening += new System.ComponentModel.CancelEventHandler(this.databaseStrip_Opening);
//
// SystemMenuList
//
@@ -760,9 +759,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(278, 434);
+ this.contentModBox.Location = new System.Drawing.Point(265, 146);
this.contentModBox.Name = "contentModBox";
- this.contentModBox.Size = new System.Drawing.Size(249, 69);
+ this.contentModBox.Size = new System.Drawing.Size(249, 329);
this.contentModBox.TabIndex = 41;
this.contentModBox.TabStop = false;
this.contentModBox.Text = "Edit Title Contents";
@@ -1172,7 +1171,6 @@
this.Controls.Add(this.saveaswadbox);
this.Controls.Add(this.databaseButton);
this.Controls.Add(this.button5);
- this.Controls.Add(this.contentModBox);
this.Controls.Add(this.proxyBox);
this.Controls.Add(this.button4);
this.Controls.Add(this.wadnamebox);
@@ -1185,6 +1183,7 @@
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);
diff --git a/NUS Downloader/Form1.cs b/NUS Downloader/Form1.cs
index 51c6964..f0bd307 100644
--- a/NUS Downloader/Form1.cs
+++ b/NUS Downloader/Form1.cs
@@ -19,7 +19,7 @@ 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.4 Beta";
+ string version = "v1.3 Beta";
WebClient generalWC = new WebClient();
static RijndaelManaged rijndaelCipher;
static bool dsidecrypt = false;
@@ -206,6 +206,7 @@ namespace NUS_Downloader
{
// Directory stuff
string currentdir = Application.StartupPath;
+
if (currentdir.EndsWith(Convert.ToString(Path.DirectorySeparatorChar.ToString())) == false)
currentdir += Path.DirectorySeparatorChar.ToString();
@@ -771,6 +772,7 @@ namespace NUS_Downloader
// Current directory...
string currentdir = Application.StartupPath;
+
if (!(currentdir.EndsWith(Path.DirectorySeparatorChar.ToString())) || !(currentdir.EndsWith(Path.AltDirectorySeparatorChar.ToString())))
currentdir += Path.DirectorySeparatorChar.ToString();
@@ -852,6 +854,7 @@ namespace NUS_Downloader
dlprogress.Value = 50;
// Download CETK after tmd...
+ bool ticket_exists = true;
try
{
DownloadNUSFile(titleid, "cetk", titledirectory, 0, wiimode);
@@ -874,71 +877,80 @@ namespace NUS_Downloader
WriteStatus("Ticket not found! Continuing, however WAD packing and decryption are not possible!");
packbox.Checked = false;
decryptbox.Checked = false;
+ ticket_exists = false;
}
}
downloadstartbtn.Text = "Prerequisites: (2/2)";
dlprogress.Value = 100;
- // Create ticket file holder
- byte[] cetkbuf = FileLocationToByteArray(titledirectory + Path.DirectorySeparatorChar.ToString() + @"cetk");
+ byte[] cetkbuf = new byte[0];
+ byte[] titlekey = new byte[0];
+ if (ticket_exists)
+ {
+ // Create ticket file holder
+ cetkbuf = FileLocationToByteArray(titledirectory + Path.DirectorySeparatorChar.ToString() + @"cetk");
- // Obtain TitleKey
- byte[] titlekey = new byte[16];
- if (decryptbox.Checked == true)
- {
- // Load TitleKey into it's byte[]
- // It is currently encrypted...
- for (int i = 0; i < 16; i++)
- {
- titlekey[i] = cetkbuf[0x1BF + i];
- }
-
- // IV (TITLEID+0000s)
- 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;
- }
-
- // Standard/Korea Common Key
- byte[] keyBytes;
- if (cetkbuf[0x01F1] == 0x01)
+ // Obtain TitleKey
+ titlekey = new byte[16];
+ if (decryptbox.Checked == true)
{
- WriteStatus("Key Type: Korean");
- keyBytes = LoadCommonKey(Path.DirectorySeparatorChar.ToString() + @"kkey.bin");
- }
- else
- {
- WriteStatus("Key Type: Standard");
- if (wiimode)
- keyBytes = LoadCommonKey(Path.DirectorySeparatorChar.ToString() + @"key.bin");
+ // Load TitleKey into it's byte[]
+ // It is currently encrypted...
+ for (int i = 0; i < 16; i++)
+ {
+ titlekey[i] = cetkbuf[0x1BF + i];
+ }
+
+ // IV (TITLEID+0000s)
+ 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;
+ }
+
+ // Standard/Korea Common Key
+ byte[] keyBytes;
+ if (cetkbuf[0x01F1] == 0x01)
+ {
+ WriteStatus("Key Type: Korean");
+ keyBytes = LoadCommonKey(Path.DirectorySeparatorChar.ToString() + @"kkey.bin");
+ }
else
- keyBytes = LoadCommonKey(Path.DirectorySeparatorChar.ToString() + @"dsikey.bin");
- }
-
- initCrypt(iv, keyBytes);
+ {
+ WriteStatus("Key Type: Standard");
+ if (wiimode)
+ keyBytes = LoadCommonKey(Path.DirectorySeparatorChar.ToString() + @"key.bin");
+ else
+ keyBytes = LoadCommonKey(Path.DirectorySeparatorChar.ToString() + @"dsikey.bin");
+ }
- WriteStatus("Title Key: " + DisplayBytes(Decrypt(titlekey), ""));
- titlekey = Decrypt(titlekey);
+ initCrypt(iv, keyBytes);
+
+ WriteStatus("Title Key: " + DisplayBytes(Decrypt(titlekey), ""));
+ titlekey = Decrypt(titlekey);
+ }
}
// Read the tmd as a stream...
byte[] tmd = FileLocationToByteArray(titledirectory + tmdfull);
- // Locate Certs **************************************
- if (!(CertsValid()))
+ if (ticket_exists == true)
{
- WriteStatus("Searching for certs...");
- ScanForCerts(tmd);
- ScanForCerts(cetkbuf);
+ // Locate Certs **************************************
+ if (!(CertsValid()))
+ {
+ WriteStatus("Searching for certs...");
+ ScanForCerts(tmd);
+ ScanForCerts(cetkbuf);
+ }
+ else
+ WriteStatus("Using cached certs...");
+ // /Locate Cert **************************************
}
- else
- WriteStatus("Using cached certs...");
- // /Locate Cert **************************************
// Read Title Version...
string tmdversion = "";
@@ -953,12 +965,11 @@ namespace NUS_Downloader
if (sysversion != "0")
WriteStatus("Requires: IOS" + sysversion);
- // Renaming would be ideal, but gives too many errors...
+ // Renaming would be ideal, but gives too many permission errors...
/*if ((currentdir + titleid + "v" + titleversion.Text + Path.DirectorySeparatorChar.ToString()) != titledirectory)
- {
- Directory.Move(titledirectory, currentdir + titleid + "v" + titleversion.Text + Path.DirectorySeparatorChar.ToString());
- titledirectory = currentdir + titleid + "v" + titleversion.Text + Path.DirectorySeparatorChar.ToString();
- DirectoryInfo di = new DirectoryInfo(titledirectory);
+ {
+ Directory.Move(titledirectory, currentdir + titleid + "v" + titleversion.Text + Path.DirectorySeparatorChar.ToString());
+ titledirectory = currentdir + titleid + "v" + titleversion.Text + Path.DirectorySeparatorChar.ToString();
} */
// Read Content #...
@@ -1029,7 +1040,7 @@ namespace NUS_Downloader
}
iv[1] = tmdindices[i];
- initCrypt(iv, titlekey);
+ initCrypt(iv, titlekey);
/* Create decrypted file
string zeros = "000000";
@@ -3435,7 +3446,7 @@ namespace NUS_Downloader
wiibrewsource = wiibrewsource.Replace("<","<");
wiibrewsource = wiibrewsource.Replace(">",">");
wiibrewsource = wiibrewsource.Replace(""",'"'.ToString());
- wiibrewsource = wiibrewsource.Replace(" ", " "); // Shouldn't occur, but they happen...
+ wiibrewsource = wiibrewsource.Replace(" "," "); // Shouldn't occur, but they happen...
// Return parsed xml database...
return wiibrewsource;
@@ -3467,6 +3478,12 @@ namespace NUS_Downloader
File.Delete("database.xml");
File.WriteAllText("database.xml", database);
+ // Load it up...
+ ClearDatabaseStrip();
+ FillDatabaseStrip();
+ LoadRegionCodes();
+ ShowInnerToolTips(false);
+
WriteStatus("Database successfully updated!");
}
@@ -3637,7 +3654,7 @@ namespace NUS_Downloader
if (!(Directory.Exists(currentdir + "scripts")))
{
Directory.CreateDirectory(currentdir + "scripts");
- WriteStatus(" - Created 'scrips\' directory.");
+ WriteStatus(" - Created 'scripts\' directory.");
}
string time = RemoveIllegalCharacters(DateTime.Now.ToShortTimeString());
File.WriteAllText(String.Format(currentdir + "scripts\\{0}_Update_{1}_{2}_{3} {4}.nus", RegionID, DateTime.Now.Month, DateTime.Now.Day, DateTime.Now.Year, time), script_text);
diff --git a/NUS Downloader/NUS Downloader.csproj b/NUS Downloader/NUS Downloader.csproj
index f1dfd22..9a91c99 100644
--- a/NUS Downloader/NUS Downloader.csproj
+++ b/NUS Downloader/NUS Downloader.csproj
@@ -30,7 +30,7 @@
false
false
true
- 10
+ 11
1.0.0.%2a
false
true
diff --git a/NUS Downloader/TMD.cs b/NUS Downloader/TMD.cs
index b49339c..a80ec57 100644
--- a/NUS Downloader/TMD.cs
+++ b/NUS Downloader/TMD.cs
@@ -6,6 +6,18 @@ 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.