Merge pull request #1838 from lioncash/dedup
file_sys/registered_cache: Eliminate variable shadowing
This commit is contained in:
commit
e5dd4cb392
1 changed files with 33 additions and 34 deletions
|
@ -107,18 +107,20 @@ static ContentRecordType GetCRTypeFromNCAType(NCAContentType type) {
|
||||||
VirtualFile RegisteredCache::OpenFileOrDirectoryConcat(const VirtualDir& dir,
|
VirtualFile RegisteredCache::OpenFileOrDirectoryConcat(const VirtualDir& dir,
|
||||||
std::string_view path) const {
|
std::string_view path) const {
|
||||||
const auto file = dir->GetFileRelative(path);
|
const auto file = dir->GetFileRelative(path);
|
||||||
if (file != nullptr)
|
if (file != nullptr) {
|
||||||
return file;
|
return file;
|
||||||
|
}
|
||||||
|
|
||||||
const auto nca_dir = dir->GetDirectoryRelative(path);
|
const auto nca_dir = dir->GetDirectoryRelative(path);
|
||||||
if (nca_dir != nullptr) {
|
if (nca_dir == nullptr) {
|
||||||
const auto nca_dir = dir->GetDirectoryRelative(path);
|
return nullptr;
|
||||||
VirtualFile file = nullptr;
|
}
|
||||||
|
|
||||||
const auto files = nca_dir->GetFiles();
|
const auto files = nca_dir->GetFiles();
|
||||||
if (files.size() == 1 && files[0]->GetName() == "00") {
|
if (files.size() == 1 && files[0]->GetName() == "00") {
|
||||||
file = files[0];
|
return files[0];
|
||||||
} else {
|
}
|
||||||
|
|
||||||
std::vector<VirtualFile> concat;
|
std::vector<VirtualFile> concat;
|
||||||
// Since the files are a two-digit hex number, max is FF.
|
// Since the files are a two-digit hex number, max is FF.
|
||||||
for (std::size_t i = 0; i < 0x100; ++i) {
|
for (std::size_t i = 0; i < 0x100; ++i) {
|
||||||
|
@ -127,22 +129,19 @@ VirtualFile RegisteredCache::OpenFileOrDirectoryConcat(const VirtualDir& dir,
|
||||||
concat.push_back(std::move(next));
|
concat.push_back(std::move(next));
|
||||||
} else {
|
} else {
|
||||||
next = nca_dir->GetFile(fmt::format("{:02x}", i));
|
next = nca_dir->GetFile(fmt::format("{:02x}", i));
|
||||||
if (next != nullptr)
|
if (next != nullptr) {
|
||||||
concat.push_back(std::move(next));
|
concat.push_back(std::move(next));
|
||||||
else
|
} else {
|
||||||
break;
|
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 {
|
VirtualFile RegisteredCache::GetFileAtID(NcaID id) const {
|
||||||
|
|
Loading…
Reference in a new issue