-Added support for the new vWii System Menu's
-I've got the beginnings of animation going.  I still need to work on making it smooth
-Fixed the ridiculous bug (possibly intentional?) where the System Menu region is defined by setting.txt, not by what's installed.
-Some minor optimizations

TODO:
-Make those cogs turn smoothly, and possibly touch up the gfx.
-Do some SERIOUS code cleanup.  Just go through that source with some bleach and scrub
This commit is contained in:
Joostinonline 2013-10-18 01:25:17 +00:00
parent b5c4dcb48a
commit bd0c05ee6b
17 changed files with 6152 additions and 247 deletions

View File

@ -1,10 +1,34 @@
#ifndef __GUI_H__
#define __GUI_H__
#include <grrlib.h>
#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))
extern GRRLIB_ttfFont *myFont;
extern GRRLIB_texImg *tex_background_png;
extern GRRLIB_texImg *tex_Checkicon_png;
extern GRRLIB_texImg *tex_Deleteicon_png;
extern GRRLIB_texImg *tex_Refreshicon_png;
extern GRRLIB_texImg *tex_WiiButtonA_png;
extern GRRLIB_texImg *tex_WiiButtonHome_png;
extern GRRLIB_texImg *tex_WiiButtonMinus_png;
extern GRRLIB_texImg *tex_WiiButtonPlus_png;
extern GRRLIB_texImg *tex_WiiDpadLeft_png;
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);
void deinitGUI(void);
int printError(const char* msg);
int printSuccess(const char* msg);
int printLoading(const char* msg);
@ -15,5 +39,6 @@ int printEndError(const char* msg);
int printReport(char report[200][100], int firstLine, bool completeReport);
int printUploadSuccess(const char* msg);
int printUploadError(const char* msg);
void DrawCog(void);
#endif

View File

@ -75,12 +75,17 @@ typedef struct _U8Entry
};
} __attribute__( ( packed ) ) U8Entry;
extern const char *Regions[];
extern u8 sysMenuInfoContent;
extern bool debug;
#ifdef __cplusplus
extern "C"
{
#endif
// Prototypes
char GetSysMenuRegion(u32 sysVersion);
bool GetCertificates(void);
u32 GetSysMenuVersion(void);
float GetSysMenuNintendoVersion(u32 sysVersion);

View File

@ -1,25 +1,6 @@
#ifndef _VIDEO_H_
#define _VIDEO_H_
// Attributes
#define RESET 0
#define BRIGHT 1
#define DIM 2
#define UNDERLINE 3
#define BLINK 4
#define REVERSE 7
#define HIDDEN 8
// Available colors
#define BLACK 0
#define RED 1
#define GREEN 2
#define YELLOW 3
#define BLUE 4
#define MAGENTA 5
#define CYAN 6
#define WHITE 7
// Wii Light state
#define WIILIGHT_OFF 0
#define WIILIGHT_ON 1

1167
source/gfx/Cog1.h Normal file

File diff suppressed because it is too large Load Diff

BIN
source/gfx/Cog1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

1165
source/gfx/Cog2.h Normal file

File diff suppressed because it is too large Load Diff

BIN
source/gfx/Cog2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

1167
source/gfx/Cog3.h Normal file

File diff suppressed because it is too large Load Diff

BIN
source/gfx/Cog3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

1163
source/gfx/Cog4.h Normal file

File diff suppressed because it is too large Load Diff

BIN
source/gfx/Cog4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

1136
source/gfx/Cog5.h Normal file

File diff suppressed because it is too large Load Diff

BIN
source/gfx/Cog5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

@ -1,6 +1,6 @@
#include <grrlib.h>
#include <stdlib.h>
#include <wiiuse/wpad.h>
#include <ogc/lwp_watchdog.h>
#include "tahoma_ttf.h"
@ -17,6 +17,11 @@
#include "loadingbargrey.h"
#include "loadingbarblue.h"
#include "window.h"
#include "Cog1.h"
#include "Cog2.h"
#include "Cog3.h"
#include "Cog4.h"
#include "Cog5.h"
#include "languages.h"
#include "gui.h"
#include "gecko.h"
@ -37,6 +42,8 @@ GRRLIB_texImg *tex_WiiDpadRight_png;
GRRLIB_texImg *tex_loadingbargrey_png;
GRRLIB_texImg *tex_loadingbarblue_png;
GRRLIB_texImg *tex_window_png;
GRRLIB_texImg *tex_Cogs_png[5];
GRRLIB_texImg *tex_ScreenBuf;
typedef struct map_entry
{
@ -48,6 +55,8 @@ static const u8 WIIFONT_HASH[] = {0x32, 0xb3, 0x39, 0xcb, 0xbb, 0x50, 0x7d, 0x5
static const u8 WIIFONT_HASH_KOR[] = {0xb7, 0x15, 0x6d, 0xf0, 0xf4, 0xae, 0x07, 0x8f, 0xd1, 0x53, 0x58, 0x3e, 0x93, 0x6e, 0x07, 0xc0, 0x98, 0x77, 0x49, 0x0e};
u8 *systemFont;
s32 systemFontSize = 0;
static u8 Cog_Num = 0;
static u64 Last_Cog_Turn = 0;
bool loadSystemFont(bool korean)
{
@ -146,17 +155,56 @@ int initGUI(void) {
tex_loadingbargrey_png = GRRLIB_LoadTexturePNG(loadingbargrey);
tex_loadingbarblue_png = GRRLIB_LoadTexturePNG(loadingbarblue);
tex_window_png = GRRLIB_LoadTexturePNG(window);
tex_Cogs_png[0] = GRRLIB_LoadTexturePNG(Cog1);
tex_Cogs_png[1] = GRRLIB_LoadTexturePNG(Cog2);
tex_Cogs_png[2] = GRRLIB_LoadTexturePNG(Cog3);
tex_Cogs_png[3] = GRRLIB_LoadTexturePNG(Cog4);
tex_Cogs_png[4] = GRRLIB_LoadTexturePNG(Cog5);
tex_ScreenBuf = GRRLIB_CreateEmptyTexture(rmode->fbWidth, rmode->efbHeight);
return 0;
}
void deinitGUI(void) {
GRRLIB_FreeTTF(myFont);
GRRLIB_FreeTexture(tex_background_png);
GRRLIB_FreeTexture(tex_Checkicon_png);
GRRLIB_FreeTexture(tex_Deleteicon_png);
GRRLIB_FreeTexture(tex_Refreshicon_png);
GRRLIB_FreeTexture(tex_WiiButtonA_png);
GRRLIB_FreeTexture(tex_WiiButtonHome_png);
GRRLIB_FreeTexture(tex_WiiButtonMinus_png);
GRRLIB_FreeTexture(tex_WiiButtonPlus_png);
GRRLIB_FreeTexture(tex_WiiDpadLeft_png);
GRRLIB_FreeTexture(tex_WiiDpadRight_png);
GRRLIB_FreeTexture(tex_loadingbargrey_png);
GRRLIB_FreeTexture(tex_loadingbarblue_png);
GRRLIB_FreeTexture(tex_window_png);
GRRLIB_FreeTexture(tex_Cogs_png[0]);
GRRLIB_FreeTexture(tex_Cogs_png[1]);
GRRLIB_FreeTexture(tex_Cogs_png[2]);
GRRLIB_FreeTexture(tex_Cogs_png[3]);
GRRLIB_FreeTexture(tex_Cogs_png[4]);
GRRLIB_FreeTexture(tex_ScreenBuf);
GRRLIB_Exit();
return;
}
void DrawDuringSort(void) {
DrawBuf();
DrawCog();
GRRLIB_Render();
return;
}
int printError(const char* msg) {
int i;
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_Deleteicon_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
DrawBuf();
GRRLIB_Render();
}
@ -165,23 +213,28 @@ int printError(const char* msg) {
int printSuccess(const char* msg) {
int i;
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_Checkicon_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
DrawBuf();
GRRLIB_Render();
}
return 0;
}
int printLoading(const char* msg) {
int i;
for (i = 0; i < 3; i++) { //Workaround for GRRLIB_Render() bug
//int i;
u64 current_ticks = gettick();
//GRRLIB_DrawImg(256, 112, tex_Refreshicon_png, 0, 1, 1, HEX_WHITE);
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
while(!CheckTime(current_ticks, 250)) {
DrawBuf();
DrawCog();
GRRLIB_Render();
}
return 0;
@ -189,7 +242,6 @@ int printLoading(const char* msg) {
int printSelectIOS(const char* msg, const char* ios) {
int i;
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);
@ -200,7 +252,9 @@ int printSelectIOS(const char* msg, const char* ios) {
GRRLIB_DrawImg(310, 388, tex_WiiButtonPlus_png, 0, 1, 1, HEX_WHITE);
GRRLIB_PrintfTTF(335-(strlen(BUT_Update)*7.8)/2, 425, myFont, BUT_Update, 14, HEX_WHITE);
CopyBuf();
for (i = 0; i < 3; i++) { //Workaround for GRRLIB_Render() bug
DrawBuf();
GRRLIB_Render();
}
return 0;
@ -208,21 +262,24 @@ int printSelectIOS(const char* msg, const char* ios) {
int printLoadingBar(const char* msg, const f32 percent) {
int loaded, notloaded;
u64 current_ticks = gettick();
loaded = 536.0/100.0*percent;
if (loaded > 536) loaded = 536;
notloaded = 536 - loaded;
int i;
for (i = 0; i < 3; i++) { //Workaround for GRRLIB_Render() bug
//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_DrawImg(256, 112, tex_Refreshicon_png, 0, 1, 1, HEX_WHITE);
GRRLIB_PrintfTTF((640-strlen(msg)*9)/2, 256, myFont, msg, 20, HEX_WHITE);
GRRLIB_DrawPart(52, 340, 0, 0, loaded, 36, tex_loadingbarblue_png, 0, 1, 1, HEX_WHITE);
GRRLIB_DrawPart(52+loaded, 340, loaded, 0, notloaded, 36, tex_loadingbargrey_png, 0, 1, 1, HEX_WHITE);
CopyBuf();
//for (i = 0; i < 3; i++) { //Workaround for GRRLIB_Render() bug
while(!CheckTime(current_ticks, 250)) {
DrawBuf();
DrawCog();
GRRLIB_Render();
}
return 0;
@ -230,7 +287,6 @@ int printLoadingBar(const char* msg, const f32 percent) {
int printEndSuccess(const char* msg) {
int i;
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_Checkicon_png, 0, 1, 1, HEX_WHITE);
@ -247,16 +303,28 @@ int printEndSuccess(const char* msg) {
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
DrawBuf();
GRRLIB_Render();
}
return 0;
}
inline void DrawCog(void) {
if (CheckTime(Last_Cog_Turn, 25)) {
Cog_Num++;
if (Cog_Num > 4) Cog_Num = 0;
Last_Cog_Turn = gettick();
}
GRRLIB_DrawImg(220, 150, tex_Cogs_png[Cog_Num], 0, 1, 1, HEX_WHITE);
return;
}
int printEndError(const char* msg) {
int i;
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_Deleteicon_png, 0, 1, 1, HEX_WHITE);
@ -271,7 +339,9 @@ int printEndError(const char* msg) {
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
DrawBuf();
GRRLIB_Render();
}
@ -318,7 +388,6 @@ int printReport(char report[200][100], int firstLine, bool completeReport) {
int printUploadSuccess(const char* msg) {
int i;
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_Checkicon_png, 0, 1, 1, HEX_WHITE);
@ -328,16 +397,16 @@ int printUploadSuccess(const char* msg) {
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);
CopyBuf();
for (i = 0; i < 3; i++) { //Workaround for GRRLIB_Render() bug
DrawBuf();
GRRLIB_Render();
}
return 0;
}
int printUploadError(const char* msg) {
int i;
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_Deleteicon_png, 0, 1, 1, HEX_WHITE);
@ -345,10 +414,11 @@ int printUploadError(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);
CopyBuf();
for (i = 0; i < 3; i++) { //Workaround for GRRLIB_Render() bug
DrawBuf();
GRRLIB_Render();
}
return 0;
}

View File

@ -48,9 +48,9 @@ int initLanguages(struct tm today)
MSG_SortTitles = "Titel werden sortiert...";
MSG_GetCertificates = "Zertifikate werden aus dem NAND ausgelesen...";
ERR_GetCertificates = "Zertifikate aus dem NAND ausgelesen fehlgeschalgen.";
TXT_SysMenu = "Systemmenue %1.1f%s (v%d)";
TXT_SysMenu = "Systemmenue %1.1f%c (v%d)";
TXT_SysMenu2 = "Systemmenue %s%s (v%d)";
TXT_SysMenu3 = "Systemmenue %1.1f%s (v%d, Info: v%d %s)";
TXT_SysMenu3 = "Systemmenue %1.1f%c (v%d, Info: v%d %s)";
TXT_HBF = "HomebrewFilter rev%d benutzt IOS58";
TXT_HBC = "Homebrewkanal 1.0.%d benutzt IOS%d";
TXT_HBC_NEW = "Homebrewkanal 1.1.0 benutzt IOS%d";
@ -123,9 +123,9 @@ int initLanguages(struct tm today)
MSG_SortTitles = "Tri des titres...";
MSG_GetCertificates = "Obtention des certificats de la 'NAND'...";
ERR_GetCertificates = "Impossible d'obtenir les certificats de la 'NAND'";
TXT_SysMenu = "Menu Systeme %1.1f%s (v%d)";
TXT_SysMenu = "Menu Systeme %1.1f%c (v%d)";
TXT_SysMenu2 = "Menu Systeme %s%s (v%d)";
TXT_SysMenu3 = "Menu Systeme %1.1f%s (v%d, Info: v%d %s)";
TXT_SysMenu3 = "Menu Systeme %1.1f%c (v%d, Info: v%d %s)";
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";
@ -195,9 +195,9 @@ int initLanguages(struct tm today)
MSG_SortTitles = "Ordinamento giochi...";
MSG_GetCertificates = "Controllo certificati nella NAND...";
ERR_GetCertificates = "Errore nella verifica certificati nella NAND...";
TXT_SysMenu = "Menu di sistema %1.1f%s (v%d)";
TXT_SysMenu = "Menu di sistema %1.1f%c (v%d)";
TXT_SysMenu2 = "Menu di sistema %s%s (v%d)";
TXT_SysMenu3 = "Menu di sistema %1.1f%s (v%d, Info: v%d %s)";
TXT_SysMenu3 = "Menu di sistema %1.1f%c (v%d, Info: v%d %s)";
TXT_HBC = "Canale Homebrew 1.0.%d appoggiato all'IOS%d";
TXT_HBC_NEW = "Canale Homebrew 1.1.0 appoggiato all'IOS%d";
TXT_HBC_112 = "Canale Homebrew 1.1.%d appoggiato all'IOS%d";
@ -267,9 +267,9 @@ int initLanguages(struct tm today)
MSG_SortTitles = "Ordenando titulos...";
MSG_GetCertificates = "Obteniendo certificados de la NAND...";
ERR_GetCertificates = "No se pudieron obtener certificados de la NAND...";
TXT_SysMenu = "Menu de Sistema %1.1f%s (v%d)";
TXT_SysMenu = "Menu de Sistema %1.1f%c (v%d)";
TXT_SysMenu2 = "Menu de Sistema %s%s (v%d)";
TXT_SysMenu3 = "Menu de Sistema %1.1f%s (v%d, Info: v%d %s)";
TXT_SysMenu3 = "Menu de Sistema %1.1f%c (v%d, Info: v%d %s)";
TXT_HBC = "Canal Homebrew 1.0.%d corriendo en IOS%d";
TXT_HBC_NEW = "Canal Homebrew 1.1.0 corriendo en IOS%d";
TXT_HBC_112 = "Canal Homebrew 1.1.%d corriendo en %d";
@ -339,9 +339,9 @@ int initLanguages(struct tm today)
MSG_SortTitles = "Sorting titles...";
MSG_GetCertificates = "Getting the certificates from the NAND...";
ERR_GetCertificates = "Failed getting the certificates from the NAND...";
TXT_SysMenu = "System Menu %1.1f%s (v%d)";
TXT_SysMenu = "System Menu %1.1f%c (v%d)";
TXT_SysMenu2 = "System Menu %s%s (v%d)";
TXT_SysMenu3 = "System Menu %1.1f%s (v%d, Info: v%d %s)";
TXT_SysMenu3 = "System Menu %1.1f%c (v%d, Info: v%d %s)";
TXT_HBC = "Homebrew Channel 1.0.%d running on IOS%d";
TXT_HBC_NEW = "Homebrew Channel 1.1.0 running on IOS%d";
TXT_HBC_112 = "Homebrew Channel 1.1.%d running on IOS%d";

View File

@ -58,9 +58,11 @@
// Variables
bool NandInitialized = false;
extern bool debug;
bool debug = false;
char incommingIP[50];
u8 sysMenueInfoContent = 0;
u8 sysMenuInfoContent = 0;
const char *Regions[] = {"NTSC-J", "NTSC-U", "PAL", "", "KOR", "NTSC-J"}; //Last is actually China
void logfile(const char *format, ...)
@ -68,13 +70,13 @@ void logfile(const char *format, ...)
if (!debug) return;
MountSD();
char buffer[4096];
char temp[256];
//char temp[256];
va_list args;
va_start (args, format);
vsprintf (buffer,format, args);
FILE *f;
sprintf(temp, "SD:/sysCheckDebug.log");
f = fopen(temp, "a");
//sprintf(temp, "SD:/sysCheckDebug.log");
f = fopen("SD:/sysCheckDebug.log", "a");
fputs(buffer, f);
fclose(f);
va_end (args);
@ -381,8 +383,8 @@ float GetSysMenuNintendoVersion(u32 sysVersion)
ninVersion = 1.0f;
break;
case 128:
case 97:
case 128:
case 130:
ninVersion = 2.0f;
break;
@ -460,6 +462,9 @@ float GetSysMenuNintendoVersion(u32 sysVersion)
case 513:
case 514:
case 518:
case 544:
//case 545:
case 546:
ninVersion = 4.3f;
break;
}
@ -467,6 +472,72 @@ float GetSysMenuNintendoVersion(u32 sysVersion)
return ninVersion;
}
char GetSysMenuRegion(u32 sysVersion) {
char SysMenuRegion;
switch(sysVersion)
{
case 1: //Pre-launch
case 97: //2.0U
case 193: //2.2U
case 225: //3.0U
case 257: //3.1U
case 289: //3.2U
case 353: //3.3U
case 385: //3.4U
case 417: //4.0U
case 449: //4.1U
case 54449: // mauifrog 4.1U
case 481: //4.2U
case 513: //4.3U
case 545:
SysMenuRegion = 'U';
break;
case 130: //2.0E
case 162: //2.1E
case 194: //2.2E
case 226: //3.0E
case 258: //3.1E
case 290: //3.2E
case 354: //3.3E
case 386: //3.4E
case 418: //4.0E
case 450: //4.1E
case 54450: // mauifrog 4.1E
case 482: //4.2E
case 514: //4.3E
case 546:
SysMenuRegion = 'E';
break;
case 128: //2.0J
case 192: //2.2J
case 224: //3.0J
case 256: //3.1J
case 288: //3.2J
case 352: //3.3J
case 384: //3.4J
case 416: //4.0J
case 448: //4.1J
case 54448: // mauifrog 4.1J
case 480: //4.2J
case 512: //4.3J
case 544:
SysMenuRegion = 'J';
break;
case 326: //3.3K
case 390: //3.5K
case 454: //4.1K
case 54454: // mauifrog 4.1K
case 486: //4.2K
case 518: //4.3K
SysMenuRegion = 'K';
break;
default:
SysMenuRegion = 'X';
break;
}
return SysMenuRegion;
}
void zero_sig(signed_blob *sig)
{
u8 *sig_ptr = (u8 *)sig;

View File

@ -7,6 +7,8 @@
#include <unistd.h>
#include <wiilight.h>
#include <ogc/conf.h>
#include <ogc/es.h>
#include <ogc/ios.h>
#include <wiiuse/wpad.h>
#include <stdlib.h>
#include <stdarg.h>
@ -35,11 +37,19 @@
#define SECTOR_SIZE (0x4000)
extern bool geckoinit;
extern u8 sysMenueInfoContent;
bool debug;
char miosInfo[128] = {0};
extern void __exception_setreload(int t);
// Stripped down version of IOS_ReloadIOS, run inline
inline void ReloadIOS(int version) {
__IOS_ShutdownSubsystems();
__ES_Init();
__IOS_LaunchNewIOS(version);
__IOS_InitializeSubsystems();
}
int get_title_ios(u64 title) {
s32 ret, fd;
static char filepath[256] ATTRIBUTE_ALIGN(32);
@ -152,20 +162,17 @@ bool getInfoFromContent(IOS *ios) {
gprintf("is %s\n", ios->info);
logfile("is %s\r\n", ios->info);
retValue = true;
if (buffer != 0)
{
free(buffer);
}
if (buffer) free(buffer);
}
return retValue;
}
void formatDate(u32 date, char ReportBuffer[200][100]) {
char temp[9] = {0};
char day[3] = {0};
char month[3] = {0};
char year[5] = {0};
char temp[8] = {0};
char day[2] = {0};
char month[2] = {0};
char year[4] = {0};
sprintf(temp, "%08x", date);
sprintf(year, "%c%c%c%c", temp[0], temp[1], temp[2], temp[3]);
@ -204,6 +211,9 @@ void sort(u64 *titles, u32 cnt) {
for (i = 0; i < cnt -1; ++i) {
for (j = 0; j < cnt - i - 1; ++j) {
if (titles[j] > titles[j + 1]) {
//DrawBuf();
//DrawCog();
//GRRLIB_Render();
u64 tmp = titles[j];
titles[j] = titles[j + 1];
titles[j + 1] = tmp;
@ -245,7 +255,7 @@ int main(int argc, char **argv)
// Get the console region
printLoading(MSG_GetConsoleRegion);
usleep(250000);
//usleep(250000);
int regionSelection = CONF_GetRegion();
u8 shopcode = 0;
@ -254,20 +264,19 @@ int main(int argc, char **argv)
// Get the system menu version
printLoading(MSG_GetSysMenuVer);
usleep(250000);
//usleep(250000);
u32 sysVersion = GetSysMenuVersion();
sysMenu systemmenu;
printLoading(MSG_GetHBCVer);
usleep(250000);
//usleep(250000);
u32 hbcversion = 0;
u32 hbfversion = 0;
s32 hbc = 0;
s32 hbf = 0;
u32 hbcIOS = 0;
u32 dvdSupport = 0;
s32 ret;
ret = Title_GetVersionNObuf(0x000100014C554C5All);
s32 ret = Title_GetVersionNObuf(0x000100014C554C5All);
if (ret<0) {
ret = Title_GetVersionNObuf(0x00010001AF1BF516ll);
if (ret<0) {
@ -293,11 +302,7 @@ int main(int argc, char **argv)
}
} else {
hbc = 4;
hbcversion = ret;
if (hbcversion == 257)
hbcversion = 1;
else
hbcversion = 2;
hbcversion = (ret != 257) +1;
}
if (hbc == 4) {
hbcIOS = get_title_ios(TITLE_ID(0x10001, 0x4C554C5A));
@ -334,26 +339,27 @@ int main(int argc, char **argv)
}
float sysNinVersion = GetSysMenuNintendoVersion(sysVersion);
char SysMenuRegion = GetSysMenuRegion(sysVersion);
// Get the running IOS version and revision
u32 runningIOS = IOS_GetVersion();
u32 runningIOSRevision = IOS_GetRevision();
printLoading(MSG_GetRunningIOS);
usleep(250000);
//usleep(250000);
// Get the console ID
printLoading(MSG_GetConsoleID);
usleep(250000);
//usleep(250000);
u32 deviceID = GetDeviceID();
// Get the boot2 version
printLoading(MSG_GetBoot2);
usleep(250000);
//usleep(250000);
u32 boot2version = GetBoot2Version();
// Get number of titles
printLoading(MSG_GetNrOfTitles);
usleep(250000);
//usleep(250000);
u32 tempTitles;
if (ES_GetNumTitles(&tempTitles) < 0) {
@ -375,7 +381,7 @@ int main(int argc, char **argv)
// Get list of titles
printLoading(MSG_GetTitleList);
usleep(250000);
//usleep(250000);
if (ES_GetTitles(titles, nbTitles) < 0) {
printError(ERR_GetTitleList);
sleep(5);
@ -410,19 +416,8 @@ int main(int argc, char **argv)
}
}
if (titleID > 258 && titleID < 512) {
titles[i] = 0;
continue;
}
// Skip the running IOS
if (titleID == 0) {
titles[i] = 0;
continue;
}
// Skip the System Menu
if (titleID == 2) {
// Skip the running IOS, the System Menu, and out of range IOS
if ((titleID > 258 && titleID < 512) || (titleID == 0) || (titleID == 2)) {
titles[i] = 0;
continue;
}
@ -431,7 +426,7 @@ int main(int argc, char **argv)
// Sort IOS titles
printLoading(MSG_SortTitles);
usleep(250000);
//usleep(250000);
u64 *newTitles = memalign(32, countIOS*sizeof(u64));
u32 cnt = 0;
@ -601,9 +596,9 @@ int main(int argc, char **argv)
iosinfo_t *sysInfo;
// Try to identify the cIOS by the info put in by the installer/ModMii
sysMenueInfoContent = *(u8 *)((u32)iosTMDBuffer+0x1E7);
sprintf(filepath, "/title/%08x/%08x/content/%08x.app", 0x00000001, 2, sysMenueInfoContent);
gprintf("/title/%08x/%08x/content/%08x.app\n", 0x00000001, 2, sysMenueInfoContent);
sysMenuInfoContent = *(u8 *)((u32)iosTMDBuffer+0x1E7);
sprintf(filepath, "/title/%08x/%08x/content/%08x.app", 0x00000001, 2, sysMenuInfoContent);
gprintf("/title/%08x/%08x/content/%08x.app\n", 0x00000001, 2, sysMenuInfoContent);
ret = read_file_from_nand(filepath, &buffer, &filesize);
sysInfo = (iosinfo_t *)(buffer);
@ -631,7 +626,7 @@ int main(int argc, char **argv)
// Get the certificates from the NAND
printLoading(MSG_GetCertificates);
usleep(250000);
//usleep(250000);
if (!GetCertificates()) {
printError(ERR_GetCertificates);
sleep(5);
@ -716,6 +711,7 @@ int main(int argc, char **argv)
} else if (ret >= 0) {
printSuccess(MSG_UpdateSuccess);
sleep(10);
deinitGUI();
if (*(u32*)0x80001800) exit(0);
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
} else if (ret < 0) {
@ -761,7 +757,8 @@ 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);
IOS_ReloadIOS(ios[i].titleID);
//IOS_ReloadIOS(ios[i].titleID);
ReloadIOS(ios[i].titleID);
// Test fake signature
gprintf("// Test fake signature\n");
@ -827,16 +824,16 @@ int main(int argc, char **argv)
// Reload the running IOS
IOS_ReloadIOS(runningIOS);
ReloadIOS(runningIOS);
sprintf(MSG_Buffer, MSG_ReloadIOS, runningIOS, runningIOSRevision);
printLoading(MSG_Buffer);
usleep(250000);
//usleep(250000);
//--Generate Report--
printLoading(MSG_GenerateReport);
usleep(250000);
//usleep(250000);
char ReportBuffer[200][100] = {{0}} ;
char ReportBuffer[200][100] = {{0}};
if (dvdSupport > 0)
formatDate(dvdSupport, ReportBuffer);
@ -846,64 +843,25 @@ 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 = regionSelection >= CONF_REGION_JP && regionSelection <= CONF_REGION_CN;
// Display the console region
if (!sysNinVersion == 0.0f) {
switch (regionSelection)
{
case CONF_REGION_US:
sprintf(ReportBuffer[TEXT_REGION], "%s: NTSC-U", TXT_Region);
sprintf(ReportBuffer[SYSMENU], TXT_SysMenu, sysNinVersion, "U", sysVersion);
break;
case CONF_REGION_EU:
sprintf(ReportBuffer[TEXT_REGION], "%s: PAL", TXT_Region);
sprintf(ReportBuffer[SYSMENU], TXT_SysMenu, sysNinVersion, "E", sysVersion);
break;
case CONF_REGION_JP:
sprintf(ReportBuffer[TEXT_REGION], "%s: NTSC-J", TXT_Region);
sprintf(ReportBuffer[SYSMENU], TXT_SysMenu, sysNinVersion, "J", sysVersion);
break;
case CONF_REGION_KR:
sprintf(ReportBuffer[TEXT_REGION], "%s: KOR", TXT_Region);
sprintf(ReportBuffer[SYSMENU], TXT_SysMenu, sysNinVersion, "K", sysVersion);
break;
default:
sprintf(ReportBuffer[TEXT_REGION], "%s: ", TXT_Region);
if (sysNinVersion != 0.0f) {
sprintf(ReportBuffer[TEXT_REGION], "%s: %s", TXT_Region, validregion ? Regions[regionSelection] : "");
if (validregion)
sprintf(ReportBuffer[SYSMENU], TXT_SysMenu, sysNinVersion, SysMenuRegion, sysVersion);
else
strcat(ReportBuffer[SYSMENU], TXT_Unknown);
}
} else if (systemmenu.hasInfo) {
u32 realSysVersion = systemmenu.realRevision;
sysNinVersion = GetSysMenuNintendoVersion(realSysVersion);
switch (regionSelection)
{
case CONF_REGION_US:
sprintf(ReportBuffer[TEXT_REGION], "%s: NTSC-U", TXT_Region);
sprintf(ReportBuffer[SYSMENU], TXT_SysMenu3, sysNinVersion, "U", sysVersion, realSysVersion, systemmenu.info);
break;
case CONF_REGION_EU:
sprintf(ReportBuffer[TEXT_REGION], "%s: PAL", TXT_Region);
sprintf(ReportBuffer[SYSMENU], TXT_SysMenu3, sysNinVersion, "E", sysVersion, realSysVersion, systemmenu.info);
break;
case CONF_REGION_JP:
sprintf(ReportBuffer[TEXT_REGION], "%s: NTSC-J", TXT_Region);
sprintf(ReportBuffer[SYSMENU], TXT_SysMenu3, sysNinVersion, "J", sysVersion, realSysVersion, systemmenu.info);
break;
case CONF_REGION_KR:
sprintf(ReportBuffer[TEXT_REGION], "%s: KOR", TXT_Region);
sprintf(ReportBuffer[SYSMENU], TXT_SysMenu3, sysNinVersion, "K", sysVersion, realSysVersion, systemmenu.info);
break;
default:
sprintf(ReportBuffer[TEXT_REGION], "%s: ", TXT_Region);
strcat(ReportBuffer[TEXT_REGION], TXT_Unknown);
}
SysMenuRegion = GetSysMenuRegion(sysVersion);
sprintf(ReportBuffer[TEXT_REGION], "%s: %s", TXT_Region, validregion ? Regions[regionSelection] : "");
if (validregion)
sprintf(ReportBuffer[SYSMENU], TXT_SysMenu3, sysNinVersion, SysMenuRegion, sysVersion, realSysVersion, systemmenu.info);
else
strcat(ReportBuffer[SYSMENU], TXT_Unknown);
} else {
signed_blob *TMD = NULL;
tmd *t = NULL;
@ -936,28 +894,25 @@ int main(int argc, char **argv)
{
case CONF_REGION_US:
sprintf(ReportBuffer[TEXT_REGION], "%s: NTSC-U", TXT_Region);
sprintf(Region, "U");
break;
case CONF_REGION_EU:
sprintf(ReportBuffer[TEXT_REGION], "%s: PAL", TXT_Region);
sprintf(Region, "E");
break;
case CONF_REGION_JP:
sprintf(ReportBuffer[TEXT_REGION], "%s: NTSC-J", TXT_Region);
sprintf(Region, "J");
break;
case CONF_REGION_KR:
sprintf(ReportBuffer[TEXT_REGION], "%s: KOR", TXT_Region);
sprintf(Region, "K");
break;
default:
sprintf(ReportBuffer[TEXT_REGION], "%s: ", TXT_Region);
strcat(ReportBuffer[TEXT_REGION], TXT_Unknown);
}
sprintf(Region, "%c", SysMenuRegion);
switch (sysIOS)
{
@ -1083,7 +1038,7 @@ int main(int argc, char **argv)
sprintf(ReportBuffer[HOLLYWOOD], TXT_Hollywood, *HOLLYWOOD_VERSION);
sprintf(ReportBuffer[CONSOLE_ID], TXT_ConsoleID, deviceID);
sprintf(ReportBuffer[BOOT2_VERSION], TXT_vBoot2, boot2version);
sprintf(ReportBuffer[COUNTRY], "Shop Channel Country: %s (%u)", (strlen(country)) ? country : "Unknown", shopcode);
sprintf(ReportBuffer[COUNTRY], "Shop Channel Country: %s (%u)", (strlen(country)) ? country : TXT_Unknown, shopcode);
sprintf(ReportBuffer[NR_OF_TITLES], TXT_NrOfTitles, countTitles);
sprintf(ReportBuffer[NR_OF_IOS], TXT_NrOfIOS, (countIOS - countBCMIOS), countStubs);
@ -1158,12 +1113,12 @@ int main(int argc, char **argv)
// Mount the SD Card
printLoading(MSG_MountSD);
usleep(250000);
//usleep(250000);
MountSD();
// Initialise the FAT file system
printLoading(MSG_InitFAT);
usleep(250000);
//usleep(250000);
if (!fatInitDefault())
{
sprintf(MSG_Buffer, ERR_InitFAT);