From a9f4ebcb88247bea401c38b19287ae36dd90b1a4 Mon Sep 17 00:00:00 2001 From: Joostinonline Date: Thu, 13 Feb 2014 09:16:23 +0000 Subject: [PATCH] -Grouped HBC and HBF info into structures -Fixed Console Type check -A little more code cleanup --- include/SysMenuInfo.h | 10 +++ include/gui.h | 6 +- include/languages.h | 1 + include/sys.h | 25 +++++--- source/gui.c | 79 +++++++++++------------- source/languages.c | 23 ++++--- source/sysCheck.c | 139 +++++++++++++++++++++--------------------- 7 files changed, 153 insertions(+), 130 deletions(-) diff --git a/include/SysMenuInfo.h b/include/SysMenuInfo.h index f16f689..384ceec 100644 --- a/include/SysMenuInfo.h +++ b/include/SysMenuInfo.h @@ -36,6 +36,7 @@ typedef struct { u32 deviceID; + bool deviceType; u32 boot2version; u32 sysMenuVer; u32 dvdSupport; @@ -43,6 +44,7 @@ typedef struct { float sysNinVersion; char sysMenuRegion; s32 systemRegion; + bool validregion; char country[44]; char miosInfo[128]; u32 countTitles; @@ -59,6 +61,14 @@ typedef struct { int type; } dirent_t; +typedef struct { + u32 hbcversion; + u32 hbfversion; + s32 hbc; + s32 hbf; + u32 hbcIOS; +} homebrew_t; + char getSystemMenuRegionFromContent(); #endif diff --git a/include/gui.h b/include/gui.h index 571ceab..9712311 100644 --- a/include/gui.h +++ b/include/gui.h @@ -6,9 +6,8 @@ #define HEX_WHITE 0xFFFFFFFF #define HEX_BLACK 0x00000000 -#define CopyBuf() GRRLIB_Screen2Texture(0, 0, tex_ScreenBuf, GX_FALSE) -#define DrawBuf() GRRLIB_DrawImg(0, 0, tex_ScreenBuf, 0, 1, 1, HEX_WHITE) -#define CheckTime(X,Y) (ticks_to_millisecs(diff_ticks((X), gettick())) > (Y)) +#define CopyBuf() GRRLIB_Screen2Texture(0, 0, tex_ScreenBuf, GX_FALSE) +#define DrawBuf() GRRLIB_DrawImg(0, 0, tex_ScreenBuf, 0, 1, 1, HEX_WHITE) extern GRRLIB_ttfFont *myFont; extern GRRLIB_texImg *tex_background_png; @@ -24,7 +23,6 @@ extern GRRLIB_texImg *tex_WiiDpadRight_png; extern GRRLIB_texImg *tex_loadingbargrey_png; extern GRRLIB_texImg *tex_loadingbarblue_png; extern GRRLIB_texImg *tex_window_png; -extern GRRLIB_texImg *tex_Cogs_png[5]; extern GRRLIB_texImg *tex_ScreenBuf; int initGUI(void); diff --git a/include/languages.h b/include/languages.h index 8d7387c..4711928 100644 --- a/include/languages.h +++ b/include/languages.h @@ -37,6 +37,7 @@ const char* TXT_HBC_112; const char* TXT_HBC_STUB; const char* TXT_Hollywood; const char* TXT_ConsoleID; +const char* TXT_ConsoleType; const char* TXT_vBoot2; const char* TXT_NrOfTitles; const char* TXT_NrOfIOS; diff --git a/include/sys.h b/include/sys.h index cb8bef2..c00a2e1 100644 --- a/include/sys.h +++ b/include/sys.h @@ -6,7 +6,7 @@ #define MEM_PROT (MEM_REG_BASE + 0x20a) #define HOLLYWOOD_VERSION (vu32*)0x80003138 #define LOADER_STUB (vu32*)0x80001800 -#define IS_WII_U ((*(vu32*)(0xCd8005A0) >> 16 ) == 0xCAFE); +#define IS_WII_U ((*(vu32*)(0xCd8005A0) >> 16 ) == 0xCAFE) // Turn upper and lower into a full title ID #define TITLE_ID(x,y) (((u64)(x) << 32) | (y)) @@ -30,6 +30,7 @@ enum { HBF, HOLLYWOOD, CONSOLE_ID, + CONSOLE_TYPE, COUNTRY, BOOT2_VERSION, NR_OF_TITLES, @@ -38,6 +39,20 @@ enum { LAST }; +enum { + HBC_NONE = 0, + HBC_HAXX, + HBC_JODI, + HBC_1_0_7, + HBC_LULZ +}; + +enum { + HBF_NONE = 0, + HBF_HBF0, + HBF_THBF +}; + typedef struct { s32 revision; bool isStub; @@ -108,19 +123,15 @@ bool CheckFlashAccess(void); bool CheckNANDAccess(void); bool CheckBoot2Access(void); bool CheckMload(void); -bool CheckUSB2(u32); -bool IsKnownStub(u32, s32); +bool CheckUSB2(u32 titleID); +bool IsKnownStub(u32 noIOS, s32 noRevision); s32 GetTMD(u64 TicketID, signed_blob **Output, u32 *Length); -char GetBootFilename(u64 titleId); s32 read_file_from_nand(char *filepath, u8 **buffer, u32 *filesize); int NandStartup(void); void NandShutdown(void); int checkSysLoader(void); void transmitSyscheck(char ReportBuffer[200][100], int *lines); -u32 IOSPATCH_Apply(void); s32 brute_tmd(tmd *p_tmd); -bool checkISFSinRAM(void); -u32 es_set_ahbprot(void); void *allocate_memory(u32 size); void logfile(const char *format, ...); s32 get_miosinfo(char *str); diff --git a/source/gui.c b/source/gui.c index b642cb5..a8b13cf 100644 --- a/source/gui.c +++ b/source/gui.c @@ -106,10 +106,7 @@ bool loadSystemFont(bool korean) free(fontArchive); free(contentMap); MountSD(); - static char buf[128]; - snprintf(buf, 128, "sd:/test.ttf"); - FILE *fp = NULL; - fp = fopen(buf, "wb"); + FILE *fp = fopen("sd:/test.ttf", "wb"); if (fp) { fwrite(systemFont, 1, systemFontSize, fp); @@ -181,7 +178,6 @@ int printError(const char* msg) { DrawBuf(); GRRLIB_Render(); } - return 0; } @@ -200,11 +196,12 @@ int printSuccess(const char* msg) { int printLoading(const char* msg) { int i; + GRRLIB_DrawImg(0, 0, tex_background_png, 0, 1, 1, HEX_WHITE); + GRRLIB_DrawImg(256, 112, tex_Refreshicon_png, 0, 1, 1, HEX_WHITE); + GRRLIB_PrintfTTF((640-strlen(msg)*9)/2, 256, myFont, msg, 20, HEX_WHITE); + CopyBuf(); for (i = 0; i < 3; i++) { //Workaround for GRRLIB_Render() bug - GRRLIB_DrawImg(0, 0, tex_background_png, 0, 1, 1, HEX_WHITE); - GRRLIB_DrawImg(256, 112, tex_Refreshicon_png, 0, 1, 1, HEX_WHITE); - GRRLIB_PrintfTTF((640-strlen(msg)*9)/2, 256, myFont, msg, 20, HEX_WHITE); - + DrawBuf(); GRRLIB_Render(); } return 0; @@ -276,7 +273,6 @@ int printEndSuccess(const char* msg) { DrawBuf(); GRRLIB_Render(); } - return 0; } @@ -302,45 +298,44 @@ int printEndError(const char* msg) { DrawBuf(); GRRLIB_Render(); } - return 0; } int printReport(char report[200][100], int firstLine, bool completeReport) { int i, j; + GRRLIB_DrawImg(0, 0, tex_background_png, 0, 1, 1, HEX_WHITE); + GRRLIB_DrawImg(36, 40, tex_window_png, 0, 1, 1, HEX_WHITE); + + for (j = 0; j < BLANK + 1; j++) { + GRRLIB_PrintfTTF(80, 98+j*17, myFont, report[firstLine+j], 12, HEX_BLACK); + } + if (completeReport) { + GRRLIB_DrawImg(80, 388, tex_WiiButtonMinus_png, 0, 1, 1, HEX_WHITE); + GRRLIB_PrintfTTF(96-(strlen(BUT_Shutoff)*7.8)/2, 425, myFont, BUT_Shutoff, 14, HEX_WHITE); + + GRRLIB_DrawImg(238, 386, tex_WiiButtonHome_png, 0, 1, 1, HEX_WHITE); + GRRLIB_PrintfTTF(256-(strlen(BUT_HBC)*7.8)/2, 425, myFont, BUT_HBC, 14, HEX_WHITE); + + GRRLIB_DrawImg(380, 388, tex_WiiButtonA_png, 0, 1, 1, HEX_WHITE); + GRRLIB_PrintfTTF(408-(strlen(BUT_ConfirmUpload)*7.8)/2, 425, myFont, BUT_ConfirmUpload, 14, HEX_WHITE); + + GRRLIB_DrawImg(528, 388, tex_WiiButtonPlus_png, 0, 1, 1, HEX_WHITE); + GRRLIB_PrintfTTF(544-(strlen(BUT_SysMenu)*7.8)/2, 425, myFont, BUT_SysMenu, 14, HEX_WHITE); + } else { + GRRLIB_DrawImg(144, 388, tex_WiiButtonMinus_png, 0, 1, 1, HEX_WHITE); + GRRLIB_PrintfTTF(160-(strlen(BUT_Shutoff)*7.8)/2, 425, myFont, BUT_Shutoff, 14, HEX_WHITE); + + GRRLIB_DrawImg(302, 386, tex_WiiButtonHome_png, 0, 1, 1, HEX_WHITE); + GRRLIB_PrintfTTF(320-(strlen(BUT_HBC)*7.8)/2, 425, myFont, BUT_HBC, 14, HEX_WHITE); + + GRRLIB_DrawImg(464, 388, tex_WiiButtonPlus_png, 0, 1, 1, HEX_WHITE); + GRRLIB_PrintfTTF(480-(strlen(BUT_SysMenu)*7.8)/2, 425, myFont, BUT_SysMenu, 14, HEX_WHITE); + } + CopyBuf(); for (i = 0; i < 3; i++) { //Workaround for GRRLIB_Render() bug - GRRLIB_DrawImg(0, 0, tex_background_png, 0, 1, 1, HEX_WHITE); - GRRLIB_DrawImg(36, 40, tex_window_png, 0, 1, 1, HEX_WHITE); - - for (j = 0; j < BLANK + 1; j++) { - GRRLIB_PrintfTTF(80, 98+j*17, myFont, report[firstLine+j], 12, HEX_BLACK); - } - if (completeReport) { - GRRLIB_DrawImg(80, 388, tex_WiiButtonMinus_png, 0, 1, 1, HEX_WHITE); - GRRLIB_PrintfTTF(96-(strlen(BUT_Shutoff)*7.8)/2, 425, myFont, BUT_Shutoff, 14, HEX_WHITE); - - GRRLIB_DrawImg(238, 386, tex_WiiButtonHome_png, 0, 1, 1, HEX_WHITE); - GRRLIB_PrintfTTF(256-(strlen(BUT_HBC)*7.8)/2, 425, myFont, BUT_HBC, 14, HEX_WHITE); - - GRRLIB_DrawImg(380, 388, tex_WiiButtonA_png, 0, 1, 1, HEX_WHITE); - GRRLIB_PrintfTTF(408-(strlen(BUT_ConfirmUpload)*7.8)/2, 425, myFont, BUT_ConfirmUpload, 14, HEX_WHITE); - - GRRLIB_DrawImg(528, 388, tex_WiiButtonPlus_png, 0, 1, 1, HEX_WHITE); - GRRLIB_PrintfTTF(544-(strlen(BUT_SysMenu)*7.8)/2, 425, myFont, BUT_SysMenu, 14, HEX_WHITE); - } else { - GRRLIB_DrawImg(144, 388, tex_WiiButtonMinus_png, 0, 1, 1, HEX_WHITE); - GRRLIB_PrintfTTF(160-(strlen(BUT_Shutoff)*7.8)/2, 425, myFont, BUT_Shutoff, 14, HEX_WHITE); - - GRRLIB_DrawImg(302, 386, tex_WiiButtonHome_png, 0, 1, 1, HEX_WHITE); - GRRLIB_PrintfTTF(320-(strlen(BUT_HBC)*7.8)/2, 425, myFont, BUT_HBC, 14, HEX_WHITE); - - GRRLIB_DrawImg(464, 388, tex_WiiButtonPlus_png, 0, 1, 1, HEX_WHITE); - GRRLIB_PrintfTTF(480-(strlen(BUT_SysMenu)*7.8)/2, 425, myFont, BUT_SysMenu, 14, HEX_WHITE); - } - + DrawBuf(); GRRLIB_Render(); } - return 0; } @@ -355,7 +350,7 @@ int printUploadSuccess(const char* msg) { GRRLIB_DrawImg(302, 300, tex_WiiButtonA_png, 0, 1, 1, HEX_WHITE); GRRLIB_PrintfTTF(319-(strlen(BUT_OK)*7.8)/2, 342, myFont, BUT_OK, 14, HEX_WHITE); - //GRRLIB_DrawImg(52, 340, tex_loadingbarblue_png, 0, 1, 1, HEX_WHITE); + GRRLIB_DrawImg(52, 340, tex_loadingbarblue_png, 0, 1, 1, HEX_WHITE); CopyBuf(); for (i = 0; i < 3; i++) { //Workaround for GRRLIB_Render() bug DrawBuf(); diff --git a/source/languages.c b/source/languages.c index ef66190..553490f 100644 --- a/source/languages.c +++ b/source/languages.c @@ -23,7 +23,7 @@ int initLanguages(struct tm today) { - TXT_AppVersion = "v2.1.0 HD Edition"; + TXT_AppVersion = "v2.2.0 HD Edition"; switch (CONF_GetLanguage()) { case CONF_LANG_GERMAN: @@ -59,10 +59,11 @@ int initLanguages(struct tm today) TXT_HBF = "Homebrew Filter rev%d benutzt IOS58"; TXT_Hollywood = "Hollywood v0x%x"; TXT_ConsoleID = "Konsolen-ID: %d"; + TXT_ConsoleType = "Konsolentyp: %s"; TXT_vBoot2 = "Boot2 v%u"; TXT_NrOfTitles = "Es wurden %d Titel gefunden."; TXT_NrOfIOS = "Es wurden %d IOS gefunden, von denen %d funktionslos (Stub) sind."; - TXT_AppTitle = "sysCheck %s von Double_A und R2-D2199, JoostinOnline, Nano"; + TXT_AppTitle = "SysCheck %s von Double_A und R2-D2199, JoostinOnline, Nano"; TXT_AppIOS = "...laeuft auf dem IOS%d (rev %d)."; ERR_AllocateMemory = "Speicher fuer %d Titel konnte nicht zugewiesen werden."; ERR_OpenFile = "Zugriff auf die Speicherdatei des Berichts fehlgeschlagen!"; @@ -80,6 +81,7 @@ int initLanguages(struct tm today) TXT_NAND = " NAND Zugriff,"; TXT_Boot2 = " Boot2 Zugriff,"; TXT_USB = " USB 2.0,"; + TXT_VersionP = " ES_Version,"; TXT_NoPatch = " Keine Patches,"; sprintf(TXT_ReportDate, "Bericht wurde am %2.2d.%2.2d.%4.4d generiert.", today.tm_mday, today.tm_mon + 1, today.tm_year + 1900); BUT_HBC = "Homebrew Channel"; @@ -88,7 +90,6 @@ int initLanguages(struct tm today) BUT_Update = "Aktualisieren"; TXT_Priiloader = "Priiloader installiert"; TXT_PreFiix = "PreFiix installiert"; - TXT_VersionP = " ES_Version,"; MSG_Update = "Aktualisiere SysCheck..."; MSG_NoUpdate = "Diese Version ist bereits auf dem neuesten Stand!"; MSG_UpdateSuccess = "Die Aktualisierung wurde erfolgreich geladen!"; @@ -132,10 +133,11 @@ int initLanguages(struct tm today) TXT_HBF = "Homebrew Filter rev%d utilise IOS58"; TXT_Hollywood = "Hollywood v0x%x"; TXT_ConsoleID = "Identifiant de la console: %d"; + TXT_ConsoleType = "Type de Console: %s"; TXT_vBoot2 = "Boot2 v%u"; TXT_NrOfTitles = "%d titres trouves."; TXT_NrOfIOS = "%d IOS trouves sur cette console. %d sont des stubs."; - TXT_AppTitle = "sysCheck %s par Double_A et R2-D2199, JoostinOnline, Nano"; + TXT_AppTitle = "SysCheck %s par Double_A et R2-D2199, JoostinOnline, Nano"; TXT_AppIOS = "...tourne sous l'IOS%d (rev %d)."; ERR_AllocateMemory = "Imposible d'allouer la memoire pour %d titres."; ERR_OpenFile = "Impossible d'ouvrir le fichier."; @@ -153,6 +155,7 @@ int initLanguages(struct tm today) TXT_NAND = " Acces NAND,"; TXT_Boot2 = " Acces Boot2,"; TXT_USB = " USB 2.0,"; + TXT_VersionP = " ES_Version,"; TXT_NoPatch = " Pas de patches,"; sprintf(TXT_ReportDate, "Rapport genere le %4.4d/%2.2d/%2.2d.", today.tm_year + 1900, today.tm_mon + 1, today.tm_mday); BUT_HBC = "Homebrew Channel"; @@ -204,10 +207,11 @@ int initLanguages(struct tm today) TXT_HBF = "Homebrew Filter rev%d appoggiato all'IOS58"; TXT_Hollywood = "Hollywood v0x%x"; TXT_ConsoleID = "ID console: %d"; + TXT_ConsoleType = "Tipo Console: %s"; TXT_vBoot2 = "Boot2 v%u"; TXT_NrOfTitles = "Trovati %d giochi."; TXT_NrOfIOS = "Trovati %d IOS in questa console. %d di questi sono stub."; - TXT_AppTitle = "sysCheck %s by Double_A and R2-D2199, JoostinOnline, Nano"; + TXT_AppTitle = "SysCheck %s by Double_A and R2-D2199, JoostinOnline, Nano"; TXT_AppIOS = "...appoggiato all'IOS%d (v. %d)."; ERR_AllocateMemory = "Impossibile allocare la memoria per %d giochi."; ERR_OpenFile = "Impossibile aprire il file!"; @@ -225,6 +229,7 @@ int initLanguages(struct tm today) TXT_NAND = " Accesso NAND,"; TXT_Boot2 = " Accesso Boot2,"; TXT_USB = " USB 2.0,"; + TXT_VersionP = " ES_Version,"; TXT_NoPatch = " Non patchato,"; sprintf(TXT_ReportDate, "Rapporto generato il %2.2d.%2.2d.%4.4d.", today.tm_mday, today.tm_mon + 1, today.tm_year + 1900); BUT_HBC = "Canale Homebrew"; @@ -276,10 +281,11 @@ int initLanguages(struct tm today) TXT_HBF = "Homebrew Filter rev%d corriendo en IOS58"; TXT_Hollywood = "Hollywood v0x%x"; TXT_ConsoleID = "ID de consola: %d"; + TXT_ConsoleType = "Tipo Consola: %s"; TXT_vBoot2 = "Boot2 v%u"; TXT_NrOfTitles = "Encontrados %d titulos."; TXT_NrOfIOS = "Se encontraron %d IOS en esta consola. %d de ellos son stubs."; - TXT_AppTitle = "sysCheck %s por Double_A y R2-D2199, JoostinOnline, Nano"; + TXT_AppTitle = "SysCheck %s por Double_A y R2-D2199, JoostinOnline, Nano"; TXT_AppIOS = "...corre en IOS%d (rev %d)."; ERR_AllocateMemory = "Imposible asignar memoria para %d titulos."; ERR_OpenFile = "Imposible abrir el archivo!"; @@ -297,6 +303,7 @@ int initLanguages(struct tm today) TXT_NAND = " Acceso NAND,"; TXT_Boot2 = " Acceso Boot2,"; TXT_USB = " USB 2.0,"; + TXT_VersionP = " ES_Version,"; TXT_NoPatch = " Sin Parches,"; sprintf(TXT_ReportDate, "Reporte generado el %2.2d/%2.2d/%4.4d.", today.tm_mday, today.tm_mon + 1, today.tm_year + 1900); BUT_HBC = "Canal Homebrew"; @@ -348,10 +355,11 @@ int initLanguages(struct tm today) TXT_HBF = "Homebrew Filter rev%d running on IOS58"; TXT_Hollywood = "Hollywood v0x%x"; TXT_ConsoleID = "Console ID: %d"; + TXT_ConsoleType = "Console Type: %s"; TXT_vBoot2 = "Boot2 v%u"; TXT_NrOfTitles = "Found %d titles."; TXT_NrOfIOS = "Found %d IOS on this console. %d of them are stub."; - TXT_AppTitle = "sysCheck %s by Double_A and R2-D2199, JoostinOnline, Nano"; + TXT_AppTitle = "SysCheck %s by Double_A and R2-D2199, JoostinOnline, Nano"; TXT_AppIOS = "...runs on IOS%d (rev %d)."; ERR_AllocateMemory = "Unable to allocate the memory for %d titles."; ERR_OpenFile = "Unable to open the file!"; @@ -369,6 +377,7 @@ int initLanguages(struct tm today) TXT_NAND = " NAND Access,"; TXT_Boot2 = " Boot2 Access,"; TXT_USB = " USB 2.0,"; + TXT_VersionP = " ES_Version,"; TXT_NoPatch = " No Patches,"; sprintf(TXT_ReportDate, "Report generated on %2.2d/%2.2d/%4.4d.", today.tm_mon + 1, today.tm_mday, today.tm_year + 1900); BUT_HBC = "Homebrew Channel"; diff --git a/source/sysCheck.c b/source/sysCheck.c index 8ea4d6d..62211b6 100644 --- a/source/sysCheck.c +++ b/source/sysCheck.c @@ -28,7 +28,7 @@ #include "SysMenuInfo.h" #include "tmdIdentification.h" #include "gecko.h" -#include "update.h" +#include "update.h" // Filename #define REPORT "sd:/sysCheck.csv" @@ -228,6 +228,7 @@ int main(int argc, char **argv) } } SYSSETTINGS SystemInfo; + SystemInfo.deviceType = IS_WII_U; if (AHB_ACCESS && !forceNoAHBPROT) IosPatch_RUNTIME(true, false, false, false); SystemInfo.nandAccess = CheckNANDAccess(); @@ -261,11 +262,12 @@ int main(int argc, char **argv) printLoading(MSG_GetHBCVer); usleep(200000); - u32 hbcversion = 0; - u32 hbfversion = 0; - s32 hbc = 0; - s32 hbf = 0; - u32 hbcIOS = 0; + homebrew_t homebrew; + homebrew.hbcversion = 0; + homebrew.hbfversion = 0; + homebrew.hbc = HBC_NONE; + homebrew.hbf = HBF_NONE; + homebrew.hbcIOS = 0; SystemInfo.dvdSupport = 0; s32 ret = Title_GetVersionNObuf(0x000100014C554C5All); if (ret<0) { @@ -273,50 +275,50 @@ int main(int argc, char **argv) if (ret<0) { ret = Title_GetVersionNObuf(0x000100014A4F4449ll); if (ret<0) { - hbc = 1; + homebrew.hbc = HBC_HAXX; ret = Title_GetVersionNObuf(0x0001000148415858ll); if (ret<0) { - hbc = 0; + homebrew.hbc = HBC_NONE; } else { - hbc = 1; - hbcversion = ret; + homebrew.hbc = HBC_HAXX; + homebrew.hbcversion = ret; } } else { - hbc = 2; - hbcversion = ret; + homebrew.hbc = HBC_JODI; + homebrew.hbcversion = ret; } } else { - hbc = 3; - hbcversion = ret; - if (hbcversion == 0) - hbcversion = VERSION_1_1_0; + homebrew.hbc = HBC_1_0_7; + homebrew.hbcversion = ret; + if (homebrew.hbcversion == 0) + homebrew.hbcversion = VERSION_1_1_0; } } else { - hbc = 4; - hbcversion = (ret != 257) +1; + homebrew.hbc = HBC_LULZ; + homebrew.hbcversion = (ret != 257) + 1; } - if (hbc == 4) { - hbcIOS = get_title_ios(TITLE_ID(0x10001, 0x4C554C5A)); - } else if (hbc == 3) { - hbcIOS = get_title_ios(TITLE_ID(0x10001, 0xAF1BF516)); - } else if (hbc == 2) { - hbcIOS = get_title_ios(TITLE_ID(0x10001, 0x4A4F4449)); - } else if (hbc == 1) { - hbcIOS = get_title_ios(TITLE_ID(0x10001, 0x48415858)); + if (homebrew.hbc == HBC_LULZ) { + homebrew.hbcIOS = get_title_ios(TITLE_ID(0x10001, 0x4C554C5A)); // LULZ + } else if (homebrew.hbc == HBC_1_0_7) { + homebrew.hbcIOS = get_title_ios(TITLE_ID(0x10001, 0xAF1BF516)); // ???? + } else if (homebrew.hbc == HBC_JODI) { + homebrew.hbcIOS = get_title_ios(TITLE_ID(0x10001, 0x4A4F4449)); // JODI + } else if (homebrew.hbc == HBC_HAXX) { + homebrew.hbcIOS = get_title_ios(TITLE_ID(0x10001, 0x48415858)); // HAXX } ret = Title_GetVersionNObuf(0x0001000148424630LL); //HBF0 if (ret<0) { ret = Title_GetVersionNObuf(0x0001000154484246LL); //THBF if (ret<0) { - hbf = 0; + homebrew.hbf = HBF_NONE; } else { - hbf = 1; - hbfversion = ret; + homebrew.hbf = HBF_HBF0; + homebrew.hbfversion = ret; } } else { - hbf = 2; - hbfversion = ret; + homebrew.hbf = HBF_THBF; + homebrew.hbfversion = ret; } if (AHB_ACCESS && !forceNoAHBPROT) { @@ -755,36 +757,33 @@ int main(int argc, char **argv) // Test fake signature gprintf("// Test fake signature\n"); logfile("// Test fake signature\r\n"); - ios[i].infoFakeSignature = (CheckFakeSignature()); + ios[i].infoFakeSignature = CheckFakeSignature(); // Test ES Identify gprintf("// Test ES Identify\n"); logfile("// Test ES Identify\r\n"); - ios[i].infoESIdentify = (CheckESIdentify()); + ios[i].infoESIdentify = CheckESIdentify(); // Test Flash Access gprintf("// Test Flash Access\n"); logfile("// Test Flash Access\r\n"); - ios[i].infoFlashAccess = (CheckFlashAccess()); + ios[i].infoFlashAccess = CheckFlashAccess(); // Test NAND Access gprintf("// Test NAND Access\n"); logfile("// Test NAND Access\r\n"); - ios[i].infoNANDAccess = (CheckNANDAccess()); + ios[i].infoNANDAccess = CheckNANDAccess(); // Test Boot2 Access gprintf("// Test Boot2 Access\n"); logfile("// Test Boot2 Access\r\n"); - ios[i].infoBoot2Access = (CheckBoot2Access()); + ios[i].infoBoot2Access = CheckBoot2Access(); // Test USB 2.0 gprintf("// Test USB 2.0\n"); logfile("// Test USB 2.0\r\n"); - ios[i].infoUSB2 = (CheckUSB2(ios[i].titleID)); + ios[i].infoUSB2 = CheckUSB2(ios[i].titleID); - if (ios[i].infoFakeSignature) { - //ios[i].infoVersionPatch = (CheckVersionPatch()); - } // Check Priiloader if (!SystemInfo.nandAccess && SystemInfo.priiloader == -2 && ios[i].infoNANDAccess) { @@ -835,12 +834,12 @@ int main(int argc, char **argv) // Display Title sprintf(ReportBuffer[APP_TITLE], TXT_AppTitle, TXT_AppVersion); sprintf(ReportBuffer[APP_IOS], TXT_AppIOS, runningIOS, IOS_GetRevision()); - bool validregion = SystemInfo.systemRegion >= CONF_REGION_JP && SystemInfo.systemRegion <= CONF_REGION_CN; + SystemInfo.validregion = SystemInfo.systemRegion >= CONF_REGION_JP && SystemInfo.systemRegion <= CONF_REGION_CN; // Display the console region if (SystemInfo.sysNinVersion != 0.0f) { - sprintf(ReportBuffer[TEXT_REGION], "%s: %s", TXT_Region, validregion ? Regions[SystemInfo.systemRegion] : ""); - if (validregion) + sprintf(ReportBuffer[TEXT_REGION], "%s: %s", TXT_Region, SystemInfo.validregion ? Regions[SystemInfo.systemRegion] : ""); + if (SystemInfo.validregion) sprintf(ReportBuffer[SYSMENU], TXT_SysMenu, SystemInfo.sysNinVersion, SystemInfo.sysMenuRegion, SystemInfo.sysMenuVer); else strcat(ReportBuffer[SYSMENU], TXT_Unknown); @@ -849,8 +848,8 @@ int main(int argc, char **argv) u32 realSysVersion = systemmenu.realRevision; SystemInfo.sysNinVersion = GetSysMenuNintendoVersion(realSysVersion); SystemInfo.sysMenuRegion = GetSysMenuRegion(SystemInfo.sysMenuVer); - sprintf(ReportBuffer[TEXT_REGION], "%s: %s", TXT_Region, validregion ? Regions[SystemInfo.systemRegion] : ""); - if (validregion) + sprintf(ReportBuffer[TEXT_REGION], "%s: %s", TXT_Region, SystemInfo.validregion ? Regions[SystemInfo.systemRegion] : ""); + if (SystemInfo.validregion) sprintf(ReportBuffer[SYSMENU], TXT_SysMenu3, SystemInfo.sysNinVersion, SystemInfo.sysMenuRegion, SystemInfo.sysMenuVer, realSysVersion, systemmenu.info); else strcat(ReportBuffer[SYSMENU], TXT_Unknown); @@ -880,8 +879,6 @@ int main(int argc, char **argv) } else { SystemInfo.sysMenuIOS = get_title_ios(TITLE_ID(0x00000001, 0x00000002)); - char Region[100]; - switch (SystemInfo.systemRegion) { case CONF_REGION_US: @@ -904,39 +901,38 @@ int main(int argc, char **argv) sprintf(ReportBuffer[TEXT_REGION], "%s: ", TXT_Region); strcat(ReportBuffer[TEXT_REGION], TXT_Unknown); } - sprintf(Region, "%c", SystemInfo.sysMenuRegion); switch (SystemInfo.sysMenuIOS) { case 9: - sprintf(ReportBuffer[SYSMENU], TXT_SysMenu2, "1.0", Region, SystemInfo.sysMenuVer); + sprintf(ReportBuffer[SYSMENU], TXT_SysMenu2, "1.0", SystemInfo.sysMenuRegion, SystemInfo.sysMenuVer); break; case 11: - sprintf(ReportBuffer[SYSMENU], TXT_SysMenu2, "2.0/2.1", Region, SystemInfo.sysMenuVer); + sprintf(ReportBuffer[SYSMENU], TXT_SysMenu2, "2.0/2.1", SystemInfo.sysMenuRegion, SystemInfo.sysMenuVer); break; case 20: - sprintf(ReportBuffer[SYSMENU], TXT_SysMenu2, "2.2", Region); + sprintf(ReportBuffer[SYSMENU], TXT_SysMenu2, "2.2", SystemInfo.sysMenuRegion); break; case 30: - sprintf(ReportBuffer[SYSMENU], TXT_SysMenu2, "3.0/3.1/3.2/3.3", Region, SystemInfo.sysMenuVer); + sprintf(ReportBuffer[SYSMENU], TXT_SysMenu2, "3.0/3.1/3.2/3.3", SystemInfo.sysMenuRegion, SystemInfo.sysMenuVer); break; case 40: - sprintf(ReportBuffer[SYSMENU], TXT_SysMenu2, "3.3", Region, SystemInfo.sysMenuVer); + sprintf(ReportBuffer[SYSMENU], TXT_SysMenu2, "3.3", SystemInfo.sysMenuRegion, SystemInfo.sysMenuVer); break; case 50: - sprintf(ReportBuffer[SYSMENU], TXT_SysMenu2, "3.4", Region, SystemInfo.sysMenuVer); + sprintf(ReportBuffer[SYSMENU], TXT_SysMenu2, "3.4", SystemInfo.sysMenuRegion, SystemInfo.sysMenuVer); break; case 60: - sprintf(ReportBuffer[SYSMENU], TXT_SysMenu2, "4.0/4.1", Region, SystemInfo.sysMenuVer); + sprintf(ReportBuffer[SYSMENU], TXT_SysMenu2, "4.0/4.1", SystemInfo.sysMenuRegion, SystemInfo.sysMenuVer); break; case 70: - sprintf(ReportBuffer[SYSMENU], TXT_SysMenu2, "4.2", Region, SystemInfo.sysMenuVer); + sprintf(ReportBuffer[SYSMENU], TXT_SysMenu2, "4.2", SystemInfo.sysMenuRegion, SystemInfo.sysMenuVer); break; case 80: - sprintf(ReportBuffer[SYSMENU], TXT_SysMenu2, "4.3", Region, SystemInfo.sysMenuVer); + sprintf(ReportBuffer[SYSMENU], TXT_SysMenu2, "4.3", SystemInfo.sysMenuRegion, SystemInfo.sysMenuVer); break; default: - sprintf(ReportBuffer[SYSMENU], TXT_SysMenu2, "0.0", Region, SystemInfo.sysMenuVer); + sprintf(ReportBuffer[SYSMENU], TXT_SysMenu2, "0.0", SystemInfo.sysMenuRegion, SystemInfo.sysMenuVer); break; } } @@ -1004,24 +1000,25 @@ int main(int argc, char **argv) else if (SystemInfo.priiloader == 2) sprintf(ReportBuffer[PRIILOADER], TXT_PreFiix); - if (hbc == 0 || hbcversion == 0) + if (homebrew.hbc == HBC_NONE || homebrew.hbcversion == 0) sprintf(ReportBuffer[HBC], "Homebrew Channel is not installed"); - else if (hbcIOS == 0) + else if (homebrew.hbcIOS == 0) sprintf(ReportBuffer[HBC], TXT_HBC_STUB); - else if (hbc == 4) - sprintf(ReportBuffer[HBC], TXT_HBC_112, hbcversion, hbcIOS); - else if (hbcversion == VERSION_1_1_0) - sprintf(ReportBuffer[HBC], TXT_HBC_NEW, hbcIOS); - else if (hbcversion > 0) - sprintf(ReportBuffer[HBC], TXT_HBC, hbcversion, hbcIOS); + 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); - if (hbf > 0) - sprintf(ReportBuffer[HBF], TXT_HBF, hbfversion); + if (homebrew.hbf > HBF_NONE) + sprintf(ReportBuffer[HBF], TXT_HBF, homebrew.hbfversion); sprintf(ReportBuffer[HOLLYWOOD], TXT_Hollywood, *HOLLYWOOD_VERSION); sprintf(ReportBuffer[CONSOLE_ID], TXT_ConsoleID, SystemInfo.deviceID); - sprintf(ReportBuffer[BOOT2_VERSION], TXT_vBoot2, SystemInfo.boot2version); + sprintf(ReportBuffer[CONSOLE_TYPE], TXT_ConsoleType, SystemInfo.deviceType ? "vWii" : "Wii"); sprintf(ReportBuffer[COUNTRY], "Shop Channel Country: %s (%u)", (strlen(SystemInfo.country)) ? SystemInfo.country : TXT_Unknown, SystemInfo.shopcode); + sprintf(ReportBuffer[BOOT2_VERSION], TXT_vBoot2, SystemInfo.boot2version); sprintf(ReportBuffer[NR_OF_TITLES], TXT_NrOfTitles, SystemInfo.countTitles); sprintf(ReportBuffer[NR_OF_IOS], TXT_NrOfIOS, (SystemInfo.countIOS - SystemInfo.countBCMIOS), SystemInfo.countStubs); @@ -1107,6 +1104,7 @@ int main(int argc, char **argv) sleep(2); printEndError(MSG_ReportError); } else { + //chdir("/"); // Create the report FILE *file = fopen(REPORT, "w"); @@ -1139,6 +1137,7 @@ int main(int argc, char **argv) for (i = 0; i <= lines; i++) { fprintf(file, HashLogBuffer[i]); fprintf(file, "\r\n"); + fflush(file); } // Close the report fclose(file); @@ -1160,7 +1159,7 @@ int main(int argc, char **argv) // Unmount the SD Card UnmountSD(); deinitGUI(); - if(*LOADER_STUB) exit(0);; + if(*LOADER_STUB) exit(0); SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0); }