summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2018-12-05 00:34:49 +0100
committerGitHub <noreply@github.com>2018-12-05 00:34:49 +0100
commite5dd4cb39266fe4e237b4024da881f855353b3eb (patch)
tree8a0608c999c9c7bb0a05f2ce6b678177d5a76ddc
parentMerge pull request #1836 from lioncash/unused (diff)
parentfile_sys/registered_cache: Eliminate variable shadowing (diff)
downloadyuzu-e5dd4cb39266fe4e237b4024da881f855353b3eb.tar
yuzu-e5dd4cb39266fe4e237b4024da881f855353b3eb.tar.gz
yuzu-e5dd4cb39266fe4e237b4024da881f855353b3eb.tar.bz2
yuzu-e5dd4cb39266fe4e237b4024da881f855353b3eb.tar.lz
yuzu-e5dd4cb39266fe4e237b4024da881f855353b3eb.tar.xz
yuzu-e5dd4cb39266fe4e237b4024da881f855353b3eb.tar.zst
yuzu-e5dd4cb39266fe4e237b4024da881f855353b3eb.zip
-rw-r--r--src/core/file_sys/registered_cache.cpp53
1 files changed, 26 insertions, 27 deletions
diff --git a/src/core/file_sys/registered_cache.cpp b/src/core/file_sys/registered_cache.cpp
index 07c3af64a..128199063 100644
--- a/src/core/file_sys/registered_cache.cpp
+++ b/src/core/file_sys/registered_cache.cpp
@@ -107,42 +107,41 @@ static ContentRecordType GetCRTypeFromNCAType(NCAContentType type) {
VirtualFile RegisteredCache::OpenFileOrDirectoryConcat(const VirtualDir& dir,
std::string_view path) const {
const auto file = dir->GetFileRelative(path);
- if (file != nullptr)
+ if (file != nullptr) {
return file;
+ }
const auto nca_dir = dir->GetDirectoryRelative(path);
- if (nca_dir != nullptr) {
- const auto nca_dir = dir->GetDirectoryRelative(path);
- VirtualFile file = nullptr;
+ if (nca_dir == nullptr) {
+ return nullptr;
+ }
- const auto files = nca_dir->GetFiles();
- if (files.size() == 1 && files[0]->GetName() == "00") {
- file = files[0];
+ const auto files = nca_dir->GetFiles();
+ if (files.size() == 1 && files[0]->GetName() == "00") {
+ return files[0];
+ }
+
+ std::vector<VirtualFile> concat;
+ // Since the files are a two-digit hex number, max is FF.
+ for (std::size_t i = 0; i < 0x100; ++i) {
+ auto next = nca_dir->GetFile(fmt::format("{:02X}", i));
+ if (next != nullptr) {
+ concat.push_back(std::move(next));
} else {
- std::vector<VirtualFile> concat;
- // Since the files are a two-digit hex number, max is FF.
- for (std::size_t i = 0; i < 0x100; ++i) {
- auto next = nca_dir->GetFile(fmt::format("{:02X}", i));
- if (next != nullptr) {
- concat.push_back(std::move(next));
- } else {
- next = nca_dir->GetFile(fmt::format("{:02x}", i));
- if (next != nullptr)
- concat.push_back(std::move(next));
- else
- break;
- }
+ next = nca_dir->GetFile(fmt::format("{:02x}", i));
+ if (next != nullptr) {
+ concat.push_back(std::move(next));
+ } else {
+ break;
}
-
- if (concat.empty())
- return nullptr;
-
- file = ConcatenatedVfsFile::MakeConcatenatedFile(concat, concat.front()->GetName());
}
+ }
- return file;
+ if (concat.empty()) {
+ return nullptr;
}
- return nullptr;
+
+ return ConcatenatedVfsFile::MakeConcatenatedFile(concat, concat.front()->GetName());
}
VirtualFile RegisteredCache::GetFileAtID(NcaID id) const {