GameList: Don't try to scan gpudump files

This commit is contained in:
Stenzek 2025-03-15 14:45:28 +10:00
parent bcd4b918dc
commit 8a0400ad2c
No known key found for this signature in database
3 changed files with 16 additions and 19 deletions

View File

@ -177,7 +177,7 @@ bool GameList::IsScannableFilename(std::string_view path)
if (StringUtil::EndsWithNoCase(path, ".bin"))
return false;
return System::IsLoadablePath(path);
return (System::IsDiscPath(path) || System::IsExePath(path) || System::IsPsfPath(path));
}
bool GameList::ShouldLoadAchievementsProgress()
@ -501,7 +501,7 @@ void GameList::ScanDirectory(const char* path, bool recursive, bool only_cache,
const Achievements::ProgressDatabase& achievements_progress,
BinaryFileWriter& cache_writer, ProgressCallback* progress)
{
INFO_LOG("Scanning {}{}", path, recursive ? " (recursively)" : "");
VERBOSE_LOG("Scanning {}{}", path, recursive ? " (recursively)" : "");
progress->SetStatusText(SmallString::from_format(TRANSLATE_FS("GameList", "Scanning directory '{}'..."), path));
@ -577,7 +577,7 @@ bool GameList::ScanFile(std::string path, std::time_t timestamp, std::unique_loc
// don't block UI while scanning
lock.unlock();
DEV_LOG("Scanning '{}'...", path);
VERBOSE_LOG("Scanning '{}'...", path);
Entry entry;
if (!PopulateEntryFromPath(path, &entry))

View File

@ -800,6 +800,15 @@ bool System::IsUsingPS2BIOS()
return (s_state.bios_image_info && s_state.bios_image_info->fastboot_patch == BIOS::ImageInfo::FastBootPatch::Type2);
}
bool System::IsDiscPath(std::string_view path)
{
return (StringUtil::EndsWithNoCase(path, ".bin") || StringUtil::EndsWithNoCase(path, ".cue") ||
StringUtil::EndsWithNoCase(path, ".img") || StringUtil::EndsWithNoCase(path, ".iso") ||
StringUtil::EndsWithNoCase(path, ".chd") || StringUtil::EndsWithNoCase(path, ".ecm") ||
StringUtil::EndsWithNoCase(path, ".mds") || StringUtil::EndsWithNoCase(path, ".pbp") ||
StringUtil::EndsWithNoCase(path, ".m3u"));
}
bool System::IsExePath(std::string_view path)
{
return (StringUtil::EndsWithNoCase(path, ".exe") || StringUtil::EndsWithNoCase(path, ".psexe") ||
@ -820,22 +829,7 @@ bool System::IsGPUDumpPath(std::string_view path)
bool System::IsLoadablePath(std::string_view path)
{
static constexpr const std::array extensions = {
".bin", ".cue", ".img", ".iso", ".chd", ".ecm", ".mds", // discs
".exe", ".psexe", ".ps-exe", ".psx", ".cpe", ".elf", // exes
".psf", ".minipsf", // psf
".psxgpu", ".psxgpu.zst", ".psxgpu.xz", // gpu dump
".m3u", // playlists
".pbp",
};
for (const char* test_extension : extensions)
{
if (StringUtil::EndsWithNoCase(path, test_extension))
return true;
}
return false;
return (IsDiscPath(path) || IsExePath(path) || IsPsfPath(path) || IsGPUDumpPath(path));
}
bool System::IsSaveStatePath(std::string_view path)

View File

@ -118,6 +118,9 @@ enum class Taint : u8
MaxCount,
};
/// Returns true if the path is a disc image that we can load.
bool IsDiscPath(std::string_view path);
/// Returns true if the path is a PlayStation executable we can inject.
bool IsExePath(std::string_view path);