mirror of
https://github.com/DarkStore-3DS/DarkStore.git
synced 2026-07-05 08:39: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 Title;
|
||||||
std::string Author;
|
std::string Author;
|
||||||
std::string URL;
|
std::string URL;
|
||||||
|
std::string File; // Used to check, if File does NOT contain a slash or so.
|
||||||
std::string FileName;
|
std::string FileName;
|
||||||
std::string Description;
|
std::string Description;
|
||||||
int Version;
|
int Version;
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
extern bool checkWifiStatus();
|
extern bool checkWifiStatus();
|
||||||
extern bool touching(touchPosition touch, Structs::ButtonPos button);
|
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::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 = {
|
static const std::vector<Structs::ButtonPos> mainButtons = {
|
||||||
{ 10, 4, 300, 22 },
|
{ 10, 4, 300, 22 },
|
||||||
|
|||||||
@@ -247,31 +247,43 @@ void Overlays::SelectStore(std::unique_ptr<Store> &store, std::vector<std::uniqu
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (hidKeysDown() & KEY_A) {
|
if (hidKeysDown() & KEY_A) {
|
||||||
/* Load selected one. */
|
if (info[selection].File != "") { // Ensure to check for this.
|
||||||
if (info[selection].Version == -1) Msg::waitMsg(Lang::get("UNISTORE_INVALID_ERROR"));
|
if (!(info[selection].File.find("/") != std::string::npos)) {
|
||||||
else if (info[selection].Version < 3) Msg::waitMsg(Lang::get("UNISTORE_TOO_OLD"));
|
/* Load selected one. */
|
||||||
else if (info[selection].Version > 3) Msg::waitMsg(Lang::get("UNISTORE_TOO_NEW"));
|
if (info[selection].Version == -1) Msg::waitMsg(Lang::get("UNISTORE_INVALID_ERROR"));
|
||||||
else {
|
else if (info[selection].Version < 3) Msg::waitMsg(Lang::get("UNISTORE_TOO_OLD"));
|
||||||
store = std::make_unique<Store>(_STORE_PATH + info[selection].FileName);
|
else if (info[selection].Version > 3) Msg::waitMsg(Lang::get("UNISTORE_TOO_NEW"));
|
||||||
StoreUtils::ResetAll(store, meta, entries);
|
else {
|
||||||
config->lastStore(info[selection].FileName);
|
store = std::make_unique<Store>(_STORE_PATH + info[selection].FileName);
|
||||||
StoreUtils::SortEntries(false, SortType::LAST_UPDATED, entries);
|
StoreUtils::ResetAll(store, meta, entries);
|
||||||
doOut = true;
|
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) {
|
if (hidKeysDown() & KEY_TOUCH) {
|
||||||
for (int i = 0; i < 7; i++) {
|
for (int i = 0; i < 7; i++) {
|
||||||
if (touching(touch, mainButtons[i])) {
|
if (touching(touch, mainButtons[i])) {
|
||||||
if (i + sPos < (int)info.size()) {
|
if (i + sPos < (int)info.size() && info[i + sPos].File != "") { // Ensure to check for this.
|
||||||
if (info[i + sPos].Version == -1) Msg::waitMsg(Lang::get("UNISTORE_INVALID_ERROR"));
|
if (!(info[i + sPos].File.find("/") != std::string::npos)) {
|
||||||
else if (info[i + sPos].Version < 3) Msg::waitMsg(Lang::get("UNISTORE_TOO_OLD"));
|
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_NEW"));
|
else if (info[i + sPos].Version < 3) Msg::waitMsg(Lang::get("UNISTORE_TOO_OLD"));
|
||||||
else {
|
else if (info[i + sPos].Version > 3) Msg::waitMsg(Lang::get("UNISTORE_TOO_NEW"));
|
||||||
store = std::make_unique<Store>(_STORE_PATH + info[i + sPos].FileName);
|
else {
|
||||||
StoreUtils::ResetAll(store, meta, entries);
|
store = std::make_unique<Store>(_STORE_PATH + info[i + sPos].FileName);
|
||||||
config->lastStore(info[i + sPos].FileName);
|
StoreUtils::ResetAll(store, meta, entries);
|
||||||
doOut = true;
|
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.
|
const std::string &fieName: Const Reference to the filename, without path.
|
||||||
*/
|
*/
|
||||||
UniStoreInfo GetInfo(const std::string &file, const std::string &fileName) {
|
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;
|
nlohmann::json JSON = nullptr;
|
||||||
|
|
||||||
FILE *temp = fopen(file.c_str(), "r");
|
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"];
|
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()) {
|
if (JSON["storeInfo"].contains("author") && JSON["storeInfo"]["author"].is_string()) {
|
||||||
Temp.Author = JSON["storeInfo"]["author"];
|
Temp.Author = JSON["storeInfo"]["author"];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user