101 std::function<void(
const std::string& gameId, std::function<
void(
Game&)>)>;
122 GameStateSync(
const GameStateSync&) =
delete;
123 GameStateSync& operator=(
const GameStateSync&) =
delete;
129 void syncThreadFunction();
130 void syncGame(
Game* game);
131 bool verifySteamInstallation(
Game* game);
132 bool verifyLocalInstallation(
Game* game);
133 void fixTransitionalState(
Game* game);
134 void updateSteamMetadata(
Game* game);
145 std::thread syncThread_;
146 std::atomic<bool> shouldStop_;
147 std::atomic<bool> requestFullSync_;
149 std::mutex gameIdsMutex_;
150 std::set<std::string> gamesNeedingSync_;
152 std::atomic<int> syncIntervalSeconds_{10};
153 std::atomic<int> transitionalStateTimeoutSeconds_{60};
154 std::atomic<bool> autoRecoveryEnabled_{
true};
158 mutable std::mutex callbackMutex_;
161 std::map<std::string, time_t> transitionalStateStartTimes_;
162 std::mutex transitionalStatesMutex_;
165 mutable std::mutex statsMutex_;
Central database for managing all games in the launcher.
void setStateChangeCallback(StateChangeCallback callback)
void requestFullSync()
Request immediate sync of all games.
void setTransitionalStateTimeout(int timeoutSeconds)
Set timeout for transitional states (default: 60 seconds).
void setSyncInterval(int intervalSeconds)
Set sync interval (default: 10 seconds).
void start(GameLibrary *library, SteamLibraryScanner *steamScanner)
Start the background sync thread.
std::function< void(const std::string &gameId, std::function< void(Game &)>)> GameUpdateCallback
void setAutoRecoveryEnabled(bool enabled)
Enable/disable automatic status recovery.
void requestImmediateSync(const std::string &gameId)
Request immediate sync of a specific game.
void stop()
Stop the background sync thread.
void setGameUpdateCallback(GameUpdateCallback callback)
std::function< void(const std::string &gameId, GameStatus oldStatus, GameStatus newStatus)> StateChangeCallback
static GameStateSync & instance()
Complete representation of a game in the library.
Scans Steam installations to discover games.
GameStatus
Current installation and execution status of the game.