diff options
| author | JosJuice <josjuice@gmail.com> | 2025-05-25 15:03:26 +0200 |
|---|---|---|
| committer | JosJuice <josjuice@gmail.com> | 2025-05-25 20:37:52 +0200 |
| commit | 66f181a621cd096b29060b3a85cb0dcb0ae0140d (patch) | |
| tree | a38291c3854152f4d14c9f36864f1a529acfb309 /Source/Core/DiscIO | |
| parent | da8610e76fc1ae09562df3152a28be7f50d6e317 (diff) | |
Hide DirectoryBlob header.bin files from game list
This is a continuation of 552b6da. That commit hid sys/boot.bin, but not
disc/header.bin, which is only present for Wii games.
Fixes https://bugs.dolphin-emu.org/issues/13810.
Diffstat (limited to 'Source/Core/DiscIO')
| -rw-r--r-- | Source/Core/DiscIO/DirectoryBlob.cpp | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/Source/Core/DiscIO/DirectoryBlob.cpp b/Source/Core/DiscIO/DirectoryBlob.cpp index dfed684760..d0ee8bf803 100644 --- a/Source/Core/DiscIO/DirectoryBlob.cpp +++ b/Source/Core/DiscIO/DirectoryBlob.cpp @@ -240,13 +240,13 @@ static bool PathCharactersEqual(char a, char b) return a == b || (IsDirectorySeparator(a) && IsDirectorySeparator(b)); } -static bool PathEndsWith(const std::string& path, const std::string& suffix) +static bool PathEndsWith(const std::string& path, const std::string_view suffix) { if (suffix.size() > path.size()) return false; std::string::const_iterator path_iterator = path.cend() - suffix.size(); - std::string::const_iterator suffix_iterator = suffix.cbegin(); + std::string_view::const_iterator suffix_iterator = suffix.cbegin(); while (path_iterator != path.cend()) { if (!PathCharactersEqual(*path_iterator, *suffix_iterator)) @@ -341,19 +341,28 @@ static bool IsMainDolForNonGamePartition(const std::string& path) static bool IsBootBin(const std::string& path) { - if (!PathEndsWith(path, "/sys/boot.bin")) + static constexpr std::string_view boot_bin = "/sys/boot.bin"; + if (!PathEndsWith(path, boot_bin)) return false; - static constexpr size_t chars_to_remove = std::string_view("sys/boot.bin").size(); - const std::string partition_root = path.substr(0, path.size() - chars_to_remove); + const std::string partition_root = path.substr(0, path.size() - boot_bin.size()); + return File::Exists(partition_root + "/sys/main.dol"); +} + +static bool IsHeaderBin(const std::string& path) +{ + static constexpr std::string_view header_bin = "/disc/header.bin"; + if (!PathEndsWith(path, header_bin)) + return false; - return File::Exists(partition_root + "sys/main.dol"); + const std::string partition_root = path.substr(0, path.size() - header_bin.size()); + return File::Exists(partition_root + "/sys/main.dol"); } bool ShouldHideFromGameList(const std::string& volume_path) { return IsInFilesDirectory(volume_path) || IsMainDolForNonGamePartition(volume_path) || - IsBootBin(volume_path); + IsBootBin(volume_path) || IsHeaderBin(volume_path); } std::unique_ptr<DirectoryBlobReader> DirectoryBlobReader::Create(const std::string& dol_path) |
