2013-10-12 20:38:34 +02:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <gccore.h>
|
|
|
|
#include <malloc.h>
|
|
|
|
#include <fat.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <ogc/conf.h>
|
2013-10-18 03:25:17 +02:00
|
|
|
#include <ogc/es.h>
|
|
|
|
#include <ogc/ios.h>
|
2014-06-19 19:47:13 +02:00
|
|
|
#include <ogc/pad.h>
|
2013-10-12 20:38:34 +02:00
|
|
|
#include <wiiuse/wpad.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <di/di.h>
|
|
|
|
#include <CheckRegion.h>
|
|
|
|
|
2015-10-27 09:04:08 +01:00
|
|
|
#include "runtimeiospatch.h"
|
2014-07-06 20:53:35 +02:00
|
|
|
#include "SysMenuInfo.h"
|
2013-10-12 20:38:34 +02:00
|
|
|
#include "fatMounter.h"
|
2014-07-06 20:53:35 +02:00
|
|
|
#include "gecko.h"
|
2013-10-12 20:38:34 +02:00
|
|
|
#include "gui.h"
|
2014-07-06 20:53:35 +02:00
|
|
|
#include "languages.h"
|
2013-10-12 20:38:34 +02:00
|
|
|
#include "mload.h"
|
|
|
|
#include "sha1.h"
|
2014-07-06 20:53:35 +02:00
|
|
|
#include "sys.h"
|
|
|
|
#include "title.h"
|
2013-10-12 20:38:34 +02:00
|
|
|
#include "tmdIdentification.h"
|
2014-07-06 20:53:35 +02:00
|
|
|
#include "tmd_dat.h"
|
2014-02-13 10:16:23 +01:00
|
|
|
#include "update.h"
|
2014-07-06 20:53:35 +02:00
|
|
|
#include "wiibasics.h"
|
2013-10-12 20:38:34 +02:00
|
|
|
|
|
|
|
// Filename
|
2023-03-09 19:42:29 +01:00
|
|
|
#define REPORT ":/SysCheck.csv"
|
|
|
|
#define HASHLOG ":/IOSsyscheck.log"
|
2014-07-25 20:42:07 +02:00
|
|
|
#define VERSION_1_1_0 65536
|
2013-11-01 16:31:34 +01:00
|
|
|
|
2013-10-12 20:38:34 +02:00
|
|
|
|
|
|
|
extern void __exception_setreload(int t);
|
2015-03-13 09:16:55 +01:00
|
|
|
static u64 current_time = 0;
|
2013-10-12 20:38:34 +02:00
|
|
|
|
2015-09-29 00:32:10 +02:00
|
|
|
// Main
|
2013-10-12 20:38:34 +02:00
|
|
|
int main(int argc, char **argv)
|
|
|
|
{
|
|
|
|
__exception_setreload(2);
|
2017-11-04 07:53:21 +01:00
|
|
|
arguments.AHB_At_Start = AHB_ACCESS;
|
2014-07-30 19:22:32 +02:00
|
|
|
memset(arguments.skipIOSlist, 0, sizeof(arguments.skipIOSlist));
|
|
|
|
arguments.skipIOScnt = 0;
|
|
|
|
arguments.debug = false;
|
2015-09-29 00:32:10 +02:00
|
|
|
arguments.USB = strlen(argv[0]) && (argv[0][0] == 'U' || argv[0][0] == 'u');
|
|
|
|
|
2015-03-13 09:16:55 +01:00
|
|
|
InitGecko();
|
2015-10-13 22:42:02 +02:00
|
|
|
gprintf(" \n \n==============================================================================\n");
|
2013-10-12 20:38:34 +02:00
|
|
|
if(argc>=1){
|
|
|
|
int i;
|
|
|
|
for(i=0; i<argc; i++){
|
2014-07-30 19:22:32 +02:00
|
|
|
if(CHECK_ARG("--debug=true")) {
|
|
|
|
arguments.debug = true;
|
2013-10-12 20:38:34 +02:00
|
|
|
gprintf("--debug=true\n");
|
2014-07-30 19:22:32 +02:00
|
|
|
logfile("--debug=true\r\n");
|
|
|
|
} else if(CHECK_ARG("--forceNoAHBPROT=true")) {
|
2017-11-04 07:53:21 +01:00
|
|
|
arguments.AHB_At_Start = false;
|
2013-10-12 20:38:34 +02:00
|
|
|
gprintf("--forceNoAHBPROT=true\n");
|
2014-07-30 19:22:32 +02:00
|
|
|
logfile("--forceNoAHBPROT=true\r\n");
|
2017-11-04 07:53:21 +01:00
|
|
|
IOS_ReloadIOS(IOS_GetVersion());
|
2014-07-30 19:22:32 +02:00
|
|
|
} else if(CHECK_ARG("--skipIOS=")) {
|
|
|
|
arguments.skipIOSlist[arguments.skipIOScnt] = atoi(CHECK_ARG_VAL("--skipIOS="));
|
|
|
|
gprintf("skipIOS[%i] = %i\r\n", arguments.skipIOScnt, arguments.skipIOSlist[arguments.skipIOScnt]);
|
|
|
|
logfile("skipIOS[%i] = %i\r\n", arguments.skipIOScnt, arguments.skipIOSlist[arguments.skipIOScnt]);
|
|
|
|
arguments.skipIOScnt++;
|
2013-10-12 20:38:34 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-03-09 19:42:29 +01:00
|
|
|
SysSettings_t SystemInfo = {0};
|
2017-11-04 07:53:21 +01:00
|
|
|
if(arguments.AHB_At_Start)
|
|
|
|
SystemInfo.deviceType = IS_WII_U;
|
|
|
|
else
|
|
|
|
SystemInfo.deviceType = CONSOLE_UNKNOWN;
|
2014-02-18 02:37:54 +01:00
|
|
|
memset(SystemInfo.miosInfo, 0, sizeof(SystemInfo.miosInfo));
|
2013-10-12 20:38:34 +02:00
|
|
|
|
2017-11-04 07:53:21 +01:00
|
|
|
if (AHB_ACCESS) IosPatch_RUNTIME(true, false, false, true);
|
2014-02-10 16:00:50 +01:00
|
|
|
SystemInfo.nandAccess = CheckNANDAccess();
|
2013-10-12 20:38:34 +02:00
|
|
|
|
|
|
|
// Get and display the current date and time
|
|
|
|
struct tm today;
|
|
|
|
time_t rawtime;
|
|
|
|
time(&rawtime);
|
|
|
|
today = *localtime(&rawtime);
|
|
|
|
|
|
|
|
initGUI();
|
|
|
|
initLanguages(today);
|
|
|
|
|
|
|
|
// Get the console region
|
2013-10-18 03:25:17 +02:00
|
|
|
printLoading(MSG_GetConsoleRegion);
|
2014-07-25 20:42:07 +02:00
|
|
|
UpdateTime();
|
2014-02-10 16:00:50 +01:00
|
|
|
SystemInfo.systemRegion = CONF_GetRegion();
|
2015-02-07 08:33:33 +01:00
|
|
|
CheckTime();
|
2015-09-29 00:32:10 +02:00
|
|
|
|
2014-02-10 16:00:50 +01:00
|
|
|
SystemInfo.shopcode = 0;
|
|
|
|
if (!CONF_GetShopCode(&SystemInfo.shopcode)) {
|
|
|
|
strcpy(SystemInfo.country, CONF_CountryCodes[SystemInfo.shopcode]);
|
|
|
|
} else {
|
2014-07-25 20:42:07 +02:00
|
|
|
strcpy(SystemInfo.country, TXT_Unknown);
|
2014-02-10 16:00:50 +01:00
|
|
|
}
|
2013-10-12 20:38:34 +02:00
|
|
|
|
2013-10-18 03:25:17 +02:00
|
|
|
// Get the system menu version
|
|
|
|
printLoading(MSG_GetSysMenuVer);
|
2014-07-25 20:42:07 +02:00
|
|
|
UpdateTime();
|
2014-02-10 16:00:50 +01:00
|
|
|
SystemInfo.sysMenuVer = GetSysMenuVersion();
|
2015-02-07 08:33:33 +01:00
|
|
|
CheckTime();
|
2015-09-29 00:32:10 +02:00
|
|
|
|
2015-03-13 09:16:55 +01:00
|
|
|
sysMenu_t systemmenu;
|
2013-10-12 20:38:34 +02:00
|
|
|
|
|
|
|
printLoading(MSG_GetHBCVer);
|
2014-07-25 20:42:07 +02:00
|
|
|
UpdateTime();
|
2015-09-29 00:32:10 +02:00
|
|
|
|
2014-02-13 10:16:23 +01:00
|
|
|
homebrew_t homebrew;
|
|
|
|
homebrew.hbcversion = 0;
|
|
|
|
homebrew.hbfversion = 0;
|
|
|
|
homebrew.hbc = HBC_NONE;
|
|
|
|
homebrew.hbf = HBF_NONE;
|
|
|
|
homebrew.hbcIOS = 0;
|
2014-02-10 16:00:50 +01:00
|
|
|
SystemInfo.dvdSupport = 0;
|
2017-11-04 07:53:21 +01:00
|
|
|
s32 ret = Title_GetVersionNObuf(TITLE_ID(0x00010001, HBC_TID_OPEN));
|
2013-10-12 20:38:34 +02:00
|
|
|
if (ret<0) {
|
2023-03-09 19:42:29 +01:00
|
|
|
ret = Title_GetVersionNObuf(TITLE_ID(0x00010001, HBC_TID_LULZ));
|
2013-10-12 20:38:34 +02:00
|
|
|
if (ret<0) {
|
2017-11-04 07:53:21 +01:00
|
|
|
ret = Title_GetVersionNObuf(TITLE_ID(0x00010001, HBC_TID_1_0_7));
|
2013-10-12 20:38:34 +02:00
|
|
|
if (ret<0) {
|
2017-11-04 07:53:21 +01:00
|
|
|
ret = Title_GetVersionNObuf(TITLE_ID(0x00010001, HBC_TID_JODI));
|
2013-10-12 20:38:34 +02:00
|
|
|
if (ret<0) {
|
2014-02-13 10:16:23 +01:00
|
|
|
homebrew.hbc = HBC_HAXX;
|
2017-11-04 07:53:21 +01:00
|
|
|
ret = Title_GetVersionNObuf(TITLE_ID(0x00010001, HBC_TID_HAXX));
|
|
|
|
if (ret<0) {
|
|
|
|
homebrew.hbc = HBC_NONE;
|
|
|
|
} else {
|
|
|
|
homebrew.hbc = HBC_HAXX;
|
|
|
|
homebrew.hbcversion = ret;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
homebrew.hbc = HBC_JODI;
|
2014-02-13 10:16:23 +01:00
|
|
|
homebrew.hbcversion = ret;
|
2013-10-12 20:38:34 +02:00
|
|
|
}
|
|
|
|
} else {
|
2017-11-04 07:53:21 +01:00
|
|
|
homebrew.hbc = HBC_1_0_7;
|
2014-02-13 10:16:23 +01:00
|
|
|
homebrew.hbcversion = ret;
|
2017-11-04 07:53:21 +01:00
|
|
|
if (homebrew.hbcversion == 0)
|
|
|
|
homebrew.hbcversion = VERSION_1_1_0;
|
2013-10-12 20:38:34 +02:00
|
|
|
}
|
|
|
|
} else {
|
2017-11-04 07:53:21 +01:00
|
|
|
homebrew.hbc = HBC_LULZ;
|
|
|
|
homebrew.hbcversion = (ret != 257) + 1;
|
2013-10-12 20:38:34 +02:00
|
|
|
}
|
|
|
|
} else {
|
2017-11-04 07:53:21 +01:00
|
|
|
homebrew.hbc = HBC_OPEN;
|
2023-03-09 19:42:29 +01:00
|
|
|
homebrew.hbcversion = (ret == 258) ? 3 : ret; // OHBC or a fork
|
2013-10-12 20:38:34 +02:00
|
|
|
}
|
2017-11-04 07:53:21 +01:00
|
|
|
if (homebrew.hbc == HBC_OPEN) {
|
|
|
|
homebrew.hbcIOS = get_title_ios(TITLE_ID(0x00010001, HBC_TID_OPEN)); // OPEN
|
|
|
|
} else if (homebrew.hbc == HBC_LULZ) {
|
|
|
|
homebrew.hbcIOS = get_title_ios(TITLE_ID(0x00010001, HBC_TID_LULZ)); // LULZ
|
2014-02-13 10:16:23 +01:00
|
|
|
} else if (homebrew.hbc == HBC_1_0_7) {
|
2017-11-04 07:53:21 +01:00
|
|
|
homebrew.hbcIOS = get_title_ios(TITLE_ID(0x00010001, HBC_TID_1_0_7)); // ????
|
2014-02-13 10:16:23 +01:00
|
|
|
} else if (homebrew.hbc == HBC_JODI) {
|
2017-11-04 07:53:21 +01:00
|
|
|
homebrew.hbcIOS = get_title_ios(TITLE_ID(0x00010001, HBC_TID_JODI)); // JODI
|
2014-02-13 10:16:23 +01:00
|
|
|
} else if (homebrew.hbc == HBC_HAXX) {
|
2017-11-04 07:53:21 +01:00
|
|
|
homebrew.hbcIOS = get_title_ios(TITLE_ID(0x00010001, HBC_TID_HAXX)); // HAXX
|
2013-10-12 20:38:34 +02:00
|
|
|
}
|
|
|
|
|
2014-07-30 19:22:32 +02:00
|
|
|
ret = Title_GetVersionNObuf(TITLE_ID(0x00010001, 0x48424630)); //HBF0
|
2013-10-12 20:38:34 +02:00
|
|
|
if (ret<0) {
|
2014-07-30 19:22:32 +02:00
|
|
|
ret = Title_GetVersionNObuf(TITLE_ID(0x00010001, 0x54484246)); //THBF
|
2013-10-12 20:38:34 +02:00
|
|
|
if (ret<0) {
|
2014-02-13 10:16:23 +01:00
|
|
|
homebrew.hbf = HBF_NONE;
|
2013-10-12 20:38:34 +02:00
|
|
|
} else {
|
2014-02-13 10:16:23 +01:00
|
|
|
homebrew.hbf = HBF_HBF0;
|
|
|
|
homebrew.hbfversion = ret;
|
2013-10-12 20:38:34 +02:00
|
|
|
}
|
|
|
|
} else {
|
2014-02-13 10:16:23 +01:00
|
|
|
homebrew.hbf = HBF_THBF;
|
|
|
|
homebrew.hbfversion = ret;
|
2013-10-12 20:38:34 +02:00
|
|
|
}
|
|
|
|
|
2017-11-04 07:53:21 +01:00
|
|
|
if (AHB_ACCESS) {
|
2013-10-12 20:38:34 +02:00
|
|
|
DI_Init();
|
|
|
|
DI_DriveID id;
|
|
|
|
|
|
|
|
if(DI_Identify(&id) == 0) {
|
2014-02-10 16:00:50 +01:00
|
|
|
SystemInfo.dvdSupport = id.rel_date;
|
2013-10-12 20:38:34 +02:00
|
|
|
}
|
|
|
|
DI_Close();
|
|
|
|
}
|
|
|
|
|
2014-02-10 16:00:50 +01:00
|
|
|
SystemInfo.sysNinVersion = GetSysMenuNintendoVersion(SystemInfo.sysMenuVer);
|
|
|
|
SystemInfo.sysMenuRegion = GetSysMenuRegion(SystemInfo.sysMenuVer);
|
2015-02-07 08:33:33 +01:00
|
|
|
CheckTime();
|
2013-10-12 20:38:34 +02:00
|
|
|
|
2013-10-18 03:25:17 +02:00
|
|
|
// Get the running IOS version and revision
|
2014-06-19 19:47:13 +02:00
|
|
|
printLoading(MSG_GetRunningIOS);
|
2014-07-25 20:42:07 +02:00
|
|
|
UpdateTime();
|
2015-02-07 08:33:33 +01:00
|
|
|
SystemInfo.runningIOS = IOS_GetVersion();
|
|
|
|
SystemInfo.runningIOSRevision = IOS_GetRevision();
|
2015-09-29 00:32:10 +02:00
|
|
|
|
2015-02-07 08:33:33 +01:00
|
|
|
CheckTime();
|
2013-10-12 20:38:34 +02:00
|
|
|
|
|
|
|
// Get the console ID
|
2013-10-18 03:25:17 +02:00
|
|
|
printLoading(MSG_GetConsoleID);
|
2014-07-25 20:42:07 +02:00
|
|
|
UpdateTime();
|
2014-02-10 16:00:50 +01:00
|
|
|
SystemInfo.deviceID = GetDeviceID();
|
2015-02-07 08:33:33 +01:00
|
|
|
CheckTime();
|
2013-10-12 20:38:34 +02:00
|
|
|
|
2013-10-18 03:25:17 +02:00
|
|
|
// Get the boot2 version
|
|
|
|
printLoading(MSG_GetBoot2);
|
2014-07-25 20:42:07 +02:00
|
|
|
UpdateTime();
|
2014-02-10 16:00:50 +01:00
|
|
|
SystemInfo.boot2version = GetBoot2Version();
|
2015-02-07 08:33:33 +01:00
|
|
|
CheckTime();
|
2013-10-12 20:38:34 +02:00
|
|
|
|
|
|
|
// Get number of titles
|
2013-10-18 03:25:17 +02:00
|
|
|
printLoading(MSG_GetNrOfTitles);
|
2014-07-25 20:42:07 +02:00
|
|
|
UpdateTime();
|
2013-10-12 20:38:34 +02:00
|
|
|
|
|
|
|
u32 tempTitles;
|
|
|
|
if (ES_GetNumTitles(&tempTitles) < 0) {
|
|
|
|
printError(ERR_GetNrOfTitles);
|
|
|
|
sleep(5);
|
2013-10-25 21:14:36 +02:00
|
|
|
deinitGUI();
|
|
|
|
exit(1);
|
2013-10-18 03:25:17 +02:00
|
|
|
}
|
2013-10-12 20:38:34 +02:00
|
|
|
|
|
|
|
s32 nbTitles = tempTitles;
|
|
|
|
|
|
|
|
// Allocate the memory for titles
|
|
|
|
u64 *titles = memalign(32, nbTitles*sizeof(u64));
|
|
|
|
if (titles == NULL) {
|
|
|
|
sprintf(MSG_Buffer, ERR_AllocateMemory, titles);
|
|
|
|
printError(MSG_Buffer);
|
|
|
|
sleep(5);
|
2013-10-25 21:14:36 +02:00
|
|
|
deinitGUI();
|
|
|
|
exit(1);
|
2013-10-18 03:25:17 +02:00
|
|
|
}
|
2015-02-07 08:33:33 +01:00
|
|
|
CheckTime();
|
2013-10-12 20:38:34 +02:00
|
|
|
|
|
|
|
// Get list of titles
|
2013-10-18 03:25:17 +02:00
|
|
|
printLoading(MSG_GetTitleList);
|
2014-07-25 20:42:07 +02:00
|
|
|
UpdateTime();
|
2013-10-12 20:38:34 +02:00
|
|
|
if (ES_GetTitles(titles, nbTitles) < 0) {
|
2013-10-18 03:25:17 +02:00
|
|
|
printError(ERR_GetTitleList);
|
2013-10-12 20:38:34 +02:00
|
|
|
sleep(5);
|
2013-10-25 21:14:36 +02:00
|
|
|
deinitGUI();
|
|
|
|
exit(1);
|
2013-10-18 03:25:17 +02:00
|
|
|
}
|
2013-10-12 20:38:34 +02:00
|
|
|
|
|
|
|
int i;
|
|
|
|
int j;
|
2014-02-10 16:00:50 +01:00
|
|
|
SystemInfo.countIOS = 0; // Number of IOS
|
|
|
|
SystemInfo.countStubs = 0; // Number of IOS Stubs
|
|
|
|
SystemInfo.countBCMIOS = 0; //Number of BC and MIOS. Should be 2.
|
2014-02-10 05:09:20 +01:00
|
|
|
u32 titleID;
|
2013-10-12 20:38:34 +02:00
|
|
|
char HashLogBuffer[300][100] = {{0}};
|
|
|
|
int lines = 0;
|
|
|
|
|
|
|
|
// For each titles found
|
|
|
|
for (i = 0; i < nbTitles; i++)
|
|
|
|
{
|
|
|
|
// Skip non-system titles
|
|
|
|
if (titles[i] >> 32 != 1) {
|
|
|
|
titles[i] = 0;
|
|
|
|
continue;
|
|
|
|
}
|
2014-02-10 05:09:20 +01:00
|
|
|
titleID = titles[i] & 0xFFFFFFFF;
|
2013-10-12 20:38:34 +02:00
|
|
|
|
|
|
|
// Skip BC, MIOS and possible other non-IOS titles
|
|
|
|
if (titleID > 200 && titleID < 258) {
|
|
|
|
u32 tmdSize = 0;
|
|
|
|
if (ES_GetStoredTMDSize(0x0000000100000000ULL | titleID, &tmdSize) < 0) {
|
|
|
|
titles[i] = 0;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-18 03:25:17 +02:00
|
|
|
// Skip the running IOS, the System Menu, and out of range IOS
|
|
|
|
if ((titleID > 258 && titleID < 512) || (titleID == 0) || (titleID == 2)) {
|
2013-10-12 20:38:34 +02:00
|
|
|
titles[i] = 0;
|
|
|
|
continue;
|
|
|
|
}
|
2014-02-10 16:00:50 +01:00
|
|
|
SystemInfo.countIOS++;
|
2013-10-12 20:38:34 +02:00
|
|
|
}
|
2015-09-29 00:32:10 +02:00
|
|
|
|
2014-08-05 23:34:08 +02:00
|
|
|
// Not the most efficient way to remove argument-skipped IOS's, but it works.
|
2015-09-29 00:32:10 +02:00
|
|
|
int tempSkipIOScnt = arguments.skipIOScnt;
|
|
|
|
while (tempSkipIOScnt > 0) {
|
2014-07-30 19:22:32 +02:00
|
|
|
for (i = nbTitles; i--;) {
|
|
|
|
titleID = titles[i] & 0xFFFFFFFF;
|
2015-09-29 00:32:10 +02:00
|
|
|
if(arguments.skipIOSlist[tempSkipIOScnt - 1] > 0 && titleID == arguments.skipIOSlist[tempSkipIOScnt - 1]) {
|
|
|
|
logfile("Skipped IOS %i, titles[%i] = %i\r\n", arguments.skipIOSlist[tempSkipIOScnt - 1], i, titles[i]);
|
2014-07-30 19:22:32 +02:00
|
|
|
titles[i] = 0;
|
|
|
|
SystemInfo.countIOS--;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2015-09-29 00:32:10 +02:00
|
|
|
tempSkipIOScnt--;
|
2014-07-30 19:22:32 +02:00
|
|
|
}
|
2015-09-29 00:32:10 +02:00
|
|
|
|
2015-02-07 08:33:33 +01:00
|
|
|
CheckTime();
|
2013-10-12 20:38:34 +02:00
|
|
|
|
|
|
|
// Sort IOS titles
|
|
|
|
printLoading(MSG_SortTitles);
|
2014-07-25 20:42:07 +02:00
|
|
|
UpdateTime();
|
2015-09-29 00:32:10 +02:00
|
|
|
|
2014-07-30 19:22:32 +02:00
|
|
|
u64 *newTitles = memalign(32, (SystemInfo.countIOS)*sizeof(u64));
|
2013-10-12 20:38:34 +02:00
|
|
|
u32 cnt = 0;
|
|
|
|
for (i = 0; i < nbTitles; i++) {
|
|
|
|
if (titles[i] > 0) {
|
|
|
|
newTitles[cnt] = titles[i];
|
|
|
|
cnt++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-02-10 16:00:50 +01:00
|
|
|
sort(newTitles, SystemInfo.countIOS);
|
2013-10-12 20:38:34 +02:00
|
|
|
free(titles);
|
|
|
|
|
2015-03-13 09:16:55 +01:00
|
|
|
IOS_t ios[SystemInfo.countIOS];
|
2014-07-25 20:42:07 +02:00
|
|
|
// IOS List Initialization
|
|
|
|
for (i = SystemInfo.countIOS; i--;) {
|
2013-10-12 20:38:34 +02:00
|
|
|
ios[i].infoContent = 0;
|
|
|
|
ios[i].titleID = 0;
|
|
|
|
ios[i].mloadVersion = 0;
|
|
|
|
ios[i].baseIOS = -1;
|
2015-09-29 00:32:10 +02:00
|
|
|
strcpy(ios[i].info, "NULL");
|
2013-10-12 20:38:34 +02:00
|
|
|
ios[i].isStub = false;
|
|
|
|
ios[i].revision = 0;
|
|
|
|
ios[i].infoFakeSignature = false;
|
|
|
|
ios[i].infoESIdentify = false;
|
|
|
|
ios[i].infoFlashAccess = false;
|
|
|
|
ios[i].infoNANDAccess = false;
|
|
|
|
ios[i].infoBoot2Access = false;
|
|
|
|
ios[i].infoUSB2 = false;
|
|
|
|
ios[i].infoVersionPatch = false;
|
2014-08-22 19:55:55 +02:00
|
|
|
ios[i].infovIOS = false;
|
2013-10-12 20:38:34 +02:00
|
|
|
}
|
|
|
|
|
2014-07-25 20:42:07 +02:00
|
|
|
//MountSD();
|
2013-10-12 20:38:34 +02:00
|
|
|
NandStartup();
|
|
|
|
|
|
|
|
// Check Priiloader
|
2014-02-10 16:00:50 +01:00
|
|
|
SystemInfo.priiloader = checkSysLoader();
|
2013-10-12 20:38:34 +02:00
|
|
|
|
|
|
|
// Check MIOS
|
2014-02-10 16:00:50 +01:00
|
|
|
if (SystemInfo.nandAccess) get_miosinfo(SystemInfo.miosInfo);
|
2015-09-29 00:32:10 +02:00
|
|
|
|
2015-03-13 09:16:55 +01:00
|
|
|
// Check running IOS type so we don't have to reload it later
|
2017-11-04 07:53:21 +01:00
|
|
|
SystemInfo.runningIOSType = (SystemInfo.deviceType != CONSOLE_WII) && CheckIOSType(SystemInfo.runningIOS, SystemInfo.runningIOSRevision);
|
2013-10-12 20:38:34 +02:00
|
|
|
|
|
|
|
// For each titles found
|
2014-07-25 20:42:07 +02:00
|
|
|
for (i = SystemInfo.countIOS; i--;)
|
2013-10-12 20:38:34 +02:00
|
|
|
{
|
|
|
|
ios[i].titleID = newTitles[i] & 0xFFFFFFFF;
|
|
|
|
|
|
|
|
// Check if this title is an IOS stub
|
|
|
|
u32 tmdSize = 0;
|
|
|
|
tmd *iosTMD = NULL;
|
|
|
|
signed_blob *iosTMDBuffer = NULL;
|
|
|
|
|
|
|
|
// Get the stored TMD size for the title
|
|
|
|
if (ES_GetStoredTMDSize(0x0000000100000000ULL | ios[i].titleID, &tmdSize) < 0)
|
|
|
|
{
|
|
|
|
sprintf(MSG_Buffer, ERR_GetIosTMDSize, ios[i].titleID);
|
|
|
|
printError(MSG_Buffer);
|
|
|
|
sleep(5);
|
2013-10-25 21:14:36 +02:00
|
|
|
deinitGUI();
|
|
|
|
exit(1);
|
2013-10-12 20:38:34 +02:00
|
|
|
}
|
2015-10-05 06:11:56 +02:00
|
|
|
ios[i].infoBeerTicket = CheckBeerTicket(ios[i].titleID);
|
2013-10-12 20:38:34 +02:00
|
|
|
|
|
|
|
iosTMDBuffer = (signed_blob*)memalign(32, (tmdSize+31)&(~31));
|
|
|
|
memset(iosTMDBuffer, 0, tmdSize);
|
|
|
|
|
|
|
|
// Get the stored TMD for the title
|
|
|
|
logfile("Getting TMD for title %d\r\n", ios[i].titleID);
|
|
|
|
gprintf("Getting TMD for title %d\n", ios[i].titleID);
|
|
|
|
if (ES_GetStoredTMD(0x0000000100000000ULL | ios[i].titleID, iosTMDBuffer, tmdSize) < 0)
|
|
|
|
{
|
|
|
|
sprintf(MSG_Buffer, ERR_GetIosTMD, ios[i].titleID);
|
|
|
|
printError(MSG_Buffer);
|
|
|
|
sleep(5);
|
2013-10-25 21:14:36 +02:00
|
|
|
deinitGUI();
|
|
|
|
exit(1);
|
2013-10-12 20:38:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
iosTMD = (tmd*)SIGNATURE_PAYLOAD(iosTMDBuffer);
|
|
|
|
|
|
|
|
// Get the title version
|
2014-07-25 20:42:07 +02:00
|
|
|
ios[i].titleSize = Title_GetSize_FromTMD(iosTMD);
|
2013-10-12 20:38:34 +02:00
|
|
|
ios[i].revision = iosTMD->title_version;
|
|
|
|
ios[i].isStub = false;
|
|
|
|
ios[i].infoContent = *(u8 *)((u32)iosTMDBuffer+0x1E7);
|
|
|
|
ios[i].num_contents = iosTMD->num_contents;
|
2014-07-25 20:42:07 +02:00
|
|
|
gprintf("ios%d rev%d iosTMD->num_contents = %d size=%d\n", ios[i].titleID, ios[i].revision, iosTMD->num_contents, ios[i].titleSize);
|
|
|
|
logfile("ios%d rev%d iosTMD->num_contents = %d size=%d\r\n", ios[i].titleID, ios[i].revision, iosTMD->num_contents, ios[i].titleSize);
|
2013-10-12 20:38:34 +02:00
|
|
|
|
|
|
|
// Check if this is an IOS stub (according to WiiBrew.org)
|
|
|
|
if (IsKnownStub(ios[i].titleID, ios[i].revision))
|
|
|
|
ios[i].isStub = true;
|
|
|
|
else
|
|
|
|
{
|
2014-07-25 20:42:07 +02:00
|
|
|
ios[i].isStub = (ios[i].titleID != TID_BC && ios[i].titleID != TID_MIOS && ios[i].titleID != TID_NAND && ios[i].titleID != TID_WFS && ios[i].titleSize < 0x100000);
|
2013-10-12 20:38:34 +02:00
|
|
|
if (ios[i].isStub) {
|
|
|
|
gprintf("is stub\n");
|
|
|
|
logfile("is stub\r\n");
|
2015-09-29 00:32:10 +02:00
|
|
|
usleep(100000); // A little delay so you can see what stubs were scanned
|
2013-10-12 20:38:34 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-06-19 19:47:13 +02:00
|
|
|
if ((!ios[i].isStub || ios[i].titleID == TID_CBOOT2) && (SystemInfo.nandAccess) && (!getInfoFromContent(&ios[i]))) {
|
2015-03-13 09:16:55 +01:00
|
|
|
// Get the TMD hash
|
2014-06-19 19:47:13 +02:00
|
|
|
iosTMD->title_id = ((u64)(1) << 32) | 249;
|
|
|
|
brute_tmd(iosTMD);
|
|
|
|
|
|
|
|
sha1 hash;
|
|
|
|
SHA1((u8 *)iosTMDBuffer, tmdSize, hash);
|
|
|
|
|
2014-09-17 21:48:14 +02:00
|
|
|
sprintf(HashLogBuffer[lines], "IOS%d base hash: \r\n%02x %02x %02x %02x, %02x %02x %02x %02x, %02x %02x %02x %02x, %02x %02x %02x %02x, %02x %02x %02x %02x\r\n", \
|
2014-07-25 20:42:07 +02:00
|
|
|
ios[i].titleID, hash[0], hash[1], hash[2], hash[3], hash[4], hash[5], hash[6], hash[7], hash[8], hash[9], hash[10], hash[11], hash[12], hash[13], hash[14], hash[15], hash[16], hash[17], hash[18], hash[19]);
|
2014-06-19 19:47:13 +02:00
|
|
|
lines++;
|
|
|
|
|
|
|
|
for (j = 0;j < base_number;j++)
|
|
|
|
{
|
|
|
|
// Check hashes
|
2015-02-07 08:33:33 +01:00
|
|
|
if (memcmp((void*)hash, (u32*)&iosHash[j].hashes, sizeof(sha1)) == 0)
|
2014-06-19 19:47:13 +02:00
|
|
|
{
|
|
|
|
if (ios[i].titleID != iosHash[j].base)
|
|
|
|
ios[i].baseIOS = iosHash[j].base;
|
|
|
|
strcpy(ios[i].info, iosHash[j].info);
|
|
|
|
gprintf("is %s\n", ios[i].info);
|
|
|
|
logfile("is %s\r\n", ios[i].info);
|
2013-10-12 20:38:34 +02:00
|
|
|
}
|
2014-06-19 19:47:13 +02:00
|
|
|
}
|
2013-10-12 20:38:34 +02:00
|
|
|
}
|
|
|
|
|
2014-06-19 19:47:13 +02:00
|
|
|
if (ios[i].titleID == TID_BC || ios[i].titleID == TID_MIOS) SystemInfo.countBCMIOS++;
|
2013-10-12 20:38:34 +02:00
|
|
|
|
2014-02-10 16:00:50 +01:00
|
|
|
if (ios[i].isStub && !(iosTMD->title_version == 31338) && !(iosTMD->title_version == 65281) && !(iosTMD->title_version == 65535)) SystemInfo.countStubs++;
|
2023-03-09 19:42:29 +01:00
|
|
|
free(iosTMDBuffer);
|
2013-10-12 20:38:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Check if this title is an IOS stub
|
|
|
|
u32 tmdSize = 0;
|
|
|
|
signed_blob *iosTMDBuffer = NULL;
|
|
|
|
|
|
|
|
// Get the stored TMD size for the title
|
|
|
|
if (ES_GetStoredTMDSize(0x0000000100000000ULL | 2, &tmdSize) < 0)
|
|
|
|
{
|
|
|
|
sprintf(MSG_Buffer, ERR_GetIosTMDSize, 2);
|
|
|
|
printError(MSG_Buffer);
|
|
|
|
sleep(5);
|
2013-10-25 21:14:36 +02:00
|
|
|
deinitGUI();
|
|
|
|
exit(1);
|
2013-10-12 20:38:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
iosTMDBuffer = (signed_blob*)memalign(32, (tmdSize+31)&(~31));
|
|
|
|
memset(iosTMDBuffer, 0, tmdSize);
|
|
|
|
|
|
|
|
// Get the stored TMD for the title
|
|
|
|
if (ES_GetStoredTMD(0x0000000100000000ULL | 2, iosTMDBuffer, tmdSize) < 0)
|
|
|
|
{
|
|
|
|
sprintf(MSG_Buffer, ERR_GetIosTMD, 2);
|
|
|
|
printError(MSG_Buffer);
|
|
|
|
sleep(5);
|
2013-10-25 21:14:36 +02:00
|
|
|
deinitGUI();
|
|
|
|
exit(1);
|
2013-10-12 20:38:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
char filepath[ISFS_MAXPATH] ATTRIBUTE_ALIGN(0x20);
|
|
|
|
u8 *buffer = 0;
|
|
|
|
u32 filesize = 0;
|
|
|
|
iosinfo_t *sysInfo;
|
|
|
|
|
|
|
|
// Try to identify the cIOS by the info put in by the installer/ModMii
|
2013-10-18 03:25:17 +02:00
|
|
|
sysMenuInfoContent = *(u8 *)((u32)iosTMDBuffer+0x1E7);
|
2014-08-05 23:34:08 +02:00
|
|
|
sprintf(filepath, "/title/00000001/00000002/content/%08x.app", sysMenuInfoContent);
|
2014-06-19 19:47:13 +02:00
|
|
|
gprintf(filepath);
|
2015-10-09 02:04:26 +02:00
|
|
|
gprintf("\n");
|
2013-10-12 20:38:34 +02:00
|
|
|
ret = read_file_from_nand(filepath, &buffer, &filesize);
|
|
|
|
|
|
|
|
sysInfo = (iosinfo_t *)(buffer);
|
|
|
|
if (ret >= 0 && sysInfo != NULL && sysInfo->magicword == 0x1ee7c105 && sysInfo->magicversion == 1)
|
|
|
|
{
|
|
|
|
systemmenu.realRevision = sysInfo->version;
|
|
|
|
systemmenu.hasInfo = true;
|
|
|
|
sprintf(systemmenu.info, "%s%s", sysInfo->name, sysInfo->versionstring);
|
2013-10-21 18:41:01 +02:00
|
|
|
if (buffer != NULL) free(buffer);
|
2013-10-12 20:38:34 +02:00
|
|
|
} else {
|
|
|
|
systemmenu.realRevision = 0;
|
|
|
|
systemmenu.hasInfo = false;
|
2013-10-21 18:41:01 +02:00
|
|
|
strcpy(systemmenu.info, "NONE");
|
2013-10-12 20:38:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
NandShutdown();
|
2014-07-25 20:42:07 +02:00
|
|
|
//UnmountSD();
|
2013-10-12 20:38:34 +02:00
|
|
|
|
2014-02-10 16:00:50 +01:00
|
|
|
SystemInfo.countTitles = nbTitles;
|
|
|
|
nbTitles = SystemInfo.countIOS;
|
2015-02-07 08:33:33 +01:00
|
|
|
CheckTime();
|
2013-10-12 20:38:34 +02:00
|
|
|
|
|
|
|
// Get the certificates from the NAND
|
|
|
|
printLoading(MSG_GetCertificates);
|
2014-08-05 23:34:08 +02:00
|
|
|
UpdateTime();
|
2013-10-12 20:38:34 +02:00
|
|
|
if (!GetCertificates()) {
|
|
|
|
printError(ERR_GetCertificates);
|
|
|
|
sleep(5);
|
2013-10-25 21:14:36 +02:00
|
|
|
deinitGUI();
|
|
|
|
exit(1);
|
2013-10-12 20:38:34 +02:00
|
|
|
}
|
2015-02-07 08:33:33 +01:00
|
|
|
CheckTime();
|
2013-10-12 20:38:34 +02:00
|
|
|
//Select an IOS to test
|
|
|
|
WPAD_Init();
|
2014-06-19 19:47:13 +02:00
|
|
|
PAD_Init();
|
2013-10-12 20:38:34 +02:00
|
|
|
int selectedIOS = -1;
|
2014-02-10 16:00:50 +01:00
|
|
|
u32 wpressed;
|
2014-07-25 20:42:07 +02:00
|
|
|
time_t starttime = time(NULL);
|
2015-09-29 00:32:10 +02:00
|
|
|
|
2013-10-12 20:38:34 +02:00
|
|
|
printSelectIOS(MSG_SelectIOS, MSG_All);
|
|
|
|
|
|
|
|
bool completeReport = true;
|
|
|
|
|
|
|
|
while (difftime (time(NULL),starttime) < 15) {
|
2014-08-05 23:34:08 +02:00
|
|
|
|
2014-06-19 19:47:13 +02:00
|
|
|
wpressed = DetectInput(DI_BUTTONS_HELD);
|
2014-08-05 23:54:02 +02:00
|
|
|
usleep(80000);
|
2013-10-12 20:38:34 +02:00
|
|
|
|
|
|
|
if (wpressed & WPAD_BUTTON_RIGHT && selectedIOS < (nbTitles-1)){
|
|
|
|
selectedIOS++;
|
|
|
|
starttime = time(NULL);
|
|
|
|
|
2014-02-10 05:09:20 +01:00
|
|
|
titleID = newTitles[selectedIOS] & 0xFFFFFFFF;
|
2013-10-12 20:38:34 +02:00
|
|
|
|
|
|
|
switch (titleID)
|
|
|
|
{
|
2014-06-19 19:47:13 +02:00
|
|
|
case TID_BC:
|
2013-10-12 20:38:34 +02:00
|
|
|
sprintf(MSG_Buffer, "BC");
|
|
|
|
break;
|
2014-06-19 19:47:13 +02:00
|
|
|
case TID_MIOS:
|
2013-10-12 20:38:34 +02:00
|
|
|
sprintf(MSG_Buffer, "MIOS");
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
sprintf(MSG_Buffer, "IOS%d", titleID);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
printSelectIOS(MSG_SelectIOS, MSG_Buffer);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (wpressed & WPAD_BUTTON_LEFT && selectedIOS > -1) {
|
2013-10-18 03:25:17 +02:00
|
|
|
selectedIOS--;
|
2013-10-12 20:38:34 +02:00
|
|
|
starttime = time(NULL);
|
|
|
|
|
|
|
|
if (selectedIOS > -1) {
|
2014-02-10 05:09:20 +01:00
|
|
|
titleID = newTitles[selectedIOS] & 0xFFFFFFFF;
|
2013-10-12 20:38:34 +02:00
|
|
|
|
|
|
|
switch (titleID)
|
|
|
|
{
|
2014-06-19 19:47:13 +02:00
|
|
|
case TID_BC:
|
2013-10-12 20:38:34 +02:00
|
|
|
sprintf(MSG_Buffer, "BC");
|
|
|
|
break;
|
2014-06-19 19:47:13 +02:00
|
|
|
case TID_MIOS:
|
2013-10-12 20:38:34 +02:00
|
|
|
sprintf(MSG_Buffer, "MIOS");
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
sprintf(MSG_Buffer, "IOS%d", titleID);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
printSelectIOS(MSG_SelectIOS, MSG_Buffer);
|
|
|
|
} else {
|
|
|
|
printSelectIOS(MSG_SelectIOS, MSG_All);
|
|
|
|
}
|
|
|
|
}
|
2023-03-09 19:42:29 +01:00
|
|
|
/*
|
2013-10-12 20:38:34 +02:00
|
|
|
if (wpressed & WPAD_BUTTON_PLUS) {
|
|
|
|
printLoading(MSG_Update);
|
|
|
|
ret = updateApp();
|
2015-10-09 02:04:26 +02:00
|
|
|
gprintf("updateApp returned %i\n", ret);
|
2013-10-12 20:38:34 +02:00
|
|
|
if (ret == 2) {
|
|
|
|
printSuccess(MSG_NoUpdate);
|
|
|
|
sleep(5);
|
|
|
|
starttime = time(NULL);
|
2015-10-09 02:04:26 +02:00
|
|
|
if (selectedIOS > -1)
|
|
|
|
printSelectIOS(MSG_SelectIOS, MSG_Buffer);
|
|
|
|
else
|
|
|
|
printSelectIOS(MSG_SelectIOS, MSG_All);
|
2013-10-12 20:38:34 +02:00
|
|
|
} else if (ret >= 0) {
|
|
|
|
printSuccess(MSG_UpdateSuccess);
|
2015-02-07 08:33:33 +01:00
|
|
|
sleep(5);
|
2013-10-18 03:25:17 +02:00
|
|
|
deinitGUI();
|
2014-02-28 02:44:22 +01:00
|
|
|
exit(0);
|
2013-10-12 20:38:34 +02:00
|
|
|
} else if (ret < 0) {
|
|
|
|
printError(MSG_UpdateFail);
|
|
|
|
sleep(5);
|
|
|
|
starttime = time(NULL);
|
2015-10-09 02:04:26 +02:00
|
|
|
if (selectedIOS > -1)
|
|
|
|
printSelectIOS(MSG_SelectIOS, MSG_Buffer);
|
|
|
|
else
|
|
|
|
printSelectIOS(MSG_SelectIOS, MSG_All);
|
2013-10-12 20:38:34 +02:00
|
|
|
}
|
|
|
|
}
|
2023-03-09 19:42:29 +01:00
|
|
|
*/
|
|
|
|
// Return to the loader
|
|
|
|
if (wpressed & WPAD_BUTTON_HOME) {
|
|
|
|
UnmountSD();
|
|
|
|
UnmountUSB();
|
|
|
|
deinitGUI();
|
|
|
|
exit(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Return to System Menu
|
|
|
|
if (wpressed & WPAD_BUTTON_PLUS) {
|
|
|
|
UnmountSD();
|
|
|
|
UnmountUSB();
|
|
|
|
deinitGUI();
|
|
|
|
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Shutdown Wii
|
|
|
|
if (wpressed & WPAD_BUTTON_MINUS) {
|
|
|
|
UnmountSD();
|
|
|
|
UnmountUSB();
|
|
|
|
deinitGUI();
|
|
|
|
SYS_ResetSystem(SYS_POWEROFF, 0, 0);
|
|
|
|
}
|
2013-10-12 20:38:34 +02:00
|
|
|
|
|
|
|
if (wpressed & WPAD_BUTTON_A) {
|
2013-10-18 03:25:17 +02:00
|
|
|
break;
|
2013-10-12 20:38:34 +02:00
|
|
|
}
|
|
|
|
}
|
2023-03-09 19:42:29 +01:00
|
|
|
sleep(1); // Without this some controllers don't reconnect correctly (modern libogc issue?)
|
|
|
|
Wpad_Disconnect();
|
2013-10-12 20:38:34 +02:00
|
|
|
if (selectedIOS > -1) {
|
|
|
|
nbTitles = 1;
|
|
|
|
completeReport = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Test vulnerabilities in IOS
|
|
|
|
for (i = 0; i < nbTitles; i++)
|
|
|
|
{
|
|
|
|
if (selectedIOS > -1) i = selectedIOS; //If specific IOS is selected
|
|
|
|
|
2014-06-19 19:47:13 +02:00
|
|
|
if (ios[i].titleID == TID_BC) sprintf(MSG_Buffer2, "BC");
|
|
|
|
else if (ios[i].titleID == TID_MIOS) sprintf(MSG_Buffer2, "MIOS");
|
2013-10-12 20:38:34 +02:00
|
|
|
else sprintf(MSG_Buffer2, "IOS%d", ios[i].titleID);
|
|
|
|
|
|
|
|
sprintf(MSG_Buffer, MSG_TestingIOS, MSG_Buffer2);
|
|
|
|
printLoadingBar(MSG_Buffer, (100.0/(nbTitles-1)*(i+1)));
|
|
|
|
|
2015-09-29 00:32:10 +02:00
|
|
|
if (ios[i].isStub ||
|
|
|
|
ios[i].titleID == TID_BC ||
|
|
|
|
ios[i].titleID == TID_MIOS ||
|
|
|
|
ios[i].titleID == TID_NAND ||
|
2014-06-19 19:47:13 +02:00
|
|
|
ios[i].titleID == TID_WFS)
|
2013-10-12 20:38:34 +02:00
|
|
|
{
|
|
|
|
ios[i].infoFakeSignature = false;
|
|
|
|
ios[i].infoESIdentify = false;
|
|
|
|
ios[i].infoFlashAccess = false;
|
|
|
|
ios[i].infoNANDAccess = false;
|
|
|
|
ios[i].infoBoot2Access = false;
|
|
|
|
ios[i].infoUSB2 = false;
|
2014-08-22 19:55:55 +02:00
|
|
|
if (ios[i].titleID == TID_NAND || ios[i].titleID == TID_WFS) ios[i].infovIOS = true;
|
2013-10-12 20:38:34 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Reload IOS
|
2015-10-27 09:04:08 +01:00
|
|
|
gprintf("IOS_ReloadIOS(%d)\n", ios[i].titleID);
|
|
|
|
logfile("IOS_ReloadIOS(%d)\r\n", ios[i].titleID);
|
2015-09-29 00:32:10 +02:00
|
|
|
|
2023-03-09 19:42:29 +01:00
|
|
|
if (arguments.USB)
|
|
|
|
USB_Deinitialize();
|
2015-01-28 18:14:15 +01:00
|
|
|
if (SystemInfo.deviceType == CONSOLE_WII_U)
|
|
|
|
IosPatch_FULL(false, false, false, false, ios[i].titleID);
|
|
|
|
else
|
|
|
|
IOS_ReloadIOS(ios[i].titleID);
|
2015-09-29 00:32:10 +02:00
|
|
|
|
2014-08-22 19:55:55 +02:00
|
|
|
// Test IOS type
|
|
|
|
gprintf("// Test IOS type\n");
|
|
|
|
logfile("// Test IOS type\r\n");
|
2017-11-04 07:53:21 +01:00
|
|
|
if(SystemInfo.deviceType != CONSOLE_WII) ios[i].infovIOS = CheckIOSType(ios[i].titleID, ios[i].revision);
|
2013-10-12 20:38:34 +02:00
|
|
|
|
|
|
|
// Test fake signature
|
|
|
|
gprintf("// Test fake signature\n");
|
|
|
|
logfile("// Test fake signature\r\n");
|
2014-02-13 10:16:23 +01:00
|
|
|
ios[i].infoFakeSignature = CheckFakeSignature();
|
2013-10-12 20:38:34 +02:00
|
|
|
|
|
|
|
// Test ES Identify
|
|
|
|
gprintf("// Test ES Identify\n");
|
|
|
|
logfile("// Test ES Identify\r\n");
|
2014-02-13 10:16:23 +01:00
|
|
|
ios[i].infoESIdentify = CheckESIdentify();
|
2013-10-12 20:38:34 +02:00
|
|
|
|
|
|
|
// Test Flash Access
|
|
|
|
gprintf("// Test Flash Access\n");
|
|
|
|
logfile("// Test Flash Access\r\n");
|
2014-02-13 10:16:23 +01:00
|
|
|
ios[i].infoFlashAccess = CheckFlashAccess();
|
2013-10-12 20:38:34 +02:00
|
|
|
|
|
|
|
// Test NAND Access
|
|
|
|
gprintf("// Test NAND Access\n");
|
|
|
|
logfile("// Test NAND Access\r\n");
|
2014-02-13 10:16:23 +01:00
|
|
|
ios[i].infoNANDAccess = CheckNANDAccess();
|
2013-10-12 20:38:34 +02:00
|
|
|
|
|
|
|
// Test Boot2 Access
|
|
|
|
gprintf("// Test Boot2 Access\n");
|
|
|
|
logfile("// Test Boot2 Access\r\n");
|
2014-02-13 10:16:23 +01:00
|
|
|
ios[i].infoBoot2Access = CheckBoot2Access();
|
2013-10-12 20:38:34 +02:00
|
|
|
|
|
|
|
// Test USB 2.0
|
|
|
|
gprintf("// Test USB 2.0\n");
|
|
|
|
logfile("// Test USB 2.0\r\n");
|
2014-02-13 10:16:23 +01:00
|
|
|
ios[i].infoUSB2 = CheckUSB2(ios[i].titleID);
|
2013-10-12 20:38:34 +02:00
|
|
|
|
2017-11-04 07:53:21 +01:00
|
|
|
// Set sysMenuIOSVersion and sysMenuIOSType if currently running the System Menu IOS
|
|
|
|
if (ios[i].titleID == SystemInfo.sysMenuIOS) {
|
|
|
|
SystemInfo.sysMenuIOSVersion = ios[i].revision;
|
|
|
|
SystemInfo.sysMenuIOSType = ios[i].infovIOS;
|
|
|
|
}
|
2013-10-12 20:38:34 +02:00
|
|
|
|
|
|
|
// Check Priiloader
|
2014-02-10 16:00:50 +01:00
|
|
|
if (!SystemInfo.nandAccess && SystemInfo.priiloader == -2 && ios[i].infoNANDAccess) {
|
|
|
|
SystemInfo.priiloader = checkSysLoader();
|
2013-10-12 20:38:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Check Base IOS
|
2014-02-10 16:00:50 +01:00
|
|
|
if (!SystemInfo.nandAccess && ios[i].infoNANDAccess) {
|
2013-10-12 20:38:34 +02:00
|
|
|
NandStartup();
|
|
|
|
int k = 0;
|
|
|
|
for (k = 0; k < nbTitles; k++) {
|
2014-06-19 19:47:13 +02:00
|
|
|
if ((ios[i].isStub || ios[i].titleID == TID_BC || ios[i].titleID == TID_MIOS) && ios[i].titleID != TID_CBOOT2) continue;
|
2013-10-12 20:38:34 +02:00
|
|
|
getInfoFromContent(&ios[k]);
|
|
|
|
}
|
|
|
|
NandShutdown();
|
|
|
|
}
|
|
|
|
if ((ios[i].titleID==222 || ios[i].titleID==224 || ios[i].titleID==223 || ios[i].titleID==202 || ios[i].titleID==225) && ios[i].baseIOS < 0) {
|
|
|
|
ret = mload_init();
|
|
|
|
gprintf("// mload_get_IOS_base()\n");
|
|
|
|
logfile("// mload_get_IOS_base()\r\n");
|
|
|
|
ios[i].baseIOS = mload_get_IOS_base();
|
|
|
|
gprintf("// mload_get_version()\n");
|
|
|
|
logfile("// mload_get_version()\r\n");
|
|
|
|
ios[i].mloadVersion = mload_get_version();
|
|
|
|
mload_close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--Generate Report--
|
2014-07-25 20:42:07 +02:00
|
|
|
UpdateTime();
|
2013-10-12 20:38:34 +02:00
|
|
|
printLoading(MSG_GenerateReport);
|
2015-09-29 00:32:10 +02:00
|
|
|
|
2013-10-12 20:38:34 +02:00
|
|
|
|
2015-03-13 09:16:55 +01:00
|
|
|
char ReportBuffer[200][100] = {{0}}; // The maximum display length is actually 73
|
2013-10-12 20:38:34 +02:00
|
|
|
|
2014-02-10 16:00:50 +01:00
|
|
|
if (SystemInfo.dvdSupport > 0)
|
|
|
|
formatDate(SystemInfo.dvdSupport, ReportBuffer);
|
2013-12-02 19:08:33 +01:00
|
|
|
else
|
|
|
|
sprintf(ReportBuffer[DVD], TXT_NoDVD);
|
2013-10-12 20:38:34 +02:00
|
|
|
|
2013-12-02 19:08:33 +01:00
|
|
|
// Display Title
|
|
|
|
sprintf(ReportBuffer[APP_TITLE], TXT_AppTitle, TXT_AppVersion);
|
2015-10-06 17:12:36 +02:00
|
|
|
sprintf(ReportBuffer[APP_IOS], TXT_AppIOS, SystemInfo.runningIOSType ? "v" : "", SystemInfo.runningIOS, SystemInfo.runningIOSRevision);
|
2014-02-13 10:16:23 +01:00
|
|
|
SystemInfo.validregion = SystemInfo.systemRegion >= CONF_REGION_JP && SystemInfo.systemRegion <= CONF_REGION_CN;
|
2013-10-12 20:38:34 +02:00
|
|
|
|
2013-12-02 19:08:33 +01:00
|
|
|
// Display the console region
|
2014-02-10 16:00:50 +01:00
|
|
|
if (SystemInfo.sysNinVersion != 0.0f) {
|
2014-02-13 10:16:23 +01:00
|
|
|
sprintf(ReportBuffer[TEXT_REGION], "%s: %s", TXT_Region, SystemInfo.validregion ? Regions[SystemInfo.systemRegion] : "");
|
|
|
|
if (SystemInfo.validregion)
|
2014-02-10 16:00:50 +01:00
|
|
|
sprintf(ReportBuffer[SYSMENU], TXT_SysMenu, SystemInfo.sysNinVersion, SystemInfo.sysMenuRegion, SystemInfo.sysMenuVer);
|
2013-12-02 19:08:33 +01:00
|
|
|
else
|
|
|
|
strcat(ReportBuffer[SYSMENU], TXT_Unknown);
|
2015-09-29 00:32:10 +02:00
|
|
|
|
2013-12-02 19:08:33 +01:00
|
|
|
} else if (systemmenu.hasInfo) {
|
2014-02-18 02:37:54 +01:00
|
|
|
SystemInfo.sysNinVersion = GetSysMenuNintendoVersion(systemmenu.realRevision);
|
2014-02-10 16:00:50 +01:00
|
|
|
SystemInfo.sysMenuRegion = GetSysMenuRegion(SystemInfo.sysMenuVer);
|
2014-02-13 10:16:23 +01:00
|
|
|
sprintf(ReportBuffer[TEXT_REGION], "%s: %s", TXT_Region, SystemInfo.validregion ? Regions[SystemInfo.systemRegion] : "");
|
|
|
|
if (SystemInfo.validregion)
|
2014-02-18 02:37:54 +01:00
|
|
|
sprintf(ReportBuffer[SYSMENU], TXT_SysMenu3, SystemInfo.sysNinVersion, SystemInfo.sysMenuRegion, SystemInfo.sysMenuVer, systemmenu.realRevision, systemmenu.info);
|
2013-12-02 19:08:33 +01:00
|
|
|
else
|
|
|
|
strcat(ReportBuffer[SYSMENU], TXT_Unknown);
|
|
|
|
} else {
|
|
|
|
signed_blob *TMD = NULL;
|
|
|
|
tmd *t = NULL;
|
|
|
|
u32 TMD_size = 0;
|
2013-10-12 20:38:34 +02:00
|
|
|
|
2013-12-02 19:08:33 +01:00
|
|
|
ret = GetTMD((((u64)(1) << 32) | (0x0000000100000002LL)), &TMD, &TMD_size);
|
2013-10-12 20:38:34 +02:00
|
|
|
|
2013-12-02 19:08:33 +01:00
|
|
|
t = (tmd*)SIGNATURE_PAYLOAD(TMD);
|
|
|
|
t->title_id = ((u64)(1) << 32) | 249;
|
|
|
|
brute_tmd(t);
|
2013-10-12 20:38:34 +02:00
|
|
|
|
2013-12-02 19:08:33 +01:00
|
|
|
sha1 hash;
|
|
|
|
SHA1((u8 *)TMD, TMD_size, hash);
|
2013-10-12 20:38:34 +02:00
|
|
|
|
2013-12-02 19:08:33 +01:00
|
|
|
free(TMD);
|
2013-10-12 20:38:34 +02:00
|
|
|
|
2013-12-02 19:08:33 +01:00
|
|
|
u32 hashtest[5] = {0xc6404e23, 0x39eff390, 0x1d17c28f, 0xc3970680, 0xf44524e7};
|
2013-10-12 20:38:34 +02:00
|
|
|
|
2013-12-02 19:08:33 +01:00
|
|
|
if (memcmp((void *)hash, (u32 *)&hashtest, sizeof(sha1)) == 0)
|
|
|
|
{
|
2014-02-10 16:00:50 +01:00
|
|
|
SystemInfo.sysNinVersion = 4.1f;
|
2013-12-02 19:08:33 +01:00
|
|
|
sprintf(ReportBuffer[TEXT_REGION], "%s: PAL", TXT_Region);
|
2014-02-10 16:00:50 +01:00
|
|
|
sprintf(ReportBuffer[SYSMENU], TXT_SysMenu, SystemInfo.sysNinVersion, "E", SystemInfo.sysMenuVer);
|
2013-12-02 19:08:33 +01:00
|
|
|
} else {
|
2014-02-10 16:00:50 +01:00
|
|
|
SystemInfo.sysMenuIOS = get_title_ios(TITLE_ID(0x00000001, 0x00000002));
|
2013-10-12 20:38:34 +02:00
|
|
|
|
2014-02-10 16:00:50 +01:00
|
|
|
switch (SystemInfo.systemRegion)
|
2013-12-02 19:08:33 +01:00
|
|
|
{
|
|
|
|
case CONF_REGION_US:
|
|
|
|
sprintf(ReportBuffer[TEXT_REGION], "%s: NTSC-U", TXT_Region);
|
2013-10-12 20:38:34 +02:00
|
|
|
break;
|
|
|
|
|
2013-12-02 19:08:33 +01:00
|
|
|
case CONF_REGION_EU:
|
|
|
|
sprintf(ReportBuffer[TEXT_REGION], "%s: PAL", TXT_Region);
|
2013-10-12 20:38:34 +02:00
|
|
|
break;
|
|
|
|
|
2013-12-02 19:08:33 +01:00
|
|
|
case CONF_REGION_JP:
|
|
|
|
sprintf(ReportBuffer[TEXT_REGION], "%s: NTSC-J", TXT_Region);
|
2013-10-12 20:38:34 +02:00
|
|
|
break;
|
|
|
|
|
2013-12-02 19:08:33 +01:00
|
|
|
case CONF_REGION_KR:
|
|
|
|
sprintf(ReportBuffer[TEXT_REGION], "%s: KOR", TXT_Region);
|
2013-10-12 20:38:34 +02:00
|
|
|
break;
|
|
|
|
|
2013-12-02 19:08:33 +01:00
|
|
|
default:
|
|
|
|
sprintf(ReportBuffer[TEXT_REGION], "%s: ", TXT_Region);
|
|
|
|
strcat(ReportBuffer[TEXT_REGION], TXT_Unknown);
|
|
|
|
}
|
2013-10-12 20:38:34 +02:00
|
|
|
|
2014-02-10 16:00:50 +01:00
|
|
|
switch (SystemInfo.sysMenuIOS)
|
2013-12-02 19:08:33 +01:00
|
|
|
{
|
|
|
|
case 9:
|
2014-02-13 10:16:23 +01:00
|
|
|
sprintf(ReportBuffer[SYSMENU], TXT_SysMenu2, "1.0", SystemInfo.sysMenuRegion, SystemInfo.sysMenuVer);
|
2014-02-10 16:00:50 +01:00
|
|
|
break;
|
2013-12-02 19:08:33 +01:00
|
|
|
case 11:
|
2014-02-13 10:16:23 +01:00
|
|
|
sprintf(ReportBuffer[SYSMENU], TXT_SysMenu2, "2.0/2.1", SystemInfo.sysMenuRegion, SystemInfo.sysMenuVer);
|
2014-02-10 16:00:50 +01:00
|
|
|
break;
|
2013-12-02 19:08:33 +01:00
|
|
|
case 20:
|
2014-02-13 10:16:23 +01:00
|
|
|
sprintf(ReportBuffer[SYSMENU], TXT_SysMenu2, "2.2", SystemInfo.sysMenuRegion);
|
2014-02-10 16:00:50 +01:00
|
|
|
break;
|
2013-12-02 19:08:33 +01:00
|
|
|
case 30:
|
2014-02-13 10:16:23 +01:00
|
|
|
sprintf(ReportBuffer[SYSMENU], TXT_SysMenu2, "3.0/3.1/3.2/3.3", SystemInfo.sysMenuRegion, SystemInfo.sysMenuVer);
|
2014-02-10 16:00:50 +01:00
|
|
|
break;
|
2013-12-02 19:08:33 +01:00
|
|
|
case 40:
|
2014-02-13 10:16:23 +01:00
|
|
|
sprintf(ReportBuffer[SYSMENU], TXT_SysMenu2, "3.3", SystemInfo.sysMenuRegion, SystemInfo.sysMenuVer);
|
2014-02-10 16:00:50 +01:00
|
|
|
break;
|
2013-12-02 19:08:33 +01:00
|
|
|
case 50:
|
2014-02-13 10:16:23 +01:00
|
|
|
sprintf(ReportBuffer[SYSMENU], TXT_SysMenu2, "3.4", SystemInfo.sysMenuRegion, SystemInfo.sysMenuVer);
|
2014-02-10 16:00:50 +01:00
|
|
|
break;
|
2013-12-02 19:08:33 +01:00
|
|
|
case 60:
|
2014-02-13 10:16:23 +01:00
|
|
|
sprintf(ReportBuffer[SYSMENU], TXT_SysMenu2, "4.0/4.1", SystemInfo.sysMenuRegion, SystemInfo.sysMenuVer);
|
2014-02-10 16:00:50 +01:00
|
|
|
break;
|
2013-12-02 19:08:33 +01:00
|
|
|
case 70:
|
2014-02-13 10:16:23 +01:00
|
|
|
sprintf(ReportBuffer[SYSMENU], TXT_SysMenu2, "4.2", SystemInfo.sysMenuRegion, SystemInfo.sysMenuVer);
|
2014-02-10 16:00:50 +01:00
|
|
|
break;
|
2013-12-02 19:08:33 +01:00
|
|
|
case 80:
|
2014-02-13 10:16:23 +01:00
|
|
|
sprintf(ReportBuffer[SYSMENU], TXT_SysMenu2, "4.3", SystemInfo.sysMenuRegion, SystemInfo.sysMenuVer);
|
2014-02-10 16:00:50 +01:00
|
|
|
break;
|
2013-12-02 19:08:33 +01:00
|
|
|
default:
|
2014-02-13 10:16:23 +01:00
|
|
|
sprintf(ReportBuffer[SYSMENU], TXT_SysMenu2, "0.0", SystemInfo.sysMenuRegion, SystemInfo.sysMenuVer);
|
2014-02-10 16:00:50 +01:00
|
|
|
break;
|
2013-12-02 19:08:33 +01:00
|
|
|
}
|
2013-10-12 20:38:34 +02:00
|
|
|
}
|
2013-12-02 19:08:33 +01:00
|
|
|
}
|
2013-10-12 20:38:34 +02:00
|
|
|
|
2013-12-02 19:08:33 +01:00
|
|
|
switch (CONF_GetSerialCode(NULL)) {
|
|
|
|
case CONF_CODE_JPN:
|
|
|
|
case CONF_CODE_VJPNI:
|
|
|
|
case CONF_CODE_VJPNO:
|
|
|
|
// JAP
|
2014-02-10 16:00:50 +01:00
|
|
|
if (SystemInfo.systemRegion != CONF_REGION_JP) {
|
2013-12-02 19:08:33 +01:00
|
|
|
strcat(ReportBuffer[TEXT_REGION], TXT_OriginalRegion);
|
|
|
|
strcat(ReportBuffer[TEXT_REGION], "JAP)");
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CONF_CODE_USA:
|
|
|
|
case CONF_CODE_USAK:
|
|
|
|
case CONF_CODE_VUSAI:
|
|
|
|
case CONF_CODE_VUSAO:
|
|
|
|
// USA
|
2014-02-10 16:00:50 +01:00
|
|
|
if (SystemInfo.systemRegion != CONF_REGION_US) {
|
2013-12-02 19:08:33 +01:00
|
|
|
strcat(ReportBuffer[TEXT_REGION], TXT_OriginalRegion);
|
|
|
|
strcat(ReportBuffer[TEXT_REGION], "USA)");
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CONF_CODE_EURH:
|
|
|
|
case CONF_CODE_EURHK:
|
|
|
|
case CONF_CODE_EURM:
|
|
|
|
case CONF_CODE_EURMK:
|
|
|
|
case CONF_CODE_EURF:
|
|
|
|
case CONF_CODE_EURFK:
|
|
|
|
case CONF_CODE_VEURHI:
|
|
|
|
case CONF_CODE_VEURHO:
|
|
|
|
case CONF_CODE_VEURMI:
|
|
|
|
case CONF_CODE_VEURMO:
|
|
|
|
case CONF_CODE_VEURFI:
|
|
|
|
case CONF_CODE_VEURFO:
|
|
|
|
// EU
|
2014-02-10 16:00:50 +01:00
|
|
|
if (SystemInfo.systemRegion != CONF_REGION_EU) {
|
2013-12-02 19:08:33 +01:00
|
|
|
strcat(ReportBuffer[TEXT_REGION], TXT_OriginalRegion);
|
|
|
|
strcat(ReportBuffer[TEXT_REGION], "PAL)");
|
2013-10-12 20:38:34 +02:00
|
|
|
}
|
2013-12-02 19:08:33 +01:00
|
|
|
break;
|
|
|
|
case CONF_CODE_KOR:
|
|
|
|
// KOR
|
2014-02-10 16:00:50 +01:00
|
|
|
if (SystemInfo.systemRegion != CONF_REGION_KR) {
|
2013-12-02 19:08:33 +01:00
|
|
|
strcat(ReportBuffer[TEXT_REGION], TXT_OriginalRegion);
|
|
|
|
strcat(ReportBuffer[TEXT_REGION], "KOR)");
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CONF_CODE_AUS:
|
|
|
|
case CONF_CODE_AUSK:
|
|
|
|
case CONF_CODE_VAUSI:
|
|
|
|
case CONF_CODE_VAUSO:
|
|
|
|
// AUS
|
|
|
|
strcat(ReportBuffer[TEXT_REGION], TXT_OriginalRegion);
|
|
|
|
strcat(ReportBuffer[TEXT_REGION], "AUS)");
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2013-10-12 20:38:34 +02:00
|
|
|
|
2014-02-10 16:00:50 +01:00
|
|
|
if (SystemInfo.priiloader == 1)
|
2013-12-02 19:08:33 +01:00
|
|
|
sprintf(ReportBuffer[PRIILOADER], TXT_Priiloader);
|
2014-02-10 16:00:50 +01:00
|
|
|
else if (SystemInfo.priiloader == 2)
|
2013-12-02 19:08:33 +01:00
|
|
|
sprintf(ReportBuffer[PRIILOADER], TXT_PreFiix);
|
|
|
|
|
2014-02-13 10:16:23 +01:00
|
|
|
if (homebrew.hbc == HBC_NONE || homebrew.hbcversion == 0)
|
2014-06-19 19:47:13 +02:00
|
|
|
sprintf(ReportBuffer[HBC], TXT_NO_HBC);
|
2014-02-13 10:16:23 +01:00
|
|
|
else if (homebrew.hbcIOS == 0)
|
2013-12-02 19:08:33 +01:00
|
|
|
sprintf(ReportBuffer[HBC], TXT_HBC_STUB);
|
2023-03-09 19:42:29 +01:00
|
|
|
else if (homebrew.hbc == HBC_OPEN)
|
|
|
|
sprintf(ReportBuffer[HBC], TXT_HBC_112, homebrew.hbcversion, homebrew.hbcIOS);
|
2014-02-13 10:16:23 +01:00
|
|
|
else if (homebrew.hbc == HBC_LULZ)
|
|
|
|
sprintf(ReportBuffer[HBC], TXT_HBC_112, homebrew.hbcversion, homebrew.hbcIOS);
|
|
|
|
else if (homebrew.hbcversion == VERSION_1_1_0)
|
|
|
|
sprintf(ReportBuffer[HBC], TXT_HBC_NEW, homebrew.hbcIOS);
|
|
|
|
else if (homebrew.hbcversion > 0)
|
|
|
|
sprintf(ReportBuffer[HBC], TXT_HBC, homebrew.hbcversion, homebrew.hbcIOS);
|
2013-12-02 19:08:33 +01:00
|
|
|
|
2014-02-13 10:16:23 +01:00
|
|
|
if (homebrew.hbf > HBF_NONE)
|
|
|
|
sprintf(ReportBuffer[HBF], TXT_HBF, homebrew.hbfversion);
|
2013-12-02 19:08:33 +01:00
|
|
|
|
2017-11-04 07:53:21 +01:00
|
|
|
// If console type is unknown (because no AHB access), try to determine it by the IOS80 version. Less reliable
|
|
|
|
if ((SystemInfo.deviceType == CONSOLE_UNKNOWN) && (SystemInfo.sysMenuIOSType == IOS_WII_U) && (SystemInfo.sysMenuIOS == 80) && (SystemInfo.sysMenuIOSVersion == 7200))
|
|
|
|
SystemInfo.deviceType = CONSOLE_WII_U;
|
|
|
|
|
|
|
|
const char *device_types[] = {"Wii", "vWii", TXT_Unknown};
|
|
|
|
|
2015-02-07 08:33:33 +01:00
|
|
|
sprintf(ReportBuffer[HOLLYWOOD], TXT_Hollywood, HOLLYWOOD_VERSION);
|
2014-02-10 16:00:50 +01:00
|
|
|
sprintf(ReportBuffer[CONSOLE_ID], TXT_ConsoleID, SystemInfo.deviceID);
|
2017-11-04 07:53:21 +01:00
|
|
|
sprintf(ReportBuffer[CONSOLE_TYPE], TXT_ConsoleType, device_types[SystemInfo.deviceType]);
|
2014-02-15 06:16:55 +01:00
|
|
|
sprintf(ReportBuffer[COUNTRY], TXT_ShopCountry, (strlen(SystemInfo.country)) ? SystemInfo.country : TXT_Unknown, SystemInfo.shopcode);
|
2014-02-13 10:16:23 +01:00
|
|
|
sprintf(ReportBuffer[BOOT2_VERSION], TXT_vBoot2, SystemInfo.boot2version);
|
2014-02-10 16:00:50 +01:00
|
|
|
sprintf(ReportBuffer[NR_OF_TITLES], TXT_NrOfTitles, SystemInfo.countTitles);
|
|
|
|
sprintf(ReportBuffer[NR_OF_IOS], TXT_NrOfIOS, (SystemInfo.countIOS - SystemInfo.countBCMIOS), SystemInfo.countStubs);
|
2013-12-02 19:08:33 +01:00
|
|
|
|
|
|
|
|
|
|
|
// Display IOS vulnerabilities
|
|
|
|
int lineOffset = 0;
|
2015-09-29 00:32:10 +02:00
|
|
|
int skippedOffset = 0;
|
|
|
|
int lastIOS = 0;
|
2013-12-02 19:08:33 +01:00
|
|
|
for (i = 0; i < nbTitles; i++)
|
|
|
|
{
|
|
|
|
lineOffset = i + LAST;
|
2015-09-29 00:32:10 +02:00
|
|
|
if (arguments.skipIOScnt > 0) {
|
|
|
|
for(j = 0; j < arguments.skipIOScnt; j++) {
|
|
|
|
if (arguments.skipIOSlist[j] > lastIOS && arguments.skipIOSlist[j] < ios[i].titleID) {
|
|
|
|
snprintf(ReportBuffer[skippedOffset + lineOffset], MAX_ELEMENTS(ReportBuffer[0]), "%sIOS%d: %s", (SystemInfo.deviceType == CONSOLE_WII_U) ? "v" : "", arguments.skipIOSlist[j], TXT_IOSSkipped);
|
|
|
|
skippedOffset++;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-12-02 19:08:33 +01:00
|
|
|
if (selectedIOS > -1) i = selectedIOS; //If specific IOS is selected
|
|
|
|
|
2014-06-19 19:47:13 +02:00
|
|
|
if (ios[i].titleID == TID_BC) {
|
2015-09-29 00:32:10 +02:00
|
|
|
sprintf(ReportBuffer[skippedOffset + lineOffset], "BC v%d", ios[i].revision);
|
2014-06-19 19:47:13 +02:00
|
|
|
} else if (ios[i].titleID == TID_MIOS) {
|
2015-09-29 00:32:10 +02:00
|
|
|
sprintf(ReportBuffer[skippedOffset + lineOffset], "MIOS v%d%s", ios[i].revision, SystemInfo.miosInfo);
|
2014-09-17 21:48:14 +02:00
|
|
|
} else if (ios[i].baseIOS == 75 && (ios[i].titleID==222 || ios[i].titleID==224 || ios[i].titleID==223 || ios[i].titleID==202 || ios[i].titleID==225)) {
|
2015-09-29 00:32:10 +02:00
|
|
|
sprintf(ReportBuffer[skippedOffset + lineOffset], "%sIOS%d[38+37] (rev %d, Info: %s):", ios[i].infovIOS ? "v" : "", ios[i].titleID, ios[i].revision, ios[i].info);
|
2014-09-17 21:48:14 +02:00
|
|
|
} else if (ios[i].baseIOS == 98 && (ios[i].titleID==222 || ios[i].titleID==224 || ios[i].titleID==223 || ios[i].titleID==202 || ios[i].titleID==225)) {
|
2015-09-29 00:32:10 +02:00
|
|
|
sprintf(ReportBuffer[skippedOffset + lineOffset], "%sIOS%d[38+60] (rev %d, Info: %s):", ios[i].infovIOS ? "v" : "", ios[i].titleID, ios[i].revision, ios[i].info);
|
2013-12-02 19:08:33 +01:00
|
|
|
} else {
|
|
|
|
if(ios[i].mloadVersion > 0 && ios[i].baseIOS > 0) {
|
|
|
|
int v, s;
|
|
|
|
v = ios[i].mloadVersion;
|
|
|
|
s = v & 0x0F;
|
|
|
|
v = v >> 4;
|
|
|
|
if (v == 0 && s == 1) {
|
|
|
|
v = 4;
|
|
|
|
s = 0;
|
2013-10-12 20:38:34 +02:00
|
|
|
}
|
2015-09-29 00:32:10 +02:00
|
|
|
sprintf(ReportBuffer[skippedOffset + lineOffset], "%sIOS%d[%d] (rev %d, Info: hermes-v%d.%d):", ios[i].infovIOS ? "v" : "", ios[i].titleID, ios[i].baseIOS, ios[i].revision, v, s);
|
2013-12-02 19:08:33 +01:00
|
|
|
} else if(ios[i].baseIOS > 0) {
|
2015-09-29 00:32:10 +02:00
|
|
|
snprintf(ReportBuffer[skippedOffset + lineOffset], MAX_ELEMENTS(ReportBuffer[0]), "%sIOS%d[%d] (rev %d, Info: %s):", ios[i].infovIOS ? "v" : "", ios[i].titleID, ios[i].baseIOS, ios[i].revision, ios[i].info);
|
2013-12-02 19:08:33 +01:00
|
|
|
} else if (strcmp(ios[i].info, "NULL") != 0 && !ios[i].isStub) {
|
2015-09-29 00:32:10 +02:00
|
|
|
snprintf(ReportBuffer[skippedOffset + lineOffset], MAX_ELEMENTS(ReportBuffer[0]), "%sIOS%d (rev %d, Info: %s):", ios[i].infovIOS ? "v" : "", ios[i].titleID, ios[i].revision, ios[i].info);
|
2013-12-02 19:08:33 +01:00
|
|
|
} else if (ios[i].titleID == 249 && ios[i].revision > 11 && ios[i].revision < 18) {
|
2015-09-29 00:32:10 +02:00
|
|
|
sprintf(ReportBuffer[skippedOffset + lineOffset], "%sIOS%d[38] (rev %d):", ios[i].infovIOS ? "v" : "", ios[i].titleID, ios[i].revision);
|
2013-12-02 19:08:33 +01:00
|
|
|
} else {
|
2015-09-29 00:32:10 +02:00
|
|
|
snprintf(ReportBuffer[skippedOffset + lineOffset], MAX_ELEMENTS(ReportBuffer[0]), "%sIOS%d (rev %d):", ios[i].infovIOS ? "v" : "", ios[i].titleID, ios[i].revision);
|
2013-10-12 20:38:34 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-12-02 19:08:33 +01:00
|
|
|
// Check BootMii As IOS (BootMii As IOS is installed on IOS254 rev 31338)
|
2014-06-19 19:47:13 +02:00
|
|
|
if (ios[i].titleID == TID_BOOTMII && (ios[i].revision == 31338 || ios[i].revision == 65281))
|
2015-09-29 00:32:10 +02:00
|
|
|
strcat (ReportBuffer[skippedOffset + lineOffset]," BootMii");
|
2014-06-19 19:47:13 +02:00
|
|
|
else if (ios[i].titleID == TID_NANDEMU && ios[i].revision == 65535)
|
2015-09-29 00:32:10 +02:00
|
|
|
strcat (ReportBuffer[skippedOffset + lineOffset]," NANDEmu");
|
2013-12-02 19:08:33 +01:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if (ios[i].isStub && strcmp(ios[i].info, "NULL") == 0) {
|
|
|
|
gprintf("1. titleID: %d %s\n", ios[i].titleID, ios[i].info);
|
2015-09-29 00:32:10 +02:00
|
|
|
strcat (ReportBuffer[skippedOffset + lineOffset], TXT_Stub);
|
2013-12-02 19:08:33 +01:00
|
|
|
} else if (ios[i].isStub && strcmp(ios[i].info, "NULL") != 0) {
|
|
|
|
gprintf("2. titleID: %d %s\n", ios[i].titleID, ios[i].info);
|
2015-09-29 00:32:10 +02:00
|
|
|
strcat (ReportBuffer[skippedOffset + lineOffset], ios[i].info);
|
2014-06-19 19:47:13 +02:00
|
|
|
} else if(ios[i].titleID != TID_BC && ios[i].titleID != TID_MIOS) {
|
2015-09-29 00:32:10 +02:00
|
|
|
if(ios[i].infoFakeSignature) strcat(ReportBuffer[skippedOffset + lineOffset], TXT_Trucha);
|
|
|
|
if(ios[i].infoESIdentify) strcat(ReportBuffer[skippedOffset + lineOffset], TXT_ES);
|
|
|
|
if(ios[i].infoFlashAccess) strcat(ReportBuffer[skippedOffset + lineOffset], TXT_Flash);
|
|
|
|
if(ios[i].infoNANDAccess) strcat(ReportBuffer[skippedOffset + lineOffset], TXT_NAND);
|
|
|
|
if(ios[i].infoVersionPatch) strcat(ReportBuffer[skippedOffset + lineOffset], TXT_VersionP);
|
|
|
|
if(ios[i].infoBoot2Access) strcat(ReportBuffer[skippedOffset + lineOffset], TXT_Boot2);
|
|
|
|
if(ios[i].infoUSB2) strcat(ReportBuffer[skippedOffset + lineOffset], TXT_USB);
|
2015-10-05 06:11:56 +02:00
|
|
|
if(ios[i].infoBeerTicket) strcat(ReportBuffer[skippedOffset + lineOffset], TXT_BeerTicket);
|
|
|
|
if(!ios[i].infoFakeSignature && !ios[i].infoESIdentify && !ios[i].infoFlashAccess && !ios[i].infoNANDAccess && !ios[i].infoUSB2 && !ios[i].infoVersionPatch && !ios[i].infoBeerTicket) strcat(ReportBuffer[skippedOffset + lineOffset], TXT_NoPatch);
|
2015-09-29 00:32:10 +02:00
|
|
|
|
|
|
|
ReportBuffer[skippedOffset + lineOffset][strlen(ReportBuffer[skippedOffset + lineOffset])-1]='\0';
|
2013-12-02 19:08:33 +01:00
|
|
|
}
|
|
|
|
}
|
2015-09-29 00:32:10 +02:00
|
|
|
lastIOS = ios[i].titleID;
|
2013-12-02 19:08:33 +01:00
|
|
|
}
|
|
|
|
|
2015-09-29 00:32:10 +02:00
|
|
|
int NumLines = lineOffset + skippedOffset + 1;
|
2013-12-02 19:08:33 +01:00
|
|
|
sprintf(ReportBuffer[NumLines], TXT_ReportDate);
|
2015-02-07 08:33:33 +01:00
|
|
|
CheckTime();
|
2015-09-29 00:32:10 +02:00
|
|
|
|
2013-10-12 20:38:34 +02:00
|
|
|
// Mount the SD Card
|
2014-07-25 20:42:07 +02:00
|
|
|
UpdateTime();
|
2023-03-09 19:42:29 +01:00
|
|
|
if (arguments.USB)
|
|
|
|
{
|
|
|
|
printLoading(MSG_MountUSB);
|
|
|
|
USB_Deinitialize();
|
|
|
|
if (SystemInfo.runningIOS != IOS_GetVersion())
|
|
|
|
{
|
|
|
|
IosPatch_AHBPROT(false);
|
|
|
|
IOS_ReloadIOS(SystemInfo.runningIOS);
|
|
|
|
}
|
|
|
|
usleep(100000);
|
|
|
|
MountUSB();
|
|
|
|
} else {
|
|
|
|
printLoading(MSG_MountSD);
|
2015-10-05 06:11:56 +02:00
|
|
|
MountSD();
|
2023-03-09 19:42:29 +01:00
|
|
|
}
|
2015-02-07 08:33:33 +01:00
|
|
|
CheckTime();
|
2013-10-12 20:38:34 +02:00
|
|
|
|
|
|
|
// Initialise the FAT file system
|
2014-07-25 20:42:07 +02:00
|
|
|
UpdateTime();
|
2013-10-12 20:38:34 +02:00
|
|
|
printLoading(MSG_InitFAT);
|
2023-03-09 19:42:29 +01:00
|
|
|
if (!arguments.USB && !fatInitDefault())
|
2013-10-12 20:38:34 +02:00
|
|
|
{
|
|
|
|
sprintf(MSG_Buffer, ERR_InitFAT);
|
|
|
|
printError(MSG_Buffer);
|
|
|
|
sleep(2);
|
|
|
|
printEndError(MSG_ReportError);
|
|
|
|
} else {
|
|
|
|
// Create the report
|
2015-02-07 08:33:33 +01:00
|
|
|
CheckTime();
|
2023-03-09 19:42:29 +01:00
|
|
|
char dest[100];
|
|
|
|
sprintf(dest, "%s%s", arguments.USB ? "usb" : "sd", REPORT);
|
|
|
|
FILE *file = fopen(dest, "w");
|
2013-10-12 20:38:34 +02:00
|
|
|
if(!file)
|
|
|
|
{
|
|
|
|
printError(ERR_OpenFile);
|
|
|
|
sleep(2);
|
|
|
|
printEndError(MSG_ReportError);
|
|
|
|
} else {
|
|
|
|
for (i = 0; i <= NumLines; i++) {
|
|
|
|
fprintf(file, ReportBuffer[i]);
|
|
|
|
fprintf(file, "\r\n");
|
2014-02-10 16:00:50 +01:00
|
|
|
fflush(file);
|
2013-10-12 20:38:34 +02:00
|
|
|
}
|
|
|
|
// Close the report
|
|
|
|
fclose(file);
|
|
|
|
|
|
|
|
printEndSuccess(MSG_ReportSuccess);
|
2015-02-07 08:33:33 +01:00
|
|
|
CheckTime();
|
2013-10-12 20:38:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Create hash log
|
2023-03-09 19:42:29 +01:00
|
|
|
sprintf(dest, "%s%s", arguments.USB ? "usb" : "sd", HASHLOG);
|
|
|
|
file = fopen(dest, "w");
|
2013-10-12 20:38:34 +02:00
|
|
|
if(!file)
|
|
|
|
{
|
|
|
|
printError(ERR_OpenFile);
|
|
|
|
sleep(2);
|
|
|
|
printEndError(MSG_ReportError);
|
|
|
|
} else {
|
|
|
|
for (i = 0; i <= lines; i++) {
|
|
|
|
fprintf(file, HashLogBuffer[i]);
|
|
|
|
fprintf(file, "\r\n");
|
2014-02-13 10:16:23 +01:00
|
|
|
fflush(file);
|
2013-10-12 20:38:34 +02:00
|
|
|
}
|
|
|
|
// Close the report
|
|
|
|
fclose(file);
|
2014-07-25 20:42:07 +02:00
|
|
|
UpdateTime();
|
2013-10-12 20:38:34 +02:00
|
|
|
printEndSuccess(MSG_ReportSuccess);
|
2015-02-07 08:33:33 +01:00
|
|
|
CheckTime();
|
2013-10-12 20:38:34 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int LineNr = 0;
|
|
|
|
|
|
|
|
WPAD_Init();
|
|
|
|
bool reportIsDisplayed = false;
|
|
|
|
while (1) {
|
2014-06-19 19:47:13 +02:00
|
|
|
wpressed = DetectInput(DI_BUTTONS_HELD);
|
2013-10-12 20:38:34 +02:00
|
|
|
|
|
|
|
// Return to the loader
|
|
|
|
if (wpressed & WPAD_BUTTON_HOME) {
|
2015-10-05 06:11:56 +02:00
|
|
|
UnmountSD();
|
2023-03-09 19:42:29 +01:00
|
|
|
UnmountUSB();
|
2013-10-25 21:14:36 +02:00
|
|
|
deinitGUI();
|
2014-02-28 02:44:22 +01:00
|
|
|
exit(0);
|
2013-10-12 20:38:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Return to System Menu
|
|
|
|
if (wpressed & WPAD_BUTTON_PLUS) {
|
2015-10-05 06:11:56 +02:00
|
|
|
UnmountSD();
|
2023-03-09 19:42:29 +01:00
|
|
|
UnmountUSB();
|
2013-10-25 21:14:36 +02:00
|
|
|
deinitGUI();
|
2013-10-12 20:38:34 +02:00
|
|
|
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Shutdown Wii
|
|
|
|
if (wpressed & WPAD_BUTTON_MINUS) {
|
2015-10-05 06:11:56 +02:00
|
|
|
UnmountSD();
|
2023-03-09 19:42:29 +01:00
|
|
|
UnmountUSB();
|
2013-10-25 21:14:36 +02:00
|
|
|
deinitGUI();
|
2013-10-12 20:38:34 +02:00
|
|
|
SYS_ResetSystem(SYS_POWEROFF, 0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Display Report
|
|
|
|
if (wpressed & WPAD_BUTTON_A) {
|
|
|
|
if (reportIsDisplayed && completeReport) {
|
|
|
|
transmitSyscheck(ReportBuffer, &NumLines);
|
|
|
|
FILE *file = fopen(REPORT, "a");
|
|
|
|
|
|
|
|
if(file)
|
|
|
|
{
|
|
|
|
fprintf(file, ReportBuffer[NumLines]);
|
|
|
|
fprintf(file, "\r\n");
|
|
|
|
// Close the report
|
|
|
|
fclose(file);
|
|
|
|
}
|
|
|
|
completeReport = false;
|
|
|
|
printReport(ReportBuffer, LineNr, completeReport);
|
|
|
|
} else {
|
|
|
|
printReport(ReportBuffer, LineNr, completeReport);
|
2014-02-10 16:00:50 +01:00
|
|
|
usleep(500000); // A little pause to decrease the chance of accidental upload
|
2013-10-12 20:38:34 +02:00
|
|
|
reportIsDisplayed = true;
|
|
|
|
}
|
|
|
|
}
|
2014-02-10 16:00:50 +01:00
|
|
|
if (NumLines > 14) { // Just a safety measure in case the report is less than 14 lines for some reason
|
|
|
|
if (wpressed & WPAD_BUTTON_UP) {
|
|
|
|
if (LineNr > 0) LineNr--;
|
|
|
|
printReport(ReportBuffer, LineNr, completeReport);
|
2015-03-13 09:16:55 +01:00
|
|
|
usleep(50000);
|
2014-02-10 16:00:50 +01:00
|
|
|
}
|
2013-10-12 20:38:34 +02:00
|
|
|
|
2014-02-10 16:00:50 +01:00
|
|
|
if (wpressed & WPAD_BUTTON_DOWN) {
|
|
|
|
if (LineNr < NumLines-14) LineNr++;
|
|
|
|
printReport(ReportBuffer, LineNr, completeReport);
|
2015-03-13 09:16:55 +01:00
|
|
|
usleep(50000);
|
2014-02-10 16:00:50 +01:00
|
|
|
}
|
|
|
|
if (wpressed & WPAD_BUTTON_LEFT) {
|
|
|
|
if (LineNr > 0) LineNr = LineNr - 15;
|
|
|
|
if (LineNr < 0) LineNr = 0;
|
|
|
|
printReport(ReportBuffer, LineNr, completeReport);
|
2015-03-13 09:16:55 +01:00
|
|
|
usleep(100000);
|
2014-02-10 16:00:50 +01:00
|
|
|
}
|
2013-10-12 20:38:34 +02:00
|
|
|
|
2014-02-10 16:00:50 +01:00
|
|
|
if (wpressed & WPAD_BUTTON_RIGHT) {
|
|
|
|
if (LineNr < NumLines-14) LineNr = LineNr + 15;
|
|
|
|
if (LineNr + 14 > NumLines) LineNr = NumLines-14;
|
|
|
|
printReport(ReportBuffer, LineNr, completeReport);
|
2015-03-13 09:16:55 +01:00
|
|
|
usleep(100000);
|
2014-02-10 16:00:50 +01:00
|
|
|
}
|
2013-10-12 20:38:34 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|