- sourceflow no longer shows cache covers progress bar unless 1 or more covers need to be cached.

- hopefully removed split second green screen when sourceflow on startup is used.
- fixed startup for wiivc (although untested).
- made changes to cios loading on startup.
- fixed if wiiflow fails on startup to not exit to HBC unless booted from HBC.
This commit is contained in:
Fledge68 2020-04-28 18:03:24 -05:00
parent 0d9b58609c
commit f90b82ec9f
15 changed files with 120 additions and 79 deletions

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 MiB

After

Width:  |  Height:  |  Size: 4.1 MiB

View File

@ -77,15 +77,6 @@ void Nand::Init()
isfs_inited = false; isfs_inited = false;
} }
bool Nand::LoadDefaultIOS(void)
{
Patch_AHB();//apply a patch so the new IOS will also have AHBPROT disabled
s32 ret = IOS_ReloadIOS(IOS_GetPreferredVersion());// reload to preferred IOS. not sure what wiiflows preferred IOS is.
loadIOS(IOS_GetVersion(), false);// this basically does nothing (well very little). definetly doesn't load a IOS or shutdown anything.
Init_ISFS();
return (ret == 0);
}
void Nand::SetNANDEmu(u32 partition) void Nand::SetNANDEmu(u32 partition)
{ {
EmuDevice = partition == 0 ? EMU_SD : EMU_USB; EmuDevice = partition == 0 ? EMU_SD : EMU_USB;

View File

@ -65,7 +65,6 @@ class Nand
{ {
public: public:
void Init(); void Init();
bool LoadDefaultIOS(void);
/* Prototypes */ /* Prototypes */
void SetNANDEmu(u32 partition); void SetNANDEmu(u32 partition);

View File

@ -1,6 +1,6 @@
#define APP_NAME "WiiFlow WFL" #define APP_NAME "WiiFlow WFL"
#define APP_VERSION "5.4.4" #define APP_VERSION "5.4.5"
#define APP_DATA_DIR "wiiflow" #define APP_DATA_DIR "wiiflow"
#define APPS_DIR "apps/wiiflow" #define APPS_DIR "apps/wiiflow"

View File

@ -149,9 +149,10 @@ bool DeviceHandler::MountAllUSB()
return false; return false;
/* Kill possible USB thread */ /* Kill possible USB thread */
KillUSBKeepAliveThread(); //KillUSBKeepAliveThread();
/* Wait for our slowass HDD */ /* usb spinup - Wait for our slowass HDD */
WaitForDevice(GetUSBInterface()); if(WaitForDevice(GetUSBInterface()) == false)
return false;
/* Get Partitions and Mount them */ /* Get Partitions and Mount them */
if(!usb.IsInserted() || !usb.IsMounted(0)) if(!usb.IsInserted() || !usb.IsMounted(0))
usb.SetDevice(GetUSBInterface()); usb.SetDevice(GetUSBInterface());
@ -162,6 +163,7 @@ bool DeviceHandler::MountAllUSB()
if(MountUSB(i)) if(MountUSB(i))
result = true; result = true;
} }
// why force FAT? why not just return result?
if(!result) if(!result)
result = usb.Mount(0, DeviceName[USB1], true); /* Force FAT */ result = usb.Mount(0, DeviceName[USB1], true); /* Force FAT */
//if(result && usb_libogc_mode) //if(result && usb_libogc_mode)
@ -260,17 +262,19 @@ s32 DeviceHandler::OpenWBFS(int dev)
return WBFS_Init(GetWbfsHandle(dev), part_fs, part_idx, part_lba, partition); return WBFS_Init(GetWbfsHandle(dev), part_fs, part_idx, part_lba, partition);
} }
void DeviceHandler::WaitForDevice(const DISC_INTERFACE *Handle) /* usb spinup wait for 20 seconds */
bool DeviceHandler::WaitForDevice(const DISC_INTERFACE *Handle)
{ {
if(Handle == NULL) if(Handle == NULL)// apparently this never happens
return; return false;
time_t timeout = time(NULL); time_t timeout = time(NULL);
while(time(NULL) - timeout < 20) while(time(NULL) - timeout < 20)
{ {
if(Handle->startup() && Handle->isInserted()) if(Handle->startup() && Handle->isInserted())
break; return true;
usleep(50000); usleep(50000);
} }
return false;
} }
bool DeviceHandler::MountDevolution() bool DeviceHandler::MountDevolution()

View File

@ -82,7 +82,7 @@ public:
bool USB_Inserted() { return usb.IsInserted(); } bool USB_Inserted() { return usb.IsInserted(); }
bool UsablePartitionMounted(); bool UsablePartitionMounted();
bool PartitionUsableForNandEmu(int Partition); bool PartitionUsableForNandEmu(int Partition);
void WaitForDevice(const DISC_INTERFACE *Handle); bool WaitForDevice(const DISC_INTERFACE *Handle);
void UnMountSD() { sd.UnMountAll(); } void UnMountSD() { sd.UnMountAll(); }
void UnMountUSB(int pos); void UnMountUSB(int pos);

View File

@ -24,7 +24,7 @@
#include "dip_plugin_249.h" #include "dip_plugin_249.h"
#include "mload_modules.h" #include "mload_modules.h"
static int load_ehc_module_ex(void) void load_ehc_module_ex(void)
{ {
u8 *ehc_cfg = search_for_ehcmodule_cfg((u8 *)ehcmodule_5, size_ehcmodule_5); u8 *ehc_cfg = search_for_ehcmodule_cfg((u8 *)ehcmodule_5, size_ehcmodule_5);
if(ehc_cfg) if(ehc_cfg)
@ -35,7 +35,6 @@ static int load_ehc_module_ex(void)
DCFlushRange((void *) (((u32)ehc_cfg[0]) & ~31), 32); DCFlushRange((void *) (((u32)ehc_cfg[0]) & ~31), 32);
} }
load_ehc_module(); load_ehc_module();
return 0;
} }
void load_dip_249() void load_dip_249()

View File

@ -8,6 +8,8 @@ extern "C" {
#endif #endif
bool loadIOS(int ios, bool MountDevices); bool loadIOS(int ios, bool MountDevices);
void load_ehc_module_ex(void);
void load_dip_249();
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -160,22 +160,32 @@ int main(int argc, char **argv)
} }
else else
{ {
NandHandle.LoadDefaultIOS(); /* safe reload to preferred IOS */ NandHandle.Init_ISFS();
/* load and check wiiflow save for possible new IOS and Port settings */ /* load and check wiiflow save for possible new IOS and Port settings */
if(InternalSave.CheckSave()) if(InternalSave.CheckSave())
InternalSave.LoadSettings(); InternalSave.LoadSettings();
/* Handle (c)IOS Loading */ /* Handle (c)IOS Loading */
if(useMainIOS && CustomIOS(IOS_GetType(mainIOS))) /* Requested */ if(useMainIOS && CustomIOS(IOS_GetType(mainIOS)))// load cios
iosOK = loadIOS(mainIOS, false) && CustomIOS(CurrentIOS.Type);// reload to cIOS (249 by default) {
NandHandle.DeInit_ISFS();
NandHandle.Patch_AHB();
iosOK = IOS_ReloadIOS(mainIOS) == 0;
gprintf("AHBPROT disabled after IOS Reload: %s\n", AHBPROT_Patched() ? "yes" : "no");
NandHandle.Init_ISFS();
}
else else
gprintf("Using IOS58\n");// stay on IOS58. no reload to cIOS gprintf("Using IOS58\n");// stay on IOS58. no reload to cIOS
}
/* sys inits */ IOS_GetCurrentIOSInfo();
Sys_Init();// set reset and power button callbacks if(CurrentIOS.Type == IOS_TYPE_HERMES)
Sys_ExitTo(EXIT_TO_HBC);// set exit to in case of failed launch load_ehc_module_ex();
else if(CurrentIOS.Type == IOS_TYPE_WANIN && CurrentIOS.Revision >= 18)
load_dip_249();
DeviceHandle.SetModes();
WDVD_Init();
}
/* mount SD */ /* mount SD */
DeviceHandle.MountSD();// mount SD before calling isUsingUSB() duh! DeviceHandle.MountSD();// mount SD before calling isUsingUSB() duh!
@ -191,20 +201,13 @@ int main(int argc, char **argv)
/* init controllers for input */ /* init controllers for input */
Open_Inputs();// WPAD_SetVRes() is called later in mainMenu.init() during cursor init which gets the theme pointer images Open_Inputs();// WPAD_SetVRes() is called later in mainMenu.init() during cursor init which gets the theme pointer images
/* sys inits */
Sys_Init();// set reset and power button callbacks
bool startup_successful = false;
/* init configs, folders, coverflow, gui and more */ /* init configs, folders, coverflow, gui and more */
if(mainMenu.init(usb_mounted)) if(mainMenu.init(usb_mounted))
{ {
if(CurrentIOS.Version != mainIOS)
{
if(useMainIOS || !DeviceHandle.UsablePartitionMounted())// if useMainIOS or there's isn't a FAT or NTFS partition
{
useMainIOS = false;
mainMenu.TempLoadIOS();// switch to cIOS
iosOK = CustomIOS(CurrentIOS.Type);
}
}
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(!DeviceHandle.UsablePartitionMounted()) else if(!DeviceHandle.UsablePartitionMounted())
@ -213,6 +216,7 @@ int main(int argc, char **argv)
mainMenu.terror("errboot3", L"Could not initialize the DIP module!"); mainMenu.terror("errboot3", L"Could not initialize the DIP module!");
else // alls good lets start wiiflow else // alls good lets start wiiflow
{ {
startup_successful = true;
if(!isWiiVC) if(!isWiiVC)
writeStub();// copy return stub to memory writeStub();// copy return stub to memory
if(gameid != NULL && strlen(gameid) == 6)// if argv game ID then launch it if(gameid != NULL && strlen(gameid) == 6)// if argv game ID then launch it
@ -224,6 +228,7 @@ int main(int argc, char **argv)
mainMenu.cleanup();// removes all sounds, fonts, images, coverflow, plugin stuff, source menu and clear memory mainMenu.cleanup();// removes all sounds, fonts, images, coverflow, plugin stuff, source menu and clear memory
} }
ShutdownBeforeExit();// unmount devices and close inputs ShutdownBeforeExit();// unmount devices and close inputs
if(startup_successful)// use wiiflow's exit choice otherwise just exit to loader (system menu or hbc)
Sys_Exit(); Sys_Exit();
return 0; return 0;
} }

View File

@ -1109,6 +1109,7 @@ private:
bool _gameinfo(void); bool _gameinfo(void);
void _gameSettings(const dir_discHdr *GameHdr, bool disc = false); void _gameSettings(const dir_discHdr *GameHdr, bool disc = false);
void _CoverBanner(void); void _CoverBanner(void);
int _sfCacheCoversNeeded();
int _cacheCovers(void); int _cacheCovers(void);
void _Explorer(void); void _Explorer(void);
const char *_FolderExplorer(const char *startPath); const char *_FolderExplorer(const char *startPath);

View File

@ -466,6 +466,57 @@ void CMenu::_textShutdown(void)
} }
/*******************************************************************************/ /*******************************************************************************/
int CMenu::_sfCacheCoversNeeded()// for sourceflow
{
CoverFlow.stopCoverLoader(true);
string coverPath;
string wfcPath;
string cachePath = m_cacheDir + "/sourceflow/";
string gameNameOrID;
bool smallBox = m_cfg.getBool(SOURCEFLOW_DOMAIN, "smallbox", false);
int missing = 0;
for(vector<dir_discHdr>::iterator hdr = m_gameList.begin(); hdr != m_gameList.end(); ++hdr)
{
/* get cover png path */
bool blankCover = false;
bool fullCover = true;
coverPath.assign(getBoxPath(&(*hdr)));
if(!fsop_FileExist(coverPath.c_str()) || smallBox)
{
fullCover = false;
coverPath.assign(getFrontPath(&(*hdr)));
if(!fsop_FileExist(coverPath.c_str()) && !smallBox)
{
fullCover = true;
coverPath.assign(getBlankCoverPath(&(*hdr)));
blankCover = true;
if(!fsop_FileExist(coverPath.c_str()))
continue;
}
}
/* get game name or ID */
if(!blankCover)
gameNameOrID.assign(CoverFlow.getFilenameId(&(*hdr)));
else
gameNameOrID.assign(coverPath.substr(coverPath.find_last_of("/") + 1));
/* get cover wfc path */
if(smallBox)
wfcPath.assign(cachePath + gameNameOrID + "_small.wfc");
else
wfcPath.assign(cachePath + gameNameOrID);
/* if wfc doesn't exist or is flat and have full cover */
if(!fsop_FileExist(wfcPath.c_str()) || (!CoverFlow.fullCoverCached(wfcPath.c_str()) && fullCover))
missing++;
}
return missing;
}
int CMenu::_cacheCovers() int CMenu::_cacheCovers()
{ {
CoverFlow.stopCoverLoader(true); CoverFlow.stopCoverLoader(true);

View File

@ -54,18 +54,6 @@ static int CalculateRepeatSpeed(float magnitude, int current_value)
void CMenu::ScanInput() void CMenu::ScanInput()
{ {
/*for(int chan = WPAD_MAX_WIIMOTES-1; chan >= 0; chan--)
{
wd[chan] = WPAD_Data(chan);
if(wd[chan]->err < 0)
{
Close_Inputs();
Open_Inputs();
for(int chn = WPAD_MAX_WIIMOTES-1; chn >= 0; chn--)
WPAD_SetVRes(chn, m_vid.width() + m_cursor[chn].width(), m_vid.height() + m_cursor[chn].height());
break;
}
}*/
m_show_zone_main = false; m_show_zone_main = false;
m_show_zone_main2 = false; m_show_zone_main2 = false;
m_show_zone_main3 = false; m_show_zone_main3 = false;

View File

@ -240,6 +240,8 @@ void CMenu::_showCF(bool refreshList)
if(cacheCovers) if(cacheCovers)
{ {
cacheCovers = false; cacheCovers = false;
if(!m_sourceflow || _sfCacheCoversNeeded() > 0)
{
m_btnMgr.setProgress(m_wbfsPBar, 0.f, true); m_btnMgr.setProgress(m_wbfsPBar, 0.f, true);
m_btnMgr.setText(m_wbfsLblMessage, L"0%"); m_btnMgr.setText(m_wbfsLblMessage, L"0%");
m_btnMgr.setText(m_wbfsLblDialog, L""); m_btnMgr.setText(m_wbfsLblDialog, L"");
@ -254,7 +256,7 @@ void CMenu::_showCF(bool refreshList)
u8 pause = 150; u8 pause = 150;
if(m_sourceflow) if(m_sourceflow)
pause = 1; pause = 1;
while(!m_exit) do
{ {
_mainLoopCommon(); _mainLoopCommon();
pause--; pause--;
@ -263,8 +265,8 @@ void CMenu::_showCF(bool refreshList)
m_btnMgr.hide(m_wbfsPBar); m_btnMgr.hide(m_wbfsPBar);
m_btnMgr.hide(m_wbfsLblMessage); m_btnMgr.hide(m_wbfsLblMessage);
m_btnMgr.hide(m_wbfsLblDialog); m_btnMgr.hide(m_wbfsLblDialog);
break;
} }
}while(!m_exit && pause > 0);
} }
} }
/* setup categories and favorites for filtering the game list below */ /* setup categories and favorites for filtering the game list below */
@ -416,8 +418,6 @@ int CMenu::main(void)
_setMainBg(); _setMainBg();
_showCF(true); _showCF(true);
} }
else
_hideWaitMessage();
if(show_mem) if(show_mem)
{ {

View File

@ -343,6 +343,7 @@ bool CMenu::_Source()
SetupInput(); SetupInput();
_showSource(); _showSource();
_updateSourceBtns(); _updateSourceBtns();
_hideWaitMessage();// needed for source menu on start
while(!m_exit) while(!m_exit)
{ {