-added new options for plugin inis, "displayname", if you

set it in for example the fceugx.ini to "nes" it will display
"nes" instead of "fceugx" in plugins menu
This commit is contained in:
fix94.1 2012-05-11 18:46:43 +00:00
parent f83670be3d
commit b8fd3e623d
2 changed files with 17 additions and 10 deletions

View File

@ -13,7 +13,8 @@
#include "gui/text.hpp" #include "gui/text.hpp"
#include "gecko/gecko.h" #include "gecko/gecko.h"
static const std::string emptyString; static const string emptyString;
static const string emptyString2("/");
static char* emptyChar = (char*)" "; static char* emptyChar = (char*)" ";
void Plugin::init(string m_pluginsDir) void Plugin::init(string m_pluginsDir)
@ -49,6 +50,14 @@ bool Plugin::AddPlugin(Config &plugin)
sscanf(plugin.getString("PLUGIN","coverColor","").c_str(), "%08x", &NewPlugin.caseColor); sscanf(plugin.getString("PLUGIN","coverColor","").c_str(), "%08x", &NewPlugin.caseColor);
NewPlugin.ReturnLoader = plugin.getBool("PLUGIN","ReturnLoader"); NewPlugin.ReturnLoader = plugin.getBool("PLUGIN","ReturnLoader");
string PluginName = plugin.getString("PLUGIN","displayname","");
if(PluginName == emptyString || PluginName == emptyString2)
{
PluginName = NewPlugin.DolName;
PluginName.erase(PluginName.end() - 4, PluginName.end());
}
NewPlugin.DisplayName.fromUTF8(PluginName.c_str());
string bannerfilepath = sfmt("%s/%s", pluginsDir.c_str(), plugin.getString("PLUGIN","bannerSound","").c_str()); string bannerfilepath = sfmt("%s/%s", pluginsDir.c_str(), plugin.getString("PLUGIN","bannerSound","").c_str());
ifstream infile; ifstream infile;
infile.open(bannerfilepath.c_str(), ios::binary); infile.open(bannerfilepath.c_str(), ios::binary);
@ -130,11 +139,7 @@ bool Plugin::PluginExist(u8 pos)
wstringEx Plugin::GetPluginName(u8 pos) wstringEx Plugin::GetPluginName(u8 pos)
{ {
wstringEx tmpString; return Plugins[pos].DisplayName;
string PluginName(Plugins[pos].DolName);
PluginName.erase(PluginName.end() - 4, PluginName.end());
tmpString.fromUTF8(PluginName.c_str());
return tmpString;
} }
void Plugin::SetEnablePlugin(Config &cfg, u8 pos, u8 ForceMode) void Plugin::SetEnablePlugin(Config &cfg, u8 pos, u8 ForceMode)
@ -185,13 +190,14 @@ vector<dir_discHdr> Plugin::ParseScummvmINI(Config &ini, string Device)
if(!ini.loaded()) if(!ini.loaded())
return gameHeader; return gameHeader;
string game(ini.firstDomain()); string game(ini.firstDomain());
string GameName;
dir_discHdr tmp; dir_discHdr tmp;
while(1) while(1)
{ {
if(game == emptyString) if(game == emptyString || game == emptyString2)
break; break;
if(strncasecmp(game.c_str(), "/", 1) == 0 || GameName = ini.getString(game,"description");
strncasecmp(ini.getString(game,"description").c_str(), "/", 1) == 0 || if(GameName == emptyString || GameName == emptyString2 ||
strncasecmp(ini.getWString(game, "path").toUTF8().c_str(), Device.c_str(), 3) != 0) strncasecmp(ini.getWString(game, "path").toUTF8().c_str(), Device.c_str(), 3) != 0)
{ {
game = ini.nextDomain(); game = ini.nextDomain();
@ -200,7 +206,7 @@ vector<dir_discHdr> Plugin::ParseScummvmINI(Config &ini, string Device)
memset(&tmp, 0, sizeof(dir_discHdr)); memset(&tmp, 0, sizeof(dir_discHdr));
tmp.hdr.casecolor = Plugins.back().caseColor; tmp.hdr.casecolor = Plugins.back().caseColor;
wstringEx tmpString; wstringEx tmpString;
tmpString.fromUTF8(ini.getString(game,"description").c_str()); tmpString.fromUTF8(GameName.c_str());
wcsncpy(tmp.title, tmpString.c_str(), 64); wcsncpy(tmp.title, tmpString.c_str(), 64);
strncpy(tmp.path, game.c_str(), sizeof(tmp.path)); strncpy(tmp.path, game.c_str(), sizeof(tmp.path));
gprintf("Found: %ls\n", tmp.title); gprintf("Found: %ls\n", tmp.title);

View File

@ -24,6 +24,7 @@ struct PluginOptions
u32 magicWord; u32 magicWord;
string DolName; string DolName;
string coverFolder; string coverFolder;
wstringEx DisplayName;
u32 caseColor; u32 caseColor;
bool ReturnLoader; bool ReturnLoader;
}; };