content_archive: Add getter for logo section of NCA

This commit is contained in:
Zach Hilman 2019-01-15 15:56:32 -05:00
parent 7c6bb8c17f
commit 318bf7c8e3
2 changed files with 16 additions and 0 deletions

View File

@ -359,6 +359,8 @@ bool NCA::ReadPFS0Section(const NCASectionHeader& section, const NCASectionTable
dirs.push_back(std::move(npfs)); dirs.push_back(std::move(npfs));
if (IsDirectoryExeFS(dirs.back())) if (IsDirectoryExeFS(dirs.back()))
exefs = dirs.back(); exefs = dirs.back();
else if (IsDirectoryLogoPartition(dirs.back()))
logo = dirs.back();
} else { } else {
if (has_rights_id) if (has_rights_id)
status = Loader::ResultStatus::ErrorIncorrectTitlekeyOrTitlekek; status = Loader::ResultStatus::ErrorIncorrectTitlekeyOrTitlekek;
@ -546,4 +548,8 @@ u64 NCA::GetBaseIVFCOffset() const {
return ivfc_offset; return ivfc_offset;
} }
VirtualDir NCA::GetLogoPartition() const {
return logo;
}
} // namespace FileSys } // namespace FileSys

View File

@ -74,6 +74,13 @@ inline bool IsDirectoryExeFS(const std::shared_ptr<VfsDirectory>& pfs) {
return pfs->GetFile("main") != nullptr && pfs->GetFile("main.npdm") != nullptr; return pfs->GetFile("main") != nullptr && pfs->GetFile("main.npdm") != nullptr;
} }
inline bool IsDirectoryLogoPartition(const VirtualDir& pfs) {
// NintendoLogo is the static image in the top left corner while StartupMovie is the animation
// in the bottom right corner.
return pfs->GetFile("NintendoLogo.png") != nullptr &&
pfs->GetFile("StartupMovie.gif") != nullptr;
}
// An implementation of VfsDirectory that represents a Nintendo Content Archive (NCA) conatiner. // An implementation of VfsDirectory that represents a Nintendo Content Archive (NCA) conatiner.
// After construction, use GetStatus to determine if the file is valid and ready to be used. // After construction, use GetStatus to determine if the file is valid and ready to be used.
class NCA : public ReadOnlyVfsDirectory { class NCA : public ReadOnlyVfsDirectory {
@ -102,6 +109,8 @@ public:
// Returns the base ivfc offset used in BKTR patching. // Returns the base ivfc offset used in BKTR patching.
u64 GetBaseIVFCOffset() const; u64 GetBaseIVFCOffset() const;
VirtualDir GetLogoPartition() const;
private: private:
bool CheckSupportedNCA(const NCAHeader& header); bool CheckSupportedNCA(const NCAHeader& header);
bool HandlePotentialHeaderDecryption(); bool HandlePotentialHeaderDecryption();
@ -122,6 +131,7 @@ private:
VirtualFile romfs = nullptr; VirtualFile romfs = nullptr;
VirtualDir exefs = nullptr; VirtualDir exefs = nullptr;
VirtualDir logo = nullptr;
VirtualFile file; VirtualFile file;
VirtualFile bktr_base_romfs; VirtualFile bktr_base_romfs;
u64 ivfc_offset = 0; u64 ivfc_offset = 0;