// Copyright 2017 Dolphin Emulator Project // Licensed under GPLv2+ // Refer to the license.txt file included. #pragma once #include #include #include #include #include #include #include #include "Common/CommonTypes.h" class PointerWrap; namespace UICommon { class GameFile; std::vector FindAllGamePaths(const std::vector& directories_to_scan, bool recursive_scan); class GameFileCache { public: void ForEach(std::function&)> f) const; void Clear(); // Returns nullptr if the file is invalid. std::shared_ptr AddOrGet(const std::string& path, bool* cache_changed); // 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 = {}); bool UpdateAdditionalMetadata( std::function&)> game_updated = {}); bool Load(); bool Save(); private: bool UpdateAdditionalMetadata(std::shared_ptr* game_file); bool SyncCacheFile(bool save); void DoState(PointerWrap* p, u64 size = 0); std::vector> m_cached_files; }; } // namespace UICommon