Add language override bool

This commit is contained in:
J-D-K
2021-06-14 23:00:03 -04:00
parent b5037abd83
commit 3e89939308
8 changed files with 61 additions and 12 deletions

View File

@@ -140,7 +140,7 @@ namespace data
void restoreDefaultConfig();
extern int selUser, selData;
extern SetLanguage sysLang;
extern bool incDev, autoBack, ovrClk, holdDel, holdRest, holdOver, forceMount, accSysSave, sysSaveWrite, directFsCmd, skipUser, zip;
extern bool incDev, autoBack, ovrClk, holdDel, holdRest, holdOver, forceMount, accSysSave, sysSaveWrite, directFsCmd, skipUser, zip, langOverride;
extern uint8_t sortType;
}

View File

@@ -16,9 +16,9 @@ namespace ui
//Strings for extras menu
extern std::string exMenuStr[11];
//Strings for options menu
extern std::string optMenuStr[14];
extern std::string optMenuStr[15];
//Strings for options explanations
extern std::string optMenuExp[14];
extern std::string optMenuExp[15];
//Strings for the holding thing
extern std::string holdingText[3];
//Strings for sort type

View File

@@ -108,6 +108,7 @@ optMenu = 10, "Direct FS Cmd: "
optMenu = 11, "Skip User Select: "
optMenu = 12, "Export to ZIP: "
optMenu = 13, "Sort: "
optMenu = 14, "Language Override: "
#Explanations of what options do.
optMenuExp = 0, "Includes Device Save data in user accounts."
@@ -124,6 +125,7 @@ optMenuExp = 10, "Directly uses the Switch's FS commands to copy files instead o
optMenuExp = 11, "Skips the user selection screen and jumps directly to the first user account found."
optMenuExp = 12, "Exports saves to zip files."
optMenuExp = 13, "Changes the way titles are sorted and listed."
opeMenuExp = 14, "Forces English to be used regardless of system language."
#Sort Types
sortType = 0, "Alphabetical"

View File

@@ -31,6 +31,7 @@ SetLanguage data::sysLang;
//Options
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 data::langOverride = false;
uint8_t data::sortType = 0;
//For other save types
@@ -588,6 +589,7 @@ void data::loadCfg()
data::directFsCmd = cfgIn >> 53 & 1;
data::skipUser = cfgIn >> 52 & 1;
data::zip = cfgIn >> 51 & 1;
data::langOverride = cfgIn >> 50 & 1;
}
}
@@ -611,6 +613,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)data::langOverride << 50;
fwrite(&cfgOut, sizeof(uint64_t), 1, cfg);
fwrite(&data::sortType, 1, 1, cfg);
@@ -633,6 +636,7 @@ void data::restoreDefaultConfig()
data::skipUser = false;
data::zip = false;
data::sortType = 0;
data::langOverride = false;
}
void data::loadFav()

View File

@@ -60,7 +60,7 @@ static std::unordered_map<std::string, unsigned> uistrdef =
static void loadTrans()
{
bool transFile = fs::fileExists(fs::getWorkDir() + "trans.txt");
if(!transFile && data::sysLang == SetLanguage_ENUS)
if(!transFile && (data::sysLang == SetLanguage_ENUS || data::langOverride))
return;//Don't bother loading from file. It serves as a translation guide
std::string file;

View File

@@ -18,8 +18,6 @@ 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;

View File

@@ -368,7 +368,7 @@ static inline void changeSort()
void ui::optMenuInit()
{
optMenu.setParams(76, 98, 310);
for(unsigned i = 0; i < 14; i++)
for(unsigned i = 0; i < 15; i++)
optMenu.addOpt(ui::optMenuStr[i]);
}
@@ -391,6 +391,8 @@ void ui::updateOptMenu(const uint64_t& down, const uint64_t& held)
optMenu.editOpt(11, optMenuStr[11] + getBoolText(data::skipUser));
optMenu.editOpt(12, optMenuStr[12] + getBoolText(data::zip));
optMenu.editOpt(13, optMenuStr[13] + ui::sortString[data::sortType]);
optMenu.editOpt(14, optMenuStr[14] + getBoolText(data::langOverride));
if(down & HidNpadButton_A)
{
@@ -452,6 +454,10 @@ void ui::updateOptMenu(const uint64_t& down, const uint64_t& held)
changeSort();
data::loadUsersTitles(false);
break;
case 14:
switchBool(data::langOverride);
break;
}
}
else if(down & HidNpadButton_X)

View File

@@ -28,10 +28,48 @@ std::string ui::confEraseFolder = "*WARNING*: This *will* delete the current sav
std::string ui::noSavesFound = "No saves found for #%s#!";
std::string ui::errorConnecting = "Error Connecting!";
std::string ui::noUpdate = "No updates available!";
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[14] = { "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: ", "Sort: "};
std::string ui::optMenuExp[14] =
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[15] =
{
"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: ",
"Sort: ",
"Language Override: "
};
std::string ui::optMenuExp[15] =
{
"Includes Device Save data in user accounts.",
"Automatically creates a save backup before restoring a save.",
@@ -46,7 +84,8 @@ std::string ui::optMenuExp[14] =
"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.",
"Changes the way titles are sorted and listed."
"Changes the way titles are sorted and listed.",
"Forces English to be used regardless of system language."
};
std::string ui::holdingText[3] = { "(Hold) ", "(Keep Holding) ", "(Almost there!) " };
std::string ui::sortString[3] = { "Alphabetical", "Time Played", "Last Played" };