diff --git a/assets/gfx/sprites.t3s b/assets/gfx/sprites.t3s index 296bd6b..e2bf52a 100644 --- a/assets/gfx/sprites.t3s +++ b/assets/gfx/sprites.t3s @@ -3,12 +3,14 @@ sprites/arrow.png sprites/bottom_screen_bot.png sprites/bottom_screen_top.png +sprites/button.png sprites/delete.png sprites/download_all.png sprites/dropdown.png sprites/top_screen_bot.png sprites/top_screen_top.png sprites/search.png +sprites/selector.png sprites/side_arrow.png sprites/uniStore.png sprites/uniStore_HD.png diff --git a/assets/gfx/sprites/button.png b/assets/gfx/sprites/button.png new file mode 100644 index 0000000..d7e0c77 Binary files /dev/null and b/assets/gfx/sprites/button.png differ diff --git a/assets/gfx/sprites/selector.png b/assets/gfx/sprites/selector.png new file mode 100644 index 0000000..1cead37 Binary files /dev/null and b/assets/gfx/sprites/selector.png differ diff --git a/include/animation.hpp b/include/animation.hpp index d00a177..9c3613d 100644 --- a/include/animation.hpp +++ b/include/animation.hpp @@ -33,6 +33,8 @@ namespace Animation { // Draw Progressbar. void DrawProgressBar(float currentProgress, float totalProgress, int mode); + // Draw Button. + void Button(int x, int y, float speed = .030); } #endif \ No newline at end of file diff --git a/include/gui/gfx.hpp b/include/gui/gfx.hpp index b6aa6e1..0a18cbd 100644 --- a/include/gui/gfx.hpp +++ b/include/gui/gfx.hpp @@ -41,6 +41,8 @@ namespace GFX // Draw Sprites. void DrawSprite(int img, int x, int y, float ScaleX = 1, float ScaleY = 1); void DrawSpriteBlend(int img, int x, int y, float ScaleX = 1, float ScaleY = 1); + + void DrawButton(int x, int y, std::string ButtonText = "", u32 color = Config::Button); } #endif \ No newline at end of file diff --git a/include/screens/mainMenu.hpp b/include/screens/mainMenu.hpp index ceb4bbc..1b71455 100644 --- a/include/screens/mainMenu.hpp +++ b/include/screens/mainMenu.hpp @@ -41,11 +41,11 @@ private: int Selection = 0; std::vector mainButtons = { - {10, 70, 140, 40}, // Scripts. - {170, 70, 140, 40}, // UniStore. - {10, 145, 140, 40}, // Settings. - {170, 145, 140, 40}, // FTP. - {0, 215, 25, 25}, // Back Arrow. + {0, 60, 149, 52}, // UniStore. + {162, 60, 149, 52}, // Scripts. + {0, 130, 149, 52}, // Settings. + {162, 130, 149, 52}, // FTP. + {0, 215, 25, 25} // Back Arrow. }; }; diff --git a/include/screens/scriptlist.hpp b/include/screens/scriptlist.hpp index 46400c6..c4870bc 100644 --- a/include/screens/scriptlist.hpp +++ b/include/screens/scriptlist.hpp @@ -97,10 +97,10 @@ private: {5, 0, 25, 25} // Dropdown Menu. }; std::vector subPos = { - {10, 70, 140, 40}, // Script list. - {170, 70, 140, 40}, // Get Scripts. - {10, 145, 140, 40}, // Script Creator. - {170, 145, 140, 40} // Script path change. + {0, 60, 149, 52}, // Script list. + {162, 60, 149, 52}, // Get Scripts. + {0, 130, 149, 52}, // Script Creator. + {162, 130, 149, 52} // Script path change. }; // DropDownMenu. diff --git a/include/screens/settings.hpp b/include/screens/settings.hpp index d52d0ec..b375087 100644 --- a/include/screens/settings.hpp +++ b/include/screens/settings.hpp @@ -43,6 +43,9 @@ private: int colorMode = 0; int mode = 0; int Selection = 0; + bool dropDownMenu = false; + mutable int screenPos = 0; + int colorSelection = 0; // Draws. void DrawSubMenu(void) const; @@ -56,9 +59,9 @@ private: void MiscSettingsLogic(u32 hDown, u32 hHeld, touchPosition touch); std::vector mainButtons = { - {90, 40, 140, 35}, // Language. - {90, 100, 140, 35}, // Colors. - {90, 160, 140, 35}, // Misc. + {80, 30, 149, 52}, // Language. + {80, 90, 149, 52}, // Colors. + {80, 150, 149, 52} // Misc. }; std::vector langBlocks = { @@ -74,18 +77,13 @@ private: {177, 188, 20, 20}, }; - std::vector buttons = { - {10, 85, 95, 41}, - {115, 85, 95, 41}, - {220, 85, 95, 41}, - }; - std::vector arrowPos = { {0, 0, 25, 25}, // Previous Arrow. {295, 0, 25, 25}, // Next Arrow. {0, 215, 25, 25}, // Back Arrow. {0, 0, 25, 25}, // Back Arrow top left. {295, 215, 25, 25}, // Next Page / Misc Arrow. + {5, 0, 25, 25} // Dropdown Menu. }; }; diff --git a/include/screens/unistore.hpp b/include/screens/unistore.hpp index 83e70b8..45b5ee7 100644 --- a/include/screens/unistore.hpp +++ b/include/screens/unistore.hpp @@ -103,21 +103,24 @@ private: {0, 215, 25, 25}, // Back Arrow. {5, 0, 25, 25}, // Dropdown Menu. }; + std::vector URLBtn = { - {10, 70, 140, 40}, // FULL URL. - {170, 70, 140, 40}, // Github. - {10, 145, 140, 40}, // TinyDB. - {170, 145, 140, 40} // QR Code? + {0, 60, 149, 52}, // FULL URL. + {162, 60, 149, 52}, // GitHub. + {0, 130, 149, 52}, // TinyDB. + {162, 130, 149, 52} // QR Code? }; + std::vector GitHubPos = { {30, 50, 260, 30}, // Owner & Repo. {30, 130, 260, 30}, // Filename. {135, 180, 50, 30} // OK. }; + std::vector subPos = { - {90, 40, 140, 35}, // StoreList. - {90, 100, 140, 35}, // storeSearch. - {90, 160, 140, 35} // storePathChange. + {80, 30, 149, 52}, // StoreList. + {80, 90, 149, 52}, // storeSearch. + {80, 150, 149, 52} // storePathChange. }; // DropDownMenu. diff --git a/include/utils/config.hpp b/include/utils/config.hpp index 327f324..a446bce 100644 --- a/include/utils/config.hpp +++ b/include/utils/config.hpp @@ -30,7 +30,7 @@ #include namespace Config { - extern int LangPath, lang, Color1, Color2, Color3, TxtColor, SelectedColor, UnselectedColor, viewMode, progressbarColor, autoboot, outdated, uptodate, notFound, future; + extern int LangPath, lang, Color1, Color2, Color3, TxtColor, SelectedColor, UnselectedColor, viewMode, progressbarColor, autoboot, outdated, uptodate, notFound, future, Button; extern std::string ScriptPath, MusicPath, StorePath, AutobootFile; extern bool Logging, UseBars, GodMode; diff --git a/include/utils/scriptHelper.hpp b/include/utils/scriptHelper.hpp index d55cffe..44e6de7 100644 --- a/include/utils/scriptHelper.hpp +++ b/include/utils/scriptHelper.hpp @@ -74,7 +74,6 @@ namespace ScriptHelper { bool checkIfValid(std::string scriptFile, int mode = 0); - void deleteTitle(const std::string TitleID, bool isNAND, std::string message); void bootTitle(const std::string TitleID, bool isNAND, std::string message); Result prompt(std::string message); diff --git a/romfs/lang/en/app.json b/romfs/lang/en/app.json index bf4a9d6..b91b91f 100644 --- a/romfs/lang/en/app.json +++ b/romfs/lang/en/app.json @@ -118,11 +118,6 @@ "MEDIATYPE_NAND": "MediaType NAND", "BOOT_TITLE": "Would you like to boot this title?", - "GODMODE": "GodMode: ", - "FUNCTION_NOT_ALLOWED": "This function is not allowed without GodMode!", - "ENABLE_GODMODE": "Enable GodMode", - "ENABLE_GODMODE_PROMPT": "Would you like to enable GodMode?\n\nBe careful when you use GodMode!!", - "DISABLE_AUTOBOOT": "Would you like to disable autoboot?", "AUTOBOOT_STORE": "Would you like to autoboot this Store?\n\nThis will autoboot this store on startup!", @@ -149,6 +144,7 @@ "OUTDATED_COLOR": "Outdated Script Color", "UPTODATE_COLOR": "Up-To-Date Script Color", "FUTURE_COLOR": "Future Script Color", + "BUTTON_COLOR": "Button Color", "DELETE_SCRIPT2": "Delete the selected Script.", "DELETE_UNISTORE": "Delete the selected UniStore.", "REFRESH_SCRIPTBROWSE_PROMPT": "Would you like to refresh the ScriptBrowse?", diff --git a/source/animation.cpp b/source/animation.cpp index 76b45d7..47d143c 100644 --- a/source/animation.cpp +++ b/source/animation.cpp @@ -26,7 +26,11 @@ #include "common.hpp" +extern bool isScriptSelected; extern u32 progressBar; +extern u32 selected; + +extern C2D_SpriteSheet sprites; // Draws a Rectangle as the progressbar. void Animation::DrawProgressBar(float currentProgress, float totalProgress, int mode) { @@ -35,4 +39,32 @@ void Animation::DrawProgressBar(float currentProgress, float totalProgress, int } else { Gui::Draw_Rect(31, 121, (int)(((float)currentProgress/(float)totalProgress) * 338.0f), 28, Config::progressbarColor); } +} + +void Animation::Button(int x, int y, float speed) +{ + static float timer = 0.0f; + float highlight_multiplier = fmax(0.0, fabs(fmod(timer, 1.0) - 0.5) / 0.5); + u8 r, g, b; + if (isScriptSelected) { + r = selected & 0xFF; + g = (selected >> 8) & 0xFF; + b = (selected >> 16) & 0xFF; + } else { + r = Config::SelectedColor & 0xFF; + g = (Config::SelectedColor >> 8) & 0xFF; + b = (Config::SelectedColor >> 16) & 0xFF; + } + + u32 color = C2D_Color32(r + (255 - r) * highlight_multiplier, g + (255 - g) * highlight_multiplier, b + (255 - b) * highlight_multiplier, 255); + + // The actual draw part. + C2D_ImageTint tint; + C2D_SetImageTint(&tint, C2D_TopLeft, color, 1); + C2D_SetImageTint(&tint, C2D_TopRight, color, 1); + C2D_SetImageTint(&tint, C2D_BotLeft, color, 1); + C2D_SetImageTint(&tint, C2D_BotRight, color, 1); + C2D_DrawImageAt(C2D_SpriteSheetGetImage(sprites, sprites_selector_idx), x+4, y+4, 0.5f, &tint); // +4 because to fit the button. + + timer += speed; // Speed of the animation. Example : .030f / .030 } \ No newline at end of file diff --git a/source/gui/gfx.cpp b/source/gui/gfx.cpp index 77be1e5..fcdfde8 100644 --- a/source/gui/gfx.cpp +++ b/source/gui/gfx.cpp @@ -111,7 +111,7 @@ void GFX::DrawArrow(int x, int y, float rotation, int arrowSprite) { C2D_SetImageTint(&tint, C2D_TopLeft, Config::TxtColor, 0.5); C2D_SetImageTint(&tint, C2D_TopRight, Config::TxtColor, 0.5); C2D_SetImageTint(&tint, C2D_BotLeft, Config::TxtColor, 0.5); - C2D_SetImageTint(&tint, C2D_BotRight, Config::TxtColor, 0.5); + C2D_SetImageTint(&tint, C2D_BotRight, Config::TxtColor, 0.5); } if (arrowSprite == 0) { @@ -123,4 +123,21 @@ void GFX::DrawArrow(int x, int y, float rotation, int arrowSprite) { C2D_SpriteSetPos(&sprite, x, y); C2D_SpriteSetDepth(&sprite, 0.5); C2D_DrawSpriteTinted(&sprite, &tint); +} + +// Draw a Button and draw Text on it. +void GFX::DrawButton(int x, int y, std::string ButtonText, u32 color) { + C2D_ImageTint tint; + C2D_SetImageTint(&tint, C2D_TopLeft, color, 0.5); + C2D_SetImageTint(&tint, C2D_TopRight, color, 0.5); + C2D_SetImageTint(&tint, C2D_BotLeft, color, 0.5); + C2D_SetImageTint(&tint, C2D_BotRight, color, 0.5); + C2D_DrawImageAt(C2D_SpriteSheetGetImage(sprites, sprites_button_idx), x, y, 0.5f, &tint); + + // Draw String. TODO: Center. + if (isScriptSelected) { + Gui::DrawStringCentered(- (158/2) + x, y + (61/2) - (Gui::GetStringHeight(0.6f, ButtonText) / 2), 0.6f, TextColor, ButtonText, 145, 30); + } else { + Gui::DrawStringCentered(- (158/2) + x, y + (61/2) - (Gui::GetStringHeight(0.6f, ButtonText) / 2), 0.6f, Config::TxtColor, ButtonText, 145, 30); + } } \ No newline at end of file diff --git a/source/screens/mainMenu.cpp b/source/screens/mainMenu.cpp index 2329fff..9f5b2b6 100644 --- a/source/screens/mainMenu.cpp +++ b/source/screens/mainMenu.cpp @@ -49,38 +49,19 @@ void MainMenu::Draw(void) const { Gui::DrawString(397-Gui::GetStringWidth(0.5f, V_STRING), 237-Gui::GetStringHeight(0.5f, V_STRING), 0.5f, Config::TxtColor, V_STRING); } - if (Config::UseBars == true) { - if (Config::GodMode) { - Gui::DrawStringCentered(0, 218, 0.7f, Config::TxtColor, Lang::get("GODMODE") + Lang::get("YES"), 400); - } else { - Gui::DrawStringCentered(0, 218, 0.7f, Config::TxtColor, Lang::get("GODMODE") + Lang::get("NO"), 400); - } - } else { - if (Config::GodMode) { - Gui::DrawStringCentered(0, 218, 0.7f, Config::TxtColor, Lang::get("GODMODE") + Lang::get("YES"), 400); - } else { - Gui::DrawStringCentered(0, 218, 0.7f, Config::TxtColor, Lang::get("GODMODE") + Lang::get("NO"), 400); - } - } - if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(0, 0, 0, fadealpha)); // Fade in out effect GFX::DrawBottom(); GFX::DrawArrow(0, 218, 0, 1); - for (int i = 0; i < 4; i++) { - Gui::Draw_Rect(mainButtons[i].x, mainButtons[i].y, mainButtons[i].w, mainButtons[i].h, Config::UnselectedColor); - if (Selection == i) { - Gui::drawAnimatedSelector(mainButtons[i].x, mainButtons[i].y, mainButtons[i].w, mainButtons[i].h, .060, TRANSPARENT, Config::SelectedColor); - } - } - - Gui::DrawStringCentered(-80+10, mainButtons[0].y+12, 0.6f, Config::TxtColor, "UniStore", 130); - Gui::DrawStringCentered(80, mainButtons[1].y+12, 0.6f, Config::TxtColor, Lang::get("SCRIPTS"), 130); - Gui::DrawStringCentered(-80, mainButtons[2].y+12, 0.6f, Config::TxtColor, Lang::get("SETTINGS"), 130); - Gui::DrawStringCentered(80, mainButtons[3].y+12, 0.6f, Config::TxtColor, "FTP", 130); + GFX::DrawButton(mainButtons[0].x, mainButtons[0].y, "UniStore"); + GFX::DrawButton(mainButtons[1].x, mainButtons[1].y, Lang::get("SCRIPTS")); + GFX::DrawButton(mainButtons[2].x, mainButtons[2].y, Lang::get("SETTINGS")); + GFX::DrawButton(mainButtons[3].x, mainButtons[3].y, "FTP"); + // Selector. + Animation::Button(mainButtons[Selection].x, mainButtons[Selection].y, .060); // Draw UniStore Icon. ;P - GFX::DrawSprite(sprites_uniStore_idx, 10, 65); + //GFX::DrawSprite(sprites_uniStore_idx, 10, 65); if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(0, 0, 0, fadealpha)); // Fade in out effect } @@ -128,10 +109,4 @@ void MainMenu::Logic(u32 hDown, u32 hHeld, touchPosition touch) { Gui::setScreen(std::make_unique()); } } - - /* That was a test. - if (hDown & KEY_X) { - TextColor = Config::TxtColor; - ScriptHelper::downloadRelease("Universal-Team/extras", "Universal-Updater.3dsx", "/3ds/Universal-Updater.3dsx", true, true, "Downloading Universal-Updater..."); - }*/ } \ No newline at end of file diff --git a/source/screens/scriptlist.cpp b/source/screens/scriptlist.cpp index 82c1b7f..8cc307f 100644 --- a/source/screens/scriptlist.cpp +++ b/source/screens/scriptlist.cpp @@ -164,17 +164,12 @@ void ScriptList::DrawSubMenu(void) const { GFX::DrawBottom(); GFX::DrawArrow(0, 218, 0, 1); - for (int i = 0; i < 4; i++) { - Gui::Draw_Rect(subPos[i].x, subPos[i].y, subPos[i].w, subPos[i].h, Config::UnselectedColor); - if (Selection == i) { - Gui::drawAnimatedSelector(subPos[i].x, subPos[i].y, subPos[i].w, subPos[i].h, .060, TRANSPARENT, Config::SelectedColor); - } - } - - Gui::DrawStringCentered(-80, subPos[0].y+12, 0.6f, Config::TxtColor, Lang::get("SCRIPTLIST"), 130); - Gui::DrawStringCentered(80, subPos[1].y+12, 0.6f, Config::TxtColor, Lang::get("GET_SCRIPTS"), 130); - Gui::DrawStringCentered(-80, subPos[2].y+12, 0.6f, Config::TxtColor, Lang::get("SCRIPTCREATOR"), 130); - Gui::DrawStringCentered(80, subPos[3].y+12, 0.6f, Config::TxtColor, Lang::get("CHANGE_SCRIPTPATH"), 130); + GFX::DrawButton(subPos[0].x, subPos[0].y, Lang::get("SCRIPTLIST")); + GFX::DrawButton(subPos[1].x, subPos[1].y, Lang::get("GET_SCRIPTS")); + GFX::DrawButton(subPos[2].x, subPos[2].y, Lang::get("SCRIPTCREATOR")); + GFX::DrawButton(subPos[3].x, subPos[3].y, Lang::get("CHANGE_SCRIPTPATH")); + // Selector. + Animation::Button(subPos[Selection].x, subPos[Selection].y, .060); } // Load the description. @@ -996,19 +991,6 @@ Result ScriptList::runFunctions(nlohmann::json &json) { } else if (type == "saveConfig") { Config::save(); - } else if (type == "deleteTitle") { - std::string TitleID = ""; - std::string message = ""; - bool isNAND = false, missing = false; - if(json.at(choice).at(i).contains("TitleID")) TitleID = json.at(choice).at(i).at("TitleID"); - else missing = true; - if (json.at(choice).at(i).contains("NAND") && json.at(choice).at(i).at("NAND").is_boolean()) isNAND = json.at(choice).at(i).at("NAND"); - else missing = true; - if(json.at(choice).at(i).contains("message")) message = json.at(choice).at(i).at("message"); - else missing = true; - if(!missing) ScriptHelper::deleteTitle(TitleID, isNAND, message); - else ret = SYNTAX_ERROR; - } else if (type == "bootTitle") { std::string TitleID = ""; std::string message = ""; @@ -1021,10 +1003,12 @@ Result ScriptList::runFunctions(nlohmann::json &json) { else missing = true; if(!missing) ScriptHelper::bootTitle(TitleID, isNAND, message); else ret = SYNTAX_ERROR; + } else if (type == "promptMessage") { std::string Message = ""; if(json.at(choice).at(i).contains("message")) Message = json.at(choice).at(i).at("message"); ret = ScriptHelper::prompt(Message); + } else if (type == "copy") { std::string Message = "", source = "", destination = ""; bool missing = false; diff --git a/source/screens/settings.cpp b/source/screens/settings.cpp index b110059..2fd9672 100644 --- a/source/screens/settings.cpp +++ b/source/screens/settings.cpp @@ -61,16 +61,11 @@ void Settings::DrawSubMenu(void) const { GFX::DrawArrow(0, 218, 0, 1); GFX::DrawArrow(318, 240, 180.0, 1); - for (int i = 0; i < 3; i++) { - Gui::Draw_Rect(mainButtons[i].x, mainButtons[i].y, mainButtons[i].w, mainButtons[i].h, Config::UnselectedColor); - if (Selection == i) { - Gui::drawAnimatedSelector(mainButtons[i].x, mainButtons[i].y, mainButtons[i].w, mainButtons[i].h, .060, TRANSPARENT, Config::SelectedColor); - } - } - - Gui::DrawStringCentered(0, mainButtons[0].y+10, 0.6f, Config::TxtColor, Lang::get("LANGUAGE"), 130); - Gui::DrawStringCentered(0, mainButtons[1].y+10, 0.6f, Config::TxtColor, Lang::get("COLORS"), 130); - Gui::DrawStringCentered(0, mainButtons[2].y+10, 0.6f, Config::TxtColor, Lang::get("CREDITS"), 130); + GFX::DrawButton(mainButtons[0].x, mainButtons[0].y, Lang::get("LANGUAGE")); + GFX::DrawButton(mainButtons[1].x, mainButtons[1].y, Lang::get("COLORS")); + GFX::DrawButton(mainButtons[2].x, mainButtons[2].y, Lang::get("CREDITS")); + // Selector. + Animation::Button(mainButtons[Selection].x, mainButtons[Selection].y, .060); } void Settings::DrawLanguageSelection(void) const { @@ -103,7 +98,24 @@ void Settings::DrawLanguageSelection(void) const { Gui::DrawString(langBlocks[9].x+25, langBlocks[9].y, 0.7f, Config::TxtColor, "日本語", 320); } +const std::vector colorList = { + "BAR_COLOR", + "TOP_BG_COLOR", + "BOTTOM_BG_COLOR", + "TEXT_COLOR", + "SELECTED_COLOR", + "UNSELECTED_COLOR", + "PROGRESSBAR_COLOR", + "NOT_FOUND_COLOR", + "OUTDATED_COLOR", + "UPTODATE_COLOR", + "FUTURE_COLOR", + "BUTTON_COLOR" +}; + + void Settings::DrawColorChanging(void) const { + std::string line1; GFX::DrawTop(); if (Config::UseBars == true) { Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, "Universal-Updater", 400); @@ -111,104 +123,99 @@ void Settings::DrawColorChanging(void) const { Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, "Universal-Updater", 400); } - if (colorMode == 3) { - Gui::Draw_Rect(0, 40, 400, 45, Config::SelectedColor); - Gui::DrawStringCentered(0, 45, 0.7f, Config::TxtColor, Lang::get("TEXT_COLOR"), 320); - } else if (colorMode == 4) { - Gui::Draw_Rect(0, 40, 400, 45, Config::SelectedColor); - Gui::DrawStringCentered(0, 45, 0.7f, Config::TxtColor, Lang::get("SELECTED_COLOR"), 320); - } else if (colorMode == 5) { - Gui::Draw_Rect(0, 40, 400, 45, Config::UnselectedColor); - 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); + if (!dropDownMenu) { + if (colorMode == 3) { + Gui::Draw_Rect(0, 40, 400, 45, Config::SelectedColor); + Gui::DrawStringCentered(0, 45, 0.7f, Config::TxtColor, Lang::get("TEXT_COLOR"), 320); + } else if (colorMode == 4) { + Gui::Draw_Rect(0, 40, 400, 45, Config::SelectedColor); + Gui::DrawStringCentered(0, 45, 0.7f, Config::TxtColor, Lang::get("SELECTED_COLOR"), 320); + } else if (colorMode == 5) { + Gui::Draw_Rect(0, 40, 400, 45, Config::UnselectedColor); + 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); + } else if (colorMode == 11) { + GFX::DrawButton(100, 100, ""); + } + Gui::DrawStringCentered(0, 215, 0.7f, WHITE, Lang::get(colorList[colorMode]), 320); } GFX::DrawBottom(); - GFX::DrawArrow(0, 218, 0, 1); + if (!dropDownMenu) { + GFX::DrawArrow(0, 218, 0, 1); + GFX::DrawSpriteBlend(sprites_dropdown_idx, arrowPos[5].x, arrowPos[5].y); + } - GFX::DrawArrow(0, 0, 0, 1); - GFX::DrawArrow(318, 22, 180.0, 1); - - for (int i = 0; i < 11; i++) { - if (colorMode == i) { - Gui::drawAnimatedSelector(24 + i * 25, 2, 16, 16, .060, TRANSPARENT, C2D_Color32(140, 140, 140, 255)); + if (dropDownMenu) { + for(int i=0;i 24 + i * 25 && touch.px < 24 + i * 25+16 && touch.py > 2 && touch.py < 2+16) { - colorMode = i; + if (dropDownMenu) { + if (hDown & KEY_A) { + colorMode = colorSelection; + dropDownMenu = false; + } + + if (hDown & KEY_UP) { if (colorSelection > 0) colorSelection--; } + if (hDown & KEY_DOWN) { if (colorSelection < (int)colorList.size()-1) colorSelection++; } + } else { + + if ((hDown & KEY_SELECT) || (hDown & KEY_TOUCH && touching(touch, arrowPos[3]))) { + colorSelection = colorMode; + dropDownMenu = true; + } + + if ((hDown & KEY_B) || (hDown & KEY_TOUCH && touching(touch, arrowPos[2]))) { + mode = 0; + } + + if ((hDown & KEY_L || hDown & KEY_LEFT)) { + if(colorMode > 0) colorMode--; + } + + if ((hDown & KEY_R || hDown & KEY_RIGHT)) { + if(colorMode < 11) colorMode++; + } + + if (hDown & KEY_TOUCH) { + if (touching(touch, mainButtons[0])) { + int temp = Input::getUint(255, Lang::get("ENTER_RED_RGB")); + if(temp != -1) { + red = temp; + if (colorMode == 0) { + Config::Color1 = RGBA8(red, ColorHelper::getColorValue(Config::Color1, 1), ColorHelper::getColorValue(Config::Color1, 0), 255); + } else if (colorMode == 1) { + Config::Color2 = RGBA8(red, ColorHelper::getColorValue(Config::Color2, 1), ColorHelper::getColorValue(Config::Color2, 0), 255); + } else if (colorMode == 2) { + Config::Color3 = RGBA8(red, ColorHelper::getColorValue(Config::Color3, 1), ColorHelper::getColorValue(Config::Color3, 0), 255); + } else if (colorMode == 3) { + Config::TxtColor = RGBA8(red, ColorHelper::getColorValue(Config::TxtColor, 1), ColorHelper::getColorValue(Config::TxtColor, 0), 255); + } else if (colorMode == 4) { + Config::SelectedColor = RGBA8(red, ColorHelper::getColorValue(Config::SelectedColor, 1), ColorHelper::getColorValue(Config::SelectedColor, 0), 255); + } else if (colorMode == 5) { + 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); + } else if (colorMode == 11) { + Config::Button = RGBA8(red, ColorHelper::getColorValue(Config::Button, 1), ColorHelper::getColorValue(Config::Button, 0), 255); + } + changesMade = true; + } + } else if (touching(touch, mainButtons[1])) { + int temp = Input::getUint(255, Lang::get("ENTER_GREEN_RGB")); + if(temp != -1) { + green = temp; + if (colorMode == 0) { + Config::Color1 = RGBA8(ColorHelper::getColorValue(Config::Color1, 2), green, ColorHelper::getColorValue(Config::Color1, 0), 255); + } else if (colorMode == 1) { + Config::Color2 = RGBA8(ColorHelper::getColorValue(Config::Color2, 2), green, ColorHelper::getColorValue(Config::Color2, 0), 255); + } else if (colorMode == 2) { + Config::Color3 = RGBA8(ColorHelper::getColorValue(Config::Color3, 2), green, ColorHelper::getColorValue(Config::Color3, 0), 255); + } else if (colorMode == 3) { + Config::TxtColor = RGBA8(ColorHelper::getColorValue(Config::TxtColor, 2), green, ColorHelper::getColorValue(Config::TxtColor, 0), 255); + } else if (colorMode == 4) { + Config::SelectedColor = RGBA8(ColorHelper::getColorValue(Config::SelectedColor, 2), green, ColorHelper::getColorValue(Config::SelectedColor, 0), 255); + } else if (colorMode == 5) { + 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); + } else if (colorMode == 11) { + Config::Button = RGBA8(ColorHelper::getColorValue(Config::Button, 2), green, ColorHelper::getColorValue(Config::Button, 0), 255); + } + changesMade = true; + } + } else if (touching(touch, mainButtons[2])) { + int temp = Input::getUint(255, Lang::get("ENTER_BLUE_RGB")); + if(temp != -1) { + blue = temp; + if (colorMode == 0) { + Config::Color1 = RGBA8(ColorHelper::getColorValue(Config::Color1, 2), ColorHelper::getColorValue(Config::Color1, 1), blue, 255); + } else if (colorMode == 1) { + Config::Color2 = RGBA8(ColorHelper::getColorValue(Config::Color2, 2), ColorHelper::getColorValue(Config::Color2, 1), blue, 255); + } else if (colorMode == 2) { + Config::Color3 = RGBA8(ColorHelper::getColorValue(Config::Color3, 2), ColorHelper::getColorValue(Config::Color3, 1), blue, 255); + } else if (colorMode == 3) { + Config::TxtColor = RGBA8(ColorHelper::getColorValue(Config::TxtColor, 2), ColorHelper::getColorValue(Config::TxtColor, 1), blue, 255); + } else if (colorMode == 4) { + Config::SelectedColor = RGBA8(ColorHelper::getColorValue(Config::SelectedColor, 2), ColorHelper::getColorValue(Config::SelectedColor, 1), blue, 255); + } else if (colorMode == 5) { + 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); + } else if (colorMode == 11) { + Config::Button = RGBA8(ColorHelper::getColorValue(Config::Button, 2), ColorHelper::getColorValue(Config::Button, 1), blue, 255); + } + changesMade = true; + } } } } - - - if ((hDown & KEY_B) || (hDown & KEY_TOUCH && touching(touch, arrowPos[2]))) { - mode = 0; - } - - if ((hDown & KEY_L || hDown & KEY_LEFT) || (hDown & KEY_TOUCH && touching(touch, arrowPos[0]))) { - if(colorMode > 0) colorMode--; - } - - if ((hDown & KEY_R || hDown & KEY_RIGHT) || (hDown & KEY_TOUCH && touching(touch, arrowPos[1]))) { - if(colorMode < 10) colorMode++; - } - - if (hDown & KEY_TOUCH) { - if (touching(touch, buttons[0])) { - int temp = Input::getUint(255, Lang::get("ENTER_RED_RGB")); - if(temp != -1) { - red = temp; - if (colorMode == 0) { - Config::Color1 = RGBA8(red, ColorHelper::getColorValue(Config::Color1, 1), ColorHelper::getColorValue(Config::Color1, 0), 255); - } else if (colorMode == 1) { - Config::Color2 = RGBA8(red, ColorHelper::getColorValue(Config::Color2, 1), ColorHelper::getColorValue(Config::Color2, 0), 255); - } else if (colorMode == 2) { - Config::Color3 = RGBA8(red, ColorHelper::getColorValue(Config::Color3, 1), ColorHelper::getColorValue(Config::Color3, 0), 255); - } else if (colorMode == 3) { - Config::TxtColor = RGBA8(red, ColorHelper::getColorValue(Config::TxtColor, 1), ColorHelper::getColorValue(Config::TxtColor, 0), 255); - } else if (colorMode == 4) { - Config::SelectedColor = RGBA8(red, ColorHelper::getColorValue(Config::SelectedColor, 1), ColorHelper::getColorValue(Config::SelectedColor, 0), 255); - } else if (colorMode == 5) { - 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])) { - int temp = Input::getUint(255, Lang::get("ENTER_GREEN_RGB")); - if(temp != -1) { - green = temp; - if (colorMode == 0) { - Config::Color1 = RGBA8(ColorHelper::getColorValue(Config::Color1, 2), green, ColorHelper::getColorValue(Config::Color1, 0), 255); - } else if (colorMode == 1) { - Config::Color2 = RGBA8(ColorHelper::getColorValue(Config::Color2, 2), green, ColorHelper::getColorValue(Config::Color2, 0), 255); - } else if (colorMode == 2) { - Config::Color3 = RGBA8(ColorHelper::getColorValue(Config::Color3, 2), green, ColorHelper::getColorValue(Config::Color3, 0), 255); - } else if (colorMode == 3) { - Config::TxtColor = RGBA8(ColorHelper::getColorValue(Config::TxtColor, 2), green, ColorHelper::getColorValue(Config::TxtColor, 0), 255); - } else if (colorMode == 4) { - Config::SelectedColor = RGBA8(ColorHelper::getColorValue(Config::SelectedColor, 2), green, ColorHelper::getColorValue(Config::SelectedColor, 0), 255); - } else if (colorMode == 5) { - 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; - } - } else if (touching(touch, buttons[2])) { - int temp = Input::getUint(255, Lang::get("ENTER_BLUE_RGB")); - if(temp != -1) { - blue = temp; - if (colorMode == 0) { - Config::Color1 = RGBA8(ColorHelper::getColorValue(Config::Color1, 2), ColorHelper::getColorValue(Config::Color1, 1), blue, 255); - } else if (colorMode == 1) { - Config::Color2 = RGBA8(ColorHelper::getColorValue(Config::Color2, 2), ColorHelper::getColorValue(Config::Color2, 1), blue, 255); - } else if (colorMode == 2) { - Config::Color3 = RGBA8(ColorHelper::getColorValue(Config::Color3, 2), ColorHelper::getColorValue(Config::Color3, 1), blue, 255); - } else if (colorMode == 3) { - Config::TxtColor = RGBA8(ColorHelper::getColorValue(Config::TxtColor, 2), ColorHelper::getColorValue(Config::TxtColor, 1), blue, 255); - } else if (colorMode == 4) { - Config::SelectedColor = RGBA8(ColorHelper::getColorValue(Config::SelectedColor, 2), ColorHelper::getColorValue(Config::SelectedColor, 1), blue, 255); - } else if (colorMode == 5) { - 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; - } - } + if (colorSelection < screenPos) { + screenPos = colorSelection; + } else if (colorSelection > screenPos + ENTRIES_PER_SCREEN - 1) { + screenPos = colorSelection - ENTRIES_PER_SCREEN + 1; } } diff --git a/source/screens/unistore.cpp b/source/screens/unistore.cpp index 558d8ab..502446f 100644 --- a/source/screens/unistore.cpp +++ b/source/screens/unistore.cpp @@ -245,16 +245,11 @@ void UniStore::DrawSubMenu(void) const { GFX::DrawBottom(); GFX::DrawArrow(0, 218, 0, 1); - for (int i = 0; i < 3; i++) { - Gui::Draw_Rect(subPos[i].x, subPos[i].y, subPos[i].w, subPos[i].h, Config::UnselectedColor); - if (Selection == i) { - Gui::drawAnimatedSelector(subPos[i].x, subPos[i].y, subPos[i].w, subPos[i].h, .060, TRANSPARENT, Config::SelectedColor); - } - } - - Gui::DrawStringCentered(0, subPos[0].y+10, 0.6f, Config::TxtColor, Lang::get("STORE_LIST"), 130); - Gui::DrawStringCentered(0, subPos[1].y+10, 0.6f, Config::TxtColor, Lang::get("STORE_SEARCH"), 130); - Gui::DrawStringCentered(0, subPos[2].y+10, 0.6f, Config::TxtColor, Lang::get("CHANGE_STOREPATH"), 130); + GFX::DrawButton(subPos[0].x, subPos[0].y,Lang::get("STORE_LIST")); + GFX::DrawButton(subPos[1].x, subPos[1].y, Lang::get("STORE_SEARCH")); + GFX::DrawButton(subPos[2].x, subPos[2].y, Lang::get("CHANGE_STOREPATH")); + // Selector. + Animation::Button(subPos[Selection].x, subPos[Selection].y, .060); } @@ -541,12 +536,12 @@ void UniStore::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) { } break; case 1: - if (checkWifiStatus()) { +// if (checkWifiStatus()) { Selection = 0; mode = 3; - } else { - notConnectedMsg(); - } +// } else { +// notConnectedMsg(); +// } break; case 2: std::string tempStore = selectFilePath(Lang::get("SELECT_STORE_PATH"), Config::StorePath, {}); @@ -1020,16 +1015,12 @@ void UniStore::DrawSearch(void) const { GFX::DrawBottom(); GFX::DrawArrow(0, 218, 0, 1); - for (int i = 0; i < 3; i++) { - Gui::Draw_Rect(URLBtn[i].x, URLBtn[i].y, URLBtn[i].w, URLBtn[i].h, Config::UnselectedColor); - if (Selection == i) { - Gui::drawAnimatedSelector(URLBtn[i].x, URLBtn[i].y, URLBtn[i].w, URLBtn[i].h, .060, TRANSPARENT, Config::SelectedColor); - } - } - - Gui::DrawStringCentered(-80, URLBtn[0].y+12, 0.6f, Config::TxtColor, Lang::get("FULL_URL"), 130); - Gui::DrawStringCentered(80, URLBtn[1].y+12, 0.6f, Config::TxtColor, Lang::get("GITHUB"), 130); - Gui::DrawStringCentered(-80, URLBtn[2].y+12, 0.6f, Config::TxtColor, "TinyDB", 130); + GFX::DrawButton(URLBtn[0].x, URLBtn[0].y,Lang::get("FULL_URL")); + GFX::DrawButton(URLBtn[1].x, URLBtn[1].y, Lang::get("GITHUB")); + GFX::DrawButton(URLBtn[2].x, URLBtn[2].y, "TinyDB"); + GFX::DrawButton(URLBtn[3].x, URLBtn[3].y, "QR Code"); + // Selector. + Animation::Button(URLBtn[Selection].x, URLBtn[Selection].y, .060); } void UniStore::SearchLogic(u32 hDown, u32 hHeld, touchPosition touch) { @@ -1332,19 +1323,6 @@ Result UniStore::execute() { } else if (type == "notImplemented") { notImplemented(); - } else if (type == "deleteTitle") { - std::string TitleID = ""; - std::string message = ""; - bool isNAND = false, missing = false; - if(appStoreJson.at("storeContent").at(Selection).at("script").at(i).contains("TitleID")) TitleID = appStoreJson.at("storeContent").at(Selection).at("script").at(i).at("TitleID"); - else missing = true; - if (appStoreJson.at("storeContent").at(Selection).at("script").at(i).contains("NAND") && appStoreJson.at("storeContent").at(Selection).at("script").at(i).at("NAND").is_boolean()) isNAND = appStoreJson.at("storeContent").at(Selection).at("script").at(i).at("NAND"); - else missing = true; - if(appStoreJson.at("storeContent").at(Selection).at("script").at(i).contains("message")) message = appStoreJson.at("storeContent").at(Selection).at("script").at(i).at("message"); - else missing = true; - if(!missing) ScriptHelper::deleteTitle(TitleID, isNAND, message); - else ret = SYNTAX_ERROR; - } else if (type == "bootTitle") { std::string TitleID = ""; std::string message = ""; @@ -1357,6 +1335,7 @@ Result UniStore::execute() { else missing = true; if(!missing) ScriptHelper::bootTitle(TitleID, isNAND, message); else ret = SYNTAX_ERROR; + } else if (type == "promptMessage") { std::string Message = ""; if(appStoreJson.at("storeContent").at(Selection).at("script").at(i).contains("message")) Message = appStoreJson.at("storeContent").at(Selection).at("script").at(i).at("message"); diff --git a/source/utils/config.cpp b/source/utils/config.cpp index 3df3d81..35d8515 100644 --- a/source/utils/config.cpp +++ b/source/utils/config.cpp @@ -54,6 +54,7 @@ int Config::outdated; int Config::uptodate; int Config::notFound; int Config::future; +int Config::Button; nlohmann::json configJson; void Config::load() { @@ -186,6 +187,13 @@ void Config::load() { } else { future = getInt("FUTURE"); } + + if(!configJson.contains("BUTTON")) { + Button = C2D_Color32(0, 0, 50, 255); + } else { + Button = getInt("BUTTON"); + } + fclose(file); } else { Color1 = BarColor; @@ -209,6 +217,7 @@ void Config::load() { uptodate = C2D_Color32(0xa5, 0xdd, 0x81, 255); notFound = C2D_Color32(255, 128, 0, 255); future = C2D_Color32(255, 255, 0, 255); + Button = C2D_Color32(0, 0, 50, 255); } } @@ -234,6 +243,7 @@ void Config::save() { setInt("UPTODATE", uptodate); setInt("NOTFOUND", notFound); setInt("FUTURE", future); + setInt("BUTTON", Button); 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); @@ -265,6 +275,7 @@ void Config::initializeNewConfig() { setInt("UPTODATE", C2D_Color32(0xa5, 0xdd, 0x81, 255)); setInt("NOTFOUND", C2D_Color32(255, 128, 0, 255)); setInt("FUTURE", C2D_Color32(255, 255, 0, 255)); + setInt("BUTTON", C2D_Color32(0, 0, 50, 255)); if(file) fwrite(configJson.dump(1, '\t').c_str(), 1, configJson.dump(1, '\t').size(), file); fclose(file); diff --git a/source/utils/scriptHelper.cpp b/source/utils/scriptHelper.cpp index ae455fa..c780e00 100644 --- a/source/utils/scriptHelper.cpp +++ b/source/utils/scriptHelper.cpp @@ -159,26 +159,6 @@ bool ScriptHelper::checkIfValid(std::string scriptFile, int mode) { return true; } -void ScriptHelper::deleteTitle(const std::string TitleID, bool isNAND, std::string message) { - if (Config::GodMode) { - std::string MSG = Lang::get("DELETE_TITLE") + "\n\n"; - if (isNAND) MSG += Lang::get("MEDIATYPE_NAND") + "\n" + TitleID; - else MSG += Lang::get("MEDIATYPE_SD") + "\n" + TitleID; - u64 ID = std::stoull(TitleID, 0, 16); - if (Msg::promptMsg(MSG)) { - if (isNAND == true) { - Msg::DisplayMsg(message); - deletePrevious(ID, MEDIATYPE_NAND); - } else { - Msg::DisplayMsg(message); - deletePrevious(ID, MEDIATYPE_SD); - } - } - } else { - Msg::DisplayWarnMsg(Lang::get("FUNCTION_NOT_ALLOWED")); - } -} - void ScriptHelper::bootTitle(const std::string TitleID, bool isNAND, std::string message) { std::string MSG = Lang::get("BOOT_TITLE") + "\n\n"; if (isNAND) MSG += Lang::get("MEDIATYPE_NAND") + "\n" + TitleID;