Add "VIEWMODE" to config.

This commit is contained in:
VoltZ
2019-11-13 23:33:59 +01:00
parent 6a12495e59
commit bb2cecc622
10 changed files with 32 additions and 32 deletions
-1
View File
@@ -40,7 +40,6 @@ public:
ScriptBrowse();
private:
int listMode = 0;
std::vector<DirEntry> dirContents;
mutable int screenPos = 0;
mutable int screenPosList = 0;
-1
View File
@@ -46,7 +46,6 @@ private:
void SelectFunction(u32 hDown, u32 hHeld);
int mode = 0;
int listMode = 0;
std::vector<DirEntry> dirContents;
mutable int screenPos = 0;
mutable int screenPosList = 0;
-1
View File
@@ -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;
+1 -1
View File
@@ -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();
+1 -1
View File
@@ -87,7 +87,7 @@ int main()
C3D_FrameEnd(0);
gspWaitForVBlank();
}
Config::save();
Gui::exit();
gfxExit();
cfguExit();
+7 -7
View File
@@ -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<ENTRIES_PER_SCREEN && i<(int)infoJson.size();i++) {
if(screenPos + i == selection) {
Gui::Draw_Rect(0, 40+(i*57), 320, 45, Config::SelectedColor);
@@ -149,7 +149,7 @@ void ScriptBrowse::Draw(void) const {
Gui::DrawStringCentered(0, 38+(i*57), 0.7f, Config::TxtColor, infoJson[screenPos+i]["title"], 320);
Gui::DrawStringCentered(0, 62+(i*57), 0.7f, Config::TxtColor, infoJson[screenPos+i]["author"], 320);
}
} else if (listMode == 1) {
} else if (Config::viewMode == 1) {
for(int i=0;i<ENTRIES_PER_LIST && i<(int)infoJson.size();i++) {
if(screenPosList + i == selection) {
Gui::Draw_Rect(0, 30+(i*25), 320, 30, Config::SelectedColor);
@@ -228,20 +228,20 @@ void ScriptBrowse::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;
}
}
if (listMode == 0) {
if (Config::viewMode == 0) {
if(selection < screenPos) {
screenPos = selection;
} else if (selection > 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) {
+11 -11
View File
@@ -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<ENTRIES_PER_SCREEN && i<(int)fileInfo.size();i++) {
line1 = fileInfo[screenPos + i].title;
line2 = fileInfo[screenPos + i].author;
@@ -323,7 +323,7 @@ void ScriptList::DrawList(void) const {
Gui::DrawStringCentered(0, 38+(i*57), 0.7f, Config::TxtColor, line1, 320);
Gui::DrawStringCentered(0, 62+(i*57), 0.7f, Config::TxtColor, line2, 320);
}
} else if (listMode == 1) {
} else if (Config::viewMode == 1) {
for(int i=0;i<ENTRIES_PER_LIST && i<(int)fileInfo.size();i++) {
line1 = fileInfo[screenPosList + i].title;
if(screenPosList + i == selection) {
@@ -363,7 +363,7 @@ void ScriptList::DrawSingleObject(void) const {
Gui::DrawStringCentered(0, 120-((lines.size()*20)/2)+i*20, 0.6f, TextColor, lines[i], 400);
}
Gui::DrawBottom();
if (listMode == 0) {
if (Config::viewMode == 0) {
for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)fileInfo2.size();i++) {
info = fileInfo2[screenPos2 + i];
if(screenPos2 + i == selection2) {
@@ -373,7 +373,7 @@ void ScriptList::DrawSingleObject(void) const {
}
Gui::DrawStringCentered(0, 50+(i*57), 0.7f, TextColor, info, 320);
}
} else if (listMode == 1) {
} else if (Config::viewMode == 1) {
for(int i=0;i<ENTRIES_PER_LIST && i<(int)fileInfo2.size();i++) {
info = fileInfo2[screenPosList2 + i];
if(screenPosList2 + i == selection2) {
@@ -445,13 +445,13 @@ void ScriptList::ListSelection(u32 hDown, u32 hHeld) {
fastMode = false;
}
if (listMode == 0) {
if (Config::viewMode == 0) {
if(selection < screenPos) {
screenPos = selection;
} else if (selection > 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;
}
}
}
-2
View File
@@ -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;
}
+7 -7
View File
@@ -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<ENTRIES_PER_SCREEN && i<(int)tinyDBList.size();i++) {
info = tinyDBList[screenPos + i];
if(screenPos + i == selection) {
@@ -128,7 +128,7 @@ void TinyDB::Draw(void) const {
}
Gui::DrawStringCentered(0, 50+(i*57), 0.7f, WHITE, info, 320);
}
} else if (listMode == 1) {
} else if (Config::viewMode == 1) {
for(int i=0;i<ENTRIES_PER_LIST && i<(int)tinyDBList.size();i++) {
info = tinyDBList[screenPosList + i];
if(screenPosList + i == selection) {
@@ -184,13 +184,13 @@ void TinyDB::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
}
}
if (listMode == 0) {
if (Config::viewMode == 0) {
if(selection < screenPos) {
screenPos = selection;
} else if (selection > 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;
}
}
+5
View File
@@ -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);
}