Restore color pulse, fix up zh-TW line breaking rules, fix load screen
4
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
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 110 KiB After Width: | Height: | Size: 110 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
|
@ -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
|
||||
|
|
|
|||
14
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;
|
||||
};
|
||||
|
||||
|
|
|
|||
1
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
|
||||
|
|
|
|||
|
|
@ -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, \
|
||||
|
|
|
|||
BIN
romfs/icon.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 4.7 KiB |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 4.7 KiB |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 4.7 KiB |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 4.7 KiB |
|
|
@ -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#的進度檔案!"
|
||||
|
|
|
|||
18
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");
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
17
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);
|
||||
|
|
|
|||
|
|
@ -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];
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||