diff options
| author | 2021-05-02 15:12:07 -0700 | |
|---|---|---|
| committer | 2021-05-02 15:12:07 -0700 | |
| commit | c17a59b58e4c78dfee976dabddd13c3c6fdf95b7 (patch) | |
| tree | 7a935c140bd467ca9e5e3ca27547ee6fee14861f /src | |
| parent | Merge pull request #6263 from Kewlan/folder-swap-expand-state (diff) | |
| parent | file_sys: Resolve cases of variable shadowing (diff) | |
| download | yuzu-c17a59b58e4c78dfee976dabddd13c3c6fdf95b7.tar.gz yuzu-c17a59b58e4c78dfee976dabddd13c3c6fdf95b7.tar.xz yuzu-c17a59b58e4c78dfee976dabddd13c3c6fdf95b7.zip | |
Merge pull request #6269 from lioncash/file-shadow
file_sys: Resolve cases of variable shadowing
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/file_sys/card_image.cpp | 26 | ||||
| -rw-r--r-- | src/core/file_sys/content_archive.cpp | 21 | ||||
| -rw-r--r-- | src/core/file_sys/fsmitm_romfsbuild.cpp | 25 | ||||
| -rw-r--r-- | src/core/file_sys/fsmitm_romfsbuild.h | 2 | ||||
| -rw-r--r-- | src/core/file_sys/nca_patch.cpp | 18 | ||||
| -rw-r--r-- | src/core/file_sys/registered_cache.cpp | 32 | ||||
| -rw-r--r-- | src/core/file_sys/registered_cache.h | 2 | ||||
| -rw-r--r-- | src/core/file_sys/romfs_factory.cpp | 4 | ||||
| -rw-r--r-- | src/core/file_sys/romfs_factory.h | 2 | ||||
| -rw-r--r-- | src/core/file_sys/savedata_factory.cpp | 18 | ||||
| -rw-r--r-- | src/core/file_sys/submission_package.cpp | 8 | ||||
| -rw-r--r-- | src/core/file_sys/vfs_concat.cpp | 2 | ||||
| -rw-r--r-- | src/core/file_sys/vfs_concat.h | 2 | ||||
| -rw-r--r-- | src/core/file_sys/vfs_layered.cpp | 20 | ||||
| -rw-r--r-- | src/core/file_sys/vfs_layered.h | 14 | ||||
| -rw-r--r-- | src/core/file_sys/vfs_offset.cpp | 4 | ||||
| -rw-r--r-- | src/core/file_sys/vfs_offset.h | 2 | ||||
| -rw-r--r-- | src/core/file_sys/vfs_real.cpp | 16 | ||||
| -rw-r--r-- | src/core/file_sys/vfs_real.h | 8 | ||||
| -rw-r--r-- | src/core/file_sys/vfs_vector.cpp | 12 | ||||
| -rw-r--r-- | src/core/file_sys/vfs_vector.h | 8 |
21 files changed, 132 insertions, 114 deletions
diff --git a/src/core/file_sys/card_image.cpp b/src/core/file_sys/card_image.cpp index 8dee5590b..db2f6a955 100644 --- a/src/core/file_sys/card_image.cpp +++ b/src/core/file_sys/card_image.cpp | |||
| @@ -176,26 +176,30 @@ u64 XCI::GetProgramTitleID() const { | |||
| 176 | 176 | ||
| 177 | u32 XCI::GetSystemUpdateVersion() { | 177 | u32 XCI::GetSystemUpdateVersion() { |
| 178 | const auto update = GetPartition(XCIPartition::Update); | 178 | const auto update = GetPartition(XCIPartition::Update); |
| 179 | if (update == nullptr) | 179 | if (update == nullptr) { |
| 180 | return 0; | 180 | return 0; |
| 181 | } | ||
| 181 | 182 | ||
| 182 | for (const auto& file : update->GetFiles()) { | 183 | for (const auto& update_file : update->GetFiles()) { |
| 183 | NCA nca{file, nullptr, 0}; | 184 | NCA nca{update_file, nullptr, 0}; |
| 184 | 185 | ||
| 185 | if (nca.GetStatus() != Loader::ResultStatus::Success) | 186 | if (nca.GetStatus() != Loader::ResultStatus::Success) { |
| 186 | continue; | 187 | continue; |
| 188 | } | ||
| 187 | 189 | ||
| 188 | if (nca.GetType() == NCAContentType::Meta && nca.GetTitleId() == 0x0100000000000816) { | 190 | if (nca.GetType() == NCAContentType::Meta && nca.GetTitleId() == 0x0100000000000816) { |
| 189 | const auto dir = nca.GetSubdirectories()[0]; | 191 | const auto dir = nca.GetSubdirectories()[0]; |
| 190 | const auto cnmt = dir->GetFile("SystemUpdate_0100000000000816.cnmt"); | 192 | const auto cnmt = dir->GetFile("SystemUpdate_0100000000000816.cnmt"); |
| 191 | if (cnmt == nullptr) | 193 | if (cnmt == nullptr) { |
| 192 | continue; | 194 | continue; |
| 195 | } | ||
| 193 | 196 | ||
| 194 | CNMT cnmt_data{cnmt}; | 197 | CNMT cnmt_data{cnmt}; |
| 195 | 198 | ||
| 196 | const auto metas = cnmt_data.GetMetaRecords(); | 199 | const auto metas = cnmt_data.GetMetaRecords(); |
| 197 | if (metas.empty()) | 200 | if (metas.empty()) { |
| 198 | continue; | 201 | continue; |
| 202 | } | ||
| 199 | 203 | ||
| 200 | return metas[0].title_version; | 204 | return metas[0].title_version; |
| 201 | } | 205 | } |
| @@ -262,8 +266,8 @@ VirtualDir XCI::ConcatenatedPseudoDirectory() { | |||
| 262 | if (part == nullptr) | 266 | if (part == nullptr) |
| 263 | continue; | 267 | continue; |
| 264 | 268 | ||
| 265 | for (const auto& file : part->GetFiles()) | 269 | for (const auto& part_file : part->GetFiles()) |
| 266 | out->AddFile(file); | 270 | out->AddFile(part_file); |
| 267 | } | 271 | } |
| 268 | 272 | ||
| 269 | return out; | 273 | return out; |
| @@ -283,12 +287,12 @@ Loader::ResultStatus XCI::AddNCAFromPartition(XCIPartition part) { | |||
| 283 | return Loader::ResultStatus::ErrorXCIMissingPartition; | 287 | return Loader::ResultStatus::ErrorXCIMissingPartition; |
| 284 | } | 288 | } |
| 285 | 289 | ||
| 286 | for (const VirtualFile& file : partition->GetFiles()) { | 290 | for (const VirtualFile& partition_file : partition->GetFiles()) { |
| 287 | if (file->GetExtension() != "nca") { | 291 | if (partition_file->GetExtension() != "nca") { |
| 288 | continue; | 292 | continue; |
| 289 | } | 293 | } |
| 290 | 294 | ||
| 291 | auto nca = std::make_shared<NCA>(file, nullptr, 0); | 295 | auto nca = std::make_shared<NCA>(partition_file, nullptr, 0); |
| 292 | if (nca->IsUpdate()) { | 296 | if (nca->IsUpdate()) { |
| 293 | continue; | 297 | continue; |
| 294 | } | 298 | } |
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 @@ | |||
| 5 | #include <algorithm> | 5 | #include <algorithm> |
| 6 | #include <cstring> | 6 | #include <cstring> |
| 7 | #include <optional> | 7 | #include <optional> |
| 8 | #include <ranges> | ||
| 8 | #include <utility> | 9 | #include <utility> |
| 9 | 10 | ||
| 10 | #include "common/logging/log.h" | 11 | #include "common/logging/log.h" |
| @@ -136,12 +137,11 @@ NCA::NCA(VirtualFile file_, VirtualFile bktr_base_romfs_, u64 bktr_base_ivfc_off | |||
| 136 | return; | 137 | return; |
| 137 | } | 138 | } |
| 138 | 139 | ||
| 139 | has_rights_id = std::any_of(header.rights_id.begin(), header.rights_id.end(), | 140 | has_rights_id = std::ranges::any_of(header.rights_id, [](char c) { return c != '\0'; }); |
| 140 | [](char c) { return c != '\0'; }); | ||
| 141 | 141 | ||
| 142 | const std::vector<NCASectionHeader> sections = ReadSectionHeaders(); | 142 | const std::vector<NCASectionHeader> sections = ReadSectionHeaders(); |
| 143 | is_update = std::any_of(sections.begin(), sections.end(), [](const NCASectionHeader& header) { | 143 | is_update = std::ranges::any_of(sections, [](const NCASectionHeader& nca_header) { |
| 144 | return header.raw.header.crypto_type == NCASectionCryptoType::BKTR; | 144 | return nca_header.raw.header.crypto_type == NCASectionCryptoType::BKTR; |
| 145 | }); | 145 | }); |
| 146 | 146 | ||
| 147 | if (!ReadSections(sections, bktr_base_ivfc_offset)) { | 147 | if (!ReadSections(sections, bktr_base_ivfc_offset)) { |
| @@ -202,8 +202,9 @@ bool NCA::HandlePotentialHeaderDecryption() { | |||
| 202 | 202 | ||
| 203 | std::vector<NCASectionHeader> NCA::ReadSectionHeaders() const { | 203 | std::vector<NCASectionHeader> NCA::ReadSectionHeaders() const { |
| 204 | const std::ptrdiff_t number_sections = | 204 | const std::ptrdiff_t number_sections = |
| 205 | std::count_if(std::begin(header.section_tables), std::end(header.section_tables), | 205 | std::ranges::count_if(header.section_tables, [](const NCASectionTableEntry& entry) { |
| 206 | [](NCASectionTableEntry entry) { return entry.media_offset > 0; }); | 206 | return entry.media_offset > 0; |
| 207 | }); | ||
| 207 | 208 | ||
| 208 | std::vector<NCASectionHeader> sections(number_sections); | 209 | std::vector<NCASectionHeader> sections(number_sections); |
| 209 | const auto length_sections = SECTION_HEADER_SIZE * number_sections; | 210 | const auto length_sections = SECTION_HEADER_SIZE * number_sections; |
| @@ -312,11 +313,11 @@ bool NCA::ReadRomFSSection(const NCASectionHeader& section, const NCASectionTabl | |||
| 312 | } | 313 | } |
| 313 | 314 | ||
| 314 | std::vector<RelocationBucket> relocation_buckets(relocation_buckets_raw.size()); | 315 | std::vector<RelocationBucket> relocation_buckets(relocation_buckets_raw.size()); |
| 315 | std::transform(relocation_buckets_raw.begin(), relocation_buckets_raw.end(), | 316 | std::ranges::transform(relocation_buckets_raw, relocation_buckets.begin(), |
| 316 | relocation_buckets.begin(), &ConvertRelocationBucketRaw); | 317 | &ConvertRelocationBucketRaw); |
| 317 | std::vector<SubsectionBucket> subsection_buckets(subsection_buckets_raw.size()); | 318 | std::vector<SubsectionBucket> subsection_buckets(subsection_buckets_raw.size()); |
| 318 | std::transform(subsection_buckets_raw.begin(), subsection_buckets_raw.end(), | 319 | std::ranges::transform(subsection_buckets_raw, subsection_buckets.begin(), |
| 319 | subsection_buckets.begin(), &ConvertSubsectionBucketRaw); | 320 | &ConvertSubsectionBucketRaw); |
| 320 | 321 | ||
| 321 | u32 ctr_low; | 322 | u32 ctr_low; |
| 322 | std::memcpy(&ctr_low, section.raw.section_ctr.data(), sizeof(ctr_low)); | 323 | std::memcpy(&ctr_low, section.raw.section_ctr.data(), sizeof(ctr_low)); |
diff --git a/src/core/file_sys/fsmitm_romfsbuild.cpp b/src/core/file_sys/fsmitm_romfsbuild.cpp index c52fafb6f..1ca1d536f 100644 --- a/src/core/file_sys/fsmitm_romfsbuild.cpp +++ b/src/core/file_sys/fsmitm_romfsbuild.cpp | |||
| @@ -126,16 +126,17 @@ static u64 romfs_get_hash_table_count(u64 num_entries) { | |||
| 126 | return count; | 126 | return count; |
| 127 | } | 127 | } |
| 128 | 128 | ||
| 129 | void RomFSBuildContext::VisitDirectory(VirtualDir root_romfs, VirtualDir ext, | 129 | void RomFSBuildContext::VisitDirectory(VirtualDir root_romfs, VirtualDir ext_dir, |
| 130 | std::shared_ptr<RomFSBuildDirectoryContext> parent) { | 130 | std::shared_ptr<RomFSBuildDirectoryContext> parent) { |
| 131 | std::vector<std::shared_ptr<RomFSBuildDirectoryContext>> child_dirs; | 131 | std::vector<std::shared_ptr<RomFSBuildDirectoryContext>> child_dirs; |
| 132 | 132 | ||
| 133 | VirtualDir dir; | 133 | VirtualDir dir; |
| 134 | 134 | ||
| 135 | if (parent->path_len == 0) | 135 | if (parent->path_len == 0) { |
| 136 | dir = root_romfs; | 136 | dir = root_romfs; |
| 137 | else | 137 | } else { |
| 138 | dir = root_romfs->GetDirectoryRelative(parent->path); | 138 | dir = root_romfs->GetDirectoryRelative(parent->path); |
| 139 | } | ||
| 139 | 140 | ||
| 140 | const auto entries = dir->GetEntries(); | 141 | const auto entries = dir->GetEntries(); |
| 141 | 142 | ||
| @@ -147,8 +148,9 @@ void RomFSBuildContext::VisitDirectory(VirtualDir root_romfs, VirtualDir ext, | |||
| 147 | child->path_len = child->cur_path_ofs + static_cast<u32>(kv.first.size()); | 148 | child->path_len = child->cur_path_ofs + static_cast<u32>(kv.first.size()); |
| 148 | child->path = parent->path + "/" + kv.first; | 149 | child->path = parent->path + "/" + kv.first; |
| 149 | 150 | ||
| 150 | if (ext != nullptr && ext->GetFileRelative(child->path + ".stub") != nullptr) | 151 | if (ext_dir != nullptr && ext_dir->GetFileRelative(child->path + ".stub") != nullptr) { |
| 151 | continue; | 152 | continue; |
| 153 | } | ||
| 152 | 154 | ||
| 153 | // Sanity check on path_len | 155 | // Sanity check on path_len |
| 154 | ASSERT(child->path_len < FS_MAX_PATH); | 156 | ASSERT(child->path_len < FS_MAX_PATH); |
| @@ -163,21 +165,20 @@ void RomFSBuildContext::VisitDirectory(VirtualDir root_romfs, VirtualDir ext, | |||
| 163 | child->path_len = child->cur_path_ofs + static_cast<u32>(kv.first.size()); | 165 | child->path_len = child->cur_path_ofs + static_cast<u32>(kv.first.size()); |
| 164 | child->path = parent->path + "/" + kv.first; | 166 | child->path = parent->path + "/" + kv.first; |
| 165 | 167 | ||
| 166 | if (ext != nullptr && ext->GetFileRelative(child->path + ".stub") != nullptr) | 168 | if (ext_dir != nullptr && ext_dir->GetFileRelative(child->path + ".stub") != nullptr) { |
| 167 | continue; | 169 | continue; |
| 170 | } | ||
| 168 | 171 | ||
| 169 | // Sanity check on path_len | 172 | // Sanity check on path_len |
| 170 | ASSERT(child->path_len < FS_MAX_PATH); | 173 | ASSERT(child->path_len < FS_MAX_PATH); |
| 171 | 174 | ||
| 172 | child->source = root_romfs->GetFileRelative(child->path); | 175 | child->source = root_romfs->GetFileRelative(child->path); |
| 173 | 176 | ||
| 174 | if (ext != nullptr) { | 177 | if (ext_dir != nullptr) { |
| 175 | const auto ips = ext->GetFileRelative(child->path + ".ips"); | 178 | if (const auto ips = ext_dir->GetFileRelative(child->path + ".ips")) { |
| 176 | 179 | if (auto patched = PatchIPS(child->source, ips)) { | |
| 177 | if (ips != nullptr) { | ||
| 178 | auto patched = PatchIPS(child->source, ips); | ||
| 179 | if (patched != nullptr) | ||
| 180 | child->source = std::move(patched); | 180 | child->source = std::move(patched); |
| 181 | } | ||
| 181 | } | 182 | } |
| 182 | } | 183 | } |
| 183 | 184 | ||
| @@ -188,7 +189,7 @@ void RomFSBuildContext::VisitDirectory(VirtualDir root_romfs, VirtualDir ext, | |||
| 188 | } | 189 | } |
| 189 | 190 | ||
| 190 | for (auto& child : child_dirs) { | 191 | for (auto& child : child_dirs) { |
| 191 | this->VisitDirectory(root_romfs, ext, child); | 192 | this->VisitDirectory(root_romfs, ext_dir, child); |
| 192 | } | 193 | } |
| 193 | } | 194 | } |
| 194 | 195 | ||
diff --git a/src/core/file_sys/fsmitm_romfsbuild.h b/src/core/file_sys/fsmitm_romfsbuild.h index 049de180b..8d4d89fab 100644 --- a/src/core/file_sys/fsmitm_romfsbuild.h +++ b/src/core/file_sys/fsmitm_romfsbuild.h | |||
| @@ -59,7 +59,7 @@ private: | |||
| 59 | u64 file_hash_table_size = 0; | 59 | u64 file_hash_table_size = 0; |
| 60 | u64 file_partition_size = 0; | 60 | u64 file_partition_size = 0; |
| 61 | 61 | ||
| 62 | void VisitDirectory(VirtualDir filesys, VirtualDir ext, | 62 | void VisitDirectory(VirtualDir filesys, VirtualDir ext_dir, |
| 63 | std::shared_ptr<RomFSBuildDirectoryContext> parent); | 63 | std::shared_ptr<RomFSBuildDirectoryContext> parent); |
| 64 | 64 | ||
| 65 | bool AddDirectory(std::shared_ptr<RomFSBuildDirectoryContext> parent_dir_ctx, | 65 | bool AddDirectory(std::shared_ptr<RomFSBuildDirectoryContext> parent_dir_ctx, |
diff --git a/src/core/file_sys/nca_patch.cpp b/src/core/file_sys/nca_patch.cpp index a65ec6798..b36827b75 100644 --- a/src/core/file_sys/nca_patch.cpp +++ b/src/core/file_sys/nca_patch.cpp | |||
| @@ -83,11 +83,14 @@ BKTR::~BKTR() = default; | |||
| 83 | 83 | ||
| 84 | std::size_t BKTR::Read(u8* data, std::size_t length, std::size_t offset) const { | 84 | std::size_t BKTR::Read(u8* data, std::size_t length, std::size_t offset) const { |
| 85 | // Read out of bounds. | 85 | // Read out of bounds. |
| 86 | if (offset >= relocation.size) | 86 | if (offset >= relocation.size) { |
| 87 | return 0; | 87 | return 0; |
| 88 | const auto relocation = GetRelocationEntry(offset); | 88 | } |
| 89 | const auto section_offset = offset - relocation.address_patch + relocation.address_source; | 89 | |
| 90 | const auto bktr_read = relocation.from_patch; | 90 | const auto relocation_entry = GetRelocationEntry(offset); |
| 91 | const auto section_offset = | ||
| 92 | offset - relocation_entry.address_patch + relocation_entry.address_source; | ||
| 93 | const auto bktr_read = relocation_entry.from_patch; | ||
| 91 | 94 | ||
| 92 | const auto next_relocation = GetNextRelocationEntry(offset); | 95 | const auto next_relocation = GetNextRelocationEntry(offset); |
| 93 | 96 | ||
| @@ -106,15 +109,16 @@ std::size_t BKTR::Read(u8* data, std::size_t length, std::size_t offset) const { | |||
| 106 | return bktr_romfs->Read(data, length, section_offset); | 109 | return bktr_romfs->Read(data, length, section_offset); |
| 107 | } | 110 | } |
| 108 | 111 | ||
| 109 | const auto subsection = GetSubsectionEntry(section_offset); | 112 | const auto subsection_entry = GetSubsectionEntry(section_offset); |
| 110 | Core::Crypto::AESCipher<Core::Crypto::Key128> cipher(key, Core::Crypto::Mode::CTR); | 113 | Core::Crypto::AESCipher<Core::Crypto::Key128> cipher(key, Core::Crypto::Mode::CTR); |
| 111 | 114 | ||
| 112 | // Calculate AES IV | 115 | // Calculate AES IV |
| 113 | std::array<u8, 16> iv{}; | 116 | std::array<u8, 16> iv{}; |
| 114 | auto subsection_ctr = subsection.ctr; | 117 | auto subsection_ctr = subsection_entry.ctr; |
| 115 | auto offset_iv = section_offset + base_offset; | 118 | auto offset_iv = section_offset + base_offset; |
| 116 | for (std::size_t i = 0; i < section_ctr.size(); ++i) | 119 | for (std::size_t i = 0; i < section_ctr.size(); ++i) { |
| 117 | iv[i] = section_ctr[0x8 - i - 1]; | 120 | iv[i] = section_ctr[0x8 - i - 1]; |
| 121 | } | ||
| 118 | offset_iv >>= 4; | 122 | offset_iv >>= 4; |
| 119 | for (std::size_t i = 0; i < sizeof(u64); ++i) { | 123 | for (std::size_t i = 0; i < sizeof(u64); ++i) { |
| 120 | iv[0xF - i] = static_cast<u8>(offset_iv & 0xFF); | 124 | iv[0xF - i] = static_cast<u8>(offset_iv & 0xFF); |
diff --git a/src/core/file_sys/registered_cache.cpp b/src/core/file_sys/registered_cache.cpp index 431302f55..1fb66874e 100644 --- a/src/core/file_sys/registered_cache.cpp +++ b/src/core/file_sys/registered_cache.cpp | |||
| @@ -281,14 +281,14 @@ NcaID PlaceholderCache::Generate() { | |||
| 281 | return out; | 281 | return out; |
| 282 | } | 282 | } |
| 283 | 283 | ||
| 284 | VirtualFile RegisteredCache::OpenFileOrDirectoryConcat(const VirtualDir& dir, | 284 | VirtualFile RegisteredCache::OpenFileOrDirectoryConcat(const VirtualDir& open_dir, |
| 285 | std::string_view path) const { | 285 | std::string_view path) const { |
| 286 | const auto file = dir->GetFileRelative(path); | 286 | const auto file = open_dir->GetFileRelative(path); |
| 287 | if (file != nullptr) { | 287 | if (file != nullptr) { |
| 288 | return file; | 288 | return file; |
| 289 | } | 289 | } |
| 290 | 290 | ||
| 291 | const auto nca_dir = dir->GetDirectoryRelative(path); | 291 | const auto nca_dir = open_dir->GetDirectoryRelative(path); |
| 292 | if (nca_dir == nullptr) { | 292 | if (nca_dir == nullptr) { |
| 293 | return nullptr; | 293 | return nullptr; |
| 294 | } | 294 | } |
| @@ -431,13 +431,15 @@ void RegisteredCache::ProcessFiles(const std::vector<NcaID>& ids) { | |||
| 431 | } | 431 | } |
| 432 | 432 | ||
| 433 | void RegisteredCache::AccumulateYuzuMeta() { | 433 | void RegisteredCache::AccumulateYuzuMeta() { |
| 434 | const auto dir = this->dir->GetSubdirectory("yuzu_meta"); | 434 | const auto meta_dir = dir->GetSubdirectory("yuzu_meta"); |
| 435 | if (dir == nullptr) | 435 | if (meta_dir == nullptr) { |
| 436 | return; | 436 | return; |
| 437 | } | ||
| 437 | 438 | ||
| 438 | for (const auto& file : dir->GetFiles()) { | 439 | for (const auto& file : meta_dir->GetFiles()) { |
| 439 | if (file->GetExtension() != "cnmt") | 440 | if (file->GetExtension() != "cnmt") { |
| 440 | continue; | 441 | continue; |
| 442 | } | ||
| 441 | 443 | ||
| 442 | CNMT cnmt(file); | 444 | CNMT cnmt(file); |
| 443 | yuzu_meta.insert_or_assign(cnmt.GetTitleID(), std::move(cnmt)); | 445 | yuzu_meta.insert_or_assign(cnmt.GetTitleID(), std::move(cnmt)); |
| @@ -445,8 +447,10 @@ void RegisteredCache::AccumulateYuzuMeta() { | |||
| 445 | } | 447 | } |
| 446 | 448 | ||
| 447 | void RegisteredCache::Refresh() { | 449 | void RegisteredCache::Refresh() { |
| 448 | if (dir == nullptr) | 450 | if (dir == nullptr) { |
| 449 | return; | 451 | return; |
| 452 | } | ||
| 453 | |||
| 450 | const auto ids = AccumulateFiles(); | 454 | const auto ids = AccumulateFiles(); |
| 451 | ProcessFiles(ids); | 455 | ProcessFiles(ids); |
| 452 | AccumulateYuzuMeta(); | 456 | AccumulateYuzuMeta(); |
| @@ -566,7 +570,7 @@ InstallResult RegisteredCache::InstallEntry(const NSP& nsp, bool overwrite_if_ex | |||
| 566 | } | 570 | } |
| 567 | 571 | ||
| 568 | const auto meta_id_raw = (*meta_iter)->GetName().substr(0, 32); | 572 | const auto meta_id_raw = (*meta_iter)->GetName().substr(0, 32); |
| 569 | const auto meta_id = Common::HexStringToArray<16>(meta_id_raw); | 573 | const auto meta_id_data = Common::HexStringToArray<16>(meta_id_raw); |
| 570 | 574 | ||
| 571 | if ((*meta_iter)->GetSubdirectories().empty()) { | 575 | if ((*meta_iter)->GetSubdirectories().empty()) { |
| 572 | LOG_ERROR(Loader, | 576 | LOG_ERROR(Loader, |
| @@ -591,7 +595,7 @@ InstallResult RegisteredCache::InstallEntry(const NSP& nsp, bool overwrite_if_ex | |||
| 591 | const auto result = RemoveExistingEntry(title_id); | 595 | const auto result = RemoveExistingEntry(title_id); |
| 592 | 596 | ||
| 593 | // Install Metadata File | 597 | // Install Metadata File |
| 594 | const auto res = RawInstallNCA(**meta_iter, copy, overwrite_if_exists, meta_id); | 598 | const auto res = RawInstallNCA(**meta_iter, copy, overwrite_if_exists, meta_id_data); |
| 595 | if (res != InstallResult::Success) { | 599 | if (res != InstallResult::Success) { |
| 596 | return res; | 600 | return res; |
| 597 | } | 601 | } |
| @@ -741,15 +745,15 @@ InstallResult RegisteredCache::RawInstallNCA(const NCA& nca, const VfsCopyFuncti | |||
| 741 | 745 | ||
| 742 | bool RegisteredCache::RawInstallYuzuMeta(const CNMT& cnmt) { | 746 | bool RegisteredCache::RawInstallYuzuMeta(const CNMT& cnmt) { |
| 743 | // Reasoning behind this method can be found in the comment for InstallEntry, NCA overload. | 747 | // Reasoning behind this method can be found in the comment for InstallEntry, NCA overload. |
| 744 | const auto dir = this->dir->CreateDirectoryRelative("yuzu_meta"); | 748 | const auto meta_dir = dir->CreateDirectoryRelative("yuzu_meta"); |
| 745 | const auto filename = GetCNMTName(cnmt.GetType(), cnmt.GetTitleID()); | 749 | const auto filename = GetCNMTName(cnmt.GetType(), cnmt.GetTitleID()); |
| 746 | if (dir->GetFile(filename) == nullptr) { | 750 | if (meta_dir->GetFile(filename) == nullptr) { |
| 747 | auto out = dir->CreateFile(filename); | 751 | auto out = meta_dir->CreateFile(filename); |
| 748 | const auto buffer = cnmt.Serialize(); | 752 | const auto buffer = cnmt.Serialize(); |
| 749 | out->Resize(buffer.size()); | 753 | out->Resize(buffer.size()); |
| 750 | out->WriteBytes(buffer); | 754 | out->WriteBytes(buffer); |
| 751 | } else { | 755 | } else { |
| 752 | auto out = dir->GetFile(filename); | 756 | auto out = meta_dir->GetFile(filename); |
| 753 | CNMT old_cnmt(out); | 757 | CNMT old_cnmt(out); |
| 754 | // Returns true on change | 758 | // Returns true on change |
| 755 | if (old_cnmt.UnionRecords(cnmt)) { | 759 | if (old_cnmt.UnionRecords(cnmt)) { |
diff --git a/src/core/file_sys/registered_cache.h b/src/core/file_sys/registered_cache.h index b08a1687a..b31630014 100644 --- a/src/core/file_sys/registered_cache.h +++ b/src/core/file_sys/registered_cache.h | |||
| @@ -182,7 +182,7 @@ private: | |||
| 182 | void AccumulateYuzuMeta(); | 182 | void AccumulateYuzuMeta(); |
| 183 | std::optional<NcaID> GetNcaIDFromMetadata(u64 title_id, ContentRecordType type) const; | 183 | std::optional<NcaID> GetNcaIDFromMetadata(u64 title_id, ContentRecordType type) const; |
| 184 | VirtualFile GetFileAtID(NcaID id) const; | 184 | VirtualFile GetFileAtID(NcaID id) const; |
| 185 | VirtualFile OpenFileOrDirectoryConcat(const VirtualDir& dir, std::string_view path) const; | 185 | VirtualFile OpenFileOrDirectoryConcat(const VirtualDir& open_dir, std::string_view path) const; |
| 186 | InstallResult RawInstallNCA(const NCA& nca, const VfsCopyFunction& copy, | 186 | InstallResult RawInstallNCA(const NCA& nca, const VfsCopyFunction& copy, |
| 187 | bool overwrite_if_exists, std::optional<NcaID> override_id = {}); | 187 | bool overwrite_if_exists, std::optional<NcaID> override_id = {}); |
| 188 | bool RawInstallYuzuMeta(const CNMT& cnmt); | 188 | bool RawInstallYuzuMeta(const CNMT& cnmt); |
diff --git a/src/core/file_sys/romfs_factory.cpp b/src/core/file_sys/romfs_factory.cpp index f4e16e4be..de6ab721d 100644 --- a/src/core/file_sys/romfs_factory.cpp +++ b/src/core/file_sys/romfs_factory.cpp | |||
| @@ -33,8 +33,8 @@ RomFSFactory::RomFSFactory(Loader::AppLoader& app_loader, ContentProvider& provi | |||
| 33 | 33 | ||
| 34 | RomFSFactory::~RomFSFactory() = default; | 34 | RomFSFactory::~RomFSFactory() = default; |
| 35 | 35 | ||
| 36 | void RomFSFactory::SetPackedUpdate(VirtualFile update_raw) { | 36 | void RomFSFactory::SetPackedUpdate(VirtualFile update_raw_file) { |
| 37 | this->update_raw = std::move(update_raw); | 37 | update_raw = std::move(update_raw_file); |
| 38 | } | 38 | } |
| 39 | 39 | ||
| 40 | ResultVal<VirtualFile> RomFSFactory::OpenCurrentProcess(u64 current_process_title_id) const { | 40 | ResultVal<VirtualFile> RomFSFactory::OpenCurrentProcess(u64 current_process_title_id) const { |
diff --git a/src/core/file_sys/romfs_factory.h b/src/core/file_sys/romfs_factory.h index 96dd0d578..39db09e4e 100644 --- a/src/core/file_sys/romfs_factory.h +++ b/src/core/file_sys/romfs_factory.h | |||
| @@ -40,7 +40,7 @@ public: | |||
| 40 | Service::FileSystem::FileSystemController& controller); | 40 | Service::FileSystem::FileSystemController& controller); |
| 41 | ~RomFSFactory(); | 41 | ~RomFSFactory(); |
| 42 | 42 | ||
| 43 | void SetPackedUpdate(VirtualFile update_raw); | 43 | void SetPackedUpdate(VirtualFile update_raw_file); |
| 44 | [[nodiscard]] ResultVal<VirtualFile> OpenCurrentProcess(u64 current_process_title_id) const; | 44 | [[nodiscard]] ResultVal<VirtualFile> OpenCurrentProcess(u64 current_process_title_id) const; |
| 45 | [[nodiscard]] ResultVal<VirtualFile> OpenPatchedRomFS(u64 title_id, | 45 | [[nodiscard]] ResultVal<VirtualFile> OpenPatchedRomFS(u64 title_id, |
| 46 | ContentRecordType type) const; | 46 | ContentRecordType type) const; |
diff --git a/src/core/file_sys/savedata_factory.cpp b/src/core/file_sys/savedata_factory.cpp index b7bfe0928..fa68af3a8 100644 --- a/src/core/file_sys/savedata_factory.cpp +++ b/src/core/file_sys/savedata_factory.cpp | |||
| @@ -170,26 +170,30 @@ std::string SaveDataFactory::GetFullPath(Core::System& system, SaveDataSpaceId s | |||
| 170 | SaveDataSize SaveDataFactory::ReadSaveDataSize(SaveDataType type, u64 title_id, | 170 | SaveDataSize SaveDataFactory::ReadSaveDataSize(SaveDataType type, u64 title_id, |
| 171 | u128 user_id) const { | 171 | u128 user_id) const { |
| 172 | const auto path = GetFullPath(system, SaveDataSpaceId::NandUser, type, title_id, user_id, 0); | 172 | const auto path = GetFullPath(system, SaveDataSpaceId::NandUser, type, title_id, user_id, 0); |
| 173 | const auto dir = GetOrCreateDirectoryRelative(this->dir, path); | 173 | const auto relative_dir = GetOrCreateDirectoryRelative(dir, path); |
| 174 | 174 | ||
| 175 | const auto size_file = dir->GetFile(SAVE_DATA_SIZE_FILENAME); | 175 | const auto size_file = relative_dir->GetFile(SAVE_DATA_SIZE_FILENAME); |
| 176 | if (size_file == nullptr || size_file->GetSize() < sizeof(SaveDataSize)) | 176 | if (size_file == nullptr || size_file->GetSize() < sizeof(SaveDataSize)) { |
| 177 | return {0, 0}; | 177 | return {0, 0}; |
| 178 | } | ||
| 178 | 179 | ||
| 179 | SaveDataSize out; | 180 | SaveDataSize out; |
| 180 | if (size_file->ReadObject(&out) != sizeof(SaveDataSize)) | 181 | if (size_file->ReadObject(&out) != sizeof(SaveDataSize)) { |
| 181 | return {0, 0}; | 182 | return {0, 0}; |
| 183 | } | ||
| 184 | |||
| 182 | return out; | 185 | return out; |
| 183 | } | 186 | } |
| 184 | 187 | ||
| 185 | void SaveDataFactory::WriteSaveDataSize(SaveDataType type, u64 title_id, u128 user_id, | 188 | void SaveDataFactory::WriteSaveDataSize(SaveDataType type, u64 title_id, u128 user_id, |
| 186 | SaveDataSize new_value) const { | 189 | SaveDataSize new_value) const { |
| 187 | const auto path = GetFullPath(system, SaveDataSpaceId::NandUser, type, title_id, user_id, 0); | 190 | const auto path = GetFullPath(system, SaveDataSpaceId::NandUser, type, title_id, user_id, 0); |
| 188 | const auto dir = GetOrCreateDirectoryRelative(this->dir, path); | 191 | const auto relative_dir = GetOrCreateDirectoryRelative(dir, path); |
| 189 | 192 | ||
| 190 | const auto size_file = dir->CreateFile(SAVE_DATA_SIZE_FILENAME); | 193 | const auto size_file = relative_dir->CreateFile(SAVE_DATA_SIZE_FILENAME); |
| 191 | if (size_file == nullptr) | 194 | if (size_file == nullptr) { |
| 192 | return; | 195 | return; |
| 196 | } | ||
| 193 | 197 | ||
| 194 | size_file->Resize(sizeof(SaveDataSize)); | 198 | size_file->Resize(sizeof(SaveDataSize)); |
| 195 | size_file->WriteObject(new_value); | 199 | size_file->WriteObject(new_value); |
diff --git a/src/core/file_sys/submission_package.cpp b/src/core/file_sys/submission_package.cpp index c05735ddd..80e560970 100644 --- a/src/core/file_sys/submission_package.cpp +++ b/src/core/file_sys/submission_package.cpp | |||
| @@ -232,15 +232,15 @@ void NSP::SetTicketKeys(const std::vector<VirtualFile>& files) { | |||
| 232 | void NSP::InitializeExeFSAndRomFS(const std::vector<VirtualFile>& files) { | 232 | void NSP::InitializeExeFSAndRomFS(const std::vector<VirtualFile>& files) { |
| 233 | exefs = pfs; | 233 | exefs = pfs; |
| 234 | 234 | ||
| 235 | const auto romfs_iter = std::find_if(files.begin(), files.end(), [](const VirtualFile& file) { | 235 | const auto iter = std::find_if(files.begin(), files.end(), [](const VirtualFile& entry) { |
| 236 | return file->GetName().rfind(".romfs") != std::string::npos; | 236 | return entry->GetName().rfind(".romfs") != std::string::npos; |
| 237 | }); | 237 | }); |
| 238 | 238 | ||
| 239 | if (romfs_iter == files.end()) { | 239 | if (iter == files.end()) { |
| 240 | return; | 240 | return; |
| 241 | } | 241 | } |
| 242 | 242 | ||
| 243 | romfs = *romfs_iter; | 243 | romfs = *iter; |
| 244 | } | 244 | } |
| 245 | 245 | ||
| 246 | void NSP::ReadNCAs(const std::vector<VirtualFile>& files) { | 246 | void NSP::ReadNCAs(const std::vector<VirtualFile>& files) { |
diff --git a/src/core/file_sys/vfs_concat.cpp b/src/core/file_sys/vfs_concat.cpp index 3c5a7d87a..619081502 100644 --- a/src/core/file_sys/vfs_concat.cpp +++ b/src/core/file_sys/vfs_concat.cpp | |||
| @@ -136,7 +136,7 @@ std::size_t ConcatenatedVfsFile::Write(const u8* data, std::size_t length, std:: | |||
| 136 | return 0; | 136 | return 0; |
| 137 | } | 137 | } |
| 138 | 138 | ||
| 139 | bool ConcatenatedVfsFile::Rename(std::string_view name) { | 139 | bool ConcatenatedVfsFile::Rename(std::string_view new_name) { |
| 140 | return false; | 140 | return false; |
| 141 | } | 141 | } |
| 142 | 142 | ||
diff --git a/src/core/file_sys/vfs_concat.h b/src/core/file_sys/vfs_concat.h index 287c72555..3397d32cd 100644 --- a/src/core/file_sys/vfs_concat.h +++ b/src/core/file_sys/vfs_concat.h | |||
| @@ -36,7 +36,7 @@ public: | |||
| 36 | bool IsReadable() const override; | 36 | bool IsReadable() const override; |
| 37 | std::size_t Read(u8* data, std::size_t length, std::size_t offset) const override; | 37 | std::size_t Read(u8* data, std::size_t length, std::size_t offset) const override; |
| 38 | std::size_t Write(const u8* data, std::size_t length, std::size_t offset) override; | 38 | std::size_t Write(const u8* data, std::size_t length, std::size_t offset) override; |
| 39 | bool Rename(std::string_view name) override; | 39 | bool Rename(std::string_view new_name) override; |
| 40 | 40 | ||
| 41 | private: | 41 | private: |
| 42 | // Maps starting offset to file -- more efficient. | 42 | // Maps starting offset to file -- more efficient. |
diff --git a/src/core/file_sys/vfs_layered.cpp b/src/core/file_sys/vfs_layered.cpp index 434b03cec..192740058 100644 --- a/src/core/file_sys/vfs_layered.cpp +++ b/src/core/file_sys/vfs_layered.cpp | |||
| @@ -45,12 +45,12 @@ VirtualDir LayeredVfsDirectory::GetDirectoryRelative(std::string_view path) cons | |||
| 45 | return MakeLayeredDirectory(std::move(out)); | 45 | return MakeLayeredDirectory(std::move(out)); |
| 46 | } | 46 | } |
| 47 | 47 | ||
| 48 | VirtualFile LayeredVfsDirectory::GetFile(std::string_view name) const { | 48 | VirtualFile LayeredVfsDirectory::GetFile(std::string_view file_name) const { |
| 49 | return GetFileRelative(name); | 49 | return GetFileRelative(file_name); |
| 50 | } | 50 | } |
| 51 | 51 | ||
| 52 | VirtualDir LayeredVfsDirectory::GetSubdirectory(std::string_view name) const { | 52 | VirtualDir LayeredVfsDirectory::GetSubdirectory(std::string_view subdir_name) const { |
| 53 | return GetDirectoryRelative(name); | 53 | return GetDirectoryRelative(subdir_name); |
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | std::string LayeredVfsDirectory::GetFullPath() const { | 56 | std::string LayeredVfsDirectory::GetFullPath() const { |
| @@ -105,24 +105,24 @@ VirtualDir LayeredVfsDirectory::GetParentDirectory() const { | |||
| 105 | return dirs[0]->GetParentDirectory(); | 105 | return dirs[0]->GetParentDirectory(); |
| 106 | } | 106 | } |
| 107 | 107 | ||
| 108 | VirtualDir LayeredVfsDirectory::CreateSubdirectory(std::string_view name) { | 108 | VirtualDir LayeredVfsDirectory::CreateSubdirectory(std::string_view subdir_name) { |
| 109 | return nullptr; | 109 | return nullptr; |
| 110 | } | 110 | } |
| 111 | 111 | ||
| 112 | VirtualFile LayeredVfsDirectory::CreateFile(std::string_view name) { | 112 | VirtualFile LayeredVfsDirectory::CreateFile(std::string_view file_name) { |
| 113 | return nullptr; | 113 | return nullptr; |
| 114 | } | 114 | } |
| 115 | 115 | ||
| 116 | bool LayeredVfsDirectory::DeleteSubdirectory(std::string_view name) { | 116 | bool LayeredVfsDirectory::DeleteSubdirectory(std::string_view subdir_name) { |
| 117 | return false; | 117 | return false; |
| 118 | } | 118 | } |
| 119 | 119 | ||
| 120 | bool LayeredVfsDirectory::DeleteFile(std::string_view name) { | 120 | bool LayeredVfsDirectory::DeleteFile(std::string_view file_name) { |
| 121 | return false; | 121 | return false; |
| 122 | } | 122 | } |
| 123 | 123 | ||
| 124 | bool LayeredVfsDirectory::Rename(std::string_view name_) { | 124 | bool LayeredVfsDirectory::Rename(std::string_view new_name) { |
| 125 | name = name_; | 125 | name = new_name; |
| 126 | return true; | 126 | return true; |
| 127 | } | 127 | } |
| 128 | 128 | ||
diff --git a/src/core/file_sys/vfs_layered.h b/src/core/file_sys/vfs_layered.h index 6d7513ac6..cb4b32e91 100644 --- a/src/core/file_sys/vfs_layered.h +++ b/src/core/file_sys/vfs_layered.h | |||
| @@ -23,8 +23,8 @@ public: | |||
| 23 | 23 | ||
| 24 | VirtualFile GetFileRelative(std::string_view path) const override; | 24 | VirtualFile GetFileRelative(std::string_view path) const override; |
| 25 | VirtualDir GetDirectoryRelative(std::string_view path) const override; | 25 | VirtualDir GetDirectoryRelative(std::string_view path) const override; |
| 26 | VirtualFile GetFile(std::string_view name) const override; | 26 | VirtualFile GetFile(std::string_view file_name) const override; |
| 27 | VirtualDir GetSubdirectory(std::string_view name) const override; | 27 | VirtualDir GetSubdirectory(std::string_view subdir_name) const override; |
| 28 | std::string GetFullPath() const override; | 28 | std::string GetFullPath() const override; |
| 29 | 29 | ||
| 30 | std::vector<VirtualFile> GetFiles() const override; | 30 | std::vector<VirtualFile> GetFiles() const override; |
| @@ -33,11 +33,11 @@ public: | |||
| 33 | bool IsReadable() const override; | 33 | bool IsReadable() const override; |
| 34 | std::string GetName() const override; | 34 | std::string GetName() const override; |
| 35 | VirtualDir GetParentDirectory() const override; | 35 | VirtualDir GetParentDirectory() const override; |
| 36 | VirtualDir CreateSubdirectory(std::string_view name) override; | 36 | VirtualDir CreateSubdirectory(std::string_view subdir_name) override; |
| 37 | VirtualFile CreateFile(std::string_view name) override; | 37 | VirtualFile CreateFile(std::string_view file_name) override; |
| 38 | bool DeleteSubdirectory(std::string_view name) override; | 38 | bool DeleteSubdirectory(std::string_view subdir_name) override; |
| 39 | bool DeleteFile(std::string_view name) override; | 39 | bool DeleteFile(std::string_view file_name) override; |
| 40 | bool Rename(std::string_view name) override; | 40 | bool Rename(std::string_view new_name) override; |
| 41 | 41 | ||
| 42 | private: | 42 | private: |
| 43 | std::vector<VirtualDir> dirs; | 43 | std::vector<VirtualDir> dirs; |
diff --git a/src/core/file_sys/vfs_offset.cpp b/src/core/file_sys/vfs_offset.cpp index 056737b54..870ed1cf8 100644 --- a/src/core/file_sys/vfs_offset.cpp +++ b/src/core/file_sys/vfs_offset.cpp | |||
| @@ -84,8 +84,8 @@ std::size_t OffsetVfsFile::WriteBytes(const std::vector<u8>& data, std::size_t r | |||
| 84 | return file->Write(data.data(), TrimToFit(data.size(), r_offset), offset + r_offset); | 84 | return file->Write(data.data(), TrimToFit(data.size(), r_offset), offset + r_offset); |
| 85 | } | 85 | } |
| 86 | 86 | ||
| 87 | bool OffsetVfsFile::Rename(std::string_view name) { | 87 | bool OffsetVfsFile::Rename(std::string_view new_name) { |
| 88 | return file->Rename(name); | 88 | return file->Rename(new_name); |
| 89 | } | 89 | } |
| 90 | 90 | ||
| 91 | std::size_t OffsetVfsFile::GetOffset() const { | 91 | std::size_t OffsetVfsFile::GetOffset() const { |
diff --git a/src/core/file_sys/vfs_offset.h b/src/core/file_sys/vfs_offset.h index b2ccc5c7b..42f78b3d9 100644 --- a/src/core/file_sys/vfs_offset.h +++ b/src/core/file_sys/vfs_offset.h | |||
| @@ -35,7 +35,7 @@ public: | |||
| 35 | bool WriteByte(u8 data, std::size_t offset) override; | 35 | bool WriteByte(u8 data, std::size_t offset) override; |
| 36 | std::size_t WriteBytes(const std::vector<u8>& data, std::size_t offset) override; | 36 | std::size_t WriteBytes(const std::vector<u8>& data, std::size_t offset) override; |
| 37 | 37 | ||
| 38 | bool Rename(std::string_view name) override; | 38 | bool Rename(std::string_view new_name) override; |
| 39 | 39 | ||
| 40 | std::size_t GetOffset() const; | 40 | std::size_t GetOffset() const; |
| 41 | 41 | ||
diff --git a/src/core/file_sys/vfs_real.cpp b/src/core/file_sys/vfs_real.cpp index a44ce6288..3d89dd644 100644 --- a/src/core/file_sys/vfs_real.cpp +++ b/src/core/file_sys/vfs_real.cpp | |||
| @@ -358,16 +358,16 @@ RealVfsDirectory::RealVfsDirectory(RealVfsFilesystem& base_, const std::string& | |||
| 358 | 358 | ||
| 359 | RealVfsDirectory::~RealVfsDirectory() = default; | 359 | RealVfsDirectory::~RealVfsDirectory() = default; |
| 360 | 360 | ||
| 361 | VirtualFile RealVfsDirectory::GetFileRelative(std::string_view path) const { | 361 | VirtualFile RealVfsDirectory::GetFileRelative(std::string_view relative_path) const { |
| 362 | const auto full_path = FS::SanitizePath(this->path + DIR_SEP + std::string(path)); | 362 | const auto full_path = FS::SanitizePath(path + DIR_SEP + std::string(relative_path)); |
| 363 | if (!FS::Exists(full_path) || FS::IsDirectory(full_path)) { | 363 | if (!FS::Exists(full_path) || FS::IsDirectory(full_path)) { |
| 364 | return nullptr; | 364 | return nullptr; |
| 365 | } | 365 | } |
| 366 | return base.OpenFile(full_path, perms); | 366 | return base.OpenFile(full_path, perms); |
| 367 | } | 367 | } |
| 368 | 368 | ||
| 369 | VirtualDir RealVfsDirectory::GetDirectoryRelative(std::string_view path) const { | 369 | VirtualDir RealVfsDirectory::GetDirectoryRelative(std::string_view relative_path) const { |
| 370 | const auto full_path = FS::SanitizePath(this->path + DIR_SEP + std::string(path)); | 370 | const auto full_path = FS::SanitizePath(path + DIR_SEP + std::string(relative_path)); |
| 371 | if (!FS::Exists(full_path) || !FS::IsDirectory(full_path)) { | 371 | if (!FS::Exists(full_path) || !FS::IsDirectory(full_path)) { |
| 372 | return nullptr; | 372 | return nullptr; |
| 373 | } | 373 | } |
| @@ -382,13 +382,13 @@ VirtualDir RealVfsDirectory::GetSubdirectory(std::string_view name) const { | |||
| 382 | return GetDirectoryRelative(name); | 382 | return GetDirectoryRelative(name); |
| 383 | } | 383 | } |
| 384 | 384 | ||
| 385 | VirtualFile RealVfsDirectory::CreateFileRelative(std::string_view path) { | 385 | VirtualFile RealVfsDirectory::CreateFileRelative(std::string_view relative_path) { |
| 386 | const auto full_path = FS::SanitizePath(this->path + DIR_SEP + std::string(path)); | 386 | const auto full_path = FS::SanitizePath(path + DIR_SEP + std::string(relative_path)); |
| 387 | return base.CreateFile(full_path, perms); | 387 | return base.CreateFile(full_path, perms); |
| 388 | } | 388 | } |
| 389 | 389 | ||
| 390 | VirtualDir RealVfsDirectory::CreateDirectoryRelative(std::string_view path) { | 390 | VirtualDir RealVfsDirectory::CreateDirectoryRelative(std::string_view relative_path) { |
| 391 | const auto full_path = FS::SanitizePath(this->path + DIR_SEP + std::string(path)); | 391 | const auto full_path = FS::SanitizePath(path + DIR_SEP + std::string(relative_path)); |
| 392 | return base.CreateDirectory(full_path, perms); | 392 | return base.CreateDirectory(full_path, perms); |
| 393 | } | 393 | } |
| 394 | 394 | ||
diff --git a/src/core/file_sys/vfs_real.h b/src/core/file_sys/vfs_real.h index 23e99865e..0666f2679 100644 --- a/src/core/file_sys/vfs_real.h +++ b/src/core/file_sys/vfs_real.h | |||
| @@ -79,12 +79,12 @@ class RealVfsDirectory : public VfsDirectory { | |||
| 79 | public: | 79 | public: |
| 80 | ~RealVfsDirectory() override; | 80 | ~RealVfsDirectory() override; |
| 81 | 81 | ||
| 82 | VirtualFile GetFileRelative(std::string_view path) const override; | 82 | VirtualFile GetFileRelative(std::string_view relative_path) const override; |
| 83 | VirtualDir GetDirectoryRelative(std::string_view path) const override; | 83 | VirtualDir GetDirectoryRelative(std::string_view relative_path) const override; |
| 84 | VirtualFile GetFile(std::string_view name) const override; | 84 | VirtualFile GetFile(std::string_view name) const override; |
| 85 | VirtualDir GetSubdirectory(std::string_view name) const override; | 85 | VirtualDir GetSubdirectory(std::string_view name) const override; |
| 86 | VirtualFile CreateFileRelative(std::string_view path) override; | 86 | VirtualFile CreateFileRelative(std::string_view relative_path) override; |
| 87 | VirtualDir CreateDirectoryRelative(std::string_view path) override; | 87 | VirtualDir CreateDirectoryRelative(std::string_view relative_path) override; |
| 88 | bool DeleteSubdirectoryRecursive(std::string_view name) override; | 88 | bool DeleteSubdirectoryRecursive(std::string_view name) override; |
| 89 | std::vector<VirtualFile> GetFiles() const override; | 89 | std::vector<VirtualFile> GetFiles() const override; |
| 90 | std::vector<VirtualDir> GetSubdirectories() const override; | 90 | std::vector<VirtualDir> GetSubdirectories() const override; |
diff --git a/src/core/file_sys/vfs_vector.cpp b/src/core/file_sys/vfs_vector.cpp index c1ec1e645..1a3f06227 100644 --- a/src/core/file_sys/vfs_vector.cpp +++ b/src/core/file_sys/vfs_vector.cpp | |||
| @@ -103,12 +103,12 @@ static bool FindAndRemoveVectorElement(std::vector<T>& vec, std::string_view nam | |||
| 103 | return true; | 103 | return true; |
| 104 | } | 104 | } |
| 105 | 105 | ||
| 106 | bool VectorVfsDirectory::DeleteSubdirectory(std::string_view name) { | 106 | bool VectorVfsDirectory::DeleteSubdirectory(std::string_view subdir_name) { |
| 107 | return FindAndRemoveVectorElement(dirs, name); | 107 | return FindAndRemoveVectorElement(dirs, subdir_name); |
| 108 | } | 108 | } |
| 109 | 109 | ||
| 110 | bool VectorVfsDirectory::DeleteFile(std::string_view name) { | 110 | bool VectorVfsDirectory::DeleteFile(std::string_view file_name) { |
| 111 | return FindAndRemoveVectorElement(files, name); | 111 | return FindAndRemoveVectorElement(files, file_name); |
| 112 | } | 112 | } |
| 113 | 113 | ||
| 114 | bool VectorVfsDirectory::Rename(std::string_view name_) { | 114 | bool VectorVfsDirectory::Rename(std::string_view name_) { |
| @@ -116,11 +116,11 @@ bool VectorVfsDirectory::Rename(std::string_view name_) { | |||
| 116 | return true; | 116 | return true; |
| 117 | } | 117 | } |
| 118 | 118 | ||
| 119 | VirtualDir VectorVfsDirectory::CreateSubdirectory(std::string_view name) { | 119 | VirtualDir VectorVfsDirectory::CreateSubdirectory(std::string_view subdir_name) { |
| 120 | return nullptr; | 120 | return nullptr; |
| 121 | } | 121 | } |
| 122 | 122 | ||
| 123 | VirtualFile VectorVfsDirectory::CreateFile(std::string_view name) { | 123 | VirtualFile VectorVfsDirectory::CreateFile(std::string_view file_name) { |
| 124 | return nullptr; | 124 | return nullptr; |
| 125 | } | 125 | } |
| 126 | 126 | ||
diff --git a/src/core/file_sys/vfs_vector.h b/src/core/file_sys/vfs_vector.h index 2aff9ca34..c10c527b6 100644 --- a/src/core/file_sys/vfs_vector.h +++ b/src/core/file_sys/vfs_vector.h | |||
| @@ -112,11 +112,11 @@ public: | |||
| 112 | bool IsReadable() const override; | 112 | bool IsReadable() const override; |
| 113 | std::string GetName() const override; | 113 | std::string GetName() const override; |
| 114 | VirtualDir GetParentDirectory() const override; | 114 | VirtualDir GetParentDirectory() const override; |
| 115 | bool DeleteSubdirectory(std::string_view name) override; | 115 | bool DeleteSubdirectory(std::string_view subdir_name) override; |
| 116 | bool DeleteFile(std::string_view name) override; | 116 | bool DeleteFile(std::string_view file_name) override; |
| 117 | bool Rename(std::string_view name) override; | 117 | bool Rename(std::string_view name) override; |
| 118 | VirtualDir CreateSubdirectory(std::string_view name) override; | 118 | VirtualDir CreateSubdirectory(std::string_view subdir_name) override; |
| 119 | VirtualFile CreateFile(std::string_view name) override; | 119 | VirtualFile CreateFile(std::string_view file_name) override; |
| 120 | 120 | ||
| 121 | virtual void AddFile(VirtualFile file); | 121 | virtual void AddFile(VirtualFile file); |
| 122 | virtual void AddDirectory(VirtualDir dir); | 122 | virtual void AddDirectory(VirtualDir dir); |