mirror of
https://github.com/J-D-K/JKSV.git
synced 2026-04-24 07:17:11 -05:00
Fix init order so ForceEnglish option actually works.
This commit is contained in:
parent
2a48b18b49
commit
280e5d6cb9
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -13,3 +13,6 @@ JKSV.nacp
|
|||
JKSV.nro
|
||||
JKSV.nso
|
||||
JKSV.pfs0
|
||||
|
||||
#sometimes I give jksv to people and forget about this.
|
||||
JKSV.zip
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ namespace config
|
|||
|
||||
private:
|
||||
/// @brief This is where the majority of the config values are.
|
||||
std::map<std::string, uint8_t> m_configMap{};
|
||||
std::map<std::string, uint8_t, std::less<>> m_configMap{};
|
||||
|
||||
/// @brief The main directory JKSV operates from.
|
||||
fslib::Path m_workingDirectory{};
|
||||
|
|
|
|||
|
|
@ -60,6 +60,9 @@ JKSV::JKSV()
|
|||
ABORT_ON_FAILURE(JKSV::initialize_sdl());
|
||||
|
||||
ABORT_ON_FAILURE(curl::initialize());
|
||||
input::initialize();
|
||||
config::initialize();
|
||||
|
||||
ABORT_ON_FAILURE(strings::initialize()); // This is fatal now.
|
||||
|
||||
const char *translationFormat = strings::get_by_name(strings::names::TRANSLATION, 0);
|
||||
|
|
@ -68,9 +71,6 @@ JKSV::JKSV()
|
|||
m_translationInfo = stringutil::get_formatted_string(translationFormat, author);
|
||||
m_buildString = stringutil::get_formatted_string("v. %02d.%02d.%04d", BUILD_MON, BUILD_DAY, BUILD_YEAR);
|
||||
|
||||
input::initialize();
|
||||
config::initialize();
|
||||
|
||||
// This needs the config init'd or read to work.
|
||||
JKSV::create_directories();
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
#include "config/keys.hpp"
|
||||
#include "error.hpp"
|
||||
#include "logging/error.hpp"
|
||||
#include "logging/logger.hpp"
|
||||
#include "stringutil.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
|
|
@ -69,14 +70,14 @@ void config::ConfigContext::save() { ConfigContext::save_config_file(); }
|
|||
|
||||
uint8_t config::ConfigContext::get_by_key(std::string_view key) const
|
||||
{
|
||||
const auto findKey = m_configMap.find(key.data());
|
||||
const auto findKey = m_configMap.find(key);
|
||||
if (findKey == m_configMap.end()) { return 0; }
|
||||
return findKey->second;
|
||||
}
|
||||
|
||||
void config::ConfigContext::toggle_by_key(std::string_view key)
|
||||
{
|
||||
auto findKey = m_configMap.find(key.data());
|
||||
auto findKey = m_configMap.find(key);
|
||||
if (findKey == m_configMap.end()) { return; }
|
||||
|
||||
const uint8_t value = findKey->second;
|
||||
|
|
@ -85,7 +86,7 @@ void config::ConfigContext::toggle_by_key(std::string_view key)
|
|||
|
||||
void config::ConfigContext::set_by_key(std::string_view key, uint8_t value)
|
||||
{
|
||||
auto findKey = m_configMap.find(key.data());
|
||||
auto findKey = m_configMap.find(key);
|
||||
if (findKey == m_configMap.end()) { return; }
|
||||
|
||||
findKey->second = value;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
#include "strings/strings.hpp"
|
||||
|
||||
#include "JSON.hpp"
|
||||
#include "config/config.hpp"
|
||||
#include "fslib.hpp"
|
||||
#include "logging/error.hpp"
|
||||
#include "logging/logger.hpp"
|
||||
#include "stringutil.hpp"
|
||||
|
||||
#include <map>
|
||||
|
|
@ -92,9 +94,10 @@ static fslib::Path get_file_path()
|
|||
uint64_t languageCode{};
|
||||
SetLanguage language{};
|
||||
|
||||
const bool codeError = error::libnx(setGetLanguageCode(&languageCode));
|
||||
const bool langError = !codeError && error::libnx(setMakeLanguage(languageCode, &language));
|
||||
if (codeError || langError) { returnPath /= s_fileMap[SetLanguage_ENUS]; }
|
||||
const bool forceEnglish = config::get_by_key(config::keys::FORCE_ENGLISH);
|
||||
const bool codeError = error::libnx(setGetLanguageCode(&languageCode));
|
||||
const bool langError = !codeError && error::libnx(setMakeLanguage(languageCode, &language));
|
||||
if (forceEnglish || codeError || langError) { returnPath /= s_fileMap[SetLanguage_ENUS]; }
|
||||
else { returnPath /= s_fileMap[language]; }
|
||||
|
||||
return returnPath;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user