diff --git a/include/screens/scriptBrowse.hpp b/include/screens/scriptBrowse.hpp index 66fc130..1b9cb8d 100644 --- a/include/screens/scriptBrowse.hpp +++ b/include/screens/scriptBrowse.hpp @@ -60,7 +60,6 @@ private: // Browse stuff. int keyRepeatDelay = 0; - int fastMode = false; std::vector dirContents; void refresh(); void downloadAll(); diff --git a/include/screens/scriptlist.hpp b/include/screens/scriptlist.hpp index c4870bc..4459422 100644 --- a/include/screens/scriptlist.hpp +++ b/include/screens/scriptlist.hpp @@ -86,7 +86,6 @@ private: // Browse stuff. int keyRepeatDelay = 0; std::vector dirContents; - int fastMode = false; // Button | Icon structs. diff --git a/include/screens/settings.hpp b/include/screens/settings.hpp index b375087..a5aee86 100644 --- a/include/screens/settings.hpp +++ b/include/screens/settings.hpp @@ -61,20 +61,7 @@ private: std::vector mainButtons = { {80, 30, 149, 52}, // Language. {80, 90, 149, 52}, // Colors. - {80, 150, 149, 52} // Misc. - }; - - std::vector langBlocks = { - {37, 32, 20, 20}, - {37, 72, 20, 20}, - {37, 112, 20, 20}, - {37, 152, 20, 20}, - {37, 188, 20, 20}, - {177, 32, 20, 20}, - {177, 72, 20, 20}, - {177, 112, 20, 20}, - {177, 152, 20, 20}, - {177, 188, 20, 20}, + {80, 150, 149, 52} // Credits. }; std::vector arrowPos = { diff --git a/include/screens/unistore.hpp b/include/screens/unistore.hpp index 45b5ee7..0b143a0 100644 --- a/include/screens/unistore.hpp +++ b/include/screens/unistore.hpp @@ -85,7 +85,6 @@ private: // Browse stuff. int keyRepeatDelay = 0; - int fastMode = false; std::vector dirContents; // Other stuff. diff --git a/include/utils/config.hpp b/include/utils/config.hpp index 3b25516..21fa5d2 100644 --- a/include/utils/config.hpp +++ b/include/utils/config.hpp @@ -30,7 +30,7 @@ #include namespace Config { - extern int LangPath, Color1, Color2, Color3, TxtColor, SelectedColor, UnselectedColor, viewMode, progressbarColor, autoboot, outdated, uptodate, notFound, future, Button; + 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; diff --git a/romfs/lang/en/app.json b/romfs/lang/en/app.json index 25de1c9..9c43909 100644 --- a/romfs/lang/en/app.json +++ b/romfs/lang/en/app.json @@ -169,5 +169,7 @@ "SYNTAX_ERROR": "Syntax Error!", "COPY_ERROR": "Copy Error!", "MOVE_ERROR": "Move Error!", - "DELETE_ERROR": "Delete Error!" + "DELETE_ERROR": "Delete Error!", + "CHANGE_KEY_DELAY": "Change Key Delay", + "ENTER_KEY_DELAY": "Enter the Key Delay for Scrolling." } diff --git a/source/screens/credits.cpp b/source/screens/credits.cpp index 079f7e6..73dbafc 100644 --- a/source/screens/credits.cpp +++ b/source/screens/credits.cpp @@ -43,6 +43,7 @@ const std::vector Translators = { "XDgierman", "YoSoy" }; + const std::vector Languages = { "Русский", "Dansk", @@ -58,6 +59,7 @@ const std::vector Languages = { "Polski", "Español" }; + // Universal-Team Page 2. const std::vector UniversalTeam = { "DeadPhoenix", @@ -67,6 +69,7 @@ const std::vector UniversalTeam = { "StackZ", "TotallyNotGuy" }; + // Script Page 3. const std::vector ScriptCreators = { "DualBladedKirito", "Glazed_Belmont", "Pk11", "StackZ", "The Conceptionist", "YoSoy" diff --git a/source/screens/scriptBrowse.cpp b/source/screens/scriptBrowse.cpp index 9be4049..997376d 100644 --- a/source/screens/scriptBrowse.cpp +++ b/source/screens/scriptBrowse.cpp @@ -386,11 +386,44 @@ void ScriptBrowse::Logic(u32 hDown, u32 hHeld, touchPosition touch) { } else { Selection = 0; } - if (fastMode == true) { - keyRepeatDelay = 3; - } else if (fastMode == false){ - keyRepeatDelay = 6; + + keyRepeatDelay = Config::keyDelay; + } + + if ((hHeld & KEY_RIGHT && !keyRepeatDelay)) { + if (Config::viewMode == 0) { + if (Selection < (int)infoJson.size()-1-3) { + Selection += 3; + } else { + Selection = (int)infoJson.size()-1; + } + } else { + if (Selection < (int)infoJson.size()-1-6) { + Selection += 7; + } else { + Selection = (int)infoJson.size()-1; + } } + + keyRepeatDelay = Config::keyDelay; + } + + if ((hHeld & KEY_LEFT && !keyRepeatDelay)) { + if (Config::viewMode == 0) { + if (Selection > 2) { + Selection -= 3; + } else { + Selection = 0; + } + } else { + if (Selection > 6) { + Selection -= 7; + } else { + Selection = 0; + } + } + + keyRepeatDelay = Config::keyDelay; } if ((hDown & KEY_SELECT) || (hDown & KEY_TOUCH && touching(touch, arrowPos[3]))) { @@ -403,11 +436,8 @@ void ScriptBrowse::Logic(u32 hDown, u32 hHeld, touchPosition touch) { } else { Selection = (int)infoJson.size()-1; } - if (fastMode == true) { - keyRepeatDelay = 3; - } else if (fastMode == false){ - keyRepeatDelay = 6; - } + + keyRepeatDelay = Config::keyDelay; } if (hDown & KEY_TOUCH) { @@ -465,14 +495,6 @@ void ScriptBrowse::Logic(u32 hDown, u32 hHeld, touchPosition touch) { } } - if (hDown & KEY_R) { - fastMode = true; - } - - if (hDown & KEY_L) { - fastMode = false; - } - if (Config::viewMode == 0) { if(Selection < screenPos) { screenPos = Selection; @@ -488,7 +510,7 @@ void ScriptBrowse::Logic(u32 hDown, u32 hHeld, touchPosition touch) { } } // Switch to Glossary and back. - if (hDown & KEY_RIGHT || hDown & KEY_LEFT) { + if (hDown & KEY_R || hDown & KEY_L) { if (mode == 0) mode = 1; else mode = 0; } diff --git a/source/screens/scriptlist.cpp b/source/screens/scriptlist.cpp index 6434d7d..966e552 100644 --- a/source/screens/scriptlist.cpp +++ b/source/screens/scriptlist.cpp @@ -578,11 +578,8 @@ void ScriptList::ListSelection(u32 hDown, u32 hHeld, touchPosition touch) { } else { Selection = 0; } - if (fastMode == true) { - keyRepeatDelay = 3; - } else if (fastMode == false){ - keyRepeatDelay = 6; - } + + keyRepeatDelay = Config::keyDelay; } if ((hHeld & KEY_UP && !keyRepeatDelay) || (hDown & KEY_TOUCH && touching(touch, arrowPos[0]))) { @@ -591,11 +588,44 @@ void ScriptList::ListSelection(u32 hDown, u32 hHeld, touchPosition touch) { } else { Selection = (int)fileInfo.size()-1; } - if (fastMode == true) { - keyRepeatDelay = 3; - } else if (fastMode == false){ - keyRepeatDelay = 6; + + keyRepeatDelay = Config::keyDelay; + } + + if ((hHeld & KEY_RIGHT && !keyRepeatDelay)) { + if (Config::viewMode == 0) { + if (Selection < (int)fileInfo.size()-1-3) { + Selection += 3; + } else { + Selection = (int)fileInfo.size()-1; + } + } else { + if (Selection < (int)fileInfo.size()-1-6) { + Selection += 7; + } else { + Selection = (int)fileInfo.size()-1; + } } + + keyRepeatDelay = Config::keyDelay; + } + + if ((hHeld & KEY_LEFT && !keyRepeatDelay)) { + if (Config::viewMode == 0) { + if (Selection > 2) { + Selection -= 3; + } else { + Selection = 0; + } + } else { + if (Selection > 6) { + Selection -= 7; + } else { + Selection = 0; + } + } + + keyRepeatDelay = Config::keyDelay; } if (hDown & KEY_TOUCH) { @@ -663,14 +693,6 @@ void ScriptList::ListSelection(u32 hDown, u32 hHeld, touchPosition touch) { } } - if (hDown & KEY_R) { - fastMode = true; - } - - if (hDown & KEY_L) { - fastMode = false; - } - if (Config::viewMode == 0) { if(Selection < screenPos) { screenPos = Selection; @@ -734,11 +756,8 @@ void ScriptList::SelectFunction(u32 hDown, u32 hHeld, touchPosition touch) { } else { Selection = 0; } - if (fastMode == true) { - keyRepeatDelay = 3; - } else if (fastMode == false){ - keyRepeatDelay = 6; - } + + keyRepeatDelay = Config::keyDelay; } if ((hHeld & KEY_UP && !keyRepeatDelay) || (hDown & KEY_TOUCH && touching(touch, arrowPos[0]))) { @@ -747,11 +766,45 @@ void ScriptList::SelectFunction(u32 hDown, u32 hHeld, touchPosition touch) { } else { Selection = (int)fileInfo2.size()-1; } - if (fastMode == true) { - keyRepeatDelay = 3; - } else if (fastMode == false){ - keyRepeatDelay = 6; + + keyRepeatDelay = Config::keyDelay; + } + + + if ((hHeld & KEY_RIGHT && !keyRepeatDelay)) { + if (Config::viewMode == 0) { + if (Selection < (int)fileInfo2.size()-1-3) { + Selection += 3; + } else { + Selection = (int)fileInfo2.size()-1; + } + } else { + if (Selection < (int)fileInfo2.size()-1-6) { + Selection += 7; + } else { + Selection = (int)fileInfo2.size()-1; + } } + + keyRepeatDelay = Config::keyDelay; + } + + if ((hHeld & KEY_LEFT && !keyRepeatDelay)) { + if (Config::viewMode == 0) { + if (Selection > 2) { + Selection -= 3; + } else { + Selection = 0; + } + } else { + if (Selection > 6) { + Selection -= 7; + } else { + Selection = 0; + } + } + + keyRepeatDelay = Config::keyDelay; } if (hDown & KEY_TOUCH) { @@ -788,14 +841,6 @@ void ScriptList::SelectFunction(u32 hDown, u32 hHeld, touchPosition touch) { } } } - - if (hDown & KEY_R) { - fastMode = true; - } - - if (hDown & KEY_L) { - fastMode = false; - } if (hDown & KEY_SELECT) { Config::Color1 = barColor; @@ -832,7 +877,7 @@ void ScriptList::Logic(u32 hDown, u32 hHeld, touchPosition touch) { SelectFunction(hDown, hHeld, touch); } - if (hDown & KEY_LEFT || hDown & KEY_RIGHT) { + if (hDown & KEY_L || hDown & KEY_R) { if (mode == 3) { mode = lastMode; } else if (mode == 1) { diff --git a/source/screens/settings.cpp b/source/screens/settings.cpp index c639912..51771c2 100644 --- a/source/screens/settings.cpp +++ b/source/screens/settings.cpp @@ -237,6 +237,7 @@ void Settings::DrawMiscSettings(void) const { 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")); // Selector. Animation::Button(mainButtons[Selection].x, mainButtons[Selection].y, .060); } @@ -247,7 +248,7 @@ void Settings::MiscSettingsLogic(u32 hDown, u32 hHeld, touchPosition touch) { } if (hDown & KEY_DOWN) { - if (Selection < 1) Selection++; + if (Selection < 2) Selection++; } if (hDown & KEY_A) { @@ -261,6 +262,9 @@ void Settings::MiscSettingsLogic(u32 hDown, u32 hHeld, touchPosition touch) { if (Config::UseBars == true) Config::UseBars = false; else if (Config::UseBars == false) Config::UseBars = true; changesMade = true; + } else if (Selection == 2) { + Config::keyDelay = Input::getUint(255, Lang::get("ENTER_KEY_DELAY")); + changesMade = true; } } @@ -275,6 +279,9 @@ void Settings::MiscSettingsLogic(u32 hDown, u32 hHeld, touchPosition touch) { if (Config::UseBars == true) Config::UseBars = false; else if (Config::UseBars == false) Config::UseBars = true; changesMade = true; + } else if (touching(touch, mainButtons[2])) { + Config::keyDelay = Input::getUint(255, Lang::get("ENTER_KEY_DELAY")); + changesMade = true; } } diff --git a/source/screens/unistore.cpp b/source/screens/unistore.cpp index 9245a5c..669b9e9 100644 --- a/source/screens/unistore.cpp +++ b/source/screens/unistore.cpp @@ -536,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, {}); @@ -703,12 +703,10 @@ void UniStore::StoreSelectionLogic(u32 hDown, u32 hHeld, touchPosition touch) { descript(); loadStoreDesc(); } - if (fastMode == true) { - keyRepeatDelay = 3; - } else if (fastMode == false){ - keyRepeatDelay = 6; - } + + keyRepeatDelay = Config::keyDelay; } + if ((hHeld & KEY_UP && !keyRepeatDelay) || (hDown & KEY_TOUCH && touching(touch, arrowPos[0]))) { if (Selection > 0) { Selection--; @@ -719,11 +717,60 @@ void UniStore::StoreSelectionLogic(u32 hDown, u32 hHeld, touchPosition touch) { descript(); loadStoreDesc(); } - if (fastMode == true) { - keyRepeatDelay = 3; - } else if (fastMode == false){ - keyRepeatDelay = 6; + + keyRepeatDelay = Config::keyDelay; + } + + if ((hHeld & KEY_RIGHT && !keyRepeatDelay)) { + if (Config::viewMode == 0) { + if (Selection < (int)storeInfo.size()-1-3) { + Selection += 3; + descript(); + loadStoreDesc(); + } else { + Selection = (int)storeInfo.size()-1; + descript(); + loadStoreDesc(); + } + } else { + if (Selection < (int)storeInfo.size()-1-6) { + Selection += 7; + descript(); + loadStoreDesc(); + } else { + Selection = (int)storeInfo.size()-1; + descript(); + loadStoreDesc(); + } } + + keyRepeatDelay = Config::keyDelay; + } + + if ((hHeld & KEY_LEFT && !keyRepeatDelay)) { + if (Config::viewMode == 0) { + if (Selection > 2) { + Selection -= 3; + descript(); + loadStoreDesc(); + } else { + Selection = 0; + descript(); + loadStoreDesc(); + } + } else { + if (Selection > 6) { + Selection -= 7; + descript(); + loadStoreDesc(); + } else { + Selection = 0; + descript(); + loadStoreDesc(); + } + } + + keyRepeatDelay = Config::keyDelay; } if (hDown & KEY_A) { @@ -750,14 +797,6 @@ void UniStore::StoreSelectionLogic(u32 hDown, u32 hHeld, touchPosition touch) { } } - if (hDown & KEY_R) { - fastMode = true; - } - - if (hDown & KEY_L) { - fastMode = false; - } - if (Config::viewMode == 0) { if(Selection < screenPos) { screenPos = Selection; @@ -891,14 +930,6 @@ void UniStore::StoreLogic(u32 hDown, u32 hHeld, touchPosition touch) { freeSheet(); } - if (hDown & KEY_R) { - fastMode = true; - } - - if (hDown & KEY_L) { - fastMode = false; - } - // Go one entry up. if ((hHeld & KEY_UP && !keyRepeatDelay) || (hDown & KEY_TOUCH && touching(touch, arrowPos[0]))) { if (Selection > 0) { @@ -906,11 +937,8 @@ void UniStore::StoreLogic(u32 hDown, u32 hHeld, touchPosition touch) { } else { Selection = (int)appStoreJson.at("storeContent").size()-1; } - if (fastMode == true) { - keyRepeatDelay = 3; - } else if (fastMode == false){ - keyRepeatDelay = 6; - } + + keyRepeatDelay = Config::keyDelay; } // Go one entry down. @@ -920,11 +948,44 @@ void UniStore::StoreLogic(u32 hDown, u32 hHeld, touchPosition touch) { } else { Selection = 0; } - if (fastMode == true) { - keyRepeatDelay = 3; - } else if (fastMode == false){ - keyRepeatDelay = 6; + + keyRepeatDelay = Config::keyDelay; + } + + if ((hHeld & KEY_RIGHT && !keyRepeatDelay)) { + if (Config::viewMode == 0) { + if (Selection < (int)appStoreJson.at("storeContent").size()-1-3) { + Selection += 3; + } else { + Selection = (int)appStoreJson.at("storeContent").size()-1; + } + } else { + if (Selection < (int)appStoreJson.at("storeContent").size()-1-6) { + Selection += 7; + } else { + Selection = (int)appStoreJson.at("storeContent").size()-1; + } } + + keyRepeatDelay = Config::keyDelay; + } + + if ((hHeld & KEY_LEFT && !keyRepeatDelay)) { + if (Config::viewMode == 0) { + if (Selection > 2) { + Selection -= 3; + } else { + Selection = 0; + } + } else { + if (Selection > 6) { + Selection -= 7; + } else { + Selection = 0; + } + } + + keyRepeatDelay = Config::keyDelay; } // Execute touched Entry. @@ -990,7 +1051,7 @@ void UniStore::Logic(u32 hDown, u32 hHeld, touchPosition touch) { GitHubLogic(hDown, hHeld, touch); } - if (hDown & KEY_LEFT || hDown & KEY_RIGHT) { + if (hDown & KEY_L || hDown & KEY_R) { if (mode == 6) { mode = lastMode; } else if (mode == 1) { diff --git a/source/utils/config.cpp b/source/utils/config.cpp index 2e7f6cb..f5e554c 100644 --- a/source/utils/config.cpp +++ b/source/utils/config.cpp @@ -55,6 +55,7 @@ int Config::uptodate; int Config::notFound; int Config::future; int Config::Button; +int Config::keyDelay = 5; nlohmann::json configJson; extern bool changesMade; @@ -201,6 +202,12 @@ void Config::load() { Button = getInt("BUTTON"); } + if(!configJson.contains("KEY_DELAY")) { + keyDelay = 5; + } else { + keyDelay = getInt("KEY_DELAY"); + } + fclose(file); } else { Color1 = BarColor; @@ -225,6 +232,7 @@ void Config::load() { notFound = C2D_Color32(255, 128, 0, 255); future = C2D_Color32(255, 255, 0, 255); Button = C2D_Color32(0, 0, 50, 255); + keyDelay = 5; } } @@ -251,6 +259,7 @@ void Config::save() { setInt("NOTFOUND", notFound); setInt("FUTURE", future); setInt("BUTTON", Button); + setInt("KEY_DELAY", keyDelay); 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); @@ -283,6 +292,7 @@ void Config::initializeNewConfig() { setInt("NOTFOUND", C2D_Color32(255, 128, 0, 255)); setInt("FUTURE", C2D_Color32(255, 255, 0, 255)); setInt("BUTTON", C2D_Color32(0, 0, 50, 255)); + setInt("KEY_DELAY", 5); if(file) fwrite(configJson.dump(1, '\t').c_str(), 1, configJson.dump(1, '\t').size(), file); fclose(file);