diff --git a/out/boot.dol b/out/boot.dol index 3b164f7d..4edeb7ae 100644 Binary files a/out/boot.dol and b/out/boot.dol differ diff --git a/source/gui/coverflow.cpp b/source/gui/coverflow.cpp index aa9f9891..a7aec79d 100644 --- a/source/gui/coverflow.cpp +++ b/source/gui/coverflow.cpp @@ -1916,6 +1916,12 @@ bool CCoverFlow::_sortByBtnNumbers(CItem item1, CItem item2) 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) { 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); else if (m_sorting == SORT_BTN_NUMBERS) 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 */ if(!m_dvdskin_loaded) @@ -2280,7 +2288,7 @@ void CCoverFlow::_completeJump(void) void CCoverFlow::nextLetter(wchar_t *c) { - if (m_covers == NULL || m_sorting == SORT_BTN_NUMBERS) + if (m_covers == NULL) { c[0] = L'\0'; return; @@ -2292,6 +2300,9 @@ void CCoverFlow::nextLetter(wchar_t *c) if (m_sorting == SORT_GAMEID) return nextID(c); + if (m_sorting == SORT_YEAR) + return nextYear(c); + LockMutex lock(m_mutex); 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) { - if (m_covers == NULL || m_sorting == SORT_BTN_NUMBERS) + if (m_covers == NULL) { c[0] = L'\0'; return; @@ -2330,6 +2341,9 @@ void CCoverFlow::prevLetter(wchar_t *c) if (m_sorting == SORT_GAMEID) return prevID(c); + + if (m_sorting == SORT_YEAR) + return prevYear(c); LockMutex lock(m_mutex); u32 i, j = 0, k = 0, n = m_items.size(); @@ -2371,6 +2385,63 @@ void CCoverFlow::prevLetter(wchar_t *c) _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) { 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; } - char p[4] = {0 ,0 ,0 ,0}; - sprintf(p, "%d", players); + char p[2] = {0 ,0}; + itoa(players, p, 10); mbstowcs(c, p, strlen(p)); _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; } - char p[4] = {0 ,0 ,0 ,0}; - sprintf(p, "%d", players); + char p[2] = {0 ,0}; + itoa(players, p, 10); mbstowcs(c, p, strlen(p)); _updateAllTargets(); @@ -2447,7 +2518,8 @@ void CCoverFlow::nextID(wchar_t *c) 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); _updateAllTargets(); diff --git a/source/gui/coverflow.hpp b/source/gui/coverflow.hpp index ca9fff98..a000feaa 100644 --- a/source/gui/coverflow.hpp +++ b/source/gui/coverflow.hpp @@ -23,14 +23,13 @@ using std::max; enum Sorting { SORT_ALPHA, + SORT_YEAR, SORT_PLAYCOUNT, SORT_LASTPLAYED, SORT_GAMEID, SORT_WIFIPLAYERS, SORT_PLAYERS, SORT_MAX, - SORT_ESRB, - SORT_CONTROLLERS, SORT_BTN_NUMBERS, }; @@ -64,6 +63,8 @@ public: void pageDown(void); void nextLetter(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 prevPlayers(bool wifi, wchar_t *c); void nextID(wchar_t *c); @@ -357,6 +358,7 @@ private: static bool _sortByPlayers(CItem item1, CItem item2); static bool _sortByWifiPlayers(CItem item1, CItem item2); static bool _sortByBtnNumbers(CItem item1, CItem item2); + static bool _sortByYear(CItem item1, CItem item2); private: static void * _coverLoader(void *obj); diff --git a/source/list/ListGenerator.cpp b/source/list/ListGenerator.cpp index 69614d1d..2cfeee7c 100644 --- a/source/list/ListGenerator.cpp +++ b/source/list/ListGenerator.cpp @@ -31,7 +31,7 @@ dir_discHdr ListElement; Config CustomTitles; GameTDB gameTDB; Config romNamesDB; -string platformName; +const char *platformName; string pluginsDataDir; 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)); ListElement.index = m_cacheList.size(); + if(GameID != NULL) strncpy(ListElement.id, GameID, 6); + if(GamePath != NULL) strncpy(ListElement.path, GamePath, sizeof(ListElement.path) - 1); + ListElement.casecolor = CustomTitles.getColor("COVERS", ListElement.id, GameColor).intVal(); + char CustomTitle[64]; memset(CustomTitle, 0, sizeof(CustomTitle)); strncpy(CustomTitle, CustomTitles.getString("TITLES", ListElement.id).c_str(), 63); + const char *gameTDB_Title = NULL; if(gameTDB.IsLoaded()) { + /* set the released year */ + int PublishDate = gameTDB.GetPublishDate(ListElement.id); + int year = PublishDate >> 16; + ListElement.year = year; if(ListElement.casecolor == GameColor) ListElement.casecolor = gameTDB.GetCaseColor(ListElement.id); ListElement.wifi = gameTDB.GetWifiPlayers(ListElement.id); @@ -234,6 +243,10 @@ static void Create_Channel_List() const char *gameTDB_Title = NULL; if(gameTDB.IsLoaded()) { + /* set the released year */ + int PublishDate = gameTDB.GetPublishDate(ListElement.id); + int year = PublishDate >> 16; + ListElement.year = year; if(ListElement.casecolor == 0xFFFFFF) ListElement.casecolor = gameTDB.GetCaseColor(ListElement.id); ListElement.wifi = gameTDB.GetWifiPlayers(ListElement.id); @@ -276,7 +289,7 @@ static void Add_Plugin_Game(char *FullPath) if(gameTDB.IsLoaded()) { /* 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()) romID = "PLUGIN"; @@ -317,6 +330,15 @@ static void Add_Plugin_Game(char *FullPath) mbstowcs(ListElement.title, RomFilename, 63); 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.casecolor = m_cacheList.Color; ListElement.type = TYPE_PLUGIN; @@ -403,6 +425,15 @@ void ListGenerator::ParseScummvmINI(Config &ini, const char *Device, const char Asciify(ListElement.title); 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.casecolor = m_cacheList.Color; ListElement.type = TYPE_PLUGIN; @@ -410,13 +441,13 @@ void ListGenerator::ParseScummvmINI(Config &ini, const char *Device, const char GameDomain = ini.nextDomain().c_str(); } m_crc.unload(); - CloseConfigs(); + CloseConfigs(); if(!this->empty() && !DBName.empty()) /* Write a new Cache */ CCache(*this, DBName, SAVE); } /* note: scummvm games are parsed above */ -void ListGenerator::CreateRomList(Config &platform_cfg, const string& romsDir, const vector& FileTypes, const string& DBName, bool UpdateCache) +void ListGenerator::CreateRomList(const char *platform, const string& romsDir, const vector& FileTypes, const string& DBName, bool UpdateCache) { Clear(); if(!DBName.empty()) @@ -432,35 +463,25 @@ void ListGenerator::CreateRomList(Config &platform_cfg, const string& romsDir, c } } - platformName = ""; - if(platform_cfg.loaded()) + platformName = platform;// done to use it in add plugin game + if(platformName != NULL) { - /* Search platform.ini to find plugin magic to get platformName */ - platformName = platform_cfg.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 = 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()); - } + /* Load rom names and crc database */ + romNamesDB.load(fmt("%s/%s/%s.ini", pluginsDataDir.c_str(), platformName, platformName)); + + /* Load platform name.xml database to get game's info using the gameID */ + gameTDB.OpenFile(fmt("%s/%s/%s.xml", pluginsDataDir.c_str(), platformName, platformName)); + if(gameTDB.IsLoaded()) + gameTDB.SetLanguageCode(gameTDB_Language.c_str()); } CustomTitles.load(CustomTitlesPath.c_str()); CustomTitles.groupCustomTitles(); + GetFiles(romsDir.c_str(), FileTypes, Add_Plugin_Game, false, 30);//wow 30 subfolders! really? + CloseConfigs(); romNamesDB.unload(); + if(!this->empty() && !DBName.empty()) /* Write a new Cache */ CCache(*this, DBName, SAVE); } diff --git a/source/list/ListGenerator.hpp b/source/list/ListGenerator.hpp index 1b82ac44..21a0f4ed 100644 --- a/source/list/ListGenerator.hpp +++ b/source/list/ListGenerator.hpp @@ -40,7 +40,7 @@ public: 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& FileTypes, const string& DBName, bool UpdateCache); + void CreateRomList(const char *platform, const string& romsDir, const vector& FileTypes, const string& DBName, bool UpdateCache); void CreateList(u32 Flow, const string& Path, const vector& FileTypes, const string& DBName, bool UpdateCache); u32 Color; u32 Magic; diff --git a/source/loader/disc.h b/source/loader/disc.h index 821b14de..20cac1f7 100644 --- a/source/loader/disc.h +++ b/source/loader/disc.h @@ -83,8 +83,9 @@ struct dir_discHdr u32 casecolor; u16 index; - u8 esrb; - u8 controllers; + u16 year;// year released + //u8 esrb; + //u8 controllers; u8 players; u8 wifi; } ATTRIBUTE_PACKED; diff --git a/source/menu/menu.cpp b/source/menu/menu.cpp index 9a52b765..ea12ec1d 100644 --- a/source/menu/menu.cpp +++ b/source/menu/menu.cpp @@ -2034,10 +2034,15 @@ void CMenu::_initCF(void) string favDomain = "FAVORITES"; string adultDomain = "ADULTONLY"; + string playcntDomain = "PLAYCOUNT"; + string lastplayDomain = "LASTPLAYED"; + if(hdr->type == TYPE_PLUGIN) { favDomain = "FAVORITES_PLUGINS"; adultDomain = "ADULTONLY_PLUGINS"; + string playcntDomain = "PLAYCOUNT_PLUGINS"; + string lastplayDomain = "LASTPLAYED_PLUGINS"; } // 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); - if(hdr->type == TYPE_PLUGIN && m_plugin.GetEnabledStatus(m_plugin.GetPluginPosition(hdr->settings[0]))) - CoverFlow.addItem(&(*hdr), 0, 0); - else + if(hdr->type != TYPE_HOMEBREW && strcmp(hdr->id, "PLUGIN") != 0) { - int playcount = m_gcfg1.getInt("PLAYCOUNT", cfgKey1, 0); - unsigned int lastPlayed = m_gcfg1.getUInt("LASTPLAYED", cfgKey1, 0); + int playcount = m_gcfg1.getInt(playcntDomain, 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); } + else + CoverFlow.addItem(&(*hdr), 0, 0); } /* remove them if false to keep file short */ if(!m_gcfg1.getBool(favDomain, cfgKey1)) @@ -2592,14 +2601,30 @@ bool CMenu::_loadPluginList() } 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)); bool preCachedList = fsop_FileExist(cachedListFile.c_str()); + + string romsDir(fmt("%s:/%s", DeviceName[currentPartition], romDir)); vector FileTypes = stringToVector(m_plugin.GetFileTypes(i), '|'); m_cacheList.Color = m_plugin.GetCaseColor(i); m_cacheList.Magic = m_plugin.GetPluginMagic(i); 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::iterator tmp_itr = m_cacheList.begin(); tmp_itr != m_cacheList.end(); tmp_itr++) m_gameList.push_back(*tmp_itr); if(updateCache || (!preCachedList && fsop_FileExist(cachedListFile.c_str()))) diff --git a/source/menu/menu_config_game.cpp b/source/menu/menu_config_game.cpp index 68247e29..ed84c7f5 100644 --- a/source/menu/menu_config_game.cpp +++ b/source/menu/menu_config_game.cpp @@ -465,7 +465,7 @@ void CMenu::_configGame(const dir_discHdr *hdr, bool disc) 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(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 { if(strrchr(GameHdr->path, '/') != NULL) diff --git a/source/menu/menu_game_boot.cpp b/source/menu/menu_game_boot.cpp index 4f0b9cf1..6a25ad54 100644 --- a/source/menu/menu_game_boot.cpp +++ b/source/menu/menu_game_boot.cpp @@ -195,6 +195,14 @@ void CMenu::_launch(const 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 */ const char *plugin_dol_name = m_plugin.GetDolName(hdr->settings[0]); u8 plugin_dol_len = strlen(plugin_dol_name); diff --git a/source/menu/menu_main.cpp b/source/menu/menu_main.cpp index a547bd20..ce3c0a5d 100644 --- a/source/menu/menu_main.cpp +++ b/source/menu/menu_main.cpp @@ -491,9 +491,9 @@ int CMenu::main(void) } 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(); - 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(); 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)) @@ -639,34 +639,32 @@ int CMenu::main(void) else if(BTN_B_PRESSED) { 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)) { bUsed = true; const char *domain = _domainFromView(); 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); - m_cfg.setInt(domain, "sort", SORT_ALPHA); - sorting = SORT_ALPHA; - } - wchar_t c[2] = {0, 0}; - m_btnMgr.selected(m_mainBtnPrev) ? CoverFlow.prevLetter(c) : CoverFlow.nextLetter(c); - m_showtimer = 120; - curLetter.clear(); - curLetter = wstringEx(c); + wchar_t c[5] = {0, 0, 0, 0, 0};// long enuff for year + m_btnMgr.selected(m_mainBtnPrev) ? CoverFlow.prevLetter(c) : CoverFlow.nextLetter(c); + m_showtimer = 120; + curLetter.clear(); + curLetter = wstringEx(c); - if(sorting == SORT_ALPHA) - { - m_btnMgr.setText(m_mainLblLetter, curLetter); - m_btnMgr.show(m_mainLblLetter); - } - else - { - curLetter = _getNoticeTranslation(sorting, curLetter); + if(sorting != SORT_ALPHA && sorting != SORT_YEAR)// #players, #wifiplayers, id = VC type, wiiware, wii, or GC listed as unknown + curLetter = _getNoticeTranslation(sorting, curLetter); + m_showtimer = 120; m_btnMgr.setText(m_mainLblNotice, curLetter); m_btnMgr.show(m_mainLblNotice); } + else + m_btnMgr.selected(m_mainBtnPrev) ? CoverFlow.pageUp() : CoverFlow.pageDown(); } } else if(WROLL_LEFT) @@ -708,39 +706,32 @@ int CMenu::main(void) else // Button B Held { bheld = true; - const char *domain = _domainFromView(); - /* b+down or up = move to previous or next cover in sort order */ if(!CoverFlow.empty() && (BTN_DOWN_PRESSED || BTN_UP_PRESSED)) { bUsed = true; + const char *domain = _domainFromView(); int sorting = m_cfg.getInt(domain, "sort", SORT_ALPHA); - /* if for some reason domain sort value is not legal set it to 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); - m_cfg.setInt(domain, "sort", SORT_ALPHA); - sorting = SORT_ALPHA; - } - /* move coverflow */ - wchar_t c[2] = {0, 0}; - BTN_UP_PRESSED ? CoverFlow.prevLetter(c) : CoverFlow.nextLetter(c); + wchar_t c[5] = {0, 0, 0, 0, 0};// long enuough for year + BTN_UP_PRESSED ? CoverFlow.prevLetter(c) : CoverFlow.nextLetter(c); + m_showtimer = 120; + curLetter.clear(); + curLetter = wstringEx(c); - /* set sort text and display it */ - curLetter.clear(); - curLetter = wstringEx(c); - m_showtimer = 120; - if(sorting == SORT_ALPHA) - { - m_btnMgr.setText(m_mainLblLetter, curLetter); - m_btnMgr.show(m_mainLblLetter); - } - else - { - curLetter = _getNoticeTranslation(sorting, curLetter); + if(sorting != SORT_ALPHA && sorting != SORT_YEAR)// #players, #wifiplayers, id = VC type, wiiware, wii, or GC listed as unknown + curLetter = _getNoticeTranslation(sorting, curLetter); + m_showtimer = 120; m_btnMgr.setText(m_mainLblNotice, curLetter); m_btnMgr.show(m_mainLblNotice); } + else + BTN_UP_PRESSED ? CoverFlow.pageUp() : CoverFlow.pageDown(); } else if(BTN_LEFT_PRESSED)// b+left = previous song { @@ -753,9 +744,10 @@ int CMenu::main(void) MusicPlayer.Next(); } /* 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; + const char *domain = _domainFromView(); u8 sort = 0; if(m_sourceflow)// change sourceflow sort mode { @@ -766,13 +758,24 @@ int CMenu::main(void) sort = SORT_ALPHA; } 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 */ _initCF(); /* set sort mode text and display it */ - wstringEx curSort ; + wstringEx curSort; if(sort == SORT_ALPHA) curSort = m_loc.getWString(m_curLanguage, "alphabetically", L"Alphabetically"); else if(sort == SORT_PLAYCOUNT) @@ -787,6 +790,8 @@ int CMenu::main(void) curSort = m_loc.getWString(m_curLanguage, "byplayers", L"By Players"); else if(sort == SORT_BTN_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_btnMgr.setText(m_mainLblNotice, curSort); m_btnMgr.show(m_mainLblNotice); diff --git a/wii/wiiflow/Languages/english.ini b/wii/wiiflow/Languages/english.ini index 8fa850d6..9b7d493b 100644 --- a/wii/wiiflow/Languages/english.ini +++ b/wii/wiiflow/Languages/english.ini @@ -22,6 +22,7 @@ bylastplayed=By Last Played byplaycount=By Play Count byplayers=By Players bywifiplayers=By Wifi Players +byyear=By Year Released bybtnnumbers=By Button Numbers cat1=Select Categories cat2=Clear