diff --git a/Source/Core/UICommon/GameFileCache.cpp b/Source/Core/UICommon/GameFileCache.cpp index d9b08f63d5..1435154941 100644 --- a/Source/Core/UICommon/GameFileCache.cpp +++ b/Source/Core/UICommon/GameFileCache.cpp @@ -43,7 +43,7 @@ GameFileCache::GameFileCache() : m_path(File::GetUserPath(D_CACHE_IDX) + "gameli { } -void GameFileCache::ForEach(std::function&)> f) const +void GameFileCache::ForEach(const ForEachFn& f) const { for (const std::shared_ptr& item : m_cached_files) f(item); @@ -83,11 +83,10 @@ std::shared_ptr GameFileCache::AddOrGet(const std::string& path, return result; } -bool GameFileCache::Update( - const std::vector& all_game_paths, - std::function&)> game_added_to_cache, - std::function game_removed_from_cache, - const std::atomic_bool& processing_halted) +bool GameFileCache::Update(const std::vector& all_game_paths, + const GameAddedToCacheFn& game_added_to_cache, + const GameRemovedFromCacheFn& game_removed_from_cache, + const std::atomic_bool& processing_halted) { // Copy game paths into a set, except ones that match DiscIO::ShouldHideFromGameList. // TODO: Prevent DoFileSearch from looking inside /files/ directories of DirectoryBlobs at all? @@ -151,9 +150,8 @@ bool GameFileCache::Update( return cache_changed; } -bool GameFileCache::UpdateAdditionalMetadata( - std::function&)> game_updated, - const std::atomic_bool& processing_halted) +bool GameFileCache::UpdateAdditionalMetadata(const GameUpdatedFn& game_updated, + const std::atomic_bool& processing_halted) { bool cache_changed = false; diff --git a/Source/Core/UICommon/GameFileCache.h b/Source/Core/UICommon/GameFileCache.h index 1a54942f32..ac8ae7b177 100644 --- a/Source/Core/UICommon/GameFileCache.h +++ b/Source/Core/UICommon/GameFileCache.h @@ -30,9 +30,14 @@ public: Yes = 1, }; + using ForEachFn = std::function&)>; + using GameAddedToCacheFn = std::function&)>; + using GameRemovedFromCacheFn = std::function; + using GameUpdatedFn = std::function&)>; + GameFileCache(); - void ForEach(std::function&)> f) const; + void ForEach(const ForEachFn& f) const; size_t GetSize() const; void Clear(DeleteOnDisk delete_on_disk); @@ -42,12 +47,11 @@ public: // These functions return true if the call modified the cache. bool Update(const std::vector& all_game_paths, - std::function&)> game_added_to_cache = {}, - std::function game_removed_from_cache = {}, + const GameAddedToCacheFn& game_added_to_cache = {}, + const GameRemovedFromCacheFn& game_removed_from_cache = {}, const std::atomic_bool& processing_halted = false); - bool UpdateAdditionalMetadata( - std::function&)> game_updated = {}, - const std::atomic_bool& processing_halted = false); + bool UpdateAdditionalMetadata(const GameUpdatedFn& game_updated = {}, + const std::atomic_bool& processing_halted = false); bool Load(); bool Save();