diff options
author | Zach Hilman <zachhilman@gmail.com> | 2018-07-29 03:39:42 +0200 |
---|---|---|
committer | Zach Hilman <zachhilman@gmail.com> | 2018-08-01 06:16:54 +0200 |
commit | 239a3113e4c6a53a2c7b12e67a0f21afae24b0aa (patch) | |
tree | 027bc4288f08be240d0b9b2a5f6c6431e76b8b4f /src/core/file_sys/card_image.cpp | |
parent | Extract mbedtls to cpp file (diff) | |
download | yuzu-239a3113e4c6a53a2c7b12e67a0f21afae24b0aa.tar yuzu-239a3113e4c6a53a2c7b12e67a0f21afae24b0aa.tar.gz yuzu-239a3113e4c6a53a2c7b12e67a0f21afae24b0aa.tar.bz2 yuzu-239a3113e4c6a53a2c7b12e67a0f21afae24b0aa.tar.lz yuzu-239a3113e4c6a53a2c7b12e67a0f21afae24b0aa.tar.xz yuzu-239a3113e4c6a53a2c7b12e67a0f21afae24b0aa.tar.zst yuzu-239a3113e4c6a53a2c7b12e67a0f21afae24b0aa.zip |
Diffstat (limited to 'src/core/file_sys/card_image.cpp')
-rw-r--r-- | src/core/file_sys/card_image.cpp | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/core/file_sys/card_image.cpp b/src/core/file_sys/card_image.cpp index 5ff09a362..3c1dbf46c 100644 --- a/src/core/file_sys/card_image.cpp +++ b/src/core/file_sys/card_image.cpp @@ -30,8 +30,8 @@ XCI::XCI(VirtualFile file_) : file(std::move(file_)), partitions(0x4) { return; } - const static std::array<std::string, 0x4> partition_names = {"update", "normal", "secure", - "logo"}; + static constexpr std::array<const char*, 0x4> partition_names = {"update", "normal", "secure", + "logo"}; for (XCIPartition partition : {XCIPartition::Update, XCIPartition::Normal, XCIPartition::Secure, XCIPartition::Logo}) { @@ -93,12 +93,9 @@ VirtualDir XCI::GetLogoPartition() const { } std::shared_ptr<NCA> XCI::GetNCAByType(NCAContentType type) const { - for (const auto& nca : ncas) { - if (nca->GetType() == type) - return nca; - } - - return nullptr; + auto iter = std::find_if(ncas.begin(), ncas.end(), + [type](std::shared_ptr<NCA> nca) { return nca->GetType() == type; }); + return iter == ncas.end() ? nullptr : *iter; } VirtualFile XCI::GetNCAFileByType(NCAContentType type) const { @@ -133,7 +130,7 @@ Loader::ResultStatus XCI::AddNCAFromPartition(XCIPartition part) { return Loader::ResultStatus::ErrorInvalidFormat; } - for (VirtualFile file : partitions[static_cast<size_t>(part)]->GetFiles()) { + for (const VirtualFile& file : partitions[static_cast<size_t>(part)]->GetFiles()) { if (file->GetExtension() != "nca") continue; auto nca = std::make_shared<NCA>(file); |