mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-11-01 00:55:06 +01:00
-moved create sourceflow list to listgenerator and rewrote the code a little to include a sourceflow.db list cache file. may speed up loading sourceflow.
This commit is contained in:
parent
abcd42885b
commit
070612c161
@ -332,3 +332,51 @@ void GetFiles(const char *Path, const vector<string>& FileTypes,
|
|||||||
GetFiles(p->c_str(), FileTypes, AddFile, CompareFolders, max_depth, depth + 1);
|
GetFiles(p->c_str(), FileTypes, AddFile, CompareFolders, max_depth, depth + 1);
|
||||||
SubPaths.clear();
|
SubPaths.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ListGenerator::createSFList(u8 maxBtns, Config &m_sourceMenuCfg, bool show_homebrew, bool show_channel, bool show_plugin, bool show_gc,
|
||||||
|
const string& sourceDir, const string& DBName, bool UpdateCache)
|
||||||
|
{
|
||||||
|
if(!DBName.empty())
|
||||||
|
{
|
||||||
|
if(UpdateCache)
|
||||||
|
fsop_deleteFile(DBName.c_str());
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CCache(*this, DBName, LOAD);
|
||||||
|
if(!this->empty())
|
||||||
|
return;
|
||||||
|
fsop_deleteFile(DBName.c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
char btn_selected[256];
|
||||||
|
for(u8 i = 0; i < maxBtns; i++)
|
||||||
|
{
|
||||||
|
memset(btn_selected, 0, 256);
|
||||||
|
strncpy(btn_selected, fmt("BUTTON_%i", i), 255);
|
||||||
|
string source = m_sourceMenuCfg.getString(btn_selected, "source","");
|
||||||
|
if(source == "")
|
||||||
|
continue;
|
||||||
|
if(source == "dml" && !show_gc)
|
||||||
|
continue;
|
||||||
|
else if(source == "emunand" && !show_channel)
|
||||||
|
continue;
|
||||||
|
else if(source == "homebrew" && (!show_homebrew))
|
||||||
|
continue;
|
||||||
|
else if((source == "plugin" || source == "allplugins") && !show_plugin)
|
||||||
|
continue;
|
||||||
|
const char *path = fmt("%s/%s", sourceDir.c_str(), m_sourceMenuCfg.getString(btn_selected, "image", "").c_str());
|
||||||
|
memset((void*)&ListElement, 0, sizeof(dir_discHdr));
|
||||||
|
ListElement.index = m_gameList.size();
|
||||||
|
strncpy(ListElement.id, "SOURCE", 6);
|
||||||
|
strncpy(ListElement.path, path, sizeof(ListElement.path) - 1);
|
||||||
|
ListElement.casecolor = 0xFFFFFF;
|
||||||
|
ListElement.type = TYPE_SOURCE;
|
||||||
|
ListElement.settings[0] = i;
|
||||||
|
const char *title = m_sourceMenuCfg.getString(btn_selected, "title", fmt("title_%i", i)).c_str();
|
||||||
|
mbstowcs(ListElement.title, title, 63);
|
||||||
|
Asciify(ListElement.title);
|
||||||
|
m_gameList.push_back(ListElement);
|
||||||
|
}
|
||||||
|
if(!this->empty() && !DBName.empty()) /* Write a new Cache */
|
||||||
|
CCache(*this, DBName, SAVE);
|
||||||
|
}
|
@ -1,53 +1,55 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Copyright (C) 2012 FIX94
|
* Copyright (C) 2012 FIX94
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#ifndef _LISTGENERATOR_HPP_
|
#ifndef _LISTGENERATOR_HPP_
|
||||||
#define _LISTGENERATOR_HPP_
|
#define _LISTGENERATOR_HPP_
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "config/config.hpp"
|
#include "config/config.hpp"
|
||||||
#include "loader/wbfs.h"
|
#include "loader/wbfs.h"
|
||||||
#include "loader/disc.h"
|
#include "loader/disc.h"
|
||||||
#include "gui/GameTDB.hpp"
|
#include "gui/GameTDB.hpp"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
class ListGenerator : public vector<dir_discHdr>
|
class ListGenerator : public vector<dir_discHdr>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void Init(const char *settingsDir, const char *Language);
|
void createSFList(u8 maxBtns, Config &m_sourceMenuCfg, bool show_homebrew, bool show_channel, bool show_plugin, bool show_gc, const string& sourceDir,
|
||||||
void CreateList(u32 Flow, u32 Device, const string& Path, const vector<string>& FileTypes,
|
const string& DBName, bool UpdateCache);
|
||||||
const string& DBName, bool UpdateCache);
|
void Init(const char *settingsDir, const char *Language);
|
||||||
u32 Color;
|
void CreateList(u32 Flow, u32 Device, const string& Path, const vector<string>& FileTypes,
|
||||||
u32 Magic;
|
const string& DBName, bool UpdateCache);
|
||||||
private:
|
u32 Color;
|
||||||
void OpenConfigs();
|
u32 Magic;
|
||||||
void CloseConfigs();
|
private:
|
||||||
string gameTDB_Path;
|
void OpenConfigs();
|
||||||
string CustomTitlesPath;
|
void CloseConfigs();
|
||||||
string gameTDB_Language;
|
string gameTDB_Path;
|
||||||
};
|
string CustomTitlesPath;
|
||||||
|
string gameTDB_Language;
|
||||||
typedef void (*FileAdder)(char *Path);
|
};
|
||||||
void GetFiles(const char *Path, const vector<string>& FileTypes,
|
|
||||||
FileAdder AddFile, bool CompareFolders, u32 max_depth = 2, u32 depth = 1);
|
typedef void (*FileAdder)(char *Path);
|
||||||
extern ListGenerator m_gameList;
|
void GetFiles(const char *Path, const vector<string>& FileTypes,
|
||||||
|
FileAdder AddFile, bool CompareFolders, u32 max_depth = 2, u32 depth = 1);
|
||||||
#endif /*_LISTGENERATOR_HPP_*/
|
extern ListGenerator m_gameList;
|
||||||
|
|
||||||
|
#endif /*_LISTGENERATOR_HPP_*/
|
||||||
|
@ -2236,7 +2236,7 @@ bool CMenu::_loadGamecubeList()
|
|||||||
string gameDir(fmt(gc_games_dir, DeviceName[currentPartition]));
|
string gameDir(fmt(gc_games_dir, DeviceName[currentPartition]));
|
||||||
string cacheDir(fmt("%s/%s_gamecube.db", m_listCacheDir.c_str(), DeviceName[currentPartition]));
|
string cacheDir(fmt("%s/%s_gamecube.db", m_listCacheDir.c_str(), DeviceName[currentPartition]));
|
||||||
bool updateCache = m_cfg.getBool(GC_DOMAIN, "update_cache");
|
bool updateCache = m_cfg.getBool(GC_DOMAIN, "update_cache");
|
||||||
m_gameList.CreateList(COVERFLOW_GAMECUBE, currentPartition, gameDir, stringToVector(".iso|root", '|'),cacheDir, updateCache);
|
m_gameList.CreateList(COVERFLOW_GAMECUBE, currentPartition, gameDir, stringToVector(".iso|root", '|'), cacheDir, updateCache);
|
||||||
m_cfg.remove(GC_DOMAIN, "update_cache");
|
m_cfg.remove(GC_DOMAIN, "update_cache");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1061,7 +1061,6 @@ private:
|
|||||||
bool _Boot();
|
bool _Boot();
|
||||||
void _Paths();
|
void _Paths();
|
||||||
void _sourceFlow();
|
void _sourceFlow();
|
||||||
void _createSFList();
|
|
||||||
void _mainLoopCommon(bool withCF = false, bool adjusting = false);
|
void _mainLoopCommon(bool withCF = false, bool adjusting = false);
|
||||||
public:
|
public:
|
||||||
void directlaunch(const char *GameID);
|
void directlaunch(const char *GameID);
|
||||||
|
@ -172,7 +172,14 @@ void CMenu::LoadView(void)
|
|||||||
if(m_cfg.getBool("GENERAL", "save_favorites_mode", false))
|
if(m_cfg.getBool("GENERAL", "save_favorites_mode", false))
|
||||||
m_favorites = m_cfg.getBool(_domainFromView(), "favorites", false);
|
m_favorites = m_cfg.getBool(_domainFromView(), "favorites", false);
|
||||||
if(m_sourceflow)
|
if(m_sourceflow)
|
||||||
_createSFList();
|
{
|
||||||
|
m_gameList.clear();
|
||||||
|
string cacheDir(fmt("%s/sourceflow.db", m_listCacheDir.c_str()));
|
||||||
|
bool updateCache = m_cfg.getBool("SOURCEFLOW", "update_cache");
|
||||||
|
u8 maxBtns = m_cfg.getInt("GENERAL", "max_source_buttons", 71);
|
||||||
|
m_gameList.createSFList(maxBtns, m_source, show_homebrew, show_channel, show_plugin, show_gamecube, m_sourceDir, cacheDir, updateCache);
|
||||||
|
m_cfg.remove("SOURCEFLOW", "update_cache");
|
||||||
|
}
|
||||||
else
|
else
|
||||||
_loadList();
|
_loadList();
|
||||||
|
|
||||||
|
@ -180,44 +180,6 @@ void CMenu::_showSourceNotice(void)
|
|||||||
exitSource = false;
|
exitSource = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
dir_discHdr sourceList;
|
|
||||||
void CMenu::_createSFList()
|
|
||||||
{
|
|
||||||
bool show_homebrew = !m_cfg.getBool(HOMEBREW_DOMAIN, "disable", false);
|
|
||||||
bool show_channel = !m_cfg.getBool("GENERAL", "hidechannel", false);
|
|
||||||
bool show_emu = !m_cfg.getBool(PLUGIN_DOMAIN, "disable", false);
|
|
||||||
bool parental_homebrew = m_cfg.getBool(HOMEBREW_DOMAIN, "parental", false);
|
|
||||||
m_gameList.clear();
|
|
||||||
for(u8 i = 0; i < m_cfg.getInt("GENERAL", "max_source_buttons", 71); i++)
|
|
||||||
{
|
|
||||||
memset(btn_selected, 0, 256);
|
|
||||||
strncpy(btn_selected, fmt("BUTTON_%i", i), 255);
|
|
||||||
string source = m_source.getString(btn_selected, "source","");
|
|
||||||
if(source == "")
|
|
||||||
continue;
|
|
||||||
if(source == "dml" && !m_show_gc)
|
|
||||||
continue;
|
|
||||||
else if(source == "emunand" && !show_channel)
|
|
||||||
continue;
|
|
||||||
else if(source == "homebrew" && (!show_homebrew || (!parental_homebrew && m_locked)))
|
|
||||||
continue;
|
|
||||||
else if((source == "plugin" || source == "allplugins") && !show_emu)
|
|
||||||
continue;
|
|
||||||
const char *path = fmt("%s/%s", m_sourceDir.c_str(), m_source.getString(btn_selected, "image", "").c_str());
|
|
||||||
memset((void*)&sourceList, 0, sizeof(dir_discHdr));
|
|
||||||
sourceList.index = m_gameList.size();
|
|
||||||
strncpy(sourceList.id, "SOURCE", 6);
|
|
||||||
strncpy(sourceList.path, path, sizeof(sourceList.path) - 1);
|
|
||||||
sourceList.casecolor = 0xFFFFFF;
|
|
||||||
sourceList.type = TYPE_SOURCE;
|
|
||||||
sourceList.settings[0] = i;
|
|
||||||
const char *title = m_source.getString(btn_selected, "title", fmt("title_%i", i)).c_str();
|
|
||||||
mbstowcs(sourceList.title, title, 63);
|
|
||||||
Asciify(sourceList.title);
|
|
||||||
m_gameList.push_back(sourceList);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CMenu::_sourceFlow()
|
void CMenu::_sourceFlow()
|
||||||
{
|
{
|
||||||
u8 k;
|
u8 k;
|
||||||
|
Loading…
Reference in New Issue
Block a user