113 static const std::vector<std::string>& cdnHosts();
116 static std::string getCacheFilename(
ImageType type);
338 static std::optional<SteamGame>
parseManifest(
const std::filesystem::path& acfFilePath,
339 const std::filesystem::path& libraryPath);
349 const std::filesystem::path& libraryPath);
357 static std::map<std::string, std::string> parseKeyValues(
const std::string& content);
362 static std::string extractQuotedValue(
const std::string& line);
444 static std::vector<std::pair<std::string, std::filesystem::path>>
scanProtonVersions();
489 static std::filesystem::path
resolveProtonPath(uint32_t appId, std::string& outCompatToolName);
545 std::vector<std::string>& outGenres,
546 std::vector<std::string>& outCategories);
561 static bool fetchSteamMetadata(uint32_t appId, std::string& outName, std::string& outType,
562 std::vector<std::string>& outGenres,
563 std::vector<std::string>& outCategories);
616 static std::vector<DLCInfo>
readDLCFromACF(
const std::filesystem::path& acfFilePath,
617 const std::filesystem::path& libraryPath);
670 std::filesystem::path& libraryPath);
677 std::filesystem::path detectSteamPath();
684 std::vector<std::filesystem::path> parseLibraryFolders(
const std::filesystem::path& steamPath);
691 std::vector<SteamGame> scanLibrary(
const std::filesystem::path& libraryPath);
698 static bool isFileLocked(
const std::filesystem::path& filePath);
705 static bool validateVDFFile(
const std::filesystem::path& filePath);
714 static bool writeVDFFileWithRetry(
const std::filesystem::path& filePath,
715 const std::vector<std::string>& lines,
716 const std::filesystem::path& backupPath);
718 std::filesystem::path steamPath_;
719 std::vector<std::filesystem::path> libraries_;
802 return "Uninstalling";
804 return "Downloading";
810 return "Update Available";
812 return "Configuring";
884 auto now = std::chrono::steady_clock::now();
888 std::chrono::duration_cast<std::chrono::milliseconds>(now -
lastSpeedUpdate)
894 static_cast<double>(bytesTransferred) * 1000.0 /
static_cast<double>(elapsed);
896 else if (elapsed > 2000)
919 snprintf(buf,
sizeof(buf),
"%.1f KB/s", kbps);
926 snprintf(buf,
sizeof(buf),
"%.1f MB/s", mbps);
966 std::function<void(uint32_t appId, uint32_t oldState, uint32_t newState)>;
987 void start(
int pollIntervalMs = 1000);
1070 std::unique_ptr<
Impl> impl_;
1119 std::function<void(uint32_t appId,
const std::string& gameName)>;
1136 void start(
int scanIntervalSeconds = 300);
1152 std::vector<SteamGameUpdateInfo>
scanNow();
1193 std::unique_ptr<Impl> impl_;
Parser for Steam's KeyValues format ACF manifest files.
static std::optional< SteamGame > parseManifest(const std::filesystem::path &acfFilePath, const std::filesystem::path &libraryPath)
Parse ACF file to extract game metadata.
static std::string detectProtonVersion(uint32_t appId, const std::filesystem::path &libraryPath)
Detect Proton version for a Steam game from appmanifest UserConfig.
Complete representation of a game in the library.
Helper class for discovering and accessing Steam game images.
static std::string getCDNUrl(uint32_t appId, ImageType type)
Build CDN URL for a specific image type.
static bool downloadImage(uint32_t appId, ImageType type, const std::string &outputPath)
Download image from Steam CDN (fallback only).
static GameImagePaths discoverImages(uint32_t appId, const std::filesystem::path &steamRoot)
Find all available images for a Steam game.
static std::filesystem::path getLibraryCachePath(const std::filesystem::path &steamRoot)
Get path to Steam's library cache directory.
void setOnStateChange(StateChangeCallback callback)
void stop()
Stop all monitoring.
static std::vector< uint32_t > getDownloadingGames()
Get list of all games currently downloading.
std::function< void(uint32_t appId, uint32_t oldState, uint32_t newState)> StateChangeCallback
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.
SteamDownloadMonitor & operator=(const SteamDownloadMonitor &)=delete
SteamDownloadMonitor(const SteamDownloadMonitor &)=delete
std::function< void(uint32_t appId, int pid)> GameLaunchCallback
void setOnGameExit(GameExitCallback callback)
void start(int pollIntervalMs=1000)
Start monitoring Steam downloads.
std::function< void(uint32_t appId)> GameExitCallback
bool isRunning() const
Check if monitor is running.
void watchGame(uint32_t appId)
Add a game to the watch list for progress updates.
static SteamDownloadProgress readGameState(uint32_t appId)
Read current state of a game directly from its appmanifest.
std::function< void(uint32_t appId, const SteamDownloadProgress &progress)> ProgressCallback
void setOnProgressUpdate(ProgressCallback callback)
void unwatchGame(uint32_t appId)
Remove a game from the watch list.
void setOnGameLaunch(GameLaunchCallback callback)
std::vector< uint32_t > getWatchedGames() const
Get list of currently watched game IDs.
SteamDownloadMonitor(SteamDownloadMonitor &&) noexcept
SteamDownloadProgress getProgress(uint32_t appId) const
Get current progress for a game (immediate snapshot).
Builds Steam game launch commands with CachyOS optimizations.
static std::string buildSteamURI(uint32_t appId)
Build Steam launch URI.
static std::string buildLaunchCommand(const Game &game, const CachyOSGameConfig &config)
Build launch command for Steam game.
bool isSteamInstalled() const
Check if Steam is installed on this system.
static CloudSaveInfo readSteamCloudSaveInfo(uint32_t appId)
Read Steam Cloud save information for a game from localconfig.vdf.
static std::vector< std::pair< std::string, std::filesystem::path > > scanProtonVersions()
Scan for all installed Proton versions.
static std::map< uint32_t, SteamPlaytimeData > readSteamPlaytimeData()
Read Steam playtime statistics for all games from localconfig.vdf.
static std::string normalizeProtonName(const std::string &display)
Strip launcher-side display annotations from a Proton name.
static std::vector< DLCInfo > readDLCFromACF(const std::filesystem::path &acfFilePath, const std::filesystem::path &libraryPath)
Read DLC information from appmanifest ACF file.
static std::string fetchGameNameFromCache(uint32_t appId)
Get game name from pre-loaded cache (instant).
static bool restartSteam()
Attempt to gracefully restart Steam (blocking).
static bool loadAppNameCache()
Load Steam app name cache from GetAppList API.
static std::map< uint32_t, std::vector< std::string > > readAllUserCategories()
Read all user categories for all games at once (batch operation).
static std::string fetchGameNameFromSteamAPI(uint32_t appId)
Fetch game name from Steam Web API.
static bool isAppNameCacheLoaded()
Check if app name cache is loaded.
static bool requestUninstallGame(uint32_t appId)
Request Steam to uninstall a game via steam:// protocol.
static bool forceUninstallGame(uint32_t appId)
Force uninstall a Steam game by directly removing files.
static bool writeSteamProtonVersion(uint32_t appId, const std::string &protonName)
Write Proton compatibility tool mapping for a game to config.vdf.
static std::future< bool > restartSteamAsync()
Attempt to gracefully restart Steam asynchronously.
static bool getGameInstallInfo(uint32_t appId, std::string &installDir, std::filesystem::path &libraryPath)
Get installation info for a Steam game.
std::vector< SteamGame > scanAllLibraries()
Scan all Steam libraries for installed games.
std::vector< SteamGame > scanAllOwnedGames()
Scan for all owned Steam games (installed and not installed).
std::vector< std::filesystem::path > getLibraryPaths() const
Get list of detected Steam library paths.
static std::string readSteamProtonVersion(uint32_t appId)
Read Proton compatibility tool mapping for a game from config.vdf.
static bool isSteamRunning()
Check if Steam is currently running.
static std::filesystem::path resolveProtonPath(uint32_t appId, std::string &outCompatToolName)
Resolve Proton executable path for a game.
static std::map< uint32_t, CloudSaveInfo > readAllCloudSaveInfo()
Read all cloud save info for all games at once (batch operation).
static void populateDirectLaunchInfo(SteamGame &game)
Populate a SteamGame with direct-launch information.
static bool writeSteamLaunchOptions(uint32_t appId, const std::string &launchOptions)
Write Steam launch options for a game to localconfig.vdf.
static std::vector< std::string > readSteamUserCategories(uint32_t appId)
Read user-defined categories (tags) for a game from localconfig.vdf.
static std::string readSteamLaunchOptions(uint32_t appId)
Read Steam launch options for a game from localconfig.vdf.
SteamLibraryScanner()
Constructor - auto-detects Steam installation.
static bool fetchSteamMetadata(uint32_t appId, std::string &outType, std::vector< std::string > &outGenres, std::vector< std::string > &outCategories)
Fetch enhanced metadata from Steam Web API (type, genres, categories).
void clearCache()
Clear cached update states (force fresh detection).
static SteamUpdateMonitor & instance()
void setOnUpdateCompleted(UpdateCompletedCallback callback)
Set callback for when an update completes.
SteamUpdateMonitor & operator=(const SteamUpdateMonitor &)=delete
void setOnUpdateStarted(UpdateStartedCallback callback)
Set callback for when an update starts downloading.
void setOnUpdateAvailable(UpdateAvailableCallback callback)
Set callback for when a new update is detected.
SteamUpdateMonitor(const SteamUpdateMonitor &)=delete
bool isRunning() const
Check if monitor is running.
void stop()
Stop monitoring.
std::function< void(uint32_t appId, const std::string &gameName)> UpdateCompletedCallback
std::function< void(const SteamGameUpdateInfo &info)> UpdateStartedCallback
std::vector< SteamGameUpdateInfo > scanNow()
Force an immediate scan for updates.
size_t getUpdateCount() const
Get count of games needing updates.
std::vector< SteamGameUpdateInfo > getGamesNeedingUpdate() const
Get all games currently needing updates.
void start(int scanIntervalSeconds=300)
Start monitoring for updates.
std::function< void(const SteamGameUpdateInfo &info)> UpdateAvailableCallback
ImageType
Types of game images available.
Steam StateFlags bitfield values from appmanifest ACF files.
std::string getStateDescription(uint32_t flags)
Get human-readable state description.
bool isFullyInstalled(uint32_t flags)
Check if a game is fully installed.
constexpr uint32_t Preallocating
Pre-allocating disk space.
constexpr uint32_t Downloading
Currently downloading.
bool needsUpdate(uint32_t flags)
Check if a game needs an update.
constexpr uint32_t UpdateStarted
Update in progress (Downloading | UpdateRequired).
constexpr uint32_t Uninstalling
Being uninstalled.
constexpr uint32_t UpdateRequired
Update available (not yet started).
bool isDownloading(uint32_t flags)
Check if a game is currently downloading or updating.
constexpr uint32_t Reconfiguring
Reconfiguring after update.
constexpr uint32_t Staging
Staging files after download.
constexpr uint32_t FullyInstalled
Game is fully installed and playable.
ProtonVersion
Available Proton compatibility layer versions.
@ Proton8
Official Proton 8.0.
@ ProtonCachyOS
proton-cachyos (native, no SLR)
@ ProtonGE
Proton GE (community).
@ ProtonCachyOSSLR
proton-cachyos-slr (recommended for anti-cheat)
@ NativeLinux
Native Linux build (no Proton).
@ Proton9
Official Proton 9.0.
@ ProtonExperimental
Official Proton Experimental.
@ SystemDefault
Use Steam's default selection.
std::string getProtonVersionCommand(ProtonVersion version)
Get command/path for Proton version.
const char * getProtonVersionName(ProtonVersion version)
Get human-readable name for Proton version.
CachyOS-specific gaming configuration options.
std::string radvPerftest
RADV_PERFTEST (comma-separated, e.g., "rt,nggc,sam").
bool nvidia4000Fix
PROTON_NVIDIA_LIBS_NO_32BIT (RTX 4000+).
bool useLocalShaderCache
__GL_SHADER_DISK_CACHE=1 (NVIDIA shader cache)
bool enableWayland
PROTON_ENABLE_WAYLAND (experimental, breaks overlay).
bool enableMangoHud
MANGOHUD=1 (performance overlay).
bool enableFSR
WINE_FULLSCREEN_FSR=1 (AMD upscaling).
bool enableDLSSIndicator
PROTON_DLSS_INDICATOR (show DLSS status).
bool useGamePerformanceWrapper
Use game-performance CPU governor wrapper.
bool enableFSR4Upgrade
PROTON_FSR4_UPGRADE (AMD upscaling v4).
bool skipShaderCacheCleanup
__GL_SHADER_DISK_CACHE_SKIP_CLEANUP (NVIDIA)
bool enableGamescope
ENABLE_GAMESCOPE (microcompositor).
bool disableSteamInput
PROTON_NO_STEAMINPUT (disable Steam Input).
bool enableDXVKHDR
DXVK_HDR=1 (DXVK HDR support).
bool enableProtonLog
PROTON_LOG=1 (verbose logging).
bool enableDLSSUpgrade
PROTON_DLSS_UPGRADE (auto-upgrade DLSS).
bool useNTSync
PROTON_USE_NTSYNC=1 (GE-Proton auto-enables).
bool useDXVKAsync
DXVK_ASYNC=1 (async shader compilation).
bool enableFSR4RDNA3Upgrade
PROTON_FSR4_RDNA3_UPGRADE (AMD RDNA3 optimized upscaling).
bool enableNvidiaLibs
PROTON_NVIDIA_LIBS (PhysX/CUDA support).
bool enableXeSSUpgrade
PROTON_XESS_UPGRADE (Intel Arc upscaling).
std::string protonVerb
PROTON_VERB (e.g., "waitforexitandrun").
bool fixStuttering
LD_PRELOAD="" (disables Steam overlay).
std::string buildEnvVars() const
Build environment variable string for launch.
bool preferSDL
PROTON_PREFER_SDL (controller detection workaround).
bool enableHDR
PROTON_ENABLE_HDR (requires Gamescope/Wayland).
bool enableDXVKHud
DXVK_HUD=compiler (show shader compilation).
Information about Steam Cloud save synchronization.
Paths to various game image assets.
Parsed components from Steam launch options string.
bool isEmpty() const
Check if launch options string is empty or only whitespace.
std::vector< std::string > wrappers
Wrapper commands (e.g., game-performance, mangohud).
static ParsedSteamLaunchOptions parse(const std::string &launchOptions)
Parse Steam launch options string.
std::vector< std::string > gameArguments
Arguments after command%.
std::map< std::string, std::string > environmentVariables
Environment variables (KEY=VALUE).
std::string rawString
Original launch options string.
Real-time download/installation progress for a Steam game.
uint64_t bytesToStage
Total bytes to stage.
std::string stateDescription
Human-readable state.
std::string getFormattedSpeed() const
Get formatted download speed string.
uint32_t appId
Steam App ID.
std::chrono::steady_clock::time_point lastSpeedUpdate
Time of last speed update.
bool isError
Error occurred.
uint64_t bytesToDownload
Total bytes to download.
uint64_t lastBytesDownloaded
Previous bytes downloaded for speed calc.
uint64_t bytesStaged
Bytes staged for installation.
double downloadProgress
Download progress (0.0 to 1.0).
double downloadSpeedBytesPerSec
Current download speed in bytes/sec.
double stageProgress
Staging progress (0.0 to 1.0).
void calculateProgress()
Calculate progress percentages from byte values.
void updateSpeed()
Update download speed calculation Should be called periodically with new progress data.
uint64_t bytesDownloaded
Bytes downloaded so far.
bool isComplete
Installation complete.
int queuePosition
Position in download queue (0 = active, 1+ = queued).
uint32_t stateFlags
Current StateFlags.
double overallProgress
Combined progress (0.0 to 1.0).
Information about a game's update status.
Metadata for a Steam game parsed from appmanifest ACF file.
std::string downloadCoverArt(const std::string &coverArtDir) const
Download cover art from Steam CDN.
std::filesystem::path libraryPath
Steam library root path.
uint64_t bytesDownloaded
Bytes downloaded so far.
std::string installDir
Installation directory name.
std::string gameExecutable
Game exe relative to install dir (e.g., "FSD.exe").
time_t steamLastExit
Last exit timestamp from Steam autocloud.
std::string steamType
App type: "game", "dlc", "demo", "tool", "music", etc.
std::string name
Game name.
time_t steamLastPlayed
Last played timestamp from Steam.
bool isInstalled
True if game is installed (has appmanifest), false if owned but not installed.
std::vector< std::string > genres
Game genres from Steam API.
std::vector< DLCInfo > dlc
Installed DLC for this game.
uint32_t steamPlaytime2Weeks
Playtime in last 2 weeks (in minutes).
std::vector< std::string > categories
Steam categories (Single-player, Multi-player, etc.).
uint32_t steamPlaytimeMinutes
Total playtime from Steam (in minutes).
bool metadataFetched
Whether API metadata has been fetched.
bool isProtonGame
Requires Proton (Windows game).
time_t steamLastLaunch
Last launch timestamp from Steam autocloud.
std::filesystem::path gamePath
Full path to game directory.
Game toGame() const
Convert SteamGame to Game object for library.
std::vector< std::string > steamUserCategories
User-defined categories/tags from Steam.
uint32_t appId
Steam App ID.
uint32_t stateFlags
Steam StateFlags from appmanifest.
bool isUpdatePending
Update available but not yet started.
CloudSaveInfo cloudSave
Steam Cloud save information.
time_t lastUpdated
Last update timestamp.
std::string steamBuildId
Steam build ID from appmanifest.
bool isDownloading
Currently downloading/updating.
uint64_t bytesToStage
Total bytes to stage.
std::string compatToolName
Raw compat tool name from Steam config (e.g., "proton_experimental").
uint64_t bytesToDownload
Total bytes to download.
std::string protonVersion
Detected Proton/compatibility tool version from Steam.
std::string gameArguments
Default launch arguments from Steam (e.g., "-nohmd").
uint64_t bytesStaged
Bytes staged for installation.
uint64_t sizeOnDisk
Installation size in bytes.
std::filesystem::path protonPath
Resolved path to proton executable.
Steam playtime and usage statistics from localconfig.vdf.