From b4ca1536b562f2abb8e37e447e703fe9924bed48 Mon Sep 17 00:00:00 2001 From: "fix94.1" Date: Tue, 10 Apr 2012 13:37:57 +0000 Subject: [PATCH] -added cache support for emulator coverflow, should speed up loading alot --- source/list/cachedlist.cpp | 10 +++++----- source/menu/menu.cpp | 13 +++++++++++-- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/source/list/cachedlist.cpp b/source/list/cachedlist.cpp index 8cd64c4c..d60d2c43 100644 --- a/source/list/cachedlist.cpp +++ b/source/list/cachedlist.cpp @@ -13,19 +13,19 @@ void CachedList::Load(string path, string containing, string m_lastLanguage) bool update_games = false; bool update_homebrew = 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 music = typeid(T) == typeid(std::string); if(music) 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) { gprintf("Database file: %s\n", m_database.c_str()); 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_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())]; 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::Load(string path, string containing, string m_lastLanguage) if(update_homebrew) force_update[COVERFLOW_HOMEBREW] = 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"); @@ -90,7 +90,7 @@ void CachedList::Load(string path, string containing, string m_lastLanguage) m_loaded = true; m_update = false; - if(!music && !update_emu && pathlist.size() > 0) + if(!music && pathlist.size() > 0) { Save(); pathlist.clear(); diff --git a/source/menu/menu.cpp b/source/menu/menu.cpp index 3d9351fa..eed498e4 100644 --- a/source/menu/menu.cpp +++ b/source/menu/menu.cpp @@ -1957,17 +1957,22 @@ bool CMenu::_loadEmuList() m_plugin.load(fmt("%s/plugins.ini", m_pluginsDir.c_str())); pdir = opendir(m_pluginsDir.c_str()); + safe_vector emuList; + while ((pent = readdir(pdir)) != NULL) { // 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; 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_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::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_gameList.m_plugin.unload(); @@ -1975,6 +1980,10 @@ bool CMenu::_loadEmuList() } closedir(pdir); m_plugin.save(true); + m_gameList.clear(); + for(safe_vector::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.save();