mirror of
https://github.com/wiidev/usbloadergx.git
synced 2024-11-04 18:45:05 +01:00
*Finished the background initialization thread for devices started by giantpune and merged it into trunk. Now you can startup the loader without a HDD. Also you can put in your device after startup and it will be recognized. Hot swapping not yet added (as in remove and than stick it in).
You will see the list of available channels on your system if you start without a HDD or if your HDD is slow and is being recognized late. The list of games is than reloading as soon as it is recognized. *Hot swapping of the SD card was implemented into background thread (by giantpune) *Made lots of cleanups and some fixes *Format menu was moved to settings page 3 (only on godmode accessable) *Added ScreenShot and Reset/Shutdown call to background thread. Removed the not needed ones. Now you can call for Screenshot/Reset/Shutdown anywhere in the loader (after gui is started).
This commit is contained in:
parent
ffb017b6bc
commit
15bcbfa482
File diff suppressed because one or more lines are too long
@ -5,98 +5,127 @@
|
||||
* Shows TPL Banner images
|
||||
***************************************************************************/
|
||||
#include "gui_banner.h"
|
||||
|
||||
GuiBanner::GuiBanner(const char *tplfilepath)
|
||||
{
|
||||
memory = NULL;
|
||||
tplfilesize = 0;
|
||||
width = 0;
|
||||
height = 0;
|
||||
|
||||
FILE *tplfp = fopen(tplfilepath,"rb");
|
||||
|
||||
if(tplfp !=NULL) {
|
||||
|
||||
unsigned short heighttemp = 0;
|
||||
unsigned short widthtemp = 0;
|
||||
|
||||
fseek(tplfp , 0x14, SEEK_SET);
|
||||
fread((void*)&heighttemp,1,2,tplfp);
|
||||
fread((void*)&widthtemp,1,2,tplfp);
|
||||
fseek (tplfp , 0 , SEEK_END);
|
||||
tplfilesize = ftell (tplfp);
|
||||
rewind (tplfp);
|
||||
memory = memalign(32, tplfilesize);
|
||||
if(!memory) {
|
||||
fclose(tplfp);
|
||||
return;
|
||||
}
|
||||
fread(memory, 1, tplfilesize, tplfp);
|
||||
fclose(tplfp);
|
||||
|
||||
TPLFile tplfile;
|
||||
int ret;
|
||||
|
||||
ret = TPL_OpenTPLFromMemory(&tplfile, memory, tplfilesize);
|
||||
if(ret < 0) {
|
||||
free(memory);
|
||||
memory = NULL;
|
||||
return;
|
||||
}
|
||||
ret = TPL_GetTexture(&tplfile,0,&texObj);
|
||||
if(ret < 0) {
|
||||
free(memory);
|
||||
memory = NULL;
|
||||
return;
|
||||
}
|
||||
TPL_CloseTPLFile(&tplfile);
|
||||
|
||||
width = widthtemp;
|
||||
height = heighttemp;
|
||||
widescreen = 0;
|
||||
filecheck = true;
|
||||
|
||||
} else {
|
||||
filecheck = false;
|
||||
fclose(tplfp);
|
||||
}
|
||||
}
|
||||
|
||||
GuiBanner::GuiBanner(void *mem, u32 len, int w, int h)
|
||||
{
|
||||
if(!mem || !len)
|
||||
return;
|
||||
memory = mem;
|
||||
tplfilesize = len;
|
||||
width = w;
|
||||
height = h;
|
||||
|
||||
TPLFile tplfile;
|
||||
|
||||
int ret;
|
||||
|
||||
ret = TPL_OpenTPLFromMemory(&tplfile, memory, tplfilesize);
|
||||
if(ret < 0) {
|
||||
free(memory);
|
||||
memory = NULL;
|
||||
return;
|
||||
}
|
||||
ret = TPL_GetTexture(&tplfile,0,&texObj);
|
||||
if(ret < 0) {
|
||||
free(memory);
|
||||
memory = NULL;
|
||||
return;
|
||||
}
|
||||
TPL_CloseTPLFile(&tplfile);
|
||||
|
||||
filecheck = true;
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u32 texture_header_offset;
|
||||
u32 palette_header_offset;
|
||||
} TPLTexture;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u16 heigth;
|
||||
u16 width;
|
||||
//...
|
||||
//there is more but we only need these
|
||||
} TPLTextureHeader;
|
||||
|
||||
//only one field tpls
|
||||
typedef struct
|
||||
{
|
||||
u32 magic;
|
||||
u32 ntextures;
|
||||
u32 texture_size;
|
||||
TPLTexture textures;
|
||||
} TPLHeader;
|
||||
|
||||
|
||||
GuiBanner::GuiBanner(const char *tplfilepath)
|
||||
{
|
||||
memory = NULL;
|
||||
tplfilesize = 0;
|
||||
width = 0;
|
||||
height = 0;
|
||||
|
||||
FILE *tplfp = fopen(tplfilepath,"rb");
|
||||
|
||||
if(tplfp !=NULL) {
|
||||
|
||||
fseek (tplfp , 0 , SEEK_END);
|
||||
tplfilesize = ftell (tplfp);
|
||||
rewind (tplfp);
|
||||
memory = memalign(32, tplfilesize);
|
||||
if(!memory) {
|
||||
fclose(tplfp);
|
||||
return;
|
||||
}
|
||||
fread(memory, 1, tplfilesize, tplfp);
|
||||
fclose(tplfp);
|
||||
|
||||
const u8 * buffer = (const u8*) memory;
|
||||
const TPLHeader *hdr = (TPLHeader *) buffer;
|
||||
const TPLTextureHeader *texhdr = (TPLTextureHeader *) &buffer[hdr->textures.texture_header_offset];
|
||||
|
||||
height = texhdr[0].heigth;
|
||||
width = texhdr[0].width;
|
||||
|
||||
TPLFile tplfile;
|
||||
int ret;
|
||||
|
||||
ret = TPL_OpenTPLFromMemory(&tplfile, memory, tplfilesize);
|
||||
if(ret < 0) {
|
||||
free(memory);
|
||||
memory = NULL;
|
||||
return;
|
||||
}
|
||||
ret = TPL_GetTexture(&tplfile,0,&texObj);
|
||||
if(ret < 0) {
|
||||
free(memory);
|
||||
memory = NULL;
|
||||
return;
|
||||
}
|
||||
TPL_CloseTPLFile(&tplfile);
|
||||
|
||||
widescreen = 0;
|
||||
filecheck = true;
|
||||
|
||||
} else {
|
||||
filecheck = false;
|
||||
fclose(tplfp);
|
||||
}
|
||||
}
|
||||
|
||||
GuiBanner::GuiBanner(void *mem, u32 len)
|
||||
{
|
||||
if(!mem || !len)
|
||||
return;
|
||||
|
||||
memory = mem;
|
||||
tplfilesize = len;
|
||||
|
||||
const u8 * buffer = (const u8*) memory;
|
||||
const TPLHeader *hdr = (TPLHeader *) buffer;
|
||||
const TPLTextureHeader *texhdr = (TPLTextureHeader *) &buffer[hdr->textures.texture_header_offset];
|
||||
|
||||
height = texhdr[0].heigth;
|
||||
width = texhdr[0].width;
|
||||
|
||||
TPLFile tplfile;
|
||||
|
||||
int ret;
|
||||
|
||||
ret = TPL_OpenTPLFromMemory(&tplfile, memory, tplfilesize);
|
||||
if(ret < 0) {
|
||||
free(memory);
|
||||
memory = NULL;
|
||||
return;
|
||||
}
|
||||
ret = TPL_GetTexture(&tplfile,0,&texObj);
|
||||
if(ret < 0) {
|
||||
free(memory);
|
||||
memory = NULL;
|
||||
return;
|
||||
}
|
||||
TPL_CloseTPLFile(&tplfile);
|
||||
|
||||
filecheck = true;
|
||||
}
|
||||
|
||||
GuiBanner::~GuiBanner()
|
||||
{
|
||||
{
|
||||
if(memory != NULL) {
|
||||
free(memory);
|
||||
memory = NULL;
|
||||
free(memory);
|
||||
memory = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@ -104,11 +133,11 @@ void GuiBanner::Draw()
|
||||
{
|
||||
LOCK(this);
|
||||
if(!filecheck ||!this->IsVisible())
|
||||
return;
|
||||
return;
|
||||
|
||||
float currScale = this->GetScale();
|
||||
|
||||
Menu_DrawTPLImg(this->GetLeft(), this->GetTop(), 0, width, height, &texObj, imageangle, widescreen ? currScale*0.80 : currScale, currScale, this->GetAlpha(), xx1,yy1,xx2,yy2,xx3,yy3,xx4,yy4);
|
||||
float currScale = this->GetScale();
|
||||
|
||||
Menu_DrawTPLImg(this->GetLeft(), this->GetTop(), 0, width, height, &texObj, imageangle, widescreen ? currScale*0.80 : currScale, currScale, this->GetAlpha(), xx1,yy1,xx2,yy2,xx3,yy3,xx4,yy4);
|
||||
|
||||
this->UpdateEffects();
|
||||
}
|
||||
|
@ -19,9 +19,7 @@ public:
|
||||
//!Constructor
|
||||
//!\param mem Memory of the loaded tpl
|
||||
//!\param len Filesize of the tpl
|
||||
//!\param w Width of the tpl
|
||||
//!\param h Height of the tpl
|
||||
GuiBanner(void *mem, u32 len, int w, int h);
|
||||
GuiBanner(void *mem, u32 len);
|
||||
//!Destructor
|
||||
~GuiBanner();
|
||||
void Draw();
|
||||
|
@ -13,6 +13,8 @@ extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include <gccore.h>
|
||||
|
||||
/***********************************************************
|
||||
* Error description:
|
||||
* 0 Successfully extracted
|
||||
|
@ -1,6 +1,6 @@
|
||||
#ifndef BANNERSOUND_H
|
||||
#define BANNERSOUND_H
|
||||
|
||||
const u8 *LoadBannerSound(const u8 *discid, u32 *size);
|
||||
|
||||
#endif /* BANNERSOUND_H */
|
||||
#ifndef BANNERSOUND_H
|
||||
#define BANNERSOUND_H
|
||||
|
||||
const u8 *LoadBannerSound(const u8 *discid, u32 *size);
|
||||
|
||||
#endif /* BANNERSOUND_H */
|
||||
|
@ -12,11 +12,7 @@
|
||||
#include "filelist.h"
|
||||
#include "sys.h"
|
||||
#include "gct.h"
|
||||
|
||||
/*** Extern functions ***/
|
||||
extern void ResumeGui();
|
||||
extern void HaltGui();
|
||||
|
||||
#include "../menu/menus.h"
|
||||
/*** Extern variables ***/
|
||||
extern GuiWindow * mainWindow;
|
||||
|
||||
|
@ -28,9 +28,7 @@
|
||||
#include "unzip/miniunz.h"
|
||||
#include "usbloader/utils.h"
|
||||
|
||||
/*** Extern functions ***/
|
||||
extern void ResumeGui();
|
||||
extern void HaltGui();
|
||||
#include "../menu/menus.h"
|
||||
|
||||
/*** Extern variables ***/
|
||||
extern GuiWindow * mainWindow;
|
||||
@ -39,8 +37,6 @@ extern GuiImage * bgImg;
|
||||
extern u32 infilesize;
|
||||
extern u32 uncfilesize;
|
||||
extern char wiiloadVersion[2];
|
||||
extern u8 shutdown;
|
||||
extern u8 reset;
|
||||
extern struct SSettings Settings;
|
||||
extern void *innetbuffer;
|
||||
|
||||
@ -731,11 +727,6 @@ int MenuHomebrewBrowse() {
|
||||
MainButton4.ResetState();
|
||||
}
|
||||
|
||||
else if (shutdown == 1)
|
||||
Sys_Shutdown();
|
||||
else if (reset == 1)
|
||||
Sys_Reboot();
|
||||
|
||||
else if (backBtn.GetState() == STATE_CLICKED) {
|
||||
menu = MENU_DISCLIST;
|
||||
changed = true;
|
||||
@ -834,29 +825,29 @@ int MenuHomebrewBrowse() {
|
||||
|
||||
read += result;
|
||||
}
|
||||
|
||||
|
||||
char filename[101];
|
||||
if (!error) {
|
||||
|
||||
|
||||
network_read((u8*) &filename, 100);
|
||||
|
||||
|
||||
// Do we need to unzip this thing?
|
||||
if (wiiloadVersion[0] > 0 || wiiloadVersion[1] > 4) {
|
||||
|
||||
// We need to unzip...
|
||||
if (temp[0] == 'P' && temp[1] == 'K' && temp[2] == 0x03 && temp[3] == 0x04) {
|
||||
// It's a zip file, unzip to the apps directory
|
||||
|
||||
|
||||
// Zip archive, ask for permission to install the zip
|
||||
char zippath[255];
|
||||
sprintf((char *) &zippath, "%s%s", Settings.homebrewapps_path, filename);
|
||||
|
||||
|
||||
FILE *fp = fopen(zippath, "wb");
|
||||
if (fp != NULL)
|
||||
{
|
||||
fwrite(temp, 1, infilesize, fp);
|
||||
fclose(fp);
|
||||
|
||||
|
||||
// Now unzip the zip file...
|
||||
unzFile uf = unzOpen(zippath);
|
||||
if (uf==NULL) {
|
||||
@ -864,9 +855,9 @@ int MenuHomebrewBrowse() {
|
||||
} else {
|
||||
extractZip(uf,0,1,0, Settings.homebrewapps_path);
|
||||
unzCloseCurrentFile(uf);
|
||||
|
||||
|
||||
remove(zippath);
|
||||
|
||||
|
||||
// Reload this menu here...
|
||||
menu = MENU_HOMEBREWBROWSE;
|
||||
break;
|
||||
@ -880,17 +871,17 @@ int MenuHomebrewBrowse() {
|
||||
uLongf f = uncfilesize;
|
||||
error = uncompress(unc, &f, temp, infilesize) != Z_OK;
|
||||
uncfilesize = f;
|
||||
|
||||
|
||||
free(temp);
|
||||
temp = unc;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!error && strstr(filename,".zip") == NULL) {
|
||||
innetbuffer = temp;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ProgressStop();
|
||||
|
||||
if (error || read != infilesize) {
|
||||
|
File diff suppressed because it is too large
Load Diff
458
source/main.cpp
458
source/main.cpp
@ -15,14 +15,13 @@
|
||||
#include <ogcsys.h>
|
||||
#include <unistd.h>
|
||||
#include <locale.h>
|
||||
#include <ogc/libversion.h>
|
||||
#include <wiiuse/wpad.h>
|
||||
//#include <debug.h>
|
||||
extern "C"
|
||||
{
|
||||
extern void __exception_setreload(int t);
|
||||
extern "C" {
|
||||
extern void __exception_setreload(int t);
|
||||
}
|
||||
|
||||
|
||||
#include <di/di.h>
|
||||
#include <sys/iosupport.h>
|
||||
|
||||
@ -50,436 +49,144 @@ extern "C"
|
||||
#include "usbloader/usbstorage.h"
|
||||
#include "memory/mem2.h"
|
||||
#include "lstub.h"
|
||||
#include "xml/xml.h"
|
||||
#include "settings/newtitles.h"
|
||||
#include "menu/menus.h"
|
||||
|
||||
extern bool geckoinit;
|
||||
extern bool textVideoInit;
|
||||
extern char headlessID[8];
|
||||
PartList partitions;
|
||||
|
||||
/* Constants */
|
||||
#define CONSOLE_XCOORD 260
|
||||
#define CONSOLE_YCOORD 115
|
||||
#define CONSOLE_WIDTH 340
|
||||
#define CONSOLE_HEIGHT 218
|
||||
#define CONSOLE_XCOORD 260
|
||||
#define CONSOLE_YCOORD 115
|
||||
#define CONSOLE_WIDTH 340
|
||||
#define CONSOLE_HEIGHT 218
|
||||
|
||||
FreeTypeGX *fontSystem=0;
|
||||
FreeTypeGX *fontClock=0;
|
||||
PartList partitions;
|
||||
|
||||
u8 dbvideo =0;
|
||||
|
||||
static void BootUpProblems()
|
||||
void LoadHeadlessID(const char * ID)
|
||||
{
|
||||
s32 ret2;
|
||||
|
||||
// load main font from file, or default to built-in font
|
||||
fontSystem = new FreeTypeGX();
|
||||
fontSystem->loadFont(NULL, font_ttf, font_ttf_size, 0);
|
||||
fontSystem->setCompatibilityMode(FTGX_COMPATIBILITY_DEFAULT_TEVOP_GX_PASSCLR | FTGX_COMPATIBILITY_DEFAULT_VTXDESC_GX_NONE);
|
||||
|
||||
GuiImageData bootimageData(gxlogo_png);
|
||||
GuiImage bootimage(&bootimageData);
|
||||
GuiText boottext(NULL, 20, (GXColor) {255, 255, 255, 255}
|
||||
);
|
||||
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.SetScale(1.2);
|
||||
|
||||
GuiImageData usbimageData(usbport_png);
|
||||
GuiImage usbimage(&usbimageData);
|
||||
usbimage.SetPosition(400,300);
|
||||
usbimage.SetScale(.7);
|
||||
usbimage.SetAlpha(200);
|
||||
|
||||
time_t curtime;
|
||||
InitTextVideo();
|
||||
strncpy(headlessID, ID, sizeof(headlessID));
|
||||
InitCheckThread();
|
||||
time_t endtime = time(0) + 30;
|
||||
do
|
||||
time_t curtime;
|
||||
printf("\tWaiting for USB-Device:\n");
|
||||
while(checkthreadState != 1)
|
||||
{
|
||||
/*ret2 = IOS_ReloadIOSsafe(249);
|
||||
if (ret2 < 0) {
|
||||
ret2 = IOS_ReloadIOSsafe(222);
|
||||
SDCard_Init();
|
||||
load_ehc_module();
|
||||
SDCard_deInit();
|
||||
if(ret2 <0) {
|
||||
boottext.SetText("ERROR: cIOS could not be loaded!");
|
||||
bootimage.Draw();
|
||||
boottext.Draw();
|
||||
Menu_Render();
|
||||
sleep(5);
|
||||
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
|
||||
}
|
||||
}*/
|
||||
USBDevice_deInit();
|
||||
USBDevice_Init();
|
||||
ret2 = WBFS_Init(WBFS_DEVICE_USB);
|
||||
if (ret2 >= 0)
|
||||
{
|
||||
boottext.SetText("Loading...");
|
||||
bootimage.Draw();
|
||||
boottext.Draw();
|
||||
Menu_Render();
|
||||
break;
|
||||
}
|
||||
usleep(100);
|
||||
curtime = time(0);
|
||||
boottext.SetTextf("Waiting for your slow USB Device: %i secs...", int(endtime-curtime));
|
||||
while(curtime == time(0))
|
||||
printf("\t\t%d\n", int(endtime-curtime));
|
||||
if(endtime == curtime)
|
||||
{
|
||||
boottext.Draw();
|
||||
bootimage.Draw();
|
||||
if (endtime-curtime<15)usbimage.Draw();
|
||||
Menu_Render();
|
||||
printf("\n\tDevice could not be loaded.\n\tExiting...\n");
|
||||
sleep(5);
|
||||
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
|
||||
}
|
||||
} while((endtime-time(0)) > 0);
|
||||
|
||||
/*if(ret2 < 0) {
|
||||
boottext.SetText("ERROR: USB device could not be loaded!");
|
||||
usbimage.Draw();
|
||||
bootimage.Draw();
|
||||
boottext.Draw();
|
||||
Menu_Render();
|
||||
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
|
||||
}*/
|
||||
|
||||
///delete font to load up custom if set
|
||||
if(fontSystem)
|
||||
{
|
||||
delete fontSystem;
|
||||
fontSystem = NULL;
|
||||
}
|
||||
mountMethod = 0;
|
||||
checkthreadState = 0;
|
||||
ExitCheckThread();
|
||||
CloseXMLDatabase();
|
||||
NewTitles::DestroyInstance();
|
||||
ShutdownAudio();
|
||||
StopGX();
|
||||
gettextCleanUp();
|
||||
menuBootgame(headlessID);
|
||||
}
|
||||
|
||||
|
||||
unsigned int *xfb = NULL;
|
||||
|
||||
void InitTextVideo ()
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
gprintf("\nInitTextVideo ()");
|
||||
if (textVideoInit)
|
||||
{
|
||||
gprintf("...0");
|
||||
return;
|
||||
}
|
||||
dbvideo=1;
|
||||
VIDEO_Init();
|
||||
// get default video mode
|
||||
GXRModeObj *vmode = VIDEO_GetPreferredMode(NULL);
|
||||
setlocale(LC_ALL, "en.UTF-8");
|
||||
geckoinit = InitGecko();
|
||||
|
||||
// widescreen fix
|
||||
VIDEO_Configure (vmode);
|
||||
if (hbcStubAvailable() || geckoinit)
|
||||
InitTextVideo();
|
||||
|
||||
// Allocate the video buffers
|
||||
xfb = (u32 *) MEM_K0_TO_K1 (SYS_AllocateFramebuffer (vmode));
|
||||
__exception_setreload(5);//auto reset code dump nobody gives us codedump info anyways.
|
||||
|
||||
// A console is always useful while debugging
|
||||
console_init (xfb, 20, 64, vmode->fbWidth, vmode->xfbHeight, vmode->fbWidth * 2);
|
||||
|
||||
// Clear framebuffers etc.
|
||||
VIDEO_ClearFrameBuffer (vmode, xfb, COLOR_BLACK);
|
||||
VIDEO_SetNextFramebuffer (xfb);
|
||||
|
||||
VIDEO_SetBlack (FALSE);
|
||||
VIDEO_Flush ();
|
||||
VIDEO_WaitVSync ();
|
||||
if (vmode->viTVMode & VI_NON_INTERLACE)
|
||||
VIDEO_WaitVSync ();
|
||||
|
||||
//send console output to the gecko
|
||||
if (geckoinit)CON_EnableGecko(1, true);
|
||||
textVideoInit = true;
|
||||
gprintf("...1");
|
||||
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
setlocale(LC_ALL, "en.UTF-8");
|
||||
geckoinit = InitGecko();
|
||||
|
||||
if (hbcStubAvailable() || geckoinit)
|
||||
{
|
||||
InitTextVideo();
|
||||
}
|
||||
|
||||
// DEBUG_Init(GDBSTUB_DEVICE_USB, 1);
|
||||
//_break();
|
||||
|
||||
__exception_setreload(5); //auto reset code dump nobody gives us codedump info anyways.
|
||||
|
||||
gprintf("\n\n------------------");
|
||||
gprintf("\nUSB Loader GX rev%s",GetRev());
|
||||
gprintf("\nmain(%d", argc);
|
||||
for (int i=0;i<argc;i++)
|
||||
gprintf(", %s",argv[i]?argv[i]:"<NULL>");
|
||||
gprintf("\n\n------------------");
|
||||
gprintf("\nUSB Loader GX rev%s linked with %s",GetRev(), _V_STRING);
|
||||
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
|
||||
// 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\tReloading into ios 236");
|
||||
if (IOS_ReloadIOSsafe(236) < 0)
|
||||
IOS_ReloadIOSsafe(36);
|
||||
|
||||
printf("\n\tStarting up");
|
||||
printf("\n\tStarting up");
|
||||
|
||||
MEM2_init(36); // Initialize 36 MB
|
||||
MEM2_takeBigOnes(true);
|
||||
MEM2_init(36); // Initialize 36 MB
|
||||
MEM2_takeBigOnes(true);
|
||||
|
||||
s32 ret;
|
||||
bool startupproblem = false;
|
||||
|
||||
bool bootDevice_found=false;
|
||||
if (argc >= 1)
|
||||
{
|
||||
if (!strncasecmp(argv[0], "usb:/", 5))
|
||||
{
|
||||
if (argc >= 1) {
|
||||
if (!strncasecmp(argv[0], "usb:/", 5)) {
|
||||
strcpy(bootDevice, "USB:");
|
||||
bootDevice_found = true;
|
||||
} 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(); // initialize PAD/WPAD
|
||||
PAD_Init(); // initialize PAD/WPAD
|
||||
|
||||
printf("\n\tInitialize USB (wake up)");
|
||||
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")
|
||||
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")
|
||||
USBDevice_deInit();
|
||||
|
||||
gprintf("\n\tChecking for stub IOS");
|
||||
ios222rev = getIOSrev(0x00000001000000dell);
|
||||
ios249rev = getIOSrev(0x00000001000000f9ll);
|
||||
ret = CheckForCIOS();
|
||||
|
||||
//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);
|
||||
|
||||
printf("%d", ret);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
printf("\n\tIOS 249 failed, reloading ios 222...");
|
||||
ret = IOS_ReloadIOSsafe(222);
|
||||
printf("%d", ret);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
printf("\n\tIOS 222 failed, reloading ios 250...");
|
||||
ret = IOS_ReloadIOSsafe(250);
|
||||
printf("%d", ret);
|
||||
|
||||
if(ret < 0)
|
||||
{
|
||||
printf("\n\tIOS 250 failed, reloading ios 223...");
|
||||
ret = IOS_ReloadIOSsafe(223);
|
||||
printf("%d", ret);
|
||||
|
||||
if (ret < 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\tdeinit sd card");
|
||||
SDCard_deInit();
|
||||
}
|
||||
|
||||
printf("\n\tInit wbfs...");
|
||||
ret = WBFS_Init(WBFS_DEVICE_USB);
|
||||
printf("%d", ret);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
printf("\n\tYou have issues with a slow disc, or a difficult disc\n\tReloading 222...");
|
||||
ret = IOS_ReloadIOSsafe(222);
|
||||
printf("%d", ret);
|
||||
/*if(ret < 0) {
|
||||
// printf("\n\tSleeping for 4 seconds");
|
||||
// sleep(4);
|
||||
|
||||
InitVideo(); // Initialise video
|
||||
Menu_Render();
|
||||
BootUpProblems();
|
||||
startupproblem = true;
|
||||
ret = 1;
|
||||
}*/
|
||||
printf("\n\tInitialize sd card");
|
||||
SDCard_Init();
|
||||
printf("\n\tLoad ehc module");
|
||||
load_ehc_module();
|
||||
printf("\n\tdeinit sd card");
|
||||
SDCard_deInit();
|
||||
|
||||
printf("\n\tInitialize wbfs...");
|
||||
USBDevice_deInit();
|
||||
USBDevice_Init();
|
||||
ret = WBFS_Init(WBFS_DEVICE_USB);
|
||||
printf("%d", ret);
|
||||
|
||||
if(ret < 0)
|
||||
{
|
||||
// printf("\n\tSleeping for 4 seconds");
|
||||
// sleep(4);
|
||||
InitVideo(); // Initialise video
|
||||
Menu_Render();
|
||||
BootUpProblems();
|
||||
startupproblem = true;
|
||||
ret = 1;
|
||||
}
|
||||
}
|
||||
|
||||
printf("\n\tInitialize sd card");
|
||||
SDCard_Init(); // mount SD for loading cfg's
|
||||
|
||||
//this should have already been done by now in order to WBFS_Init().
|
||||
printf("\n\tInitialize usb device");
|
||||
USBDevice_Init(); // and mount USB:/
|
||||
printf("\n\tInitialize sd card");
|
||||
SDCard_Init(); // mount SD for loading cfg's
|
||||
printf("\n\tInitialize usb device");
|
||||
USBDevice_Init(); // and mount USB:/
|
||||
|
||||
if (!bootDevice_found)
|
||||
{
|
||||
printf("\n\tSearch for configuration file");
|
||||
|
||||
printf("\n\tSearch for configuration file");
|
||||
//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
|
||||
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/usbloader_gx/boot.dol"))
|
||||
|| checkfile((char*) "USB:/apps/usbloadergx/boot.dol") || (checkfile((char*) "USB:/apps/usbloadergx/boot.elf"))
|
||||
|| checkfile((char*) "USB:/apps/usbloader_gx/boot.dol"))
|
||||
strcpy(bootDevice, "USB:");
|
||||
|
||||
printf("\n\tConfiguration file is on %s", bootDevice);
|
||||
}
|
||||
|
||||
// Try opening and closing the configuration file here
|
||||
// to prevent a crash dump later on - giantpune
|
||||
char GXGlobal_cfg[26];
|
||||
sprintf(GXGlobal_cfg, "%s/config/GXGlobal.cfg", bootDevice);
|
||||
FILE *fp = fopen(GXGlobal_cfg, "r");
|
||||
if (fp)
|
||||
{
|
||||
fclose(fp);
|
||||
printf("\n\tConfiguration file is on %s", bootDevice);
|
||||
}
|
||||
|
||||
gettextCleanUp();
|
||||
printf("\n\tLoading configuration...");
|
||||
printf("\n\tLoading configuration...");
|
||||
CFG_Load();
|
||||
printf("done");
|
||||
// gprintf("\n\tbootDevice = %s",bootDevice);
|
||||
printf("done");
|
||||
|
||||
/* Load Custom IOS */
|
||||
if ((Settings.cios == ios222 && IOS_GetVersion() != 222) ||
|
||||
(Settings.cios == ios223 && IOS_GetVersion() != 223))
|
||||
{
|
||||
printf("\n\tReloading IOS to config setting (%d)...", ios222 ? 222 : 223);
|
||||
SDCard_deInit(); // unmount SD for reloading IOS
|
||||
USBDevice_deInit(); // unmount USB for reloading IOS
|
||||
USBStorage_Deinit();
|
||||
ret = IOS_ReloadIOSsafe(ios222 ? 222 : 223);
|
||||
printf("%d", ret);
|
||||
SDCard_Init();
|
||||
load_ehc_module();
|
||||
if (ret < 0)
|
||||
{
|
||||
SDCard_deInit();
|
||||
Settings.cios = ios249;
|
||||
ret = IOS_ReloadIOSsafe(249);
|
||||
// now mount SD:/ //no need to keep mindlessly mounting and unmounting SD card
|
||||
SDCard_Init();
|
||||
}
|
||||
LoadAppCIOS();
|
||||
printf("\n\tcIOS = %u (Rev %u)",IOS_GetVersion(), IOS_GetRevision());
|
||||
|
||||
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);
|
||||
SDCard_deInit(); // unmount SD for reloading IOS
|
||||
USBDevice_deInit(); // unmount USB for reloading IOS
|
||||
USBStorage_Deinit();
|
||||
ret = IOS_ReloadIOSsafe(ios249 ? 249 : 250);
|
||||
printf("%d", ret);
|
||||
if (ret < 0)
|
||||
{
|
||||
Settings.cios = ios222;
|
||||
ret = IOS_ReloadIOSsafe(222);
|
||||
SDCard_Init();
|
||||
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);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
printf("\nERROR: cIOS could not be loaded!");
|
||||
sleep(5);
|
||||
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
|
||||
printf("\n\tcIOS = %u (Rev %u)",IOS_GetVersion(), IOS_GetRevision());
|
||||
|
||||
// printf("Sleeping for 5 seconds\n");
|
||||
// sleep(5);
|
||||
|
||||
//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.
|
||||
if (argc > 1 && argv[1])
|
||||
{
|
||||
if (strlen(argv[1])==6)
|
||||
strncpy(headlessID, argv[1], sizeof(headlessID));
|
||||
}
|
||||
//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.
|
||||
if (argc > 1 && argv[1])
|
||||
{
|
||||
if (strlen(argv[1]) == 6)
|
||||
LoadHeadlessID(argv[1]);
|
||||
}
|
||||
|
||||
//! Init the rest of the System
|
||||
Sys_Init();
|
||||
Wpad_Init();
|
||||
if(!startupproblem)
|
||||
InitVideo();
|
||||
InitAudio(); // Initialize audio
|
||||
InitVideo();
|
||||
InitAudio(); // Initialize audio
|
||||
|
||||
WPAD_SetDataFormat(WPAD_CHAN_ALL,WPAD_FMT_BTNS_ACC_IR);
|
||||
WPAD_SetVRes(WPAD_CHAN_ALL, screenwidth, screenheight);
|
||||
@ -496,8 +203,9 @@ main(int argc, char *argv[])
|
||||
fontClock->loadFont(NULL, clock_ttf, clock_ttf_size, 0);
|
||||
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();
|
||||
MainMenu(MENU_CHECK);
|
||||
MainMenu(MENU_DISCLIST);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
327
source/menu.cpp
327
source/menu.cpp
@ -21,7 +21,9 @@
|
||||
#include "settings/cfg.h"
|
||||
#include "themes/Theme_Downloader.h"
|
||||
#include "usbloader/disc.h"
|
||||
#include "usbloader/wdvd.h"
|
||||
#include "usbloader/getentries.h"
|
||||
#include "usbloader/usbstorage.h"
|
||||
#include "wad/title.h"
|
||||
#include "xml/xml.h"
|
||||
#include "audio.h"
|
||||
@ -44,7 +46,7 @@ GuiSound *btnClick2 = NULL;
|
||||
|
||||
struct discHdr *dvdheader = NULL;
|
||||
int currentMenu;
|
||||
u8 mountMethod=0;
|
||||
u8 mountMethod=3;
|
||||
|
||||
char game_partition[6];
|
||||
int load_from_fs;
|
||||
@ -65,8 +67,6 @@ static int ExitRequested = 0;
|
||||
/*** Extern variables ***/
|
||||
extern struct discHdr * gameList;
|
||||
extern FreeTypeGX *fontClock;
|
||||
extern u8 shutdown;
|
||||
extern u8 reset;
|
||||
extern s32 gameSelected, gameStart;
|
||||
extern u8 boothomebrew;
|
||||
extern u8 dbvideo;
|
||||
@ -79,7 +79,8 @@ extern u8 dbvideo;
|
||||
* after finishing the removal/insertion of new elements, and after initial
|
||||
* GUI setup.
|
||||
***************************************************************************/
|
||||
void ResumeGui() {
|
||||
void ResumeGui()
|
||||
{
|
||||
guiHalt = false;
|
||||
LWP_ResumeThread (guithread);
|
||||
}
|
||||
@ -92,8 +93,11 @@ void ResumeGui() {
|
||||
* This eliminates the possibility that the GUI is in the middle of accessing
|
||||
* an element that is being changed.
|
||||
***************************************************************************/
|
||||
void HaltGui() {
|
||||
if (guiHalt)return;
|
||||
void HaltGui()
|
||||
{
|
||||
if (guiHalt)
|
||||
return;
|
||||
|
||||
guiHalt = true;
|
||||
|
||||
// wait for thread to finish
|
||||
@ -182,13 +186,16 @@ void InitGUIThreads() {
|
||||
LWP_CreateThread(&guithread, UpdateGUI, NULL, NULL, 0, LWP_PRIO_HIGHEST);
|
||||
InitProgressThread();
|
||||
InitNetworkThread();
|
||||
InitCheckThread();
|
||||
|
||||
if (Settings.autonetwork)
|
||||
ResumeNetworkThread();
|
||||
}
|
||||
|
||||
void ExitGUIThreads() {
|
||||
void ExitGUIThreads()
|
||||
{
|
||||
ExitRequested = 1;
|
||||
ExitCheckThread();
|
||||
LWP_JoinThread(guithread, NULL);
|
||||
guithread = LWP_THREAD_NULL;
|
||||
}
|
||||
@ -253,9 +260,6 @@ int MainMenu(int menu) {
|
||||
currentMenu = menu;
|
||||
char imgPath[100];
|
||||
|
||||
//if (strcmp(headlessID,"")!=0)HaltGui();
|
||||
//WindowPrompt("Can you see me now",0,"ok");
|
||||
|
||||
snprintf(imgPath, sizeof(imgPath), "%splayer1_point.png", CFG.theme_path);
|
||||
pointer[0] = new GuiImageData(imgPath, player1_point_png);
|
||||
snprintf(imgPath, sizeof(imgPath), "%splayer2_point.png", CFG.theme_path);
|
||||
@ -277,8 +281,7 @@ int MainMenu(int menu) {
|
||||
bgImg = new GuiImage(background);
|
||||
mainWindow->Append(bgImg);
|
||||
|
||||
if (strcmp(headlessID,"")==0)
|
||||
ResumeGui();
|
||||
ResumeGui();
|
||||
|
||||
bgMusic = new GuiSound(bg_music_ogg, bg_music_ogg_size, Settings.volume);
|
||||
bgMusic->SetLoop(1); //loop music
|
||||
@ -291,43 +294,37 @@ int MainMenu(int menu) {
|
||||
while (currentMenu != MENU_EXIT) {
|
||||
bgMusic->SetVolume(Settings.volume);
|
||||
|
||||
switch (currentMenu) {
|
||||
case MENU_CHECK:
|
||||
|
||||
currentMenu = MenuCheck();
|
||||
break;
|
||||
case MENU_FORMAT:
|
||||
currentMenu = MenuFormat();
|
||||
break;
|
||||
case MENU_INSTALL:
|
||||
currentMenu = MenuInstall();
|
||||
break;
|
||||
case MENU_SETTINGS:
|
||||
currentMenu = MenuSettings();
|
||||
break;
|
||||
case MENU_THEMEDOWNLOADER:
|
||||
currentMenu = Theme_Downloader();
|
||||
break;
|
||||
case MENU_HOMEBREWBROWSE:
|
||||
currentMenu = MenuHomebrewBrowse();
|
||||
break;
|
||||
case MENU_DISCLIST:
|
||||
currentMenu = MenuDiscList();
|
||||
break;
|
||||
default: // unrecognized menu
|
||||
currentMenu = MenuCheck();
|
||||
break;
|
||||
switch (currentMenu)
|
||||
{
|
||||
case MENU_FORMAT:
|
||||
currentMenu = MenuFormat();
|
||||
break;
|
||||
case MENU_INSTALL:
|
||||
currentMenu = MenuInstall();
|
||||
break;
|
||||
case MENU_SETTINGS:
|
||||
currentMenu = MenuSettings();
|
||||
break;
|
||||
case MENU_THEMEDOWNLOADER:
|
||||
currentMenu = Theme_Downloader();
|
||||
break;
|
||||
case MENU_HOMEBREWBROWSE:
|
||||
currentMenu = MenuHomebrewBrowse();
|
||||
break;
|
||||
case MENU_DISCLIST:
|
||||
currentMenu = MenuDiscList();
|
||||
break;
|
||||
default: // unrecognized menu
|
||||
currentMenu = MenuDiscList();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MemInfoPrompt();
|
||||
gprintf("\nExiting main GUI. mountMethod = %d",mountMethod);
|
||||
|
||||
CloseXMLDatabase();
|
||||
NewTitles::DestroyInstance();
|
||||
if (strcmp(headlessID,"")!=0)//the GUIthread was never started, so it cant be ended and joined properly if headless mode was used. so we resume it and close it.
|
||||
ResumeGui();
|
||||
ExitGUIThreads();
|
||||
|
||||
bgMusic->Stop();
|
||||
@ -347,70 +344,72 @@ int MainMenu(int menu) {
|
||||
StopGX();
|
||||
gettextCleanUp();
|
||||
|
||||
if(dbvideo)
|
||||
{
|
||||
InitVideodebug ();
|
||||
printf("\n\n\n\n\n");
|
||||
}
|
||||
if (mountMethod==3)
|
||||
{
|
||||
struct discHdr *header = &gameList[gameSelected];
|
||||
char tmp[20];
|
||||
u32 tid;
|
||||
sprintf(tmp,"%c%c%c%c",header->id[0],header->id[1],header->id[2],header->id[3]);
|
||||
memcpy(&tid, tmp, 4);
|
||||
gprintf("\nBooting title %016llx",TITLE_ID((header->id[5]=='1'?0x00010001:0x00010002),tid));
|
||||
WII_Initialize();
|
||||
WII_LaunchTitle(TITLE_ID((header->id[5]=='1'?0x00010001:0x00010002),tid));
|
||||
}
|
||||
if (mountMethod==2)
|
||||
{
|
||||
gprintf("\nLoading BC for GameCube");
|
||||
WII_Initialize();
|
||||
WII_LaunchTitle(0x0000000100000100ULL);
|
||||
}
|
||||
menuBootgame("");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void menuBootgame(const char *headless)
|
||||
{
|
||||
if (mountMethod==3)
|
||||
{
|
||||
struct discHdr *header = &gameList[gameSelected];
|
||||
char tmp[20];
|
||||
u32 tid;
|
||||
sprintf(tmp,"%c%c%c%c",header->id[0],header->id[1],header->id[2],header->id[3]);
|
||||
memcpy(&tid, tmp, 4);
|
||||
gprintf("\nBooting title %016llx",TITLE_ID((header->id[5]=='1'?0x00010001:0x00010002),tid));
|
||||
WII_Initialize();
|
||||
WII_LaunchTitle(TITLE_ID((header->id[5]=='1'?0x00010001:0x00010002),tid));
|
||||
}
|
||||
if (mountMethod==2)
|
||||
{
|
||||
gprintf("\nLoading BC for GameCube");
|
||||
WII_Initialize();
|
||||
WII_LaunchTitle(0x0000000100000100ULL);
|
||||
}
|
||||
|
||||
else if (boothomebrew == 1) {
|
||||
gprintf("\nBootHomebrew");
|
||||
gprintf("\nBootHomebrew");
|
||||
BootHomebrew(Settings.selected_homebrew);
|
||||
}
|
||||
else if (boothomebrew == 2) {
|
||||
gprintf("\nBootHomebrewFromMenu");
|
||||
else if (boothomebrew == 2) {
|
||||
gprintf("\nBootHomebrewFromMenu");
|
||||
BootHomebrewFromMem();
|
||||
}
|
||||
else {
|
||||
gprintf("\n\tSettings.partition:%d",Settings.partition);
|
||||
struct discHdr *header = NULL;
|
||||
//if the GUI was "skipped" to boot a game from main(argv[1])
|
||||
if (strcmp(headlessID,"")!=0)
|
||||
{
|
||||
gprintf("\n\tHeadless mode (%s)",headlessID);
|
||||
__Menu_GetEntries(1);
|
||||
if (!gameCnt)
|
||||
{
|
||||
gprintf(" ERROR : !gameCnt");
|
||||
exit(0);
|
||||
}
|
||||
//gprintf("\n\tgameCnt:%d",gameCnt);
|
||||
for(u32 i=0;i<gameCnt;i++)
|
||||
{
|
||||
header = &gameList[i];
|
||||
char tmp[8];
|
||||
sprintf(tmp,"%c%c%c%c%c%c",header->id[0],header->id[1],header->id[2],header->id[3],header->id[4],header->id[5]);
|
||||
if (strcmp(tmp,headlessID)==0)
|
||||
{
|
||||
gameSelected = i;
|
||||
gprintf(" found (%d)",i);
|
||||
break;
|
||||
}
|
||||
//if the game was not found
|
||||
if (i==gameCnt-1)
|
||||
{
|
||||
gprintf(" not found (%d IDs checked)",i);
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
gprintf("\n\tSettings.partition:%d",Settings.partition);
|
||||
struct discHdr *header = NULL;
|
||||
//if the GUI was "skipped" to boot a game from main(argv[1])
|
||||
if (strcmp(headless,"")!=0)
|
||||
{
|
||||
gprintf("\n\tHeadless mode (%s)",headless);
|
||||
__Menu_GetEntries(1);
|
||||
if (!gameCnt)
|
||||
{
|
||||
gprintf(" ERROR : !gameCnt");
|
||||
exit(0);
|
||||
}
|
||||
gprintf("\n\tgameCnt:%d",gameCnt);
|
||||
for(u32 i=0;i<gameCnt;i++)
|
||||
{
|
||||
header = &gameList[i];
|
||||
char tmp[8];
|
||||
sprintf(tmp,"%c%c%c%c%c%c",header->id[0],header->id[1],header->id[2],header->id[3],header->id[4],header->id[5]);
|
||||
if (strcmp(tmp,headless)==0)
|
||||
{
|
||||
gameSelected = i;
|
||||
gprintf(" found (%d)",i);
|
||||
break;
|
||||
}
|
||||
//if the game was not found
|
||||
if (i==gameCnt-1)
|
||||
{
|
||||
gprintf(" not found (%d IDs checked)",i);
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int ret = 0;
|
||||
@ -426,10 +425,10 @@ int MainMenu(int menu) {
|
||||
fix002 = game_cfg->errorfix002;
|
||||
iosChoice = game_cfg->ios;
|
||||
countrystrings = game_cfg->patchcountrystrings;
|
||||
if (!altdoldefault) {
|
||||
alternatedol = game_cfg->loadalternatedol;
|
||||
alternatedoloffset = game_cfg->alternatedolstart;
|
||||
}
|
||||
if (!altdoldefault) {
|
||||
alternatedol = game_cfg->loadalternatedol;
|
||||
alternatedoloffset = game_cfg->alternatedolstart;
|
||||
}
|
||||
reloadblock = game_cfg->iosreloadblock;
|
||||
} else {
|
||||
videoChoice = Settings.video;
|
||||
@ -443,81 +442,86 @@ int MainMenu(int menu) {
|
||||
}
|
||||
fix002 = Settings.error002;
|
||||
countrystrings = Settings.patchcountrystrings;
|
||||
if (!altdoldefault) {
|
||||
alternatedol = off;
|
||||
alternatedoloffset = 0;
|
||||
}
|
||||
if (!altdoldefault) {
|
||||
alternatedol = off;
|
||||
alternatedoloffset = 0;
|
||||
}
|
||||
reloadblock = off;
|
||||
}
|
||||
int ios2;
|
||||
int ios2;
|
||||
|
||||
switch (iosChoice) {
|
||||
case i249:
|
||||
ios2 = 249;
|
||||
break;
|
||||
switch (iosChoice) {
|
||||
case i249:
|
||||
ios2 = 249;
|
||||
break;
|
||||
|
||||
case i222:
|
||||
ios2 = 222;
|
||||
break;
|
||||
case i222:
|
||||
ios2 = 222;
|
||||
break;
|
||||
|
||||
case i223:
|
||||
ios2 = 223;
|
||||
break;
|
||||
case i223:
|
||||
ios2 = 223;
|
||||
break;
|
||||
|
||||
default:
|
||||
ios2 = 249;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
ios2 = 249;
|
||||
break;
|
||||
}
|
||||
|
||||
// When the selected ios is 249, and you're loading from FAT, reset ios to 222
|
||||
if (load_from_fs != PART_FS_WBFS && ios2 == 249) {
|
||||
ios2 = 222;
|
||||
}
|
||||
bool onlinefix = ShutdownWC24();
|
||||
// When the selected ios is 249, and you're loading from FAT, reset ios to 222
|
||||
if (load_from_fs != PART_FS_WBFS && ios2 == 249)
|
||||
ios2 = 222;
|
||||
|
||||
// You cannot reload ios when loading from fat
|
||||
if (IOS_GetVersion() != ios2 || onlinefix) {
|
||||
ShutdownWC24();
|
||||
|
||||
// You cannot reload ios when loading from fat
|
||||
if (IOS_GetVersion() != ios2)
|
||||
{
|
||||
ret = Sys_ChangeIos(ios2);
|
||||
if (ret < 0) {
|
||||
if (ret < 0)
|
||||
Sys_ChangeIos(249);
|
||||
}
|
||||
}
|
||||
if (!mountMethod)
|
||||
{
|
||||
gprintf("\nLoading fragment list...");
|
||||
ret = get_frag_list(header->id);
|
||||
gprintf("%d\n", ret);
|
||||
|
||||
gprintf("\nSetting fragment list...");
|
||||
ret = set_frag_list(header->id);
|
||||
gprintf("%d\n", ret);
|
||||
if (!mountMethod)
|
||||
{
|
||||
gprintf("\nLoading fragment list...");
|
||||
ret = get_frag_list(header->id);
|
||||
gprintf("%d\n", ret);
|
||||
|
||||
ret = Disc_SetUSB(header->id);
|
||||
if (ret < 0) Sys_BackToLoader();
|
||||
gprintf("\n\tUSB set to game");
|
||||
}
|
||||
else {
|
||||
gprintf("\n\tUSB not set, loading DVD");
|
||||
}
|
||||
gprintf("\nSetting fragment list...");
|
||||
ret = set_frag_list(header->id);
|
||||
gprintf("%d\n", ret);
|
||||
|
||||
ret = Disc_SetUSB(header->id);
|
||||
if (ret < 0) Sys_BackToLoader();
|
||||
gprintf("\n\tUSB set to game");
|
||||
}
|
||||
else {
|
||||
gprintf("\n\tUSB not set, loading DVD");
|
||||
Disc_SetUSB(NULL);
|
||||
ret = WDVD_Close();
|
||||
ret = Disc_Init();
|
||||
}
|
||||
ret = Disc_Open();
|
||||
gprintf("\n\tDisc_Open():%d",ret);
|
||||
|
||||
if (ret < 0) Sys_BackToLoader();
|
||||
if (ret < 0 && !mountMethod) Sys_BackToLoader();
|
||||
|
||||
if (gameList){
|
||||
free(gameList);
|
||||
}
|
||||
if(dvdheader)
|
||||
delete dvdheader;
|
||||
if (gameList)
|
||||
free(gameList);
|
||||
|
||||
gprintf("\nLoading BCA data...");
|
||||
ret = do_bca_code(header->id);
|
||||
gprintf("%d\n", ret);
|
||||
if(dvdheader)
|
||||
delete dvdheader;
|
||||
|
||||
if (reloadblock == on && Sys_IsHermes()) {
|
||||
gprintf("\nLoading BCA data...");
|
||||
ret = do_bca_code(header->id);
|
||||
gprintf("%d\n", ret);
|
||||
|
||||
if (reloadblock == on && Sys_IsHermes())
|
||||
{
|
||||
patch_cios_data();
|
||||
if (load_from_fs == PART_FS_WBFS) {
|
||||
mload_close();
|
||||
}
|
||||
if (load_from_fs == PART_FS_WBFS)
|
||||
mload_close();
|
||||
}
|
||||
|
||||
u8 errorfixer002 = 0;
|
||||
@ -644,14 +648,13 @@ int MainMenu(int menu) {
|
||||
vipatch = 0;
|
||||
break;
|
||||
}
|
||||
gprintf("\n\tDisc_wiiBoot");
|
||||
gprintf("\n\tDisc_wiiBoot");
|
||||
|
||||
ret = Disc_WiiBoot(videoselected, cheat, vipatch, countrystrings, errorfixer002, alternatedol, alternatedoloffset);
|
||||
if (ret < 0) {
|
||||
Sys_LoadMenu();
|
||||
}
|
||||
|
||||
printf("Returning entry point: 0x%0x\n", ret);
|
||||
printf("Returning entry point: 0x%0x\n", ret);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -15,8 +15,11 @@
|
||||
|
||||
void InitGUIThreads(void);
|
||||
void ExitGUIThreads(void);
|
||||
void ResumeGui();
|
||||
void HaltGui();
|
||||
void menuBootgame(const char *headless);
|
||||
|
||||
int MainMenu (int menuitem);
|
||||
int MainMenu (int menu);
|
||||
|
||||
enum {
|
||||
MENU_EXIT = -1,
|
||||
|
202
source/menu/device_check.cpp
Normal file
202
source/menu/device_check.cpp
Normal file
@ -0,0 +1,202 @@
|
||||
#include <dirent.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "gecko.h"
|
||||
#include "menus.h"
|
||||
#include "wpad.h"
|
||||
#include "fatmounter.h"
|
||||
#include "usbloader/getentries.h"
|
||||
#include "usbloader/wbfs.h"
|
||||
|
||||
extern int load_from_fs;
|
||||
extern char game_partition[6];
|
||||
|
||||
static lwp_t checkthread = LWP_THREAD_NULL;
|
||||
static bool checkHalt = false;
|
||||
static bool ExitRequested = false;
|
||||
static u8 sdState =0;
|
||||
u8 hddState = 0;
|
||||
u8 checkthreadState = 0;
|
||||
|
||||
extern u8 shutdown;
|
||||
extern u8 reset;
|
||||
|
||||
void ResumeCheck()
|
||||
{
|
||||
checkHalt = false;
|
||||
LWP_ResumeThread(checkthread);
|
||||
}
|
||||
|
||||
void HaltCheck()
|
||||
{
|
||||
if(checkHalt)
|
||||
return;
|
||||
|
||||
checkHalt = true;
|
||||
|
||||
while (!LWP_ThreadIsSuspended(checkthread))
|
||||
usleep(50);
|
||||
}
|
||||
|
||||
int CheckPartition()
|
||||
{
|
||||
s32 ret2 = -1;
|
||||
memset(game_partition, 0, 6);
|
||||
load_from_fs = -1;
|
||||
|
||||
extern PartList partitions;
|
||||
// Added for slow HDD
|
||||
for (int runs = 0; runs < 10; runs++)
|
||||
{
|
||||
if (Partition_GetList(WBFS_DEVICE_USB, &partitions) != 0)
|
||||
continue;
|
||||
|
||||
if (Settings.partition != -1 && partitions.num > Settings.partition)
|
||||
{
|
||||
PartInfo pinfo = partitions.pinfo[Settings.partition];
|
||||
if (WBFS_OpenPart(pinfo.part_fs, pinfo.index, partitions.pentry[Settings.partition].sector, partitions.pentry[Settings.partition].size, (char *) &game_partition) == 0)
|
||||
{
|
||||
ret2 = 0;
|
||||
load_from_fs = pinfo.part_fs;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (partitions.wbfs_n != 0)
|
||||
{
|
||||
ret2 = WBFS_Open();
|
||||
for (int p = 0; p < partitions.num; p++)
|
||||
{
|
||||
if (partitions.pinfo[p].fs_type == FS_TYPE_WBFS)
|
||||
{
|
||||
Settings.partition = p;
|
||||
load_from_fs = PART_FS_WBFS;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if (Sys_IsHermes() && (partitions.fat_n != 0 || partitions.ntfs_n != 0))
|
||||
{
|
||||
// Loop through FAT/NTFS partitions, and find the first partition with games on it (if there is one)
|
||||
u32 count;
|
||||
for (int i = 0; i < partitions.num; i++)
|
||||
{
|
||||
if (partitions.pinfo[i].fs_type == FS_TYPE_FAT32 || partitions.pinfo[i].fs_type == FS_TYPE_NTFS)
|
||||
{
|
||||
if (!WBFS_OpenPart(partitions.pinfo[i].part_fs, partitions.pinfo[i].index, partitions.pentry[i].sector, partitions.pentry[i].size, (char *) &game_partition))
|
||||
{
|
||||
// Get the game count...
|
||||
WBFS_GetCount(&count);
|
||||
if (count > 0)
|
||||
{
|
||||
load_from_fs = partitions.pinfo[i].part_fs;
|
||||
Settings.partition = i;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
WBFS_Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((ret2 >= 0 || load_from_fs != PART_FS_WBFS) && isInserted(bootDevice))
|
||||
{
|
||||
cfg_save_global();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (ret2 < 0 && load_from_fs != PART_FS_WBFS)
|
||||
return ret2;
|
||||
|
||||
ret2 = Disc_Init();
|
||||
if (ret2 < 0)
|
||||
return ret2;
|
||||
|
||||
// open database if needed, load titles if needed
|
||||
if(isInserted(bootDevice))
|
||||
OpenXMLDatabase(Settings.titlestxt_path,Settings.db_language, Settings.db_JPtoEN, true, Settings.titlesOverride==1?true:false, true);
|
||||
|
||||
hddState = 1;
|
||||
|
||||
return hddState;
|
||||
}
|
||||
|
||||
int CheckHDD()
|
||||
{
|
||||
USBDevice_deInit();
|
||||
USBDevice_Init();
|
||||
|
||||
int wbfsinit = WBFS_Init(WBFS_DEVICE_USB);
|
||||
|
||||
if (wbfsinit >= 0)
|
||||
wbfsinit = CheckPartition();
|
||||
|
||||
return wbfsinit;
|
||||
}
|
||||
|
||||
static void * CheckDevices (void *arg)
|
||||
{
|
||||
sdState = isInserted(bootDevice);
|
||||
while (!ExitRequested)
|
||||
{
|
||||
usleep(100);
|
||||
|
||||
if (checkHalt && !ExitRequested)
|
||||
{
|
||||
LWP_SuspendThread(checkthread);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (shutdown == 1)
|
||||
Sys_Shutdown();
|
||||
|
||||
else if (reset == 1)
|
||||
Sys_Reboot();
|
||||
|
||||
if (!hddState)
|
||||
{
|
||||
if(CheckHDD() >= 0)
|
||||
{
|
||||
checkthreadState = 1;
|
||||
}
|
||||
}
|
||||
|
||||
//this really doesnt work right. it seems that isInserted() isn't what it should be.
|
||||
int sdNow = isInserted(bootDevice);
|
||||
if (sdState != sdNow)
|
||||
{
|
||||
sdState = sdNow;
|
||||
checkthreadState = 2;
|
||||
WindowPrompt("2",0,"OK");
|
||||
}
|
||||
|
||||
u32 buttons = ButtonsPressed();
|
||||
if((buttons & WPAD_NUNCHUK_BUTTON_Z) || (buttons & WPAD_CLASSIC_BUTTON_ZL) ||
|
||||
(buttons & PAD_TRIGGER_Z))
|
||||
{
|
||||
gprintf("\n\tscreenShotBtn clicked");
|
||||
ScreenShot();
|
||||
gprintf("...It's easy, mmmmmmKay");
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void InitCheckThread()
|
||||
{
|
||||
LWP_CreateThread(&checkthread, CheckDevices, NULL, NULL, 0, 0);
|
||||
}
|
||||
|
||||
void ExitCheckThread()
|
||||
{
|
||||
ExitRequested = true;
|
||||
LWP_ResumeThread(checkthread);
|
||||
LWP_JoinThread(checkthread, NULL);
|
||||
checkthread = LWP_THREAD_NULL;
|
||||
}
|
@ -1,164 +0,0 @@
|
||||
#include <dirent.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "menus.h"
|
||||
#include "wpad.h"
|
||||
#include "fatmounter.h"
|
||||
#include "usbloader/getentries.h"
|
||||
#include "usbloader/wbfs.h"
|
||||
|
||||
extern int load_from_fs;
|
||||
extern char game_partition[6];
|
||||
extern char headlessID[8];
|
||||
|
||||
/****************************************************************************
|
||||
* MenuCheck
|
||||
***************************************************************************/
|
||||
int MenuCheck() {
|
||||
gprintf("\nMenuCheck()");
|
||||
int menu = MENU_NONE;
|
||||
int i = 0;
|
||||
int choice;
|
||||
s32 ret2, wbfsinit;
|
||||
OptionList options;
|
||||
options.length = i;
|
||||
|
||||
VIDEO_WaitVSync ();
|
||||
|
||||
wbfsinit = WBFS_Init(WBFS_DEVICE_USB);
|
||||
if (wbfsinit < 0) {
|
||||
ret2 = WindowPrompt(tr("No USB Device found."), tr("Do you want to retry for 30 secs?"), "cIOS249", "cIOS222", tr("Back to Wii Menu"));
|
||||
SDCard_deInit();
|
||||
USBDevice_deInit();
|
||||
WPAD_Flush(0);
|
||||
WPAD_Disconnect(0);
|
||||
WPAD_Shutdown();
|
||||
if (ret2 == 1) {
|
||||
Settings.cios = ios249;
|
||||
} else if (ret2 == 2) {
|
||||
Settings.cios = ios222;
|
||||
} else {
|
||||
Sys_LoadMenu();
|
||||
}
|
||||
ret2 = DiscWait(tr("No USB Device"), tr("Waiting for USB Device"), 0, 0, 1);
|
||||
//reinitialize SD and USB
|
||||
Wpad_Init();
|
||||
WPAD_SetDataFormat(WPAD_CHAN_ALL,WPAD_FMT_BTNS_ACC_IR);
|
||||
WPAD_SetVRes(WPAD_CHAN_ALL, screenwidth, screenheight);
|
||||
if (ret2 < 0) {
|
||||
WindowPrompt (tr("Error !"),tr("USB Device not found"), tr("OK"));
|
||||
Sys_LoadMenu();
|
||||
}
|
||||
}
|
||||
|
||||
ret2 = -1;
|
||||
memset(game_partition, 0, 6);
|
||||
load_from_fs = -1;
|
||||
|
||||
extern PartList partitions;
|
||||
// Added for slow HDD
|
||||
for (int runs = 0; runs < 10; runs++) {
|
||||
if (Partition_GetList(WBFS_DEVICE_USB, &partitions) != 0) {
|
||||
sleep(1);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Settings.partition != -1 && partitions.num > Settings.partition) {
|
||||
PartInfo pinfo = partitions.pinfo[Settings.partition];
|
||||
if (WBFS_OpenPart(pinfo.part_fs, pinfo.index, partitions.pentry[Settings.partition].sector, partitions.pentry[Settings.partition].size, (char *) &game_partition) == 0)
|
||||
{
|
||||
ret2 = 0;
|
||||
load_from_fs = pinfo.part_fs;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (partitions.wbfs_n != 0) {
|
||||
ret2 = WBFS_Open();
|
||||
for (int p = 0; p < partitions.num; p++) {
|
||||
if (partitions.pinfo[p].fs_type == FS_TYPE_WBFS) {
|
||||
Settings.partition = p;
|
||||
load_from_fs = PART_FS_WBFS;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (Sys_IsHermes() && (partitions.fat_n != 0 || partitions.ntfs_n != 0)) {
|
||||
// Loop through FAT/NTFS partitions, and find the first partition with games on it (if there is one)
|
||||
u32 count;
|
||||
|
||||
for (int i = 0; i < partitions.num; i++) {
|
||||
if (partitions.pinfo[i].fs_type == FS_TYPE_FAT32 || partitions.pinfo[i].fs_type == FS_TYPE_NTFS) {
|
||||
|
||||
if (!WBFS_OpenPart(partitions.pinfo[i].part_fs, partitions.pinfo[i].index, partitions.pentry[i].sector, partitions.pentry[i].size, (char *) &game_partition)) {
|
||||
// Get the game count...
|
||||
WBFS_GetCount(&count);
|
||||
|
||||
if (count > 0) {
|
||||
load_from_fs = partitions.pinfo[i].part_fs;
|
||||
Settings.partition = i;
|
||||
break;
|
||||
} else {
|
||||
WBFS_Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((ret2 >= 0 || load_from_fs != PART_FS_WBFS) && isInserted(bootDevice)) {
|
||||
cfg_save_global();
|
||||
break;
|
||||
}
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
if (ret2 < 0 && load_from_fs != PART_FS_WBFS) {
|
||||
choice = WindowPrompt(tr("No WBFS or FAT/NTFS partition found"),tr("You need to select or format a partition"), tr("Select"), tr("Format"), tr("Return"));
|
||||
if (choice == 0) {
|
||||
Sys_LoadMenu();
|
||||
} else {
|
||||
load_from_fs = choice == 1 ? PART_FS_FAT : PART_FS_WBFS;
|
||||
menu = MENU_FORMAT;
|
||||
}
|
||||
}
|
||||
|
||||
ret2 = Disc_Init();
|
||||
if (ret2 < 0) {
|
||||
WindowPrompt (tr("Error !"),tr("Could not initialize DIP module!"),tr("OK"));
|
||||
Sys_LoadMenu();
|
||||
}
|
||||
|
||||
if (shutdown == 1)
|
||||
Sys_Shutdown();
|
||||
if (reset == 1)
|
||||
Sys_Reboot();
|
||||
|
||||
if (wbfsinit < 0) {
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
// open database if needed, load titles if needed
|
||||
if(isInserted(bootDevice))OpenXMLDatabase(Settings.titlestxt_path,Settings.db_language, Settings.db_JPtoEN, true, Settings.titlesOverride==1?true:false, true);
|
||||
|
||||
// titles.txt loaded after database to override database titles with custom titles
|
||||
//snprintf(pathname, sizeof(pathname), "%stitles.txt", Settings.titlestxt_path);
|
||||
//cfg_parsefile(pathname, &title_set);
|
||||
|
||||
//Spieleliste laden
|
||||
__Menu_GetEntries(0);
|
||||
|
||||
if (strcmp(headlessID,"")!=0)
|
||||
menu = MENU_EXIT;
|
||||
|
||||
if (menu == MENU_NONE)
|
||||
menu = MENU_DISCLIST;
|
||||
|
||||
//for HDDs with issues
|
||||
if (wbfsinit < 0) {
|
||||
sleep(1);
|
||||
USBDevice_Init();
|
||||
SDCard_Init();
|
||||
}
|
||||
|
||||
return menu;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,185 +1,196 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include "menus.h"
|
||||
#include "fatmounter.h"
|
||||
#include "usbloader/usbstorage.h"
|
||||
#include "usbloader/utils.h"
|
||||
#include "usbloader/wbfs.h"
|
||||
#include "libwiigui/gui_customoptionbrowser.h"
|
||||
|
||||
extern int load_from_fs;
|
||||
extern char game_partition[6];
|
||||
|
||||
/****************************************************************************
|
||||
* MenuFormat
|
||||
***************************************************************************/
|
||||
int MenuFormat() {
|
||||
|
||||
USBDevice_deInit();
|
||||
sleep(1);
|
||||
|
||||
USBStorage_Init();
|
||||
|
||||
int menu = MENU_NONE;
|
||||
char imgPath[100];
|
||||
|
||||
customOptionList options(MAX_PARTITIONS_EX);
|
||||
extern PartList partitions;
|
||||
|
||||
u32 cnt, counter = 0;
|
||||
int choice, ret;
|
||||
char text[ISFS_MAXPATH];
|
||||
|
||||
//create the partitionlist
|
||||
for (cnt = 0; cnt < (u32) partitions.num; cnt++) {
|
||||
partitionEntry *entry = &partitions.pentry[cnt];
|
||||
|
||||
/* Calculate size in gigabytes */
|
||||
f32 size = entry->size * (partitions.sector_size / GB_SIZE);
|
||||
|
||||
if (size) {
|
||||
options.SetName(counter, "%s %d:",tr("Partition"), cnt+1);
|
||||
options.SetValue(counter,"%.2fGB", size);
|
||||
} else {
|
||||
options.SetName(counter, "%s %d:",tr("Partition"), cnt+1);
|
||||
options.SetValue(counter,tr("Can't be formatted"));
|
||||
}
|
||||
counter++;
|
||||
}
|
||||
|
||||
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, Settings.sfxvolume);
|
||||
// because destroy GuiSound must wait while sound playing is finished, we use a global sound
|
||||
if(!btnClick2) btnClick2=new GuiSound(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
|
||||
// GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
|
||||
snprintf(imgPath, sizeof(imgPath), "%swiimote_poweroff.png", CFG.theme_path);
|
||||
GuiImageData btnpwroff(imgPath, wiimote_poweroff_png);
|
||||
snprintf(imgPath, sizeof(imgPath), "%swiimote_poweroff_over.png", CFG.theme_path);
|
||||
GuiImageData btnpwroffOver(imgPath, wiimote_poweroff_over_png);
|
||||
snprintf(imgPath, sizeof(imgPath), "%smenu_button.png", CFG.theme_path);
|
||||
GuiImageData btnhome(imgPath, menu_button_png);
|
||||
snprintf(imgPath, sizeof(imgPath), "%smenu_button_over.png", CFG.theme_path);
|
||||
GuiImageData btnhomeOver(imgPath, menu_button_over_png);
|
||||
GuiImageData battery(battery_png);
|
||||
GuiImageData batteryBar(battery_bar_png);
|
||||
GuiImageData batteryRed(battery_red_png);
|
||||
GuiImageData batteryBarRed(battery_bar_red_png);
|
||||
|
||||
|
||||
GuiTrigger trigA;
|
||||
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
||||
GuiTrigger trigHome;
|
||||
trigHome.SetButtonOnlyTrigger(-1, WPAD_BUTTON_HOME | WPAD_CLASSIC_BUTTON_HOME, 0);
|
||||
|
||||
GuiImage poweroffBtnImg(&btnpwroff);
|
||||
GuiImage poweroffBtnImgOver(&btnpwroffOver);
|
||||
poweroffBtnImg.SetWidescreen(CFG.widescreen);
|
||||
poweroffBtnImgOver.SetWidescreen(CFG.widescreen);
|
||||
GuiButton poweroffBtn(&poweroffBtnImg,&poweroffBtnImgOver, 0, 3, THEME.power_x, THEME.power_y, &trigA, &btnSoundOver, btnClick2,1);
|
||||
GuiImage exitBtnImg(&btnhome);
|
||||
GuiImage exitBtnImgOver(&btnhomeOver);
|
||||
exitBtnImg.SetWidescreen(CFG.widescreen);
|
||||
exitBtnImgOver.SetWidescreen(CFG.widescreen);
|
||||
GuiButton exitBtn(&exitBtnImg,&exitBtnImgOver, 0, 3, THEME.home_x, THEME.home_y, &trigA, &btnSoundOver, btnClick2,1);
|
||||
exitBtn.SetTrigger(&trigHome);
|
||||
|
||||
GuiCustomOptionBrowser optionBrowser(396, 280, &options, CFG.theme_path, "bg_options_settings.png", bg_options_settings_png, 0, 10);
|
||||
optionBrowser.SetPosition(0, 40);
|
||||
optionBrowser.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
|
||||
HaltGui();
|
||||
GuiWindow w(screenwidth, screenheight);
|
||||
w.Append(&poweroffBtn);
|
||||
w.Append(&exitBtn);
|
||||
|
||||
mainWindow->Append(&w);
|
||||
mainWindow->Append(&optionBrowser);
|
||||
|
||||
ResumeGui();
|
||||
|
||||
while (menu == MENU_NONE) {
|
||||
|
||||
VIDEO_WaitVSync ();
|
||||
|
||||
ret = optionBrowser.GetClickedOption();
|
||||
|
||||
if(ret >= 0) {
|
||||
if(Settings.godmode == 1) {
|
||||
partitionEntry *entry = &partitions.pentry[ret];
|
||||
if (entry->size) {
|
||||
if (load_from_fs == PART_FS_FAT) {
|
||||
WBFS_OpenPart(partitions.pinfo[ret].part_fs, partitions.pinfo[ret].index, entry->sector,
|
||||
entry->size, (char *) &game_partition);
|
||||
load_from_fs = partitions.pinfo[ret].part_fs;
|
||||
menu = MENU_DISCLIST;
|
||||
|
||||
Settings.partition = ret;
|
||||
if(isInserted(bootDevice))cfg_save_global();
|
||||
} else {
|
||||
sprintf(text, "%s %d : %.2fGB",tr("Partition"), ret+1, entry->size * (partitions.sector_size / GB_SIZE));
|
||||
choice = WindowPrompt( tr("Do you want to format:"), text,tr("Yes"),tr("No"));
|
||||
if (choice == 1) {
|
||||
ret = FormatingPartition(tr("Formatting, please wait..."), entry);
|
||||
if (ret < 0) {
|
||||
WindowPrompt(tr("Error !"),tr("Failed formating"),tr("Return"));
|
||||
menu = MENU_SETTINGS;
|
||||
} else {
|
||||
sleep(1);
|
||||
ret = WBFS_Open();
|
||||
sprintf(text, "%s %s", text,tr("formatted!"));
|
||||
WindowPrompt(tr("Success:"),text,tr("OK"));
|
||||
if(ret < 0) {
|
||||
WindowPrompt(tr("ERROR"), tr("Failed to open partition"), tr("OK"));
|
||||
Sys_LoadMenu();
|
||||
}
|
||||
menu = MENU_DISCLIST;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if(Settings.godmode == 0) {
|
||||
mainWindow->Remove(&optionBrowser);
|
||||
char entered[20] = "";
|
||||
int result = OnScreenKeyboard(entered, 20,0);
|
||||
mainWindow->Append(&optionBrowser);
|
||||
if ( result == 1 ) {
|
||||
if (!strcmp(entered, Settings.unlockCode)) { //if password correct
|
||||
if (Settings.godmode == 0) {
|
||||
WindowPrompt(tr("Correct Password"),tr("All the features of USB Loader GX are unlocked."),tr("OK"));
|
||||
Settings.godmode = 1;
|
||||
}
|
||||
} else {
|
||||
WindowPrompt(tr("Wrong Password"),tr("USB Loader GX is protected"),tr("OK"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (shutdown == 1)
|
||||
Sys_Shutdown();
|
||||
if (reset == 1)
|
||||
Sys_Reboot();
|
||||
|
||||
if (poweroffBtn.GetState() == STATE_CLICKED) {
|
||||
choice = WindowPrompt (tr("Shutdown System"),tr("Are you sure?"),tr("Yes"),tr("No"));
|
||||
if (choice == 1) {
|
||||
Sys_Shutdown();
|
||||
}
|
||||
|
||||
} else if (exitBtn.GetState() == STATE_CLICKED) {
|
||||
choice = WindowPrompt (tr("Return to Wii Menu"),tr("Are you sure?"),tr("Yes"),tr("No"));
|
||||
if (choice == 1) {
|
||||
Sys_LoadMenu();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
HaltGui();
|
||||
|
||||
mainWindow->Remove(&optionBrowser);
|
||||
mainWindow->Remove(&w);
|
||||
ResumeGui();
|
||||
|
||||
return menu;
|
||||
}
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#include "menus.h"
|
||||
#include "menus.h"
|
||||
#include "fatmounter.h"
|
||||
#include "usbloader/usbstorage.h"
|
||||
#include "usbloader/utils.h"
|
||||
#include "usbloader/wbfs.h"
|
||||
#include "libwiigui/gui_customoptionbrowser.h"
|
||||
|
||||
extern int load_from_fs;
|
||||
extern char game_partition[6];
|
||||
|
||||
/****************************************************************************
|
||||
* MenuFormat
|
||||
***************************************************************************/
|
||||
int MenuFormat() {
|
||||
|
||||
USBDevice_deInit();
|
||||
sleep(1);
|
||||
|
||||
USBStorage_Init();
|
||||
|
||||
int menu = MENU_NONE;
|
||||
char imgPath[100];
|
||||
|
||||
customOptionList options(MAX_PARTITIONS_EX);
|
||||
extern PartList partitions;
|
||||
|
||||
u32 cnt, counter = 0;
|
||||
int choice, ret;
|
||||
char text[ISFS_MAXPATH];
|
||||
|
||||
//create the partitionlist
|
||||
for (cnt = 0; cnt < (u32) partitions.num; cnt++) {
|
||||
partitionEntry *entry = &partitions.pentry[cnt];
|
||||
|
||||
/* Calculate size in gigabytes */
|
||||
f32 size = entry->size * (partitions.sector_size / GB_SIZE);
|
||||
|
||||
if (size) {
|
||||
options.SetName(counter, "%s %d:",tr("Partition"), cnt+1);
|
||||
options.SetValue(counter,"%.2fGB", size);
|
||||
} else {
|
||||
options.SetName(counter, "%s %d:",tr("Partition"), cnt+1);
|
||||
options.SetValue(counter,tr("Can't be formatted"));
|
||||
}
|
||||
counter++;
|
||||
}
|
||||
|
||||
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, Settings.sfxvolume);
|
||||
// because destroy GuiSound must wait while sound playing is finished, we use a global sound
|
||||
if(!btnClick2) btnClick2=new GuiSound(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
|
||||
// GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
|
||||
snprintf(imgPath, sizeof(imgPath), "%swiimote_poweroff.png", CFG.theme_path);
|
||||
GuiImageData btnpwroff(imgPath, wiimote_poweroff_png);
|
||||
snprintf(imgPath, sizeof(imgPath), "%swiimote_poweroff_over.png", CFG.theme_path);
|
||||
GuiImageData btnpwroffOver(imgPath, wiimote_poweroff_over_png);
|
||||
snprintf(imgPath, sizeof(imgPath), "%smenu_button.png", CFG.theme_path);
|
||||
GuiImageData btnhome(imgPath, menu_button_png);
|
||||
snprintf(imgPath, sizeof(imgPath), "%smenu_button_over.png", CFG.theme_path);
|
||||
GuiImageData btnhomeOver(imgPath, menu_button_over_png);
|
||||
GuiImageData battery(battery_png);
|
||||
GuiImageData batteryBar(battery_bar_png);
|
||||
GuiImageData batteryRed(battery_red_png);
|
||||
GuiImageData batteryBarRed(battery_bar_red_png);
|
||||
|
||||
|
||||
GuiTrigger trigA;
|
||||
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
||||
GuiTrigger trigHome;
|
||||
trigHome.SetButtonOnlyTrigger(-1, WPAD_BUTTON_HOME | WPAD_CLASSIC_BUTTON_HOME, 0);
|
||||
GuiTrigger trigB;
|
||||
trigB.SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B);
|
||||
|
||||
GuiButton backBtn(0,0);
|
||||
backBtn.SetTrigger(&trigB);
|
||||
|
||||
GuiImage poweroffBtnImg(&btnpwroff);
|
||||
GuiImage poweroffBtnImgOver(&btnpwroffOver);
|
||||
poweroffBtnImg.SetWidescreen(CFG.widescreen);
|
||||
poweroffBtnImgOver.SetWidescreen(CFG.widescreen);
|
||||
GuiButton poweroffBtn(&poweroffBtnImg,&poweroffBtnImgOver, 0, 3, THEME.power_x, THEME.power_y, &trigA, &btnSoundOver, btnClick2,1);
|
||||
GuiImage exitBtnImg(&btnhome);
|
||||
GuiImage exitBtnImgOver(&btnhomeOver);
|
||||
exitBtnImg.SetWidescreen(CFG.widescreen);
|
||||
exitBtnImgOver.SetWidescreen(CFG.widescreen);
|
||||
GuiButton exitBtn(&exitBtnImg,&exitBtnImgOver, 0, 3, THEME.home_x, THEME.home_y, &trigA, &btnSoundOver, btnClick2,1);
|
||||
exitBtn.SetTrigger(&trigHome);
|
||||
|
||||
GuiCustomOptionBrowser optionBrowser(396, 280, &options, CFG.theme_path, "bg_options_settings.png", bg_options_settings_png, 0, 10);
|
||||
optionBrowser.SetPosition(0, 40);
|
||||
optionBrowser.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
|
||||
HaltGui();
|
||||
GuiWindow w(screenwidth, screenheight);
|
||||
w.Append(&poweroffBtn);
|
||||
w.Append(&backBtn);
|
||||
w.Append(&exitBtn);
|
||||
|
||||
mainWindow->Append(&w);
|
||||
mainWindow->Append(&optionBrowser);
|
||||
|
||||
ResumeGui();
|
||||
|
||||
while (menu == MENU_NONE) {
|
||||
|
||||
VIDEO_WaitVSync ();
|
||||
|
||||
ret = optionBrowser.GetClickedOption();
|
||||
|
||||
if(ret >= 0) {
|
||||
if(Settings.godmode == 1) {
|
||||
partitionEntry *entry = &partitions.pentry[ret];
|
||||
if (entry->size) {
|
||||
if (load_from_fs == PART_FS_FAT) {
|
||||
WBFS_OpenPart(partitions.pinfo[ret].part_fs, partitions.pinfo[ret].index, entry->sector,
|
||||
entry->size, (char *) &game_partition);
|
||||
load_from_fs = partitions.pinfo[ret].part_fs;
|
||||
menu = MENU_SETTINGS;
|
||||
|
||||
Settings.partition = ret;
|
||||
if(isInserted(bootDevice))cfg_save_global();
|
||||
} else {
|
||||
sprintf(text, "%s %d : %.2fGB",tr("Partition"), ret+1, entry->size * (partitions.sector_size / GB_SIZE));
|
||||
choice = WindowPrompt( tr("Do you want to format:"), text,tr("Yes"),tr("No"));
|
||||
if (choice == 1) {
|
||||
ret = FormatingPartition(tr("Formatting, please wait..."), entry);
|
||||
if (ret < 0) {
|
||||
WindowPrompt(tr("Error !"),tr("Failed formating"),tr("Return"));
|
||||
menu = MENU_SETTINGS;
|
||||
} else {
|
||||
sleep(1);
|
||||
ret = WBFS_Open();
|
||||
sprintf(text, "%s %s", text,tr("formatted!"));
|
||||
WindowPrompt(tr("Success:"),text,tr("OK"));
|
||||
if(ret < 0) {
|
||||
WindowPrompt(tr("ERROR"), tr("Failed to open partition"), tr("OK"));
|
||||
Sys_LoadMenu();
|
||||
}
|
||||
menu = MENU_SETTINGS;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if(Settings.godmode == 0) {
|
||||
mainWindow->Remove(&optionBrowser);
|
||||
char entered[20] = "";
|
||||
int result = OnScreenKeyboard(entered, 20,0);
|
||||
mainWindow->Append(&optionBrowser);
|
||||
if ( result == 1 ) {
|
||||
if (!strcmp(entered, Settings.unlockCode)) { //if password correct
|
||||
if (Settings.godmode == 0) {
|
||||
WindowPrompt(tr("Correct Password"),tr("All the features of USB Loader GX are unlocked."),tr("OK"));
|
||||
Settings.godmode = 1;
|
||||
}
|
||||
} else {
|
||||
WindowPrompt(tr("Wrong Password"),tr("USB Loader GX is protected"),tr("OK"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* if (shutdown == 1)
|
||||
Sys_Shutdown();
|
||||
if (reset == 1)
|
||||
Sys_Reboot();*/
|
||||
|
||||
if (poweroffBtn.GetState() == STATE_CLICKED) {
|
||||
choice = WindowPrompt (tr("Shutdown System"),tr("Are you sure?"),tr("Yes"),tr("No"));
|
||||
if (choice == 1) {
|
||||
Sys_Shutdown();
|
||||
}
|
||||
|
||||
} else if (exitBtn.GetState() == STATE_CLICKED) {
|
||||
choice = WindowPrompt (tr("Return to Wii Menu"),tr("Are you sure?"),tr("Yes"),tr("No"));
|
||||
if (choice == 1) {
|
||||
Sys_LoadMenu();
|
||||
}
|
||||
}
|
||||
else if (backBtn.GetState() == STATE_CLICKED) {
|
||||
menu = MENU_SETTINGS;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
HaltGui();
|
||||
|
||||
mainWindow->Remove(&optionBrowser);
|
||||
mainWindow->Remove(&w);
|
||||
ResumeGui();
|
||||
|
||||
return menu;
|
||||
}
|
||||
|
||||
|
@ -134,15 +134,6 @@ int MenuInstall() {
|
||||
menu = MENU_DISCLIST;
|
||||
break;
|
||||
}
|
||||
|
||||
if (shutdown == 1) {
|
||||
wiilight(0);
|
||||
Sys_Shutdown();
|
||||
}
|
||||
if (reset == 1) {
|
||||
wiilight(0);
|
||||
Sys_Reboot();
|
||||
}
|
||||
}
|
||||
|
||||
//Turn off the WiiLight
|
||||
|
@ -1,24 +1,31 @@
|
||||
#ifndef _MENUS_H
|
||||
#define _MENUS_H
|
||||
|
||||
#include "libwiigui/gui.h"
|
||||
#include "language/gettext.h"
|
||||
#include "prompts/PromptWindows.h"
|
||||
#include "menu.h"
|
||||
#include "gecko.h"
|
||||
#include "filelist.h"
|
||||
#include "sys.h"
|
||||
|
||||
extern void ResumeGui();
|
||||
extern void HaltGui();
|
||||
extern GuiWindow * mainWindow;
|
||||
extern GuiSound * bgMusic;
|
||||
extern u8 shutdown;
|
||||
extern u8 reset;
|
||||
|
||||
int MenuInstall();
|
||||
int MenuDiscList();
|
||||
int MenuFormat();
|
||||
int MenuCheck();
|
||||
|
||||
#endif // _MENUS_H
|
||||
#ifndef _MENUS_H
|
||||
#define _MENUS_H
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#include "libwiigui/gui.h"
|
||||
#include "language/gettext.h"
|
||||
#include "prompts/PromptWindows.h"
|
||||
#include "menu.h"
|
||||
#include "gecko.h"
|
||||
#include "filelist.h"
|
||||
#include "sys.h"
|
||||
|
||||
extern GuiWindow * mainWindow;
|
||||
extern GuiSound * bgMusic;
|
||||
extern u8 checkthreadState;
|
||||
extern u8 needToReloadGamelist;
|
||||
extern u8 hddOK;
|
||||
extern u8 mountMethod;
|
||||
|
||||
|
||||
int MenuInstall();
|
||||
int MenuDiscList();
|
||||
int MenuFormat();
|
||||
|
||||
extern void ResumeCheck();
|
||||
extern void HaltCheck();
|
||||
extern void InitCheckThread();
|
||||
extern void ExitCheckThread();
|
||||
|
||||
#endif // _MENUS_H
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "prompts/PromptWindows.h"
|
||||
#include "filelist.h"
|
||||
#include "menu.h"
|
||||
#include "../menu/menus.h"
|
||||
#include "usbloader/disc.h"
|
||||
#include "usbloader/fstfile.h"
|
||||
#include "usbloader/wdvd.h"
|
||||
@ -21,14 +22,8 @@
|
||||
#include "../gecko.h"
|
||||
#include "../patches/dvd_broadway.h"
|
||||
|
||||
/*** Extern functions ***/
|
||||
extern void ResumeGui();
|
||||
extern void HaltGui();
|
||||
|
||||
/*** Extern variables ***/
|
||||
extern GuiWindow * mainWindow;
|
||||
extern u8 shutdown;
|
||||
extern u8 reset;
|
||||
extern u8 mountMethod;
|
||||
|
||||
/********************************************************************************
|
||||
@ -50,7 +45,7 @@ int DiscBrowse(struct discHdr * header) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ret = Disc_Open();
|
||||
if (ret < 0) {
|
||||
ResumeGui();
|
||||
@ -71,7 +66,7 @@ int DiscBrowse(struct discHdr * header) {
|
||||
WindowPrompt(tr("ERROR:"), tr("Could not open WBFS partition"), tr("OK"));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int *buffer = (int*)allocate_memory(0x20);
|
||||
|
||||
if (buffer == NULL) {
|
||||
@ -86,7 +81,7 @@ int DiscBrowse(struct discHdr * header) {
|
||||
WindowPrompt(tr("ERROR:"), tr("Could not read the disc."), tr("OK"));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void *fstbuffer = allocate_memory(buffer[2]*4);
|
||||
FST_ENTRY *fst = (FST_ENTRY *)fstbuffer;
|
||||
|
||||
@ -204,11 +199,6 @@ int DiscBrowse(struct discHdr * header) {
|
||||
while (!exit) {
|
||||
VIDEO_WaitVSync();
|
||||
|
||||
if (shutdown == 1)
|
||||
Sys_Shutdown();
|
||||
if (reset == 1)
|
||||
Sys_Reboot();
|
||||
|
||||
ret = optionBrowser3.GetClickedOption();
|
||||
|
||||
if (ret > 0) {
|
||||
@ -244,29 +234,29 @@ int autoSelectDol(const char *id, bool force) {
|
||||
|
||||
char id4[10];
|
||||
sprintf(id4,"%c%c%c%c",id[0],id[1],id[2],id[3]);
|
||||
|
||||
|
||||
////// games that can be forced (always need alt dol)
|
||||
|
||||
//Boogie
|
||||
//Boogie
|
||||
if (strcmp(id,"RBOP69") == 0) return 675;//previous value was 657
|
||||
if (strcmp(id,"RBOE69") == 0) return 675;//starstremr
|
||||
|
||||
|
||||
//Fifa 08
|
||||
if (strcmp(id,"RF8E69") == 0) return 439;//from isostar
|
||||
if (strcmp(id,"RF8P69") == 0) return 463;//from isostar
|
||||
if (strcmp(id,"RF8X69") == 0) return 464;//from isostar
|
||||
|
||||
|
||||
//Madden NFL07
|
||||
if (strcmp(id,"RMDP69") == 0) return 39;//from isostar
|
||||
|
||||
|
||||
//Madden NFL08
|
||||
if (strcmp(id,"RNFP69") == 0) return 1079;//from isostar
|
||||
|
||||
|
||||
//Medal of Honor: Heroes 2
|
||||
if (strcmp(id,"RM2X69") == 0)return 601;//dj_skual
|
||||
if (strcmp(id,"RM2P69") == 0)return 517;//MZottel
|
||||
if (strcmp(id,"RM2E69") == 0) return 492;//Old8oy
|
||||
|
||||
if (strcmp(id,"RM2E69") == 0) return 492;//Old8oy
|
||||
|
||||
//Mortal Kombat
|
||||
if (strcmp(id,"RKMP5D") == 0) return 290;//from isostar
|
||||
if (strcmp(id,"RKME5D") == 0) return 290;//starstremr
|
||||
@ -276,7 +266,7 @@ int autoSelectDol(const char *id, bool force) {
|
||||
|
||||
//Pangya! Golf with Style
|
||||
if (strcmp(id,"RPYP9B") == 0) return 12490;//from isostar
|
||||
|
||||
|
||||
//Redsteel
|
||||
if (strcmp(id,"REDP41") == 0) return 1957;//from isostar
|
||||
if (strcmp(id,"REDE41") == 0) return 1957;//starstremr
|
||||
@ -284,37 +274,37 @@ int autoSelectDol(const char *id, bool force) {
|
||||
//SSX
|
||||
if (strcmp(id,"RSXP69") == 0) return 377;//previous value was 337
|
||||
if (strcmp(id,"RSXE69") == 0) return 377;//previous value was 337
|
||||
|
||||
|
||||
//Wii Sports Resort, needs alt dol one time only, to show the Motion Plus video
|
||||
//if (strcmp(id,"RZTP01") == 0 && CheckForSave(id4)==0) return 952;//from isostar
|
||||
//if (strcmp(id,"RZTE01") == 0 && CheckForSave(id4)==0) return 674;//from starstremr
|
||||
//as well as Grand Slam Tennis, Tiger Woods 10, Virtual Tennis 2009
|
||||
|
||||
|
||||
///// games that can't be forced (alt dol is not always needed)
|
||||
if (!force) {
|
||||
|
||||
|
||||
//Grand Slam Tennis
|
||||
if (strcmp(id,"R5TP69") == 0) return 1493;//from isostar
|
||||
if (strcmp(id,"R5TE69") == 0) return 1493;//starstremr
|
||||
|
||||
|
||||
//Medal of Honor Heroes
|
||||
if (strcmp(id,"RMZX69") == 0) return 492;//from isostar
|
||||
if (strcmp(id,"RMZP69") == 0) return 492;//from isostar
|
||||
if (strcmp(id,"RMZE69") == 0) return 492;//starstremr
|
||||
|
||||
if (strcmp(id,"RMZE69") == 0) return 492;//starstremr
|
||||
|
||||
//Tiger Woods 10
|
||||
if (strcmp(id,"R9OP69") == 0) return 1991;//from isostar
|
||||
if (strcmp(id,"R9OE69") == 0) return 1973;//starstremr
|
||||
|
||||
|
||||
//Virtual Tennis 2009
|
||||
if (strcmp(id,"RVUP8P") == 0) return 16426;//from isostar
|
||||
if (strcmp(id,"RVUE8P") == 0) return 16405;//from isostar
|
||||
|
||||
|
||||
//Wii Sports Resort
|
||||
if (strcmp(id,"RZTP01") == 0) return 952;//from isostar
|
||||
if (strcmp(id,"RZTE01") == 0) return 674;//from starstremr
|
||||
}
|
||||
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -323,7 +313,7 @@ int autoSelectDolMenu(const char *id, bool force) {
|
||||
/*
|
||||
char id4[10];
|
||||
sprintf(id4,"%c%c%c%c",id[0],id[1],id[2],id[3]);
|
||||
|
||||
|
||||
switch (CheckForSave(id4)) {
|
||||
case 0:
|
||||
WindowPrompt(tr("NO save"),0,tr("OK"));
|
||||
@ -339,7 +329,7 @@ int autoSelectDolMenu(const char *id, bool force) {
|
||||
}
|
||||
return -1;
|
||||
*/
|
||||
|
||||
|
||||
//Indiana Jones and the Staff of Kings (Fate of Atlantis)
|
||||
if (strcmp(id,"RJ8E64") == 0) {
|
||||
int choice = WindowPrompt(tr("Select a DOL"), 0, "Fate of Atlantis", tr("Default"));
|
||||
@ -365,7 +355,7 @@ int autoSelectDolMenu(const char *id, bool force) {
|
||||
}
|
||||
return choice;
|
||||
}
|
||||
|
||||
|
||||
//Metal Slug Anthology (Metal Slug 6)
|
||||
if (strcmp(id,"RMLEH4") == 0) {
|
||||
int choice = WindowPrompt(tr("Select a DOL"), 0, "Metal Slug 6", tr("Default"));
|
||||
@ -391,7 +381,7 @@ int autoSelectDolMenu(const char *id, bool force) {
|
||||
}
|
||||
return choice;
|
||||
}
|
||||
|
||||
|
||||
//Metroid Prime Trilogy
|
||||
if (strcmp(id,"R3ME01") == 0) {
|
||||
//do not use any alt dol if there is no save game in the nand
|
||||
@ -442,7 +432,7 @@ int autoSelectDolMenu(const char *id, bool force) {
|
||||
}
|
||||
return choice;
|
||||
}
|
||||
|
||||
|
||||
//Rampage: Total Destruction (M1.dol=Rampage, jarvos.dol=Rampage World Tour)
|
||||
if (strcmp(id,"RPGP5D") == 0) {
|
||||
int choice = WindowPrompt(tr("Select a DOL"), 0, "Rampage", "World Tour", tr("Default"));
|
||||
@ -459,7 +449,7 @@ int autoSelectDolMenu(const char *id, bool force) {
|
||||
}
|
||||
return choice;
|
||||
}
|
||||
|
||||
|
||||
//The House Of The Dead 2 & 3 Return (only to play 2)
|
||||
if (strcmp(id,"RHDE8P") == 0) {
|
||||
int choice = WindowPrompt(tr("Select a DOL"), 0, "HotD 2", tr("Default"));
|
||||
@ -501,11 +491,11 @@ void __dvd_readidcb(s32 result)
|
||||
dvddone = result;
|
||||
}
|
||||
|
||||
u8 DiscMount(discHdr *header) {
|
||||
u8 DiscMount1(discHdr *header) {
|
||||
gprintf("\nDiscMount() ");
|
||||
int ret;
|
||||
HaltGui();
|
||||
|
||||
|
||||
u8 *tmpBuff = (u8 *) malloc(0x60);
|
||||
memcpy(tmpBuff, g_diskID, 0x60); // Make a backup of the first 96 bytes at 0x80000000
|
||||
|
||||
@ -513,7 +503,7 @@ u8 DiscMount(discHdr *header) {
|
||||
dvddone = 0;
|
||||
ret = bwDVD_LowReset(__dvd_readidcb);
|
||||
while(ret>=0 && dvddone==0);
|
||||
|
||||
|
||||
dvddone = 0;
|
||||
ret = bwDVD_LowReadID(g_diskID, __dvd_readidcb); // Leave this one here, or you'll get an IOCTL error
|
||||
while(ret>=0 && dvddone==0);
|
||||
@ -521,15 +511,65 @@ u8 DiscMount(discHdr *header) {
|
||||
dvddone = 0;
|
||||
ret = bwDVD_LowUnencryptedRead(g_diskID, 0x60, 0x00, __dvd_readidcb); // Overwrite the g_diskID thing
|
||||
while(ret>=0 && dvddone==0);
|
||||
|
||||
|
||||
memcpy(header, g_diskID, 0x60);
|
||||
memcpy(g_diskID, tmpBuff, 0x60); // Put the backup back, or games won't load
|
||||
free(tmpBuff);
|
||||
|
||||
|
||||
|
||||
ResumeGui();
|
||||
if (dvddone != 1) {
|
||||
return 0;
|
||||
}
|
||||
return (header->magic == 0x5D1C9EA3) ? 1 : 2; // Don't check gamecube magic (0xC2339F3D)
|
||||
}
|
||||
|
||||
u8 DiscMount(discHdr *header) {
|
||||
gprintf("\nDiscMount() ");
|
||||
|
||||
HaltGui();
|
||||
GuiWindow w(screenwidth, screenheight);
|
||||
|
||||
mainWindow->Append(&w);
|
||||
|
||||
ResumeGui();
|
||||
|
||||
//HaltCheck();
|
||||
int ret = Disc_SetUSB(NULL);
|
||||
ret = WDVD_Close();
|
||||
ret = Disc_Init();
|
||||
|
||||
|
||||
|
||||
|
||||
ret = DiscWait(tr("Insert Disk"),tr("Waiting..."),tr("Cancel"),0,0);
|
||||
if (ret < 0) {
|
||||
WindowPrompt (tr("Error reading Disc"),0,tr("Back"));
|
||||
goto OUT;
|
||||
}
|
||||
mainWindow->SetState(STATE_DISABLED);
|
||||
//gprintf("..1");
|
||||
ret = Disc_Open();
|
||||
if (ret < 0) {
|
||||
WindowPrompt (tr("Could not open Disc"),0,tr("Back"));
|
||||
goto OUT;
|
||||
}
|
||||
//gprintf("..2");
|
||||
Disc_ReadHeader(header);
|
||||
//gprintf("..3");
|
||||
ret = Disc_IsWii();
|
||||
//gprintf("..4");
|
||||
//ResumeCheck();
|
||||
if (ret < 0) {
|
||||
ret = 2;
|
||||
}
|
||||
ret = 1;
|
||||
|
||||
|
||||
OUT:
|
||||
HaltGui();
|
||||
mainWindow->Remove(&w);
|
||||
mainWindow->SetState(STATE_DEFAULT);
|
||||
ResumeGui();
|
||||
return ret;
|
||||
}
|
||||
|
@ -40,10 +40,6 @@ static time_t start;
|
||||
extern GuiWindow * mainWindow;
|
||||
extern float gamesize;
|
||||
|
||||
/*** Extern functions ***/
|
||||
extern void ResumeGui();
|
||||
extern void HaltGui();
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* GameInstallProgress
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include "fatmounter.h"
|
||||
#include "listfiles.h"
|
||||
#include "menu.h"
|
||||
#include "menu.h"
|
||||
#include "filelist.h"
|
||||
#include "sys.h"
|
||||
#include "wpad.h"
|
||||
@ -53,15 +52,10 @@ extern u32 gameCnt;
|
||||
extern s32 gameSelected, gameStart;
|
||||
extern float gamesize;
|
||||
extern struct discHdr * gameList;
|
||||
extern u8 shutdown;
|
||||
extern u8 reset;
|
||||
extern u8 mountMethod;
|
||||
extern struct discHdr *dvdheader;
|
||||
extern char game_partition[6];
|
||||
|
||||
/*** Extern functions ***/
|
||||
extern void ResumeGui();
|
||||
extern void HaltGui();
|
||||
extern u8 shutdown;
|
||||
|
||||
/****************************************************************************
|
||||
* OnScreenNumpad
|
||||
@ -71,9 +65,9 @@ extern void HaltGui();
|
||||
***************************************************************************/
|
||||
int OnScreenNumpad(char * var, u32 maxlen) {
|
||||
int save = -1;
|
||||
|
||||
|
||||
GuiNumpad numpad(var, maxlen);
|
||||
|
||||
|
||||
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, Settings.sfxvolume);
|
||||
// because destroy GuiSound must wait while sound playing is finished, we use a global sound
|
||||
if(!btnClick2) btnClick2=new GuiSound(button_click2_pcm, button_click2_pcm_size,Settings.sfxvolume);
|
||||
@ -104,7 +98,7 @@ int OnScreenNumpad(char * var, u32 maxlen) {
|
||||
GuiButton cancelBtn(&cancelBtnImg,&cancelBtnImg, 1, 4, -5, -15, &trigA, &btnSoundOver, btnClick2,1);
|
||||
cancelBtn.SetLabel(&cancelBtnTxt);
|
||||
cancelBtn.SetTrigger(&trigB);
|
||||
|
||||
|
||||
numpad.Append(&okBtn);
|
||||
numpad.Append(&cancelBtn);
|
||||
|
||||
@ -132,7 +126,7 @@ int OnScreenNumpad(char * var, u32 maxlen) {
|
||||
mainWindow->SetState(STATE_DEFAULT);
|
||||
ResumeGui();
|
||||
gprintf("\t%s",(save == 1?"saved":"discarded"));
|
||||
return save;
|
||||
return save;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@ -696,17 +690,9 @@ int WindowPrompt(const char *title, const char *msg, const char *btn1Label,
|
||||
|
||||
}
|
||||
|
||||
GuiTrigger trigZ;
|
||||
trigZ.SetButtonOnlyTrigger(-1, WPAD_NUNCHUK_BUTTON_Z | WPAD_CLASSIC_BUTTON_ZL, PAD_TRIGGER_Z);
|
||||
|
||||
GuiButton screenShotBtn(0,0);
|
||||
screenShotBtn.SetPosition(0,0);
|
||||
screenShotBtn.SetTrigger(&trigZ);
|
||||
|
||||
promptWindow.Append(&dialogBoxImg);
|
||||
promptWindow.Append(&titleTxt);
|
||||
promptWindow.Append(&msgTxt);
|
||||
promptWindow.Append(&screenShotBtn);
|
||||
|
||||
if (btn1Label)
|
||||
promptWindow.Append(&btn1);
|
||||
@ -726,12 +712,7 @@ int WindowPrompt(const char *title, const char *msg, const char *btn1Label,
|
||||
|
||||
while (choice == -1) {
|
||||
VIDEO_WaitVSync();
|
||||
if (shutdown == 1) {
|
||||
wiilight(0);
|
||||
Sys_Shutdown();
|
||||
}
|
||||
if (reset == 1)
|
||||
Sys_Reboot();
|
||||
|
||||
if (btn1.GetState() == STATE_CLICKED) {
|
||||
choice = 1;
|
||||
} else if (btn2.GetState() == STATE_CLICKED) {
|
||||
@ -746,12 +727,7 @@ int WindowPrompt(const char *title, const char *msg, const char *btn1Label,
|
||||
choice = 3;
|
||||
} else if (btn4.GetState() == STATE_CLICKED) {
|
||||
choice = 0;
|
||||
} else if (screenShotBtn.GetState() == STATE_CLICKED) {
|
||||
gprintf("\n\tscreenShotBtn clicked");
|
||||
screenShotBtn.ResetState();
|
||||
ScreenShot();
|
||||
gprintf("...It's easy, mmmmmmKay");
|
||||
}
|
||||
}
|
||||
if (count>0)count--;
|
||||
if (count==0) choice = 1;
|
||||
}
|
||||
@ -978,12 +954,9 @@ int WindowExitPrompt()
|
||||
}
|
||||
|
||||
|
||||
if (shutdown == 1) {
|
||||
if (shutdown == 1)
|
||||
wiilight(0);
|
||||
Sys_Shutdown();
|
||||
}
|
||||
if (reset == 1)
|
||||
Sys_Reboot();
|
||||
|
||||
if (btn1.GetState() == STATE_CLICKED) {
|
||||
choice = 1;
|
||||
btn1.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 50);
|
||||
@ -1138,12 +1111,6 @@ int GameWindowPrompt() {
|
||||
trigPlus.SetButtonOnlyTrigger(-1, WPAD_BUTTON_PLUS | WPAD_CLASSIC_BUTTON_PLUS, 0);
|
||||
GuiTrigger trigMinus;
|
||||
trigMinus.SetButtonOnlyTrigger(-1, WPAD_BUTTON_MINUS | WPAD_CLASSIC_BUTTON_MINUS, 0);
|
||||
GuiTrigger trigZ;
|
||||
trigZ.SetButtonOnlyTrigger(-1, WPAD_NUNCHUK_BUTTON_Z | WPAD_CLASSIC_BUTTON_ZL, PAD_TRIGGER_Z);
|
||||
|
||||
GuiButton screenShotBtn(0,0);
|
||||
screenShotBtn.SetPosition(0,0);
|
||||
screenShotBtn.SetTrigger(&trigZ);
|
||||
|
||||
if (CFG.widescreen)
|
||||
snprintf(imgPath, sizeof(imgPath), "%swdialogue_box_startgame.png", CFG.theme_path);
|
||||
@ -1274,7 +1241,6 @@ int GameWindowPrompt() {
|
||||
promptWindow.Append(&dialogBoxImg);
|
||||
promptWindow.Append(&nameBtn);
|
||||
promptWindow.Append(&playcntTxt);
|
||||
promptWindow.Append(&screenShotBtn);
|
||||
promptWindow.Append(&btn2);
|
||||
if (!mountMethod)//stuff we don't show if it is a DVD mounted
|
||||
{
|
||||
@ -1295,7 +1261,7 @@ int GameWindowPrompt() {
|
||||
|
||||
promptWindow.Append(&diskImg2);
|
||||
promptWindow.Append(&btn1);
|
||||
|
||||
|
||||
short changed = -1;
|
||||
GuiImageData * diskCover = NULL;
|
||||
GuiImageData * diskCover2 = NULL;
|
||||
@ -1452,19 +1418,6 @@ int GameWindowPrompt() {
|
||||
|
||||
diskImg.SetSpin(btn1.GetState() == STATE_SELECTED);
|
||||
diskImg2.SetSpin(btn1.GetState() == STATE_SELECTED);
|
||||
if (shutdown == 1) { //for power button
|
||||
promptWindow.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 50);
|
||||
mainWindow->SetState(STATE_DEFAULT);
|
||||
while (promptWindow.GetEffect() > 0) usleep(50);
|
||||
HaltGui();
|
||||
mainWindow->Remove(&promptWindow);
|
||||
ResumeGui();
|
||||
wiilight(0);
|
||||
Sys_Shutdown();
|
||||
}
|
||||
|
||||
if (reset == 1) //for reset button
|
||||
Sys_Reboot();
|
||||
|
||||
if(gameSound)
|
||||
{
|
||||
@ -1544,12 +1497,6 @@ int GameWindowPrompt() {
|
||||
}
|
||||
btnFavorite5.ResetState();
|
||||
}
|
||||
else if (screenShotBtn.GetState() == STATE_CLICKED) {
|
||||
gprintf("\n\tscreenShotBtn clicked");
|
||||
screenShotBtn.ResetState();
|
||||
ScreenShot();
|
||||
gprintf("...It's easy, mmmmmmKay");
|
||||
}
|
||||
// this next part is long because nobody could agree on what the left/right buttons should do
|
||||
else if ((btnRight.GetState() == STATE_CLICKED) && (Settings.xflip == no)) {//next game
|
||||
promptWindow.SetEffect(EFFECT_SLIDE_RIGHT | EFFECT_SLIDE_OUT, 50);
|
||||
@ -2768,7 +2715,7 @@ int ProgressUpdateWindow() {
|
||||
} else {
|
||||
filesize = download_request("http://www.techjawa.com/usbloadergx/ULNR.file");//for some reason it didn't download completely when saved as a wad.
|
||||
}
|
||||
|
||||
|
||||
if (filesize > 0) {
|
||||
|
||||
pfile = fopen(dolpath, "wb");//here we save the txt as a wad
|
||||
@ -2887,7 +2834,7 @@ int ProgressUpdateWindow() {
|
||||
|
||||
return 1;
|
||||
}
|
||||
#else
|
||||
#else
|
||||
int ProgressUpdateWindow() {
|
||||
|
||||
gprintf("\nProgressUpdateWindow(not full channel)");
|
||||
@ -3051,7 +2998,7 @@ int ProgressUpdateWindow() {
|
||||
promptWindow.Append(&progressbarOutlineImg);
|
||||
promptWindow.Append(&prTxt);
|
||||
msgTxt.SetTextf("%s Rev%i", tr("Update to"), newrev);
|
||||
|
||||
|
||||
s32 filesize;
|
||||
if (Settings.beta_upgrades) {
|
||||
char url[255];
|
||||
@ -3569,14 +3516,6 @@ HBCWindowPrompt(const char *name, const char *coder, const char *version,
|
||||
btn2.SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
|
||||
btn2.SetPosition(-40, 2);
|
||||
|
||||
GuiTrigger trigZ;
|
||||
trigZ.SetButtonOnlyTrigger(-1, WPAD_NUNCHUK_BUTTON_Z | WPAD_CLASSIC_BUTTON_ZL, PAD_TRIGGER_Z);
|
||||
|
||||
GuiButton screenShotBtn(0,0);
|
||||
screenShotBtn.SetPosition(0,0);
|
||||
screenShotBtn.SetTrigger(&trigZ);
|
||||
promptWindow.Append(&screenShotBtn);
|
||||
|
||||
promptWindow.Append(&dialogBoxImg);
|
||||
if (strcmp(long_description,""))promptWindow.Append(&whiteBoxImg);
|
||||
if (strcmp(long_description,""))promptWindow.Append(&scrollbarImg);
|
||||
@ -3603,23 +3542,15 @@ HBCWindowPrompt(const char *name, const char *coder, const char *version,
|
||||
|
||||
while (choice == -1) {
|
||||
VIDEO_WaitVSync();
|
||||
if (shutdown == 1) {
|
||||
|
||||
if (shutdown == 1)
|
||||
wiilight(0);
|
||||
Sys_Shutdown();
|
||||
}
|
||||
if (reset == 1)
|
||||
Sys_Reboot();
|
||||
|
||||
if (btn1.GetState() == STATE_CLICKED) {
|
||||
choice = 1;
|
||||
} else if (btn2.GetState() == STATE_CLICKED) {
|
||||
choice = 0;
|
||||
}
|
||||
else if (screenShotBtn.GetState() == STATE_CLICKED) {
|
||||
gprintf("\n\tscreenShotBtn clicked");
|
||||
screenShotBtn.ResetState();
|
||||
ScreenShot();
|
||||
gprintf("...It's easy, mmmmmmKay");
|
||||
}
|
||||
else if ((arrowUpBtn.GetState()==STATE_CLICKED||arrowUpBtn.GetState()==STATE_HELD) ) {
|
||||
if (long_descriptionTxt.GetFirstLine()>1)
|
||||
long_descriptionTxt.SetFirstLine(long_descriptionTxt.GetFirstLine()-1);
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "settings/cfg.h"
|
||||
#include "sys.h"
|
||||
#include "menu.h"
|
||||
#include "../menu/menus.h"
|
||||
#include "audio.h"
|
||||
#include "wad/wad.h"
|
||||
#include "xml/xml.h"
|
||||
@ -37,14 +38,8 @@ u32 titleCnt;
|
||||
extern struct discHdr * gameList;
|
||||
extern u32 gameCnt;
|
||||
|
||||
/*** Extern functions ***/
|
||||
extern void ResumeGui();
|
||||
extern void HaltGui();
|
||||
|
||||
/*** Extern variables ***/
|
||||
extern GuiWindow * mainWindow;
|
||||
extern u8 shutdown;
|
||||
extern u8 reset;
|
||||
extern u32 infilesize;
|
||||
extern wchar_t *gameFilter;
|
||||
|
||||
@ -123,7 +118,7 @@ int TitleBrowser(u32 type) {
|
||||
char line[200];
|
||||
char tmp[50];
|
||||
snprintf(tmp,50," ");
|
||||
|
||||
|
||||
//check if the content.bin is on the SD card for that game
|
||||
//if there is content.bin,then the game is on the SDmenu and not the wii
|
||||
sprintf(line,"SD:/private/wii/title/%s/content.bin",text);
|
||||
@ -295,16 +290,8 @@ int TitleBrowser(u32 type) {
|
||||
wifiBtn.SetAlpha(80);
|
||||
wifiBtn.SetTrigger(&trigA);
|
||||
|
||||
GuiTrigger trigZ;
|
||||
trigZ.SetButtonOnlyTrigger(-1, WPAD_NUNCHUK_BUTTON_Z | WPAD_CLASSIC_BUTTON_ZL, PAD_TRIGGER_Z);
|
||||
|
||||
GuiButton screenShotBtn(0,0);
|
||||
screenShotBtn.SetPosition(0,0);
|
||||
screenShotBtn.SetTrigger(&trigZ);
|
||||
|
||||
HaltGui();
|
||||
GuiWindow w(screenwidth, screenheight);
|
||||
w.Append(&screenShotBtn);
|
||||
w.Append(&settingsbackgroundbtn);
|
||||
w.Append(&titleTxt);
|
||||
w.Append(&cancelBtn);
|
||||
@ -320,12 +307,7 @@ int TitleBrowser(u32 type) {
|
||||
while (!exit) {
|
||||
VIDEO_WaitVSync();
|
||||
|
||||
if (shutdown == 1)
|
||||
Sys_Shutdown();
|
||||
if (reset == 1)
|
||||
Sys_Reboot();
|
||||
|
||||
else if (wifiBtn.GetState() == STATE_CLICKED) {
|
||||
if (wifiBtn.GetState() == STATE_CLICKED) {
|
||||
|
||||
ResumeNetworkWait();
|
||||
wifiBtn.ResetState();
|
||||
@ -418,7 +400,7 @@ int TitleBrowser(u32 type) {
|
||||
char temp[50];
|
||||
char filepath[100];
|
||||
u32 read = 0;
|
||||
|
||||
|
||||
//make sure there is a folder for this to be saved in
|
||||
struct stat st;
|
||||
snprintf(filepath, sizeof(filepath), "%s/wad/", bootDevice);
|
||||
@ -428,7 +410,7 @@ int TitleBrowser(u32 type) {
|
||||
}
|
||||
}
|
||||
snprintf(filepath, sizeof(filepath), "%s/wad/tmp.tmp", bootDevice);
|
||||
|
||||
|
||||
|
||||
if (infilesize < MB_SIZE)
|
||||
snprintf(filesizetxt, sizeof(filesizetxt), tr("Incoming file %0.2fKB"), infilesize/KB_SIZE);
|
||||
@ -512,9 +494,9 @@ int TitleBrowser(u32 type) {
|
||||
w.Remove(&wifiBtn);
|
||||
w.Remove(&optionBrowser3);
|
||||
ResumeGui();
|
||||
|
||||
|
||||
Wad_Install(file);
|
||||
|
||||
|
||||
HaltGui();
|
||||
w.Append(&titleTxt);
|
||||
w.Append(&cancelBtn);
|
||||
@ -547,12 +529,6 @@ int TitleBrowser(u32 type) {
|
||||
exit = true;
|
||||
ret = -10;
|
||||
}
|
||||
else if (screenShotBtn.GetState() == STATE_CLICKED) {
|
||||
gprintf("\n\tscreenShotBtn clicked");
|
||||
screenShotBtn.ResetState();
|
||||
ScreenShot();
|
||||
gprintf("...It's easy, mmmmmmKay");
|
||||
}
|
||||
}
|
||||
|
||||
CloseConnection();
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include <algorithm>
|
||||
|
||||
#include "menu.h"
|
||||
#include "../menu/menus.h"
|
||||
|
||||
#include "listfiles.h"
|
||||
#include "language/gettext.h"
|
||||
@ -27,15 +28,10 @@
|
||||
#include "libwiigui/gui.h"
|
||||
#include "sys.h"
|
||||
#include "filebrowser.h"
|
||||
#include "../menu.h"
|
||||
|
||||
/*** Extern variables ***/
|
||||
extern GuiWindow * mainWindow;
|
||||
extern u8 shutdown;
|
||||
extern u8 reset;
|
||||
|
||||
/*** Extern functions ***/
|
||||
extern void ResumeGui();
|
||||
extern void HaltGui();
|
||||
|
||||
static int curDevice = -1;
|
||||
static std::vector<BROWSERINFO> browsers;
|
||||
@ -317,7 +313,7 @@ int BrowseDevice(char * Path, int Path_size, int Flags, FILTERCASCADE *Filter/*=
|
||||
folderBtn.SetImage(&folderImg);
|
||||
folderBtn.SetTrigger(&trigA);
|
||||
folderBtn.SetEffectGrow();
|
||||
|
||||
|
||||
char imgPath[100];
|
||||
snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", CFG.theme_path);
|
||||
GuiImageData btnOutline(imgPath, button_dialogue_box_png);
|
||||
@ -393,12 +389,6 @@ int BrowseDevice(char * Path, int Path_size, int Flags, FILTERCASCADE *Filter/*=
|
||||
while (menu == MENU_NONE) {
|
||||
VIDEO_WaitVSync();
|
||||
|
||||
if (shutdown == 1)
|
||||
Sys_Shutdown();
|
||||
|
||||
if (reset == 1)
|
||||
Sys_Reboot();
|
||||
|
||||
for (i=0; i<FILEBROWSERSIZE; i++) {
|
||||
if (fileBrowser.fileList[i]->GetState() == STATE_CLICKED) {
|
||||
fileBrowser.fileList[i]->ResetState();
|
||||
@ -486,7 +476,7 @@ int BrowseDevice(char * Path, int Path_size, int Flags, FILTERCASCADE *Filter/*=
|
||||
char oldfolder[100];
|
||||
snprintf(newfolder, sizeof(newfolder), "%s%s", browser->rootdir, browser->dir);
|
||||
strcpy(oldfolder,newfolder);
|
||||
|
||||
|
||||
int result = OnScreenKeyboard(newfolder, sizeof(newfolder), strlen(browser->rootdir));
|
||||
if ( result == 1 ) {
|
||||
unsigned int len = strlen(newfolder);
|
||||
|
@ -19,22 +19,18 @@
|
||||
#include "gameinfo.h"
|
||||
#include "usbloader/getentries.h"
|
||||
#include "../gecko.h"
|
||||
#include "../menu.h"
|
||||
#include "../menu/menus.h"
|
||||
|
||||
|
||||
/*** Extern variables ***/
|
||||
extern GuiWindow * mainWindow;
|
||||
extern GuiSound * bgMusic;
|
||||
extern u8 shutdown;
|
||||
extern u8 reset;
|
||||
extern struct gameXMLinfo gameinfo;
|
||||
extern struct gameXMLinfo gameinfo_reset;
|
||||
extern u32 gameCnt;
|
||||
extern struct discHdr * gameList;
|
||||
|
||||
/*** Extern functions ***/
|
||||
extern void ResumeGui();
|
||||
extern void HaltGui();
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* gameinfo
|
||||
@ -714,7 +710,7 @@ int showGameInfo(char *ID) {
|
||||
snprintf(linebuf, sizeof(linebuf), "%s:",tr("WiFi Features"));
|
||||
} else {
|
||||
strcpy(linebuf,"");
|
||||
}
|
||||
}
|
||||
wifiTxt[0] = new GuiText(linebuf, 16, (GXColor) {0,0,0, 255});
|
||||
wifiTxt[0]->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
||||
wifiTxt[0]->SetPosition(205,200+wifiY);
|
||||
@ -781,13 +777,6 @@ int showGameInfo(char *ID) {
|
||||
|
||||
gameinfoWindow.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_IN, 100);
|
||||
|
||||
GuiTrigger trigZ;
|
||||
trigZ.SetButtonOnlyTrigger(-1, WPAD_NUNCHUK_BUTTON_Z | WPAD_CLASSIC_BUTTON_ZL, PAD_TRIGGER_Z);
|
||||
|
||||
GuiButton screenShotBtn(0,0);
|
||||
screenShotBtn.SetPosition(0,0);
|
||||
screenShotBtn.SetTrigger(&trigZ);
|
||||
gameinfoWindow.Append(&screenShotBtn);
|
||||
HaltGui();
|
||||
//mainWindow->SetState(STATE_DISABLED);
|
||||
mainWindow->Append(&gameinfoWindow);
|
||||
@ -799,13 +788,8 @@ int showGameInfo(char *ID) {
|
||||
while (choice == -1) {
|
||||
|
||||
VIDEO_WaitVSync();
|
||||
if (shutdown == 1) {
|
||||
wiilight(0);
|
||||
Sys_Shutdown();
|
||||
} else if (reset == 1)
|
||||
Sys_Reboot();
|
||||
|
||||
else if ((backBtn.GetState()==STATE_CLICKED)||(backBtn.GetState()==STATE_HELD)) {
|
||||
if ((backBtn.GetState()==STATE_CLICKED)||(backBtn.GetState()==STATE_HELD)) {
|
||||
backBtn.ResetState();
|
||||
if (page==1) {
|
||||
choice=1;
|
||||
@ -816,13 +800,11 @@ int showGameInfo(char *ID) {
|
||||
gameinfoWindow2.Remove(&nextBtn);
|
||||
gameinfoWindow2.Remove(&backBtn);
|
||||
gameinfoWindow2.Remove(&homeBtn);
|
||||
gameinfoWindow2.Remove(&screenShotBtn);
|
||||
gameinfoWindow2.SetVisible(false);
|
||||
gameinfoWindow.SetVisible(true);
|
||||
gameinfoWindow.Append(&backBtn);
|
||||
gameinfoWindow.Append(&nextBtn);
|
||||
gameinfoWindow.Append(&homeBtn);
|
||||
gameinfoWindow.Append(&screenShotBtn);
|
||||
mainWindow->Remove(&gameinfoWindow2);
|
||||
ResumeGui();
|
||||
page=1;
|
||||
@ -835,14 +817,12 @@ int showGameInfo(char *ID) {
|
||||
gameinfoWindow.Remove(&nextBtn);
|
||||
gameinfoWindow.Remove(&backBtn);
|
||||
gameinfoWindow.Remove(&homeBtn);
|
||||
gameinfoWindow.Remove(&screenShotBtn);
|
||||
gameinfoWindow.SetVisible(false);
|
||||
gameinfoWindow2.SetVisible(true);
|
||||
coverImg->SetPosition(15,30);
|
||||
gameinfoWindow2.Append(&nextBtn);
|
||||
gameinfoWindow2.Append(&backBtn);
|
||||
gameinfoWindow2.Append(&homeBtn);
|
||||
gameinfoWindow2.Append(&screenShotBtn);
|
||||
mainWindow->Append(&gameinfoWindow2);
|
||||
ResumeGui();
|
||||
page=2;
|
||||
@ -851,13 +831,11 @@ int showGameInfo(char *ID) {
|
||||
gameinfoWindow2.Remove(&nextBtn);
|
||||
gameinfoWindow2.Remove(&backBtn);
|
||||
gameinfoWindow2.Remove(&homeBtn);
|
||||
gameinfoWindow2.Remove(&screenShotBtn);
|
||||
gameinfoWindow2.SetVisible(false);
|
||||
gameinfoWindow.SetVisible(true);
|
||||
gameinfoWindow.Append(&backBtn);
|
||||
gameinfoWindow.Append(&nextBtn);
|
||||
gameinfoWindow.Append(&homeBtn);
|
||||
gameinfoWindow.Append(&screenShotBtn);
|
||||
mainWindow->Remove(&gameinfoWindow2);
|
||||
ResumeGui();
|
||||
page=1;
|
||||
@ -916,12 +894,6 @@ int showGameInfo(char *ID) {
|
||||
}
|
||||
urlBtn.ResetState();
|
||||
}
|
||||
else if (screenShotBtn.GetState() == STATE_CLICKED) {
|
||||
gprintf("\n\tscreenShotBtn clicked");
|
||||
screenShotBtn.ResetState();
|
||||
ScreenShot();
|
||||
gprintf("...It's easy, mmmmmmKay");
|
||||
}
|
||||
}
|
||||
if (page==1) {
|
||||
gameinfoWindow.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_OUT, 100);
|
||||
@ -1103,10 +1075,10 @@ bool save_XML_URL() { // save xml url as as txt file for people without wifi
|
||||
sleep(1);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
char XMLurl[3540];
|
||||
build_XML_URL(XMLurl,sizeof(XMLurl));
|
||||
|
||||
|
||||
fprintf(f, "# USB Loader Has Saved this file\n");
|
||||
fprintf(f, "# This URL was created based on your list of games and language settings.\n");
|
||||
fclose(f);
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "cheats/cheatmenu.h"
|
||||
#include "fatmounter.h"
|
||||
#include "menu.h"
|
||||
#include "menu/menus.h"
|
||||
#include "filelist.h"
|
||||
#include "listfiles.h"
|
||||
#include "sys.h"
|
||||
@ -23,9 +24,6 @@
|
||||
|
||||
#define MAXOPTIONS 13
|
||||
|
||||
/*** Extern functions ***/
|
||||
extern void ResumeGui();
|
||||
extern void HaltGui();
|
||||
extern void titles_default();
|
||||
|
||||
/*** Extern variables ***/
|
||||
@ -34,8 +32,6 @@ extern GuiSound * bgMusic;
|
||||
extern GuiImage * bgImg;
|
||||
extern GuiImageData * pointer[4];
|
||||
extern GuiImageData * background;
|
||||
extern u8 shutdown;
|
||||
extern u8 reset;
|
||||
extern u8 mountMethod;
|
||||
extern struct discHdr *dvdheader;
|
||||
extern PartList partitions;
|
||||
@ -76,7 +72,7 @@ int MenuSettings()
|
||||
int opt_override = Settings.titlesOverride;
|
||||
// backup partition index
|
||||
u8 settingspartitionold = Settings.partition;
|
||||
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
@ -537,7 +533,7 @@ int MenuSettings()
|
||||
|
||||
snprintf(MainButtonText, sizeof(MainButtonText), "%s", tr("Theme Downloader"));
|
||||
MainButton1Txt.SetText(MainButtonText);
|
||||
snprintf(MainButtonText, sizeof(MainButtonText), "%s", tr(" "));
|
||||
snprintf(MainButtonText, sizeof(MainButtonText), "%s", tr("Partition Format Menu"));
|
||||
MainButton2Txt.SetText(MainButtonText);
|
||||
snprintf(MainButtonText, sizeof(MainButtonText), "%s", tr(" "));
|
||||
MainButton3Txt.SetText(MainButtonText);
|
||||
@ -557,6 +553,7 @@ int MenuSettings()
|
||||
w.Append(&GoRightBtn);
|
||||
w.Append(&GoLeftBtn);
|
||||
w.Append(&MainButton1);
|
||||
w.Append(&MainButton2);
|
||||
|
||||
PageIndicatorBtn1.SetAlpha(50);
|
||||
PageIndicatorBtn2.SetAlpha(50);
|
||||
@ -611,10 +608,6 @@ int MenuSettings()
|
||||
{
|
||||
VIDEO_WaitVSync ();
|
||||
|
||||
if (shutdown == 1)
|
||||
Sys_Shutdown();
|
||||
if (reset == 1)
|
||||
Sys_Reboot();
|
||||
|
||||
if ( pageToDisplay == 1 )
|
||||
{
|
||||
@ -658,12 +651,7 @@ int MenuSettings()
|
||||
|
||||
returnhere = 1;
|
||||
|
||||
if (shutdown == 1)
|
||||
Sys_Shutdown();
|
||||
if (reset == 1)
|
||||
Sys_Reboot();
|
||||
|
||||
else if (backBtn.GetState() == STATE_CLICKED)
|
||||
if (backBtn.GetState() == STATE_CLICKED)
|
||||
{
|
||||
backBtn.ResetState();
|
||||
exit = true;
|
||||
@ -865,7 +853,7 @@ int MenuSettings()
|
||||
static const char *opts[settings_screensaver_max] = {trNOOP("OFF"),trNOOP("3 min"),trNOOP("5 min"),trNOOP("10 min"),trNOOP("20 min"),trNOOP("30 min"),trNOOP("1 hour")};
|
||||
options2.SetValue(Idx,"%s",tr(opts[Settings.screensaver]));
|
||||
}
|
||||
|
||||
|
||||
if(ret == ++Idx || firstRun)
|
||||
{
|
||||
if(firstRun) options2.SetName(Idx, "%s",tr("Mark new games"));
|
||||
@ -920,12 +908,7 @@ int MenuSettings()
|
||||
{
|
||||
VIDEO_WaitVSync ();
|
||||
|
||||
if (shutdown == 1)
|
||||
Sys_Shutdown();
|
||||
if (reset == 1)
|
||||
Sys_Reboot();
|
||||
|
||||
else if (backBtn.GetState() == STATE_CLICKED)
|
||||
if (backBtn.GetState() == STATE_CLICKED)
|
||||
{
|
||||
backBtn.ResetState();
|
||||
exit = true;
|
||||
@ -1010,7 +993,7 @@ int MenuSettings()
|
||||
else
|
||||
options2.SetValue(Idx, "********");
|
||||
}
|
||||
|
||||
|
||||
if (ret == ++Idx || firstRun)
|
||||
{
|
||||
if (firstRun) options2.SetName(Idx, "%s", tr("Partition"));
|
||||
@ -1022,23 +1005,23 @@ int MenuSettings()
|
||||
}
|
||||
while (!IsValidPartition(partitions.pinfo[Settings.partition].fs_type, Settings.cios));
|
||||
}
|
||||
|
||||
|
||||
PartInfo pInfo = partitions.pinfo[Settings.partition];
|
||||
f32 partition_size = partitions.pentry[Settings.partition].size * (partitions.sector_size / GB_SIZE);
|
||||
|
||||
|
||||
// Get the partition name and it's size in GB's
|
||||
options2.SetValue(Idx,"%s%d (%.2fGB)", pInfo.fs_type == FS_TYPE_FAT32 ? "FAT" : pInfo.fs_type == FS_TYPE_NTFS ? "NTFS" : "WBFS",
|
||||
pInfo.index,
|
||||
partition_size);
|
||||
}
|
||||
|
||||
|
||||
if (ret == ++Idx || firstRun)
|
||||
{
|
||||
if (firstRun) options2.SetName(Idx, "%s", tr("FAT: Use directories"));
|
||||
if (ret == Idx) {
|
||||
Settings.FatInstallToDir = Settings.FatInstallToDir == 0 ? 1 : 0;
|
||||
}
|
||||
options2.SetValue(Idx, "%s", tr(opts_no_yes[Settings.FatInstallToDir]));
|
||||
options2.SetValue(Idx, "%s", tr(opts_no_yes[Settings.FatInstallToDir]));
|
||||
}
|
||||
|
||||
if(ret == ++Idx || firstRun)
|
||||
@ -1119,12 +1102,7 @@ int MenuSettings()
|
||||
{
|
||||
VIDEO_WaitVSync ();
|
||||
|
||||
if (shutdown == 1)
|
||||
Sys_Shutdown();
|
||||
if (reset == 1)
|
||||
Sys_Reboot();
|
||||
|
||||
else if (backBtn.GetState() == STATE_CLICKED)
|
||||
if (backBtn.GetState() == STATE_CLICKED)
|
||||
{
|
||||
backBtn.ResetState();
|
||||
exit = true;
|
||||
@ -1167,7 +1145,7 @@ int MenuSettings()
|
||||
{
|
||||
char entered[20];
|
||||
memset(entered, 0, 20);
|
||||
|
||||
|
||||
//password check to unlock Install,Delete and Format
|
||||
w.Remove(&optionBrowser2);
|
||||
w.Remove(&backBtn);
|
||||
@ -1294,11 +1272,7 @@ int MenuSettings()
|
||||
|
||||
bool returnhere = true;
|
||||
|
||||
if (shutdown == 1)
|
||||
Sys_Shutdown();
|
||||
if (reset == 1)
|
||||
Sys_Reboot();
|
||||
else if (backBtn.GetState() == STATE_CLICKED)
|
||||
if (backBtn.GetState() == STATE_CLICKED)
|
||||
{
|
||||
backBtn.ResetState();
|
||||
exit = true;
|
||||
@ -1474,12 +1448,8 @@ int MenuSettings()
|
||||
{
|
||||
VIDEO_WaitVSync ();
|
||||
|
||||
if (shutdown == 1)
|
||||
Sys_Shutdown();
|
||||
if (reset == 1)
|
||||
Sys_Reboot();
|
||||
|
||||
else if (backBtn.GetState() == STATE_CLICKED)
|
||||
if (backBtn.GetState() == STATE_CLICKED)
|
||||
{
|
||||
backBtn.ResetState();
|
||||
exit = true;
|
||||
@ -1888,7 +1858,7 @@ int MenuSettings()
|
||||
}
|
||||
options2.SetValue(Idx, "%s", Settings.BcaCodepath);
|
||||
}
|
||||
|
||||
|
||||
if(ret == ++Idx || firstRun)
|
||||
{
|
||||
if(firstRun) options2.SetName(Idx, "%s", tr("WIP Patches Path"));
|
||||
@ -2048,6 +2018,20 @@ int MenuSettings()
|
||||
pageToDisplay = 0;
|
||||
break;
|
||||
}
|
||||
if (MainButton2.GetState() == STATE_CLICKED)
|
||||
{
|
||||
if(Settings.godmode == 1)
|
||||
{
|
||||
if (isInserted(bootDevice))
|
||||
cfg_save_global();
|
||||
menu = MENU_FORMAT;
|
||||
pageToDisplay = 0;
|
||||
break;
|
||||
}
|
||||
else
|
||||
WindowPrompt(tr("You can't access this menu!"), tr("Unlock the app first."), tr("OK"));
|
||||
MainButton2.ResetState();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2146,7 +2130,7 @@ int MenuSettings()
|
||||
w.SetEffect(EFFECT_FADE, -20);
|
||||
while (w.GetEffect()>0) usleep(50);
|
||||
|
||||
// if partition has changed, Reinitialize it
|
||||
// if partition has changed, Reinitialize it
|
||||
PartInfo pinfo = partitions.pinfo[Settings.partition];
|
||||
partitionEntry pentry = partitions.pentry[Settings.partition];
|
||||
load_from_fs = pinfo.part_fs;
|
||||
@ -2154,7 +2138,7 @@ int MenuSettings()
|
||||
WBFS_Close();
|
||||
WBFS_OpenPart(load_from_fs, pinfo.index, pentry.sector, pentry.size, (char *) &game_partition);
|
||||
}
|
||||
|
||||
|
||||
// if language has changed, reload titles
|
||||
char opt_langnew[100];
|
||||
strcpy(opt_langnew,Settings.language_path);
|
||||
@ -2428,7 +2412,7 @@ int GameSettings(struct discHdr * header)
|
||||
iosChoice = i250;
|
||||
else if (Settings.cios == ios223)
|
||||
iosChoice = i223;
|
||||
else
|
||||
else
|
||||
iosChoice = i249;
|
||||
parentalcontrolChoice = 0;
|
||||
fix002 = Settings.error002;
|
||||
@ -2449,11 +2433,6 @@ int GameSettings(struct discHdr * header)
|
||||
{
|
||||
VIDEO_WaitVSync ();
|
||||
|
||||
if (shutdown == 1)
|
||||
Sys_Shutdown();
|
||||
if (reset == 1)
|
||||
Sys_Reboot();
|
||||
|
||||
if (MainButton1.GetState() == STATE_CLICKED)
|
||||
{
|
||||
w.Append(&saveBtn);
|
||||
@ -2489,10 +2468,6 @@ int GameSettings(struct discHdr * header)
|
||||
|
||||
returnhere = 1;
|
||||
|
||||
if (shutdown == 1)
|
||||
Sys_Shutdown();
|
||||
if (reset == 1)
|
||||
Sys_Reboot();
|
||||
if (backBtn.GetState() == STATE_CLICKED)
|
||||
{
|
||||
backBtn.ResetState();
|
||||
@ -2762,10 +2737,6 @@ int GameSettings(struct discHdr * header)
|
||||
{
|
||||
VIDEO_WaitVSync ();
|
||||
|
||||
if (shutdown == 1)
|
||||
Sys_Shutdown();
|
||||
if (reset == 1)
|
||||
Sys_Reboot();
|
||||
if (backBtn.GetState() == STATE_CLICKED)
|
||||
{
|
||||
backBtn.ResetState();
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "settings/cfg.h"
|
||||
#include "network/URL_List.h"
|
||||
#include "listfiles.h"
|
||||
#include "menu/menus.h"
|
||||
#include "main.h"
|
||||
#include "fatmounter.h"
|
||||
#include "filelist.h"
|
||||
@ -20,13 +21,6 @@
|
||||
/*** Extern variables ***/
|
||||
extern GuiWindow * mainWindow;
|
||||
extern GuiSound * bgMusic;
|
||||
extern u8 shutdown;
|
||||
extern u8 reset;
|
||||
|
||||
/*** Extern functions ***/
|
||||
extern void ResumeGui();
|
||||
extern void HaltGui();
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* MenuOGG
|
||||
@ -183,11 +177,6 @@ bool MenuOGG() {
|
||||
|
||||
while (!returnhere) {
|
||||
|
||||
if (shutdown == 1)
|
||||
Sys_Shutdown();
|
||||
if (reset == 1)
|
||||
Sys_Reboot();
|
||||
|
||||
if (backBtn.GetState() == STATE_CLICKED) {
|
||||
if (nothingchanged == 1 && countoggs > 0) {
|
||||
if (strcmp("", Settings.oggload_path) && strcmp("notset", Settings.ogg_path)) {
|
||||
@ -453,12 +442,7 @@ int MenuLanguageSelect() {
|
||||
|
||||
while (!returnhere) {
|
||||
|
||||
if (shutdown == 1)
|
||||
Sys_Shutdown();
|
||||
else if (reset == 1)
|
||||
Sys_Reboot();
|
||||
|
||||
else if (backBtn.GetState() == STATE_CLICKED) {
|
||||
if (backBtn.GetState() == STATE_CLICKED) {
|
||||
|
||||
backBtn.ResetState();
|
||||
break;
|
||||
|
@ -366,7 +366,7 @@ void Global_Default(void) {
|
||||
Settings.partitions_to_install = install_game_only;
|
||||
Settings.fullcopy = 0;
|
||||
Settings.beta_upgrades = 0;
|
||||
|
||||
|
||||
memset(&Settings.parental, 0, sizeof(struct SParental));
|
||||
|
||||
char buf[0x4a];
|
||||
@ -385,7 +385,11 @@ void Global_Default(void) {
|
||||
}
|
||||
|
||||
|
||||
char *cfg_get_title(u8 *id) {
|
||||
char *cfg_get_title(u8 *id)
|
||||
{
|
||||
if(!id)
|
||||
return NULL;
|
||||
|
||||
int i;
|
||||
for (i=0; i<num_title; i++) {
|
||||
if (memcmp(id, cfg_title[i].id, 4) == 0) {
|
||||
@ -1850,7 +1854,7 @@ void CFG_Load(void) {
|
||||
// if GUI language is set to default Settings.language_path needs to remain "notset" (if the detected setting was kept detection wouldn't work next time)
|
||||
if (langisdefault)
|
||||
sprintf(Settings.language_path, "notset");
|
||||
|
||||
|
||||
Settings.godmode = (Settings.parental.enabled == 0 && (Settings.parentalcontrol == 0 || strlen(Settings.unlockCode) == 0)) ? 1 : 0;
|
||||
}
|
||||
|
||||
|
200
source/sys.cpp
200
source/sys.cpp
@ -14,10 +14,13 @@
|
||||
#include "fatmounter.h"
|
||||
#include "sys.h"
|
||||
#include "wpad.h"
|
||||
#include "menu/menus.h"
|
||||
|
||||
extern char game_partition[6];
|
||||
extern u8 load_from_fs;
|
||||
|
||||
extern u8 hddState;
|
||||
|
||||
//Wiilight stuff
|
||||
static vu32 *_wiilight_reg = (u32*)0xCD0000C0;
|
||||
void wiilight(int enable) { // Toggle wiilight (thanks Bool for wiilight source)
|
||||
@ -68,44 +71,51 @@ void Sys_Reboot(void) {
|
||||
|
||||
int Sys_ChangeIos(int ios) {
|
||||
s32 prevIos = IOS_GetVersion();
|
||||
|
||||
|
||||
SDCard_deInit();
|
||||
USBDevice_deInit();
|
||||
|
||||
if (hddState)
|
||||
USBDevice_deInit();
|
||||
|
||||
WPAD_Flush(0);
|
||||
WPAD_Disconnect(0);
|
||||
WPAD_Shutdown();
|
||||
|
||||
WDVD_Close();
|
||||
|
||||
USBStorage_Deinit();
|
||||
|
||||
if (hddState)
|
||||
{
|
||||
WDVD_Close();
|
||||
USBStorage_Deinit();
|
||||
}
|
||||
|
||||
s32 ret = IOS_ReloadIOSsafe(ios);
|
||||
if (ret < 0) {
|
||||
ios = prevIos;
|
||||
}
|
||||
|
||||
|
||||
SDCard_Init();
|
||||
|
||||
if (ios == 222 || ios == 223) {
|
||||
load_ehc_module();
|
||||
}
|
||||
USBDevice_Init();
|
||||
|
||||
if (hddState)
|
||||
USBDevice_Init();
|
||||
|
||||
PAD_Init();
|
||||
Wpad_Init();
|
||||
WPAD_SetDataFormat(WPAD_CHAN_ALL,WPAD_FMT_BTNS_ACC_IR);
|
||||
WPAD_SetVRes(WPAD_CHAN_ALL, screenwidth, screenheight);
|
||||
|
||||
WBFS_Init(WBFS_DEVICE_USB);
|
||||
Disc_Init();
|
||||
|
||||
if (Sys_IsHermes()) {
|
||||
WBFS_OpenNamed((char *) &game_partition);
|
||||
} else {
|
||||
WBFS_Open();
|
||||
}
|
||||
|
||||
if (hddState)
|
||||
{
|
||||
WBFS_Init(WBFS_DEVICE_USB);
|
||||
Disc_Init();
|
||||
|
||||
if (Sys_IsHermes()) {
|
||||
WBFS_OpenNamed((char *) &game_partition);
|
||||
} else {
|
||||
WBFS_Open();
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -114,17 +124,22 @@ int Sys_IosReload(int IOS) {
|
||||
|
||||
//shutdown SD and USB before IOS Reload in DiscWait
|
||||
SDCard_deInit();
|
||||
USBDevice_deInit();
|
||||
if (hddState)
|
||||
USBDevice_deInit();
|
||||
|
||||
WPAD_Flush(0);
|
||||
WPAD_Disconnect(0);
|
||||
WPAD_Shutdown();
|
||||
|
||||
WDVD_Close();
|
||||
if (hddState)
|
||||
{
|
||||
WDVD_Close();
|
||||
USBStorage_Deinit();
|
||||
}
|
||||
|
||||
USBStorage_Deinit();
|
||||
|
||||
if (IOS == 249 || IOS == 222 || IOS == 223) {
|
||||
ret = IOS_ReloadIOSsafe(IOS);
|
||||
if (ret < 0) return ret;
|
||||
if ((IOS == 249 || IOS == 222 || IOS == 223) && hddState) {
|
||||
for (int i = 0; i < 10; i++) {
|
||||
ret = IOS_ReloadIOSsafe(IOS);
|
||||
if (ret < 0) return ret;
|
||||
@ -148,7 +163,8 @@ int Sys_IosReload(int IOS) {
|
||||
WPAD_SetVRes(WPAD_CHAN_ALL, screenwidth, screenheight);
|
||||
//reinitialize SD and USB
|
||||
SDCard_Init();
|
||||
USBDevice_Init();
|
||||
if (hddState)
|
||||
USBDevice_Init();
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -228,34 +244,34 @@ s32 ios250rev = -69;
|
||||
s32 IOS_ReloadIOSsafe(int ios)
|
||||
{
|
||||
if (ios==222)
|
||||
{
|
||||
{
|
||||
if (ios222rev == -69)
|
||||
ios222rev = getIOSrev(0x00000001000000dell);
|
||||
|
||||
|
||||
if (ios222rev >= 0 && (ios222rev != 4 && ios222rev != 5))return -2;
|
||||
}
|
||||
else if (ios==223)
|
||||
{
|
||||
{
|
||||
if (ios223rev == -69)
|
||||
ios223rev = getIOSrev(0x00000001000000dfll);
|
||||
|
||||
|
||||
if (ios223rev >= 0 && (ios223rev != 4 && ios223rev != 5))return -2;
|
||||
}
|
||||
else if (ios==249)
|
||||
{
|
||||
{
|
||||
if (ios249rev == -69)
|
||||
ios249rev = getIOSrev(0x00000001000000f9ll);
|
||||
|
||||
ios249rev = getIOSrev(0x00000001000000f9ll);
|
||||
|
||||
if (ios249rev >= 0 && !(ios249rev>=9 && ios249rev<65280))return -2;
|
||||
}
|
||||
else if (ios==250)
|
||||
{
|
||||
{
|
||||
if (ios250rev == -69)
|
||||
ios250rev = getIOSrev(0x00000001000000fall);
|
||||
|
||||
|
||||
if (ios250rev >= 0 && !(ios250rev>=9 && ios250rev<65280))return -2;
|
||||
}
|
||||
|
||||
|
||||
s32 r = IOS_ReloadIOS(ios);
|
||||
if (r >= 0) {
|
||||
WII_Initialize();
|
||||
@ -263,6 +279,120 @@ s32 IOS_ReloadIOSsafe(int ios)
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
|
||||
s32 CheckForCIOS()
|
||||
{
|
||||
gprintf("\n\tChecking for stub IOS");
|
||||
s32 ret = -1;
|
||||
s32 ios222rev = getIOSrev(0x00000001000000dell);
|
||||
s32 ios249rev = getIOSrev(0x00000001000000f9ll);
|
||||
|
||||
//if we don't like either of the cIOS then scram
|
||||
if (!(ios222rev==4 || ios222rev==5 || (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);
|
||||
|
||||
printf("%d", ret);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
printf("\n\tIOS 249 failed, reloading ios 222...");
|
||||
ret = IOS_ReloadIOSsafe(222);
|
||||
printf("%d", ret);
|
||||
if (ret < 0) {
|
||||
printf("\n\tIOS 222 failed, reloading ios 250...");
|
||||
ret = IOS_ReloadIOSsafe(250);
|
||||
printf("%d", ret);
|
||||
if (ret < 0) {
|
||||
printf("\n\tERROR: cIOS could not be loaded!\n");
|
||||
sleep(5);
|
||||
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//only for 222 loading ehc modules
|
||||
printf("\n\tLoad ehc module");
|
||||
load_ehc_module();
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int LoadAppCIOS()
|
||||
{
|
||||
s32 ret = 1;
|
||||
/* Load Custom IOS */
|
||||
if (Settings.cios == ios222 && IOS_GetVersion() != 222)
|
||||
{
|
||||
printf("\n\tReloading IOS to config setting (%d)...", ios222 ? 222 : 223);
|
||||
SDCard_deInit();// unmount SD for reloading IOS
|
||||
USBDevice_deInit();// unmount USB for reloading IOS
|
||||
USBStorage_Deinit();
|
||||
ret = IOS_ReloadIOSsafe(ios222 ? 222 : 223);
|
||||
printf("%d", ret);
|
||||
if (ret < 0)
|
||||
{
|
||||
Settings.cios = ios249;
|
||||
IOS_ReloadIOSsafe(249);
|
||||
}
|
||||
|
||||
SDCard_Init();
|
||||
USBDevice_Init(); // and mount USB:/
|
||||
if(ret >= 0)
|
||||
load_ehc_module();
|
||||
}
|
||||
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);
|
||||
SDCard_deInit();// unmount SD for reloading IOS
|
||||
USBDevice_deInit();// unmount USB for reloading IOS
|
||||
USBStorage_Deinit();
|
||||
ret = IOS_ReloadIOSsafe(ios249 ? 249 : 250);
|
||||
printf("%d", ret);
|
||||
if (ret < 0) {
|
||||
Settings.cios = ios222;
|
||||
ret = IOS_ReloadIOSsafe(222);
|
||||
SDCard_Init();
|
||||
load_ehc_module();
|
||||
}
|
||||
|
||||
else SDCard_Init(); // now mount SD:/ //no need to keep mindlessly mounting and unmounting SD card
|
||||
USBDevice_Init(); // and mount USB:/
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#include <time.h>
|
||||
|
||||
void ScreenShot()
|
||||
|
@ -13,6 +13,8 @@ void Sys_LoadMenu(void);
|
||||
void Sys_BackToLoader(void);
|
||||
int Sys_ChangeIos(int ios);
|
||||
int Sys_IosReload(int IOS);
|
||||
s32 CheckForCIOS();
|
||||
int LoadAppCIOS();
|
||||
bool Sys_IsHermes();
|
||||
s32 IOS_ReloadIOSsafe(int ios);
|
||||
void ScreenShot();
|
||||
|
@ -24,16 +24,10 @@
|
||||
#include "ZipFile.h"
|
||||
#include "gecko.h"
|
||||
|
||||
/*** Extern functions ***/
|
||||
extern void ResumeGui();
|
||||
extern void HaltGui();
|
||||
|
||||
/*** Extern variables ***/
|
||||
extern GuiWindow * mainWindow;
|
||||
extern GuiSound * bgMusic;
|
||||
extern GuiImage * bgImg;
|
||||
extern u8 shutdown;
|
||||
extern u8 reset;
|
||||
|
||||
|
||||
int DownloadTheme(const char *url, const char *title)
|
||||
@ -245,11 +239,6 @@ static int Theme_Prompt(const char *title, const char *author, GuiImageData *thu
|
||||
{
|
||||
VIDEO_WaitVSync();
|
||||
|
||||
if (shutdown == 1)
|
||||
Sys_Shutdown();
|
||||
else if (reset == 1)
|
||||
Sys_Reboot();
|
||||
|
||||
if (downloadBtn.GetState() == STATE_CLICKED)
|
||||
{
|
||||
int choice = WindowPrompt(tr("Do you want to download this theme?"), title, tr("Yes"), tr("Cancel"));
|
||||
@ -579,12 +568,7 @@ int Theme_Downloader()
|
||||
{
|
||||
VIDEO_WaitVSync ();
|
||||
|
||||
if (shutdown == 1)
|
||||
Sys_Shutdown();
|
||||
else if (reset == 1)
|
||||
Sys_Reboot();
|
||||
|
||||
else if (wifiBtn.GetState() == STATE_CLICKED)
|
||||
if (wifiBtn.GetState() == STATE_CLICKED)
|
||||
{
|
||||
Initialize_Network();
|
||||
wifiBtn.ResetState();
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
#include "../prompts/TitleBrowser.h"
|
||||
|
||||
#include "../gecko.h"
|
||||
#include "wad/wad.h"
|
||||
#include "xml/xml.h"
|
||||
#include "../wad/title.h"
|
||||
@ -50,9 +51,9 @@ static inline int wcsnicmp(const wchar_t *s1, const wchar_t *s2, int len)
|
||||
if (*s1++ == 0)
|
||||
break;
|
||||
} while (--len != 0);
|
||||
|
||||
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
@ -131,7 +132,7 @@ int __Menu_GetPrevFilter(int t, wchar_t* gameFilter, u32 gameFiltered, wchar_t *
|
||||
struct discHdr *buffer = NULL;
|
||||
u32 cnt, len, i;
|
||||
s32 ret;
|
||||
|
||||
|
||||
wchar_t *new_gameFilterPrev = wcsdup_new(gameFilter);
|
||||
|
||||
|
||||
@ -182,8 +183,8 @@ int __Menu_GetPrevFilter(int t, wchar_t* gameFilter, u32 gameFiltered, wchar_t *
|
||||
{
|
||||
// Check game rating in WiiTDB, since the default Wii parental control setting is enabled
|
||||
s32 rating = GetRatingForGame((char *) header->id);
|
||||
|
||||
if ((rating != -1 && rating > Settings.parental.rating) ||
|
||||
|
||||
if ((rating != -1 && rating > Settings.parental.rating) ||
|
||||
(rating == -1 && get_pegi_block(header) > Settings.parental.rating))
|
||||
{
|
||||
continue;
|
||||
@ -193,7 +194,7 @@ int __Menu_GetPrevFilter(int t, wchar_t* gameFilter, u32 gameFiltered, wchar_t *
|
||||
wchar_t *wname = FreeTypeGX::charToWideChar(get_title(header));
|
||||
if(wname) nameList.push_back(wname);
|
||||
}
|
||||
|
||||
|
||||
NewTitles::Instance()->Save();
|
||||
|
||||
/* delete buffer */
|
||||
@ -225,7 +226,7 @@ int __Menu_GetPrevFilter(int t, wchar_t* gameFilter, u32 gameFiltered, wchar_t *
|
||||
/****************************************************************************
|
||||
* Get GameFilter NextList
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
int int_cmp(const void *a, const void *b) { return *((u32*)a)-*((u32*)b); }
|
||||
|
||||
int __Menu_GetGameFilter_NextList(discHdr *gameList, u32 gameCnt, wchar_t **PgameFilter, wchar_t **PgameFilterNextList)
|
||||
@ -248,15 +249,15 @@ int __Menu_GetGameFilter_NextList(discHdr *gameList, u32 gameCnt, wchar_t **Pgam
|
||||
}
|
||||
else if(wcslen(gameName) == filter_len)
|
||||
autofill = false; // no autofill when gameNameLen == filterLen
|
||||
|
||||
|
||||
nextList[i] = nextFilterChar;
|
||||
}
|
||||
qsort(nextList, gameCnt, sizeof(u32), int_cmp);
|
||||
|
||||
|
||||
*PgameFilterNextList = new wchar_t[gameCnt+1];
|
||||
if(*PgameFilterNextList == NULL) goto error;
|
||||
|
||||
|
||||
|
||||
|
||||
p = *PgameFilterNextList;
|
||||
lastChar = 0;
|
||||
for(i=0; i<gameCnt; i++)
|
||||
@ -274,14 +275,14 @@ int __Menu_GetGameFilter_NextList(discHdr *gameList, u32 gameCnt, wchar_t **Pgam
|
||||
{
|
||||
wchar_t *newFilter = new wchar_t[filter_len + 2];
|
||||
if(newFilter == NULL) goto error;
|
||||
|
||||
|
||||
wcscpy(newFilter, *PgameFilter);
|
||||
wcscat(newFilter, *PgameFilterNextList);
|
||||
delete [] *PgameFilter; *PgameFilter = newFilter;
|
||||
delete [] *PgameFilterNextList; *PgameFilterNextList = NULL;
|
||||
return __Menu_GetGameFilter_NextList(gameList, gameCnt, PgameFilter, PgameFilterNextList);
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
error:
|
||||
if(nextList) delete [] nextList;
|
||||
@ -306,7 +307,7 @@ int buildTitleList(int t, wchar_t* gameFilter, discHdr ** PgameList, u32 *PgameC
|
||||
|
||||
ret = getTitles_TypeCount(typei, &num_titles);
|
||||
if (ret < 0) {
|
||||
return -1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = getTitles_Type(typei, titles, num_titles);
|
||||
@ -331,7 +332,7 @@ int buildTitleList(int t, wchar_t* gameFilter, discHdr ** PgameList, u32 *PgameC
|
||||
return -1;
|
||||
|
||||
memset(buffer, 0, len);
|
||||
|
||||
|
||||
sprintf(path,"%s/config/database.txt",bootDevice);
|
||||
f = fopen(path, "r");
|
||||
|
||||
@ -342,20 +343,20 @@ int buildTitleList(int t, wchar_t* gameFilter, discHdr ** PgameList, u32 *PgameC
|
||||
char text[15];
|
||||
strcpy(name,"");//make sure name is empty
|
||||
u8 found=0;
|
||||
|
||||
|
||||
sprintf(text, "%s", titleText(i<num_titles?typei:0x00010002, i<num_titles?titles[i]:sys_titles[i-num_titles]));
|
||||
|
||||
|
||||
|
||||
char line[200];
|
||||
char tmp[50];
|
||||
snprintf(tmp,50," ");
|
||||
|
||||
|
||||
//check if the content.bin is on the SD card for that game
|
||||
//if there is content.bin,then the game is on the SDmenu and not the wii
|
||||
sprintf(line,"SD:/private/wii/title/%s/content.bin",text);
|
||||
if (!checkfile(line))
|
||||
{
|
||||
|
||||
|
||||
struct discHdr *header = &buffer[i];
|
||||
if (f) {
|
||||
while (fgets(line, sizeof(line), f)) {
|
||||
@ -393,7 +394,7 @@ int buildTitleList(int t, wchar_t* gameFilter, discHdr ** PgameList, u32 *PgameC
|
||||
header->id[4]='1';
|
||||
header->id[5]=(i<num_titles?'1':'2');
|
||||
//header->
|
||||
|
||||
|
||||
//not using these filters right now, but i left them in just in case
|
||||
// Filters
|
||||
/*if (Settings.fave) {
|
||||
@ -401,32 +402,32 @@ int buildTitleList(int t, wchar_t* gameFilter, discHdr ** PgameList, u32 *PgameC
|
||||
if (!game_num || game_num->favorite==0)
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (Settings.parentalcontrol && !Settings.godmode) {
|
||||
if (get_block(header) >= Settings.parentalcontrol)
|
||||
continue;
|
||||
}*/
|
||||
|
||||
if(gameFilter && *gameFilter) {
|
||||
|
||||
/*if(gameFilter && *gameFilter) {
|
||||
u32 filter_len = wcslen(gameFilter);
|
||||
wchar_t *gameName = FreeTypeGX::charToWideChar(get_title(header));
|
||||
if (!gameName || wcsnicmp(gameName, gameFilter, filter_len)) {
|
||||
delete [] gameName;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
if(i != cnt2)
|
||||
buffer[cnt2] = buffer[i];
|
||||
cnt2++;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
|
||||
if (f)fclose(f);
|
||||
|
||||
Uninstall_FromTitle(TITLE_ID(1, 0));
|
||||
ISFS_Deinitialize();
|
||||
|
||||
|
||||
if(cnt > cnt2)
|
||||
{
|
||||
cnt = cnt2;
|
||||
@ -434,7 +435,7 @@ int buildTitleList(int t, wchar_t* gameFilter, discHdr ** PgameList, u32 *PgameC
|
||||
}
|
||||
if (!buffer)
|
||||
return -1;
|
||||
|
||||
|
||||
if (Settings.sort==pcount) {
|
||||
qsort(buffer, cnt, sizeof(struct discHdr), __Menu_EntryCmpCount);
|
||||
} else if (Settings.fave) {
|
||||
@ -445,12 +446,12 @@ int buildTitleList(int t, wchar_t* gameFilter, discHdr ** PgameList, u32 *PgameC
|
||||
/*PgameList = buffer;
|
||||
buffer = NULL;
|
||||
PgameCnt = cnt;*/
|
||||
|
||||
|
||||
if(PgameList) *PgameList = buffer; else free(buffer);
|
||||
if(PgameCnt) *PgameCnt = cnt;
|
||||
|
||||
|
||||
return 0;
|
||||
|
||||
|
||||
return cnt;
|
||||
}
|
||||
|
||||
@ -469,7 +470,7 @@ int __Menu_GetGameList(int t, wchar_t* gameFilter, discHdr ** PgameList, u32 *Pg
|
||||
ret = WBFS_GetCount(&cnt);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
//gprintf("\n WBFS_GetCount:%d",cnt);
|
||||
/* Buffer length */
|
||||
len = sizeof(struct discHdr) * cnt;
|
||||
|
||||
@ -487,7 +488,7 @@ int __Menu_GetGameList(int t, wchar_t* gameFilter, discHdr ** PgameList, u32 *Pg
|
||||
if (buffer) free(buffer);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
for (u32 i = 0; i < cnt; i++) {
|
||||
struct discHdr *header = &buffer[i];
|
||||
|
||||
@ -506,7 +507,7 @@ int __Menu_GetGameList(int t, wchar_t* gameFilter, discHdr ** PgameList, u32 *Pg
|
||||
header->id[2]=='C'&&header->id[3]=='F'&&
|
||||
header->id[4]=='G'&&header->id[5]=='_')
|
||||
continue;
|
||||
|
||||
|
||||
if (Settings.parentalcontrol && !Settings.godmode && t==0) {
|
||||
if (get_block(header) >= Settings.parentalcontrol)
|
||||
continue;
|
||||
@ -517,13 +518,13 @@ int __Menu_GetGameList(int t, wchar_t* gameFilter, discHdr ** PgameList, u32 *Pg
|
||||
{
|
||||
// Check game rating in WiiTDB, since the default Wii parental control setting is enabled
|
||||
s32 rating = GetRatingForGame((char *) header->id);
|
||||
if ((rating != -1 && rating > Settings.parental.rating) ||
|
||||
if ((rating != -1 && rating > Settings.parental.rating) ||
|
||||
(rating == -1 && get_pegi_block(header) > Settings.parental.rating))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(gameFilter && *gameFilter && t==0) {
|
||||
u32 filter_len = wcslen(gameFilter);
|
||||
wchar_t *gameName = FreeTypeGX::charToWideChar(get_title(header));
|
||||
@ -537,7 +538,7 @@ int __Menu_GetGameList(int t, wchar_t* gameFilter, discHdr ** PgameList, u32 *Pg
|
||||
cnt2++;
|
||||
}
|
||||
NewTitles::Instance()->Save();
|
||||
|
||||
|
||||
if(cnt > cnt2)
|
||||
{
|
||||
cnt = cnt2;
|
||||
@ -545,7 +546,7 @@ int __Menu_GetGameList(int t, wchar_t* gameFilter, discHdr ** PgameList, u32 *Pg
|
||||
}
|
||||
if (!buffer)
|
||||
return -1;
|
||||
|
||||
|
||||
if (Settings.sort==pcount) {
|
||||
qsort(buffer, cnt, sizeof(struct discHdr), __Menu_EntryCmpCount);
|
||||
} else if (Settings.fave) {
|
||||
@ -557,18 +558,18 @@ int __Menu_GetGameList(int t, wchar_t* gameFilter, discHdr ** PgameList, u32 *Pg
|
||||
/* Set values */
|
||||
if(PgameList) *PgameList = buffer; else free(buffer);
|
||||
if(PgameCnt) *PgameCnt = cnt;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int __Menu_GetEntries(int t, const wchar_t* Filter) {
|
||||
|
||||
//gprintf("\n__Menu_GetEntries()");
|
||||
/*if (mountMethod==3)
|
||||
{
|
||||
{
|
||||
return buildTitleList();
|
||||
}*/
|
||||
|
||||
|
||||
|
||||
|
||||
u32 new_gameCnt = 0;
|
||||
struct discHdr *new_gameList = NULL;
|
||||
wchar_t *new_gameFilter = NULL;
|
||||
@ -576,32 +577,50 @@ int __Menu_GetEntries(int t, const wchar_t* Filter) {
|
||||
wchar_t *new_gameFilterPrev = NULL;
|
||||
|
||||
new_gameFilter = wcsdup_new(Filter ? Filter : (gameFilter ? gameFilter : L"") );
|
||||
if(new_gameFilter == NULL) return -1;
|
||||
|
||||
if(new_gameFilter == NULL)
|
||||
{
|
||||
//gprintf("\nnew_gameFilter == NULL");
|
||||
return -1;
|
||||
}
|
||||
|
||||
for(;;)
|
||||
{
|
||||
if (mountMethod==3)
|
||||
{if(buildTitleList(t, new_gameFilter, &new_gameList, &new_gameCnt) < 0)
|
||||
return -1;}
|
||||
|
||||
else
|
||||
{if(__Menu_GetGameList(t, new_gameFilter, &new_gameList, &new_gameCnt) < 0)
|
||||
return -1;}
|
||||
|
||||
|
||||
{int butt =buildTitleList(t, new_gameFilter, &new_gameList, &new_gameCnt);
|
||||
if (butt < 0)
|
||||
{
|
||||
gprintf("\nbutt:%d", butt);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
if(__Menu_GetGameList(t, new_gameFilter, &new_gameList, &new_gameCnt) < 0)
|
||||
{
|
||||
gprintf("\n__Menu_GetGameList(t, new_gameFilter, &new_gameList, &new_gameCnt) < 0");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(new_gameCnt > 0 || new_gameFilter[0] == 0)
|
||||
{
|
||||
//gprintf("\nnew_gameCnt:%d",new_gameCnt);
|
||||
break;
|
||||
}
|
||||
new_gameFilter[wcslen(new_gameFilter)-1] = 0;
|
||||
}
|
||||
if (mountMethod!=3)
|
||||
{
|
||||
/* init GameFilterNextList */
|
||||
if(__Menu_GetGameFilter_NextList(new_gameList, new_gameCnt, &new_gameFilter, &new_gameFilterNextList) < 0)
|
||||
goto error;
|
||||
|
||||
/* init GameFilterNextList */
|
||||
if(__Menu_GetGameFilter_NextList(new_gameList, new_gameCnt, &new_gameFilter, &new_gameFilterNextList) < 0)
|
||||
goto error;
|
||||
|
||||
/* init GameFilterPrev */
|
||||
if(__Menu_GetPrevFilter(t, new_gameFilter, new_gameCnt, &new_gameFilterPrev) < 0)
|
||||
goto error;
|
||||
|
||||
/* init GameFilterPrev */
|
||||
if(__Menu_GetPrevFilter(t, new_gameFilter, new_gameCnt, &new_gameFilterPrev) < 0)
|
||||
goto error;
|
||||
}
|
||||
/* Set values */
|
||||
if(gameList) free(gameList);
|
||||
if(gameFilter) delete [] gameFilter;
|
||||
@ -610,14 +629,19 @@ int __Menu_GetEntries(int t, const wchar_t* Filter) {
|
||||
|
||||
gameList = new_gameList;
|
||||
gameCnt = new_gameCnt;
|
||||
gameFilter = new_gameFilter;
|
||||
gameFilterNextList = new_gameFilterNextList;
|
||||
gameFilterPrev = new_gameFilterPrev;
|
||||
gameFilter = new_gameFilter;
|
||||
gameFilterNextList = new_gameFilterNextList;
|
||||
gameFilterPrev = new_gameFilterPrev;
|
||||
|
||||
/* Reset variables */
|
||||
|
||||
/* Reset variables */
|
||||
gameSelected = gameStart = 0;
|
||||
return 0;
|
||||
//gprintf("\ncnt:%d", gameCnt);
|
||||
|
||||
|
||||
return 0;
|
||||
error: // clean up
|
||||
gprintf("\nERROR");
|
||||
if(new_gameList) free(new_gameList);
|
||||
if(new_gameFilter) delete [] new_gameFilter;
|
||||
if(new_gameFilterNextList) delete [] new_gameFilterNextList;
|
||||
|
@ -30,6 +30,9 @@ int screenheight;
|
||||
int screenwidth;
|
||||
u32 frameCount = 0;
|
||||
|
||||
extern bool textVideoInit;
|
||||
extern bool geckoinit;
|
||||
|
||||
u8 * gameScreenTex = NULL; // a GX texture screen capture of the game
|
||||
u8 * gameScreenTex2 = NULL; // a GX texture screen capture of the game (copy)
|
||||
|
||||
@ -198,6 +201,46 @@ InitVideo () {
|
||||
ResetVideo_Menu();
|
||||
// Finally, the video is up and ready for use :)
|
||||
}
|
||||
|
||||
void InitTextVideo ()
|
||||
{
|
||||
unsigned int *xfb = NULL;
|
||||
gprintf("\nInitTextVideo ()");
|
||||
if (textVideoInit)
|
||||
{
|
||||
gprintf("...0");
|
||||
return;
|
||||
}
|
||||
|
||||
VIDEO_Init();
|
||||
GXRModeObj *vmode = VIDEO_GetPreferredMode(NULL); // get default video mode
|
||||
|
||||
// widescreen fix
|
||||
VIDEO_Configure (vmode);
|
||||
|
||||
// Allocate the video buffers
|
||||
xfb = (u32 *) MEM_K0_TO_K1 (SYS_AllocateFramebuffer (vmode));
|
||||
|
||||
// A console is always useful while debugging
|
||||
console_init (xfb, 20, 64, vmode->fbWidth, vmode->xfbHeight, vmode->fbWidth * 2);
|
||||
|
||||
// Clear framebuffers etc.
|
||||
VIDEO_ClearFrameBuffer (vmode, xfb, COLOR_BLACK);
|
||||
VIDEO_SetNextFramebuffer (xfb);
|
||||
|
||||
VIDEO_SetBlack (FALSE);
|
||||
VIDEO_Flush ();
|
||||
VIDEO_WaitVSync ();
|
||||
if (vmode->viTVMode & VI_NON_INTERLACE)
|
||||
VIDEO_WaitVSync ();
|
||||
|
||||
//send console output to the gecko
|
||||
if (geckoinit)CON_EnableGecko(1, true);
|
||||
textVideoInit = true;
|
||||
gprintf("...1");
|
||||
|
||||
}
|
||||
|
||||
static unsigned int *xfbDB = NULL;
|
||||
|
||||
void InitVideodebug () {
|
||||
@ -241,8 +284,8 @@ void StopGX() {
|
||||
*
|
||||
* Renders everything current sent to GX, and flushes video
|
||||
***************************************************************************/
|
||||
void Menu_Render() {
|
||||
|
||||
void Menu_Render()
|
||||
{
|
||||
whichfb ^= 1; // flip framebuffer
|
||||
GX_SetZMode(GX_TRUE, GX_LEQUAL, GX_TRUE);
|
||||
GX_SetColorUpdate(GX_TRUE);
|
||||
@ -492,6 +535,13 @@ void Menu_DrawTPLImg(f32 xpos, f32 ypos, f32 zpos, f32 width, f32 height, GXTexO
|
||||
***************************************************************************/
|
||||
s32 TakeScreenshot(const char *path)
|
||||
{
|
||||
//check if it is possible to write
|
||||
FILE *f = fopen(path, "wb");
|
||||
if(!f)
|
||||
return -1;
|
||||
else
|
||||
fclose(f);
|
||||
|
||||
gprintf("\nTakeScreenshot(%s)", path);
|
||||
IMGCTX ctx = PNGU_SelectImageFromDevice (path);
|
||||
s32 ret = PNGU_EncodeFromYCbYCr(ctx,vmode->fbWidth, vmode->efbHeight,xfb[whichfb],0);
|
||||
@ -499,3 +549,4 @@ s32 TakeScreenshot(const char *path)
|
||||
gprintf(":%d", ret);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
void InitVideo ();
|
||||
void InitVideodebug();
|
||||
void InitTextVideo();
|
||||
void StopGX();
|
||||
void ResetVideo_Menu();
|
||||
void Menu_Render();
|
||||
|
@ -8,22 +8,15 @@
|
||||
#include "utils.h"
|
||||
#include "video.h"
|
||||
#include "wad.h"
|
||||
|
||||
|
||||
|
||||
#include "prompts/PromptWindows.h"
|
||||
#include "libwiigui/gui.h"
|
||||
#include "language/gettext.h"
|
||||
#include "menu.h"
|
||||
#include "filelist.h"
|
||||
/*** Extern functions ***/
|
||||
extern void ResumeGui();
|
||||
extern void HaltGui();
|
||||
|
||||
/*** Extern variables ***/
|
||||
extern GuiWindow * mainWindow;
|
||||
|
||||
|
||||
|
||||
/* 'WAD Header' structure */
|
||||
typedef struct {
|
||||
/* Header length */
|
||||
@ -347,9 +340,9 @@ s32 Wad_Install(FILE *fp)
|
||||
snprintf(imgPath, sizeof(imgPath), "%s%d...",tr(">> Installing content #"),content->cid);
|
||||
msg4Txt.SetText(imgPath);
|
||||
// Install content data
|
||||
while (idx < len) {
|
||||
|
||||
//VIDEO_WaitVSync ();
|
||||
while (idx < len) {
|
||||
|
||||
//VIDEO_WaitVSync ();
|
||||
|
||||
u32 size;
|
||||
|
||||
@ -371,7 +364,7 @@ s32 Wad_Install(FILE *fp)
|
||||
// Increase variables
|
||||
idx += size;
|
||||
offset += size;
|
||||
|
||||
|
||||
//snprintf(imgPath, sizeof(imgPath), "%s%d (%d)...",tr(">> Installing content #"),content->cid,idx);
|
||||
|
||||
//msg4Txt.SetText(imgPath);
|
||||
|
Loading…
Reference in New Issue
Block a user