-added cache support for emulator coverflow,

should speed up loading alot
This commit is contained in:
fix94.1 2012-04-10 13:37:57 +00:00
parent 72a7106fad
commit b4ca1536b5
2 changed files with 16 additions and 7 deletions

View File

@ -13,19 +13,19 @@ void CachedList<T>::Load(string path, string containing, string m_lastLanguage)
bool update_games = false; bool update_games = false;
bool update_homebrew = false; bool update_homebrew = false;
bool update_dml = false; bool update_dml = false;
bool update_emu = strcasestr(path.c_str(), m_plugin.getString("PLUGIN","romDir","").c_str()) != NULL; bool update_emu = false;
bool ditimes = false; bool ditimes = false;
bool music = typeid(T) == typeid(std::string); bool music = typeid(T) == typeid(std::string);
if(music) if(music)
gprintf("Loading music list from path: %s\n",path.c_str()); gprintf("Loading music list from path: %s\n",path.c_str());
else if(update_emu)
gprintf("Loading emulator gamelist from path: %s\n",path.c_str());
else if(!m_wbfsFS) else if(!m_wbfsFS)
{ {
gprintf("Database file: %s\n", m_database.c_str()); gprintf("Database file: %s\n", m_database.c_str());
update_games = strcasestr(path.c_str(), "wbfs") != NULL && force_update[COVERFLOW_USB]; update_games = strcasestr(path.c_str(), "wbfs") != NULL && force_update[COVERFLOW_USB];
update_homebrew = strcasestr(path.c_str(), "apps") != NULL && force_update[COVERFLOW_HOMEBREW]; update_homebrew = strcasestr(path.c_str(), "apps") != NULL && force_update[COVERFLOW_HOMEBREW];
update_emu = strcasestr(path.c_str(), m_plugin.getString("PLUGIN","romDir","").c_str()) != NULL && force_update[COVERFLOW_EMU];
const char* partition = DeviceName[DeviceHandler::Instance()->PathToDriveType(path.c_str())]; const char* partition = DeviceName[DeviceHandler::Instance()->PathToDriveType(path.c_str())];
update_dml = strcasestr(path.c_str(), sfmt(strncmp(partition, "sd", 2) != 0 ? m_DMLgameDir.c_str() : "%s:/games", partition).c_str()) != NULL && force_update[COVERFLOW_DML]; update_dml = strcasestr(path.c_str(), sfmt(strncmp(partition, "sd", 2) != 0 ? m_DMLgameDir.c_str() : "%s:/games", partition).c_str()) != NULL && force_update[COVERFLOW_DML];
@ -74,7 +74,7 @@ void CachedList<T>::Load(string path, string containing, string m_lastLanguage)
if(update_homebrew) force_update[COVERFLOW_HOMEBREW] = false; if(update_homebrew) force_update[COVERFLOW_HOMEBREW] = false;
if(update_dml) force_update[COVERFLOW_DML] = false; if(update_dml) force_update[COVERFLOW_DML] = false;
if(m_update || m_wbfsFS || music || update_emu) if(m_update || m_wbfsFS || music)
{ {
gprintf("Calling list to update filelist\n"); gprintf("Calling list to update filelist\n");
@ -90,7 +90,7 @@ void CachedList<T>::Load(string path, string containing, string m_lastLanguage)
m_loaded = true; m_loaded = true;
m_update = false; m_update = false;
if(!music && !update_emu && pathlist.size() > 0) if(!music && pathlist.size() > 0)
{ {
Save(); Save();
pathlist.clear(); pathlist.clear();

View File

@ -1957,17 +1957,22 @@ bool CMenu::_loadEmuList()
m_plugin.load(fmt("%s/plugins.ini", m_pluginsDir.c_str())); m_plugin.load(fmt("%s/plugins.ini", m_pluginsDir.c_str()));
pdir = opendir(m_pluginsDir.c_str()); pdir = opendir(m_pluginsDir.c_str());
safe_vector<dir_discHdr> emuList;
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) if (strcmp(pent->d_name, ".") == 0 || strcmp(pent->d_name, "..") == 0 || strcasecmp(pent->d_name, "plugins.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_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(), "EN"); m_gameList.clear();
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++)
emuList.push_back(*tmp_itr);
m_plugin.setString("GENERAL",m_gameList.m_plugin.getString("PLUGIN","magic","").c_str(),m_gameList.m_plugin.getString("PLUGIN","dolFile","").c_str()); m_plugin.setString("GENERAL",m_gameList.m_plugin.getString("PLUGIN","magic","").c_str(),m_gameList.m_plugin.getString("PLUGIN","dolFile","").c_str());
} }
m_gameList.m_plugin.unload(); m_gameList.m_plugin.unload();
@ -1975,6 +1980,10 @@ bool CMenu::_loadEmuList()
} }
closedir(pdir); closedir(pdir);
m_plugin.save(true); m_plugin.save(true);
m_gameList.clear();
for(safe_vector<dir_discHdr>::iterator tmp_itr = emuList.begin(); tmp_itr != emuList.end(); tmp_itr++)
m_gameList.push_back(*tmp_itr);
emuList.clear();
m_cfg.setString("EMULATOR", "lastlanguage", m_loc.getString(m_curLanguage, "gametdb_code", "EN")); m_cfg.setString("EMULATOR", "lastlanguage", m_loc.getString(m_curLanguage, "gametdb_code", "EN"));
m_cfg.save(); m_cfg.save();