WiiFlow_Lite/source/menu/menu_config_hb.cpp
Fledge68 90fd389aac - improved cover loader by adding 3 tries to load the covers. 2nd and third tries are there just to get any missing covers that didn't load the first time.
- homebrew list is now cached again. if you add or delete an app you must do a reload cache.
- if you use the custom blank covers by Abz they now need to go in wiiflow/boxcovers/blank_covers folder.
- homebrew covers must go in wiiflow/boxcovers/homebrew for full covers or wiiflow/covers/homebrew for 2d front covers.
- now using a cache subfolder named homebrew for homebrew covers wfc files. to keep them separate from the game ID games.
- sourceflow now does cache covers the first time and any time you load a new tier. if the covers are already cached then you will only see the progress bar for a split second.
- other minor changes.
- one problem. when using small_box for homebrew covers it will use the apps icon.png and if it has transparency it will look like crap.
2019-03-27 11:45:43 -05:00

182 lines
7.2 KiB
C++

#include "menu.hpp"
s16 m_cfghbLblTitle;
s16 m_cfghbBtnBack;
s16 m_cfghbLblUser[4];
s16 m_cfghbLblHideHB;
s16 m_cfghbBtnHideHB;
s16 m_cfghbLblSmallbox;
s16 m_cfghbBtnSmallbox;
s16 m_cfghbLblBoxMode;
s16 m_cfghbBtnBoxMode;
s16 m_cfghbLblPartition;
s16 m_cfghbLblPartitionVal;
s16 m_cfghbBtnPartitionP;
s16 m_cfghbBtnPartitionM;
TexData m_cfghbBg;
static void _showCfgHB(void)
{
m_btnMgr.show(m_cfghbLblTitle);
m_btnMgr.show(m_cfghbBtnBack);
for(u8 i = 0; i < ARRAY_SIZE(m_cfghbLblUser); ++i)
if(m_cfghbLblUser[i] != -1)
m_btnMgr.show(m_cfghbLblUser[i]);
m_btnMgr.show(m_cfghbLblHideHB);
m_btnMgr.show(m_cfghbBtnHideHB);
m_btnMgr.show(m_cfghbLblSmallbox);
m_btnMgr.show(m_cfghbBtnSmallbox);
m_btnMgr.show(m_cfghbLblBoxMode);
m_btnMgr.show(m_cfghbBtnBoxMode);
m_btnMgr.show(m_cfghbLblPartition);
m_btnMgr.show(m_cfghbLblPartitionVal);
m_btnMgr.show(m_cfghbBtnPartitionP);
m_btnMgr.show(m_cfghbBtnPartitionM);
}
static void _hideCfgHB(bool instant)
{
m_btnMgr.hide(m_cfghbLblTitle, instant);
m_btnMgr.hide(m_cfghbBtnBack, instant);
for(u8 i = 0; i < ARRAY_SIZE(m_cfghbLblUser); ++i)
if(m_cfghbLblUser[i] != -1)
m_btnMgr.hide(m_cfghbLblUser[i], instant);
m_btnMgr.hide(m_cfghbLblHideHB, instant);
m_btnMgr.hide(m_cfghbBtnHideHB, instant);
m_btnMgr.hide(m_cfghbLblSmallbox, instant);
m_btnMgr.hide(m_cfghbBtnSmallbox, instant);
m_btnMgr.hide(m_cfghbLblBoxMode, instant);
m_btnMgr.hide(m_cfghbBtnBoxMode, instant);
m_btnMgr.hide(m_cfghbLblPartition, instant);
m_btnMgr.hide(m_cfghbLblPartitionVal, instant);
m_btnMgr.hide(m_cfghbBtnPartitionP, instant);
m_btnMgr.hide(m_cfghbBtnPartitionM, instant);
}
void CMenu::_CfgHB(void)
{
m_btnMgr.setText(m_cfghbBtnHideHB, m_cfg.getBool(HOMEBREW_DOMAIN, "disable", false) ? _t("yes", L"Yes") : _t("no", L"No"));
m_btnMgr.setText(m_cfghbBtnSmallbox, m_cfg.getBool(HOMEBREW_DOMAIN, "smallbox") ? _t("on", L"On") : _t("off", L"Off"));
m_btnMgr.setText(m_cfghbBtnBoxMode, m_cfg.getBool(HOMEBREW_DOMAIN, "box_mode") ? _t("on", L"On") : _t("off", L"Off"));
currentPartition = m_cfg.getInt(HOMEBREW_DOMAIN, "partition", 0);
const char *partitionname = DeviceName[currentPartition];
m_btnMgr.setText(m_cfghbLblPartitionVal, upperCase(partitionname));
SetupInput();
_setBg(m_cfghbBg, m_cfghbBg);
_showCfgHB();
while(!m_exit)
{
_mainLoopCommon();
if(BTN_HOME_PRESSED || BTN_B_PRESSED)
break;
else if(BTN_UP_PRESSED)
m_btnMgr.up();
else if(BTN_DOWN_PRESSED)
m_btnMgr.down();
else if(BTN_A_PRESSED)
{
if(m_btnMgr.selected(m_cfghbBtnBack))
break;
else if (m_btnMgr.selected(m_cfghbBtnHideHB))
{
m_cfg.setBool(HOMEBREW_DOMAIN, "disable", !m_cfg.getBool(HOMEBREW_DOMAIN, "disable"));
m_btnMgr.setText(m_cfghbBtnHideHB, m_cfg.getBool(HOMEBREW_DOMAIN, "disable") ? _t("yes", L"Yes") : _t("no", L"No"));
}
else if (m_btnMgr.selected(m_cfghbBtnSmallbox))
{
m_refreshGameList = true;
m_cfg.setBool(HOMEBREW_DOMAIN, "update_cache", true);
m_cfg.setBool(HOMEBREW_DOMAIN, "smallbox", !m_cfg.getBool(HOMEBREW_DOMAIN, "smallbox", false));
m_btnMgr.setText(m_cfghbBtnSmallbox, m_cfg.getBool(HOMEBREW_DOMAIN, "smallbox") ? _t("on", L"On") : _t("off", L"Off"));
}
else if (m_btnMgr.selected(m_cfghbBtnBoxMode))
{
m_refreshGameList = true;
m_cfg.setBool(HOMEBREW_DOMAIN, "box_mode", !m_cfg.getBool(HOMEBREW_DOMAIN, "box_mode", false));
m_btnMgr.setText(m_cfghbBtnBoxMode, m_cfg.getBool(HOMEBREW_DOMAIN, "box_mode") ? _t("on", L"On") : _t("off", L"Off"));
}
else if (m_btnMgr.selected(m_cfghbBtnPartitionP) || m_btnMgr.selected(m_cfghbBtnPartitionM))
{
m_refreshGameList = true;
m_cfg.setBool(HOMEBREW_DOMAIN, "update_cache", true);
s8 direction = m_btnMgr.selected(m_cfghbBtnPartitionP) ? 1 : -1;
_setPartition(direction);
const char *partitionname = DeviceName[currentPartition];
m_btnMgr.setText(m_cfghbLblPartitionVal, upperCase(partitionname));
}
}
}
_hideCfgHB(true);
}
void CMenu::_initCfgHB(void)
{
m_cfghbBg = _texture("CFG_HB/BG", "texture", theme.bg, false);
_addUserLabels(m_cfghbLblUser, ARRAY_SIZE(m_cfghbLblUser), "CFG_HB");
m_cfghbLblTitle = _addLabel("CFG_HB/TITLE", theme.titleFont, L"", 0, 10, 640, 60, theme.titleFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE);
m_cfghbBtnBack = _addButton("CFG_HB/BACK_BTN", theme.btnFont, L"", 420, 400, 200, 48, theme.btnFontColor);
m_cfghbLblHideHB = _addLabel("CFG_HB/HIDE_HB", theme.lblFont, L"", 20, 125, 385, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_cfghbBtnHideHB = _addButton("CFG_HB/HIDE_HB_BTN", theme.btnFont, L"", 420, 130, 200, 48, theme.btnFontColor);
m_cfghbLblSmallbox = _addLabel("CFG_HB/HB_SMALLBOX", theme.lblFont, L"", 20, 185, 385, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_cfghbBtnSmallbox = _addButton("CFG_HB/HB_SMALLBOX_BTN", theme.btnFont, L"", 420, 190, 200, 48, theme.btnFontColor);
m_cfghbLblBoxMode = _addLabel("CFG_HB/HB_BOXMODE", theme.lblFont, L"", 20, 245, 385, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_cfghbBtnBoxMode = _addButton("CFG_HB/HB_BOXMODE_BTN", theme.btnFont, L"", 420, 250, 200, 48, theme.btnFontColor);
m_cfghbLblPartition = _addLabel("CFG_HB/HB_PARTITION", theme.lblFont, L"", 20, 305, 385, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_cfghbLblPartitionVal = _addLabel("CFG_HB/HB_PARTITION_VAL", theme.btnFont, L"", 468, 310, 104, 48, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_cfghbBtnPartitionM = _addPicButton("CFG_HB/HB_PARTITION_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 420, 310, 48, 48);
m_cfghbBtnPartitionP = _addPicButton("CFG_HB/HB_PARTITION_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 572, 310, 48, 48);
_setHideAnim(m_cfghbLblTitle, "CFG_HB/TITLE", 0, 0, -2.f, 0.f);
_setHideAnim(m_cfghbBtnBack, "CFG_HB/BACK_BTN", 0, 0, 1.f, -1.f);
_setHideAnim(m_cfghbLblHideHB, "CFG_HB/HIDE_HB", -50, 0, -2.f, 0.f);
_setHideAnim(m_cfghbBtnHideHB, "CFG_HB/HIDE_HB_BTN", -50, 0, 1.f, 0.f);
_setHideAnim(m_cfghbLblSmallbox, "CFG_HB/HB_SMALLBOX", -50, 0, -2.f, 0.f);
_setHideAnim(m_cfghbBtnSmallbox, "CFG_HB/HB_SMALLBOX_BTN", -50, 0, 1.f, 0.f);
_setHideAnim(m_cfghbLblBoxMode, "CFG_HB/HB_BOXMODE", -50, 0, -2.f, 0.f);
_setHideAnim(m_cfghbBtnBoxMode, "CFG_HB/HB_BOXMODE_BTN", -50, 0, 1.f, 0.f);
_setHideAnim(m_cfghbLblPartition, "CFG_HB/HB_PARTITION", -50, 0, -2.f, 0.f);
_setHideAnim(m_cfghbLblPartitionVal, "CFG_HB/HB_PARTITION_VAL", -50, 0, 1.f, 0.f);
_setHideAnim(m_cfghbBtnPartitionM, "CFG_HB/HB_PARTITION_MINUS", -50, 0, 1.f, 0.f);
_setHideAnim(m_cfghbBtnPartitionP, "CFG_HB/HB_PARTITION_PLUS", -50, 0, 1.f, 0.f);
_hideCfgHB(true);
_textCfgHB();
}
void CMenu::_textCfgHB(void)
{
m_btnMgr.setText(m_cfghbLblTitle, _t("cfghb1", L"Homebrew Settings"));
m_btnMgr.setText(m_cfghbLblHideHB, _t("cfghb5", L"Hide homebrew button"));
m_btnMgr.setText(m_cfghbLblSmallbox, _t("cfghb2", L"Coverflow Smallbox"));
m_btnMgr.setText(m_cfghbLblBoxMode, _t("cfghb4", L"Box Mode"));
m_btnMgr.setText(m_cfghbLblPartition, _t("cfghb3", L"Homebrew Partition"));
m_btnMgr.setText(m_cfghbBtnBack, _t("cfg10", L"Back"));
}