mirror of https://github.com/PCSX2/pcsx2.git
GameList: Don't repeatedly scan invalid files every startup
This commit is contained in:
parent
db1e1bcc1f
commit
6edba3820b
|
@ -312,7 +312,16 @@ bool GameList::GetIsoListEntry(const std::string& path, GameList::Entry* entry)
|
|||
|
||||
case CDVD_TYPE_ILLEGAL:
|
||||
default:
|
||||
return false;
|
||||
{
|
||||
// Create empty invalid entry, so we don't repeatedly scan it every time.
|
||||
entry->type = EntryType::Invalid;
|
||||
entry->path = path;
|
||||
entry->total_size = 0;
|
||||
entry->compatibility_rating = CompatibilityRating::Unknown;
|
||||
entry->title.clear();
|
||||
entry->region = Region::Other;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
entry->path = path;
|
||||
|
@ -624,6 +633,10 @@ bool GameList::AddFileFromCache(const std::string& path, std::time_t timestamp,
|
|||
if (!GetGameListEntryFromCache(path, &entry) || entry.last_modified_time != timestamp)
|
||||
return false;
|
||||
|
||||
// Skip over invalid entries.
|
||||
if (entry.type == EntryType::Invalid)
|
||||
return true;
|
||||
|
||||
auto iter = UnorderedStringMapFind(played_time_map, entry.serial);
|
||||
if (iter != played_time_map.end())
|
||||
{
|
||||
|
@ -647,7 +660,6 @@ bool GameList::ScanFile(
|
|||
if (!PopulateEntryFromPath(path, &entry))
|
||||
return false;
|
||||
|
||||
entry.path = std::move(path);
|
||||
entry.last_modified_time = timestamp;
|
||||
|
||||
if (s_cache_write_stream || OpenCacheForWriting())
|
||||
|
@ -656,6 +668,13 @@ bool GameList::ScanFile(
|
|||
Console.Warning("Failed to write entry '%s' to cache", entry.path.c_str());
|
||||
}
|
||||
|
||||
if (entry.type == EntryType::Invalid)
|
||||
{
|
||||
// don't add invalid entries to list
|
||||
lock.lock();
|
||||
return true;
|
||||
}
|
||||
|
||||
auto iter = UnorderedStringMapFind(played_time_map, entry.serial);
|
||||
if (iter != played_time_map.end())
|
||||
{
|
||||
|
|
|
@ -40,6 +40,7 @@ namespace GameList
|
|||
PS2Disc,
|
||||
PS1Disc,
|
||||
ELF,
|
||||
Invalid,
|
||||
Count
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue