diff --git a/source/FreeTypeGX.cpp b/source/FreeTypeGX.cpp index dc8670b4..a85d25e2 100644 --- a/source/FreeTypeGX.cpp +++ b/source/FreeTypeGX.cpp @@ -439,14 +439,17 @@ void FreeTypeGX::loadGlyphData(FT_Bitmap *bmp, ftgxCharData *charData) { */ int16_t FreeTypeGX::getStyleOffsetWidth(uint16_t width, uint16_t format) { - if (format & FTGX_JUSTIFY_LEFT ) { - return 0; - } - else if (format & FTGX_JUSTIFY_CENTER ) { - return -(width >> 1); - } - else if (format & FTGX_JUSTIFY_RIGHT ) { - return -width; + switch(format & FTGX_JUSTIFY_MASK) + { + case FTGX_JUSTIFY_LEFT: + return 0; + + default: + case FTGX_JUSTIFY_CENTER: + return -(width >> 1); + + case FTGX_JUSTIFY_RIGHT: + return -width; } return 0; diff --git a/source/cfg.h b/source/cfg.h index 232fdfe5..455b7480 100644 --- a/source/cfg.h +++ b/source/cfg.h @@ -201,7 +201,7 @@ int subfoldercheck(char * directory); //Astidof - Begin of modification enum { - ConsoleLangDefault, + ConsoleLangDefault=0, jap, eng, ger, @@ -211,21 +211,25 @@ enum { dut, schin, tchin, - kor + kor, + + settings_language_max // always the last entry }; enum { - systemdefault, + systemdefault=0, discdefault, patch, pal50, pal60, - ntsc + ntsc, + settings_video_max // always the last entry }; enum { - off, + off=0, on, + settings_off_on_max // always the last entry }; enum { @@ -233,40 +237,45 @@ enum { GameRegion, Both, Neither, + settings_sinfo_max // always the last entry }; enum { - i249, + i249=0, i222, }; enum { - ios249, + ios249=0, ios222, + settings_cios_max // always the last entry }; enum { - hr12, + hr12=0, hr24, Off, + settings_clock_max // always the last entry }; enum { - all, + all=0, pcount, }; enum { - RumbleOff, + RumbleOff=0, RumbleOn, + settings_rumble_max // always the last entry }; enum { - TooltipsOff, + TooltipsOff=0, TooltipsOn, + settings_tooltips_max // always the last entry }; enum { - v10, + v10=0, v20, v30, v40, @@ -277,27 +286,35 @@ enum { v90, v100, v0, + settings_volume_max // always the last entry }; enum { - no, + no=0, yes, sysmenu, wtf, disk3d, + settings_xflip_max // always the last entry }; enum { - us, + us=0, dvorak, euro, azerty, + settings_keyset_max // always the last entry }; enum { list, grid, carousel, }; +enum { + scrollDefault, + scrollMarquee, + settings_scrolleffect_max // always the last entry +}; struct SSettings { int video; int language; diff --git a/source/libwiigui/gui.h b/source/libwiigui/gui.h index 42d57835..2d060576 100644 --- a/source/libwiigui/gui.h +++ b/source/libwiigui/gui.h @@ -659,6 +659,7 @@ class GuiText : public GuiElement //!Sets the text of the GuiText element //!\param t Text void SetText(const char * t); + void SetTextf(const char *format, ...) __attribute__((format(printf,2,3))); //!Sets up preset values to be used by GuiText(t) //!Useful when printing multiple text elements, all with the same attributes set //!\param sz Font size diff --git a/source/libwiigui/gui_customoptionbrowser.cpp b/source/libwiigui/gui_customoptionbrowser.cpp index e9f8a30c..41ab56ca 100644 --- a/source/libwiigui/gui_customoptionbrowser.cpp +++ b/source/libwiigui/gui_customoptionbrowser.cpp @@ -15,8 +15,68 @@ #define GAMESELECTSIZE 30 -static int scrollbaron = 0; -int coL2; + +customOptionList::customOptionList(int size) +{ + name = new char * [size]; + value = new char * [size]; + for (int i = 0; i < size; i++) + { + name[i] = 0; + value[i] = 0; + } + length = size; + changed = false; +} +customOptionList::~customOptionList() +{ + for (int i = 0; i < length; i++) + { + free(name[i]); + free(value[i]); + } + delete [] name; + delete [] value; +} +void customOptionList::SetName(int i, const char *format, ...) +{ + if(i >= 0 && i < length) + { + if(name[i]) free(name[i]); + name[i] = 0; + va_list va; + va_start(va, format); + vasprintf(&name[i], format, va); + va_end(va); + changed = true; + } +} +void customOptionList::SetValue(int i, const char *format, ...) +{ + if(i >= 0 && i < length) + { + char *tmp=0; + va_list va; + va_start(va, format); + vasprintf(&tmp, format, va); + va_end(va); + + if(tmp) + { + if(value[i] && !strcmp(tmp, value[i])) + free(tmp); + else + { + free(value[i]); + value[i] = tmp; + changed = true; + } + } + } +} + + + //int vol; extern const int vol; /** @@ -27,7 +87,7 @@ GuiCustomOptionBrowser::GuiCustomOptionBrowser(int w, int h, customOptionList * width = w; height = h; options = l; - size = ((l->length > PAGESIZE)? PAGESIZE: l->length); + size = ((l->GetLength() > PAGESIZE)? PAGESIZE: l->GetLength()); scrollbaron = scrollon; selectable = true; listOffset = this->FindMenuItem(-1, 1); @@ -115,13 +175,14 @@ GuiCustomOptionBrowser::GuiCustomOptionBrowser(int w, int h, customOptionList * optionIndex = new int[size]; optionVal = new GuiText * [size]; + optionValOver = new GuiText * [size]; optionBtn = new GuiButton * [size]; optionTxt = new GuiText * [size]; optionBg = new GuiImage * [size]; for(int i=0; i < size; i++) { - optionTxt[i] = new GuiText(options->name[i], 20, (GXColor){0, 0, 0, 0xff}); + optionTxt[i] = new GuiText(options->GetName(i), 20, (GXColor){0, 0, 0, 0xff}); optionTxt[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); optionTxt[i]->SetPosition(24,0); @@ -129,12 +190,15 @@ GuiCustomOptionBrowser::GuiCustomOptionBrowser(int w, int h, customOptionList * optionVal[i] = new GuiText(NULL, 20, (GXColor){0, 0, 0, 0xff}); optionVal[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); - optionVal[i]->SetPosition(250,0); + + optionValOver[i] = new GuiText(NULL, 20, (GXColor){0, 0, 0, 0xff}); + optionValOver[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); optionBtn[i] = new GuiButton(width,GAMESELECTSIZE);//(width-28,GAMESELECTSIZE); optionBtn[i]->SetParent(this); optionBtn[i]->SetLabel(optionTxt[i], 0); optionBtn[i]->SetLabel(optionVal[i], 1); + optionBtn[i]->SetLabelOver(optionValOver[i], 1); optionBtn[i]->SetImageOver(optionBg[i]); optionBtn[i]->SetPosition(10,GAMESELECTSIZE*i+4); optionBtn[i]->SetRumble(false); @@ -142,6 +206,7 @@ GuiCustomOptionBrowser::GuiCustomOptionBrowser(int w, int h, customOptionList * optionBtn[i]->SetSoundClick(btnSoundClick); } + UpdateListEntries(); } /** @@ -180,23 +245,18 @@ GuiCustomOptionBrowser::~GuiCustomOptionBrowser() { delete optionTxt[i]; delete optionVal[i]; + delete optionValOver[i]; delete optionBg[i]; delete optionBtn[i]; } delete [] optionIndex; delete [] optionVal; + delete [] optionValOver; delete [] optionBtn; delete [] optionTxt; delete [] optionBg; } -void GuiCustomOptionBrowser::SetCol2Position(int x) -{ - LOCK(this); - for(int i = 0; i < size; i++) - optionVal[i]->SetPosition(x,0); -} - void GuiCustomOptionBrowser::SetFocus(int f) { LOCK(this); @@ -263,10 +323,10 @@ int GuiCustomOptionBrowser::FindMenuItem(int currentItem, int direction) { int nextItem = currentItem + direction; - if(nextItem < 0 || nextItem >= options->length) + if(nextItem < 0 || nextItem >= options->GetLength()) return -1; - if(strlen(options->name[nextItem]) > 0) + if(strlen(options->GetName(nextItem)) > 0) return nextItem; else return FindMenuItem(nextItem, direction); @@ -304,31 +364,12 @@ void GuiCustomOptionBrowser::Draw() } this->UpdateEffects(); } - -void GuiCustomOptionBrowser::Update(GuiTrigger * t) +void GuiCustomOptionBrowser::UpdateListEntries() { - LOCK(this); - int next, prev, lang = options->length; - - if(state == STATE_DISABLED || !t) - return; - - - // scrolldelay affects how fast the list scrolls - // when the arrows are clicked - float scrolldelay = 3.5; - - - if (scrollbaron == 1) { - // update the location of the scroll box based on the position in the option list - - - arrowUpBtn->Update(t); - arrowDownBtn->Update(t); - scrollbarBoxBtn->Update(t); - } - next = listOffset; + if(listOffset<0) listOffset = this->FindMenuItem(-1, 1); + int next = listOffset; + int maxNameWidth = 0; for(int i=0; i < size; i++) { if(next >= 0) @@ -339,9 +380,11 @@ void GuiCustomOptionBrowser::Update(GuiTrigger * t) optionBtn[i]->SetState(STATE_DEFAULT); } - optionTxt[i]->SetText(options->name[next]); - optionVal[i]->SetText(options->value[next]); - optionVal[i]->SetPosition(coL2, 0); + optionTxt[i]->SetText(options->GetName(next)); + if(maxNameWidth < optionTxt[i]->GetTextWidth()) + maxNameWidth = optionTxt[i]->GetTextWidth(); + optionVal[i]->SetText(options->GetValue(next)); + optionValOver[i]->SetText(options->GetValue(next)); optionIndex[i] = next; next = this->FindMenuItem(next, 1); @@ -351,6 +394,52 @@ void GuiCustomOptionBrowser::Update(GuiTrigger * t) optionBtn[i]->SetVisible(false); optionBtn[i]->SetState(STATE_DISABLED); } + } + if(coL2 < (24+maxNameWidth+16)) + coL2 = 24+maxNameWidth+16; + for(int i=0; i < size; i++) + { + if(optionBtn[i]->GetState() != STATE_DISABLED) + { + optionVal[i]->SetPosition(coL2,0); + optionVal[i]->SetMaxWidth(bgOptionsImg->GetWidth() - (coL2+24), GuiText::DOTTED); + + optionValOver[i]->SetPosition(coL2,0); + optionValOver[i]->SetMaxWidth(bgOptionsImg->GetWidth() - (coL2+24), GuiText::SCROLL); + } + } +} +void GuiCustomOptionBrowser::Update(GuiTrigger * t) +{ + LOCK(this); + int next, prev, lang = options->GetLength(); + + if(state == STATE_DISABLED || !t) + return; + + if(options->IsChanged()) + UpdateListEntries(); + int old_listOffset = listOffset; + + // scrolldelay affects how fast the list scrolls + // when the arrows are clicked + float scrolldelay = 3.5; + + + if (scrollbaron == 1) + { + // update the location of the scroll box based on the position in the option list + arrowUpBtn->Update(t); + arrowDownBtn->Update(t); + scrollbarBoxBtn->Update(t); + } + + next = listOffset; + + for(int i=0; i < size; i++) + { + if(next >= 0) + next = this->FindMenuItem(next, 1); if(focus) { @@ -374,171 +463,174 @@ void GuiCustomOptionBrowser::Update(GuiTrigger * t) if(!focus) return; // skip navigation - if (scrollbaron == 1) { - - if (t->Down() || - arrowDownBtn->GetState() == STATE_CLICKED || ////////////////////////////////////////////down - arrowDownBtn->GetState() == STATE_HELD) + if (scrollbaron == 1) { - next = this->FindMenuItem(optionIndex[selectedItem], 1); - - if(next >= 0) + if (t->Down() || + arrowDownBtn->GetState() == STATE_CLICKED || ////////////////////////////////////////////down + arrowDownBtn->GetState() == STATE_HELD) { - if(selectedItem == size-1) + + next = this->FindMenuItem(optionIndex[selectedItem], 1); + + if(next >= 0) { - // move list down by 1 - listOffset = this->FindMenuItem(listOffset, 1); + if(selectedItem == size-1) + { + // move list down by 1 + listOffset = this->FindMenuItem(listOffset, 1); + } + else if(optionBtn[selectedItem+1]->IsVisible()) + { + optionBtn[selectedItem]->ResetState(); + optionBtn[selectedItem+1]->SetState(STATE_SELECTED, t->chan); + selectedItem++; + } + scrollbarBoxBtn->Draw(); + usleep(10000 * scrolldelay); } - else if(optionBtn[selectedItem+1]->IsVisible()) + WPAD_ScanPads(); + u8 cnt, buttons = NULL; + /* Get pressed buttons */ + for (cnt = 0; cnt < 4; cnt++) + buttons |= WPAD_ButtonsHeld(cnt); + if (buttons == WPAD_BUTTON_A) { - optionBtn[selectedItem]->ResetState(); - optionBtn[selectedItem+1]->SetState(STATE_SELECTED, t->chan); - selectedItem++; - } - scrollbarBoxBtn->Draw(); - usleep(10000 * scrolldelay); - - - }WPAD_ScanPads(); - u8 cnt, buttons = NULL; - /* Get pressed buttons */ - for (cnt = 0; cnt < 4; cnt++) - buttons |= WPAD_ButtonsHeld(cnt); - if (buttons == WPAD_BUTTON_A) { - - } else { - arrowDownBtn->ResetState(); - - } - - } - else if(t->Up() || - arrowUpBtn->GetState() == STATE_CLICKED || ////////////////////////////////////////////up - arrowUpBtn->GetState() == STATE_HELD) - { - prev = this->FindMenuItem(optionIndex[selectedItem], -1); - - if(prev >= 0) - { - if(selectedItem == 0) - { - // move list up by 1 - listOffset = prev; } else { - optionBtn[selectedItem]->ResetState(); - optionBtn[selectedItem-1]->SetState(STATE_SELECTED, t->chan); - selectedItem--; + arrowDownBtn->ResetState(); } - scrollbarBoxBtn->Draw(); - usleep(10000 * scrolldelay); - - - }WPAD_ScanPads(); - u8 cnt, buttons = NULL; - /* Get pressed buttons */ - for (cnt = 0; cnt < 4; cnt++) - buttons |= WPAD_ButtonsHeld(cnt); - if (buttons == WPAD_BUTTON_A) { - - } else { - arrowUpBtn->ResetState(); - - } - } - - if(scrollbarBoxBtn->GetState() == STATE_HELD && - scrollbarBoxBtn->GetStateChan() == t->chan && - t->wpad.ir.valid && options->length > size) - { - scrollbarBoxBtn->SetPosition(width/2-18+7,0); - int position = t->wpad.ir.y - 50 - scrollbarBoxBtn->GetTop(); - - listOffset = (position * lang)/180 - selectedItem; - - if(listOffset <= 0) - { - listOffset = 0; - selectedItem = 0; } - else if(listOffset+size >= lang) + else if(t->Up() || + arrowUpBtn->GetState() == STATE_CLICKED || ////////////////////////////////////////////up + arrowUpBtn->GetState() == STATE_HELD) { - listOffset = lang-size; - selectedItem = size-1; + prev = this->FindMenuItem(optionIndex[selectedItem], -1); + + if(prev >= 0) + { + if(selectedItem == 0) + { + // move list up by 1 + listOffset = prev; + } + else + { + optionBtn[selectedItem]->ResetState(); + optionBtn[selectedItem-1]->SetState(STATE_SELECTED, t->chan); + selectedItem--; + } + scrollbarBoxBtn->Draw(); + usleep(10000 * scrolldelay); + + + } + WPAD_ScanPads(); + u8 cnt, buttons = NULL; + /* Get pressed buttons */ + for (cnt = 0; cnt < 4; cnt++) + buttons |= WPAD_ButtonsHeld(cnt); + if (buttons == WPAD_BUTTON_A) + { + } + else + { + arrowUpBtn->ResetState(); + } } - } - int positionbar = 237*(listOffset + selectedItem) / lang; + if(scrollbarBoxBtn->GetState() == STATE_HELD && + scrollbarBoxBtn->GetStateChan() == t->chan && + t->wpad.ir.valid && options->GetLength() > size) + { + scrollbarBoxBtn->SetPosition(width/2-18+7,0); + int position = t->wpad.ir.y - 50 - scrollbarBoxBtn->GetTop(); - if(positionbar > 216) - positionbar = 216; + listOffset = (position * lang)/180 - selectedItem; + + if(listOffset <= 0) + { + listOffset = 0; + selectedItem = 0; + } + else if(listOffset+size >= lang) + { + listOffset = lang-size; + selectedItem = size-1; + } + + } + int positionbar = 237*(listOffset + selectedItem) / lang; + + if(positionbar > 216) + positionbar = 216; scrollbarBoxBtn->SetPosition(width/2-18+7, positionbar+8); - if(t->Right()) - { - if(listOffset < lang && lang > size) + if(t->Right()) { - listOffset =listOffset+ size; - if(listOffset+size >= lang) - listOffset = lang-size; - } - } - else if(t->Left()) - { - if(listOffset > 0) - { - listOffset =listOffset- size; - if(listOffset < 0) - listOffset = 0; - } - } - - } else { - - - if(t->Down()) - { - next = this->FindMenuItem(optionIndex[selectedItem], 1); - - if(next >= 0) - { - if(selectedItem == size-1) + if(listOffset < lang && lang > size) { - // move list down by 1 - listOffset = this->FindMenuItem(listOffset, 1); - } - else if(optionBtn[selectedItem+1]->IsVisible()) - { - optionBtn[selectedItem]->ResetState(); - optionBtn[selectedItem+1]->SetState(STATE_SELECTED, t->chan); - selectedItem++; + listOffset =listOffset+ size; + if(listOffset+size >= lang) + listOffset = lang-size; } } - } - else if(t->Up()) - { - prev = this->FindMenuItem(optionIndex[selectedItem], -1); - - if(prev >= 0) + else if(t->Left()) { - if(selectedItem == 0) + if(listOffset > 0) { - // move list up by 1 - listOffset = prev; - } - else - { - optionBtn[selectedItem]->ResetState(); - optionBtn[selectedItem-1]->SetState(STATE_SELECTED, t->chan); - selectedItem--; + listOffset =listOffset- size; + if(listOffset < 0) + listOffset = 0; } } - } } + else + { + if(t->Down()) + { + next = this->FindMenuItem(optionIndex[selectedItem], 1); + if(next >= 0) + { + if(selectedItem == size-1) + { + // move list down by 1 + listOffset = this->FindMenuItem(listOffset, 1); + } + else if(optionBtn[selectedItem+1]->IsVisible()) + { + optionBtn[selectedItem]->ResetState(); + optionBtn[selectedItem+1]->SetState(STATE_SELECTED, t->chan); + selectedItem++; + } + } + } + else if(t->Up()) + { + prev = this->FindMenuItem(optionIndex[selectedItem], -1); + + if(prev >= 0) + { + if(selectedItem == 0) + { + // move list up by 1 + listOffset = prev; + } + else + { + optionBtn[selectedItem]->ResetState(); + optionBtn[selectedItem-1]->SetState(STATE_SELECTED, t->chan); + selectedItem--; + } + } + } + } + if(old_listOffset != listOffset) + UpdateListEntries(); + if(updateCB) updateCB(this); } diff --git a/source/libwiigui/gui_customoptionbrowser.h b/source/libwiigui/gui_customoptionbrowser.h index ecc0d51d..0455a495 100644 --- a/source/libwiigui/gui_customoptionbrowser.h +++ b/source/libwiigui/gui_customoptionbrowser.h @@ -1,31 +1,33 @@ #include "gui.h" +extern int SetValue(int i, const char *format, ...) __attribute__((format(printf,2,3))); class customOptionList { public: - customOptionList(int size) { - name = new char * [size]; - value = new char * [size]; - for (int i = 0; i < size; i++) - { - name[i] = new char[40]; - value[i] = new char[40]; - } - length = size; - }; - ~customOptionList(){ - for (int i = 0; i < length; i++) - { - delete [] name[i]; - delete [] value[i]; - } - delete [] name; - delete [] value; - }; - - public: + customOptionList(int size); + ~customOptionList(); + void SetName(int i, const char *format, ...) __attribute__((format (printf, 3, 4))); + const char *GetName(int i) + { + if(i >= 0 && i < length && name[i]) + return name[i]; + else + return ""; + } + void SetValue(int i, const char *format, ...) __attribute__((format (printf, 3, 4))); + const char *GetValue(int i) + { + if(i >= 0 && i < length && value[i]) + return value[i]; + else + return ""; + } + int GetLength() { return length; } + bool IsChanged() { bool ret = changed; changed = false; return ret;} + private: int length; char ** name; char ** value; + bool changed; }; //!Display a list of menu options @@ -34,7 +36,6 @@ class GuiCustomOptionBrowser : public GuiElement public: GuiCustomOptionBrowser(int w, int h, customOptionList * l, const char * themePath, const char *custombg, const u8 *imagebg, int scrollbar, int col2); ~GuiCustomOptionBrowser(); - void SetCol2Position(int x); int FindMenuItem(int c, int d); int GetClickedOption(); int GetSelectedOption(); @@ -42,16 +43,20 @@ class GuiCustomOptionBrowser : public GuiElement void SetFocus(int f); void Draw(); void Update(GuiTrigger * t); - GuiText ** optionVal; protected: + void UpdateListEntries(); int selectedItem; int listOffset; int size; + int coL2; + int scrollbaron; customOptionList * options; int * optionIndex; GuiButton ** optionBtn; GuiText ** optionTxt; + GuiText ** optionVal; + GuiText ** optionValOver; GuiImage ** optionBg; GuiButton * arrowUpBtn; diff --git a/source/libwiigui/gui_gamebrowser.cpp b/source/libwiigui/gui_gamebrowser.cpp index 6deb0a67..9de8f91b 100644 --- a/source/libwiigui/gui_gamebrowser.cpp +++ b/source/libwiigui/gui_gamebrowser.cpp @@ -313,27 +313,26 @@ void GuiGameBrowser::UpdateListEntries() int next = listOffset; for(int i=0; i= 0) + if(next >= 0) + { + if(game[i]->GetState() == STATE_DISABLED) { - if(game[i]->GetState() == STATE_DISABLED) - { - game[i]->SetVisible(true); - game[i]->SetState(STATE_DEFAULT); - } - gameTxt[i]->SetText(get_title(&gameList[next])); - gameTxt[i]->SetPosition(24, 0); - gameTxtOver[i]->SetText(get_title(&gameList[next])); - gameTxtOver[i]->SetPosition(24, 0); + game[i]->SetVisible(true); + game[i]->SetState(STATE_DEFAULT); + } + gameTxt[i]->SetText(get_title(&gameList[next])); + gameTxt[i]->SetPosition(24, 0); + gameTxtOver[i]->SetText(get_title(&gameList[next])); + gameTxtOver[i]->SetPosition(24, 0); - gameIndex[i] = next; - next = this->FindMenuItem(next, 1); - } - else - { - game[i]->SetVisible(false); - game[i]->SetState(STATE_DISABLED); - } -// } + gameIndex[i] = next; + next = this->FindMenuItem(next, 1); + } + else + { + game[i]->SetVisible(false); + game[i]->SetState(STATE_DISABLED); + } } } @@ -437,7 +436,6 @@ void GuiGameBrowser::Update(GuiTrigger * t) { // move list up by 1 listOffset = prev; -// UpdateEntries(); } else { @@ -500,10 +498,7 @@ void GuiGameBrowser::Update(GuiTrigger * t) } scrollbarBoxBtn->Draw(); usleep(10000 * scrolldelay); - - } - } else if (position2 < position1) { @@ -603,7 +598,6 @@ void GuiGameBrowser::Update(GuiTrigger * t) { // move list down by 1 listOffset = this->FindMenuItem(listOffset, 1); -// UpdateEntries(); } else if(game[selectedItem+1]->IsVisible()) { @@ -623,7 +617,6 @@ void GuiGameBrowser::Update(GuiTrigger * t) { // move list up by 1 listOffset = prev; -// UpdateEntries(); } else { diff --git a/source/libwiigui/gui_text.cpp b/source/libwiigui/gui_text.cpp index 7f62df61..62117012 100644 --- a/source/libwiigui/gui_text.cpp +++ b/source/libwiigui/gui_text.cpp @@ -94,6 +94,18 @@ void GuiText::SetText(const char * t) scrollPos2 = 0; scrollDelay = 0; } +void GuiText::SetTextf(const char *format, ...) +{ + char *tmp=0; + va_list va; + va_start(va, format); + if((vasprintf(&tmp, format, va)>=0) && tmp) + { + this->SetText(tmp); + free(tmp); + } + va_end(va); +} void GuiText::SetPresets(int sz, GXColor c, int w, int wrap, u16 s, int h, int v) { @@ -178,6 +190,9 @@ void GuiText::SetFont(FreeTypeGX *f) int GuiText::GetTextWidth() { LOCK(this); + if(!text) + return 0; + int newSize = size*this->GetScale(); if(newSize != currentSize || currentWidescreen != widescreen) diff --git a/source/menu.cpp b/source/menu.cpp index b546b964..a4b35cdb 100644 --- a/source/menu.cpp +++ b/source/menu.cpp @@ -31,7 +31,7 @@ #include "wdvd.h" #include "libwbfs/libwbfs.h" #include "sys.h" -#include "libwiigui/gui_gamegrid.h" +#include "libwiigui/gui_gamegrid.h" #include "libwiigui/gui_gamecarousel.h" #include "patchcode.h" #include "wpad.h" @@ -57,12 +57,9 @@ static GuiImageData * pointer[4]; static GuiImage * bgImg = NULL; static GuiButton * btnLogo = NULL; static GuiImageData * background = NULL; -static char prozent[10] = " "; -static char timet[50] = " "; -static char sizeshow[20] = " "; -static GuiText prTxt(prozent, 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); -static GuiText timeTxt(prozent, 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); -static GuiText sizeTxt(sizeshow, 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); +static GuiText prTxt(NULL, 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); +static GuiText timeTxt(NULL, 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); +static GuiText sizeTxt(NULL, 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); static GuiText *GameIDTxt = NULL; static GuiText *GameRegionTxt = NULL; static GuiSound * bgMusic = NULL; @@ -212,9 +209,9 @@ static void WindowCredits(void * ptr) GuiText * txt[numEntries]; txt[i] = new GuiText(LANGUAGE.Credits, 26, (GXColor){255, 255, 255, 255}); - txt[i]->SetAlignment(ALIGN_CENTRE, ALIGN_TOP); txt[i]->SetPosition(0,12); i++; - - char SvnRev[10]; + txt[i]->SetAlignment(ALIGN_CENTRE, ALIGN_TOP); txt[i]->SetPosition(0,12); i++; + + char SvnRev[10]; snprintf(SvnRev, 10, "Rev%s", SVN_REV); txt[i] = new GuiText(SvnRev, 18, (GXColor){255, 255, 255, 255}); @@ -953,7 +950,6 @@ WindowExitPrompt(const char *title, const char *msg, const char *btn1Label, int GameWindowPrompt() { int choice = -1, angle = 0; - char sizeText[15]; f32 size = 0.0; char ID[4]; char IDFull[7]; @@ -1022,9 +1018,9 @@ int GameWindowPrompt() nameBtn.SetEffectGrow(); } - GuiText sizeTxt("", 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{50, 50, 50, 255}); //TODO: get the size here + GuiText sizeTxt(NULL, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{50, 50, 50, 255}); //TODO: get the size here sizeTxt.SetAlignment(ALIGN_RIGHT, ALIGN_TOP); - sizeTxt.SetPosition(-110,70); + sizeTxt.SetPosition(-60,70); // GuiImage diskImg; GuiDiskCover diskImg; @@ -1038,8 +1034,7 @@ int GameWindowPrompt() diskImg2.SetAngle(angle); diskImg2.SetBeta(180); - char PlayCnt[25]; - GuiText playcntTxt(PlayCnt, 18, (GXColor){THEME.info_r, THEME.info_g, THEME.info_b, 255}); + GuiText playcntTxt(NULL, 18, (GXColor){THEME.info_r, THEME.info_g, THEME.info_b, 255}); playcntTxt.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE); playcntTxt.SetPosition(-115,45); @@ -1156,9 +1151,6 @@ int GameWindowPrompt() //load disc image based or what game is seleted struct discHdr * header = &gameList[gameSelected]; - WBFS_GameSize(header->id, &size); - - snprintf(sizeText, sizeof(sizeText), "%.2fGB", size); //set size text snprintf (ID,sizeof(ID),"%c%c%c", header->id[0], header->id[1], header->id[2]); snprintf (IDFull,sizeof(IDFull),"%c%c%c%c%c%c", header->id[0], header->id[1], header->id[2],header->id[3], header->id[4], header->id[5]); @@ -1230,7 +1222,9 @@ int GameWindowPrompt() } else diskImg.SetImage(diskCover); - sizeTxt.SetText(sizeText); + + WBFS_GameSize(header->id, &size); + sizeTxt.SetTextf("%.2fGB", size); //set size text; nameTxt.SetText(get_title(header)); struct Game_NUM* game_num = CFG_get_game_num(header->id); @@ -1241,8 +1235,7 @@ int GameWindowPrompt() playCount = 0; faveChoice = 0; } - sprintf(PlayCnt,"%s: %i",LANGUAGE.Plays, playCount); - playcntTxt.SetText(PlayCnt); + playcntTxt.SetTextf("%s: %i",LANGUAGE.Plays, playCount); btnFavoriteImg.SetImage(faveChoice ? &imgFavorite : &imgNotFavorite); nameTxt.SetPosition(0, 1); @@ -1522,8 +1515,7 @@ DiscWait(const char *title, const char *msg, const char *btn1Label, const char * } } - char timer[20]; - GuiText timerTxt(timer, 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255}); + GuiText timerTxt(NULL, 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255}); timerTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); timerTxt.SetPosition(0,160); @@ -1550,8 +1542,7 @@ DiscWait(const char *title, const char *msg, const char *btn1Label, const char * if(IsDeviceWait) { while(i >= 0) { - sprintf(timer, "%u%s", i,LANGUAGE.secondsleft); - timerTxt.SetText(timer); + timerTxt.SetTextf("%u%s", i,LANGUAGE.secondsleft); VIDEO_WaitVSync(); if(Settings.cios == ios222) { ret = IOS_ReloadIOS(222); @@ -1725,8 +1716,7 @@ int NetworkInitPromp(int choice2) } if (IP && ret > 0) { - sprintf(msg, "IP: %s", IP); - msgTxt.SetText(msg); + msgTxt.SetTextf("IP: %s", IP); cntMissFiles = 0; u32 i = 0; char filename[11]; @@ -1823,16 +1813,13 @@ ShowProgress (s32 done, s32 total) //Calculate percentage/size f32 percent = (done * 100.0) / total; - sprintf(prozent, "%0.2f", percent); - prTxt.SetText(prozent); + prTxt.SetTextf("%0.2f", percent); - sprintf(timet,"%s %d:%02d:%02d",LANGUAGE.Timeleft,h,m,s); - timeTxt.SetText(timet); + timeTxt.SetTextf("%s %d:%02d:%02d",LANGUAGE.Timeleft,h,m,s); f32 gamesizedone = gamesize * done/total; - sprintf(sizeshow,"%0.2fGB/%0.2fGB", gamesizedone, gamesize); - sizeTxt.SetText(sizeshow); + sizeTxt.SetTextf("%0.2fGB/%0.2fGB", gamesizedone, gamesize); if ((Settings.wsprompt == yes) && (CFG.widescreen)){ progressbarImg.SetTile((int)(80*done/total));} @@ -2011,12 +1998,12 @@ ProgressDownloadWindow(int choice2) GuiText titleTxt(LANGUAGE.Downloadingfile, 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255}); titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); titleTxt.SetPosition(0,60); - char msg[25] = " "; - GuiText msgTxt(msg, 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255}); + + GuiText msgTxt(NULL, 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255}); msgTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); msgTxt.SetPosition(0,130); - char msg2[15] = " "; - GuiText msg2Txt(msg2, 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255}); + + GuiText msg2Txt(NULL, 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255}); msg2Txt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); msg2Txt.SetPosition(0,100); @@ -2081,8 +2068,7 @@ ProgressDownloadWindow(int choice2) while (i < cntMissFiles) { - sprintf(prozent, "%i%%", 100*i/cntMissFiles); - prTxt.SetText(prozent); + prTxt.SetTextf("%i%%", 100*i/cntMissFiles); if ((Settings.wsprompt == yes) && (CFG.widescreen)){/////////////adjust for widescreen progressbarImg.SetPosition(80,40); @@ -2091,10 +2077,8 @@ ProgressDownloadWindow(int choice2) progressbarImg.SetTile(100*i/cntMissFiles); } - sprintf(msg, "%i %s", cntMissFiles - i, LANGUAGE.filesleft); - msgTxt.SetText(msg); - sprintf(msg2, "%s", missingFiles[i]); - msg2Txt.SetText(msg2); + msgTxt.SetTextf("%i %s", cntMissFiles - i, LANGUAGE.filesleft); + msg2Txt.SetTextf("%s", missingFiles[i]); //download boxart image char imgPath[100]; @@ -2374,29 +2358,24 @@ ProgressUpdateWindow() sprintf(msg, "Rev%i %s.", revnumber, LANGUAGE.available); int choice = WindowPrompt(msg, LANGUAGE.Doyouwanttoupdate, LANGUAGE.Yes, LANGUAGE.No, 0, 0); if(choice == 1) { - //sprintf(title, "%s", "%s USB Loader GX", LANGUAGE.updating); - sprintf(title, "%s USB Loader GX", LANGUAGE.updating); - titleTxt.SetText(title); + titleTxt.SetTextf("%s USB Loader GX", LANGUAGE.updating); msgTxt.SetPosition(0,100); promptWindow.Append(&progressbarEmptyImg); promptWindow.Append(&progressbarImg); promptWindow.Append(&progressbarOutlineImg); promptWindow.Append(&prTxt); - sprintf(msg, "Updating to Rev%i", revnumber); - msgTxt.SetText(msg); + msgTxt.SetTextf("Updating to Rev%i", revnumber); int filesize = downloadrev("http://www.techjawa.com/usbloadergx/boot.dol"); if(filesize > 0) { pfile = fopen(dolpath, "wb"); for (int i = 0; i < filesize; i += blocksize) { - sprintf(prozent, "%i%%", 100*i/filesize); - prTxt.SetText(prozent); + prTxt.SetTextf("%i%%", 100*i/filesize); if ((Settings.wsprompt == yes) && (CFG.widescreen)){/////////////adjust for widescreen progressbarImg.SetTile(80*i/filesize); } else { progressbarImg.SetTile(100*i/filesize); } - sprintf(msg2, "%iKB/%iKB", i/1024, filesize/1024); - msg2Txt.SetText(msg2); + msg2Txt.SetTextf("%iKB/%iKB", i/1024, filesize/1024); if(btn1.GetState() == STATE_CLICKED) { fclose(pfile); @@ -2669,7 +2648,7 @@ s32 __Menu_GetEntries(void) u32 cnt2 = 0; for (u32 i = 0; i < cnt; i++) - { + { header = &buffer[i]; if (get_block(header) < CFG.parentalcontrol) { buffer2 = (discHdr *) realloc(buffer2, (cnt2+1) * sizeof(struct discHdr)); @@ -2975,7 +2954,6 @@ static int MenuDiscList() datagB=0; int menu = MENU_NONE, dataef=0; char imgPath[100]; - char buf[4]; __Menu_GetEntries(); f32 freespace, used, size = 0.0; @@ -2986,7 +2964,7 @@ static int MenuDiscList() //CLOCK struct tm * timeinfo; - char theTime[80]; + char theTime[80]=""; time_t lastrawtime=0; WBFS_DiskSpace(&used, &freespace); @@ -3341,8 +3319,7 @@ static int MenuDiscList() } else if (dataed > 0){ - sprintf(buf, "%i", (dataed-1)); - clockTime.SetText(buf); + clockTime.SetTextf("%i", (dataed-1)); } } @@ -3444,7 +3421,7 @@ static int MenuDiscList() offset = gameBrowser.GetOffset();} else if (Settings.gameDisplay==grid){ startat = gameGrid.GetSelectedOption(); - offset = gameGrid.GetOffset();} + offset = gameGrid.GetOffset();} if(isSdInserted()) { CFG_Load(); } @@ -3533,9 +3510,7 @@ static int MenuDiscList() gameBrowser.Reload(gameList, gameCnt);} else if (Settings.gameDisplay==grid){ gameGrid.Reload(gameList, gameCnt);} -// gameBrowser.Reload(gameList, gameCnt); - sprintf(GamesCnt,"%s: %i",LANGUAGE.Games, gameCnt); - gamecntTxt.SetText(GamesCnt); + gamecntTxt.SetTextf("%s: %i",LANGUAGE.Games, gameCnt); selectedold = 1; favoriteBtn.ResetState(); Settings.fave ? (favoriteBtn.SetImage(&favoriteBtnImg), favoriteBtn.SetAlpha(255)) : (favoriteBtn.SetImage(&favoriteBtnImg_g), favoriteBtn.SetAlpha(180)); @@ -4288,7 +4263,6 @@ static int MenuSettings() { int menu = MENU_NONE; int ret; - char cfgtext[20]; int choice = 0; GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM, vol); @@ -4414,10 +4388,9 @@ static int MenuSettings() btnLogo->SetUpdateCallback(WindowCredits); customOptionList options2(9); - GuiCustomOptionBrowser optionBrowser2(396, 280, &options2, CFG.theme_path, "bg_options_settings.png", bg_options_settings_png, 0, 200); + GuiCustomOptionBrowser optionBrowser2(396, 280, &options2, CFG.theme_path, "bg_options_settings.png", bg_options_settings_png, 0, 150); optionBrowser2.SetPosition(0, 90); optionBrowser2.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); - optionBrowser2.SetCol2Position(200); GuiWindow w(screenwidth, screenheight); int pageToDisplay = 1; @@ -4427,17 +4400,17 @@ static int MenuSettings() if ( pageToDisplay == 1) { - sprintf(options2.name[0], "%s",LANGUAGE.VideoMode); - sprintf(options2.name[1], "%s",LANGUAGE.VIDTVPatch); - sprintf(options2.name[2], "%s",LANGUAGE.Language); + options2.SetName(0, "%s",LANGUAGE.VideoMode); + options2.SetName(1, "%s",LANGUAGE.VIDTVPatch); + options2.SetName(2, "%s",LANGUAGE.Language); - sprintf(options2.name[3], "Ocarina"); + options2.SetName(3, "Ocarina"); - sprintf(options2.name[4],"%s", LANGUAGE.Display); - sprintf(options2.name[5],"%s", LANGUAGE.Clock); //CLOCK - sprintf(options2.name[6],"%s", LANGUAGE.Rumble); //RUMBLE - sprintf(options2.name[7],"%s", LANGUAGE.Volume); - sprintf(options2.name[8],"%s", LANGUAGE.Tooltips); + options2.SetName(4,"%s", LANGUAGE.Display); + options2.SetName(5,"%s", LANGUAGE.Clock); //CLOCK + options2.SetName(6,"%s", LANGUAGE.Rumble); //RUMBLE + options2.SetName(7,"%s", LANGUAGE.Volume); + options2.SetName(8,"%s", LANGUAGE.Tooltips); HaltGui(); w.Append(&settingsbackgroundbtn); @@ -4487,15 +4460,15 @@ static int MenuSettings() mainWindow->Append(&page1Btn); mainWindow->Append(&page3Btn); - sprintf(options2.name[0],"%s", LANGUAGE.Password); - sprintf(options2.name[1],"%s", LANGUAGE.BootStandard); - sprintf(options2.name[2],"%s", LANGUAGE.FlipX); - sprintf(options2.name[3],"%s", LANGUAGE.QuickBoot); - sprintf(options2.name[4],"%s", LANGUAGE.PromptsButtons); - sprintf(options2.name[5],"%s", LANGUAGE.Parentalcontrol); - sprintf(options2.name[6],"%s", LANGUAGE.CoverPath); - sprintf(options2.name[7],"%s", LANGUAGE.DiscimagePath); - sprintf(options2.name[8],"%s", LANGUAGE.ThemePath); + options2.SetName(0,"%s", LANGUAGE.Password); + options2.SetName(1,"%s", LANGUAGE.BootStandard); + options2.SetName(2,"%s", LANGUAGE.FlipX); + options2.SetName(3,"%s", LANGUAGE.QuickBoot); + options2.SetName(4,"%s", LANGUAGE.PromptsButtons); + options2.SetName(5,"%s", LANGUAGE.Parentalcontrol); + options2.SetName(6,"%s", LANGUAGE.CoverPath); + options2.SetName(7,"%s", LANGUAGE.DiscimagePath); + options2.SetName(8,"%s", LANGUAGE.ThemePath); } else if ( pageToDisplay == 3 ) { @@ -4516,15 +4489,15 @@ static int MenuSettings() mainWindow->Append(&page3Btn); - sprintf(options2.name[0], "%s",LANGUAGE.Titlestxtpath); - sprintf(options2.name[1], "%s",LANGUAGE.AppLanguage); - sprintf(options2.name[2], "%s",LANGUAGE.keyboard); - sprintf(options2.name[3], "%s",LANGUAGE.Unicodefix); - sprintf(options2.name[4], "%s",LANGUAGE.Backgroundmusic); - sprintf(options2.name[5], "%s",LANGUAGE.Wiilight); - sprintf(options2.name[6], "%s",LANGUAGE.Updatepath); - sprintf(options2.name[7], "%s",LANGUAGE.MP3Menu); - sprintf(options2.name[8], "%s",LANGUAGE.Defaultsettings); + options2.SetName(0, "%s",LANGUAGE.Titlestxtpath); + options2.SetName(1, "%s",LANGUAGE.AppLanguage); + options2.SetName(2, "%s",LANGUAGE.keyboard); + options2.SetName(3, "%s",LANGUAGE.Unicodefix); + options2.SetName(4, "%s",LANGUAGE.Backgroundmusic); + options2.SetName(5, "%s",LANGUAGE.Wiilight); + options2.SetName(6, "%s",LANGUAGE.Updatepath); + options2.SetName(7, "%s",LANGUAGE.MP3Menu); + options2.SetName(8, "%s",LANGUAGE.Defaultsettings); } while(menu == MENU_NONE) @@ -4533,77 +4506,77 @@ static int MenuSettings() if ( pageToDisplay == 1 ) { - if(Settings.video > 5) + if(Settings.video >= settings_video_max) Settings.video = 0; - if(Settings.language > 10) + if(Settings.language >= settings_language_max) Settings.language = 0; - if(Settings.ocarina > 1) + if(Settings.ocarina >= settings_off_on_max) Settings.ocarina = 0; - if(Settings.vpatch > 1) + if(Settings.vpatch >= settings_off_on_max) Settings.vpatch = 0; - if(Settings.sinfo > 3) + if(Settings.sinfo >= settings_sinfo_max) Settings.sinfo = 0; - if(Settings.hddinfo > 2) + if(Settings.hddinfo >= settings_clock_max) Settings.hddinfo = 0; //CLOCK - if(Settings.rumble > 1) + if(Settings.rumble >= settings_rumble_max) Settings.rumble = 0; //RUMBLE - if(Settings.volume > 10) + if(Settings.volume >= settings_volume_max) Settings.volume = 0; - if (Settings.tooltips > 1 ) + if (Settings.tooltips >= settings_tooltips_max) Settings.tooltips = 0; - if (Settings.video == discdefault) sprintf (options2.value[0],"%s",LANGUAGE.DiscDefault); - else if (Settings.video == systemdefault) sprintf (options2.value[0],"%s",LANGUAGE.SystemDefault); - else if (Settings.video == patch) sprintf (options2.value[0],"%s",LANGUAGE.AutoPatch); - else if (Settings.video == pal50) sprintf (options2.value[0],"%s PAL50",LANGUAGE.Force); - else if (Settings.video == pal60) sprintf (options2.value[0],"%s PAL60",LANGUAGE.Force); - else if (Settings.video == ntsc) sprintf (options2.value[0],"%s NTSC",LANGUAGE.Force); + if (Settings.video == discdefault) options2.SetValue(0,"%s",LANGUAGE.DiscDefault); + else if (Settings.video == systemdefault) options2.SetValue(0,"%s",LANGUAGE.SystemDefault); + else if (Settings.video == patch) options2.SetValue(0,"%s",LANGUAGE.AutoPatch); + else if (Settings.video == pal50) options2.SetValue(0,"%s PAL50",LANGUAGE.Force); + else if (Settings.video == pal60) options2.SetValue(0,"%s PAL60",LANGUAGE.Force); + else if (Settings.video == ntsc) options2.SetValue(0,"%s NTSC",LANGUAGE.Force); - if (Settings.vpatch == on) sprintf (options2.value[1],"%s",LANGUAGE.ON); - else if (Settings.vpatch == off) sprintf (options2.value[1],"%s",LANGUAGE.OFF); + if (Settings.vpatch == on) options2.SetValue(1,"%s",LANGUAGE.ON); + else if (Settings.vpatch == off) options2.SetValue(1,"%s",LANGUAGE.OFF); - if (Settings.language == ConsoleLangDefault) sprintf (options2.value[2],"%s",LANGUAGE.ConsoleDefault); - else if (Settings.language == jap) sprintf (options2.value[2],"%s",LANGUAGE.Japanese); - else if (Settings.language == ger) sprintf (options2.value[2],"%s",LANGUAGE.German); - else if (Settings.language == eng) sprintf (options2.value[2],"%s",LANGUAGE.English); - else if (Settings.language == fren) sprintf (options2.value[2],"%s",LANGUAGE.French); - else if (Settings.language == esp) sprintf (options2.value[2],"%s",LANGUAGE.Spanish); - else if (Settings.language == it) sprintf (options2.value[2],"%s",LANGUAGE.Italian); - else if (Settings.language == dut) sprintf (options2.value[2],"%s",LANGUAGE.Dutch); - else if (Settings.language == schin) sprintf (options2.value[2],"%s",LANGUAGE.SChinese); - else if (Settings.language == tchin) sprintf (options2.value[2],"%s",LANGUAGE.TChinese); - else if (Settings.language == kor) sprintf (options2.value[2],"%s",LANGUAGE.Korean); + if (Settings.language == ConsoleLangDefault) options2.SetValue(2,"%s",LANGUAGE.ConsoleDefault); + else if (Settings.language == jap) options2.SetValue(2,"%s",LANGUAGE.Japanese); + else if (Settings.language == ger) options2.SetValue(2,"%s",LANGUAGE.German); + else if (Settings.language == eng) options2.SetValue(2,"%s",LANGUAGE.English); + else if (Settings.language == fren) options2.SetValue(2,"%s",LANGUAGE.French); + else if (Settings.language == esp) options2.SetValue(2,"%s",LANGUAGE.Spanish); + else if (Settings.language == it) options2.SetValue(2,"%s",LANGUAGE.Italian); + else if (Settings.language == dut) options2.SetValue(2,"%s",LANGUAGE.Dutch); + else if (Settings.language == schin) options2.SetValue(2,"%s",LANGUAGE.SChinese); + else if (Settings.language == tchin) options2.SetValue(2,"%s",LANGUAGE.TChinese); + else if (Settings.language == kor) options2.SetValue(2,"%s",LANGUAGE.Korean); - if (Settings.ocarina == on) sprintf (options2.value[3],"%s",LANGUAGE.ON); - else if (Settings.ocarina == off) sprintf (options2.value[3],"%s",LANGUAGE.OFF); + if (Settings.ocarina == on) options2.SetValue(3,"%s",LANGUAGE.ON); + else if (Settings.ocarina == off) options2.SetValue(3,"%s",LANGUAGE.OFF); - if (Settings.sinfo == GameID) sprintf (options2.value[4],"%s",LANGUAGE.GameID); - else if (Settings.sinfo == GameRegion) sprintf (options2.value[4],"%s",LANGUAGE.GameRegion); - else if (Settings.sinfo == Both) sprintf (options2.value[4],"%s",LANGUAGE.Both); - else if (Settings.sinfo == Neither) sprintf (options2.value[4],"%s",LANGUAGE.Neither); + if (Settings.sinfo == GameID) options2.SetValue(4,"%s",LANGUAGE.GameID); + else if (Settings.sinfo == GameRegion) options2.SetValue(4,"%s",LANGUAGE.GameRegion); + else if (Settings.sinfo == Both) options2.SetValue(4,"%s",LANGUAGE.Both); + else if (Settings.sinfo == Neither) options2.SetValue(4,"%s",LANGUAGE.Neither); - if (Settings.hddinfo == hr12) sprintf (options2.value[5],"12 %s",LANGUAGE.hour); - else if (Settings.hddinfo == hr24) sprintf (options2.value[5],"24 %s",LANGUAGE.hour); - else if (Settings.hddinfo == Off) sprintf (options2.value[5],"%s",LANGUAGE.OFF); + if (Settings.hddinfo == hr12) options2.SetValue(5,"12 %s",LANGUAGE.hour); + else if (Settings.hddinfo == hr24) options2.SetValue(5,"24 %s",LANGUAGE.hour); + else if (Settings.hddinfo == Off) options2.SetValue(5,"%s",LANGUAGE.OFF); - if (Settings.rumble == RumbleOn) sprintf (options2.value[6],"%s",LANGUAGE.ON); - else if (Settings.rumble == RumbleOff) sprintf (options2.value[6],"%s",LANGUAGE.OFF); + if (Settings.rumble == RumbleOn) options2.SetValue(6,"%s",LANGUAGE.ON); + else if (Settings.rumble == RumbleOff) options2.SetValue(6,"%s",LANGUAGE.OFF); - if (Settings.volume == v10) sprintf (options2.value[7],"10"); - else if (Settings.volume == v20) sprintf (options2.value[7],"20"); - else if (Settings.volume == v30) sprintf (options2.value[7],"30"); - else if (Settings.volume == v40) sprintf (options2.value[7],"40"); - else if (Settings.volume == v50) sprintf (options2.value[7],"50"); - else if (Settings.volume == v60) sprintf (options2.value[7],"60"); - else if (Settings.volume == v70) sprintf (options2.value[7],"70"); - else if (Settings.volume == v80) sprintf (options2.value[7],"80"); - else if (Settings.volume == v90) sprintf (options2.value[7],"90"); - else if (Settings.volume == v100) sprintf (options2.value[7],"100"); - else if (Settings.volume == v0) sprintf (options2.value[7],"%s",LANGUAGE.OFF); + if (Settings.volume == v10) options2.SetValue(7,"10"); + else if (Settings.volume == v20) options2.SetValue(7,"20"); + else if (Settings.volume == v30) options2.SetValue(7,"30"); + else if (Settings.volume == v40) options2.SetValue(7,"40"); + else if (Settings.volume == v50) options2.SetValue(7,"50"); + else if (Settings.volume == v60) options2.SetValue(7,"60"); + else if (Settings.volume == v70) options2.SetValue(7,"70"); + else if (Settings.volume == v80) options2.SetValue(7,"80"); + else if (Settings.volume == v90) options2.SetValue(7,"90"); + else if (Settings.volume == v100) options2.SetValue(7,"100"); + else if (Settings.volume == v0) options2.SetValue(7,"%s",LANGUAGE.OFF); - if (Settings.tooltips == TooltipsOn) sprintf (options2.value[8],"%s",LANGUAGE.ON); - else if (Settings.tooltips == TooltipsOff) sprintf (options2.value[8],"%s",LANGUAGE.OFF); + if (Settings.tooltips == TooltipsOn) options2.SetValue(8,"%s",LANGUAGE.ON); + else if (Settings.tooltips == TooltipsOff) options2.SetValue(8,"%s",LANGUAGE.OFF); ret = optionBrowser2.GetClickedOption(); @@ -4641,9 +4614,9 @@ static int MenuSettings() if ( pageToDisplay == 2 ) { - if ( Settings.cios > 1 ) + if ( Settings.cios >= settings_cios_max) Settings.cios = 0; - if ( Settings.xflip > 4 ) + if ( Settings.xflip >= settings_xflip_max) Settings.xflip = 0; if ( Settings.qboot > 1 ) Settings.qboot = 0; @@ -4653,59 +4626,35 @@ static int MenuSettings() CFG.parentalcontrol = 0; - if ( CFG.godmode != 1) sprintf(options2.value[0], "********"); - else if (!strcmp("", Settings.unlockCode)) sprintf(options2.value[0], "%s",LANGUAGE.notset); - else sprintf(options2.value[0], Settings.unlockCode); + if ( CFG.godmode != 1) options2.SetValue(0, "********"); + else if (!strcmp("", Settings.unlockCode)) options2.SetValue(0, "%s",LANGUAGE.notset); + else options2.SetValue(0, Settings.unlockCode); - if (CFG.godmode != 1) sprintf(options2.value[1], "********"); - else if (Settings.cios == ios249) sprintf (options2.value[1],"cIOS 249"); - else if (Settings.cios == ios222) sprintf (options2.value[1],"cIOS 222"); + if (CFG.godmode != 1) options2.SetValue(1, "********"); + else if (Settings.cios == ios249) options2.SetValue(1,"cIOS 249"); + else if (Settings.cios == ios222) options2.SetValue(1,"cIOS 222"); - if (Settings.xflip == no) sprintf (options2.value[2],"%s/%s",LANGUAGE.Right,LANGUAGE.Next); - else if (Settings.xflip == yes) sprintf (options2.value[2],"%s/%s",LANGUAGE.Left,LANGUAGE.Prev); - else if (Settings.xflip == sysmenu) sprintf (options2.value[2],"%s", LANGUAGE.LikeSysMenu); - else if (Settings.xflip == wtf) sprintf (options2.value[2],"%s/%s",LANGUAGE.Right,LANGUAGE.Prev); - else if (Settings.xflip == disk3d) sprintf (options2.value[2],"DiskFlip"); + if (Settings.xflip == no) options2.SetValue(2,"%s/%s",LANGUAGE.Right,LANGUAGE.Next); + else if (Settings.xflip == yes) options2.SetValue(2,"%s/%s",LANGUAGE.Left,LANGUAGE.Prev); + else if (Settings.xflip == sysmenu) options2.SetValue(2,"%s", LANGUAGE.LikeSysMenu); + else if (Settings.xflip == wtf) options2.SetValue(2,"%s/%s",LANGUAGE.Right,LANGUAGE.Prev); + else if (Settings.xflip == disk3d) options2.SetValue(2,"DiskFlip"); - if (Settings.qboot == no) sprintf (options2.value[3],"%s",LANGUAGE.No); - else if (Settings.qboot == yes) sprintf (options2.value[3],"%s",LANGUAGE.Yes); + if (Settings.qboot == no) options2.SetValue(3,"%s",LANGUAGE.No); + else if (Settings.qboot == yes) options2.SetValue(3,"%s",LANGUAGE.Yes); - if (Settings.wsprompt == no) sprintf (options2.value[4],"%s",LANGUAGE.Normal); - else if (Settings.wsprompt == yes) sprintf (options2.value[4],"%s",LANGUAGE.WidescreenFix); + if (Settings.wsprompt == no) options2.SetValue(4,"%s",LANGUAGE.Normal); + else if (Settings.wsprompt == yes) options2.SetValue(4,"%s",LANGUAGE.WidescreenFix); - if (CFG.godmode != 1) sprintf(options2.value[5], "********"); - else if(CFG.parentalcontrol == 0) sprintf(options2.value[5], "0"); - else if(CFG.parentalcontrol == 1) sprintf(options2.value[5], "1"); - else if(CFG.parentalcontrol == 2) sprintf(options2.value[5], "2"); - else if(CFG.parentalcontrol == 3) sprintf(options2.value[5], "3"); + if (CFG.godmode != 1) options2.SetValue(5, "********"); + else if(CFG.parentalcontrol == 0) options2.SetValue(5, "0"); + else if(CFG.parentalcontrol == 1) options2.SetValue(5, "1"); + else if(CFG.parentalcontrol == 2) options2.SetValue(5, "2"); + else if(CFG.parentalcontrol == 3) options2.SetValue(5, "3"); - - if (strlen(CFG.covers_path) < (9 + 3)) { - sprintf(cfgtext, "%s", CFG.covers_path); - } else { - strncpy(cfgtext, CFG.covers_path, 9); - cfgtext[9] = '\0'; - strncat(cfgtext, "...", 3); - } - sprintf(options2.value[6], "%s", cfgtext); - - if (strlen(CFG.disc_path) < (9 + 3)) { - sprintf(cfgtext, "%s", CFG.disc_path); - } else { - strncpy(cfgtext, CFG.disc_path, 9); - cfgtext[9] = '\0'; - strncat(cfgtext, "...", 3); - } - sprintf(options2.value[7], "%s", cfgtext); - - if (strlen(CFG.theme_path) < (9 + 3)) { - sprintf(cfgtext, "%s", CFG.theme_path); - } else { - strncpy(cfgtext, CFG.theme_path, 9); - cfgtext[9] = '\0'; - strncat(cfgtext, "...", 3); - } - sprintf(options2.value[8], "%s", cfgtext); + options2.SetValue(6, "%s", CFG.covers_path); + options2.SetValue(7, "%s", CFG.disc_path); + options2.SetValue(8, "%s", CFG.theme_path); ret = optionBrowser2.GetClickedOption(); @@ -4923,119 +4872,88 @@ static int MenuSettings() break; } } - if (pageToDisplay == 3){ + if (pageToDisplay == 3) + { - - if ( Settings.keyset > 3 ) + if ( Settings.keyset >= settings_keyset_max) Settings.keyset = 0; - if ( Settings.unicodefix > 2 ) + if ( Settings.unicodefix > 2 ) Settings.unicodefix = 0; - if ( Settings.wiilight > 2 ) + if ( Settings.wiilight > 2 ) Settings.wiilight = 0; - if (strlen(CFG.titlestxt_path) < (9 + 3)) { - sprintf(cfgtext, "%s", CFG.titlestxt_path); - } else { - strncpy(cfgtext, CFG.titlestxt_path, 9); - cfgtext[9] = '\0'; - strncat(cfgtext, "...", 3); - } - sprintf(options2.value[0], "%s", cfgtext); + options2.SetValue(0, "%s", CFG.titlestxt_path); - if (strlen(CFG.language_path) < (9 + 3)) { - sprintf(cfgtext, "%s", CFG.language_path); - } else { - strncpy(cfgtext, CFG.language_path, 9); - cfgtext[9] = '\0'; - strncat(cfgtext, "...", 3); - } - sprintf(options2.value[1], "%s", cfgtext); + options2.SetValue(1, "%s", CFG.language_path); + if (Settings.keyset == us) options2.SetValue(2,"QWERTY"); + else if (Settings.keyset == dvorak) options2.SetValue(2,"DVORAK"); + else if (Settings.keyset == euro) options2.SetValue(2,"QWERTZ"); + else if (Settings.keyset == azerty) options2.SetValue(2,"AZERTY"); - if (Settings.keyset == us) sprintf (options2.value[2],"QWERTY"); - else if (Settings.keyset == dvorak) sprintf (options2.value[2],"DVORAK"); - else if (Settings.keyset == euro) sprintf (options2.value[2],"QWERTZ"); - else if (Settings.keyset == azerty) sprintf (options2.value[2],"AZERTY"); + if (Settings.unicodefix == 0) options2.SetValue(3,"%s",LANGUAGE.OFF); + else if (Settings.unicodefix == 1) options2.SetValue(3,"%s",LANGUAGE.TChinese); + else if (Settings.unicodefix == 2) options2.SetValue(3,"%s",LANGUAGE.SChinese); - if (Settings.unicodefix == 0) sprintf (options2.value[3],"%s",LANGUAGE.OFF); - else if (Settings.unicodefix == 1) sprintf (options2.value[3],"%s",LANGUAGE.TChinese); - else if (Settings.unicodefix == 2) sprintf (options2.value[3],"%s",LANGUAGE.SChinese); + if(!strcmp("notset", CFG.ogg_path) || !strcmp("",CFG.oggload_path)) + options2.SetValue(4, "%s", LANGUAGE.Standard); + else + options2.SetValue(4, "%s", CFG.ogg_path); - if(!strcmp("notset", CFG.ogg_path) || !strcmp("",CFG.oggload_path)) { - sprintf(options2.value[4], "%s", LANGUAGE.Standard); - } else { - if (strlen(CFG.ogg_path) < (9 + 3)) { - sprintf(cfgtext, "%s", CFG.ogg_path); - } else { - strncpy(cfgtext, CFG.ogg_path, 9); - cfgtext[9] = '\0'; - strncat(cfgtext, "...", 3); - } - sprintf(options2.value[4], "%s", cfgtext); - } + if (Settings.wiilight == 0) options2.SetValue(5,"%s",LANGUAGE.OFF); + else if (Settings.wiilight == 1) options2.SetValue(5,"%s",LANGUAGE.ON); + else if (Settings.wiilight == 2) options2.SetValue(5,"%s",LANGUAGE.OnlyInstall); - if (Settings.wiilight == 0) sprintf (options2.value[5],"%s",LANGUAGE.OFF); - else if (Settings.wiilight == 1) sprintf (options2.value[5],"%s",LANGUAGE.ON); - else if (Settings.wiilight == 2) sprintf (options2.value[5],"%s",LANGUAGE.OnlyInstall); + options2.SetValue(6, "%s", CFG.update_path); + options2.SetValue(7, "not working!"); + options2.SetValue(8, " "); - if (strlen(CFG.update_path) < (9 + 3)) { - sprintf(cfgtext, "%s", CFG.update_path); - } else { - strncpy(cfgtext, CFG.update_path, 9); - cfgtext[9] = '\0'; - strncat(cfgtext, "...", 3); - } - sprintf(options2.value[6], "%s", cfgtext); + ret = optionBrowser2.GetClickedOption(); - sprintf(options2.value[7], "not working!"); - sprintf(options2.value[8], " "); - - ret = optionBrowser2.GetClickedOption(); - - switch(ret) { - - case 0: - if ( CFG.godmode == 1) - { - mainWindow->Remove(&optionBrowser2); - mainWindow->Remove(&page1Btn); - mainWindow->Remove(&page2Btn); - mainWindow->Remove(&tabBtn); - mainWindow->Remove(&page3Btn); - w.Remove(&backBtn); - w.Remove(&lockBtn); - w.Remove(&updateBtn); - char entered[43] = ""; - strncpy(entered, CFG.titlestxt_path, sizeof(entered)); - int result = OnScreenKeyboard(entered,43,4); - mainWindow->Append(&optionBrowser2); - mainWindow->Append(&page1Btn); - mainWindow->Append(&page2Btn); - mainWindow->Append(&tabBtn); - mainWindow->Append(&page3Btn); - w.Append(&backBtn); - w.Append(&lockBtn); - w.Append(&updateBtn); - if ( result == 1 ) - { - int len = (strlen(entered)-1); - if(entered[len] !='/') - strncat (entered, "/", 1); - strncpy(CFG.titlestxt_path, entered, sizeof(CFG.titlestxt_path)); - WindowPrompt(LANGUAGE.TitlestxtpathChanged,0,LANGUAGE.ok,0,0,0); - if(isSdInserted()) { - cfg_save_global(); - CFG_Load(); - } else { - WindowPrompt(LANGUAGE.NoSDcardinserted, LANGUAGE.InsertaSDCardtosave, LANGUAGE.ok, 0,0,0); - } - } - } - else - { - WindowPrompt(LANGUAGE.Titlestxtpathchange,LANGUAGE.Consoleshouldbeunlockedtomodifyit,LANGUAGE.ok,0,0,0); - } - break; + switch(ret) + { + case 0: + if ( CFG.godmode == 1) + { + mainWindow->Remove(&optionBrowser2); + mainWindow->Remove(&page1Btn); + mainWindow->Remove(&page2Btn); + mainWindow->Remove(&tabBtn); + mainWindow->Remove(&page3Btn); + w.Remove(&backBtn); + w.Remove(&lockBtn); + w.Remove(&updateBtn); + char entered[43] = ""; + strncpy(entered, CFG.titlestxt_path, sizeof(entered)); + int result = OnScreenKeyboard(entered,43,4); + mainWindow->Append(&optionBrowser2); + mainWindow->Append(&page1Btn); + mainWindow->Append(&page2Btn); + mainWindow->Append(&tabBtn); + mainWindow->Append(&page3Btn); + w.Append(&backBtn); + w.Append(&lockBtn); + w.Append(&updateBtn); + if ( result == 1 ) + { + int len = (strlen(entered)-1); + if(entered[len] !='/') + strncat (entered, "/", 1); + strncpy(CFG.titlestxt_path, entered, sizeof(CFG.titlestxt_path)); + WindowPrompt(LANGUAGE.TitlestxtpathChanged,0,LANGUAGE.ok,0,0,0); + if(isSdInserted()) { + cfg_save_global(); + CFG_Load(); + } else { + WindowPrompt(LANGUAGE.NoSDcardinserted, LANGUAGE.InsertaSDCardtosave, LANGUAGE.ok, 0,0,0); + } + } + } + else + { + WindowPrompt(LANGUAGE.Titlestxtpathchange,LANGUAGE.Consoleshouldbeunlockedtomodifyit,LANGUAGE.ok,0,0,0); + } + break; case 1: // language file path if ( CFG.godmode == 1) { @@ -5061,17 +4979,17 @@ static int MenuSettings() if ( result == 1 ) { strncpy(CFG.language_path, entered, sizeof(CFG.language_path)); if(isSdInserted()) { - cfg_save_global(); - if(!checkfile(CFG.language_path)) { - WindowPrompt(LANGUAGE.Filenotfound,LANGUAGE.Loadingstandardlanguage,LANGUAGE.ok,0,0,0); - } - lang_default(); + cfg_save_global(); + if(!checkfile(CFG.language_path)) { + WindowPrompt(LANGUAGE.Filenotfound,LANGUAGE.Loadingstandardlanguage,LANGUAGE.ok,0,0,0); + } + lang_default(); CFG_Load(); menu = MENU_SETTINGS; pageToDisplay = 0; - } else { - WindowPrompt(LANGUAGE.NoSDcardinserted, LANGUAGE.InsertaSDCardtosave, LANGUAGE.ok, 0,0,0); - } + } else { + WindowPrompt(LANGUAGE.NoSDcardinserted, LANGUAGE.InsertaSDCardtosave, LANGUAGE.ok, 0,0,0); + } } } else @@ -5082,83 +5000,83 @@ static int MenuSettings() case 2: Settings.keyset++; break; - case 3: - Settings.unicodefix++; - break; - case 4: - if(isSdInserted()) { - menu = MENU_OGG; - pageToDisplay = 0; - } else { - WindowPrompt(LANGUAGE.NoSDcardinserted, LANGUAGE.InsertaSDCardtousethatoption, LANGUAGE.ok, 0,0,0); - } - break; - case 5: - Settings.wiilight++; - break; - case 7: - if(isSdInserted()) { - menu = MENU_MP3; - pageToDisplay = 0; - } else { - WindowPrompt(LANGUAGE.NoSDcardinserted, LANGUAGE.InsertaSDCardtousethatoption, LANGUAGE.ok, 0,0,0); - } - break; - case 6: - if ( CFG.godmode == 1) - { - mainWindow->Remove(&optionBrowser2); - mainWindow->Remove(&page1Btn); - mainWindow->Remove(&page2Btn); - mainWindow->Remove(&tabBtn); - mainWindow->Remove(&page3Btn); - w.Remove(&backBtn); - w.Remove(&lockBtn); - w.Remove(&updateBtn); - char entered[43] = ""; - strncpy(entered, CFG.update_path, sizeof(entered)); - int result = OnScreenKeyboard(entered,43,4); - mainWindow->Append(&optionBrowser2); - mainWindow->Append(&page1Btn); - mainWindow->Append(&page2Btn); - mainWindow->Append(&tabBtn); - mainWindow->Append(&page3Btn); - w.Append(&backBtn); - w.Append(&lockBtn); - w.Append(&updateBtn); - if ( result == 1 ) - { - int len = (strlen(entered)-1); - if(entered[len] !='/') - strncat (entered, "/", 1); - strncpy(CFG.update_path, entered, sizeof(CFG.update_path)); - WindowPrompt(LANGUAGE.Updatepathchanged,0,LANGUAGE.ok,0,0,0); - } - } else { - WindowPrompt(0,LANGUAGE.Consoleshouldbeunlockedtomodifyit,LANGUAGE.ok,0,0,0); - } - break; - case 8: - int choice = WindowPrompt(LANGUAGE.Areyousure, 0, LANGUAGE.Yes, LANGUAGE.Cancel, 0, 0); - if(choice == 1) { - if(isSdInserted()) { - remove("SD:/config/GXGlobal.cfg"); - } - lang_default(); - CFG_Load(); - DefaultSettings(); - menu = MENU_SETTINGS; - pageToDisplay = 0; + case 3: + Settings.unicodefix++; + break; + case 4: + if(isSdInserted()) + { + menu = MENU_OGG; + pageToDisplay = 0; } - break; - } - + else + WindowPrompt(LANGUAGE.NoSDcardinserted, LANGUAGE.InsertaSDCardtousethatoption, LANGUAGE.ok, 0,0,0); + break; + case 5: + Settings.wiilight++; + break; + case 7: + if(isSdInserted()) + { + menu = MENU_MP3; + pageToDisplay = 0; + } else + WindowPrompt(LANGUAGE.NoSDcardinserted, LANGUAGE.InsertaSDCardtousethatoption, LANGUAGE.ok, 0,0,0); + break; + case 6: + if ( CFG.godmode == 1) + { + mainWindow->Remove(&optionBrowser2); + mainWindow->Remove(&page1Btn); + mainWindow->Remove(&page2Btn); + mainWindow->Remove(&tabBtn); + mainWindow->Remove(&page3Btn); + w.Remove(&backBtn); + w.Remove(&lockBtn); + w.Remove(&updateBtn); + char entered[43] = ""; + strncpy(entered, CFG.update_path, sizeof(entered)); + int result = OnScreenKeyboard(entered,43,4); + mainWindow->Append(&optionBrowser2); + mainWindow->Append(&page1Btn); + mainWindow->Append(&page2Btn); + mainWindow->Append(&tabBtn); + mainWindow->Append(&page3Btn); + w.Append(&backBtn); + w.Append(&lockBtn); + w.Append(&updateBtn); + if ( result == 1 ) + { + int len = (strlen(entered)-1); + if(entered[len] !='/') + strncat (entered, "/", 1); + strncpy(CFG.update_path, entered, sizeof(CFG.update_path)); + WindowPrompt(LANGUAGE.Updatepathchanged,0,LANGUAGE.ok,0,0,0); + } + } + else + WindowPrompt(0,LANGUAGE.Consoleshouldbeunlockedtomodifyit,LANGUAGE.ok,0,0,0); + break; + case 8: + int choice = WindowPrompt(LANGUAGE.Areyousure, 0, LANGUAGE.Yes, LANGUAGE.Cancel, 0, 0); + if(choice == 1) + { + if(isSdInserted()) + remove("SD:/config/GXGlobal.cfg"); + lang_default(); + CFG_Load(); + DefaultSettings(); + menu = MENU_SETTINGS; + pageToDisplay = 0; + } + break; + } } if(shutdown == 1) Sys_Shutdown(); if(reset == 1) - Sys_Reboot(); + Sys_Reboot(); if(page1Btn.GetState() == STATE_CLICKED) { @@ -5368,13 +5286,13 @@ int GameSettings(struct discHdr * header) } customOptionList options3(7); - sprintf(options3.name[0],"%s", LANGUAGE.VideoMode); - sprintf(options3.name[1],"%s", LANGUAGE.VIDTVPatch); - sprintf(options3.name[2],"%s", LANGUAGE.Language); - sprintf(options3.name[3], "Ocarina"); - sprintf(options3.name[4], "IOS"); - sprintf(options3.name[5],"Parental Control");//sprintf(options3.name[5],"%s", LANGUAGE.addToFavorite); - sprintf(options3.name[6],"%s", LANGUAGE.Defaultgamesettings); + options3.SetName(0,"%s", LANGUAGE.VideoMode); + options3.SetName(1,"%s", LANGUAGE.VIDTVPatch); + options3.SetName(2,"%s", LANGUAGE.Language); + options3.SetName(3, "Ocarina"); + options3.SetName(4, "IOS"); + options3.SetName(5,"%s", LANGUAGE.addToFavorite); + options3.SetName(6,"%s", LANGUAGE.Defaultgamesettings); GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM, vol); GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, SOUND_PCM, vol); @@ -5438,7 +5356,6 @@ int GameSettings(struct discHdr * header) GuiCustomOptionBrowser optionBrowser3(396, 280, &options3, CFG.theme_path, "bg_options_gamesettings.png", bg_options_settings_png, 0, 200); optionBrowser3.SetPosition(0, 90); optionBrowser3.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); - optionBrowser3.SetCol2Position(200); HaltGui(); GuiWindow w(screenwidth, screenheight); @@ -5483,38 +5400,38 @@ int GameSettings(struct discHdr * header) VIDEO_WaitVSync (); - if (videoChoice == discdefault) sprintf (options3.value[0],"%s",LANGUAGE.DiscDefault); - else if (videoChoice == systemdefault) sprintf (options3.value[0],"%s",LANGUAGE.SystemDefault); - else if (videoChoice == patch) sprintf (options3.value[0],"%s",LANGUAGE.AutoPatch); - else if (videoChoice == pal50) sprintf (options3.value[0],"%s PAL50",LANGUAGE.Force); - else if (videoChoice == pal60) sprintf (options3.value[0],"%s PAL60",LANGUAGE.Force); - else if (videoChoice == ntsc) sprintf (options3.value[0],"%s NTSC",LANGUAGE.Force); + if (videoChoice == discdefault) options3.SetValue(0,"%s",LANGUAGE.DiscDefault); + else if (videoChoice == systemdefault) options3.SetValue(0,"%s",LANGUAGE.SystemDefault); + else if (videoChoice == patch) options3.SetValue(0,"%s",LANGUAGE.AutoPatch); + else if (videoChoice == pal50) options3.SetValue(0,"%s PAL50",LANGUAGE.Force); + else if (videoChoice == pal60) options3.SetValue(0,"%s PAL60",LANGUAGE.Force); + else if (videoChoice == ntsc) options3.SetValue(0,"%s NTSC",LANGUAGE.Force); - if (viChoice == on) sprintf (options3.value[1],"%s",LANGUAGE.ON); - else if (viChoice == off) sprintf (options3.value[1],"%s",LANGUAGE.OFF); + if (viChoice == on) options3.SetValue(1,"%s",LANGUAGE.ON); + else if (viChoice == off) options3.SetValue(1,"%s",LANGUAGE.OFF); - if (languageChoice == ConsoleLangDefault) sprintf (options3.value[2],"%s",LANGUAGE.ConsoleDefault); - else if (languageChoice == jap) sprintf (options3.value[2],"%s",LANGUAGE.Japanese); - else if (languageChoice == ger) sprintf (options3.value[2],"%s",LANGUAGE.German); - else if (languageChoice == eng) sprintf (options3.value[2],"%s",LANGUAGE.English); - else if (languageChoice == fren) sprintf (options3.value[2],"%s",LANGUAGE.French); - else if (languageChoice == esp) sprintf (options3.value[2],"%s",LANGUAGE.Spanish); - else if (languageChoice == it) sprintf (options3.value[2],"%s",LANGUAGE.Italian); - else if (languageChoice == dut) sprintf (options3.value[2],"%s",LANGUAGE.Dutch); - else if (languageChoice == schin) sprintf (options3.value[2],"%s",LANGUAGE.SChinese); - else if (languageChoice == tchin) sprintf (options3.value[2],"%s",LANGUAGE.TChinese); - else if (languageChoice == kor) sprintf (options3.value[2],"%s",LANGUAGE.Korean); + if (languageChoice == ConsoleLangDefault) options3.SetValue(2,"%s",LANGUAGE.ConsoleDefault); + else if (languageChoice == jap) options3.SetValue(2,"%s",LANGUAGE.Japanese); + else if (languageChoice == ger) options3.SetValue(2,"%s",LANGUAGE.German); + else if (languageChoice == eng) options3.SetValue(2,"%s",LANGUAGE.English); + else if (languageChoice == fren) options3.SetValue(2,"%s",LANGUAGE.French); + else if (languageChoice == esp) options3.SetValue(2,"%s",LANGUAGE.Spanish); + else if (languageChoice == it) options3.SetValue(2,"%s",LANGUAGE.Italian); + else if (languageChoice == dut) options3.SetValue(2,"%s",LANGUAGE.Dutch); + else if (languageChoice == schin) options3.SetValue(2,"%s",LANGUAGE.SChinese); + else if (languageChoice == tchin) options3.SetValue(2,"%s",LANGUAGE.TChinese); + else if (languageChoice == kor) options3.SetValue(2,"%s",LANGUAGE.Korean); - if (ocarinaChoice == on) sprintf (options3.value[3],"%s",LANGUAGE.ON); - else if (ocarinaChoice == off) sprintf (options3.value[3],"%s",LANGUAGE.OFF); + if (ocarinaChoice == on) options3.SetValue(3,"%s",LANGUAGE.ON); + else if (ocarinaChoice == off) options3.SetValue(3,"%s",LANGUAGE.OFF); - if (iosChoice == i249) sprintf (options3.value[4],"249"); - else if (iosChoice == i222) sprintf (options3.value[4],"222"); + if (iosChoice == i249) options3.SetValue(4,"249"); + else if (iosChoice == i222) options3.SetValue(4,"222"); - if (parentalcontrolChoice == 0) sprintf (options3.value[5],"0 (Always)"); - else if (parentalcontrolChoice == 1) sprintf (options3.value[5],"1"); - else if (parentalcontrolChoice == 2) sprintf (options3.value[5],"2"); - else if (parentalcontrolChoice == 3) sprintf (options3.value[5],"3 (Mature)"); + if (parentalcontrolChoice == 0) options3.SetValue(5,"0 (Always)"); + else if (parentalcontrolChoice == 1) options3.SetValue(5,"1"); + else if (parentalcontrolChoice == 2) options3.SetValue(5,"2"); + else if (parentalcontrolChoice == 3) options3.SetValue(5,"3 (Mature)"); if(shutdown == 1) @@ -5522,7 +5439,7 @@ int GameSettings(struct discHdr * header) if(reset == 1) Sys_Reboot(); - sprintf(options3.value[6]," "); + options3.SetValue(6," "); ret = optionBrowser3.GetClickedOption(); @@ -5823,10 +5740,12 @@ int MenuOGG() customOptionList options2(countmp3); for (cnt = 0; cnt < countmp3; cnt++) { - snprintf(options2.value[cnt], 30, "%s", mp3files[cnt]); - sprintf (options2.name[cnt],"%i.", cnt+1); + char tmp[30]; + snprintf(tmp , 30, "%s", mp3files[cnt]); + options2.SetValue(cnt, "%s", tmp); + options2.SetName(cnt,"%i.", cnt+1); } - options2.length = cnt; + // options2.length = cnt; if(cnt < 9) { scrollon = 0; @@ -6085,16 +6004,19 @@ int MenuMp3() GuiTrigger trigA; trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A); - customOptionList options2(500); char mp3path[30] = "SD:/mp3/"; char fullpath[110]; int countmp3 = GetFiles(mp3path); - for (cnt = 0; cnt < countmp3; cnt++) { - snprintf(options2.value[cnt], 30, "%s", mp3files[cnt]); - sprintf (options2.name[cnt],"%i.", cnt+1); + customOptionList options2(countmp3); + + for (cnt = 0; cnt < countmp3; cnt++) { + char tmp[30]; + snprintf(tmp , 30, "%s", mp3files[cnt]); + options2.SetValue(cnt, "%s", tmp); + options2.SetName(cnt,"%i.", cnt+1); } - options2.length = cnt; + // options2.length = cnt; snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", CFG.theme_path); GuiImageData btnOutline(imgPath, button_dialogue_box_png); @@ -6106,7 +6028,6 @@ int MenuMp3() GuiCustomOptionBrowser optionBrowser4(396, 280, &options2, CFG.theme_path, "bg_options_settings.png", bg_options_settings_png, scrollon, 85); optionBrowser4.SetPosition(0, 90); optionBrowser4.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); - optionBrowser4.SetCol2Position(85); GuiText cancelBtnTxt(LANGUAGE.Back, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255}); cancelBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30);