diff options
author | Lioncash <mathew1800@gmail.com> | 2021-05-02 08:34:40 +0200 |
---|---|---|
committer | Lioncash <mathew1800@gmail.com> | 2021-05-02 08:59:57 +0200 |
commit | 1da72c7792e4f68fd44579a713288f6772c193b4 (patch) | |
tree | 83061da36f2dd728e86d035c81fb646f23a2aab0 /src/core/file_sys/content_archive.cpp | |
parent | Merge pull request #6245 from lat9nq/boost-only-config (diff) | |
download | yuzu-1da72c7792e4f68fd44579a713288f6772c193b4.tar yuzu-1da72c7792e4f68fd44579a713288f6772c193b4.tar.gz yuzu-1da72c7792e4f68fd44579a713288f6772c193b4.tar.bz2 yuzu-1da72c7792e4f68fd44579a713288f6772c193b4.tar.lz yuzu-1da72c7792e4f68fd44579a713288f6772c193b4.tar.xz yuzu-1da72c7792e4f68fd44579a713288f6772c193b4.tar.zst yuzu-1da72c7792e4f68fd44579a713288f6772c193b4.zip |
Diffstat (limited to 'src/core/file_sys/content_archive.cpp')
-rw-r--r-- | src/core/file_sys/content_archive.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/core/file_sys/content_archive.cpp b/src/core/file_sys/content_archive.cpp index d12218fc2..24eff210f 100644 --- a/src/core/file_sys/content_archive.cpp +++ b/src/core/file_sys/content_archive.cpp @@ -5,6 +5,7 @@ #include <algorithm> #include <cstring> #include <optional> +#include <ranges> #include <utility> #include "common/logging/log.h" @@ -136,12 +137,11 @@ NCA::NCA(VirtualFile file_, VirtualFile bktr_base_romfs_, u64 bktr_base_ivfc_off return; } - has_rights_id = std::any_of(header.rights_id.begin(), header.rights_id.end(), - [](char c) { return c != '\0'; }); + has_rights_id = std::ranges::any_of(header.rights_id, [](char c) { return c != '\0'; }); const std::vector<NCASectionHeader> sections = ReadSectionHeaders(); - is_update = std::any_of(sections.begin(), sections.end(), [](const NCASectionHeader& header) { - return header.raw.header.crypto_type == NCASectionCryptoType::BKTR; + is_update = std::ranges::any_of(sections, [](const NCASectionHeader& nca_header) { + return nca_header.raw.header.crypto_type == NCASectionCryptoType::BKTR; }); if (!ReadSections(sections, bktr_base_ivfc_offset)) { @@ -202,8 +202,9 @@ bool NCA::HandlePotentialHeaderDecryption() { std::vector<NCASectionHeader> NCA::ReadSectionHeaders() const { const std::ptrdiff_t number_sections = - std::count_if(std::begin(header.section_tables), std::end(header.section_tables), - [](NCASectionTableEntry entry) { return entry.media_offset > 0; }); + std::ranges::count_if(header.section_tables, [](const NCASectionTableEntry& entry) { + return entry.media_offset > 0; + }); std::vector<NCASectionHeader> sections(number_sections); const auto length_sections = SECTION_HEADER_SIZE * number_sections; @@ -312,11 +313,11 @@ bool NCA::ReadRomFSSection(const NCASectionHeader& section, const NCASectionTabl } std::vector<RelocationBucket> relocation_buckets(relocation_buckets_raw.size()); - std::transform(relocation_buckets_raw.begin(), relocation_buckets_raw.end(), - relocation_buckets.begin(), &ConvertRelocationBucketRaw); + std::ranges::transform(relocation_buckets_raw, relocation_buckets.begin(), + &ConvertRelocationBucketRaw); std::vector<SubsectionBucket> subsection_buckets(subsection_buckets_raw.size()); - std::transform(subsection_buckets_raw.begin(), subsection_buckets_raw.end(), - subsection_buckets.begin(), &ConvertSubsectionBucketRaw); + std::ranges::transform(subsection_buckets_raw, subsection_buckets.begin(), + &ConvertSubsectionBucketRaw); u32 ctr_low; std::memcpy(&ctr_low, section.raw.section_ctr.data(), sizeof(ctr_low)); |