mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-11-27 21:54:15 +01:00
-added support for gc games extracted with crediars new
tool GCReEx for DML v1.0 -changed small thing about plugin loading in code
This commit is contained in:
parent
9d9636f080
commit
e4df9ddf82
@ -79,7 +79,7 @@ void CachedList<T>::Load(string path, string containing, string m_lastLanguage)
|
||||
gprintf("Calling list to update filelist\n");
|
||||
|
||||
safe_vector<string> pathlist;
|
||||
list.GetPaths(pathlist, containing, path, m_wbfsFS);
|
||||
list.GetPaths(pathlist, containing, path, m_wbfsFS, update_dml);
|
||||
list.GetHeaders(pathlist, *this, m_settingsDir, m_curLanguage, m_DMLgameDir, m_plugin);
|
||||
|
||||
path.append("/touch.db");
|
||||
|
@ -64,6 +64,8 @@ class CachedList : public safe_vector<T>
|
||||
void Remove(u32 index) {if(m_loaded) CCache<T>(*this, m_database, index, REMOVE);} /* Remove One */
|
||||
|
||||
void SetLanguage(string curLanguage) { m_curLanguage = curLanguage; }
|
||||
void LoadPluginConfig(const char* name) { m_plugin.load(name); }
|
||||
void UnloadPluginConfig() {m_plugin.unload(); };
|
||||
private:
|
||||
string make_db_name(string path);
|
||||
|
||||
@ -80,7 +82,6 @@ class CachedList : public safe_vector<T>
|
||||
string m_lastLanguage;
|
||||
string m_discinf;
|
||||
string m_DMLgameDir;
|
||||
public:
|
||||
Config m_plugin;
|
||||
};
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include "gc.h"
|
||||
|
||||
template <typename T>
|
||||
void CList<T>::GetPaths(safe_vector<string> &pathlist, string containing, string directory, bool wbfs_fs)
|
||||
void CList<T>::GetPaths(safe_vector<string> &pathlist, string containing, string directory, bool wbfs_fs, bool dml)
|
||||
{
|
||||
if (!wbfs_fs)
|
||||
{
|
||||
@ -18,6 +18,7 @@ void CList<T>::GetPaths(safe_vector<string> &pathlist, string containing, string
|
||||
safe_vector<string> compares = stringToVector(containing, '|');
|
||||
safe_vector<string> temp_pathlist;
|
||||
|
||||
bool foundDMLgame;
|
||||
struct dirent *ent;
|
||||
|
||||
/* Read primary entries */
|
||||
@ -49,20 +50,34 @@ void CList<T>::GetPaths(safe_vector<string> &pathlist, string containing, string
|
||||
{
|
||||
dir_itr = opendir((*templist).c_str());
|
||||
if (!dir_itr) continue;
|
||||
if(dml)
|
||||
foundDMLgame = false;
|
||||
|
||||
/* Read secondary entries */
|
||||
while((ent = readdir(dir_itr)) != NULL)
|
||||
{
|
||||
if(ent->d_type != DT_REG) continue;
|
||||
if (strlen(ent->d_name) < 8) continue;
|
||||
|
||||
for(safe_vector<string>::iterator compare = compares.begin(); compare != compares.end(); compare++)
|
||||
if (strcasestr(ent->d_name, (*compare).c_str()) != NULL)
|
||||
if(ent->d_type == DT_REG && strlen(ent->d_name) > 7)
|
||||
{
|
||||
for(safe_vector<string>::iterator compare = compares.begin(); compare != compares.end(); compare++)
|
||||
{
|
||||
//gprintf("Pushing %s to the list.\n", sfmt("%s/%s", (*templist).c_str(), ent->d_name).c_str());
|
||||
pathlist.push_back(sfmt("%s/%s", (*templist).c_str(), ent->d_name));
|
||||
if (strcasestr(ent->d_name, (*compare).c_str()) != NULL)
|
||||
{
|
||||
//gprintf("Pushing %s to the list.\n", sfmt("%s/%s", (*templist).c_str(), ent->d_name).c_str());
|
||||
pathlist.push_back(sfmt("%s/%s", (*templist).c_str(), ent->d_name));
|
||||
if(dml)
|
||||
foundDMLgame = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(dml && foundDMLgame == false)
|
||||
{
|
||||
if(strcasestr(ent->d_name, "sys") != NULL)
|
||||
{
|
||||
temp_pathlist.push_back(sfmt("%s/%s", (*templist).c_str(), ent->d_name));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir(dir_itr);
|
||||
}
|
||||
@ -129,11 +144,12 @@ void CList<dir_discHdr>::GetHeaders(safe_vector<string> pathlist, safe_vector<di
|
||||
tmp.hdr.casecolor = 1;
|
||||
|
||||
bool wbfs = (*itr).rfind(".wbfs") != string::npos || (*itr).rfind(".WBFS") != string::npos;
|
||||
if (wbfs || (*itr).rfind(".iso") != string::npos || (*itr).rfind(".ISO") != string::npos)
|
||||
if (wbfs || (*itr).rfind(".iso") != string::npos || (*itr).rfind(".ISO") != string::npos
|
||||
|| (*itr).rfind(".bin") != string::npos || (*itr).rfind(".BIN") != string::npos)
|
||||
{
|
||||
char* filename = &(*itr)[(*itr).find_last_of('/')+1];
|
||||
const char* dml_partition = DeviceName[DeviceHandler::Instance()->PathToDriveType((*itr).c_str())];
|
||||
if(strcasecmp(filename, "game.iso") == 0 && strstr((*itr).c_str(), sfmt((strncmp(dml_partition, "sd", 2) != 0) ? DMLgameUSBDir.c_str() : DML_DIR, dml_partition).c_str()) != NULL)
|
||||
if((strcasecmp(filename, "game.iso") == 0 || strcasecmp(filename, "boot.bin") == 0) && strstr((*itr).c_str(), sfmt((strncmp(dml_partition, "sd", 2) != 0) ? DMLgameUSBDir.c_str() : DML_DIR, dml_partition).c_str()) != NULL)
|
||||
{
|
||||
FILE *fp = fopen((*itr).c_str(), "rb");
|
||||
if( fp )
|
||||
@ -161,6 +177,8 @@ void CList<dir_discHdr>::GetHeaders(safe_vector<string> pathlist, safe_vector<di
|
||||
|
||||
tmp.hdr.gc_magic = 0xc2339f3d;
|
||||
(*itr)[(*itr).find_last_of('/')] = 0;
|
||||
if(strcasecmp(filename, "boot.bin") == 0)
|
||||
(*itr)[(*itr).find_last_of('/')] = 0;
|
||||
(*itr).assign(&(*itr)[(*itr).find_last_of('/') + 1]);
|
||||
strcpy( tmp.path, (*itr).c_str() );
|
||||
|
||||
@ -188,6 +206,8 @@ void CList<dir_discHdr>::GetHeaders(safe_vector<string> pathlist, safe_vector<di
|
||||
|
||||
tmp.hdr.casecolor = 0;
|
||||
(*itr)[(*itr).find_last_of('/')] = 0;
|
||||
if(strcasecmp(filename, "boot.bin") == 0)
|
||||
(*itr)[(*itr).find_last_of('/')] = 0;
|
||||
(*itr).assign(&(*itr)[(*itr).find_last_of('/') + 1]);
|
||||
strcpy( tmp.path, (*itr).c_str() );
|
||||
|
||||
|
@ -24,7 +24,7 @@ class CList
|
||||
public:
|
||||
CList(){};
|
||||
~CList(){};
|
||||
void GetPaths(safe_vector<string> &pathlist, string containing, string directory, bool wbfs_fs = false);
|
||||
void GetPaths(safe_vector<string> &pathlist, string containing, string directory, bool wbfs_fs = false, bool dml = false);
|
||||
void GetHeaders(safe_vector<string> pathlist, safe_vector<T> &headerlist, string, string, string, Config &plugin);
|
||||
void GetChannels(safe_vector<T> &headerlist, string, u32, string);
|
||||
private:
|
||||
|
@ -1938,9 +1938,9 @@ bool CMenu::_loadDmlList()
|
||||
gprintf("%s\n", DeviceName[currentPartition]);
|
||||
DeviceHandler::Instance()->Open_WBFS(currentPartition);
|
||||
if(currentPartition != SD)
|
||||
m_gameList.Load(sfmt(m_DMLgameDir.c_str(), DeviceName[currentPartition]), ".iso", m_cfg.getString("DML", "lastlanguage", "EN").c_str());
|
||||
m_gameList.Load(sfmt(m_DMLgameDir.c_str(), DeviceName[currentPartition]), "boot.bin|.iso", m_cfg.getString("DML", "lastlanguage", "EN").c_str());
|
||||
else
|
||||
m_gameList.Load(sfmt(DML_DIR, DeviceName[currentPartition]), ".iso", m_cfg.getString("DML", "lastlanguage", "EN").c_str());
|
||||
m_gameList.Load(sfmt(DML_DIR, DeviceName[currentPartition]), "boot.bin|.iso", m_cfg.getString("DML", "lastlanguage", "EN").c_str());
|
||||
m_cfg.setString("DML", "lastlanguage", m_loc.getString(m_curLanguage, "gametdb_code", "EN"));
|
||||
m_cfg.save();
|
||||
return m_gameList.size() > 0 ? true : false;
|
||||
@ -1961,6 +1961,7 @@ bool CMenu::_loadEmuList()
|
||||
pdir = opendir(m_pluginsDir.c_str());
|
||||
|
||||
safe_vector<dir_discHdr> emuList;
|
||||
Config m_plugin_cfg;
|
||||
|
||||
while ((pent = readdir(pdir)) != NULL)
|
||||
{
|
||||
@ -1970,16 +1971,18 @@ bool CMenu::_loadEmuList()
|
||||
continue;
|
||||
if(strcasestr(pent->d_name, ".ini") != NULL)
|
||||
{
|
||||
m_gameList.m_plugin.load(fmt("%s/%s", m_pluginsDir.c_str(), pent->d_name));
|
||||
if(m_gameList.m_plugin.loaded())
|
||||
m_plugin_cfg.load(fmt("%s/%s", m_pluginsDir.c_str(), pent->d_name));
|
||||
if(m_plugin_cfg.loaded())
|
||||
{
|
||||
m_plugin.AddPlugin(m_gameList.m_plugin);
|
||||
m_plugin.AddPlugin(m_plugin_cfg);
|
||||
m_gameList.clear();
|
||||
if(strcasestr(m_gameList.m_plugin.getString("PLUGIN","romDir","").c_str(), "scummvm.ini") == NULL)
|
||||
if(strcasestr(m_plugin_cfg.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.LoadPluginConfig(fmt("%s/%s", m_pluginsDir.c_str(), pent->d_name));
|
||||
m_gameList.Load(sfmt("%s:/%s", DeviceName[currentPartition], m_plugin_cfg.getString("PLUGIN","romDir","").c_str()), m_plugin_cfg.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++)
|
||||
emuList.push_back(*tmp_itr);
|
||||
m_gameList.UnloadPluginConfig();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1991,7 +1994,7 @@ bool CMenu::_loadEmuList()
|
||||
emuList.push_back(*tmp_itr);
|
||||
}
|
||||
}
|
||||
m_gameList.m_plugin.unload();
|
||||
m_plugin_cfg.unload();
|
||||
}
|
||||
}
|
||||
closedir(pdir);
|
||||
|
Loading…
Reference in New Issue
Block a user