From d8298a73d9674733568fa09729395eb065672e53 Mon Sep 17 00:00:00 2001 From: dimok321 <15055714+dimok789@users.noreply.github.com> Date: Fri, 12 Jun 2009 11:50:14 +0000 Subject: [PATCH] *Added IOS223 support NOTE: If your loader is rebooting when you try to start a game its because you initialized Network! Right now initializing the network by trying to update or trying to download covers/discimages the Loader has Issues with booting games. Try booting games directly without initializing the Network. --- gui.pnproj | 2 +- gui.pnps | 2 +- source/PromptWindows.cpp | 14 +++++++----- source/Settings.cpp | 5 +++-- source/cfg.h | 1 + source/disc.c | 4 +++- source/language.c | 4 ++-- source/main.cpp | 2 ++ source/menu.cpp | 37 +++++++++++++++++++++++++------ source/sys.cpp | 47 +++++++++++++++++++++------------------- 10 files changed, 77 insertions(+), 41 deletions(-) diff --git a/gui.pnproj b/gui.pnproj index a3063a94..88d9a4a2 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 4988660c..cab6d274 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/PromptWindows.cpp b/source/PromptWindows.cpp index 1b073a3d..31032e19 100644 --- a/source/PromptWindows.cpp +++ b/source/PromptWindows.cpp @@ -21,6 +21,7 @@ #include "partition.h" #include "usbstorage.h" #include "getentries.h" +#include "mload.h" /*** Variables that are also used extern ***/ int cntMissFiles = 0; @@ -241,13 +242,13 @@ void WindowCredits() i++; y+=24; - sprintf(text, "Tantric %s LibWiiGui", LANGUAGE.awesometool); + sprintf(text, "Waninkoko, Kwiirk & Hermes %s", LANGUAGE.theUSBLoaderandreleasingthesourcecode); txt[i] = new GuiText(text); txt[i]->SetAlignment(ALIGN_LEFT, ALIGN_TOP); txt[i]->SetPosition(100,y); i++; y+=22; - sprintf(text, "Waninkoko & Kwiirk %s", LANGUAGE.theUSBLoaderandreleasingthesourcecode); + sprintf(text, "Tantric %s LibWiiGui", LANGUAGE.awesometool); txt[i] = new GuiText(text); txt[i]->SetAlignment(ALIGN_LEFT, ALIGN_TOP); txt[i]->SetPosition(100,y); i++; @@ -1487,13 +1488,16 @@ DiscWait(const char *title, const char *msg, const char *btn1Label, const char * if(IsDeviceWait) { while(i >= 0) { - timerTxt.SetTextf("%u %s", i,LANGUAGE.secondsleft); VIDEO_WaitVSync(); + timerTxt.SetTextf("%u %s", i,LANGUAGE.secondsleft); + HaltGui(); if(Settings.cios == ios222) { - ret = Sys_IosReload(222); + ret = IOS_ReloadIOS(222); + load_ehc_module(); } else { - ret = Sys_IosReload(249); + ret = IOS_ReloadIOS(249); } + ResumeGui(); sleep(1); ret = WBFS_Init(WBFS_DEVICE_USB); if(ret>=0) diff --git a/source/Settings.cpp b/source/Settings.cpp index fd169282..2b526ba9 100644 --- a/source/Settings.cpp +++ b/source/Settings.cpp @@ -559,7 +559,7 @@ int MenuSettings() if (Settings.titlesOverride == 0) options2.SetValue(10,"%s",LANGUAGE.OFF); else if (Settings.titlesOverride == 1) options2.SetValue(10,"%s",LANGUAGE.ON); - + if(backBtn.GetState() == STATE_CLICKED) { backBtn.ResetState(); @@ -1799,6 +1799,7 @@ int GameSettings(struct discHdr * header) if (iosChoice == i249) options3.SetValue(4,"249"); else if (iosChoice == i222) options3.SetValue(4,"222"); + else if (iosChoice == i223) options3.SetValue(4,"223"); if (parentalcontrolChoice == 0) options3.SetValue(5, LANGUAGE.Always); else if (parentalcontrolChoice == 1) options3.SetValue(5,"1"); @@ -1832,7 +1833,7 @@ int GameSettings(struct discHdr * header) ocarinaChoice = (ocarinaChoice + 1) % 2; break; case 4: - iosChoice = (iosChoice + 1) % 2; + iosChoice = (iosChoice + 1) % 3; break; case 5: parentalcontrolChoice = (parentalcontrolChoice + 1) % 4; diff --git a/source/cfg.h b/source/cfg.h index 11356506..16b11fd3 100644 --- a/source/cfg.h +++ b/source/cfg.h @@ -235,6 +235,7 @@ enum { enum { i249=0, i222, + i223 }; enum { diff --git a/source/disc.c b/source/disc.c index 447d4c05..6715cc78 100644 --- a/source/disc.c +++ b/source/disc.c @@ -287,7 +287,9 @@ s32 Disc_BootPartition(u64 offset, u8 videoselected, u8 cheat, u8 vipatch, u8 pa /* Disconnect Wiimote */ WPAD_Flush(0); WPAD_Disconnect(0); - WPAD_Shutdown(); + WPAD_Shutdown(); + + WDVD_Close(); /* Shutdown IOS subsystems */ SYS_ResetSystem(SYS_SHUTDOWN, 0, 0); diff --git a/source/language.c b/source/language.c index a1ecdfab..8b474cc8 100644 --- a/source/language.c +++ b/source/language.c @@ -196,7 +196,7 @@ snprintf(LANGUAGE.Save, sizeof(LANGUAGE.Save), "Save"); snprintf(LANGUAGE.SaveFailed, sizeof(LANGUAGE.SaveFailed), "Save Failed"); snprintf(LANGUAGE.Specialthanksto, sizeof(LANGUAGE.Specialthanksto), "Special thanks to:"); snprintf(LANGUAGE.For, sizeof(LANGUAGE.For), "for"); -snprintf(LANGUAGE.theUSBLoaderandreleasingthesourcecode, sizeof(LANGUAGE.theUSBLoaderandreleasingthesourcecode), "for the USB Loader source code"); +snprintf(LANGUAGE.theUSBLoaderandreleasingthesourcecode, sizeof(LANGUAGE.theUSBLoaderandreleasingthesourcecode), "for the USB Loader source"); snprintf(LANGUAGE.secondsleft, sizeof(LANGUAGE.secondsleft), "seconds left"); snprintf(LANGUAGE.Setasbackgroundmusic, sizeof(LANGUAGE.Setasbackgroundmusic), "Set as backgroundmusic?"); snprintf(LANGUAGE.SelectthePartition, sizeof(LANGUAGE.SelectthePartition), "Select the Partition"); @@ -274,7 +274,7 @@ snprintf(LANGUAGE.developedby, sizeof(LANGUAGE.developedby), "Developed by"); snprintf(LANGUAGE.publishedby, sizeof(LANGUAGE.publishedby), "Published by"); snprintf(LANGUAGE.wififeatures, sizeof(LANGUAGE.wififeatures), "WiFi Features"); snprintf(LANGUAGE.XMLTitles, sizeof(LANGUAGE.XMLTitles), "Titles from XML"); - + }; diff --git a/source/main.cpp b/source/main.cpp index 1038f1c7..8fe4ea7d 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -113,6 +113,8 @@ main(int argc, char *argv[]) SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0); } + if(Settings.cios == ios222) load_ehc_module(); + SDCard_Init(); // now mount SD:/ USBDevice_Init(); // and mount USB:/ diff --git a/source/menu.cpp b/source/menu.cpp index 8a0fb754..b5cfc650 100644 --- a/source/menu.cpp +++ b/source/menu.cpp @@ -33,6 +33,7 @@ #include "Settings.h" #include "gameinfo.h" #include "mload.h" +#include "usbstorage.h" //#include "xml.h" /* XML - Lustar*/ @@ -1654,18 +1655,33 @@ static int MenuCheck() LANGUAGE.Doyouwanttoretryfor30secs, "cIOS249", "cIOS222", LANGUAGE.BacktoWiiMenu, 0); + SDCard_deInit(); + USBDevice_deInit(); + WPAD_Flush(0); + WPAD_Disconnect(0); + WPAD_Shutdown(); if(ret2 == 1) { Settings.cios = ios249; } else if(ret2 == 2) { if(Settings.cios != ios222) { + HaltGui(); ret2 = Sys_IosReload(222); if(ret2 < 0) Sys_IosReload(249); - if(ret2 < 0) + ResumeGui(); + if(ret2 < 0) { + Wpad_Init(); + WPAD_SetDataFormat(WPAD_CHAN_ALL,WPAD_FMT_BTNS_ACC_IR); + WPAD_SetVRes(WPAD_CHAN_ALL, screenwidth, screenheight); WindowPrompt(LANGUAGE.YoudonthavecIOS,LANGUAGE.LoadingincIOS,LANGUAGE.ok, 0,0,0); - else + WPAD_Flush(0); + WPAD_Disconnect(0); + WPAD_Shutdown(); + } else { Settings.cios = ios222; + load_ehc_module(); + } } } else { Sys_LoadMenu(); @@ -1675,6 +1691,9 @@ static int MenuCheck() //reinitialize SD and USB SDCard_Init(); USBDevice_Init(); + Wpad_Init(); + WPAD_SetDataFormat(WPAD_CHAN_ALL,WPAD_FMT_BTNS_ACC_IR); + WPAD_SetVRes(WPAD_CHAN_ALL, screenwidth, screenheight); } if (ret2 < 0) { WindowPrompt (LANGUAGE.Error,LANGUAGE.USBDevicenotfound, LANGUAGE.ok, 0,0,0); @@ -1850,21 +1869,24 @@ int MainMenu(int menu) ios2 = 222; break; + case i223: + ios2 = 223; + break; + default: ios2 = 249; break; } - if(networkisinitialized == 1 || (iosChoice == i249 && Settings.cios == 1) || (iosChoice == i222 && Settings.cios == 0)) { - /*Needed for IOS Reload */ - ResumeGui(); + if(iosChoice == i223 || networkisinitialized == 1 + || (iosChoice == i249 && Settings.cios == 1) + || (iosChoice == i222 && Settings.cios == 0)) { + if(networkisinitialized == 1) ResumeGui(); ret = Sys_IosReload(ios2); if(ret < 0) { Sys_IosReload(249); - exit(0); } } - ret = Disc_SetUSB(header->id, GetPartition()); if(ret < 0) Sys_BackToLoader(); ret = Disc_Open(); @@ -1872,6 +1894,7 @@ int MainMenu(int menu) SDCard_deInit(); USBDevice_deInit(); + USBStorage_Deinit(); u8 errorfixer002 = 0; switch(fix002) diff --git a/source/sys.cpp b/source/sys.cpp index 01d42512..77ce5ed1 100644 --- a/source/sys.cpp +++ b/source/sys.cpp @@ -1,5 +1,6 @@ #include #include +#include #include "sys.h" #include "wpad.h" @@ -74,12 +75,14 @@ void Sys_Reboot(void) int Sys_IosReload(int IOS) { - s32 ret; + s32 ret = -1; //shutdown SD and USB before IOS Reload in DiscWait SDCard_deInit(); USBDevice_deInit(); + mload_close(); + WPAD_Flush(0); WPAD_Disconnect(0); WPAD_Shutdown(); @@ -87,32 +90,32 @@ int Sys_IosReload(int IOS) USBStorage_Deinit(); WDVD_Close(); - ret = IOS_ReloadIOS(IOS); - - if(IOS == 222) load_ehc_module(); + if(IOS == 249 || IOS == 222 || IOS == 223) { + for(int i = 0; i < 10; i++) { + ret = IOS_ReloadIOS(IOS); + if(ret < 0) return ret; + if(IOS == 222 || IOS == 223) load_ehc_module(); + ret = WBFS_Init(WBFS_DEVICE_USB); + if(!(ret < 0)) break; + sleep(1); + USBStorage_Deinit(); + } + if(ret>=0) { + ret = Disc_Init(); + int i = 0; + if(ret>=0) { + for(i = 0; i < 4; i++) { + ret = WBFS_Open2(i); + if(ret == 0) break; + } + } + } else Sys_BackToLoader(); + } PAD_Init(); Wpad_Init(); WPAD_SetDataFormat(WPAD_CHAN_ALL,WPAD_FMT_BTNS_ACC_IR); WPAD_SetVRes(WPAD_CHAN_ALL, screenwidth, screenheight); - - if(ret < 0) { - return ret; - } - - if(IOS == 249 || IOS == 222) { - ret = WBFS_Init(WBFS_DEVICE_USB); - if(ret>=0) - { - ret = Disc_Init(); - int i = 0; - if(ret>=0) - for(i = 0; i < 4; i++) { - ret = WBFS_Open2(i); - if(ret == 0) break; - } - } - } //reinitialize SD and USB SDCard_Init(); USBDevice_Init();