- fixed sorting covers.

- added sorting by year released for all games. requires 'Reload Cache'.
- added playcount and lastplayed for plugin games.

B+PLUS to set sorting type (alphabet, playcount, lastplayed, players, and year. wifiplayers for wii games and game ID (1st letter) for VC games).
B+up/down to next/prev sorted item.
B on next/prev icons to next/prev sorted item.
This commit is contained in:
Fledge68 2023-01-20 17:53:52 -06:00
parent 2826ec575e
commit 363caf4794
11 changed files with 229 additions and 94 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 MiB

After

Width:  |  Height:  |  Size: 4.4 MiB

View File

@ -1916,6 +1916,12 @@ bool CCoverFlow::_sortByBtnNumbers(CItem item1, CItem item2)
return item1.hdr->settings[0] < item2.hdr->settings[0]; return item1.hdr->settings[0] < item2.hdr->settings[0];
} }
bool CCoverFlow::_sortByYear(CItem item1, CItem item2)
{
if(item1.hdr->year == item2.hdr->year) return _sortByAlpha(item1, item2);
return item1.hdr->year < item2.hdr->year;
}
bool CCoverFlow::start(const string &m_imgsDir) bool CCoverFlow::start(const string &m_imgsDir)
{ {
if (m_items.empty()) return true; if (m_items.empty()) return true;
@ -1935,6 +1941,8 @@ bool CCoverFlow::start(const string &m_imgsDir)
sort(m_items.begin(), m_items.end(), CCoverFlow::_sortByWifiPlayers); sort(m_items.begin(), m_items.end(), CCoverFlow::_sortByWifiPlayers);
else if (m_sorting == SORT_BTN_NUMBERS) else if (m_sorting == SORT_BTN_NUMBERS)
sort(m_items.begin(), m_items.end(), CCoverFlow::_sortByBtnNumbers); sort(m_items.begin(), m_items.end(), CCoverFlow::_sortByBtnNumbers);
else if (m_sorting == SORT_YEAR)
sort(m_items.begin(), m_items.end(), CCoverFlow::_sortByYear);
/* load the colored skin/spine images if not already done */ /* load the colored skin/spine images if not already done */
if(!m_dvdskin_loaded) if(!m_dvdskin_loaded)
@ -2280,7 +2288,7 @@ void CCoverFlow::_completeJump(void)
void CCoverFlow::nextLetter(wchar_t *c) void CCoverFlow::nextLetter(wchar_t *c)
{ {
if (m_covers == NULL || m_sorting == SORT_BTN_NUMBERS) if (m_covers == NULL)
{ {
c[0] = L'\0'; c[0] = L'\0';
return; return;
@ -2292,6 +2300,9 @@ void CCoverFlow::nextLetter(wchar_t *c)
if (m_sorting == SORT_GAMEID) if (m_sorting == SORT_GAMEID)
return nextID(c); return nextID(c);
if (m_sorting == SORT_YEAR)
return nextYear(c);
LockMutex lock(m_mutex); LockMutex lock(m_mutex);
u32 i, j = 0, k = 0, n = m_items.size(); u32 i, j = 0, k = 0, n = m_items.size();
@ -2319,7 +2330,7 @@ void CCoverFlow::nextLetter(wchar_t *c)
void CCoverFlow::prevLetter(wchar_t *c) void CCoverFlow::prevLetter(wchar_t *c)
{ {
if (m_covers == NULL || m_sorting == SORT_BTN_NUMBERS) if (m_covers == NULL)
{ {
c[0] = L'\0'; c[0] = L'\0';
return; return;
@ -2330,6 +2341,9 @@ void CCoverFlow::prevLetter(wchar_t *c)
if (m_sorting == SORT_GAMEID) if (m_sorting == SORT_GAMEID)
return prevID(c); return prevID(c);
if (m_sorting == SORT_YEAR)
return prevYear(c);
LockMutex lock(m_mutex); LockMutex lock(m_mutex);
u32 i, j = 0, k = 0, n = m_items.size(); u32 i, j = 0, k = 0, n = m_items.size();
@ -2371,6 +2385,63 @@ void CCoverFlow::prevLetter(wchar_t *c)
_updateAllTargets(); _updateAllTargets();
} }
void CCoverFlow::nextYear(wchar_t *c)
{
LockMutex lock(m_mutex);
u32 i, n = m_items.size();
_completeJump();
u32 curPos = _currentPos();
int year = m_items[curPos].hdr->year;
for (i = 1; i < n; ++i)
if (m_items[loopNum(curPos + i, n)].hdr->year != year)
break;
if (i < n)
{
_setJump(i);
year = m_items[loopNum(curPos + i, n)].hdr->year;
}
char y[5] = {0 ,0 ,0 ,0, 0};
itoa(year, y, 10);
mbstowcs(c, y, strlen(y));
_updateAllTargets();
}
void CCoverFlow::prevYear(wchar_t *c)
{
LockMutex lock(m_mutex);
u32 i, n = m_items.size();
_completeJump();
u32 curPos = _currentPos();
int year = m_items[curPos].hdr->year;
for (i = 1; i < n; ++i)
if (m_items[loopNum(curPos - i, n)].hdr->year != year)
{
year = m_items[loopNum(curPos - i, n)].hdr->year;
while(i < n && (m_items[loopNum(curPos - i, n)].hdr->year == year)) ++i;
i--;
break;
}
if (i < n)
{
_setJump(-i);
year = m_items[loopNum(curPos - i, n)].hdr->year;
}
char y[5] = {0 ,0 ,0 ,0, 0};
itoa(year, y, 10);
mbstowcs(c, y, strlen(y));
_updateAllTargets();
}
void CCoverFlow::nextPlayers(bool wifi, wchar_t *c) void CCoverFlow::nextPlayers(bool wifi, wchar_t *c)
{ {
LockMutex lock(m_mutex); LockMutex lock(m_mutex);
@ -2390,8 +2461,8 @@ void CCoverFlow::nextPlayers(bool wifi, wchar_t *c)
players = wifi ? m_items[loopNum(curPos + i, n)].hdr->wifi : m_items[loopNum(curPos + i, n)].hdr->players; players = wifi ? m_items[loopNum(curPos + i, n)].hdr->wifi : m_items[loopNum(curPos + i, n)].hdr->players;
} }
char p[4] = {0 ,0 ,0 ,0}; char p[2] = {0 ,0};
sprintf(p, "%d", players); itoa(players, p, 10);
mbstowcs(c, p, strlen(p)); mbstowcs(c, p, strlen(p));
_updateAllTargets(); _updateAllTargets();
@ -2421,8 +2492,8 @@ void CCoverFlow::prevPlayers(bool wifi, wchar_t *c)
players = wifi ? m_items[loopNum(curPos - i, n)].hdr->wifi : m_items[loopNum(curPos - i, n)].hdr->players; players = wifi ? m_items[loopNum(curPos - i, n)].hdr->wifi : m_items[loopNum(curPos - i, n)].hdr->players;
} }
char p[4] = {0 ,0 ,0 ,0}; char p[2] = {0 ,0};
sprintf(p, "%d", players); itoa(players, p, 10);
mbstowcs(c, p, strlen(p)); mbstowcs(c, p, strlen(p));
_updateAllTargets(); _updateAllTargets();
@ -2447,7 +2518,8 @@ void CCoverFlow::nextID(wchar_t *c)
system = m_items[loopNum(curPos + i, n)].hdr->id; system = m_items[loopNum(curPos + i, n)].hdr->id;
} }
system[1] = '\0'; system[1] = '\0';// wouldn't this ruin the 4 or 6 digit ID for m_items since system is a pointer?
// the above isn't really needed for mbstowcs which copies only 1 character and c[1] is already 0
mbstowcs(c, system, 1); mbstowcs(c, system, 1);
_updateAllTargets(); _updateAllTargets();

View File

@ -23,14 +23,13 @@ using std::max;
enum Sorting enum Sorting
{ {
SORT_ALPHA, SORT_ALPHA,
SORT_YEAR,
SORT_PLAYCOUNT, SORT_PLAYCOUNT,
SORT_LASTPLAYED, SORT_LASTPLAYED,
SORT_GAMEID, SORT_GAMEID,
SORT_WIFIPLAYERS, SORT_WIFIPLAYERS,
SORT_PLAYERS, SORT_PLAYERS,
SORT_MAX, SORT_MAX,
SORT_ESRB,
SORT_CONTROLLERS,
SORT_BTN_NUMBERS, SORT_BTN_NUMBERS,
}; };
@ -64,6 +63,8 @@ public:
void pageDown(void); void pageDown(void);
void nextLetter(wchar_t *c); void nextLetter(wchar_t *c);
void prevLetter(wchar_t *c); void prevLetter(wchar_t *c);
void nextYear(wchar_t *c);
void prevYear(wchar_t *c);
void nextPlayers(bool wifi, wchar_t *c); void nextPlayers(bool wifi, wchar_t *c);
void prevPlayers(bool wifi, wchar_t *c); void prevPlayers(bool wifi, wchar_t *c);
void nextID(wchar_t *c); void nextID(wchar_t *c);
@ -357,6 +358,7 @@ private:
static bool _sortByPlayers(CItem item1, CItem item2); static bool _sortByPlayers(CItem item1, CItem item2);
static bool _sortByWifiPlayers(CItem item1, CItem item2); static bool _sortByWifiPlayers(CItem item1, CItem item2);
static bool _sortByBtnNumbers(CItem item1, CItem item2); static bool _sortByBtnNumbers(CItem item1, CItem item2);
static bool _sortByYear(CItem item1, CItem item2);
private: private:
static void * _coverLoader(void *obj); static void * _coverLoader(void *obj);

View File

@ -31,7 +31,7 @@ dir_discHdr ListElement;
Config CustomTitles; Config CustomTitles;
GameTDB gameTDB; GameTDB gameTDB;
Config romNamesDB; Config romNamesDB;
string platformName; const char *platformName;
string pluginsDataDir; string pluginsDataDir;
std::regex fileNameSkipRegex; std::regex fileNameSkipRegex;
@ -90,15 +90,24 @@ static void AddISO(const char *GameID, const char *GameTitle, const char *GamePa
{ {
memset((void*)&ListElement, 0, sizeof(dir_discHdr)); memset((void*)&ListElement, 0, sizeof(dir_discHdr));
ListElement.index = m_cacheList.size(); ListElement.index = m_cacheList.size();
if(GameID != NULL) strncpy(ListElement.id, GameID, 6); if(GameID != NULL) strncpy(ListElement.id, GameID, 6);
if(GamePath != NULL) strncpy(ListElement.path, GamePath, sizeof(ListElement.path) - 1); if(GamePath != NULL) strncpy(ListElement.path, GamePath, sizeof(ListElement.path) - 1);
ListElement.casecolor = CustomTitles.getColor("COVERS", ListElement.id, GameColor).intVal(); ListElement.casecolor = CustomTitles.getColor("COVERS", ListElement.id, GameColor).intVal();
char CustomTitle[64]; char CustomTitle[64];
memset(CustomTitle, 0, sizeof(CustomTitle)); memset(CustomTitle, 0, sizeof(CustomTitle));
strncpy(CustomTitle, CustomTitles.getString("TITLES", ListElement.id).c_str(), 63); strncpy(CustomTitle, CustomTitles.getString("TITLES", ListElement.id).c_str(), 63);
const char *gameTDB_Title = NULL; const char *gameTDB_Title = NULL;
if(gameTDB.IsLoaded()) if(gameTDB.IsLoaded())
{ {
/* set the released year */
int PublishDate = gameTDB.GetPublishDate(ListElement.id);
int year = PublishDate >> 16;
ListElement.year = year;
if(ListElement.casecolor == GameColor) if(ListElement.casecolor == GameColor)
ListElement.casecolor = gameTDB.GetCaseColor(ListElement.id); ListElement.casecolor = gameTDB.GetCaseColor(ListElement.id);
ListElement.wifi = gameTDB.GetWifiPlayers(ListElement.id); ListElement.wifi = gameTDB.GetWifiPlayers(ListElement.id);
@ -234,6 +243,10 @@ static void Create_Channel_List()
const char *gameTDB_Title = NULL; const char *gameTDB_Title = NULL;
if(gameTDB.IsLoaded()) if(gameTDB.IsLoaded())
{ {
/* set the released year */
int PublishDate = gameTDB.GetPublishDate(ListElement.id);
int year = PublishDate >> 16;
ListElement.year = year;
if(ListElement.casecolor == 0xFFFFFF) if(ListElement.casecolor == 0xFFFFFF)
ListElement.casecolor = gameTDB.GetCaseColor(ListElement.id); ListElement.casecolor = gameTDB.GetCaseColor(ListElement.id);
ListElement.wifi = gameTDB.GetWifiPlayers(ListElement.id); ListElement.wifi = gameTDB.GetWifiPlayers(ListElement.id);
@ -276,7 +289,7 @@ static void Add_Plugin_Game(char *FullPath)
if(gameTDB.IsLoaded()) if(gameTDB.IsLoaded())
{ {
/* Get 6 character unique romID (from Screenscraper.fr) using shortName. if fails then use CRC or CD serial to get romID */ /* Get 6 character unique romID (from Screenscraper.fr) using shortName. if fails then use CRC or CD serial to get romID */
romID = m_plugin.GetRomId(FullPath, m_cacheList.Magic, romNamesDB, pluginsDataDir.c_str(), platformName.c_str(), ShortName.c_str()); romID = m_plugin.GetRomId(FullPath, m_cacheList.Magic, romNamesDB, pluginsDataDir.c_str(), platformName, ShortName.c_str());
} }
if(romID.empty()) if(romID.empty())
romID = "PLUGIN"; romID = "PLUGIN";
@ -317,6 +330,15 @@ static void Add_Plugin_Game(char *FullPath)
mbstowcs(ListElement.title, RomFilename, 63); mbstowcs(ListElement.title, RomFilename, 63);
Asciify(ListElement.title); Asciify(ListElement.title);
/* set the released year */
int year = 0;
if(romID != "PLUGIN" && gameTDB.IsLoaded())
{
int PublishDate = gameTDB.GetPublishDate(romID.c_str());
year = PublishDate >> 16;
}
ListElement.year = year;
ListElement.settings[0] = m_cacheList.Magic; //Plugin magic ListElement.settings[0] = m_cacheList.Magic; //Plugin magic
ListElement.casecolor = m_cacheList.Color; ListElement.casecolor = m_cacheList.Color;
ListElement.type = TYPE_PLUGIN; ListElement.type = TYPE_PLUGIN;
@ -403,6 +425,15 @@ void ListGenerator::ParseScummvmINI(Config &ini, const char *Device, const char
Asciify(ListElement.title); Asciify(ListElement.title);
strcpy(ListElement.path, GameDomain); strcpy(ListElement.path, GameDomain);
/* set the released year */
int year = 0;
if(GameID != "PLUGIN" && gameTDB.IsLoaded())
{
int PublishDate = gameTDB.GetPublishDate(GameID.c_str());
year = PublishDate >> 16;
}
ListElement.year = year;
ListElement.settings[0] = m_cacheList.Magic; //scummvm magic ListElement.settings[0] = m_cacheList.Magic; //scummvm magic
ListElement.casecolor = m_cacheList.Color; ListElement.casecolor = m_cacheList.Color;
ListElement.type = TYPE_PLUGIN; ListElement.type = TYPE_PLUGIN;
@ -410,13 +441,13 @@ void ListGenerator::ParseScummvmINI(Config &ini, const char *Device, const char
GameDomain = ini.nextDomain().c_str(); GameDomain = ini.nextDomain().c_str();
} }
m_crc.unload(); m_crc.unload();
CloseConfigs(); CloseConfigs();
if(!this->empty() && !DBName.empty()) /* Write a new Cache */ if(!this->empty() && !DBName.empty()) /* Write a new Cache */
CCache(*this, DBName, SAVE); CCache(*this, DBName, SAVE);
} }
/* note: scummvm games are parsed above */ /* note: scummvm games are parsed above */
void ListGenerator::CreateRomList(Config &platform_cfg, const string& romsDir, const vector<string>& FileTypes, const string& DBName, bool UpdateCache) void ListGenerator::CreateRomList(const char *platform, const string& romsDir, const vector<string>& FileTypes, const string& DBName, bool UpdateCache)
{ {
Clear(); Clear();
if(!DBName.empty()) if(!DBName.empty())
@ -432,35 +463,25 @@ void ListGenerator::CreateRomList(Config &platform_cfg, const string& romsDir, c
} }
} }
platformName = ""; platformName = platform;// done to use it in add plugin game
if(platform_cfg.loaded()) if(platformName != NULL)
{ {
/* Search platform.ini to find plugin magic to get platformName */ /* Load rom names and crc database */
platformName = platform_cfg.getString("PLUGINS", m_plugin.PluginMagicWord); romNamesDB.load(fmt("%s/%s/%s.ini", pluginsDataDir.c_str(), platformName, platformName));
if(!platformName.empty())
{ /* Load platform name.xml database to get game's info using the gameID */
/* check COMBINED for platform names that mean the same system just different region */ gameTDB.OpenFile(fmt("%s/%s/%s.xml", pluginsDataDir.c_str(), platformName, platformName));
/* some platforms have different names per country (ex. Genesis/Megadrive) */ if(gameTDB.IsLoaded())
/* but we use only one platform name for both */ gameTDB.SetLanguageCode(gameTDB_Language.c_str());
string newName = platform_cfg.getString("COMBINED", platformName);
if(newName.empty())
platform_cfg.remove("COMBINED", platformName);
else
platformName = newName;
/* Load rom names and crc database */
romNamesDB.load(fmt("%s/%s/%s.ini", pluginsDataDir.c_str(), platformName.c_str(), platformName.c_str()));
/* Load platform name.xml database to get game's info using the gameID */
gameTDB.OpenFile(fmt("%s/%s/%s.xml", pluginsDataDir.c_str(), platformName.c_str(), platformName.c_str()));
if(gameTDB.IsLoaded())
gameTDB.SetLanguageCode(gameTDB_Language.c_str());
}
} }
CustomTitles.load(CustomTitlesPath.c_str()); CustomTitles.load(CustomTitlesPath.c_str());
CustomTitles.groupCustomTitles(); CustomTitles.groupCustomTitles();
GetFiles(romsDir.c_str(), FileTypes, Add_Plugin_Game, false, 30);//wow 30 subfolders! really? GetFiles(romsDir.c_str(), FileTypes, Add_Plugin_Game, false, 30);//wow 30 subfolders! really?
CloseConfigs(); CloseConfigs();
romNamesDB.unload(); romNamesDB.unload();
if(!this->empty() && !DBName.empty()) /* Write a new Cache */ if(!this->empty() && !DBName.empty()) /* Write a new Cache */
CCache(*this, DBName, SAVE); CCache(*this, DBName, SAVE);
} }

View File

@ -40,7 +40,7 @@ public:
void Init(const char *settingsDir, const char *Language, const char *plgnsDataDir, const std::string& fileNameSkipPattern); 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(const char *platform, const string& romsDir, const vector<string>& FileTypes, const string& DBName, bool UpdateCache);
void CreateList(u32 Flow, const string& Path, const vector<string>& FileTypes, const string& DBName, bool UpdateCache); void CreateList(u32 Flow, const string& Path, const vector<string>& FileTypes, const string& DBName, bool UpdateCache);
u32 Color; u32 Color;
u32 Magic; u32 Magic;

View File

@ -83,8 +83,9 @@ struct dir_discHdr
u32 casecolor; u32 casecolor;
u16 index; u16 index;
u8 esrb; u16 year;// year released
u8 controllers; //u8 esrb;
//u8 controllers;
u8 players; u8 players;
u8 wifi; u8 wifi;
} ATTRIBUTE_PACKED; } ATTRIBUTE_PACKED;

View File

@ -2034,10 +2034,15 @@ void CMenu::_initCF(void)
string favDomain = "FAVORITES"; string favDomain = "FAVORITES";
string adultDomain = "ADULTONLY"; string adultDomain = "ADULTONLY";
string playcntDomain = "PLAYCOUNT";
string lastplayDomain = "LASTPLAYED";
if(hdr->type == TYPE_PLUGIN) if(hdr->type == TYPE_PLUGIN)
{ {
favDomain = "FAVORITES_PLUGINS"; favDomain = "FAVORITES_PLUGINS";
adultDomain = "ADULTONLY_PLUGINS"; adultDomain = "ADULTONLY_PLUGINS";
string playcntDomain = "PLAYCOUNT_PLUGINS";
string lastplayDomain = "LASTPLAYED_PLUGINS";
} }
// 1 is the one used. 2 is a temp copied to 1. // 1 is the one used. 2 is a temp copied to 1.
@ -2198,17 +2203,21 @@ void CMenu::_initCF(void)
} }
} }
if(dumpGameLst && (!NoGameID(hdr->type) || (hdr->type == TYPE_PLUGIN && strcmp(hdr->id, "PLUGIN") != 0))) if(dumpGameLst && hdr->type != TYPE_HOMEBREW && strcmp(hdr->id, "PLUGIN") != 0)
dump.setWString(catDomain1, catKey1, hdr->title); dump.setWString(catDomain1, catKey1, hdr->title);
if(hdr->type == TYPE_PLUGIN && m_plugin.GetEnabledStatus(m_plugin.GetPluginPosition(hdr->settings[0]))) if(hdr->type != TYPE_HOMEBREW && strcmp(hdr->id, "PLUGIN") != 0)
CoverFlow.addItem(&(*hdr), 0, 0);
else
{ {
int playcount = m_gcfg1.getInt("PLAYCOUNT", cfgKey1, 0); int playcount = m_gcfg1.getInt(playcntDomain, cfgKey1, 0);
unsigned int lastPlayed = m_gcfg1.getUInt("LASTPLAYED", cfgKey1, 0); if(playcount == 0)
m_gcfg1.remove(playcntDomain, cfgKey1);
unsigned int lastPlayed = m_gcfg1.getUInt(lastplayDomain, cfgKey1, 0);
if(lastPlayed == 0)
m_gcfg1.remove("lastplayDomain", cfgKey1);
CoverFlow.addItem(&(*hdr), playcount, lastPlayed); CoverFlow.addItem(&(*hdr), playcount, lastPlayed);
} }
else
CoverFlow.addItem(&(*hdr), 0, 0);
} }
/* remove them if false to keep file short */ /* remove them if false to keep file short */
if(!m_gcfg1.getBool(favDomain, cfgKey1)) if(!m_gcfg1.getBool(favDomain, cfgKey1))
@ -2592,14 +2601,30 @@ bool CMenu::_loadPluginList()
} }
else else
{ {
string romsDir(fmt("%s:/%s", DeviceName[currentPartition], romDir));
string cachedListFile(fmt("%s/%s_%s.db", m_listCacheDir.c_str(), DeviceName[currentPartition], m_plugin.PluginMagicWord)); string cachedListFile(fmt("%s/%s_%s.db", m_listCacheDir.c_str(), DeviceName[currentPartition], m_plugin.PluginMagicWord));
bool preCachedList = fsop_FileExist(cachedListFile.c_str()); bool preCachedList = fsop_FileExist(cachedListFile.c_str());
string romsDir(fmt("%s:/%s", DeviceName[currentPartition], romDir));
vector<string> FileTypes = stringToVector(m_plugin.GetFileTypes(i), '|'); vector<string> FileTypes = stringToVector(m_plugin.GetFileTypes(i), '|');
m_cacheList.Color = m_plugin.GetCaseColor(i); m_cacheList.Color = m_plugin.GetCaseColor(i);
m_cacheList.Magic = m_plugin.GetPluginMagic(i); m_cacheList.Magic = m_plugin.GetPluginMagic(i);
m_cacheList.usePluginDBTitles = m_cfg.getBool(PLUGIN_DOMAIN, "database_titles", true); m_cacheList.usePluginDBTitles = m_cfg.getBool(PLUGIN_DOMAIN, "database_titles", true);
m_cacheList.CreateRomList(m_platform, romsDir, FileTypes, cachedListFile, updateCache);
string platformName = m_platform.getString("PLUGINS", m_plugin.PluginMagicWord, "");
if(!platformName.empty())
{
/* check COMBINED for platform names that mean the same system just different region */
/* some platforms have different names per country (ex. Genesis/Megadrive) */
/* but we use only one platform name for both */
string newName = m_platform.getString("COMBINED", platformName, "");
if(newName.empty())
m_platform.remove("COMBINED", platformName);
else
platformName = newName;
}
m_cacheList.CreateRomList(platformName.c_str(), romsDir, FileTypes, cachedListFile, updateCache);
for(vector<dir_discHdr>::iterator tmp_itr = m_cacheList.begin(); tmp_itr != m_cacheList.end(); tmp_itr++) for(vector<dir_discHdr>::iterator tmp_itr = m_cacheList.begin(); tmp_itr != m_cacheList.end(); tmp_itr++)
m_gameList.push_back(*tmp_itr); m_gameList.push_back(*tmp_itr);
if(updateCache || (!preCachedList && fsop_FileExist(cachedListFile.c_str()))) if(updateCache || (!preCachedList && fsop_FileExist(cachedListFile.c_str())))

View File

@ -465,7 +465,7 @@ void CMenu::_configGame(const dir_discHdr *hdr, bool disc)
strncpy(m_plugin.PluginMagicWord, fmt("%08x", GameHdr->settings[0]), 8); strncpy(m_plugin.PluginMagicWord, fmt("%08x", GameHdr->settings[0]), 8);
// if game has an id from the plugin database we use the new method which uses platform name/id // if game has an id from the plugin database we use the new method which uses platform name/id
if(strcmp(GameHdr->id, "PLUGIN") != 0 && !m_platform.getString("PLUGINS", m_plugin.PluginMagicWord, "").empty()) if(strcmp(GameHdr->id, "PLUGIN") != 0 && !m_platform.getString("PLUGINS", m_plugin.PluginMagicWord, "").empty())
id =sfmt("%s/%s", m_platform.getString("PLUGINS", m_plugin.PluginMagicWord).c_str(), GameHdr->id); id = sfmt("%s/%s", m_platform.getString("PLUGINS", m_plugin.PluginMagicWord).c_str(), GameHdr->id);
else // old pre 5.4.4 method which uses plugin magic/title of game else // old pre 5.4.4 method which uses plugin magic/title of game
{ {
if(strrchr(GameHdr->path, '/') != NULL) if(strrchr(GameHdr->path, '/') != NULL)

View File

@ -195,6 +195,14 @@ void CMenu::_launch(const dir_discHdr *hdr)
void CMenu::_launchPlugin(dir_discHdr *hdr) void CMenu::_launchPlugin(dir_discHdr *hdr)
{ {
if(strcmp(hdr->id, "PLUGIN") != 0)
{
strncpy(m_plugin.PluginMagicWord, fmt("%08x", hdr->settings[0]), 8);
string gcfg1Key = sfmt("%s/%s", m_platform.getString("PLUGINS", m_plugin.PluginMagicWord).c_str(), hdr->id);
m_gcfg1.setInt("PLAYCOUNT_PLUGINS", gcfg1Key, m_gcfg1.getInt("PLAYCOUNT_PLUGINS", gcfg1Key, 0) + 1);
m_gcfg1.setUInt("LASTPLAYED_PLUGINS", gcfg1Key, time(NULL));
}
/* get dol name and name length for music plugin */ /* get dol name and name length for music plugin */
const char *plugin_dol_name = m_plugin.GetDolName(hdr->settings[0]); const char *plugin_dol_name = m_plugin.GetDolName(hdr->settings[0]);
u8 plugin_dol_len = strlen(plugin_dol_name); u8 plugin_dol_len = strlen(plugin_dol_name);

View File

@ -491,9 +491,9 @@ int CMenu::main(void)
} }
else if(BTN_A_PRESSED) else if(BTN_A_PRESSED)
{ {
if(m_btnMgr.selected(m_mainBtnPrev)) if(m_btnMgr.selected(m_mainBtnPrev))// A on prev icon - move back a screen of covers
CoverFlow.pageUp(); CoverFlow.pageUp();
else if(m_btnMgr.selected(m_mainBtnNext)) else if(m_btnMgr.selected(m_mainBtnNext))// A on next icon - move forward a screen of covers
CoverFlow.pageDown(); CoverFlow.pageDown();
else if(m_btnMgr.selected(m_mainBtnChannel) || m_btnMgr.selected(m_mainBtnWii) || m_btnMgr.selected(m_mainBtnGamecube) else if(m_btnMgr.selected(m_mainBtnChannel) || m_btnMgr.selected(m_mainBtnWii) || m_btnMgr.selected(m_mainBtnGamecube)
|| m_btnMgr.selected(m_mainBtnPlugin) || m_btnMgr.selected(m_mainBtnHomebrew)) || m_btnMgr.selected(m_mainBtnPlugin) || m_btnMgr.selected(m_mainBtnHomebrew))
@ -639,34 +639,32 @@ int CMenu::main(void)
else if(BTN_B_PRESSED) else if(BTN_B_PRESSED)
{ {
bheld = true; bheld = true;
// B on next or prev icon - move to next/prev sort item
if(m_btnMgr.selected(m_mainBtnNext) || m_btnMgr.selected(m_mainBtnPrev)) if(m_btnMgr.selected(m_mainBtnNext) || m_btnMgr.selected(m_mainBtnPrev))
{ {
bUsed = true; bUsed = true;
const char *domain = _domainFromView(); const char *domain = _domainFromView();
int sorting = m_cfg.getInt(domain, "sort", SORT_ALPHA); int sorting = m_cfg.getInt(domain, "sort", SORT_ALPHA);
if (sorting != SORT_ALPHA && sorting != SORT_PLAYERS && sorting != SORT_WIFIPLAYERS && sorting != SORT_GAMEID) // sorting playcount, lastplayed, and source numbers there is no need for prev or next. playcount maybe.
// lastplayed time and source numbers will be different for every single game. playcount might be the same.
// sort gameid not useful for wii and gc. best for the different VC systems.
if(sorting == SORT_ALPHA || sorting == SORT_PLAYERS || sorting == SORT_WIFIPLAYERS ||
sorting == SORT_GAMEID || sorting == SORT_YEAR)
{ {
CoverFlow.setSorting((Sorting)SORT_ALPHA); wchar_t c[5] = {0, 0, 0, 0, 0};// long enuff for year
m_cfg.setInt(domain, "sort", SORT_ALPHA); m_btnMgr.selected(m_mainBtnPrev) ? CoverFlow.prevLetter(c) : CoverFlow.nextLetter(c);
sorting = SORT_ALPHA; m_showtimer = 120;
} curLetter.clear();
wchar_t c[2] = {0, 0}; curLetter = wstringEx(c);
m_btnMgr.selected(m_mainBtnPrev) ? CoverFlow.prevLetter(c) : CoverFlow.nextLetter(c);
m_showtimer = 120;
curLetter.clear();
curLetter = wstringEx(c);
if(sorting == SORT_ALPHA) if(sorting != SORT_ALPHA && sorting != SORT_YEAR)// #players, #wifiplayers, id = VC type, wiiware, wii, or GC listed as unknown
{ curLetter = _getNoticeTranslation(sorting, curLetter);
m_btnMgr.setText(m_mainLblLetter, curLetter); m_showtimer = 120;
m_btnMgr.show(m_mainLblLetter);
}
else
{
curLetter = _getNoticeTranslation(sorting, curLetter);
m_btnMgr.setText(m_mainLblNotice, curLetter); m_btnMgr.setText(m_mainLblNotice, curLetter);
m_btnMgr.show(m_mainLblNotice); m_btnMgr.show(m_mainLblNotice);
} }
else
m_btnMgr.selected(m_mainBtnPrev) ? CoverFlow.pageUp() : CoverFlow.pageDown();
} }
} }
else if(WROLL_LEFT) else if(WROLL_LEFT)
@ -708,39 +706,32 @@ int CMenu::main(void)
else // Button B Held else // Button B Held
{ {
bheld = true; bheld = true;
const char *domain = _domainFromView();
/* b+down or up = move to previous or next cover in sort order */ /* b+down or up = move to previous or next cover in sort order */
if(!CoverFlow.empty() && (BTN_DOWN_PRESSED || BTN_UP_PRESSED)) if(!CoverFlow.empty() && (BTN_DOWN_PRESSED || BTN_UP_PRESSED))
{ {
bUsed = true; bUsed = true;
const char *domain = _domainFromView();
int sorting = m_cfg.getInt(domain, "sort", SORT_ALPHA); int sorting = m_cfg.getInt(domain, "sort", SORT_ALPHA);
/* if for some reason domain sort value is not legal set it to alpha */ // sorting playcount, lastplayed, and source numbers there is no need for prev or next. playcount maybe.
if(sorting != SORT_ALPHA && sorting != SORT_PLAYERS && sorting != SORT_WIFIPLAYERS && sorting != SORT_GAMEID) // lastplayed time and source numbers will be different for every single game. playcount might be the same.
// sort gameid not useful for wii and gc. best for the different VC systems.
if(sorting == SORT_ALPHA || sorting == SORT_PLAYERS || sorting == SORT_WIFIPLAYERS ||
sorting == SORT_GAMEID || sorting == SORT_YEAR)
{ {
CoverFlow.setSorting((Sorting)SORT_ALPHA); wchar_t c[5] = {0, 0, 0, 0, 0};// long enuough for year
m_cfg.setInt(domain, "sort", SORT_ALPHA); BTN_UP_PRESSED ? CoverFlow.prevLetter(c) : CoverFlow.nextLetter(c);
sorting = SORT_ALPHA; m_showtimer = 120;
} curLetter.clear();
/* move coverflow */ curLetter = wstringEx(c);
wchar_t c[2] = {0, 0};
BTN_UP_PRESSED ? CoverFlow.prevLetter(c) : CoverFlow.nextLetter(c);
/* set sort text and display it */ if(sorting != SORT_ALPHA && sorting != SORT_YEAR)// #players, #wifiplayers, id = VC type, wiiware, wii, or GC listed as unknown
curLetter.clear(); curLetter = _getNoticeTranslation(sorting, curLetter);
curLetter = wstringEx(c); m_showtimer = 120;
m_showtimer = 120;
if(sorting == SORT_ALPHA)
{
m_btnMgr.setText(m_mainLblLetter, curLetter);
m_btnMgr.show(m_mainLblLetter);
}
else
{
curLetter = _getNoticeTranslation(sorting, curLetter);
m_btnMgr.setText(m_mainLblNotice, curLetter); m_btnMgr.setText(m_mainLblNotice, curLetter);
m_btnMgr.show(m_mainLblNotice); m_btnMgr.show(m_mainLblNotice);
} }
else
BTN_UP_PRESSED ? CoverFlow.pageUp() : CoverFlow.pageDown();
} }
else if(BTN_LEFT_PRESSED)// b+left = previous song else if(BTN_LEFT_PRESSED)// b+left = previous song
{ {
@ -753,9 +744,10 @@ int CMenu::main(void)
MusicPlayer.Next(); MusicPlayer.Next();
} }
/* b+plus = change sort mode */ /* b+plus = change sort mode */
else if(!CoverFlow.empty() && BTN_PLUS_PRESSED && !m_locked && (m_current_view < 8 || m_sourceflow))// <8 excludes plugins and homebrew else if(!CoverFlow.empty() && BTN_PLUS_PRESSED && !m_locked && (m_current_view < COVERFLOW_HOMEBREW || m_sourceflow))// homebrew not allowed
{ {
bUsed = true; bUsed = true;
const char *domain = _domainFromView();
u8 sort = 0; u8 sort = 0;
if(m_sourceflow)// change sourceflow sort mode if(m_sourceflow)// change sourceflow sort mode
{ {
@ -766,13 +758,24 @@ int CMenu::main(void)
sort = SORT_ALPHA; sort = SORT_ALPHA;
} }
else // change all other coverflow sort mode else // change all other coverflow sort mode
sort = loopNum((m_cfg.getInt(domain, "sort", 0)) + 1, SORT_MAX); {
m_cfg.setInt(domain, "sort", sort); while(true)
{
sort = loopNum((m_cfg.getInt(domain, "sort", 0)) + 1, SORT_MAX);
m_cfg.setInt(domain, "sort", sort);
if(sort == SORT_GAMEID && m_current_view & COVERFLOW_CHANNEL)
break;
if(sort == SORT_WIFIPLAYERS && (m_current_view & COVERFLOW_WII || m_current_view & COVERFLOW_CHANNEL))
break;
if(sort != SORT_GAMEID && sort != SORT_WIFIPLAYERS)
break;
}
}
/* set coverflow to new sorting */ /* set coverflow to new sorting */
_initCF(); _initCF();
/* set sort mode text and display it */ /* set sort mode text and display it */
wstringEx curSort ; wstringEx curSort;
if(sort == SORT_ALPHA) if(sort == SORT_ALPHA)
curSort = m_loc.getWString(m_curLanguage, "alphabetically", L"Alphabetically"); curSort = m_loc.getWString(m_curLanguage, "alphabetically", L"Alphabetically");
else if(sort == SORT_PLAYCOUNT) else if(sort == SORT_PLAYCOUNT)
@ -787,6 +790,8 @@ int CMenu::main(void)
curSort = m_loc.getWString(m_curLanguage, "byplayers", L"By Players"); curSort = m_loc.getWString(m_curLanguage, "byplayers", L"By Players");
else if(sort == SORT_BTN_NUMBERS) else if(sort == SORT_BTN_NUMBERS)
curSort = m_loc.getWString(m_curLanguage, "bybtnnumbers", L"By Button Numbers"); curSort = m_loc.getWString(m_curLanguage, "bybtnnumbers", L"By Button Numbers");
else if(sort == SORT_YEAR)
curSort = m_loc.getWString(m_curLanguage, "byyear", L"By Year Released");
m_showtimer = 120; m_showtimer = 120;
m_btnMgr.setText(m_mainLblNotice, curSort); m_btnMgr.setText(m_mainLblNotice, curSort);
m_btnMgr.show(m_mainLblNotice); m_btnMgr.show(m_mainLblNotice);

View File

@ -22,6 +22,7 @@ bylastplayed=By Last Played
byplaycount=By Play Count byplaycount=By Play Count
byplayers=By Players byplayers=By Players
bywifiplayers=By Wifi Players bywifiplayers=By Wifi Players
byyear=By Year Released
bybtnnumbers=By Button Numbers bybtnnumbers=By Button Numbers
cat1=Select Categories cat1=Select Categories
cat2=Clear cat2=Clear