mirror of
https://github.com/WB3000/nusdownloader.git
synced 2024-11-17 07:09:21 +01:00
Added new fixes to my build changes. hopefully...
This commit is contained in:
parent
44920dc610
commit
1e76a7bfea
7
NUS Downloader/Form1.Designer.cs
generated
7
NUS Downloader/Form1.Designer.cs
generated
@ -314,7 +314,6 @@
|
|||||||
this.databaseStrip.Name = "databaseStrip";
|
this.databaseStrip.Name = "databaseStrip";
|
||||||
this.databaseStrip.ShowItemToolTips = false;
|
this.databaseStrip.ShowItemToolTips = false;
|
||||||
this.databaseStrip.Size = new System.Drawing.Size(164, 170);
|
this.databaseStrip.Size = new System.Drawing.Size(164, 170);
|
||||||
//this.databaseStrip.Opening += new System.ComponentModel.CancelEventHandler(this.databaseStrip_Opening);
|
|
||||||
//
|
//
|
||||||
// SystemMenuList
|
// SystemMenuList
|
||||||
//
|
//
|
||||||
@ -760,9 +759,9 @@
|
|||||||
this.contentModBox.Controls.Add(this.button11);
|
this.contentModBox.Controls.Add(this.button11);
|
||||||
this.contentModBox.Controls.Add(this.button9);
|
this.contentModBox.Controls.Add(this.button9);
|
||||||
this.contentModBox.Controls.Add(this.button10);
|
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.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.TabIndex = 41;
|
||||||
this.contentModBox.TabStop = false;
|
this.contentModBox.TabStop = false;
|
||||||
this.contentModBox.Text = "Edit Title Contents";
|
this.contentModBox.Text = "Edit Title Contents";
|
||||||
@ -1172,7 +1171,6 @@
|
|||||||
this.Controls.Add(this.saveaswadbox);
|
this.Controls.Add(this.saveaswadbox);
|
||||||
this.Controls.Add(this.databaseButton);
|
this.Controls.Add(this.databaseButton);
|
||||||
this.Controls.Add(this.button5);
|
this.Controls.Add(this.button5);
|
||||||
this.Controls.Add(this.contentModBox);
|
|
||||||
this.Controls.Add(this.proxyBox);
|
this.Controls.Add(this.proxyBox);
|
||||||
this.Controls.Add(this.button4);
|
this.Controls.Add(this.button4);
|
||||||
this.Controls.Add(this.wadnamebox);
|
this.Controls.Add(this.wadnamebox);
|
||||||
@ -1185,6 +1183,7 @@
|
|||||||
this.Controls.Add(this.button7);
|
this.Controls.Add(this.button7);
|
||||||
this.Controls.Add(this.radioButton1);
|
this.Controls.Add(this.radioButton1);
|
||||||
this.Controls.Add(this.radioButton2);
|
this.Controls.Add(this.radioButton2);
|
||||||
|
this.Controls.Add(this.contentModBox);
|
||||||
this.Controls.Add(this.packbox);
|
this.Controls.Add(this.packbox);
|
||||||
this.Controls.Add(this.statusbox);
|
this.Controls.Add(this.statusbox);
|
||||||
this.Controls.Add(this.ignoreticket);
|
this.Controls.Add(this.ignoreticket);
|
||||||
|
@ -19,7 +19,7 @@ namespace NUS_Downloader
|
|||||||
const string NUSURL = "http://nus.cdn.shop.wii.com/ccs/download/";
|
const string NUSURL = "http://nus.cdn.shop.wii.com/ccs/download/";
|
||||||
const string DSiNUSURL = "http://nus.cdn.t.shop.nintendowifi.net/ccs/download/";
|
const string DSiNUSURL = "http://nus.cdn.t.shop.nintendowifi.net/ccs/download/";
|
||||||
// TODO: Always remember to change version!
|
// TODO: Always remember to change version!
|
||||||
string version = "v1.4 Beta";
|
string version = "v1.3 Beta";
|
||||||
WebClient generalWC = new WebClient();
|
WebClient generalWC = new WebClient();
|
||||||
static RijndaelManaged rijndaelCipher;
|
static RijndaelManaged rijndaelCipher;
|
||||||
static bool dsidecrypt = false;
|
static bool dsidecrypt = false;
|
||||||
@ -206,6 +206,7 @@ namespace NUS_Downloader
|
|||||||
{
|
{
|
||||||
// Directory stuff
|
// Directory stuff
|
||||||
string currentdir = Application.StartupPath;
|
string currentdir = Application.StartupPath;
|
||||||
|
|
||||||
if (currentdir.EndsWith(Convert.ToString(Path.DirectorySeparatorChar.ToString())) == false)
|
if (currentdir.EndsWith(Convert.ToString(Path.DirectorySeparatorChar.ToString())) == false)
|
||||||
currentdir += Path.DirectorySeparatorChar.ToString();
|
currentdir += Path.DirectorySeparatorChar.ToString();
|
||||||
|
|
||||||
@ -771,6 +772,7 @@ namespace NUS_Downloader
|
|||||||
|
|
||||||
// Current directory...
|
// Current directory...
|
||||||
string currentdir = Application.StartupPath;
|
string currentdir = Application.StartupPath;
|
||||||
|
|
||||||
if (!(currentdir.EndsWith(Path.DirectorySeparatorChar.ToString())) || !(currentdir.EndsWith(Path.AltDirectorySeparatorChar.ToString())))
|
if (!(currentdir.EndsWith(Path.DirectorySeparatorChar.ToString())) || !(currentdir.EndsWith(Path.AltDirectorySeparatorChar.ToString())))
|
||||||
currentdir += Path.DirectorySeparatorChar.ToString();
|
currentdir += Path.DirectorySeparatorChar.ToString();
|
||||||
|
|
||||||
@ -852,6 +854,7 @@ namespace NUS_Downloader
|
|||||||
dlprogress.Value = 50;
|
dlprogress.Value = 50;
|
||||||
|
|
||||||
// Download CETK after tmd...
|
// Download CETK after tmd...
|
||||||
|
bool ticket_exists = true;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
DownloadNUSFile(titleid, "cetk", titledirectory, 0, wiimode);
|
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!");
|
WriteStatus("Ticket not found! Continuing, however WAD packing and decryption are not possible!");
|
||||||
packbox.Checked = false;
|
packbox.Checked = false;
|
||||||
decryptbox.Checked = false;
|
decryptbox.Checked = false;
|
||||||
|
ticket_exists = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
downloadstartbtn.Text = "Prerequisites: (2/2)";
|
downloadstartbtn.Text = "Prerequisites: (2/2)";
|
||||||
dlprogress.Value = 100;
|
dlprogress.Value = 100;
|
||||||
|
|
||||||
// Create ticket file holder
|
byte[] cetkbuf = new byte[0];
|
||||||
byte[] cetkbuf = FileLocationToByteArray(titledirectory + Path.DirectorySeparatorChar.ToString() + @"cetk");
|
byte[] titlekey = new byte[0];
|
||||||
|
if (ticket_exists)
|
||||||
|
{
|
||||||
|
// Create ticket file holder
|
||||||
|
cetkbuf = FileLocationToByteArray(titledirectory + Path.DirectorySeparatorChar.ToString() + @"cetk");
|
||||||
|
|
||||||
// Obtain TitleKey
|
// Obtain TitleKey
|
||||||
byte[] titlekey = new byte[16];
|
titlekey = new byte[16];
|
||||||
if (decryptbox.Checked == true)
|
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)
|
|
||||||
{
|
{
|
||||||
WriteStatus("Key Type: Korean");
|
// Load TitleKey into it's byte[]
|
||||||
keyBytes = LoadCommonKey(Path.DirectorySeparatorChar.ToString() + @"kkey.bin");
|
// It is currently encrypted...
|
||||||
}
|
for (int i = 0; i < 16; i++)
|
||||||
else
|
{
|
||||||
{
|
titlekey[i] = cetkbuf[0x1BF + i];
|
||||||
WriteStatus("Key Type: Standard");
|
}
|
||||||
if (wiimode)
|
|
||||||
keyBytes = LoadCommonKey(Path.DirectorySeparatorChar.ToString() + @"key.bin");
|
// 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
|
else
|
||||||
keyBytes = LoadCommonKey(Path.DirectorySeparatorChar.ToString() + @"dsikey.bin");
|
{
|
||||||
}
|
WriteStatus("Key Type: Standard");
|
||||||
|
if (wiimode)
|
||||||
initCrypt(iv, keyBytes);
|
keyBytes = LoadCommonKey(Path.DirectorySeparatorChar.ToString() + @"key.bin");
|
||||||
|
else
|
||||||
|
keyBytes = LoadCommonKey(Path.DirectorySeparatorChar.ToString() + @"dsikey.bin");
|
||||||
|
}
|
||||||
|
|
||||||
WriteStatus("Title Key: " + DisplayBytes(Decrypt(titlekey), ""));
|
initCrypt(iv, keyBytes);
|
||||||
titlekey = Decrypt(titlekey);
|
|
||||||
|
WriteStatus("Title Key: " + DisplayBytes(Decrypt(titlekey), ""));
|
||||||
|
titlekey = Decrypt(titlekey);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read the tmd as a stream...
|
// Read the tmd as a stream...
|
||||||
byte[] tmd = FileLocationToByteArray(titledirectory + tmdfull);
|
byte[] tmd = FileLocationToByteArray(titledirectory + tmdfull);
|
||||||
|
|
||||||
// Locate Certs **************************************
|
if (ticket_exists == true)
|
||||||
if (!(CertsValid()))
|
|
||||||
{
|
{
|
||||||
WriteStatus("Searching for certs...");
|
// Locate Certs **************************************
|
||||||
ScanForCerts(tmd);
|
if (!(CertsValid()))
|
||||||
ScanForCerts(cetkbuf);
|
{
|
||||||
|
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...
|
// Read Title Version...
|
||||||
string tmdversion = "";
|
string tmdversion = "";
|
||||||
@ -953,12 +965,11 @@ namespace NUS_Downloader
|
|||||||
if (sysversion != "0")
|
if (sysversion != "0")
|
||||||
WriteStatus("Requires: IOS" + sysversion);
|
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)
|
/*if ((currentdir + titleid + "v" + titleversion.Text + Path.DirectorySeparatorChar.ToString()) != titledirectory)
|
||||||
{
|
{
|
||||||
Directory.Move(titledirectory, currentdir + titleid + "v" + titleversion.Text + Path.DirectorySeparatorChar.ToString());
|
Directory.Move(titledirectory, currentdir + titleid + "v" + titleversion.Text + Path.DirectorySeparatorChar.ToString());
|
||||||
titledirectory = currentdir + titleid + "v" + titleversion.Text + Path.DirectorySeparatorChar.ToString();
|
titledirectory = currentdir + titleid + "v" + titleversion.Text + Path.DirectorySeparatorChar.ToString();
|
||||||
DirectoryInfo di = new DirectoryInfo(titledirectory);
|
|
||||||
} */
|
} */
|
||||||
|
|
||||||
// Read Content #...
|
// Read Content #...
|
||||||
@ -1029,7 +1040,7 @@ namespace NUS_Downloader
|
|||||||
}
|
}
|
||||||
iv[1] = tmdindices[i];
|
iv[1] = tmdindices[i];
|
||||||
|
|
||||||
initCrypt(iv, titlekey);
|
initCrypt(iv, titlekey);
|
||||||
|
|
||||||
/* Create decrypted file
|
/* Create decrypted file
|
||||||
string zeros = "000000";
|
string zeros = "000000";
|
||||||
@ -3435,7 +3446,7 @@ namespace NUS_Downloader
|
|||||||
wiibrewsource = wiibrewsource.Replace("<","<");
|
wiibrewsource = wiibrewsource.Replace("<","<");
|
||||||
wiibrewsource = wiibrewsource.Replace(">",">");
|
wiibrewsource = wiibrewsource.Replace(">",">");
|
||||||
wiibrewsource = wiibrewsource.Replace(""",'"'.ToString());
|
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 parsed xml database...
|
||||||
return wiibrewsource;
|
return wiibrewsource;
|
||||||
@ -3467,6 +3478,12 @@ namespace NUS_Downloader
|
|||||||
File.Delete("database.xml");
|
File.Delete("database.xml");
|
||||||
File.WriteAllText("database.xml", database);
|
File.WriteAllText("database.xml", database);
|
||||||
|
|
||||||
|
// Load it up...
|
||||||
|
ClearDatabaseStrip();
|
||||||
|
FillDatabaseStrip();
|
||||||
|
LoadRegionCodes();
|
||||||
|
ShowInnerToolTips(false);
|
||||||
|
|
||||||
WriteStatus("Database successfully updated!");
|
WriteStatus("Database successfully updated!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3637,7 +3654,7 @@ namespace NUS_Downloader
|
|||||||
if (!(Directory.Exists(currentdir + "scripts")))
|
if (!(Directory.Exists(currentdir + "scripts")))
|
||||||
{
|
{
|
||||||
Directory.CreateDirectory(currentdir + "scripts");
|
Directory.CreateDirectory(currentdir + "scripts");
|
||||||
WriteStatus(" - Created 'scrips\' directory.");
|
WriteStatus(" - Created 'scripts\' directory.");
|
||||||
}
|
}
|
||||||
string time = RemoveIllegalCharacters(DateTime.Now.ToShortTimeString());
|
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);
|
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);
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
<UpdatePeriodically>false</UpdatePeriodically>
|
<UpdatePeriodically>false</UpdatePeriodically>
|
||||||
<UpdateRequired>false</UpdateRequired>
|
<UpdateRequired>false</UpdateRequired>
|
||||||
<MapFileExtensions>true</MapFileExtensions>
|
<MapFileExtensions>true</MapFileExtensions>
|
||||||
<ApplicationRevision>10</ApplicationRevision>
|
<ApplicationRevision>11</ApplicationRevision>
|
||||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||||
<UseApplicationTrust>false</UseApplicationTrust>
|
<UseApplicationTrust>false</UseApplicationTrust>
|
||||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||||
|
@ -6,6 +6,18 @@ namespace NUS_Downloader
|
|||||||
{
|
{
|
||||||
class TMD
|
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.
|
* 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.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user