mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2025-02-02 13:52:36 +01:00
- modified plugin code a little. biggest difference is now it no longer uses [PLUGINS_ENABLED] in wiiflow_lite.ini.
This commit is contained in:
parent
ef22015f8d
commit
da19f5b414
BIN
out/boot.dol
BIN
out/boot.dol
Binary file not shown.
Before Width: | Height: | Size: 4.1 MiB After Width: | Height: | Size: 4.1 MiB |
@ -75,7 +75,6 @@ CMenu::CMenu()
|
|||||||
m_init_network = false;
|
m_init_network = false;
|
||||||
m_use_source = true;
|
m_use_source = true;
|
||||||
m_sourceflow = false;
|
m_sourceflow = false;
|
||||||
m_numPlugins = 0;
|
|
||||||
m_clearCats = false;
|
m_clearCats = false;
|
||||||
m_getFavs = true;
|
m_getFavs = true;
|
||||||
m_catStartPage = 1;
|
m_catStartPage = 1;
|
||||||
@ -103,13 +102,6 @@ CMenu::CMenu()
|
|||||||
m_source_autoboot = false;
|
m_source_autoboot = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static vector<string> INI_List;
|
|
||||||
static void GrabINIFiles(char *FullPath)
|
|
||||||
{
|
|
||||||
//Just push back
|
|
||||||
INI_List.push_back(FullPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CMenu::init(bool usb_mounted)
|
bool CMenu::init(bool usb_mounted)
|
||||||
{
|
{
|
||||||
SoundHandle.Init();
|
SoundHandle.Init();
|
||||||
@ -327,28 +319,29 @@ bool CMenu::init(bool usb_mounted)
|
|||||||
m_coverflow.load(fmt("%s/default.ini", m_coverflowsDir.c_str()));
|
m_coverflow.load(fmt("%s/default.ini", m_coverflowsDir.c_str()));
|
||||||
m_platform.load(fmt("%s/platform.ini", m_pluginDataDir.c_str()));
|
m_platform.load(fmt("%s/platform.ini", m_pluginDataDir.c_str()));
|
||||||
|
|
||||||
/* Get plugin ini files */
|
/* Init plugins */
|
||||||
m_plugin.init(m_pluginsDir);
|
m_plugin.init(m_pluginsDir);
|
||||||
INI_List.clear();
|
vector<string> magics = m_cfg.getStrings(PLUGIN_DOMAIN, "enabled_plugins", ',');
|
||||||
GetFiles(m_pluginsDir.c_str(), stringToVector(".ini", '|'), GrabINIFiles, false, 3);
|
if(magics.size() > 0)
|
||||||
|
|
||||||
if(INI_List.size() > 0)
|
|
||||||
{
|
{
|
||||||
Config m_plugin_cfg;
|
enabledPluginsCount = 0;
|
||||||
for(vector<string>::const_iterator iniFile = INI_List.begin(); iniFile != INI_List.end(); ++iniFile)
|
string enabledMagics;
|
||||||
|
for(u8 i = 0; i < magics.size(); i++)
|
||||||
{
|
{
|
||||||
if(iniFile->find("scummvm.ini") != string::npos)
|
u8 pos = m_plugin.GetPluginPosition(strtoul(magics[i].c_str(), NULL, 16));
|
||||||
continue;
|
if(pos < 255)
|
||||||
m_plugin_cfg.load(iniFile->c_str());
|
|
||||||
if(m_plugin_cfg.loaded())
|
|
||||||
{
|
{
|
||||||
m_plugin.AddPlugin(m_plugin_cfg);
|
enabledPluginsCount++;
|
||||||
m_numPlugins++;
|
m_plugin.SetEnablePlugin(pos, 2);
|
||||||
}
|
if(i == 0)
|
||||||
m_plugin_cfg.unload();
|
enabledMagics = magics[0];
|
||||||
|
else
|
||||||
|
enabledMagics.append(',' + magics[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_plugin.EndAdd();
|
m_cfg.setString(PLUGIN_DOMAIN, "enabled_plugins", enabledMagics);
|
||||||
|
magics.clear();
|
||||||
|
}
|
||||||
|
|
||||||
/* Set wiiflow language */
|
/* Set wiiflow language */
|
||||||
const char *defLang = "Default";
|
const char *defLang = "Default";
|
||||||
@ -2146,7 +2139,7 @@ void CMenu::_initCF(void)
|
|||||||
dump.setWString(domain, id, hdr->title);
|
dump.setWString(domain, id, hdr->title);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(hdr->type == TYPE_PLUGIN && m_plugin.GetEnableStatus(m_cfg, hdr->settings[0]))
|
if(hdr->type == TYPE_PLUGIN && m_plugin.GetEnabledStatus(m_plugin.GetPluginPosition(hdr->settings[0])))
|
||||||
CoverFlow.addItem(&(*hdr), 0, 0);
|
CoverFlow.addItem(&(*hdr), 0, 0);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2187,10 +2180,9 @@ void CMenu::_initCF(void)
|
|||||||
}
|
}
|
||||||
else if(m_current_view == COVERFLOW_PLUGIN)
|
else if(m_current_view == COVERFLOW_PLUGIN)
|
||||||
{
|
{
|
||||||
m_plugin.GetEnabledPlugins(m_cfg, &enabledPluginsCount);
|
|
||||||
if(enabledPluginsCount == 1)// only one plugin enabled
|
if(enabledPluginsCount == 1)// only one plugin enabled
|
||||||
{
|
{
|
||||||
if(m_cfg.getBool(PLUGIN_ENABLED, "48425257"))// homebrew plugin
|
if(m_plugin.GetEnabledStatus(m_plugin.GetPluginPosition(strtoul("48425257", NULL, 16))))// 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));
|
||||||
@ -2198,9 +2190,9 @@ void CMenu::_initCF(void)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
s8 bm = -1;
|
s8 bm = -1;
|
||||||
for(u8 i = 0; m_plugin.PluginExist(i); ++i)// get plugins box mode value
|
for(u8 i = 0; m_plugin.PluginExist(i); ++i)
|
||||||
{
|
{
|
||||||
if(m_plugin.GetEnableStatus(m_cfg, m_plugin.getPluginMagic(i)))
|
if(m_plugin.GetEnabledStatus(i))
|
||||||
{
|
{
|
||||||
bm = m_plugin.GetBoxMode(i);
|
bm = m_plugin.GetBoxMode(i);
|
||||||
break;
|
break;
|
||||||
@ -2217,31 +2209,33 @@ void CMenu::_initCF(void)
|
|||||||
{
|
{
|
||||||
s8 bm1 = -1;
|
s8 bm1 = -1;
|
||||||
s8 bm2 = -1;
|
s8 bm2 = -1;
|
||||||
u8 i;
|
bool all_same = true;
|
||||||
for(i = 0; m_plugin.PluginExist(i); ++i)// get first enabled plugins box mode
|
for(u8 i = 0; m_plugin.PluginExist(i); ++i)
|
||||||
{
|
{
|
||||||
if(m_plugin.GetEnableStatus(m_cfg, m_plugin.getPluginMagic(i)))
|
if(m_plugin.GetEnabledStatus(i))
|
||||||
|
{
|
||||||
|
if(bm1 == -1)
|
||||||
{
|
{
|
||||||
bm1 = m_plugin.GetBoxMode(i);
|
bm1 = m_plugin.GetBoxMode(i);
|
||||||
if(bm1 < 0)
|
if(bm1 < 0)
|
||||||
bm1 = m_cfg.getBool("GENERAL", "box_mode", true);
|
bm1 = m_cfg.getBool("GENERAL", "box_mode", true) ? 1 : 0;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
for(i = 0; m_plugin.PluginExist(i); ++i)// check all other enabled are the same
|
|
||||||
{
|
|
||||||
if(m_plugin.GetEnableStatus(m_cfg, m_plugin.getPluginMagic(i)))
|
|
||||||
{
|
{
|
||||||
bm2 = m_plugin.GetBoxMode(i);
|
bm2 = m_plugin.GetBoxMode(i);
|
||||||
if(bm2 < 0)
|
if(bm2 < 0)
|
||||||
bm2 = m_cfg.getBool("GENERAL", "box_mode", true);
|
bm2 = m_cfg.getBool("GENERAL", "box_mode", true) ? 1 : 0;
|
||||||
if(bm2 != bm1)
|
if(bm2 != bm1)
|
||||||
|
{
|
||||||
|
all_same = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(m_plugin.PluginExist(i))// broke out of loop because not all the same so use default
|
}
|
||||||
|
}
|
||||||
|
if(!all_same)
|
||||||
CoverFlow.setBoxMode(m_cfg.getBool("GENERAL", "box_mode", true));
|
CoverFlow.setBoxMode(m_cfg.getBool("GENERAL", "box_mode", true));
|
||||||
else // made it thru loop so they all match
|
else
|
||||||
CoverFlow.setBoxMode(bm1 == 0 ? false : true);
|
CoverFlow.setBoxMode(bm1 == 0 ? false : true);
|
||||||
CoverFlow.setSmallBoxMode(false);
|
CoverFlow.setSmallBoxMode(false);
|
||||||
}
|
}
|
||||||
@ -2271,18 +2265,20 @@ 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)
|
||||||
{
|
{
|
||||||
strncpy(m_plugin.PluginMagicWord, m_cfg.getString(PLUGIN_DOMAIN, "cur_magic").c_str(), 8);
|
if(!m_plugin.GetEnabledStatus(m_plugin.GetPluginPosition(strtoul(m_cfg.getString(PLUGIN_DOMAIN, "cur_magic", "00000000").c_str(), NULL, 16))))
|
||||||
if(!m_cfg.getBool("PLUGINS_ENABLED", m_plugin.PluginMagicWord, false))
|
|
||||||
{
|
{
|
||||||
for(u8 i = 0; m_plugin.PluginExist(i); ++i)
|
for(u8 i = 0; m_plugin.PluginExist(i); ++i)
|
||||||
{
|
{
|
||||||
if(m_plugin.GetEnableStatus(m_cfg, m_plugin.getPluginMagic(i)))// sets m_plugin.PluginMagicWord
|
if(m_plugin.GetEnabledStatus(i))
|
||||||
{
|
{
|
||||||
m_cfg.setString(PLUGIN_DOMAIN, "cur_magic", m_plugin.PluginMagicWord);
|
m_cfg.setString(PLUGIN_DOMAIN, "cur_magic", sfmt("%08x", m_plugin.GetPluginMagic(i)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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, "4E47434D", 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, "4E574949", 8) == 0)//NWII
|
||||||
@ -2468,8 +2464,7 @@ bool CMenu::_loadPluginList()
|
|||||||
gprintf("Adding plugins list\n");
|
gprintf("Adding plugins list\n");
|
||||||
for(u8 i = 0; m_plugin.PluginExist(i); ++i)
|
for(u8 i = 0; m_plugin.PluginExist(i); ++i)
|
||||||
{
|
{
|
||||||
u32 Magic = m_plugin.getPluginMagic(i);
|
if(!m_plugin.GetEnabledStatus(i))
|
||||||
if(!m_plugin.GetEnableStatus(m_cfg, Magic))// m_plugin.PluginMagicWord is set here.
|
|
||||||
continue;
|
continue;
|
||||||
int romsPartition = m_plugin.GetRomPartition(i);
|
int romsPartition = m_plugin.GetRomPartition(i);
|
||||||
if(romsPartition < 0)
|
if(romsPartition < 0)
|
||||||
@ -2477,6 +2472,7 @@ bool CMenu::_loadPluginList()
|
|||||||
currentPartition = romsPartition;
|
currentPartition = romsPartition;
|
||||||
if(!DeviceHandle.IsInserted(currentPartition))
|
if(!DeviceHandle.IsInserted(currentPartition))
|
||||||
continue;
|
continue;
|
||||||
|
strncpy(m_plugin.PluginMagicWord, fmt("%08x", m_plugin.GetPluginMagic(i)), 8);
|
||||||
const char *romDir = m_plugin.GetRomDir(i);
|
const char *romDir = m_plugin.GetRomDir(i);
|
||||||
if(strcasecmp(romDir, "scummvm.ini") != 0)
|
if(strcasecmp(romDir, "scummvm.ini") != 0)
|
||||||
{
|
{
|
||||||
@ -2519,7 +2515,7 @@ bool CMenu::_loadPluginList()
|
|||||||
bool preCachedList = fsop_FileExist(cachedListFile.c_str());
|
bool preCachedList = fsop_FileExist(cachedListFile.c_str());
|
||||||
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 = m_plugin.GetPluginMagic(i);
|
||||||
m_cacheList.usePluginDBTitles = m_cfg.getBool(PLUGIN_DOMAIN, "database_titles", true);
|
m_cacheList.usePluginDBTitles = m_cfg.getBool(PLUGIN_DOMAIN, "database_titles", true);
|
||||||
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++)
|
||||||
@ -2543,7 +2539,7 @@ bool CMenu::_loadPluginList()
|
|||||||
if(m_platform.loaded())/* convert plugin magic to platform name */
|
if(m_platform.loaded())/* convert plugin magic to platform name */
|
||||||
platformName = m_platform.getString("PLUGINS", m_plugin.PluginMagicWord);
|
platformName = m_platform.getString("PLUGINS", m_plugin.PluginMagicWord);
|
||||||
m_cacheList.Color = m_plugin.GetCaseColor(i);
|
m_cacheList.Color = m_plugin.GetCaseColor(i);
|
||||||
m_cacheList.Magic = Magic;
|
m_cacheList.Magic = m_plugin.GetPluginMagic(i);
|
||||||
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);
|
||||||
|
@ -102,7 +102,6 @@ private:
|
|||||||
u8 *m_buffer;
|
u8 *m_buffer;
|
||||||
u8 m_aa;
|
u8 m_aa;
|
||||||
u8 m_numCFVersions;
|
u8 m_numCFVersions;
|
||||||
u8 m_numPlugins;
|
|
||||||
u8 m_max_source_btn;
|
u8 m_max_source_btn;
|
||||||
u8 curCustBg;
|
u8 curCustBg;
|
||||||
char cf_domain[16];
|
char cf_domain[16];
|
||||||
|
@ -75,8 +75,9 @@ void CMenu::_setCatGenDomain()
|
|||||||
{
|
{
|
||||||
for(u8 i = 0; m_plugin.PluginExist(i); ++i)// only set "PLUGINS" for real plugins
|
for(u8 i = 0; m_plugin.PluginExist(i); ++i)// only set "PLUGINS" for real plugins
|
||||||
{
|
{
|
||||||
if(m_plugin.GetEnableStatus(m_cfg, m_plugin.getPluginMagic(i)))
|
if(m_plugin.GetEnabledStatus(i))
|
||||||
{
|
{
|
||||||
|
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, "4E47434D", 8) == 0)//NGCM
|
||||||
continue;
|
continue;
|
||||||
else if(strncasecmp(m_plugin.PluginMagicWord, "4E574949", 8) == 0)//NWII
|
else if(strncasecmp(m_plugin.PluginMagicWord, "4E574949", 8) == 0)//NWII
|
||||||
@ -88,7 +89,10 @@ void CMenu::_setCatGenDomain()
|
|||||||
else if(strncasecmp(m_plugin.PluginMagicWord, "48425257", 8) == 0)//HBRW
|
else if(strncasecmp(m_plugin.PluginMagicWord, "48425257", 8) == 0)//HBRW
|
||||||
continue;
|
continue;
|
||||||
else
|
else
|
||||||
|
{
|
||||||
genDomain = "PLUGINS";
|
genDomain = "PLUGINS";
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -537,8 +537,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)
|
||||||
{
|
{
|
||||||
m_plugin.GetEnabledPlugins(m_cfg, &enabledPluginsCount);
|
if(enabledPluginsCount == 1 && m_plugin.GetEnabledStatus(m_plugin.GetPluginPosition(strtoul("48425257", NULL, 16))))
|
||||||
if(enabledPluginsCount == 1 && m_cfg.getBool(PLUGIN_ENABLED, "48425257"))
|
|
||||||
smallBox = m_cfg.getBool(HOMEBREW_DOMAIN, "smallbox", false);
|
smallBox = m_cfg.getBool(HOMEBREW_DOMAIN, "smallbox", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,6 +52,8 @@ void CMenu::_getCustomBgTex()
|
|||||||
string fn = "";
|
string fn = "";
|
||||||
if(m_platform.loaded())
|
if(m_platform.loaded())
|
||||||
{
|
{
|
||||||
|
m_plugin.PluginMagicWord[0] = '\0';
|
||||||
|
u8 i = 0;
|
||||||
switch(m_current_view)
|
switch(m_current_view)
|
||||||
{
|
{
|
||||||
case COVERFLOW_CHANNEL:
|
case COVERFLOW_CHANNEL:
|
||||||
@ -67,18 +69,14 @@ void CMenu::_getCustomBgTex()
|
|||||||
strncpy(m_plugin.PluginMagicWord, "4E47434D", 9);
|
strncpy(m_plugin.PluginMagicWord, "4E47434D", 9);
|
||||||
break;
|
break;
|
||||||
case COVERFLOW_PLUGIN:
|
case COVERFLOW_PLUGIN:
|
||||||
for(u8 i = 0; m_plugin.PluginExist(i); ++i)
|
while(m_plugin.PluginExist(i) && !m_plugin.GetEnabledStatus(i)) { ++i; }
|
||||||
{
|
if(m_plugin.PluginExist(i))
|
||||||
if(m_plugin.GetEnableStatus(m_cfg, m_plugin.getPluginMagic(i)))
|
strncpy(m_plugin.PluginMagicWord, fmt("%08x", m_plugin.GetPluginMagic(i)), 8);
|
||||||
{
|
|
||||||
strncpy(m_plugin.PluginMagicWord, fmt("%08x", m_plugin.getPluginMagic(i)), 8);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
default:// wii
|
default:// wii
|
||||||
strncpy(m_plugin.PluginMagicWord, "4E574949", 9);
|
strncpy(m_plugin.PluginMagicWord, "4E574949", 9);
|
||||||
}
|
}
|
||||||
|
if(strlen(m_plugin.PluginMagicWord) == 8)
|
||||||
fn = m_platform.getString("PLUGINS", m_plugin.PluginMagicWord, "");
|
fn = m_platform.getString("PLUGINS", m_plugin.PluginMagicWord, "");
|
||||||
}
|
}
|
||||||
if(fn.length() > 0)
|
if(fn.length() > 0)
|
||||||
@ -171,7 +169,6 @@ void CMenu::_showCF(bool refreshList)
|
|||||||
break;
|
break;
|
||||||
case COVERFLOW_PLUGIN:
|
case COVERFLOW_PLUGIN:
|
||||||
Pth = "";
|
Pth = "";
|
||||||
m_plugin.GetEnabledPlugins(m_cfg, &enabledPluginsCount);
|
|
||||||
if(enabledPluginsCount == 0)
|
if(enabledPluginsCount == 0)
|
||||||
Msg = _t("main6", L"No plugins selected.");
|
Msg = _t("main6", L"No plugins selected.");
|
||||||
else if(enabledPluginsCount > 1)
|
else if(enabledPluginsCount > 1)
|
||||||
@ -179,18 +176,14 @@ void CMenu::_showCF(bool refreshList)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
Msg = _t("main2", L"No games found in ");
|
Msg = _t("main2", L"No games found in ");
|
||||||
for(u8 i = 0; m_plugin.PluginExist(i); ++i)
|
u8 i = 0;
|
||||||
{
|
while(m_plugin.PluginExist(i) && !m_plugin.GetEnabledStatus(i)){ ++i; }
|
||||||
if(m_plugin.GetEnableStatus(m_cfg, m_plugin.getPluginMagic(i)))
|
|
||||||
{
|
|
||||||
int romsPartition = m_plugin.GetRomPartition(i);
|
int romsPartition = m_plugin.GetRomPartition(i);
|
||||||
if(romsPartition < 0)
|
if(romsPartition < 0)
|
||||||
romsPartition = m_cfg.getInt(PLUGIN_DOMAIN, "partition", 0);
|
romsPartition = m_cfg.getInt(PLUGIN_DOMAIN, "partition", 0);
|
||||||
Pth = wstringEx(fmt("%s:/%s", DeviceName[romsPartition], m_plugin.GetRomDir(i)));
|
Pth = wstringEx(fmt("%s:/%s", DeviceName[romsPartition], m_plugin.GetRomDir(i)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -301,49 +294,35 @@ void CMenu::_showCF(bool refreshList)
|
|||||||
strcpy(cf_domain, "_SMALLFLOW");
|
strcpy(cf_domain, "_SMALLFLOW");
|
||||||
if(m_current_view == COVERFLOW_PLUGIN && !m_sourceflow)
|
if(m_current_view == COVERFLOW_PLUGIN && !m_sourceflow)
|
||||||
{
|
{
|
||||||
m_plugin.GetEnabledPlugins(m_cfg, &enabledPluginsCount);
|
|
||||||
/* check if homebrew plugin */
|
/* check if homebrew plugin */
|
||||||
if(enabledPluginsCount == 1 && m_cfg.getBool(PLUGIN_ENABLED, "48425257") && m_cfg.getBool(HOMEBREW_DOMAIN, "smallbox"))
|
if(enabledPluginsCount == 1 && m_plugin.GetEnabledStatus(m_plugin.GetPluginPosition(strtoul("48425257", NULL, 16))) && m_cfg.getBool(HOMEBREW_DOMAIN, "smallbox"))
|
||||||
strcpy(cf_domain, "_SMALLFLOW");
|
strcpy(cf_domain, "_SMALLFLOW");
|
||||||
else if(enabledPluginsCount > 0)
|
else if(enabledPluginsCount > 0 && m_platform.loaded())
|
||||||
{
|
|
||||||
/* check if platform.ini is loaded */
|
|
||||||
if(m_platform.loaded())
|
|
||||||
{
|
{
|
||||||
/* get first plugin flow domain */
|
/* get first plugin flow domain */
|
||||||
string flow_domain;
|
u8 i = 0;
|
||||||
for(u8 i = 0; m_plugin.PluginExist(i); ++i)
|
while(m_plugin.PluginExist(i) && !m_plugin.GetEnabledStatus(i)){ ++i; }
|
||||||
{
|
string flow_domain = m_platform.getString("FLOWS", m_platform.getString("PLUGINS", sfmt("%08x", m_plugin.GetPluginMagic(i)), ""), "_COVERFLOW");
|
||||||
if(m_plugin.GetEnableStatus(m_cfg, m_plugin.getPluginMagic(i)))
|
|
||||||
{
|
|
||||||
strncpy(m_plugin.PluginMagicWord, fmt("%08x", m_plugin.getPluginMagic(i)), 8);
|
|
||||||
flow_domain = m_platform.getString("FLOWS", m_platform.getString("PLUGINS", m_plugin.PluginMagicWord));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* check if all plugin flow domains match */
|
/* check if all plugin flow domains match */
|
||||||
if(!flow_domain.empty())
|
|
||||||
{
|
|
||||||
bool match = true;
|
bool match = true;
|
||||||
for(u8 i = 0; m_plugin.PluginExist(i); ++i)
|
i++;
|
||||||
|
while(m_plugin.PluginExist(i))
|
||||||
{
|
{
|
||||||
if(m_plugin.GetEnableStatus(m_cfg, m_plugin.getPluginMagic(i)))
|
if(m_plugin.GetEnabledStatus(i) &&
|
||||||
{
|
flow_domain != m_platform.getString("FLOWS", m_platform.getString("PLUGINS", sfmt("%08x", m_plugin.GetPluginMagic(i)), ""), "_COVERFLOW"))
|
||||||
strncpy(m_plugin.PluginMagicWord, fmt("%08x", m_plugin.getPluginMagic(i)), 8);
|
|
||||||
if(flow_domain != m_platform.getString("FLOWS", m_platform.getString("PLUGINS", m_plugin.PluginMagicWord)))
|
|
||||||
{
|
{
|
||||||
match = false;
|
match = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
/* if all match we use that flow domain */
|
/* if all match we use that flow domain */
|
||||||
if(match)
|
if(match)
|
||||||
snprintf(cf_domain, sizeof(cf_domain), "%s", flow_domain.c_str());
|
snprintf(cf_domain, sizeof(cf_domain), "%s", flow_domain.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* get the number of layouts (modes) for the CoverFlow domain */
|
/* get the number of layouts (modes) for the CoverFlow domain */
|
||||||
m_numCFVersions = min(max(1, m_coverflow.getInt(cf_domain, "number_of_modes", 1)), 15);// max layouts is 15
|
m_numCFVersions = min(max(1, m_coverflow.getInt(cf_domain, "number_of_modes", 1)), 15);// max layouts is 15
|
||||||
@ -1273,12 +1252,16 @@ int CMenu::_getCFVersion()
|
|||||||
int first = 0;
|
int first = 0;
|
||||||
for(u8 i = 0; m_plugin.PluginExist(i); ++i)
|
for(u8 i = 0; m_plugin.PluginExist(i); ++i)
|
||||||
{
|
{
|
||||||
if(m_plugin.GetEnableStatus(m_cfg, m_plugin.getPluginMagic(i)) && m_cfg.has("PLUGIN_CFVERSION", m_plugin.PluginMagicWord))
|
if(m_plugin.GetEnabledStatus(i))
|
||||||
{
|
{
|
||||||
if(first > 0 && m_cfg.getInt("PLUGIN_CFVERSION", m_plugin.PluginMagicWord, 1) != first)
|
string magic = sfmt("%08x", m_plugin.GetPluginMagic(i));
|
||||||
|
if(m_cfg.has("PLUGIN_CFVERSION", magic))
|
||||||
|
{
|
||||||
|
if(first > 0 && m_cfg.getInt("PLUGIN_CFVERSION", magic, 1) != first)
|
||||||
return m_cfg.getInt(_domainFromView(), "last_cf_mode", 1);
|
return m_cfg.getInt(_domainFromView(), "last_cf_mode", 1);
|
||||||
else if(first == 0)
|
else if(first == 0)
|
||||||
first = m_cfg.getInt("PLUGIN_CFVERSION", m_plugin.PluginMagicWord, 1);
|
first = m_cfg.getInt("PLUGIN_CFVERSION", magic, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(first == 0)
|
if(first == 0)
|
||||||
@ -1297,21 +1280,25 @@ void CMenu::_setCFVersion(int version)
|
|||||||
int first = 0;
|
int first = 0;
|
||||||
for(u8 i = 0; m_plugin.PluginExist(i); ++i)
|
for(u8 i = 0; m_plugin.PluginExist(i); ++i)
|
||||||
{
|
{
|
||||||
if(m_plugin.GetEnableStatus(m_cfg, m_plugin.getPluginMagic(i)) && m_cfg.has("PLUGIN_CFVERSION", m_plugin.PluginMagicWord))
|
if(m_plugin.GetEnabledStatus(i))
|
||||||
{
|
{
|
||||||
if(first > 0 && m_cfg.getInt("PLUGIN_CFVERSION", m_plugin.PluginMagicWord, 1) != first)
|
string magic = sfmt("%08x", m_plugin.GetPluginMagic(i));
|
||||||
|
if(m_cfg.has("PLUGIN_CFVERSION", magic))
|
||||||
|
{
|
||||||
|
if(first > 0 && m_cfg.getInt("PLUGIN_CFVERSION", magic, 1) != first)
|
||||||
{
|
{
|
||||||
m_cfg.setInt(_domainFromView(), "last_cf_mode", version);
|
m_cfg.setInt(_domainFromView(), "last_cf_mode", version);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if(first == 0)
|
else if(first == 0)
|
||||||
first = m_cfg.getInt("PLUGIN_CFVERSION", m_plugin.PluginMagicWord, 1);
|
first = m_cfg.getInt("PLUGIN_CFVERSION", magic, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(u8 i = 0; m_plugin.PluginExist(i); ++i)
|
for(u8 i = 0; m_plugin.PluginExist(i); ++i)
|
||||||
{
|
{
|
||||||
if(m_plugin.GetEnableStatus(m_cfg, m_plugin.getPluginMagic(i)))
|
if(m_plugin.GetEnabledStatus(i))
|
||||||
m_cfg.setInt("PLUGIN_CFVERSION", m_plugin.PluginMagicWord, version);
|
m_cfg.setInt("PLUGIN_CFVERSION", sfmt("%08x", m_plugin.GetPluginMagic(i)), version);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -72,7 +72,7 @@ void CMenu::_updatePluginCheckboxes(void)
|
|||||||
m_btnMgr.hide(m_pluginBtn[i]);
|
m_btnMgr.hide(m_pluginBtn[i]);
|
||||||
m_btnMgr.hide(m_pluginLblCat[i]);
|
m_btnMgr.hide(m_pluginLblCat[i]);
|
||||||
}
|
}
|
||||||
const vector<bool> &EnabledPlugins = m_plugin.GetEnabledPlugins(m_cfg, &enabledPluginsCount);
|
const vector<bool> &EnabledPlugins = m_plugin.GetEnabledPlugins(&enabledPluginsCount);
|
||||||
/* ALL Button */
|
/* ALL Button */
|
||||||
if(EnabledPlugins.size() == 0)
|
if(EnabledPlugins.size() == 0)
|
||||||
m_pluginBtn[0] = m_pluginBtnCats[0];
|
m_pluginBtn[0] = m_pluginBtnCats[0];
|
||||||
@ -99,10 +99,8 @@ void CMenu::_PluginSettings()
|
|||||||
while(m_plugin.PluginExist(i)) i++;
|
while(m_plugin.PluginExist(i)) i++;
|
||||||
Plugin_Pages = static_cast<int>(ceil(static_cast<float>(i)/static_cast<float>(10)));
|
Plugin_Pages = static_cast<int>(ceil(static_cast<float>(i)/static_cast<float>(10)));
|
||||||
m_max_plugins = i;
|
m_max_plugins = i;
|
||||||
//gprintf("Plugins found: %i, Pages: %i\n", m_max_plugins, Plugin_Pages);
|
if(Plugin_Pages == 0)// Only use Plugin Settings if Plugins are found
|
||||||
if(Plugin_Pages == 0)
|
|
||||||
return;
|
return;
|
||||||
/* Only use Plugin Settings if Plugins are found */
|
|
||||||
SetupInput();
|
SetupInput();
|
||||||
Plugin_curPage = 1;
|
Plugin_curPage = 1;
|
||||||
_showPluginSettings();
|
_showPluginSettings();
|
||||||
@ -112,7 +110,6 @@ void CMenu::_PluginSettings()
|
|||||||
_mainLoopCommon();
|
_mainLoopCommon();
|
||||||
if(BTN_HOME_PRESSED || BTN_B_PRESSED || (BTN_A_PRESSED && m_btnMgr.selected(m_pluginBtnBack)))
|
if(BTN_HOME_PRESSED || BTN_B_PRESSED || (BTN_A_PRESSED && m_btnMgr.selected(m_pluginBtnBack)))
|
||||||
{
|
{
|
||||||
//m_cfg.save();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if(BTN_UP_PRESSED)
|
else if(BTN_UP_PRESSED)
|
||||||
@ -149,18 +146,17 @@ void CMenu::_PluginSettings()
|
|||||||
{
|
{
|
||||||
/* clear all plugins */
|
/* clear all plugins */
|
||||||
for(u8 j = 0; m_plugin.PluginExist(j); j++)
|
for(u8 j = 0; m_plugin.PluginExist(j); j++)
|
||||||
m_plugin.SetEnablePlugin(m_cfg, j, 1);
|
m_plugin.SetEnablePlugin(j, 1);
|
||||||
m_current_view = COVERFLOW_PLUGIN;
|
m_current_view = COVERFLOW_PLUGIN;
|
||||||
}
|
}
|
||||||
if(i == 0)// all button to clear all or set all
|
if(i == 0)// all button to clear all or set all
|
||||||
{
|
{
|
||||||
m_plugin.GetEnabledPlugins(m_cfg, &enabledPluginsCount);// get enabled plugins count
|
|
||||||
// if all clear then set(2) them else clear(1) them all
|
// if all clear then set(2) them else clear(1) them all
|
||||||
for(u8 j = 0; m_plugin.PluginExist(j); j++)
|
for(u8 j = 0; m_plugin.PluginExist(j); j++)
|
||||||
m_plugin.SetEnablePlugin(m_cfg, j, (enabledPluginsCount == 0) ? 2 : 1);
|
m_plugin.SetEnablePlugin(j, (enabledPluginsCount == 0) ? 2 : 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
m_plugin.SetEnablePlugin(m_cfg, i+IteratorHelp-1);// switch plugin from off to on or vice versa
|
m_plugin.SetEnablePlugin(i+IteratorHelp-1);// switch plugin from off to on or vice versa
|
||||||
_updatePluginCheckboxes();
|
_updatePluginCheckboxes();
|
||||||
m_btnMgr.setSelected(m_pluginBtn[i]);
|
m_btnMgr.setSelected(m_pluginBtn[i]);
|
||||||
break;
|
break;
|
||||||
@ -169,7 +165,20 @@ void CMenu::_PluginSettings()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
_hidePluginSettings();
|
_hidePluginSettings();
|
||||||
m_plugin.GetEnabledPlugins(m_cfg, &enabledPluginsCount);
|
string enabledMagics;
|
||||||
|
for(u8 i = 0; m_plugin.PluginExist(i); i++)
|
||||||
|
{
|
||||||
|
if(m_plugin.GetEnabledStatus(i))
|
||||||
|
{
|
||||||
|
string magic = sfmt("%08x", m_plugin.GetPluginMagic(i));
|
||||||
|
if(i == 0)
|
||||||
|
enabledMagics = magic;
|
||||||
|
else
|
||||||
|
enabledMagics.append(',' + magic);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m_cfg.setString(PLUGIN_DOMAIN, "enabled_plugins", enabledMagics);
|
||||||
|
|
||||||
if(m_refreshGameList && enabledPluginsCount > 0)
|
if(m_refreshGameList && enabledPluginsCount > 0)
|
||||||
{
|
{
|
||||||
m_cfg.setUInt("GENERAL", "sources", m_current_view);
|
m_cfg.setUInt("GENERAL", "sources", m_current_view);
|
||||||
|
@ -14,7 +14,7 @@ TexData m_sourceBg;
|
|||||||
|
|
||||||
string source;
|
string source;
|
||||||
bool exitSource = false;
|
bool exitSource = false;
|
||||||
static u8 i, j, k;
|
static u8 i, j;
|
||||||
int curPage;
|
int curPage;
|
||||||
int numPages;
|
int numPages;
|
||||||
vector<string> magicNums;
|
vector<string> magicNums;
|
||||||
@ -73,16 +73,26 @@ void CMenu::_sourceFlow()
|
|||||||
magicNums = m_source.getStrings(btn_selected, "magic", ',');
|
magicNums = m_source.getStrings(btn_selected, "magic", ',');
|
||||||
if(magicNums.size() > 0)
|
if(magicNums.size() > 0)
|
||||||
{
|
{
|
||||||
m_current_view = COVERFLOW_PLUGIN;
|
for(u8 pos = 0; m_plugin.PluginExist(pos); pos++)
|
||||||
for(k = 0; k < m_numPlugins; ++k)
|
m_plugin.SetEnablePlugin(pos, 1); // force disable all
|
||||||
m_plugin.SetEnablePlugin(m_cfg, k, 1); // force disable all
|
enabledPluginsCount = 0;
|
||||||
for(vector<string>::iterator itr = magicNums.begin(); itr != magicNums.end(); itr++)
|
string enabledMagics;
|
||||||
|
for(i = 0; i < magicNums.size(); i++)
|
||||||
{
|
{
|
||||||
s16 exist = m_plugin.GetPluginPosition(strtoul(itr->c_str(), NULL, 16));
|
u8 pos = m_plugin.GetPluginPosition(strtoul(magicNums[i].c_str(), NULL, 16));
|
||||||
if(exist >= 0)
|
if(pos < 255)
|
||||||
m_plugin.SetEnablePlugin(m_cfg, exist, 2);
|
{
|
||||||
|
enabledPluginsCount++;
|
||||||
|
m_plugin.SetEnablePlugin(pos, 2);
|
||||||
|
if(i == 0)
|
||||||
|
enabledMagics = magicNums[0];
|
||||||
|
else
|
||||||
|
enabledMagics.append(',' + magicNums[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
m_cfg.setString(PLUGIN_DOMAIN, "enabled_plugins", enabledMagics);
|
||||||
|
m_current_view = COVERFLOW_PLUGIN;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if(source =="new_source")
|
else if(source =="new_source")
|
||||||
{
|
{
|
||||||
@ -425,24 +435,31 @@ bool CMenu::_Source()
|
|||||||
}
|
}
|
||||||
else if(source == "plugin")
|
else if(source == "plugin")
|
||||||
{
|
{
|
||||||
m_current_view = COVERFLOW_PLUGIN;
|
|
||||||
_setSrcOptions();
|
|
||||||
for(k = 0; k < m_numPlugins; ++k)
|
|
||||||
m_plugin.SetEnablePlugin(m_cfg, k, 1); /* force disable */
|
|
||||||
magicNums.clear();
|
magicNums.clear();
|
||||||
magicNums = m_source.getStrings(btn_selected, "magic", ',');
|
magicNums = m_source.getStrings(btn_selected, "magic", ',');
|
||||||
if(magicNums.size() > 0)
|
if(magicNums.size() > 0)
|
||||||
{
|
{
|
||||||
for(vector<string>::iterator itr = magicNums.begin(); itr != magicNums.end(); itr++)
|
for(u8 pos = 0; m_plugin.PluginExist(pos); pos++)
|
||||||
|
m_plugin.SetEnablePlugin(pos, 1); // force disable all
|
||||||
|
enabledPluginsCount = 0;
|
||||||
|
string enabledMagics;
|
||||||
|
for(i = 0; i < magicNums.size(); i++)
|
||||||
{
|
{
|
||||||
s16 exist = m_plugin.GetPluginPosition(strtoul(itr->c_str(), NULL, 16));// make sure magic# is valid
|
u8 pos = m_plugin.GetPluginPosition(strtoul(magicNums[i].c_str(), NULL, 16));
|
||||||
if(exist >= 0)
|
if(pos < 255)
|
||||||
m_plugin.SetEnablePlugin(m_cfg, exist, 2);
|
{
|
||||||
|
enabledPluginsCount++;
|
||||||
|
m_plugin.SetEnablePlugin(pos, 2);
|
||||||
|
if(i == 0)
|
||||||
|
enabledMagics = magicNums[0];
|
||||||
|
else
|
||||||
|
enabledMagics.append(',' + magicNums[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_plugin.GetEnabledPlugins(m_cfg, &enabledPluginsCount);
|
m_cfg.setString(PLUGIN_DOMAIN, "enabled_plugins", enabledMagics);
|
||||||
if(enabledPluginsCount == 0) // no magic #'s or invalid ones so default to first plugin in list
|
m_current_view = COVERFLOW_PLUGIN;
|
||||||
m_plugin.SetEnablePlugin(m_cfg, 0, 2);
|
_setSrcOptions();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if(source =="new_source")
|
else if(source =="new_source")
|
||||||
{
|
{
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include "gecko/gecko.hpp"
|
#include "gecko/gecko.hpp"
|
||||||
#include "devicemounter/PartitionHandle.h"
|
#include "devicemounter/PartitionHandle.h"
|
||||||
#include "devicemounter/DeviceHandler.hpp"
|
#include "devicemounter/DeviceHandler.hpp"
|
||||||
|
#include "list/ListGenerator.hpp"
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "crc32.h"
|
#include "crc32.h"
|
||||||
|
|
||||||
@ -36,15 +37,6 @@
|
|||||||
#define MODETEST_VAL 0xffffff00
|
#define MODETEST_VAL 0xffffff00
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Plugin m_plugin;
|
|
||||||
void Plugin::init(const string& m_pluginsDir)
|
|
||||||
{
|
|
||||||
PluginMagicWord[8] = '\0';
|
|
||||||
pluginsDir = m_pluginsDir;
|
|
||||||
Plugins.clear();
|
|
||||||
adding = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool PluginOptions_cmp(PluginOptions lhs, PluginOptions rhs)
|
static bool PluginOptions_cmp(PluginOptions lhs, PluginOptions rhs)
|
||||||
{
|
{
|
||||||
const wchar_t *first = lhs.DisplayName.c_str();
|
const wchar_t *first = lhs.DisplayName.c_str();
|
||||||
@ -52,23 +44,48 @@ static bool PluginOptions_cmp(PluginOptions lhs, PluginOptions rhs)
|
|||||||
return wchar_cmp(first, second, wcslen(first), wcslen(second));
|
return wchar_cmp(first, second, wcslen(first), wcslen(second));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Plugin::EndAdd()
|
static vector<string> INI_List;
|
||||||
|
static void GrabINIFiles(char *FullPath)
|
||||||
{
|
{
|
||||||
|
//Just push back
|
||||||
|
INI_List.push_back(FullPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
Plugin m_plugin;
|
||||||
|
void Plugin::init(const string& m_pluginsDir)
|
||||||
|
{
|
||||||
|
PluginMagicWord[8] = '\0';
|
||||||
|
pluginsDir = m_pluginsDir;
|
||||||
|
Plugins.clear();
|
||||||
|
|
||||||
|
INI_List.clear();
|
||||||
|
GetFiles(m_pluginsDir.c_str(), stringToVector(".ini", '|'), GrabINIFiles, false, 3);
|
||||||
|
|
||||||
|
if(INI_List.size() > 0)
|
||||||
|
{
|
||||||
|
Config m_plugin_cfg;
|
||||||
|
for(vector<string>::const_iterator iniFile = INI_List.begin(); iniFile != INI_List.end(); ++iniFile)
|
||||||
|
{
|
||||||
|
if(iniFile->find("scummvm.ini") != string::npos)
|
||||||
|
continue;
|
||||||
|
m_plugin_cfg.load(iniFile->c_str());
|
||||||
|
if(m_plugin_cfg.loaded())
|
||||||
|
{
|
||||||
|
m_plugin.AddPlugin(m_plugin_cfg);
|
||||||
|
}
|
||||||
|
m_plugin_cfg.unload();
|
||||||
|
}
|
||||||
|
}
|
||||||
std::sort(Plugins.begin(), Plugins.end(), PluginOptions_cmp);
|
std::sort(Plugins.begin(), Plugins.end(), PluginOptions_cmp);
|
||||||
adding = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Plugin::Cleanup()
|
void Plugin::Cleanup()
|
||||||
{
|
{
|
||||||
Plugins.clear();
|
Plugins.clear();
|
||||||
adding = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Plugin::AddPlugin(Config &plugin)
|
void Plugin::AddPlugin(Config &plugin)
|
||||||
{
|
{
|
||||||
if(!adding)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
PluginOptions NewPlugin;
|
PluginOptions NewPlugin;
|
||||||
NewPlugin.DolName = plugin.getString(PLUGIN, "dolFile");
|
NewPlugin.DolName = plugin.getString(PLUGIN, "dolFile");
|
||||||
NewPlugin.coverFolder = plugin.getString(PLUGIN, "coverFolder");
|
NewPlugin.coverFolder = plugin.getString(PLUGIN, "coverFolder");
|
||||||
@ -79,6 +96,7 @@ bool Plugin::AddPlugin(Config &plugin)
|
|||||||
NewPlugin.fileTypes = plugin.getString(PLUGIN, "fileTypes");
|
NewPlugin.fileTypes = plugin.getString(PLUGIN, "fileTypes");
|
||||||
NewPlugin.Args = plugin.getStrings(PLUGIN, "arguments", '|');
|
NewPlugin.Args = plugin.getStrings(PLUGIN, "arguments", '|');
|
||||||
NewPlugin.boxMode = plugin.getInt(PLUGIN, "boxmode", -1);
|
NewPlugin.boxMode = plugin.getInt(PLUGIN, "boxmode", -1);
|
||||||
|
NewPlugin.state = false;
|
||||||
string PluginName = plugin.getString(PLUGIN, "displayname");
|
string PluginName = plugin.getString(PLUGIN, "displayname");
|
||||||
if(PluginName.size() < 2)
|
if(PluginName.size() < 2)
|
||||||
{
|
{
|
||||||
@ -93,27 +111,26 @@ bool Plugin::AddPlugin(Config &plugin)
|
|||||||
if(NewPlugin.BannerSoundSize > 0)
|
if(NewPlugin.BannerSoundSize > 0)
|
||||||
NewPlugin.BannerSound = bannerfilepath;
|
NewPlugin.BannerSound = bannerfilepath;
|
||||||
Plugins.push_back(NewPlugin);
|
Plugins.push_back(NewPlugin);
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
s16 Plugin::GetPluginPosition(u32 magic)
|
u8 Plugin::GetPluginPosition(u32 magic)
|
||||||
{
|
{
|
||||||
for(u8 pos = 0; pos < Plugins.size(); pos++)
|
for(u8 pos = 0; pos < Plugins.size(); pos++)
|
||||||
{
|
{
|
||||||
if(magic == Plugins[pos].magic)
|
if(magic == Plugins[pos].magic)
|
||||||
return (s16)pos;
|
return (s16)pos;
|
||||||
}
|
}
|
||||||
return -1;
|
return 255;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 Plugin::getPluginMagic(u8 pos)
|
u32 Plugin::GetPluginMagic(u8 pos)
|
||||||
{
|
{
|
||||||
return Plugins[pos].magic;
|
return Plugins[pos].magic;
|
||||||
}
|
}
|
||||||
|
|
||||||
u8* Plugin::GetBannerSound(u32 magic)
|
u8* Plugin::GetBannerSound(u32 magic)
|
||||||
{
|
{
|
||||||
if((Plugin_Pos = GetPluginPosition(magic)) >= 0)
|
if((Plugin_Pos = GetPluginPosition(magic)) < 255)
|
||||||
{
|
{
|
||||||
u32 size = 0;
|
u32 size = 0;
|
||||||
return fsop_ReadFile(Plugins[Plugin_Pos].BannerSound.c_str(), &size);
|
return fsop_ReadFile(Plugins[Plugin_Pos].BannerSound.c_str(), &size);
|
||||||
@ -131,21 +148,23 @@ u32 Plugin::GetBannerSoundSize()
|
|||||||
|
|
||||||
const char *Plugin::GetDolName(u32 magic)
|
const char *Plugin::GetDolName(u32 magic)
|
||||||
{
|
{
|
||||||
if((Plugin_Pos = GetPluginPosition(magic)) >= 0)
|
if((Plugin_Pos = GetPluginPosition(magic)) < 255)
|
||||||
return Plugins[Plugin_Pos].DolName.c_str();
|
return Plugins[Plugin_Pos].DolName.c_str();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *Plugin::GetCoverFolderName(u32 magic)
|
const char *Plugin::GetCoverFolderName(u32 magic)
|
||||||
{
|
{
|
||||||
if((Plugin_Pos = GetPluginPosition(magic)) >= 0)
|
if((Plugin_Pos = GetPluginPosition(magic)) < 255)
|
||||||
return Plugins[Plugin_Pos].coverFolder.c_str();
|
return Plugins[Plugin_Pos].coverFolder.c_str();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Plugin::GetRomPartition(u8 pos)
|
int Plugin::GetRomPartition(u8 pos)
|
||||||
{
|
{
|
||||||
|
if(pos < Plugins.size())
|
||||||
return Plugins[pos].romPartition;
|
return Plugins[pos].romPartition;
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *Plugin::GetRomDir(u8 pos)
|
const char *Plugin::GetRomDir(u8 pos)
|
||||||
@ -153,7 +172,7 @@ const char *Plugin::GetRomDir(u8 pos)
|
|||||||
return Plugins[pos].romDir.c_str();
|
return Plugins[pos].romDir.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
const string& Plugin::GetFileTypes(s16 pos)
|
const string& Plugin::GetFileTypes(u8 pos)
|
||||||
{
|
{
|
||||||
return Plugins[pos].fileTypes;
|
return Plugins[pos].fileTypes;
|
||||||
}
|
}
|
||||||
@ -180,44 +199,36 @@ bool Plugin::PluginExist(u8 pos)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Plugin::SetEnablePlugin(Config &cfg, u8 pos, u8 ForceMode)
|
void Plugin::SetEnablePlugin(u8 pos, u8 ForceMode)
|
||||||
{
|
{
|
||||||
if(pos < Plugins.size())
|
if(pos < Plugins.size())
|
||||||
{
|
{
|
||||||
strncpy(PluginMagicWord, fmt("%08x", Plugins[pos].magic), 8);
|
|
||||||
if(ForceMode == 1)
|
if(ForceMode == 1)
|
||||||
cfg.setBool(PLUGIN_ENABLED, PluginMagicWord, false);
|
Plugins[pos].state = false;
|
||||||
else if(ForceMode == 2)
|
else if(ForceMode == 2)
|
||||||
cfg.setBool(PLUGIN_ENABLED, PluginMagicWord, true);
|
Plugins[pos].state = true;
|
||||||
else
|
else
|
||||||
cfg.setBool(PLUGIN_ENABLED, PluginMagicWord, cfg.getBool(PLUGIN_ENABLED, PluginMagicWord) ? false : true);
|
Plugins[pos].state = Plugins[pos].state ? false : true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Plugin::GetEnableStatus(Config &cfg, u32 magic)
|
bool Plugin::GetEnabledStatus(u8 pos)
|
||||||
{
|
{
|
||||||
if((Plugin_Pos = GetPluginPosition(magic)) >= 0)
|
if(pos < Plugins.size())
|
||||||
{
|
return Plugins[pos].state;
|
||||||
strncpy(PluginMagicWord, fmt("%08x", magic), 8);
|
|
||||||
return cfg.getBool(PLUGIN_ENABLED, PluginMagicWord, true);
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const vector<bool> &Plugin::GetEnabledPlugins(Config &cfg, u8 *num)
|
const vector<bool> &Plugin::GetEnabledPlugins(u8 *num)
|
||||||
{
|
{
|
||||||
enabledPlugins.clear();
|
enabledPlugins.clear();
|
||||||
u8 enabledPluginsNumber = 0;
|
u8 enabledPluginsNumber = 0;
|
||||||
for(u8 i = 0; i < Plugins.size(); i++)
|
for(u8 i = 0; i < Plugins.size(); i++)
|
||||||
{
|
{
|
||||||
strncpy(PluginMagicWord, fmt("%08x", Plugins[i].magic), 8);
|
enabledPlugins.push_back(GetEnabledStatus(i));
|
||||||
if(cfg.getBool(PLUGIN_ENABLED, PluginMagicWord, true))
|
if(GetEnabledStatus(i))
|
||||||
{
|
|
||||||
enabledPluginsNumber++;
|
enabledPluginsNumber++;
|
||||||
enabledPlugins.push_back(true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
enabledPlugins.push_back(false);
|
|
||||||
}
|
}
|
||||||
if(enabledPluginsNumber == Plugins.size())
|
if(enabledPluginsNumber == Plugins.size())
|
||||||
enabledPlugins.clear();
|
enabledPlugins.clear();
|
||||||
@ -231,7 +242,7 @@ vector<string> Plugin::CreateArgs(const char *device, const char *path,
|
|||||||
{
|
{
|
||||||
vector<string> args;
|
vector<string> args;
|
||||||
Plugin_Pos = GetPluginPosition(magic);
|
Plugin_Pos = GetPluginPosition(magic);
|
||||||
if(Plugin_Pos < 0)
|
if(Plugin_Pos == 255)
|
||||||
return args;
|
return args;
|
||||||
for(vector<string>::const_iterator arg = Plugins[Plugin_Pos].Args.begin();
|
for(vector<string>::const_iterator arg = Plugins[Plugin_Pos].Args.begin();
|
||||||
arg != Plugins[Plugin_Pos].Args.end(); ++arg)
|
arg != Plugins[Plugin_Pos].Args.end(); ++arg)
|
||||||
@ -466,7 +477,7 @@ string Plugin::GetRomId(char *romPath, u32 Magic, Config &m_crc, const char *dat
|
|||||||
}
|
}
|
||||||
else if(!strcasecmp(platform, "ATARIST"))
|
else if(!strcasecmp(platform, "ATARIST"))
|
||||||
{
|
{
|
||||||
s16 pos = m_plugin.GetPluginPosition(Magic);
|
u8 pos = m_plugin.GetPluginPosition(Magic);
|
||||||
string FileTypes = m_plugin.GetFileTypes(pos);
|
string FileTypes = m_plugin.GetFileTypes(pos);
|
||||||
string path;
|
string path;
|
||||||
|
|
||||||
@ -507,7 +518,7 @@ string Plugin::GetRomId(char *romPath, u32 Magic, Config &m_crc, const char *dat
|
|||||||
}
|
}
|
||||||
else if(!strcasecmp(platform, "DOS"))
|
else if(!strcasecmp(platform, "DOS"))
|
||||||
{
|
{
|
||||||
s16 pos = m_plugin.GetPluginPosition(Magic);
|
u8 pos = m_plugin.GetPluginPosition(Magic);
|
||||||
string FileTypes = m_plugin.GetFileTypes(pos);
|
string FileTypes = m_plugin.GetFileTypes(pos);
|
||||||
|
|
||||||
if(strcasestr(FileTypes.c_str(), ".conf"))
|
if(strcasestr(FileTypes.c_str(), ".conf"))
|
||||||
|
@ -54,6 +54,7 @@ struct PluginOptions
|
|||||||
vector<string> Args;
|
vector<string> Args;
|
||||||
wstringEx DisplayName;
|
wstringEx DisplayName;
|
||||||
s8 boxMode;
|
s8 boxMode;
|
||||||
|
bool state;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Plugin
|
class Plugin
|
||||||
@ -68,19 +69,18 @@ public:
|
|||||||
string GetRomName(const char *FullPath);
|
string GetRomName(const char *FullPath);
|
||||||
string GetRomId(char *romPath, u32 Magic, Config &m_crc, const char *datadir, const char *platform, const char *name);
|
string GetRomId(char *romPath, u32 Magic, Config &m_crc, const char *datadir, const char *platform, const char *name);
|
||||||
int GetRomPartition(u8 pos);
|
int GetRomPartition(u8 pos);
|
||||||
const string& GetFileTypes(s16 pos);
|
const string& GetFileTypes(u8 pos);
|
||||||
wstringEx GetPluginName(u8 pos);
|
wstringEx GetPluginName(u8 pos);
|
||||||
u32 getPluginMagic(u8 pos);
|
u32 GetPluginMagic(u8 pos);
|
||||||
s16 GetPluginPosition(u32 magic);
|
u8 GetPluginPosition(u32 magic);
|
||||||
s8 GetBoxMode(u8 pos);
|
s8 GetBoxMode(u8 pos);
|
||||||
|
|
||||||
void init(const string& m_pluginsDir);
|
void init(const string& m_pluginsDir);
|
||||||
bool AddPlugin(Config &plugin);
|
void AddPlugin(Config &plugin);
|
||||||
void Cleanup();
|
void Cleanup();
|
||||||
void EndAdd();
|
bool GetEnabledStatus(u8 pos);
|
||||||
bool GetEnableStatus(Config &cfg, u32 magic);
|
void SetEnablePlugin(u8 pos, u8 ForceMode = 0);
|
||||||
void SetEnablePlugin(Config &cfg, u8 pos, u8 ForceMode = 0);
|
const vector<bool> &GetEnabledPlugins(u8 *num);
|
||||||
const vector<bool> &GetEnabledPlugins(Config &cfg, u8 *num);
|
|
||||||
bool PluginExist(u8 pos);
|
bool PluginExist(u8 pos);
|
||||||
|
|
||||||
vector<string> CreateArgs(const char *device, const char *path,
|
vector<string> CreateArgs(const char *device, const char *path,
|
||||||
@ -93,7 +93,6 @@ private:
|
|||||||
vector<bool> enabledPlugins;
|
vector<bool> enabledPlugins;
|
||||||
s16 Plugin_Pos;
|
s16 Plugin_Pos;
|
||||||
string pluginsDir;
|
string pluginsDir;
|
||||||
bool adding;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern Plugin m_plugin;
|
extern Plugin m_plugin;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user