- only change channels type when needed.

This commit is contained in:
Fledge68 2023-03-25 18:26:31 -05:00
parent 1fa1054f04
commit b878b9e2ee
4 changed files with 47 additions and 16 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 MiB

After

Width:  |  Height:  |  Size: 4.4 MiB

View File

@ -2555,7 +2555,6 @@ bool CMenu::_loadChannelList(void)
bool CMenu::_loadPluginList()
{
bool updateCache = m_cfg.getBool(PLUGIN_DOMAIN, "update_cache");
int channels_type = min(max(1, m_cfg.getInt(CHANNEL_DOMAIN, "channels_type", CHANNELS_REAL)), (int)ARRAY_SIZE(CMenu::_ChannelsType));
gprintf("Adding plugins list\n");
for(u8 i = 0; m_plugin.PluginExist(i); ++i)
{
@ -2589,18 +2588,10 @@ bool CMenu::_loadPluginList()
m_cfg.setBool(WII_DOMAIN, "update_cache", true);
_loadWiiList();
}
else if(strncasecmp(m_plugin.PluginMagicWord, NAND_PMAGIC, 8) == 0)//NAND
else if(strncasecmp(m_plugin.PluginMagicWord, NAND_PMAGIC, 8) == 0 || strncasecmp(m_plugin.PluginMagicWord, ENAND_PMAGIC, 8) == 0)//NAND
{
if(updateCache)
m_cfg.setBool(CHANNEL_DOMAIN, "update_cache", true);
m_cfg.setInt(CHANNEL_DOMAIN, "channels_type", CHANNELS_REAL);
_loadChannelList();
}
else if(strncasecmp(m_plugin.PluginMagicWord, ENAND_PMAGIC, 8) == 0)//ENAN
{
if(updateCache)
m_cfg.setBool(CHANNEL_DOMAIN, "update_cache", true);
m_cfg.setInt(CHANNEL_DOMAIN, "channels_type", CHANNELS_EMU);
_loadChannelList();
}
else
@ -2661,7 +2652,6 @@ bool CMenu::_loadPluginList()
}
}
m_cfg.remove(PLUGIN_DOMAIN, "update_cache");
m_cfg.setInt(CHANNEL_DOMAIN, "channels_type", channels_type);
return true;
}

View File

@ -159,7 +159,8 @@ void CMenu::_PluginSettings()
}
_hidePluginSettings();
int channels_type = 0;
int channels_type = m_cfg.getInt(CHANNEL_DOMAIN, "channels_type");
u8 first = 1;
string enabledMagics;
enabledPluginsCount = 0;
for(u8 i = 0; m_plugin.PluginExist(i); i++)
@ -173,12 +174,20 @@ void CMenu::_PluginSettings()
else
enabledMagics.append(',' + magic);
if(magic == ENAND_PMAGIC || magic == NAND_PMAGIC)
{
if(first)
{
first--;
channels_type = 0;
}
if(magic == ENAND_PMAGIC)
channels_type |= CHANNELS_EMU;
else if(magic == NAND_PMAGIC)
channels_type |= CHANNELS_REAL;
}
}
}
m_cfg.setString(PLUGIN_DOMAIN, "enabled_plugins", enabledMagics);
if(m_refreshGameList && enabledPluginsCount > 0)

View File

@ -80,6 +80,8 @@ void CMenu::_sourceFlow()
m_plugin.SetEnablePlugin(pos, 1); // force disable all
enabledPluginsCount = 0;
string enabledMagics;
int channels_type = m_cfg.getInt(CHANNEL_DOMAIN, "channels_type");
u8 first = 1;
for(i = 0; i < magicNums.size(); i++)
{
u8 pos = m_plugin.GetPluginPosition(strtoul(magicNums[i].c_str(), NULL, 16));
@ -91,8 +93,22 @@ void CMenu::_sourceFlow()
enabledMagics = magicNums[i];
else
enabledMagics.append(',' + magicNums[i]);
string magic = sfmt("%08x", m_plugin.GetPluginMagic(pos));
if(magic == ENAND_PMAGIC || magic == NAND_PMAGIC)
{
if(first)
{
first--;
channels_type = 0;
}
if(magic == ENAND_PMAGIC)
channels_type |= CHANNELS_EMU;
else if(magic == NAND_PMAGIC)
channels_type |= CHANNELS_REAL;
}
}
}
m_cfg.setInt(CHANNEL_DOMAIN, "channels_type", channels_type);
m_cfg.setString(PLUGIN_DOMAIN, "enabled_plugins", enabledMagics);
m_current_view = COVERFLOW_PLUGIN;
}
@ -500,6 +516,8 @@ bool CMenu::_Source()
m_plugin.SetEnablePlugin(pos, 1); // force disable all
enabledPluginsCount = 0;
string enabledMagics;
int channels_type = m_cfg.getInt(CHANNEL_DOMAIN, "channels_type");
u8 first = 1;
for(i = 0; i < magicNums.size(); i++)
{
u8 pos = m_plugin.GetPluginPosition(strtoul(magicNums[i].c_str(), NULL, 16));
@ -511,8 +529,22 @@ bool CMenu::_Source()
enabledMagics = magicNums[i];
else
enabledMagics.append(',' + magicNums[i]);
string magic = sfmt("%08x", m_plugin.GetPluginMagic(pos));
if(magic == ENAND_PMAGIC || magic == NAND_PMAGIC)
{
if(first)
{
first--;
channels_type = 0;
}
if(magic == ENAND_PMAGIC)
channels_type |= CHANNELS_EMU;
else if(magic == NAND_PMAGIC)
channels_type |= CHANNELS_REAL;
}
}
}
m_cfg.setInt(CHANNEL_DOMAIN, "channels_type", channels_type);
m_cfg.setString(PLUGIN_DOMAIN, "enabled_plugins", enabledMagics);
m_current_view = COVERFLOW_PLUGIN;
_setSrcOptions();