diff options
| author | Meow <59313695+a55uka@users.noreply.github.com> | 2026-10-31 11:57:12 +0000 |
|---|---|---|
| committer | Meow <59313695+a55uka@users.noreply.github.com> | 2026-10-31 12:04:06 +0000 |
| commit | 4d2cf418374323b30f7ea59be595fa69fe78a82f (patch) | |
| tree | 794389bade77403559c16488f5a49ed26034d2d9 /src/core | |
| parent | 2b72e348561bd4696d3e44ca3b855fe565106c64 (diff) | |
game_list, loader: find loose ExeFS dumps and show their name and icon
Diffstat (limited to 'src/core')
| -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; |
