summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKeve1227 <killenlillen02@gmail.com>2023-06-03 17:13:24 +0200
committerKeve1227 <killenlillen02@gmail.com>2023-06-03 17:13:24 +0200
commitd0aa63069f6a9ec0b062b086a93dbcd2f880ac84 (patch)
tree20ed1ca1a56047bb92924f889aeb0bca942d5632 /src
parentUpdate README.md (Add Android at builds description) (#10586) (diff)
downloadyuzu-d0aa63069f6a9ec0b062b086a93dbcd2f880ac84.tar
yuzu-d0aa63069f6a9ec0b062b086a93dbcd2f880ac84.tar.gz
yuzu-d0aa63069f6a9ec0b062b086a93dbcd2f880ac84.tar.bz2
yuzu-d0aa63069f6a9ec0b062b086a93dbcd2f880ac84.tar.lz
yuzu-d0aa63069f6a9ec0b062b086a93dbcd2f880ac84.tar.xz
yuzu-d0aa63069f6a9ec0b062b086a93dbcd2f880ac84.tar.zst
yuzu-d0aa63069f6a9ec0b062b086a93dbcd2f880ac84.zip
Diffstat (limited to 'src')
-rw-r--r--src/core/file_sys/patch_manager.cpp33
1 files changed, 32 insertions, 1 deletions
diff --git a/src/core/file_sys/patch_manager.cpp b/src/core/file_sys/patch_manager.cpp
index 4c80e13a9..fa282615b 100644
--- a/src/core/file_sys/patch_manager.cpp
+++ b/src/core/file_sys/patch_manager.cpp
@@ -24,6 +24,8 @@
#include "core/file_sys/vfs_layered.h"
#include "core/file_sys/vfs_vector.h"
#include "core/hle/service/filesystem/filesystem.h"
+#include "core/hle/service/ns/language.h"
+#include "core/hle/service/set/set.h"
#include "core/loader/loader.h"
#include "core/loader/nso.h"
#include "core/memory/cheat_engine.h"
@@ -623,8 +625,37 @@ PatchManager::Metadata PatchManager::ParseControlNCA(const NCA& nca) const {
auto nacp = nacp_file == nullptr ? nullptr : std::make_unique<NACP>(nacp_file);
+ // Get language code from settings
+ const auto language_code =
+ Service::Set::GetLanguageCodeFromIndex(Settings::values.language_index.GetValue());
+
+ // Convert to application language and get priority list
+ const auto application_language =
+ Service::NS::ConvertToApplicationLanguage(language_code)
+ .value_or(Service::NS::ApplicationLanguage::AmericanEnglish);
+ const auto language_priority_list =
+ Service::NS::GetApplicationLanguagePriorityList(application_language);
+
+ // Convert to language names
+ auto priority_language_names = FileSys::LANGUAGE_NAMES; // Copy
+ if (language_priority_list) {
+ for (size_t i = 0; i < priority_language_names.size(); ++i) {
+ // Relies on FileSys::LANGUAGE_NAMES being in the same order as
+ // Service::NS::ApplicationLanguage
+ const auto language_index = static_cast<u8>(language_priority_list->at(i));
+
+ if (language_index < FileSys::LANGUAGE_NAMES.size()) {
+ priority_language_names[i] = FileSys::LANGUAGE_NAMES[language_index];
+ } else {
+ // Not a catastrophy, unlikely to happen
+ LOG_WARNING(Loader, "Invalid language index {}", language_index);
+ }
+ }
+ }
+
+ // Get first matching icon
VirtualFile icon_file;
- for (const auto& language : FileSys::LANGUAGE_NAMES) {
+ for (const auto& language : priority_language_names) {
icon_file = extracted->GetFile(std::string("icon_").append(language).append(".dat"));
if (icon_file != nullptr) {
break;