mirror of
https://github.com/mogzol/sharpii.git
synced 2024-11-21 17:59:19 +01:00
Updated to 1.6 - SendWad now supports AHBPROT (use '-ahb')
- IP can now be saved in an environmental variable (SharpiiIP) for both SendWad and SendDol (manually or with '-saveip') - Pointless aster eggs are fun! - Code cleanup/bug fixes
This commit is contained in:
parent
bc65416cf7
commit
a6d7600859
@ -55,7 +55,7 @@ namespace Sharpii
|
||||
//Check if file exists
|
||||
if (File.Exists(input) == false)
|
||||
{
|
||||
System.Console.WriteLine("ERROR: Unable to open file: {0}", input);
|
||||
Console.WriteLine("ERROR: Unable to open file: {0}", input);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -64,15 +64,15 @@ namespace Sharpii
|
||||
{
|
||||
//Now convert it
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.Write("Loading file...");
|
||||
Console.Write("Loading file...");
|
||||
|
||||
Wave WavFile = libWiiSharp.BNS.BnsToWave(input);
|
||||
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.Write("Done!\n");
|
||||
Console.Write("Done!\n");
|
||||
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.Write("Saving wav...");
|
||||
Console.Write("Saving wav...");
|
||||
|
||||
if (output.Substring(output.Length - 4, 4).ToUpper() != ".WAV")
|
||||
output = output + ".wav";
|
||||
@ -80,16 +80,16 @@ namespace Sharpii
|
||||
WavFile.Save(output);
|
||||
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.Write("Done!\n");
|
||||
Console.Write("Done!\n");
|
||||
|
||||
if (Quiet.quiet > 1)
|
||||
System.Console.WriteLine("Operation completed succesfully!");
|
||||
Console.WriteLine("Operation completed succesfully!");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Console.WriteLine("An unknown error occured, please try again");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine("ERROR DETAILS: {0}", ex.Message);
|
||||
Console.WriteLine("An unknown error occured, please try again");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("ERROR DETAILS: {0}", ex.Message);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -104,7 +104,7 @@ namespace Sharpii
|
||||
//Check if file exists
|
||||
if (File.Exists(input) == false)
|
||||
{
|
||||
System.Console.WriteLine("ERROR: Unable to open file: {0}", input);
|
||||
Console.WriteLine("ERROR: Unable to open file: {0}", input);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -131,28 +131,28 @@ namespace Sharpii
|
||||
try
|
||||
{
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.Write("Loading file...");
|
||||
Console.Write("Loading file...");
|
||||
|
||||
BNS WavFile = new BNS(input);
|
||||
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.Write("Done!\n");
|
||||
Console.Write("Done!\n");
|
||||
|
||||
if (loop == true)
|
||||
{
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.WriteLine("Applying loop");
|
||||
Console.WriteLine("Applying loop");
|
||||
WavFile.SetLoop(1);
|
||||
}
|
||||
if (mono == true)
|
||||
{
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.WriteLine("Converting to mono");
|
||||
Console.WriteLine("Converting to mono");
|
||||
WavFile.StereoToMono = true;
|
||||
}
|
||||
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.Write("Saving BNS...");
|
||||
Console.Write("Saving BNS...");
|
||||
|
||||
WavFile.Convert();
|
||||
|
||||
@ -162,42 +162,42 @@ namespace Sharpii
|
||||
WavFile.Save(output);
|
||||
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.Write("Done!\n");
|
||||
Console.Write("Done!\n");
|
||||
|
||||
if (Quiet.quiet > 1)
|
||||
System.Console.WriteLine("Operation completed succesfully!");
|
||||
Console.WriteLine("Operation completed succesfully!");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Console.WriteLine("An unknown error occured, please try again");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine("ERROR DETAILS: {0}", ex.Message);
|
||||
Console.WriteLine("An unknown error occured, please try again");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("ERROR DETAILS: {0}", ex.Message);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public static void Wav2BNS_help()
|
||||
{
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine("Sharpii {0} - BNS - A tool by person66, using libWiiSharp.dll by leathl", Version.version);
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine(" Usage:");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine(" Sharpii BNS [-to | -from] input.wav output.bns [-l/-loop] [-m/-mono]");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine(" Arguments:");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine(" -to Convert wav to bns");
|
||||
System.Console.WriteLine(" -from Create wav from bns");
|
||||
System.Console.WriteLine(" input.wav The input wave sound file");
|
||||
System.Console.WriteLine(" output.bns The output BNS sound file");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine(" Arguments for converting to BNS:");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine(" -l | -loop Creates a looping BNS");
|
||||
System.Console.WriteLine(" -m | -mono Convert stereo sound to mono BNS");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("Sharpii {0} - BNS - A tool by person66, using libWiiSharp.dll by leathl", Version.version);
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" Usage:");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" Sharpii BNS [-to | -from] input.wav output.bns [-l/-loop] [-m/-mono]");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" Arguments:");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" -to Convert wav to bns");
|
||||
Console.WriteLine(" -from Create wav from bns");
|
||||
Console.WriteLine(" input.wav The input wave sound file");
|
||||
Console.WriteLine(" output.bns The output BNS sound file");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" Arguments for converting to BNS:");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" -l | -loop Creates a looping BNS");
|
||||
Console.WriteLine(" -m | -mono Convert stereo sound to mono BNS");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
176
Sharpii/HBC.cs
176
Sharpii/HBC.cs
@ -41,6 +41,7 @@ namespace Sharpii
|
||||
string protocol = "JODI";
|
||||
string arguments = "";
|
||||
bool compress = true;
|
||||
bool saveip = false;
|
||||
|
||||
//Get parameters
|
||||
for (int i = 1; i < args.Length; i++)
|
||||
@ -55,6 +56,9 @@ namespace Sharpii
|
||||
}
|
||||
ip = args[i + 1];
|
||||
break;
|
||||
case "-SAVEIP":
|
||||
saveip = true;
|
||||
break;
|
||||
case "-DOL":
|
||||
if (i + 1 >= args.Length)
|
||||
{
|
||||
@ -65,7 +69,7 @@ namespace Sharpii
|
||||
//Check if file exists
|
||||
if (File.Exists(input) == false)
|
||||
{
|
||||
System.Console.WriteLine("ERROR: Unable to open file: {0}", input);
|
||||
Console.WriteLine("ERROR: Unable to open file: {0}", input);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -90,44 +94,58 @@ namespace Sharpii
|
||||
//Run main part, and check for exceptions
|
||||
try
|
||||
{
|
||||
if (ip != "" && saveip == true)
|
||||
{
|
||||
if (Quiet.quiet > 2)
|
||||
Console.WriteLine("Saving IP");
|
||||
Environment.SetEnvironmentVariable("SharpiiIP", ip, EnvironmentVariableTarget.User);
|
||||
}
|
||||
|
||||
if (ip == "")
|
||||
{
|
||||
if (Quiet.quiet > 2)
|
||||
Console.WriteLine("No IP set, using {0}", Environment.GetEnvironmentVariable("SharpiiIP", EnvironmentVariableTarget.User));
|
||||
ip = Environment.GetEnvironmentVariable("SharpiiIP", EnvironmentVariableTarget.User);
|
||||
}
|
||||
|
||||
libWiiSharp.Protocol proto = Protocol.JODI;
|
||||
|
||||
if (Quiet.quiet > 2 && protocol == "HAXX")
|
||||
System.Console.WriteLine("Using old protocol");
|
||||
Console.WriteLine("Using old protocol");
|
||||
|
||||
if (protocol == "HAXX")
|
||||
proto = Protocol.HAXX;
|
||||
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.Write("Loading File...");
|
||||
Console.Write("Loading File...");
|
||||
|
||||
HbcTransmitter file = new HbcTransmitter(proto, ip);
|
||||
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.Write("Done!\n");
|
||||
Console.Write("Done!\n");
|
||||
|
||||
|
||||
if (Quiet.quiet > 2 && compress == true)
|
||||
System.Console.Write("Compressing File...");
|
||||
Console.Write("Compressing File...");
|
||||
|
||||
file.Compress = compress;
|
||||
|
||||
if (Quiet.quiet > 2 && compress == true)
|
||||
System.Console.Write("Done!\n");
|
||||
Console.Write("Done!\n");
|
||||
|
||||
if (Quiet.quiet > 1)
|
||||
System.Console.Write("Sending file...");
|
||||
Console.Write("Sending file...");
|
||||
|
||||
file.TransmitFile(Path.GetFileName(input) + arguments, File.ReadAllBytes(input));
|
||||
|
||||
if (Quiet.quiet > 1)
|
||||
System.Console.Write("Done!\n");
|
||||
Console.Write("Done!\n");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Console.WriteLine("An unknown error occured, please try again");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine("ERROR DETAILS: {0}", ex.Message);
|
||||
Console.WriteLine("An unknown error occured, please try again");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("ERROR DETAILS: {0}", ex.Message);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -150,9 +168,9 @@ namespace Sharpii
|
||||
|
||||
if (!File.Exists("WadInstaller.dll"))
|
||||
{
|
||||
System.Console.WriteLine("ERROR: WadInstaller.dll not found");
|
||||
System.Console.WriteLine("\n\nAttemp to download? [Y/N]");
|
||||
System.Console.Write("\n>>");
|
||||
Console.WriteLine("ERROR: WadInstaller.dll not found");
|
||||
Console.WriteLine("\n\nAttemp to download? [Y/N]");
|
||||
Console.Write("\n>>");
|
||||
string ans = Console.ReadLine();
|
||||
if (ans.ToUpper() == "Y")
|
||||
{
|
||||
@ -164,7 +182,7 @@ namespace Sharpii
|
||||
Console.Write("Done!\n");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{ System.Console.WriteLine("An error occured: {0}", ex.Message); return false; }
|
||||
{ Console.WriteLine("An error occured: {0}", ex.Message); return false; }
|
||||
}
|
||||
else
|
||||
return false;
|
||||
@ -179,6 +197,8 @@ namespace Sharpii
|
||||
string ip = "";
|
||||
string ios = "";
|
||||
string protocol = "JODI";
|
||||
bool ahb = false;
|
||||
bool saveip = false;
|
||||
|
||||
//Get parameters
|
||||
for (int i = 1; i < args.Length; i++)
|
||||
@ -188,7 +208,7 @@ namespace Sharpii
|
||||
case "-IOS":
|
||||
if (i + 1 >= args.Length)
|
||||
{
|
||||
Console.WriteLine("ERROR: No ip set");
|
||||
Console.WriteLine("ERROR: No ios set");
|
||||
return;
|
||||
}
|
||||
ios = args[i + 1];
|
||||
@ -198,6 +218,9 @@ namespace Sharpii
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case "-AHB":
|
||||
ahb = true;
|
||||
break;
|
||||
case "-IP":
|
||||
if (i + 1 >= args.Length)
|
||||
{
|
||||
@ -206,6 +229,9 @@ namespace Sharpii
|
||||
}
|
||||
ip = args[i + 1];
|
||||
break;
|
||||
case "-SAVEIP":
|
||||
saveip = true;
|
||||
break;
|
||||
case "-WAD":
|
||||
if (i + 1 >= args.Length)
|
||||
{
|
||||
@ -216,7 +242,7 @@ namespace Sharpii
|
||||
//Check if file exists
|
||||
if (File.Exists(input) == false)
|
||||
{
|
||||
System.Console.WriteLine("ERROR: Unable to open file: {0}", input);
|
||||
Console.WriteLine("ERROR: Unable to open file: {0}", input);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
@ -229,36 +255,57 @@ namespace Sharpii
|
||||
//Run main part, and check for exceptions
|
||||
try
|
||||
{
|
||||
if (ip != "" && saveip == true)
|
||||
{
|
||||
if (Quiet.quiet > 2)
|
||||
Console.WriteLine("Saving IP");
|
||||
Environment.SetEnvironmentVariable("SharpiiIP", ip, EnvironmentVariableTarget.User);
|
||||
}
|
||||
|
||||
if (ahb == true || ios == "")
|
||||
{
|
||||
if (Quiet.quiet > 2)
|
||||
Console.WriteLine("Using AHBPROT");
|
||||
ios = "0";
|
||||
}
|
||||
|
||||
if (ip == "")
|
||||
{
|
||||
if (Quiet.quiet > 2)
|
||||
Console.WriteLine("No IP set, using {0}", Environment.GetEnvironmentVariable("SharpiiIP", EnvironmentVariableTarget.User));
|
||||
ip = Environment.GetEnvironmentVariable("SharpiiIP", EnvironmentVariableTarget.User);
|
||||
}
|
||||
|
||||
libWiiSharp.Protocol proto = Protocol.JODI;
|
||||
|
||||
if (Quiet.quiet > 2 && protocol == "HAXX")
|
||||
System.Console.WriteLine("Using old protocol");
|
||||
Console.WriteLine("Using old protocol");
|
||||
|
||||
if (protocol == "HAXX")
|
||||
proto = Protocol.HAXX;
|
||||
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.Write("Loading File...");
|
||||
Console.Write("Loading File...");
|
||||
|
||||
HbcTransmitter file = new HbcTransmitter(proto, ip);
|
||||
byte[] Installer = WadInstaller.InstallerHelper.CreateInstaller(input, (byte)Convert.ToInt32(ios)).ToArray();
|
||||
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.Write("Done!\n");
|
||||
Console.Write("Done!\n");
|
||||
|
||||
if (Quiet.quiet > 1)
|
||||
System.Console.Write("Sending file...");
|
||||
Console.Write("Sending file...");
|
||||
|
||||
file.TransmitFile("WadInstaller.dol", Installer);
|
||||
|
||||
if (Quiet.quiet > 1)
|
||||
System.Console.Write("Done!\n");
|
||||
Console.Write("Done!\n");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Console.WriteLine("An unknown error occured, please try again");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine("ERROR DETAILS: {0}", ex.Message);
|
||||
Console.WriteLine("An unknown error occured, please try again");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("ERROR DETAILS: {0}", ex.Message);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -268,47 +315,52 @@ namespace Sharpii
|
||||
|
||||
private static void SendDol_help()
|
||||
{
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine("Sharpii {0} - SendDol - A tool by person66, using libWiiSharp.dll by leathl", Version.version);
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine(" Usage:");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine(" Sharpii.exe SendDol -ip ip_adress [-old] [-nocomp] -dol file [args]");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine(" Arguments:");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine(" -dol file The dol file to send");
|
||||
System.Console.WriteLine(" -ip ip_adress The IP address of your wii");
|
||||
System.Console.WriteLine(" -old Use for the old (1.0.4 and below) HBC");
|
||||
System.Console.WriteLine(" -nocomp Disable compression");
|
||||
System.Console.WriteLine(" args Dol arguments");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine(" NOTE: Any arguments after '-dol file' will be sent as dol");
|
||||
System.Console.WriteLine(" arguments");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("Sharpii {0} - SendDol - A tool by person66, using libWiiSharp.dll by leathl", Version.version);
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" Usage:");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" Sharpii.exe SendDol -ip ip_adress [-old] [-nocomp] [-saveip]");
|
||||
Console.WriteLine(" -dol file [args]");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" Arguments:");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" -dol file The dol file to send");
|
||||
Console.WriteLine(" -ip ip_adress The IP address of your wii");
|
||||
Console.WriteLine(" -saveip Save entered IP address for future use");
|
||||
Console.WriteLine(" -old Use for the old (1.0.4 and below) HBC");
|
||||
Console.WriteLine(" -nocomp Disable compression");
|
||||
Console.WriteLine(" args Dol arguments");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" NOTE: Any arguments after '-dol file' will be sent as dol");
|
||||
Console.WriteLine(" arguments");
|
||||
}
|
||||
|
||||
public static void SendWad_help()
|
||||
{
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine("Sharpii {0} - SendWad - A tool by person66, using libWiiSharp.dll by leathl,", Version.version);
|
||||
System.Console.WriteLine(" and CRAP's installer by WiiCrazy/I.R.on");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine(" Usage:");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine(" Sharpii.exe SendWad -ip ip_adress -wad file -ios ios [-old] [-nocomp]");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine(" Arguments:");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine(" -dol file The dol file to send");
|
||||
System.Console.WriteLine(" -ip ip_adress The IP address of your wii");
|
||||
System.Console.WriteLine(" -ios ios The ios to use to install the wad");
|
||||
System.Console.WriteLine(" -old Use for the old (1.0.4 and below) HBC");
|
||||
System.Console.WriteLine(" -nocomp Disable compression");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine(" NOTE: WAD files must be less than 8MB large");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("Sharpii {0} - SendWad - A tool by person66, using libWiiSharp.dll by leathl,", Version.version);
|
||||
Console.WriteLine(" and CRAP's installer by WiiCrazy/I.R.on");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" Usage:");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" Sharpii.exe SendWad -ip ip_adress -wad file [-ios IOS | -ahb] [-old]");
|
||||
Console.WriteLine(" [-nocomp] [-saveip]");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" Arguments:");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" -dol file The dol file to send");
|
||||
Console.WriteLine(" -ip ip_adress The IP address of your wii");
|
||||
Console.WriteLine(" -ios ios The ios to use to install the wad");
|
||||
Console.WriteLine(" -ahb Use HW_AHBPROT to install the wad");
|
||||
Console.WriteLine(" -saveip Save entered IP address for future use");
|
||||
Console.WriteLine(" -old Use for the old (1.0.4 and below) HBC");
|
||||
Console.WriteLine(" -nocomp Disable compression");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" NOTE: WAD files must be less than 8MB large");
|
||||
}
|
||||
}
|
||||
}
|
@ -42,7 +42,7 @@ namespace Sharpii
|
||||
//Check if file exists
|
||||
if (File.Exists(input) == false)
|
||||
{
|
||||
System.Console.WriteLine("ERROR: Unable to open file: {0}", input);
|
||||
Console.WriteLine("ERROR: Unable to open file: {0}", input);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -132,12 +132,12 @@ namespace Sharpii
|
||||
ios.KeepOriginalFooter = true;
|
||||
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.Write("Loading File...");
|
||||
Console.Write("Loading File...");
|
||||
|
||||
ios.LoadFile(input);
|
||||
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.Write("Done!\n");
|
||||
Console.Write("Done!\n");
|
||||
|
||||
//Check if WAD is an IOS
|
||||
if ((ios.TitleID >> 32) != 1 || (ios.TitleID & 0xffffffff) > 255 || (ios.TitleID & 0xffffffff) < 3)
|
||||
@ -154,28 +154,28 @@ namespace Sharpii
|
||||
if (fs == true)
|
||||
{
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.WriteLine("Applying Fakesigning patch");
|
||||
Console.WriteLine("Applying Fakesigning patch");
|
||||
patcher.PatchFakeSigning();
|
||||
}
|
||||
|
||||
if (es == true)
|
||||
{
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.WriteLine("Applying ES_Identify patch");
|
||||
Console.WriteLine("Applying ES_Identify patch");
|
||||
patcher.PatchEsIdentify();
|
||||
}
|
||||
|
||||
if (np == true)
|
||||
{
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.WriteLine("Applying NAND permissions patch");
|
||||
Console.WriteLine("Applying NAND permissions patch");
|
||||
patcher.PatchNandPermissions();
|
||||
}
|
||||
|
||||
if (vp == true)
|
||||
{
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.WriteLine("Applying Version patch");
|
||||
Console.WriteLine("Applying Version patch");
|
||||
patcher.PatchVP();
|
||||
}
|
||||
|
||||
@ -185,14 +185,14 @@ namespace Sharpii
|
||||
if (slot > -1)
|
||||
{
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.WriteLine("Changing IOS slot to: {0}", slot);
|
||||
Console.WriteLine("Changing IOS slot to: {0}", slot);
|
||||
ios.TitleID = (ulong)((1UL << 32) | (uint)slot);
|
||||
}
|
||||
|
||||
if (version > -1)
|
||||
{
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.WriteLine("Changing title version to: {0}", version);
|
||||
Console.WriteLine("Changing title version to: {0}", version);
|
||||
ios.TitleVersion = (ushort)version;
|
||||
}
|
||||
|
||||
@ -200,13 +200,13 @@ namespace Sharpii
|
||||
if (output != "")
|
||||
{
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.WriteLine("Saving to file: {0}", output);
|
||||
Console.WriteLine("Saving to file: {0}", output);
|
||||
ios.Save(output);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.Write("Saving file...");
|
||||
Console.Write("Saving file...");
|
||||
|
||||
if (output != "")
|
||||
{
|
||||
@ -217,16 +217,16 @@ namespace Sharpii
|
||||
ios.Save(input);
|
||||
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.Write("Done!\n");
|
||||
Console.Write("Done!\n");
|
||||
}
|
||||
if (Quiet.quiet > 1)
|
||||
System.Console.WriteLine("Operation completed succesfully!");
|
||||
Console.WriteLine("Operation completed succesfully!");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Console.WriteLine("An unknown error occured, please try again");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine("ERROR DETAILS: {0}", ex.Message);
|
||||
Console.WriteLine("An unknown error occured, please try again");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("ERROR DETAILS: {0}", ex.Message);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -236,26 +236,26 @@ namespace Sharpii
|
||||
|
||||
public static void IOS_help()
|
||||
{
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine("Sharpii {0} - IOS - A tool by person66, using libWiiSharp.dll by leathl", Version.version);
|
||||
System.Console.WriteLine(" Code based off PatchIOS by leathl");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine(" Usage:");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine(" Sharpii.exe IOS input [-o output] [-fs] [-es] [-np] [-vp] [-s slot]");
|
||||
System.Console.WriteLine(" [-v version]");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine(" Arguments:");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine(" input The input file");
|
||||
System.Console.WriteLine(" -o output The output file");
|
||||
System.Console.WriteLine(" -fs Patch Fakesigning");
|
||||
System.Console.WriteLine(" -es Patch ES_Identify");
|
||||
System.Console.WriteLine(" -np Patch NAND Permissions");
|
||||
System.Console.WriteLine(" -vp Add version patch");
|
||||
System.Console.WriteLine(" -s # Change IOS slot to #");
|
||||
System.Console.WriteLine(" -v # Change IOS version to #");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("Sharpii {0} - IOS - A tool by person66, using libWiiSharp.dll by leathl", Version.version);
|
||||
Console.WriteLine(" Code based off PatchIOS by leathl");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" Usage:");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" Sharpii.exe IOS input [-o output] [-fs] [-es] [-np] [-vp] [-s slot]");
|
||||
Console.WriteLine(" [-v version]");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" Arguments:");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" input The input file");
|
||||
Console.WriteLine(" -o output The output file");
|
||||
Console.WriteLine(" -fs Patch Fakesigning");
|
||||
Console.WriteLine(" -es Patch ES_Identify");
|
||||
Console.WriteLine(" -np Patch NAND Permissions");
|
||||
Console.WriteLine(" -vp Add version patch");
|
||||
Console.WriteLine(" -s # Change IOS slot to #");
|
||||
Console.WriteLine(" -v # Change IOS version to #");
|
||||
}
|
||||
}
|
||||
}
|
@ -169,14 +169,14 @@ namespace Sharpii
|
||||
//Error checking & stuff
|
||||
if (id == "")
|
||||
{
|
||||
System.Console.WriteLine("ERROR: No ID specified");
|
||||
Console.WriteLine("ERROR: No ID specified");
|
||||
return;
|
||||
}
|
||||
|
||||
if (version == "")
|
||||
{
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.WriteLine("No version specified, using latest", version);
|
||||
Console.WriteLine("No version specified, using latest", version);
|
||||
version = "LATEST";
|
||||
}
|
||||
|
||||
@ -188,14 +188,14 @@ namespace Sharpii
|
||||
version = tmd.TitleVersion.ToString();
|
||||
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.WriteLine("Found latest version: v{0}", version);
|
||||
Console.WriteLine("Found latest version: v{0}", version);
|
||||
}
|
||||
|
||||
if (entered == false) //Will only be false if no store type argument was given
|
||||
{
|
||||
store.Add(StoreType.All);
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.WriteLine("No store type specified, using all");
|
||||
Console.WriteLine("No store type specified, using all");
|
||||
}
|
||||
|
||||
if (id.Length == 16 && Convert.ToInt32(id.Substring(14, 2), 16) >= 3 && Convert.ToInt32(id.Substring(14, 2), 16) <= 255 && id.Substring(0, 14) == "00000001000000")
|
||||
@ -215,7 +215,7 @@ namespace Sharpii
|
||||
NoOut = true;
|
||||
output = ios == "" ? id + "v" + version : ios.Substring(0, ios.Length - 4);
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.WriteLine("No output specified, using {0}", output);
|
||||
Console.WriteLine("No output specified, using {0}", output);
|
||||
}
|
||||
|
||||
//Main part, catches random/unexpected exceptions
|
||||
@ -226,7 +226,7 @@ namespace Sharpii
|
||||
if (local == true)
|
||||
{
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.WriteLine("Using local files if present...");
|
||||
Console.WriteLine("Using local files if present...");
|
||||
nus.UseLocalFiles = true;
|
||||
}
|
||||
|
||||
@ -234,17 +234,17 @@ namespace Sharpii
|
||||
if (content != "")
|
||||
{
|
||||
if (Quiet.quiet > 1)
|
||||
System.Console.Write("Downloading content...");
|
||||
Console.Write("Downloading content...");
|
||||
|
||||
nus.DownloadSingleContent(id, version, content, output);
|
||||
|
||||
if (Quiet.quiet > 1)
|
||||
System.Console.Write("Done!\n");
|
||||
Console.Write("Done!\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Quiet.quiet > 1)
|
||||
System.Console.Write("Downloading title...");
|
||||
Console.Write("Downloading title...");
|
||||
|
||||
string realout = output;
|
||||
if (wad == true)
|
||||
@ -255,17 +255,17 @@ namespace Sharpii
|
||||
WadIosNamingStuff(wad, temp, id, version, ios, NoOut, output, realout);
|
||||
|
||||
if (Quiet.quiet > 1)
|
||||
System.Console.Write("Done!\n");
|
||||
Console.Write("Done!\n");
|
||||
}
|
||||
|
||||
if (Quiet.quiet > 1)
|
||||
System.Console.WriteLine("Operation completed succesfully!");
|
||||
Console.WriteLine("Operation completed succesfully!");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Console.WriteLine("An unknown error occured, please try again");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine("ERROR DETAILS: {0}", ex.Message);
|
||||
Console.WriteLine("An unknown error occured, please try again");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("ERROR DETAILS: {0}", ex.Message);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -279,7 +279,7 @@ namespace Sharpii
|
||||
{
|
||||
if (!File.Exists(temp + "\\" + id + "v" + version + ".wad"))
|
||||
{
|
||||
System.Console.WriteLine("ERROR: Can't find WAD");
|
||||
Console.WriteLine("ERROR: Can't find WAD");
|
||||
return;
|
||||
}
|
||||
if (ios != "" && NoOut == true)
|
||||
@ -318,36 +318,36 @@ namespace Sharpii
|
||||
|
||||
public static void NUS_help()
|
||||
{
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine("Sharpii {0} - NUSD - A tool by person66, using libWiiSharp.dll by leathl", Version.version);
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine(" Usage:");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine(" Sharpii.exe NUSD [-id titleID | -ios IOS] [-v version] [-o otput] [-all]");
|
||||
System.Console.WriteLine(" [-wad] [-decrypt] [-encrypt] [-local] [-s content]");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine(" Arguments:");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine(" -id titleID [required] The Title ID of the file you wish to download");
|
||||
System.Console.WriteLine(" -v version [required] The version of the file you wish to download");
|
||||
System.Console.WriteLine(" NOTE: Use 'latest' to get the latest version");
|
||||
System.Console.WriteLine(" -ios IOS The IOS you wish to download. This is an alternative to");
|
||||
System.Console.WriteLine(" '-id', use one or the other, but not both.");
|
||||
System.Console.WriteLine(" -o output Folder to output the files to");
|
||||
System.Console.WriteLine(" -local Use local files if present");
|
||||
System.Console.WriteLine(" -s content Download a single content from the file");
|
||||
System.Console.WriteLine(" NOTE: When using this, output MUST have a path and a");
|
||||
System.Console.WriteLine(" filename. For current directory use '.\\[filename]'");
|
||||
System.Console.WriteLine(" -all Create and keep encrypted, decrypted, and WAD versions");
|
||||
System.Console.WriteLine(" of the file you wish to download");
|
||||
System.Console.WriteLine(" -wad Keep only the WAD version of the file you wish to");
|
||||
System.Console.WriteLine(" download");
|
||||
System.Console.WriteLine(" -decrypt Keep only the decrypted contents of the file you wish to");
|
||||
System.Console.WriteLine(" download");
|
||||
System.Console.WriteLine(" -encrypt Keep only the encrypted contents of the file you wish to");
|
||||
System.Console.WriteLine(" download");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("Sharpii {0} - NUSD - A tool by person66, using libWiiSharp.dll by leathl", Version.version);
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" Usage:");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" Sharpii.exe NUSD [-id titleID | -ios IOS] [-v version] [-o otput] [-all]");
|
||||
Console.WriteLine(" [-wad] [-decrypt] [-encrypt] [-local] [-s content]");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" Arguments:");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" -id titleID [required] The Title ID of the file you wish to download");
|
||||
Console.WriteLine(" -v version [required] The version of the file you wish to download");
|
||||
Console.WriteLine(" NOTE: Use 'latest' to get the latest version");
|
||||
Console.WriteLine(" -ios IOS The IOS you wish to download. This is an alternative to");
|
||||
Console.WriteLine(" '-id', use one or the other, but not both.");
|
||||
Console.WriteLine(" -o output Folder to output the files to");
|
||||
Console.WriteLine(" -local Use local files if present");
|
||||
Console.WriteLine(" -s content Download a single content from the file");
|
||||
Console.WriteLine(" NOTE: When using this, output MUST have a path and a");
|
||||
Console.WriteLine(" filename. For current directory use '.\\[filename]'");
|
||||
Console.WriteLine(" -all Create and keep encrypted, decrypted, and WAD versions");
|
||||
Console.WriteLine(" of the file you wish to download");
|
||||
Console.WriteLine(" -wad Keep only the WAD version of the file you wish to");
|
||||
Console.WriteLine(" download");
|
||||
Console.WriteLine(" -decrypt Keep only the decrypted contents of the file you wish to");
|
||||
Console.WriteLine(" download");
|
||||
Console.WriteLine(" -encrypt Keep only the encrypted contents of the file you wish to");
|
||||
Console.WriteLine(" download");
|
||||
}
|
||||
}
|
||||
}
|
@ -34,9 +34,9 @@ namespace Sharpii
|
||||
|
||||
if (!File.Exists("libWiiSharp.dll"))
|
||||
{
|
||||
System.Console.WriteLine("ERROR: libWiiSharp.dll not found");
|
||||
System.Console.WriteLine("\n\nAttemp to download? [Y/N]");
|
||||
System.Console.Write("\n>>");
|
||||
Console.WriteLine("ERROR: libWiiSharp.dll not found");
|
||||
Console.WriteLine("\n\nAttemp to download? [Y/N]");
|
||||
Console.Write("\n>>");
|
||||
string ans = Console.ReadLine();
|
||||
if (ans.ToUpper() == "Y")
|
||||
{
|
||||
@ -48,7 +48,7 @@ namespace Sharpii
|
||||
Console.Write("Done!\n");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{ System.Console.WriteLine("An error occured: {0}", ex.Message); Environment.Exit(0); }
|
||||
{ Console.WriteLine("An error occured: {0}", ex.Message); Environment.Exit(0); }
|
||||
}
|
||||
else
|
||||
Environment.Exit(0);
|
||||
@ -70,70 +70,77 @@ namespace Sharpii
|
||||
}
|
||||
}
|
||||
|
||||
string Function = args[0];
|
||||
string Function = args[0].ToUpper();
|
||||
bool gotSomewhere = false;
|
||||
|
||||
if (Function.ToUpper() == "-H" || Function.ToUpper() == "-HELP" || Function.ToUpper() == "H" || Function.ToUpper() == "HELP")
|
||||
if (Function == "-H" || Function == "-HELP" || Function == "H" || Function == "HELP")
|
||||
{
|
||||
help();
|
||||
gotSomewhere = true;
|
||||
}
|
||||
|
||||
if (Function.ToUpper() == "BNS")
|
||||
if (Function == "BNS")
|
||||
{
|
||||
BNS_Stuff.BNS(args);
|
||||
gotSomewhere = true;
|
||||
}
|
||||
|
||||
if (Function.ToUpper() == "WAD")
|
||||
if (Function == "WAD")
|
||||
{
|
||||
WAD_Stuff.WAD(args);
|
||||
gotSomewhere = true;
|
||||
}
|
||||
|
||||
if (Function.ToUpper() == "TPL")
|
||||
if (Function == "TPL")
|
||||
{
|
||||
TPL_Stuff.TPL(args);
|
||||
gotSomewhere = true;
|
||||
}
|
||||
|
||||
if (Function.ToUpper() == "U8")
|
||||
if (Function == "U8")
|
||||
{
|
||||
U8_Stuff.U8(args);
|
||||
gotSomewhere = true;
|
||||
}
|
||||
|
||||
if (Function.ToUpper() == "IOS")
|
||||
if (Function == "IOS")
|
||||
{
|
||||
IOS_Stuff.IOS(args);
|
||||
gotSomewhere = true;
|
||||
}
|
||||
|
||||
if (Function.ToUpper() == "NUS" || Function.ToUpper() == "NUSD")
|
||||
if (Function == "NUS" || Function == "NUSD")
|
||||
{
|
||||
NUS_Stuff.NUS(args);
|
||||
gotSomewhere = true;
|
||||
}
|
||||
|
||||
if (Function.ToUpper() == "SENDDOL" || Function.ToUpper() == "SENDOL")
|
||||
if (Function == "SENDDOL" || Function == "SENDOL")
|
||||
{
|
||||
HBC_Stuff.SendDol(args);
|
||||
gotSomewhere = true;
|
||||
}
|
||||
|
||||
if (Function.ToUpper() == "SENDWAD")
|
||||
if (Function == "SENDWAD")
|
||||
{
|
||||
bool cont = HBC_Stuff.SendWad_Check(args);
|
||||
if (cont == true) HBC_Stuff.SendWad(args);
|
||||
gotSomewhere = true;
|
||||
}
|
||||
|
||||
if (Function == "WHICH CAME FIRST" || Function == "WHICH CAME FIRST?" ||
|
||||
(Function == "WHICH" && args[1].ToUpper() == "CAME" && args[2].Substring(0,5).ToUpper() == "FIRST"))
|
||||
{
|
||||
InconspicuousNotEasterEggThingamajig();
|
||||
gotSomewhere = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (gotSomewhere == false)
|
||||
{
|
||||
//If tuser gets here, they entered something wrong
|
||||
System.Console.WriteLine("ERROR: The argument {0} is invalid", args[0]);
|
||||
Console.WriteLine("ERROR: The argument {0} is invalid", args[0]);
|
||||
}
|
||||
|
||||
string temp = Path.GetTempPath() + "Sharpii.tmp";
|
||||
@ -143,37 +150,58 @@ namespace Sharpii
|
||||
Environment.Exit(0);
|
||||
}
|
||||
|
||||
private static void InconspicuousNotEasterEggThingamajig()
|
||||
{
|
||||
WebClient egg = new WebClient(); string all = "";
|
||||
try { all = egg.DownloadString("http://sites.google.com/site/person66files/home/EASTEREGG.txt"); }
|
||||
catch (Exception) { Console.WriteLine("\n Easter eggs are more fun if you has internetz"); return; }
|
||||
int width = Console.WindowWidth; int height = Console.WindowHeight; int bwidth = Console.BufferWidth; int bheight = Console.BufferHeight;
|
||||
ConsoleKeyInfo key; Console.Clear(); Console.CursorVisible = false; Console.SetWindowSize(75, 5); Console.SetBufferSize(75, 5);
|
||||
Console.WriteLine("Complete the following: \n\n UP, __ , __ , __ , __ , __ , __ , __ , __ , __ , START"); key = Console.ReadKey(true);
|
||||
if (key.Key.ToString() == "UpArrow") { Console.SetCursorPosition(7, 2); Console.Write("UP"); } else { goto ByeBye; }
|
||||
key = Console.ReadKey(true); if (key.Key.ToString() == "DownArrow") { Console.SetCursorPosition(12, 2); Console.Write("DOWN , __ , __ , __ , __ , __ , __ , __ , START"); } else { goto ByeBye; }
|
||||
key = Console.ReadKey(true); if (key.Key.ToString() == "DownArrow") { Console.SetCursorPosition(19, 2); Console.Write("DOWN , __ , __ , __ , __ , __ , __ , START"); } else { goto ByeBye; }
|
||||
key = Console.ReadKey(true); if (key.Key.ToString() == "LeftArrow") { Console.SetCursorPosition(26, 2); Console.Write("LEFT , __ , __ , __ , __ , __ , START"); } else { goto ByeBye; }
|
||||
key = Console.ReadKey(true); if (key.Key.ToString() == "RightArrow") { Console.SetCursorPosition(33, 2); Console.Write("RIGHT , __ , __ , __ , __ , START"); } else { goto ByeBye; }
|
||||
key = Console.ReadKey(true); if (key.Key.ToString() == "LeftArrow") { Console.SetCursorPosition(41, 2); Console.Write("LEFT , __ , __ , __ , START"); } else { goto ByeBye; }
|
||||
key = Console.ReadKey(true); if (key.Key.ToString() == "RightArrow") { Console.SetCursorPosition(48, 2); Console.Write("RIGHT , __ , __ , START"); } else { goto ByeBye; }
|
||||
key = Console.ReadKey(true); if (key.Key.ToString() == "B") { Console.SetCursorPosition(56, 2); Console.Write("B , __ , START "); } else { goto ByeBye; }
|
||||
key = Console.ReadKey(true); if (key.Key.ToString() == "A") { Console.SetCursorPosition(60, 2); Console.Write("A , START "); } else { goto ByeBye; }
|
||||
Console.SetBufferSize(95, 44); Console.SetWindowSize(95, 44); Console.SetCursorPosition(0, 0); Console.Clear(); Console.Write(all); Console.ReadKey(true);
|
||||
ByeBye: Console.Clear(); Console.CursorVisible = true; Console.SetWindowSize(width, height); Console.SetBufferSize(bwidth, bheight); Environment.Exit(0);
|
||||
}
|
||||
|
||||
private static void help()
|
||||
{
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine("Sharpii {0} - A tool by person66, using libWiiSharp.dll by leathl", Version.version);
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine(" Usage:");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine(" Sharpii [function] [parameters] [-quiet | -q | -lots]");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine(" Functions:");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine(" BNS Convert a wav to bns, or vice versa");
|
||||
System.Console.WriteLine(" WAD Pack/Unpack/Edit a wad file");
|
||||
System.Console.WriteLine(" TPL Convert a image to a tpl, or vice versa");
|
||||
System.Console.WriteLine(" U8 Pack/Unpack a U8 archive");
|
||||
System.Console.WriteLine(" IOS Apply various patches to an IOS");
|
||||
System.Console.WriteLine(" NUSD Download files from NUS");
|
||||
System.Console.WriteLine(" SendDol Send a dol to the HBC over wifi");
|
||||
System.Console.WriteLine(" SendWad Send a wad to the HBC over wifi");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine(" NOTE: Too see more detailed descriptions of any of the above,");
|
||||
System.Console.WriteLine(" use 'Sharpii [function] -h'");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine(" Global Arguments:");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine(" -quiet | -q Try not to display any output");
|
||||
System.Console.WriteLine(" -lots Display lots of output");
|
||||
System.Console.WriteLine("");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("Sharpii {0} - A tool by person66, using libWiiSharp.dll by leathl", Version.version);
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" Usage:");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" Sharpii [function] [parameters] [-quiet | -q | -lots]");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" Functions:");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" BNS Convert a wav to bns, or vice versa");
|
||||
Console.WriteLine(" WAD Pack/Unpack/Edit a wad file");
|
||||
Console.WriteLine(" TPL Convert a image to a tpl, or vice versa");
|
||||
Console.WriteLine(" U8 Pack/Unpack a U8 archive");
|
||||
Console.WriteLine(" IOS Apply various patches to an IOS");
|
||||
Console.WriteLine(" NUSD Download files from NUS");
|
||||
Console.WriteLine(" SendDol Send a dol to the HBC over wifi");
|
||||
Console.WriteLine(" SendWad Send a wad to the HBC over wifi");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" NOTE: Too see more detailed descriptions of any of the above,");
|
||||
Console.WriteLine(" use 'Sharpii [function] -h'");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" Global Arguments:");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" -quiet | -q Try not to display any output");
|
||||
Console.WriteLine(" -lots Display lots of output");
|
||||
Console.WriteLine("");
|
||||
|
||||
|
||||
}
|
||||
@ -213,5 +241,5 @@ namespace Sharpii
|
||||
}
|
||||
public class Version
|
||||
{
|
||||
public static string version = "1.5";
|
||||
public static string version = "1.6";
|
||||
}
|
@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Sharpii")]
|
||||
[assembly: AssemblyCopyright("2011 Person66")]
|
||||
[assembly: AssemblyCopyright("2011 person66")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: AssemblyVersion("1.6")]
|
||||
[assembly: AssemblyFileVersion("1.6")]
|
||||
|
@ -1,5 +1,5 @@
|
||||
/------------------------------------------------------------------------------>
|
||||
Sharpii 1.5
|
||||
Sharpii 1.6
|
||||
<---------------------------------------------------------------->
|
||||
An app by person66
|
||||
libWiiSharp.dll by leathl (mod by scooby74029)
|
||||
@ -82,6 +82,22 @@ help with.
|
||||
found online. If you are sending a zip file instead of a dol, it wont be
|
||||
compressed at all, no matter what.
|
||||
|
||||
If you do not wish to enter an IP every time you use SendDol, then you can add
|
||||
the argument '-saveip' to the command. This will save the entered IP to the
|
||||
environmental variable 'SharpiiIP', and then, in the future, if you do not enter
|
||||
an ip, Sharpii will use the one saved there instead. (Also applies to SendWad)
|
||||
|
||||
SendWad:
|
||||
/------------------>
|
||||
Since version 1.6, Sharpii has supported AHBPROT for installing WADs. This means
|
||||
that as long as you have HBC 1.0.7 or above, you will be able to install the WAD
|
||||
without a patched IOS. To use this feature, enter '-ahb' instead of '-ios IOS'
|
||||
|
||||
If you do not wish to enter an IP every time you use SendDol, then you can add
|
||||
the argument '-saveip' to the command. This will save the entered IP to the
|
||||
environmental variable 'SharpiiIP', and then, in the future, if you do not enter
|
||||
an ip, Sharpii will use the one saved there instead. (Also applies to SendDol)
|
||||
|
||||
|
||||
/----SOURCE
|
||||
/------------------------------>
|
||||
@ -100,7 +116,8 @@ libWiiSharp can be found at: libwiisharp.googlecode.com
|
||||
|
||||
SendWad uses CRAP's installer by WiiCrazy/I.R.on, with any edits that leathl
|
||||
may have made when adding it to CustomizeMii (which is where I got the source
|
||||
from)
|
||||
from). Since version 1.6, the AHBPROT code it uses is just mostly stolen from
|
||||
WiiMod by jskyboo.
|
||||
|
||||
|
||||
I would also like to thank XFlak and JoostinOnline for doing a bit of beta
|
||||
@ -117,6 +134,12 @@ See "LICENSE.txt" for more information.
|
||||
/----CHANGELOG
|
||||
/------------------------------>
|
||||
|
||||
1.6
|
||||
- SendWad now supports AHBPROT (use '-ahb')
|
||||
- IP can now be saved in an environmental variable (SharpiiIP)
|
||||
for both SendWad and SendDol (manually or with '-saveip')
|
||||
- Pointless aster eggs are fun!
|
||||
- Code cleanup/bug fixes
|
||||
1.5
|
||||
- Added the ability to send WADs to the HBC using SendWad
|
||||
- You can now download an IOS with -ios # in NUSD
|
||||
|
@ -91,8 +91,8 @@
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="LICENSE.txt" />
|
||||
<Content Include="README.txt" />
|
||||
<None Include="LICENSE.txt" />
|
||||
<None Include="README.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\WadInstaller\WadInstaller.csproj">
|
||||
|
104
Sharpii/TPL.cs
104
Sharpii/TPL.cs
@ -46,7 +46,7 @@ namespace Sharpii
|
||||
}
|
||||
|
||||
//If tuser gets here, they entered something wrong
|
||||
System.Console.WriteLine("ERROR: The argument {0} is invalid", args[1]);
|
||||
Console.WriteLine("ERROR: The argument {0} is invalid", args[1]);
|
||||
return;
|
||||
|
||||
}
|
||||
@ -59,7 +59,7 @@ namespace Sharpii
|
||||
//Check if file exists
|
||||
if (File.Exists(input) == false)
|
||||
{
|
||||
System.Console.WriteLine("ERROR: Unable to open file: {0}", input);
|
||||
Console.WriteLine("ERROR: Unable to open file: {0}", input);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -68,30 +68,30 @@ namespace Sharpii
|
||||
{
|
||||
//Load tpl
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.Write("Loading file...");
|
||||
Console.Write("Loading file...");
|
||||
|
||||
TPL tplfile = libWiiSharp.TPL.Load(input);
|
||||
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.Write("Done!\n");
|
||||
Console.Write("Done!\n");
|
||||
|
||||
//save image
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.Write("Extracting texture...");
|
||||
Console.Write("Extracting texture...");
|
||||
|
||||
tplfile.ExtractTexture(output);
|
||||
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.Write("Done!\n");
|
||||
Console.Write("Done!\n");
|
||||
|
||||
if (Quiet.quiet > 1)
|
||||
System.Console.WriteLine("Operation completed succesfully!");
|
||||
Console.WriteLine("Operation completed succesfully!");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Console.WriteLine("An unknown error occured, please try again");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine("ERROR DETAILS: {0}", ex.Message);
|
||||
Console.WriteLine("An unknown error occured, please try again");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("ERROR DETAILS: {0}", ex.Message);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -106,7 +106,7 @@ namespace Sharpii
|
||||
//Check if file exists
|
||||
if (File.Exists(input) == false)
|
||||
{
|
||||
System.Console.WriteLine("ERROR: Unable to open file: {0}", input);
|
||||
Console.WriteLine("ERROR: Unable to open file: {0}", input);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -137,7 +137,7 @@ namespace Sharpii
|
||||
//Check if valid format was entered
|
||||
if (tplFormat != "I4" & tplFormat != "I8" & tplFormat != "IA4" & tplFormat != "IA8" & tplFormat != "RGB565" & tplFormat != "RGB5A3" & tplFormat != "RGBA8")
|
||||
{
|
||||
System.Console.WriteLine("ERROR: Unknown format type: {0}", tplFormat);
|
||||
Console.WriteLine("ERROR: Unknown format type: {0}", tplFormat);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -163,20 +163,20 @@ namespace Sharpii
|
||||
format = TPL_TextureFormat.RGBA8;
|
||||
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.WriteLine("Format set to: {0}", tplFormat);
|
||||
Console.WriteLine("Format set to: {0}", tplFormat);
|
||||
|
||||
//Make tpl
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.Write("Creating tpl file...");
|
||||
Console.Write("Creating tpl file...");
|
||||
|
||||
TPL tplfile = libWiiSharp.TPL.FromImage(input, format);
|
||||
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.Write("Done!\n");
|
||||
Console.Write("Done!\n");
|
||||
|
||||
//save
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.Write("Saving tpl file...");
|
||||
Console.Write("Saving tpl file...");
|
||||
|
||||
if (output.Substring(output.Length - 4, 4).ToUpper() != ".TPL")
|
||||
output = output + ".tpl";
|
||||
@ -184,53 +184,53 @@ namespace Sharpii
|
||||
tplfile.Save(output);
|
||||
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.Write("Done!\n");
|
||||
Console.Write("Done!\n");
|
||||
|
||||
if (Quiet.quiet > 1)
|
||||
System.Console.WriteLine("Operation completed succesfully!");
|
||||
Console.WriteLine("Operation completed succesfully!");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Console.WriteLine("An unknown error occured, please try again");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine("ERROR DETAILS: {0}", ex.Message);
|
||||
Console.WriteLine("An unknown error occured, please try again");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("ERROR DETAILS: {0}", ex.Message);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public static void TPL_help()
|
||||
{
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine("Sharpii {0} - TPL - A tool by person66, using libWiiSharp.dll by leathl", Version.version);
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine(" Usage:");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine(" Sharpii.exe TPL [-to | -from] input output [arguments]");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine(" Arguments:");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine(" -to Convert image to tpl");
|
||||
System.Console.WriteLine(" -from Create image from tpl");
|
||||
System.Console.WriteLine(" input The input file/folder");
|
||||
System.Console.WriteLine(" output The output file/folder");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine(" Arguments for Converting to TPL:");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine(" -format | -f The format of the tpl. Possible values are:");
|
||||
System.Console.WriteLine(" RGBA8 (High Quality with Alpha)");
|
||||
System.Console.WriteLine(" RGB565 (Medium Quality without Alpha)");
|
||||
System.Console.WriteLine(" RGB5A3 (Low Quality with Alpha)");
|
||||
System.Console.WriteLine(" IA8 (High quality B/W with Alpha)");
|
||||
System.Console.WriteLine(" IA4 (Low Quality B/W with Alpha)");
|
||||
System.Console.WriteLine(" I8 (High Quality B/W without Alpha)");
|
||||
System.Console.WriteLine(" I4 (Low Quality B/W without Alpha)");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine(" Notes:");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine(" If no format is specified when converting to TPL, RGB565 is used.");
|
||||
System.Console.WriteLine(" When converting to an image, the image format is chosen based on the extension");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("Sharpii {0} - TPL - A tool by person66, using libWiiSharp.dll by leathl", Version.version);
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" Usage:");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" Sharpii.exe TPL [-to | -from] input output [arguments]");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" Arguments:");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" -to Convert image to tpl");
|
||||
Console.WriteLine(" -from Create image from tpl");
|
||||
Console.WriteLine(" input The input file/folder");
|
||||
Console.WriteLine(" output The output file/folder");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" Arguments for Converting to TPL:");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" -format | -f The format of the tpl. Possible values are:");
|
||||
Console.WriteLine(" RGBA8 (High Quality with Alpha)");
|
||||
Console.WriteLine(" RGB565 (Medium Quality without Alpha)");
|
||||
Console.WriteLine(" RGB5A3 (Low Quality with Alpha)");
|
||||
Console.WriteLine(" IA8 (High quality B/W with Alpha)");
|
||||
Console.WriteLine(" IA4 (Low Quality B/W with Alpha)");
|
||||
Console.WriteLine(" I8 (High Quality B/W without Alpha)");
|
||||
Console.WriteLine(" I4 (Low Quality B/W without Alpha)");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" Notes:");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" If no format is specified when converting to TPL, RGB565 is used.");
|
||||
Console.WriteLine(" When converting to an image, the image format is chosen based on the extension");
|
||||
}
|
||||
}
|
||||
}
|
@ -46,7 +46,7 @@ namespace Sharpii
|
||||
}
|
||||
|
||||
//If tuser gets here, they entered something wrong
|
||||
System.Console.WriteLine("ERROR: The argument {0} is invalid", args[1]);
|
||||
Console.WriteLine("ERROR: The argument {0} is invalid", args[1]);
|
||||
return;
|
||||
|
||||
}
|
||||
@ -59,13 +59,13 @@ namespace Sharpii
|
||||
//Check if file exists
|
||||
if (File.Exists(input) == false)
|
||||
{
|
||||
System.Console.WriteLine("ERROR: Unable to open file: {0}", input);
|
||||
Console.WriteLine("ERROR: Unable to open file: {0}", input);
|
||||
return;
|
||||
}
|
||||
//Check if file is U8
|
||||
if (libWiiSharp.U8.IsU8(input) != true)
|
||||
{
|
||||
System.Console.WriteLine("ERROR: File {0} is not a U8 archive", input);
|
||||
Console.WriteLine("ERROR: File {0} is not a U8 archive", input);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -76,29 +76,29 @@ namespace Sharpii
|
||||
U8 U8file = new U8();
|
||||
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.Write("Loading file...");
|
||||
Console.Write("Loading file...");
|
||||
|
||||
U8file.LoadFile(input);
|
||||
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.Write("Done!\n");
|
||||
Console.Write("Done!\n");
|
||||
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.Write("Extracting file...");
|
||||
Console.Write("Extracting file...");
|
||||
|
||||
U8file.Extract(output);
|
||||
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.Write("Done!\n");
|
||||
Console.Write("Done!\n");
|
||||
|
||||
if (Quiet.quiet > 1)
|
||||
System.Console.WriteLine("Operation completed succesfully!");
|
||||
Console.WriteLine("Operation completed succesfully!");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Console.WriteLine("An unknown error occured, please try again");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine("ERROR DETAILS: {0}", ex.Message);
|
||||
Console.WriteLine("An unknown error occured, please try again");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("ERROR DETAILS: {0}", ex.Message);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -115,7 +115,7 @@ namespace Sharpii
|
||||
//Check if folder exists
|
||||
if (Directory.Exists(input) == false)
|
||||
{
|
||||
System.Console.WriteLine("ERROR: Unable to open Folder: {0}", input);
|
||||
Console.WriteLine("ERROR: Unable to open Folder: {0}", input);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -142,7 +142,7 @@ namespace Sharpii
|
||||
|
||||
if (imd5 == true && imet != "")
|
||||
{
|
||||
System.Console.WriteLine("ERROR: Cannot use IMET and IMD5 at the same time.");
|
||||
Console.WriteLine("ERROR: Cannot use IMET and IMD5 at the same time.");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -152,24 +152,24 @@ namespace Sharpii
|
||||
U8 U8folder = new U8();
|
||||
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.Write("Loading folder...");
|
||||
Console.Write("Loading folder...");
|
||||
|
||||
U8folder.CreateFromDirectory(input);
|
||||
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.Write("Done!\n");
|
||||
Console.Write("Done!\n");
|
||||
|
||||
if (imd5 == true)
|
||||
{
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.WriteLine("Adding IMD5 Header");
|
||||
Console.WriteLine("Adding IMD5 Header");
|
||||
U8folder.AddHeaderImd5();
|
||||
}
|
||||
|
||||
if (imet != "")
|
||||
{
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.WriteLine("Adding IMET header with title: {0}", imet);
|
||||
Console.WriteLine("Adding IMET header with title: {0}", imet);
|
||||
U8folder.AddHeaderImet(false, imet);
|
||||
}
|
||||
|
||||
@ -177,51 +177,51 @@ namespace Sharpii
|
||||
{
|
||||
//Yeah, I know this isnt where it actually compresses it
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.WriteLine("Compressing U8 archive");
|
||||
Console.WriteLine("Compressing U8 archive");
|
||||
U8folder.Lz77Compress = true;
|
||||
}
|
||||
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.WriteLine("Saving file");
|
||||
Console.WriteLine("Saving file");
|
||||
|
||||
U8folder.Save(output);
|
||||
|
||||
if (Quiet.quiet > 1)
|
||||
System.Console.WriteLine("Operation completed succesfully!");
|
||||
Console.WriteLine("Operation completed succesfully!");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Console.WriteLine("An unknown error occured, please try again");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine("ERROR DETAILS: {0}", ex.Message);
|
||||
Console.WriteLine("An unknown error occured, please try again");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("ERROR DETAILS: {0}", ex.Message);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public static void U8_help()
|
||||
{
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine("Sharpii {0} - U8 - A tool by person66, using libWiiSharp.dll by leathl", Version.version);
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine(" Usage:");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine(" Sharpii.exe U8 [-p | -u] input output [arguments]");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine(" Arguments:");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine(" input The input file/folder");
|
||||
System.Console.WriteLine(" output The output file/folder");
|
||||
System.Console.WriteLine(" -p Pack");
|
||||
System.Console.WriteLine(" -u Unpack");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine(" Arguments for Packing:");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine(" -imet [title] Pack with an IMET header (for 00000000.app)");
|
||||
System.Console.WriteLine(" You MUST enter a channel title");
|
||||
System.Console.WriteLine(" -imd5 Pack with an IMD5 header (for Banner/Icon.bin)");
|
||||
System.Console.WriteLine(" -lz77 Compress with lz77");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("Sharpii {0} - U8 - A tool by person66, using libWiiSharp.dll by leathl", Version.version);
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" Usage:");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" Sharpii.exe U8 [-p | -u] input output [arguments]");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" Arguments:");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" input The input file/folder");
|
||||
Console.WriteLine(" output The output file/folder");
|
||||
Console.WriteLine(" -p Pack");
|
||||
Console.WriteLine(" -u Unpack");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" Arguments for Packing:");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" -imet [title] Pack with an IMET header (for 00000000.app)");
|
||||
Console.WriteLine(" You MUST enter a channel title");
|
||||
Console.WriteLine(" -imd5 Pack with an IMD5 header (for Banner/Icon.bin)");
|
||||
Console.WriteLine(" -lz77 Compress with lz77");
|
||||
}
|
||||
}
|
||||
}
|
210
Sharpii/WAD.cs
210
Sharpii/WAD.cs
@ -78,7 +78,7 @@ namespace Sharpii
|
||||
}
|
||||
|
||||
//If tuser gets here, they entered something wrong
|
||||
System.Console.WriteLine("ERROR: The argument {0} is invalid", args[1]);
|
||||
Console.WriteLine("ERROR: The argument {0} is invalid", args[1]);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -92,7 +92,7 @@ namespace Sharpii
|
||||
//Check if file exists
|
||||
if (File.Exists(input) == false)
|
||||
{
|
||||
System.Console.WriteLine("ERROR: Unable to open file: {0}", input);
|
||||
Console.WriteLine("ERROR: Unable to open file: {0}", input);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -127,41 +127,41 @@ namespace Sharpii
|
||||
WAD wad = new WAD();
|
||||
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.Write("Loading file...");
|
||||
Console.Write("Loading file...");
|
||||
|
||||
wad.LoadFile(input);
|
||||
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.Write("Done!\n");
|
||||
Console.Write("Done!\n");
|
||||
|
||||
if (Quiet.quiet > 1 && output == "")
|
||||
{
|
||||
System.Console.WriteLine("WAD Info:");
|
||||
System.Console.WriteLine("");
|
||||
Console.WriteLine("WAD Info:");
|
||||
Console.WriteLine("");
|
||||
if (titles == false)
|
||||
System.Console.WriteLine("Title: {0}", wad.ChannelTitles[1]);
|
||||
Console.WriteLine("Title: {0}", wad.ChannelTitles[1]);
|
||||
else
|
||||
{
|
||||
System.Console.WriteLine("Titles:\n");
|
||||
System.Console.WriteLine(" Japanese: {0}", wad.ChannelTitles[0]);
|
||||
System.Console.WriteLine(" English: {0}", wad.ChannelTitles[1]);
|
||||
System.Console.WriteLine(" German: {0}", wad.ChannelTitles[2]);
|
||||
System.Console.WriteLine(" French: {0}", wad.ChannelTitles[3]);
|
||||
System.Console.WriteLine(" Spanish: {0}", wad.ChannelTitles[4]);
|
||||
System.Console.WriteLine(" Italian: {0}", wad.ChannelTitles[5]);
|
||||
System.Console.WriteLine(" Dutch: {0}", wad.ChannelTitles[6]);
|
||||
System.Console.WriteLine(" Korean: {0}\n", wad.ChannelTitles[7]);
|
||||
Console.WriteLine("Titles:\n");
|
||||
Console.WriteLine(" Japanese: {0}", wad.ChannelTitles[0]);
|
||||
Console.WriteLine(" English: {0}", wad.ChannelTitles[1]);
|
||||
Console.WriteLine(" German: {0}", wad.ChannelTitles[2]);
|
||||
Console.WriteLine(" French: {0}", wad.ChannelTitles[3]);
|
||||
Console.WriteLine(" Spanish: {0}", wad.ChannelTitles[4]);
|
||||
Console.WriteLine(" Italian: {0}", wad.ChannelTitles[5]);
|
||||
Console.WriteLine(" Dutch: {0}", wad.ChannelTitles[6]);
|
||||
Console.WriteLine(" Korean: {0}\n", wad.ChannelTitles[7]);
|
||||
}
|
||||
System.Console.WriteLine("Title ID: {0}", wad.UpperTitleID);
|
||||
System.Console.WriteLine("IOS: {0}", ((int)wad.StartupIOS).ToString());
|
||||
System.Console.WriteLine("Region: {0}", wad.Region);
|
||||
System.Console.WriteLine("Version: {0}", wad.TitleVersion);
|
||||
System.Console.WriteLine("Blocks: {0}", wad.NandBlocks);
|
||||
Console.WriteLine("Title ID: {0}", wad.UpperTitleID);
|
||||
Console.WriteLine("IOS: {0}", ((int)wad.StartupIOS).ToString());
|
||||
Console.WriteLine("Region: {0}", wad.Region);
|
||||
Console.WriteLine("Version: {0}", wad.TitleVersion);
|
||||
Console.WriteLine("Blocks: {0}", wad.NandBlocks);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.Write("Saving file...");
|
||||
Console.Write("Saving file...");
|
||||
|
||||
if (output.Substring(output.Length - 4, 4).ToUpper() != ".TXT")
|
||||
output = output + ".txt";
|
||||
@ -191,17 +191,17 @@ namespace Sharpii
|
||||
txt.Close();
|
||||
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.Write("Done!\n");
|
||||
Console.Write("Done!\n");
|
||||
|
||||
if (Quiet.quiet > 1)
|
||||
System.Console.WriteLine("Operation completed succesfully!");
|
||||
Console.WriteLine("Operation completed succesfully!");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Console.WriteLine("An unknown error occured, please try again");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine("ERROR DETAILS: {0}", ex.Message);
|
||||
Console.WriteLine("An unknown error occured, please try again");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("ERROR DETAILS: {0}", ex.Message);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -225,13 +225,13 @@ namespace Sharpii
|
||||
if (edit == true)
|
||||
if (File.Exists(input) == false)
|
||||
{
|
||||
System.Console.WriteLine("ERROR: Unable to open file: {0}", input);
|
||||
Console.WriteLine("ERROR: Unable to open file: {0}", input);
|
||||
return;
|
||||
}
|
||||
if (edit == false)
|
||||
if (Directory.Exists(input) == false)
|
||||
{
|
||||
System.Console.WriteLine("ERROR: Unable to open folder: {0}", input);
|
||||
Console.WriteLine("ERROR: Unable to open folder: {0}", input);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -251,7 +251,7 @@ namespace Sharpii
|
||||
id = args[i + 1];
|
||||
if (id.Length < 4)
|
||||
{
|
||||
System.Console.WriteLine("ERROR: ID too short");
|
||||
Console.WriteLine("ERROR: ID too short");
|
||||
return;
|
||||
}
|
||||
id = id.Substring(0, 4);
|
||||
@ -265,7 +265,7 @@ namespace Sharpii
|
||||
lwrid = args[i + 1];
|
||||
if (args[i + 1].ToUpper() != "CHANNEL" && args[i + 1].ToUpper() != "DLC" && args[i + 1].ToUpper() != "GAMECHANNEL" && args[i + 1].ToUpper() != "HIDDENCHANNELS" && args[i + 1].ToUpper() != "SYSTEMCHANNELS" && args[i + 1].ToUpper() != "SYSTEMTITLES")
|
||||
{
|
||||
System.Console.WriteLine("ERROR: Unknown WAD type: {0}", args[i + 1]);
|
||||
Console.WriteLine("ERROR: Unknown WAD type: {0}", args[i + 1]);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
@ -357,18 +357,18 @@ namespace Sharpii
|
||||
if (edit == true)
|
||||
{
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.Write("Loading file...");
|
||||
Console.Write("Loading file...");
|
||||
wad.LoadFile(input);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.Write("Loading folder...");
|
||||
Console.Write("Loading folder...");
|
||||
wad.CreateNew(input);
|
||||
}
|
||||
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.Write("Done!\n");
|
||||
Console.Write("Done!\n");
|
||||
|
||||
if (sound != "" || banner != "" || icon != "" || app != "")
|
||||
{
|
||||
@ -388,7 +388,7 @@ namespace Sharpii
|
||||
if (sound != "")
|
||||
{
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.Write("Grabbing sound...");
|
||||
Console.Write("Grabbing sound...");
|
||||
|
||||
twad.LoadFile(sound);
|
||||
twad.Unpack(temp + "\\sound");
|
||||
@ -399,12 +399,12 @@ namespace Sharpii
|
||||
File.Copy(temp + "\\sound\\00000000\\meta\\sound.bin", temp + "\\main\\00000000\\meta\\sound.bin", true);
|
||||
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.Write("Done!\n");
|
||||
Console.Write("Done!\n");
|
||||
}
|
||||
if (banner != "")
|
||||
{
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.Write("Grabbing banner...");
|
||||
Console.Write("Grabbing banner...");
|
||||
|
||||
twad.LoadFile(banner);
|
||||
twad.Unpack(temp + "\\banner");
|
||||
@ -415,12 +415,12 @@ namespace Sharpii
|
||||
File.Copy(temp + "\\banner\\00000000\\meta\\banner.bin", temp + "\\main\\00000000\\meta\\banner.bin", true);
|
||||
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.Write("Done!\n");
|
||||
Console.Write("Done!\n");
|
||||
}
|
||||
if (icon != "")
|
||||
{
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.Write("Grabbing icon...");
|
||||
Console.Write("Grabbing icon...");
|
||||
|
||||
twad.LoadFile(icon);
|
||||
twad.Unpack(temp + "\\icon");
|
||||
@ -431,12 +431,12 @@ namespace Sharpii
|
||||
File.Copy(temp + "\\icon\\00000000\\meta\\icon.bin", temp + "\\main\\00000000\\meta\\icon.bin", true);
|
||||
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.Write("Done!\n");
|
||||
Console.Write("Done!\n");
|
||||
}
|
||||
if (app != "")
|
||||
{
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.Write("Grabbing dol...");
|
||||
Console.Write("Grabbing dol...");
|
||||
|
||||
if (app.Substring(app.Length - 4, 4) == ".dol")
|
||||
{
|
||||
@ -452,7 +452,7 @@ namespace Sharpii
|
||||
File.Copy(temp + "\\dol\\00000001.app", temp + "\\main\\00000001.app", true);
|
||||
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.Write("Done!\n");
|
||||
Console.Write("Done!\n");
|
||||
}
|
||||
u.ReplaceFile(1, temp + "\\main\\00000000\\meta\\banner.bin");
|
||||
u.ReplaceFile(2, temp + "\\main\\00000000\\meta\\icon.bin");
|
||||
@ -464,18 +464,18 @@ namespace Sharpii
|
||||
}
|
||||
|
||||
if (Quiet.quiet > 2 && fake == true)
|
||||
System.Console.WriteLine("FakeSigning WAD");
|
||||
Console.WriteLine("FakeSigning WAD");
|
||||
wad.FakeSign = fake;
|
||||
|
||||
if (id != "")
|
||||
{
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.WriteLine("Changing channel ID to: {0}", id);
|
||||
Console.WriteLine("Changing channel ID to: {0}", id);
|
||||
|
||||
if (lwrid != "")
|
||||
{
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.WriteLine("Changing channel type to: {0}", lwrid);
|
||||
Console.WriteLine("Changing channel type to: {0}", lwrid);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -498,18 +498,18 @@ namespace Sharpii
|
||||
if (ios > -1)
|
||||
{
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.WriteLine("Changing startup IOS to: {0}", ios);
|
||||
Console.WriteLine("Changing startup IOS to: {0}", ios);
|
||||
wad.ChangeStartupIOS(ios);
|
||||
}
|
||||
if (title != "")
|
||||
{
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.WriteLine("Changing channel title to: {0}", title);
|
||||
Console.WriteLine("Changing channel title to: {0}", title);
|
||||
wad.ChangeChannelTitles(title);
|
||||
}
|
||||
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.Write("Saving file...");
|
||||
Console.Write("Saving file...");
|
||||
|
||||
if (output.Substring(output.Length - 4, 4).ToUpper() != ".WAD")
|
||||
output = output + ".wad";
|
||||
@ -517,16 +517,16 @@ namespace Sharpii
|
||||
wad.Save(output);
|
||||
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.Write("Done!\n");
|
||||
Console.Write("Done!\n");
|
||||
|
||||
if (Quiet.quiet > 1)
|
||||
System.Console.WriteLine("Operation completed succesfully!");
|
||||
Console.WriteLine("Operation completed succesfully!");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Console.WriteLine("An unknown error occured, please try again");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine("ERROR DETAILS: {0}", ex.Message);
|
||||
Console.WriteLine("An unknown error occured, please try again");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("ERROR DETAILS: {0}", ex.Message);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -541,7 +541,7 @@ namespace Sharpii
|
||||
//Check if file exists
|
||||
if (File.Exists(input) == false)
|
||||
{
|
||||
System.Console.WriteLine("ERROR: Unable to open file: {0}", input);
|
||||
Console.WriteLine("ERROR: Unable to open file: {0}", input);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -562,78 +562,78 @@ namespace Sharpii
|
||||
WAD wad = new WAD();
|
||||
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.Write("Loading file...");
|
||||
Console.Write("Loading file...");
|
||||
|
||||
wad.LoadFile(input);
|
||||
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.Write("Done!\n");
|
||||
Console.Write("Done!\n");
|
||||
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.Write("Unpacking WAD...");
|
||||
Console.Write("Unpacking WAD...");
|
||||
|
||||
wad.Unpack(output, cid);
|
||||
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.Write("Done!\n");
|
||||
Console.Write("Done!\n");
|
||||
|
||||
if (Quiet.quiet > 1)
|
||||
System.Console.WriteLine("Operation completed succesfully!");
|
||||
Console.WriteLine("Operation completed succesfully!");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Console.WriteLine("An unknown error occured, please try again");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine("ERROR DETAILS: {0}", ex.Message);
|
||||
Console.WriteLine("An unknown error occured, please try again");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("ERROR DETAILS: {0}", ex.Message);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public static void WAD_help()
|
||||
{
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine("Sharpii {0} - WAD - A tool by person66, using libWiiSharp.dll by leathl", Version.version);
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine(" Usage:");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine(" Sharpii.exe WAD [-p | -u | -e | -i] input output [arguments]");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine(" Arguments:");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine(" input The input file/folder");
|
||||
System.Console.WriteLine(" output The output file/folder");
|
||||
System.Console.WriteLine(" -p Pack WAD");
|
||||
System.Console.WriteLine(" -u Unpack WAD");
|
||||
System.Console.WriteLine(" -e Edit WAD");
|
||||
System.Console.WriteLine(" -i Get WAD info");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine(" Arguments for unpacking:");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine(" -cid Use Content ID as name");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine(" Arguments for info:");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine(" -o output Output info to text file");
|
||||
System.Console.WriteLine(" -titles Display titles in all languages");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine(" Arguments for packing/editing:");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine(" -id [TitleID] Change the 4-character title id");
|
||||
System.Console.WriteLine(" -ios [IOS] Change the Startup IOS");
|
||||
System.Console.WriteLine(" -title [title] Change the Channel name/title.");
|
||||
System.Console.WriteLine(" If there are spaces, surround in quotes");
|
||||
System.Console.WriteLine(" -f Fakesign the WAD");
|
||||
System.Console.WriteLine(" -type [type] Change the Channel type. Possible values are:");
|
||||
System.Console.WriteLine(" Channel, DLC, GameChannel, HiddenChannels,");
|
||||
System.Console.WriteLine(" SystemChannels, or SystemTitles");
|
||||
System.Console.WriteLine(" -sound [wad] Use the sound from 'wad'");
|
||||
System.Console.WriteLine(" -banner [wad] Use the banner from 'wad'");
|
||||
System.Console.WriteLine(" -icon [wad] Use the icon from 'wad'");
|
||||
System.Console.WriteLine(" -dol [wad] Use the dol from 'wad'");
|
||||
System.Console.WriteLine(" NOTE: you can also just enter the path to a");
|
||||
System.Console.WriteLine(" regular dol file, instead of a wad");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("Sharpii {0} - WAD - A tool by person66, using libWiiSharp.dll by leathl", Version.version);
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" Usage:");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" Sharpii.exe WAD [-p | -u | -e | -i] input output [arguments]");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" Arguments:");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" input The input file/folder");
|
||||
Console.WriteLine(" output The output file/folder");
|
||||
Console.WriteLine(" -p Pack WAD");
|
||||
Console.WriteLine(" -u Unpack WAD");
|
||||
Console.WriteLine(" -e Edit WAD");
|
||||
Console.WriteLine(" -i Get WAD info");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" Arguments for unpacking:");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" -cid Use Content ID as name");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" Arguments for info:");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" -o output Output info to text file");
|
||||
Console.WriteLine(" -titles Display titles in all languages");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" Arguments for packing/editing:");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" -id [TitleID] Change the 4-character title id");
|
||||
Console.WriteLine(" -ios [IOS] Change the Startup IOS");
|
||||
Console.WriteLine(" -title [title] Change the Channel name/title.");
|
||||
Console.WriteLine(" If there are spaces, surround in quotes");
|
||||
Console.WriteLine(" -f Fakesign the WAD");
|
||||
Console.WriteLine(" -type [type] Change the Channel type. Possible values are:");
|
||||
Console.WriteLine(" Channel, DLC, GameChannel, HiddenChannels,");
|
||||
Console.WriteLine(" SystemChannels, or SystemTitles");
|
||||
Console.WriteLine(" -sound [wad] Use the sound from 'wad'");
|
||||
Console.WriteLine(" -banner [wad] Use the banner from 'wad'");
|
||||
Console.WriteLine(" -icon [wad] Use the icon from 'wad'");
|
||||
Console.WriteLine(" -dol [wad] Use the dol from 'wad'");
|
||||
Console.WriteLine(" NOTE: you can also just enter the path to a");
|
||||
Console.WriteLine(" regular dol file, instead of a wad");
|
||||
}
|
||||
}
|
||||
}
|
@ -41,7 +41,7 @@ namespace WadInstaller
|
||||
|
||||
public static MemoryStream CreateInstaller(byte[] wadFileBytes, byte iosToUse)
|
||||
{
|
||||
const int injectionPosition = 0x6A698;
|
||||
const int injectionPosition = 0x665FC;
|
||||
const int maxAllowedSizeForWads = 8 * 1024 * 1024 - 32; //(Max 4MB-32bytes )
|
||||
|
||||
//0. Read length of the wad to ensure it has an allowed size
|
||||
|
Binary file not shown.
91
WadInstaller_Source/source/ahbprot.c
Normal file
91
WadInstaller_Source/source/ahbprot.c
Normal file
@ -0,0 +1,91 @@
|
||||
#include <gccore.h>
|
||||
#include <ogc/machine/processor.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "ahbprot.h"
|
||||
|
||||
#define MEM_PROT 0xD8B420A
|
||||
|
||||
|
||||
const u8 identify_check[] = { 0x28, 0x03, 0xD1, 0x23 };
|
||||
const u8 identify_patch[] = { 0x00, 0x00 };
|
||||
const u8 addticket_vers_check[] = { 0xD2, 0x01, 0x4E, 0x56 };
|
||||
const u8 setuid_check[] = { 0xD1, 0x2A, 0x1C, 0x39 };
|
||||
const u8 setuid_patch[] = { 0x46, 0xC0 };
|
||||
const u8 isfs_perms_check[] = { 0x42, 0x8B, 0xD0, 0x01, 0x25, 0x66 };
|
||||
const u8 e0_patch[] = { 0xE0 };
|
||||
const u8 es_set_ahbprot_check[] = { 0x68, 0x5B, 0x22, 0xEC, 0x00, 0x52, 0x18, 0x9B, 0x68, 0x1B, 0x46, 0x98, 0x07, 0xDB };
|
||||
const u8 es_set_ahbprot_patch[] = { 0x01 };
|
||||
|
||||
const u32 identify_check_size = sizeof(identify_check);
|
||||
const u32 identify_patch_size = sizeof(identify_patch);
|
||||
const u32 addticket_vers_check_size = sizeof(addticket_vers_check);
|
||||
const u32 setuid_check_size = sizeof(setuid_check);
|
||||
const u32 setuid_patch_size = sizeof(setuid_patch);
|
||||
const u32 isfs_perms_check_size = sizeof(isfs_perms_check);
|
||||
const u32 e0_patch_size = sizeof(e0_patch);
|
||||
const u32 es_set_ahbprot_check_size = sizeof(es_set_ahbprot_check);
|
||||
const u32 es_set_ahbprot_patch_size = sizeof(es_set_ahbprot_patch);
|
||||
|
||||
static u8 certs[0xA00] ATTRIBUTE_ALIGN(32);
|
||||
static const char certs_fs[] ATTRIBUTE_ALIGN(32) = "/sys/cert.sys";
|
||||
|
||||
const u8 hash_old[] = { 0x20, 0x07, 0x4B, 0x0B };
|
||||
const u8 hash_patch[] = { 0x00 };
|
||||
|
||||
int get_certs(void) {
|
||||
int fd, ret;
|
||||
fd = IOS_Open(certs_fs, 1);
|
||||
ret = IOS_Read(fd, certs, sizeof(certs));
|
||||
if (ret < sizeof(certs)) {
|
||||
ret = -1;
|
||||
} else {
|
||||
IOS_Close(fd);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
u32 apply_patch2(const char *name, const u8 *old, u32 old_size, const u8 *patch, u32 patch_size, u32 patch_offset) {
|
||||
u32 * end = (u32 *) 0x80003134;
|
||||
u8 *ptr = (u8 *) *end;
|
||||
u32 i, found = 0;
|
||||
u8 *start;
|
||||
|
||||
while ((u32) ptr < (0x94000000 - old_size)) {
|
||||
if (!memcmp(ptr, old, old_size)) {
|
||||
found++;
|
||||
start = ptr + patch_offset;
|
||||
for (i = 0; i < patch_size; i++) {
|
||||
*(start + i) = patch[i];
|
||||
}
|
||||
ptr += patch_size;
|
||||
DCFlushRange((u8 *) (((u32) start) >> 5 << 5), (patch_size >> 5 << 5) + 64);
|
||||
ICInvalidateRange((u8 *)(((u32)start) >> 5 << 5), (patch_size >> 5 << 5) + 64);
|
||||
break;
|
||||
}
|
||||
ptr++;
|
||||
}
|
||||
return found;
|
||||
}
|
||||
|
||||
u32 patchSetAHBPROT() {
|
||||
u32 count = 0;
|
||||
write16(MEM_PROT, 0);
|
||||
count += apply_patch2("Set AHBPROT patch", es_set_ahbprot_check, es_set_ahbprot_check_size, es_set_ahbprot_patch, es_set_ahbprot_patch_size, 25);
|
||||
write16(MEM_PROT, 1);
|
||||
return count;
|
||||
}
|
||||
|
||||
u32 runtimePatchApply() {
|
||||
u32 count = 0;
|
||||
write16(MEM_PROT, 0);
|
||||
count += apply_patch2("New Trucha (may fail)", hash_old, sizeof(hash_old), hash_patch, sizeof(hash_patch), 1);
|
||||
count += apply_patch2("ES_Identify", identify_check, identify_check_size, identify_patch, identify_patch_size, 2);
|
||||
count += apply_patch2("NAND Permissions", isfs_perms_check, isfs_perms_check_size, e0_patch, e0_patch_size, 2);
|
||||
count += apply_patch2("Add ticket patch", addticket_vers_check, addticket_vers_check_size, e0_patch, e0_patch_size, 0);
|
||||
count += apply_patch2("ES_SetUID", setuid_check, setuid_check_size, setuid_patch, setuid_patch_size, 0);
|
||||
write16(MEM_PROT, 1);
|
||||
return count;
|
||||
}
|
44
WadInstaller_Source/source/ahbprot.h
Normal file
44
WadInstaller_Source/source/ahbprot.h
Normal file
@ -0,0 +1,44 @@
|
||||
#ifndef _RUNTIMEIOSPATCH_H_
|
||||
#define _RUNTIMEIOSPATCH_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define HAVE_AHBPROT ((*(vu32*)0xcd800064 == 0xFFFFFFFF) ? 1 : 0)
|
||||
|
||||
|
||||
int get_certs(void);
|
||||
int check_fakesig(void);
|
||||
|
||||
extern const u8 identify_check[];
|
||||
extern const u8 identify_patch[];
|
||||
extern const u8 addticket_vers_check[];
|
||||
extern const u8 setuid_check[];
|
||||
extern const u8 setuid_patch[];
|
||||
extern const u8 isfs_perms_check[];
|
||||
extern const u8 e0_patch[];
|
||||
extern const u8 es_set_ahbprot_check[];
|
||||
extern const u8 es_set_ahbprot_patch[];
|
||||
|
||||
extern const u32 identify_check_size;
|
||||
extern const u32 identify_patch_size;
|
||||
extern const u32 addticket_vers_check_size;
|
||||
extern const u32 setuid_check_size;
|
||||
extern const u32 setuid_patch_size;
|
||||
extern const u32 isfs_perms_check_size;
|
||||
extern const u32 e0_patch_size;
|
||||
extern const u32 es_set_ahbprot_check_size;
|
||||
extern const u32 es_set_ahbprot_patch_size;
|
||||
|
||||
u32 patchSetAHBPROT();
|
||||
u32 runtimePatchApply();
|
||||
|
||||
u32 PrintResult(u32 successful);
|
||||
void ApplyingPatch(const char* which);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
@ -3,6 +3,7 @@
|
||||
#include <string.h>
|
||||
#include <malloc.h>
|
||||
#include <ogcsys.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "fat.h"
|
||||
#include "restart.h"
|
||||
@ -11,19 +12,35 @@
|
||||
#include "video.h"
|
||||
#include "wad.h"
|
||||
#include "wpad.h"
|
||||
#include "ahbprot.h"
|
||||
|
||||
/* Constants */
|
||||
#define CIOS_VERSION 249
|
||||
|
||||
|
||||
void LoadSelectedIOS()
|
||||
{
|
||||
u8 selectedIOS = Wad_SelectIOS();
|
||||
|
||||
s32 ret;
|
||||
|
||||
if (selectedIOS == 0) {
|
||||
if (HAVE_AHBPROT) {
|
||||
ret = patchSetAHBPROT();
|
||||
if (ret > 0) {
|
||||
ret = runtimePatchApply();
|
||||
if (ret > 0) {
|
||||
printf("\nUsing AHBPROT\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
printf("\nAHBPROT FAILED!\n");
|
||||
}
|
||||
}
|
||||
|
||||
ret = IOS_ReloadIOS(selectedIOS);
|
||||
if (ret<0)
|
||||
{
|
||||
printf("\nUsing default IOS");
|
||||
printf("\nUsing default IOS\n");
|
||||
} else
|
||||
{
|
||||
printf("\nUsing selected IOS %d\n", selectedIOS);
|
||||
|
@ -81,6 +81,32 @@ int mread(void * buf, int size, int count)
|
||||
|
||||
//-------------------------- INSTALL FROM MEMORY -------------------------------
|
||||
|
||||
void __Wad_FixTicket(signed_blob *p_tik) {
|
||||
u8 *data = (u8 *) p_tik;
|
||||
u8 *ckey = data + 0x1F1;
|
||||
|
||||
if (*ckey > 1) {
|
||||
/* Set common key */
|
||||
*ckey = 0;
|
||||
|
||||
/* Fakesign ticket */
|
||||
brute_tik((tik *) p_tik);
|
||||
}
|
||||
}
|
||||
|
||||
s32 brute_tik(tik *p_tik) {
|
||||
u16 fill;
|
||||
for (fill = 0; fill < 65535; fill++) {
|
||||
p_tik->padding = fill;
|
||||
sha1 hash;
|
||||
// gprintf("SHA1(%p, %x, %p)\n", p_tmd, TMD_SIZE(p_tmd), hash);
|
||||
SHA1((u8 *) p_tik, sizeof(tik), hash);
|
||||
if (hash[0] == 0) return 1;
|
||||
}
|
||||
printf("Unable to fix tik :(\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
s32 __Wad_ReadFile(void *outbuf, u32 offset, u32 len)
|
||||
{
|
||||
s32 ret;
|
||||
@ -192,9 +218,13 @@ s32 __Wad_Install()
|
||||
ret = __Wad_ReadAlloc((void *)&p_tik, offset, header->tik_len);
|
||||
if (ret < 0)
|
||||
goto err;
|
||||
else
|
||||
else {
|
||||
offset += round_up(header->tik_len, 64);
|
||||
|
||||
// Fix ticket (This is what caused me the headaches when adding AHBPROT -person66)
|
||||
__Wad_FixTicket(p_tik);
|
||||
}
|
||||
|
||||
/* WAD TMD */
|
||||
ret = __Wad_ReadAlloc((void *)&p_tmd, offset, header->tmd_len);
|
||||
if (ret < 0)
|
||||
|
@ -4,5 +4,6 @@
|
||||
/* Prototypes */
|
||||
s32 Wad_InstallFromMemory();
|
||||
u8 Wad_SelectIOS(void);
|
||||
s32 brute_tik(tik *p_tik);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user