|
game_launcher 1.1.0
Modern Linux game launcher with Steam / Proton / Wine integration
|
Monitors Steam download/install progress for games. More...
#include <steam_integration.h>
Classes | |
| class | Impl |
Public Types | |
| using | GameExitCallback = std::function<void(uint32_t appId)> |
| using | GameLaunchCallback = std::function<void(uint32_t appId, int pid)> |
| using | ProgressCallback |
| using | StateChangeCallback |
Public Member Functions | |
| SteamDownloadMonitor () | |
| SteamDownloadMonitor (const SteamDownloadMonitor &)=delete | |
| SteamDownloadMonitor (SteamDownloadMonitor &&) noexcept | |
| ~SteamDownloadMonitor () | |
| SteamDownloadProgress | getProgress (uint32_t appId) const |
| Get current progress for a game (immediate snapshot). | |
| std::vector< uint32_t > | getWatchedGames () const |
| Get list of currently watched game IDs. | |
| bool | isRunning () const |
| Check if monitor is running. | |
| SteamDownloadMonitor & | operator= (const SteamDownloadMonitor &)=delete |
| SteamDownloadMonitor & | operator= (SteamDownloadMonitor &&) noexcept |
| void | setOnGameExit (GameExitCallback callback) |
| void | setOnGameLaunch (GameLaunchCallback callback) |
| void | setOnProgressUpdate (ProgressCallback callback) |
| void | setOnStateChange (StateChangeCallback callback) |
| void | start (int pollIntervalMs=1000) |
| Start monitoring Steam downloads. | |
| void | stop () |
| Stop all monitoring. | |
| void | unwatchGame (uint32_t appId) |
| Remove a game from the watch list. | |
| void | watchGame (uint32_t appId) |
| Add a game to the watch list for progress updates. | |
Static Public Member Functions | |
| static std::vector< uint32_t > | getDownloadingGames () |
| Get list of all games currently downloading. | |
| static int | getRunningGamePid (uint32_t appId) |
| Check if a Steam game is currently running (by app ID). | |
| static bool | isSteamDownloading () |
| Check if Steam is actively downloading/updating anything. | |
| static SteamDownloadProgress | readGameState (uint32_t appId) |
| Read current state of a game directly from its appmanifest. | |
Monitors Steam download/install progress for games.
This class provides download progress tracking by:
Usage:
Definition at line 960 of file steam_integration.h.
| using SteamDownloadMonitor::GameExitCallback = std::function<void(uint32_t appId)> |
Definition at line 968 of file steam_integration.h.
| using SteamDownloadMonitor::GameLaunchCallback = std::function<void(uint32_t appId, int pid)> |
Definition at line 967 of file steam_integration.h.
Definition at line 963 of file steam_integration.h.
Definition at line 965 of file steam_integration.h.
| SteamDownloadMonitor::SteamDownloadMonitor | ( | ) |
Definition at line 5079 of file steam_integration.cpp.
Referenced by SteamDownloadMonitor(), SteamDownloadMonitor(), operator=(), operator=(), and start().
|
default |
|
delete |
References SteamDownloadMonitor().
|
defaultnoexcept |
References SteamDownloadMonitor().
|
static |
Get list of all games currently downloading.
Definition at line 5222 of file steam_integration.cpp.
References SteamLibraryScanner::getLibraryPaths(), SteamStateFlags::isDownloading(), readVdfContent(), and start().
Referenced by isSteamDownloading(), and operator=().
| SteamDownloadProgress SteamDownloadMonitor::getProgress | ( | uint32_t | appId | ) | const |
Get current progress for a game (immediate snapshot).
| appId | Steam App ID |
Definition at line 5116 of file steam_integration.cpp.
Referenced by operator=().
|
static |
Check if a Steam game is currently running (by app ID).
| appId | Steam App ID |
Detects game processes using the reaper PID file Steam creates.
Definition at line 5121 of file steam_integration.cpp.
References ProcessExecutor::executeWithOutput(), ProcessResult::output, and ProcessResult::success.
Referenced by operator=().
| std::vector< uint32_t > SteamDownloadMonitor::getWatchedGames | ( | ) | const |
Get list of currently watched game IDs.
Definition at line 5111 of file steam_integration.cpp.
Referenced by operator=().
| bool SteamDownloadMonitor::isRunning | ( | ) | const |
Check if monitor is running.
Definition at line 5096 of file steam_integration.cpp.
Referenced by operator=().
|
static |
Check if Steam is actively downloading/updating anything.
Definition at line 5215 of file steam_integration.cpp.
References getDownloadingGames().
Referenced by operator=().
|
delete |
References SteamDownloadMonitor().
|
defaultnoexcept |
|
static |
Read current state of a game directly from its appmanifest.
| appId | Steam App ID |
This is a static method that reads the appmanifest file directly without requiring the game to be watched. Useful for checking initial state of games (e.g., to detect partial downloads) before adding them to watch list.
Definition at line 5295 of file steam_integration.cpp.
References SteamDownloadProgress::appId, SteamDownloadProgress::bytesDownloaded, SteamDownloadProgress::bytesStaged, SteamDownloadProgress::bytesToDownload, SteamDownloadProgress::bytesToStage, SteamDownloadProgress::calculateProgress(), SteamLibraryScanner::getLibraryPaths(), SteamStateFlags::getStateDescription(), SteamDownloadProgress::isComplete, SteamStateFlags::isFullyInstalled(), readVdfContent(), SteamDownloadProgress::stateDescription, SteamDownloadProgress::stateFlags, and Logger::warn().
Referenced by operator=(), UpdatesIndicator::refresh(), DetailsPanelManager::Impl::update(), SidebarManager::updateCategoryCounts(), and DetailsPanelManager::Impl::updateLaunchButton().
| void SteamDownloadMonitor::setOnGameExit | ( | GameExitCallback | callback | ) |
Definition at line 5439 of file steam_integration.cpp.
Referenced by operator=().
| void SteamDownloadMonitor::setOnGameLaunch | ( | GameLaunchCallback | callback | ) |
Definition at line 5434 of file steam_integration.cpp.
Referenced by operator=().
| void SteamDownloadMonitor::setOnProgressUpdate | ( | ProgressCallback | callback | ) |
Definition at line 5424 of file steam_integration.cpp.
Referenced by operator=().
| void SteamDownloadMonitor::setOnStateChange | ( | StateChangeCallback | callback | ) |
Definition at line 5429 of file steam_integration.cpp.
Referenced by operator=().
| void SteamDownloadMonitor::start | ( | int | pollIntervalMs = 1000 | ) |
Start monitoring Steam downloads.
| pollIntervalMs | How often to check for changes (default: 1000ms) |
Definition at line 5086 of file steam_integration.cpp.
References SteamDownloadMonitor(), and start().
Referenced by getDownloadingGames(), operator=(), and start().
| void SteamDownloadMonitor::stop | ( | ) |
Stop all monitoring.
Definition at line 5091 of file steam_integration.cpp.
Referenced by operator=().
| void SteamDownloadMonitor::unwatchGame | ( | uint32_t | appId | ) |
Remove a game from the watch list.
| appId | Steam App ID to stop monitoring |
Definition at line 5106 of file steam_integration.cpp.
Referenced by operator=().
| void SteamDownloadMonitor::watchGame | ( | uint32_t | appId | ) |
Add a game to the watch list for progress updates.
| appId | Steam App ID to monitor |
Definition at line 5101 of file steam_integration.cpp.
Referenced by operator=().