|
game_launcher 1.1.0
Modern Linux game launcher with Steam / Proton / Wine integration
|
Service for integrating with Epic Games through Legendary CLI. More...
#include <legendary_integration.h>
Classes | |
| struct | Impl |
Public Types | |
| using | AuthCallback = std::function<void(bool success, const std::string& message)> |
| using | ProgressCallback = std::function<void(const LegendaryProgress&)> |
Public Member Functions | |
| LegendaryIntegration () | |
| ~LegendaryIntegration () | |
| void | authenticate (const AuthCallback &callback=nullptr) |
| Start authentication flow. | |
| void | authenticateWithCode (const std::string &authCode, const AuthCallback &callback=nullptr) |
| Start authentication with authorization code. | |
| void | cancelOperation () |
| Cancel ongoing operation. | |
| bool | downloadCloudSaves (const std::string &appName, bool force=false) |
| Download cloud saves for a game. | |
| EpicAuthStatus | getAuthStatus () const |
| Check authentication status. | |
| std::vector< EpicGameInfo > | getAvailableDLC (const std::string &appName) |
| Get available DLC for a game. | |
| EpicCloudSaveInfo | getCloudSaveStatus (const std::string &appName) const |
| Get cloud save status for a game. | |
| std::filesystem::path | getDefaultInstallPath () const |
| Get default installation directory. | |
| std::optional< EpicGameInfo > | getGameInfo (const std::string &appName) const |
| Get info for a specific game. | |
| std::vector< EpicGameInfo > | getInstalledGames () const |
| Get all installed games. | |
| std::string | getLaunchCommand (const std::string &appName, const std::vector< std::string > &additionalArgs={}, bool offline=false) const |
| Get launch command for a game. | |
| std::vector< EpicGameInfo > | getLibrary (bool forceRefresh=false) |
| Get all games in Epic library. | |
| bool | importGame (const std::string &appName, const std::filesystem::path &existingPath) |
| Import an existing game installation. | |
| bool | installDLC (const std::string &dlcAppName, const ProgressCallback &progressCallback=nullptr) |
| Install DLC for a game. | |
| bool | installGame (const std::string &appName, const std::filesystem::path &installPath={}, const ProgressCallback &progressCallback=nullptr) |
| Install a game. | |
| std::future< bool > | installGameAsync (const std::string &appName, const std::filesystem::path &installPath={}, const ProgressCallback &progressCallback=nullptr) |
| Install a game asynchronously. | |
| bool | isAuthenticated () const |
| Check if user is authenticated. | |
| bool | launchGame (const std::string &appName, const std::vector< std::string > &additionalArgs={}, bool offline=false, pid_t *outPid=nullptr) |
| Launch a game. | |
| void | logout () |
| Log out and clear credentials. | |
| bool | moveGame (const std::string &appName, const std::filesystem::path &newPath, const ProgressCallback &progressCallback=nullptr) |
| Move game to different location. | |
| bool | repairGame (const std::string &appName, const ProgressCallback &progressCallback=nullptr) |
| Repair game (verify and redownload corrupt files). | |
| void | setAutoSyncSaves (bool enabled) |
| Enable/disable automatic cloud save sync. | |
| void | setDefaultInstallPath (const std::filesystem::path &path) |
| Set default installation directory. | |
| void | setMaxWorkers (int workers) |
| Set maximum download workers. | |
| bool | syncCloudSaves (const std::string &appName) |
| Sync saves (download if newer, upload if local is newer). | |
| int | syncLibrary () |
| Sync Epic library with game database. | |
| Game | toGame (const EpicGameInfo &epicGame) const |
| Convert Epic game to generic Game object. | |
| bool | uninstallGame (const std::string &appName, bool keepFiles=false) |
| Uninstall a game. | |
| bool | updateGame (const std::string &appName, const ProgressCallback &progressCallback=nullptr) |
| Update a game. | |
| bool | uploadCloudSaves (const std::string &appName, bool force=false) |
| Upload local saves to cloud. | |
| bool | verifyGame (const std::string &appName, const ProgressCallback &progressCallback=nullptr) |
| Verify game files. | |
Static Public Member Functions | |
| static std::filesystem::path | getLegendaryPath () |
| Get path to Legendary executable. | |
| static std::string | getVersion () |
| Get Legendary version. | |
| static bool | isAvailable () |
| Check if Legendary CLI is installed. | |
Service for integrating with Epic Games through Legendary CLI.
Provides methods for managing Epic Games library, installation, and cloud saves through the Legendary CLI tool.
Definition at line 167 of file legendary_integration.h.
| using LegendaryIntegration::AuthCallback = std::function<void(bool success, const std::string& message)> |
Definition at line 171 of file legendary_integration.h.
| using LegendaryIntegration::ProgressCallback = std::function<void(const LegendaryProgress&)> |
Definition at line 170 of file legendary_integration.h.
| LegendaryIntegration::LegendaryIntegration | ( | ) |
Definition at line 161 of file legendary_integration.cpp.
References getAuthStatus(), and isAvailable().
| LegendaryIntegration::~LegendaryIntegration | ( | ) |
Definition at line 170 of file legendary_integration.cpp.
| void LegendaryIntegration::authenticate | ( | const AuthCallback & | callback = nullptr | ) |
Start authentication flow.
| callback | Callback when auth completes |
Opens browser for Epic Games login. The callback is called when authentication completes (success or failure).
Definition at line 442 of file legendary_integration.cpp.
References EpicAuthStatus::accountId, EpicAuthStatus::displayName, and EpicAuthStatus::isAuthenticated.
| void LegendaryIntegration::authenticateWithCode | ( | const std::string & | authCode, |
| const AuthCallback & | callback = nullptr ) |
Start authentication with authorization code.
| authCode | Authorization code from Epic login |
| callback | Callback when auth completes |
Definition at line 509 of file legendary_integration.cpp.
References EpicAuthStatus::accountId, EpicAuthStatus::displayName, ShellUtils::escapeArg(), and EpicAuthStatus::isAuthenticated.
| void LegendaryIntegration::cancelOperation | ( | ) |
Cancel ongoing operation.
Definition at line 1203 of file legendary_integration.cpp.
| bool LegendaryIntegration::downloadCloudSaves | ( | const std::string & | appName, |
| bool | force = false ) |
Download cloud saves for a game.
| appName | App name/ID |
| force | Force overwrite local saves |
Definition at line 1045 of file legendary_integration.cpp.
References Logger::info().
| EpicAuthStatus LegendaryIntegration::getAuthStatus | ( | ) | const |
Check authentication status.
Definition at line 401 of file legendary_integration.cpp.
References EpicAuthStatus::accountId, EpicAuthStatus::displayName, and EpicAuthStatus::isAuthenticated.
Referenced by LegendaryIntegration(), and isAuthenticated().
| std::vector< EpicGameInfo > LegendaryIntegration::getAvailableDLC | ( | const std::string & | appName | ) |
Get available DLC for a game.
| appName | Base game app name |
Definition at line 1002 of file legendary_integration.cpp.
References EpicGameInfo::baseGameAppName, getLibrary(), and EpicGameInfo::isDLC.
| EpicCloudSaveInfo LegendaryIntegration::getCloudSaveStatus | ( | const std::string & | appName | ) | const |
Get cloud save status for a game.
| appName | App name/ID |
Definition at line 1028 of file legendary_integration.cpp.
References EpicCloudSaveInfo::appName.
| fs::path LegendaryIntegration::getDefaultInstallPath | ( | ) | const |
Get default installation directory.
Definition at line 1185 of file legendary_integration.cpp.
| std::optional< EpicGameInfo > LegendaryIntegration::getGameInfo | ( | const std::string & | appName | ) | const |
Get info for a specific game.
| appName | App name/ID |
Definition at line 765 of file legendary_integration.cpp.
References EpicGameInfo::appName, EpicGameInfo::appTitle, EpicGameInfo::developer, EpicGameInfo::downloadSize, Logger::error(), EpicGameInfo::installPath, EpicGameInfo::installSize, EpicGameInfo::isInstalled, and EpicGameInfo::version.
| std::vector< EpicGameInfo > LegendaryIntegration::getInstalledGames | ( | ) | const |
Get all installed games.
Definition at line 726 of file legendary_integration.cpp.
References EpicGameInfo::appName, EpicGameInfo::appTitle, Logger::error(), EpicGameInfo::installPath, EpicGameInfo::installSize, EpicGameInfo::isInstalled, and EpicGameInfo::version.
| std::string LegendaryIntegration::getLaunchCommand | ( | const std::string & | appName, |
| const std::vector< std::string > & | additionalArgs = {}, | ||
| bool | offline = false ) const |
Get launch command for a game.
| appName | App name/ID |
| additionalArgs | Additional arguments |
| offline | Offline mode |
Definition at line 1156 of file legendary_integration.cpp.
|
static |
Get path to Legendary executable.
Definition at line 230 of file legendary_integration.cpp.
Referenced by isAvailable(), and launchGame().
| std::vector< EpicGameInfo > LegendaryIntegration::getLibrary | ( | bool | forceRefresh = false | ) |
Get all games in Epic library.
| forceRefresh | Force refresh from Epic servers |
Definition at line 694 of file legendary_integration.cpp.
References Logger::info(), and LegendaryIntegration::Impl::LIBRARY_CACHE_VALIDITY_SEC.
Referenced by getAvailableDLC(), and syncLibrary().
|
static |
Get Legendary version.
Definition at line 197 of file legendary_integration.cpp.
References isAvailable().
| bool LegendaryIntegration::importGame | ( | const std::string & | appName, |
| const std::filesystem::path & | existingPath ) |
Import an existing game installation.
| appName | App name/ID |
| existingPath | Path to existing installation |
Definition at line 988 of file legendary_integration.cpp.
References Logger::info().
| bool LegendaryIntegration::installDLC | ( | const std::string & | dlcAppName, |
| const ProgressCallback & | progressCallback = nullptr ) |
Install DLC for a game.
| dlcAppName | DLC app name |
| progressCallback | Progress updates |
Definition at line 1018 of file legendary_integration.cpp.
References installGame().
| bool LegendaryIntegration::installGame | ( | const std::string & | appName, |
| const std::filesystem::path & | installPath = {}, | ||
| const ProgressCallback & | progressCallback = nullptr ) |
Install a game.
| appName | App name/ID |
| installPath | Installation path (empty = default) |
| progressCallback | Progress updates |
Definition at line 843 of file legendary_integration.cpp.
References LegendaryProgress::Completed, LegendaryProgress::Failed, Logger::info(), LegendaryProgress::percentComplete, LegendaryProgress::Starting, and LegendaryProgress::state.
Referenced by installDLC(), and installGameAsync().
| std::future< bool > LegendaryIntegration::installGameAsync | ( | const std::string & | appName, |
| const std::filesystem::path & | installPath = {}, | ||
| const ProgressCallback & | progressCallback = nullptr ) |
Install a game asynchronously.
Definition at line 881 of file legendary_integration.cpp.
References installGame().
| bool LegendaryIntegration::isAuthenticated | ( | ) | const |
Check if user is authenticated.
Definition at line 437 of file legendary_integration.cpp.
References getAuthStatus(), and EpicAuthStatus::isAuthenticated.
|
static |
Check if Legendary CLI is installed.
Definition at line 192 of file legendary_integration.cpp.
References getLegendaryPath().
Referenced by LegendaryIntegration(), and getVersion().
| bool LegendaryIntegration::launchGame | ( | const std::string & | appName, |
| const std::vector< std::string > & | additionalArgs = {}, | ||
| bool | offline = false, | ||
| pid_t * | outPid = nullptr ) |
Launch a game.
| appName | App name/ID |
| additionalArgs | Additional command line arguments |
| offline | Launch in offline mode |
| outPid | Optional — receives PID of the spawned legendary process (which itself runs the game via Wine/Proton); use this to waitpid / kill the Epic launch from the caller. Pass nullptr to ignore. |
Forks + execvp of the legendary binary directly — no shell. Caller is responsible for reaping the child if they want the exit status; a non-reaping caller just leaks the zombie until process exit, which is fine for a launcher.
Definition at line 1087 of file legendary_integration.cpp.
References Logger::error(), getLegendaryPath(), and Logger::info().
| void LegendaryIntegration::logout | ( | ) |
Log out and clear credentials.
Definition at line 570 of file legendary_integration.cpp.
References Logger::info().
| bool LegendaryIntegration::moveGame | ( | const std::string & | appName, |
| const std::filesystem::path & | newPath, | ||
| const ProgressCallback & | progressCallback = nullptr ) |
Move game to different location.
| appName | App name/ID |
| newPath | New installation path |
| progressCallback | Progress updates |
Definition at line 976 of file legendary_integration.cpp.
References Logger::info().
| bool LegendaryIntegration::repairGame | ( | const std::string & | appName, |
| const ProgressCallback & | progressCallback = nullptr ) |
Repair game (verify and redownload corrupt files).
| appName | App name/ID |
| progressCallback | Progress updates |
Definition at line 964 of file legendary_integration.cpp.
References Logger::info().
| void LegendaryIntegration::setAutoSyncSaves | ( | bool | enabled | ) |
Enable/disable automatic cloud save sync.
| enabled | Whether to auto-sync |
Definition at line 1197 of file legendary_integration.cpp.
| void LegendaryIntegration::setDefaultInstallPath | ( | const std::filesystem::path & | path | ) |
Set default installation directory.
| path | Default install path |
Definition at line 1179 of file legendary_integration.cpp.
| void LegendaryIntegration::setMaxWorkers | ( | int | workers | ) |
Set maximum download workers.
| workers | Number of parallel downloads |
Definition at line 1191 of file legendary_integration.cpp.
| bool LegendaryIntegration::syncCloudSaves | ( | const std::string & | appName | ) |
Sync saves (download if newer, upload if local is newer).
| appName | App name/ID |
Definition at line 1074 of file legendary_integration.cpp.
References Logger::info().
| int LegendaryIntegration::syncLibrary | ( | ) |
Sync Epic library with game database.
Definition at line 832 of file legendary_integration.cpp.
References getLibrary(), and Logger::info().
| Game LegendaryIntegration::toGame | ( | const EpicGameInfo & | epicGame | ) | const |
Convert Epic game to generic Game object.
| epicGame | Epic game info |
Definition at line 800 of file legendary_integration.cpp.
References EpicGameInfo::appName, EpicGameInfo::appTitle, EpicGameInfo::coverUrl, Epic, GameRunnerConfig::executablePath, Game::id, GameMetadata::imagePaths, EpicGameInfo::installPath, Game::installPath, EpicGameInfo::isInstalled, Game::metadata, Game::name, Game::runner, Game::runnerConfig, Game::source, GameImagePaths::verticalCover, and Wine.
| bool LegendaryIntegration::uninstallGame | ( | const std::string & | appName, |
| bool | keepFiles = false ) |
Uninstall a game.
| appName | App name/ID |
| keepFiles | Keep game files (just unregister) |
Definition at line 937 of file legendary_integration.cpp.
References Logger::info().
| bool LegendaryIntegration::updateGame | ( | const std::string & | appName, |
| const ProgressCallback & | progressCallback = nullptr ) |
Update a game.
| appName | App name/ID |
| progressCallback | Progress updates |
Definition at line 925 of file legendary_integration.cpp.
References Logger::info().
| bool LegendaryIntegration::uploadCloudSaves | ( | const std::string & | appName, |
| bool | force = false ) |
Upload local saves to cloud.
| appName | App name/ID |
| force | Force overwrite cloud saves |
Definition at line 1060 of file legendary_integration.cpp.
References Logger::info().
| bool LegendaryIntegration::verifyGame | ( | const std::string & | appName, |
| const ProgressCallback & | progressCallback = nullptr ) |
Verify game files.
| appName | App name/ID |
| progressCallback | Progress updates |
Definition at line 952 of file legendary_integration.cpp.
References Logger::info().