diff options
author | bunnei <bunneidev@gmail.com> | 2018-10-19 03:48:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-19 03:48:09 +0200 |
commit | 7f152f22737dbd632568dded33d1fe1435d80376 (patch) | |
tree | 01fd3dd3ad3f368c27a36647642850ba2eed08b1 /src/core/file_sys/content_archive.h | |
parent | Merge pull request #1521 from ogniK5377/imp-mmu (diff) | |
parent | content_archive: Simpify assignment of bktr_base_romfs in the constructor (diff) | |
download | yuzu-7f152f22737dbd632568dded33d1fe1435d80376.tar yuzu-7f152f22737dbd632568dded33d1fe1435d80376.tar.gz yuzu-7f152f22737dbd632568dded33d1fe1435d80376.tar.bz2 yuzu-7f152f22737dbd632568dded33d1fe1435d80376.tar.lz yuzu-7f152f22737dbd632568dded33d1fe1435d80376.tar.xz yuzu-7f152f22737dbd632568dded33d1fe1435d80376.tar.zst yuzu-7f152f22737dbd632568dded33d1fe1435d80376.zip |
Diffstat (limited to 'src/core/file_sys/content_archive.h')
-rw-r--r-- | src/core/file_sys/content_archive.h | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/core/file_sys/content_archive.h b/src/core/file_sys/content_archive.h index f9f66cae9..1c903cd3f 100644 --- a/src/core/file_sys/content_archive.h +++ b/src/core/file_sys/content_archive.h @@ -73,8 +73,6 @@ inline bool IsDirectoryExeFS(const std::shared_ptr<VfsDirectory>& pfs) { return pfs->GetFile("main") != nullptr && pfs->GetFile("main.npdm") != nullptr; } -bool IsValidNCA(const NCAHeader& header); - // 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. class NCA : public ReadOnlyVfsDirectory { @@ -106,10 +104,19 @@ protected: bool ReplaceFileWithSubdirectory(VirtualFile file, VirtualDir dir) override; private: + bool CheckSupportedNCA(const NCAHeader& header); + bool HandlePotentialHeaderDecryption(); + + std::vector<NCASectionHeader> ReadSectionHeaders() const; + bool ReadSections(const std::vector<NCASectionHeader>& sections, u64 bktr_base_ivfc_offset); + bool ReadRomFSSection(const NCASectionHeader& section, const NCASectionTableEntry& entry, + u64 bktr_base_ivfc_offset); + bool ReadPFS0Section(const NCASectionHeader& section, const NCASectionTableEntry& entry); + u8 GetCryptoRevision() const; boost::optional<Core::Crypto::Key128> GetKeyAreaKey(NCASectionCryptoType type) const; boost::optional<Core::Crypto::Key128> GetTitlekey(); - VirtualFile Decrypt(NCASectionHeader header, VirtualFile in, u64 starting_offset); + VirtualFile Decrypt(const NCASectionHeader& header, VirtualFile in, u64 starting_offset); std::vector<VirtualDir> dirs; std::vector<VirtualFile> files; @@ -118,15 +125,15 @@ private: VirtualDir exefs = nullptr; VirtualFile file; VirtualFile bktr_base_romfs; - u64 ivfc_offset; + u64 ivfc_offset = 0; NCAHeader header{}; bool has_rights_id{}; Loader::ResultStatus status{}; - bool encrypted; - bool is_update; + bool encrypted = false; + bool is_update = false; Core::Crypto::KeyManager keys; }; |