VERY experimental Nintendo Switch 2 emulator
C++
file_sys: Resolve cases of variable shadowing
Lioncashab38371888c9
diff --git a/src/core/file_sys/card_image.cpp b/src/core/file_sys/card_image.cppindex 8dee5590b5..db2f6a9552 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 {u32 XCI::GetSystemUpdateVersion() {const auto update = GetPartition(XCIPartition::Update);- if (update == nullptr)+ if (update == nullptr) {return 0;+ }- for (const auto& file : update->GetFiles()) {- NCA nca{file, nullptr, 0};+ for (const auto& update_file : update->GetFiles()) {+ NCA nca{update_file, nullptr, 0};- if (nca.GetStatus() != Loader::ResultStatus::Success)+ if (nca.GetStatus() != Loader::ResultStatus::Success) {continue;+ }if (nca.GetType() == NCAContentType::Meta && nca.GetTitleId() == 0x0100000000000816) {const auto dir = nca.GetSubdirectories()[0];const auto cnmt = dir->GetFile("SystemUpdate_0100000000000816.cnmt");- if (cnmt == nullptr)+ if (cnmt == nullptr) {continue;+ }CNMT cnmt_data{cnmt};const auto metas = cnmt_data.GetMetaRecords();- if (metas.empty())+ if (metas.empty()) {continue;+ }return metas[0].title_version;}@@ -262,8 +266,8 @@ VirtualDir XCI::ConcatenatedPseudoDirectory() {if (part == nullptr)continue;- for (const auto& file : part->GetFiles())- out->AddFile(file);+ for (const auto& part_file : part->GetFiles())+ out->AddFile(part_file);}return out;@@ -283,12 +287,12 @@ Loader::ResultStatus XCI::AddNCAFromPartition(XCIPartition part) {return Loader::ResultStatus::ErrorXCIMissingPartition;}- for (const VirtualFile& file : partition->GetFiles()) {- if (file->GetExtension() != "nca") {+ for (const VirtualFile& partition_file : partition->GetFiles()) {+ if (partition_file->GetExtension() != "nca") {continue;}- auto nca = std::make_shared<NCA>(file, nullptr, 0);+ auto nca = std::make_shared<NCA>(partition_file, nullptr, 0);if (nca->IsUpdate()) {continue;}diff --git a/src/core/file_sys/content_archive.cpp b/src/core/file_sys/content_archive.cppindex d12218fc2f..24eff210f1 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_offreturn;}- 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));diff --git a/src/core/file_sys/fsmitm_romfsbuild.cpp b/src/core/file_sys/fsmitm_romfsbuild.cppindex c52fafb6f6..1ca1d536f7 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) {return count;}-void RomFSBuildContext::VisitDirectory(VirtualDir root_romfs, VirtualDir ext,+void RomFSBuildContext::VisitDirectory(VirtualDir root_romfs, VirtualDir ext_dir,std::shared_ptr<RomFSBuildDirectoryContext> parent) {std::vector<std::shared_ptr<RomFSBuildDirectoryContext>> child_dirs;VirtualDir dir;- if (parent->path_len == 0)+ if (parent->path_len == 0) {dir = root_romfs;- else+ } else {dir = root_romfs->GetDirectoryRelative(parent->path);+ }const auto entries = dir->GetEntries();@@ -147,8 +148,9 @@ void RomFSBuildContext::VisitDirectory(VirtualDir root_romfs, VirtualDir ext,child->path_len = child->cur_path_ofs + static_cast<u32>(kv.first.size());child->path = parent->path + "/" + kv.first;- if (ext != nullptr && ext->GetFileRelative(child->path + ".stub") != nullptr)+ if (ext_dir != nullptr && ext_dir->GetFileRelative(child->path + ".stub") != nullptr) {continue;+ }// Sanity check on path_lenASSERT(child->path_len < FS_MAX_PATH);@@ -163,21 +165,20 @@ void RomFSBuildContext::VisitDirectory(VirtualDir root_romfs, VirtualDir ext,child->path_len = child->cur_path_ofs + static_cast<u32>(kv.first.size());child->path = parent->path + "/" + kv.first;- if (ext != nullptr && ext->GetFileRelative(child->path + ".stub") != nullptr)+ if (ext_dir != nullptr && ext_dir->GetFileRelative(child->path + ".stub") != nullptr) {continue;+ }// Sanity check on path_lenASSERT(child->path_len < FS_MAX_PATH);child->source = root_romfs->GetFileRelative(child->path);- if (ext != nullptr) {- const auto ips = ext->GetFileRelative(child->path + ".ips");-- if (ips != nullptr) {- auto patched = PatchIPS(child->source, ips);- if (patched != nullptr)+ if (ext_dir != nullptr) {+ if (const auto ips = ext_dir->GetFileRelative(child->path + ".ips")) {+ if (auto patched = PatchIPS(child->source, ips)) {child->source = std::move(patched);+ }}}@@ -188,7 +189,7 @@ void RomFSBuildContext::VisitDirectory(VirtualDir root_romfs, VirtualDir ext,}for (auto& child : child_dirs) {- this->VisitDirectory(root_romfs, ext, child);+ this->VisitDirectory(root_romfs, ext_dir, child);}}diff --git a/src/core/file_sys/fsmitm_romfsbuild.h b/src/core/file_sys/fsmitm_romfsbuild.hindex 049de180b5..8d4d89fab9 100644--- a/src/core/file_sys/fsmitm_romfsbuild.h+++ b/src/core/file_sys/fsmitm_romfsbuild.h@@ -59,7 +59,7 @@ private:u64 file_hash_table_size = 0;u64 file_partition_size = 0;- void VisitDirectory(VirtualDir filesys, VirtualDir ext,+ void VisitDirectory(VirtualDir filesys, VirtualDir ext_dir,std::shared_ptr<RomFSBuildDirectoryContext> parent);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.cppindex a65ec67987..b36827b757 100644--- a/src/core/file_sys/nca_patch.cpp+++ b/src/core/file_sys/nca_patch.cpp@@ -83,11 +83,14 @@ BKTR::~BKTR() = default;std::size_t BKTR::Read(u8* data, std::size_t length, std::size_t offset) const {// Read out of bounds.- if (offset >= relocation.size)+ if (offset >= relocation.size) {return 0;- const auto relocation = GetRelocationEntry(offset);- const auto section_offset = offset - relocation.address_patch + relocation.address_source;- const auto bktr_read = relocation.from_patch;+ }++ const auto relocation_entry = GetRelocationEntry(offset);+ const auto section_offset =+ offset - relocation_entry.address_patch + relocation_entry.address_source;+ const auto bktr_read = relocation_entry.from_patch;const auto next_relocation = GetNextRelocationEntry(offset);@@ -106,15 +109,16 @@ std::size_t BKTR::Read(u8* data, std::size_t length, std::size_t offset) const {return bktr_romfs->Read(data, length, section_offset);}- const auto subsection = GetSubsectionEntry(section_offset);+ const auto subsection_entry = GetSubsectionEntry(section_offset);Core::Crypto::AESCipher<Core::Crypto::Key128> cipher(key, Core::Crypto::Mode::CTR);// Calculate AES IVstd::array<u8, 16> iv{};- auto subsection_ctr = subsection.ctr;+ auto subsection_ctr = subsection_entry.ctr;auto offset_iv = section_offset + base_offset;- for (std::size_t i = 0; i < section_ctr.size(); ++i)+ for (std::size_t i = 0; i < section_ctr.size(); ++i) {iv[i] = section_ctr[0x8 - i - 1];+ }offset_iv >>= 4;for (std::size_t i = 0; i < sizeof(u64); ++i) {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.cppindex 431302f559..1fb66874e4 100644--- a/src/core/file_sys/registered_cache.cpp+++ b/src/core/file_sys/registered_cache.cpp@@ -281,14 +281,14 @@ NcaID PlaceholderCache::Generate() {return out;}-VirtualFile RegisteredCache::OpenFileOrDirectoryConcat(const VirtualDir& dir,+VirtualFile RegisteredCache::OpenFileOrDirectoryConcat(const VirtualDir& open_dir,std::string_view path) const {- const auto file = dir->GetFileRelative(path);+ const auto file = open_dir->GetFileRelative(path);if (file != nullptr) {return file;}- const auto nca_dir = dir->GetDirectoryRelative(path);+ const auto nca_dir = open_dir->GetDirectoryRelative(path);if (nca_dir == nullptr) {return nullptr;}@@ -431,13 +431,15 @@ void RegisteredCache::ProcessFiles(const std::vector<NcaID>& ids) {}void RegisteredCache::AccumulateYuzuMeta() {- const auto dir = this->dir->GetSubdirectory("yuzu_meta");- if (dir == nullptr)+ const auto meta_dir = dir->GetSubdirectory("yuzu_meta");+ if (meta_dir == nullptr) {return;+ }- for (const auto& file : dir->GetFiles()) {- if (file->GetExtension() != "cnmt")+ for (const auto& file : meta_dir->GetFiles()) {+ if (file->GetExtension() != "cnmt") {continue;+ }CNMT cnmt(file);yuzu_meta.insert_or_assign(cnmt.GetTitleID(), std::move(cnmt));@@ -445,8 +447,10 @@ void RegisteredCache::AccumulateYuzuMeta() {}void RegisteredCache::Refresh() {- if (dir == nullptr)+ if (dir == nullptr) {return;+ }+const auto ids = AccumulateFiles();ProcessFiles(ids);AccumulateYuzuMeta();@@ -566,7 +570,7 @@ InstallResult RegisteredCache::InstallEntry(const NSP& nsp, bool overwrite_if_ex}const auto meta_id_raw = (*meta_iter)->GetName().substr(0, 32);- const auto meta_id = Common::HexStringToArray<16>(meta_id_raw);+ const auto meta_id_data = Common::HexStringToArray<16>(meta_id_raw);if ((*meta_iter)->GetSubdirectories().empty()) {LOG_ERROR(Loader,@@ -591,7 +595,7 @@ InstallResult RegisteredCache::InstallEntry(const NSP& nsp, bool overwrite_if_exconst auto result = RemoveExistingEntry(title_id);// Install Metadata File- const auto res = RawInstallNCA(**meta_iter, copy, overwrite_if_exists, meta_id);+ const auto res = RawInstallNCA(**meta_iter, copy, overwrite_if_exists, meta_id_data);if (res != InstallResult::Success) {return res;}@@ -741,15 +745,15 @@ InstallResult RegisteredCache::RawInstallNCA(const NCA& nca, const VfsCopyFunctibool RegisteredCache::RawInstallYuzuMeta(const CNMT& cnmt) {// Reasoning behind this method can be found in the comment for InstallEntry, NCA overload.- const auto dir = this->dir->CreateDirectoryRelative("yuzu_meta");+ const auto meta_dir = dir->CreateDirectoryRelative("yuzu_meta");const auto filename = GetCNMTName(cnmt.GetType(), cnmt.GetTitleID());- if (dir->GetFile(filename) == nullptr) {- auto out = dir->CreateFile(filename);+ if (meta_dir->GetFile(filename) == nullptr) {+ auto out = meta_dir->CreateFile(filename);const auto buffer = cnmt.Serialize();out->Resize(buffer.size());out->WriteBytes(buffer);} else {- auto out = dir->GetFile(filename);+ auto out = meta_dir->GetFile(filename);CNMT old_cnmt(out);// Returns true on changeif (old_cnmt.UnionRecords(cnmt)) {diff --git a/src/core/file_sys/registered_cache.h b/src/core/file_sys/registered_cache.hindex b08a1687a7..b316300144 100644--- a/src/core/file_sys/registered_cache.h+++ b/src/core/file_sys/registered_cache.h@@ -182,7 +182,7 @@ private:void AccumulateYuzuMeta();std::optional<NcaID> GetNcaIDFromMetadata(u64 title_id, ContentRecordType type) const;VirtualFile GetFileAtID(NcaID id) const;- VirtualFile OpenFileOrDirectoryConcat(const VirtualDir& dir, std::string_view path) const;+ VirtualFile OpenFileOrDirectoryConcat(const VirtualDir& open_dir, std::string_view path) const;InstallResult RawInstallNCA(const NCA& nca, const VfsCopyFunction& copy,bool overwrite_if_exists, std::optional<NcaID> override_id = {});bool RawInstallYuzuMeta(const CNMT& cnmt);diff --git a/src/core/file_sys/romfs_factory.cpp b/src/core/file_sys/romfs_factory.cppindex f4e16e4be0..de6ab721df 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& proviRomFSFactory::~RomFSFactory() = default;-void RomFSFactory::SetPackedUpdate(VirtualFile update_raw) {- this->update_raw = std::move(update_raw);+void RomFSFactory::SetPackedUpdate(VirtualFile update_raw_file) {+ update_raw = std::move(update_raw_file);}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.hindex 96dd0d578e..39db09e4e2 100644--- a/src/core/file_sys/romfs_factory.h+++ b/src/core/file_sys/romfs_factory.h@@ -40,7 +40,7 @@ public:Service::FileSystem::FileSystemController& controller);~RomFSFactory();- void SetPackedUpdate(VirtualFile update_raw);+ void SetPackedUpdate(VirtualFile update_raw_file);[[nodiscard]] ResultVal<VirtualFile> OpenCurrentProcess(u64 current_process_title_id) const;[[nodiscard]] ResultVal<VirtualFile> OpenPatchedRomFS(u64 title_id,ContentRecordType type) const;diff --git a/src/core/file_sys/savedata_factory.cpp b/src/core/file_sys/savedata_factory.cppindex b7bfe0928b..fa68af3a80 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 sSaveDataSize SaveDataFactory::ReadSaveDataSize(SaveDataType type, u64 title_id,u128 user_id) const {const auto path = GetFullPath(system, SaveDataSpaceId::NandUser, type, title_id, user_id, 0);- const auto dir = GetOrCreateDirectoryRelative(this->dir, path);+ const auto relative_dir = GetOrCreateDirectoryRelative(dir, path);- const auto size_file = dir->GetFile(SAVE_DATA_SIZE_FILENAME);- if (size_file == nullptr || size_file->GetSize() < sizeof(SaveDataSize))+ const auto size_file = relative_dir->GetFile(SAVE_DATA_SIZE_FILENAME);+ if (size_file == nullptr || size_file->GetSize() < sizeof(SaveDataSize)) {return {0, 0};+ }SaveDataSize out;- if (size_file->ReadObject(&out) != sizeof(SaveDataSize))+ if (size_file->ReadObject(&out) != sizeof(SaveDataSize)) {return {0, 0};+ }+return out;}void SaveDataFactory::WriteSaveDataSize(SaveDataType type, u64 title_id, u128 user_id,SaveDataSize new_value) const {const auto path = GetFullPath(system, SaveDataSpaceId::NandUser, type, title_id, user_id, 0);- const auto dir = GetOrCreateDirectoryRelative(this->dir, path);+ const auto relative_dir = GetOrCreateDirectoryRelative(dir, path);- const auto size_file = dir->CreateFile(SAVE_DATA_SIZE_FILENAME);- if (size_file == nullptr)+ const auto size_file = relative_dir->CreateFile(SAVE_DATA_SIZE_FILENAME);+ if (size_file == nullptr) {return;+ }size_file->Resize(sizeof(SaveDataSize));size_file->WriteObject(new_value);diff --git a/src/core/file_sys/submission_package.cpp b/src/core/file_sys/submission_package.cppindex c05735dddd..80e5609704 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) {void NSP::InitializeExeFSAndRomFS(const std::vector<VirtualFile>& files) {exefs = pfs;- const auto romfs_iter = std::find_if(files.begin(), files.end(), [](const VirtualFile& file) {- return file->GetName().rfind(".romfs") != std::string::npos;+ const auto iter = std::find_if(files.begin(), files.end(), [](const VirtualFile& entry) {+ return entry->GetName().rfind(".romfs") != std::string::npos;});- if (romfs_iter == files.end()) {+ if (iter == files.end()) {return;}- romfs = *romfs_iter;+ romfs = *iter;}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.cppindex 3c5a7d87a6..6190815023 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::return 0;}-bool ConcatenatedVfsFile::Rename(std::string_view name) {+bool ConcatenatedVfsFile::Rename(std::string_view new_name) {return false;}diff --git a/src/core/file_sys/vfs_concat.h b/src/core/file_sys/vfs_concat.hindex 287c72555e..3397d32cd0 100644--- a/src/core/file_sys/vfs_concat.h+++ b/src/core/file_sys/vfs_concat.h@@ -36,7 +36,7 @@ public:bool IsReadable() const override;std::size_t Read(u8* data, std::size_t length, std::size_t offset) const override;std::size_t Write(const u8* data, std::size_t length, std::size_t offset) override;- bool Rename(std::string_view name) override;+ bool Rename(std::string_view new_name) override;private:// Maps starting offset to file -- more efficient.diff --git a/src/core/file_sys/vfs_layered.cpp b/src/core/file_sys/vfs_layered.cppindex 434b03cecc..1927400583 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) consreturn MakeLayeredDirectory(std::move(out));}-VirtualFile LayeredVfsDirectory::GetFile(std::string_view name) const {- return GetFileRelative(name);+VirtualFile LayeredVfsDirectory::GetFile(std::string_view file_name) const {+ return GetFileRelative(file_name);}-VirtualDir LayeredVfsDirectory::GetSubdirectory(std::string_view name) const {- return GetDirectoryRelative(name);+VirtualDir LayeredVfsDirectory::GetSubdirectory(std::string_view subdir_name) const {+ return GetDirectoryRelative(subdir_name);}std::string LayeredVfsDirectory::GetFullPath() const {@@ -105,24 +105,24 @@ VirtualDir LayeredVfsDirectory::GetParentDirectory() const {return dirs[0]->GetParentDirectory();}-VirtualDir LayeredVfsDirectory::CreateSubdirectory(std::string_view name) {+VirtualDir LayeredVfsDirectory::CreateSubdirectory(std::string_view subdir_name) {return nullptr;}-VirtualFile LayeredVfsDirectory::CreateFile(std::string_view name) {+VirtualFile LayeredVfsDirectory::CreateFile(std::string_view file_name) {return nullptr;}-bool LayeredVfsDirectory::DeleteSubdirectory(std::string_view name) {+bool LayeredVfsDirectory::DeleteSubdirectory(std::string_view subdir_name) {return false;}-bool LayeredVfsDirectory::DeleteFile(std::string_view name) {+bool LayeredVfsDirectory::DeleteFile(std::string_view file_name) {return false;}-bool LayeredVfsDirectory::Rename(std::string_view name_) {- name = name_;+bool LayeredVfsDirectory::Rename(std::string_view new_name) {+ name = new_name;return true;}diff --git a/src/core/file_sys/vfs_layered.h b/src/core/file_sys/vfs_layered.hindex 6d7513ac62..cb4b32e917 100644--- a/src/core/file_sys/vfs_layered.h+++ b/src/core/file_sys/vfs_layered.h@@ -23,8 +23,8 @@ public:VirtualFile GetFileRelative(std::string_view path) const override;VirtualDir GetDirectoryRelative(std::string_view path) const override;- VirtualFile GetFile(std::string_view name) const override;- VirtualDir GetSubdirectory(std::string_view name) const override;+ VirtualFile GetFile(std::string_view file_name) const override;+ VirtualDir GetSubdirectory(std::string_view subdir_name) const override;std::string GetFullPath() const override;std::vector<VirtualFile> GetFiles() const override;@@ -33,11 +33,11 @@ public:bool IsReadable() const override;std::string GetName() const override;VirtualDir GetParentDirectory() const override;- VirtualDir CreateSubdirectory(std::string_view name) override;- VirtualFile CreateFile(std::string_view name) override;- bool DeleteSubdirectory(std::string_view name) override;- bool DeleteFile(std::string_view name) override;- bool Rename(std::string_view name) override;+ VirtualDir CreateSubdirectory(std::string_view subdir_name) override;+ VirtualFile CreateFile(std::string_view file_name) override;+ bool DeleteSubdirectory(std::string_view subdir_name) override;+ bool DeleteFile(std::string_view file_name) override;+ bool Rename(std::string_view new_name) override;private:std::vector<VirtualDir> dirs;diff --git a/src/core/file_sys/vfs_offset.cpp b/src/core/file_sys/vfs_offset.cppindex 056737b54f..870ed1cf82 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 rreturn file->Write(data.data(), TrimToFit(data.size(), r_offset), offset + r_offset);}-bool OffsetVfsFile::Rename(std::string_view name) {- return file->Rename(name);+bool OffsetVfsFile::Rename(std::string_view new_name) {+ return file->Rename(new_name);}std::size_t OffsetVfsFile::GetOffset() const {diff --git a/src/core/file_sys/vfs_offset.h b/src/core/file_sys/vfs_offset.hindex b2ccc5c7b8..42f78b3d9d 100644--- a/src/core/file_sys/vfs_offset.h+++ b/src/core/file_sys/vfs_offset.h@@ -35,7 +35,7 @@ public:bool WriteByte(u8 data, std::size_t offset) override;std::size_t WriteBytes(const std::vector<u8>& data, std::size_t offset) override;- bool Rename(std::string_view name) override;+ bool Rename(std::string_view new_name) override;std::size_t GetOffset() const;diff --git a/src/core/file_sys/vfs_real.cpp b/src/core/file_sys/vfs_real.cppindex a44ce6288e..3d89dd6449 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&RealVfsDirectory::~RealVfsDirectory() = default;-VirtualFile RealVfsDirectory::GetFileRelative(std::string_view path) const {- const auto full_path = FS::SanitizePath(this->path + DIR_SEP + std::string(path));+VirtualFile RealVfsDirectory::GetFileRelative(std::string_view relative_path) const {+ const auto full_path = FS::SanitizePath(path + DIR_SEP + std::string(relative_path));if (!FS::Exists(full_path) || FS::IsDirectory(full_path)) {return nullptr;}return base.OpenFile(full_path, perms);}-VirtualDir RealVfsDirectory::GetDirectoryRelative(std::string_view path) const {- const auto full_path = FS::SanitizePath(this->path + DIR_SEP + std::string(path));+VirtualDir RealVfsDirectory::GetDirectoryRelative(std::string_view relative_path) const {+ const auto full_path = FS::SanitizePath(path + DIR_SEP + std::string(relative_path));if (!FS::Exists(full_path) || !FS::IsDirectory(full_path)) {return nullptr;}@@ -382,13 +382,13 @@ VirtualDir RealVfsDirectory::GetSubdirectory(std::string_view name) const {return GetDirectoryRelative(name);}-VirtualFile RealVfsDirectory::CreateFileRelative(std::string_view path) {- const auto full_path = FS::SanitizePath(this->path + DIR_SEP + std::string(path));+VirtualFile RealVfsDirectory::CreateFileRelative(std::string_view relative_path) {+ const auto full_path = FS::SanitizePath(path + DIR_SEP + std::string(relative_path));return base.CreateFile(full_path, perms);}-VirtualDir RealVfsDirectory::CreateDirectoryRelative(std::string_view path) {- const auto full_path = FS::SanitizePath(this->path + DIR_SEP + std::string(path));+VirtualDir RealVfsDirectory::CreateDirectoryRelative(std::string_view relative_path) {+ const auto full_path = FS::SanitizePath(path + DIR_SEP + std::string(relative_path));return base.CreateDirectory(full_path, perms);}diff --git a/src/core/file_sys/vfs_real.h b/src/core/file_sys/vfs_real.hindex 23e99865e9..0666f26796 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 {public:~RealVfsDirectory() override;- VirtualFile GetFileRelative(std::string_view path) const override;- VirtualDir GetDirectoryRelative(std::string_view path) const override;+ VirtualFile GetFileRelative(std::string_view relative_path) const override;+ VirtualDir GetDirectoryRelative(std::string_view relative_path) const override;VirtualFile GetFile(std::string_view name) const override;VirtualDir GetSubdirectory(std::string_view name) const override;- VirtualFile CreateFileRelative(std::string_view path) override;- VirtualDir CreateDirectoryRelative(std::string_view path) override;+ VirtualFile CreateFileRelative(std::string_view relative_path) override;+ VirtualDir CreateDirectoryRelative(std::string_view relative_path) override;bool DeleteSubdirectoryRecursive(std::string_view name) override;std::vector<VirtualFile> GetFiles() const override;std::vector<VirtualDir> GetSubdirectories() const override;diff --git a/src/core/file_sys/vfs_vector.cpp b/src/core/file_sys/vfs_vector.cppindex c1ec1e6458..1a3f06227e 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 namreturn true;}-bool VectorVfsDirectory::DeleteSubdirectory(std::string_view name) {- return FindAndRemoveVectorElement(dirs, name);+bool VectorVfsDirectory::DeleteSubdirectory(std::string_view subdir_name) {+ return FindAndRemoveVectorElement(dirs, subdir_name);}-bool VectorVfsDirectory::DeleteFile(std::string_view name) {- return FindAndRemoveVectorElement(files, name);+bool VectorVfsDirectory::DeleteFile(std::string_view file_name) {+ return FindAndRemoveVectorElement(files, file_name);}bool VectorVfsDirectory::Rename(std::string_view name_) {@@ -116,11 +116,11 @@ bool VectorVfsDirectory::Rename(std::string_view name_) {return true;}-VirtualDir VectorVfsDirectory::CreateSubdirectory(std::string_view name) {+VirtualDir VectorVfsDirectory::CreateSubdirectory(std::string_view subdir_name) {return nullptr;}-VirtualFile VectorVfsDirectory::CreateFile(std::string_view name) {+VirtualFile VectorVfsDirectory::CreateFile(std::string_view file_name) {return nullptr;}diff --git a/src/core/file_sys/vfs_vector.h b/src/core/file_sys/vfs_vector.hindex 2aff9ca34f..c10c527b6f 100644--- a/src/core/file_sys/vfs_vector.h+++ b/src/core/file_sys/vfs_vector.h@@ -112,11 +112,11 @@ public:bool IsReadable() const override;std::string GetName() const override;VirtualDir GetParentDirectory() const override;- bool DeleteSubdirectory(std::string_view name) override;- bool DeleteFile(std::string_view name) override;+ bool DeleteSubdirectory(std::string_view subdir_name) override;+ bool DeleteFile(std::string_view file_name) override;bool Rename(std::string_view name) override;- VirtualDir CreateSubdirectory(std::string_view name) override;- VirtualFile CreateFile(std::string_view name) override;+ VirtualDir CreateSubdirectory(std::string_view subdir_name) override;+ VirtualFile CreateFile(std::string_view file_name) override;virtual void AddFile(VirtualFile file);virtual void AddDirectory(VirtualDir dir);