mirror of
https://github.com/DarkStore-3DS/DarkStore.git
synced 2026-07-03 00:39:02 +00:00
WIP: Credits & Language Screen Rewrite.
This commit is contained in:
+30
-6
@@ -2,6 +2,7 @@
|
||||
#include "lang.hpp"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
nlohmann::json appJson;
|
||||
|
||||
@@ -12,15 +13,38 @@ std::string Lang::get(const std::string &key) {
|
||||
return appJson.at(key).get_ref<const std::string&>();
|
||||
}
|
||||
|
||||
std::string langs[] = {"br", "de", "en", "es", "fr", "it", "lt", "pt", "ru", "jp"};
|
||||
std::string langs[] = {"br", "da", "de", "en", "es", "fr", "it", "lt", "pt", "ru", "jp"};
|
||||
|
||||
void Lang::load(int lang) {
|
||||
void Lang::load(const std::string lang) {
|
||||
FILE* values;
|
||||
if (Config::LangPath == 1) {
|
||||
values = fopen(("sdmc:/3ds/Universal-Updater/app.json"), "rt");
|
||||
// Check if exist.
|
||||
if(access("sdmc:/3ds/Universal-Updater/app.json", F_OK) == 0 ) {
|
||||
values = fopen(("sdmc:/3ds/Universal-Updater/app.json"), "rt");
|
||||
appJson = nlohmann::json::parse(values, nullptr, false);
|
||||
fclose(values);
|
||||
return;
|
||||
|
||||
} else {
|
||||
values = fopen(("romfs:/lang/en/app.json"), "rt");
|
||||
appJson = nlohmann::json::parse(values, nullptr, false);
|
||||
fclose(values);
|
||||
return;
|
||||
}
|
||||
|
||||
} else {
|
||||
values = fopen(("romfs:/lang/"+langs[lang]+"/app.json").c_str(), "rt");
|
||||
// Check if exist.
|
||||
if(access(("romfs:/lang/" + lang + "/app.json").c_str(), F_OK) == 0 ) {
|
||||
values = fopen(std::string(("romfs:/lang/" + lang + "/app.json")).c_str(), "rt");
|
||||
appJson = nlohmann::json::parse(values, nullptr, false);
|
||||
fclose(values);
|
||||
return;
|
||||
|
||||
} else {
|
||||
values = fopen(("romfs:/lang/en/app.json"), "rt");
|
||||
appJson = nlohmann::json::parse(values, nullptr, false);
|
||||
fclose(values);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(values) appJson = nlohmann::json::parse(values, nullptr, false);
|
||||
fclose(values);
|
||||
}
|
||||
Reference in New Issue
Block a user