mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-11-27 13:44:15 +01:00
Merge pull request #278 from eku/feature/multi_disc_support
Support for exclusion of certain multi disc/tape files
This commit is contained in:
commit
26b467b665
@ -16,6 +16,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <regex>
|
||||||
#include "ListGenerator.hpp"
|
#include "ListGenerator.hpp"
|
||||||
#include "cache.hpp"
|
#include "cache.hpp"
|
||||||
#include "channel/channels.h"
|
#include "channel/channels.h"
|
||||||
@ -32,8 +33,10 @@ GameTDB gameTDB;
|
|||||||
Config romNamesDB;
|
Config romNamesDB;
|
||||||
string platformName;
|
string platformName;
|
||||||
string pluginsDataDir;
|
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)
|
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(Language != NULL) gameTDB_Language = Language;
|
||||||
if(plgnsDataDir != NULL) pluginsDataDir = fmt("%s", plgnsDataDir);
|
if(plgnsDataDir != NULL) pluginsDataDir = fmt("%s", plgnsDataDir);
|
||||||
|
|
||||||
|
fileNameSkipRegex = std::regex(fileNameSkipPattern,
|
||||||
|
std::regex_constants::extended |
|
||||||
|
std::regex_constants::icase);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ListGenerator::Clear(void)
|
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 */
|
/* Get roms's title without the extra ()'s or []'s */
|
||||||
string ShortName = m_plugin.GetRomName(FullPath);
|
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 */
|
/* only add disc 1 of multi disc games */
|
||||||
const char *RomFilename = strrchr(FullPath, '/') + 1;
|
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;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* get rom's ID */
|
/* get rom's ID */
|
||||||
string romID = "";
|
string romID = "";
|
||||||
|
@ -29,11 +29,15 @@
|
|||||||
#include "gui/GameTDB.hpp"
|
#include "gui/GameTDB.hpp"
|
||||||
#include "plugin/plugin.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>
|
class ListGenerator : public std::vector<dir_discHdr>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void createSFList(u8 maxBtns, Config &m_sourceMenuCfg, const string& sourceDir);
|
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 Clear();
|
||||||
void ParseScummvmINI(Config &ini, const char *Device, const char *datadir, const char *platform, const string& DBName, bool UpdateCache);
|
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);
|
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 */
|
/* 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 */
|
/* Init the onscreen pointer */
|
||||||
m_aa = 3;
|
m_aa = 3;
|
||||||
|
@ -174,7 +174,8 @@ int CMenu::_configAdv(void)
|
|||||||
_hideConfigAdv();
|
_hideConfigAdv();
|
||||||
if(m_curLanguage != prevLanguage)
|
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_deleteFolder(m_listCacheDir.c_str());// delete cache lists folder and remake it so all lists update.
|
||||||
fsop_MakeFolder(m_listCacheDir.c_str());
|
fsop_MakeFolder(m_listCacheDir.c_str());
|
||||||
m_refreshGameList = true;
|
m_refreshGameList = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user