sprinkled gprintf() throughout the source some more.

added functions to mess with the "return to" stub.  everything should be working right, but if i messed up, it may cause you not to be able to exit the program (it could just keep restarting itself).  now when booting homebrew, they should exit back to this program if you have a channel installed as UNEO or ULNR.  priority is given to UNEO if both are present.
This commit is contained in:
giantpune 2009-10-20 23:00:19 +00:00
parent 6a378e3523
commit b753af6d4d
15 changed files with 318 additions and 69 deletions

View File

@ -105,6 +105,8 @@ export OUTPUT := $(CURDIR)/$(TARGET)
$(BUILD): $(BUILD):
@[ -d $@ ] || mkdir -p $@ @[ -d $@ ] || mkdir -p $@
@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile @make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
# @echo debug...
# start geckoreader.exe
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
lang: lang:
@ -181,6 +183,9 @@ language: $(wildcard $(PROJECTDIR)/Languages/*.lang)
%.dat.o : %.dat %.dat.o : %.dat
@echo $(notdir $<) @echo $(notdir $<)
$(bin2o) $(bin2o)
%.bin.o : %.bin
@echo $(notdir $<)
$(bin2o)
export PATH := $(PROJECTDIR)/gettext-bin:$(PATH) export PATH := $(PROJECTDIR)/gettext-bin:$(PATH)

BIN
data/stub.bin Normal file

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
<pd><ViewState><e p="gui\source\mload" x="false"></e><e p="gui\source\settings" x="false"></e><e p="gui\source\images" x="false"></e><e p="gui\source\prompts" x="true"></e><e p="gui\source\banner" x="false"></e><e p="gui\source\cheats" x="false"></e><e p="gui\source\network" x="true"></e><e p="gui\source\unzip" x="false"></e><e p="gui\source\usbloader" x="false"></e><e p="gui\source\xml" x="false"></e><e p="gui\source\fonts" x="false"></e><e p="gui\source\ramdisc" x="false"></e><e p="gui\source\sounds" x="false"></e><e p="gui\source\wad" x="false"></e><e p="gui" x="true"></e><e p="gui\source\homebrewboot" x="false"></e><e p="gui\source\language" x="false"></e><e p="gui\source" x="true"></e><e p="gui\source\libwbfs" x="false"></e><e p="gui\source\libwiigui" x="true"></e><e p="gui\source\patches" x="false"></e></ViewState></pd> <pd><ViewState><e p="gui\source\mload" x="false"></e><e p="gui\source\settings" x="false"></e><e p="gui\source\images" x="false"></e><e p="gui\source\prompts" x="true"></e><e p="gui\source\banner" x="false"></e><e p="gui\source\cheats" x="false"></e><e p="gui\source\network" x="true"></e><e p="gui\source\unzip" x="false"></e><e p="gui\source\usbloader" x="true"></e><e p="gui\source\xml" x="false"></e><e p="gui\source\fonts" x="false"></e><e p="gui\source\ramdisc" x="false"></e><e p="gui\source\sounds" x="false"></e><e p="gui\source\wad" x="false"></e><e p="gui" x="true"></e><e p="gui\source\homebrewboot" x="false"></e><e p="gui\source\language" x="false"></e><e p="gui\source" x="true"></e><e p="gui\source\libwbfs" x="false"></e><e p="gui\source\libwiigui" x="true"></e><e p="gui\source\patches" x="false"></e></ViewState></pd>

View File

@ -106,7 +106,7 @@ static char * number(char * str, long num, int base, int size, int precision
return str; return str;
} }
int kvsprintf(char *buf, const char *fmt, va_list args) int kvsprintf1(char *buf, const char *fmt, va_list args)
{ {
int len; int len;
unsigned long num; unsigned long num;
@ -298,9 +298,8 @@ void gprintf(const char *str, ...)
va_list args; va_list args;
va_start(args, str); va_start(args, str);
len=kvsprintf(__outstr,str,args); len=kvsprintf1(__outstr,str,args);
va_end(args); va_end(args);
write(2, __outstr, len);
usb_sendbuffer_safe(1,__outstr,len); usb_sendbuffer_safe(1,__outstr,len);
} }

View File

@ -1,7 +1,20 @@
#ifndef _GECKO_H_
#define _GECKO_H_
#ifdef __cplusplus
extern "C" {
#endif
//giantpune's functions for USB gecko //giantpune's functions for USB gecko
//use this just like printf(); //use this just like printf();
void gprintf(const char *str, ...); void gprintf(const char *str, ...);
bool InitGecko(); bool InitGecko();
#ifdef __cplusplus
}
#endif
#endif

View File

@ -6,6 +6,7 @@
#include <unistd.h> #include <unistd.h>
#include <ogc/machine/processor.h> #include <ogc/machine/processor.h>
#include <wiiuse/wpad.h> #include <wiiuse/wpad.h>
#include "../lstub.h"
#include "fatmounter.h" #include "fatmounter.h"
#include "dolloader.h" #include "dolloader.h"
@ -36,6 +37,9 @@ void CopyHomebrewMemory(u32 read, u8 *temp, u32 len) {
} }
int BootHomebrew(char * path) { int BootHomebrew(char * path) {
loadStub();
if (Set_Stub_Split(0x00010001,"UNEO")<0)
Set_Stub_Split(0x00010001,"ULNR");
void *buffer = NULL; void *buffer = NULL;
u32 filesize = 0; u32 filesize = 0;
entrypoint entry; entrypoint entry;
@ -102,6 +106,9 @@ int BootHomebrew(char * path) {
} }
int BootHomebrewFromMem() { int BootHomebrewFromMem() {
loadStub();
if (Set_Stub_Split(0x00010001,"UNEO")<0)
Set_Stub_Split(0x00010001,"ULNR");
entrypoint entry; entrypoint entry;
u32 cpu_isr; u32 cpu_isr;

122
source/lstub.c Normal file
View File

@ -0,0 +1,122 @@
//functions for manipulating the HBC stub by giantpune
#include <string.h>
#include <ogcsys.h>
#include <malloc.h>
#include <stdio.h>
#include "lstub.h"
#include "stub_bin.h"
#define TITLE_1(x) ((u8)((x) >> 8))
#define TITLE_2(x) ((u8)((x) >> 16))
#define TITLE_3(x) ((u8)((x) >> 24))
#define TITLE_4(x) ((u8)((x) >> 32))
#define TITLE_5(x) ((u8)((x) >> 40))
#define TITLE_6(x) ((u8)((x) >> 48))
#define TITLE_7(x) ((u8)((x) >> 56))
#define TITLE_ID(x,y) (((u64)(x) << 32) | (y))
s32 Set_Stub(u64 reqID)
{
u32 tmdsize;
u64 tid = 0;
u64 *list;
u32 titlecount;
s32 ret;
u32 i;
ret = ES_GetNumTitles(&titlecount);
if(ret < 0)
return WII_EINTERNAL;
list = memalign(32, titlecount * sizeof(u64) + 32);
ret = ES_GetTitles(list, titlecount);
if(ret < 0) {
free(list);
return WII_EINTERNAL;
}
for(i=0; i<titlecount; i++) {
if (list[i]==reqID)
{
tid = list[i];
break;
}
}
free(list);
if(!tid)
return -69;//id to stub is not installed
if(ES_GetStoredTMDSize(tid, &tmdsize) < 0)
return WII_EINSTALL;
char *stub = (char *)0x800024C6;
stub[0] = TITLE_7(reqID);
stub[1] = TITLE_6(reqID);
stub[8] = TITLE_5(reqID);
stub[9] = TITLE_4(reqID);
stub[4] = TITLE_3(reqID);
stub[5] = TITLE_2(reqID);
stub[12] = TITLE_1(reqID);
stub[13] = ((u8)(reqID));
return 1;
}
s32 Set_Stub_Split(u32 type, const char* reqID)
{
char tmp[4];
u32 lower;
sprintf(tmp,"%c%c%c%c",reqID[0],reqID[1],reqID[2],reqID[3]);
memcpy(&lower, tmp, 4);
u64 reqID64 = TITLE_ID(type, lower);
return Set_Stub(reqID64);
}
void loadStub()
{
char *stubLoc = (char *)0x80001800;
memcpy(stubLoc, stub_bin, stub_bin_size);
}
u64 getStubDest()
{
char * sig = (char *)0x80001804;
if (!(
sig[0] == 'S' &&
sig[1] == 'T' &&
sig[2] == 'U' &&
sig[3] == 'B' &&
sig[4] == 'H' &&
sig[5] == 'A' &&
sig[6] == 'X' &&
sig[7] == 'X'))
return 0;
char *stub = (char *)0x800024C6;
char ret[8];
u64 retu =0;
ret[0] = stub[0];
ret[1] = stub[1];
ret[2] = stub[8];
ret[3] = stub[9];
ret[4] = stub[4];
ret[5] = stub[5];
ret[6] = stub[12];
ret[7] = stub[13];
ret[8] = 0x00;
memcpy(&retu, ret, 8);
return retu;
}

37
source/lstub.h Normal file
View File

@ -0,0 +1,37 @@
//small group of functions to manipulate the HBC stub
//brought to you by giantpune
#ifndef _LSTUB_H_
#define _LSTUB_H_
#ifdef __cplusplus
extern "C" {
#endif
//to set the "return to" stub for a certain ID
//!reqID is the Requested ID to return to
//!returns WII_EINTERNAL if it cant get the list of installed titles with ES functions
//!retuns -69 if the ID is not installed
//!1 if successful
s32 Set_Stub(u64 reqID);
//!same as the above function, but expects a type and 4 char channel ID
s32 Set_Stub_Split(u32 type, const char* reqID);
//load the default HBC stub into memory. as long as nothing writes to the 0x80001800
// +0xDC7 memory block it will stay there. by default it has 0x00010001/JODI.
void loadStub();
//get whatever ID the stub is set to load
//!returns 0 if no stub is loaded into memory (must be the HBC stub at 0x800018000)
//!otherwise returns the ID set to return to
u64 getStubDest();
#ifdef __cplusplus
}
#endif
#endif

View File

@ -35,6 +35,7 @@
#include "wpad.h" #include "wpad.h"
#include "fat.h" #include "fat.h"
#include "gecko.h" #include "gecko.h"
#include "svnrev.h"
extern bool geckoinit; extern bool geckoinit;
@ -128,7 +129,11 @@ main(int argc, char *argv[]) {
setlocale(LC_ALL, "en.UTF-8"); setlocale(LC_ALL, "en.UTF-8");
geckoinit = InitGecko(); geckoinit = InitGecko();
gprintf("\x1b[2J");
gprintf("------------------");
gprintf("\nUSB Loader GX rev%s",GetRev());
gprintf("\nmain(int argc, char *argv[])"); gprintf("\nmain(int argc, char *argv[])");
s32 ret; s32 ret;
bool startupproblem = false; bool startupproblem = false;
@ -141,7 +146,7 @@ main(int argc, char *argv[]) {
} else if (!strncasecmp(argv[0], "sd:/", 4)) } else if (!strncasecmp(argv[0], "sd:/", 4))
bootDevice_found = true; bootDevice_found = true;
} }
/** PAD_Init has to be before InitVideo don't move that **/ /** PAD_Init has to be before InitVideo don't move that **/
PAD_Init(); // initialize PAD/WPAD PAD_Init(); // initialize PAD/WPAD
@ -160,7 +165,7 @@ main(int argc, char *argv[]) {
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0); SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
} }
} }
ret = WBFS_Init(WBFS_DEVICE_USB); ret = WBFS_Init(WBFS_DEVICE_USB);
if (ret < 0) { if (ret < 0) {
@ -189,6 +194,7 @@ main(int argc, char *argv[]) {
SDCard_Init(); // mount SD for loading cfg's SDCard_Init(); // mount SD for loading cfg's
USBDevice_Init(); // and mount USB:/ USBDevice_Init(); // and mount USB:/
gprintf("\n\tSD and USB Init OK");
if (!bootDevice_found) { if (!bootDevice_found) {
//try USB //try USB
@ -201,6 +207,7 @@ main(int argc, char *argv[]) {
gettextCleanUp(); gettextCleanUp();
CFG_Load(); CFG_Load();
gprintf("\n\tbootDevice = %s",bootDevice);
/* Load Custom IOS */ /* Load Custom IOS */
if (Settings.cios == ios222 && IOS_GetVersion() != 222) { if (Settings.cios == ios222 && IOS_GetVersion() != 222) {
@ -235,6 +242,7 @@ main(int argc, char *argv[]) {
sleep(5); sleep(5);
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0); SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
} }
gprintf("\n\tcIOS = %u (Rev %u)",IOS_GetVersion(), IOS_GetRevision());
//! Init the rest of the System //! Init the rest of the System
Sys_Init(); Sys_Init();

View File

@ -398,15 +398,6 @@ int MenuDiscList() {
GuiImageData btnsdcard(imgPath, sdcard_png); GuiImageData btnsdcard(imgPath, sdcard_png);
snprintf(imgPath, sizeof(imgPath), "%sbattery.png", CFG.theme_path);
GuiImageData battery(imgPath, battery_png);
snprintf(imgPath, sizeof(imgPath), "%sbattery_bar.png", CFG.theme_path);
GuiImageData batteryBar(imgPath, battery_bar_png);
snprintf(imgPath, sizeof(imgPath), "%sbattery_red.png", CFG.theme_path);
GuiImageData batteryRed(imgPath, battery_red_png);
snprintf(imgPath, sizeof(imgPath), "%sbattery_bar_red.png", CFG.theme_path);
GuiImageData batteryBarRed(imgPath, battery_bar_red_png);
snprintf(imgPath, sizeof(imgPath), "%sfavIcon.png", CFG.theme_path); snprintf(imgPath, sizeof(imgPath), "%sfavIcon.png", CFG.theme_path);
GuiImageData imgfavIcon(imgPath, favIcon_png); GuiImageData imgfavIcon(imgPath, favIcon_png);
snprintf(imgPath, sizeof(imgPath), "%sfavIcon_gray.png", CFG.theme_path); snprintf(imgPath, sizeof(imgPath), "%sfavIcon_gray.png", CFG.theme_path);
@ -864,6 +855,7 @@ int MenuDiscList() {
while (menu == MENU_NONE) { while (menu == MENU_NONE) {
if (idiotFlag==1) { if (idiotFlag==1) {
gprintf("\n\tIdiot flag");
char idiotBuffer[200]; char idiotBuffer[200];
snprintf(idiotBuffer, sizeof(idiotBuffer), "%s (%s). %s",tr("You have attempted to load a bad image"), snprintf(idiotBuffer, sizeof(idiotBuffer), "%s (%s). %s",tr("You have attempted to load a bad image"),
idiotChar,tr("Most likely it has dimensions that are not evenly divisible by 4.")); idiotChar,tr("Most likely it has dimensions that are not evenly divisible by 4."));
@ -922,12 +914,14 @@ int MenuDiscList() {
if ((datagB<1)&&(Settings.cios==1)&&(Settings.video == ntsc)&&(Settings.hddinfo == hr12)&&(Settings.qboot==1)&&(Settings.wsprompt==0)&&(Settings.language==ger)&&(Settings.tooltips==0)){dataed=1;dataef=1;}if (dataef==1){if (cosa>7){cosa=1;}datag++;if (sina==3){wiiBtn.SetAlignment(ALIGN_LEFT,ALIGN_BOTTOM);wiiBtnImg.SetAngle(0);if(datag>163){datag=1;}else if (datag<62){wiiBtn.SetPosition(((cosa)*70),(-2*(datag)+120));}else if(62<=datag){wiiBtn.SetPosition(((cosa)*70),((datag*2)-130));}if (datag>162){wiiBtn.SetPosition(700,700);w.Remove(&wiiBtn);datagB=2;cosa++;sina=lastrawtime%4;}w.Append(&wiiBtn);}if (sina==2){wiiBtn.SetAlignment(ALIGN_RIGHT,ALIGN_TOP);wiiBtnImg.SetAngle(270);if(datag>163){datag=1;}else if (datag<62){wiiBtn.SetPosition(((-2*(datag)+130)),((cosa)*50));}else if(62<=datag){wiiBtn.SetPosition((2*(datag)-120),((cosa)*50));}if (datag>162){wiiBtn.SetPosition(700,700);w.Remove(&wiiBtn);datagB=2;cosa++;sina=lastrawtime%4;}w.Append(&wiiBtn);}if (sina==1){wiiBtn.SetAlignment(ALIGN_TOP,ALIGN_LEFT);wiiBtnImg.SetAngle(180);if(datag>163){datag=1;}else if (datag<62){wiiBtn.SetPosition(((cosa)*70),(2*(datag)-120));}else if(62<=datag){wiiBtn.SetPosition(((cosa)*70),(-2*(datag)+130));}if (datag>162){wiiBtn.SetPosition(700,700);w.Remove(&wiiBtn);datagB=2;cosa++;sina=lastrawtime%4;}w.Append(&wiiBtn);}if (sina==0){wiiBtn.SetAlignment(ALIGN_TOP,ALIGN_LEFT);wiiBtnImg.SetAngle(90);if(datag>163){datag=1;}else if (datag<62){wiiBtn.SetPosition(((2*(datag)-130)),((cosa)*50));}else if(62<=datag){wiiBtn.SetPosition((-2*(datag)+120),((cosa)*50));}if (datag>162){wiiBtn.SetPosition(700,700);w.Remove(&wiiBtn);datagB=2;cosa++;sina=lastrawtime%4;}w.Append(&wiiBtn);}} if ((datagB<1)&&(Settings.cios==1)&&(Settings.video == ntsc)&&(Settings.hddinfo == hr12)&&(Settings.qboot==1)&&(Settings.wsprompt==0)&&(Settings.language==ger)&&(Settings.tooltips==0)){dataed=1;dataef=1;}if (dataef==1){if (cosa>7){cosa=1;}datag++;if (sina==3){wiiBtn.SetAlignment(ALIGN_LEFT,ALIGN_BOTTOM);wiiBtnImg.SetAngle(0);if(datag>163){datag=1;}else if (datag<62){wiiBtn.SetPosition(((cosa)*70),(-2*(datag)+120));}else if(62<=datag){wiiBtn.SetPosition(((cosa)*70),((datag*2)-130));}if (datag>162){wiiBtn.SetPosition(700,700);w.Remove(&wiiBtn);datagB=2;cosa++;sina=lastrawtime%4;}w.Append(&wiiBtn);}if (sina==2){wiiBtn.SetAlignment(ALIGN_RIGHT,ALIGN_TOP);wiiBtnImg.SetAngle(270);if(datag>163){datag=1;}else if (datag<62){wiiBtn.SetPosition(((-2*(datag)+130)),((cosa)*50));}else if(62<=datag){wiiBtn.SetPosition((2*(datag)-120),((cosa)*50));}if (datag>162){wiiBtn.SetPosition(700,700);w.Remove(&wiiBtn);datagB=2;cosa++;sina=lastrawtime%4;}w.Append(&wiiBtn);}if (sina==1){wiiBtn.SetAlignment(ALIGN_TOP,ALIGN_LEFT);wiiBtnImg.SetAngle(180);if(datag>163){datag=1;}else if (datag<62){wiiBtn.SetPosition(((cosa)*70),(2*(datag)-120));}else if(62<=datag){wiiBtn.SetPosition(((cosa)*70),(-2*(datag)+130));}if (datag>162){wiiBtn.SetPosition(700,700);w.Remove(&wiiBtn);datagB=2;cosa++;sina=lastrawtime%4;}w.Append(&wiiBtn);}if (sina==0){wiiBtn.SetAlignment(ALIGN_TOP,ALIGN_LEFT);wiiBtnImg.SetAngle(90);if(datag>163){datag=1;}else if (datag<62){wiiBtn.SetPosition(((2*(datag)-130)),((cosa)*50));}else if(62<=datag){wiiBtn.SetPosition((-2*(datag)+120),((cosa)*50));}if (datag>162){wiiBtn.SetPosition(700,700);w.Remove(&wiiBtn);datagB=2;cosa++;sina=lastrawtime%4;}w.Append(&wiiBtn);}}
// respond to button presses // respond to button presses
if (shutdown == 1) { if (shutdown == 1) {
gprintf("\n\tshutdown");
Sys_Shutdown(); Sys_Shutdown();
} }
if (reset == 1) if (reset == 1)
Sys_Reboot(); Sys_Reboot();
if (updateavailable == true) { if (updateavailable == true) {
gprintf("\n\tUpdate Available");
HaltGui(); HaltGui();
GuiWindow ww(640,480); GuiWindow ww(640,480);
w.SetState(STATE_DISABLED); w.SetState(STATE_DISABLED);
@ -943,6 +937,7 @@ int MenuDiscList() {
if (poweroffBtn.GetState() == STATE_CLICKED) { if (poweroffBtn.GetState() == STATE_CLICKED) {
gprintf("\n\tpoweroffBtn clicked");
choice = WindowPrompt(tr("How to Shutdown?"),0,tr("Full Shutdown"), tr("Shutdown to Idle"), tr("Cancel")); choice = WindowPrompt(tr("How to Shutdown?"),0,tr("Full Shutdown"), tr("Shutdown to Idle"), tr("Cancel"));
if (choice == 2) { if (choice == 2) {
Sys_ShutdownToIdel(); Sys_ShutdownToIdel();
@ -960,7 +955,8 @@ int MenuDiscList() {
} }
} else if (gamecntBtn.GetState() == STATE_CLICKED && mountMethod!=3) { } else if (gamecntBtn.GetState() == STATE_CLICKED && mountMethod!=3) {
gamecntBtn.ResetState(); gprintf("\n\tgameCntBtn clicked");
gamecntBtn.ResetState();
char linebuf[150]; char linebuf[150];
snprintf(linebuf, sizeof(linebuf), "%s %sGameList ?",tr("Save Game List to"), Settings.update_path); snprintf(linebuf, sizeof(linebuf), "%s %sGameList ?",tr("Save Game List to"), Settings.update_path);
choice = WindowPrompt(0,linebuf,"TXT","CSV",tr("Back")); choice = WindowPrompt(0,linebuf,"TXT","CSV",tr("Back"));
@ -974,6 +970,7 @@ int MenuDiscList() {
break; break;
} else if (homeBtn.GetState() == STATE_CLICKED) { } else if (homeBtn.GetState() == STATE_CLICKED) {
gprintf("\n\thomeBtn clicked");
s32 thetimeofbg = bgMusic->GetPlayTime(); s32 thetimeofbg = bgMusic->GetPlayTime();
bgMusic->Stop(); bgMusic->Stop();
choice = WindowExitPrompt(tr("Exit USB Loader GX?"),0, tr("Back to Loader"),tr("Wii Menu"),tr("Back"),0); choice = WindowExitPrompt(tr("Exit USB Loader GX?"),0, tr("Back to Loader"),tr("Wii Menu"),tr("Back"),0);
@ -1001,6 +998,8 @@ int MenuDiscList() {
} }
} else if (wiiBtn.GetState() == STATE_CLICKED) { } else if (wiiBtn.GetState() == STATE_CLICKED) {
gprintf("\n\twiiBtn clicked");
dataed++; dataed++;
wiiBtn.ResetState(); wiiBtn.ResetState();
if (Settings.gameDisplay==list) { if (Settings.gameDisplay==list) {
@ -1011,6 +1010,7 @@ int MenuDiscList() {
gameCarousel->SetFocus(1); gameCarousel->SetFocus(1);
} }
} else if (installBtn.GetState() == STATE_CLICKED) { } else if (installBtn.GetState() == STATE_CLICKED) {
gprintf("\n\tinstallBtn clicked");
choice = WindowPrompt(tr("Install a game"),0,tr("Yes"),tr("No")); choice = WindowPrompt(tr("Install a game"),0,tr("Yes"),tr("No"));
if (choice == 1) { if (choice == 1) {
menu = MENU_INSTALL; menu = MENU_INSTALL;
@ -1026,6 +1026,7 @@ int MenuDiscList() {
} }
} }
}else if ((covert & 0x2)&&(covert!=covertOld)) { }else if ((covert & 0x2)&&(covert!=covertOld)) {
gprintf("\n\tNew Disc Detected");
choice = WindowPrompt(tr("New Disc Detected"),0,tr("Install"),tr("Mount DVD drive"),tr("Cancel")); choice = WindowPrompt(tr("New Disc Detected"),0,tr("Install"),tr("Mount DVD drive"),tr("Cancel"));
if (choice == 1) { if (choice == 1) {
menu = MENU_INSTALL; menu = MENU_INSTALL;
@ -1046,6 +1047,7 @@ int MenuDiscList() {
} }
else if (sdcardBtn.GetState() == STATE_CLICKED) { else if (sdcardBtn.GetState() == STATE_CLICKED) {
gprintf("\n\tsdCardBtn Clicked");
SDCard_deInit(); SDCard_deInit();
SDCard_Init(); SDCard_Init();
if (Settings.gameDisplay==list) { if (Settings.gameDisplay==list) {
@ -1069,6 +1071,7 @@ int MenuDiscList() {
} }
else if (DownloadBtn.GetState() == STATE_CLICKED) { else if (DownloadBtn.GetState() == STATE_CLICKED) {
gprintf("\n\tDownloadBtn Clicked");
if (isInserted(bootDevice)) { if (isInserted(bootDevice)) {
choice = WindowPrompt(tr("Cover Download"), 0, tr("Normal Covers"), tr("3D Covers"), tr("Disc Images"), tr("Back")); // ask for download choice choice = WindowPrompt(tr("Cover Download"), 0, tr("Normal Covers"), tr("3D Covers"), tr("Disc Images"), tr("Back")); // ask for download choice
if (choice != 0) { if (choice != 0) {
@ -1110,6 +1113,7 @@ int MenuDiscList() {
}//end download }//end download
else if (settingsBtn.GetState() == STATE_CLICKED) { else if (settingsBtn.GetState() == STATE_CLICKED) {
gprintf("\n\tsettingsBtn Clicked");
if (Settings.gameDisplay==list) { if (Settings.gameDisplay==list) {
startat = gameBrowser->GetSelectedOption(); startat = gameBrowser->GetSelectedOption();
offset = gameBrowser->GetOffset(); offset = gameBrowser->GetOffset();
@ -1126,6 +1130,7 @@ int MenuDiscList() {
} }
else if (favoriteBtn.GetState() == STATE_CLICKED) { else if (favoriteBtn.GetState() == STATE_CLICKED) {
gprintf("\n\tfavoriteBtn Clicked");
Settings.fave=!Settings.fave; Settings.fave=!Settings.fave;
if (isInserted(bootDevice)) { if (isInserted(bootDevice)) {
cfg_save_global(); cfg_save_global();
@ -1138,6 +1143,7 @@ int MenuDiscList() {
else if (searchBtn.GetState() == STATE_CLICKED && mountMethod!=3) { else if (searchBtn.GetState() == STATE_CLICKED && mountMethod!=3) {
gprintf("\n\tsearchBtn Clicked");
show_searchwindow=!show_searchwindow; show_searchwindow=!show_searchwindow;
HaltGui(); HaltGui();
if(searchBar) if(searchBar)
@ -1219,6 +1225,7 @@ int MenuDiscList() {
} }
else if (abcBtn.GetState() == STATE_CLICKED) { else if (abcBtn.GetState() == STATE_CLICKED) {
gprintf("\n\tabcBtn clicked");
if (Settings.sort != all) { if (Settings.sort != all) {
Settings.sort=all; Settings.sort=all;
if (isInserted(bootDevice)) { if (isInserted(bootDevice)) {
@ -1233,6 +1240,7 @@ int MenuDiscList() {
} }
else if (countBtn.GetState() == STATE_CLICKED) { else if (countBtn.GetState() == STATE_CLICKED) {
gprintf("\n\tcountBtn Clicked");
if (Settings.sort != pcount) { if (Settings.sort != pcount) {
Settings.sort=pcount; Settings.sort=pcount;
//if(isSdInserted()) { //if(isSdInserted()) {
@ -1249,6 +1257,7 @@ int MenuDiscList() {
} }
else if (listBtn.GetState() == STATE_CLICKED) { else if (listBtn.GetState() == STATE_CLICKED) {
gprintf("\n\tlistBtn Clicked");
if (Settings.gameDisplay!=list) { if (Settings.gameDisplay!=list) {
Settings.gameDisplay=list; Settings.gameDisplay=list;
menu = MENU_DISCLIST; menu = MENU_DISCLIST;
@ -1264,6 +1273,7 @@ int MenuDiscList() {
else if (gridBtn.GetState() == STATE_CLICKED) { else if (gridBtn.GetState() == STATE_CLICKED) {
gprintf("\n\tgridBtn Clicked");
if (Settings.gameDisplay!=grid) { if (Settings.gameDisplay!=grid) {
Settings.gameDisplay=grid; Settings.gameDisplay=grid;
@ -1279,6 +1289,7 @@ int MenuDiscList() {
} }
else if (carouselBtn.GetState() == STATE_CLICKED) { else if (carouselBtn.GetState() == STATE_CLICKED) {
gprintf("\n\tcarouselBtn Clicked");
if (Settings.gameDisplay!=carousel) { if (Settings.gameDisplay!=carousel) {
Settings.gameDisplay=carousel; Settings.gameDisplay=carousel;
menu = MENU_DISCLIST; menu = MENU_DISCLIST;
@ -1291,10 +1302,12 @@ int MenuDiscList() {
carouselBtn.ResetState(); carouselBtn.ResetState();
} }
} else if (homebrewBtn.GetState() == STATE_CLICKED) { } else if (homebrewBtn.GetState() == STATE_CLICKED) {
gprintf("\n\thomebrewBtn Clicked");
menu = MENU_HOMEBREWBROWSE; menu = MENU_HOMEBREWBROWSE;
break; break;
} else if (gameInfo.GetState() == STATE_CLICKED && mountMethod!=3) { } else if (gameInfo.GetState() == STATE_CLICKED && mountMethod!=3) {
gameInfo.ResetState(); gprintf("\n\tgameinfo Clicked");
gameInfo.ResetState();
if(selectImg1>=0 && selectImg1<(s32)gameCnt) { if(selectImg1>=0 && selectImg1<(s32)gameCnt) {
gameSelected = selectImg1; gameSelected = selectImg1;
rockout(); rockout();
@ -1311,7 +1324,8 @@ int MenuDiscList() {
} }
} }
else if (dvdBtn.GetState() == STATE_CLICKED) { else if (dvdBtn.GetState() == STATE_CLICKED) {
mountMethodOLD = (mountMethod==3?mountMethod:0); gprintf("\n\tdvdBtn Clicked");
mountMethodOLD = (mountMethod==3?mountMethod:0);
mountMethod=DiscMount(dvdheader); mountMethod=DiscMount(dvdheader);
dvdBtn.ResetState(); dvdBtn.ResetState();
@ -1431,7 +1445,8 @@ int MenuDiscList() {
} }
if (idBtn.GetState() == STATE_CLICKED && mountMethod!=3) { if (idBtn.GetState() == STATE_CLICKED && mountMethod!=3) {
struct discHdr * header = &gameList[gameBrowser->GetSelectedOption()]; gprintf("\n\tidBtn Clicked");
struct discHdr * header = &gameList[gameBrowser->GetSelectedOption()];
//enter new game ID //enter new game ID
char entered[10]; char entered[10];
snprintf(entered, sizeof(entered), "%s", IDfull); snprintf(entered, sizeof(entered), "%s", IDfull);
@ -1507,7 +1522,8 @@ int MenuDiscList() {
sprintf(nipple, "%s%s.gct",Settings.Cheatcodespath,IDfull); sprintf(nipple, "%s%s.gct",Settings.Cheatcodespath,IDfull);
exeFile = fopen (nipple ,"rb"); exeFile = fopen (nipple ,"rb");
if (exeFile==NULL) { if (exeFile==NULL) {
sprintf(nipple, "%s %s",nipple,tr("does not exist! Loading game without cheats.")); gprintf("\n\ttried to load missing gct.");
sprintf(nipple, "%s %s",nipple,tr("does not exist! Loading game without cheats."));
WindowPrompt(tr("Error"),nipple,NULL,NULL,NULL,NULL,170); WindowPrompt(tr("Error"),nipple,NULL,NULL,NULL,NULL,170);
} else { } else {
fseek (exeFile, 0, SEEK_END); fseek (exeFile, 0, SEEK_END);
@ -1515,7 +1531,8 @@ int MenuDiscList() {
rewind (exeFile); rewind (exeFile);
fclose(exeFile); fclose(exeFile);
if (size>2056) { if (size>2056) {
sprintf(nipple, "%s %s",nipple,tr("contains over 255 lines of code. It will produce unexpected results.")); gprintf("\n\tgct is too big");
sprintf(nipple, "%s %s",nipple,tr("contains over 255 lines of code. It will produce unexpected results."));
WindowPrompt(tr("Error"),nipple,NULL,NULL,NULL,NULL,170); WindowPrompt(tr("Error"),nipple,NULL,NULL,NULL,NULL,170);
} }
} }
@ -1537,6 +1554,8 @@ int MenuDiscList() {
playcount += 1; playcount += 1;
CFG_save_game_num(header->id); CFG_save_game_num(header->id);
gprintf("\n\tplaycount for %c%c%c%c%c%c raised to %i",header->id[0],header->id[1],header->id[2],header->id[3],header->id[4],header->id[5],playcount);
} }
menu = MENU_EXIT; menu = MENU_EXIT;
break; break;
@ -1555,7 +1574,8 @@ int MenuDiscList() {
sprintf(nipple, "%s%s.dol",Settings.dolpath,IDfull); sprintf(nipple, "%s%s.dol",Settings.dolpath,IDfull);
exeFile = fopen (nipple ,"rb"); exeFile = fopen (nipple ,"rb");
if (exeFile==NULL) { if (exeFile==NULL) {
sprintf(nipple, "%s %s",nipple,tr("does not exist! You Messed something up, Idiot.")); gprintf("\n\tTried to load alt dol that isn't there");
sprintf(nipple, "%s %s",nipple,tr("does not exist! You Messed something up, Idiot."));
WindowPrompt(tr("Error"),nipple,tr("OK")); WindowPrompt(tr("Error"),nipple,tr("OK"));
menu = MENU_CHECK; menu = MENU_CHECK;
wiilight(0); wiilight(0);
@ -1569,7 +1589,8 @@ int MenuDiscList() {
sprintf(nipple, "%s%s.gct",Settings.Cheatcodespath,IDfull); sprintf(nipple, "%s%s.gct",Settings.Cheatcodespath,IDfull);
exeFile = fopen (nipple ,"rb"); exeFile = fopen (nipple ,"rb");
if (exeFile==NULL) { if (exeFile==NULL) {
sprintf(nipple, "%s %s",nipple,tr("does not exist! Loading game without cheats.")); gprintf("\n\ttried to load gct file that isn't there");
sprintf(nipple, "%s %s",nipple,tr("does not exist! Loading game without cheats."));
WindowPrompt(tr("Error"),nipple,NULL,NULL,NULL,NULL,170); WindowPrompt(tr("Error"),nipple,NULL,NULL,NULL,NULL,170);
} else { } else {
fseek (exeFile, 0, SEEK_END); fseek (exeFile, 0, SEEK_END);
@ -1577,7 +1598,8 @@ int MenuDiscList() {
rewind (exeFile); rewind (exeFile);
fclose(exeFile); fclose(exeFile);
if (size>2056) { if (size>2056) {
sprintf(nipple, "%s %s",nipple,tr("contains over 255 lines of code. It will produce unexpected results.")); gprintf("\n\tgct file is too big");
sprintf(nipple, "%s %s",nipple,tr("contains over 255 lines of code. It will produce unexpected results."));
WindowPrompt(tr("Error"),nipple,NULL,NULL,NULL,NULL,170); WindowPrompt(tr("Error"),nipple,NULL,NULL,NULL,NULL,170);
} }
} }
@ -1722,6 +1744,8 @@ int MenuDiscList() {
***************************************************************************/ ***************************************************************************/
static int MenuInstall() { static int MenuInstall() {
gprintf("\nMenuInstall()");
int menu = MENU_NONE; int menu = MENU_NONE;
static struct discHdr headerdisc ATTRIBUTE_ALIGN(32); static struct discHdr headerdisc ATTRIBUTE_ALIGN(32);
@ -2036,6 +2060,7 @@ static int MenuFormat() {
* MenuCheck * MenuCheck
***************************************************************************/ ***************************************************************************/
static int MenuCheck() { static int MenuCheck() {
gprintf("\nMenuCheck()");
int menu = MENU_NONE; int menu = MENU_NONE;
int i = 0; int i = 0;
int choice; int choice;
@ -2192,6 +2217,7 @@ int MainMenu(int menu) {
WindowPrompt(0,tmp,0,0,0,0,100); WindowPrompt(0,tmp,0,0,0,0,100);
} }
*/ */
gprintf("\nExiting main GUI");
CloseXMLDatabase(); CloseXMLDatabase();
ExitGUIThreads(); ExitGUIThreads();
bgMusic->Stop(); bgMusic->Stop();
@ -2217,18 +2243,22 @@ int MainMenu(int menu) {
u32 tid; u32 tid;
sprintf(tmp,"%c%c%c%c",header->id[0],header->id[1],header->id[2],header->id[3]); sprintf(tmp,"%c%c%c%c",header->id[0],header->id[1],header->id[2],header->id[3]);
memcpy(&tid, tmp, 4); memcpy(&tid, tmp, 4);
gprintf("\nBooting title %016llx",TITLE_ID((header->id[5]=='1'?0x00010001:0x00010002),tid));
WII_Initialize(); WII_Initialize();
WII_LaunchTitle(TITLE_ID((header->id[5]=='1'?0x00010001:0x00010002),tid)); WII_LaunchTitle(TITLE_ID((header->id[5]=='1'?0x00010001:0x00010002),tid));
} }
if (mountMethod==2) if (mountMethod==2)
{ {
gprintf("\nLoading BC for GameCube");
WII_Initialize(); WII_Initialize();
WII_LaunchTitle(0x0000000100000100ULL); WII_LaunchTitle(0x0000000100000100ULL);
} }
if (boothomebrew == 1) { if (boothomebrew == 1) {
gprintf("\nBootHomebrew");
BootHomebrew(Settings.selected_homebrew); BootHomebrew(Settings.selected_homebrew);
} else if (boothomebrew == 2) { } else if (boothomebrew == 2) {
gprintf("\nBootHomebrewFromMenu");
BootHomebrewFromMem(); BootHomebrewFromMem();
} else { } else {
@ -2299,12 +2329,16 @@ int MainMenu(int menu) {
{ {
ret = Disc_SetUSB(header->id); ret = Disc_SetUSB(header->id);
if (ret < 0) Sys_BackToLoader(); if (ret < 0) Sys_BackToLoader();
gprintf("\n\tUSB set to game");
} }
else gprintf("\n\tUSB not set, loading DVD");
ret = Disc_Open(); ret = Disc_Open();
if (ret < 0) Sys_BackToLoader(); if (ret < 0) Sys_BackToLoader();
SDCard_deInit(); SDCard_deInit();
USBDevice_deInit(); USBDevice_deInit();
gprintf("\n\tSD and USB DeInit");
if (gameList){ if (gameList){
free(gameList); free(gameList);
@ -2441,7 +2475,7 @@ int MainMenu(int menu) {
vipatch = 0; vipatch = 0;
break; break;
} }
gprintf("\n\tDisc_wiiBoot");
ret = Disc_WiiBoot(videoselected, cheat, vipatch, countrystrings, errorfixer002, alternatedol, alternatedoloffset); ret = Disc_WiiBoot(videoselected, cheat, vipatch, countrystrings, errorfixer002, alternatedol, alternatedoloffset);
if (ret < 0) { if (ret < 0) {
Sys_LoadMenu(); Sys_LoadMenu();

View File

@ -18,10 +18,9 @@
#include "settings/cfg.h" #include "settings/cfg.h"
#include "memory.h" #include "memory.h"
#include "../wad/title.h" #include "../wad/title.h"
#include "../gecko.h"
#include "../patches/dvd_broadway.h" #include "../patches/dvd_broadway.h"
#define BC 0x0000000100000100ULL
/*** Extern functions ***/ /*** Extern functions ***/
extern void ResumeGui(); extern void ResumeGui();
extern void HaltGui(); extern void HaltGui();
@ -36,6 +35,7 @@ extern u8 mountMethod;
*Disk Browser *Disk Browser
*********************************************************************************/ *********************************************************************************/
int DiscBrowse(struct discHdr * header) { int DiscBrowse(struct discHdr * header) {
gprintf("\nDiscBrowser() started");
bool exit = false; bool exit = false;
int ret, choice; int ret, choice;
u64 offset; u64 offset;
@ -134,7 +134,7 @@ int DiscBrowse(struct discHdr * header) {
dolfilecount++; dolfilecount++;
} }
} }
gprintf("\n%i alt dols found",dolfilecount);
if (dolfilecount <= 0) { if (dolfilecount <= 0) {
WindowPrompt(tr("ERROR"), tr("No DOL file found on disc."), tr("OK")); WindowPrompt(tr("ERROR"), tr("No DOL file found on disc."), tr("OK"));
free(fstbuffer); free(fstbuffer);
@ -238,6 +238,7 @@ int DiscBrowse(struct discHdr * header) {
int autoSelectDol(const char *id, bool force) { int autoSelectDol(const char *id, bool force) {
gprintf("\nautoSelectDol() started");
char id4[10]; char id4[10];
sprintf(id4,"%c%c%c%c",id[0],id[1],id[2],id[3]); sprintf(id4,"%c%c%c%c",id[0],id[1],id[2],id[3]);
@ -499,6 +500,7 @@ void __dvd_readidcb(s32 result)
} }
u8 DiscMount(discHdr *header) { u8 DiscMount(discHdr *header) {
gprintf("\nDiscMount() ");
int ret; int ret;
HaltGui(); HaltGui();

View File

@ -35,6 +35,10 @@
#include "xml/xml.h" #include "xml/xml.h"
#include "../wad/title.h" #include "../wad/title.h"
#include "language/UpdateLanguage.h" #include "language/UpdateLanguage.h"
#include "gecko.h"
#include "../lstub.h"
/*** Variables that are also used extern ***/ /*** Variables that are also used extern ***/
@ -66,6 +70,7 @@ extern void HaltGui();
* into the specified variable. * into the specified variable.
***************************************************************************/ ***************************************************************************/
int OnScreenKeyboard(char * var, u32 maxlen, int min) { int OnScreenKeyboard(char * var, u32 maxlen, int min) {
int save = -1; int save = -1;
int keyset = 0; int keyset = 0;
if (Settings.keyset == us) keyset = 0; if (Settings.keyset == us) keyset = 0;
@ -73,6 +78,8 @@ int OnScreenKeyboard(char * var, u32 maxlen, int min) {
else if (Settings.keyset == euro) keyset = 2; else if (Settings.keyset == euro) keyset = 2;
else if (Settings.keyset == azerty) keyset = 3; else if (Settings.keyset == azerty) keyset = 3;
else if (Settings.keyset == qwerty) keyset = 4; else if (Settings.keyset == qwerty) keyset = 4;
gprintf("\nOnScreenKeyboard(%s, %i, %i) \n\tkeyset = %i",var,maxlen,min,keyset);
GuiKeyboard keyboard(var, maxlen, min, keyset); GuiKeyboard keyboard(var, maxlen, min, keyset);
@ -132,6 +139,7 @@ int OnScreenKeyboard(char * var, u32 maxlen, int min) {
mainWindow->Remove(&keyboard); mainWindow->Remove(&keyboard);
mainWindow->SetState(STATE_DEFAULT); mainWindow->SetState(STATE_DEFAULT);
ResumeGui(); ResumeGui();
gprintf("\t%s",(save?"saved":"discarded"));
return save; return save;
} }
@ -140,6 +148,8 @@ int OnScreenKeyboard(char * var, u32 maxlen, int min) {
* Display credits * Display credits
***************************************************************************/ ***************************************************************************/
void WindowCredits() { void WindowCredits() {
gprintf("\nWindowCredits()");
int angle = 0; int angle = 0;
GuiSound * creditsMusic = NULL; GuiSound * creditsMusic = NULL;
@ -362,6 +372,7 @@ void WindowCredits() {
* Display screensaver * Display screensaver
***************************************************************************/ ***************************************************************************/
int WindowScreensaver() { int WindowScreensaver() {
gprintf("\nWindowScreenSaver()");
int i = 0; int i = 0;
bool exit = false; bool exit = false;
//char imgPath[100];//uncomment for themable screensaver //char imgPath[100];//uncomment for themable screensaver
@ -419,12 +430,13 @@ int WindowScreensaver() {
* If title/subtitle or one of the buttons is not needed give him a 0 on that * If title/subtitle or one of the buttons is not needed give him a 0 on that
* place. * place.
***************************************************************************/ ***************************************************************************/
int int WindowPrompt(const char *title, const char *msg, const char *btn1Label,
WindowPrompt(const char *title, const char *msg, const char *btn1Label,
const char *btn2Label, const char *btn3Label, const char *btn2Label, const char *btn3Label,
const char *btn4Label, int wait) { const char *btn4Label, int wait) {
int choice = -1; int choice = -1;
int count = wait; int count = wait;
gprintf("\nWindowPrompt(%s, %s, %s, %s, %s, %s, %i)",title,msg,btn1Label,btn2Label, btn3Label,btn4Label,wait);
GuiWindow promptWindow(472,320); GuiWindow promptWindow(472,320);
promptWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE); promptWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
@ -654,6 +666,8 @@ WindowPrompt(const char *title, const char *msg, const char *btn1Label,
mainWindow->Remove(&promptWindow); mainWindow->Remove(&promptWindow);
mainWindow->SetState(STATE_DEFAULT); mainWindow->SetState(STATE_DEFAULT);
ResumeGui(); ResumeGui();
gprintf(" = %i",choice);
return choice; return choice;
} }
@ -671,6 +685,8 @@ int
WindowExitPrompt(const char *title, const char *msg, const char *btn1Label, WindowExitPrompt(const char *title, const char *msg, const char *btn1Label,
const char *btn2Label, const char *btn3Label, const char *btn2Label, const char *btn3Label,
const char *btn4Label) { const char *btn4Label) {
gprintf("\nWindowExitPrompt()");
GuiSound * homein = NULL; GuiSound * homein = NULL;
homein = new GuiSound(menuin_ogg, menuin_ogg_size, SOUND_OGG, Settings.sfxvolume); homein = new GuiSound(menuin_ogg, menuin_ogg_size, SOUND_OGG, Settings.sfxvolume);
homein->SetVolume(Settings.sfxvolume); homein->SetVolume(Settings.sfxvolume);
@ -684,8 +700,13 @@ WindowExitPrompt(const char *title, const char *msg, const char *btn1Label,
int choice = -1; int choice = -1;
char imgPath[100]; char imgPath[100];
u8 HBC=0;
GuiWindow promptWindow(640,480); u64 oldstub = getStubDest();
loadStub();
if (oldstub != 0x00010001554c4e52ll && oldstub != 0x00010001554e454fll)
Set_Stub(oldstub);
GuiWindow promptWindow(640,480);
promptWindow.SetAlignment(ALIGN_LEFT, ALIGN_TOP); promptWindow.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
promptWindow.SetPosition(0, 0); promptWindow.SetPosition(0, 0);
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM, Settings.sfxvolume); GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM, Settings.sfxvolume);
@ -750,20 +771,9 @@ WindowExitPrompt(const char *title, const char *msg, const char *btn1Label,
batteryBtn[3]->SetPosition(494, 150); batteryBtn[3]->SetPosition(494, 150);
char * sig = (char *)0x80001804;
if (
sig[0] == 'S' &&
sig[1] == 'T' &&
sig[2] == 'U' &&
sig[3] == 'B' &&
sig[4] == 'H' &&
sig[5] == 'A' &&
sig[6] == 'X' &&
sig[7] == 'X')
HBC=1; // Exit to HBC
#endif #endif
GuiTrigger trigA;
GuiTrigger trigA;
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A); trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
GuiTrigger trigB; GuiTrigger trigB;
trigB.SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B); trigB.SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B);
@ -795,7 +805,7 @@ WindowExitPrompt(const char *title, const char *msg, const char *btn1Label,
GuiButton btn1(&btn1Img,&btn1OverImg, 0, 3, 0, 0, &trigA, &btnSoundOver, &btnClick,0); GuiButton btn1(&btn1Img,&btn1OverImg, 0, 3, 0, 0, &trigA, &btnSoundOver, &btnClick,0);
btn1.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN, 50); btn1.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN, 50);
GuiText btn2Txt((HBC!=1?tr("Homebrew Channel"):btn1Label), 28, (GXColor) {0, 0, 0, 255}); GuiText btn2Txt(btn1Label, 28, (GXColor) {0, 0, 0, 255});
GuiImage btn2Img(&button); GuiImage btn2Img(&button);
if (Settings.wsprompt == yes) { if (Settings.wsprompt == yes) {
btn2Txt.SetWidescreen(CFG.widescreen); btn2Txt.SetWidescreen(CFG.widescreen);
@ -805,9 +815,8 @@ WindowExitPrompt(const char *title, const char *msg, const char *btn1Label,
btn2.SetLabel(&btn2Txt); btn2.SetLabel(&btn2Txt);
btn2.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_IN, 50); btn2.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_IN, 50);
btn2.SetRumble(false); btn2.SetRumble(false);
if (HBC==1) { btn2.SetPosition(-150, 0);
btn2.SetPosition(-150, 0);
}
GuiText btn3Txt(btn2Label, 28, (GXColor) {0, 0, 0, 255}); GuiText btn3Txt(btn2Label, 28, (GXColor) {0, 0, 0, 255});
GuiImage btn3Img(&button); GuiImage btn3Img(&button);
@ -909,15 +918,7 @@ WindowExitPrompt(const char *title, const char *msg, const char *btn1Label,
} else if (btn2.GetState() == STATE_CLICKED) { } else if (btn2.GetState() == STATE_CLICKED) {
ret = WindowPrompt(tr("Are you sure?"), 0, tr("Yes"), tr("No")); ret = WindowPrompt(tr("Are you sure?"), 0, tr("Yes"), tr("No"));
if (ret == 1) { if (ret == 1) {
if (HBC!=1) {
CloseXMLDatabase();
ExitGUIThreads();
ShutdownAudio();
StopGX();
WII_Initialize();
WII_BootHBC();
}
choice = 2; choice = 2;
} }
HaltGui(); HaltGui();
@ -1016,6 +1017,7 @@ int GameWindowPrompt() {
char ID[5]; char ID[5];
char IDFull[7]; char IDFull[7];
gprintf("\nGameWindowPrompt()");
GuiWindow promptWindow(472,320); GuiWindow promptWindow(472,320);
promptWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE); promptWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
promptWindow.SetPosition(0, -10); promptWindow.SetPosition(0, -10);
@ -1225,7 +1227,8 @@ int GameWindowPrompt() {
snprintf (ID,sizeof(ID),"%c%c%c", header->id[0], header->id[1], header->id[2]); snprintf (ID,sizeof(ID),"%c%c%c", header->id[0], header->id[1], header->id[2]);
snprintf (IDFull,sizeof(IDFull),"%c%c%c%c%c%c", header->id[0], header->id[1], header->id[2],header->id[3], header->id[4], header->id[5]); snprintf (IDFull,sizeof(IDFull),"%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 (diskCover) gprintf("\n\t%s",IDFull);
if (diskCover)
delete diskCover; delete diskCover;
@ -1519,6 +1522,7 @@ int GameWindowPrompt() {
delete diskCover; delete diskCover;
delete diskCover2; delete diskCover2;
gprintf("\n\treturn %i",choice);
return choice; return choice;
} }
@ -1722,7 +1726,8 @@ FormatingPartition(const char *title, partitionEntry *entry) {
***************************************************************************/ ***************************************************************************/
bool SearchMissingImages(int choice2) { bool SearchMissingImages(int choice2) {
GuiWindow promptWindow(472,320); gprintf("\nSearchMissingImages(%i)",choice2);
GuiWindow promptWindow(472,320);
promptWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE); promptWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
promptWindow.SetPosition(0, -10); promptWindow.SetPosition(0, -10);
@ -1819,7 +1824,8 @@ bool SearchMissingImages(int choice2) {
__Menu_GetEntries(); __Menu_GetEntries();
ResumeGui(); ResumeGui();
if (cntMissFiles > 0) { //&& !IsNetworkInit()) { gprintf(" = %i",cntMissFiles);
if (cntMissFiles > 0) { //&& !IsNetworkInit()) {
NetworkInitPrompt(); NetworkInitPrompt();
} }
@ -1834,7 +1840,8 @@ bool SearchMissingImages(int choice2) {
***************************************************************************/ ***************************************************************************/
bool NetworkInitPrompt() { bool NetworkInitPrompt() {
if (IsNetworkInit()) gprintf("\nNetworkinitPrompt()");
if (IsNetworkInit())
return true; return true;
bool success = true; bool success = true;
@ -2418,6 +2425,7 @@ ProgressDownloadWindow(int choice2) {
int ProgressUpdateWindow() { int ProgressUpdateWindow() {
gprintf("\nProgressUpdateWindow(not full channel)");
int ret = 0, failed = 0, updatemode = -1; int ret = 0, failed = 0, updatemode = -1;
GuiWindow promptWindow(472,320); GuiWindow promptWindow(472,320);
@ -2718,6 +2726,9 @@ int ProgressUpdateWindow() {
if (!failed && ret >= 0 && updatemode == 1) { if (!failed && ret >= 0 && updatemode == 1) {
WindowPrompt(tr("Successfully Updated") , tr("Restarting..."), tr("OK")); WindowPrompt(tr("Successfully Updated") , tr("Restarting..."), tr("OK"));
loadStub();
Set_Stub_Split(0x00010001,"UNEO");
Sys_BackToLoader(); Sys_BackToLoader();
} else if(updatemode > 0 && ret > 0) { } else if(updatemode > 0 && ret > 0) {
WindowPrompt(tr("Successfully Updated") , 0, tr("OK")); WindowPrompt(tr("Successfully Updated") , 0, tr("OK"));
@ -2743,6 +2754,7 @@ int ProgressUpdateWindow() {
int ProgressUpdateWindow() { int ProgressUpdateWindow() {
int ret = 0, failed = 0; int ret = 0, failed = 0;
gprintf("\nProgressUpdateWindow(full channel)");
GuiWindow promptWindow(472,320); GuiWindow promptWindow(472,320);
promptWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE); promptWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
promptWindow.SetPosition(0, -10); promptWindow.SetPosition(0, -10);
@ -3002,14 +3014,16 @@ int ProgressUpdateWindow() {
} else { } else {
//sprintf(nipple, tr("The update wad has been saved as %s. Now let's try to install it."),dolpath); //sprintf(nipple, tr("The update wad has been saved as %s. Now let's try to install it."),dolpath);
//WindowPrompt(0,nipple, tr("OK")); //WindowPrompt(0,nipple, tr("OK"));
error = Wad_Install(wadFile); gprintf("\n\tinstall wad");
error = Wad_Install(wadFile);
fclose(wadFile); fclose(wadFile);
if (error==0) { if (error==0) {
diarhea = remove(dolpath); diarhea = remove(dolpath);
if (diarhea) if (diarhea)
WindowPrompt(tr("Success"),tr("The wad file was installed. But It could not be deleted from the SD card."),tr("OK")); WindowPrompt(tr("Success"),tr("The wad file was installed. But It could not be deleted from the SD card."),tr("OK"));
} else { } else {
sprintf(nipple, tr("The wad installation failed with error %ld"),error); gprintf(" -> failed");
sprintf(nipple, tr("The wad installation failed with error %ld"),error);
WindowPrompt(tr("Error"),nipple,tr("OK")); WindowPrompt(tr("Error"),nipple,tr("OK"));
} }
} }
@ -3022,7 +3036,8 @@ int ProgressUpdateWindow() {
ExitGUIThreads(); ExitGUIThreads();
ShutdownAudio(); ShutdownAudio();
StopGX(); StopGX();
WII_Initialize(); gprintf("\nRebooting");
WII_Initialize();
WII_LaunchTitle(TITLE_ID(0x00010001,0x554c4e52)); WII_LaunchTitle(TITLE_ID(0x00010001,0x554c4e52));
} }

View File

@ -12,7 +12,7 @@
#include "alternatedol.h" #include "alternatedol.h"
#include "fstfile.h" #include "fstfile.h"
#include "settings/cfg.h" #include "settings/cfg.h"
#include "../gecko.h" #include "gecko.h"
/*KENOBI! - FISHEARS*/ /*KENOBI! - FISHEARS*/
extern const unsigned char kenobiwii[]; extern const unsigned char kenobiwii[];
@ -313,6 +313,7 @@ s32 Apploader_Run(entry_point *entry, u8 cheat, u8 videoSelected, u8 vipatch, u8
u32 appldr_len; u32 appldr_len;
s32 ret; s32 ret;
gprintf("\nApploader_Run() started");
//u32 geckoattached = usb_isgeckoalive(EXI_CHANNEL_1); //u32 geckoattached = usb_isgeckoalive(EXI_CHANNEL_1);
//if (geckoattached)usb_flush(EXI_CHANNEL_1); //if (geckoattached)usb_flush(EXI_CHANNEL_1);
@ -345,6 +346,7 @@ s32 Apploader_Run(entry_point *entry, u8 cheat, u8 videoSelected, u8 vipatch, u8
} }
if (cheat || geckoinit) { if (cheat || geckoinit) {
// gprintf("\n\tkenobiwii loaded");
/*HOOKS STUFF - FISHEARS*/ /*HOOKS STUFF - FISHEARS*/
memset((void*)0x80001800,0,kenobiwii_size); memset((void*)0x80001800,0,kenobiwii_size);
memcpy((void*)0x80001800,kenobiwii,kenobiwii_size); memcpy((void*)0x80001800,kenobiwii,kenobiwii_size);
@ -375,6 +377,7 @@ s32 Apploader_Run(entry_point *entry, u8 cheat, u8 videoSelected, u8 vipatch, u8
/** Load alternate dol if set **/ /** Load alternate dol if set **/
if (alternatedol == 1) { if (alternatedol == 1) {
// gprintf("\n\talt dol from FAT");
void *dolbuffer; void *dolbuffer;
int dollen; int dollen;
@ -396,6 +399,7 @@ s32 Apploader_Run(entry_point *entry, u8 cheat, u8 videoSelected, u8 vipatch, u8
free(dolbuffer); free(dolbuffer);
} else if (alternatedol == 2) { } else if (alternatedol == 2) {
// gprintf("\n\talt dol from WBFS");
FST_ENTRY *fst = (FST_ENTRY *)*(u32 *)0x80000038; FST_ENTRY *fst = (FST_ENTRY *)*(u32 *)0x80000038;

View File

@ -10,9 +10,10 @@
#include "disc.h" #include "disc.h"
#include "video.h" #include "video.h"
#include "wdvd.h" #include "wdvd.h"
#include "alternatedol.h" #include "alternatedol.h"
#include "memory.h" #include "memory.h"
#include "../gecko.h"
/* Constants */ /* Constants */
#define PTABLE_OFFSET 0x40000 #define PTABLE_OFFSET 0x40000
#define WII_MAGIC 0x5D1C9EA3 #define WII_MAGIC 0x5D1C9EA3
@ -149,6 +150,8 @@ void __Disc_SetVMode(u8 videoselected) {
if (vmode->viTVMode & VI_NON_INTERLACE) if (vmode->viTVMode & VI_NON_INTERLACE)
VIDEO_WaitVSync(); VIDEO_WaitVSync();
} }
gprintf("\nVideo mode - %s",((progressive)?"progressive":"interlaced"));
} }
void __Disc_SetTime(void) { void __Disc_SetTime(void) {