Restore color pulse, fix up zh-TW line breaking rules, fix load screen

This commit is contained in:
J-D-K 2021-06-14 22:26:36 -04:00
parent cf8da7cb1c
commit b5037abd83
22 changed files with 79 additions and 35 deletions

View File

@ -38,9 +38,9 @@ INCLUDES := inc
EXEFS_SRC := exefs_src EXEFS_SRC := exefs_src
APP_TITLE := JKSV APP_TITLE := JKSV
APP_AUTHOR := JK APP_AUTHOR := JK
APP_VERSION := 06.02.2021 APP_VERSION := 06.14.2021
ROMFS := romfs ROMFS := romfs
ICON := romfs/icon.jpg ICON := icon.jpg
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# options for code generation # options for code generation

View File

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View File

Before

Width:  |  Height:  |  Size: 110 KiB

After

Width:  |  Height:  |  Size: 110 KiB

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -13,7 +13,7 @@
#define curData users[data::selUser].titles[data::selData] #define curData users[data::selUser].titles[data::selData]
#define BLD_MON 06 #define BLD_MON 06
#define BLD_DAY 02 #define BLD_DAY 14
#define BLD_YEAR 2021 #define BLD_YEAR 2021
namespace data namespace data
@ -123,6 +123,9 @@ namespace data
SDL_Texture *userIcon; SDL_Texture *userIcon;
}; };
//Gets total count of save containers
unsigned getTotalSaves();
//Adds title to blacklist //Adds title to blacklist
void blacklistAdd(data::titledata& t); void blacklistAdd(data::titledata& t);
//Adds title to favorite list //Adds title to favorite list

View File

@ -3,6 +3,7 @@
#include "gfx.h" #include "gfx.h"
#define PROG_MAX_WIDTH_DEFAULT 576
#define POP_FRAME_DEFAULT 130 #define POP_FRAME_DEFAULT 130
//For smaller classes that aren't easy to get lost in and general functions //For smaller classes that aren't easy to get lost in and general functions
@ -12,17 +13,26 @@ namespace ui
class progBar class progBar
{ {
public: public:
progBar() = default;
//Constructor. _max is the maximum value //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 //Updates progress
void update(const uint64_t& _prog); void update(const uint64_t& _prog);
void incProgress(unsigned inc){ prog += inc; }
//Draws with text at top //Draws with text at top
void draw(const std::string& text, const std::string& head); void draw(const std::string& text, const std::string& head);
//Draws without dialog box
void drawNoDialog(int x, int y);
private: private:
uint64_t max, prog; uint64_t max, prog, maxWidth;
float width; float width;
}; };

View File

@ -77,7 +77,6 @@ namespace ui
void init(); void init();
void exit(); void exit();
//Just draws a screen and flips JIC boot takes long.
void showLoadScreen(); void showLoadScreen();
//Clears and draws general stuff used by multiple screens //Clears and draws general stuff used by multiple screens

View File

@ -4,6 +4,8 @@
//Strings since translation support //Strings since translation support
namespace ui namespace ui
{ {
extern const std::string loadGlyphArray[8];
extern std::string author, userHelp, titleHelp, folderHelp, optHelp, \ extern std::string author, userHelp, titleHelp, folderHelp, optHelp, \
confBlacklist, confOverwrite, confRestore, confDel, confCopy, \ confBlacklist, confOverwrite, confRestore, confDel, confCopy, \
confEraseNand, confEraseFolder, yt, nt, on, off, confirmHead, \ confEraseNand, confEraseFolder, yt, nt, on, off, confirmHead, \

BIN
romfs/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

@ -33,25 +33,25 @@ confirmHead = "再次確認"
copyHead = "正在複製檔案..." copyHead = "正在複製檔案..."
#Confirm blacklist. #Confirm blacklist.
confirmBlacklist = "是否確定要將#%s#加入黑名單?" confirmBlacklist = "是否確定要將 #%s #加入黑名單?"
#Confirm overwriting folder #Confirm overwriting folder
confirmOverwrite = "是否確定要覆寫#%s#?" confirmOverwrite = "是否確定要覆寫 #%s#?"
#Confirm restoring save #Confirm restoring save
confirmRestore = "是否確定要還原#%s#?" confirmRestore = "是否確定要還原 #%s#?"
#Confirm deleting. #Confirm deleting.
confirmDelete = "是否確定要刪除#%s#? *此為永久性刪除*!" confirmDelete = "是否確定要刪除 #%s#? *此為永久性刪除*!"
#Confirm file copy in file mode #Confirm file copy in file mode
confirmCopy = "是否確定要將#%s#複製到#%s#?" confirmCopy = "是否確定要將 #%s# 複製到 #%s#?"
#Warning for erasing save data from system in title menu #Warning for erasing save data from system in title menu
confirmEraseNand = "*警告*: 此操作將把#%s#檔案從你的主機系統內*徹底抹除*!如同從#檔案管理器#內將進度檔案刪除!是否確定要繼續執行抹除?" confirmEraseNand = "*警告*: 此操作將把 #%s# 檔案從你的主機系統內*徹底抹除*! 如同從#檔案管理器#內將進度檔案刪除! 是否確定要繼續執行抹除?"
#Warning for deleting save data in folder menu #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 #Error displayed in pop-up if no titles are found for user. Rarely happens, but can for Device and BCAT
noSavesFound = "沒有找到#%s#的進度檔案!" noSavesFound = "沒有找到#%s#的進度檔案!"

View File

@ -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() void data::loadBlacklist()
{ {
fs::dataFile blk(fs::getWorkDir() + "blacklist.txt"); fs::dataFile blk(fs::getWorkDir() + "blacklist.txt");

View File

@ -371,7 +371,7 @@ void fs::copyFile(const std::string& from, const std::string& to)
copyArgs *send = copyArgsCreate(from, to, "", NULL, &progress); copyArgs *send = copyArgsCreate(from, to, "", NULL, &progress);
//Setup progress bar. This thread updates screen, other handles copying //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; Thread cpyThread;
threadCreate(&cpyThread, copyfile_t, send, NULL, 0x4000, 0x2B, 1); 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) void fs::copyFileCommit(const std::string& from, const std::string& to, const std::string& dev)
{ {
uint64_t offset = 0; 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); copyArgs *send = copyArgsCreate(from, to, dev, NULL, &offset);
Thread cpyThread; Thread cpyThread;
@ -515,7 +515,7 @@ void copyFileToZip_t(void *a)
void copyFileToZip(const std::string& from, zipFile *z) 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; uint64_t progress = 0;
copyArgs *send = copyArgsCreate(from, "", "", z, &progress); 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; std::string path = to + filename;
mkdirRec(path.substr(0, path.find_last_of('/') + 1)); 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; size_t done = 0;
//Create new empty file using FS //Create new empty file using FS

View File

@ -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 src = {0, 0, g->w, g->h};
SDL_Rect dst = {tmpX + g->left, y + (fontSize - g->top), 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); SDL_RenderCopy(render, g->tex, &src, &dst);
tmpX += g->advX; tmpX += g->advX;

View File

@ -42,7 +42,6 @@ SDL_Texture *mnuTopLeft, *mnuTopRight, *mnuBotLeft, *mnuBotRight;
SDL_Texture *ui::sideBar; SDL_Texture *ui::sideBar;
static SDL_Texture *icn; static SDL_Texture *icn;
static SDL_Color white = {0xFF, 0xFF, 0xFF, 0xFF};
//X position of help texts. Calculated to make editing quicker/easier //X position of help texts. Calculated to make editing quicker/easier
static unsigned userHelpX, titleHelpX, folderHelpX, optHelpX; static unsigned userHelpX, titleHelpX, folderHelpX, optHelpX;
@ -349,11 +348,10 @@ void ui::exit()
void ui::showLoadScreen() void ui::showLoadScreen()
{ {
SDL_Texture *icon = gfx::loadImageFile("romfs:/icon.jpg"); SDL_Texture *icon = gfx::loadImageFile("romfs:/icon.png");
SDL_SetRenderDrawColor(gfx::render, 0x2D, 0x2D, 0x2D, 0xFF); gfx::clear(&ui::clearClr);
SDL_RenderClear(gfx::render); gfx::texDraw(icon, 512, 226);
gfx::texDraw(icon, 512, 232); gfx::drawTextf(18, 1100, 673, &ui::txtCont, "Loading...");
gfx::drawTextf(16, 1100, 673, &white, "Loading...");
gfx::present(); gfx::present();
SDL_DestroyTexture(icon); 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); 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 //top
gfx::texDraw(mnuTopLeft, x, y); gfx::texDraw(mnuTopLeft, x, y);

View File

@ -27,19 +27,11 @@ enum popStates
popFall popFall
}; };
//8
static const std::string loadGlyphArray[] =
{
"\ue020", "\ue021", "\ue022", "\ue023",
"\ue024", "\ue025", "\ue026", "\ue027"
};
void ui::progBar::update(const uint64_t& _prog) void ui::progBar::update(const uint64_t& _prog)
{ {
prog = _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) 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()); 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, ...) void ui::showMessage(const char *head, const char *fmt, ...)
{ {
char tmp[1024]; char tmp[1024];

View File

@ -18,6 +18,8 @@ static bool clrAdd = true;
//Selected rectangle X and Y. //Selected rectangle X and Y.
static unsigned selRectX = 66, selRectY = 94; static unsigned selRectX = 66, selRectY = 94;
static SDL_Texture *panel;
static inline void reset() static inline void reset()
{ {
start = 0; start = 0;

View File

@ -2,6 +2,13 @@
#include "uistr.h" #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::author = "NULL";
std::string ui::userHelp = "[A] Select [Y] Dump All [X] UI Mode [R] Update [-] Options [ZR] Extras"; 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"; std::string ui::titleHelp = "[A] Select [L][R] Change User [Y] Dump All [X] Favorite [-] BlackList [ZR] Erase [B] Back";

View File

@ -105,7 +105,7 @@ void ui::updateUserMenu(const uint64_t& down, const uint64_t& held)
case HidNpadButton_StickLUp: case HidNpadButton_StickLUp:
case HidNpadButton_Up: case HidNpadButton_Up:
data::selUser - 5 < 0 ? data::selUser = 0 : data::selUser -= 4; data::selUser - 5 < 0 ? data::selUser = 0 : data::selUser -= 5;
break; break;
case HidNpadButton_StickLDown: case HidNpadButton_StickLDown: