diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/file_sys/control_metadata.cpp | 12 | ||||
| -rw-r--r-- | src/core/file_sys/control_metadata.h | 4 | ||||
| -rw-r--r-- | src/core/file_sys/patch_manager.cpp | 33 | ||||
| -rw-r--r-- | src/yuzu/main.cpp | 3 |
4 files changed, 42 insertions, 10 deletions
diff --git a/src/core/file_sys/control_metadata.cpp b/src/core/file_sys/control_metadata.cpp index 50f44f598..cd9ac2e75 100644 --- a/src/core/file_sys/control_metadata.cpp +++ b/src/core/file_sys/control_metadata.cpp | |||
| @@ -23,8 +23,8 @@ const std::array<const char*, 16> LANGUAGE_NAMES{{ | |||
| 23 | "Portuguese", | 23 | "Portuguese", |
| 24 | "Russian", | 24 | "Russian", |
| 25 | "Korean", | 25 | "Korean", |
| 26 | "Taiwanese", | 26 | "TraditionalChinese", |
| 27 | "Chinese", | 27 | "SimplifiedChinese", |
| 28 | "BrazilianPortuguese", | 28 | "BrazilianPortuguese", |
| 29 | }}; | 29 | }}; |
| 30 | 30 | ||
| @@ -45,17 +45,17 @@ constexpr std::array<Language, 18> language_to_codes = {{ | |||
| 45 | Language::German, | 45 | Language::German, |
| 46 | Language::Italian, | 46 | Language::Italian, |
| 47 | Language::Spanish, | 47 | Language::Spanish, |
| 48 | Language::Chinese, | 48 | Language::SimplifiedChinese, |
| 49 | Language::Korean, | 49 | Language::Korean, |
| 50 | Language::Dutch, | 50 | Language::Dutch, |
| 51 | Language::Portuguese, | 51 | Language::Portuguese, |
| 52 | Language::Russian, | 52 | Language::Russian, |
| 53 | Language::Taiwanese, | 53 | Language::TraditionalChinese, |
| 54 | Language::BritishEnglish, | 54 | Language::BritishEnglish, |
| 55 | Language::CanadianFrench, | 55 | Language::CanadianFrench, |
| 56 | Language::LatinAmericanSpanish, | 56 | Language::LatinAmericanSpanish, |
| 57 | Language::Chinese, | 57 | Language::SimplifiedChinese, |
| 58 | Language::Taiwanese, | 58 | Language::TraditionalChinese, |
| 59 | Language::BrazilianPortuguese, | 59 | Language::BrazilianPortuguese, |
| 60 | }}; | 60 | }}; |
| 61 | 61 | ||
diff --git a/src/core/file_sys/control_metadata.h b/src/core/file_sys/control_metadata.h index 6a81873b1..c98efb00d 100644 --- a/src/core/file_sys/control_metadata.h +++ b/src/core/file_sys/control_metadata.h | |||
| @@ -84,8 +84,8 @@ enum class Language : u8 { | |||
| 84 | Portuguese = 10, | 84 | Portuguese = 10, |
| 85 | Russian = 11, | 85 | Russian = 11, |
| 86 | Korean = 12, | 86 | Korean = 12, |
| 87 | Taiwanese = 13, | 87 | TraditionalChinese = 13, |
| 88 | Chinese = 14, | 88 | SimplifiedChinese = 14, |
| 89 | BrazilianPortuguese = 15, | 89 | BrazilianPortuguese = 15, |
| 90 | 90 | ||
| 91 | Default = 255, | 91 | Default = 255, |
diff --git a/src/core/file_sys/patch_manager.cpp b/src/core/file_sys/patch_manager.cpp index f786f2add..4e61d4335 100644 --- a/src/core/file_sys/patch_manager.cpp +++ b/src/core/file_sys/patch_manager.cpp | |||
| @@ -25,6 +25,8 @@ | |||
| 25 | #include "core/file_sys/vfs_layered.h" | 25 | #include "core/file_sys/vfs_layered.h" |
| 26 | #include "core/file_sys/vfs_vector.h" | 26 | #include "core/file_sys/vfs_vector.h" |
| 27 | #include "core/hle/service/filesystem/filesystem.h" | 27 | #include "core/hle/service/filesystem/filesystem.h" |
| 28 | #include "core/hle/service/ns/language.h" | ||
| 29 | #include "core/hle/service/set/set.h" | ||
| 28 | #include "core/loader/loader.h" | 30 | #include "core/loader/loader.h" |
| 29 | #include "core/loader/nso.h" | 31 | #include "core/loader/nso.h" |
| 30 | #include "core/memory/cheat_engine.h" | 32 | #include "core/memory/cheat_engine.h" |
| @@ -624,8 +626,37 @@ PatchManager::Metadata PatchManager::ParseControlNCA(const NCA& nca) const { | |||
| 624 | 626 | ||
| 625 | auto nacp = nacp_file == nullptr ? nullptr : std::make_unique<NACP>(nacp_file); | 627 | auto nacp = nacp_file == nullptr ? nullptr : std::make_unique<NACP>(nacp_file); |
| 626 | 628 | ||
| 629 | // Get language code from settings | ||
| 630 | const auto language_code = | ||
| 631 | Service::Set::GetLanguageCodeFromIndex(Settings::values.language_index.GetValue()); | ||
| 632 | |||
| 633 | // Convert to application language and get priority list | ||
| 634 | const auto application_language = | ||
| 635 | Service::NS::ConvertToApplicationLanguage(language_code) | ||
| 636 | .value_or(Service::NS::ApplicationLanguage::AmericanEnglish); | ||
| 637 | const auto language_priority_list = | ||
| 638 | Service::NS::GetApplicationLanguagePriorityList(application_language); | ||
| 639 | |||
| 640 | // Convert to language names | ||
| 641 | auto priority_language_names = FileSys::LANGUAGE_NAMES; // Copy | ||
| 642 | if (language_priority_list) { | ||
| 643 | for (size_t i = 0; i < priority_language_names.size(); ++i) { | ||
| 644 | // Relies on FileSys::LANGUAGE_NAMES being in the same order as | ||
| 645 | // Service::NS::ApplicationLanguage | ||
| 646 | const auto language_index = static_cast<u8>(language_priority_list->at(i)); | ||
| 647 | |||
| 648 | if (language_index < FileSys::LANGUAGE_NAMES.size()) { | ||
| 649 | priority_language_names[i] = FileSys::LANGUAGE_NAMES[language_index]; | ||
| 650 | } else { | ||
| 651 | // Not a catastrophe, unlikely to happen | ||
| 652 | LOG_WARNING(Loader, "Invalid language index {}", language_index); | ||
| 653 | } | ||
| 654 | } | ||
| 655 | } | ||
| 656 | |||
| 657 | // Get first matching icon | ||
| 627 | VirtualFile icon_file; | 658 | VirtualFile icon_file; |
| 628 | for (const auto& language : FileSys::LANGUAGE_NAMES) { | 659 | for (const auto& language : priority_language_names) { |
| 629 | icon_file = extracted->GetFile(std::string("icon_").append(language).append(".dat")); | 660 | icon_file = extracted->GetFile(std::string("icon_").append(language).append(".dat")); |
| 630 | if (icon_file != nullptr) { | 661 | if (icon_file != nullptr) { |
| 631 | break; | 662 | break; |
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 82bce9a3a..145fea5f1 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -3491,6 +3491,7 @@ void GMainWindow::ResetWindowSize1080() { | |||
| 3491 | void GMainWindow::OnConfigure() { | 3491 | void GMainWindow::OnConfigure() { |
| 3492 | const auto old_theme = UISettings::values.theme; | 3492 | const auto old_theme = UISettings::values.theme; |
| 3493 | const bool old_discord_presence = UISettings::values.enable_discord_presence.GetValue(); | 3493 | const bool old_discord_presence = UISettings::values.enable_discord_presence.GetValue(); |
| 3494 | const auto old_language_index = Settings::values.language_index.GetValue(); | ||
| 3494 | 3495 | ||
| 3495 | Settings::SetConfiguringGlobal(true); | 3496 | Settings::SetConfiguringGlobal(true); |
| 3496 | ConfigureDialog configure_dialog(this, hotkey_registry, input_subsystem.get(), *system, | 3497 | ConfigureDialog configure_dialog(this, hotkey_registry, input_subsystem.get(), *system, |
| @@ -3559,7 +3560,7 @@ void GMainWindow::OnConfigure() { | |||
| 3559 | emit UpdateThemedIcons(); | 3560 | emit UpdateThemedIcons(); |
| 3560 | 3561 | ||
| 3561 | const auto reload = UISettings::values.is_game_list_reload_pending.exchange(false); | 3562 | const auto reload = UISettings::values.is_game_list_reload_pending.exchange(false); |
| 3562 | if (reload) { | 3563 | if (reload || Settings::values.language_index.GetValue() != old_language_index) { |
| 3563 | game_list->PopulateAsync(UISettings::values.game_dirs); | 3564 | game_list->PopulateAsync(UISettings::values.game_dirs); |
| 3564 | } | 3565 | } |
| 3565 | 3566 | ||