From 4d2cf418374323b30f7ea59be595fa69fe78a82f Mon Sep 17 00:00:00 2001 From: Meow <59313695+a55uka@users.noreply.github.com> Date: Sat, 31 Oct 2026 11:57:12 +0000 Subject: game_list, loader: find loose ExeFS dumps and show their name and icon --- src/core/loader/deconstructed_rom_directory.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'src/core/loader/deconstructed_rom_directory.cpp') 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 +#include #include #include #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 (/exefs/main and +// ExeFS or in the game folder above it (/exefs/main, /base/exefs/main and // /updates//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; -- cgit v1.2.3