mirror of
https://github.com/DarkStore-3DS/DarkStore.git
synced 2026-07-02 16:49:05 +00:00
Properly add slash check and fix JPN Lang selection.
This commit is contained in:
@@ -45,6 +45,7 @@ struct UniStoreInfo {
|
||||
std::string Title;
|
||||
std::string Author;
|
||||
std::string URL;
|
||||
std::string File; // Used to check, if File does NOT contain a slash or so.
|
||||
std::string FileName;
|
||||
std::string Description;
|
||||
int Version;
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
extern bool checkWifiStatus();
|
||||
extern bool touching(touchPosition touch, Structs::ButtonPos button);
|
||||
static const std::vector<std::string> languages = { "Bruh", "Dansk", "Deutsch", "English", "Español", "Français", "Italiano", "Lietuvių", "Polski", "Português", "Русский", "日本語" };
|
||||
static const std::string langsTemp[] = { "br", "da", "de", "en", "es", "fr", "it", "lt", "pl", "pt", "ru", "jp "};
|
||||
static const std::string langsTemp[] = { "br", "da", "de", "en", "es", "fr", "it", "lt", "pl", "pt", "ru", "jp"};
|
||||
|
||||
static const std::vector<Structs::ButtonPos> mainButtons = {
|
||||
{ 10, 4, 300, 22 },
|
||||
|
||||
@@ -247,31 +247,43 @@ void Overlays::SelectStore(std::unique_ptr<Store> &store, std::vector<std::uniqu
|
||||
}
|
||||
|
||||
if (hidKeysDown() & KEY_A) {
|
||||
/* Load selected one. */
|
||||
if (info[selection].Version == -1) Msg::waitMsg(Lang::get("UNISTORE_INVALID_ERROR"));
|
||||
else if (info[selection].Version < 3) Msg::waitMsg(Lang::get("UNISTORE_TOO_OLD"));
|
||||
else if (info[selection].Version > 3) Msg::waitMsg(Lang::get("UNISTORE_TOO_NEW"));
|
||||
else {
|
||||
store = std::make_unique<Store>(_STORE_PATH + info[selection].FileName);
|
||||
StoreUtils::ResetAll(store, meta, entries);
|
||||
config->lastStore(info[selection].FileName);
|
||||
StoreUtils::SortEntries(false, SortType::LAST_UPDATED, entries);
|
||||
doOut = true;
|
||||
if (info[selection].File != "") { // Ensure to check for this.
|
||||
if (!(info[selection].File.find("/") != std::string::npos)) {
|
||||
/* Load selected one. */
|
||||
if (info[selection].Version == -1) Msg::waitMsg(Lang::get("UNISTORE_INVALID_ERROR"));
|
||||
else if (info[selection].Version < 3) Msg::waitMsg(Lang::get("UNISTORE_TOO_OLD"));
|
||||
else if (info[selection].Version > 3) Msg::waitMsg(Lang::get("UNISTORE_TOO_NEW"));
|
||||
else {
|
||||
store = std::make_unique<Store>(_STORE_PATH + info[selection].FileName);
|
||||
StoreUtils::ResetAll(store, meta, entries);
|
||||
config->lastStore(info[selection].FileName);
|
||||
StoreUtils::SortEntries(false, SortType::LAST_UPDATED, entries);
|
||||
doOut = true;
|
||||
}
|
||||
|
||||
} else {
|
||||
Msg::waitMsg(Lang::get("FILE_SLASH"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (hidKeysDown() & KEY_TOUCH) {
|
||||
for (int i = 0; i < 7; i++) {
|
||||
if (touching(touch, mainButtons[i])) {
|
||||
if (i + sPos < (int)info.size()) {
|
||||
if (info[i + sPos].Version == -1) Msg::waitMsg(Lang::get("UNISTORE_INVALID_ERROR"));
|
||||
else if (info[i + sPos].Version < 3) Msg::waitMsg(Lang::get("UNISTORE_TOO_OLD"));
|
||||
else if (info[i + sPos].Version > 3) Msg::waitMsg(Lang::get("UNISTORE_TOO_NEW"));
|
||||
else {
|
||||
store = std::make_unique<Store>(_STORE_PATH + info[i + sPos].FileName);
|
||||
StoreUtils::ResetAll(store, meta, entries);
|
||||
config->lastStore(info[i + sPos].FileName);
|
||||
doOut = true;
|
||||
if (i + sPos < (int)info.size() && info[i + sPos].File != "") { // Ensure to check for this.
|
||||
if (!(info[i + sPos].File.find("/") != std::string::npos)) {
|
||||
if (info[i + sPos].Version == -1) Msg::waitMsg(Lang::get("UNISTORE_INVALID_ERROR"));
|
||||
else if (info[i + sPos].Version < 3) Msg::waitMsg(Lang::get("UNISTORE_TOO_OLD"));
|
||||
else if (info[i + sPos].Version > 3) Msg::waitMsg(Lang::get("UNISTORE_TOO_NEW"));
|
||||
else {
|
||||
store = std::make_unique<Store>(_STORE_PATH + info[i + sPos].FileName);
|
||||
StoreUtils::ResetAll(store, meta, entries);
|
||||
config->lastStore(info[i + sPos].FileName);
|
||||
doOut = true;
|
||||
}
|
||||
|
||||
} else {
|
||||
Msg::waitMsg(Lang::get("FILE_SLASH"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ std::vector<std::string> getContents(const std::string &name, const std::vector<
|
||||
const std::string &fieName: Const Reference to the filename, without path.
|
||||
*/
|
||||
UniStoreInfo GetInfo(const std::string &file, const std::string &fileName) {
|
||||
UniStoreInfo Temp = { "", "", "", fileName, "", -1, -1, -1 }; // Title, Author, URL, FileName, Desc, Version, Revision, Entries.
|
||||
UniStoreInfo Temp = { "", "", "", "", fileName, "", -1, -1, -1 }; // Title, Author, URL, File (to check if no slash exist), FileName, Desc, Version, Revision, Entries.
|
||||
nlohmann::json JSON = nullptr;
|
||||
|
||||
FILE *temp = fopen(file.c_str(), "r");
|
||||
@@ -123,6 +123,10 @@ UniStoreInfo GetInfo(const std::string &file, const std::string &fileName) {
|
||||
Temp.Title = JSON["storeInfo"]["title"];
|
||||
}
|
||||
|
||||
if (JSON["storeInfo"].contains("file") && JSON["storeInfo"]["file"].is_string()) {
|
||||
Temp.File = JSON["storeInfo"]["file"];
|
||||
}
|
||||
|
||||
if (JSON["storeInfo"].contains("author") && JSON["storeInfo"]["author"].is_string()) {
|
||||
Temp.Author = JSON["storeInfo"]["author"];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user