|
game_launcher 1.1.0
Modern Linux game launcher with Steam / Proton / Wine integration
|
Scans Steam installations to discover games. More...
#include <steam_integration.h>
Classes | |
| struct | SteamPlaytimeData |
| Steam playtime and usage statistics from localconfig.vdf. More... | |
Public Member Functions | |
| SteamLibraryScanner () | |
| Constructor - auto-detects Steam installation. | |
| std::vector< std::filesystem::path > | getLibraryPaths () const |
| Get list of detected Steam library paths. | |
| bool | isSteamInstalled () const |
| Check if Steam is installed on this system. | |
| 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). | |
Static Public Member Functions | |
| static std::string | fetchGameNameFromCache (uint32_t appId) |
| Get game name from pre-loaded cache (instant). | |
| static std::string | fetchGameNameFromSteamAPI (uint32_t appId) |
| Fetch game name from Steam Web API. | |
| static bool | fetchSteamMetadata (uint32_t appId, std::string &outName, std::string &outType, std::vector< std::string > &outGenres, std::vector< std::string > &outCategories) |
| Fetch all Steam metadata in a single API call (OPTIMIZED). | |
| 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). | |
| static bool | forceUninstallGame (uint32_t appId) |
| Force uninstall a Steam game by directly removing files. | |
| static bool | getGameInstallInfo (uint32_t appId, std::string &installDir, std::filesystem::path &libraryPath) |
| Get installation info for a Steam game. | |
| static bool | isAppNameCacheLoaded () |
| Check if app name cache is loaded. | |
| static bool | isSteamRunning () |
| Check if Steam is currently running. | |
| static bool | loadAppNameCache () |
| Load Steam app name cache from GetAppList API. | |
| static std::string | normalizeProtonName (const std::string &display) |
| Strip launcher-side display annotations from a Proton name. | |
| static void | populateDirectLaunchInfo (SteamGame &game) |
| Populate a SteamGame with direct-launch information. | |
| static std::map< uint32_t, CloudSaveInfo > | readAllCloudSaveInfo () |
| Read all cloud save info for all games at once (batch operation). | |
| static std::map< uint32_t, std::vector< std::string > > | readAllUserCategories () |
| Read all user categories for all games at once (batch operation). | |
| static std::vector< DLCInfo > | readDLCFromACF (const std::filesystem::path &acfFilePath, const std::filesystem::path &libraryPath) |
| Read DLC information from appmanifest ACF file. | |
| static CloudSaveInfo | readSteamCloudSaveInfo (uint32_t appId) |
| Read Steam Cloud save information for a game from localconfig.vdf. | |
| static std::string | readSteamLaunchOptions (uint32_t appId) |
| Read Steam launch options for a game from localconfig.vdf. | |
| static std::map< uint32_t, SteamPlaytimeData > | readSteamPlaytimeData () |
| Read Steam playtime statistics for all games from localconfig.vdf. | |
| static std::string | readSteamProtonVersion (uint32_t appId) |
| Read Proton compatibility tool mapping for a game from config.vdf. | |
| static std::vector< std::string > | readSteamUserCategories (uint32_t appId) |
| Read user-defined categories (tags) for a game from localconfig.vdf. | |
| static bool | requestUninstallGame (uint32_t appId) |
| Request Steam to uninstall a game via steam:// protocol. | |
| static std::filesystem::path | resolveProtonPath (uint32_t appId, std::string &outCompatToolName) |
| Resolve Proton executable path for a game. | |
| static bool | restartSteam () |
| Attempt to gracefully restart Steam (blocking). | |
| static std::future< bool > | restartSteamAsync () |
| Attempt to gracefully restart Steam asynchronously. | |
| static std::vector< std::pair< std::string, std::filesystem::path > > | scanProtonVersions () |
| Scan for all installed Proton versions. | |
| static bool | writeSteamLaunchOptions (uint32_t appId, const std::string &launchOptions) |
| Write Steam launch options for a game to localconfig.vdf. | |
| static bool | writeSteamProtonVersion (uint32_t appId, const std::string &protonName) |
| Write Proton compatibility tool mapping for a game to config.vdf. | |
Scans Steam installations to discover games.
Detects Steam library folders and parses all appmanifest files to build a list of installed games.
Definition at line 376 of file steam_integration.h.
| SteamLibraryScanner::SteamLibraryScanner | ( | ) |
Constructor - auto-detects Steam installation.
Definition at line 1039 of file steam_integration.cpp.
Referenced by getGameInstallInfo().
|
static |
Get game name from pre-loaded cache (instant).
| appId | Steam App ID |
Definition at line 2605 of file steam_integration.cpp.
References s_appNameCache, and s_appNameCacheMutex.
Referenced by fetchGameNameFromSteamAPI(), and scanAllOwnedGames().
|
static |
Fetch game name from Steam Web API.
| appId | Steam App ID |
Definition at line 2627 of file steam_integration.cpp.
References Logger::debug(), Logger::error(), fetchGameNameFromCache(), PipeHandle::get(), Logger::info(), and Logger::warn().
|
static |
Fetch all Steam metadata in a single API call (OPTIMIZED).
Fetches name, type, genres, and categories in one network request. Use this instead of separate fetchGameNameFromSteamAPI + fetchSteamMetadata calls.
| appId | Steam App ID |
| outName | Output for game name |
| outType | Output for app type (game/dlc/demo/tool/etc) |
| outGenres | Output for genres list |
| outCategories | Output for categories list |
Definition at line 2737 of file steam_integration.cpp.
References PipeHandle::get(), and Logger::warn().
|
static |
Fetch enhanced metadata from Steam Web API (type, genres, categories).
| appId | Steam App ID |
| outType | Output for app type (game/dlc/demo/tool/etc) |
| outGenres | Output for genres list |
| outCategories | Output for categories list |
Definition at line 2729 of file steam_integration.cpp.
References fetchSteamMetadata().
Referenced by fetchSteamMetadata().
|
static |
Force uninstall a Steam game by directly removing files.
| appId | Steam App ID to uninstall |
This bypasses Steam's confirmation dialog by:
Steam will detect the missing files on next refresh and update its state. Use requestUninstallGame() for the preferred Steam-native uninstall.
Definition at line 4439 of file steam_integration.cpp.
References Logger::error(), getGameInstallInfo(), Logger::info(), and Logger::warn().
Referenced by ContextMenuManager::install().
|
static |
Get installation info for a Steam game.
| appId | Steam App ID | |
| [out] | installDir | Game installation directory name |
| [out] | libraryPath | Library path containing the game |
Definition at line 4347 of file steam_integration.cpp.
References SteamLibraryScanner(), getLibraryPaths(), and readVdfContent().
Referenced by forceUninstallGame().
| std::vector< std::filesystem::path > SteamLibraryScanner::getLibraryPaths | ( | ) | const |
Get list of detected Steam library paths.
Definition at line 1279 of file steam_integration.cpp.
Referenced by SteamDownloadMonitor::getDownloadingGames(), getGameInstallInfo(), SteamDownloadMonitor::readGameState(), and SteamUpdateMonitor::Impl::scanForUpdates().
|
static |
Check if app name cache is loaded.
Definition at line 2617 of file steam_integration.cpp.
References s_appNameCacheLoaded, and s_appNameCacheMutex.
| bool SteamLibraryScanner::isSteamInstalled | ( | ) | const |
Check if Steam is installed on this system.
Definition at line 1284 of file steam_integration.cpp.
Referenced by GameImportDialog::GameImportDialog(), and SteamUpdateMonitor::Impl::scanForUpdates().
|
static |
Check if Steam is currently running.
Definition at line 2872 of file steam_integration.cpp.
References ProcessExecutor::isProcessRunning().
Referenced by restartSteam().
|
static |
Load Steam app name cache from GetAppList API.
Fetches the complete list of Steam app names in ONE request and caches it. Subsequent calls to fetchGameNameFromCache() will be instant.
Definition at line 2464 of file steam_integration.cpp.
References Logger::error(), PipeHandle::get(), SteamPaths::getPrimarySteamRoot(), Logger::info(), loadAppNamesFromLocalCache(), s_appNameCache, s_appNameCacheLoaded, s_appNameCacheMutex, and Logger::warn().
Referenced by MainWindow::MainWindow().
|
static |
Strip launcher-side display annotations from a Proton name.
Converts "proton-cachyos-slr (system)" -> "proton-cachyos-slr" so the value can be compared against / written to Steam's CompatToolMapping (which uses bare tool directory names). Returns empty string for Steam-managed sentinels ("Native Linux", "Proton (Steam-managed)", "Proton") — caller should treat empty as "leave Steam's mapping alone".
Definition at line 3517 of file steam_integration.cpp.
Referenced by writeSteamProtonVersion().
|
static |
Populate a SteamGame with direct-launch information.
Reads appinfo.vdf to find the game executable and resolves the Proton path. This enables direct Proton launching instead of steam -applaunch.
| game | SteamGame to populate (modified in place) |
Definition at line 3424 of file steam_integration.cpp.
References SteamGame::appId, SteamGame::compatToolName, SteamGame::gameArguments, SteamGame::gameExecutable, SteamPaths::getPrimarySteamRoot(), SteamGame::isProtonGame, SteamAppInfoParser::load(), SteamGame::protonPath, resolveProtonPath(), SteamGame::steamType, and Logger::warn().
|
static |
Read all cloud save info for all games at once (batch operation).
More efficient than calling readSteamCloudSaveInfo() for each game individually. Parses localconfig.vdf once and extracts all cloud save data.
Definition at line 4187 of file steam_integration.cpp.
References findVdfSectionEnd(), getActiveUserId(), SteamPaths::getPrimarySteamRoot(), readSteamCloudSaveInfo(), readVdfContent(), and CloudSaveInfo::supported.
Referenced by scanAllLibraries().
|
static |
Read all user categories for all games at once (batch operation).
More efficient than calling readSteamUserCategories() for each game individually.
Definition at line 4265 of file steam_integration.cpp.
References findVdfSectionEnd(), getActiveUserId(), SteamPaths::getPrimarySteamRoot(), readSteamUserCategories(), and readVdfContent().
Referenced by scanAllLibraries().
|
static |
Read DLC information from appmanifest ACF file.
| acfFilePath | Path to appmanifest_*.acf file |
| libraryPath | Steam library root path |
Parses InstalledDepots section to detect DLC: "InstalledDepots" -> "[DepotID]" -> "manifest", "size", etc.
Definition at line 4069 of file steam_integration.cpp.
References DLCInfo::appId, Logger::error(), DLCInfo::installed, DLCInfo::name, readVdfContent(), and DLCInfo::sizeBytes.
|
static |
Read Steam Cloud save information for a game from localconfig.vdf.
| appId | Steam App ID |
Parses the Cloud section from localconfig.vdf: "Apps" -> "[AppID]" -> "Cloud" -> "cloud", "cloudenabled", "lastsyncstate", etc.
Definition at line 3794 of file steam_integration.cpp.
References Logger::debug(), CloudSaveInfo::enabled, Logger::error(), findVdfSectionEnd(), getActiveUserId(), SteamPaths::getPrimarySteamRoot(), CloudSaveInfo::lastSyncState, CloudSaveInfo::lastSyncTime, readVdfContent(), CloudSaveInfo::storageBytes, CloudSaveInfo::supported, and Logger::warn().
Referenced by readAllCloudSaveInfo().
|
static |
Read Steam launch options for a game from localconfig.vdf.
| appId | Steam App ID |
Definition at line 1517 of file steam_integration.cpp.
References Logger::error(), and SteamPaths::getPrimarySteamRoot().
Referenced by SteamGame::toGame().
|
static |
Read Steam playtime statistics for all games from localconfig.vdf.
Definition at line 2139 of file steam_integration.cpp.
References Logger::error(), SteamPaths::getPrimarySteamRoot(), SteamLibraryScanner::SteamPlaytimeData::lastExit, SteamLibraryScanner::SteamPlaytimeData::lastLaunch, SteamLibraryScanner::SteamPlaytimeData::lastPlayed, SteamLibraryScanner::SteamPlaytimeData::playtime2Weeks, SteamLibraryScanner::SteamPlaytimeData::playtimeMinutes, and readVdfContent().
Referenced by scanAllLibraries(), and scanAllOwnedGames().
|
static |
Read Proton compatibility tool mapping for a game from config.vdf.
| appId | Steam App ID |
Definition at line 3162 of file steam_integration.cpp.
References Logger::error(), and SteamPaths::getPrimarySteamRoot().
Referenced by resolveProtonPath().
|
static |
Read user-defined categories (tags) for a game from localconfig.vdf.
| appId | Steam App ID |
Parses the tags section from localconfig.vdf: "Apps" -> "[AppID]" -> "tags" -> "0" "Category1", "1" "Category2", etc.
Definition at line 3964 of file steam_integration.cpp.
References findVdfSectionEnd(), getActiveUserId(), SteamPaths::getPrimarySteamRoot(), and readVdfContent().
Referenced by readAllUserCategories().
|
static |
Request Steam to uninstall a game via steam:// protocol.
| appId | Steam App ID to uninstall |
This opens Steam's uninstall dialog for the game, allowing the user to confirm the uninstall through Steam's native interface. Steam will handle removing game files and updating its internal state.
Definition at line 4393 of file steam_integration.cpp.
References Logger::error(), and Logger::info().
|
static |
Resolve Proton executable path for a game.
Checks the user's CompatToolMapping for explicit per-game Proton config, then falls back to the best available installed Proton version.
| appId | Steam App ID | |
| [out] | outCompatToolName | Raw compat tool name from config (e.g., "proton_experimental") |
Definition at line 3263 of file steam_integration.cpp.
References Logger::info(), readSteamProtonVersion(), scanProtonVersions(), and Logger::warn().
Referenced by populateDirectLaunchInfo().
|
static |
Attempt to gracefully restart Steam (blocking).
Definition at line 2877 of file steam_integration.cpp.
References Logger::error(), ProcessExecutor::execute(), ProcessExecutor::executeBackground(), Logger::info(), isSteamRunning(), and ProcessResult::success.
Referenced by restartSteamAsync().
|
static |
Attempt to gracefully restart Steam asynchronously.
Definition at line 2918 of file steam_integration.cpp.
References restartSteam().
| std::vector< SteamGame > SteamLibraryScanner::scanAllLibraries | ( | ) |
Scan all Steam libraries for installed games.
Definition at line 1050 of file steam_integration.cpp.
References SteamLibraryScanner::SteamPlaytimeData::lastExit, SteamLibraryScanner::SteamPlaytimeData::lastLaunch, SteamLibraryScanner::SteamPlaytimeData::lastPlayed, SteamLibraryScanner::SteamPlaytimeData::playtime2Weeks, SteamLibraryScanner::SteamPlaytimeData::playtimeMinutes, readAllCloudSaveInfo(), readAllUserCategories(), and readSteamPlaytimeData().
Referenced by scanAllOwnedGames().
| std::vector< SteamGame > SteamLibraryScanner::scanAllOwnedGames | ( | ) |
Scan for all owned Steam games (installed and not installed).
This method:
Definition at line 1101 of file steam_integration.cpp.
References SteamGame::appId, fetchGameNameFromCache(), SteamGame::gamePath, SteamPaths::getPrimarySteamRoot(), SteamPaths::getUserDataDirectory(), Logger::info(), SteamGame::installDir, SteamGame::isInstalled, SteamLibraryScanner::SteamPlaytimeData::lastExit, SteamLibraryScanner::SteamPlaytimeData::lastLaunch, SteamLibraryScanner::SteamPlaytimeData::lastPlayed, SteamGame::lastUpdated, SteamGame::libraryPath, SteamGame::name, SteamLibraryScanner::SteamPlaytimeData::playtime2Weeks, SteamLibraryScanner::SteamPlaytimeData::playtimeMinutes, readSteamPlaytimeData(), readVdfContent(), scanAllLibraries(), SteamGame::sizeOnDisk, SteamGame::steamLastExit, SteamGame::steamLastLaunch, SteamGame::steamLastPlayed, SteamGame::steamPlaytime2Weeks, and SteamGame::steamPlaytimeMinutes.
|
static |
Scan for all installed Proton versions.
Definition at line 2928 of file steam_integration.cpp.
References SteamConstants::COMMON_DIR, SteamConstants::COMPAT_TOOLS_DIR, SteamConstants::CONFIG_DIR, SteamPaths::getAllSteamRoots(), SteamPaths::getPrimarySteamRoot(), Logger::info(), SteamConstants::LIBRARY_FOLDERS_VDF, and SteamConstants::STEAMAPPS_DIR.
Referenced by resolveProtonPath().
|
static |
Write Steam launch options for a game to localconfig.vdf.
| appId | Steam App ID |
| launchOptions | Launch options string to write |
Definition at line 1918 of file steam_integration.cpp.
References Logger::error(), SteamPaths::getPrimarySteamRoot(), Logger::info(), vdfEscapeValue(), and Logger::warn().
|
static |
Write Proton compatibility tool mapping for a game to config.vdf.
| appId | Steam App ID |
| protonName | Name of the Proton version (e.g., "proton-cachyos-10.0-20251120-slr-x86_64") |
The name is normalised via normalizeProtonName() before writing — the launcher's runner picker stores display strings (with " (system)", " (Steam-managed)", etc. annotations) but Steam looks up tools by bare directory name. Writing an annotated string causes Steam to silently fall back to no compat tool.
Definition at line 3559 of file steam_integration.cpp.
References Logger::error(), SteamPaths::getPrimarySteamRoot(), Logger::info(), normalizeProtonName(), SteamConstants::VDF_BACKUP_SUFFIX, vdfEscapeValue(), and Logger::warn().