mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-11-27 13:44:15 +01:00
-added temporary reload to cIOS for game install and emu nand mode
when in IOS58 mode -corrected a bug that the usb hdd does not get hooked up properly after IOS reload -small cleanup
This commit is contained in:
parent
c5dbc32d10
commit
794fc9cca6
@ -188,6 +188,7 @@ s32 Nand::Disable_Emu()
|
|||||||
MountedDevice = 0;
|
MountedDevice = 0;
|
||||||
|
|
||||||
emu_enabled = false;
|
emu_enabled = false;
|
||||||
|
usleep(1000);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ void DeviceHandler::MountAll()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceHandler::UnMountAll(bool ShutdownUSB)
|
void DeviceHandler::UnMountAll()
|
||||||
{
|
{
|
||||||
for(u32 i = SD; i < MAXDEVICES; i++)
|
for(u32 i = SD; i < MAXDEVICES; i++)
|
||||||
UnMount(i);
|
UnMount(i);
|
||||||
@ -84,9 +84,8 @@ void DeviceHandler::UnMountAll(bool ShutdownUSB)
|
|||||||
usb1 = NULL;
|
usb1 = NULL;
|
||||||
|
|
||||||
USBStorage2_Deinit();
|
USBStorage2_Deinit();
|
||||||
SDHC_Close();
|
|
||||||
if(ShutdownUSB)
|
|
||||||
USB_Deinitialize();
|
USB_Deinitialize();
|
||||||
|
SDHC_Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DeviceHandler::Mount(int dev)
|
bool DeviceHandler::Mount(int dev)
|
||||||
@ -420,3 +419,13 @@ void DeviceHandler::UnMountDevolution(int CurrentPartition)
|
|||||||
OGC_Device->UnMount(NewPartition);
|
OGC_Device->UnMount(NewPartition);
|
||||||
delete OGC_Device;
|
delete OGC_Device;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool DeviceHandler::UsablePartitionMounted()
|
||||||
|
{
|
||||||
|
for(u8 i = SD; i < MAXDEVICES; i++)
|
||||||
|
{
|
||||||
|
if(IsInserted(i) && !GetWbfsHandle(i)) //Everything besides WBFS for configuration
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
@ -72,7 +72,7 @@ class DeviceHandler
|
|||||||
void SetModes();
|
void SetModes();
|
||||||
|
|
||||||
void MountAll();
|
void MountAll();
|
||||||
void UnMountAll(bool ShutdownUSB = false);
|
void UnMountAll();
|
||||||
bool Mount(int dev);
|
bool Mount(int dev);
|
||||||
bool IsInserted(int dev);
|
bool IsInserted(int dev);
|
||||||
void UnMount(int dev);
|
void UnMount(int dev);
|
||||||
@ -85,6 +85,7 @@ class DeviceHandler
|
|||||||
bool SD_Inserted() { if(sd) return sd->IsInserted(); return false; }
|
bool SD_Inserted() { if(sd) return sd->IsInserted(); return false; }
|
||||||
bool USB0_Inserted() { if(usb0) return usb0->IsInserted(); return false; }
|
bool USB0_Inserted() { if(usb0) return usb0->IsInserted(); return false; }
|
||||||
bool USB1_Inserted() { if(usb1) return usb1->IsInserted(); return false; }
|
bool USB1_Inserted() { if(usb1) return usb1->IsInserted(); return false; }
|
||||||
|
bool UsablePartitionMounted();
|
||||||
void WaitForDevice(const DISC_INTERFACE *Handle);
|
void WaitForDevice(const DISC_INTERFACE *Handle);
|
||||||
|
|
||||||
void UnMountSD() { if(sd) delete sd; sd = NULL; }
|
void UnMountSD() { if(sd) delete sd; sd = NULL; }
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include "sys.h"
|
#include "sys.h"
|
||||||
#include "wbfs.h"
|
#include "wbfs.h"
|
||||||
#include "wdvd.h"
|
#include "wdvd.h"
|
||||||
|
#include "external_booter.hpp"
|
||||||
#include "channel/nand.hpp"
|
#include "channel/nand.hpp"
|
||||||
#include "devicemounter/DeviceHandler.hpp"
|
#include "devicemounter/DeviceHandler.hpp"
|
||||||
#include "devicemounter/sdhc.h"
|
#include "devicemounter/sdhc.h"
|
||||||
@ -82,17 +83,17 @@ void load_dip_249()
|
|||||||
|
|
||||||
bool loadIOS(int ios, bool MountDevices)
|
bool loadIOS(int ios, bool MountDevices)
|
||||||
{
|
{
|
||||||
|
int CurIOS = IOS_GetVersion();
|
||||||
bool ret = true;
|
bool ret = true;
|
||||||
m_music.Stop();
|
|
||||||
DeviceHandler::Instance()->UnMountAll();
|
|
||||||
|
|
||||||
#ifndef DOLPHIN
|
#ifndef DOLPHIN
|
||||||
if(ios != IOS_GetVersion())
|
if(ios != CurIOS)
|
||||||
{
|
{
|
||||||
WDVD_Close();
|
WDVD_Close();
|
||||||
Close_Inputs();
|
Close_Inputs();
|
||||||
gprintf("Reloading into IOS %i from %i...\n", ios, IOS_GetVersion());
|
m_music.Stop();
|
||||||
Nand::Instance()->DeInit_ISFS();
|
gprintf("Reloading into IOS %i from %i...\n", ios, CurIOS);
|
||||||
|
ShutdownBeforeExit();
|
||||||
ret = IOS_ReloadIOS(ios) == 0;
|
ret = IOS_ReloadIOS(ios) == 0;
|
||||||
Nand::Instance()->Init_ISFS();
|
Nand::Instance()->Init_ISFS();
|
||||||
gprintf("AHBPROT after IOS Reload: %u\n", AHBRPOT_Patched());
|
gprintf("AHBPROT after IOS Reload: %u\n", AHBRPOT_Patched());
|
||||||
@ -106,7 +107,7 @@ bool loadIOS(int ios, bool MountDevices)
|
|||||||
else if(CurrentIOS.Type == IOS_TYPE_WANIN && CurrentIOS.Revision >= 18)
|
else if(CurrentIOS.Type == IOS_TYPE_WANIN && CurrentIOS.Revision >= 18)
|
||||||
load_dip_249();
|
load_dip_249();
|
||||||
DeviceHandler::Instance()->SetModes();
|
DeviceHandler::Instance()->SetModes();
|
||||||
if(MountDevices)
|
if(MountDevices && ios != CurIOS)
|
||||||
DeviceHandler::Instance()->MountAll();
|
DeviceHandler::Instance()->MountAll();
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -111,7 +111,7 @@ void ExternalBooter_ChannelSetup(void *dolchunkoffset[18], u32 dolchunksize[18],
|
|||||||
|
|
||||||
void ShutdownBeforeExit(bool KeepPatches)
|
void ShutdownBeforeExit(bool KeepPatches)
|
||||||
{
|
{
|
||||||
DeviceHandler::Instance()->UnMountAll(true); //Shutdown USB as well
|
DeviceHandler::Instance()->UnMountAll();
|
||||||
Nand::Instance()->DeInit_ISFS(KeepPatches);
|
Nand::Instance()->DeInit_ISFS(KeepPatches);
|
||||||
WDVD_Close();
|
WDVD_Close();
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#include "memory/memory.h"
|
#include "memory/memory.h"
|
||||||
|
|
||||||
CMenu *mainMenu;
|
CMenu *mainMenu;
|
||||||
bool useMainIOS;
|
bool useMainIOS = false;
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
@ -96,32 +96,35 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
DeviceHandler::Instance()->MountAll();
|
DeviceHandler::Instance()->MountAll();
|
||||||
vid.waitMessage(0.15f);
|
vid.waitMessage(0.15f);
|
||||||
bool dipOK = WDVD_Init() >= 0;
|
|
||||||
|
|
||||||
mainMenu = new CMenu(vid);
|
mainMenu = new CMenu(vid);
|
||||||
Open_Inputs();
|
Open_Inputs();
|
||||||
mainMenu->init();
|
mainMenu->init();
|
||||||
if(CurrentIOS.Version != mainIOS && !neek2o())
|
if(CurrentIOS.Version != mainIOS && !neek2o())
|
||||||
{
|
{
|
||||||
if(useMainIOS || (!DeviceHandler::Instance()->IsInserted(SD) && !DeviceHandler::Instance()->IsInserted(USB1)))
|
if(useMainIOS || !DeviceHandler::Instance()->UsablePartitionMounted())
|
||||||
{
|
{
|
||||||
iosOK = loadIOS(mainIOS, true) && CustomIOS(CurrentIOS.Type);
|
iosOK = loadIOS(mainIOS, true) && CustomIOS(CurrentIOS.Type);
|
||||||
Open_Inputs();
|
Open_Inputs();
|
||||||
mainMenu->init();
|
mainMenu->init();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(CurrentIOS.Version == mainIOS)
|
||||||
|
useMainIOS = true; //Needed for later checks
|
||||||
|
|
||||||
if(!iosOK)
|
if(!iosOK)
|
||||||
mainMenu->terror("errboot1", L"No cIOS found!\ncIOS d2x 249 base 56 and 250 base 57 are enough for all your games.");
|
mainMenu->terror("errboot1", L"No cIOS found!\ncIOS d2x 249 base 56 and 250 base 57 are enough for all your games.");
|
||||||
else if(!DeviceHandler::Instance()->IsInserted(SD) && !DeviceHandler::Instance()->IsInserted(USB1))
|
else if(!DeviceHandler::Instance()->UsablePartitionMounted())
|
||||||
mainMenu->terror("errboot2", L"Could not find a device to save configuration files on!");
|
mainMenu->terror("errboot2", L"Could not find a device to save configuration files on!");
|
||||||
else if(!dipOK)
|
else if(WDVD_Init() < 0)
|
||||||
mainMenu->terror("errboot3", L"Could not initialize the DIP module!");
|
mainMenu->terror("errboot3", L"Could not initialize the DIP module!");
|
||||||
else if(gameid != NULL && strlen(gameid) == 6)
|
|
||||||
mainMenu->directlaunch(gameid);
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(Emulator_boot)
|
if(Emulator_boot)
|
||||||
mainMenu->m_Emulator_boot = true;
|
mainMenu->m_Emulator_boot = true;
|
||||||
|
if(gameid != NULL && strlen(gameid) == 6)
|
||||||
|
mainMenu->directlaunch(gameid);
|
||||||
|
else
|
||||||
mainMenu->main();
|
mainMenu->main();
|
||||||
}
|
}
|
||||||
//Exit WiiFlow, no game booted...
|
//Exit WiiFlow, no game booted...
|
||||||
|
@ -2099,13 +2099,7 @@ bool CMenu::_loadChannelList(void)
|
|||||||
Nand::Instance()->Disable_Emu();
|
Nand::Instance()->Disable_Emu();
|
||||||
if(!disable_emu)
|
if(!disable_emu)
|
||||||
{
|
{
|
||||||
if(CurrentIOS.Version != mainIOS)
|
_TempLoadIOS();
|
||||||
{
|
|
||||||
loadIOS(mainIOS, true);
|
|
||||||
Open_Inputs();
|
|
||||||
for(int chan = WPAD_MAX_WIIMOTES-2; chan >= 0; chan--)
|
|
||||||
WPAD_SetVRes(chan, m_vid.width() + m_cursor[chan].width(), m_vid.height() + m_cursor[chan].height());
|
|
||||||
}
|
|
||||||
if(!DeviceHandler::Instance()->IsInserted(lastPartition))
|
if(!DeviceHandler::Instance()->IsInserted(lastPartition))
|
||||||
DeviceHandler::Instance()->Mount(lastPartition);
|
DeviceHandler::Instance()->Mount(lastPartition);
|
||||||
|
|
||||||
@ -2145,8 +2139,11 @@ bool CMenu::_loadList(void)
|
|||||||
if((m_current_view == COVERFLOW_CHANNEL && m_cfg.getBool("NAND", "disable", true)) || m_current_view != COVERFLOW_CHANNEL)
|
if((m_current_view == COVERFLOW_CHANNEL && m_cfg.getBool("NAND", "disable", true)) || m_current_view != COVERFLOW_CHANNEL)
|
||||||
Nand::Instance()->Disable_Emu();
|
Nand::Instance()->Disable_Emu();
|
||||||
|
|
||||||
if(m_cfg.getBool(_domainFromView(), "update_cache")) m_gameList.Update(m_current_view);
|
if(m_cfg.getBool(_domainFromView(), "update_cache"))
|
||||||
|
m_gameList.Update(m_current_view);
|
||||||
|
|
||||||
|
/* Make sure if coming from Emu NAND the IOS is set back */
|
||||||
|
_TempLoadIOS(IOS_TYPE_NORMAL_IOS);
|
||||||
gprintf("Loading items of ");
|
gprintf("Loading items of ");
|
||||||
|
|
||||||
bool retval;
|
bool retval;
|
||||||
@ -2563,3 +2560,25 @@ void CMenu::RemoveCover( char * id )
|
|||||||
remove(fmt("%s/%s.wfc", m_cacheDir.c_str(), id));
|
remove(fmt("%s/%s.wfc", m_cacheDir.c_str(), id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CMenu::_TempLoadIOS(int IOS)
|
||||||
|
{
|
||||||
|
#ifndef DOLPHIN
|
||||||
|
/* Only temp reload in IOS58 mode */
|
||||||
|
if(useMainIOS || neek2o())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(IOS == IOS_TYPE_NORMAL_IOS)
|
||||||
|
IOS = 58;
|
||||||
|
else if(IOS == 0)
|
||||||
|
IOS = mainIOS;
|
||||||
|
|
||||||
|
if(CurrentIOS.Version != IOS)
|
||||||
|
{
|
||||||
|
loadIOS(IOS, true);
|
||||||
|
Open_Inputs();
|
||||||
|
for(int chan = WPAD_MAX_WIIMOTES-2; chan >= 0; chan--)
|
||||||
|
WPAD_SetVRes(chan, m_vid.width() + m_cursor[chan].width(), m_vid.height() + m_cursor[chan].height());
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
@ -1072,7 +1072,8 @@ private:
|
|||||||
static void _gameSoundThread(CMenu *m);
|
static void _gameSoundThread(CMenu *m);
|
||||||
|
|
||||||
static void _load_installed_cioses();
|
static void _load_installed_cioses();
|
||||||
//
|
void _TempLoadIOS(int IOS = 0);
|
||||||
|
|
||||||
struct SOption { const char id[10]; const wchar_t text[16]; };
|
struct SOption { const char id[10]; const wchar_t text[16]; };
|
||||||
static const string _translations[23];
|
static const string _translations[23];
|
||||||
static const SOption _languages[11];
|
static const SOption _languages[11];
|
||||||
|
@ -1083,8 +1083,6 @@ void CMenu::_launchChannel(dir_discHdr *hdr)
|
|||||||
ShutdownBeforeExit();
|
ShutdownBeforeExit();
|
||||||
Launch_nk(gameTitle, emuPath.size() > 1 ? emuPath.c_str() : NULL);
|
Launch_nk(gameTitle, emuPath.size() > 1 ? emuPath.c_str() : NULL);
|
||||||
}
|
}
|
||||||
DeviceHandler::Instance()->UnMountAll();
|
|
||||||
|
|
||||||
if(!forwarder || neek2o())
|
if(!forwarder || neek2o())
|
||||||
{
|
{
|
||||||
if(!emu_disabled)
|
if(!emu_disabled)
|
||||||
@ -1094,10 +1092,7 @@ void CMenu::_launchChannel(dir_discHdr *hdr)
|
|||||||
}
|
}
|
||||||
gameIOS = channel.GetRequestedIOS(gameTitle);
|
gameIOS = channel.GetRequestedIOS(gameTitle);
|
||||||
if(!emu_disabled)
|
if(!emu_disabled)
|
||||||
{
|
|
||||||
Nand::Instance()->Disable_Emu();
|
Nand::Instance()->Disable_Emu();
|
||||||
usleep(1000);
|
|
||||||
}
|
|
||||||
if(_loadIOS(gameIOS, userIOS, id) == LOAD_IOS_FAILED)
|
if(_loadIOS(gameIOS, userIOS, id) == LOAD_IOS_FAILED)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1184,15 +1179,15 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
|
|||||||
return;
|
return;
|
||||||
} while(!(cover & 0x2));
|
} while(!(cover & 0x2));
|
||||||
}
|
}
|
||||||
if(CurrentIOS.Version != mainIOS)
|
|
||||||
loadIOS(mainIOS, true);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
_TempLoadIOS();
|
||||||
/* Open Disc */
|
/* Open Disc */
|
||||||
if(Disc_Open(true) < 0)
|
if(Disc_Open(true) < 0)
|
||||||
{
|
{
|
||||||
error(_t("wbfsoperr2", L"Disc_Open failed"));
|
error(_t("wbfsoperr2", L"Disc_Open failed"));
|
||||||
if (BTN_B_PRESSED) return;
|
if(BTN_B_PRESSED)
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
/* Check disc */
|
/* Check disc */
|
||||||
if(Disc_IsWii() < 0)
|
if(Disc_IsWii() < 0)
|
||||||
@ -1200,7 +1195,8 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
|
|||||||
if (Disc_IsGC() < 0)
|
if (Disc_IsGC() < 0)
|
||||||
{
|
{
|
||||||
error(_t("errgame9", L"This is not a Wii or GC disc"));
|
error(_t("errgame9", L"This is not a Wii or GC disc"));
|
||||||
if (BTN_B_PRESSED) return;
|
if(BTN_B_PRESSED)
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1355,8 +1351,6 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
|
|||||||
m_cat.save(true);
|
m_cat.save(true);
|
||||||
m_cfg.save(true);
|
m_cfg.save(true);
|
||||||
cleanup(); // wifi and sd gecko doesnt work anymore after cleanup
|
cleanup(); // wifi and sd gecko doesnt work anymore after cleanup
|
||||||
DeviceHandler::Instance()->UnMountAll();
|
|
||||||
|
|
||||||
if(CurrentIOS.Type == IOS_TYPE_D2X)
|
if(CurrentIOS.Type == IOS_TYPE_D2X)
|
||||||
{
|
{
|
||||||
/* Open ES Module */
|
/* Open ES Module */
|
||||||
|
@ -306,6 +306,7 @@ bool CMenu::_wbfsOp(CMenu::WBFS_OP op)
|
|||||||
switch(op)
|
switch(op)
|
||||||
{
|
{
|
||||||
case CMenu::WO_ADD_GAME:
|
case CMenu::WO_ADD_GAME:
|
||||||
|
_TempLoadIOS();
|
||||||
m_btnMgr.show(m_wbfsPBar);
|
m_btnMgr.show(m_wbfsPBar);
|
||||||
m_btnMgr.setProgress(m_wbfsPBar, 0.f);
|
m_btnMgr.setProgress(m_wbfsPBar, 0.f);
|
||||||
m_btnMgr.hide(m_wbfsBtnGo);
|
m_btnMgr.hide(m_wbfsBtnGo);
|
||||||
@ -370,7 +371,6 @@ bool CMenu::_wbfsOp(CMenu::WBFS_OP op)
|
|||||||
{
|
{
|
||||||
error(_t("wbfsoperr3", L"This is not a Wii or GC disc!"));
|
error(_t("wbfsoperr3", L"This is not a Wii or GC disc!"));
|
||||||
out = true;
|
out = true;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CMenu::WO_REMOVE_GAME:
|
case CMenu::WO_REMOVE_GAME:
|
||||||
@ -458,7 +458,10 @@ bool CMenu::_wbfsOp(CMenu::WBFS_OP op)
|
|||||||
if(!m_thrdWorking)
|
if(!m_thrdWorking)
|
||||||
{
|
{
|
||||||
if(op == CMenu::WO_ADD_GAME)
|
if(op == CMenu::WO_ADD_GAME)
|
||||||
|
{
|
||||||
WDVD_StopMotor();
|
WDVD_StopMotor();
|
||||||
|
_TempLoadIOS(IOS_TYPE_NORMAL_IOS);
|
||||||
|
}
|
||||||
m_btnMgr.show(m_wbfsBtnBack);
|
m_btnMgr.show(m_wbfsBtnBack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user