mirror of
https://github.com/DarkStore-3DS/DarkStore.git
synced 2026-07-03 00:39:02 +00:00
Add second Settingspage and make bars changeable.
This commit is contained in:
+16
-8
@@ -211,14 +211,18 @@ void Gui::DrawTop(void) {
|
||||
Gui::Draw_Rect(0, 0, 400, 25, Config::Color1);
|
||||
Gui::Draw_Rect(0, 25, 400, 190, Config::Color2);
|
||||
Gui::Draw_Rect(0, 215, 400, 25, Config::Color1);
|
||||
Gui::sprite(sprites_top_screen_top_idx, 0, 0);
|
||||
Gui::sprite(sprites_top_screen_bot_idx, 0, 215);
|
||||
if (Config::UseBars == true) {
|
||||
Gui::sprite(sprites_top_screen_top_idx, 0, 0);
|
||||
Gui::sprite(sprites_top_screen_bot_idx, 0, 215);
|
||||
}
|
||||
} else if (isScriptSelected == true) {
|
||||
Gui::Draw_Rect(0, 0, 400, 30, barColor);
|
||||
Gui::Draw_Rect(0, 25, 400, 190, bgBottomColor);
|
||||
Gui::Draw_Rect(0, 215, 400, 25, barColor);
|
||||
Gui::sprite(sprites_top_screen_top_idx, 0, 0);
|
||||
Gui::sprite(sprites_top_screen_bot_idx, 0, 215);
|
||||
if (Config::UseBars == true) {
|
||||
Gui::sprite(sprites_top_screen_top_idx, 0, 0);
|
||||
Gui::sprite(sprites_top_screen_bot_idx, 0, 215);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -228,14 +232,18 @@ void Gui::DrawBottom(void) {
|
||||
Gui::Draw_Rect(0, 0, 320, 25, Config::Color1);
|
||||
Gui::Draw_Rect(0, 25, 320, 190, Config::Color3);
|
||||
Gui::Draw_Rect(0, 215, 320, 25, Config::Color1);
|
||||
Gui::sprite(sprites_bottom_screen_top_idx, 0, 0);
|
||||
Gui::sprite(sprites_bottom_screen_bot_idx, 0, 215);
|
||||
if (Config::UseBars == true) {
|
||||
Gui::sprite(sprites_bottom_screen_top_idx, 0, 0);
|
||||
Gui::sprite(sprites_bottom_screen_bot_idx, 0, 215);
|
||||
}
|
||||
} else if (isScriptSelected == true) {
|
||||
Gui::Draw_Rect(0, 0, 320, 30, barColor);
|
||||
Gui::Draw_Rect(0, 25, 320, 190, bgBottomColor);
|
||||
Gui::Draw_Rect(0, 215, 320, 25, barColor);
|
||||
Gui::sprite(sprites_bottom_screen_top_idx, 0, 0);
|
||||
Gui::sprite(sprites_bottom_screen_bot_idx, 0, 215);
|
||||
if (Config::UseBars == true) {
|
||||
Gui::sprite(sprites_bottom_screen_top_idx, 0, 0);
|
||||
Gui::sprite(sprites_bottom_screen_bot_idx, 0, 215);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,11 @@ void FTPScreen::Draw(void) const
|
||||
Gui::clearTextBufs();
|
||||
C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
|
||||
Gui::DrawTop();
|
||||
Gui::DrawString((400-Gui::GetStringWidth(0.7f, Lang::get("FTP_MODE")))/2, 0, 0.7f, Config::TxtColor, Lang::get("FTP_MODE"), 400);
|
||||
if (Config::UseBars == true) {
|
||||
Gui::DrawString((400-Gui::GetStringWidth(0.7f, Lang::get("FTP_MODE")))/2, 0, 0.7f, Config::TxtColor, Lang::get("FTP_MODE"), 400);
|
||||
} else {
|
||||
Gui::DrawString((400-Gui::GetStringWidth(0.7f, Lang::get("FTP_MODE")))/2, 2, 0.7f, Config::TxtColor, Lang::get("FTP_MODE"), 400);
|
||||
}
|
||||
Gui::DrawBottom();
|
||||
Gui::DrawArrow(0, 218, 0, 1);
|
||||
ret = ACU_GetWifiStatus(&wifiStatus);
|
||||
|
||||
@@ -50,8 +50,15 @@ bool isTesting = false;
|
||||
|
||||
void MainMenu::Draw(void) const {
|
||||
Gui::DrawTop();
|
||||
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, "Universal-Updater", 400);
|
||||
Gui::DrawString(397-Gui::GetStringWidth(0.5f, V_STRING), 239-Gui::GetStringHeight(0.5f, V_STRING), 0.5f, Config::TxtColor, V_STRING);
|
||||
|
||||
if (Config::UseBars == true) {
|
||||
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, "Universal-Updater", 400);
|
||||
Gui::DrawString(397-Gui::GetStringWidth(0.5f, V_STRING), 239-Gui::GetStringHeight(0.5f, V_STRING), 0.5f, Config::TxtColor, V_STRING);
|
||||
} else {
|
||||
Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, "Universal-Updater", 400);
|
||||
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
|
||||
Gui::DrawBottom();
|
||||
Gui::DrawArrow(0, 218, 0, 1);
|
||||
|
||||
@@ -114,8 +114,13 @@ void ScriptBrowse::Draw(void) const {
|
||||
revision += " / ";
|
||||
revision += std::to_string(int64_t(infoJson[selection]["revision"]));
|
||||
|
||||
Gui::DrawString(397-Gui::GetStringWidth(0.6f, revision), 239-Gui::GetStringHeight(0.6f, revision), 0.6f, Config::TxtColor, revision);
|
||||
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, std::string(infoJson[selection]["title"]), 400);
|
||||
if (Config::UseBars == true) {
|
||||
Gui::DrawString(397-Gui::GetStringWidth(0.6f, revision), 239-Gui::GetStringHeight(0.6f, revision), 0.6f, Config::TxtColor, revision);
|
||||
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, std::string(infoJson[selection]["title"]), 400);
|
||||
} else {
|
||||
Gui::DrawString(397-Gui::GetStringWidth(0.6f, revision), 237-Gui::GetStringHeight(0.6f, revision), 0.6f, Config::TxtColor, revision);
|
||||
Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, std::string(infoJson[selection]["title"]), 400);
|
||||
}
|
||||
|
||||
Gui::DrawStringCentered(0, 120, 0.6f, Config::TxtColor, std::string(infoJson[selection]["shortDesc"]), 400);
|
||||
if(infoJson[selection]["curRevision"] < infoJson[selection]["revision"]) {
|
||||
|
||||
@@ -278,9 +278,13 @@ void ScriptList::DrawList(void) const {
|
||||
std::string line2;
|
||||
std::string scriptAmount = std::to_string(selection +1) + " / " + std::to_string(fileInfo.size());
|
||||
Gui::DrawTop();
|
||||
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, "Universal-Updater", 400);
|
||||
Gui::DrawString(397-Gui::GetStringWidth(0.6f, scriptAmount), 239-Gui::GetStringHeight(0.6f, scriptAmount), 0.6f, Config::TxtColor, scriptAmount);
|
||||
|
||||
if (Config::UseBars == true) {
|
||||
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, "Universal-Updater", 400);
|
||||
Gui::DrawString(397-Gui::GetStringWidth(0.6f, scriptAmount), 239-Gui::GetStringHeight(0.6f, scriptAmount), 0.6f, Config::TxtColor, scriptAmount);
|
||||
} else {
|
||||
Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, "Universal-Updater", 400);
|
||||
Gui::DrawString(397-Gui::GetStringWidth(0.6f, scriptAmount), 237-Gui::GetStringHeight(0.6f, scriptAmount), 0.6f, Config::TxtColor, scriptAmount);
|
||||
}
|
||||
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);
|
||||
@@ -337,8 +341,13 @@ void ScriptList::DrawSingleObject(void) const {
|
||||
std::string info;
|
||||
std::string entryAmount = std::to_string(selection2+1) + " / " + std::to_string(fileInfo2.size());
|
||||
Gui::DrawTop();
|
||||
Gui::DrawStringCentered(0, 0, 0.7f, TextColor, selectedTitle, 400);
|
||||
Gui::DrawString(397-Gui::GetStringWidth(0.6f, entryAmount), 239-Gui::GetStringHeight(0.6f, entryAmount), 0.6f, Config::TxtColor, entryAmount);
|
||||
if (Config::UseBars == true) {
|
||||
Gui::DrawStringCentered(0, 0, 0.7f, TextColor, selectedTitle, 400);
|
||||
Gui::DrawString(397-Gui::GetStringWidth(0.6f, entryAmount), 239-Gui::GetStringHeight(0.6f, entryAmount), 0.6f, Config::TxtColor, entryAmount);
|
||||
} else {
|
||||
Gui::DrawStringCentered(0, 2, 0.7f, TextColor, selectedTitle, 400);
|
||||
Gui::DrawString(397-Gui::GetStringWidth(0.6f, entryAmount), 237-Gui::GetStringHeight(0.6f, entryAmount), 0.6f, Config::TxtColor, entryAmount);
|
||||
}
|
||||
for(uint i=0;i<lines.size();i++) {
|
||||
Gui::DrawStringCentered(0, 120-((lines.size()*20)/2)+i*20, 0.6f, TextColor, lines[i], 400);
|
||||
}
|
||||
|
||||
+114
-7
@@ -47,15 +47,22 @@ void Settings::Draw(void) const {
|
||||
DrawColorChanging();
|
||||
} else if (mode == 3) {
|
||||
DrawCreditsScreen();
|
||||
} else if (mode == 4) {
|
||||
DrawMiscSettings();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Settings::DrawSubMenu(void) const {
|
||||
Gui::DrawTop();
|
||||
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, "Universal-Updater", 400);
|
||||
if (Config::UseBars == true) {
|
||||
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, "Universal-Updater", 400);
|
||||
} else {
|
||||
Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, "Universal-Updater", 400);
|
||||
}
|
||||
Gui::DrawBottom();
|
||||
Gui::DrawArrow(0, 218, 0, 1);
|
||||
Gui::DrawArrow(318, 240, 180.0, 1);
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if (Selection == i) {
|
||||
@@ -72,7 +79,11 @@ void Settings::DrawSubMenu(void) const {
|
||||
|
||||
void Settings::DrawLanguageSelection(void) const {
|
||||
Gui::DrawTop();
|
||||
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, Lang::get("SELECT_LANG"), 400);
|
||||
if (Config::UseBars == true) {
|
||||
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, Lang::get("SELECT_LANG"), 400);
|
||||
} else {
|
||||
Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, Lang::get("SELECT_LANG"), 400);
|
||||
}
|
||||
Gui::DrawBottom();
|
||||
Gui::DrawArrow(0, 218, 0, 1);
|
||||
|
||||
@@ -99,7 +110,11 @@ void Settings::DrawLanguageSelection(void) const {
|
||||
|
||||
void Settings::DrawColorChanging(void) const {
|
||||
Gui::DrawTop();
|
||||
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, "Universal-Updater", 400);
|
||||
if (Config::UseBars == true) {
|
||||
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, "Universal-Updater", 400);
|
||||
} else {
|
||||
Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, "Universal-Updater", 400);
|
||||
}
|
||||
|
||||
if (colorMode == 3) {
|
||||
Gui::Draw_Rect(0, 40, 400, 45, Config::SelectedColor);
|
||||
@@ -184,7 +199,11 @@ void Settings::DrawCreditsScreen(void) const {
|
||||
std::string title = "Universal-Updater - ";
|
||||
title += Lang::get("CREDITS");
|
||||
|
||||
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, title, 400);
|
||||
if (Config::UseBars == true) {
|
||||
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, title, 400);
|
||||
} else {
|
||||
Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, title, 400);
|
||||
}
|
||||
Gui::DrawStringCentered(0, 40, 0.8f, Config::TxtColor, Lang::get("DEVELOPED_BY"), 400);
|
||||
Gui::DrawStringCentered(0, 70, 0.8f, Config::TxtColor, Lang::get("MAIN_DEV"), 400);
|
||||
Gui::sprite(sprites_voltZ_idx, 150, 115);
|
||||
@@ -211,14 +230,92 @@ void Settings::DrawCreditsScreen(void) const {
|
||||
}
|
||||
}
|
||||
|
||||
void Settings::DrawMiscSettings(void) const {
|
||||
Gui::DrawTop();
|
||||
if (Config::UseBars == true) {
|
||||
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, "Universal-Updater", 400);
|
||||
} else {
|
||||
Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, "Universal-Updater", 400);
|
||||
}
|
||||
|
||||
void Settings::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
||||
Gui::DrawBottom();
|
||||
Gui::DrawArrow(0, 218, 0, 1);
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if (Selection == i) {
|
||||
Gui::Draw_Rect(mainButtons[i].x, mainButtons[i].y, mainButtons[i].w, mainButtons[i].h, Config::SelectedColor);
|
||||
} else {
|
||||
Gui::Draw_Rect(mainButtons[i].x, mainButtons[i].y, mainButtons[i].w, mainButtons[i].h, Config::UnselectedColor);
|
||||
}
|
||||
}
|
||||
|
||||
Gui::DrawStringCentered(0, mainButtons[0].y+10, 0.6f, Config::TxtColor, Lang::get("CHANGE_BARS"), 140);
|
||||
Gui::DrawStringCentered(0, mainButtons[1].y+10, 0.6f, Config::TxtColor, Lang::get("CHANGE_SCRIPTPATH"), 140);
|
||||
Gui::DrawStringCentered(0, mainButtons[2].y+10, 0.6f, Config::TxtColor, Lang::get("CHANGE_MUSICFILE"), 140);
|
||||
}
|
||||
|
||||
void Settings::MiscSettingsLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
||||
if (hDown & KEY_UP) {
|
||||
if(Selection > 0) Selection--;
|
||||
}
|
||||
|
||||
if (hDown & KEY_Y) {
|
||||
Config::ScriptPath = selectFilePath(Lang::get("SELECT_SCRIPT_PATH"));
|
||||
if (hDown & KEY_DOWN) {
|
||||
if(Selection < 2) Selection++;
|
||||
}
|
||||
|
||||
if (hDown & KEY_A) {
|
||||
if (Selection == 0) {
|
||||
if (Config::UseBars == true) {
|
||||
Config::UseBars = false;
|
||||
} else if (Config::UseBars == false) {
|
||||
Config::UseBars = true;
|
||||
}
|
||||
} else if (Selection == 1) {
|
||||
std::string tempScript = selectFilePath(Lang::get("SELECT_SCRIPT_PATH"), {});
|
||||
if (tempScript != "") {
|
||||
Config::ScriptPath = tempScript;
|
||||
}
|
||||
} else if (Selection == 2) {
|
||||
std::string tempMusic = selectFilePath(Lang::get("SELECT_MUSIC_FILE"), {"wav"}, 2);
|
||||
if (tempMusic != "") {
|
||||
Config::MusicPath = tempMusic;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (hDown & KEY_TOUCH) {
|
||||
if (touching(touch, mainButtons[0])) {
|
||||
if (Config::UseBars == true) {
|
||||
Config::UseBars = false;
|
||||
} else if (Config::UseBars == false) {
|
||||
Config::UseBars = true;
|
||||
}
|
||||
} else if (touching(touch, mainButtons[1])) {
|
||||
std::string tempScript = selectFilePath(Lang::get("SELECT_SCRIPT_PATH"), {});
|
||||
if (tempScript != "") {
|
||||
Config::ScriptPath = tempScript;
|
||||
}
|
||||
} else if (touching(touch, mainButtons[2])) {
|
||||
std::string tempMusic = selectFilePath(Lang::get("SELECT_MUSIC_FILE"), {"wav"}, 2);
|
||||
if (tempMusic != "") {
|
||||
Config::MusicPath = tempMusic;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (hDown & KEY_B || hDown & KEY_L) {
|
||||
mode = 0;
|
||||
}
|
||||
|
||||
if (hDown & KEY_TOUCH && touching(touch, arrowPos[2])) {
|
||||
mode = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Settings::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
||||
if (hDown & KEY_UP) {
|
||||
if(Selection > 0) Selection--;
|
||||
}
|
||||
|
||||
if (hDown & KEY_DOWN) {
|
||||
@@ -258,6 +355,14 @@ void Settings::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
||||
Screen::back();
|
||||
return;
|
||||
}
|
||||
|
||||
if (hDown & KEY_TOUCH && touching(touch, arrowPos[4])) {
|
||||
mode = 4;
|
||||
}
|
||||
|
||||
if (hDown & KEY_R) {
|
||||
mode = 4;
|
||||
}
|
||||
}
|
||||
|
||||
void Settings::LanguageSelection(u32 hDown, touchPosition touch) {
|
||||
@@ -457,5 +562,7 @@ void Settings::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
||||
colorChanging(hDown, touch);
|
||||
} else if (mode == 3) {
|
||||
CreditsLogic(hDown, touch);
|
||||
} else if (mode == 4) {
|
||||
MiscSettingsLogic(hDown, hHeld, touch);
|
||||
}
|
||||
}
|
||||
@@ -78,13 +78,22 @@ TinyDB::TinyDB() {
|
||||
}
|
||||
|
||||
void TinyDB::Draw(void) const {
|
||||
std::string entryAmount = std::to_string(selection+1) + " / " + std::to_string(tinyDBList.size());
|
||||
std::string info;
|
||||
Gui::setDraw(top);
|
||||
Gui::Draw_Rect(0, 0, 400, 25, C2D_Color32(63, 81, 181, 255));
|
||||
Gui::Draw_Rect(0, 25, 400, 190, C2D_Color32(140, 140, 140, 255));
|
||||
Gui::Draw_Rect(0, 215, 400, 25, C2D_Color32(63, 81, 181, 255));
|
||||
Gui::sprite(sprites_top_screen_top_idx, 0, 0);
|
||||
Gui::sprite(sprites_top_screen_bot_idx, 0, 215);
|
||||
|
||||
if (Config::UseBars == true) {
|
||||
Gui::sprite(sprites_top_screen_top_idx, 0, 0);
|
||||
Gui::sprite(sprites_top_screen_bot_idx, 0, 215);
|
||||
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, "TinyDB", 400);
|
||||
Gui::DrawString(397-Gui::GetStringWidth(0.6f, entryAmount), 239-Gui::GetStringHeight(0.6f, entryAmount), 0.6f, Config::TxtColor, entryAmount);
|
||||
} else {
|
||||
Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, "TinyDB", 400);
|
||||
Gui::DrawString(397-Gui::GetStringWidth(0.6f, entryAmount), 237-Gui::GetStringHeight(0.6f, entryAmount), 0.6f, Config::TxtColor, entryAmount);
|
||||
}
|
||||
|
||||
Gui::DrawStringCentered(0, 35, 0.6f, Config::TxtColor, Lang::get("AUTHOR") + std::string(tinyDBJson[selectedOption]["info"]["author"]), 400);
|
||||
Gui::DrawStringCentered(0, 65, 0.6f, Config::TxtColor, Lang::get("DESC") + std::string(tinyDBJson[selectedOption]["info"]["description"]), 400);
|
||||
@@ -92,17 +101,16 @@ void TinyDB::Draw(void) const {
|
||||
Gui::DrawStringCentered(0, 125, 0.6f, Config::TxtColor, Lang::get("RELEASE_ID") + std::string(tinyDBJson[selectedOption]["info"]["releaseId"]), 400);
|
||||
Gui::DrawStringCentered(0, 155, 0.6f, Config::TxtColor, Lang::get("TITLE_ID") + std::string(tinyDBJson[selectedOption]["info"]["titleid"]), 400);
|
||||
Gui::DrawStringCentered(0, 185, 0.6f, Config::TxtColor, Lang::get("FILE_SIZE") + formatBytes(int64_t(tinyDBJson[selectedOption]["info"]["fileSize"])), 400);
|
||||
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, "TinyDB", 400);
|
||||
std::string entryAmount = std::to_string(selection+1) + " / " + std::to_string(tinyDBList.size());
|
||||
Gui::DrawString(397-Gui::GetStringWidth(0.6f, entryAmount), 239-Gui::GetStringHeight(0.6f, entryAmount), 0.6f, Config::TxtColor, entryAmount);
|
||||
|
||||
|
||||
Gui::setDraw(bottom);
|
||||
Gui::Draw_Rect(0, 0, 320, 25, C2D_Color32(63, 81, 181, 255));
|
||||
Gui::Draw_Rect(0, 25, 320, 190, C2D_Color32(140, 140, 140, 255));
|
||||
Gui::Draw_Rect(0, 215, 320, 25, C2D_Color32(63, 81, 181, 255));
|
||||
Gui::sprite(sprites_bottom_screen_top_idx, 0, 0);
|
||||
Gui::sprite(sprites_bottom_screen_bot_idx, 0, 215);
|
||||
if (Config::UseBars == true) {
|
||||
Gui::sprite(sprites_bottom_screen_top_idx, 0, 0);
|
||||
Gui::sprite(sprites_bottom_screen_bot_idx, 0, 215);
|
||||
}
|
||||
|
||||
Gui::DrawArrow(295, -1);
|
||||
Gui::DrawArrow(315, 240, 180.0);
|
||||
|
||||
@@ -46,6 +46,7 @@ int Config::progressbarColor;
|
||||
std::string Config::ScriptPath;
|
||||
std::string Config::MusicPath;
|
||||
bool Config::Logging;
|
||||
bool Config::UseBars;
|
||||
nlohmann::json configJson;
|
||||
|
||||
void Config::load() {
|
||||
@@ -131,6 +132,12 @@ void Config::load() {
|
||||
Config::Logging = getBool("LOGGING");
|
||||
}
|
||||
|
||||
if(!configJson.contains("BARS")) {
|
||||
Config::UseBars = true;
|
||||
} else {
|
||||
Config::UseBars = getBool("BARS");
|
||||
}
|
||||
|
||||
fclose(file);
|
||||
} else {
|
||||
Config::Color1 = BarColor;
|
||||
@@ -146,6 +153,7 @@ void Config::load() {
|
||||
Config::progressbarColor = WHITE;
|
||||
Config::MusicPath = MUSIC_PATH;
|
||||
Config::Logging = false;
|
||||
Config::UseBars = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,6 +171,7 @@ void Config::save() {
|
||||
Config::setInt("PROGRESSBARCOLOR", Config::progressbarColor);
|
||||
Config::setString("MUSICPATH", Config::MusicPath);
|
||||
Config::setBool("LOGGING", Config::Logging);
|
||||
Config::setBool("BARS", Config::UseBars);
|
||||
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);
|
||||
@@ -184,6 +193,7 @@ void Config::initializeNewConfig() {
|
||||
Config::setInt("PROGRESSBARCOLOR", WHITE);
|
||||
Config::setString("MUSICPATH", MUSIC_PATH);
|
||||
Config::setBool("LOGGING", false);
|
||||
Config::setBool("BARS", true);
|
||||
|
||||
if(file) fwrite(configJson.dump(1, '\t').c_str(), 1, configJson.dump(1, '\t').size(), file);
|
||||
fclose(file);
|
||||
|
||||
@@ -192,7 +192,7 @@ std::vector<std::string> getContents(const std::string &name, const std::vector<
|
||||
// returns a Path or file to 'std::string'.
|
||||
// selectText is the Text which is displayed on the bottom bar of the top screen.
|
||||
// selectionMode is how you select it. 1 -> Path, 2 -> File.
|
||||
std::string selectFilePath(std::string selectText, int selectionMode) {
|
||||
std::string selectFilePath(std::string selectText, const std::vector<std::string> &extensionList, int selectionMode) {
|
||||
static uint selectedFile = 0;
|
||||
std::string selectedPath = "";
|
||||
static int keyRepeatDelay = 4;
|
||||
@@ -208,8 +208,14 @@ std::string selectFilePath(std::string selectText, int selectionMode) {
|
||||
Gui::DrawTop();
|
||||
char path[PATH_MAX];
|
||||
getcwd(path, PATH_MAX);
|
||||
Gui::DrawString((400-(Gui::GetStringWidth(0.60f, path)))/2, 0, 0.60f, Config::TxtColor, path);
|
||||
Gui::DrawStringCentered(0, 218, 0.60f, Config::TxtColor, selectText, 400);
|
||||
if (Config::UseBars == true) {
|
||||
Gui::DrawString((400-(Gui::GetStringWidth(0.60f, path)))/2, 2, 0.60f, Config::TxtColor, path);
|
||||
Gui::DrawStringCentered(0, 220, 0.60f, Config::TxtColor, selectText, 400);
|
||||
} else {
|
||||
Gui::DrawString((400-(Gui::GetStringWidth(0.60f, path)))/2, 0, 0.60f, Config::TxtColor, path);
|
||||
Gui::DrawStringCentered(0, 218, 0.60f, Config::TxtColor, selectText, 400);
|
||||
}
|
||||
|
||||
std::string dirs;
|
||||
for (uint i=(selectedFile<5) ? 0 : selectedFile-5;i<dirContents.size()&&i<((selectedFile<5) ? 6 : selectedFile+1);i++) {
|
||||
if (i == selectedFile) {
|
||||
@@ -225,7 +231,11 @@ std::string selectFilePath(std::string selectText, int selectionMode) {
|
||||
Gui::DrawString(26, 32, 0.53f, Config::TxtColor, dirs.c_str());
|
||||
Gui::DrawBottom();
|
||||
|
||||
Gui::DrawStringCentered(0, 0, 0.5f, Config::TxtColor, Lang::get("FILEBROWSE_MSG"), 320);
|
||||
if (Config::UseBars == true) {
|
||||
Gui::DrawStringCentered(0, 0, 0.5f, Config::TxtColor, Lang::get("FILEBROWSE_MSG"), 320);
|
||||
} else {
|
||||
Gui::DrawStringCentered(0, 2, 0.5f, Config::TxtColor, Lang::get("FILEBROWSE_MSG"), 320);
|
||||
}
|
||||
Gui::DrawArrow(295, -1);
|
||||
Gui::DrawArrow(315, 240, 180.0);
|
||||
|
||||
@@ -250,7 +260,7 @@ std::string selectFilePath(std::string selectText, int selectionMode) {
|
||||
if (dirChanged) {
|
||||
dirContents.clear();
|
||||
std::vector<DirEntry> dirContentsTemp;
|
||||
getDirectoryContents(dirContentsTemp);
|
||||
getDirectoryContents(dirContentsTemp, extensionList);
|
||||
for(uint i=0;i<dirContentsTemp.size();i++) {
|
||||
dirContents.push_back(dirContentsTemp[i]);
|
||||
}
|
||||
@@ -304,6 +314,7 @@ std::string selectFilePath(std::string selectText, int selectionMode) {
|
||||
char path[PATH_MAX];
|
||||
getcwd(path, PATH_MAX);
|
||||
if(strcmp(path, "sdmc:/") == 0 || strcmp(path, "/") == 0) {
|
||||
return "";
|
||||
} else {
|
||||
chdir("..");
|
||||
selectedFile = 0;
|
||||
|
||||
Reference in New Issue
Block a user