Boot index now changes...

This commit is contained in:
givememystuffplease 2009-07-22 22:22:04 +00:00
parent e404a42999
commit b4304c2ed5

View File

@ -340,7 +340,7 @@ namespace NUS_Downloader
return nbr_cont; return nbr_cont;
} }
private int BootIndex(byte[] tmd) private int GetBootIndex(byte[] tmd)
{ {
// nbr_cont (0xE0) len=0x02 // nbr_cont (0xE0) len=0x02
int bootidx = 0; int bootidx = 0;
@ -348,6 +348,15 @@ namespace NUS_Downloader
return bootidx; return bootidx;
} }
private byte[] SetBootIndex(byte[] tmd, int bootindex)
{
// nbr_cont (0xE0) len=0x02
byte[] bootbytes = NewIntegertoByteArray(bootindex, 2);
tmd[0x1E0] = bootbytes[0];
tmd[0x1E1] = bootbytes[1];
return tmd;
}
private void WriteStatus(string Update) private void WriteStatus(string Update)
{ {
// Small function for writing text to the statusbox... // Small function for writing text to the statusbox...
@ -2553,6 +2562,11 @@ namespace NUS_Downloader
{ {
string itemstr = contentsEdit.Items[c].ToString(); string itemstr = contentsEdit.Items[c].ToString();
contents[c] = new TitleContent(); contents[c] = new TitleContent();
// Set boot index...
if (itemstr.Contains(" [BOOT]"))
{
tmd = SetBootIndex(tmd, c);
}
if (itemstr.Contains(".app")) if (itemstr.Contains(".app"))
{ {
// This is already decrypted, we're going to add it to the TMD... // This is already decrypted, we're going to add it to the TMD...
@ -2725,6 +2739,7 @@ namespace NUS_Downloader
} }
} }
// Collect everything into a single byte[]... // Collect everything into a single byte[]...
byte[] contentSection = new byte[contents.Length * 36]; byte[] contentSection = new byte[contents.Length * 36];
for (int h = 0; h < contents.Length; h++) for (int h = 0; h < contents.Length; h++)