mirror of
https://github.com/wiidev/usbloadergx.git
synced 2024-11-19 09:49:21 +01:00
*Some little changes
This commit is contained in:
parent
11bfa355d1
commit
7526b140a6
120
source/menu.cpp
120
source/menu.cpp
@ -1248,10 +1248,12 @@ FormatingPartition(const char *title, partitionEntry *entry)
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* NetworkInit
|
* NetworkInit
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
char * NetworkInitPromp(int choice2)
|
int NetworkInitPromp(int choice2)
|
||||||
{
|
{
|
||||||
char myIP [16];
|
char hostip[16];
|
||||||
char * IP = 0;
|
char * IP = NULL;
|
||||||
|
s32 ret = -1;
|
||||||
|
|
||||||
GuiWindow promptWindow(472,320);
|
GuiWindow promptWindow(472,320);
|
||||||
promptWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
promptWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
||||||
promptWindow.SetPosition(0, -10);
|
promptWindow.SetPosition(0, -10);
|
||||||
@ -1298,22 +1300,31 @@ char * NetworkInitPromp(int choice2)
|
|||||||
mainWindow->SetState(STATE_DISABLED);
|
mainWindow->SetState(STATE_DISABLED);
|
||||||
mainWindow->Append(&promptWindow);
|
mainWindow->Append(&promptWindow);
|
||||||
mainWindow->ChangeFocus(&promptWindow);
|
mainWindow->ChangeFocus(&promptWindow);
|
||||||
ResumeGui();
|
|
||||||
|
|
||||||
VIDEO_WaitVSync();
|
ResumeGui();
|
||||||
|
|
||||||
while (!IP)
|
while (!IP)
|
||||||
{
|
{
|
||||||
|
|
||||||
Net_Init(myIP);
|
VIDEO_WaitVSync();
|
||||||
IP = myIP;
|
|
||||||
if (IP) {
|
ret = Net_Init(hostip);
|
||||||
|
|
||||||
|
if (ret > 0) {
|
||||||
|
IP = hostip;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ret <= 0) {
|
||||||
|
msgTxt.SetText("Could not initialize network!");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IP && ret > 0) {
|
||||||
sprintf(msg, "IP: %s", IP);
|
sprintf(msg, "IP: %s", IP);
|
||||||
msgTxt.SetText(msg);
|
msgTxt.SetText(msg);
|
||||||
cntMissFiles = 0;
|
cntMissFiles = 0;
|
||||||
u32 i = 0;
|
u32 i = 0;
|
||||||
char filename[11];
|
char filename[11];
|
||||||
// char filenameshort[10];
|
|
||||||
bool found1 = false;/////add Ids of games that are missing covers to cntMissFiles
|
bool found1 = false;/////add Ids of games that are missing covers to cntMissFiles
|
||||||
bool found2 = false;
|
bool found2 = false;
|
||||||
for (i = 0; i < gameCnt && cntMissFiles < 500; i++)
|
for (i = 0; i < gameCnt && cntMissFiles < 500; i++)
|
||||||
@ -1348,8 +1359,9 @@ char * NetworkInitPromp(int choice2)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(btn1.GetState() == STATE_CLICKED) { //pending: this should be inside the for loop
|
if(btn1.GetState() == STATE_CLICKED) {
|
||||||
IP = 0;
|
IP = 0;
|
||||||
|
ret = -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1360,7 +1372,8 @@ char * NetworkInitPromp(int choice2)
|
|||||||
mainWindow->Remove(&promptWindow);
|
mainWindow->Remove(&promptWindow);
|
||||||
mainWindow->SetState(STATE_DEFAULT);
|
mainWindow->SetState(STATE_DEFAULT);
|
||||||
ResumeGui();
|
ResumeGui();
|
||||||
return IP;
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -2503,7 +2516,14 @@ static int MenuDiscList()
|
|||||||
WPAD_Flush(0);
|
WPAD_Flush(0);
|
||||||
WPAD_Disconnect(0);
|
WPAD_Disconnect(0);
|
||||||
WPAD_Shutdown();
|
WPAD_Shutdown();
|
||||||
|
|
||||||
|
/* Set LED mode */
|
||||||
|
ret = CONF_GetIdleLedMode();
|
||||||
|
if(ret >= 0 && ret <= 2)
|
||||||
|
STM_SetLedMode(ret);
|
||||||
|
|
||||||
STM_ShutdownToIdle();
|
STM_ShutdownToIdle();
|
||||||
|
|
||||||
} else if(choice == 2) {
|
} else if(choice == 2) {
|
||||||
WPAD_Flush(0);
|
WPAD_Flush(0);
|
||||||
WPAD_Disconnect(0);
|
WPAD_Disconnect(0);
|
||||||
@ -2563,17 +2583,20 @@ static int MenuDiscList()
|
|||||||
|
|
||||||
if (choice != 0)
|
if (choice != 0)
|
||||||
{
|
{
|
||||||
char * myIP;
|
int netset;
|
||||||
int choice2 = choice;
|
int choice2 = choice;
|
||||||
|
|
||||||
myIP = NetworkInitPromp(choice2);
|
netset = NetworkInitPromp(choice2);
|
||||||
networkisinitialized = 1;
|
networkisinitialized = 1;
|
||||||
if( !myIP )
|
|
||||||
|
if(netset < 0)
|
||||||
{
|
{
|
||||||
WindowPrompt("Network init error", 0, "ok",0);
|
WindowPrompt("Network init error", 0, "OK",0);
|
||||||
netcheck = false;
|
netcheck = false;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
netcheck = true;
|
||||||
}
|
}
|
||||||
else netcheck = true;
|
|
||||||
|
|
||||||
if (netcheck)
|
if (netcheck)
|
||||||
{
|
{
|
||||||
@ -2762,49 +2785,27 @@ static int MenuDiscList()
|
|||||||
// if we have used the network or cios222 we need to reload the disklist
|
// if we have used the network or cios222 we need to reload the disklist
|
||||||
if(networkisinitialized == 1 || ios2 == 1 || Settings.cios == ios222) {
|
if(networkisinitialized == 1 || ios2 == 1 || Settings.cios == ios222) {
|
||||||
|
|
||||||
WPAD_Flush(0);
|
|
||||||
WPAD_Disconnect(0);
|
|
||||||
WPAD_Shutdown();
|
|
||||||
|
|
||||||
WDVD_Close();
|
|
||||||
|
|
||||||
USBStorage_Deinit();
|
|
||||||
|
|
||||||
if(ios2 == 1) {
|
if(ios2 == 1) {
|
||||||
|
|
||||||
ret = IOS_ReloadIOS(222);
|
ret = Sys_IosReload(222);
|
||||||
if(ret < 0) {
|
|
||||||
|
|
||||||
|
if(ret < 0) {
|
||||||
Wpad_Init();
|
Wpad_Init();
|
||||||
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);
|
||||||
|
|
||||||
WindowPrompt("You don't have cIOS222!","Loading in cIOS249!","OK", 0);
|
WindowPrompt("You don't have cIOS222!","Loading in cIOS249!","OK", 0);
|
||||||
|
|
||||||
WPAD_Flush(0);
|
Sys_IosReload(249);
|
||||||
WPAD_Disconnect(0);
|
|
||||||
WPAD_Shutdown();
|
|
||||||
|
|
||||||
IOS_ReloadIOS(249);
|
|
||||||
ios2 = 0;
|
ios2 = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
ret = IOS_ReloadIOS(249);
|
ret = Sys_IosReload(249);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = WBFS_Init(WBFS_DEVICE_USB);
|
|
||||||
|
|
||||||
PAD_Init();
|
|
||||||
Wpad_Init();
|
|
||||||
WPAD_SetDataFormat(WPAD_CHAN_ALL,WPAD_FMT_BTNS_ACC_IR);
|
|
||||||
WPAD_SetVRes(WPAD_CHAN_ALL, screenwidth, screenheight);
|
|
||||||
|
|
||||||
ret = Disc_Init();
|
|
||||||
ret = WBFS_Open();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set USB mode */
|
/* Set USB mode */
|
||||||
@ -2829,7 +2830,8 @@ static int MenuDiscList()
|
|||||||
else {
|
else {
|
||||||
menu = MENU_EXIT;
|
menu = MENU_EXIT;
|
||||||
}
|
}
|
||||||
}break;
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
bool returnHere = true;// prompt to start game
|
bool returnHere = true;// prompt to start game
|
||||||
while (returnHere)
|
while (returnHere)
|
||||||
@ -2863,51 +2865,31 @@ static int MenuDiscList()
|
|||||||
// if we have used the network or cios222 we need to reload the disklist
|
// if we have used the network or cios222 we need to reload the disklist
|
||||||
if(networkisinitialized == 1 || ios2 == 1 || Settings.cios == ios222) {
|
if(networkisinitialized == 1 || ios2 == 1 || Settings.cios == ios222) {
|
||||||
|
|
||||||
WPAD_Flush(0);
|
|
||||||
WPAD_Disconnect(0);
|
|
||||||
WPAD_Shutdown();
|
|
||||||
|
|
||||||
WDVD_Close();
|
|
||||||
|
|
||||||
USBStorage_Deinit();
|
|
||||||
|
|
||||||
if(ios2 == 1) {
|
if(ios2 == 1) {
|
||||||
|
|
||||||
ret = IOS_ReloadIOS(222);
|
ret = Sys_IosReload(222);
|
||||||
if(ret < 0) {
|
|
||||||
|
|
||||||
|
if(ret < 0) {
|
||||||
Wpad_Init();
|
Wpad_Init();
|
||||||
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);
|
||||||
|
|
||||||
WindowPrompt("You don't have cIOS222!","Loading in cIOS249!","OK", 0);
|
WindowPrompt("You don't have cIOS222!","Loading in cIOS249!","OK", 0);
|
||||||
|
|
||||||
WPAD_Flush(0);
|
Sys_IosReload(249);
|
||||||
WPAD_Disconnect(0);
|
|
||||||
WPAD_Shutdown();
|
|
||||||
|
|
||||||
IOS_ReloadIOS(249);
|
|
||||||
ios2 = 0;
|
ios2 = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
ret = IOS_ReloadIOS(249);
|
ret = Sys_IosReload(249);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = WBFS_Init(WBFS_DEVICE_USB);
|
|
||||||
|
|
||||||
PAD_Init();
|
|
||||||
Wpad_Init();
|
|
||||||
WPAD_SetDataFormat(WPAD_CHAN_ALL,WPAD_FMT_BTNS_ACC_IR);
|
|
||||||
WPAD_SetVRes(WPAD_CHAN_ALL, screenwidth, screenheight);
|
|
||||||
|
|
||||||
ret = Disc_Init();
|
|
||||||
ret = WBFS_Open();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Set USB mode */
|
/* Set USB mode */
|
||||||
ret = Disc_SetUSB(header->id, ios2);
|
ret = Disc_SetUSB(header->id, ios2);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
46
source/sys.c
46
source/sys.c
@ -1,8 +1,15 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <ogcsys.h>
|
#include <ogcsys.h>
|
||||||
|
#include <fat.h>
|
||||||
|
#include <sdcard/wiisd_io.h>
|
||||||
|
|
||||||
#include "sys.h"
|
#include "sys.h"
|
||||||
#include "wpad.h"
|
#include "wpad.h"
|
||||||
|
#include "wdvd.h"
|
||||||
|
#include "usbstorage.h"
|
||||||
|
#include "disc.h"
|
||||||
|
#include "wbfs.h"
|
||||||
|
#include "video.h"
|
||||||
|
|
||||||
/* Constants */
|
/* Constants */
|
||||||
#define CERTS_LEN 0x280
|
#define CERTS_LEN 0x280
|
||||||
@ -41,6 +48,45 @@ void Sys_Reboot(void)
|
|||||||
STM_RebootSystem();
|
STM_RebootSystem();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Sys_IosReload(int IOS)
|
||||||
|
{
|
||||||
|
s32 ret;
|
||||||
|
|
||||||
|
fatUnmount("SD");
|
||||||
|
__io_wiisd.shutdown();
|
||||||
|
|
||||||
|
WPAD_Flush(0);
|
||||||
|
WPAD_Disconnect(0);
|
||||||
|
WPAD_Shutdown();
|
||||||
|
|
||||||
|
WDVD_Close();
|
||||||
|
|
||||||
|
USBStorage_Deinit();
|
||||||
|
|
||||||
|
ret = IOS_ReloadIOS(IOS);
|
||||||
|
|
||||||
|
if(ret < 0) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
PAD_Init();
|
||||||
|
Wpad_Init();
|
||||||
|
WPAD_SetDataFormat(WPAD_CHAN_ALL,WPAD_FMT_BTNS_ACC_IR);
|
||||||
|
WPAD_SetVRes(WPAD_CHAN_ALL, screenwidth, screenheight);
|
||||||
|
|
||||||
|
__io_wiisd.startup();
|
||||||
|
fatMountSimple("SD", &__io_wiisd);
|
||||||
|
|
||||||
|
if(IOS == 249 || IOS == 222) {
|
||||||
|
ret = WBFS_Init(WBFS_DEVICE_USB);
|
||||||
|
ret = Disc_Init();
|
||||||
|
ret = WBFS_Open();
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void Sys_Shutdown(void)
|
void Sys_Shutdown(void)
|
||||||
{
|
{
|
||||||
Wpad_Disconnect();
|
Wpad_Disconnect();
|
||||||
|
@ -11,6 +11,7 @@ void Sys_Init(void);
|
|||||||
void Sys_Reboot(void);
|
void Sys_Reboot(void);
|
||||||
void Sys_Shutdown(void);
|
void Sys_Shutdown(void);
|
||||||
void Sys_LoadMenu(void);
|
void Sys_LoadMenu(void);
|
||||||
|
int Sys_IosReload(int IOS);
|
||||||
s32 Sys_GetCerts(signed_blob **, u32 *);
|
s32 Sys_GetCerts(signed_blob **, u32 *);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
Loading…
Reference in New Issue
Block a user