diff --git a/Makefile b/Makefile index 268c994..13c1867 100644 --- a/Makefile +++ b/Makefile @@ -38,9 +38,9 @@ INCLUDES := inc EXEFS_SRC := exefs_src APP_TITLE := JKSV APP_AUTHOR := JK -APP_VERSION := 06.02.2021 +APP_VERSION := 06.14.2021 ROMFS := romfs -ICON := romfs/icon.jpg +ICON := icon.jpg #--------------------------------------------------------------------------------- # options for code generation diff --git a/romfs/icon.jpg b/icon.jpg similarity index 100% rename from romfs/icon.jpg rename to icon.jpg diff --git a/JKSV_icon.png b/iconAssets/JKSV_icon.png similarity index 100% rename from JKSV_icon.png rename to iconAssets/JKSV_icon.png diff --git a/JKSV_icon.svg b/iconAssets/JKSV_icon.svg similarity index 100% rename from JKSV_icon.svg rename to iconAssets/JKSV_icon.svg diff --git a/inc/data.h b/inc/data.h index 64719be..92d57c6 100644 --- a/inc/data.h +++ b/inc/data.h @@ -13,7 +13,7 @@ #define curData users[data::selUser].titles[data::selData] #define BLD_MON 06 -#define BLD_DAY 02 +#define BLD_DAY 14 #define BLD_YEAR 2021 namespace data @@ -123,6 +123,9 @@ namespace data SDL_Texture *userIcon; }; + //Gets total count of save containers + unsigned getTotalSaves(); + //Adds title to blacklist void blacklistAdd(data::titledata& t); //Adds title to favorite list diff --git a/inc/miscui.h b/inc/miscui.h index 5dca760..b134db7 100644 --- a/inc/miscui.h +++ b/inc/miscui.h @@ -3,6 +3,7 @@ #include "gfx.h" +#define PROG_MAX_WIDTH_DEFAULT 576 #define POP_FRAME_DEFAULT 130 //For smaller classes that aren't easy to get lost in and general functions @@ -12,17 +13,26 @@ namespace ui class progBar { public: + progBar() = default; + //Constructor. _max is the maximum value - progBar(const uint64_t& _max) { max = _max; } + progBar(const uint64_t& _max, const uint64_t& _maxWidth) { max = _max; maxWidth = _maxWidth; } + + void setMax(const uint64_t& _max, const uint64_t& _maxWidth){ max = _max; maxWidth = _maxWidth; } //Updates progress void update(const uint64_t& _prog); + void incProgress(unsigned inc){ prog += inc; } + //Draws with text at top void draw(const std::string& text, const std::string& head); + //Draws without dialog box + void drawNoDialog(int x, int y); + private: - uint64_t max, prog; + uint64_t max, prog, maxWidth; float width; }; diff --git a/inc/ui.h b/inc/ui.h index 2faea3d..86ef0af 100644 --- a/inc/ui.h +++ b/inc/ui.h @@ -77,7 +77,6 @@ namespace ui void init(); void exit(); - //Just draws a screen and flips JIC boot takes long. void showLoadScreen(); //Clears and draws general stuff used by multiple screens diff --git a/inc/uistr.h b/inc/uistr.h index 6ea67e2..5e040c9 100644 --- a/inc/uistr.h +++ b/inc/uistr.h @@ -4,6 +4,8 @@ //Strings since translation support namespace ui { + extern const std::string loadGlyphArray[8]; + extern std::string author, userHelp, titleHelp, folderHelp, optHelp, \ confBlacklist, confOverwrite, confRestore, confDel, confCopy, \ confEraseNand, confEraseFolder, yt, nt, on, off, confirmHead, \ diff --git a/romfs/icon.png b/romfs/icon.png new file mode 100644 index 0000000..fb07d76 Binary files /dev/null and b/romfs/icon.png differ diff --git a/romfs/img/fb/menuBotLeft.png b/romfs/img/fb/menuBotLeft.png index feafb8f..5caf702 100644 Binary files a/romfs/img/fb/menuBotLeft.png and b/romfs/img/fb/menuBotLeft.png differ diff --git a/romfs/img/fb/menuBotRight.png b/romfs/img/fb/menuBotRight.png index ac7a840..49f8f65 100644 Binary files a/romfs/img/fb/menuBotRight.png and b/romfs/img/fb/menuBotRight.png differ diff --git a/romfs/img/fb/menuTopLeft.png b/romfs/img/fb/menuTopLeft.png index 3162fa8..9088aa2 100644 Binary files a/romfs/img/fb/menuTopLeft.png and b/romfs/img/fb/menuTopLeft.png differ diff --git a/romfs/img/fb/menuTopRight.png b/romfs/img/fb/menuTopRight.png index 8246f0e..3cde9be 100644 Binary files a/romfs/img/fb/menuTopRight.png and b/romfs/img/fb/menuTopRight.png differ diff --git a/romfs/lang/zh-TW.txt b/romfs/lang/zh-TW.txt index 5720f18..54e8194 100644 --- a/romfs/lang/zh-TW.txt +++ b/romfs/lang/zh-TW.txt @@ -33,25 +33,25 @@ confirmHead = "再次確認" copyHead = "正在複製檔案..." #Confirm blacklist. -confirmBlacklist = "是否確定要將#%s#加入黑名單?" +confirmBlacklist = "是否確定要將 #%s #加入黑名單?" #Confirm overwriting folder -confirmOverwrite = "是否確定要覆寫#%s#?" +confirmOverwrite = "是否確定要覆寫 #%s#?" #Confirm restoring save -confirmRestore = "是否確定要還原#%s#?" +confirmRestore = "是否確定要還原 #%s#?" #Confirm deleting. -confirmDelete = "是否確定要刪除#%s#? *此為永久性刪除*!" +confirmDelete = "是否確定要刪除 #%s#? *此為永久性刪除*!" #Confirm file copy in file mode -confirmCopy = "是否確定要將#%s#複製到#%s#?" +confirmCopy = "是否確定要將 #%s# 複製到 #%s#?" #Warning for erasing save data from system in title menu -confirmEraseNand = "*警告*: 此操作將把#%s#檔案從你的主機系統內*徹底抹除*!如同從#檔案管理器#內將進度檔案刪除!是否確定要繼續執行抹除?" +confirmEraseNand = "*警告*: 此操作將把 #%s# 檔案從你的主機系統內*徹底抹除*! 如同從#檔案管理器#內將進度檔案刪除! 是否確定要繼續執行抹除?" #Warning for deleting save data in folder menu -confirmEraseFolder = "*警告*: 此操作*將把*目前的進度#%s#檔案*從主機系統內刪除*!是否確定要繼續執行刪除?" +confirmEraseFolder = "*警告*: 此操作*將把*目前的進度 #%s# 檔案*從主機系統內刪除*! 是否確定要繼續執行刪除?" #Error displayed in pop-up if no titles are found for user. Rarely happens, but can for Device and BCAT noSavesFound = "沒有找到#%s#的進度檔案!" diff --git a/src/data.cpp b/src/data.cpp index 1ebc59a..179c2cb 100644 --- a/src/data.cpp +++ b/src/data.cpp @@ -486,6 +486,24 @@ void data::user::loadPlayTimes() } } +unsigned data::getTotalSaves() +{ + unsigned ret = 0; + FsSaveDataInfoReader read; + FsSaveDataInfo tmp; + int64_t out = 0; + for(unsigned i = 0; i < 7; i++) + { + if(R_FAILED(fsOpenSaveDataInfoReader(&read, (FsSaveDataSpaceId)saveOrder[i]))) + continue; + + while(R_SUCCEEDED(fsSaveDataInfoReaderRead(&read, &tmp, 1, &out)) && out != 0) + ++ret; + } + fsSaveDataInfoReaderClose(&read); + return ret; +} + void data::loadBlacklist() { fs::dataFile blk(fs::getWorkDir() + "blacklist.txt"); diff --git a/src/file.cpp b/src/file.cpp index d17e9ad..7d36ebe 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -371,7 +371,7 @@ void fs::copyFile(const std::string& from, const std::string& to) copyArgs *send = copyArgsCreate(from, to, "", NULL, &progress); //Setup progress bar. This thread updates screen, other handles copying - ui::progBar prog(fsize(from)); + ui::progBar prog(fsize(from), PROG_MAX_WIDTH_DEFAULT); Thread cpyThread; threadCreate(&cpyThread, copyfile_t, send, NULL, 0x4000, 0x2B, 1); @@ -448,7 +448,7 @@ void copyFileCommit_t(void *a) void fs::copyFileCommit(const std::string& from, const std::string& to, const std::string& dev) { uint64_t offset = 0; - ui::progBar prog(fsize(from)); + ui::progBar prog(fsize(from), PROG_MAX_WIDTH_DEFAULT); copyArgs *send = copyArgsCreate(from, to, dev, NULL, &offset); Thread cpyThread; @@ -515,7 +515,7 @@ void copyFileToZip_t(void *a) void copyFileToZip(const std::string& from, zipFile *z) { - ui::progBar prog(fs::fsize(from)); + ui::progBar prog(fs::fsize(from), PROG_MAX_WIDTH_DEFAULT); uint64_t progress = 0; copyArgs *send = copyArgsCreate(from, "", "", z, &progress); @@ -571,7 +571,7 @@ void fs::copyZipToDir(unzFile *unz, const std::string& to, const std::string& de { std::string path = to + filename; mkdirRec(path.substr(0, path.find_last_of('/') + 1)); - ui::progBar prog(info.uncompressed_size); + ui::progBar prog(info.uncompressed_size, PROG_MAX_WIDTH_DEFAULT); size_t done = 0; //Create new empty file using FS diff --git a/src/gfx.cpp b/src/gfx.cpp index 730317b..ebf2af9 100644 --- a/src/gfx.cpp +++ b/src/gfx.cpp @@ -277,7 +277,7 @@ void gfx::drawTextf(int fontSize, int x, int y, const SDL_Color *c, const char * { SDL_Rect src = {0, 0, g->w, g->h}; SDL_Rect dst = {tmpX + g->left, y + (fontSize - g->top), g->w, g->h}; - SDL_SetTextureColorMod(g->tex, c->r, c->g, c->b); + SDL_SetTextureColorMod(g->tex, textcol->r, textcol->g, textcol->b); SDL_RenderCopy(render, g->tex, &src, &dst); tmpX += g->advX; diff --git a/src/ui.cpp b/src/ui.cpp index 4fa216a..b5c1d50 100644 --- a/src/ui.cpp +++ b/src/ui.cpp @@ -42,7 +42,6 @@ SDL_Texture *mnuTopLeft, *mnuTopRight, *mnuBotLeft, *mnuBotRight; SDL_Texture *ui::sideBar; static SDL_Texture *icn; -static SDL_Color white = {0xFF, 0xFF, 0xFF, 0xFF}; //X position of help texts. Calculated to make editing quicker/easier static unsigned userHelpX, titleHelpX, folderHelpX, optHelpX; @@ -349,11 +348,10 @@ void ui::exit() void ui::showLoadScreen() { - SDL_Texture *icon = gfx::loadImageFile("romfs:/icon.jpg"); - SDL_SetRenderDrawColor(gfx::render, 0x2D, 0x2D, 0x2D, 0xFF); - SDL_RenderClear(gfx::render); - gfx::texDraw(icon, 512, 232); - gfx::drawTextf(16, 1100, 673, &white, "Loading..."); + SDL_Texture *icon = gfx::loadImageFile("romfs:/icon.png"); + gfx::clear(&ui::clearClr); + gfx::texDraw(icon, 512, 226); + gfx::drawTextf(18, 1100, 673, &ui::txtCont, "Loading..."); gfx::present(); SDL_DestroyTexture(icon); } @@ -435,7 +433,12 @@ void ui::drawBoundBox(int x, int y, int w, int h, int clrSh) gfx::drawRect(&rectClr, x + 4, y + 4, w - 8, h - 8); - rectClr = {0x00, 0x88, 0xC5, 0xFF}; + rectClr = {0x00,(uint8_t)(0x88 + clrSh), (uint8_t)(0xC5 + (clrSh / 2)), 0xFF}; + + SDL_SetTextureColorMod(mnuTopLeft, rectClr.r, rectClr.g, rectClr.b); + SDL_SetTextureColorMod(mnuTopRight, rectClr.r, rectClr.g, rectClr.b); + SDL_SetTextureColorMod(mnuBotLeft, rectClr.r, rectClr.g, rectClr.b); + SDL_SetTextureColorMod(mnuBotRight, rectClr.r, rectClr.g, rectClr.b); //top gfx::texDraw(mnuTopLeft, x, y); diff --git a/src/ui/miscui.cpp b/src/ui/miscui.cpp index 16d57f9..6989d97 100644 --- a/src/ui/miscui.cpp +++ b/src/ui/miscui.cpp @@ -27,19 +27,11 @@ enum popStates popFall }; -//8 -static const std::string loadGlyphArray[] = -{ - "\ue020", "\ue021", "\ue022", "\ue023", - "\ue024", "\ue025", "\ue026", "\ue027" -}; - - void ui::progBar::update(const uint64_t& _prog) { prog = _prog; - width = (float)(((float)prog / (float)max) * 576); + width = (float)(((float)prog / (float)max) * (float)maxWidth); } void ui::progBar::draw(const std::string& text, const std::string& head) @@ -59,6 +51,14 @@ void ui::progBar::draw(const std::string& text, const std::string& head) gfx::drawTextfWrap(16, 352, 230, 576, &ui::txtDiag, text.c_str()); } +void ui::progBar::drawNoDialog(int x, int y) +{ + gfx::drawRect(&fillBack, x, y, maxWidth, 12); + gfx::drawRect(ui::thmID == ColorSetId_Light ? &fillLight : &fillDark, x, y, width, 12); + gfx::texDraw(ui::progCovLeft, x, y); + gfx::texDraw(ui::progCovRight, x + maxWidth - 8, y); +} + void ui::showMessage(const char *head, const char *fmt, ...) { char tmp[1024]; diff --git a/src/ui/ttlsel.cpp b/src/ui/ttlsel.cpp index 0afc8ee..3816396 100644 --- a/src/ui/ttlsel.cpp +++ b/src/ui/ttlsel.cpp @@ -18,6 +18,8 @@ static bool clrAdd = true; //Selected rectangle X and Y. static unsigned selRectX = 66, selRectY = 94; +static SDL_Texture *panel; + static inline void reset() { start = 0; diff --git a/src/ui/uistr.cpp b/src/ui/uistr.cpp index ec03ea6..a03f19b 100644 --- a/src/ui/uistr.cpp +++ b/src/ui/uistr.cpp @@ -2,6 +2,13 @@ #include "uistr.h" +//8 +const std::string ui::loadGlyphArray[8] = +{ + "\ue020", "\ue021", "\ue022", "\ue023", + "\ue024", "\ue025", "\ue026", "\ue027" +}; + std::string ui::author = "NULL"; std::string ui::userHelp = "[A] Select [Y] Dump All [X] UI Mode [R] Update [-] Options [ZR] Extras"; std::string ui::titleHelp = "[A] Select [L][R] Change User [Y] Dump All [X] Favorite [-] BlackList [ZR] Erase [B] Back"; diff --git a/src/ui/usrsel.cpp b/src/ui/usrsel.cpp index 3211dae..25e6f67 100644 --- a/src/ui/usrsel.cpp +++ b/src/ui/usrsel.cpp @@ -105,7 +105,7 @@ void ui::updateUserMenu(const uint64_t& down, const uint64_t& held) case HidNpadButton_StickLUp: case HidNpadButton_Up: - data::selUser - 5 < 0 ? data::selUser = 0 : data::selUser -= 4; + data::selUser - 5 < 0 ? data::selUser = 0 : data::selUser -= 5; break; case HidNpadButton_StickLDown: