mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-11-01 00:55:06 +01:00
With the new setting filename_skip_regex, which
contains a regular expression, files can be excluded from the games list again. A typical use case is the exclusion of all disks except the first one in multidisk games.
This commit is contained in:
parent
3b1fdf06bd
commit
a768c2a76a
@ -16,6 +16,7 @@
|
||||
****************************************************************************/
|
||||
#include <dirent.h>
|
||||
#include <unistd.h>
|
||||
#include <regex>
|
||||
#include "ListGenerator.hpp"
|
||||
#include "cache.hpp"
|
||||
#include "channel/channels.h"
|
||||
@ -32,8 +33,10 @@ GameTDB gameTDB;
|
||||
Config romNamesDB;
|
||||
string platformName;
|
||||
string pluginsDataDir;
|
||||
std::regex fileNameSkipRegex;
|
||||
|
||||
void ListGenerator::Init(const char *settingsDir, const char *Language, const char *plgnsDataDir)
|
||||
void ListGenerator::Init(const char *settingsDir, const char *Language,
|
||||
const char *plgnsDataDir, const std::string& fileNameSkipPattern)
|
||||
{
|
||||
if(settingsDir != NULL)
|
||||
{
|
||||
@ -42,6 +45,10 @@ void ListGenerator::Init(const char *settingsDir, const char *Language, const ch
|
||||
}
|
||||
if(Language != NULL) gameTDB_Language = Language;
|
||||
if(plgnsDataDir != NULL) pluginsDataDir = fmt("%s", plgnsDataDir);
|
||||
|
||||
fileNameSkipRegex = std::regex(fileNameSkipPattern,
|
||||
std::regex_constants::extended |
|
||||
std::regex_constants::icase);
|
||||
}
|
||||
|
||||
void ListGenerator::Clear(void)
|
||||
@ -253,12 +260,16 @@ static void Add_Plugin_Game(char *FullPath)
|
||||
{
|
||||
/* Get roms's title without the extra ()'s or []'s */
|
||||
string ShortName = m_plugin.GetRomName(FullPath);
|
||||
//gprintf("fullName=%s, shortName=%s\n", FullPath, ShortName.c_str());
|
||||
//gprintf("Add_Plugin_Game: fullName=%s, shortName=%s\n", FullPath, ShortName.c_str());
|
||||
|
||||
/* only add disc 1 of multi disc games */
|
||||
const char *RomFilename = strrchr(FullPath, '/') + 1;
|
||||
if((strstr(RomFilename, "disc") != NULL || strstr(RomFilename, "disk") != NULL) && strstr(RomFilename, ".d1") == NULL)
|
||||
|
||||
if (std::regex_search(std::string(FullPath), fileNameSkipRegex))
|
||||
{
|
||||
//gprintf("Add_Plugin_Game: skipping '%s'\n", FullPath);
|
||||
return;
|
||||
}
|
||||
|
||||
/* get rom's ID */
|
||||
string romID = "";
|
||||
|
@ -29,11 +29,15 @@
|
||||
#include "gui/GameTDB.hpp"
|
||||
#include "plugin/plugin.hpp"
|
||||
|
||||
#define CONFIG_FILENAME_SKIP_DOMAIN "PLUGINS"
|
||||
#define CONFIG_FILENAME_SKIP_KEY "filename_skip_regex"
|
||||
#define CONFIG_FILENAME_SKIP_DEFAULT "((dis[ck]|tape|side|track)[ _-]?[b-z2-9])"
|
||||
|
||||
class ListGenerator : public std::vector<dir_discHdr>
|
||||
{
|
||||
public:
|
||||
void createSFList(u8 maxBtns, Config &m_sourceMenuCfg, const string& sourceDir);
|
||||
void Init(const char *settingsDir, const char *Language, const char *plgnsDataDir);
|
||||
void Init(const char *settingsDir, const char *Language, const char *plgnsDataDir, const std::string& fileNameSkipPattern);
|
||||
void Clear();
|
||||
void ParseScummvmINI(Config &ini, const char *Device, const char *datadir, const char *platform, const string& DBName, bool UpdateCache);
|
||||
void CreateRomList(Config &platform_cfg, const string& romsDir, const vector<string>& FileTypes, const string& DBName, bool UpdateCache);
|
||||
|
@ -407,7 +407,8 @@ bool CMenu::init(bool usb_mounted)
|
||||
}
|
||||
|
||||
/* Init gametdb and custom titles for game list making */
|
||||
m_cacheList.Init(m_settingsDir.c_str(), m_loc.getString(m_curLanguage, "gametdb_code", "EN").c_str(), m_pluginDataDir.c_str());
|
||||
m_cacheList.Init(m_settingsDir.c_str(), m_loc.getString(m_curLanguage, "gametdb_code", "EN").c_str(), m_pluginDataDir.c_str(),
|
||||
m_cfg.getString(CONFIG_FILENAME_SKIP_DOMAIN,CONFIG_FILENAME_SKIP_KEY,CONFIG_FILENAME_SKIP_DEFAULT));
|
||||
|
||||
/* Init the onscreen pointer */
|
||||
m_aa = 3;
|
||||
|
@ -174,7 +174,8 @@ int CMenu::_configAdv(void)
|
||||
_hideConfigAdv();
|
||||
if(m_curLanguage != prevLanguage)
|
||||
{
|
||||
m_cacheList.Init(m_settingsDir.c_str(), m_loc.getString(m_curLanguage, "gametdb_code", "EN").c_str(), m_pluginDataDir.c_str());
|
||||
m_cacheList.Init(m_settingsDir.c_str(), m_loc.getString(m_curLanguage, "gametdb_code", "EN").c_str(), m_pluginDataDir.c_str(),
|
||||
m_cfg.getString(CONFIG_FILENAME_SKIP_DOMAIN,CONFIG_FILENAME_SKIP_KEY,CONFIG_FILENAME_SKIP_DEFAULT));
|
||||
fsop_deleteFolder(m_listCacheDir.c_str());// delete cache lists folder and remake it so all lists update.
|
||||
fsop_MakeFolder(m_listCacheDir.c_str());
|
||||
m_refreshGameList = true;
|
||||
|
Loading…
Reference in New Issue
Block a user