From 5f3c4ad61dfca6e7834ca59ee5a7494e3af8f981 Mon Sep 17 00:00:00 2001 From: dborth Date: Sat, 27 Jun 2009 19:38:39 +0000 Subject: [PATCH] add filename text scrolling, improved efficiency on text wrapping, add reset button for mappings --- source/ngc/FreeTypeGX.cpp | 2 + source/ngc/dvd.cpp | 2 +- source/ngc/filebrowser.cpp | 2 +- source/ngc/filebrowser.h | 3 +- source/ngc/filelist.h | 6 + source/ngc/fileop.cpp | 4 +- source/ngc/gcunzip.cpp | 8 +- source/ngc/gui/gui.h | 17 +- source/ngc/gui/gui_filebrowser.cpp | 6 + source/ngc/gui/gui_text.cpp | 204 ++++++++++++++++++------ source/ngc/images/button_short.png | Bin 0 -> 1789 bytes source/ngc/images/button_short_over.png | Bin 0 -> 1875 bytes source/ngc/memcardop.cpp | 4 +- source/ngc/menu.cpp | 86 ++++++++-- source/ngc/video.cpp | 4 +- 15 files changed, 268 insertions(+), 80 deletions(-) create mode 100644 source/ngc/images/button_short.png create mode 100644 source/ngc/images/button_short_over.png diff --git a/source/ngc/FreeTypeGX.cpp b/source/ngc/FreeTypeGX.cpp index 0cbab38..32110be 100644 --- a/source/ngc/FreeTypeGX.cpp +++ b/source/ngc/FreeTypeGX.cpp @@ -680,6 +680,7 @@ void FreeTypeGX::copyTextureToFramebuffer(GXTexObj *texObj, f32 texWidth, f32 te GX_Color4u8(color.r, color.g, color.b, color.a); GX_TexCoord2f32(0.0f, 1.0f); GX_End(); + GX_DrawDone(); this->setDefaultMode(); } @@ -713,6 +714,7 @@ void FreeTypeGX::copyFeatureToFramebuffer(f32 featureWidth, f32 featureHeight, i GX_Position2s16(screenX, featureHeight + screenY); GX_Color4u8(color.r, color.g, color.b, color.a); GX_End(); + GX_DrawDone(); this->setDefaultMode(); } diff --git a/source/ngc/dvd.cpp b/source/ngc/dvd.cpp index d469c08..17eaa8d 100644 --- a/source/ngc/dvd.cpp +++ b/source/ngc/dvd.cpp @@ -467,7 +467,7 @@ getentry (int entrycount, unsigned char dvdbuffer[]) else { StripExt(tmpname, fname); // hide file extension - strncpy (browserList[entrycount].displayname, tmpname, MAXDISPLAY); + strncpy (browserList[entrycount].displayname, tmpname, MAXJOLIET); } memcpy (&offset32, &dvdbuffer[diroffset + EXTENT], 4); diff --git a/source/ngc/filebrowser.cpp b/source/ngc/filebrowser.cpp index 4bfabf8..1b3ab43 100644 --- a/source/ngc/filebrowser.cpp +++ b/source/ngc/filebrowser.cpp @@ -413,7 +413,7 @@ void StripExt(char* returnstring, char * inputstring) { char* loc_dot; - strncpy (returnstring, inputstring, 255); + strncpy (returnstring, inputstring, MAXJOLIET); if(inputstring == NULL || strlen(inputstring) < 4) return; diff --git a/source/ngc/filebrowser.h b/source/ngc/filebrowser.h index 57b726a..630d801 100644 --- a/source/ngc/filebrowser.h +++ b/source/ngc/filebrowser.h @@ -18,7 +18,6 @@ #include #define MAXJOLIET 255 -#define MAXDISPLAY 40 typedef struct { @@ -35,7 +34,7 @@ typedef struct time_t mtime; // file modified time char isdir; // 0 - file, 1 - directory char filename[MAXJOLIET + 1]; // full filename - char displayname[MAXDISPLAY + 1]; // name for browser display + char displayname[MAXJOLIET + 1]; // name for browser display } BROWSERENTRY; extern BROWSERINFO browser; diff --git a/source/ngc/filelist.h b/source/ngc/filelist.h index 9fd1e62..f0e6583 100644 --- a/source/ngc/filelist.h +++ b/source/ngc/filelist.h @@ -98,6 +98,12 @@ extern const u32 button_png_size; extern const u8 button_over_png[]; extern const u32 button_over_png_size; +extern const u8 button_short_png[]; +extern const u32 button_short_png_size; + +extern const u8 button_short_over_png[]; +extern const u32 button_short_over_png_size; + extern const u8 button_small_png[]; extern const u32 button_small_png_size; diff --git a/source/ngc/fileop.cpp b/source/ngc/fileop.cpp index 97464a7..484f5f6 100644 --- a/source/ngc/fileop.cpp +++ b/source/ngc/fileop.cpp @@ -325,7 +325,6 @@ ParseDirectory(int method) DIR_ITER *dir = NULL; char fulldir[MAXPATHLEN]; char filename[MAXPATHLEN]; - char tmpname[MAXPATHLEN]; struct stat filestat; char msg[128]; int retry = 1; @@ -397,8 +396,7 @@ ParseDirectory(int method) } else { - StripExt(tmpname, filename); // hide file extension - strncpy(browserList[entryNum].displayname, tmpname, MAXDISPLAY); // crop name for display + StripExt(browserList[entryNum].displayname, browserList[entryNum].filename); // hide file extension } browserList[entryNum].length = filestat.st_size; diff --git a/source/ngc/gcunzip.cpp b/source/ngc/gcunzip.cpp index ae7bdeb..942695d 100644 --- a/source/ngc/gcunzip.cpp +++ b/source/ngc/gcunzip.cpp @@ -5,7 +5,7 @@ * Michniewski 2008 * Tantric September 2008 * - * unzip.cpp + * gcunzip.cpp * * File unzip routines ***************************************************************************/ @@ -484,9 +484,9 @@ int SzParse(char * filepath, int method) } memset(&(browserList[SzJ]), 0, sizeof(BROWSERENTRY)); // clear the new entry - // parse information about this file to the dvd file list structure - strncpy(browserList[SzJ].filename, SzF->Name, MAXJOLIET); // copy joliet name (useless...) - strncpy(browserList[SzJ].displayname, SzF->Name, MAXDISPLAY); // crop name for display + // parse information about this file to the file list structure + strncpy(browserList[SzJ].filename, SzF->Name, MAXJOLIET); + StripExt(browserList[SzJ].displayname, browserList[SzJ].filename); browserList[SzJ].length = SzF->Size; // filesize browserList[SzJ].offset = SzI; // the extraction function identifies the file with this number browserList[SzJ].isdir = 0; // only files will be displayed (-> no flags) diff --git a/source/ngc/gui/gui.h b/source/ngc/gui/gui.h index c85148b..227f2c6 100644 --- a/source/ngc/gui/gui.h +++ b/source/ngc/gui/gui.h @@ -102,6 +102,12 @@ enum TRIGGER_BUTTON_ONLY_IN_FOCUS }; +enum +{ + SCROLL_NONE, + SCROLL_HORIZONTAL +}; + typedef struct _paddata { u16 btns_d; u16 btns_u; @@ -613,7 +619,9 @@ class GuiText : public GuiElement //!Sets the maximum width of the drawn texture image //!If the text exceeds this, it is wrapped to the next line //!\param w Maximum width - void SetMaxWidth(int w); + void SetMaxWidth(int width); + void SetScroll(int s); + void SetWrap(bool w, int width = 0); //!Sets the font color //!\param c Font color void SetColor(GXColor c); @@ -627,9 +635,16 @@ class GuiText : public GuiElement //!Constantly called to draw the text void Draw(); protected: + char * origText; wchar_t* text; //!< Unicode text value int size; //!< Font size int maxWidth; //!< Maximum width of the generated text object (for text wrapping) + bool wrap; + wchar_t* textDyn; + int textScroll; + int textScrollPos; + int textScrollInitialDelay; + int textScrollDelay; u16 style; //!< FreeTypeGX style attributes GXColor color; //!< Font color }; diff --git a/source/ngc/gui/gui_filebrowser.cpp b/source/ngc/gui/gui_filebrowser.cpp index 0e28e67..44c08c9 100644 --- a/source/ngc/gui/gui_filebrowser.cpp +++ b/source/ngc/gui/gui_filebrowser.cpp @@ -103,6 +103,7 @@ GuiFileBrowser::GuiFileBrowser(int w, int h) fileListText[i] = new GuiText(NULL, 20, (GXColor){0, 0, 0, 0xff}); fileListText[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); fileListText[i]->SetPosition(5,0); + fileListText[i]->SetMaxWidth(380); fileListBg[i] = new GuiImage(bgGameSelectionEntry); fileListFolder[i] = new GuiImage(gameFolder); @@ -375,6 +376,11 @@ void GuiFileBrowser::Update(GuiTrigger * t) selectedItem = i; browser.selIndex = browser.pageIndex + i; } + + if(selectedItem == i) + fileListText[i]->SetScroll(SCROLL_HORIZONTAL); + else + fileListText[i]->SetScroll(SCROLL_NONE); } // update the location of the scroll box based on the position in the file list diff --git a/source/ngc/gui/gui_text.cpp b/source/ngc/gui/gui_text.cpp index f3254a3..c432403 100644 --- a/source/ngc/gui/gui_text.cpp +++ b/source/ngc/gui/gui_text.cpp @@ -18,23 +18,36 @@ static int presetAlignmentVert = 0; static u16 presetStyle = 0; static GXColor presetColor = (GXColor){255, 255, 255, 255}; +#define TEXT_SCROLL_DELAY 8 +#define TEXT_SCROLL_INITIAL_DELAY 6 + /** * Constructor for the GuiText class. */ GuiText::GuiText(const char * t, int s, GXColor c) { + origText = NULL; text = NULL; size = s; color = c; alpha = c.a; style = FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE; maxWidth = 0; + wrap = false; + textDyn = NULL; + textScroll = SCROLL_NONE; + textScrollPos = 0; + textScrollInitialDelay = TEXT_SCROLL_INITIAL_DELAY; + textScrollDelay = TEXT_SCROLL_DELAY; alignmentHor = ALIGN_CENTRE; alignmentVert = ALIGN_MIDDLE; if(t) + { + origText = strdup(t); text = fontSystem->charToWideChar((char *)t); + } } /** @@ -42,18 +55,28 @@ GuiText::GuiText(const char * t, int s, GXColor c) */ GuiText::GuiText(const char * t) { + origText = NULL; text = NULL; size = presetSize; color = presetColor; alpha = presetColor.a; style = presetStyle; maxWidth = presetMaxWidth; + wrap = false; + textDyn = NULL; + textScroll = SCROLL_NONE; + textScrollPos = 0; + textScrollInitialDelay = TEXT_SCROLL_INITIAL_DELAY; + textScrollDelay = TEXT_SCROLL_DELAY; alignmentHor = presetAlignmentHor; alignmentVert = presetAlignmentVert; if(t) + { + origText = strdup(t); text = fontSystem->charToWideChar((char *)t); + } } /** @@ -61,22 +84,34 @@ GuiText::GuiText(const char * t) */ GuiText::~GuiText() { + if(origText) + free(origText); if(text) - { delete text; - text = NULL; - } + if(textDyn) + delete textDyn; } void GuiText::SetText(const char * t) { + if(origText) + free(origText); if(text) delete text; + if(textDyn) + delete textDyn; + origText = NULL; text = NULL; + textDyn = NULL; + textScrollPos = 0; + textScrollInitialDelay = TEXT_SCROLL_INITIAL_DELAY; if(t) + { + origText = strdup(t); text = fontSystem->charToWideChar((char *)t); + } } void GuiText::SetPresets(int sz, GXColor c, int w, u16 s, int h, int v) @@ -94,9 +129,31 @@ void GuiText::SetFontSize(int s) size = s; } -void GuiText::SetMaxWidth(int w) +void GuiText::SetMaxWidth(int width) { - maxWidth = w; + maxWidth = width; +} + +void GuiText::SetWrap(bool w, int width) +{ + wrap = w; + maxWidth = width; +} + +void GuiText::SetScroll(int s) +{ + if(textScroll == s) + return; + + if(textDyn) + { + delete(textDyn); + textDyn = NULL; + } + textScroll = s; + textScrollPos = 0; + textScrollInitialDelay = TEXT_SCROLL_INITIAL_DELAY; + textScrollDelay = TEXT_SCROLL_DELAY; } void GuiText::SetColor(GXColor c) @@ -170,61 +227,116 @@ void GuiText::Draw() if(alignmentVert == ALIGN_MIDDLE) voffset = -newSize/2 + 2; - if(maxWidth > 0) // text wrapping + if(maxWidth > 0) { - int lineheight = newSize + 6; - int strlen = wcslen(text); - int i = 0; - int ch = 0; - int linenum = 0; - int lastSpace = -1; - int lastSpaceIndex = -1; - wchar_t * tmptext[20]; + char * tmpText = strdup(origText); + u8 maxChar = (maxWidth*2.0) / newSize; - while(ch < strlen) + if(!textDyn) { - if(i == 0) - tmptext[linenum] = new wchar_t[strlen + 1]; + if(strlen(tmpText) > maxChar) + tmpText[maxChar] = 0; + textDyn = fontSystem->charToWideChar(tmpText); + } - tmptext[linenum][i] = text[ch]; - tmptext[linenum][i+1] = 0; + if(textScroll == SCROLL_HORIZONTAL) + { + int textlen = strlen(origText); - if(text[ch] == ' ' || ch == strlen-1) + if(textlen > maxChar && (FrameTimer % textScrollDelay == 0)) { - if(fontSystem->getWidth(tmptext[linenum]) >= maxWidth) + if(textScrollInitialDelay) { - if(lastSpace >= 0) + textScrollInitialDelay--; + } + else + { + textScrollPos++; + if(textScrollPos > textlen-1) { - tmptext[linenum][lastSpaceIndex] = 0; // discard space, and everything after - ch = lastSpace; // go backwards to the last space - lastSpace = -1; // we have used this space - lastSpaceIndex = -1; + textScrollPos = 0; + textScrollInitialDelay = TEXT_SCROLL_INITIAL_DELAY; } - linenum++; - i = -1; - } - else if(ch == strlen-1) - { - linenum++; + + strncpy(tmpText, &origText[textScrollPos], maxChar-1); + tmpText[maxChar-1] = 0; + + int dynlen = strlen(tmpText); + + if(dynlen+2 < maxChar) + { + tmpText[dynlen] = ' '; + tmpText[dynlen+1] = ' '; + strncat(&tmpText[dynlen+2], origText, maxChar - dynlen - 2); + } + if(textDyn) delete textDyn; + textDyn = fontSystem->charToWideChar(tmpText); } } - if(text[ch] == ' ' && i >= 0) - { - lastSpace = ch; - lastSpaceIndex = i; - } - ch++; - i++; + if(textDyn) + fontSystem->drawText(this->GetLeft(), this->GetTop()+voffset, textDyn, c, style); } - - if(alignmentVert == ALIGN_MIDDLE) - voffset = voffset - (lineheight*linenum)/2 + lineheight/2; - - for(i=0; i < linenum; i++) + else if(wrap) { - fontSystem->drawText(this->GetLeft(), this->GetTop()+voffset+i*lineheight, tmptext[i], c, style); - delete tmptext[i]; + int lineheight = newSize + 6; + int txtlen = wcslen(text); + int i = 0; + int ch = 0; + int linenum = 0; + int lastSpace = -1; + int lastSpaceIndex = -1; + wchar_t * textrow[20]; + + while(ch < txtlen) + { + if(i == 0) + textrow[linenum] = new wchar_t[txtlen + 1]; + + textrow[linenum][i] = text[ch]; + textrow[linenum][i+1] = 0; + + if(text[ch] == ' ' || ch == txtlen-1) + { + if(wcslen(textrow[linenum]) >= maxChar) + { + if(lastSpace >= 0) + { + textrow[linenum][lastSpaceIndex] = 0; // discard space, and everything after + ch = lastSpace; // go backwards to the last space + lastSpace = -1; // we have used this space + lastSpaceIndex = -1; + } + linenum++; + i = -1; + } + else if(ch == txtlen-1) + { + linenum++; + } + } + if(text[ch] == ' ' && i >= 0) + { + lastSpace = ch; + lastSpaceIndex = i; + } + ch++; + i++; + } + + if(alignmentVert == ALIGN_MIDDLE) + voffset = voffset - (lineheight*linenum)/2 + lineheight/2; + + for(i=0; i < linenum; i++) + { + fontSystem->drawText(this->GetLeft(), this->GetTop()+voffset+i*lineheight, textrow[i], c, style); + delete textrow[i]; + } } + else + { + fontSystem->drawText(this->GetLeft(), this->GetTop()+voffset, textDyn, c, style); + } + free(tmpText); } else { diff --git a/source/ngc/images/button_short.png b/source/ngc/images/button_short.png new file mode 100644 index 0000000000000000000000000000000000000000..6d212da971226e52386f851f1c5beb8745bd6310 GIT binary patch literal 1789 zcmV%40Q~ZGz_&QA7wt$QKyj<&B>X{38aTjP5D4<)O?iTh=>$EV6c3kXg(uNMh!*L z)dhT;kMKpJowNIW+ugel7FY##&u`|>IOqFz-MQa?&$;)0-@RMw(W6H|H0}}s4#XSf zj|zmUBNUvQ-8PQtQ2C0=&5fK4tH<0N^x-{G!%+iKy-{AkJZ{F?an4=TE=8#oHIRs= zlCSTBN<&>nEkg}svs5eGl`rwvs8gtYs0parPuehjl>dAuYH(#f0P{o%K_w{WdAA~O zP~MV6*<%6fZCfWbd!{k?wR#phv}w(ks0t{&cm>YrE`YZ1g0)lpl!`#6nTX1H9EJ%; zC0Q#u-8*-Hh_DbC@=7o8^=Zymtr~Ev_%@_v?t=q||ALf^EGT{WP(GzA>UUH$YQ8=1 zSoG=g=DXTfWId&q|dp=Q~eVQ5)S#O1yCQxWX`{Ji)P$Xj4^pg_>*Bg#7IMTcWx<0Pm`xT>l`A(tdZPoB0w4&`cY>rNS+v*v+6( zumzT&S*BQfojsc((q?w6Kv)?`(Do41#tntZqa(QWYgkrUxqhpqtU}OS-1N%sqDj!o zNUB9`IOFih4Kiw7M2^EXStaHDc281}07uy&%b zT?A9TpvgFzpv^7s3oE+JgdT!y;{ z7AYkvTp3jbpn~`sRVg~f6tqb*{f>Y`(!HAlKOmVW6-@7V(@*$S)!N&RPHu?fHjW(y fY0}kE{3pNw?_l;$eHimP00000NkvXXu0mjfRJB$} literal 0 HcmV?d00001 diff --git a/source/ngc/images/button_short_over.png b/source/ngc/images/button_short_over.png new file mode 100644 index 0000000000000000000000000000000000000000..aa4a938c3772985167698cd65ae38739619a5bb2 GIT binary patch literal 1875 zcmV-Z2dwysP)VqS2UWATbh+7{Xr=4Mrjf(ZmFN1dWJ5 zn3AEx$zx==z}TbfW9wsWujkxH`Fh)K-2*my&oB9PaK76+xcAp{zH`3so|+^{0>as2 z&%+d=7P%N%57UGDp|J7m7~@^Yiz>&Brk4FV$1GFyAMhYIAvYk`BCCOMEAdR8$Ayu< zs5~@L0f{hA^8L-oZ;&^Tdy$W`SY{L)>W6p-@&fV%l0r$*?G{Y4`pbVtJ~o+u0OPh| zHFBRSo|h+bg7JnV@*W=}pBnX~wsNpLYM{7e4&S0_KrGr1(eMq3g?n=yvQUi(B$^j# z3VSOAvmSXMSI8+TUj(kImEfvg1-9ZUzH2i8iFg?NeXTI$zW{?hCqa^u`a@PBPa(G> zcTJ^W-c;jY1}eQRQ0}=K$~+B%RpPrf15jis22br8nKkn^fDc8}*ZmVD6H)On8}cJH zS$SHWC{Ic-6oOvW8_PY7P&udNrcfjn$xMdbF$-!JY?Q^**Zm{%nEnt-SiVPYL=NOS zk7nz?S&q77by?j**7|BEgF1PK1=`Pfpw!{sl|7MgY+Aj=UAqQKE0)O_5z{~f z6S%4~=BryV0@+d?2LIwwQ>hfn+_d+Jy^9gynY{)Edrygrm({914r?KaHb2?4(PHO3 zc`;GqaAZ)JCa~FfdS+P_vn04Z$cYWHy?gp;r8XWc#FWBsr z^4=O1wK#RDx8RExgsQH^S_W3Ti{~#4u$Rsj1w&}GsKuESti>LlyD(&shtXjv31(rM zU~CmE7={vU>~6hju|+M+q+m8%dBV$(QB+i%k#T1T#$>jE#9J&GvKFiv$y1j7FcNzh zhN1*1t~bR$paGo4uwWQCVTttXP3`8Umi-ixF5Zk=QHTy*Q=T(o8k(`2dtx-SYFQF( z^i5TKhl8D9bJXxh%)l59T!Q#WP&9R+bLkQVvsD`z^8X7J)x7E3$cPMe>rLO%izb*O zpgbPw(dIG1!FF&~EaNL@K*VEy2>Q_cA4I`)fYJx;NzD-G{{u>0cY(=d z;VWqn1o|_23w3GXNG})yJ+MS=A8bl23&6m&qB{rD(_&Yj&z$rb#pS`_6#5$RB0db|l`Hv57XXHXmmtvF3W-EUv#FgZmV?>eGg|sX#k?0lY5$QzaG(w1 zBLQ$#t&$tkFz(cB=ufL!IDo)`6pJA$pt=z9Tab zl9Z4?k%D^QvarOmL3RPdpO&i2x|V0YBY4HOyE z2ih%1;uwka;?MtN(c}OX=BPjK@qErZo)RuelfG7lR<(DC8B{90iuB3U7R9NByvf90 zLvY(OpO`kt^>35fMv`K(A<;?wC&@4<3zvB zgtkJwj+~2pMa`%Zd>>{sT0!X|wL}d;?Gri4WLFjas$1KwhA8R+L5r75k&S$hrWIYP zD5y#EVRcF|X-wrZG>PYsN)42AJEq}cEiZ5}oF8MH3M{c(@r(Z#U;tndwAppend(&optionBrowser); mainWindow->Append(&w); mainWindow->Append(&titleTxt); @@ -2598,14 +2621,17 @@ static int MenuSettingsMappingsMap() for(i=0; i < options.length; i++) { - options.value[i][0] = 0; - for(j=0; j < ctrlr_def[mapMenuCtrl].num_btns; j++) { - if(btnmap[mapMenuCtrlSNES][mapMenuCtrl][i] == + if(btnmap[mapMenuCtrlSNES][mapMenuCtrl][i] == 0) + { + options.value[i][0] = 0; + } + else if(btnmap[mapMenuCtrlSNES][mapMenuCtrl][i] == ctrlr_def[mapMenuCtrl].map[j].btn) { - sprintf(options.value[i], ctrlr_def[mapMenuCtrl].map[j].name); + if(strcmp(options.value[i], ctrlr_def[mapMenuCtrl].map[j].name) != 0) + sprintf(options.value[i], ctrlr_def[mapMenuCtrl].map[j].name); break; } } @@ -2615,13 +2641,27 @@ static int MenuSettingsMappingsMap() if(ret >= 0) { - btnmap[mapMenuCtrlSNES][mapMenuCtrl][ret] = ButtonMappingWindow(); // get a button selection from user + // get a button selection from user + btnmap[mapMenuCtrlSNES][mapMenuCtrl][ret] = ButtonMappingWindow(); } if(backBtn.GetState() == STATE_CLICKED) { menu = MENU_GAMESETTINGS_MAPPINGS_CTRL; } + else if(resetBtn.GetState() == STATE_CLICKED) + { + resetBtn.ResetState(); + + int choice = WindowPrompt( + "Reset Mappings", + "Are you sure that you want to reset your mappings?", + "Yes", + "No"); + + if(choice == 1) + ResetControls(mapMenuCtrlSNES, mapMenuCtrl); + } } HaltGui(); mainWindow->Remove(&optionBrowser); @@ -2853,6 +2893,9 @@ static int MenuSettingsVideo() sprintf(options.name[i++], "Video Mode"); options.length = i; + for(i=0; i < options.length; i++) + options.value[i][0] = 0; + GuiText titleTxt("Game Settings - Video", 28, (GXColor){255, 255, 255, 255}); titleTxt.SetAlignment(ALIGN_LEFT, ALIGN_TOP); titleTxt.SetPosition(50,50); @@ -3031,7 +3074,7 @@ static int MenuSettings() savingBtn.SetEffectGrow(); GuiText menuBtnTxt("Menu", 24, (GXColor){0, 0, 0, 255}); - menuBtnTxt.SetMaxWidth(btnLargeOutline.GetWidth()-30); + menuBtnTxt.SetWrap(true, btnLargeOutline.GetWidth()-30); GuiImage menuBtnImg(&btnLargeOutline); GuiImage menuBtnImgOver(&btnLargeOutlineOver); GuiImage menuBtnIcon(&iconMenu); @@ -3048,7 +3091,7 @@ static int MenuSettings() menuBtn.SetEffectGrow(); GuiText networkBtnTxt("Network", 24, (GXColor){0, 0, 0, 255}); - networkBtnTxt.SetMaxWidth(btnLargeOutline.GetWidth()-30); + networkBtnTxt.SetWrap(true, btnLargeOutline.GetWidth()-30); GuiImage networkBtnImg(&btnLargeOutline); GuiImage networkBtnImgOver(&btnLargeOutlineOver); GuiImage networkBtnIcon(&iconNetwork); @@ -3172,6 +3215,9 @@ static int MenuSettingsFile() sprintf(options.name[i++], "Verify MC Saves"); options.length = i; + for(i=0; i < options.length; i++) + options.value[i][0] = 0; + GuiText titleTxt("Settings - Saving & Loading", 28, (GXColor){255, 255, 255, 255}); titleTxt.SetAlignment(ALIGN_LEFT, ALIGN_TOP); titleTxt.SetPosition(50,50); @@ -3355,6 +3401,9 @@ static int MenuSettingsMenu() sprintf(options.name[i++], "Rumble"); options.length = i; + for(i=0; i < options.length; i++) + options.value[i][0] = 0; + GuiText titleTxt("Settings - Menu", 28, (GXColor){255, 255, 255, 255}); titleTxt.SetAlignment(ALIGN_LEFT, ALIGN_TOP); titleTxt.SetPosition(50,50); @@ -3500,6 +3549,9 @@ static int MenuSettingsNetwork() sprintf(options.name[i++], "SMB Share Password"); options.length = i; + for(i=0; i < options.length; i++) + options.value[i][0] = 0; + GuiText titleTxt("Settings - Network", 28, (GXColor){255, 255, 255, 255}); titleTxt.SetAlignment(ALIGN_LEFT, ALIGN_TOP); titleTxt.SetPosition(50,50); diff --git a/source/ngc/video.cpp b/source/ngc/video.cpp index 26fe066..5a979b6 100644 --- a/source/ngc/video.cpp +++ b/source/ngc/video.cpp @@ -1025,8 +1025,6 @@ ResetVideo_Menu () ***************************************************************************/ void Menu_Render() { - GX_DrawDone (); - whichfb ^= 1; // flip framebuffer GX_SetZMode(GX_TRUE, GX_LEQUAL, GX_TRUE); GX_SetColorUpdate(GX_TRUE); @@ -1086,6 +1084,7 @@ void Menu_DrawImg(f32 xpos, f32 ypos, u16 width, u16 height, u8 data[], GX_Color4u8(0xFF,0xFF,0xFF,alpha); GX_TexCoord2f32(0, 1); GX_End(); + GX_DrawDone(); GX_LoadPosMtxImm (GXmodelView2D, GX_PNMTX0); GX_SetTevOp (GX_TEVSTAGE0, GX_PASSCLR); @@ -1124,4 +1123,5 @@ void Menu_DrawRectangle(f32 x, f32 y, f32 width, f32 height, GXColor color, u8 f GX_Color4u8(color.r, color.g, color.b, color.a); } GX_End(); + GX_DrawDone(); }