- fixed box mode for plugins. now each plugin can have box mode on (1), off (0), or default (-1). default is the GENERAL box mode setting in wfl ini. if the boxmode= line is missing from plugin it will use the default.

This commit is contained in:
Fledge68 2019-07-10 09:24:44 -05:00
parent 71784050cc
commit 3af4cef548
4 changed files with 53 additions and 16 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 MiB

After

Width:  |  Height:  |  Size: 3.4 MiB

View File

@ -2163,23 +2163,61 @@ void CMenu::_initCF(void)
else if(m_current_view == COVERFLOW_PLUGIN)
{
m_plugin.GetEnabledPlugins(m_cfg, &enabledPluginsCount);
if(enabledPluginsCount == 1 && m_cfg.getBool(PLUGIN_ENABLED, "48425257"))// homebrew plugin
if(enabledPluginsCount == 1)// only one plugin enabled
{
CoverFlow.setBoxMode(m_cfg.getBool(HOMEBREW_DOMAIN, "box_mode", true));
CoverFlow.setSmallBoxMode(m_cfg.getBool(HOMEBREW_DOMAIN, "smallbox", false));
if(m_cfg.getBool(PLUGIN_ENABLED, "48425257"))// homebrew plugin
{
CoverFlow.setBoxMode(m_cfg.getBool(HOMEBREW_DOMAIN, "box_mode", true));
CoverFlow.setSmallBoxMode(m_cfg.getBool(HOMEBREW_DOMAIN, "smallbox", false));
}
else
{
s8 bm = -1;
for(u8 i = 0; m_plugin.PluginExist(i); ++i)// get plugins box mode value
{
if(m_plugin.GetEnableStatus(m_cfg, m_plugin.getPluginMagic(i)))
{
bm = m_plugin.GetBoxMode(i);
break;
}
}
if(bm < 0)// if negative then use default setting
CoverFlow.setBoxMode(m_cfg.getBool("GENERAL", "box_mode", true));
else
CoverFlow.setBoxMode(bm == 0 ? false : true);
CoverFlow.setSmallBoxMode(false);
}
}
else
else // more than 1 plugin enabled
{
int boxmode_cnt = 0;
for(u8 i = 0; m_plugin.PluginExist(i); ++i)
s8 bm1 = -1;
s8 bm2 = -1;
u8 i;
for(i = 0; m_plugin.PluginExist(i); ++i)// get first enabled plugins box mode
{
if(m_plugin.GetEnableStatus(m_cfg, m_plugin.getPluginMagic(i)))
{
if(m_plugin.GetBoxMode(i))
boxmode_cnt++;
bm1 = m_plugin.GetBoxMode(i);
if(bm1 < 0)
bm1 = m_cfg.getBool("GENERAL", "box_mode", true);
break;
}
}
CoverFlow.setBoxMode(boxmode_cnt > 0);
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);
if(bm2 < 0)
bm2 = m_cfg.getBool("GENERAL", "box_mode", true);
if(bm2 != bm1)
break;
}
}
if(m_plugin.PluginExist(i))// broke out of loop because not all the same so use default
CoverFlow.setBoxMode(m_cfg.getBool("GENERAL", "box_mode", true));
else // made it thru loop so they all match
CoverFlow.setBoxMode(bm1 == 0 ? false : true);
CoverFlow.setSmallBoxMode(false);
}
}

View File

@ -78,7 +78,7 @@ bool Plugin::AddPlugin(Config &plugin)
NewPlugin.romDir = plugin.getString(PLUGIN, "romDir");
NewPlugin.fileTypes = plugin.getString(PLUGIN, "fileTypes");
NewPlugin.Args = plugin.getStrings(PLUGIN, "arguments", '|');
NewPlugin.boxMode = plugin.getBool(PLUGIN, "boxmode", 1);
NewPlugin.boxMode = plugin.getInt(PLUGIN, "boxmode", -1);
string PluginName = plugin.getString(PLUGIN, "displayname");
if(PluginName.size() < 2)
{
@ -163,7 +163,7 @@ u32 Plugin::GetCaseColor(u8 pos)
return Plugins[pos].caseColor;
}
bool Plugin::GetBoxMode(u8 pos)
s8 Plugin::GetBoxMode(u8 pos)
{
return Plugins[pos].boxMode;
}
@ -308,12 +308,11 @@ string Plugin::GetRomName(const dir_discHdr *gameHeader)
else
{
// ScummVM
char title[1024];
char title[64];
wcstombs(title, gameHeader->title, 63);
title[63] = '\0';
string FullName = title;
if(FullName.empty())
return NULL;
string ShortName = FullName.substr(0, FullName.find(" (")).substr(0, FullName.find(" ["));
return ShortName;

View File

@ -53,7 +53,7 @@ struct PluginOptions
u32 BannerSoundSize;
vector<string> Args;
wstringEx DisplayName;
bool boxMode;
s8 boxMode;
};
class Plugin
@ -72,7 +72,7 @@ public:
wstringEx GetPluginName(u8 pos);
u32 getPluginMagic(u8 pos);
s8 GetPluginPosition(u32 magic);
bool GetBoxMode(u8 pos);
s8 GetBoxMode(u8 pos);
void init(const string& m_pluginsDir);
bool AddPlugin(Config &plugin);