From a5b2561401ac76fc2a25bd7dcadb715c8613dd4b Mon Sep 17 00:00:00 2001 From: "fix94.1" Date: Fri, 8 Feb 2013 10:39:07 +0000 Subject: [PATCH] -fixed wii game save emu when booting in ios58 mode and reload to cios -speed up the wiiflow bootup a bit in ios58 mode --- source/channel/nand.cpp | 1 - source/main.cpp | 13 ++++----- source/menu/menu_game.cpp | 56 ++++++++++++++++++--------------------- 3 files changed, 33 insertions(+), 37 deletions(-) diff --git a/source/channel/nand.cpp b/source/channel/nand.cpp index d9424458..de7bc0d4 100644 --- a/source/channel/nand.cpp +++ b/source/channel/nand.cpp @@ -81,7 +81,6 @@ void Nand::Init() bool Nand::LoadDefaultIOS(void) { Patch_AHB(); - DeInit_ISFS(); s32 ret = IOS_ReloadIOS(IOS_GetPreferredVersion()); loadIOS(IOS_GetVersion(), false); Init_ISFS(); diff --git a/source/main.cpp b/source/main.cpp index 957edf32..aaef2440 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -40,7 +40,7 @@ int main(int argc, char **argv) char *gameid = NULL; bool Emulator_boot = false; - bool iosOK = false; + bool iosOK = true; for(u8 i = 0; i < argc; i++) { @@ -64,17 +64,18 @@ int main(int argc, char **argv) Emulator_boot = true; } /* Init ISFS */ - NandHandle.Init_ISFS(); - if(InternalSave.CheckSave()) /* Maybe new IOS settings */ + if(neek2o() || Sys_DolphinMode()) + NandHandle.Init_ISFS(); + else + NandHandle.LoadDefaultIOS(); /* safe reload to preferred IOS */ + /* Maybe new IOS settings */ + if(InternalSave.CheckSave()) InternalSave.LoadIOS(); /* Handle (c)IOS Loading */ if(neek2o() || Sys_DolphinMode()) /* wont reload anythin */ iosOK = loadIOS(IOS_GetVersion(), false); else if(useMainIOS && CustomIOS(IOS_GetType(mainIOS))) /* Requested */ iosOK = loadIOS(mainIOS, false) && CustomIOS(CurrentIOS.Type); - else /* safe reload to preferred IOS */ - iosOK = NandHandle.LoadDefaultIOS(); - // Init Sys_Init(); Sys_ExitTo(EXIT_TO_HBC); diff --git a/source/menu/menu_game.cpp b/source/menu/menu_game.cpp index 78ecba8d..aadb3bfe 100644 --- a/source/menu/menu_game.cpp +++ b/source/menu/menu_game.cpp @@ -1265,7 +1265,6 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd) int emuPartition = 0; u8 emulate_mode = min((u32)m_gcfg2.getInt(id, "emulate_save", 0), ARRAY_SIZE(CMenu::_SaveEmu) - 1u); - if(emulate_mode == 0) { emulate_mode = min(max(0, m_cfg.getInt(WII_DOMAIN, "save_emulation", 0)), (int)ARRAY_SIZE(CMenu::_GlobalSaveEmu) - 1); @@ -1274,7 +1273,7 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd) } else if(emulate_mode == 1) emulate_mode = 0; - if(emulate_mode && !dvd && !neek2o() && CurrentIOS.Type == IOS_TYPE_D2X) + if(emulate_mode && !dvd && !neek2o()) { emuPartition = _FindEmuPart(emuPath, false); if(emuPartition < 0) @@ -1305,18 +1304,15 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd) NANDemuView = true; m_cfg.setInt(WII_DOMAIN, "savepartition", emuPartition); m_cfg.setString(WII_DOMAIN, "savepath", emuPath); - if(emulate_mode == 2 || emulate_mode > 3) + if(emulate_mode == 2) { - if(emulate_mode == 2) - { - m_forceext = false; - _hideWaitMessage(); - if(!_AutoExtractSave(id)) - NandHandle.CreateTitleTMD(hdr); - _showWaitMessage(); - } + m_forceext = false; + _hideWaitMessage(); + if(!_AutoExtractSave(id)) + NandHandle.CreateTitleTMD(hdr); + _showWaitMessage(); } - if(emulate_mode > 2) + else if(emulate_mode > 2) { NandHandle.CreateConfig(); NandHandle.Do_Region_Change(id); @@ -1368,28 +1364,28 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd) if(_loadIOS(gameIOS, userIOS, id) == LOAD_IOS_FAILED) Sys_Exit(); } - if(CurrentIOS.Type == IOS_TYPE_D2X && returnTo != 0 && !m_directLaunch) + if(CurrentIOS.Type == IOS_TYPE_D2X) { - if(D2X_PatchReturnTo(returnTo) >= 0) + if(returnTo != 0 && !m_directLaunch && D2X_PatchReturnTo(returnTo) >= 0) memset(&returnTo, 0, sizeof(u32)); - } - if(emulate_mode) - { - /* Enable our Emu NAND */ - DeviceHandle.UnMountAll(); - if(emulate_mode == 3) - NandHandle.Set_RCMode(true); - else if(emulate_mode == 4) - NandHandle.Set_FullMode(true); - else - NandHandle.Set_FullMode(false); - if(NandHandle.Enable_Emu() < 0) + if(emulate_mode) { - NandHandle.Disable_Emu(); - error(_t("errgame6", L"Enabling emu after reload failed!")); - Sys_Exit(); + /* Enable our Emu NAND */ + DeviceHandle.UnMountAll(); + if(emulate_mode == 3) + NandHandle.Set_RCMode(true); + else if(emulate_mode == 4) + NandHandle.Set_FullMode(true); + else + NandHandle.Set_FullMode(false); + if(NandHandle.Enable_Emu() < 0) + { + NandHandle.Disable_Emu(); + error(_t("errgame6", L"Enabling emu after reload failed!")); + Sys_Exit(); + } + DeviceHandle.MountAll(); } - DeviceHandle.MountAll(); } bool wbfs_partition = false; if(!dvd)