mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-12-18 07:51:53 +01:00
-added scummvm ini parser, that means if scummvm plugin
detected, wiiflow will scan the scummvm.ini for games
This commit is contained in:
parent
fc1c81d601
commit
b2cef2a34e
@ -1965,18 +1965,31 @@ bool CMenu::_loadEmuList()
|
|||||||
while ((pent = readdir(pdir)) != NULL)
|
while ((pent = readdir(pdir)) != NULL)
|
||||||
{
|
{
|
||||||
// Skip it
|
// Skip it
|
||||||
if (strcmp(pent->d_name, ".") == 0 || strcmp(pent->d_name, "..") == 0 || strcasecmp(pent->d_name, "plugins.ini") == 0)
|
if (strcmp(pent->d_name, ".") == 0 || strcmp(pent->d_name, "..") == 0
|
||||||
|
|| strcasecmp(pent->d_name, "plugins.ini") == 0 || strcasecmp(pent->d_name, "scummvm.ini") == 0)
|
||||||
continue;
|
continue;
|
||||||
if(strcasestr(pent->d_name, ".ini") != NULL)
|
if(strcasestr(pent->d_name, ".ini") != NULL)
|
||||||
{
|
{
|
||||||
m_gameList.m_plugin.load(fmt("%s/%s", m_pluginsDir.c_str(), pent->d_name));
|
m_gameList.m_plugin.load(fmt("%s/%s", m_pluginsDir.c_str(), pent->d_name));
|
||||||
if(m_gameList.m_plugin.loaded())
|
if(m_gameList.m_plugin.loaded())
|
||||||
{
|
{
|
||||||
|
m_plugin.AddPlugin(m_gameList.m_plugin);
|
||||||
m_gameList.clear();
|
m_gameList.clear();
|
||||||
|
if(strcasestr(m_gameList.m_plugin.getString("PLUGIN","romDir","").c_str(), "scummvm.ini") == NULL)
|
||||||
|
{
|
||||||
m_gameList.Load(sfmt("%s:/%s", DeviceName[currentPartition], m_gameList.m_plugin.getString("PLUGIN","romDir","").c_str()), m_gameList.m_plugin.getString("PLUGIN","fileTypes","").c_str(), m_cfg.getString("EMULATOR", "lastlanguage", "EN").c_str());
|
m_gameList.Load(sfmt("%s:/%s", DeviceName[currentPartition], m_gameList.m_plugin.getString("PLUGIN","romDir","").c_str()), m_gameList.m_plugin.getString("PLUGIN","fileTypes","").c_str(), m_cfg.getString("EMULATOR", "lastlanguage", "EN").c_str());
|
||||||
for(safe_vector<dir_discHdr>::iterator tmp_itr = m_gameList.begin(); tmp_itr != m_gameList.end(); tmp_itr++)
|
for(safe_vector<dir_discHdr>::iterator tmp_itr = m_gameList.begin(); tmp_itr != m_gameList.end(); tmp_itr++)
|
||||||
emuList.push_back(*tmp_itr);
|
emuList.push_back(*tmp_itr);
|
||||||
m_plugin.AddPlugin(m_gameList.m_plugin);
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Config scummvm;
|
||||||
|
safe_vector<dir_discHdr> scummvmList;
|
||||||
|
scummvm.load(fmt("%s/%s", m_pluginsDir.c_str(), "scummvm.ini"));
|
||||||
|
scummvmList = m_plugin.ParseScummvmINI(scummvm, DeviceName[currentPartition]);
|
||||||
|
for(safe_vector<dir_discHdr>::iterator tmp_itr = scummvmList.begin(); tmp_itr != scummvmList.end(); tmp_itr++)
|
||||||
|
emuList.push_back(*tmp_itr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
m_gameList.m_plugin.unload();
|
m_gameList.m_plugin.unload();
|
||||||
}
|
}
|
||||||
|
@ -630,19 +630,28 @@ void CMenu::_launch(dir_discHdr *hdr)
|
|||||||
m_gcfg2.load(sfmt("%s/gameconfig2.ini", m_settingsDir.c_str()).c_str());
|
m_gcfg2.load(sfmt("%s/gameconfig2.ini", m_settingsDir.c_str()).c_str());
|
||||||
if(hdr->hdr.gc_magic == 0x4c4f4c4f)
|
if(hdr->hdr.gc_magic == 0x4c4f4c4f)
|
||||||
{
|
{
|
||||||
m_cfg.setString("EMULATOR", "current_item", &hdr->path[std::string(hdr->path).find_last_of("/")]);
|
|
||||||
string title(&hdr->path[std::string(hdr->path).find_last_of("/")+1]);
|
string title(&hdr->path[std::string(hdr->path).find_last_of("/")+1]);
|
||||||
string wiiflow_dol(m_dol);
|
string wiiflow_dol(m_dol);
|
||||||
if(strstr(wiiflow_dol.c_str(), "sd:/") == NULL)
|
if(strstr(wiiflow_dol.c_str(), "sd:/") == NULL)
|
||||||
wiiflow_dol.erase(3,1);
|
wiiflow_dol.erase(3,1);
|
||||||
string path((char*)hdr->path, size_t(strlen((char*)hdr->path) - title.size()));
|
string path((char*)hdr->path, size_t(strlen((char*)hdr->path) - title.size()));
|
||||||
safe_vector<std::string> arguments;
|
safe_vector<std::string> arguments;
|
||||||
if(strstr(path.c_str(), "sd:/") == NULL)
|
|
||||||
path.erase(3,1);
|
|
||||||
gprintf("Game title: %s\n", title.c_str());
|
gprintf("Game title: %s\n", title.c_str());
|
||||||
|
if(strstr(path.c_str(), "sd:/") == NULL && strstr(path.c_str(), ":/") != NULL)
|
||||||
|
{
|
||||||
|
path.erase(3,1);
|
||||||
arguments.push_back(path);
|
arguments.push_back(path);
|
||||||
arguments.push_back(title);
|
arguments.push_back(title);
|
||||||
arguments.push_back(wiiflow_dol);
|
arguments.push_back(wiiflow_dol);
|
||||||
|
m_cfg.setString("EMULATOR", "current_item", &hdr->path[std::string(hdr->path).find_last_of("/")]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
arguments.push_back(title);
|
||||||
|
char gametitle[64];
|
||||||
|
wcstombs(gametitle, hdr->title, sizeof(gametitle));
|
||||||
|
m_cfg.setString("EMULATOR", "current_item", gametitle);
|
||||||
|
}
|
||||||
_launchHomebrew(fmt("%s/%s", m_pluginsDir.c_str(), m_plugin.GetDolName(hdr->hdr.magic)), arguments);
|
_launchHomebrew(fmt("%s/%s", m_pluginsDir.c_str(), m_plugin.GetDolName(hdr->hdr.magic)), arguments);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,9 @@
|
|||||||
#include "plugin.hpp"
|
#include "plugin.hpp"
|
||||||
#include "memory/mem2.hpp"
|
#include "memory/mem2.hpp"
|
||||||
#include "gui/text.hpp"
|
#include "gui/text.hpp"
|
||||||
|
#include "gecko/gecko.h"
|
||||||
|
|
||||||
|
static const std::string emptyString;
|
||||||
|
|
||||||
void Plugin::init(string m_pluginsDir)
|
void Plugin::init(string m_pluginsDir)
|
||||||
{
|
{
|
||||||
@ -40,10 +43,13 @@ bool Plugin::AddPlugin(Config &plugin)
|
|||||||
{
|
{
|
||||||
if(!adding)
|
if(!adding)
|
||||||
return false;
|
return false;
|
||||||
u32 magic;
|
|
||||||
|
DolName.push_back(plugin.getString("PLUGIN","dolFile",""));
|
||||||
|
u32 magic, caseColor;
|
||||||
sscanf(plugin.getString("PLUGIN","magic","").c_str(), "%08x", &magic);
|
sscanf(plugin.getString("PLUGIN","magic","").c_str(), "%08x", &magic);
|
||||||
magicWords.push_back(magic);
|
magicWords.push_back(magic);
|
||||||
DolName.push_back(plugin.getString("PLUGIN","dolFile",""));
|
sscanf(plugin.getString("PLUGIN","coverColor","").c_str(), "%08x", &caseColor);
|
||||||
|
caseColors.push_back(caseColor);
|
||||||
|
|
||||||
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;
|
||||||
@ -95,3 +101,32 @@ char* Plugin::GetDolName(u32 magic)
|
|||||||
return (char*)DolName[banner_pos].c_str();
|
return (char*)DolName[banner_pos].c_str();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
safe_vector<dir_discHdr> Plugin::ParseScummvmINI(Config &ini, const char* Device)
|
||||||
|
{
|
||||||
|
gprintf("Parsing scummvm.ini\n");
|
||||||
|
safe_vector<dir_discHdr> gameHeader;
|
||||||
|
string game = ini.firstDomain().c_str();
|
||||||
|
dir_discHdr tmp;
|
||||||
|
while(1)
|
||||||
|
{
|
||||||
|
if(game != emptyString && (lowerCase(game).rfind("scummvm") != string::npos
|
||||||
|
|| lowerCase(ini.getString(game, "path")).rfind(Device) == string::npos))
|
||||||
|
{
|
||||||
|
game = ini.nextDomain();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if(game == emptyString)
|
||||||
|
break;
|
||||||
|
memset(&tmp, 0, sizeof(dir_discHdr));
|
||||||
|
tmp.hdr.casecolor = caseColors.back();
|
||||||
|
mbstowcs(tmp.title, ini.getString(game,"description").c_str(), sizeof(tmp.title));
|
||||||
|
strncpy(tmp.path, game.c_str(), sizeof(tmp.path));
|
||||||
|
gprintf("Found: %s\n", ini.getString(game,"description").c_str());
|
||||||
|
tmp.hdr.magic = magicWords.back();
|
||||||
|
tmp.hdr.gc_magic = 0x4c4f4c4f;
|
||||||
|
gameHeader.push_back(tmp);
|
||||||
|
game = ini.nextDomain();
|
||||||
|
}
|
||||||
|
return gameHeader;
|
||||||
|
}
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
#include "config/config.hpp"
|
#include "config/config.hpp"
|
||||||
#include "safe_vector.hpp"
|
#include "safe_vector.hpp"
|
||||||
|
#include "loader/disc.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
@ -26,11 +27,13 @@ public:
|
|||||||
void init(string);
|
void init(string);
|
||||||
void Cleanup();
|
void Cleanup();
|
||||||
void EndAdd();
|
void EndAdd();
|
||||||
|
safe_vector<dir_discHdr> ParseScummvmINI(Config &ini, const char* Device);
|
||||||
private:
|
private:
|
||||||
safe_vector<u8*> BannerSound;
|
safe_vector<u8*> BannerSound;
|
||||||
safe_vector<u32> BannerSoundSize;
|
safe_vector<u32> BannerSoundSize;
|
||||||
safe_vector<u32> magicWords;
|
safe_vector<u32> magicWords;
|
||||||
safe_vector<string> DolName;
|
safe_vector<string> DolName;
|
||||||
|
safe_vector<u32> caseColors;
|
||||||
u8 banner_pos;
|
u8 banner_pos;
|
||||||
string pluginsDir;
|
string pluginsDir;
|
||||||
bool adding;
|
bool adding;
|
||||||
|
Loading…
Reference in New Issue
Block a user