diff options
| author | Djihads <76681596+Djihads80@users.noreply.github.com> | 2026-10-31 13:53:31 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-10-31 13:53:31 +0100 |
| commit | 8ac95d5e42fc571279eede89bfd0a4f83d2783d2 (patch) | |
| tree | cf144ebfe835fe08b60236ef31032e82db4b8e47 /src/core/loader/deconstructed_rom_directory.cpp | |
| parent | 3a2c6deb11f4cd8f0965c96834653b765f8d5748 (diff) | |
| parent | 4d2cf418374323b30f7ea59be595fa69fe78a82f (diff) | |
Merge pull request #98 from a55uka/loose-dump-discovery
game_list, loader: find loose ExeFS dumps and show their name and icon
Diffstat (limited to 'src/core/loader/deconstructed_rom_directory.cpp')
| -rw-r--r-- | src/core/loader/deconstructed_rom_directory.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/core/loader/deconstructed_rom_directory.cpp b/src/core/loader/deconstructed_rom_directory.cpp index 4f2eb1d446..cda1645548 100644 --- a/src/core/loader/deconstructed_rom_directory.cpp +++ b/src/core/loader/deconstructed_rom_directory.cpp @@ -5,6 +5,7 @@ // SPDX-License-Identifier: GPL-2.0-or-later #include <algorithm> +#include <cctype> #include <cstring> #include <string_view> #include "common/logging.h" @@ -131,9 +132,17 @@ std::string RomFSProductVersion(const FileSys::VirtualDir& romfs_dir) { } // Loose ExeFS dumps carry no control data, but icon/nacp sidecars can be dropped next to the -// ExeFS or in the game folder above it (<game>/exefs/main and +// ExeFS or in the game folder above it (<game>/exefs/main, <game>/base/exefs/main and // <game>/updates/<title id>/exefs/main layouts). std::vector<FileSys::VirtualDir> FindSidecarDirs(const FileSys::VirtualDir& exefs_dir) { + const auto equals_ignore_case = [](const std::string& a, std::string_view b) { + return a.size() == b.size() && + std::equal(a.begin(), a.end(), b.begin(), [](char x, char y) { + return std::tolower(static_cast<unsigned char>(x)) == + std::tolower(static_cast<unsigned char>(y)); + }); + }; + std::vector<FileSys::VirtualDir> dirs{exefs_dir}; for (auto dir = exefs_dir; dirs.size() < 4;) { const auto parent = dir->GetParentDirectory(); @@ -142,10 +151,11 @@ std::vector<FileSys::VirtualDir> FindSidecarDirs(const FileSys::VirtualDir& exef } const auto& name = parent->GetName(); dirs.push_back(parent); - const bool title_id_like = - name == "updates" || + const bool storage_level = + equals_ignore_case(name, "base") || equals_ignore_case(name, "update") || + equals_ignore_case(name, "updates") || (!name.empty() && name.find_first_not_of("0123456789abcdefABCDEF") == std::string::npos); - if (!title_id_like) { + if (!storage_level) { break; } dir = parent; |
