summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2018-09-20 16:13:23 +0200
committerGitHub <noreply@github.com>2018-09-20 16:13:23 +0200
commit0931a711de3518fd417b1ea48ae6cd013d113192 (patch)
treea7f93e360e28338480caaaa72ebd890d6738dd44 /src/core
parentMerge pull request #1361 from lioncash/nax (diff)
parentcontrol_metadata: Remove unnecessary else within GetLanguageEntry() (diff)
downloadyuzu-0931a711de3518fd417b1ea48ae6cd013d113192.tar
yuzu-0931a711de3518fd417b1ea48ae6cd013d113192.tar.gz
yuzu-0931a711de3518fd417b1ea48ae6cd013d113192.tar.bz2
yuzu-0931a711de3518fd417b1ea48ae6cd013d113192.tar.lz
yuzu-0931a711de3518fd417b1ea48ae6cd013d113192.tar.xz
yuzu-0931a711de3518fd417b1ea48ae6cd013d113192.tar.zst
yuzu-0931a711de3518fd417b1ea48ae6cd013d113192.zip
Diffstat (limited to 'src/core')
-rw-r--r--src/core/file_sys/control_metadata.cpp24
-rw-r--r--src/core/file_sys/control_metadata.h7
2 files changed, 17 insertions, 14 deletions
diff --git a/src/core/file_sys/control_metadata.cpp b/src/core/file_sys/control_metadata.cpp
index e76bf77bf..f11b91399 100644
--- a/src/core/file_sys/control_metadata.cpp
+++ b/src/core/file_sys/control_metadata.cpp
@@ -8,6 +8,14 @@
namespace FileSys {
+const std::array<const char*, 15> LANGUAGE_NAMES = {
+ "AmericanEnglish", "BritishEnglish", "Japanese",
+ "French", "German", "LatinAmericanSpanish",
+ "Spanish", "Italian", "Dutch",
+ "CanadianFrench", "Portugese", "Russian",
+ "Korean", "Taiwanese", "Chinese",
+};
+
std::string LanguageEntry::GetApplicationName() const {
return Common::StringFromFixedZeroTerminatedBuffer(application_name.data(), 0x200);
}
@@ -23,15 +31,15 @@ NACP::NACP(VirtualFile file) : raw(std::make_unique<RawNACP>()) {
const LanguageEntry& NACP::GetLanguageEntry(Language language) const {
if (language != Language::Default) {
return raw->language_entries.at(static_cast<u8>(language));
- } else {
- for (const auto& language_entry : raw->language_entries) {
- if (!language_entry.GetApplicationName().empty())
- return language_entry;
- }
-
- // Fallback to English
- return GetLanguageEntry(Language::AmericanEnglish);
}
+
+ for (const auto& language_entry : raw->language_entries) {
+ if (!language_entry.GetApplicationName().empty())
+ return language_entry;
+ }
+
+ // Fallback to English
+ return GetLanguageEntry(Language::AmericanEnglish);
}
std::string NACP::GetApplicationName(Language language) const {
diff --git a/src/core/file_sys/control_metadata.h b/src/core/file_sys/control_metadata.h
index 8a510bf46..319bae821 100644
--- a/src/core/file_sys/control_metadata.h
+++ b/src/core/file_sys/control_metadata.h
@@ -66,12 +66,7 @@ enum class Language : u8 {
Default = 255,
};
-static constexpr std::array<const char*, 15> LANGUAGE_NAMES = {
- "AmericanEnglish", "BritishEnglish", "Japanese",
- "French", "German", "LatinAmericanSpanish",
- "Spanish", "Italian", "Dutch",
- "CanadianFrench", "Portugese", "Russian",
- "Korean", "Taiwanese", "Chinese"};
+extern const std::array<const char*, 15> 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.