-Fixed bug where a bunch of blank lines are shown on the report when you press Right close to the end of the file

-Grouped a lot of variables into a structure
-Added a .5 second delay after displaying report to decrease the chance of accidental uploads
-Added a .2 second delay between the init messages
This commit is contained in:
Joostinonline 2014-02-10 15:00:50 +00:00
parent d399fb5fa1
commit d53b83fcac
6 changed files with 151 additions and 169 deletions

View File

@ -3,6 +3,7 @@
detect_settings.h -- detects various system settings detect_settings.h -- detects various system settings
Copyright (C) 2008 tona Copyright (C) 2008 tona
Copyright (C) 2014 JoostinOnline
Unless other credit specified Unless other credit specified
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
@ -29,37 +30,29 @@
#ifndef __SYSMENUINFO_H__ #ifndef __SYSMENUINFO_H__
#define __SYSMENUINFO_H__ #define __SYSMENUINFO_H__
#define SADR_LENGTH 0x1007+1 #define SADR_LENGTH 0x1007+1
#define round_up(x,n) (-(-(x) & -(n))) #define round_up(x,n) (-(-(x) & -(n)))
typedef struct { typedef struct {
u32 deviceId; u32 deviceID;
u32 hollywoodVersion;
u32 boot2version; u32 boot2version;
u16 sysMenuVer; u32 sysMenuVer;
u32 dvdSupport;
s32 sysMenuIOS; s32 sysMenuIOS;
bool sysMenuIOSisStub; float sysNinVersion;
bool regionChangedKoreanWii;
double sysMenuNinVersion;
char sysMenuRegion; char sysMenuRegion;
char regionFromSerial; s32 systemRegion;
s32 lang; char country[44];
s32 area; char miosInfo[128];
s32 game; u32 countTitles;
s32 video; u32 countBCMIOS;
s32 eula; u32 countIOS;
s32 country; u32 countStubs;
bool reRunWithSU; u8 shopcode;
bool missingIOSwarning; u8 priiloader;
bool SMRegionMismatchWarning; bool nandAccess;
bool failSMContentRead;
u16 bcVersion;
u16 miosVersion;
u32 titleCnt;
u32 iosCount;
bool ahbprot;
} SYSSETTINGS; } SYSSETTINGS;
extern SYSSETTINGS wiiSettings;
typedef struct { typedef struct {
char name[ISFS_MAXPATH + 1]; char name[ISFS_MAXPATH + 1];

View File

@ -1,11 +1,12 @@
#ifndef _TOOLS_H_ #ifndef _TOOLS_H_
#define _TOOLS_H_ #define _TOOLS_H_
#define HAVE_AHBPROT ((*(vu32*)0xcd800064 == 0xFFFFFFFF) ? 1 : 0) #define AHB_ACCESS ((*(vu32*)0xcd800064 == 0xFFFFFFFF) ? 1 : 0)
#define MEM_REG_BASE 0xd8b4000 #define MEM_REG_BASE 0xd8b4000
#define MEM_PROT (MEM_REG_BASE + 0x20a) #define MEM_PROT (MEM_REG_BASE + 0x20a)
#define HOLLYWOOD_VERSION (vu32*)0x80003138 #define HOLLYWOOD_VERSION (vu32*)0x80003138
#define LOADER_STUB (vu32*)0x80001800 #define LOADER_STUB (vu32*)0x80001800
#define IS_WII_U ((*(vu32*)(0xCd8005A0) >> 16 ) == 0xCAFE);
// Turn upper and lower into a full title ID // Turn upper and lower into a full title ID
#define TITLE_ID(x,y) (((u64)(x) << 32) | (y)) #define TITLE_ID(x,y) (((u64)(x) << 32) | (y))

View File

@ -3,10 +3,9 @@
detect_settings.c -- detects various system settings detect_settings.c -- detects various system settings
Copyright (C) 2008 tona Copyright (C) 2008 tona
Copyright (C) 2014 JoostinOnline
Unless other credit specified Unless other credit specified
Changes by JoostinOnline
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any warranty. In no event will the authors be held liable for any
damages arising from the use of this software. damages arising from the use of this software.

View File

@ -25,6 +25,7 @@
#include "title.h" #include "title.h"
#include "sha1.h" #include "sha1.h"
#include "wiibasics.h" #include "wiibasics.h"
#include "SysMenuInfo.h"
#include "tmdIdentification.h" #include "tmdIdentification.h"
#include "gecko.h" #include "gecko.h"
#include "update.h" #include "update.h"
@ -36,9 +37,7 @@
extern bool geckoinit; extern bool geckoinit;
extern void ReloadIOS(int version);
char miosInfo[128] = {0};
extern void __exception_setreload(int t); extern void __exception_setreload(int t);
@ -228,12 +227,10 @@ int main(int argc, char **argv)
} }
} }
} }
SYSSETTINGS SystemInfo;
if (AHB_ACCESS && !forceNoAHBPROT) IosPatch_RUNTIME(true, false, false, false);
if (HAVE_AHBPROT && !forceNoAHBPROT) SystemInfo.nandAccess = CheckNANDAccess();
//IOSPATCH_Apply();
IosPatch_RUNTIME(true, false, false, false);
bool nandAccess = CheckNANDAccess();
// Get and display the current date and time // Get and display the current date and time
struct tm today; struct tm today;
@ -246,27 +243,30 @@ int main(int argc, char **argv)
// Get the console region // Get the console region
printLoading(MSG_GetConsoleRegion); printLoading(MSG_GetConsoleRegion);
//usleep(250000); usleep(200000);
int regionSelection = CONF_GetRegion(); SystemInfo.systemRegion = CONF_GetRegion();
u8 shopcode = 0; SystemInfo.shopcode = 0;
char country[COUNTRY_SIZE] = "Unknown"; if (!CONF_GetShopCode(&SystemInfo.shopcode)) {
if (!CONF_GetShopCode(&shopcode)) strncpy(country, CONF_CountryCodes[shopcode], COUNTRY_SIZE); strcpy(SystemInfo.country, CONF_CountryCodes[SystemInfo.shopcode]);
} else {
strcpy(SystemInfo.country, "Unknown");
}
// Get the system menu version // Get the system menu version
printLoading(MSG_GetSysMenuVer); printLoading(MSG_GetSysMenuVer);
//usleep(250000); usleep(200000);
u32 sysVersion = GetSysMenuVersion(); SystemInfo.sysMenuVer = GetSysMenuVersion();
sysMenu systemmenu; sysMenu systemmenu;
printLoading(MSG_GetHBCVer); printLoading(MSG_GetHBCVer);
//usleep(250000); usleep(200000);
u32 hbcversion = 0; u32 hbcversion = 0;
u32 hbfversion = 0; u32 hbfversion = 0;
s32 hbc = 0; s32 hbc = 0;
s32 hbf = 0; s32 hbf = 0;
u32 hbcIOS = 0; u32 hbcIOS = 0;
u32 dvdSupport = 0; SystemInfo.dvdSupport = 0;
s32 ret = Title_GetVersionNObuf(0x000100014C554C5All); s32 ret = Title_GetVersionNObuf(0x000100014C554C5All);
if (ret<0) { if (ret<0) {
ret = Title_GetVersionNObuf(0x00010001AF1BF516ll); ret = Title_GetVersionNObuf(0x00010001AF1BF516ll);
@ -319,38 +319,38 @@ int main(int argc, char **argv)
hbfversion = ret; hbfversion = ret;
} }
if (HAVE_AHBPROT && !forceNoAHBPROT) { if (AHB_ACCESS && !forceNoAHBPROT) {
DI_Init(); DI_Init();
DI_DriveID id; DI_DriveID id;
if(DI_Identify(&id) == 0) { if(DI_Identify(&id) == 0) {
dvdSupport = id.rel_date; SystemInfo.dvdSupport = id.rel_date;
} }
DI_Close(); DI_Close();
} }
float sysNinVersion = GetSysMenuNintendoVersion(sysVersion); SystemInfo.sysNinVersion = GetSysMenuNintendoVersion(SystemInfo.sysMenuVer);
char SysMenuRegion = GetSysMenuRegion(sysVersion); SystemInfo.sysMenuRegion = GetSysMenuRegion(SystemInfo.sysMenuVer);
// Get the running IOS version and revision // Get the running IOS version and revision
u32 runningIOS = IOS_GetVersion(); u32 runningIOS = IOS_GetVersion();
u32 runningIOSRevision = IOS_GetRevision(); u32 runningIOSRevision = IOS_GetRevision();
printLoading(MSG_GetRunningIOS); printLoading(MSG_GetRunningIOS);
//usleep(250000); usleep(200000);
// Get the console ID // Get the console ID
printLoading(MSG_GetConsoleID); printLoading(MSG_GetConsoleID);
//usleep(250000); usleep(200000);
u32 deviceID = GetDeviceID(); SystemInfo.deviceID = GetDeviceID();
// Get the boot2 version // Get the boot2 version
printLoading(MSG_GetBoot2); printLoading(MSG_GetBoot2);
//usleep(250000); usleep(200000);
u32 boot2version = GetBoot2Version(); SystemInfo.boot2version = GetBoot2Version();
// Get number of titles // Get number of titles
printLoading(MSG_GetNrOfTitles); printLoading(MSG_GetNrOfTitles);
//usleep(250000); usleep(200000);
u32 tempTitles; u32 tempTitles;
if (ES_GetNumTitles(&tempTitles) < 0) { if (ES_GetNumTitles(&tempTitles) < 0) {
@ -375,7 +375,7 @@ int main(int argc, char **argv)
// Get list of titles // Get list of titles
printLoading(MSG_GetTitleList); printLoading(MSG_GetTitleList);
//usleep(250000); usleep(200000);
if (ES_GetTitles(titles, nbTitles) < 0) { if (ES_GetTitles(titles, nbTitles) < 0) {
printError(ERR_GetTitleList); printError(ERR_GetTitleList);
sleep(5); sleep(5);
@ -385,9 +385,9 @@ int main(int argc, char **argv)
int i; int i;
int j; int j;
int countIOS = 0; // Number of IOS SystemInfo.countIOS = 0; // Number of IOS
int countStubs = 0; // Number of IOS Stubs SystemInfo.countStubs = 0; // Number of IOS Stubs
int countBCMIOS = 0; //Number of BC and MIOS. Should be 2. SystemInfo.countBCMIOS = 0; //Number of BC and MIOS. Should be 2.
u32 titleID; u32 titleID;
char HashLogBuffer[300][100] = {{0}}; char HashLogBuffer[300][100] = {{0}};
int lines = 0; int lines = 0;
@ -416,14 +416,14 @@ int main(int argc, char **argv)
titles[i] = 0; titles[i] = 0;
continue; continue;
} }
countIOS++; SystemInfo.countIOS++;
} }
// Sort IOS titles // Sort IOS titles
printLoading(MSG_SortTitles); printLoading(MSG_SortTitles);
//usleep(250000); //usleep(200000);
u64 *newTitles = memalign(32, countIOS*sizeof(u64)); u64 *newTitles = memalign(32, SystemInfo.countIOS*sizeof(u64));
u32 cnt = 0; u32 cnt = 0;
for (i = 0; i < nbTitles; i++) { for (i = 0; i < nbTitles; i++) {
if (titles[i] > 0) { if (titles[i] > 0) {
@ -432,13 +432,13 @@ int main(int argc, char **argv)
} }
} }
sort(newTitles, countIOS); sort(newTitles, SystemInfo.countIOS);
free(titles); free(titles);
IOS ios[countIOS]; IOS ios[SystemInfo.countIOS];
// ios Liste initialisieren // ios Liste initialisieren
//for (i = 0; i < countIOS; i++) { //for (i = 0; i < countIOS; i++) {
for (i = countIOS; i--;) { // Should be slightly faster for (i = SystemInfo.countIOS; i--;) { // Should be slightly faster
ios[i].infoContent = 0; ios[i].infoContent = 0;
ios[i].titleID = 0; ios[i].titleID = 0;
ios[i].mloadVersion = 0; ios[i].mloadVersion = 0;
@ -459,14 +459,14 @@ int main(int argc, char **argv)
NandStartup(); NandStartup();
// Check Priiloader // Check Priiloader
int priiloader = checkSysLoader(); SystemInfo.priiloader = checkSysLoader();
// Check MIOS // Check MIOS
if (nandAccess) get_miosinfo(miosInfo); if (SystemInfo.nandAccess) get_miosinfo(SystemInfo.miosInfo);
// For each titles found // For each titles found
//for (i = 0; i < countIOS; i++) //for (i = 0; i < countIOS; i++)
for (i = countIOS; i--;) // Should be slightly faster for (i = SystemInfo.countIOS; i--;) // Should be slightly faster
{ {
ios[i].titleID = newTitles[i] & 0xFFFFFFFF; ios[i].titleID = newTitles[i] & 0xFFFFFFFF;
@ -528,7 +528,7 @@ int main(int argc, char **argv)
} }
if (!ios[i].isStub || ios[i].titleID == 252) { if (!ios[i].isStub || ios[i].titleID == 252) {
if (nandAccess) if (SystemInfo.nandAccess)
if (!getInfoFromContent(&ios[i])) { if (!getInfoFromContent(&ios[i])) {
// Hash des TMDs abrufen // Hash des TMDs abrufen
iosTMD->title_id = ((u64)(1) << 32) | 249; iosTMD->title_id = ((u64)(1) << 32) | 249;
@ -557,9 +557,9 @@ int main(int argc, char **argv)
free(iosTMDBuffer); free(iosTMDBuffer);
if (ios[i].titleID == 256 || ios[i].titleID == 257) countBCMIOS++; if (ios[i].titleID == 256 || ios[i].titleID == 257) SystemInfo.countBCMIOS++;
if (ios[i].isStub && !(iosTMD->title_version == 31338) && !(iosTMD->title_version == 65281) && !(iosTMD->title_version == 65535)) countStubs++; if (ios[i].isStub && !(iosTMD->title_version == 31338) && !(iosTMD->title_version == 65281) && !(iosTMD->title_version == 65535)) SystemInfo.countStubs++;
} }
// Check if this title is an IOS stub // Check if this title is an IOS stub
@ -617,12 +617,12 @@ int main(int argc, char **argv)
NandShutdown(); NandShutdown();
UnmountSD(); UnmountSD();
u32 countTitles = nbTitles; SystemInfo.countTitles = nbTitles;
nbTitles = countIOS; nbTitles = SystemInfo.countIOS;
// Get the certificates from the NAND // Get the certificates from the NAND
printLoading(MSG_GetCertificates); printLoading(MSG_GetCertificates);
//usleep(250000); usleep(200000);
if (!GetCertificates()) { if (!GetCertificates()) {
printError(ERR_GetCertificates); printError(ERR_GetCertificates);
sleep(5); sleep(5);
@ -633,7 +633,7 @@ int main(int argc, char **argv)
//Select an IOS to test //Select an IOS to test
WPAD_Init(); WPAD_Init();
int selectedIOS = -1; int selectedIOS = -1;
u16 wpressed; u32 wpressed;
time_t starttime; time_t starttime;
starttime = time(NULL); starttime = time(NULL);
@ -658,11 +658,9 @@ int main(int argc, char **argv)
case 256: case 256:
sprintf(MSG_Buffer, "BC"); sprintf(MSG_Buffer, "BC");
break; break;
case 257: case 257:
sprintf(MSG_Buffer, "MIOS"); sprintf(MSG_Buffer, "MIOS");
break; break;
default: default:
sprintf(MSG_Buffer, "IOS%d", titleID); sprintf(MSG_Buffer, "IOS%d", titleID);
break; break;
@ -682,11 +680,9 @@ int main(int argc, char **argv)
case 256: case 256:
sprintf(MSG_Buffer, "BC"); sprintf(MSG_Buffer, "BC");
break; break;
case 257: case 257:
sprintf(MSG_Buffer, "MIOS"); sprintf(MSG_Buffer, "MIOS");
break; break;
default: default:
sprintf(MSG_Buffer, "IOS%d", titleID); sprintf(MSG_Buffer, "IOS%d", titleID);
break; break;
@ -791,12 +787,12 @@ int main(int argc, char **argv)
} }
// Check Priiloader // Check Priiloader
if (!nandAccess && priiloader == -2 && ios[i].infoNANDAccess) { if (!SystemInfo.nandAccess && SystemInfo.priiloader == -2 && ios[i].infoNANDAccess) {
priiloader = checkSysLoader(); SystemInfo.priiloader = checkSysLoader();
} }
// Check Base IOS // Check Base IOS
if (!nandAccess && ios[i].infoNANDAccess) { if (!SystemInfo.nandAccess && ios[i].infoNANDAccess) {
NandStartup(); NandStartup();
int k = 0; int k = 0;
for (k = 0; k < nbTitles; k++) { for (k = 0; k < nbTitles; k++) {
@ -823,39 +819,39 @@ int main(int argc, char **argv)
IOS_ReloadIOS(runningIOS); IOS_ReloadIOS(runningIOS);
sprintf(MSG_Buffer, MSG_ReloadIOS, runningIOS, runningIOSRevision); sprintf(MSG_Buffer, MSG_ReloadIOS, runningIOS, runningIOSRevision);
printLoading(MSG_Buffer); printLoading(MSG_Buffer);
//usleep(250000); usleep(200000);
//--Generate Report-- //--Generate Report--
printLoading(MSG_GenerateReport); printLoading(MSG_GenerateReport);
//usleep(250000); usleep(200000);
char ReportBuffer[200][100] = {{0}}; char ReportBuffer[200][100] = {{0}};
if (dvdSupport > 0) if (SystemInfo.dvdSupport > 0)
formatDate(dvdSupport, ReportBuffer); formatDate(SystemInfo.dvdSupport, ReportBuffer);
else else
sprintf(ReportBuffer[DVD], TXT_NoDVD); sprintf(ReportBuffer[DVD], TXT_NoDVD);
// Display Title // Display Title
sprintf(ReportBuffer[APP_TITLE], TXT_AppTitle, TXT_AppVersion); sprintf(ReportBuffer[APP_TITLE], TXT_AppTitle, TXT_AppVersion);
sprintf(ReportBuffer[APP_IOS], TXT_AppIOS, runningIOS, IOS_GetRevision()); sprintf(ReportBuffer[APP_IOS], TXT_AppIOS, runningIOS, IOS_GetRevision());
bool validregion = regionSelection >= CONF_REGION_JP && regionSelection <= CONF_REGION_CN; bool validregion = SystemInfo.systemRegion >= CONF_REGION_JP && SystemInfo.systemRegion <= CONF_REGION_CN;
// Display the console region // Display the console region
if (sysNinVersion != 0.0f) { if (SystemInfo.sysNinVersion != 0.0f) {
sprintf(ReportBuffer[TEXT_REGION], "%s: %s", TXT_Region, validregion ? Regions[regionSelection] : ""); sprintf(ReportBuffer[TEXT_REGION], "%s: %s", TXT_Region, validregion ? Regions[SystemInfo.systemRegion] : "");
if (validregion) if (validregion)
sprintf(ReportBuffer[SYSMENU], TXT_SysMenu, sysNinVersion, SysMenuRegion, sysVersion); sprintf(ReportBuffer[SYSMENU], TXT_SysMenu, SystemInfo.sysNinVersion, SystemInfo.sysMenuRegion, SystemInfo.sysMenuVer);
else else
strcat(ReportBuffer[SYSMENU], TXT_Unknown); strcat(ReportBuffer[SYSMENU], TXT_Unknown);
} else if (systemmenu.hasInfo) { } else if (systemmenu.hasInfo) {
u32 realSysVersion = systemmenu.realRevision; u32 realSysVersion = systemmenu.realRevision;
sysNinVersion = GetSysMenuNintendoVersion(realSysVersion); SystemInfo.sysNinVersion = GetSysMenuNintendoVersion(realSysVersion);
SysMenuRegion = GetSysMenuRegion(sysVersion); SystemInfo.sysMenuRegion = GetSysMenuRegion(SystemInfo.sysMenuVer);
sprintf(ReportBuffer[TEXT_REGION], "%s: %s", TXT_Region, validregion ? Regions[regionSelection] : ""); sprintf(ReportBuffer[TEXT_REGION], "%s: %s", TXT_Region, validregion ? Regions[SystemInfo.systemRegion] : "");
if (validregion) if (validregion)
sprintf(ReportBuffer[SYSMENU], TXT_SysMenu3, sysNinVersion, SysMenuRegion, sysVersion, realSysVersion, systemmenu.info); sprintf(ReportBuffer[SYSMENU], TXT_SysMenu3, SystemInfo.sysNinVersion, SystemInfo.sysMenuRegion, SystemInfo.sysMenuVer, realSysVersion, systemmenu.info);
else else
strcat(ReportBuffer[SYSMENU], TXT_Unknown); strcat(ReportBuffer[SYSMENU], TXT_Unknown);
} else { } else {
@ -878,15 +874,15 @@ int main(int argc, char **argv)
if (memcmp((void *)hash, (u32 *)&hashtest, sizeof(sha1)) == 0) if (memcmp((void *)hash, (u32 *)&hashtest, sizeof(sha1)) == 0)
{ {
sysNinVersion = 4.1f; SystemInfo.sysNinVersion = 4.1f;
sprintf(ReportBuffer[TEXT_REGION], "%s: PAL", TXT_Region); sprintf(ReportBuffer[TEXT_REGION], "%s: PAL", TXT_Region);
sprintf(ReportBuffer[SYSMENU], TXT_SysMenu, sysNinVersion, "E", sysVersion); sprintf(ReportBuffer[SYSMENU], TXT_SysMenu, SystemInfo.sysNinVersion, "E", SystemInfo.sysMenuVer);
} else { } else {
s32 sysIOS = get_title_ios(TITLE_ID(0x00000001, 0x00000002)); SystemInfo.sysMenuIOS = get_title_ios(TITLE_ID(0x00000001, 0x00000002));
char Region[100]; char Region[100];
switch (regionSelection) switch (SystemInfo.systemRegion)
{ {
case CONF_REGION_US: case CONF_REGION_US:
sprintf(ReportBuffer[TEXT_REGION], "%s: NTSC-U", TXT_Region); sprintf(ReportBuffer[TEXT_REGION], "%s: NTSC-U", TXT_Region);
@ -908,49 +904,40 @@ int main(int argc, char **argv)
sprintf(ReportBuffer[TEXT_REGION], "%s: ", TXT_Region); sprintf(ReportBuffer[TEXT_REGION], "%s: ", TXT_Region);
strcat(ReportBuffer[TEXT_REGION], TXT_Unknown); strcat(ReportBuffer[TEXT_REGION], TXT_Unknown);
} }
sprintf(Region, "%c", SysMenuRegion); sprintf(Region, "%c", SystemInfo.sysMenuRegion);
switch (sysIOS) switch (SystemInfo.sysMenuIOS)
{ {
case 9: case 9:
sprintf(ReportBuffer[SYSMENU], TXT_SysMenu2, "1.0", Region, sysVersion); sprintf(ReportBuffer[SYSMENU], TXT_SysMenu2, "1.0", Region, SystemInfo.sysMenuVer);
break; break;
case 11: case 11:
sprintf(ReportBuffer[SYSMENU], TXT_SysMenu2, "2.0/2.1", Region, sysVersion); sprintf(ReportBuffer[SYSMENU], TXT_SysMenu2, "2.0/2.1", Region, SystemInfo.sysMenuVer);
break; break;
case 20: case 20:
sprintf(ReportBuffer[SYSMENU], TXT_SysMenu2, "2.2", Region); sprintf(ReportBuffer[SYSMENU], TXT_SysMenu2, "2.2", Region);
break; break;
case 30: case 30:
sprintf(ReportBuffer[SYSMENU], TXT_SysMenu2, "3.0/3.1/3.2/3.3", Region, sysVersion); sprintf(ReportBuffer[SYSMENU], TXT_SysMenu2, "3.0/3.1/3.2/3.3", Region, SystemInfo.sysMenuVer);
break; break;
case 40: case 40:
sprintf(ReportBuffer[SYSMENU], TXT_SysMenu2, "3.3", Region, sysVersion); sprintf(ReportBuffer[SYSMENU], TXT_SysMenu2, "3.3", Region, SystemInfo.sysMenuVer);
break; break;
case 50: case 50:
sprintf(ReportBuffer[SYSMENU], TXT_SysMenu2, "3.4", Region, sysVersion); sprintf(ReportBuffer[SYSMENU], TXT_SysMenu2, "3.4", Region, SystemInfo.sysMenuVer);
break; break;
case 60: case 60:
sprintf(ReportBuffer[SYSMENU], TXT_SysMenu2, "4.0/4.1", Region, sysVersion); sprintf(ReportBuffer[SYSMENU], TXT_SysMenu2, "4.0/4.1", Region, SystemInfo.sysMenuVer);
break; break;
case 70: case 70:
sprintf(ReportBuffer[SYSMENU], TXT_SysMenu2, "4.2", Region, sysVersion); sprintf(ReportBuffer[SYSMENU], TXT_SysMenu2, "4.2", Region, SystemInfo.sysMenuVer);
break; break;
case 80: case 80:
sprintf(ReportBuffer[SYSMENU], TXT_SysMenu2, "4.3", Region, sysVersion); sprintf(ReportBuffer[SYSMENU], TXT_SysMenu2, "4.3", Region, SystemInfo.sysMenuVer);
break; break;
default: default:
sprintf(ReportBuffer[SYSMENU], TXT_SysMenu2, "0.0", Region, sysVersion); sprintf(ReportBuffer[SYSMENU], TXT_SysMenu2, "0.0", Region, SystemInfo.sysMenuVer);
break;
} }
} }
} }
@ -960,7 +947,7 @@ int main(int argc, char **argv)
case CONF_CODE_VJPNI: case CONF_CODE_VJPNI:
case CONF_CODE_VJPNO: case CONF_CODE_VJPNO:
// JAP // JAP
if (regionSelection != CONF_REGION_JP) { if (SystemInfo.systemRegion != CONF_REGION_JP) {
strcat(ReportBuffer[TEXT_REGION], TXT_OriginalRegion); strcat(ReportBuffer[TEXT_REGION], TXT_OriginalRegion);
strcat(ReportBuffer[TEXT_REGION], "JAP)"); strcat(ReportBuffer[TEXT_REGION], "JAP)");
} }
@ -970,7 +957,7 @@ int main(int argc, char **argv)
case CONF_CODE_VUSAI: case CONF_CODE_VUSAI:
case CONF_CODE_VUSAO: case CONF_CODE_VUSAO:
// USA // USA
if (regionSelection != CONF_REGION_US) { if (SystemInfo.systemRegion != CONF_REGION_US) {
strcat(ReportBuffer[TEXT_REGION], TXT_OriginalRegion); strcat(ReportBuffer[TEXT_REGION], TXT_OriginalRegion);
strcat(ReportBuffer[TEXT_REGION], "USA)"); strcat(ReportBuffer[TEXT_REGION], "USA)");
} }
@ -988,14 +975,14 @@ int main(int argc, char **argv)
case CONF_CODE_VEURFI: case CONF_CODE_VEURFI:
case CONF_CODE_VEURFO: case CONF_CODE_VEURFO:
// EU // EU
if (regionSelection != CONF_REGION_EU) { if (SystemInfo.systemRegion != CONF_REGION_EU) {
strcat(ReportBuffer[TEXT_REGION], TXT_OriginalRegion); strcat(ReportBuffer[TEXT_REGION], TXT_OriginalRegion);
strcat(ReportBuffer[TEXT_REGION], "PAL)"); strcat(ReportBuffer[TEXT_REGION], "PAL)");
} }
break; break;
case CONF_CODE_KOR: case CONF_CODE_KOR:
// KOR // KOR
if (regionSelection != CONF_REGION_KR) { if (SystemInfo.systemRegion != CONF_REGION_KR) {
strcat(ReportBuffer[TEXT_REGION], TXT_OriginalRegion); strcat(ReportBuffer[TEXT_REGION], TXT_OriginalRegion);
strcat(ReportBuffer[TEXT_REGION], "KOR)"); strcat(ReportBuffer[TEXT_REGION], "KOR)");
} }
@ -1012,9 +999,9 @@ int main(int argc, char **argv)
break; break;
} }
if (priiloader == 1) if (SystemInfo.priiloader == 1)
sprintf(ReportBuffer[PRIILOADER], TXT_Priiloader); sprintf(ReportBuffer[PRIILOADER], TXT_Priiloader);
else if (priiloader == 2) else if (SystemInfo.priiloader == 2)
sprintf(ReportBuffer[PRIILOADER], TXT_PreFiix); sprintf(ReportBuffer[PRIILOADER], TXT_PreFiix);
if (hbc == 0 || hbcversion == 0) if (hbc == 0 || hbcversion == 0)
@ -1032,11 +1019,11 @@ int main(int argc, char **argv)
sprintf(ReportBuffer[HBF], TXT_HBF, hbfversion); sprintf(ReportBuffer[HBF], TXT_HBF, hbfversion);
sprintf(ReportBuffer[HOLLYWOOD], TXT_Hollywood, *HOLLYWOOD_VERSION); sprintf(ReportBuffer[HOLLYWOOD], TXT_Hollywood, *HOLLYWOOD_VERSION);
sprintf(ReportBuffer[CONSOLE_ID], TXT_ConsoleID, deviceID); sprintf(ReportBuffer[CONSOLE_ID], TXT_ConsoleID, SystemInfo.deviceID);
sprintf(ReportBuffer[BOOT2_VERSION], TXT_vBoot2, boot2version); sprintf(ReportBuffer[BOOT2_VERSION], TXT_vBoot2, SystemInfo.boot2version);
sprintf(ReportBuffer[COUNTRY], "Shop Channel Country: %s (%u)", (strlen(country)) ? country : TXT_Unknown, shopcode); sprintf(ReportBuffer[COUNTRY], "Shop Channel Country: %s (%u)", (strlen(SystemInfo.country)) ? SystemInfo.country : TXT_Unknown, SystemInfo.shopcode);
sprintf(ReportBuffer[NR_OF_TITLES], TXT_NrOfTitles, countTitles); sprintf(ReportBuffer[NR_OF_TITLES], TXT_NrOfTitles, SystemInfo.countTitles);
sprintf(ReportBuffer[NR_OF_IOS], TXT_NrOfIOS, (countIOS - countBCMIOS), countStubs); sprintf(ReportBuffer[NR_OF_IOS], TXT_NrOfIOS, (SystemInfo.countIOS - SystemInfo.countBCMIOS), SystemInfo.countStubs);
// Display IOS vulnerabilities // Display IOS vulnerabilities
@ -1049,7 +1036,7 @@ int main(int argc, char **argv)
if (ios[i].titleID == 256) { if (ios[i].titleID == 256) {
sprintf(ReportBuffer[lineOffset], "BC v%d", ios[i].revision); sprintf(ReportBuffer[lineOffset], "BC v%d", ios[i].revision);
} else if (ios[i].titleID == 257) { } else if (ios[i].titleID == 257) {
sprintf(ReportBuffer[lineOffset], "MIOS v%d%s", ios[i].revision, miosInfo); sprintf(ReportBuffer[lineOffset], "MIOS v%d%s", ios[i].revision, SystemInfo.miosInfo);
} else if ((ios[i].titleID==222 || ios[i].titleID==224 || ios[i].titleID==223 || ios[i].titleID==202 || ios[i].titleID==225) && ios[i].baseIOS == 75) { } else if ((ios[i].titleID==222 || ios[i].titleID==224 || ios[i].titleID==223 || ios[i].titleID==202 || ios[i].titleID==225) && ios[i].baseIOS == 75) {
sprintf(ReportBuffer[lineOffset], "IOS%d[38+37] (rev %d, Info: %s):", ios[i].titleID, ios[i].revision, ios[i].info); sprintf(ReportBuffer[lineOffset], "IOS%d[38+37] (rev %d, Info: %s):", ios[i].titleID, ios[i].revision, ios[i].info);
} else { } else {
@ -1107,12 +1094,12 @@ int main(int argc, char **argv)
// Mount the SD Card // Mount the SD Card
printLoading(MSG_MountSD); printLoading(MSG_MountSD);
//usleep(250000); usleep(200000);
MountSD(); MountSD();
// Initialise the FAT file system // Initialise the FAT file system
printLoading(MSG_InitFAT); printLoading(MSG_InitFAT);
//usleep(250000); usleep(200000);
if (!fatInitDefault()) if (!fatInitDefault())
{ {
sprintf(MSG_Buffer, ERR_InitFAT); sprintf(MSG_Buffer, ERR_InitFAT);
@ -1132,6 +1119,7 @@ int main(int argc, char **argv)
for (i = 0; i <= NumLines; i++) { for (i = 0; i <= NumLines; i++) {
fprintf(file, ReportBuffer[i]); fprintf(file, ReportBuffer[i]);
fprintf(file, "\r\n"); fprintf(file, "\r\n");
fflush(file);
} }
// Close the report // Close the report
fclose(file); fclose(file);
@ -1209,10 +1197,11 @@ int main(int argc, char **argv)
printReport(ReportBuffer, LineNr, completeReport); printReport(ReportBuffer, LineNr, completeReport);
} else { } else {
printReport(ReportBuffer, LineNr, completeReport); printReport(ReportBuffer, LineNr, completeReport);
usleep(500000); // A little pause to decrease the chance of accidental upload
reportIsDisplayed = true; reportIsDisplayed = true;
} }
} }
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 (wpressed & WPAD_BUTTON_UP) {
if (LineNr > 0) LineNr--; if (LineNr > 0) LineNr--;
printReport(ReportBuffer, LineNr, completeReport); printReport(ReportBuffer, LineNr, completeReport);
@ -1230,10 +1219,10 @@ int main(int argc, char **argv)
if (wpressed & WPAD_BUTTON_RIGHT) { if (wpressed & WPAD_BUTTON_RIGHT) {
if (LineNr < NumLines-14) LineNr = LineNr + 15; if (LineNr < NumLines-14) LineNr = LineNr + 15;
if (LineNr > NumLines) LineNr = NumLines; if (LineNr + 14 > NumLines) LineNr = NumLines-14;
printReport(ReportBuffer, LineNr, completeReport); printReport(ReportBuffer, LineNr, completeReport);
} }
}
} }
} }

View File

@ -12,12 +12,12 @@
s32 downloadSyscheckFile(const char* fileName) { s32 downloadSyscheckFile(const char* fileName) {
int ret = 0; int ret = 0;
static char buf[128]; char buf[128] = {0};
u32 http_status; u32 http_status;
u8* outbuf; u8* outbuf;
u32 lenght; u32 lenght;
snprintf(buf, 127, "http://syscheck-hd.googlecode.com/svn/trunk/SysCheckHDE/%s", fileName); snprintf(buf, sizeof(buf), "http://syscheck-hd.googlecode.com/svn/trunk/SysCheckHDE/%s", fileName);
ret = http_request(buf, 1 << 31); ret = http_request(buf, 1 << 31);
if (!ret) if (!ret)
@ -63,13 +63,13 @@ s32 updateApp(void) {
if (ret < 0) if (ret < 0)
goto out; goto out;
static char buf[128]; char buf[128] = {0};
u32 http_status; u32 http_status;
u8* outbuf; u8* outbuf;
u32 length; u32 length;
const char *checkStr = "Version="; const char *checkStr = "Version=";
snprintf(buf, 128, "http://syscheck-hd.googlecode.com/svn/trunk/Version.txt"); snprintf(buf, sizeof(buf), "http://syscheck-hd.googlecode.com/svn/trunk/Version.txt");
ret = http_request(buf, 1 << 31); ret = http_request(buf, 1 << 31);
if (!ret) if (!ret)

View File

@ -31,7 +31,7 @@
/* Converts an integer value to its hex character*/ /* Converts an integer value to its hex character*/
char to_hex(char code) { char to_hex(char code) {
static char hex[] = "0123456789abcdef"; char hex[] = "0123456789abcdef";
return hex[code & 15]; return hex[code & 15];
} }
@ -107,7 +107,7 @@ void transmitSyscheck(char ReportBuffer[200][100], int *lines) {
free(outbuf); free(outbuf);
gprintf("len: %d, String: %s\n", lenght, ReportBuffer[*lines]); gprintf("len: %d, String: %s\n", lenght, ReportBuffer[*lines]);
u16 wpressed; u32 wpressed;
if (!strncmp(ReportBuffer[*lines], "ERROR: ", 7)) { if (!strncmp(ReportBuffer[*lines], "ERROR: ", 7)) {
char temp[100]; char temp[100];