mirror of
https://github.com/DarkStore-3DS/DarkStore.git
synced 2026-07-03 00:39:02 +00:00
Add %ARCHIVE_DEFAULT%.
This commit is contained in:
@@ -46,17 +46,16 @@ private:
|
|||||||
mutable int screenPos = 0;
|
mutable int screenPos = 0;
|
||||||
int colorSelection = 0;
|
int colorSelection = 0;
|
||||||
int keyRepeatDelay = 0;
|
int keyRepeatDelay = 0;
|
||||||
|
int settingPage = 0;
|
||||||
|
|
||||||
// Draws.
|
// Draws.
|
||||||
void DrawSubMenu(void) const;
|
void DrawSubMenu(void) const;
|
||||||
void DrawLanguageSelection(void) const;
|
void DrawLanguageSelection(void) const;
|
||||||
void DrawColorChanging(void) const;
|
void DrawColorChanging(void) const;
|
||||||
void DrawMiscSettings(void) const;
|
|
||||||
// Logic's.
|
// Logic's.
|
||||||
void SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch);
|
void SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch);
|
||||||
void LanguageSelection(u32 hDown, u32 hHeld, touchPosition touch);
|
void LanguageSelection(u32 hDown, u32 hHeld, touchPosition touch);
|
||||||
void colorChanging(u32 hDown, u32 hHeld, touchPosition touch);
|
void colorChanging(u32 hDown, u32 hHeld, touchPosition touch);
|
||||||
void MiscSettingsLogic(u32 hDown, u32 hHeld, touchPosition touch);
|
|
||||||
|
|
||||||
const std::vector<Structs::ButtonPos> mainButtons = {
|
const std::vector<Structs::ButtonPos> mainButtons = {
|
||||||
{80, 30, 149, 52}, // Language.
|
{80, 30, 149, 52}, // Language.
|
||||||
|
|||||||
@@ -63,8 +63,6 @@ using json = nlohmann::json;
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern char * arg0;
|
|
||||||
|
|
||||||
#define WORKING_DIR "/"
|
#define WORKING_DIR "/"
|
||||||
#define SCRIPTS_PATH "sdmc:/3ds/Universal-Updater/scripts/" // The Scripts will be here.
|
#define SCRIPTS_PATH "sdmc:/3ds/Universal-Updater/scripts/" // The Scripts will be here.
|
||||||
#define MUSIC_PATH "sdmc:/3ds/Universal-Updater/Music.wav" // Default Music File / Path.
|
#define MUSIC_PATH "sdmc:/3ds/Universal-Updater/Music.wav" // Default Music File / Path.
|
||||||
@@ -74,4 +72,5 @@ extern char * arg0;
|
|||||||
#define ENTRIES_PER_LIST 7
|
#define ENTRIES_PER_LIST 7
|
||||||
#define metaFile "sdmc:/3ds/Universal-Updater/ScriptInfo.json"
|
#define metaFile "sdmc:/3ds/Universal-Updater/ScriptInfo.json"
|
||||||
#define _3DSX_PATH "sdmc:/3ds"
|
#define _3DSX_PATH "sdmc:/3ds"
|
||||||
#define _NDS_PATH "sdmc:"
|
#define _NDS_PATH "sdmc:"
|
||||||
|
#define ARCHIVES_DEFAULT "sdmc:"
|
||||||
@@ -129,7 +129,9 @@ public:
|
|||||||
void _3dsxpath(std::string v) { this->v_3dsx_install_path = v; if (!this->changesMade) this->changesMade = true; }
|
void _3dsxpath(std::string v) { this->v_3dsx_install_path = v; if (!this->changesMade) this->changesMade = true; }
|
||||||
std::string ndspath() { return this->v_nds_install_path; }
|
std::string ndspath() { return this->v_nds_install_path; }
|
||||||
void ndspath(std::string v) { this->v_nds_install_path = v; if (!this->changesMade) this->changesMade = true; }
|
void ndspath(std::string v) { this->v_nds_install_path = v; if (!this->changesMade) this->changesMade = true; }
|
||||||
|
std::string archivepath() { return this->v_archive_path; }
|
||||||
|
void archivepath(std::string v) { this->v_archive_path = v; if (!this->changesMade) this->changesMade = true; }
|
||||||
|
|
||||||
// Mainly helper.
|
// Mainly helper.
|
||||||
bool getBool(const std::string &key);
|
bool getBool(const std::string &key);
|
||||||
void setBool(const std::string &key, bool v);
|
void setBool(const std::string &key, bool v);
|
||||||
@@ -150,7 +152,7 @@ private:
|
|||||||
bool v_logging, v_useBars, v_screenFade, v_progressDisplay, v_firstStartup, v_useScriptColor, v_showSpeed;
|
bool v_logging, v_useBars, v_screenFade, v_progressDisplay, v_firstStartup, v_useScriptColor, v_showSpeed;
|
||||||
|
|
||||||
// Some variables.
|
// Some variables.
|
||||||
std::string v_3dsx_install_path, v_nds_install_path;
|
std::string v_3dsx_install_path, v_nds_install_path, v_archive_path;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -213,5 +213,12 @@
|
|||||||
"SELECT_AUTHOR": "Select an author you like to view.",
|
"SELECT_AUTHOR": "Select an author you like to view.",
|
||||||
"SELECT_CONSOLE": "Select a console you like to view.",
|
"SELECT_CONSOLE": "Select a console you like to view.",
|
||||||
"NO_AUTHORS_AVAILABLE": "No authors available.",
|
"NO_AUTHORS_AVAILABLE": "No authors available.",
|
||||||
"NO_CONSOLES_AVAILABLE": "No consoles available."
|
"NO_CONSOLES_AVAILABLE": "No consoles available.",
|
||||||
|
"CHANGE_3DSX_PATH": "Change 3DSX path",
|
||||||
|
"CHANGE_NDS_PATH": "Change NDS path",
|
||||||
|
"CHANGE_ARCHIVE_PATH": "Change Archive path",
|
||||||
|
"SELECT_3DSX_PATH": "Select the 3DSX path.",
|
||||||
|
"SELECT_NDS_PATH": "Select the NDS path.",
|
||||||
|
"SELECT_ARCHIVE_PATH": "Select the Archive path.",
|
||||||
|
"TOGGLE_PROGRESSBAR": "Toggle Progressbar"
|
||||||
}
|
}
|
||||||
|
|||||||
+194
-146
@@ -42,8 +42,6 @@ void Settings::Draw(void) const {
|
|||||||
DrawLanguageSelection();
|
DrawLanguageSelection();
|
||||||
} else if (mode == 2) {
|
} else if (mode == 2) {
|
||||||
DrawColorChanging();
|
DrawColorChanging();
|
||||||
} else if (mode == 4) {
|
|
||||||
DrawMiscSettings();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,11 +54,27 @@ void Settings::DrawSubMenu(void) const {
|
|||||||
GFX::DrawArrow(0, 218, 0, 1);
|
GFX::DrawArrow(0, 218, 0, 1);
|
||||||
GFX::DrawArrow(318, 240, 180.0, 1);
|
GFX::DrawArrow(318, 240, 180.0, 1);
|
||||||
|
|
||||||
GFX::DrawButton(mainButtons[0].x, mainButtons[0].y, Lang::get("LANGUAGE"));
|
if (this->settingPage == 0) {
|
||||||
GFX::DrawButton(mainButtons[1].x, mainButtons[1].y, Lang::get("COLORS"));
|
GFX::DrawButton(mainButtons[0].x, mainButtons[0].y, Lang::get("LANGUAGE"));
|
||||||
GFX::DrawButton(mainButtons[2].x, mainButtons[2].y, Lang::get("CHANGE_BAR_STYLE"));
|
GFX::DrawButton(mainButtons[1].x, mainButtons[1].y, Lang::get("COLORS"));
|
||||||
|
GFX::DrawButton(mainButtons[2].x, mainButtons[2].y, Lang::get("CHANGE_BAR_STYLE"));
|
||||||
|
} else if (this->settingPage == 1) {
|
||||||
|
GFX::DrawButton(mainButtons2[0].x, mainButtons2[0].y, Lang::get("CHANGE_MUSICFILE"));
|
||||||
|
GFX::DrawButton(mainButtons2[1].x, mainButtons2[1].y, Lang::get("CHANGE_KEY_DELAY"));
|
||||||
|
GFX::DrawButton(mainButtons2[2].x, mainButtons2[2].y, Lang::get("TOGGLE_FADE"));
|
||||||
|
GFX::DrawButton(mainButtons2[3].x, mainButtons2[3].y, Lang::get("TOGGLE_PROGRESSBAR"));
|
||||||
|
} else if (this->settingPage == 2) {
|
||||||
|
GFX::DrawButton(mainButtons[0].x, mainButtons[0].y, Lang::get("CHANGE_3DSX_PATH"));
|
||||||
|
GFX::DrawButton(mainButtons[1].x, mainButtons[1].y, Lang::get("CHANGE_NDS_PATH"));
|
||||||
|
GFX::DrawButton(mainButtons[2].x, mainButtons[2].y, Lang::get("CHANGE_ARCHIVE_PATH"));
|
||||||
|
}
|
||||||
|
|
||||||
// Selector.
|
// Selector.
|
||||||
Animation::Button(mainButtons[Selection].x, mainButtons[Selection].y, .060);
|
if (this->settingPage == 0 || this->settingPage == 2) {
|
||||||
|
Animation::Button(mainButtons[Selection].x, mainButtons[Selection].y, .060);
|
||||||
|
} else {
|
||||||
|
Animation::Button(mainButtons2[Selection].x, mainButtons2[Selection].y, .060);
|
||||||
|
}
|
||||||
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -219,151 +233,187 @@ void Settings::DrawColorChanging(void) const {
|
|||||||
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
||||||
}
|
}
|
||||||
|
|
||||||
void Settings::DrawMiscSettings(void) const {
|
|
||||||
GFX::DrawTop();
|
|
||||||
Gui::DrawStringCentered(0, config->useBars() ? 0 : 2, 0.7f, config->textColor(), "Universal-Updater", 400);
|
|
||||||
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
|
||||||
GFX::DrawBottom();
|
|
||||||
GFX::DrawArrow(0, 218, 0, 1);
|
|
||||||
|
|
||||||
GFX::DrawButton(mainButtons2[0].x, mainButtons2[0].y, Lang::get("CHANGE_MUSICFILE"));
|
|
||||||
GFX::DrawButton(mainButtons2[1].x, mainButtons2[1].y, Lang::get("CHANGE_KEY_DELAY"));
|
|
||||||
GFX::DrawButton(mainButtons2[2].x, mainButtons2[2].y, Lang::get("TOGGLE_FADE"));
|
|
||||||
|
|
||||||
// Selector.
|
|
||||||
Animation::Button(mainButtons2[Selection].x, mainButtons2[Selection].y, .060);
|
|
||||||
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
|
||||||
}
|
|
||||||
|
|
||||||
void Settings::MiscSettingsLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|
||||||
if (hDown & KEY_A) {
|
|
||||||
if (Selection == 0) {
|
|
||||||
std::string tempMusic = selectFilePath(Lang::get("SELECT_MUSIC_FILE"), "sdmc:/", {"wav"}, 2);
|
|
||||||
if (tempMusic != "") {
|
|
||||||
config->musicPath(tempMusic);
|
|
||||||
}
|
|
||||||
} else if (Selection == 1) {
|
|
||||||
config->keyDelay(Input::getUint(255, Lang::get("ENTER_KEY_DELAY")));
|
|
||||||
} else if (Selection == 2) {
|
|
||||||
if (config->screenFade()) {
|
|
||||||
if (Msg::promptMsg(Lang::get("TOGGLE_FADE_DISABLE"))) {
|
|
||||||
config->screenFade(false);
|
|
||||||
Msg::DisplayWarnMsg(Lang::get("DISABLED"));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (Msg::promptMsg(Lang::get("TOGGLE_FADE_ENABLE"))) {
|
|
||||||
config->screenFade(true);
|
|
||||||
Msg::DisplayWarnMsg(Lang::get("ENABLED"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hDown & KEY_TOUCH) {
|
|
||||||
if (touching(touch, mainButtons2[0])) {
|
|
||||||
std::string tempMusic = selectFilePath(Lang::get("SELECT_MUSIC_FILE"), "sdmc:/", {"wav"}, 2);
|
|
||||||
if (tempMusic != "") {
|
|
||||||
config->musicPath(tempMusic);
|
|
||||||
}
|
|
||||||
} else if (touching(touch, mainButtons2[1])) {
|
|
||||||
config->keyDelay(Input::getUint(255, Lang::get("ENTER_KEY_DELAY")));
|
|
||||||
} else if (touching(touch, mainButtons2[2])) {
|
|
||||||
if (config->screenFade()) {
|
|
||||||
if (Msg::promptMsg(Lang::get("TOGGLE_FADE_DISABLE"))) {
|
|
||||||
config->screenFade(false);
|
|
||||||
Msg::DisplayWarnMsg(Lang::get("DISABLED"));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (Msg::promptMsg(Lang::get("TOGGLE_FADE_ENABLE"))) {
|
|
||||||
config->screenFade(true);
|
|
||||||
Msg::DisplayWarnMsg(Lang::get("ENABLED"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((hDown & KEY_B || hDown & KEY_L) || (hDown & KEY_TOUCH && touching(touch, arrowPos[2]))) {
|
|
||||||
Selection = 0;
|
|
||||||
mode = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// No idea where to place the button for it, so do it here for now.
|
|
||||||
if (hDown & KEY_SELECT) {
|
|
||||||
if (config->progressDisplay()) {
|
|
||||||
if (Msg::promptMsg(Lang::get("PROGRESS_BAR_DISABLE"))) {
|
|
||||||
config->progressDisplay(false);
|
|
||||||
Msg::DisplayWarnMsg(Lang::get("DISABLED"));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (Msg::promptMsg(Lang::get("PROGRESS_BAR_ENABLE"))) {
|
|
||||||
config->progressDisplay(true);
|
|
||||||
Msg::DisplayWarnMsg(Lang::get("ENABLED"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Navigation.
|
|
||||||
if (hDown & KEY_UP) {
|
|
||||||
if (Selection > 1) Selection -= 2;
|
|
||||||
} else if (hDown & KEY_DOWN) {
|
|
||||||
if (Selection < 3 && Selection != 2 && Selection != 3) Selection += 2;
|
|
||||||
} else if (hDown & KEY_LEFT) {
|
|
||||||
if (Selection%2) Selection--;
|
|
||||||
} else if (hDown & KEY_RIGHT) {
|
|
||||||
if (!(Selection%2)) Selection++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Settings::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
void Settings::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
||||||
if (hDown & KEY_UP) {
|
if ((hDown & KEY_B)) {
|
||||||
if (Selection > 0) Selection--;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hDown & KEY_DOWN) {
|
|
||||||
if (Selection < 2) Selection++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hDown & KEY_A) {
|
|
||||||
switch (Selection) {
|
|
||||||
case 0:
|
|
||||||
screenPos = 0;
|
|
||||||
selectedLang = 0;
|
|
||||||
mode = 1;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
screenPos = 0;
|
|
||||||
mode = 2;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
if (config->useBars()) config->useBars(false);
|
|
||||||
else config->useBars(true);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hDown & KEY_TOUCH) {
|
|
||||||
if (touching(touch, mainButtons[0])) {
|
|
||||||
screenPos = 0;
|
|
||||||
selectedLang = 0;
|
|
||||||
mode = 1;
|
|
||||||
} else if (touching(touch, mainButtons[1])) {
|
|
||||||
screenPos = 0;
|
|
||||||
mode = 2;
|
|
||||||
} else if (touching(touch, mainButtons[2])) {
|
|
||||||
if (config->useBars()) config->useBars(false);
|
|
||||||
else config->useBars(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((hDown & KEY_B) || (hDown & KEY_TOUCH && touching(touch, arrowPos[2]))) {
|
|
||||||
Gui::screenBack(config->screenFade());
|
Gui::screenBack(config->screenFade());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((hDown & KEY_R) || (hDown & KEY_TOUCH && touching(touch, arrowPos[4]))) {
|
if ((hDown & KEY_R) || (hDown & KEY_TOUCH && touching(touch, arrowPos[4]))) {
|
||||||
Selection = 0;
|
if (this->settingPage < 2) {
|
||||||
mode = 4;
|
this->settingPage++;
|
||||||
|
Selection = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((hDown & KEY_L) || (hDown & KEY_TOUCH && touching(touch, arrowPos[2]))) {
|
||||||
|
if (this->settingPage > 0) {
|
||||||
|
this->settingPage--;
|
||||||
|
Selection = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this->settingPage == 0) {
|
||||||
|
if (hDown & KEY_UP) {
|
||||||
|
if (Selection > 0) Selection--;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hDown & KEY_DOWN) {
|
||||||
|
if (Selection < 2) Selection++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hDown & KEY_A) {
|
||||||
|
switch (Selection) {
|
||||||
|
case 0:
|
||||||
|
screenPos = 0;
|
||||||
|
selectedLang = 0;
|
||||||
|
mode = 1;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
screenPos = 0;
|
||||||
|
mode = 2;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if (config->useBars()) config->useBars(false);
|
||||||
|
else config->useBars(true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hDown & KEY_TOUCH) {
|
||||||
|
if (touching(touch, mainButtons[0])) {
|
||||||
|
screenPos = 0;
|
||||||
|
selectedLang = 0;
|
||||||
|
mode = 1;
|
||||||
|
} else if (touching(touch, mainButtons[1])) {
|
||||||
|
screenPos = 0;
|
||||||
|
mode = 2;
|
||||||
|
} else if (touching(touch, mainButtons[2])) {
|
||||||
|
if (config->useBars()) config->useBars(false);
|
||||||
|
else config->useBars(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (this->settingPage == 1) {
|
||||||
|
if (hDown & KEY_A) {
|
||||||
|
if (Selection == 0) {
|
||||||
|
std::string tempMusic = selectFilePath(Lang::get("SELECT_MUSIC_FILE"), "sdmc:/", {"wav"}, 2);
|
||||||
|
if (tempMusic != "") {
|
||||||
|
config->musicPath(tempMusic);
|
||||||
|
}
|
||||||
|
} else if (Selection == 1) {
|
||||||
|
config->keyDelay(Input::getUint(255, Lang::get("ENTER_KEY_DELAY")));
|
||||||
|
} else if (Selection == 2) {
|
||||||
|
if (config->screenFade()) {
|
||||||
|
if (Msg::promptMsg(Lang::get("TOGGLE_FADE_DISABLE"))) {
|
||||||
|
config->screenFade(false);
|
||||||
|
Msg::DisplayWarnMsg(Lang::get("DISABLED"));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (Msg::promptMsg(Lang::get("TOGGLE_FADE_ENABLE"))) {
|
||||||
|
config->screenFade(true);
|
||||||
|
Msg::DisplayWarnMsg(Lang::get("ENABLED"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (Selection == 3) {
|
||||||
|
if (config->progressDisplay()) {
|
||||||
|
if (Msg::promptMsg(Lang::get("PROGRESS_BAR_DISABLE"))) {
|
||||||
|
config->progressDisplay(false);
|
||||||
|
Msg::DisplayWarnMsg(Lang::get("DISABLED"));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (Msg::promptMsg(Lang::get("PROGRESS_BAR_ENABLE"))) {
|
||||||
|
config->progressDisplay(true);
|
||||||
|
Msg::DisplayWarnMsg(Lang::get("ENABLED"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hDown & KEY_TOUCH) {
|
||||||
|
if (touching(touch, mainButtons2[0])) {
|
||||||
|
std::string tempMusic = selectFilePath(Lang::get("SELECT_MUSIC_FILE"), "sdmc:/", {"wav"}, 2);
|
||||||
|
if (tempMusic != "") {
|
||||||
|
config->musicPath(tempMusic);
|
||||||
|
}
|
||||||
|
} else if (touching(touch, mainButtons2[1])) {
|
||||||
|
config->keyDelay(Input::getUint(255, Lang::get("ENTER_KEY_DELAY")));
|
||||||
|
} else if (touching(touch, mainButtons2[2])) {
|
||||||
|
if (config->screenFade()) {
|
||||||
|
if (Msg::promptMsg(Lang::get("TOGGLE_FADE_DISABLE"))) {
|
||||||
|
config->screenFade(false);
|
||||||
|
Msg::DisplayWarnMsg(Lang::get("DISABLED"));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (Msg::promptMsg(Lang::get("TOGGLE_FADE_ENABLE"))) {
|
||||||
|
config->screenFade(true);
|
||||||
|
Msg::DisplayWarnMsg(Lang::get("ENABLED"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (touching(touch, mainButtons2[3])) {
|
||||||
|
if (config->progressDisplay()) {
|
||||||
|
if (Msg::promptMsg(Lang::get("PROGRESS_BAR_DISABLE"))) {
|
||||||
|
config->progressDisplay(false);
|
||||||
|
Msg::DisplayWarnMsg(Lang::get("DISABLED"));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (Msg::promptMsg(Lang::get("PROGRESS_BAR_ENABLE"))) {
|
||||||
|
config->progressDisplay(true);
|
||||||
|
Msg::DisplayWarnMsg(Lang::get("ENABLED"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Navigation.
|
||||||
|
if (hDown & KEY_UP) {
|
||||||
|
if (Selection > 1) Selection -= 2;
|
||||||
|
} else if (hDown & KEY_DOWN) {
|
||||||
|
if (Selection < 2) Selection += 2;
|
||||||
|
} else if (hDown & KEY_LEFT) {
|
||||||
|
if (Selection%2) Selection--;
|
||||||
|
} else if (hDown & KEY_RIGHT) {
|
||||||
|
if (!(Selection%2)) Selection++;
|
||||||
|
}
|
||||||
|
} else if (this->settingPage == 2) {
|
||||||
|
if (hDown & KEY_UP) {
|
||||||
|
if (Selection > 0) Selection--;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hDown & KEY_DOWN) {
|
||||||
|
if (Selection < 2) Selection++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hDown & KEY_A) {
|
||||||
|
std::string tempPath;
|
||||||
|
switch (Selection) {
|
||||||
|
case 0:
|
||||||
|
tempPath = selectFilePath(Lang::get("SELECT_3DSX_PATH"), config->_3dsxpath(), {});
|
||||||
|
if (tempPath != "") config->_3dsxpath(tempPath);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
tempPath = selectFilePath(Lang::get("SELECT_NDS_PATH"), config->ndspath(), {});
|
||||||
|
if (tempPath != "") config->ndspath(tempPath);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
tempPath = selectFilePath(Lang::get("SELECT_ARCHIVE_PATH"), config->archivepath(), {});
|
||||||
|
if (tempPath != "") config->archivepath(tempPath);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hDown & KEY_TOUCH) {
|
||||||
|
if (touching(touch, mainButtons[0])) {
|
||||||
|
std::string tempPath = selectFilePath(Lang::get("SELECT_3DSX_PATH"), config->_3dsxpath(), {});
|
||||||
|
if (tempPath != "") config->_3dsxpath(tempPath);
|
||||||
|
} else if (touching(touch, mainButtons[1])) {
|
||||||
|
std::string tempPath = selectFilePath(Lang::get("SELECT_NDS_PATH"), config->ndspath(), {});
|
||||||
|
if (tempPath != "") config->ndspath(tempPath);
|
||||||
|
} else if (touching(touch, mainButtons[2])) {
|
||||||
|
std::string tempPath = selectFilePath(Lang::get("SELECT_ARCHIVE_PATH"), config->archivepath(), {});
|
||||||
|
if (tempPath != "") config->archivepath(tempPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -568,7 +618,5 @@ void Settings::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
LanguageSelection(hDown, hHeld, touch);
|
LanguageSelection(hDown, hHeld, touch);
|
||||||
} else if (mode == 2) {
|
} else if (mode == 2) {
|
||||||
colorChanging(hDown, hHeld, touch);
|
colorChanging(hDown, hHeld, touch);
|
||||||
} else if (mode == 4) {
|
|
||||||
MiscSettingsLogic(hDown, hHeld, touch);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -35,6 +35,7 @@ void Config::addMissingThings() {
|
|||||||
if (this->json["VERSION"] < 2) {
|
if (this->json["VERSION"] < 2) {
|
||||||
this->setString("3DSX_PATH", _3DSX_PATH);
|
this->setString("3DSX_PATH", _3DSX_PATH);
|
||||||
this->setString("NDS_PATH", _NDS_PATH);
|
this->setString("NDS_PATH", _NDS_PATH);
|
||||||
|
this->setString("ARCHIVE_PATH", ARCHIVES_DEFAULT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,6 +75,7 @@ void Config::initialize() {
|
|||||||
this->setBool("SHOW_SPEED", false);
|
this->setBool("SHOW_SPEED", false);
|
||||||
this->setString("3DSX_PATH", _3DSX_PATH);
|
this->setString("3DSX_PATH", _3DSX_PATH);
|
||||||
this->setString("NDS_PATH", _NDS_PATH);
|
this->setString("NDS_PATH", _NDS_PATH);
|
||||||
|
this->setString("ARCHIVE_PATH", ARCHIVES_DEFAULT);
|
||||||
this->setInt("VERSION", this->configVersion);
|
this->setInt("VERSION", this->configVersion);
|
||||||
|
|
||||||
// Write to file.
|
// Write to file.
|
||||||
@@ -282,6 +284,12 @@ Config::Config() {
|
|||||||
this->ndspath(this->getString("NDS_PATH"));
|
this->ndspath(this->getString("NDS_PATH"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!this->json.contains("ARCHIVE_PATH")) {
|
||||||
|
this->archivepath(ARCHIVES_DEFAULT);
|
||||||
|
} else {
|
||||||
|
this->archivepath(this->getString("ARCHIVE_PATH"));
|
||||||
|
}
|
||||||
|
|
||||||
this->changesMade = false; // No changes made yet.
|
this->changesMade = false; // No changes made yet.
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -321,6 +329,8 @@ void Config::save() {
|
|||||||
this->setBool("SHOW_SPEED", this->showSpeed());
|
this->setBool("SHOW_SPEED", this->showSpeed());
|
||||||
this->setString("3DSX_PATH", this->_3dsxpath());
|
this->setString("3DSX_PATH", this->_3dsxpath());
|
||||||
this->setString("NDS_PATH", this->ndspath());
|
this->setString("NDS_PATH", this->ndspath());
|
||||||
|
this->setString("ARCHIVE_PATH", this->archivepath());
|
||||||
|
|
||||||
// Write changes to file.
|
// Write changes to file.
|
||||||
const std::string dump = this->json.dump(1, '\t');
|
const std::string dump = this->json.dump(1, '\t');
|
||||||
fwrite(dump.c_str(), 1, this->json.dump(1, '\t').size(), file);
|
fwrite(dump.c_str(), 1, this->json.dump(1, '\t').size(), file);
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ Result ScriptHelper::downloadRelease(std::string repo, std::string file, std::st
|
|||||||
std::string out;
|
std::string out;
|
||||||
out = std::regex_replace(output, std::regex("%3DSX%"), config->_3dsxpath().c_str());
|
out = std::regex_replace(output, std::regex("%3DSX%"), config->_3dsxpath().c_str());
|
||||||
out = std::regex_replace(out, std::regex("%NDS%"), config->ndspath().c_str());
|
out = std::regex_replace(out, std::regex("%NDS%"), config->ndspath().c_str());
|
||||||
|
out = std::regex_replace(out, std::regex("%ARCHIVE_DEFAULT%"), config->archivepath().c_str());
|
||||||
|
|
||||||
Result ret = NONE;
|
Result ret = NONE;
|
||||||
if (downloadFromRelease("https://github.com/" + repo, file, out, message, includePrereleases, showVersions) != 0) {
|
if (downloadFromRelease("https://github.com/" + repo, file, out, message, includePrereleases, showVersions) != 0) {
|
||||||
@@ -89,6 +90,7 @@ Result ScriptHelper::downloadFile(std::string file, std::string output, std::str
|
|||||||
std::string out;
|
std::string out;
|
||||||
out = std::regex_replace(output, std::regex("%3DSX%"), config->_3dsxpath().c_str());
|
out = std::regex_replace(output, std::regex("%3DSX%"), config->_3dsxpath().c_str());
|
||||||
out = std::regex_replace(out, std::regex("%NDS%"), config->ndspath().c_str());
|
out = std::regex_replace(out, std::regex("%NDS%"), config->ndspath().c_str());
|
||||||
|
out = std::regex_replace(out, std::regex("%ARCHIVE_DEFAULT%"), config->archivepath().c_str());
|
||||||
|
|
||||||
Result ret = NONE;
|
Result ret = NONE;
|
||||||
snprintf(progressBarMsg, sizeof(progressBarMsg), message.c_str());
|
snprintf(progressBarMsg, sizeof(progressBarMsg), message.c_str());
|
||||||
@@ -108,13 +110,16 @@ Result ScriptHelper::downloadFile(std::string file, std::string output, std::str
|
|||||||
|
|
||||||
// Remove a File.
|
// Remove a File.
|
||||||
Result ScriptHelper::removeFile(std::string file, std::string message) {
|
Result ScriptHelper::removeFile(std::string file, std::string message) {
|
||||||
|
std::string out;
|
||||||
|
out = std::regex_replace(file, std::regex("%ARCHIVE_DEFAULT%"), config->archivepath().c_str());
|
||||||
|
|
||||||
Result ret = NONE;
|
Result ret = NONE;
|
||||||
if (access(file.c_str(), F_OK) != 0 ) {
|
if (access(out.c_str(), F_OK) != 0 ) {
|
||||||
return DELETE_ERROR;
|
return DELETE_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
Msg::DisplayMsg(message);
|
Msg::DisplayMsg(message);
|
||||||
deleteFile(file.c_str());
|
deleteFile(out.c_str());
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,12 +135,16 @@ void ScriptHelper::installFile(std::string file, bool updatingSelf, std::string
|
|||||||
|
|
||||||
// Extract Files.
|
// Extract Files.
|
||||||
void ScriptHelper::extractFile(std::string file, std::string input, std::string output, std::string message) {
|
void ScriptHelper::extractFile(std::string file, std::string input, std::string output, std::string message) {
|
||||||
|
std::string out, in;
|
||||||
|
in = std::regex_replace(file, std::regex("%ARCHIVE_DEFAULT%"), config->archivepath().c_str());
|
||||||
|
out = std::regex_replace(output, std::regex("%ARCHIVE_DEFAULT%"), config->archivepath().c_str());
|
||||||
|
|
||||||
snprintf(progressBarMsg, sizeof(progressBarMsg), message.c_str());
|
snprintf(progressBarMsg, sizeof(progressBarMsg), message.c_str());
|
||||||
showProgressBar = true;
|
showProgressBar = true;
|
||||||
filesExtracted = 0;
|
filesExtracted = 0;
|
||||||
progressbarType = ProgressBar::Extracting;
|
progressbarType = ProgressBar::Extracting;
|
||||||
Threads::create((ThreadFunc)displayProgressBar);
|
Threads::create((ThreadFunc)displayProgressBar);
|
||||||
extractArchive(file, input, output);
|
extractArchive(in, input, out);
|
||||||
showProgressBar = false;
|
showProgressBar = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user