diff --git a/source/list/ListGenerator.cpp b/source/list/ListGenerator.cpp
new file mode 100644
index 00000000..b985b5a6
--- /dev/null
+++ b/source/list/ListGenerator.cpp
@@ -0,0 +1,305 @@
+/****************************************************************************
+ * Copyright (C) 2012 FIX94
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ ****************************************************************************/
+#include
+#include
+#include "ListGenerator.hpp"
+#include "cache.hpp"
+#include "channel/channels.h"
+#include "devicemounter/DeviceHandler.hpp"
+#include "fileOps/fileOps.h"
+#include "gui/text.hpp"
+
+void ListGenerator::Init(string settingsDir, string Language)
+{
+ gameTDB_Path = fmt("%s/wiitdb.xml", settingsDir.c_str());
+ CustomTitlesPath = fmt("%s/" CTITLES_FILENAME, settingsDir.c_str());
+ gameTDB_Language = Language;
+}
+
+void ListGenerator::Cleanup()
+{
+ this->clear(); //clear gamelist
+}
+
+void ListGenerator::OpenConfigs()
+{
+ gameTDB.OpenFile(gameTDB_Path.c_str());
+ if(gameTDB.IsLoaded())
+ gameTDB.SetLanguageCode(gameTDB_Language.c_str());
+ CustomTitles.load(CustomTitlesPath.c_str());
+}
+
+void ListGenerator::CloseConfigs()
+{
+ if(gameTDB.IsLoaded())
+ gameTDB.CloseFile();
+ if(CustomTitles.loaded())
+ CustomTitles.unload();
+}
+
+void ListGenerator::CreateList(u32 Flow, u32 Device, string Path, vector FileTypes,
+ string DBName, bool UpdateCache, u32 Color, u32 Magic)
+{
+ Cleanup();
+ if(UpdateCache)
+ {
+ gprintf("Force Update Cache\n");
+ fsop_deleteFile(DBName.c_str());
+ }
+ else
+ {
+ CCache(*this, DBName, LOAD);
+ if(!this->empty())
+ return;
+ fsop_deleteFile(DBName.c_str());
+ }
+ OpenConfigs();
+ if(Flow == COVERFLOW_USB)
+ {
+ if(DeviceHandle.GetFSType(Device) == PART_FS_WBFS)
+ Create_Wii_WBFS_List(DeviceHandle.GetWbfsHandle(Device));
+ else
+ Create_Wii_EXT_List(Path, FileTypes);
+ }
+ else if(Flow == COVERFLOW_CHANNEL)
+ CreateChannelList();
+ else if(DeviceHandle.GetFSType(Device) != PART_FS_WBFS)
+ {
+ if(Flow == COVERFLOW_DML)
+ Create_GC_List(Path, FileTypes);
+ else if(Flow == COVERFLOW_PLUGIN)
+ Create_Plugin_List(Path, FileTypes, Color, Magic);
+ else if(Flow == COVERFLOW_HOMEBREW)
+ Create_Homebrew_List(Path, FileTypes);
+ }
+ CloseConfigs();
+ if(!this->empty()) /* Write a new Cache */
+ CCache(*this, DBName, SAVE);
+}
+
+void ListGenerator::Create_Wii_WBFS_List(wbfs_t *handle)
+{
+ discHdr Header;
+ for(u32 i = 0; i < wbfs_count_discs(handle); i++)
+ {
+ memset((void*)&Header, 0, sizeof(discHdr));
+ s32 ret = wbfs_get_disc_info(handle, i, (u8*)&Header, sizeof(discHdr), NULL);
+ if(ret == 0 && Header.magic == WII_MAGIC)
+ AddISO((const char*)Header.id, (const char*)Header.title, " ", 1, TYPE_WII_GAME);
+ }
+}
+
+void ListGenerator::Create_Wii_EXT_List(string Path, vector FileTypes)
+{
+ vector FileList;
+ GetFiles(Path.c_str(), FileTypes, &FileList);
+ discHdr Header;
+ for(vector::iterator Name = FileList.begin(); Name != FileList.end(); Name++)
+ {
+ memset((void*)&Header, 0, sizeof(discHdr));
+ FILE *fp = fopen(Name->c_str(), "rb");
+ if(fp)
+ {
+ fseek(fp, strcasestr(Name->c_str(), ".wbfs") != NULL ? 512 : 0, SEEK_SET);
+ fread((void*)&Header, 1, sizeof(discHdr), fp);
+ if(Header.magic == WII_MAGIC)
+ AddISO((const char*)Header.id, (const char*)Header.title, Name->c_str(), 1, TYPE_WII_GAME);
+ fclose(fp);
+ }
+ }
+ FileList.clear();
+}
+
+void ListGenerator::Create_GC_List(string Path, vector FileTypes)
+{
+ vector FileList;
+ GetFiles(Path.c_str(), FileTypes, &FileList, true);
+ gc_discHdr Header;
+ for(vector::iterator Name = FileList.begin(); Name != FileList.end(); Name++)
+ {
+ memset((void*)&Header, 0, sizeof(gc_discHdr));
+ FILE *fp = fopen(Name->c_str(), "rb");
+ if(fp)
+ {
+ fread((void*)&Header, 1, sizeof(gc_discHdr), fp);
+ if(Header.magic == GC_MAGIC)
+ AddISO((const char*)Header.id, (const char*)Header.title, Name->c_str(), 0, TYPE_GC_GAME);
+ fclose(fp);
+ }
+ }
+ FileList.clear();
+}
+
+void ListGenerator::Create_Plugin_List(string Path, vector FileTypes, u32 Color, u32 Magic)
+{
+ dir_discHdr ListElement;
+ vector FileList;
+ GetFiles(Path.c_str(), FileTypes, &FileList, false, 20);
+ for(vector::iterator Name = FileList.begin(); Name != FileList.end(); Name++)
+ {
+ memset((void*)&ListElement, 0, sizeof(dir_discHdr));
+ ListElement.index = this->size();
+ strncpy(ListElement.path, Name->c_str(), sizeof(ListElement.path));
+ strncpy(ListElement.id, "PLUGIN", 6);
+
+ string Title(Name->begin() + Name->find_last_of('/') + 1, Name->begin() + Name->find_last_of('.'));
+ mbstowcs(ListElement.title, Title.c_str(), 63);
+ Asciify(ListElement.title);
+
+ ListElement.settings[0] = Magic; //Plugin magic
+ ListElement.casecolor = Color;
+ ListElement.type = TYPE_PLUGIN;
+ this->push_back(ListElement);
+ }
+ FileList.clear();
+}
+
+void ListGenerator::Create_Homebrew_List(string Path, vector FileTypes)
+{
+ dir_discHdr ListElement;
+ vector FileList;
+ GetFiles(Path.c_str(), FileTypes, &FileList, false, 4);
+ for(vector::iterator Name = FileList.begin(); Name != FileList.end(); Name++)
+ {
+ if(Name->find("boot.") == string::npos)
+ continue;
+ memset((void*)&ListElement, 0, sizeof(dir_discHdr));
+ ListElement.index = this->size();
+ Name->erase(Name->begin() + Name->find_last_of('/'), Name->end());
+ strncpy(ListElement.path, Name->c_str(), sizeof(ListElement.path));
+ strncpy(ListElement.id, "HB_APP", 6);
+
+ string FolderTitle(Name->begin() + Name->find_last_of('/') + 1, Name->end());
+ ListElement.casecolor = CustomTitles.getColor("COVERS", FolderTitle.c_str(), 1).intVal();
+ string CustomTitle = CustomTitles.getString("TITLES", FolderTitle.c_str());
+ if(CustomTitle.size() > 0)
+ mbstowcs(ListElement.title, CustomTitle.c_str(), 63);
+ else
+ mbstowcs(ListElement.title, FolderTitle.c_str(), 63);
+ Asciify(ListElement.title);
+
+ ListElement.type = TYPE_HOMEBREW;
+ this->push_back(ListElement);
+ continue;
+ }
+}
+
+void ListGenerator::CreateChannelList()
+{
+ u32 GameColor = 1;
+ Channels ChannelHandle;
+ dir_discHdr ListElement;
+ ChannelHandle.Init(0, gameTDB_Language, true);
+ u32 count = ChannelHandle.Count();
+ this->reserve(count);
+ for(u32 i = 0; i < count; ++i)
+ {
+ Channel *chan = ChannelHandle.GetChannel(i);
+ if(chan->id == NULL)
+ continue; // Skip invalid channels
+ memset((void*)&ListElement, 0, sizeof(dir_discHdr));
+ ListElement.index = this->size();
+ ListElement.settings[0] = TITLE_UPPER(chan->title);
+ ListElement.settings[1] = TITLE_LOWER(chan->title);
+ strncpy(ListElement.id, chan->id, 4);
+ ListElement.casecolor = CustomTitles.getColor("COVERS", ListElement.id, GameColor).intVal();
+ string CustomTitle = CustomTitles.getString("TITLES", ListElement.id);
+ if(gameTDB.IsLoaded())
+ {
+ if(ListElement.casecolor == GameColor)
+ ListElement.casecolor = gameTDB.GetCaseColor(ListElement.id);
+ if(CustomTitle.size() == 0)
+ gameTDB.GetTitle(ListElement.id, CustomTitle);
+ ListElement.wifi = gameTDB.GetWifiPlayers(ListElement.id);
+ ListElement.players = gameTDB.GetPlayers(ListElement.id);
+ }
+ if(CustomTitle.size() > 0)
+ mbstowcs(ListElement.title, CustomTitle.c_str(), 63);
+ else
+ wcsncpy(ListElement.title, chan->name, 64);
+ ListElement.type = TYPE_CHANNEL;
+ this->push_back(ListElement);
+ }
+}
+
+void ListGenerator::AddISO(const char *GameID, const char *GameTitle, const char *GamePath, u32 GameColor, u8 Type)
+{
+ dir_discHdr ListElement;
+ memset((void*)&ListElement, 0, sizeof(dir_discHdr));
+ ListElement.index = this->size();
+ strncpy(ListElement.id, GameID, 6);
+ strncpy(ListElement.path, GamePath, sizeof(ListElement.path));
+ ListElement.casecolor = CustomTitles.getColor("COVERS", ListElement.id, GameColor).intVal();
+ string CustomTitle = CustomTitles.getString("TITLES", ListElement.id);
+ if(gameTDB.IsLoaded())
+ {
+ if(ListElement.casecolor == GameColor)
+ ListElement.casecolor = gameTDB.GetCaseColor(ListElement.id);
+ if(CustomTitle.size() == 0)
+ gameTDB.GetTitle(ListElement.id, CustomTitle);
+ ListElement.wifi = gameTDB.GetWifiPlayers(ListElement.id);
+ ListElement.players = gameTDB.GetPlayers(ListElement.id);
+ }
+ if(CustomTitle.size() > 0)
+ mbstowcs(ListElement.title, CustomTitle.c_str(), 63);
+ else
+ mbstowcs(ListElement.title, GameTitle, 63);
+ Asciify(ListElement.title);
+
+ ListElement.type = Type;
+ this->push_back(ListElement); //I am a vector! :P
+}
+
+void ListGenerator::GetFiles(const char *Path, vector FileTypes,
+ vector *FileList, bool gc, u32 max_depth, u32 depth)
+{
+ struct dirent *pent = NULL;
+ vector SubPaths;
+ DIR *pdir = opendir(Path);
+ if(pdir == NULL)
+ return;
+ while((pent = readdir(pdir)) != NULL)
+ {
+ if(strcmp(pent->d_name, ".") == 0 || strcmp(pent->d_name, "..") == 0)
+ continue;
+ string CurrentItem = sfmt("%s/%s", Path, pent->d_name);
+ if(pent->d_type == DT_DIR)
+ {
+ if(gc && depth == 2 && strcasecmp(pent->d_name, "root") == 0) //fst
+ FileList->push_back(CurrentItem);
+ else if(depth < max_depth)
+ SubPaths.push_back(CurrentItem); //thanks to libntfs for a complicated way
+ }
+ else if(pent->d_type == DT_REG)
+ {
+ const char *FileName = strstr(pent->d_name, ".");
+ if(FileName == NULL) FileName = pent->d_name;
+ for(vector::iterator cmp = FileTypes.begin(); cmp != FileTypes.end(); cmp++)
+ {
+ if(strcasecmp(FileName, cmp->c_str()) == 0)
+ {
+ FileList->push_back(CurrentItem);
+ break;
+ }
+ }
+ }
+ }
+ closedir(pdir);
+ for(vector::iterator SubPath = SubPaths.begin(); SubPath != SubPaths.end(); SubPath++)
+ GetFiles(SubPath->c_str(), FileTypes, FileList, gc, max_depth, depth + 1);
+ SubPaths.clear();
+}
diff --git a/source/list/ListGenerator.hpp b/source/list/ListGenerator.hpp
new file mode 100644
index 00000000..93721488
--- /dev/null
+++ b/source/list/ListGenerator.hpp
@@ -0,0 +1,58 @@
+/****************************************************************************
+ * Copyright (C) 2012 FIX94
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ ****************************************************************************/
+#ifndef _LISTGENERATOR_HPP_
+#define _LISTGENERATOR_HPP_
+
+#include
+#include
+#include
+
+#include "types.h"
+#include "config/config.hpp"
+#include "loader/wbfs.h"
+#include "loader/disc.h"
+#include "gui/GameTDB.hpp"
+
+using namespace std;
+
+class ListGenerator : public vector
+{
+public:
+ void Init(string settingsDir, string Language);
+ void Cleanup();
+ void CreateList(u32 Flow, u32 Device, string Path, vector FileTypes,
+ string DBName, bool UpdateCache, u32 Color = 0, u32 Magic = 0);
+private:
+ void Create_Wii_WBFS_List(wbfs_t *handle);
+ void Create_Wii_EXT_List(string Path, vector FileTypes);
+ void Create_GC_List(string Path, vector FileTypes);
+ void Create_Plugin_List(string Path, vector FileTypes, u32 Color, u32 Magic);
+ void Create_Homebrew_List(string Path, vector FileTypes);
+ void CreateChannelList();
+ void GetFiles(const char *Path, vector FileTypes, vector *FileList,
+ bool gc = false, u32 max_depth = 2, u32 depth = 1);
+ void AddISO(const char *GameID, const char *GameTitle, const char *GamePath, u32 GameColor, u8 Type);
+ void OpenConfigs();
+ void CloseConfigs();
+ string gameTDB_Path;
+ string CustomTitlesPath;
+ string gameTDB_Language;
+ GameTDB gameTDB;
+ Config CustomTitles;
+};
+
+#endif /*_LISTGENERATOR_HPP_*/
diff --git a/source/list/cachedlist.cpp b/source/list/cachedlist.cpp
deleted file mode 100644
index 8c4f972b..00000000
--- a/source/list/cachedlist.cpp
+++ /dev/null
@@ -1,165 +0,0 @@
-#include "cachedlist.hpp"
-#include
-
-void CachedList::Load(string path, string containing, string m_lastLanguage, Config &m_plugin) /* Load All */
-{
- const char* partition = DeviceName[DeviceHandle.PathToDriveType(path.c_str())];
- //gprintf("\nLoading files containing %s in %s\n", containing.c_str(), path.c_str());
- m_loaded = false;
- if(m_plugin.loaded())
- m_database = sfmt("%s/%s_%s.db", m_cacheDir.c_str(), partition, lowerCase(m_plugin.getString("PLUGIN","magic")).c_str());
- else
- m_database = sfmt("%s/%s.db", m_cacheDir.c_str(), (make_db_name(path)).c_str());
- m_wbfsFS = strncasecmp(DeviceHandle.PathToFSName(path.c_str()), "WBFS", 4) == 0;
-
- bool update_games = false;
- bool update_homebrew = false;
- bool update_dml = false;
- bool update_emu = false;
-
- bool ditimes = false;
- 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 = m_plugin.loaded() && force_update[COVERFLOW_EMU];
- update_dml = strcasestr(path.c_str(), fmt(strncmp(partition, "sd", 2) != 0 ? m_DMLgameDir.c_str() : "%s:/games", partition)) != NULL && force_update[COVERFLOW_DML];
-
- //gprintf("update_games=%d update_homebrew=%d update_dml=%d, update_emu=%d\n", update_games, update_homebrew, update_dml, update_emu);
- if(update_games || update_homebrew || update_dml || update_emu)
- remove(m_database.c_str());
-
- m_discinf = sfmt("%s/disc.info", path.c_str());
- struct stat filestat, discinfo, cache;
- //gprintf("%s\n", path.c_str());
- if(stat(path.c_str(), &filestat) == -1)
- return;
-
- bool update_lang = m_lastLanguage != m_curLanguage;
- bool noDB = stat(m_database.c_str(), &cache) == -1;
- bool mtimes = filestat.st_mtime > cache.st_mtime;
- if(strcasestr(m_discinf.c_str(), "wbfs") != NULL && stat(m_discinf.c_str(), &discinfo) != -1)
- ditimes = discinfo.st_mtime > cache.st_mtime;
-
- m_update = update_lang || noDB || (!m_skipcheck && (mtimes || ditimes));
- /*if(m_update)
- gprintf("Cache of %s is being updated because:\n", path.c_str());
- if(update_lang)
- gprintf("Languages are different!\nOld language string: %s\nNew language string: %s\n", m_lastLanguage.c_str(), m_curLanguage.c_str());
- if(noDB)
- gprintf("A database was not found!\n");
- if(!m_skipcheck && (mtimes || ditimes))
- gprintf("The WBFS folder was modified!\nCache date: %i\nFolder date: %i\n", cache.st_mtime, filestat.st_mtime);
- */
- if(m_extcheck && !m_update && !m_skipcheck)
- {
- bool m_chupdate = false;
- DIR *dir = opendir(path.c_str());
- struct dirent *entry;
- while((entry = readdir(dir)) != NULL)
- {
- m_discinf = sfmt("%s/%s", path.c_str(), entry->d_name);
- if(stat(m_discinf.c_str(), &discinfo) != -1)
- m_chupdate = discinfo.st_mtime > cache.st_mtime;
- if(m_chupdate)
- break;
- }
- m_update = m_chupdate;
- }
- }
-
- if(update_games)
- force_update[COVERFLOW_USB] = false;
- if(update_homebrew)
- force_update[COVERFLOW_HOMEBREW] = false;
- if(update_dml)
- force_update[COVERFLOW_DML] = false;
-
- if(m_update || m_wbfsFS)
- {
- gprintf("Updating Cache\n");
-
- vector pathlist;
- list.GetPaths(pathlist, containing, path, m_wbfsFS, (update_dml || (m_update && strcasestr(path.c_str(), ":/games") != NULL)), !update_emu);
- list.GetHeaders(pathlist, *this, m_settingsDir, m_curLanguage, m_DMLgameDir, m_plugin);
-
- path.append("/touch.db");
- FILE *file = fopen(path.c_str(), "wb");
- fclose(file);
- remove(path.c_str());
-
- m_loaded = true;
- m_update = false;
-
- if(pathlist.size() > 0)
- Save();
- pathlist.clear();
- }
- else
- {
- CCache(*this, m_database, LOAD);
- m_loaded = true;
- }
-}
-
-void CachedList::LoadChannels(string path, u32 channelType, string m_lastLanguage) /* Load All */
-{
- m_loaded = false;
- m_update = true;
-
- bool emu = !path.empty();
- if(emu)
- {
- m_database = sfmt("%s/%s.db", m_cacheDir.c_str(), make_db_name(sfmt("%s/emu", path.c_str())).c_str());
-
- size_t find = m_database.find("//");
- if(find != string::npos)
- m_database.replace(find, 2, "/");
-
- if(force_update[COVERFLOW_CHANNEL])
- remove(m_database.c_str());
-
- //gprintf("%s\n", m_database.c_str());
- struct stat filestat, cache;
-
- /*** Removed that stupid check overhere! ***/
- /*** Will replace it soon with something better!! ***/
-
- m_update = force_update[COVERFLOW_CHANNEL] || m_lastLanguage != m_curLanguage || stat(m_database.c_str(), &cache) == -1 || filestat.st_mtime > cache.st_mtime;
- }
-
- force_update[COVERFLOW_CHANNEL] = false;
-
- if(m_update)
- {
- gprintf("Updating channels\n");
- list.GetChannels(*this, m_settingsDir, channelType, m_curLanguage);
-
- m_loaded = true;
- m_update = false;
-
- if(this->size() > 0 && emu) Save();
- }
- else
- CCache(*this, m_database, LOAD);
-
- m_loaded = true;
-}
-
-string CachedList::make_db_name(string path)
-{
- string buffer = path;
- size_t find = buffer.find(":/");
- if(find != string::npos)
- buffer.replace(find, 2, "_");
-
- find = buffer.find("/");
- while(find != string::npos)
- {
- buffer[find] = '_';
- find = buffer.find("/");
- }
- return buffer;
-}
-
diff --git a/source/list/cachedlist.hpp b/source/list/cachedlist.hpp
deleted file mode 100644
index 1074333f..00000000
--- a/source/list/cachedlist.hpp
+++ /dev/null
@@ -1,85 +0,0 @@
-#ifndef CACHEDLIST
-#define CACHEDLIST
-
-#include "list.hpp"
-#include "cache.hpp"
-#include "config/config.hpp"
-#include "gecko/gecko.h"
-
-using namespace std;
-
-enum {
- COVERFLOW_USB,
- COVERFLOW_DML,
- COVERFLOW_CHANNEL,
- COVERFLOW_EMU,
- COVERFLOW_HOMEBREW,
- COVERFLOW_MAX
-};
-
-class CachedList : public vector
-{
-public:
- void Init(string cachedir, string settingsDir, string curLanguage, string DMLgameDir, bool extcheck, bool skipcheck) /* Initialize Private Variables */
- {
- m_cacheDir = cachedir;
- m_settingsDir = settingsDir;
- m_curLanguage = m_lastLanguage = curLanguage;
- m_loaded = false;
- m_database = "";
- m_update = false;
- m_extcheck = extcheck;
- m_skipcheck = skipcheck;
- m_DMLgameDir = DMLgameDir;
- for(u32 i = 0; i < COVERFLOW_MAX; i++)
- force_update[i] = false;
- }
-
- void Update(u32 view = COVERFLOW_MAX) /* Force db update on next load */
- {
- if(view == COVERFLOW_MAX)
- for(u32 i = 0; i < COVERFLOW_MAX; i++)
- {
- force_update[i] = true;
- gprintf("force_update[%d] = true\n", i);
- }
- else
- {
- force_update[view] = true;
- gprintf("force_update[%d] = true\n", view);
- }
- }
-
- void Load(string path, string containing, string m_lastLanguage, Config &m_plugin);
- void LoadChannels(string path, u32 channelType, string m_lastLanguage);
-
- void Unload(){if(m_loaded) {this->clear(); m_loaded = false; m_database = "";}};
- void Save() {if(m_loaded) CCache(*this, m_database, SAVE);} /* Save All */
-
- void Get(dir_discHdr tmp, u32 index) {if(m_loaded) CCache(tmp, m_database, index, LOAD);} /* Load One */
- void Set(dir_discHdr tmp, u32 index) {if(m_loaded) CCache(tmp, m_database, index, SAVE);} /* Save One */
-
- void Add(dir_discHdr tmp) {if(m_loaded) CCache(*this, m_database, tmp, ADD);} /* Add One */
- void Remove(u32 index) {if(m_loaded) CCache(*this, m_database, index, REMOVE);} /* Remove One */
-
- void SetLanguage(string curLanguage) { m_curLanguage = curLanguage; }
-private:
- string make_db_name(string path);
-
- bool m_loaded;
- bool m_update;
- bool m_wbfsFS;
- bool m_extcheck;
- bool m_skipcheck;
- u8 force_update[COVERFLOW_MAX];
- CList list;
- string m_database;
- string m_cacheDir;
- string m_settingsDir;
- string m_curLanguage;
- string m_lastLanguage;
- string m_discinf;
- string m_DMLgameDir;
-};
-
-#endif
diff --git a/source/list/list.cpp b/source/list/list.cpp
deleted file mode 100644
index fa14ea13..00000000
--- a/source/list/list.cpp
+++ /dev/null
@@ -1,474 +0,0 @@
-#include "list.hpp"
-#include "types.h"
-#include "channel/channels.h"
-#include "config/config.hpp"
-#include "fileOps/fileOps.h"
-#include "gecko/gecko.h"
-#include "gc/gc.hpp"
-#include "gui/GameTDB.hpp"
-
-template
-void CList::GetPaths(vector &pathlist, string containing, string directory, bool wbfs_fs, bool dml, bool depth_limit)
-{
- if (!wbfs_fs)
- {
- /* Open primary directory */
- DIR *dir_itr = opendir(directory.c_str());
- if (!dir_itr) return;
-
- vector compares = stringToVector(containing, '|');
- vector temp_pathlist;
-
- struct dirent *ent;
-
- /* Read primary entries */
- while((ent = readdir(dir_itr)) != NULL)
- {
- if(ent->d_name[0] == '.')
- continue;
-
- if(ent->d_type == DT_REG)
- {
- for(vector::iterator compare = compares.begin(); compare != compares.end(); compare++)
- {
- if (strcasestr(ent->d_name, (*compare).c_str()) != NULL)
- {
- //gprintf("Pushing %s to the list.\n", sfmt("%s/%s", directory.c_str(), ent->d_name).c_str());
- pathlist.push_back(sfmt("%s/%s", directory.c_str(), ent->d_name));
- break;
- }
- }
- }
- else
- temp_pathlist.push_back(sfmt("%s/%s", directory.c_str(), ent->d_name));
- }
- closedir(dir_itr);
-
- while(temp_pathlist.size())
- {
- while((dir_itr = opendir(temp_pathlist[0].c_str())) && !dir_itr)
- temp_pathlist.erase(temp_pathlist.begin());
-
- /* Read subdirectory */
- while((ent = readdir(dir_itr)) != NULL)
- {
- if(ent->d_name[0] == '.')
- continue;
- if(ent->d_type == DT_REG)
- {
- for(vector::iterator compare = compares.begin(); compare != compares.end(); compare++)
- {
- if(strcasestr(ent->d_name, (*compare).c_str()) != NULL)
- {
- //gprintf("Pushing %s to the list.\n", sfmt("%s/%s", temp_pathlist[0].c_str(), ent->d_name).c_str());
- pathlist.push_back(sfmt("%s/%s", temp_pathlist[0].c_str(), ent->d_name));
- break;
- }
- }
- }
- else
- {
- if(!depth_limit)
- temp_pathlist.push_back(sfmt("%s/%s", temp_pathlist[0].c_str(), ent->d_name));
- else if(dml && strncasecmp(ent->d_name, "sys", 3) == 0 && fsop_DirExist(fmt("%s/root", temp_pathlist[0].c_str())))
- {
- //gprintf("Pushing %s to the list.\n", sfmt("%s/%s/boot.bin", temp_pathlist[0].c_str(), ent->d_name).c_str());
- pathlist.push_back(sfmt("%s/%s/boot.bin", temp_pathlist[0].c_str(), ent->d_name));
- }
- }
- }
- closedir(dir_itr);
- /* Finished reading subdirectory, erase it */
- temp_pathlist.erase(temp_pathlist.begin());
- }
- }
- else
- {
- if(strcasestr(containing.c_str(), ".dol") != 0)
- return;
-
- int partition = DeviceHandle.PathToDriveType(directory.c_str());
- wbfs_t* handle = DeviceHandle.GetWbfsHandle(partition);
- if(!handle)
- return;
-
- u32 count = wbfs_count_discs(handle);
- for(u32 i = 0; i < count; i++)
- pathlist.push_back(directory);
- }
-}
-
-template <>
-void CList::GetHeaders(vector pathlist, vector &headerlist, string settingsDir, string curLanguage, string DMLgameUSBDir, Config &plugin)
-{
- if(pathlist.size() < 1)
- return;
-
- headerlist.reserve(pathlist.size() + headerlist.size());
- //gprintf("Getting headers for paths in pathlist (%d)\n", pathlist.size());
-
- vector GC_SD_IDs;
- bool GC_SD_IDs_loaded = false;
-
- discHdr gc_hdr;
- dir_discHdr tmp;
- u32 count = 0;
- string GTitle;
-
- Config custom_titles;
- if(settingsDir.size() > 0)
- {
- string custom_titles_path = sfmt("%s/" CTITLES_FILENAME, settingsDir.c_str());
- custom_titles.load(custom_titles_path.c_str());
- }
-
- GameTDB gameTDB;
- if(settingsDir.size() > 0)
- {
- gameTDB.OpenFile(fmt("%s/wiitdb.xml", settingsDir.c_str()));
- if(curLanguage.size() == 0) curLanguage = "EN";
- gameTDB.SetLanguageCode(curLanguage.c_str());
- }
-
- for(vector::iterator itr = pathlist.begin(); itr != pathlist.end(); itr++)
- {
- memset(&tmp, 0, sizeof(tmp));
- strncpy(tmp.path, (*itr).c_str(), sizeof(tmp.path));
- tmp.index = headerlist.size();
- tmp.casecolor = 1;
-
- bool wbfs = (*itr).rfind(".wbfs") != string::npos || (*itr).rfind(".WBFS") != string::npos;
-
- if(plugin.loaded())
- {
- vector types = plugin.getStrings("PLUGIN","fileTypes",'|');
- if (types.size() > 0)
- {
- for(vector::iterator type_itr = types.begin(); type_itr != types.end(); type_itr++)
- {
- if(lowerCase(*itr).rfind((*type_itr).c_str()) != string::npos)
- {
- strncpy(tmp.path, (*itr).c_str(), sizeof(tmp.path));
- strncpy(tmp.id, "PLUGIN", sizeof(tmp.id));
- tmp.casecolor = strtoul(plugin.getString("PLUGIN","coverColor","").c_str(), NULL, 16);
-
- char tempname[64];
- (*itr).assign(&(*itr)[(*itr).find_last_of('/') + 1]);
- if((*itr).find_last_of('.') != string::npos)
- (*itr).erase((*itr).find_last_of('.'), (*itr).size() - (*itr).find_last_of('.'));
- strncpy(tempname, (*itr).c_str(), sizeof(tempname));
-
- wstringEx tmpString;
- tmpString.fromUTF8(tempname);
- wcsncpy(tmp.title, tmpString.c_str(), 64);
- Asciify(tmp.title);
-
- //gprintf("Found: %ls\n", tmp.title);
- tmp.settings[0] = strtoul(plugin.getString("PLUGIN","magic","").c_str(), NULL, 16); //Plugin magic
- tmp.type = TYPE_PLUGIN;
- headerlist.push_back(tmp);
- break;
- }
- }
- }
- continue;
- }
- else 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[DeviceHandle.PathToDriveType((*itr).c_str())];
- if(strcasecmp(filename, "game.iso") == 0 || strcasecmp(filename, "gam1.iso") == 0 || strcasecmp(filename, "boot.bin") == 0)
- {
- FILE *fp = fopen((*itr).c_str(), "rb");
- if(fp)
- {
- u8 gc_disc[1];
- fseek(fp, 6, SEEK_SET);
- fread(gc_disc, 1, 1, fp);
-
- memset(&gc_hdr, 0, sizeof(discHdr));
- fseek(fp, 0, SEEK_SET);
- fread(&gc_hdr, sizeof(discHdr), 1, fp);
- fclose(fp);
-
- if(gc_hdr.gc_magic == GC_MAGIC)
- {
- strcpy(tmp.path, (*itr).c_str());
- strncpy(tmp.id, (char*)gc_hdr.id, 6);
- (*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]);
- GTitle = custom_titles.getString("TITLES", tmp.id);
- tmp.casecolor = 0;
- int ccolor = custom_titles.getColor("COVERS", tmp.id, tmp.casecolor).intVal();
-
- wstringEx tmpString;
- if(GTitle.size() > 0 || (gameTDB.IsLoaded() && gameTDB.GetTitle(tmp.id, GTitle)))
- {
- tmpString.fromUTF8(GTitle.c_str());
- tmp.casecolor = ccolor != 0 ? ccolor : gameTDB.GetCaseColor(tmp.id);
- }
- else
- {
- tmpString.fromUTF8(gc_hdr.title);
- tmp.casecolor = ccolor;
- }
- wcsncpy(tmp.title, tmpString.c_str(), 64);
- if(gc_disc[0])
- wcslcat(tmp.title, L" disc 2", sizeof(tmp.title));
- if(strncmp(dml_partition, "sd", 2) != 0)
- {
- if(!GC_SD_IDs_loaded)
- {
- CList tmplist;
- vector pathlist;
- tmplist.GetPaths(pathlist, ".iso|.bin", "sd:/games", false, true);
- vector tmpGameList;
- tmplist.GetHeaders(pathlist, tmpGameList, settingsDir, curLanguage, DMLgameUSBDir, plugin);
- for(u8 i = 0; i < tmpGameList.size(); i++)
- GC_SD_IDs.push_back(tmpGameList.at(i).id);
- GC_SD_IDs_loaded = true;
- }
- tmp.settings[0] = 0;
- for(u8 i = 0; i < GC_SD_IDs.size(); i++)
- {
- if(strncasecmp(GC_SD_IDs.at(i), tmp.id, 6) == 0)
- {
- tmp.settings[0] = 1; //Later Checks can use this as easy information
- wcslcat(tmp.title, L" \n(on SD)", sizeof(tmp.title));
- break;
- }
- }
- }
- Asciify(tmp.title);
-
- //gprintf("Found: %ls\n", tmp.title);
- tmp.type = TYPE_GC_GAME;
- headerlist.push_back(tmp);
- continue;
- }
- }
- continue;
- }
-
- Check_For_ID(tmp.id, (*itr).c_str(), "[", "]"); /* [GAMEID] Title, [GAMEID]_Title, Title [GAMEID], Title_[GAMEID] */
- if(tmp.id[0] == 0)
- {
- Check_For_ID(tmp.id, (*itr).c_str(), "/", "."); /* GAMEID.wbfs, GAMEID.iso */
- if(tmp.id[0] == 0)
- {
- Check_For_ID(tmp.id, (*itr).c_str(), "/", "_"); /* GAMEID_Title */
- if(tmp.id[0] == 0)
- {
- Check_For_ID(tmp.id, (*itr).c_str(), "_", "."); /* Title_GAMEID */ // <-- Unsafe?
- if(tmp.id[0] == 0)
- Check_For_ID(tmp.id, (*itr).c_str(), " ", "."); /* Title GAMEID */ //<-- Unsafe?
- }
- }
- }
-
- if(!isalnum(tmp.id[0]) || tmp.id[0] == 0 || memcmp(tmp.id, "__CFG_", sizeof tmp.id) == 0)
- {
- gprintf("Skipping file: '%s'\n", (*itr).c_str());
- continue;
- }
-
- discHdr wii_hdr;
- FILE *fp = fopen((*itr).c_str(), "rb");
- if(fp)
- {
- fseek(fp, wbfs ? 512 : 0, SEEK_SET);
- fread(&wii_hdr, sizeof(discHdr), 1, fp);
- fclose(fp);
- }
-
- if(wii_hdr.magic == WII_MAGIC)
- {
- strncpy(tmp.id, (char*)wii_hdr.id, 6);
- GTitle = custom_titles.getString("TITLES", tmp.id);
- int ccolor = custom_titles.getColor("COVERS", tmp.id, tmp.casecolor).intVal();
-
- wstringEx tmpString;
- if(GTitle.size() > 0 || (gameTDB.IsLoaded() && gameTDB.GetTitle(tmp.id, GTitle)))
- {
- tmpString.fromUTF8(GTitle.c_str());
- tmp.wifi = gameTDB.GetWifiPlayers(tmp.id);
- tmp.players = gameTDB.GetPlayers(tmp.id);
- tmp.casecolor = ccolor != 1 ? ccolor : gameTDB.GetCaseColor(tmp.id);
- }
- else
- {
- tmpString.fromUTF8(wii_hdr.title);
- tmp.casecolor = ccolor;
- }
- wcsncpy(tmp.title, tmpString.c_str(), 64);
- Asciify(tmp.title);
-
- //gprintf("Found: %ls\n", tmp.title);
- tmp.type = TYPE_WII_GAME;
- headerlist.push_back(tmp);
- continue;
- }
- }
- else if(strncasecmp(DeviceHandle.PathToFSName((*itr).c_str()), "WBFS", 4) == 0)
- {
- u8 partition = DeviceHandle.PathToDriveType((*itr).c_str());
- wbfs_t* handle = DeviceHandle.GetWbfsHandle(partition);
- if(!handle)
- return;
-
- discHdr wbfs_hdr;
- s32 ret = wbfs_get_disc_info(handle, count, (u8 *)&wbfs_hdr, sizeof(struct discHdr), NULL);
- count++;
- if(ret != 0)
- continue;
-
- if(wbfs_hdr.magic == WII_MAGIC)
- {
- strncpy(tmp.id, (char*)wbfs_hdr.id, 6);
- GTitle = custom_titles.getString("TITLES", tmp.id);
- int ccolor = custom_titles.getColor("COVERS", tmp.id, tmp.casecolor).intVal();
-
- wstringEx tmpString;
- if(GTitle.size() > 0 || (gameTDB.IsLoaded() && gameTDB.GetTitle(tmp.id, GTitle)))
- {
- tmpString.fromUTF8(GTitle.c_str());
- tmp.wifi = gameTDB.GetWifiPlayers(tmp.id);
- tmp.players = gameTDB.GetPlayers(tmp.id);
- tmp.casecolor = ccolor != 1 ? ccolor : gameTDB.GetCaseColor(tmp.id);
- }
- else
- {
- tmpString.fromUTF8((const char *)wbfs_hdr.title);
- tmp.casecolor = ccolor;
- }
- wcsncpy(tmp.title, tmpString.c_str(), 64);
- Asciify(tmp.title);
-
- //gprintf("Found: %ls\n", tmp.title);
- tmp.type = TYPE_WII_GAME;
- headerlist.push_back(tmp);
- }
- continue;
- }
- else if((*itr).rfind(".dol") != string::npos || (*itr).rfind(".DOL") != string::npos
- || (*itr).rfind(".elf") != string::npos || (*itr).rfind(".ELF") != string::npos)
- {
- char *filename = &(*itr)[(*itr).find_last_of('/')+1];
- if(strcasecmp(filename, "boot.dol") != 0 && strcasecmp(filename, "boot.elf") != 0)
- continue;
-
- strncpy(tmp.id, "HB_APP", sizeof(tmp.id));
-
- (*itr)[(*itr).find_last_of('/')] = 0;
- strncpy(tmp.path, (*itr).c_str(), sizeof(tmp.path));
-
- (*itr).assign(&(*itr)[(*itr).find_last_of('/') + 1]);
- char homebrewtitle[64];
- strncpy(homebrewtitle, (*itr).c_str(), sizeof(homebrewtitle));
-
- tmp.casecolor = custom_titles.getColor("COVERS", homebrewtitle, tmp.casecolor).intVal();
-
- wstringEx tmpString;
- GTitle = custom_titles.getString("TITLES", homebrewtitle);
- if(GTitle.size() > 0)
- tmpString.fromUTF8(GTitle.c_str());
- else
- tmpString.fromUTF8(homebrewtitle);
- wcsncpy(tmp.title, tmpString.c_str(), 64);
- Asciify(tmp.title);
-
- //gprintf("Found: %ls\n", tmp.title);
- tmp.type = TYPE_HOMEBREW;
- headerlist.push_back(tmp);
- continue;
- }
- }
-
- if(gameTDB.IsLoaded())
- gameTDB.CloseFile();
-}
-
-template <>
-void CList::GetChannels(vector &headerlist, string settingsDir, u32 channelType, string curLanguage)
-{
- Channels m_channels;
- m_channels.Init(channelType, curLanguage, true);
-
- Config custom_titles;
- if (settingsDir.size() > 0)
- {
- string custom_titles_path = sfmt("%s/" CTITLES_FILENAME, settingsDir.c_str());
- custom_titles.load(custom_titles_path.c_str());
- }
-
- GameTDB gameTDB;
- if (settingsDir.size() > 0)
- {
- gameTDB.OpenFile(fmt("%s/wiitdb.xml", settingsDir.c_str()));
- if(curLanguage.size() == 0) curLanguage = "EN";
- gameTDB.SetLanguageCode(curLanguage.c_str());
- }
-
- u32 count = m_channels.Count();
-
- headerlist.reserve(count);
-
- for (u32 i = 0; i < count; ++i)
- {
- Channel *chan = m_channels.GetChannel(i);
-
- if(chan->id == NULL)
- continue; // Skip invalid channels
-
- dir_discHdr tmp;
- bzero(&tmp, sizeof(dir_discHdr));
- tmp.index = headerlist.size();
- tmp.casecolor = 1;
-
- tmp.settings[0] = TITLE_UPPER(chan->title);
- tmp.settings[1] = TITLE_LOWER(chan->title);
- strncpy(tmp.id, chan->id, 4);
- int ccolor = custom_titles.getColor("COVERS", tmp.id, tmp.casecolor).intVal();
-
- wstringEx tmpString;
- string GTitle = custom_titles.getString("TITLES", tmp.id);
- if(GTitle.size() > 0 || (gameTDB.IsLoaded() && gameTDB.GetTitle(tmp.id, GTitle)))
- {
- tmpString.fromUTF8(GTitle.c_str());
- tmp.casecolor = ccolor != 1 ? ccolor : gameTDB.GetCaseColor(tmp.id);
- tmp.wifi = gameTDB.GetWifiPlayers(tmp.id);
- tmp.players = gameTDB.GetPlayers(tmp.id);
- }
- else
- {
- tmpString = chan->name;
- tmp.casecolor = ccolor;
- }
-
- wcsncpy(tmp.title, tmpString.c_str(), 64);
- Asciify(tmp.title);
- //gprintf("Found: %ls\n", tmp.title);
- tmp.type = TYPE_CHANNEL;
- headerlist.push_back(tmp);
- }
-
- if(gameTDB.IsLoaded())
- gameTDB.CloseFile();
-}
-
-template
-void CList::Check_For_ID(char *id, string path, string one, string two)
-{
- memset(id, 0, sizeof(id));
- size_t idstart = path.find_last_of(one);
- size_t idend = path.find_last_of(two);
- if (idend != string::npos && idstart != string::npos && idend - idstart == 7)
- for(u8 pos = 0; pos < 6; pos++)
- id[pos] = toupper(path[idstart + 1 + pos]);
-}
-
-template class CList;
-template class CList;
diff --git a/source/list/list.hpp b/source/list/list.hpp
deleted file mode 100644
index d2e90a44..00000000
--- a/source/list/list.hpp
+++ /dev/null
@@ -1,31 +0,0 @@
-#ifndef CLIST
-#define CLIST
-
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include "cache.hpp"
-#include "config/config.hpp"
-#include "devicemounter/DeviceHandler.hpp"
-#include "gui/text.hpp"
-#include "loader/disc.h"
-#include "loader/wbfs_ext.h"
-#include "libwbfs/libwbfs.h"
-
-template
-class CList
-{
- public:
- CList(){};
- ~CList(){};
- void GetPaths(vector &pathlist, string containing, string directory, bool wbfs_fs = false, bool dml = false, bool depth_limit = true);
- void GetHeaders(vector pathlist, vector &headerlist, string, string, string, Config &plugin);
- void GetChannels(vector &headerlist, string, u32, string);
- private:
- void Check_For_ID(char *id, string path, string one, string two);
-};
-#endif
diff --git a/source/menu/menu.cpp b/source/menu/menu.cpp
index fe7ef3d3..c5a8d26f 100644
--- a/source/menu/menu.cpp
+++ b/source/menu/menu.cpp
@@ -417,11 +417,9 @@ void CMenu::init(void)
m_curLanguage = CMenu::_translations[0];
m_loc.load(fmt("%s/%s.ini", m_languagesDir.c_str(), m_curLanguage.c_str()));
}
- bool extcheck = m_cfg.getBool("GENERAL", "extended_list_check", false);
- bool skipcheck = m_cfg.getBool("GENERAL", "skip_list_check", true);
m_tempView = false;
-
- m_gameList.Init(m_listCacheDir, m_settingsDir, m_loc.getString(m_curLanguage, "gametdb_code", "EN"), m_DMLgameDir, extcheck, skipcheck);
+
+ m_gameList.Init(m_settingsDir, m_loc.getString(m_curLanguage, "gametdb_code", "EN"));
m_aa = 3;
@@ -648,9 +646,9 @@ float CMenu::_getCFFloat(const string &domain, const string &key, float def, boo
void CMenu::_loadCFLayout(int version, bool forceAA, bool otherScrnFmt)
{
bool homebrew = m_current_view == COVERFLOW_HOMEBREW;
- bool smallbox = (homebrew || m_current_view == COVERFLOW_EMU) && m_cfg.getBool(_domainFromView(), "smallbox", true);
- string domain(homebrew ? fmt("_BREWFLOW_%i", version) : m_current_view == COVERFLOW_EMU ? fmt("_EMUFLOW_%i", version) : fmt("_COVERFLOW_%i", version));
- string domainSel(homebrew ? fmt("_BREWFLOW_%i_S", version) : m_current_view == COVERFLOW_EMU ? fmt("_EMUFLOW_%i_S", version) : fmt("_COVERFLOW_%i_S", version));
+ bool smallbox = (homebrew || m_current_view == COVERFLOW_PLUGIN) && m_cfg.getBool(_domainFromView(), "smallbox", true);
+ string domain(homebrew ? fmt("_BREWFLOW_%i", version) : m_current_view == COVERFLOW_PLUGIN ? fmt("_EMUFLOW_%i", version) : fmt("_COVERFLOW_%i", version));
+ string domainSel(homebrew ? fmt("_BREWFLOW_%i_S", version) : m_current_view == COVERFLOW_PLUGIN ? fmt("_EMUFLOW_%i_S", version) : fmt("_COVERFLOW_%i_S", version));
bool sf = otherScrnFmt;
int max_fsaa = m_theme.getInt(domain, "max_fsaa", 3);
@@ -1523,7 +1521,7 @@ void CMenu::_initCF(void)
m_cf.reserve(m_gameList.size());
vector EnabledPlugins;
- if(m_current_view == COVERFLOW_EMU)
+ if(m_current_view == COVERFLOW_PLUGIN)
EnabledPlugins = m_plugin.GetEnabledPlugins(m_cfg);
bool dumpGameLst = m_cfg.getBool(domain, "dump_list", true);
@@ -1548,7 +1546,7 @@ void CMenu::_initCF(void)
// check for single plugin selected
u8 pos = 0;
u8 enabledPluginsCount = 0;
- if(m_current_view == COVERFLOW_EMU && EnabledPlugins.size() != 0)
+ if(m_current_view == COVERFLOW_PLUGIN && EnabledPlugins.size() != 0)
{
char PluginMagicWord[9];
for(u8 i = 0; i < EnabledPlugins.size(); i++)
@@ -2171,10 +2169,11 @@ bool CMenu::_loadChannelList(void)
if(Nand::Instance()->EmulationEnabled() || disable_emu)
{
- m_gameList.LoadChannels(disable_emu ? "" : nandpath, 0, m_cfg.getString("NAND", "lastlanguage", "EN").c_str());
- m_cfg.setString("NAND", "lastlanguage", m_loc.getString(m_curLanguage, "gametdb_code", "EN"));
- m_cfg.save();
- }
+ string cacheDir(fmt("%s/%s_channels.db", m_cacheDir.c_str(), disable_emu ? "nand" : DeviceName[currentPartition]));
+ bool updateCache = disable_emu ? true : m_cfg.getBool(_domainFromView(), "update_cache");
+ m_gameList.CreateList(m_current_view, currentPartition, std::string(),
+ stringToVector(std::string(), '|'), cacheDir, updateCache);
+ }
lastPartition = currentPartition;
last_emu_state = disable_emu;
@@ -2185,7 +2184,6 @@ bool CMenu::_loadChannelList(void)
bool CMenu::_loadList(void)
{
m_cf.clear();
- m_gameList.clear();
if((m_current_view == COVERFLOW_CHANNEL && m_cfg.getBool("NAND", "disable", true))
|| (m_current_view != COVERFLOW_CHANNEL && Nand::Instance()->EmulationEnabled()))
{
@@ -2193,8 +2191,6 @@ bool CMenu::_loadList(void)
Nand::Instance()->Disable_Emu();
_TempLoadIOS(IOS_TYPE_NORMAL_IOS);
}
- if(m_cfg.getBool(_domainFromView(), "update_cache"))
- m_gameList.Update(m_current_view);
gprintf("Switching Views\n");
bool retval;
@@ -2209,7 +2205,7 @@ bool CMenu::_loadList(void)
case COVERFLOW_DML:
retval = _loadDmlList();
break;
- case COVERFLOW_EMU:
+ case COVERFLOW_PLUGIN:
retval = _loadEmuList();
break;
default:
@@ -2224,67 +2220,65 @@ bool CMenu::_loadList(void)
bool CMenu::_loadGameList(void)
{
- currentPartition = m_cfg.getInt("GAMES", "partition", 1);
+ currentPartition = m_cfg.getInt("GAMES", "partition", USB1);
if(!DeviceHandle.IsInserted(currentPartition))
return false;
- Config tmpcfg;
DeviceHandle.OpenWBFS(currentPartition);
- m_gameList.Load(sfmt(GAMES_DIR, DeviceName[currentPartition]), ".wbfs|.iso", m_cfg.getString("GAMES", "lastlanguage", "EN").c_str(), tmpcfg);
- m_cfg.setString("GAMES", "lastlanguage", m_loc.getString(m_curLanguage, "gametdb_code", "EN"));
- m_cfg.save();
+ string gameDir(fmt(GAMES_DIR, DeviceName[currentPartition]));
+ string cacheDir(fmt("%s/%s_wii.db", m_cacheDir.c_str(), DeviceName[currentPartition]));
+ bool updateCache = m_cfg.getBool(_domainFromView(), "update_cache");
+ m_gameList.CreateList(m_current_view, currentPartition, gameDir, stringToVector(".wbfs|.iso", '|'), cacheDir, updateCache);
WBFS_Close();
+
return m_gameList.size() > 0 ? true : false;
}
bool CMenu::_loadHomebrewList()
{
- currentPartition = m_cfg.getInt("HOMEBREW", "partition", DeviceHandle.PathToDriveType(m_appDir.c_str()));
+ currentPartition = m_cfg.getInt("HOMEBREW", "partition", SD);
if(!DeviceHandle.IsInserted(currentPartition))
return false;
- Config tmpcfg;
- m_gameList.Load(sfmt(HOMEBREW_DIR, DeviceName[currentPartition]), ".dol|.elf", m_cfg.getString("HOMEBREW", "lastlanguage", "EN").c_str(), tmpcfg);
- m_cfg.setString("HOMEBREW", "lastlanguage", m_loc.getString(m_curLanguage, "gametdb_code", "EN"));
- m_cfg.save();
+ string gameDir(fmt(HOMEBREW_DIR, DeviceName[currentPartition]));
+ string cacheDir(fmt("%s/%s_homebrew.db", m_cacheDir.c_str(), DeviceName[currentPartition]));
+ bool updateCache = m_cfg.getBool(_domainFromView(), "update_cache");
+ m_gameList.CreateList(m_current_view, currentPartition, gameDir, stringToVector(".dol|.elf", '|'), cacheDir, updateCache);
+
return m_gameList.size() > 0 ? true : false;
}
bool CMenu::_loadDmlList()
{
- currentPartition = m_cfg.getInt("DML", "partition", 0);
+ currentPartition = m_cfg.getInt("DML", "partition", USB1);
if(!DeviceHandle.IsInserted(currentPartition))
return false;
- Config tmpcfg;
- if(currentPartition != SD)
- m_gameList.Load(sfmt(m_DMLgameDir.c_str(), DeviceName[currentPartition]), "boot.bin|.iso", m_cfg.getString("DML", "lastlanguage", "EN").c_str(), tmpcfg);
- else
- m_gameList.Load(sfmt(DML_DIR, DeviceName[currentPartition]), "boot.bin|.iso", m_cfg.getString("DML", "lastlanguage", "EN").c_str(), tmpcfg);
- m_cfg.setString("DML", "lastlanguage", m_loc.getString(m_curLanguage, "gametdb_code", "EN"));
- m_cfg.save();
+ string gameDir(fmt(currentPartition == SD ? DML_DIR : m_DMLgameDir.c_str(), DeviceName[currentPartition]));
+ string cacheDir(fmt("%s/%s_gamecube.db", m_cacheDir.c_str(), DeviceName[currentPartition]));
+ bool updateCache = m_cfg.getBool(_domainFromView(), "update_cache");
+ m_gameList.CreateList(m_current_view, currentPartition, gameDir, stringToVector(".iso", '|'), cacheDir, updateCache);
+
return m_gameList.size() > 0 ? true : false;
}
bool CMenu::_loadEmuList()
{
- currentPartition = m_cfg.getInt("EMULATOR", "partition", 0);
+ currentPartition = m_cfg.getInt("EMULATOR", "partition", SD);
if(!DeviceHandle.IsInserted(currentPartition))
return false;
+ bool updateCache = m_cfg.getBool(_domainFromView(), "update_cache");
DIR *pdir;
struct dirent *pent;
- pdir = opendir(m_pluginsDir.c_str());
-
vector emuList;
Config m_plugin_cfg;
- while ((pent = readdir(pdir)) != NULL)
+ pdir = opendir(m_pluginsDir.c_str());
+ while((pent = readdir(pdir)) != NULL)
{
- // Skip it
- 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)
+ if(strcmp(pent->d_name, ".") == 0 || strcmp(pent->d_name, "..") == 0 || strcasecmp(pent->d_name, "scummvm.ini") == 0)
continue;
if(strcasestr(pent->d_name, ".ini") != NULL)
{
@@ -2292,10 +2286,15 @@ bool CMenu::_loadEmuList()
if(m_plugin_cfg.loaded())
{
m_plugin.AddPlugin(m_plugin_cfg);
- m_gameList.clear();
- if(m_plugin_cfg.getString("PLUGIN","romDir","").find("scummvm.ini") == string::npos)
+ if(m_plugin_cfg.getString(PLUGIN_DOMAIN,"romDir").find("scummvm.ini") == string::npos)
{
- 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(), m_plugin_cfg);
+ string gameDir(fmt("%s:/%s", DeviceName[currentPartition], m_plugin_cfg.getString(PLUGIN_DOMAIN,"romDir").c_str()));
+ string cacheDir(fmt("%s/%s_%s.db", m_cacheDir.c_str(), DeviceName[currentPartition], m_plugin_cfg.getString(PLUGIN_DOMAIN,"magic").c_str()));
+ string FileTypes(m_plugin_cfg.getString(PLUGIN_DOMAIN,"fileTypes"));
+ u32 CaseColor = strtoul(m_plugin_cfg.getString(PLUGIN_DOMAIN,"coverColor").c_str(), NULL, 16);
+ u32 MagicWord = strtoul(m_plugin_cfg.getString(PLUGIN_DOMAIN,"magic").c_str(), NULL, 16);
+ m_gameList.CreateList(m_current_view, currentPartition, gameDir,
+ stringToVector(FileTypes, '|'), cacheDir, updateCache, CaseColor, MagicWord);
for(vector::iterator tmp_itr = m_gameList.begin(); tmp_itr != m_gameList.end(); tmp_itr++)
emuList.push_back(*tmp_itr);
}
@@ -2319,8 +2318,6 @@ bool CMenu::_loadEmuList()
emuList.clear();
//If we return to the coverflow before wiiflow quit we dont need to reload plugins
m_plugin.EndAdd();
- m_cfg.setString("EMULATOR", "lastlanguage", m_loc.getString(m_curLanguage, "gametdb_code", "EN"));
- m_cfg.save();
return m_gameList.size() > 0 ? true : false;
}
@@ -2544,7 +2541,7 @@ const char *CMenu::_domainFromView()
return "HOMEBREW";
case COVERFLOW_DML:
return "DML";
- case COVERFLOW_EMU:
+ case COVERFLOW_PLUGIN:
return "EMULATOR";
default:
return "GAMES";
@@ -2559,7 +2556,7 @@ void CMenu::UpdateCache(u32 view)
UpdateCache(COVERFLOW_USB);
UpdateCache(COVERFLOW_HOMEBREW);
UpdateCache(COVERFLOW_DML);
- UpdateCache(COVERFLOW_EMU);
+ UpdateCache(COVERFLOW_PLUGIN);
UpdateCache(COVERFLOW_CHANNEL);
return;
}
@@ -2576,7 +2573,7 @@ void CMenu::UpdateCache(u32 view)
case COVERFLOW_DML:
domain = "DML";
break;
- case COVERFLOW_EMU:
+ case COVERFLOW_PLUGIN:
domain = "EMULATOR";
break;
default:
diff --git a/source/menu/menu.hpp b/source/menu/menu.hpp
index 60d33881..4c17a188 100644
--- a/source/menu/menu.hpp
+++ b/source/menu/menu.hpp
@@ -17,7 +17,7 @@
#include "gui/cursor.hpp"
#include "gui/fanart.hpp"
#include "gui/gui.hpp"
-#include "list/cachedlist.hpp"
+#include "list/ListGenerator.hpp"
#include "loader/disc.h"
#include "loader/gc_disc_dump.hpp"
#include "loader/wbfs.h"
@@ -56,7 +56,7 @@ private:
CButtonsMgr m_btnMgr;
CCoverFlow m_cf;
CFanart m_fa;
- CachedList m_gameList;
+ ListGenerator m_gameList;
Config m_cfg;
Config m_loc;
Config m_cat;
@@ -976,7 +976,7 @@ private:
vector _searchGamesByType(const char type);
vector _searchGamesByRegion(const char region); */
public:
- void directlaunch(const string &id);
+ void directlaunch(const char *GameID);
private:
bool m_use_wifi_gecko;
void _reload_wifi_gecko();
diff --git a/source/menu/menu_categories.cpp b/source/menu/menu_categories.cpp
index 86bb4e6a..230791e4 100644
--- a/source/menu/menu_categories.cpp
+++ b/source/menu/menu_categories.cpp
@@ -150,7 +150,7 @@ void CMenu::_CategorySettings(bool fromGameSet)
catDomain = _domainFromView();
u8 pos = 0;
vector EnabledPlugins;
- if(m_current_view == COVERFLOW_EMU)
+ if(m_current_view == COVERFLOW_PLUGIN)
{
EnabledPlugins = m_plugin.GetEnabledPlugins(m_cfg);
if(EnabledPlugins.size() != 0)
diff --git a/source/menu/menu_cftheme.cpp b/source/menu/menu_cftheme.cpp
index cf653620..ce0c5ac9 100644
--- a/source/menu/menu_cftheme.cpp
+++ b/source/menu/menu_cftheme.cpp
@@ -554,7 +554,7 @@ const char *CMenu::_cfDomain(bool selected)
{
switch(m_current_view)
{
- case COVERFLOW_EMU:
+ case COVERFLOW_PLUGIN:
return selected ? "_EMUFLOW_%i_S" : "_EMUFLOW_%i";
case COVERFLOW_HOMEBREW:
return selected ? "_BREWFLOW_%i_S" : "_BREWFLOW_%i";
diff --git a/source/menu/menu_config.cpp b/source/menu/menu_config.cpp
index de5c8dc2..349dbc16 100644
--- a/source/menu/menu_config.cpp
+++ b/source/menu/menu_config.cpp
@@ -201,7 +201,7 @@ int CMenu::_config1(void)
_cfNeedsUpdate();
m_cf.stopCoverLoader(true);
_hideConfig();
- if(m_current_view != COVERFLOW_EMU)
+ if(m_current_view != COVERFLOW_PLUGIN)
_NandEmuCfg();
else
_PluginSettings();
@@ -286,7 +286,7 @@ void CMenu::_textConfig(void)
m_btnMgr.setText(m_configBtnSetCode, _t("cfg7", L"Set code"));
m_btnMgr.setText(m_configLblPartitionName, _t("cfgp1", L"Game Partition"));
m_btnMgr.setText(m_configBtnBack, _t("cfg10", L"Back"));
- if(m_current_view != COVERFLOW_EMU)
+ if(m_current_view != COVERFLOW_PLUGIN)
{
m_btnMgr.setText(m_configLblCfg4, _t("cfg13", L"NAND Emulation Settings"));
m_btnMgr.setText(m_configBtnCfg4, _t("cfg14", L"Set"));
diff --git a/source/menu/menu_config_adv.cpp b/source/menu/menu_config_adv.cpp
index 25937a2c..7a7819e7 100644
--- a/source/menu/menu_config_adv.cpp
+++ b/source/menu/menu_config_adv.cpp
@@ -171,8 +171,8 @@ int CMenu::_configAdv(void)
_hideConfigAdv();
if (m_gameList.empty() || lang_changed)
{
- if(lang_changed)
- m_gameList.SetLanguage(m_loc.getString(m_curLanguage, "gametdb_code", "EN").c_str());
+ //if(lang_changed)
+ //m_gameList.SetLanguage(m_loc.getString(m_curLanguage, "gametdb_code", "EN").c_str());
_loadList();
}
diff --git a/source/menu/menu_download.cpp b/source/menu/menu_download.cpp
index 76864156..439eb78e 100644
--- a/source/menu/menu_download.cpp
+++ b/source/menu/menu_download.cpp
@@ -2054,7 +2054,7 @@ int CMenu::_gametdbDownloaderAsync()
remove(offsetspath.c_str());
// Update cache
- m_gameList.SetLanguage(m_loc.getString(m_curLanguage, "gametdb_code", "EN").c_str());
+ //m_gameList.SetLanguage(m_loc.getString(m_curLanguage, "gametdb_code", "EN").c_str());
UpdateCache();
LWP_MutexLock(m_mutex);
diff --git a/source/menu/menu_game.cpp b/source/menu/menu_game.cpp
index 985d2615..8b002a7e 100644
--- a/source/menu/menu_game.cpp
+++ b/source/menu/menu_game.cpp
@@ -571,22 +571,21 @@ void CMenu::_game(bool launch)
!m_devo_installed || min((u32)m_gcfg2.getInt(hdr->id, "gc_loader", 0), ARRAY_SIZE(CMenu::_GCLoader) - 1u) == 1))
{
bool foundOnSD = false;
- CList tmplist;
- vector pathlist;
- tmplist.GetPaths(pathlist, ".iso|.bin", "sd:/games", false, true);
- vector tmpGameList;
- Config nullCfg;
- tmplist.GetHeaders(pathlist, tmpGameList, m_settingsDir, m_curLanguage, m_DMLgameDir, nullCfg);
- for(u8 i = 0; i < tmpGameList.size(); i++)
+ ListGenerator SD_List;
+ string gameDir(fmt(DML_DIR, DeviceName[SD]));
+ string cacheDir(fmt("%s/%s_gamecube.db", m_cacheDir.c_str(), DeviceName[SD]));
+ SD_List.CreateList(COVERFLOW_DML, SD, gameDir, stringToVector(".iso", '|'), cacheDir, false);
+ for(vector::iterator List = SD_List.begin(); List != SD_List.end(); List++)
{
- if(strncasecmp(tmpGameList.at(i).id, hdr->id, 6) == 0)
+ if(strncasecmp(hdr->id, List->id, 6) == 0)
{
foundOnSD = true;
memset(hdr->path, 0, sizeof(hdr->path));
- strncpy(hdr->path, tmpGameList.at(i).path, sizeof(hdr->path));
+ strncpy(hdr->path, List->path, sizeof(hdr->path));
break;
}
}
+ SD_List.clear();
if(!foundOnSD)
{
if(_wbfsOp(CMenu::WO_COPY_GAME))
@@ -749,30 +748,28 @@ void CMenu::_game(bool launch)
_hideGame();
}
-void CMenu::directlaunch(const string &id)
+void CMenu::directlaunch(const char *GameID)
{
m_directLaunch = true;
-
- for (int i = USB1; i < USB8; i++)
+ for(currentPartition = SD; currentPartition < USB8; currentPartition++)
{
- if(!DeviceHandle.IsInserted(i)) continue;
-
- DeviceHandle.OpenWBFS(i);
- CList list;
- string path = sfmt(GAMES_DIR, DeviceName[i]);
- vector pathlist;
- list.GetPaths(pathlist, id.c_str(), path, strncasecmp(DeviceHandle.PathToFSName(path.c_str()), "WBFS", 4) == 0);
- m_gameList.clear();
- Config nullCfg;
- list.GetHeaders(pathlist, m_gameList, m_settingsDir, m_curLanguage, m_DMLgameDir, nullCfg);
- if(m_gameList.size() > 0)
- {
- gprintf("Game found on partition #%i\n", i);
- _launch(&m_gameList[0]); // Launch will exit wiiflow
- }
+ if(!DeviceHandle.IsInserted(currentPartition))
+ continue;
+ DeviceHandle.OpenWBFS(currentPartition);
+ string gameDir(fmt(GAMES_DIR, DeviceName[currentPartition]));
+ string cacheDir(fmt("%s/%s_wii.db", m_cacheDir.c_str(), DeviceName[currentPartition]));
+ m_gameList.CreateList(COVERFLOW_USB, currentPartition, gameDir, stringToVector(".wbfs|.iso", '|'), cacheDir, false);
WBFS_Close();
+ for(u32 i = 0; i < m_gameList.size(); i++)
+ {
+ if(strncasecmp(GameID, m_gameList[i].id, 6) == 0)
+ {
+ _launchGame(&m_gameList[i], false); // Launch will exit wiiflow
+ break;
+ }
+ }
}
- error(sfmt("errgame1", L"Cannot find the game with ID: %s", id.c_str()));
+ error(sfmt("errgame1", L"Cannot find the game with ID: %s", GameID));
}
void CMenu::_launch(dir_discHdr *hdr)
diff --git a/source/menu/menu_home.cpp b/source/menu/menu_home.cpp
index f3b9624f..ce15cc9c 100644
--- a/source/menu/menu_home.cpp
+++ b/source/menu/menu_home.cpp
@@ -48,7 +48,7 @@ bool CMenu::_Home(void)
}
else if(m_btnMgr.selected(m_homeBtnReloadCache))
{
- m_gameList.SetLanguage(m_loc.getString(m_curLanguage, "gametdb_code", "EN").c_str());
+ //m_gameList.SetLanguage(m_loc.getString(m_curLanguage, "gametdb_code", "EN").c_str());
UpdateCache(m_current_view);
LoadView();
break;
diff --git a/source/menu/menu_main.cpp b/source/menu/menu_main.cpp
index ecea1c27..b13d74ec 100644
--- a/source/menu/menu_main.cpp
+++ b/source/menu/menu_main.cpp
@@ -115,7 +115,7 @@ void CMenu::_showMain(void)
case COVERFLOW_HOMEBREW:
m_btnMgr.show(m_mainBtnUsb);
break;
- case COVERFLOW_EMU:
+ case COVERFLOW_PLUGIN:
if (show_homebrew && (parental_homebrew || !m_locked))
m_btnMgr.show(m_mainBtnHomebrew);
else
@@ -168,7 +168,7 @@ void CMenu::_showMain(void)
m_btnMgr.show(m_mainBtnInit2);
m_btnMgr.show(m_mainLblInit);
break;
- case COVERFLOW_EMU:
+ case COVERFLOW_PLUGIN:
m_btnMgr.setText(m_mainLblInit, _t("main5", L"Welcome to WiiFlow. I have not found any plugins. Select partition to select your partition type."), true);
m_btnMgr.show(m_mainBtnInit2);
m_btnMgr.show(m_mainLblInit);
@@ -259,12 +259,12 @@ int CMenu::main(void)
m_gametdb.CloseFile();
}
if(m_Emulator_boot)
- m_current_view = COVERFLOW_EMU;
+ m_current_view = COVERFLOW_PLUGIN;
if(m_cfg.getBool("GENERAL", "update_cache", false))
{
UpdateCache();
- m_gameList.Update();
+ //m_gameList.Update();
}
LoadView();
if(m_cfg.getBool("GENERAL", "startup_menu", false))
@@ -311,7 +311,7 @@ int CMenu::main(void)
else if(BTN_DOWN_PRESSED && (m_show_dml ||m_devo_installed))
m_current_view = COVERFLOW_DML;
else if(BTN_LEFT_PRESSED && show_emu)
- m_current_view = COVERFLOW_EMU;
+ m_current_view = COVERFLOW_PLUGIN;
else if(BTN_RIGHT_PRESSED && show_channel)
m_current_view = COVERFLOW_CHANNEL;
if(lastView == m_current_view)
@@ -346,12 +346,12 @@ int CMenu::main(void)
else if(m_btnMgr.selected(m_mainBtnChannel) || m_btnMgr.selected(m_mainBtnUsb) || m_btnMgr.selected(m_mainBtnDML) || m_btnMgr.selected(m_mainBtnHomebrew) || m_btnMgr.selected(m_mainBtnEmu))
{
if(m_current_view == COVERFLOW_USB)
- m_current_view = (m_show_dml || m_devo_installed) ? COVERFLOW_DML : (show_channel ? COVERFLOW_CHANNEL : (show_emu ? COVERFLOW_EMU : ((show_homebrew && (parental_homebrew || !m_locked)) ? COVERFLOW_HOMEBREW : COVERFLOW_USB)));
+ m_current_view = (m_show_dml || m_devo_installed) ? COVERFLOW_DML : (show_channel ? COVERFLOW_CHANNEL : (show_emu ? COVERFLOW_PLUGIN : ((show_homebrew && (parental_homebrew || !m_locked)) ? COVERFLOW_HOMEBREW : COVERFLOW_USB)));
else if(m_current_view == COVERFLOW_DML)
- m_current_view = show_channel ? COVERFLOW_CHANNEL : ((show_emu ? COVERFLOW_EMU : (show_homebrew && (parental_homebrew || !m_locked)) ? COVERFLOW_HOMEBREW : COVERFLOW_USB));
+ m_current_view = show_channel ? COVERFLOW_CHANNEL : ((show_emu ? COVERFLOW_PLUGIN : (show_homebrew && (parental_homebrew || !m_locked)) ? COVERFLOW_HOMEBREW : COVERFLOW_USB));
else if(m_current_view == COVERFLOW_CHANNEL)
- m_current_view = (show_emu ? COVERFLOW_EMU : (show_homebrew && (parental_homebrew || !m_locked)) ? COVERFLOW_HOMEBREW : COVERFLOW_USB);
- else if(m_current_view == COVERFLOW_EMU)
+ m_current_view = (show_emu ? COVERFLOW_PLUGIN : (show_homebrew && (parental_homebrew || !m_locked)) ? COVERFLOW_HOMEBREW : COVERFLOW_USB);
+ else if(m_current_view == COVERFLOW_PLUGIN)
m_current_view = (show_homebrew && (parental_homebrew || !m_locked)) ? COVERFLOW_HOMEBREW : COVERFLOW_USB;
else if(m_current_view == COVERFLOW_HOMEBREW)
m_current_view = COVERFLOW_USB;
@@ -651,7 +651,7 @@ int CMenu::main(void)
u8 limiter = 0;
currentPartition = loopNum(currentPartition + 1, (int)USB8);
while(!DeviceHandle.IsInserted(currentPartition) ||
- ((m_current_view == COVERFLOW_CHANNEL || m_current_view == COVERFLOW_EMU) && (DeviceHandle.GetFSType(currentPartition) != PART_FS_FAT ||
+ ((m_current_view == COVERFLOW_CHANNEL || m_current_view == COVERFLOW_PLUGIN) && (DeviceHandle.GetFSType(currentPartition) != PART_FS_FAT ||
(!isD2XnewerThanV6 && DeviceHandle.PathToDriveType(m_appDir.c_str()) == currentPartition) ||
(!isD2XnewerThanV6 && DeviceHandle.PathToDriveType(m_dataDir.c_str()) == currentPartition))) ||
((m_current_view == COVERFLOW_HOMEBREW || m_current_view == COVERFLOW_DML) && DeviceHandle.GetFSType(currentPartition) == PART_FS_WBFS))
@@ -761,7 +761,7 @@ int CMenu::main(void)
else
m_btnMgr.show(m_mainBtnUsb);
break;
- case COVERFLOW_EMU:
+ case COVERFLOW_PLUGIN:
if(show_homebrew && (parental_homebrew || !m_locked))
m_btnMgr.show(m_mainBtnHomebrew);
else
diff --git a/source/menu/menu_nandemu.cpp b/source/menu/menu_nandemu.cpp
index 022a7601..915bb74d 100644
--- a/source/menu/menu_nandemu.cpp
+++ b/source/menu/menu_nandemu.cpp
@@ -1,3 +1,5 @@
+#include
+#include
#include "menu.hpp"
#include "defines.h"
diff --git a/source/menu/menu_source.cpp b/source/menu/menu_source.cpp
index 44d848d2..5fec5952 100644
--- a/source/menu/menu_source.cpp
+++ b/source/menu/menu_source.cpp
@@ -1,3 +1,6 @@
+#include
+#include
+
#include "menu.hpp"
#include "defines.h"
@@ -253,7 +256,7 @@ bool CMenu::_Source()
if (!show_emu) _showSourceNotice();
else
{
- m_current_view = COVERFLOW_EMU;
+ m_current_view = COVERFLOW_PLUGIN;
break;
}
}
@@ -316,7 +319,7 @@ bool CMenu::_Source()
if (!show_emu) _showSourceNotice();
else
{
- m_current_view = COVERFLOW_EMU;
+ m_current_view = COVERFLOW_PLUGIN;
imgSelected = true;
for (u8 j = 0; j < numPlugins; ++j)
@@ -332,7 +335,7 @@ bool CMenu::_Source()
_showSourceNotice();
else
{
- m_current_view = COVERFLOW_EMU;
+ m_current_view = COVERFLOW_PLUGIN;
imgSelected = true;
u32 sourceMagic = strtoul(m_source.getString(fmt("BUTTON_%i", i + j), "magic","").c_str(), NULL, 16);
for (u8 k = 0; k < numPlugins; ++k)
diff --git a/source/menu/menu_wbfs.cpp b/source/menu/menu_wbfs.cpp
index b9312911..63ff3f97 100644
--- a/source/menu/menu_wbfs.cpp
+++ b/source/menu/menu_wbfs.cpp
@@ -470,7 +470,7 @@ bool CMenu::_wbfsOp(CMenu::WBFS_OP op)
_hideWBFS();
if (done && (op == CMenu::WO_REMOVE_GAME || op == CMenu::WO_ADD_GAME))
{
- m_gameList.SetLanguage(m_loc.getString(m_curLanguage, "gametdb_code", "EN").c_str());
+ //m_gameList.SetLanguage(m_loc.getString(m_curLanguage, "gametdb_code", "EN").c_str());
if(upd_dml)
UpdateCache(COVERFLOW_DML);
@@ -479,7 +479,7 @@ bool CMenu::_wbfsOp(CMenu::WBFS_OP op)
UpdateCache(COVERFLOW_USB);
if(upd_emu)
- UpdateCache(COVERFLOW_EMU);
+ UpdateCache(COVERFLOW_PLUGIN);
_loadList();
_initCF();
@@ -487,7 +487,7 @@ bool CMenu::_wbfsOp(CMenu::WBFS_OP op)
}
else if(done && op == CMenu::WO_COPY_GAME)
{
- m_gameList.SetLanguage(m_loc.getString(m_curLanguage, "gametdb_code", "EN").c_str());
+ //m_gameList.SetLanguage(m_loc.getString(m_curLanguage, "gametdb_code", "EN").c_str());
if(upd_dml)
{
UpdateCache(COVERFLOW_DML);
diff --git a/source/types.h b/source/types.h
index a13c89b1..345529ce 100644
--- a/source/types.h
+++ b/source/types.h
@@ -6,6 +6,15 @@
extern "C" {
#endif
+enum {
+ COVERFLOW_USB = 0,
+ COVERFLOW_DML,
+ COVERFLOW_CHANNEL,
+ COVERFLOW_PLUGIN,
+ COVERFLOW_HOMEBREW,
+ COVERFLOW_MAX
+};
+
enum
{
TYPE_WII_DISC = 0,