From 0a932dc042385d746aac4e0305bf4acd0778027f Mon Sep 17 00:00:00 2001 From: J-D-K Date: Tue, 10 Jul 2018 18:38:23 -0400 Subject: [PATCH] Make text work the way I want --- Makefile | 2 +- inc/data.h | 33 ++++++++++------------ inc/gfx.h | 9 +++--- romfs/img/buttonA.png | Bin 1161 -> 0 bytes romfs/img/buttonB.png | Bin 1184 -> 0 bytes romfs/img/buttonX.png | Bin 1265 -> 0 bytes romfs/img/buttonY.png | Bin 1130 -> 0 bytes src/clsui.cpp | 2 +- src/data.cpp | 47 ++++++++----------------------- src/file.cpp | 5 ++-- src/gfx.cpp | 32 ++++++++------------- src/kb.cpp | 2 +- src/main.cpp | 3 +- src/menu.cpp | 2 +- src/miscui.cpp | 26 ++++++++--------- src/ui.cpp | 63 +++++++++++++++++++++--------------------- 16 files changed, 95 insertions(+), 131 deletions(-) delete mode 100644 romfs/img/buttonA.png delete mode 100644 romfs/img/buttonB.png delete mode 100644 romfs/img/buttonX.png delete mode 100644 romfs/img/buttonY.png diff --git a/Makefile b/Makefile index 278fcdc..466587f 100644 --- a/Makefile +++ b/Makefile @@ -38,7 +38,7 @@ INCLUDES := inc EXEFS_SRC := exefs_src APP_TITLE := JKSV APP_AUTHOR := JK_ -APP_VERSION := 07/08/2018 +APP_VERSION := 07/10/2018 ROMFS := romfs #--------------------------------------------------------------------------------- diff --git a/inc/data.h b/inc/data.h index 8978cfe..bd81654 100644 --- a/inc/data.h +++ b/inc/data.h @@ -10,35 +10,30 @@ namespace data { - extern bool sysSave, forceMountable, smoothIcns; + extern bool sysSave; //Loads user + title info void loadDataInfo(); void exit(); //Class to help not load the same icons over and over - class icn + class icn : gfx::tex { public: //Loads jpeg icon from jpegData void load(const uint64_t& _id, const uint8_t *jpegData, const size_t& jpegSize); + //For loading default icon + void load(const uint64_t & _id, const std::string& _png); - //Sets icon from image already loaded. Only used for default - void setIcon(const uint64_t& _id, const gfx::tex& _set); + void draw(unsigned x, unsigned y) { gfx::tex::draw(x, y); } + void drawHalf(unsigned x, unsigned y) { gfx::tex::drawNoBlendSkipSmooth(x, y); } - //Draw - void draw(unsigned x, unsigned y); + uint64_t getTitleID() { return titleID; } - //Draws skipping pixels for half size - void drawHalf(unsigned x, unsigned y); - - uint64_t getTitleID() { return titleID;} - - void deleteData(); + void deleteData() { gfx::tex::deleteData(); } private: uint64_t titleID; - gfx::tex iconTex; }; //Class to store title info @@ -53,15 +48,15 @@ namespace data //Returns title + title without forbidden chars std::string getTitle() { return title;} - std::string getTitleSafe() { return titleSafe;} + std::string getTitleSafe() { return titleSafe; } //Returns ID - uint64_t getID() {return id;} + uint64_t getID() { return id; } //Game icon icn icon; - FsSaveDataType getType() { return type;} + FsSaveDataType getType() { return type; } private: FsSaveDataType type; @@ -81,11 +76,11 @@ namespace data bool initNoChk(const u128& _id); //Returns user ID - u128 getUID() {return userID;} + u128 getUID() { return userID; } //Returns username - std::string getUsername() {return username;} - std::string getUsernameSafe() {return userSafe;} + std::string getUsername() { return username; } + std::string getUsernameSafe() { return userSafe; } //Vector for storing save data info for user std::vector titles; diff --git a/inc/gfx.h b/inc/gfx.h index c42686c..f3b8957 100644 --- a/inc/gfx.h +++ b/inc/gfx.h @@ -27,7 +27,6 @@ namespace gfx uint8_t rgb[4]; }; - //Old 3DS code for loading raw RGBA8 data class tex { public: @@ -41,9 +40,9 @@ namespace gfx void loadJpegFile(const std::string& path); //Frees memory used by data void deleteData(); - uint16_t getWidth() { return width;} - uint16_t getHeight() {return height;} - const uint32_t *getDataPointer() {return data;} + uint16_t getWidth() { return width; } + uint16_t getHeight() { return height; } + uint32_t *getDataPointer() { return data; } void draw(uint32_t x, uint32_t y); void drawInvert(uint32_t x, uint32_t y); @@ -61,7 +60,7 @@ namespace gfx void drawRepeatVert(uint32_t x, uint32_t y, uint32_t h); void drawRepeatVertNoBlend(uint32_t x, uint32_t y, uint32_t h); - private: + protected: uint32_t sz; uint16_t width, height; uint32_t *data = NULL; diff --git a/romfs/img/buttonA.png b/romfs/img/buttonA.png deleted file mode 100644 index 7647fd85b0e2b32bc7a697d56e46ef7469399bfe..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1161 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 bU(f#oOCbX9Z2@9100000NkvXXu0mjfvkpAr diff --git a/romfs/img/buttonY.png b/romfs/img/buttonY.png deleted file mode 100644 index 468404ccdcf508c555d7fe47bb105c12cb7381c2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1130 zcmV-w1eN=VP)E2`=oqk;wo603B&m zSad^gZEa<4bN~PV002XBWnpw>WFU8GbZ8()Nlj2>E@cM*00YiRL_t(o!@ZY3Xd71? z$3Hq5ooG=KYBiyD;<~g|7NZPtuqI=Qp^F7=AaM%q6pSIzy<3NnDMPXfj~)_1oW%_! z;K_KfFl0zk)2Pte9Zcg$mMz~|chX7M;odu+WZ8a>t^D9|$9s40`~CfSzxVrvIF76{ z$VZG4W*iv7VSp-N@-HSiYAn!Xkrb<{TZWGOqJYi?CW(-tL6ip21nPhdSmJ4ezvj(O z16fko?@yr21X1RxiOp+(6Bu~I90(kg zSzxM@HTDzulQVqA3J!@D6H86qwxKQs;2J3^2NU=MojzV+lb|ZVgPJ!vsT6=@&=Ok9 zavw9)Nw5q4u!O%)4i1n2W;$D7lL^AiQvr4aaQ)b3Ruw-mJpzBBa|sI*r~ummvv*IT zq_8~~e9C0Yv2wZ&4lubF13DQjpehJ-Fnji^EbfTQv&6FlcYJaA1@4H;qc0z+5Xg8g zSYwd0{DUEUU+wJscsNczndf}uJU0qAcv61SvVQZEn`FPvvTm<4^lFH5vwSoKmoGFT zjJ712MrR8Y8%6G{-T~m@=MRZ#F@G(l#dt9A0D#+n-&O_?`SW)#-lb3PBl9-H^U8Cz2xtN|#zSoJ29pGaIQR9#N%V$$$tUx~d*Y<> zDIC{fWoU&pdyOl7D800Vi09VjR3&)bJv->JjYApC3UyX@W;c9y&hx9 zSW?s85m;rc9-3`=T_N#2-FnL7;$v>bZvk+B{k}T5yv)2hf)E?LVV4A^FpFaL>kao( z94>mNIHyyirV{l*?V&_L!z70-78>fQx6~;4?@HhVuJ4*i^$l_w1`8h~`?-GPdloQ& z2n!lEi#`Fjiv*hS;fKX8n_z(-xb-m0vK5Qz^W!bn(n&h((GG;#5oVs zyN;L9MOd7k$gElofR{w{Zvo#BB`vRGuS80py4fZ8Hn0J_6C^H>Che7FdnK7yq0F9& z<}%Uj2*3^TECC^A`DL$6*V=xc5{2XY1KT3XgW&JP)1<%{Q-_!3%bWpLL; icons; std::vector users; - bool sysSave = false, forceMountable = true, smoothIcns = false; + bool sysSave = false; void loadDataInfo() { - //Load default icon - defIcn.loadPNGFile("romfs:/img/icn/icnDefault.png"); - - //Create icon for it - icn defIcnIcon; - defIcnIcon.setIcon((uint64_t)0, defIcn); - icons.push_back(defIcnIcon); + icn defIcon; + defIcon.load(0, "romfs:/img/icn/icnDefault.png"); + icons.push_back(defIcon); for(unsigned i = 0; i < users.size(); i++) users[i].titles.clear(); @@ -94,7 +87,7 @@ namespace data u = getUserIndex(info.userID); titledata newData; - if(newData.init(info) && (!forceMountable || newData.isMountable(newUser.getUID()))) + if(newData.init(info) && newData.isMountable(newUser.getUID())) { users[u].titles.push_back(newData); } @@ -103,7 +96,7 @@ namespace data else { titledata newData; - if(newData.init(info) && (!forceMountable || newData.isMountable(users[u].getUID()))) + if(newData.init(info) && newData.isMountable(users[u].getUID())) { users[u].titles.push_back(newData); } @@ -124,37 +117,20 @@ namespace data for(unsigned i = 0; i < users.size(); i++) users[i].icn.deleteData(); - for(unsigned i = 1; i < icons.size(); i++) + for(unsigned i = 0; i < icons.size(); i++) icons[i].deleteData(); } void icn::load(const uint64_t& _id, const uint8_t *jpegData, const size_t& jpegSize) { titleID = _id; - - iconTex.loadJpegMem(jpegData, jpegSize); + gfx::tex::loadJpegMem(jpegData, jpegSize); } - void icn::setIcon(const uint64_t& _id, const gfx::tex& _set) + void icn::load(const uint64_t& _id, const std::string& _png) { titleID = _id; - iconTex = _set; - } - - void icn::draw(unsigned x, unsigned y) - { - iconTex.drawNoBlend(x, y); - } - - void icn::drawHalf(unsigned x, unsigned y) - { - iconTex.drawNoBlendSkipSmooth(x, y); - } - - - void icn::deleteData() - { - iconTex.deleteData(); + gfx::tex::loadPNGFile(_png); } int findIcnIndex(const uint64_t& titleID) @@ -305,7 +281,8 @@ namespace data { username = "Unknown"; userSafe = "Unknown"; - icn = defIcn; + //This shouldn't happen too much + icn.loadPNGFile("romfs:/img/icn/icnDefault.png"); } return true; diff --git a/src/file.cpp b/src/file.cpp index b5a0edc..e7a61e6 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include "file.h" #include "util.h" @@ -121,7 +122,7 @@ namespace fs ui::progBar prog(fileSize); std::string copyString = "Copying " + from + "..."; - copyString = util::getWrappedString(copyString, 64, 1136); + copyString = util::getWrappedString(copyString, 24, 1136); for(unsigned i = 0; i < fileSize; ) { f.read((char *)buff, BUFF_SIZE); @@ -154,7 +155,7 @@ namespace fs ui::progBar prog(fileSize); std::string copyString = "Copying " + from + "..."; - copyString = util::getWrappedString(copyString, 64, 1136); + copyString = util::getWrappedString(copyString, 24, 1136); for(unsigned i = 0; i < fileSize; ) { f.read((char *)buff, BUFF_SIZE); diff --git a/src/gfx.cpp b/src/gfx.cpp index b9e74bb..d1bb41b 100644 --- a/src/gfx.cpp +++ b/src/gfx.cpp @@ -117,9 +117,9 @@ namespace gfx uint32_t tmpChr; ssize_t unitCount = 0; - y += 27; - - FT_Set_Char_Size(face, 0, 8 * sz, 300, 300); + //Set's font height to size. Easier to work with + FT_Set_Char_Size(face, 0, sz * 64, 90, 90); + unsigned height = sz; uint32_t *fb = (uint32_t *)gfxGetFramebuffer(&fbw, NULL); @@ -136,7 +136,7 @@ namespace gfx if(tmpChr == '\n') { tmpX = x; - y += face->size->metrics.height / sz; + y += height + 8; continue; } @@ -145,7 +145,9 @@ namespace gfx if(ret) return; - drawGlyph(slot->bitmap, fb, tmpX + slot->bitmap_left, y - slot->bitmap_top, textColor); + unsigned drawY = y + (height - slot->bitmap_top); + + drawGlyph(slot->bitmap, fb, tmpX + slot->bitmap_left, drawY, textColor); tmpX += slot->advance.x >> 6; } } @@ -159,7 +161,7 @@ namespace gfx FT_GlyphSlot slot = face->glyph; FT_Error ret = 0; - FT_Set_Char_Size(face, 0, 8 * sz, 300, 300); + FT_Set_Char_Size(face, 0, 64 * sz, 90, 90); for(unsigned i = 0; i < str.length(); ) { @@ -183,17 +185,8 @@ namespace gfx unsigned getTextHeight(const uint32_t& sz) { - FT_UInt glyphIndex = 0; - FT_Error error = 0; - uint32_t tChar = 'A'; - - FT_Set_Char_Size(face, 0, 8 * sz, 300, 300); - glyphIndex = FT_Get_Char_Index(face, tChar); - error = FT_Load_Glyph(face, glyphIndex, FT_LOAD_RENDER); - if(error) - return 0; - - return face->size->metrics.height / sz; + //Pointless now, but keep + return sz; } void clearBufferColor(const uint32_t& clr) @@ -307,9 +300,8 @@ namespace gfx delete[] rows; png_destroy_read_struct(&png, &pngInfo, NULL); - - fclose(pngIn); } + fclose(pngIn); } void tex::loadJpegMem(const uint8_t *txData, const size_t& jpegSz) @@ -402,11 +394,11 @@ namespace gfx jpeg_finish_decompress(&jpegInfo); jpeg_destroy_decompress(&jpegInfo); - fclose(jpegFile); delete row[0]; delete[] row; } + fclose(jpegFile); } void tex::deleteData() diff --git a/src/kb.cpp b/src/kb.cpp index 60bb496..e9a031c 100644 --- a/src/kb.cpp +++ b/src/kb.cpp @@ -103,7 +103,7 @@ namespace ui for(unsigned i = 0; i < keys.size(); i++) keys[i].draw(); - gfx::drawText(str, 16, 192, 64, 0xFF000000); + gfx::drawText(str, 16, 192, 32, 0xFF000000); } std::string keyboard::getString(const std::string& def) diff --git a/src/main.cpp b/src/main.cpp index 2ff0632..8e88b44 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -41,7 +41,7 @@ int main(int argc, const char *argv[]) data::loadDataInfo(); ui::init(); - appletSetScreenShotPermission(0); + appletSetScreenShotPermission(1); bool run = true; while(appletMainLoop() && run) @@ -59,7 +59,6 @@ int main(int argc, const char *argv[]) if(ui::confirm("You are about to enable system save dumping and remove checks. Are you sure you want to continue?")) { data::sysSave = true; - data::forceMountable = false; data::loadDataInfo(); //Just to be sure diff --git a/src/menu.cpp b/src/menu.cpp index ca658ce..1878416 100644 --- a/src/menu.cpp +++ b/src/menu.cpp @@ -145,7 +145,7 @@ namespace ui if(i == selected) gfx::drawRectangle(x, y + ((i - start) * 36), rW, 32, rectClr); - gfx::drawText(opt[i], x, y + ((i - start) * 36), 38, textClr); + gfx::drawText(opt[i], x, (y + 8) + ((i - start) * 36), 16, textClr); } } diff --git a/src/miscui.cpp b/src/miscui.cpp index e38b568..79dceec 100644 --- a/src/miscui.cpp +++ b/src/miscui.cpp @@ -29,7 +29,7 @@ namespace ui //char tmp[64]; //sprintf(tmp, "%u / %u", (unsigned)prog, (unsigned)max); - gfx::drawText(text, 80, 256, 64, txtClr); + gfx::drawText(text, 80, 256, 24, txtClr); //gfx::drawText(tmp, 80, 320, 64, 0x000000FF); } @@ -41,8 +41,8 @@ namespace ui h = _h; text = _txt; - unsigned tw = gfx::getTextWidth(text, 48); - unsigned th = gfx::getTextHeight(48); + unsigned tw = gfx::getTextWidth(text, 24); + unsigned th = gfx::getTextHeight(24); tx = x + (w / 2) - (tw / 2); ty = y + (h / 2) - (th / 2); @@ -91,7 +91,7 @@ namespace ui else ui::drawTextbox(x, y, w, h); - gfx::drawText(text, tx, ty, 48, txtClr); + gfx::drawText(text, tx, ty, 24, txtClr); } void touchTrack::update(const touchPosition& p) @@ -140,7 +140,7 @@ namespace ui void showMessage(const std::string& mess) { button ok("OK", 256, 496, 768, 96); - std::string wrapMess = util::getWrappedString(mess, 48, 752); + std::string wrapMess = util::getWrappedString(mess, 24, 752); while(true) { hidScanInput(); @@ -155,9 +155,9 @@ namespace ui break; ui::drawTextbox(256, 128, 768, 464); - gfx::drawText(wrapMess, 272, 144, 48, txtClr); + gfx::drawText(wrapMess, 272, 144, 24, txtClr); ok.draw(); - ui::buttonA.drawInvert(ok.getTx() + 48, ok.getTy()); + ui::buttonA.drawInvert(ok.getTx() + 56, ok.getTy() - 4); gfx::handleBuffs(); } @@ -195,10 +195,10 @@ namespace ui { bool ret = false; - button yes("Yes ", 256, 496, 384, 96); - button no("No ", 640, 496, 384, 96); + button yes("Yes ", 256, 496, 384, 96); + button no("No ", 640, 496, 384, 96); - std::string wrapMess = util::getWrappedString(mess, 48, 752); + std::string wrapMess = util::getWrappedString(mess, 24, 752); while(true) { @@ -223,11 +223,11 @@ namespace ui } ui::drawTextbox(256, 128, 768, 464); - gfx::drawText(wrapMess, 272, 144, 48, txtClr); + gfx::drawText(wrapMess, 272, 144, 24, txtClr); yes.draw(); - ui::buttonA.drawInvert(yes.getTx() + 56, yes.getTy()); + ui::buttonA.drawInvert(yes.getTx() + 64, yes.getTy() - 4); no.draw(); - ui::buttonB.drawInvert(no.getTx() + 48, no.getTy()); + ui::buttonB.drawInvert(no.getTx() + 56, no.getTy() - 4); gfx::handleBuffs(); } diff --git a/src/ui.cpp b/src/ui.cpp index cdf1407..990ccda 100644 --- a/src/ui.cpp +++ b/src/ui.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include #include "ui.h" @@ -21,7 +22,7 @@ enum menuState CLS_TTL }; -#define TITLE_TEXT "JKSV - 07/08/2018" +#define TITLE_TEXT "JKSV - 07/10/2018" //Menu currently up int mstate = USR_SEL; @@ -207,7 +208,7 @@ namespace ui else background.drawNoBlend(0, 0); - gfx::drawText(TITLE_TEXT, 16, 16, 64, mnuTxt); + gfx::drawText(TITLE_TEXT, 16, 16, 32, mnuTxt); switch(mstate) { @@ -263,11 +264,11 @@ namespace ui //Input guide unsigned startX = 848; buttonA.draw(startX, 672); - gfx::drawText("Select", startX += 38, 668, 32, mnuTxt); + gfx::drawText("Select", startX += 38, 680, 14, mnuTxt); buttonY.draw(startX += 72, 672); - gfx::drawText("Dump All", startX += 38, 668, 32, mnuTxt); + gfx::drawText("Dump All", startX += 38, 680, 14, mnuTxt); buttonX.draw(startX += 96, 672); - gfx::drawText("Classic Mode", startX += 38, 668, 32, mnuTxt); + gfx::drawText("Classic Mode", startX += 38, 680, 14, mnuTxt); } break; @@ -276,11 +277,11 @@ namespace ui { unsigned startX = 914; buttonA.draw(startX, 672); - gfx::drawText("Select", startX += 38, 668, 32, mnuTxt); + gfx::drawText("Select", startX += 38, 680, 14, mnuTxt); buttonY.draw(startX += 72, 672); - gfx::drawText("Dump All", startX += 38, 668, 32, mnuTxt); + gfx::drawText("Dump All", startX += 38, 680, 14, mnuTxt); buttonB.draw(startX += 96, 672); - gfx::drawText("Back", startX += 38, 668, 32, mnuTxt); + gfx::drawText("Back", startX += 38, 680, 14, mnuTxt); } break; @@ -290,15 +291,15 @@ namespace ui //Input guide unsigned startX = 690; buttonMin.draw(startX, 672); - gfx::drawText("Adv. Mode", startX += 38, 668, 32, mnuTxt); + gfx::drawText("Adv. Mode", startX += 38, 680, 14, mnuTxt); buttonA.draw(startX += 100, 672); - gfx::drawText("Backup", startX += 38, 668, 32, mnuTxt); + gfx::drawText("Backup", startX += 38, 680, 14, mnuTxt); buttonY.draw(startX += 72, 672); - gfx::drawText("Restore", startX += 38, 668, 32, mnuTxt); + gfx::drawText("Restore", startX += 38, 680, 14, mnuTxt); buttonX.draw(startX += 72, 672); - gfx::drawText("Delete", startX += 38, 668, 32, mnuTxt); + gfx::drawText("Delete", startX += 38, 680, 14, mnuTxt); buttonB.draw(startX += 72, 672); - gfx::drawText("Back", startX += 38, 668, 32, mnuTxt); + gfx::drawText("Back", startX += 38, 680, 14, mnuTxt); } break; @@ -306,8 +307,8 @@ namespace ui saveMenu.draw(mnuTxt); sdMenu.draw(mnuTxt); - gfx::drawText(saveWrap, 16, 652, 32, mnuTxt); - gfx::drawText(sdWrap, 656, 652, 32, mnuTxt); + gfx::drawText(saveWrap, 16, 668, 14, mnuTxt); + gfx::drawText(sdWrap, 656, 668, 14, mnuTxt); break; } } @@ -372,7 +373,7 @@ namespace ui } std::string username = data::users[selected].getUsername(); - unsigned userWidth = gfx::getTextWidth(username, 32); + unsigned userWidth = gfx::getTextWidth(username, 16); int userRectWidth = userWidth + 32, userRectX = (tX + 64) - (userRectWidth / 2); if(userRectX < 16) userRectX = 16; @@ -381,7 +382,7 @@ namespace ui userRectX = 1264 - userRectWidth; drawTextbox(userRectX, y - 50, userRectWidth, 38); - gfx::drawText(username, userRectX + 16, y - 50, 32, txtClr); + gfx::drawText(username, userRectX + 16, y - 38, 16, txtClr); } data::users[i].icn.drawNoBlendSkipSmooth(tX, y); } @@ -534,7 +535,7 @@ namespace ui } std::string title = data::curUser.titles[selected].getTitle(); - unsigned titleWidth = gfx::getTextWidth(title, 32); + unsigned titleWidth = gfx::getTextWidth(title, 16); int rectWidth = titleWidth + 32, rectX = (tX + 64) - (rectWidth / 2); if(rectX < 16) rectX = 16; @@ -543,7 +544,7 @@ namespace ui rectX = 1264 - rectWidth; drawTextbox(rectX, y - 50, rectWidth, 38); - gfx::drawText(title, rectX + 16, y - 50, 32, txtClr); + gfx::drawText(title, rectX + 16, y - 38, 16, txtClr); } data::curUser.titles[i].icon.drawHalf(tX, y); } @@ -564,7 +565,7 @@ namespace ui { util::makeTitleDir(data::curUser, data::curData); folderMenuPrepare(data::curUser, data::curData); - folderMenuInfo = util::getWrappedString(util::getInfoString(data::curUser, data::curData), 38, 256); + folderMenuInfo = util::getWrappedString(util::getInfoString(data::curUser, data::curData), 18, 256); mstate = FLD_SEL; } @@ -645,7 +646,7 @@ namespace ui { util::makeTitleDir(data::curUser, data::curData); folderMenuPrepare(data::curUser, data::curData); - folderMenuInfo = util::getWrappedString(util::getInfoString(data::curUser, data::curData), 38, 256); + folderMenuInfo = util::getWrappedString(util::getInfoString(data::curUser, data::curData), 18, 256); mstate = FLD_SEL; } @@ -670,7 +671,7 @@ namespace ui folderMenu.handleInput(down, held, p); data::curData.icon.draw(16, 88); - gfx::drawText(folderMenuInfo, 16, 344, 38, mnuTxt); + gfx::drawText(folderMenuInfo, 16, 360, 18, mnuTxt); if(down & KEY_A || folderMenu.getTouchEvent() == MENU_DOUBLE_REL) { @@ -775,7 +776,7 @@ namespace ui } } - //Performs copy menu operations. To big to stuff into case IMO. +//Performs copy menu operations. To big to stuff into case IMO. void performCopyMenuOps() { switch(copyMenu.getSelected()) @@ -1094,7 +1095,7 @@ namespace ui if(saveSel == 1 && savePath != "sv:/") { util::removeLastFolderFromString(savePath); - saveWrap = util::getWrappedString(savePath, 32, 600); + saveWrap = util::getWrappedString(savePath, 14, 600); saveList.reassign(savePath); util::copyDirListToMenu(saveList, saveMenu); @@ -1102,7 +1103,7 @@ namespace ui else if(saveSel > 1 && saveList.isDir(saveSel - 2)) { savePath += saveList.getItem(saveSel - 2) + "/"; - saveWrap = util::getWrappedString(savePath, 32, 600); + saveWrap = util::getWrappedString(savePath, 14, 600); saveList.reassign(savePath); util::copyDirListToMenu(saveList, saveMenu); @@ -1117,7 +1118,7 @@ namespace ui if(sdSel == 1 && sdPath != "sdmc:/") { util::removeLastFolderFromString(sdPath); - sdWrap = util::getWrappedString(sdPath, 32, 600); + sdWrap = util::getWrappedString(sdPath, 14, 600); sdList.reassign(sdPath); util::copyDirListToMenu(sdList, sdMenu); @@ -1125,7 +1126,7 @@ namespace ui else if(sdSel > 1 && sdList.isDir(sdSel - 2)) { sdPath += sdList.getItem(sdSel - 2) + "/"; - sdWrap = util::getWrappedString(sdPath, 32, 600); + sdWrap = util::getWrappedString(sdPath, 14, 600); sdList.reassign(sdPath); util::copyDirListToMenu(sdList, sdMenu); @@ -1145,7 +1146,7 @@ namespace ui if(advMenuCtrl == 0 && savePath != "sv:/") { util::removeLastFolderFromString(savePath); - saveWrap = util::getWrappedString(savePath, 32, 600); + saveWrap = util::getWrappedString(savePath, 14, 600); saveList.reassign(savePath); util::copyDirListToMenu(saveList, saveMenu); @@ -1154,7 +1155,7 @@ namespace ui else if(advMenuCtrl == 1 && sdPath != "sdmc:/") { util::removeLastFolderFromString(sdPath); - sdWrap = util::getWrappedString(sdPath, 32, 600); + sdWrap = util::getWrappedString(sdPath, 14, 600); sdList.reassign(sdPath); util::copyDirListToMenu(sdList, sdMenu); @@ -1195,11 +1196,11 @@ namespace ui switch(advPrev) { case 0: - gfx::drawText("SAVE", 472, 242, 32,txtClr); + gfx::drawText("SAVE", 472, 250, 18,txtClr); break; case 1: - gfx::drawText("SDMC", 472, 242, 32, txtClr); + gfx::drawText("SDMC", 472, 250, 18, txtClr); break; }