diff options
author | Morph <39850852+Morph1984@users.noreply.github.com> | 2020-07-20 16:30:25 +0200 |
---|---|---|
committer | Morph <39850852+Morph1984@users.noreply.github.com> | 2020-07-29 12:50:30 +0200 |
commit | ed46f3c62a7649cfaada61c8cdb9dfd91e54a9db (patch) | |
tree | d93cd38ef3d74cd5870a602b63ebec6c5baed85b /src/core/file_sys/xts_archive.cpp | |
parent | registered_cache: Add support for removing folder ncas (diff) | |
download | yuzu-ed46f3c62a7649cfaada61c8cdb9dfd91e54a9db.tar yuzu-ed46f3c62a7649cfaada61c8cdb9dfd91e54a9db.tar.gz yuzu-ed46f3c62a7649cfaada61c8cdb9dfd91e54a9db.tar.bz2 yuzu-ed46f3c62a7649cfaada61c8cdb9dfd91e54a9db.tar.lz yuzu-ed46f3c62a7649cfaada61c8cdb9dfd91e54a9db.tar.xz yuzu-ed46f3c62a7649cfaada61c8cdb9dfd91e54a9db.tar.zst yuzu-ed46f3c62a7649cfaada61c8cdb9dfd91e54a9db.zip |
Diffstat (limited to 'src/core/file_sys/xts_archive.cpp')
-rw-r--r-- | src/core/file_sys/xts_archive.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/core/file_sys/xts_archive.cpp b/src/core/file_sys/xts_archive.cpp index 86e06ccb9..81413c684 100644 --- a/src/core/file_sys/xts_archive.cpp +++ b/src/core/file_sys/xts_archive.cpp @@ -70,14 +70,18 @@ NAX::NAX(VirtualFile file_, std::array<u8, 0x10> nca_id) NAX::~NAX() = default; Loader::ResultStatus NAX::Parse(std::string_view path) { - if (file->ReadObject(header.get()) != sizeof(NAXHeader)) + if (file == nullptr) { + return Loader::ResultStatus::ErrorNullFile; + } + if (file->ReadObject(header.get()) != sizeof(NAXHeader)) { return Loader::ResultStatus::ErrorBadNAXHeader; - - if (header->magic != Common::MakeMagic('N', 'A', 'X', '0')) + } + if (header->magic != Common::MakeMagic('N', 'A', 'X', '0')) { return Loader::ResultStatus::ErrorBadNAXHeader; - - if (file->GetSize() < NAX_HEADER_PADDING_SIZE + header->file_size) + } + if (file->GetSize() < NAX_HEADER_PADDING_SIZE + header->file_size) { return Loader::ResultStatus::ErrorIncorrectNAXFileSize; + } keys.DeriveSDSeedLazy(); std::array<Core::Crypto::Key256, 2> sd_keys{}; |