- added the partition option to select SD and USB together. issue #325. BUT if you have the same game on both it will be shown twice. adding a check to see if the game is already listed for every time a game is added i think will slow down the process.

- added DEFINES for all internal plugin magics.
This commit is contained in:
Fledge68 2022-12-10 15:10:29 -06:00
parent 8e601ae97e
commit a2c02143f5
15 changed files with 162 additions and 150 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 MiB

After

Width:  |  Height:  |  Size: 4.4 MiB

View File

@ -24,6 +24,12 @@
#define HOMEBREW_DOMAIN "HOMEBREW" #define HOMEBREW_DOMAIN "HOMEBREW"
#define SOURCEFLOW_DOMAIN "SOURCEFLOW" #define SOURCEFLOW_DOMAIN "SOURCEFLOW"
#define WII_PMAGIC "4E574949"
#define GC_PMAGIC "4E47434D"
#define ENAND_PMAGIC "454E414E"
#define NAND_PMAGIC "4E414E44"
#define HB_PMAGIC "48425257"
#define DEVELOPERS "Fledge68" #define DEVELOPERS "Fledge68"
#define PAST_DEVELOPERS "FIX94, OverjoY, Hibernatus, Narolez, Hulk, Miigotu, r-win" #define PAST_DEVELOPERS "FIX94, OverjoY, Hibernatus, Narolez, Hulk, Miigotu, r-win"
#define LOADER_AUTHOR "Kwiirk, Waninkoko, Hermes" #define LOADER_AUTHOR "Kwiirk, Waninkoko, Hermes"

View File

@ -2226,7 +2226,7 @@ void CMenu::_initCF(void)
{ {
if(enabledPluginsCount == 1)// only one plugin enabled if(enabledPluginsCount == 1)// only one plugin enabled
{ {
if(m_plugin.GetEnabledStatus(m_plugin.GetPluginPosition(strtoul("48425257", NULL, 16))))// homebrew plugin if(m_plugin.GetEnabledStatus(HB_PMAGIC))// homebrew plugin
{ {
CoverFlow.setBoxMode(m_cfg.getBool(HOMEBREW_DOMAIN, "box_mode", true)); CoverFlow.setBoxMode(m_cfg.getBool(HOMEBREW_DOMAIN, "box_mode", true));
CoverFlow.setSmallBoxMode(m_cfg.getBool(HOMEBREW_DOMAIN, "smallbox", false)); CoverFlow.setSmallBoxMode(m_cfg.getBool(HOMEBREW_DOMAIN, "smallbox", false));
@ -2309,7 +2309,7 @@ void CMenu::_initCF(void)
u32 sourceNumber = 0; u32 sourceNumber = 0;
if(m_current_view == COVERFLOW_PLUGIN && !m_sourceflow) if(m_current_view == COVERFLOW_PLUGIN && !m_sourceflow)
{ {
if(!m_plugin.GetEnabledStatus(m_plugin.GetPluginPosition(strtoul(m_cfg.getString(PLUGIN_DOMAIN, "cur_magic", "00000000").c_str(), NULL, 16)))) if(!m_plugin.GetEnabledStatus(m_cfg.getString(PLUGIN_DOMAIN, "cur_magic", "00000000").c_str()))
{ {
for(u8 i = 0; m_plugin.PluginExist(i); ++i) for(u8 i = 0; m_plugin.PluginExist(i); ++i)
{ {
@ -2323,13 +2323,13 @@ void CMenu::_initCF(void)
strncpy(m_plugin.PluginMagicWord, m_cfg.getString(PLUGIN_DOMAIN, "cur_magic").c_str(), 8); strncpy(m_plugin.PluginMagicWord, m_cfg.getString(PLUGIN_DOMAIN, "cur_magic").c_str(), 8);
if(strncasecmp(m_plugin.PluginMagicWord, "4E47434D", 8) == 0)//NGCM if(strncasecmp(m_plugin.PluginMagicWord, GC_PMAGIC, 8) == 0)//NGCM
ID = m_cfg.getString("plugin_item", m_plugin.PluginMagicWord, ""); ID = m_cfg.getString("plugin_item", m_plugin.PluginMagicWord, "");
else if(strncasecmp(m_plugin.PluginMagicWord, "4E574949", 8) == 0)//NWII else if(strncasecmp(m_plugin.PluginMagicWord, WII_PMAGIC, 8) == 0)//NWII
ID = m_cfg.getString("plugin_item", m_plugin.PluginMagicWord, ""); ID = m_cfg.getString("plugin_item", m_plugin.PluginMagicWord, "");
else if(strncasecmp(m_plugin.PluginMagicWord, "4E414E44", 8) == 0)//NAND else if(strncasecmp(m_plugin.PluginMagicWord, NAND_PMAGIC, 8) == 0)//NAND
ID = m_cfg.getString("plugin_item", m_plugin.PluginMagicWord, ""); ID = m_cfg.getString("plugin_item", m_plugin.PluginMagicWord, "");
else if(strncasecmp(m_plugin.PluginMagicWord, "454E414E", 8) == 0)//EMUNAND else if(strncasecmp(m_plugin.PluginMagicWord, ENAND_PMAGIC, 8) == 0)//EMUNAND
ID = m_cfg.getString("plugin_item", m_plugin.PluginMagicWord, ""); ID = m_cfg.getString("plugin_item", m_plugin.PluginMagicWord, "");
else else
filename = m_cfg.getString("plugin_item", m_plugin.PluginMagicWord, "");// homebrew and plugins filename = m_cfg.getString("plugin_item", m_plugin.PluginMagicWord, "");// homebrew and plugins
@ -2394,23 +2394,34 @@ bool CMenu::_loadList(void)
bool CMenu::_loadWiiList(void) bool CMenu::_loadWiiList(void)
{ {
currentPartition = m_cfg.getInt(WII_DOMAIN, "partition", USB1);
if(!DeviceHandle.IsInserted(currentPartition))
return false;
gprintf("Adding wii list\n"); gprintf("Adding wii list\n");
DeviceHandle.OpenWBFS(currentPartition);
string gameDir(fmt(wii_games_dir, 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");
bool preCachedList = fsop_FileExist(cacheDir.c_str()); if(updateCache)
m_cacheList.CreateList(COVERFLOW_WII, gameDir, stringToVector(".wbfs|.iso", '|'), cacheDir, updateCache);
WBFS_Close();
m_cfg.remove(WII_DOMAIN, "update_cache");
for(vector<dir_discHdr>::iterator tmp_itr = m_cacheList.begin(); tmp_itr != m_cacheList.end(); tmp_itr++)
m_gameList.push_back(*tmp_itr);
if(updateCache || (!preCachedList && fsop_FileExist(cacheDir.c_str())))
cacheCovers = true; cacheCovers = true;
m_cfg.remove(WII_DOMAIN, "update_cache");
for(u8 i = 0; i < 2; ++i)
{
currentPartition = m_cfg.getInt(WII_DOMAIN, "partition", USB1);
if(currentPartition == 8)
currentPartition = i;
else if(i == 1)
continue;
if(!DeviceHandle.IsInserted(currentPartition))
continue;
DeviceHandle.OpenWBFS(currentPartition);
string gameDir(fmt(wii_games_dir, DeviceName[currentPartition]));
string cacheDir(fmt("%s/%s_wii.db", m_listCacheDir.c_str(), DeviceName[currentPartition]));
bool preCachedList = fsop_FileExist(cacheDir.c_str());
m_cacheList.CreateList(COVERFLOW_WII, gameDir, stringToVector(".wbfs|.iso", '|'), cacheDir, updateCache);
WBFS_Close();
for(vector<dir_discHdr>::iterator tmp_itr = m_cacheList.begin(); tmp_itr != m_cacheList.end(); tmp_itr++)
m_gameList.push_back(*tmp_itr);
if(!preCachedList && fsop_FileExist(cacheDir.c_str()))
cacheCovers = true;
}
return true; return true;
} }
@ -2436,25 +2447,36 @@ bool CMenu::_loadHomebrewList(const char *HB_Dir)
bool CMenu::_loadGamecubeList() bool CMenu::_loadGamecubeList()
{ {
currentPartition = m_cfg.getInt(GC_DOMAIN, "partition", USB1);
if(!DeviceHandle.IsInserted(currentPartition))
return false;
gprintf("Adding gamecube list\n"); gprintf("Adding gamecube list\n");
string gameDir(fmt(gc_games_dir, 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");
bool preCachedList = fsop_FileExist(cacheDir.c_str()); if(updateCache)
m_cacheList.CreateList(COVERFLOW_GAMECUBE, gameDir, stringToVector(".iso|.gcm|.ciso|root", '|'), cacheDir, updateCache);
m_cfg.remove(GC_DOMAIN, "update_cache");
for(vector<dir_discHdr>::iterator tmp_itr = m_cacheList.begin(); tmp_itr != m_cacheList.end(); tmp_itr++)
{
if(tmp_itr->settings[0] == 1) /* disc 2 */
continue;// skip gc disc 2 if its still part of the cached list
m_gameList.push_back(*tmp_itr);
}
if(updateCache || (!preCachedList && fsop_FileExist(cacheDir.c_str())))
cacheCovers = true; cacheCovers = true;
m_cfg.remove(GC_DOMAIN, "update_cache");
for(u8 i = 0; i < 2; ++i)
{
currentPartition = m_cfg.getInt(GC_DOMAIN, "partition", USB1);
if(currentPartition == 8)
currentPartition = i;
else if(i == 1)
continue;
if(!DeviceHandle.IsInserted(currentPartition))
continue;
string gameDir(fmt(gc_games_dir, DeviceName[currentPartition]));
string cacheDir(fmt("%s/%s_gamecube.db", m_listCacheDir.c_str(), DeviceName[currentPartition]));
bool preCachedList = fsop_FileExist(cacheDir.c_str());
m_cacheList.CreateList(COVERFLOW_GAMECUBE, gameDir, stringToVector(".iso|.gcm|.ciso|root", '|'), cacheDir, updateCache);
for(vector<dir_discHdr>::iterator tmp_itr = m_cacheList.begin(); tmp_itr != m_cacheList.end(); tmp_itr++)
{
if(tmp_itr->settings[0] == 1) /* disc 2 */
continue;// skip gc disc 2 if its still part of the cached list
m_gameList.push_back(*tmp_itr);
}
if(!preCachedList && fsop_FileExist(cacheDir.c_str()))
cacheCovers = true;
}
return true; return true;
} }
@ -2518,32 +2540,32 @@ bool CMenu::_loadPluginList()
const char *romDir = m_plugin.GetRomDir(i); const char *romDir = m_plugin.GetRomDir(i);
if(strstr(romDir, "scummvm.ini") == NULL) if(strstr(romDir, "scummvm.ini") == NULL)
{ {
if(strncasecmp(m_plugin.PluginMagicWord, "484252", 6) == 0)//HBRW if(strncasecmp(m_plugin.PluginMagicWord, HB_PMAGIC, 6) == 0)//HBRW
{ {
if(updateCache) if(updateCache)
m_cfg.setBool(HOMEBREW_DOMAIN, "update_cache", true); m_cfg.setBool(HOMEBREW_DOMAIN, "update_cache", true);
_loadHomebrewList(romDir); _loadHomebrewList(romDir);
} }
else if(strncasecmp(m_plugin.PluginMagicWord, "4E47434D", 8) == 0)//NGCM else if(strncasecmp(m_plugin.PluginMagicWord, GC_PMAGIC, 8) == 0)//NGCM
{ {
if(updateCache) if(updateCache)
m_cfg.setBool(GC_DOMAIN, "update_cache", true); m_cfg.setBool(GC_DOMAIN, "update_cache", true);
_loadGamecubeList(); _loadGamecubeList();
} }
else if(strncasecmp(m_plugin.PluginMagicWord, "4E574949", 8) == 0)//NWII else if(strncasecmp(m_plugin.PluginMagicWord, WII_PMAGIC, 8) == 0)//NWII
{ {
if(updateCache) if(updateCache)
m_cfg.setBool(WII_DOMAIN, "update_cache", true); m_cfg.setBool(WII_DOMAIN, "update_cache", true);
_loadWiiList(); _loadWiiList();
} }
else if(strncasecmp(m_plugin.PluginMagicWord, "4E414E44", 8) == 0)//NAND else if(strncasecmp(m_plugin.PluginMagicWord, NAND_PMAGIC, 8) == 0)//NAND
{ {
if(updateCache) if(updateCache)
m_cfg.setBool(CHANNEL_DOMAIN, "update_cache", true); m_cfg.setBool(CHANNEL_DOMAIN, "update_cache", true);
m_cfg.setInt(CHANNEL_DOMAIN, "channels_type", CHANNELS_REAL); m_cfg.setInt(CHANNEL_DOMAIN, "channels_type", CHANNELS_REAL);
_loadChannelList(); _loadChannelList();
} }
else if(strncasecmp(m_plugin.PluginMagicWord, "454E414E", 8) == 0)//ENAN else if(strncasecmp(m_plugin.PluginMagicWord, ENAND_PMAGIC, 8) == 0)//ENAN
{ {
if(updateCache) if(updateCache)
m_cfg.setBool(CHANNEL_DOMAIN, "update_cache", true); m_cfg.setBool(CHANNEL_DOMAIN, "update_cache", true);
@ -2808,22 +2830,22 @@ const char *CMenu::getBlankCoverPath(const dir_discHdr *element)
switch(element->type) switch(element->type)
{ {
case TYPE_CHANNEL: case TYPE_CHANNEL:
strncpy(m_plugin.PluginMagicWord, "4E414E44", 9); strncpy(m_plugin.PluginMagicWord, NAND_PMAGIC, 9);
break; break;
case TYPE_EMUCHANNEL: case TYPE_EMUCHANNEL:
strncpy(m_plugin.PluginMagicWord, "454E414E", 9); strncpy(m_plugin.PluginMagicWord, ENAND_PMAGIC, 9);
break; break;
case TYPE_HOMEBREW: case TYPE_HOMEBREW:
strncpy(m_plugin.PluginMagicWord, "48425257", 9); strncpy(m_plugin.PluginMagicWord, HB_PMAGIC, 9);
break; break;
case TYPE_GC_GAME: case TYPE_GC_GAME:
strncpy(m_plugin.PluginMagicWord, "4E47434D", 9); strncpy(m_plugin.PluginMagicWord, GC_PMAGIC, 9);
break; break;
case TYPE_PLUGIN: case TYPE_PLUGIN:
strncpy(m_plugin.PluginMagicWord, fmt("%08x", element->settings[0]), 8); strncpy(m_plugin.PluginMagicWord, fmt("%08x", element->settings[0]), 8);
break; break;
default:// wii default:// wii
strncpy(m_plugin.PluginMagicWord, "4E574949", 9); strncpy(m_plugin.PluginMagicWord, WII_PMAGIC, 9);
} }
blankCoverTitle = m_platform.getString("PLUGINS", m_plugin.PluginMagicWord, "wii"); blankCoverTitle = m_platform.getString("PLUGINS", m_plugin.PluginMagicWord, "wii");
} }

View File

@ -69,15 +69,15 @@ void CMenu::_setCatGenDomain()
if(m_plugin.GetEnabledStatus(i)) if(m_plugin.GetEnabledStatus(i))
{ {
strncpy(m_plugin.PluginMagicWord, fmt("%08x", m_plugin.GetPluginMagic(i)), 8); strncpy(m_plugin.PluginMagicWord, fmt("%08x", m_plugin.GetPluginMagic(i)), 8);
if(strncasecmp(m_plugin.PluginMagicWord, "4E47434D", 8) == 0)//NGCM if(strncasecmp(m_plugin.PluginMagicWord, GC_PMAGIC, 8) == 0)//NGCM
continue; continue;
else if(strncasecmp(m_plugin.PluginMagicWord, "4E574949", 8) == 0)//NWII else if(strncasecmp(m_plugin.PluginMagicWord, WII_PMAGIC, 8) == 0)//NWII
continue; continue;
else if(strncasecmp(m_plugin.PluginMagicWord, "4E414E44", 8) == 0)//NAND else if(strncasecmp(m_plugin.PluginMagicWord, NAND_PMAGIC, 8) == 0)//NAND
continue; continue;
else if(strncasecmp(m_plugin.PluginMagicWord, "454E414E", 8) == 0)//EMUNAND else if(strncasecmp(m_plugin.PluginMagicWord, ENAND_PMAGIC, 8) == 0)//EMUNAND
continue; continue;
else if(strncasecmp(m_plugin.PluginMagicWord, "48425257", 8) == 0)//HBRW else if(strncasecmp(m_plugin.PluginMagicWord, HB_PMAGIC, 8) == 0)//HBRW
continue; continue;
else else
{ {

View File

@ -524,7 +524,7 @@ void CMenu::_configGame(const dir_discHdr *hdr, bool disc)
// smallBox = m_cfg.getBool(SOURCEFLOW_DOMAIN, "smallbox", false); // smallBox = m_cfg.getBool(SOURCEFLOW_DOMAIN, "smallbox", false);
else if(m_current_view == COVERFLOW_PLUGIN && !m_sourceflow) else if(m_current_view == COVERFLOW_PLUGIN && !m_sourceflow)
{ {
if(enabledPluginsCount == 1 && m_plugin.GetEnabledStatus(m_plugin.GetPluginPosition(strtoul("48425257", NULL, 16)))) if(enabledPluginsCount == 1 && m_plugin.GetEnabledStatus(HB_PMAGIC))
smallBox = m_cfg.getBool(HOMEBREW_DOMAIN, "smallbox", false); smallBox = m_cfg.getBool(HOMEBREW_DOMAIN, "smallbox", false);
} }

View File

@ -36,9 +36,8 @@ void CMenu::_showConfigHB(void)
m_btnMgr.setText(m_configBtn2, m_cfg.getBool(HOMEBREW_DOMAIN, "smallbox") ? _t("on", L"On") : _t("off", L"Off")); m_btnMgr.setText(m_configBtn2, m_cfg.getBool(HOMEBREW_DOMAIN, "smallbox") ? _t("on", L"On") : _t("off", L"Off"));
m_btnMgr.setText(m_configBtn3, m_cfg.getBool(HOMEBREW_DOMAIN, "box_mode") ? _t("on", L"On") : _t("off", L"Off")); m_btnMgr.setText(m_configBtn3, m_cfg.getBool(HOMEBREW_DOMAIN, "box_mode") ? _t("on", L"On") : _t("off", L"Off"));
currentPartition = m_cfg.getInt(HOMEBREW_DOMAIN, "partition", 0); currentPartition = m_cfg.getInt(HOMEBREW_DOMAIN, "partition", SD);
const char *partitionname = DeviceName[currentPartition]; m_btnMgr.setText(m_configLbl4Val, upperCase(DeviceName[currentPartition]));
m_btnMgr.setText(m_configLbl4Val, upperCase(partitionname));
m_btnMgr.show(m_configLbl1); m_btnMgr.show(m_configLbl1);
m_btnMgr.show(m_configBtn1); m_btnMgr.show(m_configBtn1);
@ -95,10 +94,10 @@ void CMenu::_ConfigHB(void)
{ {
s8 direction = m_btnMgr.selected(m_configBtn4P) ? 1 : -1; s8 direction = m_btnMgr.selected(m_configBtn4P) ? 1 : -1;
_setPartition(direction, m_cfg.getInt(HOMEBREW_DOMAIN, "partition"), COVERFLOW_HOMEBREW); _setPartition(direction, m_cfg.getInt(HOMEBREW_DOMAIN, "partition"), COVERFLOW_HOMEBREW);
const char *partitionname = DeviceName[currentPartition]; m_cfg.setInt(HOMEBREW_DOMAIN, "partition", currentPartition);
m_btnMgr.setText(m_configLbl4Val, upperCase(partitionname)); m_btnMgr.setText(m_configLbl4Val, upperCase(DeviceName[currentPartition]));
if(m_current_view & COVERFLOW_HOMEBREW || if(m_current_view & COVERFLOW_HOMEBREW ||
(m_current_view & COVERFLOW_PLUGIN && m_plugin.GetEnabledStatus(m_plugin.GetPluginPosition(strtoul("48425257", NULL, 16))))) (m_current_view & COVERFLOW_PLUGIN && m_plugin.GetEnabledStatus(HB_PMAGIC)))
{ {
m_refreshGameList = true; m_refreshGameList = true;
//m_cfg.setBool(HOMEBREW_DOMAIN, "update_cache", true); //m_cfg.setBool(HOMEBREW_DOMAIN, "update_cache", true);

View File

@ -49,15 +49,15 @@ void CMenu::_setCurrentItem(const dir_discHdr *hdr)
else else
{ {
if(hdr->type == TYPE_WII_GAME) if(hdr->type == TYPE_WII_GAME)
strncpy(m_plugin.PluginMagicWord, "4E574949", 9); strncpy(m_plugin.PluginMagicWord, WII_PMAGIC, 9);
else if(hdr->type == TYPE_GC_GAME) else if(hdr->type == TYPE_GC_GAME)
strncpy(m_plugin.PluginMagicWord, "4E47434D", 9); strncpy(m_plugin.PluginMagicWord, GC_PMAGIC, 9);
else if(hdr->type == TYPE_CHANNEL) else if(hdr->type == TYPE_CHANNEL)
strncpy(m_plugin.PluginMagicWord, "4E414E44", 9); strncpy(m_plugin.PluginMagicWord, NAND_PMAGIC, 9);
else if(hdr->type == TYPE_EMUCHANNEL) else if(hdr->type == TYPE_EMUCHANNEL)
strncpy(m_plugin.PluginMagicWord, "454E414E", 9); strncpy(m_plugin.PluginMagicWord, ENAND_PMAGIC, 9);
else //HOMEBREW else //HOMEBREW
strncpy(m_plugin.PluginMagicWord, "48425257", 9); strncpy(m_plugin.PluginMagicWord, HB_PMAGIC, 9);
} }
m_cfg.setString(PLUGIN_DOMAIN, "cur_magic", m_plugin.PluginMagicWord); m_cfg.setString(PLUGIN_DOMAIN, "cur_magic", m_plugin.PluginMagicWord);
m_cfg.setString("plugin_item", m_plugin.PluginMagicWord, fn_id); m_cfg.setString("plugin_item", m_plugin.PluginMagicWord, fn_id);

View File

@ -541,7 +541,7 @@ int CMenu::_cacheCovers()
smallBox = m_cfg.getBool(SOURCEFLOW_DOMAIN, "smallbox", false); smallBox = m_cfg.getBool(SOURCEFLOW_DOMAIN, "smallbox", false);
else if(m_current_view == COVERFLOW_PLUGIN && !m_sourceflow) else if(m_current_view == COVERFLOW_PLUGIN && !m_sourceflow)
{ {
if(enabledPluginsCount == 1 && m_plugin.GetEnabledStatus(m_plugin.GetPluginPosition(strtoul("48425257", NULL, 16)))) if(enabledPluginsCount == 1 && m_plugin.GetEnabledStatus(HB_PMAGIC))
smallBox = m_cfg.getBool(HOMEBREW_DOMAIN, "smallbox", false); smallBox = m_cfg.getBool(HOMEBREW_DOMAIN, "smallbox", false);
} }

View File

@ -58,15 +58,15 @@ void CMenu::_getCustomBgTex()
{ {
case COVERFLOW_CHANNEL: case COVERFLOW_CHANNEL:
if(m_cfg.getInt(CHANNEL_DOMAIN, "channels_type") & CHANNELS_REAL) if(m_cfg.getInt(CHANNEL_DOMAIN, "channels_type") & CHANNELS_REAL)
strncpy(m_plugin.PluginMagicWord, "4E414E44", 9); strncpy(m_plugin.PluginMagicWord, NAND_PMAGIC, 9);
else else
strncpy(m_plugin.PluginMagicWord, "454E414E", 9); strncpy(m_plugin.PluginMagicWord, ENAND_PMAGIC, 9);
break; break;
case COVERFLOW_HOMEBREW: case COVERFLOW_HOMEBREW:
strncpy(m_plugin.PluginMagicWord, "48425257", 9); strncpy(m_plugin.PluginMagicWord, HB_PMAGIC, 9);
break; break;
case COVERFLOW_GAMECUBE: case COVERFLOW_GAMECUBE:
strncpy(m_plugin.PluginMagicWord, "4E47434D", 9); strncpy(m_plugin.PluginMagicWord, GC_PMAGIC, 9);
break; break;
case COVERFLOW_PLUGIN: case COVERFLOW_PLUGIN:
while(m_plugin.PluginExist(i) && !m_plugin.GetEnabledStatus(i)) { ++i; } while(m_plugin.PluginExist(i) && !m_plugin.GetEnabledStatus(i)) { ++i; }
@ -74,7 +74,7 @@ void CMenu::_getCustomBgTex()
strncpy(m_plugin.PluginMagicWord, fmt("%08x", m_plugin.GetPluginMagic(i)), 8); strncpy(m_plugin.PluginMagicWord, fmt("%08x", m_plugin.GetPluginMagic(i)), 8);
break; break;
default:// wii default:// wii
strncpy(m_plugin.PluginMagicWord, "4E574949", 9); strncpy(m_plugin.PluginMagicWord, WII_PMAGIC, 9);
} }
if(strlen(m_plugin.PluginMagicWord) == 8) if(strlen(m_plugin.PluginMagicWord) == 8)
fn = m_platform.getString("PLUGINS", m_plugin.PluginMagicWord, ""); fn = m_platform.getString("PLUGINS", m_plugin.PluginMagicWord, "");
@ -305,7 +305,7 @@ void CMenu::_showCF(bool refreshList)
if(m_current_view == COVERFLOW_PLUGIN && !m_sourceflow) if(m_current_view == COVERFLOW_PLUGIN && !m_sourceflow)
{ {
/* check if homebrew plugin */ /* check if homebrew plugin */
if(enabledPluginsCount == 1 && m_plugin.GetEnabledStatus(m_plugin.GetPluginPosition(strtoul("48425257", NULL, 16))) && m_cfg.getBool(HOMEBREW_DOMAIN, "smallbox")) if(enabledPluginsCount == 1 && m_plugin.GetEnabledStatus(HB_PMAGIC) && m_cfg.getBool(HOMEBREW_DOMAIN, "smallbox"))
strcpy(cf_domain, "_SMALLFLOW"); strcpy(cf_domain, "_SMALLFLOW");
else if(enabledPluginsCount > 0 && m_platform.loaded()) else if(enabledPluginsCount > 0 && m_platform.loaded())
{ {
@ -1215,42 +1215,6 @@ wstringEx CMenu::_getNoticeTranslation(int sorting, wstringEx curLetter)
return curLetter; return curLetter;
} }
void CMenu::_setPartition(s8 direction, u8 partition, u8 coverflow)// COVERFLOW_NONE is for emu saves nand
{
if(m_source_cnt > 1 && coverflow > 0)// changing partition not allowed when more than one source is selected
return;
currentPartition = partition;
u8 prev_view = m_current_view;
m_current_view = coverflow;
int FS_Type = 0;
bool NeedFAT = m_current_view == COVERFLOW_CHANNEL || m_current_view == COVERFLOW_GAMECUBE || m_current_view == COVERFLOW_NONE;
u8 limiter = 0;
if(direction != 0)// change partition if direction is not zero
{
do
{
currentPartition = loopNum(currentPartition + direction, 9);
FS_Type = DeviceHandle.GetFSType(currentPartition);
limiter++;
}
while(limiter < 9 && (!DeviceHandle.IsInserted(currentPartition) ||
(m_current_view != COVERFLOW_WII && FS_Type == PART_FS_WBFS) ||
(NeedFAT && FS_Type != PART_FS_FAT)));
}
/* set partition to currentPartition */
if(limiter < 9)
{
if(coverflow == COVERFLOW_NONE)// saves emu nand
m_cfg.setInt(WII_DOMAIN, "savepartition", currentPartition);
else if(m_current_view != COVERFLOW_CHANNEL || (FS_Type != -1 && DeviceHandle.IsInserted(currentPartition)))
m_cfg.setInt(_domainFromView(), "partition", currentPartition);
}
m_current_view = prev_view;
}
void CMenu::exitHandler(int ExitTo) void CMenu::exitHandler(int ExitTo)
{ {
m_exit = true; m_exit = true;

View File

@ -132,14 +132,13 @@ void CMenu::_showNandEmu(void)
else else
{ {
m_btnMgr.setText(m_configLbl1, _t("cfgne38", L"Saves NAND Partition")); m_btnMgr.setText(m_configLbl1, _t("cfgne38", L"Saves NAND Partition"));
currentPartition = m_cfg.getInt(WII_DOMAIN, "savepartition");
m_btnMgr.setText(m_configLbl1Val, upperCase(DeviceName[currentPartition]));
m_btnMgr.setText(m_configLbl2, _t("cfgne40", L"Use Real NAND Config")); m_btnMgr.setText(m_configLbl2, _t("cfgne40", L"Use Real NAND Config"));
m_btnMgr.setText(m_configLbl3, _t("cfgne41", L"Use Real NAND Miis"));
const char *partitionname = DeviceName[m_cfg.getInt(WII_DOMAIN, "savepartition")];
m_btnMgr.setText(m_configLbl1Val, upperCase(partitionname));
m_btnMgr.setText(m_configBtn2, m_cfg.getBool(CHANNEL_DOMAIN, "real_nand_config", false) ? _t("on", L"On") : _t("off", L"Off")); m_btnMgr.setText(m_configBtn2, m_cfg.getBool(CHANNEL_DOMAIN, "real_nand_config", false) ? _t("on", L"On") : _t("off", L"Off"));
m_btnMgr.setText(m_configLbl3, _t("cfgne41", L"Use Real NAND Miis"));
m_btnMgr.setText(m_configBtn3, m_cfg.getBool(CHANNEL_DOMAIN, "real_nand_miis", false) ? _t("on", L"On") : _t("off", L"Off")); m_btnMgr.setText(m_configBtn3, m_cfg.getBool(CHANNEL_DOMAIN, "real_nand_miis", false) ? _t("on", L"On") : _t("off", L"Off"));
m_btnMgr.show(m_configLbl1); m_btnMgr.show(m_configLbl1);
@ -298,9 +297,9 @@ int CMenu::_NandEmuCfg(void)
{ {
direction = m_btnMgr.selected(m_configBtn1P) ? 1 : -1; direction = m_btnMgr.selected(m_configBtn1P) ? 1 : -1;
_setPartition(direction, m_cfg.getInt(WII_DOMAIN, "savepartition"), COVERFLOW_NONE); _setPartition(direction, m_cfg.getInt(WII_DOMAIN, "savepartition"), COVERFLOW_NONE);
m_cfg.setInt(WII_DOMAIN, "savepartition", currentPartition);
m_btnMgr.setText(m_configLbl1Val, upperCase(DeviceName[currentPartition]));
_getEmuNands();// refresh emunands in case the partition was changed _getEmuNands();// refresh emunands in case the partition was changed
const char *partitionname = DeviceName[m_cfg.getInt(WII_DOMAIN, "savepartition")];
m_btnMgr.setText(m_configLbl1Val, upperCase(partitionname));
} }
else if(m_btnMgr.selected(m_configBtn2)) else if(m_btnMgr.selected(m_configBtn2))
{ {

View File

@ -7,6 +7,11 @@ s16 m_partitionsLblUser[4];
TexData m_partitionsBg; TexData m_partitionsBg;
static inline int loopNum(int i, int s)
{
return (i + s) % s;
}
void CMenu::_hidePartitionsCfg(bool instant) void CMenu::_hidePartitionsCfg(bool instant)
{ {
m_btnMgr.hide(m_partitionsLblTitle, instant); m_btnMgr.hide(m_partitionsLblTitle, instant);
@ -32,17 +37,17 @@ void CMenu::_showPartitionsCfg(void)
m_btnMgr.setText(m_configLbl3, _t("part3", L"Emu NANDS Partition")); m_btnMgr.setText(m_configLbl3, _t("part3", L"Emu NANDS Partition"));
m_btnMgr.setText(m_configLbl4, _t("part4", L"Plugins Default Partition")); m_btnMgr.setText(m_configLbl4, _t("part4", L"Plugins Default Partition"));
const char *partitionname = DeviceName[m_cfg.getInt(WII_DOMAIN, "partition", 0)]; currentPartition = m_cfg.getInt(WII_DOMAIN, "partition", USB1);
m_btnMgr.setText(m_configLbl1Val, upperCase(partitionname)); m_btnMgr.setText(m_configLbl1Val, currentPartition == 8 ? "SD/USB" : upperCase(DeviceName[currentPartition]));
partitionname = DeviceName[m_cfg.getInt(GC_DOMAIN, "partition", 0)]; currentPartition = m_cfg.getInt(GC_DOMAIN, "partition", USB1);
m_btnMgr.setText(m_configLbl2Val, upperCase(partitionname)); m_btnMgr.setText(m_configLbl2Val, currentPartition == 8 ? "SD/USB" : upperCase(DeviceName[currentPartition]));
partitionname = DeviceName[m_cfg.getInt(CHANNEL_DOMAIN, "partition", 0)]; currentPartition = m_cfg.getInt(CHANNEL_DOMAIN, "partition", USB1);
m_btnMgr.setText(m_configLbl3Val, upperCase(partitionname)); m_btnMgr.setText(m_configLbl3Val, upperCase(DeviceName[currentPartition]));
partitionname = DeviceName[m_cfg.getInt(PLUGIN_DOMAIN, "partition", 0)]; currentPartition = m_cfg.getInt(PLUGIN_DOMAIN, "partition", SD);
m_btnMgr.setText(m_configLbl4Val, upperCase(partitionname)); m_btnMgr.setText(m_configLbl4Val, upperCase(DeviceName[currentPartition]));
m_btnMgr.show(m_configLbl1); m_btnMgr.show(m_configLbl1);
m_btnMgr.show(m_configLbl1Val); m_btnMgr.show(m_configLbl1Val);
@ -64,7 +69,6 @@ void CMenu::_showPartitionsCfg(void)
void CMenu::_partitionsCfg(void) void CMenu::_partitionsCfg(void)
{ {
//int prevPartition = currentPartition;
SetupInput(); SetupInput();
_showPartitionsCfg(); _showPartitionsCfg();
while(!m_exit) while(!m_exit)
@ -84,55 +88,41 @@ void CMenu::_partitionsCfg(void)
{ {
s8 direction = m_btnMgr.selected(m_configBtn1P) ? 1 : -1; s8 direction = m_btnMgr.selected(m_configBtn1P) ? 1 : -1;
_setPartition(direction, m_cfg.getInt(WII_DOMAIN, "partition"), COVERFLOW_WII); _setPartition(direction, m_cfg.getInt(WII_DOMAIN, "partition"), COVERFLOW_WII);
m_cfg.setInt(WII_DOMAIN, "partition", currentPartition);
_showPartitionsCfg(); _showPartitionsCfg();
if(m_current_view & COVERFLOW_WII || if(m_current_view & COVERFLOW_WII || (m_current_view & COVERFLOW_PLUGIN && m_plugin.GetEnabledStatus(WII_PMAGIC)))
(m_current_view & COVERFLOW_PLUGIN && m_plugin.GetEnabledStatus(m_plugin.GetPluginPosition(strtoul("4E574949", NULL, 16)))))
{
m_refreshGameList = true; m_refreshGameList = true;
//prevPartition = currentPartition;
}
} }
else if(m_btnMgr.selected(m_configBtn2P) || m_btnMgr.selected(m_configBtn2M)) else if(m_btnMgr.selected(m_configBtn2P) || m_btnMgr.selected(m_configBtn2M))
{ {
s8 direction = m_btnMgr.selected(m_configBtn2P) ? 1 : -1; s8 direction = m_btnMgr.selected(m_configBtn2P) ? 1 : -1;
_setPartition(direction, m_cfg.getInt(GC_DOMAIN, "partition"), COVERFLOW_GAMECUBE); _setPartition(direction, m_cfg.getInt(GC_DOMAIN, "partition"), COVERFLOW_GAMECUBE);
m_cfg.setInt(GC_DOMAIN, "partition", currentPartition);
_showPartitionsCfg(); _showPartitionsCfg();
if(m_current_view & COVERFLOW_GAMECUBE || if(m_current_view & COVERFLOW_GAMECUBE || (m_current_view & COVERFLOW_PLUGIN && m_plugin.GetEnabledStatus(GC_PMAGIC)))
(m_current_view & COVERFLOW_PLUGIN && m_plugin.GetEnabledStatus(m_plugin.GetPluginPosition(strtoul("4E47434D", NULL, 16)))))
{
m_refreshGameList = true; m_refreshGameList = true;
//prevPartition = currentPartition;
}
} }
else if(m_btnMgr.selected(m_configBtn3P) || m_btnMgr.selected(m_configBtn3M)) else if(m_btnMgr.selected(m_configBtn3P) || m_btnMgr.selected(m_configBtn3M))
{ {
s8 direction = m_btnMgr.selected(m_configBtn3P) ? 1 : -1; s8 direction = m_btnMgr.selected(m_configBtn3P) ? 1 : -1;
_setPartition(direction, m_cfg.getInt(CHANNEL_DOMAIN, "partition"), COVERFLOW_CHANNEL); _setPartition(direction, m_cfg.getInt(CHANNEL_DOMAIN, "partition"), COVERFLOW_CHANNEL);
m_cfg.setInt(CHANNEL_DOMAIN, "partition", currentPartition);
_showPartitionsCfg(); _showPartitionsCfg();
// partition only for emu nands // partition only for emu nands
if(m_current_view & COVERFLOW_CHANNEL || if(m_current_view & COVERFLOW_CHANNEL || (m_current_view & COVERFLOW_PLUGIN && m_plugin.GetEnabledStatus(ENAND_PMAGIC)))
(m_current_view & COVERFLOW_PLUGIN && m_plugin.GetEnabledStatus(m_plugin.GetPluginPosition(strtoul("454E414E", NULL, 16)))))
{
m_refreshGameList = true; m_refreshGameList = true;
//prevPartition = currentPartition;
}
} }
else if(m_btnMgr.selected(m_configBtn4P) || m_btnMgr.selected(m_configBtn4M)) else if(m_btnMgr.selected(m_configBtn4P) || m_btnMgr.selected(m_configBtn4M))
{ {
s8 direction = m_btnMgr.selected(m_configBtn4P) ? 1 : -1; s8 direction = m_btnMgr.selected(m_configBtn4P) ? 1 : -1;
_setPartition(direction, m_cfg.getInt(PLUGIN_DOMAIN, "partition"), COVERFLOW_PLUGIN); _setPartition(direction, m_cfg.getInt(PLUGIN_DOMAIN, "partition"), COVERFLOW_PLUGIN);
m_cfg.setInt(PLUGIN_DOMAIN, "partition", currentPartition);
_showPartitionsCfg(); _showPartitionsCfg();
if(m_current_view & COVERFLOW_PLUGIN) if(m_current_view & COVERFLOW_PLUGIN)
{
m_refreshGameList = true; m_refreshGameList = true;
//prevPartition = currentPartition;
}
} }
} }
} }
//m_current_view = m_prev_view;
//m_prev_view = 0;
//currentPartition = prevPartition;
_hidePartitionsCfg(); _hidePartitionsCfg();
} }
@ -156,3 +146,29 @@ void CMenu::_textPartitionsCfg(void)
m_btnMgr.setText(m_partitionsLblTitle, _t("part5", L"Partition Settings")); m_btnMgr.setText(m_partitionsLblTitle, _t("part5", L"Partition Settings"));
m_btnMgr.setText(m_partitionsBtnBack, _t("cfg10", L"Back")); m_btnMgr.setText(m_partitionsBtnBack, _t("cfg10", L"Back"));
} }
void CMenu::_setPartition(s8 direction, u8 partition, u8 coverflow)// COVERFLOW_NONE is for emu saves nand
{
currentPartition = partition;
u8 prev_view = m_current_view;// save and restore later
m_current_view = coverflow;
int FS_Type = 0;
bool NeedFAT = m_current_view == COVERFLOW_CHANNEL || m_current_view == COVERFLOW_GAMECUBE || m_current_view == COVERFLOW_NONE;
u8 limiter = 0;
if(direction != 0)// change partition if direction is not zero
{
do
{
currentPartition = loopNum(currentPartition + direction, 9);
if(currentPartition == 8 && (m_current_view == COVERFLOW_WII || m_current_view == COVERFLOW_GAMECUBE))
break;
FS_Type = DeviceHandle.GetFSType(currentPartition);
limiter++;
}
while(limiter < 9 && (!DeviceHandle.IsInserted(currentPartition) ||
(m_current_view != COVERFLOW_WII && FS_Type == PART_FS_WBFS) ||
(NeedFAT && FS_Type != PART_FS_FAT)));
}
m_current_view = prev_view;
}

View File

@ -173,9 +173,9 @@ void CMenu::_PluginSettings()
else else
enabledMagics.append(',' + magic); enabledMagics.append(',' + magic);
if(magic == "454e414e") if(magic == ENAND_PMAGIC)
channels_type |= CHANNELS_EMU; channels_type |= CHANNELS_EMU;
else if(magic == "4e414e44") else if(magic == NAND_PMAGIC)
channels_type |= CHANNELS_REAL; channels_type |= CHANNELS_REAL;
} }
} }

View File

@ -296,15 +296,15 @@ void CMenu::_checkboxesMenu(u8 md)
u8 pos = firstCheckbox + i - 1; u8 pos = firstCheckbox + i - 1;
bool plugin_ok = true; bool plugin_ok = true;
strncpy(m_plugin.PluginMagicWord, fmt("%08x", m_plugin.GetPluginMagic(pos)), 8); strncpy(m_plugin.PluginMagicWord, fmt("%08x", m_plugin.GetPluginMagic(pos)), 8);
if(strncasecmp(m_plugin.PluginMagicWord, "484252", 6) == 0)//HBRW if(strncasecmp(m_plugin.PluginMagicWord, HB_PMAGIC, 6) == 0)//HBRW
plugin_ok = false; plugin_ok = false;
else if(strncasecmp(m_plugin.PluginMagicWord, "4E47434D", 8) == 0)//NGCM else if(strncasecmp(m_plugin.PluginMagicWord, GC_PMAGIC, 8) == 0)//NGCM
plugin_ok = false; plugin_ok = false;
else if(strncasecmp(m_plugin.PluginMagicWord, "4E574949", 8) == 0)//NWII else if(strncasecmp(m_plugin.PluginMagicWord, WII_PMAGIC, 8) == 0)//NWII
plugin_ok = false; plugin_ok = false;
else if(strncasecmp(m_plugin.PluginMagicWord, "4E414E44", 8) == 0)//NAND else if(strncasecmp(m_plugin.PluginMagicWord, NAND_PMAGIC, 8) == 0)//NAND
plugin_ok = false; plugin_ok = false;
else if(strncasecmp(m_plugin.PluginMagicWord, "454E414E", 8) == 0)//ENAN else if(strncasecmp(m_plugin.PluginMagicWord, ENAND_PMAGIC, 8) == 0)//ENAN
plugin_ok = false; plugin_ok = false;
else if(strncasecmp(m_plugin.PluginMagicWord, "5343564D", 8) == 0)//scummvm else if(strncasecmp(m_plugin.PluginMagicWord, "5343564D", 8) == 0)//scummvm
plugin_ok = false; plugin_ok = false;

View File

@ -237,6 +237,11 @@ bool Plugin::GetEnabledStatus(u8 pos)
return false; return false;
} }
bool Plugin::GetEnabledStatus(const char *magic)
{
return GetEnabledStatus(GetPluginPosition(strtoul(magic, NULL, 16)));
}
const vector<bool> &Plugin::GetEnabledPlugins(u8 *num) const vector<bool> &Plugin::GetEnabledPlugins(u8 *num)
{ {
enabledPlugins.clear(); enabledPlugins.clear();

View File

@ -86,6 +86,7 @@ public:
void AddPlugin(Config &plugin, const string &iniPath); void AddPlugin(Config &plugin, const string &iniPath);
void Cleanup(); void Cleanup();
bool GetEnabledStatus(u8 pos); bool GetEnabledStatus(u8 pos);
bool GetEnabledStatus(const char *magic);
void SetEnablePlugin(u8 pos, u8 ForceMode = 0); void SetEnablePlugin(u8 pos, u8 ForceMode = 0);
const vector<bool> &GetEnabledPlugins(u8 *num); const vector<bool> &GetEnabledPlugins(u8 *num);
bool PluginExist(u8 pos); bool PluginExist(u8 pos);