Use the first available language entry in NACPs rather than hardcoding

American English

Without this, if an NACP didn't contain a title for a US english it
would show in the UI as blank.
This commit is contained in:
Billy Laws 2020-06-29 18:24:53 +01:00 committed by ◱ PixelyIon
parent 26025d9adf
commit 7114ad1734
2 changed files with 10 additions and 4 deletions

View File

@ -8,8 +8,14 @@ namespace skyline::vfs {
backing->Read(&nacpContents);
// TODO: Select based on language settings, complete struct, yada yada
ApplicationTitle &languageEntry = nacpContents.titleEntries[0];
applicationName = std::string(languageEntry.applicationName.data(), languageEntry.applicationName.size());
applicationPublisher = std::string(languageEntry.applicationPublisher.data(), languageEntry.applicationPublisher.size());
// Iterate till we get to the first populated entry
for (auto &entry : nacpContents.titleEntries) {
if (entry.applicationName.front() == '\0')
continue;
applicationName = std::string(entry.applicationName.data(), entry.applicationName.size());
applicationPublisher = std::string(entry.applicationPublisher.data(), entry.applicationPublisher.size());
}
}
}

View File

@ -26,7 +26,7 @@ namespace skyline::vfs {
* @brief This struct encapsulates all the data within an NACP file
*/
struct NacpData {
ApplicationTitle titleEntries[0x10]; //!< Title entries for each language
std::array<ApplicationTitle, 0x10> titleEntries; //!< Title entries for each language
u8 _pad_[0x4000 - (0x10 * 0x300)];
} nacpContents{};
static_assert(sizeof(NacpData) == 0x4000);