forked from suyu/suyu
Merge pull request #1363 from lioncash/control
control_metadata: Move language name array definition to the cpp file
This commit is contained in:
commit
0931a711de
2 changed files with 17 additions and 14 deletions
|
@ -8,6 +8,14 @@
|
||||||
|
|
||||||
namespace FileSys {
|
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 {
|
std::string LanguageEntry::GetApplicationName() const {
|
||||||
return Common::StringFromFixedZeroTerminatedBuffer(application_name.data(), 0x200);
|
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 {
|
const LanguageEntry& NACP::GetLanguageEntry(Language language) const {
|
||||||
if (language != Language::Default) {
|
if (language != Language::Default) {
|
||||||
return raw->language_entries.at(static_cast<u8>(language));
|
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 {
|
std::string NACP::GetApplicationName(Language language) const {
|
||||||
|
|
|
@ -66,12 +66,7 @@ enum class Language : u8 {
|
||||||
Default = 255,
|
Default = 255,
|
||||||
};
|
};
|
||||||
|
|
||||||
static constexpr std::array<const char*, 15> LANGUAGE_NAMES = {
|
extern const std::array<const char*, 15> LANGUAGE_NAMES;
|
||||||
"AmericanEnglish", "BritishEnglish", "Japanese",
|
|
||||||
"French", "German", "LatinAmericanSpanish",
|
|
||||||
"Spanish", "Italian", "Dutch",
|
|
||||||
"CanadianFrench", "Portugese", "Russian",
|
|
||||||
"Korean", "Taiwanese", "Chinese"};
|
|
||||||
|
|
||||||
// A class representing the format used by NX metadata files, typically named Control.nacp.
|
// 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.
|
// These store application name, dev name, title id, and other miscellaneous data.
|
||||||
|
|
Loading…
Reference in a new issue