diff --git a/include/screens/scriptBrowse.hpp b/include/screens/scriptBrowse.hpp index aba3270..5c710c4 100644 --- a/include/screens/scriptBrowse.hpp +++ b/include/screens/scriptBrowse.hpp @@ -40,7 +40,6 @@ public: ScriptBrowse(); private: - int listMode = 0; std::vector dirContents; mutable int screenPos = 0; mutable int screenPosList = 0; diff --git a/include/screens/scriptlist.hpp b/include/screens/scriptlist.hpp index 03573e1..e83d696 100644 --- a/include/screens/scriptlist.hpp +++ b/include/screens/scriptlist.hpp @@ -46,7 +46,6 @@ private: void SelectFunction(u32 hDown, u32 hHeld); int mode = 0; - int listMode = 0; std::vector dirContents; mutable int screenPos = 0; mutable int screenPosList = 0; diff --git a/include/screens/tinyDB.hpp b/include/screens/tinyDB.hpp index b57cb52..9965909 100644 --- a/include/screens/tinyDB.hpp +++ b/include/screens/tinyDB.hpp @@ -40,7 +40,6 @@ private: void execute(); mutable int selection = 0; int screenPos = 0; - int listMode = 0; mutable int screenPosList = 0; int keyRepeatDelay = 0; int fastMode = false; diff --git a/include/utils/config.hpp b/include/utils/config.hpp index ecce34b..7177f3e 100644 --- a/include/utils/config.hpp +++ b/include/utils/config.hpp @@ -32,7 +32,7 @@ namespace Config { // [UI] extern int lang; // The current Language. - extern int Color1, Color2, Color3, TxtColor, SelectedColor, UnselectedColor; // Colors! + extern int Color1, Color2, Color3, TxtColor, SelectedColor, UnselectedColor, viewMode; extern std::string ScriptPath; void load(); diff --git a/source/main.cpp b/source/main.cpp index 908c103..1a121f4 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -87,7 +87,7 @@ int main() C3D_FrameEnd(0); gspWaitForVBlank(); } - + Config::save(); Gui::exit(); gfxExit(); cfguExit(); diff --git a/source/screens/scriptBrowse.cpp b/source/screens/scriptBrowse.cpp index 1a65c27..79facae 100644 --- a/source/screens/scriptBrowse.cpp +++ b/source/screens/scriptBrowse.cpp @@ -133,7 +133,7 @@ void ScriptBrowse::Draw(void) const { Gui::DrawString(7.5, 1.5, 0.72f, BLACK, "\uE003"); Gui::DrawString(317-Gui::GetStringWidth(0.6f, std::to_string(selection + 1) + " / " + maxScripts), 4, 0.6f, Config::TxtColor, std::to_string(selection + 1) + " / " + maxScripts); - if (listMode == 0) { + if (Config::viewMode == 0) { for(int i=0;i screenPos + ENTRIES_PER_SCREEN - 1) { screenPos = selection - ENTRIES_PER_SCREEN + 1; } - } else if (listMode == 1) { + } else if (Config::viewMode == 1) { if(selection < screenPosList) { screenPosList = selection; } else if (selection > screenPosList + ENTRIES_PER_LIST - 1) { diff --git a/source/screens/scriptlist.cpp b/source/screens/scriptlist.cpp index ec77c4c..b7a20d0 100644 --- a/source/screens/scriptlist.cpp +++ b/source/screens/scriptlist.cpp @@ -311,7 +311,7 @@ void ScriptList::DrawList(void) const { Gui::DrawStringCentered(0, 120, 0.6f, Config::TxtColor, std::string(fileInfo[selection].shortDesc), 400); Gui::DrawBottom(); - if (listMode == 0) { + if (Config::viewMode == 0) { for(int i=0;i screenPos + ENTRIES_PER_SCREEN - 1) { screenPos = selection - ENTRIES_PER_SCREEN + 1; } - } else if (listMode == 1) { + } else if (Config::viewMode == 1) { if(selection < screenPosList) { screenPosList = selection; } else if (selection > screenPosList + ENTRIES_PER_LIST - 1) { @@ -518,13 +518,13 @@ void ScriptList::SelectFunction(u32 hDown, u32 hHeld) { mode = 0; } - if (listMode == 0) { + if (Config::viewMode == 0) { if(selection2 < screenPos2) { screenPos2 = selection2; } else if (selection2 > screenPos2 + ENTRIES_PER_SCREEN - 1) { screenPos2 = selection2 - ENTRIES_PER_SCREEN + 1; } - } else if (listMode == 1) { + } else if (Config::viewMode == 1) { if(selection2 < screenPosList2) { screenPosList2 = selection2; } else if (selection2 > screenPosList2 + ENTRIES_PER_LIST - 1) { @@ -542,10 +542,10 @@ void ScriptList::Logic(u32 hDown, u32 hHeld, touchPosition touch) { } if (hDown & KEY_X) { - if (listMode == 0) { - listMode = 1; + if (Config::viewMode == 0) { + Config::viewMode = 1; } else { - listMode = 0; + Config::viewMode = 0; } } } \ No newline at end of file diff --git a/source/screens/settings.cpp b/source/screens/settings.cpp index 8887f0c..3468c8a 100644 --- a/source/screens/settings.cpp +++ b/source/screens/settings.cpp @@ -235,7 +235,6 @@ void Settings::LanguageSelection(u32 hDown, touchPosition touch) { if (touching(touch, langBlocks[language])) { Config::lang = language; Lang::load(Config::lang); - Config::save(); } } } @@ -252,7 +251,6 @@ void Settings::colorChanging(u32 hDown, touchPosition touch) { int blue; if (hDown & KEY_B) { - Config::save(); mode = 0; } diff --git a/source/screens/tinyDB.cpp b/source/screens/tinyDB.cpp index 6598fc3..e7c09b7 100644 --- a/source/screens/tinyDB.cpp +++ b/source/screens/tinyDB.cpp @@ -118,7 +118,7 @@ void TinyDB::Draw(void) const { Gui::sprite(sprites_search_idx, -3, 0); Gui::DrawString(7.5, 1.5, 0.72f, BLACK, "\uE003"); - if (listMode == 0) { + if (Config::viewMode == 0) { for(int i=0;i screenPos + ENTRIES_PER_SCREEN - 1) { screenPos = selection - ENTRIES_PER_SCREEN + 1; } - } else if (listMode == 1) { + } else if (Config::viewMode == 1) { if(selection < screenPosList) { screenPosList = selection; } else if (selection > screenPosList + ENTRIES_PER_LIST - 1) { @@ -199,10 +199,10 @@ void TinyDB::Logic(u32 hDown, u32 hHeld, touchPosition touch) { } if (hDown & KEY_X) { - if (listMode == 0) { - listMode = 1; + if (Config::viewMode == 0) { + Config::viewMode = 1; } else { - listMode = 0; + Config::viewMode = 0; } } diff --git a/source/utils/config.cpp b/source/utils/config.cpp index 73b955a..bde1dab 100644 --- a/source/utils/config.cpp +++ b/source/utils/config.cpp @@ -40,6 +40,7 @@ int Config::Color3; int Config::TxtColor; int Config::SelectedColor; int Config::UnselectedColor; +int Config::viewMode; std::string Config::ScriptPath; nlohmann::json configJson; @@ -55,6 +56,7 @@ void Config::load() { Config::UnselectedColor = getInt("UNSELECTEDCOLOR"); Config::ScriptPath = getString("SCRIPTPATH"); Config::lang = getInt("LANGUAGE"); + Config::viewMode = getInt("VIEWMODE"); fclose(file); } else { Config::Color1 = BarColor; @@ -65,6 +67,7 @@ void Config::load() { Config::UnselectedColor = UnselectedColordefault; Config::ScriptPath = SCRIPTS_PATH; Config::lang = 2; + Config::viewMode = 0; } } @@ -77,6 +80,7 @@ void Config::save() { Config::setInt("UNSELECTEDCOLOR", Config::UnselectedColor); Config::setString("SCRIPTPATH", Config::ScriptPath); Config::setInt("LANGUAGE", Config::lang); + Config::setInt("VIEWMODE", Config::viewMode); 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); fclose(file); @@ -93,6 +97,7 @@ void Config::initializeNewConfig() { Config::setInt("UNSELECTEDCOLOR", UnselectedColordefault); Config::setString("SCRIPTPATH", SCRIPTS_PATH); Config::setInt("LANGUAGE", 2); + Config::setInt("VIEWMODE", 0); if(file) fwrite(configJson.dump(1, '\t').c_str(), 1, configJson.dump(1, '\t').size(), file); fclose(file); }