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/registered_cache.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 '')
-rw-r--r-- | src/core/file_sys/registered_cache.cpp | 32 |
1 files changed, 18 insertions, 14 deletions
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() { 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_ex const 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 VfsCopyFuncti bool 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 change if (old_cnmt.UnionRecords(cnmt)) { |