WiiFlow_Lite/source/loader/alt_ios.cpp
fledge68 9e85032382 * decided to officially commit my recent update patches *
- fixed gc ciso games to show and launch via WFL. thanks CokeCookie for getting me to fix it. note banners do not show for ciso games unless you use a custom gc banner.
- added (for wii u vwii) to be able to select Wii U channel as the exit to choice either via main cfg pg 4 exit to option or home menu>exit to menu and select wii u menu. 
- removed priiloader and bootmii as exit to options when on wii u vwii
- added random select game option. manually edit wiiflow_lite.ini and under [GENERAL] set "random_select" to yes then while in wiiflow lite main screen hold B and press '-' to have WFL random select a game instead of random boot a game.
- removed region change from savenand emulation types. why? because according to overjoy's commit he said it didn't work yet. it was for a future version of d2x cios when davebaol added it to d2x cios. i looked at all the d2x cios commits from that date to present and didn't see that it was ever added. if i'm wrong someone let me know and i will add it back into wfl.
- made some small bootup changes in case of errors on bootup.
- made some changes to the way wiiflow lite handles emunand switching and other minor emunand code editing.
2017-09-21 22:03:41 +00:00

81 lines
1.8 KiB
C++

#include <ogc/machine/processor.h>
#include "alt_ios.h"
#include "cios.h"
#include "disc.h"
#include "nk.h"
#include "sys.h"
#include "wbfs.h"
#include "wdvd.h"
#include "booter/external_booter.hpp"
#include "channel/nand.hpp"
#include "devicemounter/DeviceHandler.hpp"
#include "devicemounter/sdhc.h"
#include "devicemounter/usbstorage.h"
#include "gecko/gecko.hpp"
#include "memory/mem2.hpp"
#include "memory/memory.h"
#include "types.h"
// mload from uloader by Hermes
#include "mload.h"
#include "ehcmodule_5.h"
#include "dip_plugin_249.h"
#include "mload_modules.h"
static int load_ehc_module_ex(void)
{
u8 *ehc_cfg = search_for_ehcmodule_cfg((u8 *)ehcmodule_5, size_ehcmodule_5);
if(ehc_cfg)
{
ehc_cfg += 12;
ehc_cfg[0] = currentPort;
gprintf("EHC Port info = %i\n", ehc_cfg[0]);
DCFlushRange((void *) (((u32)ehc_cfg[0]) & ~31), 32);
}
load_ehc_module();
return 0;
}
void load_dip_249()
{
gprintf("Starting mload\n");
if(mload_init() < 0)
return;
gprintf("Loading 249 dip...");
int ret = mload_module((void *)dip_plugin_249, size_dip_plugin_249);
gprintf("%d\n", ret);
mload_close();
}
bool loadIOS(int ios, bool MountDevices)
{
int CurIOS = IOS_GetVersion();
bool ret = true;
if(ios != CurIOS && IOS_GetType(ios) != IOS_TYPE_STUB)
{
WDVD_Close();
gprintf("Reloading into IOS %i from %i...\n", ios, CurIOS);
ShutdownBeforeExit();
NandHandle.Patch_AHB(); //No AHBPROT for the next IOS
ret = IOS_ReloadIOS(ios) == 0;
gprintf("AHBPROT after IOS Reload: %u\n", AHBPROT_Patched());
NandHandle.Init_ISFS();
WDVD_Init();
}
IOS_GetCurrentIOSInfo();
if(CurrentIOS.Type == IOS_TYPE_HERMES)
load_ehc_module_ex();
else if(CurrentIOS.Type == IOS_TYPE_WANIN && CurrentIOS.Revision >= 18)
load_dip_249();
DeviceHandle.SetModes();
if(MountDevices && ios != CurIOS)
DeviceHandle.MountAll();
return ret;
}