171 using AuthCallback = std::function<void(
bool success,
const std::string& message)>;
244 std::vector<EpicGameInfo>
getLibrary(
bool forceRefresh =
false);
257 std::optional<EpicGameInfo>
getGameInfo(
const std::string& appName)
const;
283 bool installGame(
const std::string& appName,
const std::filesystem::path& installPath = {},
290 const std::filesystem::path& installPath = {},
307 bool uninstallGame(
const std::string& appName,
bool keepFiles =
false);
332 bool moveGame(
const std::string& appName,
const std::filesystem::path& newPath,
341 bool importGame(
const std::string& appName,
const std::filesystem::path& existingPath);
360 bool installDLC(
const std::string& dlcAppName,
417 bool launchGame(
const std::string& appName,
const std::vector<std::string>& additionalArgs = {},
418 bool offline =
false, pid_t* outPid =
nullptr);
428 const std::vector<std::string>& additionalArgs = {},
429 bool offline =
false)
const;
465 std::shared_ptr<Impl> impl_;
468 std::string runLegendary(
const std::vector<std::string>& args,
int timeoutSec = 30)
const;
469 bool runLegendaryInteractive(
const std::vector<std::string>& args,
471 void parseLibraryOutput(
const std::string& output);
472 void parseInstalledOutput(
const std::string& output);
473 EpicGameInfo parseGameJson(
const std::string& jsonStr)
const;
Complete representation of a game in the library.
std::vector< EpicGameInfo > getInstalledGames() const
Get all installed games.
bool syncCloudSaves(const std::string &appName)
Sync saves (download if newer, upload if local is newer).
std::filesystem::path getDefaultInstallPath() const
Get default installation directory.
std::vector< EpicGameInfo > getLibrary(bool forceRefresh=false)
Get all games in Epic library.
bool installGame(const std::string &appName, const std::filesystem::path &installPath={}, const ProgressCallback &progressCallback=nullptr)
Install a game.
bool moveGame(const std::string &appName, const std::filesystem::path &newPath, const ProgressCallback &progressCallback=nullptr)
Move game to different location.
void authenticate(const AuthCallback &callback=nullptr)
Start authentication flow.
std::optional< EpicGameInfo > getGameInfo(const std::string &appName) const
Get info for a specific game.
std::function< void(bool success, const std::string &message)> AuthCallback
std::vector< EpicGameInfo > getAvailableDLC(const std::string &appName)
Get available DLC for a game.
static bool isAvailable()
Check if Legendary CLI is installed.
void cancelOperation()
Cancel ongoing operation.
bool launchGame(const std::string &appName, const std::vector< std::string > &additionalArgs={}, bool offline=false, pid_t *outPid=nullptr)
Launch a game.
std::future< bool > installGameAsync(const std::string &appName, const std::filesystem::path &installPath={}, const ProgressCallback &progressCallback=nullptr)
Install a game asynchronously.
bool installDLC(const std::string &dlcAppName, const ProgressCallback &progressCallback=nullptr)
Install DLC for a game.
bool uploadCloudSaves(const std::string &appName, bool force=false)
Upload local saves to cloud.
EpicAuthStatus getAuthStatus() const
Check authentication status.
void setAutoSyncSaves(bool enabled)
Enable/disable automatic cloud save sync.
EpicCloudSaveInfo getCloudSaveStatus(const std::string &appName) const
Get cloud save status for a game.
bool repairGame(const std::string &appName, const ProgressCallback &progressCallback=nullptr)
Repair game (verify and redownload corrupt files).
bool updateGame(const std::string &appName, const ProgressCallback &progressCallback=nullptr)
Update a game.
bool importGame(const std::string &appName, const std::filesystem::path &existingPath)
Import an existing game installation.
bool uninstallGame(const std::string &appName, bool keepFiles=false)
Uninstall a game.
std::function< void(const LegendaryProgress &)> ProgressCallback
std::string getLaunchCommand(const std::string &appName, const std::vector< std::string > &additionalArgs={}, bool offline=false) const
Get launch command for a game.
void setDefaultInstallPath(const std::filesystem::path &path)
Set default installation directory.
bool downloadCloudSaves(const std::string &appName, bool force=false)
Download cloud saves for a game.
static std::string getVersion()
Get Legendary version.
bool isAuthenticated() const
Check if user is authenticated.
bool verifyGame(const std::string &appName, const ProgressCallback &progressCallback=nullptr)
Verify game files.
Game toGame(const EpicGameInfo &epicGame) const
Convert Epic game to generic Game object.
static std::filesystem::path getLegendaryPath()
Get path to Legendary executable.
int syncLibrary()
Sync Epic library with game database.
void logout()
Log out and clear credentials.
void authenticateWithCode(const std::string &authCode, const AuthCallback &callback=nullptr)
Start authentication with authorization code.
void setMaxWorkers(int workers)
Set maximum download workers.
int progressCallback(void *userp, curl_off_t dltotal, curl_off_t, curl_off_t, curl_off_t)
Epic Games authentication status.
bool isTokenExpired() const
std::chrono::system_clock::time_point tokenExpiry
Information about cloud saves for an Epic game.
std::filesystem::path localPath
std::chrono::system_clock::time_point localModified
std::chrono::system_clock::time_point cloudModified
Information about an Epic Games Store game.
std::string appName
Internal app identifier.
std::string publisher
Publisher name.
std::string developer
Developer name.
int64_t installSize
Installed size in bytes.
std::string appTitle
Display title.
std::string getFormattedDownloadSize() const
std::string baseGameAppName
Parent game if this is DLC.
std::string thumbnailUrl
Thumbnail URL.
std::vector< std::string > platforms
Available platforms (Windows, Mac).
std::string coverUrl
Cover image URL.
std::vector< std::string > dlcAppNames
DLC for this game.
std::string getFormattedInstallSize() const
std::filesystem::path installPath
std::string version
Installed/available version.
int64_t downloadSize
Download size in bytes.
Progress information for Legendary operations.
std::string getStateStr() const
int estimatedTimeRemaining
Seconds.