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;
|
||||
|
||||
emu_enabled = false;
|
||||
usleep(1000);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ void DeviceHandler::MountAll()
|
||||
#endif
|
||||
}
|
||||
|
||||
void DeviceHandler::UnMountAll(bool ShutdownUSB)
|
||||
void DeviceHandler::UnMountAll()
|
||||
{
|
||||
for(u32 i = SD; i < MAXDEVICES; i++)
|
||||
UnMount(i);
|
||||
@ -84,9 +84,8 @@ void DeviceHandler::UnMountAll(bool ShutdownUSB)
|
||||
usb1 = NULL;
|
||||
|
||||
USBStorage2_Deinit();
|
||||
USB_Deinitialize();
|
||||
SDHC_Close();
|
||||
if(ShutdownUSB)
|
||||
USB_Deinitialize();
|
||||
}
|
||||
|
||||
bool DeviceHandler::Mount(int dev)
|
||||
@ -420,3 +419,13 @@ void DeviceHandler::UnMountDevolution(int CurrentPartition)
|
||||
OGC_Device->UnMount(NewPartition);
|
||||
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 MountAll();
|
||||
void UnMountAll(bool ShutdownUSB = false);
|
||||
void UnMountAll();
|
||||
bool Mount(int dev);
|
||||
bool IsInserted(int dev);
|
||||
void UnMount(int dev);
|
||||
@ -85,6 +85,7 @@ class DeviceHandler
|
||||
bool SD_Inserted() { if(sd) return sd->IsInserted(); return false; }
|
||||
bool USB0_Inserted() { if(usb0) return usb0->IsInserted(); return false; }
|
||||
bool USB1_Inserted() { if(usb1) return usb1->IsInserted(); return false; }
|
||||
bool UsablePartitionMounted();
|
||||
void WaitForDevice(const DISC_INTERFACE *Handle);
|
||||
|
||||
void UnMountSD() { if(sd) delete sd; sd = NULL; }
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "sys.h"
|
||||
#include "wbfs.h"
|
||||
#include "wdvd.h"
|
||||
#include "external_booter.hpp"
|
||||
#include "channel/nand.hpp"
|
||||
#include "devicemounter/DeviceHandler.hpp"
|
||||
#include "devicemounter/sdhc.h"
|
||||
@ -82,17 +83,17 @@ void load_dip_249()
|
||||
|
||||
bool loadIOS(int ios, bool MountDevices)
|
||||
{
|
||||
int CurIOS = IOS_GetVersion();
|
||||
bool ret = true;
|
||||
m_music.Stop();
|
||||
DeviceHandler::Instance()->UnMountAll();
|
||||
|
||||
#ifndef DOLPHIN
|
||||
if(ios != IOS_GetVersion())
|
||||
if(ios != CurIOS)
|
||||
{
|
||||
WDVD_Close();
|
||||
Close_Inputs();
|
||||
gprintf("Reloading into IOS %i from %i...\n", ios, IOS_GetVersion());
|
||||
Nand::Instance()->DeInit_ISFS();
|
||||
m_music.Stop();
|
||||
gprintf("Reloading into IOS %i from %i...\n", ios, CurIOS);
|
||||
ShutdownBeforeExit();
|
||||
ret = IOS_ReloadIOS(ios) == 0;
|
||||
Nand::Instance()->Init_ISFS();
|
||||
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)
|
||||
load_dip_249();
|
||||
DeviceHandler::Instance()->SetModes();
|
||||
if(MountDevices)
|
||||
if(MountDevices && ios != CurIOS)
|
||||
DeviceHandler::Instance()->MountAll();
|
||||
|
||||
return ret;
|
||||
|
@ -111,7 +111,7 @@ void ExternalBooter_ChannelSetup(void *dolchunkoffset[18], u32 dolchunksize[18],
|
||||
|
||||
void ShutdownBeforeExit(bool KeepPatches)
|
||||
{
|
||||
DeviceHandler::Instance()->UnMountAll(true); //Shutdown USB as well
|
||||
DeviceHandler::Instance()->UnMountAll();
|
||||
Nand::Instance()->DeInit_ISFS(KeepPatches);
|
||||
WDVD_Close();
|
||||
}
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "memory/memory.h"
|
||||
|
||||
CMenu *mainMenu;
|
||||
bool useMainIOS;
|
||||
bool useMainIOS = false;
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
@ -96,33 +96,36 @@ int main(int argc, char **argv)
|
||||
|
||||
DeviceHandler::Instance()->MountAll();
|
||||
vid.waitMessage(0.15f);
|
||||
bool dipOK = WDVD_Init() >= 0;
|
||||
|
||||
mainMenu = new CMenu(vid);
|
||||
Open_Inputs();
|
||||
mainMenu->init();
|
||||
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);
|
||||
Open_Inputs();
|
||||
mainMenu->init();
|
||||
}
|
||||
}
|
||||
if(CurrentIOS.Version == mainIOS)
|
||||
useMainIOS = true; //Needed for later checks
|
||||
|
||||
if(!iosOK)
|
||||
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!");
|
||||
else if(!dipOK)
|
||||
else if(WDVD_Init() < 0)
|
||||
mainMenu->terror("errboot3", L"Could not initialize the DIP module!");
|
||||
else if(gameid != NULL && strlen(gameid) == 6)
|
||||
mainMenu->directlaunch(gameid);
|
||||
else
|
||||
{
|
||||
if(Emulator_boot)
|
||||
mainMenu->m_Emulator_boot = true;
|
||||
mainMenu->main();
|
||||
if(gameid != NULL && strlen(gameid) == 6)
|
||||
mainMenu->directlaunch(gameid);
|
||||
else
|
||||
mainMenu->main();
|
||||
}
|
||||
//Exit WiiFlow, no game booted...
|
||||
mainMenu->cleanup();
|
||||
|
@ -2099,13 +2099,7 @@ bool CMenu::_loadChannelList(void)
|
||||
Nand::Instance()->Disable_Emu();
|
||||
if(!disable_emu)
|
||||
{
|
||||
if(CurrentIOS.Version != mainIOS)
|
||||
{
|
||||
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());
|
||||
}
|
||||
_TempLoadIOS();
|
||||
if(!DeviceHandler::Instance()->IsInserted(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)
|
||||
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 ");
|
||||
|
||||
bool retval;
|
||||
@ -2563,3 +2560,25 @@ void CMenu::RemoveCover( char * 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 _load_installed_cioses();
|
||||
//
|
||||
void _TempLoadIOS(int IOS = 0);
|
||||
|
||||
struct SOption { const char id[10]; const wchar_t text[16]; };
|
||||
static const string _translations[23];
|
||||
static const SOption _languages[11];
|
||||
|
@ -1083,8 +1083,6 @@ void CMenu::_launchChannel(dir_discHdr *hdr)
|
||||
ShutdownBeforeExit();
|
||||
Launch_nk(gameTitle, emuPath.size() > 1 ? emuPath.c_str() : NULL);
|
||||
}
|
||||
DeviceHandler::Instance()->UnMountAll();
|
||||
|
||||
if(!forwarder || neek2o())
|
||||
{
|
||||
if(!emu_disabled)
|
||||
@ -1094,10 +1092,7 @@ void CMenu::_launchChannel(dir_discHdr *hdr)
|
||||
}
|
||||
gameIOS = channel.GetRequestedIOS(gameTitle);
|
||||
if(!emu_disabled)
|
||||
{
|
||||
Nand::Instance()->Disable_Emu();
|
||||
usleep(1000);
|
||||
}
|
||||
if(_loadIOS(gameIOS, userIOS, id) == LOAD_IOS_FAILED)
|
||||
return;
|
||||
}
|
||||
@ -1165,7 +1160,7 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
|
||||
if(dvd)
|
||||
{
|
||||
u32 cover = 0;
|
||||
#ifndef DOLPHIN
|
||||
#ifndef DOLPHIN
|
||||
if(!neek2o())
|
||||
{
|
||||
Disc_SetUSB(NULL, false);
|
||||
@ -1184,23 +1179,24 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
|
||||
return;
|
||||
} while(!(cover & 0x2));
|
||||
}
|
||||
if(CurrentIOS.Version != mainIOS)
|
||||
loadIOS(mainIOS, true);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
_TempLoadIOS();
|
||||
/* Open Disc */
|
||||
if (Disc_Open(true) < 0)
|
||||
if(Disc_Open(true) < 0)
|
||||
{
|
||||
error(_t("wbfsoperr2", L"Disc_Open failed"));
|
||||
if (BTN_B_PRESSED) return;
|
||||
if(BTN_B_PRESSED)
|
||||
return;
|
||||
}
|
||||
/* Check disc */
|
||||
if (Disc_IsWii() < 0)
|
||||
if(Disc_IsWii() < 0)
|
||||
{
|
||||
if (Disc_IsGC() < 0)
|
||||
{
|
||||
error(_t("errgame9", L"This is not a Wii or GC disc"));
|
||||
if (BTN_B_PRESSED) return;
|
||||
if(BTN_B_PRESSED)
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1355,8 +1351,6 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
|
||||
m_cat.save(true);
|
||||
m_cfg.save(true);
|
||||
cleanup(); // wifi and sd gecko doesnt work anymore after cleanup
|
||||
DeviceHandler::Instance()->UnMountAll();
|
||||
|
||||
if(CurrentIOS.Type == IOS_TYPE_D2X)
|
||||
{
|
||||
/* Open ES Module */
|
||||
|
@ -306,6 +306,7 @@ bool CMenu::_wbfsOp(CMenu::WBFS_OP op)
|
||||
switch(op)
|
||||
{
|
||||
case CMenu::WO_ADD_GAME:
|
||||
_TempLoadIOS();
|
||||
m_btnMgr.show(m_wbfsPBar);
|
||||
m_btnMgr.setProgress(m_wbfsPBar, 0.f);
|
||||
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!"));
|
||||
out = true;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case CMenu::WO_REMOVE_GAME:
|
||||
@ -458,7 +458,10 @@ bool CMenu::_wbfsOp(CMenu::WBFS_OP op)
|
||||
if(!m_thrdWorking)
|
||||
{
|
||||
if(op == CMenu::WO_ADD_GAME)
|
||||
{
|
||||
WDVD_StopMotor();
|
||||
_TempLoadIOS(IOS_TYPE_NORMAL_IOS);
|
||||
}
|
||||
m_btnMgr.show(m_wbfsBtnBack);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user