diff --git a/source/loader/external_booter.cpp b/source/loader/external_booter.cpp index b7e538da..bbc4245d 100644 --- a/source/loader/external_booter.cpp +++ b/source/loader/external_booter.cpp @@ -20,6 +20,8 @@ #include "cios.h" #include "fst.h" #include "channel/nand.hpp" +#include "devicemounter/sdhc.h" +#include "devicemounter/usbstorage.h" #include "homebrew/homebrew.h" /* External WiiFlow Game Booter */ @@ -90,7 +92,13 @@ void WiiFlow_ExternalBooter(u8 vidMode, bool vipatch, bool countryString, u8 pat memcpy((void *)0x90000000, &normalCFG, sizeof(the_CFG)); DCFlushRange((void *)(0x90000000), sizeof(the_CFG)); +#ifndef DOLPHIN + USBStorage2_Deinit(); + USB_Deinitialize(); + SDHC_Close(); +#endif Nand::Instance()->DeInit_ISFS(true); //cIOS loves magic :P + memcpy(EXECUTE_ADDR, wii_game_booter_dol, wii_game_booter_dol_size); DCFlushRange(EXECUTE_ADDR, wii_game_booter_dol_size); BootHomebrew(); diff --git a/source/main.cpp b/source/main.cpp index 26bdaf27..e9db8e87 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -75,16 +75,16 @@ int main(int argc, char **argv) DCFlushRange(&CurrentIOS, sizeof(IOS_Info)); DeviceHandler::Instance()->SetModes(); } - else if(!AHBRPOT_Patched()) - { - gprintf("Loading cIOS: %d\n", mainIOS); - iosOK = loadIOS(mainIOS, false) && CustomIOS(CurrentIOS.Type); - } - else + else if(AHBRPOT_Patched() && IOS_GetVersion() == 58) { gprintf("AHBPROT patched out, use IOS58\n"); iosOK = loadIOS(58, false); } + else + { + gprintf("Loading cIOS: %d\n", mainIOS); + iosOK = loadIOS(mainIOS, false) && CustomIOS(CurrentIOS.Type); + } #else iosOK = true; #endif diff --git a/source/menu/menu_game.cpp b/source/menu/menu_game.cpp index 25185efb..127092b8 100644 --- a/source/menu/menu_game.cpp +++ b/source/menu/menu_game.cpp @@ -885,8 +885,6 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool disc) cleanup(); DeviceHandler::Instance()->UnMountAll(); - Nand::Instance()->DeInit_ISFS(); - GC_SetVideoMode(videoMode, videoSetting); GC_SetLanguage(GClanguage); if(loader == 2) @@ -895,15 +893,30 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool disc) loadIOS(58, false); else //use cIOS instead to make sure Devolution works anyways loadIOS(mainIOS, false); - writeStub(); + USBStorage2_Deinit(); + USB_Deinitialize(); + SDHC_Close(); DEVO_SetOptions(path.c_str(), DeviceName[currentPartition], id.c_str(), memcard_emu); - DEVO_Boot(); } - DML_New_WriteOptions(); - WII_Initialize(); - if(WII_LaunchTitle(0x100000100LL) < 0) - Sys_LoadMenu(); +#ifndef DOLPHIN + USBStorage2_Deinit(); + USB_Deinitialize(); + SDHC_Close(); +#endif + Nand::Instance()->DeInit_ISFS(); + if(loader == 2) + { + writeStub(); + DEVO_Boot(); + } + else + { + DML_New_WriteOptions(); + WII_Initialize(); + WII_LaunchTitle(0x100000100LL); + } + Sys_LoadMenu(); } void CMenu::_launchHomebrew(const char *filepath, vector arguments) @@ -922,6 +935,12 @@ void CMenu::_launchHomebrew(const char *filepath, vector arguments) for(u32 i = 0; i < arguments.size(); ++i) AddBootArgument(arguments[i].c_str()); loadIOS(58, false); +#ifndef DOLPHIN + USBStorage2_Deinit(); + USB_Deinitialize(); + SDHC_Close(); +#endif + Nand::Instance()->DeInit_ISFS(); writeStub(); BootHomebrew(); } @@ -1422,11 +1441,6 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd) return; } } -#ifndef DOLPHIN - USBStorage2_Deinit(); - USB_Deinitialize(); - SDHC_Close(); -#endif if(CurrentIOS.Type == IOS_TYPE_HERMES) { if(dvd)