#ifndef GAME_LIST_H_ #define GAME_LIST_H_ #include #include #include #include #include #include #include typedef struct _gameInfo { uint64_t titleId; MCPAppType appType; std::string name; std::string gamePath; GuiImageData *imageData; } gameInfo; class GameList { public: GameList(); ~GameList(); int32_t size() { lock(); int32_t res = fullGameList.size(); unlock(); return res; } int32_t gameCount() { lock(); int32_t res = fullGameList.size(); unlock(); return res; } gameInfo *at(int32_t i) { return operator[](i); } gameInfo *operator[](int32_t i) { lock(); gameInfo *res = nullptr; if (i < 0 || i >= (int32_t) fullGameList.size()) { res = nullptr; } else { res = fullGameList[i]; } unlock(); return res; } gameInfo *getGameInfo(uint64_t titleId); void clear(); std::vector &getFullGameList(void) { return fullGameList; } int32_t load(); sigslot::signal1 titleListChanged; sigslot::signal1 titleUpdated; sigslot::signal1 titleAdded; void lock() { _lock.lock(); } void unlock() { _lock.unlock(); } protected: int32_t readGameList(); void updateTitleInfo(); std::vector fullGameList; std::recursive_mutex _lock; bool stopAsyncLoading = false; }; #endif