- fixed plugin system to handle more than 128 plugins.

This commit is contained in:
Fledge68 2020-07-11 15:31:14 -05:00
parent a9828f0dc5
commit ef22015f8d
4 changed files with 11 additions and 11 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 MiB

After

Width:  |  Height:  |  Size: 4.1 MiB

View File

@ -75,10 +75,10 @@ void CMenu::_sourceFlow()
{
m_current_view = COVERFLOW_PLUGIN;
for(k = 0; k < m_numPlugins; ++k)
m_plugin.SetEnablePlugin(m_cfg, k, 1); /* force disable */
m_plugin.SetEnablePlugin(m_cfg, k, 1); // force disable all
for(vector<string>::iterator itr = magicNums.begin(); itr != magicNums.end(); itr++)
{
s8 exist = m_plugin.GetPluginPosition(strtoul(itr->c_str(), NULL, 16));
s16 exist = m_plugin.GetPluginPosition(strtoul(itr->c_str(), NULL, 16));
if(exist >= 0)
m_plugin.SetEnablePlugin(m_cfg, exist, 2);
}
@ -435,7 +435,7 @@ bool CMenu::_Source()
{
for(vector<string>::iterator itr = magicNums.begin(); itr != magicNums.end(); itr++)
{
s8 exist = m_plugin.GetPluginPosition(strtoul(itr->c_str(), NULL, 16));// make sure magic# is valid
s16 exist = m_plugin.GetPluginPosition(strtoul(itr->c_str(), NULL, 16));// make sure magic# is valid
if(exist >= 0)
m_plugin.SetEnablePlugin(m_cfg, exist, 2);
}

View File

@ -96,12 +96,12 @@ bool Plugin::AddPlugin(Config &plugin)
return false;
}
s8 Plugin::GetPluginPosition(u32 magic)
s16 Plugin::GetPluginPosition(u32 magic)
{
for(u8 pos = 0; pos < Plugins.size(); pos++)
{
if(magic == Plugins[pos].magic)
return pos;
return (s16)pos;
}
return -1;
}
@ -153,7 +153,7 @@ const char *Plugin::GetRomDir(u8 pos)
return Plugins[pos].romDir.c_str();
}
const string& Plugin::GetFileTypes(u8 pos)
const string& Plugin::GetFileTypes(s16 pos)
{
return Plugins[pos].fileTypes;
}
@ -466,7 +466,7 @@ string Plugin::GetRomId(char *romPath, u32 Magic, Config &m_crc, const char *dat
}
else if(!strcasecmp(platform, "ATARIST"))
{
s8 pos = m_plugin.GetPluginPosition(Magic);
s16 pos = m_plugin.GetPluginPosition(Magic);
string FileTypes = m_plugin.GetFileTypes(pos);
string path;
@ -507,7 +507,7 @@ string Plugin::GetRomId(char *romPath, u32 Magic, Config &m_crc, const char *dat
}
else if(!strcasecmp(platform, "DOS"))
{
s8 pos = m_plugin.GetPluginPosition(Magic);
s16 pos = m_plugin.GetPluginPosition(Magic);
string FileTypes = m_plugin.GetFileTypes(pos);
if(strcasestr(FileTypes.c_str(), ".conf"))

View File

@ -68,10 +68,10 @@ public:
string GetRomName(const char *FullPath);
string GetRomId(char *romPath, u32 Magic, Config &m_crc, const char *datadir, const char *platform, const char *name);
int GetRomPartition(u8 pos);
const string& GetFileTypes(u8 pos);
const string& GetFileTypes(s16 pos);
wstringEx GetPluginName(u8 pos);
u32 getPluginMagic(u8 pos);
s8 GetPluginPosition(u32 magic);
s16 GetPluginPosition(u32 magic);
s8 GetBoxMode(u8 pos);
void init(const string& m_pluginsDir);
@ -91,7 +91,7 @@ public:
private:
vector<PluginOptions> Plugins;
vector<bool> enabledPlugins;
s8 Plugin_Pos;
s16 Plugin_Pos;
string pluginsDir;
bool adding;
};