Chage Default NDS Path & Add GBA Path Settings

This commit is contained in:
dark98
2021-07-04 00:07:38 +01:00
parent 4b902f1927
commit 714bbf14c4
5 changed files with 28 additions and 4 deletions
+4 -1
View File
@@ -61,6 +61,9 @@ public:
std::string ndsPath() const { return this->v_ndsPath; };
void ndsPath(const std::string &v) { this->v_ndsPath = v; if (!this->changesMade) this->changesMade = true; };
std::string gbaPath() const { return this->v_gbaPath; };
void gbaPath(const std::string &v) { this->v_gbaPath = v; if (!this->changesMade) this->changesMade = true; };
std::string archPath() const { return this->v_archivePath; };
void archPath(const std::string &v) { this->v_archivePath = v; if (!this->changesMade) this->changesMade = true; };
@@ -100,7 +103,7 @@ private:
bool changesMade = false;
std::string v_language = "en", v_lastStore = "darkstore-homebrew.eshop",
v_3dsxPath = "sdmc:/3ds", v_ndsPath = "sdmc:", v_archivePath = "sdmc:",
v_3dsxPath = "sdmc:/3ds", v_ndsPath = "sdmc:/roms/nds", v_gbaPath = "sdmc:/roms/gba", v_archivePath = "sdmc:",
v_shortcutPath = "sdmc:/3ds/DarkStore/shortcuts";
bool v_list = false, v_autoUpdate = true, v_metadata = true, v_updateCheck = true,
+1
View File
@@ -14,6 +14,7 @@
"CHANGE_3DSX_PATH": "Change 3DSX path",
"CHANGE_ARCHIVE_PATH": "Change archive path",
"CHANGE_NDS_PATH": "Change NDS path",
"CHANGE_GBA_PATH": "Change GBA path",
"CHANGE_SHORTCUT_PATH": "Change shortcut path",
"CHANGELOG": "Changelog",
"CHECK_ESHOP_UPDATES": "Checking for eShop updates...",
+12 -3
View File
@@ -62,7 +62,7 @@ static const Structs::ButtonPos back = { 44, 0, 24, 24 }; // Back arrow for dire
static const std::vector<std::string> mainStrings = { "LANGUAGE", "SELECT_ESHOP", "AUTO_UPDATE_SETTINGS_BTN", "GUI_SETTINGS_BTN", "DIRECTORY_SETTINGS_BTN", "CREDITS", "EXIT_APP" };
static const std::vector<std::string> dirStrings = { "CHANGE_3DSX_PATH", "CHANGE_NDS_PATH", "CHANGE_ARCHIVE_PATH", "CHANGE_SHORTCUT_PATH" };
static const std::vector<std::string> dirStrings = { "CHANGE_3DSX_PATH", "CHANGE_NDS_PATH", "CHANGE_GBA_PATH", "CHANGE_ARCHIVE_PATH", "CHANGE_SHORTCUT_PATH" };
/* Note: Украïнська is spelled using a latin i with dieresis to work in the system font */
/* en | es | fr | jp | de | it | pt | pt-BR | ru | cn-TR | da | lt | pl | hu | gr | uk | tr -*/
@@ -318,10 +318,14 @@ static void SettingsHandleDir(int &page, int &selection, const std::unique_ptr<S
if (path != "") config->ndsPath(path);
} else if (touching(touch, mainButtons[2])) {
const std::string path = Overlays::SelectDir(config->gbaPath(), Lang::get("SELECT_DIR"), store);
if (path != "") config->gbaPath(path);
} else if (touching(touch, mainButtons[3])) {
const std::string path = Overlays::SelectDir(config->archPath(), Lang::get("SELECT_DIR"), store);
if (path != "") config->archPath(path);
} else if (touching(touch, mainButtons[3])) {
} else if (touching(touch, mainButtons[4])) {
const std::string path = Overlays::SelectDir(config->shortcut(), Lang::get("SELECT_DIR"), store);
if (path != "") config->shortcut(path);
}
@@ -342,11 +346,16 @@ static void SettingsHandleDir(int &page, int &selection, const std::unique_ptr<S
break;
case 2:
path = Overlays::SelectDir(config->gbaPath(), Lang::get("SELECT_DIR"), store);
if (path != "") config->gbaPath(path);
break;
case 3:
path = Overlays::SelectDir(config->archPath(), Lang::get("SELECT_DIR"), store);
if (path != "") config->archPath(path);
break;
case 3:
case 4:
path = Overlays::SelectDir(config->shortcut(), Lang::get("SELECT_DIR"), store);
if (path != "") config->shortcut(path);
break;
+2
View File
@@ -121,6 +121,7 @@ Config::Config() {
if (this->json.contains("AutoUpdate")) this->autoupdate(this->getBool("AutoUpdate"));
if (this->json.contains("_3DSX_Path")) this->_3dsxPath(this->getString("_3DSX_Path"));
if (this->json.contains("NDS_Path")) this->ndsPath(this->getString("NDS_Path"));
if (this->json.contains("GBA_Path")) this->gbaPath(this->getString("GBA_Path"));
if (this->json.contains("Archive_Path")) this->archPath(this->getString("Archive_Path"));
if (this->json.contains("MetaData")) this->metadata(this->getBool("MetaData"));
if (this->json.contains("UpdateCheck")) this->updatecheck(this->getBool("UpdateCheck"));
@@ -145,6 +146,7 @@ void Config::save() {
this->setBool("AutoUpdate", this->autoupdate());
this->setString("_3DSX_Path", this->_3dsxPath());
this->setString("NDS_Path", this->ndsPath());
this->setString("GBA_Path", this->gbaPath());
this->setString("Archive_Path", this->archPath());
this->setBool("MetaData", this->metadata());
this->setBool("UpdateCheck", this->updatecheck());
+9
View File
@@ -53,6 +53,7 @@ Result ScriptUtils::removeFile(const std::string &file, const std::string &messa
out = std::regex_replace(file, std::regex("%ARCHIVE_DEFAULT%"), config->archPath());
out = std::regex_replace(out, std::regex("%3DSX%"), config->_3dsxPath());
out = std::regex_replace(out, std::regex("%NDS%"), config->ndsPath());
out = std::regex_replace(out, std::regex("%GBA%"), config->gbaPath());
Result ret = NONE;
if (access(out.c_str(), F_OK) != 0) return DELETE_ERROR;
@@ -92,9 +93,11 @@ Result ScriptUtils::copyFile(const std::string &source, const std::string &desti
_source = std::regex_replace(source, std::regex("%ARCHIVE_DEFAULT%"), config->archPath());
_source = std::regex_replace(_source, std::regex("%3DSX%"), config->_3dsxPath());
_source = std::regex_replace(_source, std::regex("%NDS%"), config->ndsPath());
_source = std::regex_replace(_source, std::regex("%GBA%"), config->gbaPath());
_dest = std::regex_replace(destination, std::regex("%ARCHIVE_DEFAULT%"), config->archPath());
_dest = std::regex_replace(_dest, std::regex("%3DSX%"), config->_3dsxPath());
_dest = std::regex_replace(_dest, std::regex("%NDS%"), config->ndsPath());
_dest = std::regex_replace(_dest, std::regex("%GBA%"), config->gbaPath());
if (isARG) {
snprintf(progressBarMsg, sizeof(progressBarMsg), message.c_str());
@@ -134,9 +137,11 @@ Result ScriptUtils::renameFile(const std::string &oldName, const std::string &ne
old = std::regex_replace(oldName, std::regex("%ARCHIVE_DEFAULT%"), config->archPath());
old = std::regex_replace(old, std::regex("%3DSX%"), config->_3dsxPath());
old = std::regex_replace(old, std::regex("%NDS%"), config->ndsPath());
old = std::regex_replace(old, std::regex("%GBA%"), config->gbaPath());
_new = std::regex_replace(newName, std::regex("%ARCHIVE_DEFAULT%"), config->archPath());
_new = std::regex_replace(_new, std::regex("%3DSX%"), config->_3dsxPath());
_new = std::regex_replace(_new, std::regex("%NDS%"), config->ndsPath());
_new = std::regex_replace(_new, std::regex("%GBA%"), config->gbaPath());
Msg::DisplayMsg(message);
@@ -153,6 +158,7 @@ Result ScriptUtils::downloadRelease(const std::string &repo, const std::string &
std::string out;
out = std::regex_replace(output, std::regex("%3DSX%"), config->_3dsxPath());
out = std::regex_replace(out, std::regex("%NDS%"), config->ndsPath());
out = std::regex_replace(out, std::regex("%GBA%"), config->gbaPath());
out = std::regex_replace(out, std::regex("%ARCHIVE_DEFAULT%"), config->archPath());
Result ret = NONE;
@@ -196,6 +202,7 @@ Result ScriptUtils::downloadFile(const std::string &file, const std::string &out
std::string out;
out = std::regex_replace(output, std::regex("%3DSX%"), config->_3dsxPath());
out = std::regex_replace(out, std::regex("%NDS%"), config->ndsPath());
out = std::regex_replace(out, std::regex("%GBA%"), config->gbaPath());
out = std::regex_replace(out, std::regex("%ARCHIVE_DEFAULT%"), config->archPath());
Result ret = NONE;
@@ -241,6 +248,7 @@ void ScriptUtils::installFile(const std::string &file, bool updatingSelf, const
in = std::regex_replace(file, std::regex("%ARCHIVE_DEFAULT%"), config->archPath());
in = std::regex_replace(in, std::regex("%3DSX%"), config->_3dsxPath());
in = std::regex_replace(in, std::regex("%NDS%"), config->ndsPath());
in = std::regex_replace(in, std::regex("%GBA%"), config->gbaPath());
if (isARG) {
snprintf(progressBarMsg, sizeof(progressBarMsg), message.c_str());
@@ -272,6 +280,7 @@ void ScriptUtils::extractFile(const std::string &file, const std::string &input,
out = std::regex_replace(output, std::regex("%ARCHIVE_DEFAULT%"), config->archPath());
out = std::regex_replace(out, std::regex("%3DSX%"), config->_3dsxPath());
out = std::regex_replace(out, std::regex("%NDS%"), config->ndsPath());
out = std::regex_replace(out, std::regex("%GBA%"), config->gbaPath());
if (isARG) {
snprintf(progressBarMsg, sizeof(progressBarMsg), message.c_str());