From e4052a1dab5a754e797e33bbda7778bfb5a1b8ca Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Thu, 28 Oct 2021 20:03:23 -0400 Subject: [PATCH 1/2] ns: language: Add BrazilianPortuguese to ApplicationLanguage It seems that Nintendo finally filled that last empty spot in ApplicationLanguage for a total of 16 supported languages. --- src/core/hle/service/ns/language.cpp | 26 +++++++++++++++++++++++++- src/core/hle/service/ns/language.h | 1 + 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/core/hle/service/ns/language.cpp b/src/core/hle/service/ns/language.cpp index 7d9e4a20b9..e01c6be47e 100644 --- a/src/core/hle/service/ns/language.cpp +++ b/src/core/hle/service/ns/language.cpp @@ -277,6 +277,25 @@ constexpr ApplicationLanguagePriorityList priority_list_simplified_chinese = {{ ApplicationLanguage::Korean, }}; +constexpr ApplicationLanguagePriorityList priority_list_brazilian_portuguese = {{ + ApplicationLanguage::BrazilianPortuguese, + ApplicationLanguage::Portuguese, + ApplicationLanguage::LatinAmericanSpanish, + ApplicationLanguage::AmericanEnglish, + ApplicationLanguage::BritishEnglish, + ApplicationLanguage::Japanese, + ApplicationLanguage::French, + ApplicationLanguage::German, + ApplicationLanguage::Spanish, + ApplicationLanguage::Italian, + ApplicationLanguage::Dutch, + ApplicationLanguage::CanadianFrench, + ApplicationLanguage::Russian, + ApplicationLanguage::Korean, + ApplicationLanguage::SimplifiedChinese, + ApplicationLanguage::TraditionalChinese, +}}; + const ApplicationLanguagePriorityList* GetApplicationLanguagePriorityList( const ApplicationLanguage lang) { switch (lang) { @@ -310,6 +329,8 @@ const ApplicationLanguagePriorityList* GetApplicationLanguagePriorityList( return &priority_list_traditional_chinese; case ApplicationLanguage::SimplifiedChinese: return &priority_list_simplified_chinese; + case ApplicationLanguage::BrazilianPortuguese: + return &priority_list_brazilian_portuguese; default: return nullptr; } @@ -339,7 +360,6 @@ std::optional ConvertToApplicationLanguage( case Set::LanguageCode::FR_CA: return ApplicationLanguage::CanadianFrench; case Set::LanguageCode::PT: - case Set::LanguageCode::PT_BR: return ApplicationLanguage::Portuguese; case Set::LanguageCode::RU: return ApplicationLanguage::Russian; @@ -351,6 +371,8 @@ std::optional ConvertToApplicationLanguage( case Set::LanguageCode::ZH_CN: case Set::LanguageCode::ZH_HANS: return ApplicationLanguage::SimplifiedChinese; + case Set::LanguageCode::PT_BR: + return ApplicationLanguage::BrazilianPortuguese; default: return std::nullopt; } @@ -388,6 +410,8 @@ std::optional ConvertToLanguageCode(const ApplicationLanguage return Set::LanguageCode::ZH_HANT; case ApplicationLanguage::SimplifiedChinese: return Set::LanguageCode::ZH_HANS; + case ApplicationLanguage::BrazilianPortuguese: + return Set::LanguageCode::PT_BR; default: return std::nullopt; } diff --git a/src/core/hle/service/ns/language.h b/src/core/hle/service/ns/language.h index e9829f9d26..d84c3f2775 100644 --- a/src/core/hle/service/ns/language.h +++ b/src/core/hle/service/ns/language.h @@ -30,6 +30,7 @@ enum class ApplicationLanguage : u8 { Korean, TraditionalChinese, SimplifiedChinese, + BrazilianPortuguese, Count }; using ApplicationLanguagePriorityList = From baf599c1d3daa365e84fda3c58cab2cc9c82636d Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Thu, 28 Oct 2021 20:04:33 -0400 Subject: [PATCH 2/2] file_sys: control_metadata: Add BrazilianPortuguese --- src/core/file_sys/control_metadata.cpp | 3 ++- src/core/file_sys/control_metadata.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/core/file_sys/control_metadata.cpp b/src/core/file_sys/control_metadata.cpp index f667598159..05936f3c3e 100644 --- a/src/core/file_sys/control_metadata.cpp +++ b/src/core/file_sys/control_metadata.cpp @@ -9,7 +9,7 @@ namespace FileSys { -const std::array LANGUAGE_NAMES{{ +const std::array LANGUAGE_NAMES{{ "AmericanEnglish", "BritishEnglish", "Japanese", @@ -25,6 +25,7 @@ const std::array LANGUAGE_NAMES{{ "Korean", "Taiwanese", "Chinese", + "BrazilianPortuguese", }}; std::string LanguageEntry::GetApplicationName() const { diff --git a/src/core/file_sys/control_metadata.h b/src/core/file_sys/control_metadata.h index dd9837cf5c..af2b723df8 100644 --- a/src/core/file_sys/control_metadata.h +++ b/src/core/file_sys/control_metadata.h @@ -88,11 +88,12 @@ enum class Language : u8 { Korean = 12, Taiwanese = 13, Chinese = 14, + BrazilianPortuguese = 15, Default = 255, }; -extern const std::array LANGUAGE_NAMES; +extern const std::array LANGUAGE_NAMES; // A class representing the format used by NX metadata files, typically named Control.nacp. // These store application name, dev name, title id, and other miscellaneous data.