diff options
author | Zach Hilman <zachhilman@gmail.com> | 2018-08-10 03:06:44 +0200 |
---|---|---|
committer | Zach Hilman <zachhilman@gmail.com> | 2018-08-10 03:06:59 +0200 |
commit | ec3bef7b4c21931918f3a84ad79a53d31b02aeaf (patch) | |
tree | e9da97be14d9474910faa1cfde851aa5b2383bc0 /src/core/file_sys/card_image.cpp | |
parent | Merge pull request #995 from bunnei/gl-buff-bounds (diff) | |
download | yuzu-ec3bef7b4c21931918f3a84ad79a53d31b02aeaf.tar yuzu-ec3bef7b4c21931918f3a84ad79a53d31b02aeaf.tar.gz yuzu-ec3bef7b4c21931918f3a84ad79a53d31b02aeaf.tar.bz2 yuzu-ec3bef7b4c21931918f3a84ad79a53d31b02aeaf.tar.lz yuzu-ec3bef7b4c21931918f3a84ad79a53d31b02aeaf.tar.xz yuzu-ec3bef7b4c21931918f3a84ad79a53d31b02aeaf.tar.zst yuzu-ec3bef7b4c21931918f3a84ad79a53d31b02aeaf.zip |
Diffstat (limited to 'src/core/file_sys/card_image.cpp')
-rw-r--r-- | src/core/file_sys/card_image.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/core/file_sys/card_image.cpp b/src/core/file_sys/card_image.cpp index e897d9913..a4823353e 100644 --- a/src/core/file_sys/card_image.cpp +++ b/src/core/file_sys/card_image.cpp @@ -12,14 +12,16 @@ namespace FileSys { +constexpr std::array<const char*, 0x4> partition_names = {"update", "normal", "secure", "logo"}; + XCI::XCI(VirtualFile file_) : file(std::move(file_)), partitions(0x4) { if (file->ReadObject(&header) != sizeof(GamecardHeader)) { - status = Loader::ResultStatus::ErrorInvalidFormat; + status = Loader::ResultStatus::ErrorBadXCIHeader; return; } if (header.magic != Common::MakeMagic('H', 'E', 'A', 'D')) { - status = Loader::ResultStatus::ErrorInvalidFormat; + status = Loader::ResultStatus::ErrorBadXCIHeader; return; } @@ -31,9 +33,6 @@ XCI::XCI(VirtualFile file_) : file(std::move(file_)), partitions(0x4) { return; } - static constexpr std::array<const char*, 0x4> partition_names = {"update", "normal", "secure", - "logo"}; - for (XCIPartition partition : {XCIPartition::Update, XCIPartition::Normal, XCIPartition::Secure, XCIPartition::Logo}) { auto raw = main_hfs.GetFile(partition_names[static_cast<size_t>(partition)]); @@ -130,15 +129,21 @@ bool XCI::ReplaceFileWithSubdirectory(VirtualFile file, VirtualDir dir) { Loader::ResultStatus XCI::AddNCAFromPartition(XCIPartition part) { if (partitions[static_cast<size_t>(part)] == nullptr) { - return Loader::ResultStatus::ErrorInvalidFormat; + return Loader::ResultStatus::ErrorXCIMissingPartition; } for (const VirtualFile& file : partitions[static_cast<size_t>(part)]->GetFiles()) { if (file->GetExtension() != "nca") continue; auto nca = std::make_shared<NCA>(file); - if (nca->GetStatus() == Loader::ResultStatus::Success) + if (nca->GetStatus() == Loader::ResultStatus::Success) { ncas.push_back(std::move(nca)); + } else { + const u16 error_id = static_cast<u16>(nca->GetStatus()); + LOG_CRITICAL(Loader, "Could not load NCA {}/{}, failed with error code {:04X} ({})", + partition_names[static_cast<size_t>(part)], nca->GetName(), error_id, + Loader::GetMessageForResultStatus(nca->GetStatus())); + } } return Loader::ResultStatus::Success; |