mirror of
https://github.com/mogzol/sharpii.git
synced 2024-11-14 06:35:05 +01:00
Updated to 1.5 - Added the ability to send WADs to the HBC using SendWad
- You can now download an IOS with -ios # in NUSD - Downloaded IOS wads are now named like so: IOS##-64-####.wad - Under certain conditions, when downloading a wad with NUS, it will not be saved in a folder, just as the WAD (see ReadMe) - If missing dll's are detected (WadInstaller or libWiiSharp), Sharpii will ask to download them, if they are required. - You can now use a .dol file instead of a .wad with the '-dol' in the WAD editor/packer - Probably a few other little things I have forgotten - Even more code cleanup and bug fixes
This commit is contained in:
parent
475336b843
commit
bc65416cf7
22
Sharpii.sln
22
Sharpii.sln
@ -3,16 +3,38 @@ Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual C# Express 2010
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sharpii", "Sharpii\Sharpii.csproj", "{AD7EBA1D-DF9F-4F71-AAD4-3963E79CE827}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WadInstaller", "WadInstaller\WadInstaller.csproj", "{475F3ADF-B529-449F-89DA-BA5E8BE15DD5}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|Mixed Platforms = Debug|Mixed Platforms
|
||||
Debug|x86 = Debug|x86
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|Mixed Platforms = Release|Mixed Platforms
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{AD7EBA1D-DF9F-4F71-AAD4-3963E79CE827}.Debug|Any CPU.ActiveCfg = Debug|x86
|
||||
{AD7EBA1D-DF9F-4F71-AAD4-3963E79CE827}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
|
||||
{AD7EBA1D-DF9F-4F71-AAD4-3963E79CE827}.Debug|Mixed Platforms.Build.0 = Debug|x86
|
||||
{AD7EBA1D-DF9F-4F71-AAD4-3963E79CE827}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{AD7EBA1D-DF9F-4F71-AAD4-3963E79CE827}.Debug|x86.Build.0 = Debug|x86
|
||||
{AD7EBA1D-DF9F-4F71-AAD4-3963E79CE827}.Release|Any CPU.ActiveCfg = Release|x86
|
||||
{AD7EBA1D-DF9F-4F71-AAD4-3963E79CE827}.Release|Mixed Platforms.ActiveCfg = Release|x86
|
||||
{AD7EBA1D-DF9F-4F71-AAD4-3963E79CE827}.Release|Mixed Platforms.Build.0 = Release|x86
|
||||
{AD7EBA1D-DF9F-4F71-AAD4-3963E79CE827}.Release|x86.ActiveCfg = Release|x86
|
||||
{AD7EBA1D-DF9F-4F71-AAD4-3963E79CE827}.Release|x86.Build.0 = Release|x86
|
||||
{475F3ADF-B529-449F-89DA-BA5E8BE15DD5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{475F3ADF-B529-449F-89DA-BA5E8BE15DD5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{475F3ADF-B529-449F-89DA-BA5E8BE15DD5}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{475F3ADF-B529-449F-89DA-BA5E8BE15DD5}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{475F3ADF-B529-449F-89DA-BA5E8BE15DD5}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{475F3ADF-B529-449F-89DA-BA5E8BE15DD5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{475F3ADF-B529-449F-89DA-BA5E8BE15DD5}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{475F3ADF-B529-449F-89DA-BA5E8BE15DD5}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{475F3ADF-B529-449F-89DA-BA5E8BE15DD5}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{475F3ADF-B529-449F-89DA-BA5E8BE15DD5}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
156
Sharpii/HBC.cs
156
Sharpii/HBC.cs
@ -17,6 +17,7 @@
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using libWiiSharp;
|
||||
|
||||
namespace Sharpii
|
||||
@ -134,7 +135,138 @@ namespace Sharpii
|
||||
|
||||
}
|
||||
|
||||
public static void SendDol_help()
|
||||
public static bool SendWad_Check(string[] args)
|
||||
{
|
||||
if (args.Length < 2)
|
||||
{
|
||||
SendWad_help();
|
||||
return false;
|
||||
}
|
||||
if (args[1].ToUpper() == "-H" || args[1].ToUpper() == "-HELP")
|
||||
{
|
||||
SendWad_help();
|
||||
return false;
|
||||
}
|
||||
|
||||
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>>");
|
||||
string ans = Console.ReadLine();
|
||||
if (ans.ToUpper() == "Y")
|
||||
{
|
||||
try
|
||||
{
|
||||
Console.Write("\nGrabbing WadInstaller.dll...");
|
||||
WebClient DLwadInstaller = new WebClient();
|
||||
DLwadInstaller.DownloadFile("http://sharpii.googlecode.com/files/WadInstaller.dll", "WadInstaller.dll");
|
||||
Console.Write("Done!\n");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{ System.Console.WriteLine("An error occured: {0}", ex.Message); return false; }
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void SendWad(string[] args)
|
||||
{
|
||||
string input = "";
|
||||
string ip = "";
|
||||
string ios = "";
|
||||
string protocol = "JODI";
|
||||
|
||||
//Get parameters
|
||||
for (int i = 1; i < args.Length; i++)
|
||||
{
|
||||
switch (args[i].ToUpper())
|
||||
{
|
||||
case "-IOS":
|
||||
if (i + 1 >= args.Length)
|
||||
{
|
||||
Console.WriteLine("ERROR: No ip set");
|
||||
return;
|
||||
}
|
||||
ios = args[i + 1];
|
||||
if (!(Convert.ToInt32(ios) >= 3 && Convert.ToInt32(ios) <= 255))
|
||||
{
|
||||
Console.WriteLine("ERROR: Invalid IOS number");
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case "-IP":
|
||||
if (i + 1 >= args.Length)
|
||||
{
|
||||
Console.WriteLine("ERROR: No ip set");
|
||||
return;
|
||||
}
|
||||
ip = args[i + 1];
|
||||
break;
|
||||
case "-WAD":
|
||||
if (i + 1 >= args.Length)
|
||||
{
|
||||
Console.WriteLine("ERROR: No WAD set");
|
||||
return;
|
||||
}
|
||||
input = args[i + 1];
|
||||
//Check if file exists
|
||||
if (File.Exists(input) == false)
|
||||
{
|
||||
System.Console.WriteLine("ERROR: Unable to open file: {0}", input);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case "-OLD":
|
||||
protocol = "HAXX";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//Run main part, and check for exceptions
|
||||
try
|
||||
{
|
||||
libWiiSharp.Protocol proto = Protocol.JODI;
|
||||
|
||||
if (Quiet.quiet > 2 && protocol == "HAXX")
|
||||
System.Console.WriteLine("Using old protocol");
|
||||
|
||||
if (protocol == "HAXX")
|
||||
proto = Protocol.HAXX;
|
||||
|
||||
if (Quiet.quiet > 2)
|
||||
System.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");
|
||||
|
||||
if (Quiet.quiet > 1)
|
||||
System.Console.Write("Sending file...");
|
||||
|
||||
file.TransmitFile("WadInstaller.dol", Installer);
|
||||
|
||||
if (Quiet.quiet > 1)
|
||||
System.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);
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
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);
|
||||
@ -156,5 +288,27 @@ namespace Sharpii
|
||||
System.Console.WriteLine(" NOTE: Any arguments after '-dol file' will be sent as dol");
|
||||
System.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");
|
||||
}
|
||||
}
|
||||
}
|
@ -240,7 +240,6 @@ namespace Sharpii
|
||||
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("");
|
||||
System.Console.WriteLine(" Usage:");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine(" Sharpii.exe IOS input [-o output] [-fs] [-es] [-np] [-vp] [-s slot]");
|
||||
|
132
Sharpii/NUSD.cs
132
Sharpii/NUSD.cs
@ -40,11 +40,16 @@ namespace Sharpii
|
||||
//Set up variables
|
||||
string id = "";
|
||||
string content = "";
|
||||
int version = -1;
|
||||
string version = "";
|
||||
int intver = -1;
|
||||
string output = "";
|
||||
bool local = false;
|
||||
List<StoreType> store = new List<StoreType>();
|
||||
bool entered = false;
|
||||
bool wad = false;
|
||||
bool NoOut = false;
|
||||
string ios = "";
|
||||
string temp = Path.GetTempPath() + "Sharpii.tmp";
|
||||
|
||||
//Get arguments
|
||||
for (int i = 1; i < args.Length; i++)
|
||||
@ -84,12 +89,15 @@ namespace Sharpii
|
||||
Console.WriteLine("ERROR: No version set");
|
||||
return;
|
||||
}
|
||||
if (!int.TryParse(args[i + 1], out version))
|
||||
version = args[i + 1];
|
||||
if (version.ToUpper() == "LATEST")
|
||||
break;
|
||||
if (!int.TryParse(version, out intver))
|
||||
{
|
||||
Console.WriteLine("Invalid version {0}...", args[i + 1]);
|
||||
return;
|
||||
}
|
||||
if (version < 0 || version > 65535)
|
||||
if (intver < 0 || intver > 65535)
|
||||
{
|
||||
Console.WriteLine("Invalid version {0}...", version);
|
||||
return;
|
||||
@ -101,12 +109,15 @@ namespace Sharpii
|
||||
Console.WriteLine("ERROR: No version set");
|
||||
return;
|
||||
}
|
||||
if (!int.TryParse(args[i + 1], out version))
|
||||
version = args[i + 1];
|
||||
if (version.ToUpper() == "LATEST")
|
||||
break;
|
||||
if (!int.TryParse(version, out intver))
|
||||
{
|
||||
Console.WriteLine("Invalid version {0}...", args[i + 1]);
|
||||
return;
|
||||
}
|
||||
if (version < 0 || version > 65535)
|
||||
if (intver < 0 || intver > 65535)
|
||||
{
|
||||
Console.WriteLine("Invalid version {0}...", version);
|
||||
return;
|
||||
@ -128,6 +139,14 @@ namespace Sharpii
|
||||
}
|
||||
id = args[i + 1];
|
||||
break;
|
||||
case "-IOS":
|
||||
if (i + 1 >= args.Length)
|
||||
{
|
||||
Console.WriteLine("ERROR: No IOS specified");
|
||||
return;
|
||||
}
|
||||
id = "00000001000000" + Convert.ToInt32(args[i + 1]).ToString("X2");
|
||||
break;
|
||||
case "-SINGLE":
|
||||
if (i + 1 >= args.Length)
|
||||
{
|
||||
@ -147,24 +166,29 @@ namespace Sharpii
|
||||
}
|
||||
}
|
||||
|
||||
//Error checking
|
||||
//Error checking & stuff
|
||||
if (id == "")
|
||||
{
|
||||
System.Console.WriteLine("ERROR: No ID specified");
|
||||
return;
|
||||
}
|
||||
|
||||
if (version == -1)
|
||||
if (version == "")
|
||||
{
|
||||
System.Console.WriteLine("ERROR: No version specified");
|
||||
return;
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.WriteLine("No version specified, using latest", version);
|
||||
version = "LATEST";
|
||||
}
|
||||
|
||||
if (output == "")
|
||||
if (version.ToUpper() == "LATEST")
|
||||
{
|
||||
output = id + "v" + version;
|
||||
//Grab the TMD and get the latest version
|
||||
NusClient grabtmd = new NusClient();
|
||||
TMD tmd = grabtmd.DownloadTMD(id, "");
|
||||
version = tmd.TitleVersion.ToString();
|
||||
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.WriteLine("No output specified, using {0}", output);
|
||||
System.Console.WriteLine("Found latest version: v{0}", version);
|
||||
}
|
||||
|
||||
if (entered == false) //Will only be false if no store type argument was given
|
||||
@ -174,6 +198,26 @@ namespace Sharpii
|
||||
System.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")
|
||||
ios = "IOS" + Convert.ToInt32(id.Substring(14, 2), 16) + "-64-" + version + ".wad";
|
||||
|
||||
if ((((output.Length >= 4 && output.Substring(output.Length - 4, 4).ToUpper() == ".WAD") || output == "") && Array.IndexOf(store.ToArray(), StoreType.WAD) != -1 && store.ToArray().Length == 1) || (output == "" && ios != "" && Array.IndexOf(store.ToArray(), StoreType.WAD) != -1 && store.ToArray().Length == 1))
|
||||
{
|
||||
wad = true;
|
||||
if (Directory.Exists(temp) == true)
|
||||
DeleteDir.DeleteDirectory(temp);
|
||||
|
||||
Directory.CreateDirectory(temp);
|
||||
}
|
||||
|
||||
if (output == "")
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
//Main part, catches random/unexpected exceptions
|
||||
try
|
||||
{
|
||||
@ -192,7 +236,7 @@ namespace Sharpii
|
||||
if (Quiet.quiet > 1)
|
||||
System.Console.Write("Downloading content...");
|
||||
|
||||
nus.DownloadSingleContent(id, version.ToString(), content, output);
|
||||
nus.DownloadSingleContent(id, version, content, output);
|
||||
|
||||
if (Quiet.quiet > 1)
|
||||
System.Console.Write("Done!\n");
|
||||
@ -202,7 +246,13 @@ namespace Sharpii
|
||||
if (Quiet.quiet > 1)
|
||||
System.Console.Write("Downloading title...");
|
||||
|
||||
nus.DownloadTitle(id, version.ToString(), output, store.ToArray());
|
||||
string realout = output;
|
||||
if (wad == true)
|
||||
output = temp;
|
||||
|
||||
nus.DownloadTitle(id, version, output, store.ToArray());
|
||||
|
||||
WadIosNamingStuff(wad, temp, id, version, ios, NoOut, output, realout);
|
||||
|
||||
if (Quiet.quiet > 1)
|
||||
System.Console.Write("Done!\n");
|
||||
@ -223,6 +273,49 @@ namespace Sharpii
|
||||
|
||||
}
|
||||
|
||||
private static void WadIosNamingStuff(bool wad, string temp, string id, string version, string ios, bool NoOut, string output, string realout)
|
||||
{
|
||||
if (wad == true)
|
||||
{
|
||||
if (!File.Exists(temp + "\\" + id + "v" + version + ".wad"))
|
||||
{
|
||||
System.Console.WriteLine("ERROR: Can't find WAD");
|
||||
return;
|
||||
}
|
||||
if (ios != "" && NoOut == true)
|
||||
{
|
||||
int index = realout.LastIndexOf("\\") > realout.LastIndexOf("/") ? realout.LastIndexOf("\\") : realout.LastIndexOf("/");
|
||||
if (File.Exists(realout.Substring(0, index + 1) + ios))
|
||||
File.Delete(realout.Substring(0, index + 1) + ios);
|
||||
File.Move(temp + "\\" + id + "v" + version + ".wad", realout.Substring(0, index + 1) + ios);
|
||||
}
|
||||
else if (ios == "" && NoOut == true)
|
||||
{
|
||||
if (File.Exists(realout + ".wad"))
|
||||
File.Delete(realout + ".wad");
|
||||
File.Move(temp + "\\" + id + "v" + version + ".wad", realout + ".wad");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (File.Exists(realout))
|
||||
File.Delete(realout);
|
||||
File.Move(temp + "\\" + id + "v" + version + ".wad", realout);
|
||||
}
|
||||
DeleteDir.DeleteDirectory(temp);
|
||||
}
|
||||
else if (ios != "")
|
||||
{
|
||||
if (output.Substring(output.Length - 1, 1) == "\\" || output.Substring(output.Length - 1, 1) == "/")
|
||||
output = output.Substring(output.Length - 1, 1);
|
||||
if (File.Exists(output + "\\" + id + "v" + version + ".wad"))
|
||||
{
|
||||
if (File.Exists(output + "\\" + ios))
|
||||
File.Delete(output + "\\" + ios);
|
||||
File.Move(output + "\\" + id + "v" + version + ".wad", output + "\\" + ios);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void NUS_help()
|
||||
{
|
||||
System.Console.WriteLine("");
|
||||
@ -231,14 +324,17 @@ namespace Sharpii
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine(" Usage:");
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine(" Sharpii.exe NUSD [-id titleID] [-v version] [-o otput] [-all] [-wad]");
|
||||
System.Console.WriteLine(" [-decrypt] [-encrypt] [-local] [-s content]");
|
||||
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");
|
||||
@ -248,9 +344,9 @@ namespace Sharpii
|
||||
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(" -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(" -encrypt Keep only the encrypted contents of the file you wish to");
|
||||
System.Console.WriteLine(" download");
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using libWiiSharp;
|
||||
|
||||
namespace Sharpii
|
||||
@ -34,6 +35,22 @@ 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>>");
|
||||
string ans = Console.ReadLine();
|
||||
if (ans.ToUpper() == "Y")
|
||||
{
|
||||
try
|
||||
{
|
||||
Console.Write("\nGrabbing libWiiSharp.dll...");
|
||||
WebClient DLwadInstaller = new WebClient();
|
||||
DLwadInstaller.DownloadFile("http://sharpii.googlecode.com/svn/trunk/Sharpii/libWiiSharp.dll", "libWiiSharp.dll");
|
||||
Console.Write("Done!\n");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{ System.Console.WriteLine("An error occured: {0}", ex.Message); Environment.Exit(0); }
|
||||
}
|
||||
else
|
||||
Environment.Exit(0);
|
||||
}
|
||||
|
||||
@ -54,59 +71,74 @@ namespace Sharpii
|
||||
}
|
||||
|
||||
string Function = args[0];
|
||||
bool gotSomewhere = false;
|
||||
|
||||
if (Function.ToUpper() == "-H" || Function.ToUpper() == "-HELP" || Function.ToUpper() == "H" || Function.ToUpper() == "HELP")
|
||||
{
|
||||
help();
|
||||
Environment.Exit(0);
|
||||
gotSomewhere = true;
|
||||
}
|
||||
|
||||
if (Function.ToUpper() == "BNS")
|
||||
{
|
||||
BNS_Stuff.BNS(args);
|
||||
Environment.Exit(0);
|
||||
gotSomewhere = true;
|
||||
}
|
||||
|
||||
if (Function.ToUpper() == "WAD")
|
||||
{
|
||||
WAD_Stuff.WAD(args);
|
||||
Environment.Exit(0);
|
||||
gotSomewhere = true;
|
||||
}
|
||||
|
||||
if (Function.ToUpper() == "TPL")
|
||||
{
|
||||
TPL_Stuff.TPL(args);
|
||||
Environment.Exit(0);
|
||||
gotSomewhere = true;
|
||||
}
|
||||
|
||||
if (Function.ToUpper() == "U8")
|
||||
{
|
||||
U8_Stuff.U8(args);
|
||||
Environment.Exit(0);
|
||||
gotSomewhere = true;
|
||||
}
|
||||
|
||||
if (Function.ToUpper() == "IOS")
|
||||
{
|
||||
IOS_Stuff.IOS(args);
|
||||
Environment.Exit(0);
|
||||
gotSomewhere = true;
|
||||
}
|
||||
|
||||
if (Function.ToUpper() == "NUS" || Function.ToUpper() == "NUSD")
|
||||
{
|
||||
NUS_Stuff.NUS(args);
|
||||
Environment.Exit(0);
|
||||
gotSomewhere = true;
|
||||
}
|
||||
|
||||
if (Function.ToUpper() == "SENDDOL" || Function.ToUpper() == "SENDOL")
|
||||
{
|
||||
HBC_Stuff.SendDol(args);
|
||||
Environment.Exit(0);
|
||||
gotSomewhere = true;
|
||||
}
|
||||
|
||||
if (Function.ToUpper() == "SENDWAD")
|
||||
{
|
||||
bool cont = HBC_Stuff.SendWad_Check(args);
|
||||
if (cont == true) HBC_Stuff.SendWad(args);
|
||||
gotSomewhere = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (gotSomewhere == false)
|
||||
{
|
||||
//If tuser gets here, they entered something wrong
|
||||
System.Console.WriteLine("ERROR: The argument {0} is invalid", args[0]);
|
||||
}
|
||||
|
||||
string temp = Path.GetTempPath() + "Sharpii.tmp";
|
||||
if (Directory.Exists(temp) == true)
|
||||
DeleteDir.DeleteDirectory(temp);
|
||||
|
||||
Environment.Exit(0);
|
||||
}
|
||||
@ -131,6 +163,7 @@ namespace Sharpii
|
||||
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'");
|
||||
@ -180,5 +213,5 @@ namespace Sharpii
|
||||
}
|
||||
public class Version
|
||||
{
|
||||
public static string version = "1.4";
|
||||
public static string version = "1.5";
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/------------------------------------------------------------------------------>
|
||||
Sharpii 1.4
|
||||
Sharpii 1.5
|
||||
<---------------------------------------------------------------->
|
||||
An app by person66
|
||||
libWiiSharp.dll by leathl (mod by scooby74029)
|
||||
@ -18,7 +18,7 @@ libWiiSharp.dll to perform tasks such as:
|
||||
- Download files from NUS
|
||||
- Convert a .wav file to .bns, and vice versa
|
||||
- Convert an image file to a .tpl, and vice versa
|
||||
- Send a .dol to the Homebrew Channel over Wi-Fi
|
||||
- Send a .dol or .wad to the Homebrew Channel over Wi-Fi
|
||||
|
||||
|
||||
/----USAGE
|
||||
@ -51,6 +51,13 @@ help with.
|
||||
Also note that When Downloading single contents, it will only save the
|
||||
decrypted file.
|
||||
|
||||
If you wish to download the latest content, use '-v latest' instead of the
|
||||
actual version number.
|
||||
|
||||
If you have the output format set only to WAD, and your your output location
|
||||
has '.wad' at the end, or you have not specified one, then instead of being
|
||||
saved inside a folder, just the wad file will be saved.
|
||||
|
||||
WAD Editing:
|
||||
/------------------>
|
||||
When changing the type of WAD (using the -type argument) some of the types
|
||||
@ -91,6 +98,11 @@ it borrows some code from some of the examples included with libWiiSharp.
|
||||
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)
|
||||
|
||||
|
||||
I would also like to thank XFlak and JoostinOnline for doing a bit of beta
|
||||
testing for me. Thanks!
|
||||
|
||||
@ -105,6 +117,18 @@ See "LICENSE.txt" for more information.
|
||||
/----CHANGELOG
|
||||
/------------------------------>
|
||||
|
||||
1.5
|
||||
- Added the ability to send WADs to the HBC using SendWad
|
||||
- You can now download an IOS with -ios # in NUSD
|
||||
- Downloaded IOS wads are now namedlike so: IOS##-64-####.wad
|
||||
- Under certain conditions, when downloading a wad with NUS,
|
||||
it will not be saved in a folder, just as the WAD (see ReadMe)
|
||||
- If missing dll's are detected (WadInstaller or libWiiSharp),
|
||||
Sharpii will ask to download them, if they are required.
|
||||
- You can now use a .dol file instead of a .wad with the '-dol'
|
||||
in the WAD editor/packer
|
||||
- Probably a few other little things I have forgotten
|
||||
- Even more code cleanup and bug fixes
|
||||
1.4
|
||||
- Added the ability to send arguments in the SendDol function
|
||||
- Changed the way the SendDol function works a little
|
||||
|
@ -94,6 +94,12 @@
|
||||
<Content Include="LICENSE.txt" />
|
||||
<Content Include="README.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\WadInstaller\WadInstaller.csproj">
|
||||
<Project>{475F3ADF-B529-449F-89DA-BA5E8BE15DD5}</Project>
|
||||
<Name>WadInstaller</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
@ -342,7 +342,7 @@ namespace Sharpii
|
||||
app = args[i + 1];
|
||||
if (File.Exists(app) == false)
|
||||
{
|
||||
Console.WriteLine("ERROR: Unable to find dol wad");
|
||||
Console.WriteLine("ERROR: Unable to find dol wad/file");
|
||||
return;
|
||||
}
|
||||
break;
|
||||
@ -438,8 +438,16 @@ namespace Sharpii
|
||||
if (Quiet.quiet > 2)
|
||||
System.Console.Write("Grabbing dol...");
|
||||
|
||||
if (app.Substring(app.Length - 4, 4) == ".dol")
|
||||
{
|
||||
Directory.CreateDirectory(temp + "\\dol\\");
|
||||
File.Copy(app, temp + "\\dol\\00000001.app");
|
||||
}
|
||||
else
|
||||
{
|
||||
twad.LoadFile(app);
|
||||
twad.Unpack(temp + "\\dol");
|
||||
}
|
||||
|
||||
File.Copy(temp + "\\dol\\00000001.app", temp + "\\main\\00000001.app", true);
|
||||
|
||||
@ -624,6 +632,8 @@ namespace Sharpii
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
120
WadInstaller/InstallerHelper.cs
Normal file
120
WadInstaller/InstallerHelper.cs
Normal file
@ -0,0 +1,120 @@
|
||||
/* This file is part of Sharpii.
|
||||
* Copyright (C) 2009 WiiCrazy / I.R.on
|
||||
*
|
||||
* Sharpii is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Sharpii is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Sharpii. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
namespace WadInstaller
|
||||
{
|
||||
public class WadInstaller_Plugin
|
||||
{
|
||||
const string version = "1.0";
|
||||
|
||||
public static string GetVersion()
|
||||
{
|
||||
return version;
|
||||
}
|
||||
}
|
||||
|
||||
public class InstallerHelper
|
||||
{
|
||||
public static MemoryStream CreateInstaller(string wadFile, byte iosToUse)
|
||||
{
|
||||
return CreateInstaller(File.ReadAllBytes(wadFile), iosToUse);
|
||||
}
|
||||
|
||||
public static MemoryStream CreateInstaller(byte[] wadFileBytes, byte iosToUse)
|
||||
{
|
||||
const int injectionPosition = 0x6A698;
|
||||
const int maxAllowedSizeForWads = 8 * 1024 * 1024 - 32; //(Max 4MB-32bytes )
|
||||
|
||||
//0. Read length of the wad to ensure it has an allowed size
|
||||
uint wadLength = (uint)wadFileBytes.Length;
|
||||
|
||||
if (wadLength > maxAllowedSizeForWads)
|
||||
{
|
||||
throw new ArgumentException(String.Format("The file is sized above the max allowed limit of {1} for network installation.", maxAllowedSizeForWads));
|
||||
}
|
||||
|
||||
//1. Open the stub installer from resources
|
||||
MemoryStream compressedStubInstallerStream = LoadCompressedStubInstaller("WadInstaller.dol.z");
|
||||
compressedStubInstallerStream.Seek(0, SeekOrigin.Begin);
|
||||
|
||||
//2. Decompress compressed installer
|
||||
MemoryStream uncompressedStubInstallerStream = new MemoryStream();
|
||||
|
||||
using (GZipStream gzipStream = new GZipStream(compressedStubInstallerStream, CompressionMode.Decompress))
|
||||
{
|
||||
byte[] decompressedBuff = new byte[1024];
|
||||
while (true)
|
||||
{
|
||||
int length = gzipStream.Read(decompressedBuff, 0, 1024);
|
||||
|
||||
if (length == 0) break;
|
||||
|
||||
uncompressedStubInstallerStream.Write(decompressedBuff, 0, length);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//3. Take SHA of the wad and store it in the stub installer along with the size of the wad
|
||||
|
||||
byte[] shaHash;
|
||||
using (SHA1 shaGen = SHA1.Create())
|
||||
{
|
||||
shaHash = shaGen.ComputeHash(wadFileBytes);
|
||||
}
|
||||
|
||||
//4. Inject the data into the installer
|
||||
|
||||
//Write out the wad size
|
||||
uncompressedStubInstallerStream.Seek(injectionPosition, SeekOrigin.Begin);
|
||||
uncompressedStubInstallerStream.WriteByte((byte)((wadLength >> 24) & 0xff));
|
||||
uncompressedStubInstallerStream.WriteByte((byte)((wadLength >> 16) & 0xff));
|
||||
uncompressedStubInstallerStream.WriteByte((byte)((wadLength >> 8) & 0xff));
|
||||
uncompressedStubInstallerStream.WriteByte((byte)(wadLength & 0xff));
|
||||
|
||||
//Write out the SHA1 value (Against corruption of the file on the network, this value will be checked by the installer)
|
||||
uncompressedStubInstallerStream.Write(shaHash, 0, 20);
|
||||
|
||||
//Write out the ios to be used...
|
||||
uncompressedStubInstallerStream.WriteByte(iosToUse);
|
||||
|
||||
//pad it with three zeroes (to align it into 32-bit)
|
||||
uncompressedStubInstallerStream.WriteByte(0); uncompressedStubInstallerStream.WriteByte(0); uncompressedStubInstallerStream.WriteByte(0);
|
||||
|
||||
|
||||
//Write out to be installed wad file's contents...
|
||||
uncompressedStubInstallerStream.Write(wadFileBytes, 0, (int)wadLength);
|
||||
|
||||
return uncompressedStubInstallerStream;
|
||||
}
|
||||
|
||||
private static MemoryStream LoadCompressedStubInstaller(string installerResourceName)
|
||||
{
|
||||
using (BinaryReader resLoader = new BinaryReader(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("WadInstaller.Resources." + installerResourceName)))
|
||||
{
|
||||
MemoryStream ms = new MemoryStream();
|
||||
byte[] temp = resLoader.ReadBytes((int)resLoader.BaseStream.Length);
|
||||
ms.Write(temp, 0, temp.Length);
|
||||
return ms;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
53
WadInstaller/Properties/AssemblyInfo.cs
Normal file
53
WadInstaller/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,53 @@
|
||||
/* This file is part of CustomizeMii
|
||||
* Copyright (C) 2009 WiiCrazy / I.R.on
|
||||
*
|
||||
* CustomizeMii is free software: you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* CustomizeMii is distributed in the hope that it will be
|
||||
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("WadInstaller")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Irduco")]
|
||||
[assembly: AssemblyProduct("WadInstaller")]
|
||||
[assembly: AssemblyCopyright("Copyright © Irduco 2010")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("032fe41d-4954-44ea-a8f3-e51de3546361")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// 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")]
|
BIN
WadInstaller/Resources/WadInstaller.dol.z
Normal file
BIN
WadInstaller/Resources/WadInstaller.dol.z
Normal file
Binary file not shown.
58
WadInstaller/WadInstaller.csproj
Normal file
58
WadInstaller/WadInstaller.csproj
Normal file
@ -0,0 +1,58 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>9.0.30729</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{475F3ADF-B529-449F-89DA-BA5E8BE15DD5}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>WadInstaller</RootNamespace>
|
||||
<AssemblyName>WadInstaller</AssemblyName>
|
||||
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<OldToolsVersion>3.5</OldToolsVersion>
|
||||
<UpgradeBackupLocation />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="InstallerHelper.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Resources\WadInstaller.dol.z" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
339
WadInstaller_Source/LICENSE.txt
Normal file
339
WadInstaller_Source/LICENSE.txt
Normal file
@ -0,0 +1,339 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
139
WadInstaller_Source/Makefile
Normal file
139
WadInstaller_Source/Makefile
Normal file
@ -0,0 +1,139 @@
|
||||
#---------------------------------------------------------------------------------
|
||||
# Clear the implicit built in rules
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
#DEVKITPRO = /opt/devkitPPC
|
||||
#DEVKITPPC = /opt/devkitPPC
|
||||
|
||||
ifeq ($(strip $(DEVKITPPC)),)
|
||||
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
|
||||
endif
|
||||
|
||||
include $(DEVKITPPC)/wii_rules
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# TARGET is the name of the output
|
||||
# BUILD is the directory where object files & intermediate files will be placed
|
||||
# SOURCES is a list of directories containing source code
|
||||
# INCLUDES is a list of directories containing extra header files
|
||||
#---------------------------------------------------------------------------------
|
||||
TARGET := WadInstaller
|
||||
BUILD := build
|
||||
SOURCES := source source/libpng source/libpng/pngu
|
||||
DATA := data
|
||||
INCLUDES :=
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
CFLAGS = -Os -Wall $(MACHDEP) $(INCLUDE)
|
||||
CXXFLAGS = $(CFLAGS)
|
||||
|
||||
LDFLAGS = $(MACHDEP) -Wl,-Map,$(notdir $@).map
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with the project
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := -lpng -lfat -lwiiuse -lbte -logc -lm -lz
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBDIRS := $(CURDIR)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# no real need to edit anything past this point unless you need to add additional
|
||||
# rules for different file extensions
|
||||
#---------------------------------------------------------------------------------
|
||||
ifneq ($(BUILD),$(notdir $(CURDIR)))
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||
|
||||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
|
||||
|
||||
export DEPSDIR := $(CURDIR)/$(BUILD)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# automatically build a list of object files for our project
|
||||
#---------------------------------------------------------------------------------
|
||||
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
|
||||
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
|
||||
sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
||||
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
|
||||
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# use CXX for linking C++ projects, CC for standard C
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(CPPFILES)),)
|
||||
export LD := $(CC)
|
||||
else
|
||||
export LD := $(CXX)
|
||||
endif
|
||||
|
||||
export OFILES := $(addsuffix .o,$(BINFILES)) \
|
||||
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \
|
||||
$(sFILES:.s=.o) $(SFILES:.S=.o)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# build a list of include paths
|
||||
#---------------------------------------------------------------------------------
|
||||
export INCLUDE := $(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||
-I$(CURDIR)/$(BUILD) \
|
||||
-I$(LIBOGC_INC)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# build a list of library paths
|
||||
#---------------------------------------------------------------------------------
|
||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
|
||||
-L$(LIBOGC_LIB)
|
||||
|
||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||
.PHONY: $(BUILD) clean
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
$(BUILD):
|
||||
@[ -d $@ ] || mkdir -p $@
|
||||
@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
clean:
|
||||
@echo clean ...
|
||||
@rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
run:
|
||||
wiiload $(TARGET).dol
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
|
||||
DEPENDS := $(OFILES:.o=.d)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# main targets
|
||||
#---------------------------------------------------------------------------------
|
||||
$(OUTPUT).dol: $(OUTPUT).elf
|
||||
$(OUTPUT).elf: $(OFILES)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# This rule links in binary data with the .jpg extension
|
||||
#---------------------------------------------------------------------------------
|
||||
%.jpg.o : %.jpg
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo $(notdir $<)
|
||||
$(bin2o)
|
||||
|
||||
-include $(DEPENDS)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------
|
||||
|
43
WadInstaller_Source/README.Orig.es.txt
Normal file
43
WadInstaller_Source/README.Orig.es.txt
Normal file
@ -0,0 +1,43 @@
|
||||
+----------------------------+
|
||||
| WAD Manager v1.4 |
|
||||
| developed by Waninkoko |
|
||||
+----------------------------+
|
||||
| www.teknoconsolas.es |
|
||||
+----------------------------+
|
||||
|
||||
|
||||
[ DISCLAIMER ]:
|
||||
|
||||
- ESTA APLICACION VIENE SIN NINGUNA GARANTIA, EXPLICITA NI IMPLICITA.
|
||||
NO ME HAGO RESPONSABLE POR CUALQUIER DAÑO EN TU CONSOLA WII DEBIDO A
|
||||
UN USO NO APROPIADO DE ESTE SOFTWARE.
|
||||
|
||||
|
||||
[ DESCRIPCION ]:
|
||||
|
||||
- WAD Manager es una aplicacion que te permite (des)instalar paquetes WAD.
|
||||
|
||||
La aplicacion muestra todos los paquetes WAD disponibles en un
|
||||
dispositivo de almacenamiento para poder elegir cual (des)instalar.
|
||||
|
||||
|
||||
[ DISPOSITIVOS SOPORTADOS ]:
|
||||
|
||||
- SDGecko.
|
||||
- Puerto SD interno (con soporte SDHC).
|
||||
- Dispositivo USB (1.1 y 2.0).
|
||||
|
||||
|
||||
[ COMO USARLO ]:
|
||||
|
||||
1. Crea un directorio llamado "wad" en la raiz del dispositivo de almacenamiento.
|
||||
2. Copia todos los paquetes WAD en el directorio creado en el paso 1.
|
||||
3. Ejecuta la aplicacion con cualquier metodo para cargar homebrew.
|
||||
|
||||
|
||||
[ KUDOS ]:
|
||||
|
||||
- Team Twiizers/devkitPRO
|
||||
- svpe
|
||||
- kwiirk
|
||||
- Todos mis betatesters.
|
44
WadInstaller_Source/README.Orig.txt
Normal file
44
WadInstaller_Source/README.Orig.txt
Normal file
@ -0,0 +1,44 @@
|
||||
+----------------------------+
|
||||
| WAD Manager v1.4 |
|
||||
| developed by Waninkoko |
|
||||
+----------------------------+
|
||||
| www.teknoconsolas.es |
|
||||
+----------------------------+
|
||||
|
||||
|
||||
[ DISCLAIMER ]:
|
||||
|
||||
- THIS APPLICATION COMES WITH NO WARRANTY AT ALL, NEITHER EXPRESS NOR IMPLIED.
|
||||
I DO NOT TAKE ANY RESPONSIBILITY FOR ANY DAMAGE IN YOUR WII CONSOLE
|
||||
BECAUSE OF A IMPROPER USAGE OF THIS SOFTWARE.
|
||||
|
||||
|
||||
[ DESCRIPTION ]:
|
||||
|
||||
- WAD Manager is an application that allows you to (un)install
|
||||
WAD packages.
|
||||
|
||||
It lists all the available WAD packages in a storage device
|
||||
so you can select which one to (un)install.
|
||||
|
||||
|
||||
[ SUPPORTED DEVICES ]:
|
||||
|
||||
- SDGecko.
|
||||
- Internal SD slot (with SDHC support).
|
||||
- USB device (1.1 and 2.0).
|
||||
|
||||
|
||||
[ HOW TO USE ]:
|
||||
|
||||
1. Create a folder called "wad" in the root of the storage device.
|
||||
2. Copy all the WAD packages in the folder created in the step 1.
|
||||
3. Run the application with any method to load homebrew.
|
||||
|
||||
|
||||
[ KUDOS ]:
|
||||
|
||||
- Team Twiizers/devkitPRO
|
||||
- svpe
|
||||
- kwiirk
|
||||
- All my betatesters.
|
4
WadInstaller_Source/README.txt
Normal file
4
WadInstaller_Source/README.txt
Normal file
@ -0,0 +1,4 @@
|
||||
Modified wad manager used to install wads.
|
||||
|
||||
After compiling, search for text string AAAAAAAAAAAAAAAA in a hex editor
|
||||
to find where to inject the wad (it should overwrite the A's, not go after them)
|
BIN
WadInstaller_Source/data/background
Normal file
BIN
WadInstaller_Source/data/background
Normal file
Binary file not shown.
After Width: | Height: | Size: 122 KiB |
1
WadInstaller_Source/installer.pnproj
Normal file
1
WadInstaller_Source/installer.pnproj
Normal file
@ -0,0 +1 @@
|
||||
<Project name="installer"><File path="source\fat.h"></File><File path="source\gui.c"></File><File path="source\gui.h"></File><File path="source\install.c"></File><File path="source\install.h"></File><File path="source\menu.c"></File><File path="source\menu.h"></File><File path="source\restart.c"></File><File path="source\restart.h"></File><File path="source\sha1.c"></File><File path="source\sha1.h"></File><File path="source\stub.S"></File><File path="source\sys.c"></File><File path="source\sys.h"></File><File path="source\title.c"></File><File path="source\title.h"></File><File path="source\utils.h"></File><File path="source\video.c"></File><File path="source\video.h"></File><File path="source\wad.c"></File><File path="source\wad.h"></File><File path="source\wad-manager.c"></File><File path="source\wpad.c"></File><File path="source\wpad.h"></File><File path="source\fat.c"></File></Project>
|
1
WadInstaller_Source/installer.pnps
Normal file
1
WadInstaller_Source/installer.pnps
Normal file
@ -0,0 +1 @@
|
||||
<pd><ViewState><e p="installer" x="true"></e></ViewState></pd>
|
57
WadInstaller_Source/source/fat.c
Normal file
57
WadInstaller_Source/source/fat.c
Normal file
@ -0,0 +1,57 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ogcsys.h>
|
||||
|
||||
#include "fat.h"
|
||||
|
||||
|
||||
s32 Fat_Mount(fatDevice *dev)
|
||||
{
|
||||
s32 ret;
|
||||
|
||||
/* Initialize interface */
|
||||
ret = dev->interface->startup();
|
||||
if (!ret)
|
||||
return -1;
|
||||
|
||||
/* Mount device */
|
||||
ret = fatMountSimple(dev->mount, dev->interface);
|
||||
if (!ret)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Fat_Unmount(fatDevice *dev)
|
||||
{
|
||||
/* Unmount device */
|
||||
fatUnmount(dev->mount);
|
||||
|
||||
/* Shutdown interface */
|
||||
dev->interface->shutdown();
|
||||
}
|
||||
|
||||
char *Fat_ToFilename(const char *filename)
|
||||
{
|
||||
static char buffer[128];
|
||||
|
||||
u32 cnt, idx, len;
|
||||
|
||||
/* Clear buffer */
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
|
||||
/* Get filename length */
|
||||
len = strlen(filename);
|
||||
|
||||
for (cnt = idx = 0; idx < len; idx++) {
|
||||
char c = filename[idx];
|
||||
|
||||
/* Valid characters */
|
||||
if ( (c >= '#' && c <= ')') || (c >= '-' && c <= '.') ||
|
||||
(c >= '0' && c <= '9') || (c >= 'A' && c <= 'z') ||
|
||||
(c >= 'a' && c <= 'z') || (c == '!') )
|
||||
buffer[cnt++] = c;
|
||||
}
|
||||
|
||||
return buffer;
|
||||
}
|
41
WadInstaller_Source/source/fat.h
Normal file
41
WadInstaller_Source/source/fat.h
Normal file
@ -0,0 +1,41 @@
|
||||
#ifndef _FAT_H_
|
||||
#define _FAT_H_
|
||||
|
||||
/* libfat header */
|
||||
#include <fat.h>
|
||||
#include <sys/dir.h>
|
||||
|
||||
/* SD headers */
|
||||
#include <sdcard/gcsd.h>
|
||||
#include <sdcard/wiisd_io.h>
|
||||
|
||||
|
||||
/* 'FAT Device' structure */
|
||||
typedef struct {
|
||||
/* Device mount point */
|
||||
char *mount;
|
||||
|
||||
/* Device name */
|
||||
char *name;
|
||||
|
||||
/* Device interface */
|
||||
const DISC_INTERFACE *interface;
|
||||
} fatDevice;
|
||||
|
||||
/* 'FAT File' structure */
|
||||
typedef struct {
|
||||
/* Filename */
|
||||
char filename[128];
|
||||
|
||||
/* Filestat */
|
||||
struct stat filestat;
|
||||
} fatFile;
|
||||
|
||||
|
||||
/* Prototypes */
|
||||
s32 Fat_Mount(fatDevice *);
|
||||
void Fat_Unmount(fatDevice *);
|
||||
char *Fat_ToFilename(const char *);
|
||||
|
||||
#endif
|
||||
|
62
WadInstaller_Source/source/gui.c
Normal file
62
WadInstaller_Source/source/gui.c
Normal file
@ -0,0 +1,62 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <ogcsys.h>
|
||||
|
||||
#include "video.h"
|
||||
|
||||
/* Constants */
|
||||
#define CONSOLE_XCOORD 96
|
||||
#define CONSOLE_YCOORD 118
|
||||
#define CONSOLE_WIDTH 496
|
||||
#define CONSOLE_HEIGHT 236
|
||||
|
||||
|
||||
s32 __Gui_DrawPng(void *img, u32 x, u32 y)
|
||||
{
|
||||
IMGCTX ctx = NULL;
|
||||
PNGUPROP imgProp;
|
||||
|
||||
s32 ret;
|
||||
|
||||
/* Select PNG data */
|
||||
ctx = PNGU_SelectImageFromBuffer(img);
|
||||
if (!ctx) {
|
||||
ret = -1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Get image properties */
|
||||
ret = PNGU_GetImageProperties(ctx, &imgProp);
|
||||
if (ret != PNGU_OK) {
|
||||
ret = -1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Draw image */
|
||||
Video_DrawPng(ctx, imgProp, x, y);
|
||||
|
||||
/* Success */
|
||||
ret = 0;
|
||||
|
||||
out:
|
||||
/* Free memory */
|
||||
if (ctx)
|
||||
PNGU_ReleaseImageContext(ctx);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void Gui_InitConsole(void)
|
||||
{
|
||||
/* Initialize console */
|
||||
Con_Init(CONSOLE_XCOORD, CONSOLE_YCOORD, CONSOLE_WIDTH, CONSOLE_HEIGHT);
|
||||
}
|
||||
|
||||
void Gui_DrawBackground(void)
|
||||
{
|
||||
extern char bgData[];
|
||||
|
||||
/* Draw background */
|
||||
__Gui_DrawPng(bgData, 0, 0);
|
||||
}
|
8
WadInstaller_Source/source/gui.h
Normal file
8
WadInstaller_Source/source/gui.h
Normal file
@ -0,0 +1,8 @@
|
||||
#ifndef _GUI_H_
|
||||
#define _GUI_H_
|
||||
|
||||
/* Prototypes */
|
||||
void Gui_InitConsole(void);
|
||||
void Gui_DrawBackground(void);
|
||||
|
||||
#endif
|
2
WadInstaller_Source/source/install.c
Normal file
2
WadInstaller_Source/source/install.c
Normal file
@ -0,0 +1,2 @@
|
||||
const unsigned char install[8<<20] = {0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0};
|
||||
const int install_size = sizeof(install);
|
14
WadInstaller_Source/source/install.h
Normal file
14
WadInstaller_Source/source/install.h
Normal file
@ -0,0 +1,14 @@
|
||||
/*
|
||||
This file was autogenerated by raw2c.
|
||||
Visit http://www.devkitpro.org
|
||||
*/
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
#ifndef _install_h_
|
||||
#define _install_h_
|
||||
//---------------------------------------------------------------------------------
|
||||
extern const unsigned char install[];
|
||||
extern const int install_size;
|
||||
//---------------------------------------------------------------------------------
|
||||
#endif //_install_h_
|
||||
//---------------------------------------------------------------------------------
|
3569
WadInstaller_Source/source/libpng/png.h
Normal file
3569
WadInstaller_Source/source/libpng/png.h
Normal file
File diff suppressed because it is too large
Load Diff
1481
WadInstaller_Source/source/libpng/pngconf.h
Normal file
1481
WadInstaller_Source/source/libpng/pngconf.h
Normal file
File diff suppressed because it is too large
Load Diff
1132
WadInstaller_Source/source/libpng/pngu/pngu.c
Normal file
1132
WadInstaller_Source/source/libpng/pngu/pngu.c
Normal file
File diff suppressed because it is too large
Load Diff
171
WadInstaller_Source/source/libpng/pngu/pngu.h
Normal file
171
WadInstaller_Source/source/libpng/pngu/pngu.h
Normal file
@ -0,0 +1,171 @@
|
||||
/********************************************************************************************
|
||||
|
||||
PNGU Version : 0.2a
|
||||
|
||||
Coder : frontier
|
||||
|
||||
More info : http://frontier-dev.net
|
||||
|
||||
********************************************************************************************/
|
||||
#ifndef __PNGU__
|
||||
#define __PNGU__
|
||||
|
||||
// Return codes
|
||||
#define PNGU_OK 0
|
||||
#define PNGU_ODD_WIDTH 1
|
||||
#define PNGU_ODD_STRIDE 2
|
||||
#define PNGU_INVALID_WIDTH_OR_HEIGHT 3
|
||||
#define PNGU_FILE_IS_NOT_PNG 4
|
||||
#define PNGU_UNSUPPORTED_COLOR_TYPE 5
|
||||
#define PNGU_NO_FILE_SELECTED 6
|
||||
#define PNGU_CANT_OPEN_FILE 7
|
||||
#define PNGU_CANT_READ_FILE 8
|
||||
#define PNGU_LIB_ERROR 9
|
||||
|
||||
// Color types
|
||||
#define PNGU_COLOR_TYPE_GRAY 1
|
||||
#define PNGU_COLOR_TYPE_GRAY_ALPHA 2
|
||||
#define PNGU_COLOR_TYPE_PALETTE 3
|
||||
#define PNGU_COLOR_TYPE_RGB 4
|
||||
#define PNGU_COLOR_TYPE_RGB_ALPHA 5
|
||||
#define PNGU_COLOR_TYPE_UNKNOWN 6
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Types
|
||||
typedef unsigned char PNGU_u8;
|
||||
typedef unsigned short PNGU_u16;
|
||||
typedef unsigned int PNGU_u32;
|
||||
typedef unsigned long long PNGU_u64;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
PNGU_u8 r;
|
||||
PNGU_u8 g;
|
||||
PNGU_u8 b;
|
||||
} PNGUCOLOR;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
PNGU_u32 imgWidth; // In pixels
|
||||
PNGU_u32 imgHeight; // In pixels
|
||||
PNGU_u32 imgBitDepth; // In bitx
|
||||
PNGU_u32 imgColorType; // PNGU_COLOR_TYPE_*
|
||||
PNGU_u32 validBckgrnd; // Non zero if there is a background color
|
||||
PNGUCOLOR bckgrnd; // Backgroun color
|
||||
PNGU_u32 numTrans; // Number of transparent colors
|
||||
PNGUCOLOR *trans; // Transparent colors
|
||||
} PNGUPROP;
|
||||
|
||||
// Image context, always initialize with SelectImageFrom* and free with ReleaseImageContext
|
||||
struct _IMGCTX;
|
||||
typedef struct _IMGCTX *IMGCTX;
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Pixel conversion *
|
||||
****************************************************************************/
|
||||
|
||||
// Macro to convert RGB8 values to RGB565
|
||||
#define PNGU_RGB8_TO_RGB565(r,g,b) ( ((((PNGU_u16) r) & 0xF8U) << 8) | ((((PNGU_u16) g) & 0xFCU) << 3) | (((PNGU_u16) b) >> 3) )
|
||||
|
||||
// Macro to convert RGBA8 values to RGB5A3
|
||||
#define PNGU_RGB8_TO_RGB5A3(r,g,b,a) (PNGU_u16) (((a & 0xE0U) == 0xE0U) ? \
|
||||
(0x8000U | ((((PNGU_u16) r) & 0xF8U) << 7) | ((((PNGU_u16) g) & 0xF8U) << 2) | (((PNGU_u16) b) >> 3)) : \
|
||||
(((((PNGU_u16) a) & 0xE0U) << 7) | ((((PNGU_u16) r) & 0xF0U) << 4) | (((PNGU_u16) g) & 0xF0U) | ((((PNGU_u16) b) & 0xF0U) >> 4)))
|
||||
|
||||
// Function to convert two RGB8 values to YCbYCr
|
||||
PNGU_u32 PNGU_RGB8_TO_YCbYCr (PNGU_u8 r1, PNGU_u8 g1, PNGU_u8 b1, PNGU_u8 r2, PNGU_u8 g2, PNGU_u8 b2);
|
||||
|
||||
// Function to convert an YCbYCr to two RGB8 values.
|
||||
void PNGU_YCbYCr_TO_RGB8 (PNGU_u32 ycbycr, PNGU_u8 *r1, PNGU_u8 *g1, PNGU_u8 *b1, PNGU_u8 *r2, PNGU_u8 *g2, PNGU_u8 *b2);
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Image context handling *
|
||||
****************************************************************************/
|
||||
|
||||
// Selects a PNG file, previosly loaded into a buffer, and creates an image context for subsequent procesing.
|
||||
IMGCTX PNGU_SelectImageFromBuffer (const void *buffer);
|
||||
|
||||
// Selects a PNG file, from any devoptab device, and creates an image context for subsequent procesing.
|
||||
IMGCTX PNGU_SelectImageFromDevice (const char *filename);
|
||||
|
||||
// Frees resources associated with an image context. Always call this function when you no longer need the IMGCTX.
|
||||
void PNGU_ReleaseImageContext (IMGCTX ctx);
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Miscelaneous *
|
||||
****************************************************************************/
|
||||
|
||||
// Retrieves info from selected PNG file, including image dimensions, color format, background and transparency colors.
|
||||
int PNGU_GetImageProperties (IMGCTX ctx, PNGUPROP *fileproperties);
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Image conversion *
|
||||
****************************************************************************/
|
||||
|
||||
// Expands selected image into an YCbYCr buffer. You need to specify context, image dimensions,
|
||||
// destination address and stride in pixels (stride = buffer width - image width).
|
||||
int PNGU_DecodeToYCbYCr (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, void *buffer, PNGU_u32 stride);
|
||||
|
||||
// Macro for decoding an image inside a buffer at given coordinates.
|
||||
#define PNGU_DECODE_TO_COORDS_YCbYCr(ctx,coordX,coordY,imgWidth,imgHeight,bufferWidth,bufferHeight,buffer) \
|
||||
\
|
||||
PNGU_DecodeToYCbYCr (ctx, imgWidth, imgHeight, ((void *) buffer) + (coordY) * (bufferWidth) * 2 + \
|
||||
(coordX) * 2, (bufferWidth) - (imgWidth))
|
||||
|
||||
// Expands selected image into a linear RGB565 buffer. You need to specify context, image dimensions,
|
||||
// destination address and stride in pixels (stride = buffer width - image width).
|
||||
int PNGU_DecodeToRGB565 (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, void *buffer, PNGU_u32 stride);
|
||||
|
||||
// Macro for decoding an image inside a buffer at given coordinates.
|
||||
#define PNGU_DECODE_TO_COORDS_RGB565(ctx,coordX,coordY,imgWidth,imgHeight,bufferWidth,bufferHeight,buffer) \
|
||||
\
|
||||
PNGU_DecodeToRGB565 (ctx, imgWidth, imgHeight, ((void *) buffer) + (coordY) * (bufferWidth) * 2 + \
|
||||
(coordX) * 2, (bufferWidth) - (imgWidth))
|
||||
|
||||
// Expands selected image into a linear RGBA8 buffer. You need to specify context, image dimensions,
|
||||
// destination address, stride in pixels and default alpha value, which is used if the source image
|
||||
// doesn't have an alpha channel.
|
||||
int PNGU_DecodeToRGBA8 (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, void *buffer, PNGU_u32 stride, PNGU_u8 default_alpha);
|
||||
|
||||
// Macro for decoding an image inside a buffer at given coordinates.
|
||||
#define PNGU_DECODE_TO_COORDS_RGBA8(ctx,coordX,coordY,imgWidth,imgHeight,default_alpha,bufferWidth,bufferHeight,buffer) \
|
||||
\
|
||||
PNGU_DecodeToRGBA8 (ctx, imgWidth, imgHeight, ((void *) buffer) + (coordY) * (bufferWidth) * 2 + \
|
||||
(coordX) * 2, (bufferWidth) - (imgWidth), default_alpha)
|
||||
|
||||
// Expands selected image into a 4x4 tiled RGB565 buffer. You need to specify context, image dimensions
|
||||
// and destination address.
|
||||
int PNGU_DecodeTo4x4RGB565 (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, void *buffer);
|
||||
|
||||
// Expands selected image into a 4x4 tiled RGB5A3 buffer. You need to specify context, image dimensions,
|
||||
// destination address and default alpha value, which is used if the source image doesn't have an alpha channel.
|
||||
int PNGU_DecodeTo4x4RGB5A3 (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, void *buffer, PNGU_u8 default_alpha);
|
||||
|
||||
// Expands selected image into a 4x4 tiled RGBA8 buffer. You need to specify context, image dimensions,
|
||||
// destination address and default alpha value, which is used if the source image doesn't have an alpha channel.
|
||||
int PNGU_DecodeTo4x4RGBA8 (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, void *buffer, PNGU_u8 default_alpha);
|
||||
|
||||
// Encodes an YCbYCr image in PNG format and stores it in the selected device or memory buffer. You need to
|
||||
// specify context, image dimensions, destination address and stride in pixels (stride = buffer width - image width).
|
||||
int PNGU_EncodeFromYCbYCr (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, void *buffer, PNGU_u32 stride);
|
||||
|
||||
// Macro for encoding an image stored into an YCbYCr buffer at given coordinates.
|
||||
#define PNGU_ENCODE_TO_COORDS_YCbYCr(ctx,coordX,coordY,imgWidth,imgHeight,bufferWidth,bufferHeight,buffer) \
|
||||
\
|
||||
PNGU_EncodeFromYCbYCr (ctx, imgWidth, imgHeight, ((void *) buffer) + (coordY) * (bufferWidth) * 2 + \
|
||||
(coordX) * 2, (bufferWidth) - (imgWidth))
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
36
WadInstaller_Source/source/menu.c
Normal file
36
WadInstaller_Source/source/menu.c
Normal file
@ -0,0 +1,36 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <malloc.h>
|
||||
#include <ogcsys.h>
|
||||
|
||||
#include "fat.h"
|
||||
#include "restart.h"
|
||||
#include "title.h"
|
||||
#include "utils.h"
|
||||
#include "video.h"
|
||||
#include "wad.h"
|
||||
#include "wpad.h"
|
||||
|
||||
/* Constants */
|
||||
#define CIOS_VERSION 249
|
||||
|
||||
void LoadSelectedIOS()
|
||||
{
|
||||
u8 selectedIOS = Wad_SelectIOS();
|
||||
|
||||
s32 ret;
|
||||
ret = IOS_ReloadIOS(selectedIOS);
|
||||
if (ret<0)
|
||||
{
|
||||
printf("\nUsing default IOS");
|
||||
} else
|
||||
{
|
||||
printf("\nUsing selected IOS %d\n", selectedIOS);
|
||||
}
|
||||
}
|
||||
|
||||
void Menu_Loop(void)
|
||||
{
|
||||
Wad_InstallFromMemory();
|
||||
}
|
9
WadInstaller_Source/source/menu.h
Normal file
9
WadInstaller_Source/source/menu.h
Normal file
@ -0,0 +1,9 @@
|
||||
#ifndef _MENU_H_
|
||||
#define _MENU_H_
|
||||
|
||||
/* Prototypes */
|
||||
void Menu_Loop(void);
|
||||
void LoadSelectedIOS(void);
|
||||
|
||||
#endif
|
||||
|
33
WadInstaller_Source/source/restart.c
Normal file
33
WadInstaller_Source/source/restart.c
Normal file
@ -0,0 +1,33 @@
|
||||
#include <stdio.h>
|
||||
#include <ogcsys.h>
|
||||
|
||||
#include "sys.h"
|
||||
#include "wpad.h"
|
||||
|
||||
|
||||
void Restart(void)
|
||||
{
|
||||
printf("\n Restarting Wii...");
|
||||
fflush(stdout);
|
||||
|
||||
/* Load system menu */
|
||||
Sys_LoadMenu();
|
||||
}
|
||||
|
||||
void Restart_Wait(void)
|
||||
{
|
||||
printf("\n");
|
||||
|
||||
printf(" Press any button to restart...");
|
||||
fflush(stdout);
|
||||
|
||||
/* Wait for button */
|
||||
Wpad_WaitButtons();
|
||||
|
||||
printf(" Restarting Wii...");
|
||||
fflush(stdout);
|
||||
|
||||
/* Load system menu */
|
||||
Sys_LoadMenu();
|
||||
}
|
||||
|
8
WadInstaller_Source/source/restart.h
Normal file
8
WadInstaller_Source/source/restart.h
Normal file
@ -0,0 +1,8 @@
|
||||
#ifndef _RESTART_H_
|
||||
#define _RESTART_H_
|
||||
|
||||
/* Prototypes */
|
||||
void Restart(void);
|
||||
void Restart_Wait(void);
|
||||
|
||||
#endif
|
172
WadInstaller_Source/source/sha1.c
Normal file
172
WadInstaller_Source/source/sha1.c
Normal file
@ -0,0 +1,172 @@
|
||||
/*
|
||||
SHA-1 in C
|
||||
By Steve Reid <steve@edmweb.com>
|
||||
100% Public Domain
|
||||
|
||||
Test Vectors (from FIPS PUB 180-1)
|
||||
"abc"
|
||||
A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D
|
||||
"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"
|
||||
84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1
|
||||
A million repetitions of "a"
|
||||
34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F
|
||||
*/
|
||||
|
||||
/* #define LITTLE_ENDIAN * This should be #define'd if true. */
|
||||
#define SHA1HANDSOFF
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "sha1.h"
|
||||
|
||||
#define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits))))
|
||||
|
||||
/* blk0() and blk() perform the initial expand. */
|
||||
/* I got the idea of expanding during the round function from SSLeay */
|
||||
#ifdef LITTLE_ENDIAN
|
||||
#define blk0(i) (block->l[i] = (rol(block->l[i],24)&0xFF00FF00) \
|
||||
|(rol(block->l[i],8)&0x00FF00FF))
|
||||
#else
|
||||
#define blk0(i) block->l[i]
|
||||
#endif
|
||||
#define blk(i) (block->l[i&15] = rol(block->l[(i+13)&15]^block->l[(i+8)&15] \
|
||||
^block->l[(i+2)&15]^block->l[i&15],1))
|
||||
|
||||
/* (R0+R1), R2, R3, R4 are the different operations used in SHA1 */
|
||||
#define R0(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk0(i)+0x5A827999+rol(v,5);w=rol(w,30);
|
||||
#define R1(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk(i)+0x5A827999+rol(v,5);w=rol(w,30);
|
||||
#define R2(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0x6ED9EBA1+rol(v,5);w=rol(w,30);
|
||||
#define R3(v,w,x,y,z,i) z+=(((w|x)&y)|(w&x))+blk(i)+0x8F1BBCDC+rol(v,5);w=rol(w,30);
|
||||
#define R4(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0xCA62C1D6+rol(v,5);w=rol(w,30);
|
||||
|
||||
|
||||
/* Hash a single 512-bit block. This is the core of the algorithm. */
|
||||
|
||||
void SHA1Transform(unsigned long state[5], unsigned char buffer[64])
|
||||
{
|
||||
unsigned long a, b, c, d, e;
|
||||
typedef union {
|
||||
unsigned char c[64];
|
||||
unsigned long l[16];
|
||||
} CHAR64LONG16;
|
||||
CHAR64LONG16* block;
|
||||
#ifdef SHA1HANDSOFF
|
||||
static unsigned char workspace[64];
|
||||
block = (CHAR64LONG16*)workspace;
|
||||
memcpy(block, buffer, 64);
|
||||
#else
|
||||
block = (CHAR64LONG16*)buffer;
|
||||
#endif
|
||||
/* Copy context->state[] to working vars */
|
||||
a = state[0];
|
||||
b = state[1];
|
||||
c = state[2];
|
||||
d = state[3];
|
||||
e = state[4];
|
||||
/* 4 rounds of 20 operations each. Loop unrolled. */
|
||||
R0(a,b,c,d,e, 0); R0(e,a,b,c,d, 1); R0(d,e,a,b,c, 2); R0(c,d,e,a,b, 3);
|
||||
R0(b,c,d,e,a, 4); R0(a,b,c,d,e, 5); R0(e,a,b,c,d, 6); R0(d,e,a,b,c, 7);
|
||||
R0(c,d,e,a,b, 8); R0(b,c,d,e,a, 9); R0(a,b,c,d,e,10); R0(e,a,b,c,d,11);
|
||||
R0(d,e,a,b,c,12); R0(c,d,e,a,b,13); R0(b,c,d,e,a,14); R0(a,b,c,d,e,15);
|
||||
R1(e,a,b,c,d,16); R1(d,e,a,b,c,17); R1(c,d,e,a,b,18); R1(b,c,d,e,a,19);
|
||||
R2(a,b,c,d,e,20); R2(e,a,b,c,d,21); R2(d,e,a,b,c,22); R2(c,d,e,a,b,23);
|
||||
R2(b,c,d,e,a,24); R2(a,b,c,d,e,25); R2(e,a,b,c,d,26); R2(d,e,a,b,c,27);
|
||||
R2(c,d,e,a,b,28); R2(b,c,d,e,a,29); R2(a,b,c,d,e,30); R2(e,a,b,c,d,31);
|
||||
R2(d,e,a,b,c,32); R2(c,d,e,a,b,33); R2(b,c,d,e,a,34); R2(a,b,c,d,e,35);
|
||||
R2(e,a,b,c,d,36); R2(d,e,a,b,c,37); R2(c,d,e,a,b,38); R2(b,c,d,e,a,39);
|
||||
R3(a,b,c,d,e,40); R3(e,a,b,c,d,41); R3(d,e,a,b,c,42); R3(c,d,e,a,b,43);
|
||||
R3(b,c,d,e,a,44); R3(a,b,c,d,e,45); R3(e,a,b,c,d,46); R3(d,e,a,b,c,47);
|
||||
R3(c,d,e,a,b,48); R3(b,c,d,e,a,49); R3(a,b,c,d,e,50); R3(e,a,b,c,d,51);
|
||||
R3(d,e,a,b,c,52); R3(c,d,e,a,b,53); R3(b,c,d,e,a,54); R3(a,b,c,d,e,55);
|
||||
R3(e,a,b,c,d,56); R3(d,e,a,b,c,57); R3(c,d,e,a,b,58); R3(b,c,d,e,a,59);
|
||||
R4(a,b,c,d,e,60); R4(e,a,b,c,d,61); R4(d,e,a,b,c,62); R4(c,d,e,a,b,63);
|
||||
R4(b,c,d,e,a,64); R4(a,b,c,d,e,65); R4(e,a,b,c,d,66); R4(d,e,a,b,c,67);
|
||||
R4(c,d,e,a,b,68); R4(b,c,d,e,a,69); R4(a,b,c,d,e,70); R4(e,a,b,c,d,71);
|
||||
R4(d,e,a,b,c,72); R4(c,d,e,a,b,73); R4(b,c,d,e,a,74); R4(a,b,c,d,e,75);
|
||||
R4(e,a,b,c,d,76); R4(d,e,a,b,c,77); R4(c,d,e,a,b,78); R4(b,c,d,e,a,79);
|
||||
/* Add the working vars back into context.state[] */
|
||||
state[0] += a;
|
||||
state[1] += b;
|
||||
state[2] += c;
|
||||
state[3] += d;
|
||||
state[4] += e;
|
||||
/* Wipe variables */
|
||||
a = b = c = d = e = 0;
|
||||
}
|
||||
|
||||
|
||||
/* SHA1Init - Initialize new context */
|
||||
|
||||
void SHA1Init(SHA1_CTX* context)
|
||||
{
|
||||
/* SHA1 initialization constants */
|
||||
context->state[0] = 0x67452301;
|
||||
context->state[1] = 0xEFCDAB89;
|
||||
context->state[2] = 0x98BADCFE;
|
||||
context->state[3] = 0x10325476;
|
||||
context->state[4] = 0xC3D2E1F0;
|
||||
context->count[0] = context->count[1] = 0;
|
||||
}
|
||||
|
||||
|
||||
/* Run your data through this. */
|
||||
|
||||
void SHA1Update(SHA1_CTX* context, unsigned char* data, unsigned int len)
|
||||
{
|
||||
unsigned int i, j;
|
||||
|
||||
j = (context->count[0] >> 3) & 63;
|
||||
if ((context->count[0] += len << 3) < (len << 3)) context->count[1]++;
|
||||
context->count[1] += (len >> 29);
|
||||
if ((j + len) > 63) {
|
||||
memcpy(&context->buffer[j], data, (i = 64-j));
|
||||
SHA1Transform(context->state, context->buffer);
|
||||
for ( ; i + 63 < len; i += 64) {
|
||||
SHA1Transform(context->state, &data[i]);
|
||||
}
|
||||
j = 0;
|
||||
}
|
||||
else i = 0;
|
||||
memcpy(&context->buffer[j], &data[i], len - i);
|
||||
}
|
||||
|
||||
|
||||
/* Add padding and return the message digest. */
|
||||
|
||||
void SHA1Final(unsigned char digest[20], SHA1_CTX* context)
|
||||
{
|
||||
unsigned long i, j;
|
||||
unsigned char finalcount[8];
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
finalcount[i] = (unsigned char)((context->count[(i >= 4 ? 0 : 1)]
|
||||
>> ((3-(i & 3)) * 8) ) & 255); /* Endian independent */
|
||||
}
|
||||
SHA1Update(context, (unsigned char *)"\200", 1);
|
||||
while ((context->count[0] & 504) != 448) {
|
||||
SHA1Update(context, (unsigned char *)"\0", 1);
|
||||
}
|
||||
SHA1Update(context, finalcount, 8); /* Should cause a SHA1Transform() */
|
||||
for (i = 0; i < 20; i++) {
|
||||
digest[i] = (unsigned char)
|
||||
((context->state[i>>2] >> ((3-(i & 3)) * 8) ) & 255);
|
||||
}
|
||||
/* Wipe variables */
|
||||
i = j = 0;
|
||||
memset(context->buffer, 0, 64);
|
||||
memset(context->state, 0, 20);
|
||||
memset(context->count, 0, 8);
|
||||
memset(&finalcount, 0, 8);
|
||||
#ifdef SHA1HANDSOFF /* make SHA1Transform overwrite it's own static vars */
|
||||
SHA1Transform(context->state, context->buffer);
|
||||
#endif
|
||||
}
|
||||
|
||||
void SHA1(unsigned char *ptr, unsigned int size, unsigned char *outbuf) {
|
||||
SHA1_CTX ctx;
|
||||
|
||||
SHA1Init(&ctx);
|
||||
SHA1Update(&ctx, ptr, size);
|
||||
SHA1Final(outbuf, &ctx);
|
||||
}
|
||||
|
12
WadInstaller_Source/source/sha1.h
Normal file
12
WadInstaller_Source/source/sha1.h
Normal file
@ -0,0 +1,12 @@
|
||||
typedef struct {
|
||||
unsigned long state[5];
|
||||
unsigned long count[2];
|
||||
unsigned char buffer[64];
|
||||
} SHA1_CTX;
|
||||
|
||||
void SHA1Transform(unsigned long state[5], unsigned char buffer[64]);
|
||||
void SHA1Init(SHA1_CTX* context);
|
||||
void SHA1Update(SHA1_CTX* context, unsigned char* data, unsigned int len);
|
||||
void SHA1Final(unsigned char digest[20], SHA1_CTX* context);
|
||||
|
||||
void SHA1(unsigned char *ptr, unsigned int size, unsigned char *outbuf);
|
6
WadInstaller_Source/source/stub.S
Normal file
6
WadInstaller_Source/source/stub.S
Normal file
@ -0,0 +1,6 @@
|
||||
.rodata
|
||||
|
||||
.globl bgData
|
||||
.balign 32
|
||||
bgData:
|
||||
.incbin "../data/background"
|
98
WadInstaller_Source/source/sys.c
Normal file
98
WadInstaller_Source/source/sys.c
Normal file
@ -0,0 +1,98 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <ogcsys.h>
|
||||
|
||||
#include "sys.h"
|
||||
|
||||
/* Constants */
|
||||
#define CERTS_LEN 0x280
|
||||
|
||||
/* Variables */
|
||||
static const char certs_fs[] ATTRIBUTE_ALIGN(32) = "/sys/cert.sys";
|
||||
|
||||
|
||||
void __Sys_ResetCallback(void)
|
||||
{
|
||||
/* Reboot console */
|
||||
Sys_Reboot();
|
||||
}
|
||||
|
||||
void __Sys_PowerCallback(void)
|
||||
{
|
||||
/* Poweroff console */
|
||||
Sys_Shutdown();
|
||||
}
|
||||
|
||||
|
||||
void Sys_Init(void)
|
||||
{
|
||||
/* Initialize video subsytem */
|
||||
VIDEO_Init();
|
||||
|
||||
/* Set RESET/POWER button callback */
|
||||
SYS_SetResetCallback(__Sys_ResetCallback);
|
||||
SYS_SetPowerCallback(__Sys_PowerCallback);
|
||||
}
|
||||
|
||||
void Sys_Reboot(void)
|
||||
{
|
||||
/* Restart console */
|
||||
STM_RebootSystem();
|
||||
}
|
||||
|
||||
void Sys_Shutdown(void)
|
||||
{
|
||||
/* Poweroff console */
|
||||
if(CONF_GetShutdownMode() == CONF_SHUTDOWN_IDLE) {
|
||||
s32 ret;
|
||||
|
||||
/* Set LED mode */
|
||||
ret = CONF_GetIdleLedMode();
|
||||
if(ret >= 0 && ret <= 2)
|
||||
STM_SetLedMode(ret);
|
||||
|
||||
/* Shutdown to idle */
|
||||
STM_ShutdownToIdle();
|
||||
} else {
|
||||
/* Shutdown to standby */
|
||||
STM_ShutdownToStandby();
|
||||
}
|
||||
}
|
||||
|
||||
void Sys_LoadMenu(void)
|
||||
{
|
||||
u32 *stub = (u32 *)0x80001800;
|
||||
|
||||
/* Homebrew Channel stub */
|
||||
if (*stub)
|
||||
exit(0);
|
||||
|
||||
/* Return to the Wii system menu */
|
||||
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
|
||||
}
|
||||
|
||||
s32 Sys_GetCerts(signed_blob **certs, u32 *len)
|
||||
{
|
||||
static signed_blob certificates[CERTS_LEN] ATTRIBUTE_ALIGN(32);
|
||||
|
||||
s32 fd, ret;
|
||||
|
||||
/* Open certificates file */
|
||||
fd = IOS_Open(certs_fs, 1);
|
||||
if (fd < 0)
|
||||
return fd;
|
||||
|
||||
/* Read certificates */
|
||||
ret = IOS_Read(fd, certificates, sizeof(certificates));
|
||||
|
||||
/* Close file */
|
||||
IOS_Close(fd);
|
||||
|
||||
/* Set values */
|
||||
if (ret > 0) {
|
||||
*certs = certificates;
|
||||
*len = sizeof(certificates);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
11
WadInstaller_Source/source/sys.h
Normal file
11
WadInstaller_Source/source/sys.h
Normal file
@ -0,0 +1,11 @@
|
||||
#ifndef _SYS_H_
|
||||
#define _SYS_H_
|
||||
|
||||
/* Prototypes */
|
||||
void Sys_Init(void);
|
||||
void Sys_Reboot(void);
|
||||
void Sys_Shutdown(void);
|
||||
void Sys_LoadMenu(void);
|
||||
s32 Sys_GetCerts(signed_blob **, u32 *);
|
||||
|
||||
#endif
|
256
WadInstaller_Source/source/title.c
Normal file
256
WadInstaller_Source/source/title.c
Normal file
@ -0,0 +1,256 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <malloc.h>
|
||||
#include <ogcsys.h>
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
|
||||
s32 Title_GetList(u64 **outbuf, u32 *outlen)
|
||||
{
|
||||
u64 *titles = NULL;
|
||||
|
||||
u32 len, nb_titles;
|
||||
s32 ret;
|
||||
|
||||
/* Get number of titles */
|
||||
ret = ES_GetNumTitles(&nb_titles);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* Calculate buffer lenght */
|
||||
len = round_up(sizeof(u64) * nb_titles, 32);
|
||||
|
||||
/* Allocate memory */
|
||||
titles = memalign(32, len);
|
||||
if (!titles)
|
||||
return -1;
|
||||
|
||||
/* Get titles */
|
||||
ret = ES_GetTitles(titles, nb_titles);
|
||||
if (ret < 0)
|
||||
goto err;
|
||||
|
||||
/* Set values */
|
||||
*outbuf = titles;
|
||||
*outlen = nb_titles;
|
||||
|
||||
return 0;
|
||||
|
||||
err:
|
||||
/* Free memory */
|
||||
if (titles)
|
||||
free(titles);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
s32 Title_GetTicketViews(u64 tid, tikview **outbuf, u32 *outlen)
|
||||
{
|
||||
tikview *views = NULL;
|
||||
|
||||
u32 nb_views;
|
||||
s32 ret;
|
||||
|
||||
/* Get number of ticket views */
|
||||
ret = ES_GetNumTicketViews(tid, &nb_views);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* Allocate memory */
|
||||
views = (tikview *)memalign(32, sizeof(tikview) * nb_views);
|
||||
if (!views)
|
||||
return -1;
|
||||
|
||||
/* Get ticket views */
|
||||
ret = ES_GetTicketViews(tid, views, nb_views);
|
||||
if (ret < 0)
|
||||
goto err;
|
||||
|
||||
/* Set values */
|
||||
*outbuf = views;
|
||||
*outlen = nb_views;
|
||||
|
||||
return 0;
|
||||
|
||||
err:
|
||||
/* Free memory */
|
||||
if (views)
|
||||
free(views);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
s32 Title_GetTMD(u64 tid, signed_blob **outbuf, u32 *outlen)
|
||||
{
|
||||
void *p_tmd = NULL;
|
||||
|
||||
u32 len;
|
||||
s32 ret;
|
||||
|
||||
/* Get TMD size */
|
||||
ret = ES_GetStoredTMDSize(tid, &len);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* Allocate memory */
|
||||
p_tmd = memalign(32, round_up(len, 32));
|
||||
if (!p_tmd)
|
||||
return -1;
|
||||
|
||||
/* Read TMD */
|
||||
ret = ES_GetStoredTMD(tid, p_tmd, len);
|
||||
if (ret < 0)
|
||||
goto err;
|
||||
|
||||
/* Set values */
|
||||
*outbuf = p_tmd;
|
||||
*outlen = len;
|
||||
|
||||
return 0;
|
||||
|
||||
err:
|
||||
/* Free memory */
|
||||
if (p_tmd)
|
||||
free(p_tmd);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
s32 Title_GetVersion(u64 tid, u16 *outbuf)
|
||||
{
|
||||
signed_blob *p_tmd = NULL;
|
||||
tmd *tmd_data = NULL;
|
||||
|
||||
u32 len;
|
||||
s32 ret;
|
||||
|
||||
/* Get title TMD */
|
||||
ret = Title_GetTMD(tid, &p_tmd, &len);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* Retrieve TMD info */
|
||||
tmd_data = (tmd *)SIGNATURE_PAYLOAD(p_tmd);
|
||||
|
||||
/* Set values */
|
||||
*outbuf = tmd_data->title_version;
|
||||
|
||||
/* Free memory */
|
||||
free(p_tmd);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 Title_GetSysVersion(u64 tid, u64 *outbuf)
|
||||
{
|
||||
signed_blob *p_tmd = NULL;
|
||||
tmd *tmd_data = NULL;
|
||||
|
||||
u32 len;
|
||||
s32 ret;
|
||||
|
||||
/* Get title TMD */
|
||||
ret = Title_GetTMD(tid, &p_tmd, &len);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* Retrieve TMD info */
|
||||
tmd_data = (tmd *)SIGNATURE_PAYLOAD(p_tmd);
|
||||
|
||||
/* Set values */
|
||||
*outbuf = tmd_data->sys_version;
|
||||
|
||||
/* Free memory */
|
||||
free(p_tmd);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 Title_GetSize(u64 tid, u32 *outbuf)
|
||||
{
|
||||
signed_blob *p_tmd = NULL;
|
||||
tmd *tmd_data = NULL;
|
||||
|
||||
u32 cnt, len, size = 0;
|
||||
s32 ret;
|
||||
|
||||
/* Get title TMD */
|
||||
ret = Title_GetTMD(tid, &p_tmd, &len);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* Retrieve TMD info */
|
||||
tmd_data = (tmd *)SIGNATURE_PAYLOAD(p_tmd);
|
||||
|
||||
/* Calculate title size */
|
||||
for (cnt = 0; cnt < tmd_data->num_contents; cnt++) {
|
||||
tmd_content *content = &tmd_data->contents[cnt];
|
||||
|
||||
/* Add content size */
|
||||
size += content->size;
|
||||
}
|
||||
|
||||
/* Set values */
|
||||
*outbuf = size;
|
||||
|
||||
/* Free memory */
|
||||
free(p_tmd);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 Title_GetIOSVersions(u8 **outbuf, u32 *outlen)
|
||||
{
|
||||
u8 *buffer = NULL;
|
||||
u64 *list = NULL;
|
||||
|
||||
u32 count, cnt, idx;
|
||||
s32 ret;
|
||||
|
||||
/* Get title list */
|
||||
ret = Title_GetList(&list, &count);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* Count IOS */
|
||||
for (cnt = idx = 0; idx < count; idx++) {
|
||||
u32 tidh = (list[idx] >> 32);
|
||||
u32 tidl = (list[idx] & 0xFFFFFFFF);
|
||||
|
||||
/* Title is IOS */
|
||||
if ((tidh == 0x1) && (tidl >= 3) && (tidl <= 255))
|
||||
cnt++;
|
||||
}
|
||||
|
||||
/* Allocate memory */
|
||||
buffer = (u8 *)memalign(32, cnt);
|
||||
if (!buffer) {
|
||||
ret = -1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Copy IOS */
|
||||
for (cnt = idx = 0; idx < count; idx++) {
|
||||
u32 tidh = (list[idx] >> 32);
|
||||
u32 tidl = (list[idx] & 0xFFFFFFFF);
|
||||
|
||||
/* Title is IOS */
|
||||
if ((tidh == 0x1) && (tidl >= 3) && (tidl <= 255))
|
||||
buffer[cnt++] = (u8)(tidl & 0xFF);
|
||||
}
|
||||
|
||||
/* Set values */
|
||||
*outbuf = buffer;
|
||||
*outlen = cnt;
|
||||
|
||||
goto out;
|
||||
|
||||
out:
|
||||
/* Free memory */
|
||||
if (list)
|
||||
free(list);
|
||||
|
||||
return ret;
|
||||
}
|
16
WadInstaller_Source/source/title.h
Normal file
16
WadInstaller_Source/source/title.h
Normal file
@ -0,0 +1,16 @@
|
||||
#ifndef _TITLE_H_
|
||||
#define _TITLE_H_
|
||||
|
||||
/* Constants */
|
||||
#define BLOCK_SIZE 1024
|
||||
|
||||
/* Prototypes */
|
||||
s32 Title_GetList(u64 **, u32 *);
|
||||
s32 Title_GetTicketViews(u64, tikview **, u32 *);
|
||||
s32 Title_GetTMD(u64, signed_blob **, u32 *);
|
||||
s32 Title_GetVersion(u64, u16 *);
|
||||
s32 Title_GetSysVersion(u64, u64 *);
|
||||
s32 Title_GetSize(u64, u32 *);
|
||||
s32 Title_GetIOSVersions(u8 **, u32 *);
|
||||
|
||||
#endif
|
15
WadInstaller_Source/source/utils.h
Normal file
15
WadInstaller_Source/source/utils.h
Normal file
@ -0,0 +1,15 @@
|
||||
#ifndef _UTILS_H_
|
||||
#define _UTILS_H_
|
||||
|
||||
/* Constants */
|
||||
#define KB_SIZE 1024.0
|
||||
#define MB_SIZE 1048576.0
|
||||
#define GB_SIZE 1073741824.0
|
||||
|
||||
/* Macros */
|
||||
#define round_up(x,n) (-(-(x) & -(n)))
|
||||
|
||||
/* Prototypes */
|
||||
u32 swap32(u32);
|
||||
|
||||
#endif
|
141
WadInstaller_Source/source/video.c
Normal file
141
WadInstaller_Source/source/video.c
Normal file
@ -0,0 +1,141 @@
|
||||
#include <stdio.h>
|
||||
#include <ogcsys.h>
|
||||
|
||||
#include "sys.h"
|
||||
#include "video.h"
|
||||
|
||||
/* Video variables */
|
||||
static void *framebuffer = NULL;
|
||||
static GXRModeObj *vmode = NULL;
|
||||
|
||||
|
||||
void Con_Init(u32 x, u32 y, u32 w, u32 h)
|
||||
{
|
||||
/* Create console in the framebuffer */
|
||||
CON_InitEx(vmode, x, y, w, h);
|
||||
}
|
||||
|
||||
void Con_Clear(void)
|
||||
{
|
||||
/* Clear console */
|
||||
printf("\x1b[2J");
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
void Con_ClearLine(void)
|
||||
{
|
||||
s32 cols, rows;
|
||||
u32 cnt;
|
||||
|
||||
printf("\r");
|
||||
fflush(stdout);
|
||||
|
||||
/* Get console metrics */
|
||||
CON_GetMetrics(&cols, &rows);
|
||||
|
||||
/* Erase line */
|
||||
for (cnt = 1; cnt < cols; cnt++) {
|
||||
printf(" ");
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
printf("\r");
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
void Con_FgColor(u32 color, u8 bold)
|
||||
{
|
||||
/* Set foreground color */
|
||||
printf("\x1b[%u;%um", color + 30, bold);
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
void Con_BgColor(u32 color, u8 bold)
|
||||
{
|
||||
/* Set background color */
|
||||
printf("\x1b[%u;%um", color + 40, bold);
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
void Con_FillRow(u32 row, u32 color, u8 bold)
|
||||
{
|
||||
s32 cols, rows;
|
||||
u32 cnt;
|
||||
|
||||
/* Set color */
|
||||
printf("\x1b[%u;%um", color + 40, bold);
|
||||
fflush(stdout);
|
||||
|
||||
/* Get console metrics */
|
||||
CON_GetMetrics(&cols, &rows);
|
||||
|
||||
/* Save current row and col */
|
||||
printf("\x1b[s");
|
||||
fflush(stdout);
|
||||
|
||||
/* Move to specified row */
|
||||
printf("\x1b[%u;0H", row);
|
||||
fflush(stdout);
|
||||
|
||||
/* Fill row */
|
||||
for (cnt = 0; cnt < cols; cnt++) {
|
||||
printf(" ");
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
/* Load saved row and col */
|
||||
printf("\x1b[u");
|
||||
fflush(stdout);
|
||||
|
||||
/* Set default color */
|
||||
Con_BgColor(0, 0);
|
||||
Con_FgColor(7, 1);
|
||||
}
|
||||
|
||||
void Video_Configure(GXRModeObj *rmode)
|
||||
{
|
||||
/* Configure the video subsystem */
|
||||
VIDEO_Configure(rmode);
|
||||
|
||||
/* Setup video */
|
||||
VIDEO_SetBlack(FALSE);
|
||||
VIDEO_Flush();
|
||||
VIDEO_WaitVSync();
|
||||
|
||||
if (rmode->viTVMode & VI_NON_INTERLACE)
|
||||
VIDEO_WaitVSync();
|
||||
}
|
||||
|
||||
void Video_SetMode(void)
|
||||
{
|
||||
/* Select preferred video mode */
|
||||
vmode = VIDEO_GetPreferredMode(NULL);
|
||||
|
||||
/* Allocate memory for the framebuffer */
|
||||
framebuffer = MEM_K0_TO_K1(SYS_AllocateFramebuffer(vmode));
|
||||
|
||||
/* Configure the video subsystem */
|
||||
VIDEO_Configure(vmode);
|
||||
|
||||
/* Setup video */
|
||||
VIDEO_SetNextFramebuffer(framebuffer);
|
||||
VIDEO_SetBlack(FALSE);
|
||||
VIDEO_Flush();
|
||||
VIDEO_WaitVSync();
|
||||
|
||||
if (vmode->viTVMode & VI_NON_INTERLACE)
|
||||
VIDEO_WaitVSync();
|
||||
|
||||
/* Clear the screen */
|
||||
Video_Clear(COLOR_BLACK);
|
||||
}
|
||||
|
||||
void Video_Clear(s32 color)
|
||||
{
|
||||
VIDEO_ClearFrameBuffer(vmode, framebuffer, color);
|
||||
}
|
||||
|
||||
void Video_DrawPng(IMGCTX ctx, PNGUPROP imgProp, u16 x, u16 y)
|
||||
{
|
||||
PNGU_DECODE_TO_COORDS_YCbYCr(ctx, x, y, imgProp.imgWidth, imgProp.imgHeight, vmode->fbWidth, vmode->xfbHeight, framebuffer);
|
||||
}
|
19
WadInstaller_Source/source/video.h
Normal file
19
WadInstaller_Source/source/video.h
Normal file
@ -0,0 +1,19 @@
|
||||
#ifndef _VIDEO_H_
|
||||
#define _VIDEO_H_
|
||||
|
||||
#include "libpng/pngu/pngu.h"
|
||||
|
||||
/* Prototypes */
|
||||
void Con_Init(u32, u32, u32, u32);
|
||||
void Con_Clear(void);
|
||||
void Con_ClearLine(void);
|
||||
void Con_FgColor(u32, u8);
|
||||
void Con_BgColor(u32, u8);
|
||||
void Con_FillRow(u32, u32, u8);
|
||||
|
||||
void Video_Configure(GXRModeObj *);
|
||||
void Video_SetMode(void);
|
||||
void Video_Clear(s32);
|
||||
void Video_DrawPng(IMGCTX, PNGUPROP, u16, u16);
|
||||
|
||||
#endif
|
72
WadInstaller_Source/source/wad-manager.c
Normal file
72
WadInstaller_Source/source/wad-manager.c
Normal file
@ -0,0 +1,72 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ogcsys.h>
|
||||
|
||||
#include "gui.h"
|
||||
#include "menu.h"
|
||||
#include "restart.h"
|
||||
#include "sys.h"
|
||||
#include "video.h"
|
||||
#include "wpad.h"
|
||||
|
||||
|
||||
void Disclaimer(void)
|
||||
{
|
||||
/* Print disclaimer */
|
||||
printf(" [DISCLAIMER]:\n\n");
|
||||
|
||||
printf(" THIS APPLICATION COMES WITH NO WARRANTY AT ALL,\n");
|
||||
printf(" NEITHER EXPRESS NOR IMPLIED.\n");
|
||||
printf(" I DO NOT TAKE ANY RESPONSIBILITY FOR ANY DAMAGE IN YOUR\n");
|
||||
printf(" WII CONSOLE BECAUSE OF A IMPROPER USAGE OF THIS SOFTWARE.\n\n");
|
||||
|
||||
printf(">> If you agree and install the streamed wad\n");
|
||||
printf(">> press A button to continue.\n");
|
||||
printf(">> Otherwise, press B button to restart your Wii.\n");
|
||||
|
||||
/* Wait for user answer */
|
||||
for (;;) {
|
||||
u32 buttons = Wpad_WaitButtons();
|
||||
|
||||
/* A button */
|
||||
if ((buttons & WPAD_BUTTON_A)||(buttons & PAD_BUTTON_A))
|
||||
break;
|
||||
|
||||
/* B button */
|
||||
if ((buttons & WPAD_BUTTON_B)||(buttons & WPAD_CLASSIC_BUTTON_B))
|
||||
Restart();
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
/* Initialize subsystems */
|
||||
Sys_Init();
|
||||
|
||||
/* Set video mode */
|
||||
Video_SetMode();
|
||||
|
||||
/* Initialize console */
|
||||
Gui_InitConsole();
|
||||
|
||||
/* Draw background */
|
||||
Gui_DrawBackground();
|
||||
|
||||
/* Load Selected IOS */
|
||||
LoadSelectedIOS();
|
||||
|
||||
/* Initialize Wiimote */
|
||||
Wpad_Init();
|
||||
|
||||
/* Print disclaimer */
|
||||
Disclaimer();
|
||||
|
||||
/* Menu loop */
|
||||
Menu_Loop();
|
||||
|
||||
/* Restart Wii */
|
||||
Restart_Wait();
|
||||
|
||||
return 0;
|
||||
}
|
375
WadInstaller_Source/source/wad.c
Normal file
375
WadInstaller_Source/source/wad.c
Normal file
@ -0,0 +1,375 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <malloc.h>
|
||||
#include <ogcsys.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "title.h"
|
||||
#include "utils.h"
|
||||
#include "video.h"
|
||||
#include "wad.h"
|
||||
#include "sha1.h"
|
||||
#include "install.h"
|
||||
|
||||
|
||||
/* 'WAD Header' structure */
|
||||
typedef struct {
|
||||
/* Header length */
|
||||
u32 header_len;
|
||||
|
||||
/* WAD type */
|
||||
u16 type;
|
||||
|
||||
u16 padding;
|
||||
|
||||
/* Data length */
|
||||
u32 certs_len;
|
||||
u32 crl_len;
|
||||
u32 tik_len;
|
||||
u32 tmd_len;
|
||||
u32 data_len;
|
||||
u32 footer_len;
|
||||
} ATTRIBUTE_PACKED wadHeader;
|
||||
|
||||
/* Variables */
|
||||
static u8 wadBuffer[BLOCK_SIZE] ATTRIBUTE_ALIGN(32);
|
||||
|
||||
void * startOfData;
|
||||
void * endOfData;
|
||||
void * internalPointer;
|
||||
|
||||
void mopen(void * memPointer)
|
||||
{
|
||||
u32 size = *((u32 * ) memPointer);
|
||||
startOfData = memPointer + 28;
|
||||
endOfData = startOfData + size;
|
||||
internalPointer = startOfData;
|
||||
}
|
||||
|
||||
|
||||
int mseek(u32 offset, int origin)
|
||||
{
|
||||
if (origin == SEEK_SET)
|
||||
{
|
||||
internalPointer = startOfData + offset;
|
||||
} else if (origin == SEEK_CUR)
|
||||
{
|
||||
internalPointer = internalPointer + offset;
|
||||
} else if (origin == SEEK_END) {
|
||||
internalPointer = endOfData - offset;
|
||||
} else
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
|
||||
if ((internalPointer<startOfData) || (internalPointer> endOfData))
|
||||
{
|
||||
return -1;
|
||||
} else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int mread(void * buf, int size, int count)
|
||||
{
|
||||
memcpy(buf, internalPointer, size*count);
|
||||
//DCFlushRange(buf, size*count);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------- INSTALL FROM MEMORY -------------------------------
|
||||
|
||||
s32 __Wad_ReadFile(void *outbuf, u32 offset, u32 len)
|
||||
{
|
||||
s32 ret;
|
||||
|
||||
/* Seek to offset */
|
||||
mseek(offset, SEEK_SET);
|
||||
|
||||
/* Read data */
|
||||
ret = mread(outbuf, len, 1);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 __Wad_ReadAlloc(void **outbuf, u32 offset, u32 len)
|
||||
{
|
||||
void *buffer = NULL;
|
||||
s32 ret;
|
||||
|
||||
/* Allocate memory */
|
||||
buffer = memalign(32, len);
|
||||
if (!buffer)
|
||||
return -1;
|
||||
|
||||
/* Read file */
|
||||
ret = __Wad_ReadFile(buffer, offset, len);
|
||||
if (ret < 0) {
|
||||
free(buffer);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Set pointer */
|
||||
*outbuf = buffer;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 __Wad_GetTitleID(wadHeader *header, u64 *tid)
|
||||
{
|
||||
signed_blob *p_tik = NULL;
|
||||
tik *tik_data = NULL;
|
||||
|
||||
u32 offset = 0;
|
||||
s32 ret;
|
||||
|
||||
/* Ticket offset */
|
||||
offset += round_up(header->header_len, 64);
|
||||
offset += round_up(header->certs_len, 64);
|
||||
offset += round_up(header->crl_len, 64);
|
||||
|
||||
/* Read ticket */
|
||||
ret = __Wad_ReadAlloc((void *)&p_tik, offset, header->tik_len);
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
|
||||
/* Ticket data */
|
||||
tik_data = (tik *)SIGNATURE_PAYLOAD(p_tik);
|
||||
|
||||
/* Copy title ID */
|
||||
*tid = tik_data->titleid;
|
||||
|
||||
out:
|
||||
/* Free memory */
|
||||
if (p_tik)
|
||||
free(p_tik);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
s32 __Wad_Install()
|
||||
{
|
||||
wadHeader *header = NULL;
|
||||
signed_blob *p_certs = NULL, *p_crl = NULL, *p_tik = NULL, *p_tmd = NULL;
|
||||
|
||||
tmd *tmd_data = NULL;
|
||||
|
||||
u32 cnt, offset = 0;
|
||||
s32 ret;
|
||||
|
||||
printf("\t\t>> Reading WAD data...");
|
||||
fflush(stdout);
|
||||
|
||||
/* WAD header */
|
||||
ret = __Wad_ReadAlloc((void *)&header, offset, sizeof(wadHeader));
|
||||
if (ret < 0)
|
||||
goto err;
|
||||
else
|
||||
offset += round_up(header->header_len, 64);
|
||||
|
||||
/* WAD certificates */
|
||||
ret = __Wad_ReadAlloc((void *)&p_certs, offset, header->certs_len);
|
||||
if (ret < 0)
|
||||
goto err;
|
||||
else
|
||||
offset += round_up(header->certs_len, 64);
|
||||
|
||||
/* WAD crl */
|
||||
if (header->crl_len) {
|
||||
ret = __Wad_ReadAlloc((void *)&p_crl, offset, header->crl_len);
|
||||
if (ret < 0)
|
||||
goto err;
|
||||
else
|
||||
offset += round_up(header->crl_len, 64);
|
||||
}
|
||||
|
||||
/* WAD ticket */
|
||||
ret = __Wad_ReadAlloc((void *)&p_tik, offset, header->tik_len);
|
||||
if (ret < 0)
|
||||
goto err;
|
||||
else
|
||||
offset += round_up(header->tik_len, 64);
|
||||
|
||||
/* WAD TMD */
|
||||
ret = __Wad_ReadAlloc((void *)&p_tmd, offset, header->tmd_len);
|
||||
if (ret < 0)
|
||||
goto err;
|
||||
else
|
||||
offset += round_up(header->tmd_len, 64);
|
||||
|
||||
Con_ClearLine();
|
||||
|
||||
printf("\t\t>> Installing ticket...");
|
||||
fflush(stdout);
|
||||
|
||||
/* Install ticket */
|
||||
ret = ES_AddTicket(p_tik, header->tik_len, p_certs, header->certs_len, p_crl, header->crl_len);
|
||||
if (ret < 0)
|
||||
goto err;
|
||||
|
||||
Con_ClearLine();
|
||||
|
||||
printf("\r\t\t>> Installing title...");
|
||||
fflush(stdout);
|
||||
|
||||
/* Install title */
|
||||
ret = ES_AddTitleStart(p_tmd, header->tmd_len, p_certs, header->certs_len, p_crl, header->crl_len);
|
||||
if (ret < 0)
|
||||
goto err;
|
||||
|
||||
/* Get TMD info */
|
||||
tmd_data = (tmd *)SIGNATURE_PAYLOAD(p_tmd);
|
||||
|
||||
/* Install contents */
|
||||
for (cnt = 0; cnt < tmd_data->num_contents; cnt++) {
|
||||
tmd_content *content = &tmd_data->contents[cnt];
|
||||
|
||||
u32 idx = 0, len;
|
||||
s32 cfd;
|
||||
|
||||
Con_ClearLine();
|
||||
|
||||
printf("\r\t\t>> Installing content #%02d...", content->cid);
|
||||
fflush(stdout);
|
||||
|
||||
/* Encrypted content size */
|
||||
len = round_up(content->size, 64);
|
||||
|
||||
/* Install content */
|
||||
cfd = ES_AddContentStart(tmd_data->title_id, content->cid);
|
||||
if (cfd < 0) {
|
||||
ret = cfd;
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* Install content data */
|
||||
while (idx < len) {
|
||||
u32 size;
|
||||
|
||||
/* Data length */
|
||||
size = (len - idx);
|
||||
if (size > BLOCK_SIZE)
|
||||
size = BLOCK_SIZE;
|
||||
|
||||
/* Read data */
|
||||
ret = __Wad_ReadFile(&wadBuffer, offset, size);
|
||||
if (ret < 0)
|
||||
goto err;
|
||||
|
||||
/* Install data */
|
||||
ret = ES_AddContentData(cfd, wadBuffer, size);
|
||||
if (ret < 0)
|
||||
goto err;
|
||||
|
||||
/* Increase variables */
|
||||
idx += size;
|
||||
offset += size;
|
||||
}
|
||||
|
||||
/* Finish content installation */
|
||||
ret = ES_AddContentFinish(cfd);
|
||||
if (ret < 0)
|
||||
goto err;
|
||||
}
|
||||
|
||||
Con_ClearLine();
|
||||
|
||||
printf("\r\t\t>> Finishing installation...");
|
||||
fflush(stdout);
|
||||
|
||||
/* Finish title install */
|
||||
ret = ES_AddTitleFinish();
|
||||
if (ret >= 0) {
|
||||
printf(" OK!\n");
|
||||
goto out;
|
||||
}
|
||||
|
||||
err:
|
||||
printf(" ERROR! (ret = %d)\n", ret);
|
||||
|
||||
/* Cancel install */
|
||||
ES_AddTitleCancel();
|
||||
|
||||
out:
|
||||
/* Free memory */
|
||||
if (header)
|
||||
free(header);
|
||||
if (p_certs)
|
||||
free(p_certs);
|
||||
if (p_crl)
|
||||
free(p_crl);
|
||||
if (p_tik)
|
||||
free(p_tik);
|
||||
if (p_tmd)
|
||||
free(p_tmd);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void DumpHash(u8 * hash)
|
||||
{
|
||||
int i;
|
||||
for (i=0;i<20;i++)
|
||||
{
|
||||
printf("%x", hash[i]);
|
||||
}
|
||||
}
|
||||
|
||||
s32 CompareHashes(u8 * hash1, u8 * hash2)
|
||||
{
|
||||
|
||||
printf("\nCalculated SHA1 Hash: "); DumpHash(hash1);
|
||||
printf("\nStored SHA1 Hash : "); DumpHash(hash2);
|
||||
sleep(3);
|
||||
|
||||
if (memcmp(hash1, hash2, 20)==0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
s32 Wad_EnsureInjectedData()
|
||||
{
|
||||
u32 size = *((u32 * ) install);
|
||||
u8 wadOffset = 28;
|
||||
|
||||
u8 hash1[20];
|
||||
|
||||
SHA1(((u8 *)install)+wadOffset, size , hash1); //Taking SHA of contents...
|
||||
|
||||
return CompareHashes(hash1, ((u8 *)install)+4);
|
||||
}
|
||||
|
||||
s32 Wad_InstallFromMemory()
|
||||
{
|
||||
/* Check integrity of the wad file using SHA */
|
||||
/* SHA digest of the installed wad will be from XX-XX region in the injected data */
|
||||
printf("\n");
|
||||
printf("\r\t\t>> Checking integrity of the contents...");
|
||||
if (Wad_EnsureInjectedData())
|
||||
{
|
||||
printf("\n\n\t\t>> Wad file integrity check succeeded\n\n");
|
||||
mopen(install);
|
||||
return __Wad_Install();
|
||||
} else
|
||||
{
|
||||
printf("\n\n\t\t>> Wad file integrity check failed! Will not install the wad, possible corruption during transfer...");
|
||||
}
|
||||
}
|
||||
|
||||
u8 Wad_SelectIOS()
|
||||
{
|
||||
u8 iosOffset = 24;
|
||||
return *(install+iosOffset);
|
||||
|
||||
}
|
8
WadInstaller_Source/source/wad.h
Normal file
8
WadInstaller_Source/source/wad.h
Normal file
@ -0,0 +1,8 @@
|
||||
#ifndef _WAD_H_
|
||||
#define _WAD_H_
|
||||
|
||||
/* Prototypes */
|
||||
s32 Wad_InstallFromMemory();
|
||||
u8 Wad_SelectIOS(void);
|
||||
|
||||
#endif
|
81
WadInstaller_Source/source/wpad.c
Normal file
81
WadInstaller_Source/source/wpad.c
Normal file
@ -0,0 +1,81 @@
|
||||
#include <stdio.h>
|
||||
#include <ogcsys.h>
|
||||
|
||||
#include "sys.h"
|
||||
#include "wpad.h"
|
||||
|
||||
/* Constants */
|
||||
#define MAX_WIIMOTES 4
|
||||
|
||||
|
||||
void __Wpad_PowerCallback(s32 chan)
|
||||
{
|
||||
/* Poweroff console */
|
||||
Sys_Shutdown();
|
||||
}
|
||||
|
||||
|
||||
s32 Wpad_Init(void)
|
||||
{
|
||||
s32 ret;
|
||||
|
||||
/* Initialize GC Pads */
|
||||
|
||||
ret = PAD_Init();
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* Initialize Wiimote subsystem */
|
||||
ret = WPAD_Init();
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* Set POWER button callback */
|
||||
WPAD_SetPowerButtonCallback(__Wpad_PowerCallback);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void Wpad_Disconnect(void)
|
||||
{
|
||||
u32 cnt;
|
||||
|
||||
/* Disconnect Wiimotes */
|
||||
for (cnt = 0; cnt < MAX_WIIMOTES; cnt++)
|
||||
WPAD_Disconnect(cnt);
|
||||
|
||||
/* Shutdown Wiimote subsystem */
|
||||
WPAD_Shutdown();
|
||||
}
|
||||
|
||||
u32 Wpad_GetButtons(void)
|
||||
{
|
||||
u32 buttons = 0, cnt;
|
||||
|
||||
/* Scan pads */
|
||||
WPAD_ScanPads();
|
||||
|
||||
/* Get pressed buttons */
|
||||
for (cnt = 0; cnt < MAX_WIIMOTES; cnt++)
|
||||
buttons |= WPAD_ButtonsDown(cnt);
|
||||
|
||||
return buttons;
|
||||
}
|
||||
|
||||
u32 Wpad_WaitButtons(void)
|
||||
{
|
||||
u32 buttons = 0;
|
||||
|
||||
/* Wait for button pressing */
|
||||
while (!buttons) {
|
||||
buttons = Wpad_GetButtons();
|
||||
if (!buttons)
|
||||
{
|
||||
PAD_ScanPads();
|
||||
buttons = PAD_ButtonsDown(0);
|
||||
}
|
||||
VIDEO_WaitVSync();
|
||||
}
|
||||
|
||||
return buttons;
|
||||
}
|
12
WadInstaller_Source/source/wpad.h
Normal file
12
WadInstaller_Source/source/wpad.h
Normal file
@ -0,0 +1,12 @@
|
||||
#ifndef _WPAD_H_
|
||||
#define _WPAD_H_
|
||||
|
||||
#include <wiiuse/wpad.h>
|
||||
|
||||
/* Prototypes */
|
||||
s32 Wpad_Init(void);
|
||||
void Wpad_Disconnect(void);
|
||||
u32 Wpad_GetButtons(void);
|
||||
u32 Wpad_WaitButtons(void);
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user