- all checkboxes are now a single button. we just change the texture from off to on instead of having 2 different buttons and hiding the off to show the on or vice versa. shrinks wiiflow dol and theme ini's. for categories, source menu editor, and plugin select menu's.

- fixed wiiflow language setting. I must've broke it a while back.
This commit is contained in:
Fledge68 2022-10-18 15:15:54 -05:00
parent 3da96c7737
commit 25a67d6539
9 changed files with 214 additions and 288 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 MiB

After

Width:  |  Height:  |  Size: 4.4 MiB

View File

@ -21,7 +21,6 @@ bool CButtonsMgr::init()
m_rumbleEnabled = false;
m_soundVolume = 0xFF;
m_noclick = false;
m_nohover = false;
m_mouse = false;
soundInit();
@ -80,57 +79,57 @@ s16 CButtonsMgr::addPicButton(const u8 *pngNormal, const u8 *pngSelected, int x,
s16 CButtonsMgr::addLabel(SFont font, const wstringEx &text, int x, int y, u32 width, u32 height, const CColor &color, s16 style, const TexData &bg)
{
SLabel *b = new SLabel;
SLabel *lbl = new SLabel;
b->font = font;
b->visible = false;
b->textStyle = style;
b->text.setText(b->font, text);
b->text.setFrame(width, b->textStyle, false, true);
b->textColor = color;
b->x = x + width / 2;
b->y = y + height / 2;
b->w = width;
b->h = height;
b->alpha = 0;
b->targetAlpha = 0;
b->scaleX = 0.f;
b->scaleY = 0.f;
b->targetScaleX = 0.f;
b->targetScaleY = 0.f;
b->texBg = bg;
b->moveByX = 0;
b->moveByY = 0;
lbl->font = font;
lbl->visible = false;
lbl->textStyle = style;
lbl->text.setText(lbl->font, text);
lbl->text.setFrame(width, lbl->textStyle, false, true);
lbl->textColor = color;
lbl->x = x + width / 2;
lbl->y = y + height / 2;
lbl->w = width;
lbl->h = height;
lbl->alpha = 0;
lbl->targetAlpha = 0;
lbl->scaleX = 0.f;
lbl->scaleY = 0.f;
lbl->targetScaleX = 0.f;
lbl->targetScaleY = 0.f;
lbl->texBg = bg;
lbl->moveByX = 0;
lbl->moveByY = 0;
u32 sz = m_elts.size();
m_elts.push_back(b);
m_elts.push_back(lbl);
return m_elts.size() > sz ? m_elts.size() - 1 : -2;
}
s16 CButtonsMgr::addProgressBar(int x, int y, u32 width, u32 height, SButtonTextureSet &texSet)
{
SProgressBar *b = new SProgressBar;
SProgressBar *pb = new SProgressBar;
b->visible = false;
b->x = x + width / 2;
b->y = y + height / 2;
b->w = width;
b->h = height;
b->alpha = 0;
b->targetAlpha = 0;
b->scaleX = 0.f;
b->scaleY = 0.f;
b->targetScaleX = 0.f;
b->targetScaleY = 0.f;
b->tex = texSet;
b->val = 0.f;
b->targetVal = 0.f;
b->moveByX = 0;
b->moveByY = 0;
pb->visible = false;
pb->x = x + width / 2;
pb->y = y + height / 2;
pb->w = width;
pb->h = height;
pb->alpha = 0;
pb->targetAlpha = 0;
pb->scaleX = 0.f;
pb->scaleY = 0.f;
pb->targetScaleX = 0.f;
pb->targetScaleY = 0.f;
pb->tex = texSet;
pb->val = 0.f;
pb->targetVal = 0.f;
pb->moveByX = 0;
pb->moveByY = 0;
u32 sz = m_elts.size();
m_elts.push_back(b);
m_elts.push_back(pb);
return m_elts.size() > sz ? m_elts.size() - 1 : -2;
}
@ -189,15 +188,17 @@ void CButtonsMgr::setText(s16 id, const wstringEx &text, u32 startline, bool unw
}
}
void CButtonsMgr::setBtnTexture(s16 id, TexData &texNormal, TexData &texSelected)
void CButtonsMgr::setBtnTexture(s16 id, TexData &texNormal, TexData &texSelected, bool cleanup)
{
if (id == -1) return;
if (id < (s32)m_elts.size())
{
SButton *b = (SButton*)m_elts[id];
/* free old textures */
TexHandle.Cleanup(b->tex.center);
TexHandle.Cleanup(b->tex.centerSel);
SButton *b = (SButton*)m_elts[id];// buttons only. ie. source buttons and checkboxes
if(cleanup)/* free old textures for source buttons */
{
TexHandle.Cleanup(b->tex.center);
TexHandle.Cleanup(b->tex.centerSel);
}
/*change textures */
b->tex.center = texNormal;
b->tex.centerSel = texSelected;
@ -209,7 +210,7 @@ void CButtonsMgr::freeBtnTexture(s16 id)
if(id == -1) return;
if(id < (s32)m_elts.size())
{
SButton *b = (SButton*)m_elts[id];
SButton *b = (SButton*)m_elts[id];// for buttons only. ie. source buttons
TexHandle.Cleanup(b->tex.center);
TexHandle.Cleanup(b->tex.centerSel);
}
@ -295,9 +296,9 @@ void CButtonsMgr::setProgress(s16 id, float f, bool instant)
{
if(m_elts[id]->t == GUIELT_PROGRESS)
{
SProgressBar *b = (SProgressBar*)m_elts[id];
b->targetVal = std::min(std::max(0.f, f), 1.f);
if (instant) b->val = b->targetVal;
SProgressBar *p = (SProgressBar*)m_elts[id];
p->targetVal = std::min(std::max(0.f, f), 1.f);
if (instant) p->val = p->targetVal;
}
}
@ -306,18 +307,18 @@ void CButtonsMgr::reset(s16 id, bool instant)
if (id == -1) return;
if (id < (s32)m_elts.size())
{
SElement &b = *m_elts[id];
b.x -= b.moveByX;
b.y -= b.moveByY;
SElement &e = *m_elts[id];
e.x -= e.moveByX;
e.y -= e.moveByY;
if (instant)
{
b.pos.x -= b.moveByX;
b.pos.y -= b.moveByY;
e.pos.x -= e.moveByX;
e.pos.y -= e.moveByY;
}
b.targetPos.x -= b.moveByX;
b.targetPos.y -= b.moveByY;
b.moveByX = 0;
b.moveByY = 0;
e.targetPos.x -= e.moveByX;
e.targetPos.y -= e.moveByY;
e.moveByX = 0;
e.moveByY = 0;
}
}
@ -326,18 +327,18 @@ void CButtonsMgr::moveBy(s16 id, int x, int y, bool instant)
if (id == -1) return;
if (id < (s32)m_elts.size())
{
CButtonsMgr::SElement &b = *m_elts[id];
b.moveByX += x;
b.moveByY += y;
b.x += x;
b.y += y;
CButtonsMgr::SElement &e = *m_elts[id];
e.moveByX += x;
e.moveByY += y;
e.x += x;
e.y += y;
if (instant)
{
b.pos.x += x;
b.pos.y += y;
e.pos.x += x;
e.pos.y += y;
}
b.targetPos.x += x;
b.targetPos.y += y;
e.targetPos.x += x;
e.targetPos.y += y;
}
}
@ -346,8 +347,8 @@ void CButtonsMgr::getTotalHeight(s16 id, int &height)
if (id == -1) return;
if (id < (s32)m_elts.size())
{
SLabel *s = (SLabel*)m_elts[id];
height = s->text.getTotalHeight();
SLabel *l = (SLabel*)m_elts[id];
height = l->text.getTotalHeight();
}
}
@ -356,16 +357,16 @@ void CButtonsMgr::getDimensions(s16 id, int &x, int &y, u32 &width, u32 &height)
if (id == -1) return;
if (id < (s32)m_elts.size())
{
CButtonsMgr::SElement &b = *m_elts[id];
x = b.targetPos.x;
y = b.targetPos.y;
width = b.w;
height = b.h;
if(b.t == GUIELT_LABEL)
CButtonsMgr::SElement &e = *m_elts[id];
x = e.targetPos.x;
y = e.targetPos.y;
width = e.w;
height = e.h;
if(e.t == GUIELT_LABEL)
{
SLabel *s = (SLabel*)m_elts[id];
SLabel *l = (SLabel*)m_elts[id];
// Calculate height
height = s->text.getTotalHeight();
height = l->text.getTotalHeight();
}
}
}
@ -375,22 +376,22 @@ void CButtonsMgr::hide(s16 id, int dx, int dy, float scaleX, float scaleY, bool
if (id == -1) return;
if (id < (s32)m_elts.size())
{
SElement &b = *m_elts[id];
b.hideParam.dx = dx;
b.hideParam.dy = dy;
b.hideParam.scaleX = scaleX;
b.hideParam.scaleY = scaleY;
b.visible = false;
b.targetScaleX = scaleX;
b.targetScaleY = scaleY;
b.targetPos = Vector3D((float)(b.x + dx), (float)(b.y + dy), 0.f);
b.targetAlpha = 0x00;
SElement &e = *m_elts[id];
e.hideParam.dx = dx;
e.hideParam.dy = dy;
e.hideParam.scaleX = scaleX;
e.hideParam.scaleY = scaleY;
e.visible = false;
e.targetScaleX = scaleX;
e.targetScaleY = scaleY;
e.targetPos = Vector3D((float)(e.x + dx), (float)(e.y + dy), 0.f);
e.targetAlpha = 0x00;
if (instant)
{
b.scaleX = b.targetScaleX;
b.scaleY = b.targetScaleY;
b.pos = b.targetPos;
b.alpha = b.targetAlpha;
e.scaleX = e.targetScaleX;
e.scaleY = e.targetScaleY;
e.pos = e.targetPos;
e.alpha = e.targetAlpha;
}
for(int chan = WPAD_MAX_WIIMOTES-1; chan >= 0; chan--)
if (m_selected[chan] == id)
@ -403,8 +404,8 @@ void CButtonsMgr::hide(s16 id, bool instant)
if (id == -1) return;
if (id < (s32)m_elts.size())
{
CButtonsMgr::SElement &b = *m_elts[id];
hide(id, b.hideParam.dx, b.hideParam.dy, b.hideParam.scaleX, b.hideParam.scaleY, instant);
CButtonsMgr::SElement &e = *m_elts[id];
hide(id, e.hideParam.dx, e.hideParam.dy, e.hideParam.scaleX, e.hideParam.scaleY, instant);
}
}
@ -413,18 +414,18 @@ void CButtonsMgr::show(s16 id, bool instant)
if (id == -1) return;
if (id < (s32)m_elts.size())
{
SElement &b = *m_elts[id];
b.visible = true;
b.targetScaleX = 1.0f;
b.targetScaleY = 1.0f;
b.targetPos = Vector3D((float)b.x, (float)b.y, 0);
b.targetAlpha = 0xFF;
SElement &e = *m_elts[id];
e.visible = true;
e.targetScaleX = 1.0f;
e.targetScaleY = 1.0f;
e.targetPos = Vector3D((float)e.x, (float)e.y, 0);
e.targetAlpha = 0xFF;
if (instant)
{
b.scaleX = b.targetScaleX;
b.scaleY = b.targetScaleY;
b.pos = b.targetPos;
b.alpha = b.targetAlpha;
e.scaleX = e.targetScaleX;
e.scaleY = e.targetScaleY;
e.pos = e.targetPos;
e.alpha = e.targetAlpha;
}
}
}
@ -457,11 +458,6 @@ void CButtonsMgr::setMouse(bool enable)
m_mouse = enable;
}
void CButtonsMgr::noHover(bool nohover)
{
m_nohover = nohover;
}
void CButtonsMgr::noClick(bool noclick)
{
m_noclick = noclick;
@ -485,12 +481,13 @@ bool CButtonsMgr::selected(s16 button)
return false;
}
// we use this for checkboxes. when clicked it is hidden which looses the selected state. so when its re-shown we call this to also auto select it.
void CButtonsMgr::setSelected(s16 button)
{
SElement &b = *m_elts[button];
SElement &e = *m_elts[button];
m_selected[0] = button;
b.targetScaleX = 1.1f;
b.targetScaleY = 1.1f;
e.targetScaleX = 1.1f;
e.targetScaleY = 1.1f;
}
@ -528,9 +525,10 @@ void CButtonsMgr::mouse(int chan, int x, int y)
if (m_elts.empty()) return;
float w, h;
s32 start = -1;
s32 start = -1;// used as the current or last button
if(m_selected[chan] != -1 && m_selected[chan] < (s32)m_elts.size())
{
// return current or last button to its normal scale
m_elts[m_selected[chan]]->targetScaleX = 1.f;
m_elts[m_selected[chan]]->targetScaleY = 1.f;
start = m_selected[chan];
@ -538,10 +536,10 @@ void CButtonsMgr::mouse(int chan, int x, int y)
m_selected[chan] = -1;
for(int i = (int)m_elts.size() - 1; i >= 0; --i)
{
SElement &b = *m_elts[i];
if(b.t == GUIELT_BUTTON)
SElement &e = *m_elts[i];
if(e.t == GUIELT_BUTTON)
{
SButton &but = *(SButton*)&b;
SButton &but = *(SButton*)&e;
w = (float)(but.w / 2);
h = (float)(but.h / 2);
if(but.visible && (float)x >= but.pos.x - w && (float)x < but.pos.x + w && (float)y >= but.pos.y - h && (float)y < but.pos.y + h)
@ -550,13 +548,10 @@ void CButtonsMgr::mouse(int chan, int x, int y)
but.targetScaleX = 1.05f;
but.targetScaleY = 1.05f;
//
if(start != m_selected[chan])
if(start != m_selected[chan])// if it's a new button play hover sound and rumble
{
if(m_soundVolume > 0)
{
if(!m_nohover)
but.hoverSound->Play(m_soundVolume);
}
but.hoverSound->Play(m_soundVolume);
if(m_rumbleEnabled)
{
m_rumble[chan] = 4;
@ -579,11 +574,13 @@ void CButtonsMgr::up(void)
{
if(m_elts.empty() || m_mouse)
return;
u32 start = 0;
u32 start = 0;// set as first element. don't use -1.
for(int chan = WPAD_MAX_WIIMOTES-1; chan >= 0; chan--)
{
// check if a element is selected and if so use it as start element
if(m_selected[chan] != -1 && m_selected[chan] < (s32)m_elts.size())
{
// return current or last button to its normal scale
m_elts[m_selected[chan]]->targetScaleX = 1.f;
m_elts[m_selected[chan]]->targetScaleY = 1.f;
start = m_selected[chan];
@ -593,12 +590,15 @@ void CButtonsMgr::up(void)
for(u32 i = 1; i <= m_elts.size(); ++i)
{
u32 j = loopNum<u32>(start - i, m_elts.size());
SElement &b = *m_elts[j];
if (b.t == GUIELT_BUTTON && b.visible)
SElement &e = *m_elts[j];
if(e.t == GUIELT_BUTTON && e.visible)
{
m_selected[0] = j;
b.targetScaleX = 1.1f;// mouse only enlarges 1.05
b.targetScaleY = 1.1f;
e.targetScaleX = 1.1f;// mouse only enlarges 1.05
e.targetScaleY = 1.1f;
SButton &but = *(SButton*)&e;
if(m_soundVolume > 0)
but.hoverSound->Play(m_soundVolume);
break;
}
}
@ -626,12 +626,15 @@ void CButtonsMgr::down(void)
for(u32 i = 1; i <= m_elts.size(); ++i)
{
u32 j = loopNum<u32>(start + i, m_elts.size());
SElement &b = *m_elts[j];
if (b.t == GUIELT_BUTTON && b.visible)
SElement &e = *m_elts[j];
if(e.t == GUIELT_BUTTON && e.visible)
{
m_selected[0] = j;
b.targetScaleX = 1.1f;// mouse only enlarges 1.05
b.targetScaleY = 1.1f;
e.targetScaleX = 1.1f;// mouse only enlarges 1.05
e.targetScaleY = 1.1f;
SButton &but = *(SButton*)&e;
if(m_soundVolume > 0)
but.hoverSound->Play(m_soundVolume);
break;
}
}

View File

@ -41,7 +41,7 @@ public:
s16 addProgressBar(int x, int y, u32 width, u32 height, SButtonTextureSet &texSet);
void setText(s16 id, const wstringEx &text, bool unwrap = false);
void setText(s16 id, const wstringEx &text, u32 startline, bool unwrap = false);
void setBtnTexture(s16 id, TexData &texNormal, TexData &texSelected);
void setBtnTexture(s16 id, TexData &texNormal, TexData &texSelected, bool cleanup = true);
void freeBtnTexture(s16 id);
void setTexture(s16 id ,TexData &bg);
void setTexture(s16 id, TexData &bg, int width, int height);
@ -61,7 +61,6 @@ public:
void draw(void);
void tick(void);
void noClick(bool noclick = false);
void noHover(bool nohover = false);
void click(s16 id = -1);
bool selected(s16 button = -1);
void setSelected(s16 button);
@ -154,7 +153,6 @@ private:
GuiSound *m_sndClick;
u8 m_soundVolume;
bool m_noclick;
bool m_nohover;
bool m_mouse;
private:
void _drawBtn(SButton &b, bool selected, bool click);

View File

@ -184,6 +184,9 @@ bool CMenu::init(bool usb_mounted)
strncpy(proxyPassword, m_cfg.getString("PROXY", "proxy_password", "").c_str(), sizeof(proxyPassword) - 1);
getProxyInfo();
/* set default homebrew partition for first boot */
m_cfg.getInt(HOMEBREW_DOMAIN, "partition", strcmp(drive, "sd") == 0 ? 0 : 1);// drive is device where wiiflow is.
/* Set SD only to off if any usb device is attached */
bool cfg_sdonly = m_cfg.getBool("GENERAL", "sd_only", usb_mounted ? false : true);// will only set it if this doesn't already exist - very first boot up
if(cfg_sdonly != sdOnly)// done for backwards compatibility with older wiiflow lite's

View File

@ -263,6 +263,10 @@ private:
s16 m_configBtn4M;
s16 m_configBtn4P;
// checkbox menus
s16 m_checkboxLblTxt[11];
s16 m_checkboxBtn[11];
// Download menu
s16 m_downloadLblTitle;
s16 m_downloadBtnBack;

View File

@ -8,17 +8,11 @@ s16 m_categoryBtnPageP;
s16 m_categoryBtnClear;
s16 m_categoryBtnBack;
s16 m_categoryLblTitle;
s16 m_categoryLblCat[11];
s16 m_categoryBtnCat[11];
s16 m_categoryBtnCats[11];
s16 m_categoryBtnCatHid[11];
s16 m_categoryBtnCatReq[11];
s16 m_categoryLblUser[4];
TexData m_categoryBg;
vector<char> m_categories;
static u8 curPage;
u8 lastBtn;
char id[64];
const char *catDomain = NULL;
bool gameSet;
@ -39,11 +33,8 @@ void CMenu::_hideCategorySettings(bool instant)
for(u8 i = 1; i < 11; ++i)
{
m_btnMgr.hide(m_categoryLblCat[i]);
m_btnMgr.hide(m_categoryBtnCat[i]);
m_btnMgr.hide(m_categoryBtnCats[i]);
m_btnMgr.hide(m_categoryBtnCatHid[i]);
m_btnMgr.hide(m_categoryBtnCatReq[i]);
m_btnMgr.hide(m_checkboxLblTxt[i]);
m_btnMgr.hide(m_checkboxBtn[i]);
}
}
@ -102,11 +93,8 @@ void CMenu::_updateCatCheckboxes(void)
{
for(u8 i = 1; i < 11; ++i)
{
m_btnMgr.hide(m_categoryBtnCat[i], true);
m_btnMgr.hide(m_categoryBtnCats[i], true);
m_btnMgr.hide(m_categoryBtnCatHid[i], true);
m_btnMgr.hide(m_categoryBtnCatReq[i], true);
m_btnMgr.hide(m_categoryLblCat[i], true);
m_btnMgr.hide(m_checkboxBtn[i], true);
m_btnMgr.hide(m_checkboxLblTxt[i], true);
}
if(m_max_categories > 11)
@ -125,19 +113,20 @@ void CMenu::_updateCatCheckboxes(void)
switch(m_categories[j])
{
case '0':
m_btnMgr.show(m_categoryBtnCat[i]);
m_btnMgr.setBtnTexture(m_checkboxBtn[i], theme.checkboxoff, theme.checkboxoffs, false);
break;
case '1':
m_btnMgr.show(m_categoryBtnCats[i]);
m_btnMgr.setBtnTexture(m_checkboxBtn[i], theme.checkboxon, theme.checkboxons, false);
break;
case '2':
m_btnMgr.show(m_categoryBtnCatHid[i]);
m_btnMgr.setBtnTexture(m_checkboxBtn[i], theme.checkboxHid, theme.checkboxHids, false);
break;
default:
m_btnMgr.show(m_categoryBtnCatReq[i]);
m_btnMgr.setBtnTexture(m_checkboxBtn[i], theme.checkboxReq, theme.checkboxReqs, false);
}
m_btnMgr.setText(m_categoryLblCat[i], m_cat.getWString(genDomain, fmt("cat%d",j), wfmt(L"Category %i",j).c_str()));
m_btnMgr.show(m_categoryLblCat[i]);
m_btnMgr.setText(m_checkboxLblTxt[i], m_cat.getWString(genDomain, fmt("cat%d",j), wfmt(L"Category %i",j).c_str()));
m_btnMgr.show(m_checkboxLblTxt[i]);
m_btnMgr.show(m_checkboxBtn[i]);
}
}
@ -268,8 +257,6 @@ void CMenu::_CategorySettings(bool fromGameSet)
{
_mainLoopCommon();
CoverFlow.tick();
if(!m_btnMgr.selected(lastBtn))
m_btnMgr.noHover(false);
if(BTN_HOME_PRESSED || BTN_B_PRESSED || (BTN_A_PRESSED && m_btnMgr.selected(m_categoryBtnBack)))
{
@ -336,8 +323,6 @@ void CMenu::_CategorySettings(bool fromGameSet)
}
if((BTN_LEFT_PRESSED && m_max_categories>11) || (BTN_A_PRESSED && m_btnMgr.selected(m_categoryBtnPageM)))
{
lastBtn = m_categoryBtnPageM;
m_btnMgr.noHover(true);
curPage--;
if(curPage < 1)
curPage = ((m_max_categories - 2) / 10) + 1;
@ -347,8 +332,6 @@ void CMenu::_CategorySettings(bool fromGameSet)
}
else if((BTN_RIGHT_PRESSED && m_max_categories>11) || (BTN_A_PRESSED && m_btnMgr.selected(m_categoryBtnPageP)))
{
lastBtn = m_categoryBtnPageP;
m_btnMgr.noHover(true);
curPage++;
if(curPage > ((m_max_categories - 2) / 10) + 1)
curPage = 1;
@ -378,17 +361,8 @@ void CMenu::_CategorySettings(bool fromGameSet)
for(u8 i = 1; i < 11; ++i)
{
m_refreshGameList = true;
if(m_btnMgr.selected(m_categoryBtnCat[i]) || m_btnMgr.selected(m_categoryBtnCats[i]) || m_btnMgr.selected(m_categoryBtnCatHid[i]) || m_btnMgr.selected(m_categoryBtnCatReq[i]))
if(m_btnMgr.selected(m_checkboxBtn[i]))
{
lastBtn = m_categoryBtnCat[i];
if(m_btnMgr.selected(m_categoryBtnCats[i]))
lastBtn = m_categoryBtnCats[i];
else if(m_btnMgr.selected(m_categoryBtnCatHid[i]))
lastBtn = m_categoryBtnCatHid[i];
else if(m_btnMgr.selected(m_categoryBtnCatReq[i]))
lastBtn = m_categoryBtnCatReq[i];
m_btnMgr.noHover(true);
int j = i + ((curPage - 1) * 10);
if(fromGameSet)
{
@ -404,29 +378,23 @@ void CMenu::_CategorySettings(bool fromGameSet)
if(m_categories.at(0) == '1' && m_categories.at(j) != '0')
m_categories.at(0) = '0';
}
m_btnMgr.hide(m_categoryBtnCat[i], true);
m_btnMgr.hide(m_categoryBtnCats[i], true);
m_btnMgr.hide(m_categoryBtnCatHid[i], true);
m_btnMgr.hide(m_categoryBtnCatReq[i], true);
m_btnMgr.hide(m_checkboxBtn[i], true);
switch(m_categories.at(j))
{
case '0':
m_btnMgr.show(m_categoryBtnCat[i]);
m_btnMgr.setSelected(m_categoryBtnCat[i]);
m_btnMgr.setBtnTexture(m_checkboxBtn[i], theme.checkboxoff, theme.checkboxoffs, false);
break;
case '1':
m_btnMgr.show(m_categoryBtnCats[i]);
m_btnMgr.setSelected(m_categoryBtnCats[i]);
m_btnMgr.setBtnTexture(m_checkboxBtn[i], theme.checkboxon, theme.checkboxons, false);
break;
case '2':
m_btnMgr.show(m_categoryBtnCatHid[i]);
m_btnMgr.setSelected(m_categoryBtnCatHid[i]);
m_btnMgr.setBtnTexture(m_checkboxBtn[i], theme.checkboxHid, theme.checkboxHids, false);
break;
default:
m_btnMgr.show(m_categoryBtnCatReq[i]);
m_btnMgr.setSelected(m_categoryBtnCatReq[i]);
break;
m_btnMgr.setBtnTexture(m_checkboxBtn[i], theme.checkboxReq, theme.checkboxReqs, false);
}
m_btnMgr.show(m_checkboxBtn[i]);
m_btnMgr.setSelected(m_checkboxBtn[i]);
break;
}
}
@ -445,34 +413,14 @@ void CMenu::_initCategorySettingsMenu()
m_categoryBtnPageP = _addPicButton("CATEGORY/PAGE_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 172, 400, 48, 48);
m_categoryBtnBack = _addButton("CATEGORY/BACK_BTN", theme.btnFont, L"", 420, 400, 200, 48, theme.btnFontColor);
m_categoryBtnClear = _addButton("CATEGORY/CLEAR_BTN", theme.btnFont, L"", 230, 400, 180, 48, theme.btnFontColor);
for(u8 i = 1; i < 6; ++i)
{ // left half
m_categoryBtnCat[i] = _addPicButton(fmt("CATEGORY/CAT_%i_BTN", i), theme.checkboxoff, theme.checkboxoffs, 30, (39+i*58), 44, 48);
m_categoryBtnCats[i] = _addPicButton(fmt("CATEGORY/CAT_%i_BTNS", i), theme.checkboxon, theme.checkboxons, 30, (39+i*58), 44, 48);
m_categoryBtnCatHid[i] = _addPicButton(fmt("CATEGORY/CAT_%i_BTNHID", i), theme.checkboxHid, theme.checkboxHids, 30, (39+i*58), 44, 48);
m_categoryBtnCatReq[i] = _addPicButton(fmt("CATEGORY/CAT_%i_BTNREQ", i), theme.checkboxReq, theme.checkboxReqs, 30, (39+i*58), 44, 48);
m_categoryLblCat[i] = _addLabel(fmt("CATEGORY/CAT_%i", i), theme.lblFont, L"", 85, (42+i*58), 230, 48, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
// right half
m_categoryBtnCat[i+5] = _addPicButton(fmt("CATEGORY/CAT_%i_BTN", i+5), theme.checkboxoff, theme.checkboxoffs, 325, (39+i*58), 44, 48);
m_categoryBtnCats[i+5] = _addPicButton(fmt("CATEGORY/CAT_%i_BTNS", i+5), theme.checkboxon, theme.checkboxons, 325, (39+i*58), 44, 48);
m_categoryBtnCatHid[i+5] = _addPicButton(fmt("CATEGORY/CAT_%i_BTNHID", i+5), theme.checkboxHid, theme.checkboxHids, 325, (39+i*58), 44, 48);
m_categoryBtnCatReq[i+5] = _addPicButton(fmt("CATEGORY/CAT_%i_BTNREQ", i+5), theme.checkboxReq, theme.checkboxReqs, 325, (39+i*58), 44, 48);
m_categoryLblCat[i+5] = _addLabel(fmt("CATEGORY/CAT_%i", i+5), theme.lblFont, L"", 380, (42+i*58), 230, 48, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
}
_setHideAnim(m_categoryLblTitle, "CATEGORY/TITLE", 0, 0, -2.f, 0.f);
_setHideAnim(m_categoryLblPage, "CATEGORY/PAGE_BTN", 0, 0, 1.f, -1.f);
_setHideAnim(m_categoryBtnPageM, "CATEGORY/PAGE_MINUS", 0, 0, 1.f, -1.f);
_setHideAnim(m_categoryBtnPageP, "CATEGORY/PAGE_PLUS", 0, 0, 1.f, -1.f);
_setHideAnim(m_categoryBtnClear, "CATEGORY/CLEAR_BTN", 0, 0, 1.f, -1.f);
_setHideAnim(m_categoryBtnBack, "CATEGORY/BACK_BTN", 0, 0, 1.f, -1.f);
for(u8 i = 1; i < 11; ++i)
{
_setHideAnim(m_categoryBtnCat[i], fmt("CATEGORY/CAT_%i_BTN", i), 0, 0, 1.f, 0.f);
_setHideAnim(m_categoryBtnCats[i], fmt("CATEGORY/CAT_%i_BTNS", i), 0, 0, 1.f, 0.f);
_setHideAnim(m_categoryBtnCatHid[i], fmt("CATEGORY/CAT_%i_BTNHID", i), 0, 0, 1.f, 0.f);
_setHideAnim(m_categoryBtnCatReq[i], fmt("CATEGORY/CAT_%i_BTNREQ", i), 0, 0, 1.f, 0.f);
_setHideAnim(m_categoryLblCat[i], fmt("CATEGORY/CAT_%i", i), 0, 0, 1.f, 0.f);
}
_hideCategorySettings(true);
_textCategorySettings();
}

View File

@ -547,26 +547,25 @@ void CMenu::_configMain(void)
else if(m_btnMgr.selected(m_configBtn2P) || m_btnMgr.selected(m_configBtn2M))
{
s8 direction = m_btnMgr.selected(m_configBtn2P) ? 1 : -1;
curLanguage = loopNum(curLanguage + direction, (u32)languages_available.size());
m_curLanguage = languages_available[curLanguage];
if(!m_loc.load(fmt("%s/%s.ini", m_languagesDir.c_str(), m_curLanguage.c_str())))
if(languages_available.size() > 1)
{
m_curLanguage = "Default";
m_cfg.setString("GENERAL", "language", m_curLanguage.c_str());
m_loc.unload();
}
else
curLanguage = loopNum(curLanguage + direction, (u32)languages_available.size());
m_curLanguage = languages_available[curLanguage];
if(m_curLanguage != "Default")
m_loc.load(fmt("%s/%s.ini", m_languagesDir.c_str(), m_curLanguage.c_str()));
m_cfg.setString("GENERAL", "language", m_curLanguage.c_str());
_updateText();
m_btnMgr.setText(m_configLbl1, _t("cfga7", L"Theme"));
m_btnMgr.setText(m_configLbl2, _t("cfgc9", L"WiiFlow Language"));
m_btnMgr.setText(m_configLbl3, _t("cfgc4", L"Adjust Coverflow"));
m_btnMgr.setText(m_configLbl4, _t("cfgc8", L"Startup Settings"));
m_btnMgr.setText(m_configLbl1Val, m_cfg.getString("GENERAL", "theme"));
m_btnMgr.setText(m_configLbl2Val, m_curLanguage);
m_btnMgr.setText(m_configBtn3, _t("cfgc5", L"Go"));
m_btnMgr.setText(m_configBtn4, _t("cfgc5", L"Go"));
_updateText();
m_btnMgr.setText(m_configLbl1, _t("cfga7", L"Theme"));
m_btnMgr.setText(m_configLbl2, _t("cfgc9", L"WiiFlow Language"));
m_btnMgr.setText(m_configLbl3, _t("cfgc4", L"Adjust Coverflow"));
m_btnMgr.setText(m_configLbl4, _t("cfgc8", L"Startup Settings"));
m_btnMgr.setText(m_configLbl1Val, m_cfg.getString("GENERAL", "theme"));
m_btnMgr.setText(m_configLbl2Val, m_curLanguage);
m_btnMgr.setText(m_configBtn3, _t("cfgc5", L"Go"));
m_btnMgr.setText(m_configBtn4, _t("cfgc5", L"Go"));
}
}
else if(m_btnMgr.selected(m_configBtn3))
{
@ -959,7 +958,7 @@ void CMenu::_configMain(void)
}
}
}
if(mainCfg_curPage == 2 && 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_cfg.getString(CONFIG_FILENAME_SKIP_DOMAIN,CONFIG_FILENAME_SKIP_KEY,CONFIG_FILENAME_SKIP_DEFAULT));

View File

@ -14,10 +14,6 @@ s16 m_pluginBtnPageM;
s16 m_pluginBtnPageP;
s16 m_pluginBtnBack;
s16 m_pluginLblTitle;
s16 m_pluginLblCat[11];
s16 m_pluginBtn[11];
s16 m_pluginBtnCat[11];
s16 m_pluginBtnCats[11];
s16 m_pluginLblUser[4];
TexData m_pluginBg;
@ -34,8 +30,8 @@ void CMenu::_hidePluginSettings(bool instant)
for(u8 i = 0; i < 11; ++i)
{
m_btnMgr.hide(m_pluginLblCat[i]);
m_btnMgr.hide(m_pluginBtn[i]);
m_btnMgr.hide(m_checkboxLblTxt[i]);
m_btnMgr.hide(m_checkboxBtn[i]);
}
}
@ -55,7 +51,7 @@ void CMenu::_updatePluginText(void)
{
u32 IteratorHelp = (Plugin_curPage - 1) * 10;
for(u8 i = 1; i < min(IteratorHelp+10, (u32)m_max_plugins)-IteratorHelp+1; i++)
m_btnMgr.setText(m_pluginLblCat[i], m_plugin.GetPluginName(i+IteratorHelp-1));
m_btnMgr.setText(m_checkboxLblTxt[i], m_plugin.GetPluginName(i+IteratorHelp-1));
}
void CMenu::_updatePluginCheckboxes(void)
@ -69,27 +65,27 @@ void CMenu::_updatePluginCheckboxes(void)
}
for(int i = 0; i < 11; ++i)
{
m_btnMgr.hide(m_pluginBtn[i]);
m_btnMgr.hide(m_pluginLblCat[i]);
m_btnMgr.hide(m_checkboxBtn[i]);// instant?
m_btnMgr.hide(m_checkboxLblTxt[i]);
}
const vector<bool> &EnabledPlugins = m_plugin.GetEnabledPlugins(&enabledPluginsCount);
/* ALL Button */
if(EnabledPlugins.size() == 0)
m_pluginBtn[0] = m_pluginBtnCats[0];
m_btnMgr.setBtnTexture(m_checkboxBtn[0], theme.checkboxon, theme.checkboxons, false);
else
m_pluginBtn[0] = m_pluginBtnCat[0];
m_btnMgr.show(m_pluginBtn[0]);
m_btnMgr.show(m_pluginLblCat[0]);
m_btnMgr.setBtnTexture(m_checkboxBtn[0], theme.checkboxoff, theme.checkboxoffs, false);
m_btnMgr.show(m_checkboxBtn[0]);
m_btnMgr.show(m_checkboxLblTxt[0]);
/* Single Plugins */
u32 IteratorHelp = (Plugin_curPage - 1) * 10;
for(u8 i = 1; i < min(IteratorHelp+10, (u32)m_max_plugins)-IteratorHelp+1; ++i)
{
if(m_current_view == COVERFLOW_PLUGIN && (EnabledPlugins.size() == 0 || EnabledPlugins.at(i+IteratorHelp-1) == true))
m_pluginBtn[i] = m_pluginBtnCats[i];
m_btnMgr.setBtnTexture(m_checkboxBtn[i], theme.checkboxon, theme.checkboxons, false);
else
m_pluginBtn[i] = m_pluginBtnCat[i];
m_btnMgr.show(m_pluginBtn[i]);
m_btnMgr.show(m_pluginLblCat[i]);
m_btnMgr.setBtnTexture(m_checkboxBtn[i], theme.checkboxoff, theme.checkboxoffs, false);
m_btnMgr.show(m_checkboxBtn[i]);
m_btnMgr.show(m_checkboxLblTxt[i]);
}
}
@ -139,7 +135,7 @@ void CMenu::_PluginSettings()
u32 IteratorHelp = (Plugin_curPage - 1) * 10;
for(u8 i = 0; i < min(IteratorHelp+10, (u32)m_max_plugins)-IteratorHelp+1; ++i)
{
if(m_btnMgr.selected(m_pluginBtn[i]))
if(m_btnMgr.selected(m_checkboxBtn[i]))
{
m_refreshGameList = true;
if(m_current_view != COVERFLOW_PLUGIN)
@ -158,7 +154,7 @@ void CMenu::_PluginSettings()
else
m_plugin.SetEnablePlugin(i+IteratorHelp-1);// switch plugin from off to on or vice versa
_updatePluginCheckboxes();
m_btnMgr.setSelected(m_pluginBtn[i]);
m_btnMgr.setSelected(m_checkboxBtn[i]);
break;
}
}
@ -208,31 +204,13 @@ void CMenu::_initPluginSettingsMenu()
m_pluginLblPage = _addLabel("PLUGIN/PAGE_BTN", theme.btnFont, L"", 68, 400, 104, 48, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_pluginBtnPageM = _addPicButton("PLUGIN/PAGE_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 20, 400, 48, 48);
m_pluginBtnPageP = _addPicButton("PLUGIN/PAGE_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 172, 400, 48, 48);
m_pluginBtnCat[0] = _addPicButton("PLUGIN/PLUGIN_0_BTN", theme.checkboxoff, theme.checkboxoffs, 270, 394, 44, 48);
m_pluginBtnCats[0] = _addPicButton("PLUGIN/PLUGIN_0_BTNS", theme.checkboxon, theme.checkboxons, 270, 394, 44, 48);
m_pluginLblCat[0] = _addLabel("PLUGIN/PLUGIN_0", theme.lblFont, L"", 325, 397, 100, 48, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
for(int i = 1; i < 6; ++i)
{ // Page 1
m_pluginBtnCat[i] = _addPicButton(fmt("PLUGIN/PLUGIN_%i_BTN", i), theme.checkboxoff, theme.checkboxoffs, 30, (39+i*58), 44, 48);
m_pluginBtnCats[i] = _addPicButton(fmt("PLUGIN/PLUGIN_%i_BTNS", i), theme.checkboxon, theme.checkboxons, 30, (39+i*58), 44, 48);
m_pluginLblCat[i] = _addLabel(fmt("PLUGIN/PLUGIN_%i", i), theme.lblFont, L"", 85, (42+i*58), 230, 48, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
// right half
m_pluginBtnCat[i+5] = _addPicButton(fmt("PLUGIN/PLUGIN_%i_BTN", i+5), theme.checkboxoff, theme.checkboxoffs, 325, (39+i*58), 44, 48);
m_pluginBtnCats[i+5] = _addPicButton(fmt("PLUGIN/PLUGIN_%i_BTNS", i+5), theme.checkboxon, theme.checkboxons, 325, (39+i*58), 44, 48);
m_pluginLblCat[i+5] = _addLabel(fmt("PLUGIN/PLUGIN_%i", i+5), theme.lblFont, L"", 380, (42+i*58), 230, 48, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
}
_setHideAnim(m_pluginLblTitle, "PLUGIN/TITLE", 0, 0, -2.f, 0.f);
_setHideAnim(m_pluginLblPage, "PLUGIN/PAGE_BTN", 0, 0, 1.f, -1.f);
_setHideAnim(m_pluginBtnPageM, "PLUGIN/PAGE_MINUS", 0, 0, 1.f, -1.f);
_setHideAnim(m_pluginBtnPageP, "PLUGIN/PAGE_PLUS", 0, 0, 1.f, -1.f);
_setHideAnim(m_pluginBtnBack, "PLUGIN/BACK_BTN", 0, 0, 1.f, -1.f);
for(u8 i = 0; i < 11; ++i)
{
_setHideAnim(m_pluginBtnCat[i], fmt("PLUGIN/PLUGIN_%i_BTN", i), 0, 0, 1.f, 0.f);
_setHideAnim(m_pluginBtnCats[i], fmt("PLUGIN/PLUGIN_%i_BTNS", i), 0, 0, 1.f, 0.f);
_setHideAnim(m_pluginLblCat[i], fmt("PLUGIN/PLUGIN_%i", i), 0, 0, 1.f, 0.f);
m_pluginBtn[i] = m_pluginBtnCat[i];
}
_hidePluginSettings(true);
_textPluginSettings();
}
@ -241,5 +219,5 @@ void CMenu::_textPluginSettings(void)
{
m_btnMgr.setText(m_pluginLblTitle, _t("cfgpl1", L"Select Plugins"));
m_btnMgr.setText(m_pluginBtnBack, _t("cd1", L"Back"));
m_btnMgr.setText(m_pluginLblCat[0], _t("dl25", L"All"));
m_btnMgr.setText(m_checkboxLblTxt[0], _t("dl25", L"All"));
}

View File

@ -20,11 +20,6 @@ s16 m_checkboxesBtnPageP;
s16 m_checkboxesBtnBack;
s16 m_checkboxesLblTitle;
s16 m_checkboxLblTxt[11];
s16 m_checkboxBtn[11];
s16 m_checkboxBtnOff[11];
s16 m_checkboxBtnOn[11];
void CMenu::_hideCheckboxesMenu(bool instant)
{
m_btnMgr.hide(m_checkboxesLblTitle, instant);
@ -92,7 +87,7 @@ void CMenu::_updateCheckboxes(void)
}
for(int i = 0; i < 11; ++i)
{
m_btnMgr.hide(m_checkboxBtn[i]);
m_btnMgr.hide(m_checkboxBtn[i]);// instant true?
m_btnMgr.hide(m_checkboxLblTxt[i]);
}
@ -107,17 +102,17 @@ void CMenu::_updateCheckboxes(void)
if(mode == 1)
{
if(m_source.getBool(sfmt("button_%i", firstCheckbox + i - 1), "hidden", false))
m_checkboxBtn[i] = m_checkboxBtnOn[i];
m_btnMgr.setBtnTexture(m_checkboxBtn[i], theme.checkboxon, theme.checkboxons, false);
else
m_checkboxBtn[i] = m_checkboxBtnOff[i];
m_btnMgr.setBtnTexture(m_checkboxBtn[i], theme.checkboxoff, theme.checkboxoffs, false);
}
else if(mode == 2)
{
m_checkboxBtn[i] = m_checkboxBtnOff[i];// all sources off
m_btnMgr.setBtnTexture(m_checkboxBtn[i], theme.checkboxoff, theme.checkboxoffs, false);// all sources off
}
else if(mode == 3)
{
m_checkboxBtn[i] = m_checkboxBtnOff[i];// all plugins off
m_btnMgr.setBtnTexture(m_checkboxBtn[i], theme.checkboxoff, theme.checkboxoffs, false);// all plugins off
}
else
{
@ -136,9 +131,9 @@ void CMenu::_updateCheckboxes(void)
}
}
if(found)
m_checkboxBtn[i] = m_checkboxBtnOn[i];
m_btnMgr.setBtnTexture(m_checkboxBtn[i], theme.checkboxon, theme.checkboxons, false);
else
m_checkboxBtn[i] = m_checkboxBtnOff[i];
m_btnMgr.setBtnTexture(m_checkboxBtn[i], theme.checkboxoff, theme.checkboxoffs, false);
}
}
m_btnMgr.show(m_checkboxBtn[i]);
@ -225,7 +220,7 @@ void CMenu::_checkboxesMenu(u8 md)
bool val = !m_source.getBool(button, "hidden", false);
m_source.setBool(button, "hidden", val);
_updateCheckboxes();
m_btnMgr.setSelected(m_checkboxBtn[i]);
m_btnMgr.setSelected(m_checkboxBtn[i]);// re-select after hiding and showing with new texture in case of using d-pad instead of pointer
break;
}
else if(mode == 2)// link - choose source
@ -380,25 +375,23 @@ void CMenu::_initCheckboxesMenu()
_setHideAnim(m_checkboxesBtnBack, "CHECKBOX/BACK_BTN", 0, 0, 1.f, -1.f);
/* init checkboxes only here to be used in all menu's */
m_checkboxBtnOff[0] = _addPicButton("CHECKBOX/CHECKBOX_0_OFF", theme.checkboxoff, theme.checkboxoffs, 270, 394, 44, 48);
m_checkboxBtnOn[0] = _addPicButton("CHECKBOX/CHECKBOX_0_ON", theme.checkboxon, theme.checkboxons, 270, 394, 44, 48);
m_checkboxBtn[0] = _addPicButton("CHECKBOX/CHECKBOX_0_OFF", theme.checkboxoff, theme.checkboxoffs, 270, 394, 44, 48);
m_checkboxLblTxt[0] = _addLabel("CHECKBOX/CHECKBOX_0_TXT", theme.lblFont, L"", 325, 397, 100, 48, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
for(int i = 1; i < 6; ++i)
{ // Page 1
m_checkboxBtnOff[i] = _addPicButton(fmt("CHECKBOX/CHECKBOX_%i_OFF", i), theme.checkboxoff, theme.checkboxoffs, 30, (39+i*58), 44, 48);
m_checkboxBtnOn[i] = _addPicButton(fmt("CHECKBOX/CHECKBOX_%i_ON", i), theme.checkboxon, theme.checkboxons, 30, (39+i*58), 44, 48);
for(int i = 1; i < 6; ++i)// left
{
m_checkboxBtn[i] = _addPicButton(fmt("CHECKBOX/CHECKBOX_%i_OFF", i), theme.checkboxoff, theme.checkboxoffs, 30, (39+i*58), 44, 48);
m_checkboxLblTxt[i] = _addLabel(fmt("CHECKBOX/CHECKBOX_%i_TXT", i), theme.lblFont, L"", 85, (42+i*58), 230, 48, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
// right half
m_checkboxBtnOff[i+5] = _addPicButton(fmt("CHECKBOX/CHECKBOX_%i_OFF", i+5), theme.checkboxoff, theme.checkboxoffs, 325, (39+i*58), 44, 48);
m_checkboxBtnOn[i+5] = _addPicButton(fmt("CHECKBOX/CHECKBOX_%i_ON", i+5), theme.checkboxon, theme.checkboxons, 325, (39+i*58), 44, 48);
}
for(int i = 1; i < 6; ++i)// right
{
m_checkboxBtn[i+5] = _addPicButton(fmt("CHECKBOX/CHECKBOX_%i_OFF", i+5), theme.checkboxoff, theme.checkboxoffs, 325, (39+i*58), 44, 48);
m_checkboxLblTxt[i+5] = _addLabel(fmt("CHECKBOX/CHECKBOX_%i_TXT", i+5), theme.lblFont, L"", 380, (42+i*58), 230, 48, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
}
for(u8 i = 0; i < 11; ++i)
{
_setHideAnim(m_checkboxBtnOff[i], fmt("CHECKBOX/CHECKBOX_%i_OFF", i), 0, 0, 1.f, 0.f);
_setHideAnim(m_checkboxBtnOn[i], fmt("CHECKBOX/CHECKBOX_%i_ON", i), 0, 0, 1.f, 0.f);
_setHideAnim(m_checkboxBtn[i], fmt("CHECKBOX/CHECKBOX_%i_OFF", i), 0, 0, 1.f, 0.f);
_setHideAnim(m_checkboxLblTxt[i], fmt("CHECKBOX/CHECKBOX_%i_TXT", i), 0, 0, 1.f, 0.f);
m_checkboxBtn[i] = m_checkboxBtnOff[i];
}
_hideCheckboxesMenu(true);
_textCheckboxesMenu();