mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-11-27 13:44:15 +01:00
- code cleanup so custom banners and snapshots and game info snapshots all work nicely with each other.
- fixed source menu/flow to remember tier filenames and the last selected button from each tier. tier names and button numbers are saved in wiiflow_lite.ini under [SOURCEFLOW] so when you return to wiiflow everything will be as it was when you left.
This commit is contained in:
parent
f3bc0d7ce5
commit
c33e07076d
Binary file not shown.
BIN
out/boot.dol
BIN
out/boot.dol
Binary file not shown.
Before Width: | Height: | Size: 3.4 MiB After Width: | Height: | Size: 3.4 MiB |
@ -6,7 +6,7 @@
|
||||
#else
|
||||
#define APP_NAME "WiiFlow Lite"
|
||||
#endif
|
||||
#define APP_VERSION "5.3.0 beta 10"
|
||||
#define APP_VERSION "5.3.0 beta 11"
|
||||
|
||||
#define APP_DATA_DIR "wiiflow"
|
||||
#ifdef APP_WIIFLOW
|
||||
|
@ -1623,28 +1623,36 @@ void CCoverFlow::_setCurPos(u32 index)
|
||||
_updateAllTargets(true);
|
||||
}
|
||||
|
||||
bool CCoverFlow::_setCurPosToID(const char *id, bool instant, bool path)
|
||||
bool CCoverFlow::_setCurPosToCurItem(const char *id, const char *filename, u32 sourceNumber, bool instant)
|
||||
{
|
||||
LockMutex lock(m_mutex);
|
||||
u32 i, curPos = _currentPos();
|
||||
|
||||
if(m_items.empty() || (instant && m_covers == NULL) || strlen(id) == 0)
|
||||
if(m_items.empty() || (instant && m_covers == NULL))
|
||||
return false;
|
||||
//
|
||||
for(i = 0; i < m_items.size(); ++i)
|
||||
{
|
||||
if(path)
|
||||
if(strlen(filename) > 0)
|
||||
{
|
||||
//homebrew folder or rom title.ext
|
||||
const char *name = strrchr(m_items[i].hdr->path, '/');
|
||||
if(name != NULL && strcasecmp(name + 1, id) == 0)
|
||||
if(name != NULL && strcasecmp(name + 1, filename) == 0)
|
||||
break;
|
||||
else if(strcmp(m_items[i].hdr->path, id) == 0)// scummvm
|
||||
else if(strcmp(m_items[i].hdr->path, filename) == 0)// scummvm
|
||||
break;
|
||||
}
|
||||
else if(strcmp(m_items[i].hdr->id, id) == 0)
|
||||
else if(strlen(id) > 0)
|
||||
{
|
||||
if(strcasecmp(m_items[i].hdr->id, id) == 0)
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(m_items[i].hdr->settings[0] == sourceNumber)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(i >= m_items.size())
|
||||
return false;
|
||||
m_jump = 0;
|
||||
@ -1909,7 +1917,7 @@ bool CCoverFlow::start(const string &m_imgsDir)
|
||||
{
|
||||
if (m_items.empty()) return true;
|
||||
|
||||
// Sort items
|
||||
/* sort coverflow items list based on sort type */
|
||||
if (m_sorting == SORT_ALPHA)
|
||||
sort(m_items.begin(), m_items.end(), CCoverFlow::_sortByAlpha);
|
||||
else if (m_sorting == SORT_PLAYCOUNT)
|
||||
@ -1925,7 +1933,7 @@ bool CCoverFlow::start(const string &m_imgsDir)
|
||||
else if (m_sorting == SORT_BTN_NUMBERS)
|
||||
sort(m_items.begin(), m_items.end(), CCoverFlow::_sortByBtnNumbers);
|
||||
|
||||
// Load resident textures
|
||||
/* load the colored skin/spine images if not already done */
|
||||
if(!m_dvdskin_loaded)
|
||||
{
|
||||
if(TexHandle.fromImageFile(m_dvdSkin, fmt("%s/dvdskin.jpg", m_imgsDir.c_str())) != TE_OK)
|
||||
@ -1942,6 +1950,7 @@ bool CCoverFlow::start(const string &m_imgsDir)
|
||||
return false;
|
||||
m_dvdskin_loaded = true;
|
||||
}
|
||||
/* load the no pic or loading cover images if not already done */
|
||||
if(!m_defcovers_loaded)
|
||||
{
|
||||
if(m_pngLoadCover.empty() || TexHandle.fromImageFile(m_boxLoadingTexture, m_pngLoadCover.c_str(), GX_TF_CMPR, 32, 512) != TE_OK)
|
||||
@ -1967,6 +1976,7 @@ bool CCoverFlow::start(const string &m_imgsDir)
|
||||
m_defcovers_loaded = true;
|
||||
}
|
||||
|
||||
/* allocate enough memory for the covers list (m_covers) based on rows * columns (m_range) */
|
||||
if(m_covers != NULL)
|
||||
MEM2_free(m_covers);
|
||||
m_covers = NULL;
|
||||
|
@ -52,7 +52,7 @@ public:
|
||||
void startCoverLoader(void);
|
||||
u32 _currentPos(void) const;
|
||||
void _setCurPos(u32 index);
|
||||
bool _setCurPosToID(const char *id, bool instant = false, bool path = false);
|
||||
bool _setCurPosToCurItem(const char *id, const char *filename, u32 sourceNumber, bool instant = false);
|
||||
//
|
||||
void simulateOtherScreenFormat(bool s);
|
||||
// Commands
|
||||
|
@ -1672,7 +1672,8 @@ void CMenu::_mainLoopCommon(bool withCF, bool adjusting)
|
||||
CoverFlow.draw();
|
||||
m_vid.setup2DProjection(false, true);
|
||||
CoverFlow.drawEffect();
|
||||
if(!m_banner.GetSelectedGame() && (!m_snapshot_loaded && !m_soundThrdBusy && m_gameSelected))
|
||||
//if(startGameSound == 1 && !m_soundThrdBusy && !m_banner.GetSelectedGame() && !m_snapshot_loaded)
|
||||
if(!m_soundThrdBusy && !m_banner.GetSelectedGame() && !m_snapshot_loaded)
|
||||
CoverFlow.drawText(adjusting);
|
||||
m_vid.renderAAPass(i);
|
||||
}
|
||||
@ -1688,7 +1689,7 @@ void CMenu::_mainLoopCommon(bool withCF, bool adjusting)
|
||||
CoverFlow.draw();
|
||||
m_vid.setup2DProjection();
|
||||
CoverFlow.drawEffect();
|
||||
if(!m_banner.GetSelectedGame() && (!m_snapshot_loaded && !m_soundThrdBusy && m_gameSelected))
|
||||
if(!m_soundThrdBusy && !m_banner.GetSelectedGame() && !m_snapshot_loaded)
|
||||
CoverFlow.drawText(adjusting);
|
||||
}
|
||||
}
|
||||
@ -2161,8 +2162,10 @@ void CMenu::_initCF(void)
|
||||
m_cfg.setBool("GENERAL", "dump_list", false);
|
||||
}
|
||||
|
||||
/*********************** sort coverflow list ***********************/
|
||||
CoverFlow.setSorting(m_source_cnt > 1 ? (Sorting)0 : (Sorting)m_cfg.getInt(_domainFromView(), "sort", 0));
|
||||
|
||||
/*********************** set box mode and small box mode **************************/
|
||||
if(!m_sourceflow)
|
||||
{
|
||||
if(m_current_view == COVERFLOW_HOMEBREW)
|
||||
@ -2243,15 +2246,17 @@ void CMenu::_initCF(void)
|
||||
CoverFlow.setSmallBoxMode(m_cfg.getBool(SOURCEFLOW_DOMAIN, "smallbox", false));
|
||||
}
|
||||
|
||||
/*********************** Setup coverflow covers settings ***********************/
|
||||
CoverFlow.setBufferSize(m_cfg.getInt("GENERAL", "cover_buffer", 20));
|
||||
CoverFlow.setHQcover(m_cfg.getBool("GENERAL", "cover_use_hq", true));
|
||||
CoverFlow.start(m_imgsDir);
|
||||
|
||||
/*********************** Get and set game list current item to center cover **************************/
|
||||
if(!CoverFlow.empty())
|
||||
{
|
||||
bool path = false;
|
||||
char cur_item[64];
|
||||
cur_item[63] = '\0';
|
||||
/* get ID or filename or source number of center cover */
|
||||
string ID = "", filename = "";
|
||||
u32 sourceNumber = 0;
|
||||
if(m_current_view == COVERFLOW_PLUGIN && !m_sourceflow)
|
||||
{
|
||||
strncpy(m_plugin.PluginMagicWord, m_cfg.getString(PLUGIN_DOMAIN, "cur_magic").c_str(), 8);
|
||||
@ -2266,25 +2271,29 @@ void CMenu::_initCF(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
path = true;
|
||||
if(strncasecmp(m_plugin.PluginMagicWord, "4E47434D", 8) == 0)//NGCM
|
||||
path = false;
|
||||
if(strncasecmp(m_plugin.PluginMagicWord, "4E574949", 8) == 0)//NWII
|
||||
path = false;
|
||||
if(strncasecmp(m_plugin.PluginMagicWord, "4E414E44", 8) == 0)//NAND
|
||||
path = false;
|
||||
if(strncasecmp(m_plugin.PluginMagicWord, "454E414E", 8) == 0)//EMUNAND
|
||||
path = false;
|
||||
strncpy(cur_item, m_cfg.getString("plugin_item", m_plugin.PluginMagicWord).c_str(), 63);
|
||||
}
|
||||
ID = m_cfg.getString("plugin_item", m_plugin.PluginMagicWord, "");
|
||||
else if(strncasecmp(m_plugin.PluginMagicWord, "4E574949", 8) == 0)//NWII
|
||||
ID = m_cfg.getString("plugin_item", m_plugin.PluginMagicWord, "");
|
||||
else if(strncasecmp(m_plugin.PluginMagicWord, "4E414E44", 8) == 0)//NAND
|
||||
ID = m_cfg.getString("plugin_item", m_plugin.PluginMagicWord, "");
|
||||
else if(strncasecmp(m_plugin.PluginMagicWord, "454E414E", 8) == 0)//EMUNAND
|
||||
ID = m_cfg.getString("plugin_item", m_plugin.PluginMagicWord, "");
|
||||
else
|
||||
{
|
||||
if(m_sourceflow || m_current_view == COVERFLOW_HOMEBREW || (m_source_cnt > 1 && NoGameID(m_cfg.getInt("MULTI", "current_item_type", TYPE_PLUGIN))))
|
||||
path = true;
|
||||
strncpy(cur_item, m_cfg.getString(_domainFromView(), "current_item").c_str(), 63);
|
||||
filename = m_cfg.getString("plugin_item", m_plugin.PluginMagicWord, "");
|
||||
}
|
||||
if(!CoverFlow._setCurPosToID(cur_item, true, path))
|
||||
CoverFlow._setCurPos(0);
|
||||
else if(m_sourceflow && sm_numbers.size() > 0)
|
||||
sourceNumber = stoi(sm_numbers[sm_numbers.size() - 1]);
|
||||
else if(m_current_view == COVERFLOW_HOMEBREW || (m_source_cnt > 1 && NoGameID(m_cfg.getInt("MULTI", "current_item_type", TYPE_PLUGIN))))
|
||||
filename = m_cfg.getString(_domainFromView(), "current_item", "");
|
||||
else
|
||||
ID = m_cfg.getString(_domainFromView(), "current_item", "");
|
||||
|
||||
/* set center cover as coverflow current position */
|
||||
if(!CoverFlow._setCurPosToCurItem(ID.c_str(), filename.c_str(), sourceNumber, true))
|
||||
CoverFlow._setCurPos(0);// if not found set first cover as coverflow current position
|
||||
|
||||
/************************** create and start the cover loader thread *************************/
|
||||
CoverFlow.startCoverLoader();
|
||||
}
|
||||
}
|
||||
|
@ -67,6 +67,8 @@ private:
|
||||
bool Auto_hide_icons;
|
||||
bool m_snapshot_loaded;
|
||||
vector<dir_discHdr> m_gameList;
|
||||
vector<string> tiers;
|
||||
vector<string> sm_numbers;
|
||||
|
||||
struct SZone
|
||||
{
|
||||
|
@ -251,6 +251,7 @@ void CMenu::_hideGame(bool instant)
|
||||
m_btnMgr.hide(m_gameBtnFavoriteOn, instant);
|
||||
m_btnMgr.hide(m_gameBtnFavoriteOff, instant);
|
||||
m_btnMgr.hide(m_gameBtnCategories, instant);
|
||||
m_btnMgr.hide(m_gameLblSnapBg, instant);
|
||||
m_btnMgr.hide(m_gameLblSnap, instant);
|
||||
m_btnMgr.hide(m_gameLblOverlay, instant);
|
||||
m_btnMgr.hide(m_gameLblSnapFrame, instant);
|
||||
@ -1044,8 +1045,16 @@ void * CMenu::_gameSoundThread(void *obj)
|
||||
CMenu *m = (CMenu*)obj;
|
||||
m->m_soundThrdBusy = true;
|
||||
m->m_gamesound_changed = false;
|
||||
m->m_snapshot_loaded = false;
|
||||
m_banner_loaded = false;
|
||||
|
||||
CurrentBanner.ClearBanner();//clear current banner from memory
|
||||
|
||||
/* Set to empty textures to clear current snapshot from screen */
|
||||
TexData emptyTex;
|
||||
m_btnMgr.setTexture(m->m_gameLblSnap, emptyTex);
|
||||
m_btnMgr.setTexture(m->m_gameLblOverlay, emptyTex);
|
||||
|
||||
u8 *custom_bnr_file = NULL;
|
||||
u32 custom_bnr_size = 0;
|
||||
char custom_banner[256];
|
||||
@ -1060,9 +1069,8 @@ void * CMenu::_gameSoundThread(void *obj)
|
||||
char game_sound[256];
|
||||
game_sound[255] = '\0';
|
||||
|
||||
m->m_snapshot_loaded = false;
|
||||
m_banner_loaded = false;
|
||||
const dir_discHdr *GameHdr = CoverFlow.getHdr();
|
||||
|
||||
if(GameHdr->type == TYPE_PLUGIN)
|
||||
{
|
||||
const char *coverDir = NULL;
|
||||
@ -1093,17 +1101,15 @@ void * CMenu::_gameSoundThread(void *obj)
|
||||
/* if no banner try getting snap shot */
|
||||
if((custom_bnr_size == 0 || custom_bnr_file == NULL) && m->m_platform.loaded())
|
||||
{
|
||||
gprintf("trying to get snapshot\n");
|
||||
m_banner.DeleteBanner();
|
||||
char GameID[7];
|
||||
GameID[6] = '\0';
|
||||
char platformName[264];
|
||||
const char *TMP_Char = NULL;
|
||||
GameTDB gametdb;
|
||||
TexData emptyTex;
|
||||
|
||||
/* Set to empty textures in case images not found */
|
||||
m_btnMgr.setTexture(m->m_gameLblSnap, emptyTex);
|
||||
m_btnMgr.setTexture(m->m_gameLblOverlay, emptyTex);
|
||||
|
||||
strncpy(m_plugin.PluginMagicWord, fmt("%08x", GameHdr->settings[0]), 8);
|
||||
snprintf(platformName, sizeof(platformName), "%s", m->m_platform.getString("PLUGINS", m_plugin.PluginMagicWord).c_str());
|
||||
strncpy(GameID, GameHdr->id, 6);
|
||||
|
||||
@ -1122,7 +1128,16 @@ void * CMenu::_gameSoundThread(void *obj)
|
||||
gametdb.SetLanguageCode(m->m_loc.getString(m->m_curLanguage, "gametdb_code", "EN").c_str());
|
||||
|
||||
/* Get roms's title without the extra ()'s or []'s */
|
||||
string ShortName = m_plugin.GetRomName(GameHdr->path);
|
||||
string ShortName;
|
||||
if(strrchr(GameHdr->path, '/') != NULL)
|
||||
ShortName = m_plugin.GetRomName(GameHdr->path);
|
||||
else
|
||||
{
|
||||
char title[64];
|
||||
wcstombs(title, GameHdr->title, 63);
|
||||
title[63] = '\0';
|
||||
ShortName = title;
|
||||
}
|
||||
|
||||
const char *snap_path = NULL;
|
||||
if(strcasestr(platformName, "ARCADE") || strcasestr(platformName, "CPS") || !strncasecmp(platformName, "NEOGEO", 6))
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "plugin/plugin.hpp"
|
||||
#include "plugin/crc32.h"
|
||||
#include "unzip/ZipFile.h"
|
||||
#include "banner/BannerWindow.hpp"
|
||||
|
||||
s16 m_gameinfoLblRomInfo;
|
||||
|
||||
@ -178,6 +179,11 @@ void CMenu::_gameinfo(void)
|
||||
}
|
||||
_hideGameInfo(false);
|
||||
TexHandle.Cleanup(m_cart);
|
||||
if(m_banner.GetSelectedGame())// if banner is available we need to clear snap and overlay here.
|
||||
{
|
||||
TexHandle.Cleanup(m_snap);
|
||||
TexHandle.Cleanup(m_overlay);
|
||||
}
|
||||
}
|
||||
|
||||
void CMenu::_hideGameInfo(bool instant)
|
||||
@ -364,17 +370,52 @@ void CMenu::_textGameInfo(void)
|
||||
gametdb.SetLanguageCode(m_loc.getString(m_curLanguage, "gametdb_code", "EN").c_str());
|
||||
|
||||
/* Get roms's title without the extra ()'s or []'s */
|
||||
string ShortName = m_plugin.GetRomName(GameHdr->path);
|
||||
string ShortName;
|
||||
if(strrchr(GameHdr->path, '/') != NULL)
|
||||
ShortName = m_plugin.GetRomName(GameHdr->path);
|
||||
else
|
||||
{
|
||||
char title[64];
|
||||
wcstombs(title, GameHdr->title, 63);
|
||||
title[63] = '\0';
|
||||
ShortName = title;
|
||||
}
|
||||
|
||||
/* Set to empty textures in case images not found */
|
||||
m_btnMgr.setTexture(m_gameinfoLblSnap, emptyTex);
|
||||
m_btnMgr.setTexture(m_gameinfoLblCartDisk, emptyTex);
|
||||
m_btnMgr.setTexture(m_gameinfoLblOverlay, emptyTex);
|
||||
|
||||
if(m_snap.data != NULL)
|
||||
if(m_banner.GetSelectedGame())
|
||||
{
|
||||
const char *snap_path = NULL;
|
||||
if(strcasestr(platformName, "ARCADE") || strcasestr(platformName, "CPS") || !strncasecmp(platformName, "NEOGEO", 6))
|
||||
snap_path = fmt("%s/%s/%s.png", m_snapDir.c_str(), platformName, ShortName.c_str());
|
||||
else if(gametdb.GetName(GameID, TMP_Char))
|
||||
snap_path = fmt("%s/%s/%s.png", m_snapDir.c_str(), platformName, TMP_Char);
|
||||
|
||||
if(snap_path == NULL || !fsop_FileExist(snap_path))
|
||||
snap_path = fmt("%s/%s/%s.png", m_snapDir.c_str(), platformName, GameID);
|
||||
|
||||
if(fsop_FileExist(snap_path))
|
||||
{
|
||||
TexHandle.fromImageFile(m_snap, snap_path);
|
||||
m_btnMgr.setTexture(m_gameinfoLblSnap, m_snap, m_snap.width, m_snap.height);
|
||||
}
|
||||
}
|
||||
else if(m_snap.data != NULL)
|
||||
m_btnMgr.setTexture(m_gameinfoLblSnap, m_snap, m_snap.width, m_snap.height);
|
||||
|
||||
if(m_overlay.data != NULL)
|
||||
if(m_banner.GetSelectedGame())
|
||||
{
|
||||
const char *overlay_path = fmt("%s/%s_overlay.png", m_snapDir.c_str(), platformName);
|
||||
if(fsop_FileExist(overlay_path))
|
||||
{
|
||||
TexHandle.fromImageFile(m_overlay, overlay_path);
|
||||
m_btnMgr.setTexture(m_gameinfoLblOverlay, m_overlay, m_overlay.width, m_overlay.height);
|
||||
}
|
||||
}
|
||||
else if(m_overlay.data != NULL)
|
||||
m_btnMgr.setTexture(m_gameinfoLblOverlay, m_overlay, m_overlay.width, m_overlay.height);
|
||||
|
||||
const char *cart_path = NULL;
|
||||
|
@ -21,7 +21,7 @@ static u8 i, j, k;
|
||||
int curPage;
|
||||
int numPages;
|
||||
vector<string> magicNums;
|
||||
vector<string> tiers;
|
||||
|
||||
char btn_selected[16];
|
||||
char current_btn[16];
|
||||
int curflow = 1;
|
||||
@ -30,11 +30,16 @@ int channels_type;
|
||||
|
||||
void CMenu::_sourceFlow()
|
||||
{
|
||||
string numbers;
|
||||
string trs;
|
||||
const dir_discHdr *hdr = CoverFlow.getHdr();
|
||||
if(m_cfg.getBool(SOURCEFLOW_DOMAIN, "remember_last_item", true))
|
||||
m_cfg.setString(SOURCEFLOW_DOMAIN, "current_item", strrchr(hdr->path, '/') + 1);
|
||||
else
|
||||
m_cfg.remove(SOURCEFLOW_DOMAIN, "current_item");
|
||||
|
||||
// save source number for return
|
||||
sm_numbers[sm_numbers.size() - 1] = to_string(hdr->settings[0]);
|
||||
numbers = sm_numbers[0];
|
||||
for(u8 i = 1; i < sm_numbers.size(); i++)
|
||||
numbers.append(',' + sm_numbers[i]);
|
||||
m_cfg.setString(SOURCEFLOW_DOMAIN, "numbers", numbers);
|
||||
|
||||
memset(btn_selected, 0, 16);
|
||||
strncpy(btn_selected, fmt("BUTTON_%i", hdr->settings[0]), 15);
|
||||
@ -91,12 +96,24 @@ void CMenu::_sourceFlow()
|
||||
{
|
||||
sm_tier = false;
|
||||
tiers.erase(tiers.begin() + 1, tiers.end());
|
||||
sm_numbers.erase(sm_numbers.begin() + 1, sm_numbers.end());
|
||||
}
|
||||
else
|
||||
{
|
||||
sm_tier = true;
|
||||
tiers.push_back(fn);
|
||||
sm_numbers.push_back("0");
|
||||
}
|
||||
trs = tiers[0];
|
||||
numbers = sm_numbers[0];
|
||||
for(u8 i = 1; i < tiers.size(); i++)
|
||||
{
|
||||
trs.append(',' + tiers[i]);
|
||||
numbers.append(',' + sm_numbers[i]);
|
||||
}
|
||||
m_cfg.setString(SOURCEFLOW_DOMAIN, "tiers", trs);
|
||||
m_cfg.setString(SOURCEFLOW_DOMAIN, "numbers", numbers);
|
||||
|
||||
m_source.unload();
|
||||
m_source.load(fmt("%s/%s", m_sourceDir.c_str(), fn.c_str()));
|
||||
SF_cacheCovers = true;
|
||||
@ -152,11 +169,13 @@ bool CMenu::_srcTierBack(bool home)
|
||||
{
|
||||
fn = tiers[0];
|
||||
tiers.erase(tiers.begin() + 1, tiers.end());
|
||||
sm_numbers.erase(sm_numbers.begin() + 1, sm_numbers.end());
|
||||
}
|
||||
else
|
||||
{
|
||||
fn = tiers[tiers.size() - 2];
|
||||
tiers.pop_back();
|
||||
sm_numbers.pop_back();
|
||||
}
|
||||
|
||||
if(fn == SOURCE_FILENAME)
|
||||
@ -182,7 +201,13 @@ bool CMenu::_srcTierBack(bool home)
|
||||
}
|
||||
srcDomain = m_source.nextDomain().c_str();
|
||||
}
|
||||
if(m_sourceflow)
|
||||
_setSrcFlowBg();
|
||||
else
|
||||
{
|
||||
curPage = stoi(sm_numbers[sm_numbers.size() - 1]) / 12 + 1;
|
||||
numPages = (m_max_source_btn / 12) + 1;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -362,7 +387,7 @@ bool CMenu::_Source()
|
||||
bool newSource = false;
|
||||
bool updateSource = false;
|
||||
exitSource = false;
|
||||
curPage = 1;
|
||||
curPage = stoi(sm_numbers[sm_numbers.size() - 1]) / 12 + 1;
|
||||
numPages = (m_max_source_btn / 12) + 1;
|
||||
channels_type = m_cfg.getInt(CHANNEL_DOMAIN, "channels_type", CHANNELS_REAL);
|
||||
|
||||
@ -374,18 +399,14 @@ bool CMenu::_Source()
|
||||
{
|
||||
updateSource = false;
|
||||
_mainLoopCommon();
|
||||
if(BTN_HOME_PRESSED)
|
||||
if(BTN_HOME_PRESSED || BTN_B_PRESSED)
|
||||
{
|
||||
_hideSource();
|
||||
_CfgSrc();
|
||||
if(m_cfg.getBool(SOURCEFLOW_DOMAIN, "enabled"))
|
||||
return true;
|
||||
if(m_multisource)
|
||||
newSource = true;
|
||||
_showSource();
|
||||
if(!_srcTierBack(BTN_HOME_PRESSED))
|
||||
exitSource = true;
|
||||
else
|
||||
_updateSourceBtns();
|
||||
}
|
||||
if((BTN_A_PRESSED && m_btnMgr.selected(m_sourceBtnBack)) || BTN_B_PRESSED)
|
||||
if((BTN_A_PRESSED && m_btnMgr.selected(m_sourceBtnBack)) || exitSource)
|
||||
{
|
||||
if(!m_multisource) break;
|
||||
if(selectedBtns == 0)
|
||||
@ -462,6 +483,8 @@ bool CMenu::_Source()
|
||||
}
|
||||
if(!m_multisource && i < 12)
|
||||
{
|
||||
// save source number for return
|
||||
sm_numbers.push_back(to_string(i + j));
|
||||
exitSource = true;
|
||||
m_catStartPage = 1;
|
||||
if(source == "dml")
|
||||
@ -519,17 +542,33 @@ bool CMenu::_Source()
|
||||
if(fsop_FileExist(fmt("%s/%s", m_sourceDir.c_str(), fn.c_str())))
|
||||
{
|
||||
if(fn == SOURCE_FILENAME)
|
||||
{
|
||||
sm_tier = false;
|
||||
tiers.erase(tiers.begin() + 1, tiers.end());
|
||||
sm_numbers.erase(sm_numbers.begin() + 1, sm_numbers.end());
|
||||
}
|
||||
else
|
||||
{
|
||||
sm_tier = true;
|
||||
tiers.push_back(fn);
|
||||
sm_numbers.push_back("0");
|
||||
}
|
||||
string trs = tiers[0];
|
||||
string numbers = sm_numbers[0];
|
||||
for(u8 i = 1; i < tiers.size(); i++)
|
||||
{
|
||||
trs.append(',' + tiers[i]);
|
||||
numbers.append(',' + sm_numbers[i]);
|
||||
}
|
||||
m_cfg.setString(SOURCEFLOW_DOMAIN, "tiers", trs);
|
||||
m_cfg.setString(SOURCEFLOW_DOMAIN, "numbers", numbers);
|
||||
|
||||
m_source.unload();
|
||||
m_source.load(fmt("%s/%s", m_sourceDir.c_str(), fn.c_str()));
|
||||
fn.replace(fn.find("."), 4, "_flow");
|
||||
curflow = m_cfg.getInt(SOURCEFLOW_DOMAIN, fn, m_cfg.getInt(SOURCEFLOW_DOMAIN, "last_cf_mode", 1));
|
||||
exitSource = false;
|
||||
updateSource = true;
|
||||
curPage = 1;
|
||||
/* get max source button # */
|
||||
m_max_source_btn = 0;
|
||||
const char *srcDomain = m_source.firstDomain().c_str();
|
||||
@ -545,6 +584,7 @@ bool CMenu::_Source()
|
||||
}
|
||||
srcDomain = m_source.nextDomain().c_str();
|
||||
}
|
||||
curPage = stoi(sm_numbers[sm_numbers.size() - 1]) / 12 + 1;
|
||||
numPages = (m_max_source_btn / 12) + 1;
|
||||
}
|
||||
}
|
||||
@ -747,9 +787,9 @@ void CMenu::_initSourceMenu()
|
||||
{
|
||||
m_use_source = false;
|
||||
|
||||
if(!m_source.load(fmt("%s/%s/%s", m_sourceDir.c_str(), m_themeName.c_str(), SOURCE_FILENAME)))// check for source_menu/theme/source_menu.ini
|
||||
if(!fsop_FileExist(fmt("%s/%s/%s", m_sourceDir.c_str(), m_themeName.c_str(), SOURCE_FILENAME)))// check for source_menu/theme/source_menu.ini
|
||||
{
|
||||
if(!m_source.load(fmt("%s/%s", m_sourceDir.c_str(), SOURCE_FILENAME)))// check for source_menu/source_menu.ini
|
||||
if(!fsop_FileExist(fmt("%s/%s", m_sourceDir.c_str(), SOURCE_FILENAME)))// check for source_menu/source_menu.ini
|
||||
return;// no source_menu.ini so we dont init nor use source menu, just return.
|
||||
}
|
||||
else // if source_menu/theme/source_menu.ini found then change m_sourceDir to source_menu/theme/
|
||||
@ -758,6 +798,35 @@ void CMenu::_initSourceMenu()
|
||||
/* let wiiflow know source_menu.ini found and we will be using it */
|
||||
m_use_source = true;
|
||||
|
||||
sm_numbers.clear();
|
||||
tiers.clear();
|
||||
sm_numbers = m_cfg.getStrings(SOURCEFLOW_DOMAIN, "numbers");
|
||||
tiers = m_cfg.getStrings(SOURCEFLOW_DOMAIN, "tiers");
|
||||
if(tiers.size() == 0)
|
||||
{
|
||||
tiers.push_back(SOURCE_FILENAME);
|
||||
sm_numbers.push_back("0");
|
||||
}
|
||||
sm_tier = false;
|
||||
if(tiers.size() > 1)
|
||||
sm_tier = true;
|
||||
|
||||
string trs = tiers[0];
|
||||
string numbers = sm_numbers[0];
|
||||
for(u8 i = 1; i < tiers.size(); i++)
|
||||
{
|
||||
trs.append(',' + tiers[i]);
|
||||
numbers.append(',' + sm_numbers[i]);
|
||||
}
|
||||
m_cfg.setString(SOURCEFLOW_DOMAIN, "tiers", trs);
|
||||
m_cfg.setString(SOURCEFLOW_DOMAIN, "numbers", numbers);
|
||||
|
||||
string fn = tiers[tiers.size() - 1];
|
||||
m_source.load(fmt("%s/%s", m_sourceDir.c_str(), fn.c_str()));
|
||||
|
||||
fn.replace(fn.find("."), 4, "_flow");
|
||||
curflow = m_cfg.getInt(SOURCEFLOW_DOMAIN, fn, m_cfg.getInt(SOURCEFLOW_DOMAIN, "last_cf_mode", 1));
|
||||
|
||||
/* get max source button # */
|
||||
m_max_source_btn = 0;
|
||||
const char *srcDomain = m_source.firstDomain().c_str();
|
||||
@ -774,13 +843,6 @@ void CMenu::_initSourceMenu()
|
||||
srcDomain = m_source.nextDomain().c_str();
|
||||
}
|
||||
|
||||
tiers.clear();
|
||||
tiers.push_back(SOURCE_FILENAME);
|
||||
sm_tier = false;
|
||||
string fn = tiers[0];
|
||||
fn.replace(fn.find("."), 4, "_flow");
|
||||
curflow = m_cfg.getInt(SOURCEFLOW_DOMAIN, fn, m_cfg.getInt(SOURCEFLOW_DOMAIN, "last_cf_mode", 1));
|
||||
|
||||
_addUserLabels(m_sourceLblUser, ARRAY_SIZE(m_sourceLblUser), "SOURCE");
|
||||
m_sourceBg = _texture("SOURCE/BG", "texture", theme.bg, false);
|
||||
m_sourceLblTitle = _addLabel("SOURCE/TITLE", theme.titleFont, L"", 0, 10, 640, 60, theme.titleFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE);
|
||||
|
Loading…
Reference in New Issue
Block a user