mirror of
https://github.com/wiidev/usbloadergx.git
synced 2024-11-25 12:46:53 +01:00
*fix bug in partition detection (at least for my HDD)
USB must deinit the device before re initting it or else it returns 0 games and what not. *add filter to skip __CFG_ in teh gamelist (i was told this is the ID6 for hermes' settings)
This commit is contained in:
parent
e44006330a
commit
b5653edcf4
@ -2,8 +2,8 @@
|
|||||||
<app version="1">
|
<app version="1">
|
||||||
<name> USB Loader GX</name>
|
<name> USB Loader GX</name>
|
||||||
<coder>USB Loader GX Team</coder>
|
<coder>USB Loader GX Team</coder>
|
||||||
<version>1.0 r878</version>
|
<version>1.0 r879</version>
|
||||||
<release_date>200912290325</release_date>
|
<release_date>200912300810</release_date>
|
||||||
<short_description>Loads games from USB-devices</short_description>
|
<short_description>Loads games from USB-devices</short_description>
|
||||||
<long_description>USB Loader GX is a libwiigui based USB iso loader with a wii-like GUI. You can install games to your HDDs and boot them with shorter loading times.
|
<long_description>USB Loader GX is a libwiigui based USB iso loader with a wii-like GUI. You can install games to your HDDs and boot them with shorter loading times.
|
||||||
The interactive GUI is completely controllable with WiiMote, Classic Controller or GC Controller.
|
The interactive GUI is completely controllable with WiiMote, Classic Controller or GC Controller.
|
||||||
|
533
source/main.cpp
533
source/main.cpp
@ -17,10 +17,12 @@
|
|||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#include <wiiuse/wpad.h>
|
#include <wiiuse/wpad.h>
|
||||||
//#include <debug.h>
|
//#include <debug.h>
|
||||||
extern "C" {
|
extern "C"
|
||||||
extern void __exception_setreload(int t);
|
{
|
||||||
|
extern void __exception_setreload(int t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#include <di/di.h>
|
#include <di/di.h>
|
||||||
#include <sys/iosupport.h>
|
#include <sys/iosupport.h>
|
||||||
|
|
||||||
@ -54,10 +56,10 @@ extern bool textVideoInit;
|
|||||||
extern char headlessID[8];
|
extern char headlessID[8];
|
||||||
|
|
||||||
/* Constants */
|
/* Constants */
|
||||||
#define CONSOLE_XCOORD 260
|
#define CONSOLE_XCOORD 260
|
||||||
#define CONSOLE_YCOORD 115
|
#define CONSOLE_YCOORD 115
|
||||||
#define CONSOLE_WIDTH 340
|
#define CONSOLE_WIDTH 340
|
||||||
#define CONSOLE_HEIGHT 218
|
#define CONSOLE_HEIGHT 218
|
||||||
|
|
||||||
FreeTypeGX *fontSystem=0;
|
FreeTypeGX *fontSystem=0;
|
||||||
FreeTypeGX *fontClock=0;
|
FreeTypeGX *fontClock=0;
|
||||||
@ -76,7 +78,8 @@ static void BootUpProblems()
|
|||||||
|
|
||||||
GuiImageData bootimageData(gxlogo_png);
|
GuiImageData bootimageData(gxlogo_png);
|
||||||
GuiImage bootimage(&bootimageData);
|
GuiImage bootimage(&bootimageData);
|
||||||
GuiText boottext(NULL, 20, (GXColor) {255, 255, 255, 255});
|
GuiText boottext(NULL, 20, (GXColor) {255, 255, 255, 255}
|
||||||
|
);
|
||||||
boottext.SetPosition(200, 240-1.2*bootimage.GetHeight()/2+250);
|
boottext.SetPosition(200, 240-1.2*bootimage.GetHeight()/2+250);
|
||||||
bootimage.SetPosition(320-1.2*bootimage.GetWidth()/2, 240-1.2*bootimage.GetHeight()/2);
|
bootimage.SetPosition(320-1.2*bootimage.GetWidth()/2, 240-1.2*bootimage.GetHeight()/2);
|
||||||
bootimage.SetScale(1.2);
|
bootimage.SetScale(1.2);
|
||||||
@ -85,72 +88,81 @@ static void BootUpProblems()
|
|||||||
GuiImage usbimage(&usbimageData);
|
GuiImage usbimage(&usbimageData);
|
||||||
usbimage.SetPosition(400,300);
|
usbimage.SetPosition(400,300);
|
||||||
usbimage.SetScale(.7);
|
usbimage.SetScale(.7);
|
||||||
usbimage.SetAlpha(200);
|
usbimage.SetAlpha(200);
|
||||||
|
|
||||||
time_t curtime;
|
time_t curtime;
|
||||||
time_t endtime = time(0) + 30;
|
time_t endtime = time(0) + 30;
|
||||||
do {
|
do
|
||||||
/*ret2 = IOS_ReloadIOSsafe(249);
|
{
|
||||||
if (ret2 < 0) {
|
/*ret2 = IOS_ReloadIOSsafe(249);
|
||||||
ret2 = IOS_ReloadIOSsafe(222);
|
if (ret2 < 0) {
|
||||||
SDCard_Init();
|
ret2 = IOS_ReloadIOSsafe(222);
|
||||||
load_ehc_module();
|
SDCard_Init();
|
||||||
SDCard_deInit();
|
load_ehc_module();
|
||||||
if(ret2 <0) {
|
SDCard_deInit();
|
||||||
boottext.SetText("ERROR: cIOS could not be loaded!");
|
if(ret2 <0) {
|
||||||
bootimage.Draw();
|
boottext.SetText("ERROR: cIOS could not be loaded!");
|
||||||
boottext.Draw();
|
bootimage.Draw();
|
||||||
Menu_Render();
|
boottext.Draw();
|
||||||
sleep(5);
|
Menu_Render();
|
||||||
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
|
sleep(5);
|
||||||
}
|
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
|
||||||
}*/
|
}
|
||||||
|
}*/
|
||||||
ret2 = WBFS_Init(WBFS_DEVICE_USB);
|
USBDevice_deInit();
|
||||||
if (ret2 >= 0) {
|
USBDevice_Init();
|
||||||
boottext.SetText("Loading...");
|
ret2 = WBFS_Init(WBFS_DEVICE_USB);
|
||||||
bootimage.Draw();
|
if (ret2 >= 0)
|
||||||
boottext.Draw();
|
{
|
||||||
Menu_Render();
|
boottext.SetText("Loading...");
|
||||||
break;
|
bootimage.Draw();
|
||||||
}
|
boottext.Draw();
|
||||||
curtime = time(0);
|
Menu_Render();
|
||||||
boottext.SetTextf("Waiting for your slow USB Device: %i secs...", int(endtime-curtime));
|
break;
|
||||||
while(curtime == time(0)) {
|
}
|
||||||
boottext.Draw();
|
curtime = time(0);
|
||||||
bootimage.Draw();
|
boottext.SetTextf("Waiting for your slow USB Device: %i secs...", int(endtime-curtime));
|
||||||
if (endtime-curtime<15)usbimage.Draw();
|
while(curtime == time(0))
|
||||||
Menu_Render();
|
{
|
||||||
}
|
boottext.Draw();
|
||||||
|
bootimage.Draw();
|
||||||
|
if (endtime-curtime<15)usbimage.Draw();
|
||||||
|
Menu_Render();
|
||||||
|
}
|
||||||
} while((endtime-time(0)) > 0);
|
} while((endtime-time(0)) > 0);
|
||||||
|
|
||||||
if(ret2 < 0) {
|
/*if(ret2 < 0) {
|
||||||
boottext.SetText("ERROR: USB device could not be loaded!");
|
boottext.SetText("ERROR: USB device could not be loaded!");
|
||||||
usbimage.Draw();
|
usbimage.Draw();
|
||||||
bootimage.Draw();
|
bootimage.Draw();
|
||||||
boottext.Draw();
|
boottext.Draw();
|
||||||
Menu_Render();
|
Menu_Render();
|
||||||
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
|
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
///delete font to load up custom if set
|
///delete font to load up custom if set
|
||||||
if(fontSystem) {
|
if(fontSystem)
|
||||||
|
{
|
||||||
delete fontSystem;
|
delete fontSystem;
|
||||||
fontSystem = NULL;
|
fontSystem = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
unsigned int *xfb = NULL;
|
unsigned int *xfb = NULL;
|
||||||
|
|
||||||
void InitTextVideo () {
|
void InitTextVideo ()
|
||||||
gprintf("\nInitTextVideo ()");
|
{
|
||||||
if (textVideoInit){
|
gprintf("\nInitTextVideo ()");
|
||||||
gprintf("...0");
|
if (textVideoInit)
|
||||||
return;
|
{
|
||||||
|
gprintf("...0");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
dbvideo=1;
|
dbvideo=1;
|
||||||
VIDEO_Init();
|
VIDEO_Init();
|
||||||
GXRModeObj *vmode = VIDEO_GetPreferredMode(NULL); // get default video mode
|
// get default video mode
|
||||||
|
GXRModeObj *vmode = VIDEO_GetPreferredMode(NULL);
|
||||||
|
|
||||||
// widescreen fix
|
// widescreen fix
|
||||||
VIDEO_Configure (vmode);
|
VIDEO_Configure (vmode);
|
||||||
@ -170,168 +182,185 @@ gprintf("\nInitTextVideo ()");
|
|||||||
VIDEO_WaitVSync ();
|
VIDEO_WaitVSync ();
|
||||||
if (vmode->viTVMode & VI_NON_INTERLACE)
|
if (vmode->viTVMode & VI_NON_INTERLACE)
|
||||||
VIDEO_WaitVSync ();
|
VIDEO_WaitVSync ();
|
||||||
|
|
||||||
//send console output to the gecko
|
//send console output to the gecko
|
||||||
if (geckoinit)CON_EnableGecko(1, true);
|
if (geckoinit)CON_EnableGecko(1, true);
|
||||||
textVideoInit = true;
|
textVideoInit = true;
|
||||||
gprintf("...1");
|
gprintf("...1");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char *argv[]) {
|
main(int argc, char *argv[])
|
||||||
setlocale(LC_ALL, "en.UTF-8");
|
{
|
||||||
geckoinit = InitGecko();
|
setlocale(LC_ALL, "en.UTF-8");
|
||||||
|
geckoinit = InitGecko();
|
||||||
|
|
||||||
if (hbcStubAvailable() || geckoinit) {
|
if (hbcStubAvailable() || geckoinit)
|
||||||
InitTextVideo();
|
{
|
||||||
}
|
InitTextVideo();
|
||||||
|
}
|
||||||
// DEBUG_Init(GDBSTUB_DEVICE_USB, 1);
|
|
||||||
//_break();
|
|
||||||
|
|
||||||
__exception_setreload(5);//auto reset code dump nobody gives us codedump info anyways.
|
|
||||||
|
|
||||||
gprintf("\n\n------------------");
|
// DEBUG_Init(GDBSTUB_DEVICE_USB, 1);
|
||||||
gprintf("\nUSB Loader GX rev%s",GetRev());
|
//_break();
|
||||||
gprintf("\nmain(%d", argc);
|
|
||||||
for (int i=0;i<argc;i++)
|
|
||||||
gprintf(", %s",argv[i]?argv[i]:"<NULL>");
|
|
||||||
gprintf(")");
|
|
||||||
|
|
||||||
// This part is added, because we need a identify patched ios
|
__exception_setreload(5); //auto reset code dump nobody gives us codedump info anyways.
|
||||||
printf("\n\tReloading into ios 236");
|
|
||||||
if (IOS_ReloadIOSsafe(236) < 0) {
|
gprintf("\n\n------------------");
|
||||||
printf("\n\tIOS 236 not found, reloading into 36");
|
gprintf("\nUSB Loader GX rev%s",GetRev());
|
||||||
IOS_ReloadIOSsafe(36);
|
gprintf("\nmain(%d", argc);
|
||||||
}
|
for (int i=0;i<argc;i++)
|
||||||
|
gprintf(", %s",argv[i]?argv[i]:"<NULL>");
|
||||||
printf("\n\tStarting up");
|
gprintf(")");
|
||||||
|
|
||||||
MEM2_init(36); // Initialize 36 MB
|
// This part is added, because we need a identify patched ios
|
||||||
MEM2_takeBigOnes(true);
|
printf("\n\tReloading into ios 236");
|
||||||
|
if (IOS_ReloadIOSsafe(236) < 0)
|
||||||
|
{
|
||||||
|
printf("\n\tIOS 236 not found, reloading into 36");
|
||||||
|
IOS_ReloadIOSsafe(36);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("\n\tStarting up");
|
||||||
|
|
||||||
|
MEM2_init(36); // Initialize 36 MB
|
||||||
|
MEM2_takeBigOnes(true);
|
||||||
|
|
||||||
s32 ret;
|
s32 ret;
|
||||||
bool startupproblem = false;
|
bool startupproblem = false;
|
||||||
|
|
||||||
bool bootDevice_found=false;
|
bool bootDevice_found=false;
|
||||||
if (argc >= 1) {
|
if (argc >= 1)
|
||||||
if (!strncasecmp(argv[0], "usb:/", 5)) {
|
{
|
||||||
|
if (!strncasecmp(argv[0], "usb:/", 5))
|
||||||
|
{
|
||||||
strcpy(bootDevice, "USB:");
|
strcpy(bootDevice, "USB:");
|
||||||
bootDevice_found = true;
|
bootDevice_found = true;
|
||||||
} else if (!strncasecmp(argv[0], "sd:/", 4))
|
} else if (!strncasecmp(argv[0], "sd:/", 4))
|
||||||
bootDevice_found = true;
|
bootDevice_found = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("\n\tInitializing controllers");
|
printf("\n\tInitializing controllers");
|
||||||
|
|
||||||
/** PAD_Init has to be before InitVideo don't move that **/
|
/** PAD_Init has to be before InitVideo don't move that **/
|
||||||
PAD_Init(); // initialize PAD/WPAD
|
PAD_Init(); // initialize PAD/WPAD
|
||||||
|
|
||||||
printf("\n\tInitialize USB (wake up)");
|
|
||||||
|
|
||||||
USBDevice_Init();// seems enough to wake up some HDDs if they are in sleep mode when the loader starts (tested with WD MyPassport Essential 2.5")
|
|
||||||
|
|
||||||
gprintf("\n\tChecking for stub IOS");
|
|
||||||
ios222rev = getIOSrev(0x00000001000000dell);
|
|
||||||
ios249rev = getIOSrev(0x00000001000000f9ll);
|
|
||||||
|
|
||||||
//if we don't like either of the cIOS then scram
|
|
||||||
if (!(ios222rev==4 || (ios249rev>=9 && ios249rev<65280)))
|
|
||||||
{
|
|
||||||
InitTextVideo();
|
|
||||||
printf("\x1b[2J");
|
|
||||||
if ((ios222rev < 0 && ios222rev != WII_EINSTALL) && (ios249rev < 0 && ios249rev != WII_EINSTALL)) {
|
|
||||||
printf("\n\n\n\tWARNING!");
|
|
||||||
printf("\n\tUSB Loader GX needs unstubbed cIOS 222 v4 or 249 v9+");
|
|
||||||
printf("\n\n\tWe cannot determine the versions on your system,\n\tsince you have no patched ios 36 or 236 installed.");
|
|
||||||
printf("\n\tTherefor, if loading of USB Loader GX fails, you\n\tprobably have installed the 4.2 update,");
|
|
||||||
printf("\n\tand you should go figure out how to get some cios action going on\n\tin your Wii.");
|
|
||||||
printf("\n\n\tThis message will show every time.");
|
|
||||||
sleep(5);
|
|
||||||
} else {
|
|
||||||
printf("\n\n\n\tERROR!");
|
|
||||||
printf("\n\tUSB Loader GX needs unstubbed cIOS 222 v4 or 249 v9+");
|
|
||||||
printf("\n\n\tI found \n\t\t222 = %d%s",ios222rev,ios222rev==65280?" (Stubbed by 4.2 update)":"");
|
|
||||||
printf("\n\t\t249 = %d%s",ios249rev,ios249rev==65280?" (Stubbed by 4.2 update)":"");
|
|
||||||
printf("\n\n\tGo figure out how to get some cIOS action going on\n\tin your Wii and come back and see me.");
|
|
||||||
|
|
||||||
sleep(15);
|
|
||||||
printf("\n\n\tBye");
|
|
||||||
|
|
||||||
USBDevice_deInit();
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("\n\tReloading ios 249...");
|
printf("\n\tInitialize USB (wake up)");
|
||||||
|
|
||||||
|
USBDevice_Init(); // seems enough to wake up some HDDs if they are in sleep mode when the loader starts (tested with WD MyPassport Essential 2.5")
|
||||||
|
|
||||||
|
gprintf("\n\tChecking for stub IOS");
|
||||||
|
ios222rev = getIOSrev(0x00000001000000dell);
|
||||||
|
ios249rev = getIOSrev(0x00000001000000f9ll);
|
||||||
|
|
||||||
|
//if we don't like either of the cIOS then scram
|
||||||
|
if (!(ios222rev==4 || (ios249rev>=9 && ios249rev<65280)))
|
||||||
|
{
|
||||||
|
InitTextVideo();
|
||||||
|
printf("\x1b[2J");
|
||||||
|
if ((ios222rev < 0 && ios222rev != WII_EINSTALL) && (ios249rev < 0 && ios249rev != WII_EINSTALL))
|
||||||
|
{
|
||||||
|
printf("\n\n\n\tWARNING!");
|
||||||
|
printf("\n\tUSB Loader GX needs unstubbed cIOS 222 v4 or 249 v9+");
|
||||||
|
printf("\n\n\tWe cannot determine the versions on your system,\n\tsince you have no patched ios 36 or 236 installed.");
|
||||||
|
printf("\n\tTherefor, if loading of USB Loader GX fails, you\n\tprobably have installed the 4.2 update,");
|
||||||
|
printf("\n\tand you should go figure out how to get some cios action going on\n\tin your Wii.");
|
||||||
|
printf("\n\n\tThis message will show every time.");
|
||||||
|
sleep(5);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf("\n\n\n\tERROR!");
|
||||||
|
printf("\n\tUSB Loader GX needs unstubbed cIOS 222 v4 or 249 v9+");
|
||||||
|
printf("\n\n\tI found \n\t\t222 = %d%s",ios222rev,ios222rev==65280?" (Stubbed by 4.2 update)":"");
|
||||||
|
printf("\n\t\t249 = %d%s",ios249rev,ios249rev==65280?" (Stubbed by 4.2 update)":"");
|
||||||
|
printf("\n\n\tGo figure out how to get some cIOS action going on\n\tin your Wii and come back and see me.");
|
||||||
|
|
||||||
|
sleep(15);
|
||||||
|
printf("\n\n\tBye");
|
||||||
|
|
||||||
|
USBDevice_deInit();
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("\n\tReloading ios 249...");
|
||||||
ret = IOS_ReloadIOSsafe(249);
|
ret = IOS_ReloadIOSsafe(249);
|
||||||
|
|
||||||
printf("%d", ret);
|
printf("%d", ret);
|
||||||
|
|
||||||
if (ret < 0) {
|
if (ret < 0)
|
||||||
printf("\n\tIOS 249 failed, reloading ios 222...");
|
{
|
||||||
|
printf("\n\tIOS 249 failed, reloading ios 222...");
|
||||||
ret = IOS_ReloadIOSsafe(222);
|
ret = IOS_ReloadIOSsafe(222);
|
||||||
printf("%d", ret);
|
printf("%d", ret);
|
||||||
|
|
||||||
if (ret < 0) {
|
if (ret < 0)
|
||||||
printf("\n\tIOS 222 failed, reloading ios 250...");
|
{
|
||||||
ret = IOS_ReloadIOSsafe(250);
|
printf("\n\tIOS 222 failed, reloading ios 250...");
|
||||||
printf("%d", ret);
|
ret = IOS_ReloadIOSsafe(250);
|
||||||
|
printf("%d", ret);
|
||||||
if(ret < 0) {
|
|
||||||
printf("\n\tIOS 250 failed, reloading ios 223...");
|
if(ret < 0)
|
||||||
ret = IOS_ReloadIOSsafe(223);
|
{
|
||||||
printf("%d", ret);
|
printf("\n\tIOS 250 failed, reloading ios 223...");
|
||||||
|
ret = IOS_ReloadIOSsafe(223);
|
||||||
if (ret < 0) {
|
printf("%d", ret);
|
||||||
printf("\n\tERROR: cIOS could not be loaded!\n");
|
|
||||||
sleep(5);
|
if (ret < 0)
|
||||||
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
|
{
|
||||||
}
|
printf("\n\tERROR: cIOS could not be loaded!\n");
|
||||||
}
|
sleep(5);
|
||||||
}
|
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
|
||||||
printf("\n\tInitialize sd card");
|
}
|
||||||
SDCard_Init();
|
}
|
||||||
printf("\n\tLoad ehc module");
|
}
|
||||||
load_ehc_module();
|
printf("\n\tInitialize sd card");
|
||||||
printf("\n\tdeinit sd card");
|
SDCard_Init();
|
||||||
SDCard_deInit();
|
printf("\n\tLoad ehc module");
|
||||||
|
load_ehc_module();
|
||||||
|
printf("\n\tdeinit sd card");
|
||||||
|
SDCard_deInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("\n\tInit wbfs...");
|
printf("\n\tInit wbfs...");
|
||||||
ret = WBFS_Init(WBFS_DEVICE_USB);
|
ret = WBFS_Init(WBFS_DEVICE_USB);
|
||||||
printf("%d", ret);
|
printf("%d", ret);
|
||||||
|
|
||||||
if (ret < 0) {
|
if (ret < 0)
|
||||||
printf("\n\tYou have issues with a slow disc, or a difficult disc\n\tReloading 222...");
|
{
|
||||||
|
printf("\n\tYou have issues with a slow disc, or a difficult disc\n\tReloading 222...");
|
||||||
ret = IOS_ReloadIOSsafe(222);
|
ret = IOS_ReloadIOSsafe(222);
|
||||||
printf("%d", ret);
|
printf("%d", ret);
|
||||||
if(ret < 0) {
|
/*if(ret < 0) {
|
||||||
printf("\n\tSleeping for 4 seconds");
|
// printf("\n\tSleeping for 4 seconds");
|
||||||
// sleep(4);
|
// sleep(4);
|
||||||
|
|
||||||
InitVideo(); // Initialise video
|
InitVideo(); // Initialise video
|
||||||
Menu_Render();
|
Menu_Render();
|
||||||
BootUpProblems();
|
BootUpProblems();
|
||||||
startupproblem = true;
|
startupproblem = true;
|
||||||
ret = 1;
|
ret = 1;
|
||||||
}
|
}*/
|
||||||
printf("\n\tInitialize sd card");
|
printf("\n\tInitialize sd card");
|
||||||
SDCard_Init();
|
SDCard_Init();
|
||||||
printf("\n\tLoad ehc module");
|
printf("\n\tLoad ehc module");
|
||||||
load_ehc_module();
|
load_ehc_module();
|
||||||
printf("\n\tdeinit sd card");
|
printf("\n\tdeinit sd card");
|
||||||
SDCard_deInit();
|
SDCard_deInit();
|
||||||
|
|
||||||
printf("\n\tInitialize wbfs...");
|
printf("\n\tInitialize wbfs...");
|
||||||
|
USBDevice_deInit();
|
||||||
|
USBDevice_Init();
|
||||||
ret = WBFS_Init(WBFS_DEVICE_USB);
|
ret = WBFS_Init(WBFS_DEVICE_USB);
|
||||||
printf("%d", ret);
|
printf("%d", ret);
|
||||||
|
|
||||||
if(ret < 0) {
|
if(ret < 0)
|
||||||
printf("\n\tSleeping for 4 seconds");
|
{
|
||||||
// sleep(4);
|
// printf("\n\tSleeping for 4 seconds");
|
||||||
InitVideo(); // Initialise video
|
// sleep(4);
|
||||||
|
InitVideo(); // Initialise video
|
||||||
Menu_Render();
|
Menu_Render();
|
||||||
BootUpProblems();
|
BootUpProblems();
|
||||||
startupproblem = true;
|
startupproblem = true;
|
||||||
@ -339,109 +368,118 @@ main(int argc, char *argv[]) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("\n\tInitialize sd card");
|
printf("\n\tInitialize sd card");
|
||||||
SDCard_Init(); // mount SD for loading cfg's
|
SDCard_Init(); // mount SD for loading cfg's
|
||||||
printf("\n\tInitialize usb device");
|
|
||||||
USBDevice_Init(); // and mount USB:/
|
|
||||||
//gprintf("\n\tSD and USB Init OK");
|
|
||||||
|
|
||||||
if (!bootDevice_found) {
|
//this should have already been done by now in order to WBFS_Init().
|
||||||
printf("\n\tSearch for configuration file");
|
printf("\n\tInitialize usb device");
|
||||||
|
USBDevice_Init(); // and mount USB:/
|
||||||
|
|
||||||
|
if (!bootDevice_found)
|
||||||
|
{
|
||||||
|
printf("\n\tSearch for configuration file");
|
||||||
|
|
||||||
//try USB
|
//try USB
|
||||||
//left in all the dol and elf files in this check in case this is the first time running the app and they dont have the config
|
//left in all the dol and elf files in this check in case this is the first time running the app and they dont have the config
|
||||||
if (checkfile((char*) "USB:/config/GXglobal.cfg") || (checkfile((char*) "USB:/apps/usbloader_gx/boot.elf"))
|
if (checkfile((char*) "USB:/config/GXglobal.cfg") || (checkfile((char*) "USB:/apps/usbloader_gx/boot.elf"))
|
||||||
|| checkfile((char*) "USB:/apps/usbloadergx/boot.dol") || (checkfile((char*) "USB:/apps/usbloadergx/boot.elf"))
|
|| checkfile((char*) "USB:/apps/usbloadergx/boot.dol") || (checkfile((char*) "USB:/apps/usbloadergx/boot.elf"))
|
||||||
|| checkfile((char*) "USB:/apps/usbloader_gx/boot.dol"))
|
|| checkfile((char*) "USB:/apps/usbloader_gx/boot.dol"))
|
||||||
strcpy(bootDevice, "USB:");
|
strcpy(bootDevice, "USB:");
|
||||||
|
|
||||||
printf("\n\tConfiguration file is on %s", bootDevice);
|
printf("\n\tConfiguration file is on %s", bootDevice);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try opening and closing the configuration file here
|
// Try opening and closing the configuration file here
|
||||||
// to prevent a crash dump later on - giantpune
|
// to prevent a crash dump later on - giantpune
|
||||||
char GXGlobal_cfg[26];
|
char GXGlobal_cfg[26];
|
||||||
sprintf(GXGlobal_cfg, "%s/config/GXGlobal.cfg", bootDevice);
|
sprintf(GXGlobal_cfg, "%s/config/GXGlobal.cfg", bootDevice);
|
||||||
FILE *fp = fopen(GXGlobal_cfg, "r");
|
FILE *fp = fopen(GXGlobal_cfg, "r");
|
||||||
if (fp) {
|
if (fp)
|
||||||
fclose(fp);
|
{
|
||||||
}
|
fclose(fp);
|
||||||
|
}
|
||||||
|
|
||||||
gettextCleanUp();
|
gettextCleanUp();
|
||||||
printf("\n\tLoading configuration...");
|
printf("\n\tLoading configuration...");
|
||||||
CFG_Load();
|
CFG_Load();
|
||||||
printf("done");
|
printf("done");
|
||||||
// gprintf("\n\tbootDevice = %s",bootDevice);
|
// gprintf("\n\tbootDevice = %s",bootDevice);
|
||||||
|
|
||||||
/* Load Custom IOS */
|
/* Load Custom IOS */
|
||||||
if ((Settings.cios == ios222 && IOS_GetVersion() != 222) ||
|
if ((Settings.cios == ios222 && IOS_GetVersion() != 222) ||
|
||||||
(Settings.cios == ios223 && IOS_GetVersion() != 223)) {
|
(Settings.cios == ios223 && IOS_GetVersion() != 223))
|
||||||
printf("\n\tReloading IOS to config setting (%d)...", ios222 ? 222 : 223);
|
{
|
||||||
SDCard_deInit();// unmount SD for reloading IOS
|
printf("\n\tReloading IOS to config setting (%d)...", ios222 ? 222 : 223);
|
||||||
USBDevice_deInit();// unmount USB for reloading IOS
|
SDCard_deInit(); // unmount SD for reloading IOS
|
||||||
USBStorage_Deinit();
|
USBDevice_deInit(); // unmount USB for reloading IOS
|
||||||
|
USBStorage_Deinit();
|
||||||
ret = IOS_ReloadIOSsafe(ios222 ? 222 : 223);
|
ret = IOS_ReloadIOSsafe(ios222 ? 222 : 223);
|
||||||
printf("%d", ret);
|
printf("%d", ret);
|
||||||
SDCard_Init();
|
SDCard_Init();
|
||||||
load_ehc_module();
|
load_ehc_module();
|
||||||
if (ret < 0) {
|
if (ret < 0)
|
||||||
SDCard_deInit();
|
{
|
||||||
|
SDCard_deInit();
|
||||||
Settings.cios = ios249;
|
Settings.cios = ios249;
|
||||||
ret = IOS_ReloadIOSsafe(249);
|
ret = IOS_ReloadIOSsafe(249);
|
||||||
// now mount SD:/ //no need to keep mindlessly mounting and unmounting SD card
|
// now mount SD:/ //no need to keep mindlessly mounting and unmounting SD card
|
||||||
SDCard_Init();
|
SDCard_Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
USBDevice_Init(); // and mount USB:/
|
|
||||||
WBFS_Init(WBFS_DEVICE_USB);
|
|
||||||
} else if ((Settings.cios == ios249 && IOS_GetVersion() != 249) ||
|
|
||||||
(Settings.cios == ios250 && IOS_GetVersion() != 250)) {
|
|
||||||
|
|
||||||
printf("\n\tReloading IOS to config setting (%d)...", ios249 ? 249 : 250);
|
USBDevice_Init(); // and mount USB:/
|
||||||
SDCard_deInit();// unmount SD for reloading IOS
|
WBFS_Init(WBFS_DEVICE_USB);
|
||||||
USBDevice_deInit();// unmount USB for reloading IOS
|
} else if ((Settings.cios == ios249 && IOS_GetVersion() != 249) ||
|
||||||
USBStorage_Deinit();
|
(Settings.cios == ios250 && IOS_GetVersion() != 250))
|
||||||
|
{
|
||||||
|
|
||||||
|
printf("\n\tReloading IOS to config setting (%d)...", ios249 ? 249 : 250);
|
||||||
|
SDCard_deInit(); // unmount SD for reloading IOS
|
||||||
|
USBDevice_deInit(); // unmount USB for reloading IOS
|
||||||
|
USBStorage_Deinit();
|
||||||
ret = IOS_ReloadIOSsafe(ios249 ? 249 : 250);
|
ret = IOS_ReloadIOSsafe(ios249 ? 249 : 250);
|
||||||
printf("%d", ret);
|
printf("%d", ret);
|
||||||
if (ret < 0) {
|
if (ret < 0)
|
||||||
|
{
|
||||||
Settings.cios = ios222;
|
Settings.cios = ios222;
|
||||||
ret = IOS_ReloadIOSsafe(222);
|
ret = IOS_ReloadIOSsafe(222);
|
||||||
SDCard_Init();
|
SDCard_Init();
|
||||||
load_ehc_module();
|
load_ehc_module();
|
||||||
}
|
}
|
||||||
|
|
||||||
else SDCard_Init(); // now mount SD:/ //no need to keep mindlessly mounting and unmounting SD card
|
|
||||||
USBDevice_Init(); // and mount USB:/
|
|
||||||
WBFS_Init(WBFS_DEVICE_USB);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Partition_GetList(&partitions);
|
else SDCard_Init(); // now mount SD:/ //no need to keep mindlessly mounting and unmounting SD card
|
||||||
|
USBDevice_Init(); // and mount USB:/
|
||||||
|
WBFS_Init(WBFS_DEVICE_USB);
|
||||||
|
}
|
||||||
|
|
||||||
if (ret < 0) {
|
// Partition_GetList(&partitions);
|
||||||
|
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
printf("\nERROR: cIOS could not be loaded!");
|
printf("\nERROR: cIOS could not be loaded!");
|
||||||
sleep(5);
|
sleep(5);
|
||||||
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
|
exit(0);
|
||||||
|
//SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
|
||||||
}
|
}
|
||||||
//gprintf("\n\tcIOS = %u (Rev %u)",IOS_GetVersion(), IOS_GetRevision());//don't need gprintf if sending console shit to gecko, too
|
//gprintf("\n\tcIOS = %u (Rev %u)",IOS_GetVersion(), IOS_GetRevision());//don't need gprintf if sending console shit to gecko, too
|
||||||
printf("\n\tcIOS = %u (Rev %u)",IOS_GetVersion(), IOS_GetRevision());
|
printf("\n\tcIOS = %u (Rev %u)",IOS_GetVersion(), IOS_GetRevision());
|
||||||
|
|
||||||
// printf("Sleeping for 5 seconds\n");
|
// printf("Sleeping for 5 seconds\n");
|
||||||
// sleep(5);
|
// sleep(5);
|
||||||
|
|
||||||
//if a ID was passed via args copy it and try to boot it after the partition is mounted
|
//if a ID was passed via args copy it and try to boot it after the partition is mounted
|
||||||
//its not really a headless mode. more like hairless.
|
//its not really a headless mode. more like hairless.
|
||||||
if (argc > 1 && argv[1])
|
if (argc > 1 && argv[1])
|
||||||
{
|
{
|
||||||
if (strlen(argv[1])==6)
|
if (strlen(argv[1])==6)
|
||||||
strncpy(headlessID, argv[1], sizeof(headlessID));
|
strncpy(headlessID, argv[1], sizeof(headlessID));
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Init the rest of the System
|
//! Init the rest of the System
|
||||||
Sys_Init();
|
Sys_Init();
|
||||||
Wpad_Init();
|
Wpad_Init();
|
||||||
if(!startupproblem)
|
if(!startupproblem)
|
||||||
InitVideo();
|
InitVideo();
|
||||||
InitAudio(); // Initialize audio
|
InitAudio(); // Initialize audio
|
||||||
|
|
||||||
WPAD_SetDataFormat(WPAD_CHAN_ALL,WPAD_FMT_BTNS_ACC_IR);
|
WPAD_SetDataFormat(WPAD_CHAN_ALL,WPAD_FMT_BTNS_ACC_IR);
|
||||||
WPAD_SetVRes(WPAD_CHAN_ALL, screenwidth, screenheight);
|
WPAD_SetVRes(WPAD_CHAN_ALL, screenwidth, screenheight);
|
||||||
@ -458,9 +496,8 @@ main(int argc, char *argv[]) {
|
|||||||
fontClock->loadFont(NULL, clock_ttf, clock_ttf_size, 0);
|
fontClock->loadFont(NULL, clock_ttf, clock_ttf_size, 0);
|
||||||
fontClock->setCompatibilityMode(FTGX_COMPATIBILITY_DEFAULT_TEVOP_GX_PASSCLR | FTGX_COMPATIBILITY_DEFAULT_VTXDESC_GX_NONE);
|
fontClock->setCompatibilityMode(FTGX_COMPATIBILITY_DEFAULT_TEVOP_GX_PASSCLR | FTGX_COMPATIBILITY_DEFAULT_VTXDESC_GX_NONE);
|
||||||
|
|
||||||
gprintf("\n\tEnd of Main()");
|
gprintf("\n\tEnd of Main()");
|
||||||
InitGUIThreads();
|
InitGUIThreads();
|
||||||
MainMenu(MENU_CHECK);
|
MainMenu(MENU_CHECK);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1772,19 +1772,22 @@ DiscWait(const char *title, const char *msg, const char *btn1Label, const char *
|
|||||||
while (i >= 0) {
|
while (i >= 0) {
|
||||||
VIDEO_WaitVSync();
|
VIDEO_WaitVSync();
|
||||||
timerTxt.SetTextf("%u %s", i,tr("seconds left"));
|
timerTxt.SetTextf("%u %s", i,tr("seconds left"));
|
||||||
HaltGui();
|
/* HaltGui();
|
||||||
if (Settings.cios == ios222) {
|
if (Settings.cios == ios222) {
|
||||||
ret = IOS_ReloadIOS(222);
|
ret = IOS_ReloadIOS(222);
|
||||||
load_ehc_module();
|
load_ehc_module();
|
||||||
} else {
|
} else {
|
||||||
ret = IOS_ReloadIOS(249);
|
ret = IOS_ReloadIOS(249);
|
||||||
}
|
}
|
||||||
ResumeGui();
|
ResumeGui();*/
|
||||||
sleep(1);
|
sleep(1);
|
||||||
|
USBDevice_deInit();
|
||||||
|
USBDevice_Init();
|
||||||
ret = WBFS_Init(WBFS_DEVICE_USB);
|
ret = WBFS_Init(WBFS_DEVICE_USB);
|
||||||
if (ret>=0)
|
if (ret>=0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
i--;
|
i--;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -500,6 +500,12 @@ int __Menu_GetGameList(int t, wchar_t* gameFilter, discHdr ** PgameList, u32 *Pg
|
|||||||
if (!game_num || game_num->favorite==0)
|
if (!game_num || game_num->favorite==0)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//ignore uLoader cfg "iso". i was told it is "__CFG_" but not confirmed
|
||||||
|
if (header->id[0]=='_'&&header->id[1]=='_'&&
|
||||||
|
header->id[2]=='C'&&header->id[3]=='F'&&
|
||||||
|
header->id[4]=='G'&&header->id[5]=='_')
|
||||||
|
continue;
|
||||||
|
|
||||||
if (Settings.parentalcontrol && !Settings.godmode && t==0) {
|
if (Settings.parentalcontrol && !Settings.godmode && t==0) {
|
||||||
if (get_block(header) >= Settings.parentalcontrol)
|
if (get_block(header) >= Settings.parentalcontrol)
|
||||||
|
Loading…
Reference in New Issue
Block a user