Merge branch 'Fledge68:master' into master

This commit is contained in:
MayanKoyote 2023-03-16 11:42:47 +05:00 committed by GitHub
commit 9498f82038
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 49 additions and 27 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 MiB

After

Width:  |  Height:  |  Size: 4.4 MiB

View File

@ -2682,7 +2682,7 @@ void CMenu::_stopSounds(void)
m_gameSound.Stop();
}
/* wiiflow creates a map<u8, u8> _installed_cios list for slots 200 to 253 and slot 0
/* wiiflow creates a map<u8 slot, u8 base > _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 */
@ -2700,11 +2700,12 @@ void CMenu::_load_installed_cioses()
{
gprintf("Found d2x base %u in slot %u\n", base, slot);
_installed_cios[slot] = base;
_cios_base[base] = slot;// these are sorted low to high. no duplicates. higher slot will replace lower slot if same base.
}
else if(CustomIOS(IOS_GetType(slot)))
{
gprintf("Found cIOS in slot %u\n", slot);
_installed_cios[slot] = slot;
_installed_cios[slot] = slot;// we don't add the base for non d2x cios. only keep this if a user wants to try a hermies cios for example.
}
}
}

View File

@ -994,7 +994,8 @@ private:
wstringEx _optBoolToString(int b);
void _load_installed_cioses();
std::map<u8, u8> _installed_cios;
typedef std::map<u8, u8>::iterator CIOSItr;
typedef std::map<u8, u8>::iterator CIOSItr;// we can use this for both maps.
std::map<u8, u8> _cios_base;
//game boot functions
void _launch(const dir_discHdr *hdr);
@ -1005,7 +1006,7 @@ private:
void _launchPlugin(dir_discHdr *hdr);
void _launchShutdown();
vector<string> _getMetaXML(const char *bootpath);
int _loadGameIOS(u8 ios, int userIOS, string id, bool RealNAND_Channels = false);
int _loadGameIOS(u8 ios, int userIOS, const char *id, bool RealNAND_Channels = false);
bool _loadFile(u8 * &buffer, u32 &size, const char *path, const char *file);// gameconfig.txt and cheats.gct
//

View File

@ -111,7 +111,7 @@ void CMenu::_Boot(void)
if(cur_ios > 0)
m_btnMgr.setText(m_configLbl2Val, wfmt(L"%i", cur_ios));
else
m_btnMgr.setText(m_configLbl2Val, L"AUTO");
m_btnMgr.setText(m_configLbl2Val, _t("GC_Auto", L"AUTO"));
}
else if(m_btnMgr.selected(m_configBtn3))
{

View File

@ -731,9 +731,13 @@ bool CMenu::_loadFile(u8 * &buffer, u32 &size, const char *path, const char *fil
/* used by wii and channel games to load the cIOS to use for the game */
/* plugins, apps, and gamecube games don't use cIOS */
int CMenu::_loadGameIOS(u8 gameIOS, int userIOS, string id, bool RealNAND_Channels)
int CMenu::_loadGameIOS(u8 gameIOS, int userIOS, const char *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.\n", id, gameIOS);
if(!userIOS)
gprintf("User selected %d\n", userIOS);
else
gprintf("User selected AUTO\n");
// this if seems to have been used if wiiflow was in neek2o mode
// or cios 249 is a stub and wiiflow runs on ios58
@ -751,36 +755,49 @@ int CMenu::_loadGameIOS(u8 gameIOS, int userIOS, string id, bool RealNAND_Channe
return LOAD_IOS_SUCCEEDED;
}
if(userIOS)// if IOS is not 'auto' and set to a specific cIOS then set gameIOS to that cIOS if it's installed
u8 slot = 0;
// check if the user wants to use a specific cios and if it's installed.
if(userIOS && _installed_cios.find(userIOS) != _installed_cios.end())
slot = userIOS;
else // auto find a cios base match
{
// 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++)
// Workaround for SpongeBobs Boating Bash
if(strncasecmp(id, "SBV", 3) == 0)
{
if(itr->second == userIOS || itr->first == userIOS)
slot = _cios_base[gameIOS];// try the games'IOS 53
if(!slot)
slot = _cios_base[58];
if(!slot && !IsOnWiiU())
slot = _cios_base[38];
}
else
slot = _cios_base[gameIOS];
if(!slot)// no direct match so we get the first cios with a greater base
{
for(CIOSItr itr = _cios_base.begin(); itr != _cios_base.end(); itr++)
{
found = true;
gameIOS = itr->first;
break;
if(itr->first > gameIOS)//compare bases
{
slot = itr->second;// set to cios slot
break;
}
}
}
if(!found)
gameIOS = mainIOS;
}
else
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);
if(!slot)// shouldn't happen but just in case
slot = mainIOS;// set to wiiflow's cios
gprintf("cIOS slot %d chosen.\n", slot);
/* at this point gameIOS is a cIOS */
if(gameIOS != CurrentIOS.Version)
// now we reload to this cios slot if we need to
if(slot != CurrentIOS.Version)
{
gprintf("Reloading IOS into %d\n", gameIOS);
bool ret = loadIOS(gameIOS, true);//load cIOS requested and then remount sd and USB devices
bool ret = loadIOS(slot, true);//load cIOS requested and then remount sd and USB devices
if(has_enabled_providers() || m_use_wifi_gecko)
_initAsyncNetwork();// always seem to do netinit after changing IOS
if(ret == false)
{
_error(wfmt(_fmt("errgame4", L"Couldn't load IOS %i"), gameIOS));
_error(wfmt(_fmt("errgame4", L"Couldn't load IOS %i"), slot));
return LOAD_IOS_FAILED;
}
return LOAD_IOS_SUCCEEDED;
@ -940,7 +957,7 @@ void CMenu::_launchChannel(dir_discHdr *hdr)
}
/* load selected cIOS if necessary */
if(_loadGameIOS(gameIOS, userIOS, id, !NANDemuView) == LOAD_IOS_FAILED)
if(_loadGameIOS(gameIOS, userIOS, id.c_str(), !NANDemuView) == LOAD_IOS_FAILED)
{
/* error message already shown */
return;
@ -1242,7 +1259,7 @@ void CMenu::_launchWii(dir_discHdr *hdr, bool dvd, bool disc_cfg)
/* load selected cIOS if necessary */
if(!dvd)
{
if(_loadGameIOS(gameIOS, userIOS, id) == LOAD_IOS_FAILED)
if(_loadGameIOS(gameIOS, userIOS, id.c_str()) == LOAD_IOS_FAILED)
{
/* error message already shown */
return;

View File

@ -343,6 +343,9 @@ int CMenu::_NandEmuCfg(void)
if(BTN_HOME_PRESSED || BTN_B_PRESSED || (BTN_A_PRESSED && m_btnMgr.selected(m_nandemuBtnBack)))
{
_hideNandEmu();
m_btnMgr.hide(m_nandfileLblDialog);
m_btnMgr.hide(m_nandemuLblDialog);
m_btnMgr.hide(m_nandfinLblDialog);
nandemuPage = 1;
_showNandEmu();
break;