Revise stuff

This commit is contained in:
J-D-K 2020-06-13 14:13:00 -04:00
parent fa257562f4
commit 2918aedff9
15 changed files with 208 additions and 195 deletions

View File

@ -38,7 +38,7 @@ INCLUDES := inc
EXEFS_SRC := exefs_src
APP_TITLE := JKSV
APP_AUTHOR := JK
APP_VERSION := 06.07.2020
APP_VERSION := 06.10.2020
ROMFS := romfs
ICON := romfs/icon.jpg

View File

@ -26,6 +26,7 @@ namespace data
void loadFav();
void saveFav();
void loadDefs();
void exportIcons();
//Draws some stats to the upper left corner
void dispStats();

View File

@ -19,7 +19,7 @@ namespace fs
//Mounts usr's save data for open. Returns false it fails
bool mountSave(const data::user& usr, const data::titledata& open);
inline bool unmountSave(){ return fsdevUnmountDevice("sv") == 0; }
inline bool unmountSave() { return fsdevUnmountDevice("sv") == 0; }
void copyFile(const std::string& from, const std::string& to);
void copyFileCommit(const std::string& from, const std::string& to, const std::string& dev);
@ -41,6 +41,12 @@ namespace fs
//Recursively deletes 'path'
void delDir(const std::string& path);
inline void wipeSave()
{
fs::delDir("sv:/");
fsdevCommitDevice("sv");
}
//Dumps all titles for 'user'. returns false to bail
bool dumpAllUserSaves(const data::user& u);
@ -64,6 +70,7 @@ namespace fs
public:
dirItem(const std::string& pathTo, const std::string& sItem);
std::string getItm() const { return itm; }
std::string getExt() const;
bool isDir() const { return dir; }
private:
@ -81,6 +88,7 @@ namespace fs
void rescan();
std::string getItem(int index) const { return item[index].getItm(); }
std::string getItemExt(int index) const { return item[index].getExt(); }
bool isDir(int index) const { return item[index].isDir(); }
unsigned getCount() const { return item.size(); }

View File

@ -5,6 +5,7 @@
#include <string>
#include "data.h"
#include "uistr.h"
#include "gfx.h"
//ui headers - split up to keep a bit more organized
@ -34,29 +35,18 @@ namespace ui
//Current menu/ui state
extern int mstate, prevState;
inline void changeState(int newState)
{
prevState = mstate;
mstate = newState;
}
//Holds theme set id
extern ColorSetId thmID;
//Both UI modes need access to thi
extern std::string folderMenuInfo;
//Strings since translation support
extern std::string userHelp, titleHelp, folderHelp, optHelp, \
confBlacklist, confOverwrite, confRestore, confDel, confCopy, \
confEraseNand, confEraseFolder, yt, nt, on, off, confirmHead, \
copyHead, noSavesFound;
//Strings for file mode menu
extern std::string advMenuStr[6];
//Strings for extras menu
extern std::string exMenuStr[11];
//Strings for options menu
extern std::string optMenuStr[13];
//Strings for options explanations
extern std::string optMenuExp[13];
//Strings for the holding thing
extern std::string holdingText[3];
/*Colors
clearClr = color to clear buffer
txtCont = text that contrasts clearClr

24
inc/uistr.h Normal file
View File

@ -0,0 +1,24 @@
#ifndef UISTR_H
#define UISTR_H
//Strings since translation support
namespace ui
{
extern std::string author, userHelp, titleHelp, folderHelp, optHelp, \
confBlacklist, confOverwrite, confRestore, confDel, confCopy, \
confEraseNand, confEraseFolder, yt, nt, on, off, confirmHead, \
copyHead, noSavesFound;
//Strings for file mode menu
extern std::string advMenuStr[6];
//Strings for extras menu
extern std::string exMenuStr[11];
//Strings for options menu
extern std::string optMenuStr[13];
//Strings for options explanations
extern std::string optMenuExp[13];
//Strings for the holding thing
extern std::string holdingText[3];
}
#endif // UISTR_H

View File

@ -1,42 +0,0 @@
#ifndef UISTRMAP_H
#define UISTRMAP_H
#include <unordered_map>
//This is only included in UI so I don't have a nasty if else if else if else if else if
//Might be a shitty way to pull this off, but meh
static std::unordered_map<std::string, unsigned> uistrdef;
inline void transLoadInit()
{
uistrdef["author"] = 0;
uistrdef["userHelp"] = 1;
uistrdef["titleHelp"] = 2;
uistrdef["folderHelp"] = 3;
uistrdef["optHelp"] = 4;
uistrdef["yt"] = 5;
uistrdef["nt"] = 6;
uistrdef["on"] = 7;
uistrdef["off"] = 8;
uistrdef["confirmBlacklist"] = 9;
uistrdef["confirmOverwrite"] = 10;
uistrdef["confirmRestore"] = 11;
uistrdef["confirmDelete"] = 12;
uistrdef["confirmCopy"] = 13;
uistrdef["confirmEraseNand"] = 14;
uistrdef["confirmEraseFolder"] = 15;
uistrdef["confirmHead"] = 16;
uistrdef["copyHead"] = 17;
uistrdef["noSavesFound"] = 18;
uistrdef["advMenu"] = 19;
uistrdef["extMenu"] = 20;
uistrdef["optMenu"] = 21;
uistrdef["optMenuExp"] = 22;
uistrdef["holdingText"] = 23;
}
inline void transLoadExit()
{
uistrdef.clear();
}
#endif

View File

@ -23,6 +23,8 @@ SetLanguage data::sysLang;
bool data::incDev = false, data::autoBack = true, data::ovrClk = false, data::holdDel = true, data::holdRest = true, data::holdOver = true;
bool data::forceMount = true, data::accSysSave = false, data::sysSaveWrite = false, data::directFsCmd = false, data::skipUser = false, data::zip = false;
bool dumpIcn = false;
//For other save types
static bool sysBCATPushed = false, cachePushed = false, tempPushed = false;
@ -106,6 +108,15 @@ static inline tex *createFavIcon(const tex *_icn)
static inline void loadCreateIcon(const uint64_t& _id, size_t _sz, const NsApplicationControlData *_d)
{
if(dumpIcn)
{
char path[FS_MAX_PATH];
sprintf(path, "%s/icons/%016lX.jpg", fs::getWorkDir().c_str(), _id);
FILE *jpegOut = fopen(path, "wb");
fwrite(_d->icon, 1, _sz, jpegOut);
fclose(jpegOut);
}
icons[_id].first = texLoadJPEGMem(_d->icon, _sz);
icons[_id].second = createFavIcon(icons[_id].first);
}
@ -494,6 +505,7 @@ void data::loadCfg()
data::directFsCmd = cfgIn >> 53 & 1;
data::skipUser = cfgIn >> 52 & 1;
data::zip = cfgIn >> 51 & 1;
dumpIcn = cfgIn >> 50 & 1;
}
}
@ -517,6 +529,7 @@ void data::saveCfg()
cfgOut |= (uint64_t)data::directFsCmd << 53;
cfgOut |= (uint64_t)data::skipUser << 52;
cfgOut |= (uint64_t)data::zip << 51;
cfgOut |= (uint64_t)0 << 50;
fwrite(&cfgOut, sizeof(uint64_t), 1, cfg);
fclose(cfg);

View File

@ -128,6 +128,14 @@ fs::dirItem::dirItem(const std::string& pathTo, const std::string& sItem)
dir = true;
}
std::string fs::dirItem::getExt() const
{
size_t extPos = itm.find_last_of('.');
if(extPos == itm.npos)
return "";//Folder or no extension
return itm.substr(extPos + 1, itm.npos);
}
fs::dirList::dirList(const std::string& _path)
{
path = _path;
@ -251,6 +259,12 @@ void fs::copyFile(const std::string& from, const std::string& to)
{
FSFILE *in = fsfopen(from.c_str(), FsOpenMode_Read);
FSFILE *out = fsfopen(to.c_str(), FsOpenMode_Write);
if(!in || !out)
{
fsfclose(in);
fsfclose(out);
return;
}
size_t readIn = 0;
while((readIn = fsfread(buff, 1, BUFF_SIZE, in)) > 0)
@ -269,6 +283,12 @@ void fs::copyFile(const std::string& from, const std::string& to)
{
FILE *in = fopen(from.c_str(), "rb");
FILE *out = fopen(to.c_str(), "wb");
if(!in || !out)
{
fclose(in);
fclose(out);
return;
}
size_t readIn = 0;
while((readIn = fread(buff, 1, BUFF_SIZE, in)) > 0)
@ -302,9 +322,8 @@ void fs::copyDirToDir(const std::string& from, const std::string& to)
if(list.isDir(i))
{
std::string newFrom = from + list.getItem(i) + "/";
std::string newTo = to + list.getItem(i);
mkdir(newTo.c_str(), 0777);
newTo += "/";
std::string newTo = to + list.getItem(i) + "/";
mkdir(newTo.substr(0, newTo.length() - 1).c_str(), 0777);
copyDirToDir(newFrom, newTo);
}
@ -547,7 +566,7 @@ void fs::getDirProps(const std::string& _path, uint32_t& dirCount, uint32_t& fil
{
if(list.isDir(i))
{
dirCount++;
++dirCount;
std::string newPath = _path + list.getItem(i) + "/";
uint32_t dirAdd = 0, fileAdd = 0;
uint64_t sizeAdd = 0;
@ -559,7 +578,7 @@ void fs::getDirProps(const std::string& _path, uint32_t& dirCount, uint32_t& fil
}
else
{
fileCount++;
++fileCount;
std::string filePath = _path + list.getItem(i);
FILE *gSize = fopen(filePath.c_str(), "rb");
@ -592,7 +611,6 @@ size_t fs::fsize(const std::string& _f)
{
fseek(get, 0, SEEK_END);
ret = ftell(get);
fseek(get, 0, SEEK_SET);
}
fclose(get);
return ret;

View File

@ -1,5 +1,5 @@
#include <string>
#include <vector>
#include <unordered_map>
#include <cstdio>
#include <cstring>
#include <sys/stat.h>
@ -10,10 +10,7 @@
#include "util.h"
#include "file.h"
//for ui translation loading
#include "uistrmap.h"
#define VER_STRING "v. 06.07.2020"
#define VER_STRING "v. 06.10.2020"
//text mode
bool ui::textMode = false;
@ -50,49 +47,19 @@ font *ui::shared;
//guide graphics are to save cpu drawing that over and over with alpha
static tex *top, *bot, *usrGuide, *ttlGuide, *fldrGuide, *optGuide;
//UI text strings
//Freedom English stored by default
std::string author = "NULL";
std::string ui::userHelp = "[A] Select [Y] Dump All [X] UI Mode [-] 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::folderHelp = "[-] File Mode [L]/[R]+[A] Auto [A] Backup [Y] Restore [X] Delete Selected [ZR] Erase [B] Back";
std::string ui::optHelp = "[A] Toggle [X] Defaults [B] Back";
std::string ui::yt = "Yes [A]", ui::nt = "No [B]";
std::string ui::on = ">On>", ui::off = "Off";
std::string ui::confBlacklist = "Are you sure you want to add #%s# to your blacklist?";
std::string ui::confOverwrite = "Are you sure you want to overwrite #%s#?";
std::string ui::confRestore = "Are you sure you want to restore #%s#?";
std::string ui::confDel = "Are you sure you want to delete #%s#? *This is permanent*!";
std::string ui::confCopy = "Are you sure you want to copy #%s# to #%s#?";
std::string ui::confirmHead = "Confirm";
std::string ui::copyHead = "Copying File...";
std::string ui::confEraseNand = "*WARNING*: This *will* erase the save data for #%s# *from your system*. This is the same as deleting it from #Data Management#! Are you sure you want to continue?";
std::string ui::confEraseFolder = "*WARNING*: This *will* delete the current save data for #%s# *from your system*! Are you sure you want to continue?";
std::string ui::noSavesFound = "No saves found for #%s#!";
std::string ui::advMenuStr[6] = { "Copy to ", "Delete", "Rename", "Make Dir", "Properties", "Close" };
std::string ui::exMenuStr[11] = { "SD to SD Browser", "BIS: PRODINFOF", "BIS: SAFE", "BIS: SYSTEM", "BIS: USER", "Remove Update", "Terminate Process", "Mount System Save", "Rescan Titles", "Mount Process RomFS", "Backup JKSV Folder" };
std::string ui::optMenuStr[13] = { "Include Dev Sv: ", "AutoBackup: ", "Overclock: ", "Hold to Delete: ", "Hold to Restore: ", "Hold to Overwrite: ", "Force Mount: ", "Account Sys. Saves: ", "Write to Sys. Saves: ", "Text UI Mode: ", "Direct FS Cmd: ", "Skip User Select: ", "Export to ZIP: " };
std::string ui::optMenuExp[13] =
{
"Includes Device Save data in user accounts.",
"Automatically creates a save backup before restoring a save.",
"Applies a small CPU over clock to 1224Mhz at boot. This is the same speed developer units run at.",
"Whether or not holding [A] is required when deleting folders and files.",
"Whether or not holding [A] is required when restoring save data.",
"Whether or not holding [A] is required when overwriting saves on SD.",
"When enabled, JKSV will only load and show save data that can be opened. When disabled, everything found will be shown.",
"When enabled, system save data tied to accounts will be shown.",
"Controls whether system save data and partitions can have files and data written and deleted from them. *This can be extremely dangerous if you don't know what you're doing!*",
"Changes the UI to be text menu based like the original JKSM for 3DS.",
"Directly uses the Switch's FS commands to copy files instead of stdio.",
"Skips the user selection screen and jumps directly to the first user account found.",
"Exports saves to ZIP files."
};
std::string ui::holdingText[3] = { "(Hold) ", "(Keep Holding) ", "(Almost there!) " };
//X position of help texts. Calculated to make editing quicker/easier
static unsigned userHelpX, titleHelpX, folderHelpX, optHelpX;
//Map to associate external string names to unsigned ints for switch case.
static std::unordered_map<std::string, unsigned> uistrdef =
{
{"author", 0}, {"userHelp", 1}, {"titleHelp", 2}, {"folderHelp", 3}, {"optHelp", 4},
{"yt", 5}, {"nt", 6}, {"on", 7}, {"off", 8}, {"confirmBlacklist", 9}, {"confirmOverwrite", 10},
{"confirmRestore", 11}, {"confirmDelete", 12}, {"confirmCopy", 13}, {"confirmEraseNand", 14},
{"confirmEraseFolder", 15}, {"confirmHead", 16}, {"copyHead", 17}, {"noSavesFound", 18},
{"advMenu", 19}, {"extMenu", 20}, {"optMenu", 21}, {"optMenuExp", 22}, {"holdingText", 23}
};
static void loadTrans()
{
bool transFile = fs::fileExists(fs::getWorkDir() + "trans.txt");
@ -123,14 +90,13 @@ static void loadTrans()
}
}
transLoadInit();
fs::dataFile lang(file);
while(lang.readNextLine(true))
{
switch(uistrdef[lang.getName()])
{
case 0:
author = lang.getNextValueStr();
ui::author = lang.getNextValueStr();
break;
case 1:
@ -245,7 +211,6 @@ static void loadTrans()
break;
}
}
transLoadExit();
}
void ui::initTheme()

View File

@ -482,23 +482,24 @@ void ui::updateAdvMode(const uint64_t& down, const uint64_t& held)
else if(down & KEY_ZL || down & KEY_ZR)
{
if(advMenuCtrl == 0 || advMenuCtrl == 1)
{
if(advMenuCtrl == 0)
advMenuCtrl = 1;
else
advMenuCtrl = 0;
}
advMenuCtrl = advMenuCtrl == 0 ? 1 : 0;
}
else if(down & KEY_MINUS)
{
if(prevState == EX_MNU)
mstate = EX_MNU;
else if(prevState == TTL_SEL)
mstate = TTL_SEL;
else if(ui::textMode)
mstate = TXT_FLD;
else
mstate = FLD_SEL;
switch(prevState)
{
case EX_MNU:
mstate = EX_MNU;
break;
case TTL_SEL:
mstate = TTL_SEL;
break;
default:
mstate = ui::textMode ? TXT_FLD : FLD_SEL;
break;
}
}
//draw copy menu if it's supposed to be up

View File

@ -53,18 +53,24 @@ void ui::createNewBackup(const uint64_t& held)
if(!out.empty())
{
std::string path = data::curData.getPath() + "/" + out;
if(data::zip)
switch(data::zip)
{
path += ".zip";
zipFile zip = zipOpen(path.c_str(), 0);
fs::copyDirToZip("sv:/", &zip);
zipClose(zip, NULL);
}
else
{
mkdir(path.c_str(), 777);
path += "/";
fs::copyDirToDir("sv:/", path);
case true:
{
path += ".zip";
zipFile zip = zipOpen(path.c_str(), 0);
fs::copyDirToZip("sv:/", &zip);
zipClose(zip, NULL);
}
break;
case false:
{
mkdir(path.c_str(), 777);
path += "/";
fs::copyDirToDir("sv:/", path);
}
break;
}
folderMenuPrepare(data::curUser, data::curData);
}
@ -83,7 +89,7 @@ void ui::overwriteBackup(unsigned ind)
mkdir(toPath.c_str(), 777);
fs::copyDirToDir("sv:/", toPath);
}
else
else if(!fldList.isDir(ind) && fldList.getItemExt(ind) == "zip")
{
std::string toPath = data::curData.getPath() + itemName;
fs::delfile(toPath);
@ -96,8 +102,8 @@ void ui::overwriteBackup(unsigned ind)
void ui::restoreBackup(unsigned ind)
{
std::string folderName = fldList.getItem(ind);
if((data::curData.getType() != FsSaveDataType_System || data::sysSaveWrite) && folderMenu.getSelected() > 0 && confirm(data::holdRest, ui::confRestore.c_str(), folderName.c_str()))
std::string itemName = fldList.getItem(ind);
if((data::curData.getType() != FsSaveDataType_System || data::sysSaveWrite) && folderMenu.getSelected() > 0 && confirm(data::holdRest, ui::confRestore.c_str(), itemName.c_str()))
{
if(data::autoBack)
{
@ -114,29 +120,34 @@ void ui::restoreBackup(unsigned ind)
case false:
{
std::string autoFolder = data::curData.getPath() + "/AUTO - " + data::curUser.getUsernameSafe() + " - " + util::getDateTime(util::DATE_FMT_YMD);
mkdir(autoFolder.c_str(), 777);
autoFolder += "/";
std::string autoFolder = data::curData.getPath() + "/AUTO - " + data::curUser.getUsernameSafe() + " - " + util::getDateTime(util::DATE_FMT_YMD) + "/";
mkdir(autoFolder.substr(0, autoFolder.length() - 1).c_str(), 777);
fs::copyDirToDir("sv:/", autoFolder);
}
break;
}
}
fs::delDir("sv:/");
fsdevCommitDevice("sv");
if(!fldList.isDir(ind))
if(fldList.isDir(ind))
{
std::string path = data::curData.getPath() + fldList.getItem(ind);
fs::wipeSave();
std::string fromPath = data::curData.getPath() + itemName + "/";
fs::copyDirToDirCommit(fromPath, "sv:/", "sv");
}
else if(!fldList.isDir(ind) && fldList.getItemExt(ind) == "zip")
{
fs::wipeSave();
std::string path = data::curData.getPath() + itemName;
unzFile unz = unzOpen(path.c_str());
fs::copyZipToDir(&unz, "sv:/", "sv");
unzClose(unz);
}
else
{
std::string fromPath = data::curData.getPath() + folderName + "/";
fs::copyDirToDirCommit(fromPath, "sv:/", "sv");
//Just copy file over
std::string fromPath = data::curData.getPath() + itemName;
std::string toPath = "sv:/" + itemName;
fs::copyFileCommit(fromPath, toPath, "sv");
}
}
if(data::autoBack)
@ -186,7 +197,7 @@ void ui::updateFolderMenu(const uint64_t& down, const uint64_t& held)
else if(down & KEY_MINUS)
{
advModePrep("sv:/", data::curData.getType(), true);
mstate = ADV_MDE;
ui::changeState(ADV_MDE);
}
else if(down & KEY_ZR && data::curData.getType() != FsSaveDataType_System && confirm(true, ui::confEraseFolder.c_str(), data::curData.getTitle().c_str()))
{
@ -196,7 +207,7 @@ void ui::updateFolderMenu(const uint64_t& down, const uint64_t& held)
else if(down & KEY_B)
{
fs::unmountSave();
mstate = TTL_SEL;
ui::changeState(TTL_SEL);
}
}

View File

@ -120,7 +120,7 @@ void ui::updateTitleMenu(const uint64_t& down, const uint64_t& held)
//Wanna change this sometime
ui::folderMenuInfo = util::getInfoString(data::curUser, data::curData);
mstate = FLD_SEL;
ui::changeState(FLD_SEL);
}
else if(down & KEY_Y)
fs::dumpAllUserSaves(data::curUser);
@ -132,7 +132,7 @@ void ui::updateTitleMenu(const uint64_t& down, const uint64_t& held)
else if(down & KEY_B)
{
reset();
mstate = USR_SEL;
ui::changeState(USR_SEL);
return;
}
else if(down & KEY_L)

View File

@ -58,7 +58,7 @@ void ui::textUserMenuUpdate(const uint64_t& down, const uint64_t& held)
if(data::curUser.titles.size() > 0)
{
textTitlePrep(data::curUser);
mstate = TXT_TTL;
ui::changeState(TXT_TTL);
}
else
ui::showPopup(POP_FRAME_DEFAULT, ui::noSavesFound.c_str(), data::curUser.getUsername().c_str());
@ -71,16 +71,16 @@ void ui::textUserMenuUpdate(const uint64_t& down, const uint64_t& held)
else if(down & KEY_X)
{
ui::textMode = false;
mstate = USR_SEL;
ui::changeState(USR_SEL);
}
else if(down & KEY_ZR)
{
fs::unmountSave();
ui::exMenuPrep();
ui::mstate = EX_MNU;
ui::changeState(EX_MNU);
}
else if(down & KEY_MINUS)
ui::mstate = OPT_MNU;
ui::changeState(OPT_MNU);
}
void ui::textTitleMenuUpdate(const uint64_t& down, const uint64_t& held)
@ -95,7 +95,7 @@ void ui::textTitleMenuUpdate(const uint64_t& down, const uint64_t& held)
if(fs::mountSave(data::curUser, data::curData))
{
folderMenuPrepare(data::curUser, data::curData);
mstate = TXT_FLD;
ui::changeState(TXT_FLD);
}
}
else if(down & KEY_Y)
@ -142,7 +142,7 @@ void ui::textTitleMenuUpdate(const uint64_t& down, const uint64_t& held)
else if(down & KEY_B)
{
data::selData = 0;
mstate = TXT_USR;
ui::changeState(TXT_USR);
}
}
@ -166,7 +166,7 @@ void ui::textFolderMenuUpdate(const uint64_t& down, const uint64_t& held)
else if(down & KEY_MINUS)
{
advModePrep("sv:/", data::curData.getType(), true);
mstate = ADV_MDE;
ui::changeState(ADV_MDE);
}
else if(down & KEY_ZR && data::curData.getType() != FsSaveDataType_System && confirm(true, ui::confEraseFolder.c_str(), data::curData.getTitle().c_str()))
{
@ -176,7 +176,7 @@ void ui::textFolderMenuUpdate(const uint64_t& down, const uint64_t& held)
else if(down & KEY_B)
{
fsdevUnmountDevice("sv");
mstate = TXT_TTL;
ui::changeState(TXT_TTL);
}
}
@ -202,45 +202,36 @@ void ui::updateExMenu(const uint64_t& down, const uint64_t& held)
case 0:
data::curData.setType(FsSaveDataType_Bcat);
advModePrep("sdmc:/", data::curData.getType(), false);
mstate = ADV_MDE;
prevState = EX_MNU;
ui::changeState(ADV_MDE);
break;
case 1:
fsdevUnmountDevice("sv");
fsOpenBisFileSystem(&sv, FsBisPartitionId_CalibrationFile, "");
fsdevMountDevice("prodInfo-f", sv);
advModePrep("profInfo-f:/", FsSaveDataType_System, false);
mstate = ADV_MDE;
prevState = EX_MNU;
ui::changeState(ADV_MDE);
break;
case 2:
fsOpenBisFileSystem(&sv, FsBisPartitionId_SafeMode, "");
fsdevMountDevice("safe", sv);
advModePrep("safe:/", FsSaveDataType_System, false);
mstate = ADV_MDE;
prevState = EX_MNU;
ui::changeState(ADV_MDE);
break;
case 3:
fsOpenBisFileSystem(&sv, FsBisPartitionId_System, "");
fsdevMountDevice("sys", sv);
advModePrep("sys:/", FsSaveDataType_System, false);
mstate = ADV_MDE;
prevState = EX_MNU;
ui::changeState(ADV_MDE);
break;
case 4:
fsOpenBisFileSystem(&sv, FsBisPartitionId_User, "");
fsdevMountDevice("user", sv);
advModePrep("user:/", FsSaveDataType_System, false);
mstate = ADV_MDE;
prevState = EX_MNU;
ui::changeState(ADV_MDE);
break;
case 5:
@ -285,8 +276,7 @@ void ui::updateExMenu(const uint64_t& down, const uint64_t& held)
{
fsdevMountDevice("sv", sv);
advModePrep("sv:/", data::curData.getType(), true);
prevState = EX_MNU;
mstate = ADV_MDE;
ui::changeState(ADV_MDE);
}
}
break;
@ -303,8 +293,7 @@ void ui::updateExMenu(const uint64_t& down, const uint64_t& held)
{
fsdevMountDevice("tromfs", tromfs);
advModePrep("tromfs:/", FsSaveDataType_Account, false);
ui::mstate = ADV_MDE;
ui::prevState = EX_MNU;
ui::changeState(ADV_MDE);
}
}
break;
@ -326,11 +315,7 @@ void ui::updateExMenu(const uint64_t& down, const uint64_t& held)
else if(down & KEY_B)
{
fsdevUnmountDevice("sv");
if(ui::textMode)
mstate = TXT_USR;
else
mstate = USR_SEL;
ui::changeState(ui::textMode ? TXT_USR : USR_SEL);
prevState = USR_SEL;
}
@ -423,7 +408,7 @@ void ui::updateOptMenu(const uint64_t& down, const uint64_t& held)
else if(down & KEY_X)
data::restoreDefaultConfig();
else if(down & KEY_B)
ui::mstate = ui::textMode ? TXT_USR : USR_SEL;
ui::changeState(ui::textMode ? TXT_USR : USR_SEL);
optMenu.draw(ui::txtCont);
drawTextWrap(ui::optMenuExp[optMenu.getSelected()].c_str(), frameBuffer, ui::shared, 466, 98, 18, ui::txtCont, 730);

41
src/ui/uistr.cpp Normal file
View File

@ -0,0 +1,41 @@
#include <string>
#include "uistr.h"
std::string ui::author = "NULL";
std::string ui::userHelp = "[A] Select [Y] Dump All [X] UI Mode [-] 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::folderHelp = "[-] File Mode [L]/[R]+[A] Auto [A] Backup [Y] Restore [X] Delete Selected [ZR] Erase [B] Back";
std::string ui::optHelp = "[A] Toggle [X] Defaults [B] Back";
std::string ui::yt = "Yes [A]", ui::nt = "No [B]";
std::string ui::on = ">On>", ui::off = "Off";
std::string ui::confBlacklist = "Are you sure you want to add #%s# to your blacklist?";
std::string ui::confOverwrite = "Are you sure you want to overwrite #%s#?";
std::string ui::confRestore = "Are you sure you want to restore #%s#?";
std::string ui::confDel = "Are you sure you want to delete #%s#? *This is permanent*!";
std::string ui::confCopy = "Are you sure you want to copy #%s# to #%s#?";
std::string ui::confirmHead = "Confirm";
std::string ui::copyHead = "Copying File...";
std::string ui::confEraseNand = "*WARNING*: This *will* erase the save data for #%s# *from your system*. This is the same as deleting it from #Data Management#! Are you sure you want to continue?";
std::string ui::confEraseFolder = "*WARNING*: This *will* delete the current save data for #%s# *from your system*! Are you sure you want to continue?";
std::string ui::noSavesFound = "No saves found for #%s#!";
std::string ui::advMenuStr[6] = { "Copy to ", "Delete", "Rename", "Make Dir", "Properties", "Close" };
std::string ui::exMenuStr[11] = { "SD to SD Browser", "BIS: PRODINFOF", "BIS: SAFE", "BIS: SYSTEM", "BIS: USER", "Remove Update", "Terminate Process", "Mount System Save", "Rescan Titles", "Mount Process RomFS", "Backup JKSV Folder" };
std::string ui::optMenuStr[13] = { "Include Dev Sv: ", "AutoBackup: ", "Overclock: ", "Hold to Delete: ", "Hold to Restore: ", "Hold to Overwrite: ", "Force Mount: ", "Account Sys. Saves: ", "Write to Sys. Saves: ", "Text UI Mode: ", "Direct FS Cmd: ", "Skip User Select: ", "Export to ZIP: " };
std::string ui::optMenuExp[13] =
{
"Includes Device Save data in user accounts.",
"Automatically creates a save backup before restoring a save.",
"Applies a small CPU over clock to 1224Mhz at boot. This is the same speed developer units run at.",
"Whether or not holding [A] is required when deleting folders and files.",
"Whether or not holding [A] is required when restoring save data.",
"Whether or not holding [A] is required when overwriting saves on SD.",
"When enabled, JKSV will only load and show save data that can be opened. When disabled, everything found will be shown.",
"When enabled, system save data tied to accounts will be shown.",
"Controls whether system save data and partitions can have files and data written and deleted from them. *This can be extremely dangerous if you don't know what you're doing!*",
"Changes the UI to be text menu based like the original JKSM for 3DS.",
"Directly uses the Switch's FS commands to copy files instead of stdio.",
"Skips the user selection screen and jumps directly to the first user account found.",
"Exports saves to ZIP files."
};
std::string ui::holdingText[3] = { "(Hold) ", "(Keep Holding) ", "(Almost there!) " };

View File

@ -81,7 +81,7 @@ void ui::updateUserMenu(const uint64_t& down, const uint64_t& held)
else if(down & KEY_A)
{
if(data::users[data::selUser].titles.size() > 0)
mstate = TTL_SEL;
ui::changeState(TTL_SEL);
else
ui::showPopup(POP_FRAME_DEFAULT, ui::noSavesFound.c_str(), data::curUser.getUsername().c_str());
}
@ -97,16 +97,14 @@ void ui::updateUserMenu(const uint64_t& down, const uint64_t& held)
else if(down & KEY_X)
{
ui::textMode = true;
mstate = TXT_USR;
ui::changeState(TXT_USR);
}
else if(down & KEY_ZR)
{
fs::unmountSave();
ui::mstate = EX_MNU;
ui::changeState(EX_MNU);
}
else if(down & KEY_MINUS)
{
ui::mstate = OPT_MNU;
}
ui::changeState(OPT_MNU);
}