mirror of
https://github.com/DarkStore-3DS/DarkStore.git
synced 2026-07-03 00:39:02 +00:00
More Customizable colors!
This commit is contained in:
@@ -30,7 +30,7 @@
|
||||
#include <string>
|
||||
|
||||
namespace Config {
|
||||
extern int LangPath, lang, Color1, Color2, Color3, TxtColor, SelectedColor, UnselectedColor, viewMode, progressbarColor, autoboot;
|
||||
extern int LangPath, lang, Color1, Color2, Color3, TxtColor, SelectedColor, UnselectedColor, viewMode, progressbarColor, autoboot, outdated, uptodate, notFound, future;
|
||||
extern std::string ScriptPath, MusicPath, StorePath, AutobootFile;
|
||||
extern bool Logging, UseBars, GodMode;
|
||||
|
||||
|
||||
@@ -144,5 +144,9 @@
|
||||
"GO_BACK": "Go back.",
|
||||
"ENTRY": "Current Entry | Last Entry",
|
||||
"REVISION": "Current Revision | Latest Revision",
|
||||
"UPDATE_STORE": "Update selected UniStore."
|
||||
"UPDATE_STORE": "Update selected UniStore.",
|
||||
"NOT_FOUND_COLOR": "Not Found Script Color",
|
||||
"OUTDATED_COLOR": "Outdated Script Color",
|
||||
"UPTODATE_COLOR": "Up-To-Date Script Color",
|
||||
"FUTURE_COLOR": "Future Script Color"
|
||||
}
|
||||
|
||||
@@ -148,13 +148,13 @@ void ScriptBrowse::DrawBrowse(void) const {
|
||||
Gui::drawAnimatedSelector(0, 40+(i*57), 320, 45, .060, TRANSPARENT, Config::SelectedColor);
|
||||
}
|
||||
if (infoJson[screenPos+i]["curRevision"] == -1) {
|
||||
Gui::Draw_Rect(295, 45+(i*59), 20, 20, C2D_Color32(255, 128, 0, 255));
|
||||
Gui::Draw_Rect(295, 45+(i*59), 20, 20, Config::notFound);
|
||||
} else if(infoJson[screenPos+i]["curRevision"] < infoJson[screenPos+i]["revision"]) {
|
||||
Gui::Draw_Rect(295, 45+(i*59), 20, 20, C2D_Color32(0xfb, 0x5b, 0x5b, 255));
|
||||
Gui::Draw_Rect(295, 45+(i*59), 20, 20, Config::outdated);
|
||||
} else if(infoJson[screenPos+i]["curRevision"] == infoJson[screenPos+i]["revision"]) {
|
||||
Gui::Draw_Rect(295, 45+(i*59), 20, 20, C2D_Color32(0xa5, 0xdd, 0x81, 255));
|
||||
Gui::Draw_Rect(295, 45+(i*59), 20, 20, Config::uptodate);
|
||||
} else if(infoJson[screenPos+i]["curRevision"] > infoJson[screenPos+i]["revision"]) {
|
||||
Gui::Draw_Rect(295, 45+(i*59), 20, 20, C2D_Color32(255, 255, 0, 255));
|
||||
Gui::Draw_Rect(295, 45+(i*59), 20, 20, Config::future);
|
||||
}
|
||||
|
||||
Gui::DrawStringCentered(0, 38+(i*57), 0.7f, Config::TxtColor, infoJson[screenPos+i]["title"], 317);
|
||||
@@ -169,16 +169,16 @@ void ScriptBrowse::DrawBrowse(void) const {
|
||||
|
||||
// Script not found.
|
||||
if (infoJson[screenPosList+i]["curRevision"] == -1) {
|
||||
Gui::Draw_Rect(302, ((i+1)*27)+7, 11, 11, C2D_Color32(255, 128, 0, 255));
|
||||
Gui::Draw_Rect(302, ((i+1)*27)+7, 11, 11, Config::notFound);
|
||||
// Script outdaed.
|
||||
} else if(infoJson[screenPosList+i]["curRevision"] < infoJson[screenPosList+i]["revision"]) {
|
||||
Gui::Draw_Rect(302, ((i+1)*27)+7, 11, 11, C2D_Color32(0xfb, 0x5b, 0x5b, 255));
|
||||
Gui::Draw_Rect(302, ((i+1)*27)+7, 11, 11, Config::outdated);
|
||||
// Script up-to-date.
|
||||
} else if(infoJson[screenPosList+i]["curRevision"] == infoJson[screenPosList+i]["revision"]) {
|
||||
Gui::Draw_Rect(302, ((i+1)*27)+7, 11, 11, C2D_Color32(0xa5, 0xdd, 0x81, 255));
|
||||
Gui::Draw_Rect(302, ((i+1)*27)+7, 11, 11, Config::uptodate);
|
||||
// Future script.
|
||||
} else if(infoJson[screenPosList+i]["curRevision"] > infoJson[screenPosList+i]["revision"]) {
|
||||
Gui::Draw_Rect(302, ((i+1)*27)+7, 11, 11, C2D_Color32(255, 255, 0, 255));
|
||||
Gui::Draw_Rect(302, ((i+1)*27)+7, 11, 11, Config::future);
|
||||
}
|
||||
|
||||
Gui::DrawStringCentered(0, ((i+1)*27)+1, 0.7f, Config::TxtColor, infoJson[screenPosList+i]["title"], 317);
|
||||
@@ -195,16 +195,16 @@ void ScriptBrowse::DrawGlossary(void) const {
|
||||
Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, Lang::get("GLOSSARY"), 400);
|
||||
}
|
||||
|
||||
Gui::Draw_Rect(20, 30, 30, 30, C2D_Color32(255, 128, 0, 255));
|
||||
Gui::Draw_Rect(20, 30, 30, 30, Config::notFound);
|
||||
Gui::DrawString(65, 35, 0.7f, Config::TxtColor, Lang::get("SCRIPT_NOT_FOUND"), 300);
|
||||
|
||||
Gui::Draw_Rect(20, 70, 30, 30, C2D_Color32(0xfb, 0x5b, 0x5b, 255));
|
||||
Gui::Draw_Rect(20, 70, 30, 30, Config::outdated);
|
||||
Gui::DrawString(65, 75, 0.7f, Config::TxtColor, Lang::get("OUTDATED_SCRIPT"), 300);
|
||||
|
||||
Gui::Draw_Rect(20, 110, 30, 30, C2D_Color32(0xa5, 0xdd, 0x81, 255));
|
||||
Gui::Draw_Rect(20, 110, 30, 30, Config::uptodate);
|
||||
Gui::DrawString(65, 115, 0.7f, Config::TxtColor, Lang::get("UP-TO-DATE"), 300);
|
||||
|
||||
Gui::Draw_Rect(20, 150, 30, 30, C2D_Color32(255, 255, 0, 255));
|
||||
Gui::Draw_Rect(20, 150, 30, 30, Config::future);
|
||||
Gui::DrawString(65, 155, 0.7f, Config::TxtColor, Lang::get("FUTURE_SCRIPT"), 300);
|
||||
|
||||
Gui::DrawString(15, 185, 0.7f, Config::TxtColor, std::to_string(int64_t(infoJson[Selection]["curRevision"])) + " | " + std::to_string(int64_t(infoJson[Selection]["revision"])), 40);
|
||||
|
||||
@@ -122,6 +122,14 @@ void Settings::DrawColorChanging(void) const {
|
||||
Gui::DrawStringCentered(0, 45, 0.7f, Config::TxtColor, Lang::get("UNSELECTED_COLOR"), 320);
|
||||
} else if (colorMode == 6) {
|
||||
Gui::Draw_Rect(31, 121, (int)(((float)100/(float)100) * 338.0f), 28, Config::progressbarColor);
|
||||
} else if (colorMode == 7) {
|
||||
Gui::Draw_Rect(31, 121, (int)(((float)100/(float)100) * 338.0f), 28, Config::notFound);
|
||||
} else if (colorMode == 8) {
|
||||
Gui::Draw_Rect(31, 121, (int)(((float)100/(float)100) * 338.0f), 28, Config::outdated);
|
||||
} else if (colorMode == 9) {
|
||||
Gui::Draw_Rect(31, 121, (int)(((float)100/(float)100) * 338.0f), 28, Config::uptodate);
|
||||
} else if (colorMode == 10) {
|
||||
Gui::Draw_Rect(31, 121, (int)(((float)100/(float)100) * 338.0f), 28, Config::future);
|
||||
}
|
||||
|
||||
|
||||
@@ -132,14 +140,14 @@ void Settings::DrawColorChanging(void) const {
|
||||
GFX::DrawArrow(0, 0, 0, 1);
|
||||
GFX::DrawArrow(318, 22, 180.0, 1);
|
||||
|
||||
for (int i = 0; i < 7; i++) {
|
||||
for (int i = 0; i < 11; i++) {
|
||||
if (colorMode == i) {
|
||||
Gui::drawAnimatedSelector(54 + i * 25, 2, 16, 16, .060, TRANSPARENT, C2D_Color32(140, 140, 140, 255));
|
||||
Gui::drawAnimatedSelector(24 + i * 25, 2, 16, 16, .060, TRANSPARENT, C2D_Color32(140, 140, 140, 255));
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 7; i++) {
|
||||
Gui::DrawString(58 + i * 25, 2, 0.5f, WHITE, std::to_string(i+1), 400);
|
||||
for (int i = 0; i < 11; i++) {
|
||||
Gui::DrawString(28 + i * 25, 2, 0.5f, WHITE, std::to_string(i+1), 400);
|
||||
}
|
||||
|
||||
Gui::Draw_Rect(buttons[0].x, buttons[0].y, 95, 41, C2D_Color32(255, 0, 0, 255));
|
||||
@@ -181,6 +189,26 @@ void Settings::DrawColorChanging(void) const {
|
||||
Gui::DrawString(40, 98, 0.7f, WHITE, ColorHelper::getColorName(Config::progressbarColor, 2).c_str(), 400);
|
||||
Gui::DrawString(140, 98, 0.7f, WHITE, ColorHelper::getColorName(Config::progressbarColor, 1).c_str(), 400);
|
||||
Gui::DrawString(245, 98, 0.7f, WHITE, ColorHelper::getColorName(Config::progressbarColor, 0).c_str(), 400);
|
||||
} else if (colorMode == 7) {
|
||||
Gui::DrawStringCentered(0, 60, 0.7f, Config::TxtColor, Lang::get("NOT_FOUND_COLOR"), 320);
|
||||
Gui::DrawString(40, 98, 0.7f, WHITE, ColorHelper::getColorName(Config::notFound, 2).c_str(), 400);
|
||||
Gui::DrawString(140, 98, 0.7f, WHITE, ColorHelper::getColorName(Config::notFound, 1).c_str(), 400);
|
||||
Gui::DrawString(245, 98, 0.7f, WHITE, ColorHelper::getColorName(Config::notFound, 0).c_str(), 400);
|
||||
} else if (colorMode == 8) {
|
||||
Gui::DrawStringCentered(0, 60, 0.7f, Config::TxtColor, Lang::get("OUTDATED_COLOR"), 320);
|
||||
Gui::DrawString(40, 98, 0.7f, WHITE, ColorHelper::getColorName(Config::outdated, 2).c_str(), 400);
|
||||
Gui::DrawString(140, 98, 0.7f, WHITE, ColorHelper::getColorName(Config::outdated, 1).c_str(), 400);
|
||||
Gui::DrawString(245, 98, 0.7f, WHITE, ColorHelper::getColorName(Config::outdated, 0).c_str(), 400);
|
||||
} else if (colorMode == 9) {
|
||||
Gui::DrawStringCentered(0, 60, 0.7f, Config::TxtColor, Lang::get("UPTODATE_COLOR"), 320);
|
||||
Gui::DrawString(40, 98, 0.7f, WHITE, ColorHelper::getColorName(Config::uptodate, 2).c_str(), 400);
|
||||
Gui::DrawString(140, 98, 0.7f, WHITE, ColorHelper::getColorName(Config::uptodate, 1).c_str(), 400);
|
||||
Gui::DrawString(245, 98, 0.7f, WHITE, ColorHelper::getColorName(Config::uptodate, 0).c_str(), 400);
|
||||
} else if (colorMode == 10) {
|
||||
Gui::DrawStringCentered(0, 60, 0.7f, Config::TxtColor, Lang::get("FUTURE_COLOR"), 320);
|
||||
Gui::DrawString(40, 98, 0.7f, WHITE, ColorHelper::getColorName(Config::future, 2).c_str(), 400);
|
||||
Gui::DrawString(140, 98, 0.7f, WHITE, ColorHelper::getColorName(Config::future, 1).c_str(), 400);
|
||||
Gui::DrawString(245, 98, 0.7f, WHITE, ColorHelper::getColorName(Config::future, 0).c_str(), 400);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -356,8 +384,8 @@ void Settings::colorChanging(u32 hDown, touchPosition touch) {
|
||||
int blue;
|
||||
|
||||
if (hDown & KEY_TOUCH) {
|
||||
for (int i = 0; i < 7; i++) {
|
||||
if(touch.px > 54 + i * 25 && touch.px < 54 + i * 25+16 && touch.py > 2 && touch.py < 2+16) {
|
||||
for (int i = 0; i < 11; i++) {
|
||||
if(touch.px > 24 + i * 25 && touch.px < 24 + i * 25+16 && touch.py > 2 && touch.py < 2+16) {
|
||||
colorMode = i;
|
||||
}
|
||||
}
|
||||
@@ -373,7 +401,7 @@ void Settings::colorChanging(u32 hDown, touchPosition touch) {
|
||||
}
|
||||
|
||||
if ((hDown & KEY_R || hDown & KEY_RIGHT) || (hDown & KEY_TOUCH && touching(touch, arrowPos[1]))) {
|
||||
if(colorMode < 6) colorMode++;
|
||||
if(colorMode < 10) colorMode++;
|
||||
}
|
||||
|
||||
if (hDown & KEY_TOUCH) {
|
||||
@@ -395,12 +423,20 @@ void Settings::colorChanging(u32 hDown, touchPosition touch) {
|
||||
Config::UnselectedColor = RGBA8(red, ColorHelper::getColorValue(Config::UnselectedColor, 1), ColorHelper::getColorValue(Config::UnselectedColor, 0), 255);
|
||||
} else if (colorMode == 6) {
|
||||
Config::progressbarColor = RGBA8(red, ColorHelper::getColorValue(Config::progressbarColor, 1), ColorHelper::getColorValue(Config::progressbarColor, 0), 255);
|
||||
} else if (colorMode == 7) {
|
||||
Config::notFound = RGBA8(red, ColorHelper::getColorValue(Config::notFound, 1), ColorHelper::getColorValue(Config::notFound, 0), 255);
|
||||
} else if (colorMode == 8) {
|
||||
Config::outdated = RGBA8(red, ColorHelper::getColorValue(Config::outdated, 1), ColorHelper::getColorValue(Config::outdated, 0), 255);
|
||||
} else if (colorMode == 9) {
|
||||
Config::uptodate = RGBA8(red, ColorHelper::getColorValue(Config::uptodate, 1), ColorHelper::getColorValue(Config::uptodate, 0), 255);
|
||||
} else if (colorMode == 10) {
|
||||
Config::future = RGBA8(red, ColorHelper::getColorValue(Config::future, 1), ColorHelper::getColorValue(Config::future, 0), 255);
|
||||
}
|
||||
changesMade = true;
|
||||
}
|
||||
|
||||
|
||||
} else if (touching(touch, buttons[1]) && colorMode != 7) {
|
||||
} else if (touching(touch, buttons[1])) {
|
||||
int temp = Input::getUint(255, Lang::get("ENTER_GREEN_RGB"));
|
||||
if(temp != -1) {
|
||||
green = temp;
|
||||
@@ -418,6 +454,14 @@ void Settings::colorChanging(u32 hDown, touchPosition touch) {
|
||||
Config::UnselectedColor = RGBA8(ColorHelper::getColorValue(Config::UnselectedColor, 2), green, ColorHelper::getColorValue(Config::UnselectedColor, 0), 255);
|
||||
} else if (colorMode == 6) {
|
||||
Config::progressbarColor = RGBA8(ColorHelper::getColorValue(Config::progressbarColor, 2), green, ColorHelper::getColorValue(Config::progressbarColor, 0), 255);
|
||||
} else if (colorMode == 7) {
|
||||
Config::notFound = RGBA8(ColorHelper::getColorValue(Config::notFound, 2), green, ColorHelper::getColorValue(Config::notFound, 0), 255);
|
||||
} else if (colorMode == 8) {
|
||||
Config::outdated = RGBA8(ColorHelper::getColorValue(Config::outdated, 2), green, ColorHelper::getColorValue(Config::outdated, 0), 255);
|
||||
} else if (colorMode == 9) {
|
||||
Config::uptodate = RGBA8(ColorHelper::getColorValue(Config::uptodate, 2), green, ColorHelper::getColorValue(Config::uptodate, 0), 255);
|
||||
} else if (colorMode == 10) {
|
||||
Config::future = RGBA8(ColorHelper::getColorValue(Config::future, 2), green, ColorHelper::getColorValue(Config::future, 0), 255);
|
||||
}
|
||||
changesMade = true;
|
||||
}
|
||||
@@ -439,6 +483,14 @@ void Settings::colorChanging(u32 hDown, touchPosition touch) {
|
||||
Config::UnselectedColor = RGBA8(ColorHelper::getColorValue(Config::UnselectedColor, 2), ColorHelper::getColorValue(Config::UnselectedColor, 1), blue, 255);
|
||||
} else if (colorMode == 6) {
|
||||
Config::progressbarColor = RGBA8(ColorHelper::getColorValue(Config::progressbarColor, 2), ColorHelper::getColorValue(Config::progressbarColor, 1), blue, 255);
|
||||
} else if (colorMode == 7) {
|
||||
Config::notFound = RGBA8(ColorHelper::getColorValue(Config::notFound, 2), ColorHelper::getColorValue(Config::notFound, 1), blue, 255);
|
||||
} else if (colorMode == 8) {
|
||||
Config::outdated = RGBA8(ColorHelper::getColorValue(Config::outdated, 2), ColorHelper::getColorValue(Config::outdated, 1), blue, 255);
|
||||
} else if (colorMode == 9) {
|
||||
Config::uptodate = RGBA8(ColorHelper::getColorValue(Config::uptodate, 2), ColorHelper::getColorValue(Config::uptodate, 1), blue, 255);
|
||||
} else if (colorMode == 10) {
|
||||
Config::future = RGBA8(ColorHelper::getColorValue(Config::future, 2), ColorHelper::getColorValue(Config::future, 1), blue, 255);
|
||||
}
|
||||
changesMade = true;
|
||||
}
|
||||
|
||||
+124
-87
@@ -50,6 +50,10 @@ int Config::LangPath;
|
||||
bool Config::GodMode = false;
|
||||
int Config::autoboot = 0;
|
||||
std::string Config::AutobootFile = "";
|
||||
int Config::outdated;
|
||||
int Config::uptodate;
|
||||
int Config::notFound;
|
||||
int Config::future;
|
||||
nlohmann::json configJson;
|
||||
|
||||
void Config::load() {
|
||||
@@ -58,148 +62,178 @@ void Config::load() {
|
||||
configJson = nlohmann::json::parse(file, nullptr, false);
|
||||
|
||||
if(!configJson.contains("BARCOLOR")) {
|
||||
Config::Color1 = BarColor;
|
||||
Color1 = BarColor;
|
||||
} else {
|
||||
Config::Color1 = getInt("BARCOLOR");
|
||||
Color1 = getInt("BARCOLOR");
|
||||
}
|
||||
|
||||
if(!configJson.contains("TOPBGCOLOR")) {
|
||||
Config::Color2 = TopBGColor;
|
||||
Color2 = TopBGColor;
|
||||
} else {
|
||||
Config::Color2 = getInt("TOPBGCOLOR");
|
||||
Color2 = getInt("TOPBGCOLOR");
|
||||
}
|
||||
|
||||
if(!configJson.contains("BOTTOMBGCOLOR")) {
|
||||
Config::Color3 = BottomBGColor;
|
||||
Color3 = BottomBGColor;
|
||||
} else {
|
||||
Config::Color3 = getInt("BOTTOMBGCOLOR");
|
||||
Color3 = getInt("BOTTOMBGCOLOR");
|
||||
}
|
||||
|
||||
if(!configJson.contains("TEXTCOLOR")) {
|
||||
Config::TxtColor = WHITE;
|
||||
TxtColor = WHITE;
|
||||
} else {
|
||||
Config::TxtColor = getInt("TEXTCOLOR");
|
||||
TxtColor = getInt("TEXTCOLOR");
|
||||
}
|
||||
|
||||
if(!configJson.contains("UNSELECTEDCOLOR")) {
|
||||
Config::UnselectedColor = UnselectedColordefault;
|
||||
UnselectedColor = UnselectedColordefault;
|
||||
} else {
|
||||
Config::UnselectedColor = getInt("UNSELECTEDCOLOR");
|
||||
UnselectedColor = getInt("UNSELECTEDCOLOR");
|
||||
}
|
||||
|
||||
if(!configJson.contains("SELECTEDCOLOR")) {
|
||||
Config::SelectedColor = SelectedColordefault;
|
||||
SelectedColor = SelectedColordefault;
|
||||
} else {
|
||||
Config::SelectedColor = getInt("SELECTEDCOLOR");
|
||||
SelectedColor = getInt("SELECTEDCOLOR");
|
||||
}
|
||||
|
||||
if(!configJson.contains("SCRIPTPATH")) {
|
||||
Config::ScriptPath = SCRIPTS_PATH;
|
||||
ScriptPath = SCRIPTS_PATH;
|
||||
} else {
|
||||
Config::ScriptPath = getString("SCRIPTPATH");
|
||||
ScriptPath = getString("SCRIPTPATH");
|
||||
}
|
||||
|
||||
if(!configJson.contains("LANGPATH")) {
|
||||
Config::LangPath = 0;
|
||||
LangPath = 0;
|
||||
} else {
|
||||
Config::LangPath = getInt("LANGPATH");
|
||||
LangPath = getInt("LANGPATH");
|
||||
}
|
||||
|
||||
if(!configJson.contains("LANGUAGE")) {
|
||||
Config::lang = 2;
|
||||
lang = 2;
|
||||
} else {
|
||||
Config::lang = getInt("LANGUAGE");
|
||||
lang = getInt("LANGUAGE");
|
||||
}
|
||||
|
||||
if(!configJson.contains("VIEWMODE")) {
|
||||
Config::viewMode = 0;
|
||||
viewMode = 0;
|
||||
} else {
|
||||
Config::viewMode = getInt("VIEWMODE");
|
||||
viewMode = getInt("VIEWMODE");
|
||||
}
|
||||
|
||||
if(!configJson.contains("PROGRESSBARCOLOR")) {
|
||||
Config::progressbarColor = WHITE;
|
||||
progressbarColor = WHITE;
|
||||
} else {
|
||||
Config::progressbarColor = getInt("PROGRESSBARCOLOR");
|
||||
progressbarColor = getInt("PROGRESSBARCOLOR");
|
||||
}
|
||||
|
||||
if(!configJson.contains("MUSICPATH")) {
|
||||
Config::MusicPath = MUSIC_PATH;
|
||||
MusicPath = MUSIC_PATH;
|
||||
} else {
|
||||
Config::MusicPath = getString("MUSICPATH");
|
||||
MusicPath = getString("MUSICPATH");
|
||||
}
|
||||
|
||||
if(!configJson.contains("LOGGING")) {
|
||||
Config::Logging = false;
|
||||
Logging = false;
|
||||
} else {
|
||||
Config::Logging = getBool("LOGGING");
|
||||
Logging = getBool("LOGGING");
|
||||
}
|
||||
|
||||
if(!configJson.contains("BARS")) {
|
||||
Config::UseBars = true;
|
||||
UseBars = true;
|
||||
} else {
|
||||
Config::UseBars = getBool("BARS");
|
||||
UseBars = getBool("BARS");
|
||||
}
|
||||
|
||||
if(!configJson.contains("STOREPATH")) {
|
||||
Config::StorePath = STORE_PATH;
|
||||
StorePath = STORE_PATH;
|
||||
} else {
|
||||
Config::StorePath = getString("STOREPATH");
|
||||
StorePath = getString("STOREPATH");
|
||||
}
|
||||
|
||||
if(!configJson.contains("AUTOBOOT")) {
|
||||
Config::autoboot = 0;
|
||||
autoboot = 0;
|
||||
} else {
|
||||
Config::autoboot = getInt("AUTOBOOT");
|
||||
autoboot = getInt("AUTOBOOT");
|
||||
}
|
||||
|
||||
if(!configJson.contains("AUTOBOOT_FILE")) {
|
||||
Config::AutobootFile = "";
|
||||
AutobootFile = "";
|
||||
} else {
|
||||
Config::AutobootFile = getString("AUTOBOOT_FILE");
|
||||
AutobootFile = getString("AUTOBOOT_FILE");
|
||||
}
|
||||
|
||||
if(!configJson.contains("OUTDATED")) {
|
||||
outdated = C2D_Color32(0xfb, 0x5b, 0x5b, 255);
|
||||
} else {
|
||||
outdated = getInt("OUTDATED");
|
||||
}
|
||||
|
||||
if(!configJson.contains("UPTODATE")) {
|
||||
uptodate = C2D_Color32(0xa5, 0xdd, 0x81, 255);
|
||||
} else {
|
||||
uptodate = getInt("UPTODATE");
|
||||
}
|
||||
|
||||
if(!configJson.contains("NOTFOUND")) {
|
||||
notFound = C2D_Color32(255, 128, 0, 255);
|
||||
} else {
|
||||
notFound = getInt("NOTFOUND");
|
||||
}
|
||||
|
||||
if(!configJson.contains("FUTURE")) {
|
||||
future = C2D_Color32(255, 255, 0, 255);
|
||||
} else {
|
||||
future = getInt("FUTURE");
|
||||
}
|
||||
fclose(file);
|
||||
} else {
|
||||
Config::Color1 = BarColor;
|
||||
Config::Color2 = TopBGColor;
|
||||
Config::Color3 = BottomBGColor;
|
||||
Config::TxtColor = WHITE;
|
||||
Config::SelectedColor = SelectedColordefault;
|
||||
Config::UnselectedColor = UnselectedColordefault;
|
||||
Config::ScriptPath = SCRIPTS_PATH;
|
||||
Config::LangPath = 0;
|
||||
Config::lang = 2;
|
||||
Config::viewMode = 0;
|
||||
Config::progressbarColor = WHITE;
|
||||
Config::MusicPath = MUSIC_PATH;
|
||||
Config::Logging = false;
|
||||
Config::UseBars = true;
|
||||
Config::StorePath = STORE_PATH;
|
||||
Config::autoboot = 0;
|
||||
Config::AutobootFile = "";
|
||||
Color1 = BarColor;
|
||||
Color2 = TopBGColor;
|
||||
Color3 = BottomBGColor;
|
||||
TxtColor = WHITE;
|
||||
SelectedColor = SelectedColordefault;
|
||||
UnselectedColor = UnselectedColordefault;
|
||||
ScriptPath = SCRIPTS_PATH;
|
||||
LangPath = 0;
|
||||
lang = 2;
|
||||
viewMode = 0;
|
||||
progressbarColor = WHITE;
|
||||
MusicPath = MUSIC_PATH;
|
||||
Logging = false;
|
||||
UseBars = true;
|
||||
StorePath = STORE_PATH;
|
||||
autoboot = 0;
|
||||
AutobootFile = "";
|
||||
outdated = C2D_Color32(0xfb, 0x5b, 0x5b, 255);
|
||||
uptodate = C2D_Color32(0xa5, 0xdd, 0x81, 255);
|
||||
notFound = C2D_Color32(255, 128, 0, 255);
|
||||
future = C2D_Color32(255, 255, 0, 255);
|
||||
}
|
||||
}
|
||||
|
||||
void Config::save() {
|
||||
Config::setInt("BARCOLOR", Config::Color1);
|
||||
Config::setInt("TOPBGCOLOR", Config::Color2);
|
||||
Config::setInt("BOTTOMBGCOLOR", Config::Color3);
|
||||
Config::setInt("TEXTCOLOR", Config::TxtColor);
|
||||
Config::setInt("SELECTEDCOLOR", Config::SelectedColor);
|
||||
Config::setInt("UNSELECTEDCOLOR", Config::UnselectedColor);
|
||||
Config::setString("SCRIPTPATH", Config::ScriptPath);
|
||||
Config::setInt("LANGPATH", Config::LangPath);
|
||||
Config::setInt("LANGUAGE", Config::lang);
|
||||
Config::setInt("VIEWMODE", Config::viewMode);
|
||||
Config::setInt("PROGRESSBARCOLOR", Config::progressbarColor);
|
||||
Config::setString("MUSICPATH", Config::MusicPath);
|
||||
Config::setBool("LOGGING", Config::Logging);
|
||||
Config::setBool("BARS", Config::UseBars);
|
||||
Config::setString("STOREPATH", Config::StorePath);
|
||||
|
||||
Config::setInt("AUTOBOOT", Config::autoboot);
|
||||
Config::setString("AUTOBOOT_FILE", Config::AutobootFile);
|
||||
setInt("BARCOLOR", Color1);
|
||||
setInt("TOPBGCOLOR", Color2);
|
||||
setInt("BOTTOMBGCOLOR", Color3);
|
||||
setInt("TEXTCOLOR", TxtColor);
|
||||
setInt("SELECTEDCOLOR", SelectedColor);
|
||||
setInt("UNSELECTEDCOLOR", UnselectedColor);
|
||||
setString("SCRIPTPATH", ScriptPath);
|
||||
setInt("LANGPATH", LangPath);
|
||||
setInt("LANGUAGE", lang);
|
||||
setInt("VIEWMODE", viewMode);
|
||||
setInt("PROGRESSBARCOLOR", progressbarColor);
|
||||
setString("MUSICPATH", MusicPath);
|
||||
setBool("LOGGING", Logging);
|
||||
setBool("BARS", UseBars);
|
||||
setString("STOREPATH", StorePath);
|
||||
setInt("AUTOBOOT", autoboot);
|
||||
setString("AUTOBOOT_FILE", AutobootFile);
|
||||
setInt("OUTDATED", outdated);
|
||||
setInt("UPTODATE", uptodate);
|
||||
setInt("NOTFOUND", notFound);
|
||||
setInt("FUTURE", future);
|
||||
|
||||
FILE* file = fopen("sdmc:/3ds/Universal-Updater/Settings.json", "w");
|
||||
if(file) fwrite(configJson.dump(1, '\t').c_str(), 1, configJson.dump(1, '\t').size(), file);
|
||||
@@ -209,30 +243,33 @@ void Config::save() {
|
||||
void Config::initializeNewConfig() {
|
||||
FILE* file = fopen("sdmc:/3ds/Universal-Updater/Settings.json", "r");
|
||||
if(file) configJson = nlohmann::json::parse(file, nullptr, false);
|
||||
Config::setInt("BARCOLOR", BarColor);
|
||||
Config::setInt("TOPBGCOLOR", TopBGColor);
|
||||
Config::setInt("BOTTOMBGCOLOR", BottomBGColor);
|
||||
Config::setInt("TEXTCOLOR", WHITE);
|
||||
Config::setInt("SELECTEDCOLOR", SelectedColordefault);
|
||||
Config::setInt("UNSELECTEDCOLOR", UnselectedColordefault);
|
||||
Config::setString("SCRIPTPATH", SCRIPTS_PATH);
|
||||
Config::setInt("LANGPATH", 0);
|
||||
Config::setInt("LANGUAGE", 2);
|
||||
Config::setInt("VIEWMODE", 0);
|
||||
Config::setInt("PROGRESSBARCOLOR", WHITE);
|
||||
Config::setString("MUSICPATH", MUSIC_PATH);
|
||||
Config::setBool("LOGGING", false);
|
||||
Config::setBool("BARS", true);
|
||||
Config::setString("STOREPATH", STORE_PATH);
|
||||
|
||||
Config::setInt("AUTOBOOT", 0);
|
||||
Config::setString("AUTOBOOT_FILE", "");
|
||||
setInt("BARCOLOR", BarColor);
|
||||
setInt("TOPBGCOLOR", TopBGColor);
|
||||
setInt("BOTTOMBGCOLOR", BottomBGColor);
|
||||
setInt("TEXTCOLOR", WHITE);
|
||||
setInt("SELECTEDCOLOR", SelectedColordefault);
|
||||
setInt("UNSELECTEDCOLOR", UnselectedColordefault);
|
||||
setString("SCRIPTPATH", SCRIPTS_PATH);
|
||||
setInt("LANGPATH", 0);
|
||||
setInt("LANGUAGE", 2);
|
||||
setInt("VIEWMODE", 0);
|
||||
setInt("PROGRESSBARCOLOR", WHITE);
|
||||
setString("MUSICPATH", MUSIC_PATH);
|
||||
setBool("LOGGING", false);
|
||||
setBool("BARS", true);
|
||||
setString("STOREPATH", STORE_PATH);
|
||||
setInt("AUTOBOOT", 0);
|
||||
setString("AUTOBOOT_FILE", "");
|
||||
setInt("OUTDATED", C2D_Color32(0xfb, 0x5b, 0x5b, 255));
|
||||
setInt("UPTODATE", C2D_Color32(0xa5, 0xdd, 0x81, 255));
|
||||
setInt("NOTFOUND", C2D_Color32(255, 128, 0, 255));
|
||||
setInt("FUTURE", C2D_Color32(255, 255, 0, 255));
|
||||
|
||||
if(file) fwrite(configJson.dump(1, '\t').c_str(), 1, configJson.dump(1, '\t').size(), file);
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
|
||||
bool Config::getBool(const std::string &key) {
|
||||
if(!configJson.contains(key)) {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user