diff --git a/Makefile b/Makefile index 78ff72c2..89d2c9e8 100644 --- a/Makefile +++ b/Makefile @@ -105,6 +105,8 @@ export OUTPUT := $(CURDIR)/$(TARGET) $(BUILD): @[ -d $@ ] || mkdir -p $@ @make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile +# @echo debug... +# start geckoreader.exe #--------------------------------------------------------------------------------- lang: @@ -181,6 +183,9 @@ language: $(wildcard $(PROJECTDIR)/Languages/*.lang) %.dat.o : %.dat @echo $(notdir $<) $(bin2o) +%.bin.o : %.bin + @echo $(notdir $<) + $(bin2o) export PATH := $(PROJECTDIR)/gettext-bin:$(PATH) diff --git a/data/stub.bin b/data/stub.bin new file mode 100644 index 00000000..63a37a0b Binary files /dev/null and b/data/stub.bin differ diff --git a/gui.pnproj b/gui.pnproj index 474de74a..88e7a16f 100644 --- a/gui.pnproj +++ b/gui.pnproj @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/gui.pnps b/gui.pnps index bef7a483..db1e67ac 100644 --- a/gui.pnps +++ b/gui.pnps @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/source/gecko.cpp b/source/gecko.c similarity index 98% rename from source/gecko.cpp rename to source/gecko.c index 3c556083..5ab1f65a 100644 --- a/source/gecko.cpp +++ b/source/gecko.c @@ -106,7 +106,7 @@ static char * number(char * str, long num, int base, int size, int precision return str; } -int kvsprintf(char *buf, const char *fmt, va_list args) +int kvsprintf1(char *buf, const char *fmt, va_list args) { int len; unsigned long num; @@ -298,9 +298,8 @@ void gprintf(const char *str, ...) va_list args; va_start(args, str); - len=kvsprintf(__outstr,str,args); + len=kvsprintf1(__outstr,str,args); va_end(args); - write(2, __outstr, len); usb_sendbuffer_safe(1,__outstr,len); } diff --git a/source/gecko.h b/source/gecko.h index 51dca8a5..2df6e2be 100644 --- a/source/gecko.h +++ b/source/gecko.h @@ -1,7 +1,20 @@ + +#ifndef _GECKO_H_ +#define _GECKO_H_ + +#ifdef __cplusplus +extern "C" { +#endif //giantpune's functions for USB gecko //use this just like printf(); void gprintf(const char *str, ...); bool InitGecko(); +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/source/homebrewboot/BootHomebrew.c b/source/homebrewboot/BootHomebrew.c index 81f20be0..8e5d1e12 100644 --- a/source/homebrewboot/BootHomebrew.c +++ b/source/homebrewboot/BootHomebrew.c @@ -6,6 +6,7 @@ #include #include #include +#include "../lstub.h" #include "fatmounter.h" #include "dolloader.h" @@ -36,6 +37,9 @@ void CopyHomebrewMemory(u32 read, u8 *temp, u32 len) { } int BootHomebrew(char * path) { + loadStub(); + if (Set_Stub_Split(0x00010001,"UNEO")<0) + Set_Stub_Split(0x00010001,"ULNR"); void *buffer = NULL; u32 filesize = 0; entrypoint entry; @@ -102,6 +106,9 @@ int BootHomebrew(char * path) { } int BootHomebrewFromMem() { + loadStub(); + if (Set_Stub_Split(0x00010001,"UNEO")<0) + Set_Stub_Split(0x00010001,"ULNR"); entrypoint entry; u32 cpu_isr; diff --git a/source/lstub.c b/source/lstub.c new file mode 100644 index 00000000..6de53fc4 --- /dev/null +++ b/source/lstub.c @@ -0,0 +1,122 @@ +//functions for manipulating the HBC stub by giantpune + +#include +#include +#include +#include + + +#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; i7){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 if (shutdown == 1) { + gprintf("\n\tshutdown"); Sys_Shutdown(); } if (reset == 1) Sys_Reboot(); if (updateavailable == true) { + gprintf("\n\tUpdate Available"); HaltGui(); GuiWindow ww(640,480); w.SetState(STATE_DISABLED); @@ -943,6 +937,7 @@ int MenuDiscList() { 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")); if (choice == 2) { Sys_ShutdownToIdel(); @@ -960,7 +955,8 @@ int MenuDiscList() { } } else if (gamecntBtn.GetState() == STATE_CLICKED && mountMethod!=3) { - gamecntBtn.ResetState(); + gprintf("\n\tgameCntBtn clicked"); + gamecntBtn.ResetState(); char linebuf[150]; snprintf(linebuf, sizeof(linebuf), "%s %sGameList ?",tr("Save Game List to"), Settings.update_path); choice = WindowPrompt(0,linebuf,"TXT","CSV",tr("Back")); @@ -974,6 +970,7 @@ int MenuDiscList() { break; } else if (homeBtn.GetState() == STATE_CLICKED) { + gprintf("\n\thomeBtn clicked"); s32 thetimeofbg = bgMusic->GetPlayTime(); bgMusic->Stop(); 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) { + gprintf("\n\twiiBtn clicked"); + dataed++; wiiBtn.ResetState(); if (Settings.gameDisplay==list) { @@ -1011,6 +1010,7 @@ int MenuDiscList() { gameCarousel->SetFocus(1); } } else if (installBtn.GetState() == STATE_CLICKED) { + gprintf("\n\tinstallBtn clicked"); choice = WindowPrompt(tr("Install a game"),0,tr("Yes"),tr("No")); if (choice == 1) { menu = MENU_INSTALL; @@ -1026,6 +1026,7 @@ int MenuDiscList() { } } }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")); if (choice == 1) { menu = MENU_INSTALL; @@ -1046,6 +1047,7 @@ int MenuDiscList() { } else if (sdcardBtn.GetState() == STATE_CLICKED) { + gprintf("\n\tsdCardBtn Clicked"); SDCard_deInit(); SDCard_Init(); if (Settings.gameDisplay==list) { @@ -1069,6 +1071,7 @@ int MenuDiscList() { } else if (DownloadBtn.GetState() == STATE_CLICKED) { + gprintf("\n\tDownloadBtn Clicked"); if (isInserted(bootDevice)) { choice = WindowPrompt(tr("Cover Download"), 0, tr("Normal Covers"), tr("3D Covers"), tr("Disc Images"), tr("Back")); // ask for download choice if (choice != 0) { @@ -1110,6 +1113,7 @@ int MenuDiscList() { }//end download else if (settingsBtn.GetState() == STATE_CLICKED) { + gprintf("\n\tsettingsBtn Clicked"); if (Settings.gameDisplay==list) { startat = gameBrowser->GetSelectedOption(); offset = gameBrowser->GetOffset(); @@ -1126,6 +1130,7 @@ int MenuDiscList() { } else if (favoriteBtn.GetState() == STATE_CLICKED) { + gprintf("\n\tfavoriteBtn Clicked"); Settings.fave=!Settings.fave; if (isInserted(bootDevice)) { cfg_save_global(); @@ -1138,6 +1143,7 @@ int MenuDiscList() { else if (searchBtn.GetState() == STATE_CLICKED && mountMethod!=3) { + gprintf("\n\tsearchBtn Clicked"); show_searchwindow=!show_searchwindow; HaltGui(); if(searchBar) @@ -1219,6 +1225,7 @@ int MenuDiscList() { } else if (abcBtn.GetState() == STATE_CLICKED) { + gprintf("\n\tabcBtn clicked"); if (Settings.sort != all) { Settings.sort=all; if (isInserted(bootDevice)) { @@ -1233,6 +1240,7 @@ int MenuDiscList() { } else if (countBtn.GetState() == STATE_CLICKED) { + gprintf("\n\tcountBtn Clicked"); if (Settings.sort != pcount) { Settings.sort=pcount; //if(isSdInserted()) { @@ -1249,6 +1257,7 @@ int MenuDiscList() { } else if (listBtn.GetState() == STATE_CLICKED) { + gprintf("\n\tlistBtn Clicked"); if (Settings.gameDisplay!=list) { Settings.gameDisplay=list; menu = MENU_DISCLIST; @@ -1264,6 +1273,7 @@ int MenuDiscList() { else if (gridBtn.GetState() == STATE_CLICKED) { + gprintf("\n\tgridBtn Clicked"); if (Settings.gameDisplay!=grid) { Settings.gameDisplay=grid; @@ -1279,6 +1289,7 @@ int MenuDiscList() { } else if (carouselBtn.GetState() == STATE_CLICKED) { + gprintf("\n\tcarouselBtn Clicked"); if (Settings.gameDisplay!=carousel) { Settings.gameDisplay=carousel; menu = MENU_DISCLIST; @@ -1291,10 +1302,12 @@ int MenuDiscList() { carouselBtn.ResetState(); } } else if (homebrewBtn.GetState() == STATE_CLICKED) { + gprintf("\n\thomebrewBtn Clicked"); menu = MENU_HOMEBREWBROWSE; break; } else if (gameInfo.GetState() == STATE_CLICKED && mountMethod!=3) { - gameInfo.ResetState(); + gprintf("\n\tgameinfo Clicked"); + gameInfo.ResetState(); if(selectImg1>=0 && selectImg1<(s32)gameCnt) { gameSelected = selectImg1; rockout(); @@ -1311,7 +1324,8 @@ int MenuDiscList() { } } else if (dvdBtn.GetState() == STATE_CLICKED) { - mountMethodOLD = (mountMethod==3?mountMethod:0); + gprintf("\n\tdvdBtn Clicked"); + mountMethodOLD = (mountMethod==3?mountMethod:0); mountMethod=DiscMount(dvdheader); dvdBtn.ResetState(); @@ -1431,7 +1445,8 @@ int MenuDiscList() { } 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 char entered[10]; snprintf(entered, sizeof(entered), "%s", IDfull); @@ -1507,7 +1522,8 @@ int MenuDiscList() { sprintf(nipple, "%s%s.gct",Settings.Cheatcodespath,IDfull); exeFile = fopen (nipple ,"rb"); 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); } else { fseek (exeFile, 0, SEEK_END); @@ -1515,7 +1531,8 @@ int MenuDiscList() { rewind (exeFile); fclose(exeFile); 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); } } @@ -1537,6 +1554,8 @@ int MenuDiscList() { playcount += 1; 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; break; @@ -1555,7 +1574,8 @@ int MenuDiscList() { sprintf(nipple, "%s%s.dol",Settings.dolpath,IDfull); exeFile = fopen (nipple ,"rb"); 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")); menu = MENU_CHECK; wiilight(0); @@ -1569,7 +1589,8 @@ int MenuDiscList() { sprintf(nipple, "%s%s.gct",Settings.Cheatcodespath,IDfull); exeFile = fopen (nipple ,"rb"); 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); } else { fseek (exeFile, 0, SEEK_END); @@ -1577,7 +1598,8 @@ int MenuDiscList() { rewind (exeFile); fclose(exeFile); 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); } } @@ -1722,6 +1744,8 @@ int MenuDiscList() { ***************************************************************************/ static int MenuInstall() { + gprintf("\nMenuInstall()"); + int menu = MENU_NONE; static struct discHdr headerdisc ATTRIBUTE_ALIGN(32); @@ -2036,6 +2060,7 @@ static int MenuFormat() { * MenuCheck ***************************************************************************/ static int MenuCheck() { + gprintf("\nMenuCheck()"); int menu = MENU_NONE; int i = 0; int choice; @@ -2192,6 +2217,7 @@ int MainMenu(int menu) { WindowPrompt(0,tmp,0,0,0,0,100); } */ + gprintf("\nExiting main GUI"); CloseXMLDatabase(); ExitGUIThreads(); bgMusic->Stop(); @@ -2217,18 +2243,22 @@ int MainMenu(int menu) { 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); } if (boothomebrew == 1) { + gprintf("\nBootHomebrew"); BootHomebrew(Settings.selected_homebrew); } else if (boothomebrew == 2) { + gprintf("\nBootHomebrewFromMenu"); BootHomebrewFromMem(); } else { @@ -2299,12 +2329,16 @@ int MainMenu(int menu) { { ret = Disc_SetUSB(header->id); if (ret < 0) Sys_BackToLoader(); + gprintf("\n\tUSB set to game"); + } + else gprintf("\n\tUSB not set, loading DVD"); ret = Disc_Open(); if (ret < 0) Sys_BackToLoader(); SDCard_deInit(); USBDevice_deInit(); + gprintf("\n\tSD and USB DeInit"); if (gameList){ free(gameList); @@ -2441,7 +2475,7 @@ int MainMenu(int menu) { vipatch = 0; break; } - + gprintf("\n\tDisc_wiiBoot"); ret = Disc_WiiBoot(videoselected, cheat, vipatch, countrystrings, errorfixer002, alternatedol, alternatedoloffset); if (ret < 0) { Sys_LoadMenu(); diff --git a/source/prompts/DiscBrowser.cpp b/source/prompts/DiscBrowser.cpp index 249a287d..e3a100a8 100644 --- a/source/prompts/DiscBrowser.cpp +++ b/source/prompts/DiscBrowser.cpp @@ -18,10 +18,9 @@ #include "settings/cfg.h" #include "memory.h" #include "../wad/title.h" +#include "../gecko.h" #include "../patches/dvd_broadway.h" -#define BC 0x0000000100000100ULL - /*** Extern functions ***/ extern void ResumeGui(); extern void HaltGui(); @@ -36,6 +35,7 @@ extern u8 mountMethod; *Disk Browser *********************************************************************************/ int DiscBrowse(struct discHdr * header) { + gprintf("\nDiscBrowser() started"); bool exit = false; int ret, choice; u64 offset; @@ -134,7 +134,7 @@ int DiscBrowse(struct discHdr * header) { dolfilecount++; } } - + gprintf("\n%i alt dols found",dolfilecount); if (dolfilecount <= 0) { WindowPrompt(tr("ERROR"), tr("No DOL file found on disc."), tr("OK")); free(fstbuffer); @@ -238,6 +238,7 @@ int DiscBrowse(struct discHdr * header) { int autoSelectDol(const char *id, bool force) { + gprintf("\nautoSelectDol() started"); char id4[10]; 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) { + gprintf("\nDiscMount() "); int ret; HaltGui(); diff --git a/source/prompts/PromptWindows.cpp b/source/prompts/PromptWindows.cpp index 84f495f5..49d34f3a 100644 --- a/source/prompts/PromptWindows.cpp +++ b/source/prompts/PromptWindows.cpp @@ -35,6 +35,10 @@ #include "xml/xml.h" #include "../wad/title.h" #include "language/UpdateLanguage.h" +#include "gecko.h" +#include "../lstub.h" + + /*** Variables that are also used extern ***/ @@ -66,6 +70,7 @@ extern void HaltGui(); * into the specified variable. ***************************************************************************/ int OnScreenKeyboard(char * var, u32 maxlen, int min) { + int save = -1; int 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 == azerty) keyset = 3; 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); @@ -132,6 +139,7 @@ int OnScreenKeyboard(char * var, u32 maxlen, int min) { mainWindow->Remove(&keyboard); mainWindow->SetState(STATE_DEFAULT); ResumeGui(); + gprintf("\t%s",(save?"saved":"discarded")); return save; } @@ -140,6 +148,8 @@ int OnScreenKeyboard(char * var, u32 maxlen, int min) { * Display credits ***************************************************************************/ void WindowCredits() { + gprintf("\nWindowCredits()"); + int angle = 0; GuiSound * creditsMusic = NULL; @@ -362,6 +372,7 @@ void WindowCredits() { * Display screensaver ***************************************************************************/ int WindowScreensaver() { + gprintf("\nWindowScreenSaver()"); int i = 0; bool exit = false; //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 * place. ***************************************************************************/ -int -WindowPrompt(const char *title, const char *msg, const char *btn1Label, +int WindowPrompt(const char *title, const char *msg, const char *btn1Label, const char *btn2Label, const char *btn3Label, const char *btn4Label, int wait) { int choice = -1; int count = wait; + gprintf("\nWindowPrompt(%s, %s, %s, %s, %s, %s, %i)",title,msg,btn1Label,btn2Label, btn3Label,btn4Label,wait); + GuiWindow promptWindow(472,320); promptWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE); @@ -654,6 +666,8 @@ WindowPrompt(const char *title, const char *msg, const char *btn1Label, mainWindow->Remove(&promptWindow); mainWindow->SetState(STATE_DEFAULT); ResumeGui(); + gprintf(" = %i",choice); + return choice; } @@ -671,6 +685,8 @@ int WindowExitPrompt(const char *title, const char *msg, const char *btn1Label, const char *btn2Label, const char *btn3Label, const char *btn4Label) { + gprintf("\nWindowExitPrompt()"); + GuiSound * homein = NULL; homein = new GuiSound(menuin_ogg, menuin_ogg_size, SOUND_OGG, Settings.sfxvolume); homein->SetVolume(Settings.sfxvolume); @@ -684,8 +700,13 @@ WindowExitPrompt(const char *title, const char *msg, const char *btn1Label, int choice = -1; 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.SetPosition(0, 0); 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); - 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 - - GuiTrigger trigA; + GuiTrigger trigA; trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A); GuiTrigger trigB; 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); 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); if (Settings.wsprompt == yes) { btn2Txt.SetWidescreen(CFG.widescreen); @@ -805,9 +815,8 @@ WindowExitPrompt(const char *title, const char *msg, const char *btn1Label, btn2.SetLabel(&btn2Txt); btn2.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_IN, 50); btn2.SetRumble(false); - if (HBC==1) { - btn2.SetPosition(-150, 0); - } + btn2.SetPosition(-150, 0); + GuiText btn3Txt(btn2Label, 28, (GXColor) {0, 0, 0, 255}); GuiImage btn3Img(&button); @@ -909,15 +918,7 @@ WindowExitPrompt(const char *title, const char *msg, const char *btn1Label, } else if (btn2.GetState() == STATE_CLICKED) { ret = WindowPrompt(tr("Are you sure?"), 0, tr("Yes"), tr("No")); if (ret == 1) { - if (HBC!=1) { - CloseXMLDatabase(); - ExitGUIThreads(); - ShutdownAudio(); - StopGX(); - WII_Initialize(); - WII_BootHBC(); - - } + choice = 2; } HaltGui(); @@ -1016,6 +1017,7 @@ int GameWindowPrompt() { char ID[5]; char IDFull[7]; + gprintf("\nGameWindowPrompt()"); GuiWindow promptWindow(472,320); promptWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE); 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 (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; @@ -1519,6 +1522,7 @@ int GameWindowPrompt() { delete diskCover; delete diskCover2; + gprintf("\n\treturn %i",choice); return choice; } @@ -1722,7 +1726,8 @@ FormatingPartition(const char *title, partitionEntry *entry) { ***************************************************************************/ bool SearchMissingImages(int choice2) { - GuiWindow promptWindow(472,320); + gprintf("\nSearchMissingImages(%i)",choice2); + GuiWindow promptWindow(472,320); promptWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE); promptWindow.SetPosition(0, -10); @@ -1819,7 +1824,8 @@ bool SearchMissingImages(int choice2) { __Menu_GetEntries(); ResumeGui(); - if (cntMissFiles > 0) { //&& !IsNetworkInit()) { + gprintf(" = %i",cntMissFiles); + if (cntMissFiles > 0) { //&& !IsNetworkInit()) { NetworkInitPrompt(); } @@ -1834,7 +1840,8 @@ bool SearchMissingImages(int choice2) { ***************************************************************************/ bool NetworkInitPrompt() { - if (IsNetworkInit()) + gprintf("\nNetworkinitPrompt()"); + if (IsNetworkInit()) return true; bool success = true; @@ -2418,6 +2425,7 @@ ProgressDownloadWindow(int choice2) { int ProgressUpdateWindow() { + gprintf("\nProgressUpdateWindow(not full channel)"); int ret = 0, failed = 0, updatemode = -1; GuiWindow promptWindow(472,320); @@ -2718,6 +2726,9 @@ int ProgressUpdateWindow() { if (!failed && ret >= 0 && updatemode == 1) { WindowPrompt(tr("Successfully Updated") , tr("Restarting..."), tr("OK")); + + loadStub(); + Set_Stub_Split(0x00010001,"UNEO"); Sys_BackToLoader(); } else if(updatemode > 0 && ret > 0) { WindowPrompt(tr("Successfully Updated") , 0, tr("OK")); @@ -2743,6 +2754,7 @@ int ProgressUpdateWindow() { int ProgressUpdateWindow() { int ret = 0, failed = 0; + gprintf("\nProgressUpdateWindow(full channel)"); GuiWindow promptWindow(472,320); promptWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE); promptWindow.SetPosition(0, -10); @@ -3002,14 +3014,16 @@ int ProgressUpdateWindow() { } else { //sprintf(nipple, tr("The update wad has been saved as %s. Now let's try to install it."),dolpath); //WindowPrompt(0,nipple, tr("OK")); - error = Wad_Install(wadFile); + gprintf("\n\tinstall wad"); + error = Wad_Install(wadFile); fclose(wadFile); if (error==0) { diarhea = remove(dolpath); if (diarhea) WindowPrompt(tr("Success"),tr("The wad file was installed. But It could not be deleted from the SD card."),tr("OK")); } 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")); } } @@ -3022,7 +3036,8 @@ int ProgressUpdateWindow() { ExitGUIThreads(); ShutdownAudio(); StopGX(); - WII_Initialize(); + gprintf("\nRebooting"); + WII_Initialize(); WII_LaunchTitle(TITLE_ID(0x00010001,0x554c4e52)); } diff --git a/source/usbloader/apploader.c b/source/usbloader/apploader.c index c4db49a8..0952a4b2 100644 --- a/source/usbloader/apploader.c +++ b/source/usbloader/apploader.c @@ -12,7 +12,7 @@ #include "alternatedol.h" #include "fstfile.h" #include "settings/cfg.h" -#include "../gecko.h" +#include "gecko.h" /*KENOBI! - FISHEARS*/ 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; s32 ret; + gprintf("\nApploader_Run() started"); //u32 geckoattached = usb_isgeckoalive(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) { +// gprintf("\n\tkenobiwii loaded"); /*HOOKS STUFF - FISHEARS*/ memset((void*)0x80001800,0,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 **/ if (alternatedol == 1) { +// gprintf("\n\talt dol from FAT"); void *dolbuffer; int dollen; @@ -396,6 +399,7 @@ s32 Apploader_Run(entry_point *entry, u8 cheat, u8 videoSelected, u8 vipatch, u8 free(dolbuffer); } else if (alternatedol == 2) { +// gprintf("\n\talt dol from WBFS"); FST_ENTRY *fst = (FST_ENTRY *)*(u32 *)0x80000038; diff --git a/source/usbloader/disc.c b/source/usbloader/disc.c index 6c46f054..c6084746 100644 --- a/source/usbloader/disc.c +++ b/source/usbloader/disc.c @@ -10,9 +10,10 @@ #include "disc.h" #include "video.h" #include "wdvd.h" -#include "alternatedol.h" +#include "alternatedol.h" #include "memory.h" - +#include "../gecko.h" + /* Constants */ #define PTABLE_OFFSET 0x40000 #define WII_MAGIC 0x5D1C9EA3 @@ -149,6 +150,8 @@ void __Disc_SetVMode(u8 videoselected) { if (vmode->viTVMode & VI_NON_INTERLACE) VIDEO_WaitVSync(); } + gprintf("\nVideo mode - %s",((progressive)?"progressive":"interlaced")); + } void __Disc_SetTime(void) {