Press L/R for page forward scroll.

Also do keyDelay as a setting instead of hardcode to 3 (fast) 6 (slow).
This commit is contained in:
StackZ
2020-05-06 06:27:25 +02:00
parent 1c2a0de856
commit c8289ff632
12 changed files with 246 additions and 112 deletions
-1
View File
@@ -60,7 +60,6 @@ private:
// Browse stuff.
int keyRepeatDelay = 0;
int fastMode = false;
std::vector<DirEntry> dirContents;
void refresh();
void downloadAll();
-1
View File
@@ -86,7 +86,6 @@ private:
// Browse stuff.
int keyRepeatDelay = 0;
std::vector<DirEntry> dirContents;
int fastMode = false;
// Button | Icon structs.
+1 -14
View File
@@ -61,20 +61,7 @@ private:
std::vector<Structs::ButtonPos> mainButtons = {
{80, 30, 149, 52}, // Language.
{80, 90, 149, 52}, // Colors.
{80, 150, 149, 52} // Misc.
};
std::vector<Structs::ButtonPos> 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<Structs::ButtonPos> arrowPos = {
-1
View File
@@ -85,7 +85,6 @@ private:
// Browse stuff.
int keyRepeatDelay = 0;
int fastMode = false;
std::vector<DirEntry> dirContents;
// Other stuff.
+1 -1
View File
@@ -30,7 +30,7 @@
#include <string>
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;
+3 -1
View File
@@ -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."
}
+3
View File
@@ -43,6 +43,7 @@ const std::vector<std::string> Translators = {
"XDgierman",
"YoSoy"
};
const std::vector<std::string> Languages = {
"Русский",
"Dansk",
@@ -58,6 +59,7 @@ const std::vector<std::string> Languages = {
"Polski",
"Español"
};
// Universal-Team Page 2.
const std::vector<std::string> UniversalTeam = {
"DeadPhoenix",
@@ -67,6 +69,7 @@ const std::vector<std::string> UniversalTeam = {
"StackZ",
"TotallyNotGuy"
};
// Script Page 3.
const std::vector<std::string> ScriptCreators = {
"DualBladedKirito", "Glazed_Belmont", "Pk11", "StackZ", "The Conceptionist", "YoSoy"
+40 -18
View File
@@ -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;
}
+80 -35
View File
@@ -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) {
+8 -1
View File
@@ -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;
}
}
+100 -39
View File
@@ -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) {
+10
View File
@@ -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);