- fixed cache covers progress bar to not show if a plugin has no roms.

- fixed cache covers progress bar to not show when viewing sourceflow and its tiers unless wiiflow detects that a cached cover is missing.
- fixed source on start to only work if their is a source menu.
- cleaned up some of game cios loading.
This commit is contained in:
Fledge68 2020-05-01 17:32:23 -05:00
parent f90b82ec9f
commit 5e328976e5
10 changed files with 44 additions and 65 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

@ -87,8 +87,7 @@ int main()
} }
if(normalCFG.GameBootType == TYPE_WII_DISC) if(normalCFG.GameBootType == TYPE_WII_DISC)
{ {
if(CurrentIOS.Type != IOS_TYPE_NEEK2O) Disc_SetUSB(NULL, false);
Disc_SetUSB(NULL, false);
if(CurrentIOS.Type == IOS_TYPE_HERMES) if(CurrentIOS.Type == IOS_TYPE_HERMES)
Hermes_Disable_EHC(); Hermes_Disable_EHC();
if(normalCFG.vidMode > 1) //forcing a video mode if(normalCFG.vidMode > 1) //forcing a video mode

View File

@ -30,7 +30,6 @@ enum
IOS_TYPE_WANIN, IOS_TYPE_WANIN,
IOS_TYPE_HERMES, IOS_TYPE_HERMES,
IOS_TYPE_KWIIRK, IOS_TYPE_KWIIRK,
IOS_TYPE_NEEK2O,
IOS_TYPE_NORMAL_IOS, IOS_TYPE_NORMAL_IOS,
IOS_TYPE_STUB, IOS_TYPE_STUB,
}; };

View File

@ -105,14 +105,12 @@ void DeviceHandler::UnMount(int dev)
void DeviceHandler::SetModes() void DeviceHandler::SetModes()
{ {
sdhc_mode_sd = 1; sdhc_mode_sd = 1;// use libogc and ios 58 (wiisd_libogc.c)
usb_libogc_mode = 1; usb_libogc_mode = 1;// use libogc and ios 58 (usbstorage_libogc.c)
if(CustomIOS(CurrentIOS.Type)) if(CustomIOS(CurrentIOS.Type))// if wiiflow is using a cios (force cios is on)
{ /* For USB you can use every cIOS */ {
usb_libogc_mode = 0; usb_libogc_mode = 0;// use cios for USB (usbstorage.c)
/* But not for SD */ sdhc_mode_sd = 0;// use cios for SD (sdhc.c)
if(CurrentIOS.Type != IOS_TYPE_NEEK2O)
sdhc_mode_sd = 0;// don't use cIOS for SD
} }
} }

View File

@ -2362,13 +2362,14 @@ bool CMenu::_loadWiiList(void)
string gameDir(fmt(wii_games_dir, DeviceName[currentPartition])); string gameDir(fmt(wii_games_dir, DeviceName[currentPartition]));
string cacheDir(fmt("%s/%s_wii.db", m_listCacheDir.c_str(), DeviceName[currentPartition])); string cacheDir(fmt("%s/%s_wii.db", m_listCacheDir.c_str(), DeviceName[currentPartition]));
bool updateCache = m_cfg.getBool(WII_DOMAIN, "update_cache"); bool updateCache = m_cfg.getBool(WII_DOMAIN, "update_cache");
if(updateCache || !fsop_FileExist(cacheDir.c_str())) bool preCachedList = fsop_FileExist(cacheDir.c_str());
cacheCovers = true;
m_cacheList.CreateList(COVERFLOW_WII, gameDir, stringToVector(".wbfs|.iso", '|'), cacheDir, updateCache); m_cacheList.CreateList(COVERFLOW_WII, gameDir, stringToVector(".wbfs|.iso", '|'), cacheDir, updateCache);
WBFS_Close(); WBFS_Close();
m_cfg.remove(WII_DOMAIN, "update_cache"); m_cfg.remove(WII_DOMAIN, "update_cache");
for(vector<dir_discHdr>::iterator tmp_itr = m_cacheList.begin(); tmp_itr != m_cacheList.end(); tmp_itr++) for(vector<dir_discHdr>::iterator tmp_itr = m_cacheList.begin(); tmp_itr != m_cacheList.end(); tmp_itr++)
m_gameList.push_back(*tmp_itr); m_gameList.push_back(*tmp_itr);
if(updateCache || (!preCachedList && fsop_FileExist(cacheDir.c_str())))
cacheCovers = true;
return true; return true;
} }
@ -2382,12 +2383,13 @@ bool CMenu::_loadHomebrewList(const char *HB_Dir)
string gameDir(fmt("%s:/%s", DeviceName[currentPartition], HB_Dir)); string gameDir(fmt("%s:/%s", DeviceName[currentPartition], HB_Dir));
string cacheDir(fmt("%s/%s_%s.db", m_listCacheDir.c_str(), DeviceName[currentPartition], HB_Dir)); string cacheDir(fmt("%s/%s_%s.db", m_listCacheDir.c_str(), DeviceName[currentPartition], HB_Dir));
bool updateCache = m_cfg.getBool(HOMEBREW_DOMAIN, "update_cache"); bool updateCache = m_cfg.getBool(HOMEBREW_DOMAIN, "update_cache");
if(updateCache || !fsop_FileExist(cacheDir.c_str())) bool preCachedList = fsop_FileExist(cacheDir.c_str());
cacheCovers = true;
m_cacheList.CreateList(COVERFLOW_HOMEBREW, gameDir, stringToVector(".dol|.elf", '|'), cacheDir, updateCache); m_cacheList.CreateList(COVERFLOW_HOMEBREW, gameDir, stringToVector(".dol|.elf", '|'), cacheDir, updateCache);
m_cfg.remove(HOMEBREW_DOMAIN, "update_cache"); m_cfg.remove(HOMEBREW_DOMAIN, "update_cache");
for(vector<dir_discHdr>::iterator tmp_itr = m_cacheList.begin(); tmp_itr != m_cacheList.end(); tmp_itr++) for(vector<dir_discHdr>::iterator tmp_itr = m_cacheList.begin(); tmp_itr != m_cacheList.end(); tmp_itr++)
m_gameList.push_back(*tmp_itr); m_gameList.push_back(*tmp_itr);
if(updateCache || (!preCachedList && fsop_FileExist(cacheDir.c_str())))
cacheCovers = true;
return true; return true;
} }
@ -2401,8 +2403,7 @@ bool CMenu::_loadGamecubeList()
string gameDir(fmt(gc_games_dir, DeviceName[currentPartition])); string gameDir(fmt(gc_games_dir, DeviceName[currentPartition]));
string cacheDir(fmt("%s/%s_gamecube.db", m_listCacheDir.c_str(), DeviceName[currentPartition])); string cacheDir(fmt("%s/%s_gamecube.db", m_listCacheDir.c_str(), DeviceName[currentPartition]));
bool updateCache = m_cfg.getBool(GC_DOMAIN, "update_cache"); bool updateCache = m_cfg.getBool(GC_DOMAIN, "update_cache");
if(updateCache || !fsop_FileExist(cacheDir.c_str())) bool preCachedList = fsop_FileExist(cacheDir.c_str());
cacheCovers = true;
m_cacheList.CreateList(COVERFLOW_GAMECUBE, gameDir, stringToVector(".iso|.gcm|.ciso|root", '|'), cacheDir, updateCache); m_cacheList.CreateList(COVERFLOW_GAMECUBE, gameDir, stringToVector(".iso|.gcm|.ciso|root", '|'), cacheDir, updateCache);
m_cfg.remove(GC_DOMAIN, "update_cache"); m_cfg.remove(GC_DOMAIN, "update_cache");
for(vector<dir_discHdr>::iterator tmp_itr = m_cacheList.begin(); tmp_itr != m_cacheList.end(); tmp_itr++) for(vector<dir_discHdr>::iterator tmp_itr = m_cacheList.begin(); tmp_itr != m_cacheList.end(); tmp_itr++)
@ -2411,6 +2412,8 @@ bool CMenu::_loadGamecubeList()
continue;// skip gc disc 2 if its still part of the cached list continue;// skip gc disc 2 if its still part of the cached list
m_gameList.push_back(*tmp_itr); m_gameList.push_back(*tmp_itr);
} }
if(updateCache || (!preCachedList && fsop_FileExist(cacheDir.c_str())))
cacheCovers = true;
return true; return true;
} }
@ -2445,12 +2448,13 @@ bool CMenu::_loadChannelList(void)
currentPartition = emuPartition; currentPartition = emuPartition;
string cacheDir = fmt("%s/%s_channels.db", m_listCacheDir.c_str(), DeviceName[currentPartition]); string cacheDir = fmt("%s/%s_channels.db", m_listCacheDir.c_str(), DeviceName[currentPartition]);
bool updateCache = m_cfg.getBool(CHANNEL_DOMAIN, "update_cache"); bool updateCache = m_cfg.getBool(CHANNEL_DOMAIN, "update_cache");
if(updateCache || !fsop_FileExist(cacheDir.c_str())) bool preCachedList = fsop_FileExist(cacheDir.c_str());
cacheCovers = true;
m_cacheList.CreateList(COVERFLOW_CHANNEL, std::string(), NullVector, cacheDir, updateCache); m_cacheList.CreateList(COVERFLOW_CHANNEL, std::string(), NullVector, cacheDir, updateCache);
m_cfg.remove(CHANNEL_DOMAIN, "update_cache"); m_cfg.remove(CHANNEL_DOMAIN, "update_cache");
for(vector<dir_discHdr>::iterator tmp_itr = m_cacheList.begin(); tmp_itr != m_cacheList.end(); tmp_itr++) for(vector<dir_discHdr>::iterator tmp_itr = m_cacheList.begin(); tmp_itr != m_cacheList.end(); tmp_itr++)
m_gameList.push_back(*tmp_itr); m_gameList.push_back(*tmp_itr);
if(updateCache || (!preCachedList && fsop_FileExist(cacheDir.c_str())))
cacheCovers = true;
} }
} }
return true; return true;
@ -2511,8 +2515,7 @@ bool CMenu::_loadPluginList()
{ {
string romsDir(fmt("%s:/%s", DeviceName[currentPartition], romDir)); string romsDir(fmt("%s:/%s", DeviceName[currentPartition], romDir));
string cachedListFile(fmt("%s/%s_%s.db", m_listCacheDir.c_str(), DeviceName[currentPartition], m_plugin.PluginMagicWord)); string cachedListFile(fmt("%s/%s_%s.db", m_listCacheDir.c_str(), DeviceName[currentPartition], m_plugin.PluginMagicWord));
if(updateCache || !fsop_FileExist(cachedListFile.c_str())) bool preCachedList = fsop_FileExist(cachedListFile.c_str());
cacheCovers = true;
vector<string> FileTypes = stringToVector(m_plugin.GetFileTypes(i), '|'); vector<string> FileTypes = stringToVector(m_plugin.GetFileTypes(i), '|');
m_cacheList.Color = m_plugin.GetCaseColor(i); m_cacheList.Color = m_plugin.GetCaseColor(i);
m_cacheList.Magic = Magic; m_cacheList.Magic = Magic;
@ -2520,13 +2523,15 @@ bool CMenu::_loadPluginList()
m_cacheList.CreateRomList(m_platform, romsDir, FileTypes, cachedListFile, updateCache); m_cacheList.CreateRomList(m_platform, romsDir, FileTypes, cachedListFile, updateCache);
for(vector<dir_discHdr>::iterator tmp_itr = m_cacheList.begin(); tmp_itr != m_cacheList.end(); tmp_itr++) for(vector<dir_discHdr>::iterator tmp_itr = m_cacheList.begin(); tmp_itr != m_cacheList.end(); tmp_itr++)
m_gameList.push_back(*tmp_itr); m_gameList.push_back(*tmp_itr);
if(updateCache || (!preCachedList && fsop_FileExist(cachedListFile.c_str())))
cacheCovers = true;
} }
} }
else else
{ {
string cachedListFile(fmt("%s/%s_%s.db", m_listCacheDir.c_str(), DeviceName[currentPartition], m_plugin.PluginMagicWord)); string cachedListFile(fmt("%s/%s_%s.db", m_listCacheDir.c_str(), DeviceName[currentPartition], m_plugin.PluginMagicWord));
if(updateCache || !fsop_FileExist(cachedListFile.c_str())) bool preCachedList = fsop_FileExist(cachedListFile.c_str());
cacheCovers = true;
Config scummvm; Config scummvm;
if(!scummvm.load(fmt("%s/scummvm.ini", m_pluginsDir.c_str()))) if(!scummvm.load(fmt("%s/scummvm.ini", m_pluginsDir.c_str())))
{ {
@ -2541,6 +2546,8 @@ bool CMenu::_loadPluginList()
m_cacheList.ParseScummvmINI(scummvm, DeviceName[currentPartition], m_pluginDataDir.c_str(), platformName.c_str(), cachedListFile, updateCache); m_cacheList.ParseScummvmINI(scummvm, DeviceName[currentPartition], m_pluginDataDir.c_str(), platformName.c_str(), cachedListFile, updateCache);
for(vector<dir_discHdr>::iterator tmp_itr = m_cacheList.begin(); tmp_itr != m_cacheList.end(); tmp_itr++) for(vector<dir_discHdr>::iterator tmp_itr = m_cacheList.begin(); tmp_itr != m_cacheList.end(); tmp_itr++)
m_gameList.push_back(*tmp_itr); m_gameList.push_back(*tmp_itr);
if(updateCache || (!preCachedList && fsop_FileExist(cachedListFile.c_str())))
cacheCovers = true;
scummvm.unload(); scummvm.unload();
} }
} }
@ -2583,6 +2590,10 @@ bool CMenu::_loadFile(u8 * &buffer, u32 &size, const char *path, const char *fil
return true; return true;
} }
/* wiiflow creates a map<u8, u8> _installed_cios list for slots 200 to 253 and slot 0
the first u8 is the slot and the second u8 is the base if its a d2x cios otherwise the slot number again.
slot 0 is set to 1 - first = 0 and second = 1
game config only shows the first (slot) or auto if first = 0 */
void CMenu::_load_installed_cioses() void CMenu::_load_installed_cioses()
{ {
if(isWiiVC) if(isWiiVC)

View File

@ -498,12 +498,12 @@ void CMenu::_showGameSettings()
m_btnMgr.setText(m_gameSettingsLblAspectRatioVal, _t(CMenu::_AspectRatio[i].id, CMenu::_AspectRatio[i].text)); m_btnMgr.setText(m_gameSettingsLblAspectRatioVal, _t(CMenu::_AspectRatio[i].id, CMenu::_AspectRatio[i].text));
int j = 0; int j = 0;
if(m_gcfg2.getInt(id, "ios", &j) && _installed_cios.size() > 0) if(m_gcfg2.getInt(id, "ios", j) && _installed_cios.size() > 0)
{ {
CIOSItr itr = _installed_cios.find(j); CIOSItr itr = _installed_cios.find(j);
j = (itr == _installed_cios.end()) ? 0 : itr->first; j = (itr == _installed_cios.end()) ? 0 : itr->first;
} }
else j = 0; //else j = 0;
if(j > 0) if(j > 0)
m_btnMgr.setText(m_gameSettingsLblIOS, wfmt(L"%i", j)); m_btnMgr.setText(m_gameSettingsLblIOS, wfmt(L"%i", j));

View File

@ -623,6 +623,9 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool disc)
int CMenu::_loadGameIOS(u8 gameIOS, int userIOS, string id, bool RealNAND_Channels) int CMenu::_loadGameIOS(u8 gameIOS, int userIOS, string id, bool RealNAND_Channels)
{ {
gprintf("Game ID %s requested IOS %d.\nUser selected %d\n", id.c_str(), gameIOS, userIOS); gprintf("Game ID %s requested IOS %d.\nUser selected %d\n", id.c_str(), gameIOS, userIOS);
// this if seems to have been used if wiiflow was in neek2o mode
// or cios 249 is a stub and wiiflow runs on ios58
if(RealNAND_Channels && IOS_GetType(mainIOS) == IOS_TYPE_STUB) if(RealNAND_Channels && IOS_GetType(mainIOS) == IOS_TYPE_STUB)
{ {
/* doesn't use cIOS so we don't check userIOS */ /* doesn't use cIOS so we don't check userIOS */
@ -638,55 +641,24 @@ int CMenu::_loadGameIOS(u8 gameIOS, int userIOS, string id, bool RealNAND_Channe
if(userIOS)// if IOS is not 'auto' and set to a specific cIOS then set gameIOS to that cIOS if it's installed if(userIOS)// if IOS is not 'auto' and set to a specific cIOS then set gameIOS to that cIOS if it's installed
{ {
// we need to find it just in case the gameconfig has been manually edited or that cios deleted.
bool found = false;
for(CIOSItr itr = _installed_cios.begin(); itr != _installed_cios.end(); itr++) for(CIOSItr itr = _installed_cios.begin(); itr != _installed_cios.end(); itr++)
{ {
if(itr->second == userIOS || itr->first == userIOS) if(itr->second == userIOS || itr->first == userIOS)
{ {
found = true;
gameIOS = itr->first; gameIOS = itr->first;
break; break;
} }
} }
if(!found)
gameIOS = mainIOS;
} }
else if(gameIOS != 57)// if IOS is 'auto' but gameIOS is not IOS57 then set gameIOS to wiiflow's mainIOS else
gameIOS = mainIOS;// mainIOS is usually 249 unless changed by boot args or changed on startup settings menu gameIOS = mainIOS;// mainIOS is usually 249 unless changed by boot args or changed on startup settings menu
gprintf("Changed requested IOS to %d.\n", gameIOS); gprintf("Changed requested IOS to %d.\n", gameIOS);
// remap a gameIOS of IOS57 to a cIOS base 57 or if the specific cIOS selected is not installed then
// remap game IOS to a CIOS with the same base IOS
if(gameIOS < 0x64)// < 100
{
if(_installed_cios.size() <= 0)
{
error(_t("errgame2", L"No cIOS found!"));
Sys_Exit();
}
u8 IOS[3];
IOS[0] = gameIOS;
IOS[1] = 56;
IOS[2] = 57;
bool found = false;
// compare the base of each cios to the game ios
// if no match then find the first cios with base 56
// if no match then find the first cios with base 57
for(u8 num = 0; num < 3; num++)
{
if(found)
break;
if(IOS[num] == 0)
continue;
for(CIOSItr itr = _installed_cios.begin(); itr != _installed_cios.end(); itr++)
{
if(itr->second == IOS[num] || itr->first == IOS[num])
{
gameIOS = itr->first;
found = true;
break;
}
}
}
if(!found)
return LOAD_IOS_FAILED;
}
/* at this point gameIOS is a cIOS */ /* at this point gameIOS is a cIOS */
if(gameIOS != CurrentIOS.Version) if(gameIOS != CurrentIOS.Version)
{ {
@ -809,7 +781,7 @@ void CMenu::_launchChannel(dir_discHdr *hdr)
error(_t("errgame15", L"Missing ext_loader.bin or ext_booter.bin!")); error(_t("errgame15", L"Missing ext_loader.bin or ext_booter.bin!"));
_exitWiiflow(); _exitWiiflow();
} }
if(_loadGameIOS(gameIOS, userIOS, id, !NANDemuView) == LOAD_IOS_FAILED)//in neek2o this will only load the game IOS not a cIOS if(_loadGameIOS(gameIOS, userIOS, id, !NANDemuView) == LOAD_IOS_FAILED)
{ {
/* error message already shown */ /* error message already shown */
_exitWiiflow(); _exitWiiflow();

View File

@ -412,8 +412,9 @@ int CMenu::main(void)
gprintf("Bootup completed!\n"); gprintf("Bootup completed!\n");
if(!m_source_on_start) if(!m_use_source || !m_source_on_start)
{ {
m_source_on_start = false;
_getCustomBgTex(); _getCustomBgTex();
_setMainBg(); _setMainBg();
_showCF(true); _showCF(true);

View File

@ -59,7 +59,6 @@ enum
IOS_TYPE_WANIN, IOS_TYPE_WANIN,
IOS_TYPE_HERMES, IOS_TYPE_HERMES,
IOS_TYPE_KWIIRK, IOS_TYPE_KWIIRK,
IOS_TYPE_NEEK2O,
IOS_TYPE_NORMAL_IOS, IOS_TYPE_NORMAL_IOS,
IOS_TYPE_STUB, IOS_TYPE_STUB,
}; };