-Fixed all the stuff I messed up with the last commit

-Added missing libraries
-Removed the need to reload the runtime IOS
-Fixed incorrect runtime IOS type
-Added some extra delay when scrolling
-SysCheck directory is created if it doesn't exist
-Added skipped IOS's to list
-Fixed vWii cIOS's sometimes showing as regular cIOS's
-Fixed crash when the language is set to French

TODO:
-Finish working on fat mounting.  It's probably broken now.
-Integrate vIOS check by version number
This commit is contained in:
joostinonline 2015-09-28 22:32:10 +00:00
parent 1e4ec18746
commit af1b05fa5f
19 changed files with 211 additions and 137 deletions

BIN
boot.elf Normal file

Binary file not shown.

View File

@ -75,6 +75,7 @@ const char* BUT_ConfirmUpload;
const char* TXT_Upload;
const char* BUT_OK;
const char* TXT_OriginalRegion;
const char* TXT_IOSSkipped;
char TXT_ReportDate[100];
char MSG_Buffer[1024];
char MSG_Buffer2[1024];

View File

@ -9,10 +9,8 @@
#define MEM_PROT (MEM_REG_BASE + 0x20a)
#define HOLLYWOOD_VERSION (*(vu32*)0x80003138)
#define LOADER_STUB (vu32*)0x80001800
#define IOS_START (*((vu32*)0x80003130))
#define IOS_END (*((vu32*)0x80003134))
//#define IS_WII_U ((*(vu32*)(0xCd8005A0) >> 16 ) == 0xCAFE)
#define IS_WII_U ((*(vu16*)(0xCd8005A2)) == 0xCAFE)
#define IOS_TOP (*((vu32*)0x80003130))
#define IS_WII_U ((*(vu32*)(0xCd8005A0) >> 16 ) == 0xCAFE)
#define MAX_ELEMENTS(x) ((sizeof((x))) / (sizeof((x)[0])))
// Turn upper and lower into a full title ID
@ -122,8 +120,14 @@ typedef struct _U8Entry
};
} __attribute__( ( packed ) ) U8Entry;
typedef struct {
const u32 titleID;
const s32 revision;
} vIOSdb_t;
extern const char *Regions[];
extern u8 sysMenuInfoContent;
extern const vIOSdb_t vIOSdb[];
#ifdef __cplusplus
extern "C"

View File

@ -21,6 +21,7 @@ typedef struct {
bool debug;
int skipIOSlist[512];
int skipIOScnt;
bool USB;
} arguments_t;
extern arguments_t arguments;

View File

@ -2,8 +2,8 @@
#define _UPDATE_H_
/* Constants */
#define REVISION 41
#define PATH "sd:/apps/SysCheckHDE/"
//#define REVISION 0 // For testing updateApp function
#define REVISION 41
s32 updateApp(void);

BIN
libs/lib/libCheckRegion.a Normal file

Binary file not shown.

BIN
libs/lib/libfreetype.a Normal file

Binary file not shown.

BIN
libs/lib/libgrrlib.a Normal file

Binary file not shown.

BIN
libs/lib/libjpeg.a Normal file

Binary file not shown.

BIN
libs/lib/libpng.a Normal file

Binary file not shown.

BIN
libs/lib/libpngu.a Normal file

Binary file not shown.

Binary file not shown.

BIN
libs/lib/libz.a Normal file

Binary file not shown.

View File

@ -142,7 +142,6 @@ float GetSysMenuNintendoVersion(u32 sysVersion)
}
char GetSysMenuRegion(u32 sysVersion) {
char SysMenuRegion = 'X';
switch(sysVersion)
{
case 1: //Pre-launch
@ -160,7 +159,7 @@ char GetSysMenuRegion(u32 sysVersion) {
case 513: //4.3U
case 545:
case 609:
SysMenuRegion = 'U';
return 'U';
break;
case 130: //2.0E
case 162: //2.1E
@ -177,7 +176,7 @@ char GetSysMenuRegion(u32 sysVersion) {
case 514: //4.3E
case 546:
case 610:
SysMenuRegion = 'E';
return 'E';
break;
case 128: //2.0J
case 192: //2.2J
@ -193,7 +192,7 @@ char GetSysMenuRegion(u32 sysVersion) {
case 512: //4.3J
case 544:
case 608:
SysMenuRegion = 'J';
return 'J';
break;
case 326: //3.3K
case 390: //3.5K
@ -201,10 +200,10 @@ char GetSysMenuRegion(u32 sysVersion) {
case 54454: // mauifrog 4.1K
case 486: //4.2K
case 518: //4.3K
SysMenuRegion = 'K';
return 'K';
break;
}
return SysMenuRegion;
return 'X';
}
// Get the system menu version from TMD
@ -230,4 +229,4 @@ u32 GetSysMenuVersion(void)
// Return the system menu version
return version;
}
}

View File

@ -69,6 +69,8 @@ enum BPB
};
static const char FAT_SIG[3] = {'F', 'A', 'T'};
static bool sd_mounted = false;
static bool usb_mounted = false;
static bool _FAT_partition_isFAT(const DISC_INTERFACE* disc, sec_t startSector)
{
@ -150,20 +152,22 @@ int MountSD(void)
fatUnmount("SD:/");
// Mount first FAT partition
if (fatMount("SD", &__io_wiisd, GetFATPartition(&__io_wiisd), CACHE, SECTORS)) return 1;
if (fatMount("SD", &__io_wiisd, GetFATPartition(&__io_wiisd), CACHE, SECTORS)) {
sd_mounted = true;
return 1;
}
return -1;
}
void UnmountSD(void)
{
if (!sd_mounted) return;
// Close all open files write back the cache and then shutdown them
fatUnmount("SD:/");
}
int MountUSB(void)
{
char dirpath[256];
s32 ret;
/* Initialize interface */
@ -177,8 +181,8 @@ int MountUSB(void)
return -2;
/* Set root directory */
sprintf(dirpath, "usb:/");
chdir(dirpath);
chdir("usb:/");
usb_mounted = true;
return 0;
}
@ -186,6 +190,7 @@ int MountUSB(void)
void UnmountUSB(void)
{
if(!usb_mounted) return;
/* Unmount device */
fatUnmount("usb");

View File

@ -4,12 +4,11 @@
#include "fatMounter.h"
#include "languages.h"
// CONF_LANG_ENGLISH
// CONF_LANG_GERMAN
// CONF_LANG_FRENCH
// CONF_LANG_SPANISH
// CONF_LANG_ITALIAN
// CONF_LANG_SPANISH
// CONF_LANG_ENGLISH
// !!! Doesn't support special chars... !!!
// !!! Don't change the order of the parameters !!!
@ -96,6 +95,7 @@ int initLanguages(struct tm today)
TXT_Upload = "Bericht wird hochgeladen...";
BUT_OK = "OK";
TXT_OriginalRegion = " (urspruengliche Region: ";
TXT_IOSSkipped = "Ubersprungenen";
break;
case CONF_LANG_FRENCH:
@ -123,7 +123,7 @@ int initLanguages(struct tm today)
TXT_SysMenu = "Menu Systeme %1.1f%c (v%d)";
TXT_SysMenu2 = "Menu Systeme %s%s (v%d)";
TXT_SysMenu3 = "Menu Systeme %1.1f%c (v%d, Info: v%d %s)";
TXT_NO_HBC = "Chaine Homebrew n'est pas installé";
TXT_NO_HBC = "Chaine Homebrew n'est pas installe'";
TXT_HBC = "Chaine Homebrew 1.0.%d utilise IOS%d";
TXT_HBC_NEW = "Chaine Homebrew 1.1.0 utilise IOS%d";
TXT_HBC_112 = "Chaine Channel 1.1.%d utilise IOS%d";
@ -131,7 +131,7 @@ int initLanguages(struct tm today)
TXT_Hollywood = "Hollywood v0x%x";
TXT_ConsoleID = "Identifiant de la console: %d";
TXT_ConsoleType = "Type de Console: %s";
TXT_ShopCountry ="Pays de la chaîne boutique: %s (%u)";
TXT_ShopCountry ="Pays de la chaine boutique: %s (%u)";
TXT_vBoot2 = "Boot2 v%u";
TXT_NrOfTitles = "%d titres trouves.";
TXT_NrOfIOS = "%d IOS trouves sur cette console. %d sont des stubs.";
@ -172,6 +172,7 @@ int initLanguages(struct tm today)
TXT_Upload = "Telechargement du rapport...";
BUT_OK = "OK";
TXT_OriginalRegion = " (region d'origine: ";
TXT_IOSSkipped = "Ignore'";
break;
case CONF_LANG_ITALIAN:
@ -210,7 +211,7 @@ int initLanguages(struct tm today)
TXT_ShopCountry ="Paese canale Shop: %s (%u)";
TXT_vBoot2 = "Boot2 v%u";
TXT_NrOfTitles = "Trovati %d giochi.";
TXT_NrOfIOS = "Trovati %d IOS in questa console. %d di questi sono stub.";
TXT_NrOfIOS = "Trovati %d IOS in questa console. %d di questi sono stubs.";
TXT_AppTitle = "SysCheck HDE %s by JoostinOnline, Double_A, R2-D2199, and Nano";
TXT_AppIOS = "...appoggiato all'%sIOS%d (v. %d).";
ERR_AllocateMemory = "Impossibile allocare la memoria per %d giochi.";
@ -248,6 +249,7 @@ int initLanguages(struct tm today)
TXT_Upload = "Invio rapporto...";
BUT_OK = "OK";
TXT_OriginalRegion = " (regione originale: ";
TXT_IOSSkipped = "Ignorato";
break;
case CONF_LANG_SPANISH:
@ -324,6 +326,7 @@ int initLanguages(struct tm today)
TXT_Upload = "Cargar el informe...";
BUT_OK = "OK";
TXT_OriginalRegion = " (region de origen: ";
TXT_IOSSkipped = "Omitido";
break;
default:
@ -362,7 +365,7 @@ int initLanguages(struct tm today)
TXT_ShopCountry ="Shop Channel Country: %s (%u)";
TXT_vBoot2 = "Boot2 v%u";
TXT_NrOfTitles = "Found %d titles.";
TXT_NrOfIOS = "Found %d IOS on this console. %d of them are stub.";
TXT_NrOfIOS = "Found %d IOS on this console. %d of them are stubs.";
TXT_AppTitle = "SysCheck HDE %s by JoostinOnline, Double_A, R2-D2199, and Nano";
TXT_AppIOS = "...runs on %sIOS%d (rev %d).";
ERR_AllocateMemory = "Unable to allocate the memory for %d titles.";
@ -400,6 +403,7 @@ int initLanguages(struct tm today)
TXT_Upload = "Uploading report...";
BUT_OK = "OK";
TXT_OriginalRegion = " (original region: ";
TXT_IOSSkipped = "Skipped";
}
return 0;

View File

@ -326,15 +326,12 @@ inline s32 RemoveBogusTMD(void)
inline bool CheckIOSType(void) {
if (AHB_ACCESS == false) return false;
//u32 start_address = IOS_START;
//u32 end_address = IOS_END;
const u32 start_address = 0x90000000;
const u32 end_address = 0x94000000;
const u8 WL_String[] = {0x57, 0x4C, 0x3A, 0x20, 0x30, 0x32, 0x2F, 0x30, 0x32, 0x2F, 0x31, 0x32}; // "WL: 02/02/12"
//if (AHB_ACCESS == false) return false;
u32 start_address = IOS_TOP;
const char WL_String[] = {0x57, 0x4C, 0x3A, 0x20, 0x30, 0x32, 0x2F, 0x30, 0x32, 0x2F, 0x31, 0x32}; // "WL: 02/02/12"
u32 i;
for(i = start_address; i < end_address - sizeof(WL_String); i++) {
if (memcmp((u8*)i, WL_String, sizeof(WL_String)) == 0) return true;
for(i = start_address; i < 0x94000000 - sizeof(WL_String); i++) {
if (memcmp((char*)i, WL_String, sizeof(WL_String)) == 0) return true;
}
return false;
}
@ -727,3 +724,36 @@ s32 get_miosinfo(char *str)
}
return 0;
}
// Minimum vIOS versions
const vIOSdb_t vIOSdb[] = {
{9, 1290},
{12, 782},
{13, 1288},
{14, 1288},
{15, 1288},
{17, 1288},
{21, 1295},
{22, 1550},
{28, 2063},
{31, 3864},
{33, 3864},
{34, 3864},
{35, 3864},
{36, 3864},
{37, 5919},
{38, 4380},
{41, 3863},
{43, 3863},
{45, 3863},
{46, 3863},
{48, 4380},
{53, 5919},
{55, 5919},
{56, 5918},
{57, 6175},
{58, 6432},
{59, 7201},
{62, 6430},
{80, 6430}
};

View File

@ -31,15 +31,15 @@
#include "wiibasics.h"
// Filename
#define REPORT "sd:/sysCheck.csv"
#define HASHLOG "sd:/IOSsyscheck.log"
#define REPORT "/sysCheck.csv"
#define HASHLOG "/IOSsyscheck.log"
#define VERSION_1_1_0 65536
extern void __exception_setreload(int t);
static u64 current_time = 0;
// Main
// Main
int main(int argc, char **argv)
{
__exception_setreload(2);
@ -47,7 +47,8 @@ int main(int argc, char **argv)
memset(arguments.skipIOSlist, 0, sizeof(arguments.skipIOSlist));
arguments.skipIOScnt = 0;
arguments.debug = false;
arguments.USB = strlen(argv[0]) && (argv[0][0] == 'U' || argv[0][0] == 'u');
InitGecko();
if(argc>=1){
int i;
@ -89,7 +90,7 @@ int main(int argc, char **argv)
UpdateTime();
SystemInfo.systemRegion = CONF_GetRegion();
CheckTime();
SystemInfo.shopcode = 0;
if (!CONF_GetShopCode(&SystemInfo.shopcode)) {
strcpy(SystemInfo.country, CONF_CountryCodes[SystemInfo.shopcode]);
@ -102,12 +103,12 @@ int main(int argc, char **argv)
UpdateTime();
SystemInfo.sysMenuVer = GetSysMenuVersion();
CheckTime();
sysMenu_t systemmenu;
printLoading(MSG_GetHBCVer);
UpdateTime();
homebrew_t homebrew;
homebrew.hbcversion = 0;
homebrew.hbfversion = 0;
@ -186,7 +187,7 @@ int main(int argc, char **argv)
UpdateTime();
SystemInfo.runningIOS = IOS_GetVersion();
SystemInfo.runningIOSRevision = IOS_GetRevision();
CheckTime();
// Get the console ID
@ -271,27 +272,28 @@ int main(int argc, char **argv)
}
SystemInfo.countIOS++;
}
// Not the most efficient way to remove argument-skipped IOS's, but it works.
while (arguments.skipIOScnt > 0) {
int tempSkipIOScnt = arguments.skipIOScnt;
while (tempSkipIOScnt > 0) {
for (i = nbTitles; i--;) {
titleID = titles[i] & 0xFFFFFFFF;
if(arguments.skipIOSlist[arguments.skipIOScnt - 1] > 0 && titleID == arguments.skipIOSlist[arguments.skipIOScnt - 1]) {
logfile("Skipped IOS %i, titles[%i] = %i\r\n", arguments.skipIOSlist[arguments.skipIOScnt - 1], i, titles[i]);
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]);
titles[i] = 0;
SystemInfo.countIOS--;
break;
}
}
arguments.skipIOScnt--;
tempSkipIOScnt--;
}
CheckTime();
// Sort IOS titles
printLoading(MSG_SortTitles);
UpdateTime();
u64 *newTitles = memalign(32, (SystemInfo.countIOS)*sizeof(u64));
u32 cnt = 0;
for (i = 0; i < nbTitles; i++) {
@ -311,7 +313,7 @@ int main(int argc, char **argv)
ios[i].titleID = 0;
ios[i].mloadVersion = 0;
ios[i].baseIOS = -1;
sprintf(ios[i].info, "NULL");
strcpy(ios[i].info, "NULL");
ios[i].isStub = false;
ios[i].revision = 0;
ios[i].infoFakeSignature = false;
@ -332,7 +334,7 @@ int main(int argc, char **argv)
// Check MIOS
if (SystemInfo.nandAccess) get_miosinfo(SystemInfo.miosInfo);
// Check running IOS type so we don't have to reload it later
if(SystemInfo.deviceType == CONSOLE_WII_U) ios[SystemInfo.runningIOS].infovIOS = CheckIOSType();
@ -391,6 +393,7 @@ int main(int argc, char **argv)
if (ios[i].isStub) {
gprintf("is stub\n");
logfile("is stub\r\n");
usleep(100000); // A little delay so you can see what stubs were scanned
}
}
@ -500,7 +503,7 @@ int main(int argc, char **argv)
int selectedIOS = -1;
u32 wpressed;
time_t starttime = time(NULL);
printSelectIOS(MSG_SelectIOS, MSG_All);
bool completeReport = true;
@ -600,10 +603,10 @@ int main(int argc, char **argv)
sprintf(MSG_Buffer, MSG_TestingIOS, MSG_Buffer2);
printLoadingBar(MSG_Buffer, (100.0/(nbTitles-1)*(i+1)));
if (ios[i].isStub ||
ios[i].titleID == TID_BC ||
ios[i].titleID == TID_MIOS ||
ios[i].titleID == TID_NAND ||
if (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].infoFakeSignature = false;
@ -619,12 +622,12 @@ int main(int argc, char **argv)
// Reload IOS
gprintf("// IOS_ReloadIOS(%d)\n", ios[i].titleID);
logfile("// IOS_ReloadIOS(%d)\r\n", ios[i].titleID);
if (SystemInfo.deviceType == CONSOLE_WII_U)
IosPatch_FULL(false, false, false, false, ios[i].titleID);
else
IOS_ReloadIOS(ios[i].titleID);
// Test IOS type
gprintf("// Test IOS type\n");
logfile("// Test IOS type\r\n");
@ -692,7 +695,7 @@ int main(int argc, char **argv)
//--Generate Report--
UpdateTime();
printLoading(MSG_GenerateReport);
char ReportBuffer[200][100] = {{0}}; // The maximum display length is actually 73
@ -713,7 +716,7 @@ int main(int argc, char **argv)
sprintf(ReportBuffer[SYSMENU], TXT_SysMenu, SystemInfo.sysNinVersion, SystemInfo.sysMenuRegion, SystemInfo.sysMenuVer);
else
strcat(ReportBuffer[SYSMENU], TXT_Unknown);
} else if (systemmenu.hasInfo) {
SystemInfo.sysNinVersion = GetSysMenuNintendoVersion(systemmenu.realRevision);
SystemInfo.sysMenuRegion = GetSysMenuRegion(SystemInfo.sysMenuVer);
@ -894,19 +897,32 @@ int main(int argc, char **argv)
// Display IOS vulnerabilities
int lineOffset = 0;
int skippedOffset = 0;
int lastIOS = 0;
for (i = 0; i < nbTitles; i++)
{
lineOffset = i + LAST;
// TODO: Fix hiding the next IOS
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;
}
}
}
if (selectedIOS > -1) i = selectedIOS; //If specific IOS is selected
if (ios[i].titleID == TID_BC) {
sprintf(ReportBuffer[lineOffset], "BC v%d", ios[i].revision);
sprintf(ReportBuffer[skippedOffset + lineOffset], "BC v%d", ios[i].revision);
} else if (ios[i].titleID == TID_MIOS) {
sprintf(ReportBuffer[lineOffset], "MIOS v%d%s", ios[i].revision, SystemInfo.miosInfo);
sprintf(ReportBuffer[skippedOffset + lineOffset], "MIOS v%d%s", ios[i].revision, SystemInfo.miosInfo);
} 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)) {
sprintf(ReportBuffer[lineOffset], "%sIOS%d[38+37] (rev %d, Info: %s):", ios[i].infovIOS ? "v" : "", ios[i].titleID, ios[i].revision, ios[i].info);
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);
} 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)) {
sprintf(ReportBuffer[lineOffset], "%sIOS%d[38+60] (rev %d, Info: %s):", ios[i].infovIOS ? "v" : "", ios[i].titleID, ios[i].revision, ios[i].info);
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);
} else {
if(ios[i].mloadVersion > 0 && ios[i].baseIOS > 0) {
int v, s;
@ -917,54 +933,59 @@ int main(int argc, char **argv)
v = 4;
s = 0;
}
sprintf(ReportBuffer[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);
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);
} else if(ios[i].baseIOS > 0) {
snprintf(ReportBuffer[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);
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);
} else if (strcmp(ios[i].info, "NULL") != 0 && !ios[i].isStub) {
snprintf(ReportBuffer[lineOffset], MAX_ELEMENTS(ReportBuffer[0]), "%sIOS%d (rev %d, Info: %s):", ios[i].infovIOS ? "v" : "", ios[i].titleID, ios[i].revision, ios[i].info);
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);
} else if (ios[i].titleID == 249 && ios[i].revision > 11 && ios[i].revision < 18) {
sprintf(ReportBuffer[lineOffset], "%sIOS%d[38] (rev %d):", ios[i].infovIOS ? "v" : "", ios[i].titleID, ios[i].revision);
sprintf(ReportBuffer[skippedOffset + lineOffset], "%sIOS%d[38] (rev %d):", ios[i].infovIOS ? "v" : "", ios[i].titleID, ios[i].revision);
} else {
snprintf(ReportBuffer[lineOffset], MAX_ELEMENTS(ReportBuffer[0]), "%sIOS%d (rev %d):", ios[i].infovIOS ? "v" : "", ios[i].titleID, ios[i].revision);
snprintf(ReportBuffer[skippedOffset + lineOffset], MAX_ELEMENTS(ReportBuffer[0]), "%sIOS%d (rev %d):", ios[i].infovIOS ? "v" : "", ios[i].titleID, ios[i].revision);
}
}
// Check BootMii As IOS (BootMii As IOS is installed on IOS254 rev 31338)
if (ios[i].titleID == TID_BOOTMII && (ios[i].revision == 31338 || ios[i].revision == 65281))
strcat (ReportBuffer[lineOffset]," BootMii");
strcat (ReportBuffer[skippedOffset + lineOffset]," BootMii");
else if (ios[i].titleID == TID_NANDEMU && ios[i].revision == 65535)
strcat (ReportBuffer[lineOffset]," NANDEmu");
strcat (ReportBuffer[skippedOffset + lineOffset]," NANDEmu");
else
{
if (ios[i].isStub && strcmp(ios[i].info, "NULL") == 0) {
gprintf("1. titleID: %d %s\n", ios[i].titleID, ios[i].info);
strcat (ReportBuffer[lineOffset], TXT_Stub);
strcat (ReportBuffer[skippedOffset + lineOffset], TXT_Stub);
} else if (ios[i].isStub && strcmp(ios[i].info, "NULL") != 0) {
gprintf("2. titleID: %d %s\n", ios[i].titleID, ios[i].info);
strcat (ReportBuffer[lineOffset], ios[i].info);
strcat (ReportBuffer[skippedOffset + lineOffset], ios[i].info);
} else if(ios[i].titleID != TID_BC && ios[i].titleID != TID_MIOS) {
if(ios[i].infoFakeSignature) strcat(ReportBuffer[lineOffset], TXT_Trucha);
if(ios[i].infoESIdentify) strcat(ReportBuffer[lineOffset], TXT_ES);
if(ios[i].infoFlashAccess) strcat(ReportBuffer[lineOffset], TXT_Flash);
if(ios[i].infoNANDAccess) strcat(ReportBuffer[lineOffset], TXT_NAND);
if(ios[i].infoVersionPatch) strcat(ReportBuffer[lineOffset], TXT_VersionP);
if(ios[i].infoBoot2Access) strcat(ReportBuffer[lineOffset], TXT_Boot2);
if(ios[i].infoUSB2) strcat(ReportBuffer[lineOffset], TXT_USB);
if(!ios[i].infoFakeSignature && !ios[i].infoESIdentify && !ios[i].infoFlashAccess && !ios[i].infoNANDAccess && !ios[i].infoUSB2 && !ios[i].infoVersionPatch) strcat(ReportBuffer[lineOffset], TXT_NoPatch);
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);
if(!ios[i].infoFakeSignature && !ios[i].infoESIdentify && !ios[i].infoFlashAccess && !ios[i].infoNANDAccess && !ios[i].infoUSB2 && !ios[i].infoVersionPatch) strcat(ReportBuffer[skippedOffset + lineOffset], TXT_NoPatch);
ReportBuffer[lineOffset][strlen(ReportBuffer[lineOffset])-1]='\0';
ReportBuffer[skippedOffset + lineOffset][strlen(ReportBuffer[skippedOffset + lineOffset])-1]='\0';
}
}
lastIOS = ios[i].titleID;
}
int NumLines = lineOffset+1;
int NumLines = lineOffset + skippedOffset + 1;
sprintf(ReportBuffer[NumLines], TXT_ReportDate);
CheckTime();
// Mount the SD Card
UpdateTime();
printLoading(MSG_MountSD);
MountSD();
//if(arguments.USB)
// MountUSB();
//else
// MountSD();
fatInitDefault();
CheckTime();
// Initialise the FAT file system
@ -1032,7 +1053,8 @@ int main(int argc, char **argv)
// Return to the loader
if (wpressed & WPAD_BUTTON_HOME) {
// Unmount the SD Card
UnmountSD();
//UnmountSD();
//UnmountUSB();
deinitGUI();
exit(0);
}
@ -1040,7 +1062,8 @@ int main(int argc, char **argv)
// Return to System Menu
if (wpressed & WPAD_BUTTON_PLUS) {
// Unmount the SD Card
UnmountSD();
//UnmountSD();
//UnmountUSB();
deinitGUI();
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
}
@ -1048,7 +1071,8 @@ int main(int argc, char **argv)
// Shutdown Wii
if (wpressed & WPAD_BUTTON_MINUS) {
// Unmount the SD Card
UnmountSD();
//UnmountSD();
//UnmountUSB();
deinitGUI();
SYS_ResetSystem(SYS_POWEROFF, 0, 0);
}

View File

@ -4,22 +4,25 @@
#include <stdlib.h>
#include <malloc.h>
#include <network.h>
#include <dirent.h>
#include <unistd.h>
#include "update.h"
#include "gecko.h"
#include "http.h"
#include "tools.h"
s32 downloadSyscheckFile(const char* fileName) {
s32 downloadSyscheckFile(const char* update_dir, const char* fileName) {
int ret = 0;
char buf[128] = {0};
u32 http_status;
u8* outbuf;
u32 length;
snprintf(buf, sizeof(buf), "http://syscheck-hd.googlecode.com/svn/trunk/SysCheckHDE/%s", fileName);
snprintf(buf, sizeof(buf), "http://sourceforge.net/p/syscheck-hde/code/HEAD/tree/trunk/SysCheckHDE/%s?format=raw", fileName);
ret = http_request(buf, 1 << 31);
if (!ret)
if (!ret)
{
int i;
for (i = 0; i < 10; i++) {
@ -32,15 +35,15 @@ s32 downloadSyscheckFile(const char* fileName) {
}
}
ret = http_get_result(&http_status, &outbuf, &length);
if (((int)*outbuf & 0xF0000000) == 0xF0000000)
ret = http_get_result(&http_status, &outbuf, &length);
if (((int)*outbuf & 0xF0000000) == 0xF0000000)
{
return -2;
}
sprintf(buf, "%s%s", PATH, fileName);
sprintf(buf, "%s%s", update_dir, fileName);
FILE *file = fopen(buf, "w");
if(!file)
@ -56,57 +59,60 @@ s32 downloadSyscheckFile(const char* fileName) {
}
s32 updateApp(void) {
int ret = 0;
int ret = net_init();
ret = net_init();
if (ret < 0)
goto out;
char update_dir[21];
sprintf(update_dir, "%s:/apps/SysCheckHDE", arguments.USB ? "usb" : "sd");
mkdir(update_dir,S_IWRITE|S_IREAD); // attempt to make dir
chdir(update_dir);
if (ret < 0) {
net_deinit();
return ret;
}
u32 http_status;
u8* outbuf;
u32 length;
ret = http_request("http://syscheck-hd.googlecode.com/svn/trunk/Version.txt", 1 << 31);
if (!ret)
ret = http_request("http://sourceforge.net/p/syscheck-hde/code/HEAD/tree/trunk/Version.txt?format=raw", 1 << 31);
if (!ret)
{
gprintf("Error making http request\n");
return -1;
}
ret = http_get_result(&http_status, &outbuf, &length);
if (((int)*outbuf & 0xF0000000) == 0xF0000000)
{
ret = -2;
goto out;
}
if (!strncmp((char*)outbuf, "Version=", sizeof("Version=")))
ret = http_get_result(&http_status, &outbuf, &length);
if (!strncmp((char*)outbuf, "Version=", sizeof("Version=")))
{
int version = atoi((char*)(outbuf + sizeof("Version=")));
gprintf("INT: %i\n", version);
if (version > REVISION) {
ret = downloadSyscheckFile("boot.dol");
if (ret < 0)
goto out;
ret = downloadSyscheckFile("meta.xml");
if (ret < 0)
goto out;
ret = downloadSyscheckFile("icon.png");
if (ret < 0)
goto out;
} else {
ret = 2;
goto out;
}
} else {
ret = -3;
goto out;
}
out:
if (version > REVISION) {
ret = downloadSyscheckFile(update_dir, "boot.dol");
if (ret < 0) {
net_deinit();
return ret;
}
ret = downloadSyscheckFile(update_dir, "meta.xml");
if (ret < 0) {
net_deinit();
return ret;
}
ret = downloadSyscheckFile(update_dir, "icon.png");
if (ret < 0) {
net_deinit();
return ret;
}
} else {
net_deinit();
return -2;
}
} else {
net_deinit();
return -3;
}
net_deinit();
return ret;
}
}