summaryrefslogtreecommitdiffstats
path: root/src/core/file_sys
diff options
context:
space:
mode:
authorZach Hilman <zachhilman@gmail.com>2018-09-04 01:00:14 +0200
committerZach Hilman <zachhilman@gmail.com>2018-09-04 20:30:03 +0200
commite973cceaddf060b3738417504856db1baa4a04fa (patch)
treed9f4661fbc6dad9cce078fa7a049b3dd614ac664 /src/core/file_sys
parentcard_image: Add program title ID getter (diff)
downloadyuzu-e973cceaddf060b3738417504856db1baa4a04fa.tar
yuzu-e973cceaddf060b3738417504856db1baa4a04fa.tar.gz
yuzu-e973cceaddf060b3738417504856db1baa4a04fa.tar.bz2
yuzu-e973cceaddf060b3738417504856db1baa4a04fa.tar.lz
yuzu-e973cceaddf060b3738417504856db1baa4a04fa.tar.xz
yuzu-e973cceaddf060b3738417504856db1baa4a04fa.tar.zst
yuzu-e973cceaddf060b3738417504856db1baa4a04fa.zip
Diffstat (limited to 'src/core/file_sys')
-rw-r--r--src/core/file_sys/control_metadata.cpp12
-rw-r--r--src/core/file_sys/control_metadata.h9
2 files changed, 17 insertions, 4 deletions
diff --git a/src/core/file_sys/control_metadata.cpp b/src/core/file_sys/control_metadata.cpp
index ae21ad5b9..e76bf77bf 100644
--- a/src/core/file_sys/control_metadata.cpp
+++ b/src/core/file_sys/control_metadata.cpp
@@ -21,7 +21,17 @@ NACP::NACP(VirtualFile file) : raw(std::make_unique<RawNACP>()) {
}
const LanguageEntry& NACP::GetLanguageEntry(Language language) const {
- return raw->language_entries.at(static_cast<u8>(language));
+ 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);
+ }
}
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 1568046f1..8a510bf46 100644
--- a/src/core/file_sys/control_metadata.h
+++ b/src/core/file_sys/control_metadata.h
@@ -9,6 +9,7 @@
#include <string>
#include "common/common_funcs.h"
#include "common/common_types.h"
+#include "common/swap.h"
#include "core/file_sys/vfs.h"
namespace FileSys {
@@ -61,6 +62,8 @@ enum class Language : u8 {
Korean = 12,
Taiwanese = 13,
Chinese = 14,
+
+ Default = 255,
};
static constexpr std::array<const char*, 15> LANGUAGE_NAMES = {
@@ -75,9 +78,9 @@ static constexpr std::array<const char*, 15> LANGUAGE_NAMES = {
class NACP {
public:
explicit NACP(VirtualFile file);
- const LanguageEntry& GetLanguageEntry(Language language = Language::AmericanEnglish) const;
- std::string GetApplicationName(Language language = Language::AmericanEnglish) const;
- std::string GetDeveloperName(Language language = Language::AmericanEnglish) const;
+ const LanguageEntry& GetLanguageEntry(Language language = Language::Default) const;
+ std::string GetApplicationName(Language language = Language::Default) const;
+ std::string GetDeveloperName(Language language = Language::Default) const;
u64 GetTitleId() const;
std::string GetVersionString() const;