diff --git a/Universal-Core b/Universal-Core index c82ad8d..d0d78f2 160000 --- a/Universal-Core +++ b/Universal-Core @@ -1 +1 @@ -Subproject commit c82ad8d6e11e4842c6099b53595aa3692f24910b +Subproject commit d0d78f2bfbda1e37d1edd93fa9e3644860ed56d5 diff --git a/assets/gfx/sprites/credits/stackZ.png b/assets/gfx/sprites/credits/stackZ.png deleted file mode 100644 index 6006788..0000000 Binary files a/assets/gfx/sprites/credits/stackZ.png and /dev/null differ diff --git a/assets/gfx/sprites/credits/stackie.png b/assets/gfx/sprites/credits/stackie.png new file mode 100644 index 0000000..5569a7b Binary files /dev/null and b/assets/gfx/sprites/credits/stackie.png differ diff --git a/include/gui/gfx.hpp b/include/gui/gfx.hpp index 0a18cbd..97b1e02 100644 --- a/include/gui/gfx.hpp +++ b/include/gui/gfx.hpp @@ -31,8 +31,7 @@ #include "gui.hpp" #include "sprites.h" -namespace GFX -{ +namespace GFX { // Basic GUI. void DrawTop(void); void DrawBottom(void); diff --git a/include/gui/msg.hpp b/include/gui/msg.hpp index c431d82..8e21794 100644 --- a/include/gui/msg.hpp +++ b/include/gui/msg.hpp @@ -29,8 +29,7 @@ #include -namespace Msg -{ +namespace Msg { void DisplayMsg(std::string text); void DisplayWarnMsg(std::string Text); bool promptMsg(std::string promptMsg); diff --git a/include/screens/credits.hpp b/include/screens/credits.hpp index 208c9bf..8181b7c 100644 --- a/include/screens/credits.hpp +++ b/include/screens/credits.hpp @@ -32,8 +32,7 @@ #include -class Credits : public Screen -{ +class Credits : public Screen { public: void Draw(void) const override; void Logic(u32 hDown, u32 hHeld, touchPosition touch) override; diff --git a/include/screens/exiting.hpp b/include/screens/exiting.hpp new file mode 100644 index 0000000..b2345d0 --- /dev/null +++ b/include/screens/exiting.hpp @@ -0,0 +1,38 @@ +/* +* This file is part of Universal-Updater +* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +* +* Additional Terms 7.b and 7.c of GPLv3 apply to this file: +* * Requiring preservation of specified reasonable legal notices or +* author attributions in that material or in the Appropriate Legal +* Notices displayed by works containing it. +* * Prohibiting misrepresentation of the origin of that material, +* or requiring that modified versions of such material be marked in +* reasonable ways as different from the original version. +*/ + +#ifndef EXITING_HPP +#define EXITING_HPP + +#include "common.hpp" + +class Exiting : public Screen { +public: + void Draw(void) const override; + void Logic(u32 hDown, u32 hHeld, touchPosition touch) override; +}; + +#endif \ No newline at end of file diff --git a/include/screens/ftpScreen.hpp b/include/screens/ftpScreen.hpp index 61a530b..7a4f1fe 100644 --- a/include/screens/ftpScreen.hpp +++ b/include/screens/ftpScreen.hpp @@ -29,8 +29,7 @@ #include -class FTPScreen : public Screen -{ +class FTPScreen : public Screen { public: void Draw(void) const override; void Logic(u32 hDown, u32 hHeld, touchPosition touch) override; diff --git a/include/screens/mainMenu.hpp b/include/screens/mainMenu.hpp index 1b71455..bd8b6d6 100644 --- a/include/screens/mainMenu.hpp +++ b/include/screens/mainMenu.hpp @@ -32,8 +32,7 @@ #include -class MainMenu : public Screen -{ +class MainMenu : public Screen { public: void Draw(void) const override; void Logic(u32 hDown, u32 hHeld, touchPosition touch) override; diff --git a/include/screens/scriptBrowse.hpp b/include/screens/scriptBrowse.hpp index 1b9cb8d..ce72521 100644 --- a/include/screens/scriptBrowse.hpp +++ b/include/screens/scriptBrowse.hpp @@ -33,8 +33,7 @@ #include -class ScriptBrowse : public Screen -{ +class ScriptBrowse : public Screen { public: void Draw(void) const override; void Logic(u32 hDown, u32 hHeld, touchPosition touch) override; diff --git a/include/screens/scriptCreator.hpp b/include/screens/scriptCreator.hpp index a441b18..ee228f9 100644 --- a/include/screens/scriptCreator.hpp +++ b/include/screens/scriptCreator.hpp @@ -32,8 +32,7 @@ #include -class ScriptCreator : public Screen -{ +class ScriptCreator : public Screen { public: void Draw(void) const override; void Logic(u32 hDown, u32 hHeld, touchPosition touch) override; diff --git a/include/screens/scriptlist.hpp b/include/screens/scriptlist.hpp index 4459422..d7e8dd1 100644 --- a/include/screens/scriptlist.hpp +++ b/include/screens/scriptlist.hpp @@ -34,8 +34,7 @@ #include -class ScriptList : public Screen -{ +class ScriptList : public Screen { public: void Draw(void) const override; void Logic(u32 hDown, u32 hHeld, touchPosition touch) override; diff --git a/include/screens/settings.hpp b/include/screens/settings.hpp index ef00f7c..a6a8dd3 100644 --- a/include/screens/settings.hpp +++ b/include/screens/settings.hpp @@ -33,8 +33,7 @@ #include -class Settings : public Screen -{ +class Settings : public Screen { public: void Draw(void) const override; void Logic(u32 hDown, u32 hHeld, touchPosition touch) override; @@ -65,6 +64,13 @@ private: {80, 150, 149, 52} // Credits. }; + std::vector mainButtons2 = { + {0, 60, 149, 52}, // Change Music File. + {162, 60, 149, 52}, // Change bar style. + {0, 130, 149, 52}, // Change Key Delay. + {162, 130, 149, 52} // Toggle animation. + }; + std::vector arrowPos = { {0, 0, 25, 25}, // Previous Arrow. {295, 0, 25, 25}, // Next Arrow. diff --git a/include/screens/unistore.hpp b/include/screens/unistore.hpp index 0b143a0..a2c6305 100644 --- a/include/screens/unistore.hpp +++ b/include/screens/unistore.hpp @@ -34,8 +34,7 @@ #include -class UniStore : public Screen -{ +class UniStore : public Screen { public: void Draw(void) const override; void Logic(u32 hDown, u32 hHeld, touchPosition touch) override; diff --git a/include/utils/config.hpp b/include/utils/config.hpp index 21fa5d2..4f99684 100644 --- a/include/utils/config.hpp +++ b/include/utils/config.hpp @@ -32,7 +32,7 @@ namespace Config { extern int LangPath, Color1, Color2, Color3, TxtColor, SelectedColor, UnselectedColor, viewMode, progressbarColor, autoboot, outdated, uptodate, notFound, future, Button, keyDelay; extern std::string lang, ScriptPath, MusicPath, StorePath, AutobootFile; - extern bool Logging, UseBars, GodMode; + extern bool Logging, UseBars, fading; void load(); void save(); diff --git a/include/utils/stringutils.hpp b/include/utils/stringutils.hpp index f08a4b0..fc7a6ec 100644 --- a/include/utils/stringutils.hpp +++ b/include/utils/stringutils.hpp @@ -5,8 +5,7 @@ bool matchPattern(std::string pattern, std::string tested); -namespace StringUtils -{ +namespace StringUtils { std::string format(const std::string& fmt_str, ...); } diff --git a/romfs/lang/en/app.json b/romfs/lang/en/app.json index 9c43909..8165494 100644 --- a/romfs/lang/en/app.json +++ b/romfs/lang/en/app.json @@ -56,7 +56,7 @@ "CREDITS": "Credits", "DEVELOPED_BY": "Developed by: Universal-Team.", - "MAIN_DEV": "Main Developer: StackZ", + "MAIN_DEV": "Main Developer: SuperSaiyajinStackie", "CURRENT_VERSION": "Current version: ", "MANY_THANKS": "Many Thanks to:", "TRANSLATORS": "All our Translators", @@ -171,5 +171,10 @@ "MOVE_ERROR": "Move Error!", "DELETE_ERROR": "Delete Error!", "CHANGE_KEY_DELAY": "Change Key Delay", - "ENTER_KEY_DELAY": "Enter the Key Delay for Scrolling." + "ENTER_KEY_DELAY": "Enter the Key Delay for Scrolling.", + "TOGGLE_FADE": "Toggle Fade Effect", + "TOGGLE_FADE_ENABLE": "Would you like to enable the Screen fade effect?", + "TOGGLE_FADE_DISABLE": "Would you like to disable the Screen fade effect?", + "ENABLED": "Enabled!", + "DISABLED": "Disabled!" } diff --git a/source/gui/msg.cpp b/source/gui/msg.cpp index 0d50624..d9e46c5 100644 --- a/source/gui/msg.cpp +++ b/source/gui/msg.cpp @@ -34,6 +34,7 @@ extern u32 bgTopColor; extern u32 bgBottomColor; extern u32 TextColor; +// I do not think we need that at all. void Msg::DisplayStartMSG() { Gui::clearTextBufs(); C3D_FrameBegin(C3D_FRAME_SYNCDRAW); @@ -44,12 +45,15 @@ void Msg::DisplayStartMSG() { Gui::Draw_Rect(0, 25, 400, 190, Config::Color2); Gui::Draw_Rect(0, 215, 400, 25, Config::Color1); Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, Lang::get("STARTING_UNIVERSAL_UPDATER")); + if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect Gui::ScreenDraw(Bottom); Gui::Draw_Rect(0, 0, 320, 25, Config::Color1); Gui::Draw_Rect(0, 25, 320, 190, Config::Color2); Gui::Draw_Rect(0, 215, 320, 25, Config::Color1); + if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect C3D_FrameEnd(0); } + void Msg::DisplayMsg(std::string text) { Gui::clearTextBufs(); C3D_FrameBegin(C3D_FRAME_SYNCDRAW); @@ -65,8 +69,7 @@ void Msg::DisplayMsg(std::string text) { C3D_FrameEnd(0); } -void Msg::DisplayWarnMsg(std::string Text) -{ +void Msg::DisplayWarnMsg(std::string Text) { Gui::clearTextBufs(); C3D_FrameBegin(C3D_FRAME_SYNCDRAW); C2D_TargetClear(Top, BLACK); @@ -94,8 +97,7 @@ extern touchPosition touch; extern bool touching(touchPosition touch, Structs::ButtonPos button); // Display a Message, which needs to be confirmed with A/B. -bool Msg::promptMsg(std::string promptMsg) -{ +bool Msg::promptMsg(std::string promptMsg) { Gui::clearTextBufs(); C3D_FrameBegin(C3D_FRAME_SYNCDRAW); C2D_TargetClear(Top, BLACK); @@ -108,6 +110,7 @@ bool Msg::promptMsg(std::string promptMsg) Gui::DrawStringCentered(0, (240-Gui::GetStringHeight(0.6f, promptMsg))/2, 0.6f, TextColor, promptMsg, 395, 70); Gui::DrawStringCentered(0, 217, 0.72f, TextColor, Lang::get("CONFIRM_OR_CANCEL"), 400); } + GFX::DrawBottom(); if (isScriptSelected == false) { Gui::Draw_Rect(10, 100, 140, 35, Config::Color1); @@ -122,8 +125,7 @@ bool Msg::promptMsg(std::string promptMsg) } C3D_FrameEnd(0); - while(1) - { + while(1) { gspWaitForVBlank(); hidScanInput(); hidTouchRead(&touch); diff --git a/source/init.cpp b/source/init.cpp index eeba792..4c77156 100644 --- a/source/init.cpp +++ b/source/init.cpp @@ -40,10 +40,6 @@ #include #include -// The classic Fade Effect! ;P -int fadealpha = 255; -bool fadein = true; - bool exiting = false; bool dspFound = false; touchPosition touch; @@ -100,11 +96,18 @@ Result Init::Initialize() { mkdir("sdmc:/3ds/Universal-Updater/stores", 0777); // We need to make sure, the file exist. - if(access("sdmc:/3ds/Universal-Updater/Settings.json", F_OK) == -1 ) { + if (access("sdmc:/3ds/Universal-Updater/Settings.json", F_OK) == -1 ) { Config::initializeNewConfig(); } + Config::load(); Lang::load(Config::lang); + + if (Config::fading) { + fadein = true; + fadealpha = 255; + } + // In case it takes a bit longer to autoboot a script or so. Msg::DisplayStartMSG(); if (Config::Logging == true) { @@ -116,24 +119,24 @@ Result Init::Initialize() { if (Config::autoboot == 1) { if (access(Config::AutobootFile.c_str(), F_OK) == 0) { - Gui::setScreen(std::make_unique()); + Gui::setScreen(std::make_unique(), false, true); } else { AutobootWhat = 0; Config::autoboot = 0; - Gui::setScreen(std::make_unique()); + Gui::setScreen(std::make_unique(), false, true); } } else if (Config::autoboot == 2) { if (access(Config::AutobootFile.c_str(), F_OK) == 0) { - Gui::setScreen(std::make_unique()); + Gui::setScreen(std::make_unique(), false, true); } else { AutobootWhat = 0; Config::autoboot = 0; - Gui::setScreen(std::make_unique()); + Gui::setScreen(std::make_unique(), false, true); } } else { AutobootWhat = 0; Config::autoboot = 0; - Gui::setScreen(std::make_unique()); + Gui::setScreen(std::make_unique(), false, true); } osSetSpeedupEnable(true); // Enable speed-up for New 3DS users @@ -151,10 +154,8 @@ Result Init::Initialize() { Result Init::MainLoop() { // Initialize everything. Initialize(); - // Loop as long as the status is not exiting. - while (aptMainLoop() && !exiting) - { + while (aptMainLoop()) { hidScanInput(); u32 hHeld = hidKeysHeld(); u32 hDown = hidKeysDown(); @@ -163,17 +164,15 @@ Result Init::MainLoop() { C2D_TargetClear(Top, BLACK); C2D_TargetClear(Bottom, BLACK); Gui::clearTextBufs(); - Gui::mainLoop(hDown, hHeld, touch); + Gui::DrawScreen(true); + Gui::ScreenLogic(hDown, hHeld, touch, true, true); C3D_FrameEnd(0); gspWaitForVBlank(); - - if (fadein == true) { - fadealpha -= 3; - if (fadealpha < 0) { - fadealpha = 0; - fadein = false; - } + if (exiting) { + if (!fadeout) break; } + + Gui::fadeEffects(16, 16, true); } // Exit all services and exit the app. Exit(); diff --git a/source/screens/credits.cpp b/source/screens/credits.cpp index 7c80f4b..cddaa9a 100644 --- a/source/screens/credits.cpp +++ b/source/screens/credits.cpp @@ -39,7 +39,7 @@ const std::vector Translators = { "lemonnade0", "Pk11", "Roby Spia", - "StackZ", + "SuperSaiyajinStackie", "XDgierman", "YoSoy" }; @@ -66,15 +66,15 @@ const std::vector UniversalTeam = { "FlameKat53", "Pk11", "RocketRobz", - "StackZ", + "SuperSaiyajinStackie", "TotallyNotGuy" }; // Script Page 3. const std::vector ScriptCreators = { - "DualBladedKirito", "Glazed_Belmont", "Pk11", "StackZ", "The Conceptionist", "YoSoy" + "cooolgamer", "DualBladedKirito", "Glazed_Belmont", "Pk11", "SuperSaiyajinStackie", "The Conceptionist", "YoSoy" }; -const std::vector ScriptAmount = {"1", "1", "1", "5", "10", "1 | 2"}; +const std::vector ScriptAmount = {"1", "1", "1", "1", "5", "10", "1 | 2"}; void Credits::Draw(void) const { std::string title = "Universal-Updater - "; @@ -87,8 +87,8 @@ void Credits::Draw(void) const { Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, title, 400); } Gui::DrawStringCentered(0, 30, 0.7f, Config::TxtColor, Lang::get("DEVELOPED_BY"), 390); - Gui::DrawStringCentered(0, 70, 0.7f, Config::TxtColor, Lang::get("MAIN_DEV"), 390); - GFX::DrawSprite(sprites_stackZ_idx, 5, 85); + Gui::DrawStringCentered(0, 60, 0.7f, Config::TxtColor, Lang::get("MAIN_DEV"), 390); + GFX::DrawSprite(sprites_stackie_idx, 5, 85); GFX::DrawSprite(sprites_universal_core_idx, 200, 110); std::string currentVersion = Lang::get("CURRENT_VERSION"); currentVersion += V_STRING; @@ -97,7 +97,9 @@ void Credits::Draw(void) const { Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(0, 0, 0, 190)); GFX::DrawSprite(sprites_discord_idx, 115, 35); } + if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect DrawBottom(); + if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect } void Credits::DrawBottom(void) const { @@ -211,7 +213,7 @@ void Credits::Logic(u32 hDown, u32 hHeld, touchPosition touch) { } if (hDown & KEY_B) { - Gui::screenBack(); + Gui::screenBack(Config::fading); return; } diff --git a/source/screens/exiting.cpp b/source/screens/exiting.cpp new file mode 100644 index 0000000..b3868bb --- /dev/null +++ b/source/screens/exiting.cpp @@ -0,0 +1,37 @@ +/* +* This file is part of Universal-Updater +* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +* +* Additional Terms 7.b and 7.c of GPLv3 apply to this file: +* * Requiring preservation of specified reasonable legal notices or +* author attributions in that material or in the Appropriate Legal +* Notices displayed by works containing it. +* * Prohibiting misrepresentation of the origin of that material, +* or requiring that modified versions of such material be marked in +* reasonable ways as different from the original version. +*/ + +#include "common.hpp" +#include "exiting.hpp" + +void Exiting::Draw(void) const { + GFX::DrawTop(); + Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, 255)); // Fade in/out effect + Gui::ScreenDraw(Bottom); + Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, 255)); // Fade in/out effect +} + +void Exiting::Logic(u32 hDown, u32 hHeld, touchPosition touch) { } \ No newline at end of file diff --git a/source/screens/ftpScreen.cpp b/source/screens/ftpScreen.cpp index 09e28d3..39c383d 100644 --- a/source/screens/ftpScreen.cpp +++ b/source/screens/ftpScreen.cpp @@ -24,7 +24,6 @@ * reasonable ways as different from the original version. */ - #include "ftpScreen.hpp" #include @@ -38,8 +37,7 @@ extern "C" { extern bool touching(touchPosition touch, Structs::ButtonPos button); extern touchPosition touch; -void FTPScreen::Draw(void) const -{ +void FTPScreen::Draw(void) const { ftp_init(); Result ret = 0; char buf[137], hostname[128]; @@ -56,6 +54,7 @@ void FTPScreen::Draw(void) const } else { Gui::DrawString((400-Gui::GetStringWidth(0.7f, Lang::get("FTP_MODE")))/2, 2, 0.7f, Config::TxtColor, Lang::get("FTP_MODE"), 400); } + if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect GFX::DrawBottom(); GFX::DrawArrow(0, 218, 0, 1); ret = ACU_GetWifiStatus(&wifiStatus); @@ -77,7 +76,7 @@ void FTPScreen::Draw(void) const Gui::DrawStringCentered(0, 60, 0.48, Config::TxtColor, buf, 320); Gui::DrawStringCentered(0, 222, 0.48f, Config::TxtColor, Lang::get("B_FTP_EXIT"), 320); - + if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect Gui::clearTextBufs(); C3D_FrameEnd(0); hidScanInput(); @@ -91,11 +90,8 @@ void FTPScreen::Draw(void) const memset(ftp_file_transfer, 0, 50); // Empty transfer status. ftp_exit(); - Gui::screenBack(); - return; + Gui::screenBack(false); } // Needed here, otherwise it won't compile. -void FTPScreen::Logic(u32 hDown, u32 hHeld, touchPosition touch) -{ -} \ No newline at end of file +void FTPScreen::Logic(u32 hDown, u32 hHeld, touchPosition touch) { } \ No newline at end of file diff --git a/source/screens/mainMenu.cpp b/source/screens/mainMenu.cpp index 9f5b2b6..695ca0f 100644 --- a/source/screens/mainMenu.cpp +++ b/source/screens/mainMenu.cpp @@ -25,6 +25,7 @@ */ #include "config.hpp" +#include "exiting.hpp" #include "ftpScreen.hpp" #include "mainMenu.hpp" #include "scriptHelper.hpp" @@ -49,7 +50,7 @@ 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 (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(0, 0, 0, fadealpha)); // Fade in out effect + if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect GFX::DrawBottom(); GFX::DrawArrow(0, 218, 0, 1); @@ -62,12 +63,14 @@ void MainMenu::Draw(void) const { // Draw UniStore Icon. ;P //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 + if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect } void MainMenu::Logic(u32 hDown, u32 hHeld, touchPosition touch) { if ((hDown & KEY_START) || (hDown & KEY_TOUCH && touching(touch, mainButtons[4]))) { exiting = true; + Gui::setScreen(std::make_unique(), Config::fading, true); + fadecolor = 0; } // Navigation. @@ -84,29 +87,29 @@ void MainMenu::Logic(u32 hDown, u32 hHeld, touchPosition touch) { if (hDown & KEY_A) { switch(Selection) { case 0: - Gui::setScreen(std::make_unique()); + Gui::setScreen(std::make_unique(), Config::fading, true); break; case 1: - Gui::setScreen(std::make_unique()); + Gui::setScreen(std::make_unique(), Config::fading, true); break; case 2: - Gui::setScreen(std::make_unique()); + Gui::setScreen(std::make_unique(), Config::fading, true); break; case 3: - Gui::setScreen(std::make_unique()); + Gui::setScreen(std::make_unique(), false, true); break; } } if (hDown & KEY_TOUCH) { if (touching(touch, mainButtons[0])) { - Gui::setScreen(std::make_unique()); + Gui::setScreen(std::make_unique(), Config::fading, true); } else if (touching(touch, mainButtons[1])) { - Gui::setScreen(std::make_unique()); + Gui::setScreen(std::make_unique(), Config::fading, true); } else if (touching(touch, mainButtons[2])) { - Gui::setScreen(std::make_unique()); + Gui::setScreen(std::make_unique(), Config::fading, true); } else if (touching(touch, mainButtons[3])) { - Gui::setScreen(std::make_unique()); + Gui::setScreen(std::make_unique(), false, true); } } } \ No newline at end of file diff --git a/source/screens/scriptBrowse.cpp b/source/screens/scriptBrowse.cpp index e10d464..6fd6c8b 100644 --- a/source/screens/scriptBrowse.cpp +++ b/source/screens/scriptBrowse.cpp @@ -94,6 +94,7 @@ ScriptBrowse::ScriptBrowse() { loaded = false; return; } + FILE* file = fopen(metaFile, "r"); if(file) { infoJson = nlohmann::json::parse(file, nullptr, false); @@ -167,6 +168,7 @@ void ScriptBrowse::DrawBrowse(void) const { } else if(infoJson[Selection]["curRevision"] > infoJson[Selection]["revision"]) { Gui::DrawStringCentered(0, 219, 0.7f, Config::TxtColor, Lang::get("FUTURE_SCRIPT"), 370); } + if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect GFX::DrawBottom(); GFX::DrawArrow(295, -1); GFX::DrawArrow(315, 240, 180.0); @@ -244,8 +246,10 @@ void ScriptBrowse::DrawBrowse(void) const { Gui::DrawString(dropPos[1].x+30, dropPos[1].y+5, 0.4f, Config::TxtColor, Lang::get("REFRESH_BROWSE_DDM"), 100); Gui::DrawString(dropPos[2].x+30, dropPos[2].y+5, 0.4f, Config::TxtColor, Lang::get("VIEW_DDM"), 100); } + if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect } else { GFX::DrawBottom(); + if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect } } @@ -273,7 +277,7 @@ void ScriptBrowse::DrawGlossary(void) const { 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); Gui::DrawString(65, 185, 0.7f, Config::TxtColor, Lang::get("REVISION"), 300); - + if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect GFX::DrawBottom(); GFX::DrawSpriteBlend(sprites_download_all_idx, 20, 25); Gui::DrawString(50, 27, 0.6f, Config::TxtColor, Lang::get("DOWNLOAD_ALL"), 260); @@ -290,8 +294,10 @@ void ScriptBrowse::DrawGlossary(void) const { GFX::DrawSpriteBlend(sprites_update_idx, 20, 195); Gui::DrawString(50, 197, 0.6f, Config::TxtColor, Lang::get("REFRESH_SCRIPTBROWSE"), 260); GFX::DrawArrow(0, 218, 0, 1); + if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect } else { GFX::DrawBottom(); + if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect } } @@ -375,8 +381,7 @@ void ScriptBrowse::Logic(u32 hDown, u32 hHeld, touchPosition touch) { } else { if ((hDown & KEY_B) || (hDown & KEY_TOUCH && touching(touch, arrowPos[2]))) { infoJson.clear(); - Gui::screenBack(); - return; + Gui::screenBack(Config::fading); } if (mode == 0) { if ((hHeld & KEY_DOWN && !keyRepeatDelay) || (hDown & KEY_TOUCH && touching(touch, arrowPos[1]))) { @@ -516,8 +521,7 @@ void ScriptBrowse::Logic(u32 hDown, u32 hHeld, touchPosition touch) { } } else { if (hDown & KEY_B) { - Gui::screenBack(); - return; + Gui::screenBack(Config::fading); } } } \ No newline at end of file diff --git a/source/screens/scriptCreator.cpp b/source/screens/scriptCreator.cpp index 46fdcfb..92869fc 100644 --- a/source/screens/scriptCreator.cpp +++ b/source/screens/scriptCreator.cpp @@ -83,7 +83,7 @@ void ScriptCreator::DrawSubMenu(void) const { } else { Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, Lang::get("SCRIPTCREATOR"), 400); } - + if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect GFX::DrawBottom(); for (int i = 0; i < 2; i++) { @@ -96,6 +96,7 @@ void ScriptCreator::DrawSubMenu(void) const { Gui::DrawString((320-Gui::GetStringWidth(0.6f, "New script"))/2, mainButtons[0].y+10, 0.6f, Config::TxtColor, "New script", 140); Gui::DrawString((320-Gui::GetStringWidth(0.6f, "Existing script"))/2, mainButtons[1].y+10, 0.6f, Config::TxtColor, "Existing script", 140); + if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect } void ScriptCreator::DrawScriptScreen(void) const { @@ -105,7 +106,7 @@ void ScriptCreator::DrawScriptScreen(void) const { } else { Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, "Selected Entry: " + entryName, 400); } - + if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect GFX::DrawBottom(); // Draw Page. @@ -142,6 +143,7 @@ void ScriptCreator::DrawScriptScreen(void) const { Gui::DrawString((320-Gui::GetStringWidth(0.6f, "rmdir"))/2-150+70, creatorButtons[0].y+10, 0.6f, Config::TxtColor, "rmdir", 140); Gui::DrawString((320-Gui::GetStringWidth(0.6f, "mkfile"))/2+150-70, creatorButtons[1].y+10, 0.6f, Config::TxtColor, "mkfile", 140); Gui::DrawString((320-Gui::GetStringWidth(0.6f, "TimeMsg"))/2-150+70, creatorButtons[2].y+10, 0.6f, Config::TxtColor, "TimeMsg", 140); + if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect } } @@ -284,7 +286,7 @@ void ScriptCreator::setInfoStuff(void) { void ScriptCreator::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) { if (hDown & KEY_B) { - Gui::screenBack(); + Gui::screenBack(Config::fading); return; } @@ -323,7 +325,7 @@ void ScriptCreator::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) { } if (hDown & KEY_DOWN) { - if(Selection == 0) Selection = 1; + if (Selection == 0) Selection = 1; } } @@ -364,7 +366,6 @@ void ScriptCreator::scriptLogic(u32 hDown, u32 hHeld, touchPosition touch) { } // Page 2. - if (hDown & KEY_R) { if (page == 0) { page = 1; diff --git a/source/screens/scriptlist.cpp b/source/screens/scriptlist.cpp index 966e552..7ff3bcb 100644 --- a/source/screens/scriptlist.cpp +++ b/source/screens/scriptlist.cpp @@ -160,7 +160,7 @@ void ScriptList::DrawSubMenu(void) const { } else { Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, Lang::get("SCRIPTS_SUBMENU"), 400); } - + if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect GFX::DrawBottom(); GFX::DrawArrow(0, 218, 0, 1); @@ -170,6 +170,7 @@ void ScriptList::DrawSubMenu(void) const { GFX::DrawButton(subPos[3].x, subPos[3].y, Lang::get("CHANGE_SCRIPTPATH")); // Selector. Animation::Button(subPos[Selection].x, subPos[Selection].y, .060); + if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect } // Load the description. @@ -192,7 +193,7 @@ ScriptList::ScriptList() { if (access(Config::AutobootFile.c_str(), F_OK) != 0) { AutobootWhat = 0; changeBackHandle = true; - Gui::setScreen(std::make_unique()); + Gui::setScreen(std::make_unique(), Config::fading, true); } if (ScriptHelper::checkIfValid(Config::AutobootFile) == true) { @@ -213,7 +214,7 @@ ScriptList::ScriptList() { } else { AutobootWhat = 0; changeBackHandle = true; - Gui::setScreen(std::make_unique()); + Gui::setScreen(std::make_unique(), Config::fading, true); } } } @@ -233,7 +234,7 @@ void ScriptList::DrawList(void) const { Gui::DrawStringCentered(0, 80, 0.7f, Config::TxtColor, Lang::get("TITLE") + std::string(fileInfo[Selection].title), 400); Gui::DrawStringCentered(0, 100, 0.7f, Config::TxtColor, Lang::get("AUTHOR") + std::string(fileInfo[Selection].author), 400); Gui::DrawStringCentered(0, 120, 0.6f, Config::TxtColor, std::string(fileInfo[Selection].shortDesc), 400); - + if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect GFX::DrawBottom(); GFX::DrawArrow(295, -1); GFX::DrawArrow(315, 240, 180.0); @@ -284,6 +285,7 @@ void ScriptList::DrawList(void) const { Gui::DrawString(dropPos[0].x+30, dropPos[0].y+5, 0.4f, Config::TxtColor, Lang::get("DELETE_DDM"), 100); Gui::DrawString(dropPos[1].x+30, dropPos[1].y+5, 0.4f, Config::TxtColor, Lang::get("VIEW_DDM"), 100); } + if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect } void ScriptList::Draw(void) const { @@ -312,6 +314,7 @@ void ScriptList::DrawSingleObject(void) const { for(uint i=0;i 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect GFX::DrawBottom(); GFX::DrawArrow(295, -1); GFX::DrawArrow(315, 240, 180.0); @@ -353,6 +356,7 @@ void ScriptList::DrawSingleObject(void) const { // Dropdown Text. Gui::DrawString(dropPos[0].x+30, dropPos[0].y+5, 0.4f, Config::TxtColor, Lang::get("VIEW_DDM"), 100); } + if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect } void ScriptList::refreshList() { @@ -377,9 +381,9 @@ void ScriptList::refreshList() { void ScriptList::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) { if ((hDown & KEY_B) || (hDown & KEY_TOUCH && touching(touch, arrowPos[2]))) { if (changeBackHandle) { - Gui::setScreen(std::make_unique()); + Gui::setScreen(std::make_unique(), Config::fading, true); } else { - Gui::screenBack(); + Gui::screenBack(Config::fading); return; } } @@ -413,14 +417,14 @@ void ScriptList::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) { break; case 1: if (checkWifiStatus() == true) { - Gui::setScreen(std::make_unique()); + Gui::setScreen(std::make_unique(), Config::fading, true); } else { notConnectedMsg(); } break; case 2: if (isTesting == true) { - Gui::setScreen(std::make_unique()); + Gui::setScreen(std::make_unique(), Config::fading, true); } else { notImplemented(); } @@ -451,13 +455,13 @@ void ScriptList::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) { } } else if (touching(touch, subPos[1])) { if (checkWifiStatus() == true) { - Gui::setScreen(std::make_unique()); + Gui::setScreen(std::make_unique(), Config::fading, true); } else { notConnectedMsg(); } } else if (touching(touch, subPos[2])) { if (isTesting == true) { - Gui::setScreen(std::make_unique()); + Gui::setScreen(std::make_unique(), Config::fading, true); } else { notImplemented(); } diff --git a/source/screens/settings.cpp b/source/screens/settings.cpp index ef76498..3f385ae 100644 --- a/source/screens/settings.cpp +++ b/source/screens/settings.cpp @@ -57,6 +57,7 @@ void Settings::DrawSubMenu(void) const { } else { Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, "Universal-Updater", 400); } + if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect GFX::DrawBottom(); GFX::DrawArrow(0, 218, 0, 1); GFX::DrawArrow(318, 240, 180.0, 1); @@ -66,6 +67,7 @@ void Settings::DrawSubMenu(void) const { GFX::DrawButton(mainButtons[2].x, mainButtons[2].y, Lang::get("CREDITS")); // Selector. Animation::Button(mainButtons[Selection].x, mainButtons[Selection].y, .060); + if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect } const std::vector languages = { @@ -91,6 +93,7 @@ void Settings::DrawLanguageSelection(void) const { } else { Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, Lang::get("SELECT_LANG"), 400); } + if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect GFX::DrawBottom(); for(int i=0;i 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect } const std::vector colorList = { @@ -155,7 +159,7 @@ void Settings::DrawColorChanging(void) const { } - + if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect GFX::DrawBottom(); if (!dropDownMenu) { GFX::DrawArrow(0, 218, 0, 1); @@ -222,6 +226,7 @@ void Settings::DrawColorChanging(void) const { GFX::DrawButton(mainButtons[2].x, mainButtons[2].y, ColorHelper::getColorName(Config::Button, 0).c_str(), C2D_Color32(0, 0, 255, 255)); } } + if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect } void Settings::DrawMiscSettings(void) const { @@ -231,26 +236,21 @@ void Settings::DrawMiscSettings(void) const { } else { Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, "Universal-Updater", 400); } - + if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect GFX::DrawBottom(); GFX::DrawArrow(0, 218, 0, 1); - GFX::DrawButton(mainButtons[0].x, mainButtons[0].y, Lang::get("CHANGE_MUSICFILE")); - GFX::DrawButton(mainButtons[1].x, mainButtons[1].y, Lang::get("CHANGE_BAR_STYLE")); - GFX::DrawButton(mainButtons[2].x, mainButtons[2].y, Lang::get("CHANGE_KEY_DELAY")); + GFX::DrawButton(mainButtons2[0].x, mainButtons2[0].y, Lang::get("CHANGE_MUSICFILE")); + GFX::DrawButton(mainButtons2[1].x, mainButtons2[1].y, Lang::get("CHANGE_BAR_STYLE")); + GFX::DrawButton(mainButtons2[2].x, mainButtons2[2].y, Lang::get("CHANGE_KEY_DELAY")); + GFX::DrawButton(mainButtons2[3].x, mainButtons2[3].y, Lang::get("TOGGLE_FADE")); + // Selector. - Animation::Button(mainButtons[Selection].x, mainButtons[Selection].y, .060); + Animation::Button(mainButtons2[Selection].x, mainButtons2[Selection].y, .060); + if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect } void Settings::MiscSettingsLogic(u32 hDown, u32 hHeld, touchPosition touch) { - if (hDown & KEY_UP) { - if (Selection > 0) Selection--; - } - - if (hDown & KEY_DOWN) { - if (Selection < 2) Selection++; - } - if (hDown & KEY_A) { if (Selection == 0) { std::string tempMusic = selectFilePath(Lang::get("SELECT_MUSIC_FILE"), "sdmc:/", {"wav"}, 2); @@ -265,23 +265,51 @@ void Settings::MiscSettingsLogic(u32 hDown, u32 hHeld, touchPosition touch) { } else if (Selection == 2) { Config::keyDelay = Input::getUint(255, Lang::get("ENTER_KEY_DELAY")); changesMade = true; + } else if (Selection == 3) { + if (Config::fading) { + if (Msg::promptMsg(Lang::get("TOGGLE_FADE_DISABLE"))) { + Config::fading = false; + Msg::DisplayWarnMsg(Lang::get("DISABLED")); + changesMade = true; + } + } else { + if (Msg::promptMsg(Lang::get("TOGGLE_FADE_ENABLE"))) { + Config::fading = true; + Msg::DisplayWarnMsg(Lang::get("ENABLED")); + changesMade = true; + } + } } } if (hDown & KEY_TOUCH) { - if (touching(touch, mainButtons[0])) { + if (touching(touch, mainButtons2[0])) { std::string tempMusic = selectFilePath(Lang::get("SELECT_MUSIC_FILE"), "sdmc:/", {"wav"}, 2); if (tempMusic != "") { Config::MusicPath = tempMusic; changesMade = true; } - } else if (touching(touch, mainButtons[1])) { + } else if (touching(touch, mainButtons2[1])) { if (Config::UseBars == true) Config::UseBars = false; else if (Config::UseBars == false) Config::UseBars = true; changesMade = true; - } else if (touching(touch, mainButtons[2])) { + } else if (touching(touch, mainButtons2[2])) { Config::keyDelay = Input::getUint(255, Lang::get("ENTER_KEY_DELAY")); changesMade = true; + } else if (touching(touch, mainButtons2[3])) { + if (Config::fading) { + if (Msg::promptMsg(Lang::get("TOGGLE_FADE_DISABLE"))) { + Config::fading = false; + Msg::DisplayWarnMsg(Lang::get("DISABLED")); + changesMade = true; + } + } else { + if (Msg::promptMsg(Lang::get("TOGGLE_FADE_ENABLE"))) { + Config::fading = true; + Msg::DisplayWarnMsg(Lang::get("ENABLED")); + changesMade = true; + } + } } } @@ -289,6 +317,18 @@ void Settings::MiscSettingsLogic(u32 hDown, u32 hHeld, touchPosition touch) { Selection = 0; mode = 0; } + + + // Navigation. + if (hDown & KEY_UP) { + if (Selection > 1) Selection -= 2; + } else if (hDown & KEY_DOWN) { + if (Selection < 3 && Selection != 2 && Selection != 3) Selection += 2; + } else if (hDown & KEY_LEFT) { + if (Selection%2) Selection--; + } else if (hDown & KEY_RIGHT) { + if (!(Selection%2)) Selection++; + } } @@ -313,7 +353,7 @@ void Settings::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) { mode = 2; break; case 2: - Gui::setScreen(std::make_unique()); + Gui::setScreen(std::make_unique(), Config::fading, true); break; } } @@ -327,12 +367,12 @@ void Settings::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) { screenPos = 0; mode = 2; } else if (touching(touch, mainButtons[2])) { - Gui::setScreen(std::make_unique()); + Gui::setScreen(std::make_unique(), Config::fading, true); } } if ((hDown & KEY_B) || (hDown & KEY_TOUCH && touching(touch, arrowPos[2]))) { - Gui::screenBack(); + Gui::screenBack(Config::fading); return; } diff --git a/source/screens/unistore.cpp b/source/screens/unistore.cpp index 669b9e9..595c392 100644 --- a/source/screens/unistore.cpp +++ b/source/screens/unistore.cpp @@ -183,7 +183,7 @@ UniStore::UniStore() { if (access(Config::AutobootFile.c_str(), F_OK) != 0) { AutobootWhat = 0; changeBackState = true; - Gui::setScreen(std::make_unique()); + Gui::setScreen(std::make_unique(), Config::fading, true); } StoreInfo SI; @@ -203,7 +203,7 @@ UniStore::UniStore() { } else { AutobootWhat = 0; changeBackState = true; - Gui::setScreen(std::make_unique()); + Gui::setScreen(std::make_unique(), Config::fading, true); } if (ScriptHelper::checkIfValid(Config::AutobootFile, 1) == true) { @@ -226,7 +226,7 @@ UniStore::UniStore() { } else { AutobootWhat = 0; changeBackState = true; - Gui::setScreen(std::make_unique()); + Gui::setScreen(std::make_unique(), Config::fading, true); } } } @@ -242,6 +242,7 @@ void UniStore::DrawSubMenu(void) const { } GFX::DrawSprite(sprites_uniStore_HD_idx, 140, 50, 0.2, 0.2); + if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect GFX::DrawBottom(); GFX::DrawArrow(0, 218, 0, 1); @@ -250,6 +251,7 @@ void UniStore::DrawSubMenu(void) const { GFX::DrawButton(subPos[2].x, subPos[2].y, Lang::get("CHANGE_STOREPATH")); // Selector. Animation::Button(subPos[Selection].x, subPos[Selection].y, .060); + if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect } @@ -269,7 +271,7 @@ void UniStore::DrawStoreList(void) const { for(uint i=0;i 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect GFX::DrawBottom(); GFX::DrawArrow(295, -1); GFX::DrawArrow(315, 240, 180.0); @@ -322,6 +324,7 @@ void UniStore::DrawStoreList(void) const { Gui::DrawString(dropPos[1].x+30, dropPos[1].y+5, 0.4f, Config::TxtColor, Lang::get("UPDATE_DDM"), 100); Gui::DrawString(dropPos[2].x+30, dropPos[2].y+5, 0.4f, Config::TxtColor, Lang::get("VIEW_DDM"), 100); } + if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect } void UniStore::DrawStore(void) const { @@ -368,6 +371,7 @@ void UniStore::DrawStore(void) const { } } + if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect GFX::DrawBottom(); // Bottom Background. if (appStoreJson.at("storeInfo").contains("iconIndexBottom") && sheetHasLoaded == true) { @@ -430,6 +434,7 @@ void UniStore::DrawStore(void) const { // Dropdown Text. Gui::DrawString(dropPos[0].x+30, dropPos[0].y+5, 0.4f, Config::TxtColor, Lang::get("VIEW_DDM"), 100); } + if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect } void UniStore::Draw(void) const { @@ -501,9 +506,9 @@ void UniStore::refreshList() { void UniStore::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) { if ((hDown & KEY_B) || (hDown & KEY_TOUCH && touching(touch, arrowPos[2]))) { if (changeBackState) { - Gui::setScreen(std::make_unique()); + Gui::setScreen(std::make_unique(), Config::fading, true); } else { - Gui::screenBack(); + Gui::screenBack(Config::fading); return; } } diff --git a/source/utils/config.cpp b/source/utils/config.cpp index f5e554c..2fba676 100644 --- a/source/utils/config.cpp +++ b/source/utils/config.cpp @@ -47,7 +47,6 @@ bool Config::Logging; bool Config::UseBars; std::string Config::StorePath; int Config::LangPath; -bool Config::GodMode = false; int Config::autoboot = 0; std::string Config::AutobootFile = ""; int Config::outdated; @@ -56,6 +55,7 @@ int Config::notFound; int Config::future; int Config::Button; int Config::keyDelay = 5; +bool Config::fading = true; nlohmann::json configJson; extern bool changesMade; @@ -208,6 +208,12 @@ void Config::load() { keyDelay = getInt("KEY_DELAY"); } + if(!configJson.contains("SCREEN_FADE")) { + fading = true; + } else { + fading = getBool("SCREEN_FADE"); + } + fclose(file); } else { Color1 = BarColor; @@ -233,6 +239,7 @@ void Config::load() { future = C2D_Color32(255, 255, 0, 255); Button = C2D_Color32(0, 0, 50, 255); keyDelay = 5; + fading = true; } } @@ -260,6 +267,7 @@ void Config::save() { setInt("FUTURE", future); setInt("BUTTON", Button); setInt("KEY_DELAY", keyDelay); + setBool("SCREEN_FADE", fading); 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); @@ -293,6 +301,7 @@ void Config::initializeNewConfig() { setInt("FUTURE", C2D_Color32(255, 255, 0, 255)); setInt("BUTTON", C2D_Color32(0, 0, 50, 255)); setInt("KEY_DELAY", 5); + setBool("SCREEN_FADE", true); if(file) fwrite(configJson.dump(1, '\t').c_str(), 1, configJson.dump(1, '\t').size(), file); fclose(file);