From 4e81ca8651c4c2c5436c6a216cbf49d6679547f0 Mon Sep 17 00:00:00 2001 From: "fix94.1" Date: Thu, 26 Jul 2012 00:00:49 +0000 Subject: [PATCH] -removed unneeded device mounting on wii and channel booting (should fix games like black ops) -fixed booting wii games from sd card --- source/loader/alt_ios.cpp | 18 ++++++++++-------- source/loader/alt_ios.h | 2 +- source/main.cpp | 2 +- source/menu/menu.hpp | 2 +- source/menu/menu_game.cpp | 21 ++++++--------------- 5 files changed, 19 insertions(+), 26 deletions(-) diff --git a/source/loader/alt_ios.cpp b/source/loader/alt_ios.cpp index 50c50a04..5cffc265 100644 --- a/source/loader/alt_ios.cpp +++ b/source/loader/alt_ios.cpp @@ -78,7 +78,7 @@ void load_dip_249() mload_close(); } -bool loadIOS(int ios, bool launch_game) +bool loadIOS(int ios, bool launch_game, bool emu_channel) { #ifndef DOLPHIN gprintf("Reloading into IOS %i from %i (AHBPROT: %u)...\n", ios, IOS_GetVersion(), HAVE_AHBPROT); @@ -104,15 +104,17 @@ bool loadIOS(int ios, bool launch_game) load_dip_249(); gprintf("Waninkoko cIOS Base IOS%i\n", get_ios_base()); } - - if(launch_game) + if(!emu_channel) { - DeviceHandler::Instance()->MountAll(); - DeviceHandler::Instance()->Open_WBFS(currentPartition); - Disc_Init(); + if(launch_game) + { + DeviceHandler::Instance()->Mount(currentPartition); + DeviceHandler::Instance()->Open_WBFS(currentPartition); + Disc_Init(); + } + else + Open_Inputs(); } - else - Open_Inputs(); return iosOK; #else diff --git a/source/loader/alt_ios.h b/source/loader/alt_ios.h index 4f60b1b5..989d00fc 100644 --- a/source/loader/alt_ios.h +++ b/source/loader/alt_ios.h @@ -7,7 +7,7 @@ extern "C" { #endif -bool loadIOS(int ios, bool launch_game); +bool loadIOS(int ios, bool launch_game, bool emu_channel); u32 get_ios_base(); extern int mainIOS; diff --git a/source/main.cpp b/source/main.cpp index 97b74005..647a9c77 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -66,7 +66,7 @@ int main(int argc, char **argv) #ifndef DOLPHIN // Load Custom IOS gprintf("Loading cIOS: %d\n", mainIOS); - bool iosOK = loadIOS(mainIOS, false); + bool iosOK = loadIOS(mainIOS, false, false); u8 mainIOSBase = 0; D2X(mainIOS, &mainIOSBase); diff --git a/source/menu/menu.hpp b/source/menu/menu.hpp index cd4afc88..d51b156f 100644 --- a/source/menu/menu.hpp +++ b/source/menu/menu.hpp @@ -995,7 +995,7 @@ private: bool m_use_wifi_gecko; void _reload_wifi_gecko(); bool _loadFile(SmartBuf &buffer, u32 &size, const char *path, const char *file); - int _loadIOS(u8 ios, int userIOS, string id); + int _loadIOS(u8 ios, int userIOS, string id, bool emu_channel); void _launch(dir_discHdr *hdr); void _launchGame(dir_discHdr *hdr, bool dvd); void _launchChannel(dir_discHdr *hdr); diff --git a/source/menu/menu_game.cpp b/source/menu/menu_game.cpp index af2bf3a9..b936567a 100644 --- a/source/menu/menu_game.cpp +++ b/source/menu/menu_game.cpp @@ -40,7 +40,6 @@ #include "Gekko.h" #ifndef DOLPHIN -#include "devicemounter/sdhc.h" #include "devicemounter/usbstorage.h" #endif @@ -879,7 +878,6 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool disc) if(loader == 2) DEVO_Boot(); - SDHC_Init(); DML_New_WriteOptions(); WII_Initialize(); if(WII_LaunchTitle(0x100000100LL) < 0) @@ -912,17 +910,16 @@ void CMenu::_launchHomebrew(const char *filepath, vector arguments) #ifndef DOLPHIN USBStorage2_Deinit(); USB_Deinitialize(); - SDHC_Close(); #endif BootHomebrew(title); } -int CMenu::_loadIOS(u8 gameIOS, int userIOS, string id) +int CMenu::_loadIOS(u8 gameIOS, int userIOS, string id, bool emu_channel) { gprintf("Game ID# %s requested IOS %d. User selected %d\n", id.c_str(), gameIOS, userIOS); if(neek2o()) { - if(!loadIOS(gameIOS, true)) + if(!loadIOS(gameIOS, true, emu_channel)) { _reload_wifi_gecko(); error(sfmt("errgame4", L"Couldn't load IOS %i", gameIOS)); @@ -982,7 +979,7 @@ int CMenu::_loadIOS(u8 gameIOS, int userIOS, string id) if(gameIOS != mainIOS) { gprintf("Reloading IOS into %d\n", gameIOS); - if(!loadIOS(gameIOS, true)) + if(!loadIOS(gameIOS, true, false)) { _reload_wifi_gecko(); error(sfmt("errgame4", L"Couldn't load IOS %i", gameIOS)); @@ -1089,7 +1086,7 @@ void CMenu::_launchChannel(dir_discHdr *hdr) Nand::Instance()->Disable_Emu(); usleep(1000); } - if(_loadIOS(gameIOS, userIOS, id) == LOAD_IOS_FAILED) + if(_loadIOS(gameIOS, userIOS, id, !emu_disabled) == LOAD_IOS_FAILED) return; } if(rtrn != NULL && strlen(rtrn) == 4) @@ -1109,8 +1106,6 @@ void CMenu::_launchChannel(dir_discHdr *hdr) if(!emu_disabled && !neek2o()) { Nand::Instance()->Init(emuPath.c_str(), emuPartition, false); - DeviceHandler::Instance()->UnMount(emuPartition); - if(emulate_mode == 1) Nand::Instance()->Set_FullMode(true); else @@ -1346,7 +1341,7 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd) bool iosLoaded = false; if(!dvd || neek2o()) { - int result = _loadIOS(gameIOS, userIOS, id); + int result = _loadIOS(gameIOS, userIOS, id, false); if(result == LOAD_IOS_FAILED) return; if(result == LOAD_IOS_SUCCEEDED) @@ -1420,13 +1415,9 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd) return; #ifndef DOLPHIN - shadow_mload(); - USBStorage2_Deinit(); USB_Deinitialize(); - - if(currentPartition == 0) - SDHC_Init(); + shadow_mload(); #endif RunApploader(offset, videoMode, vipatch, countryPatch, patchVidMode, aspectRatio, returnTo);