89 std::vector<StoreStatus> statuses;
109 status.
isAvailable = impl_->gogIntegration->isAvailable();
112 auto auth = impl_->gogIntegration->getAuthStatus();
117 status.
gameCount =
static_cast<int>(impl_->gogIntegration->getLibrary().size());
124 status.
isAvailable = impl_->legendaryIntegration->isAvailable();
127 auto auth = impl_->legendaryIntegration->getAuthStatus();
133 static_cast<int>(impl_->legendaryIntegration->getLibrary().size());
161 return impl_->gogIntegration->isAvailable();
166 return impl_->gogIntegration->getAuthStatus();
170 const std::function<
void(
bool success,
const std::string& message)>& callback)
172 impl_->gogIntegration->authenticate(callback);
177 impl_->gogIntegration->logout();
182 return impl_->gogIntegration->getLibrary(forceRefresh);
187 return impl_->gogIntegration->getInstalledGames();
192 const std::string& installPath,
195 return impl_->gogIntegration->installGameAsync(
196 gameId, installPath.empty() ? std::filesystem::path{} : std::filesystem::path(installPath),
200 if (progressCallback)
202 progressCallback(p.percentComplete, p.getStateStr());
209 return impl_->gogIntegration->uninstallGame(gameId);
214 int count = impl_->gogIntegration->syncLibrary();
218 std::lock_guard<std::mutex> lock(impl_->mutex);
219 cb = impl_->onStoreSyncComplete;
225 event.gamesAdded = count;
226 event.success =
true;
246 return impl_->legendaryIntegration->isAvailable();
251 return impl_->legendaryIntegration->getAuthStatus();
255 const std::function<
void(
bool success,
const std::string& message)>& callback)
257 impl_->legendaryIntegration->authenticate(callback);
262 impl_->legendaryIntegration->logout();
267 return impl_->legendaryIntegration->getLibrary(forceRefresh);
272 return impl_->legendaryIntegration->getInstalledGames();
277 const std::string& installPath,
280 return impl_->legendaryIntegration->installGameAsync(
281 appName, installPath.empty() ? std::filesystem::path{} : std::filesystem::path(installPath),
284 if (progressCallback)
286 progressCallback(p.percentComplete, p.getStateStr());
293 return impl_->legendaryIntegration->uninstallGame(appName);
298 int count = impl_->legendaryIntegration->syncLibrary();
302 std::lock_guard<std::mutex> lock(impl_->mutex);
303 cb = impl_->onStoreSyncComplete;
309 event.gamesAdded = count;
310 event.success =
true;
328 return impl_->cloudSaveService->registerSaveLocation(location);
333 return impl_->cloudSaveService->getSaveLocations();
336std::optional<SaveLocation>
339 return impl_->cloudSaveService->getSaveLocation(gameId);
342std::vector<SaveLocation>
344 const std::string& prefixPath)
const
346 return impl_->cloudSaveService->detectSaveLocation(
347 gameName, prefixPath.empty() ? std::filesystem::path{} : std::filesystem::path(prefixPath));
350std::optional<std::string>
352 const std::string& description)
354 auto result = impl_->cloudSaveService->createSnapshot(gameId, description);
360 std::lock_guard<std::mutex> lock(impl_->mutex);
361 cb = impl_->onCloudSaveEvent;
368 event.message =
"Snapshot created: " + *result;
376std::vector<SaveSnapshot>
379 return impl_->cloudSaveService->getSnapshots(gameId);
385 return impl_->cloudSaveService->restoreSnapshot(snapshotId, backupCurrent);
390 return impl_->cloudSaveService->deleteSnapshot(snapshotId);
397 return impl_->cloudSaveService->syncSavesAsync(
399 [
this, gameId, progressCallback](
const SyncStatus& status)
401 if (progressCallback)
408 std::lock_guard<std::mutex> lock(impl_->mutex);
409 cb = impl_->onCloudSaveEvent;
416 switch (status.
state)
443 return impl_->cloudSaveService->needsSync(gameId);
448 impl_->cloudSaveService->setAutoSync(gameId, enabled);
453 impl_->cloudSaveService->onGameLaunch(gameId);
458 impl_->cloudSaveService->onGameExit(gameId);
463 impl_->cloudSaveService->setCustomSyncDirectory(std::filesystem::path(path));
468 return impl_->cloudSaveService->getTotalBackupSize();
487 return impl_->dependencyManager->getAllDependencies();
490std::vector<WineDependency>
493 return impl_->dependencyManager->getDependenciesByCategory(category);
496std::vector<WineDependency>
499 return impl_->dependencyManager->searchDependencies(query);
504 return impl_->dependencyManager->getRecommendedDependencies();
510 return impl_->dependencyManager->scanPrefix(std::filesystem::path(prefixPath));
514 const std::string& verbId)
const
516 return impl_->dependencyManager->isDependencyInstalled(std::filesystem::path(prefixPath),
522 const std::string& verbId,
525 return impl_->dependencyManager->installDependencyAsync(
526 std::filesystem::path(prefixPath), verbId,
529 if (progressCallback)
536 std::lock_guard<std::mutex> lock(impl_->mutex);
537 cb = impl_->onDependencyEvent;
543 event.verbId = verbId;
573 const std::vector<std::string>& verbIds,
576 return std::async(std::launch::async,
577 [
this, prefixPath, verbIds, progressCallback]()
579 return impl_->dependencyManager->installDependencies(
580 std::filesystem::path(prefixPath), verbIds,
583 if (progressCallback)
595 return std::async(std::launch::async,
596 [
this, prefixPath, progressCallback]()
598 return impl_->dependencyManager->installGamingPreset(
599 std::filesystem::path(prefixPath),
602 if (progressCallback)
612 const std::vector<std::string>& verbIds,
615 return std::async(std::launch::async,
616 [
this, steamAppId, verbIds, progressCallback]()
618 return impl_->dependencyManager->installForSteamGame(
622 if (progressCallback)
636 impl_->cancelRequested =
false;
644 if (progressCallback)
646 progressCallback((step * 100) / totalSteps,
"Syncing GOG library...");
655 if (progressCallback)
657 progressCallback((step * 100) / totalSteps,
"Syncing Epic library...");
663 if (progressCallback)
665 progressCallback(100,
"Sync complete");
669std::vector<StoreIntegrationController::UnifiedGameInfo>
672 std::vector<UnifiedGameInfo> games;
677 for (
const auto& gogGame : impl_->gogIntegration->getLibrary())
680 info.
id =
"gog_" + gogGame.gameId;
681 info.
name = gogGame.title;
686 games.push_back(info);
693 for (
const auto& epicGame : impl_->legendaryIntegration->getLibrary())
696 info.
id =
"epic_" + epicGame.appName;
697 info.
name = epicGame.appTitle;
702 games.push_back(info);
709std::vector<StoreIntegrationController::UnifiedGameInfo>
712 std::vector<UnifiedGameInfo> gamesWithUpdates;
717 for (
const auto& gogGame : impl_->gogIntegration->getInstalledGames())
719 if (impl_->gogIntegration->hasUpdate(gogGame.gameId))
722 info.
id =
"gog_" + gogGame.gameId;
723 info.
name = gogGame.title;
726 gamesWithUpdates.push_back(info);
736 return gamesWithUpdates;
745 std::lock_guard<std::mutex> lock(impl_->mutex);
746 impl_->onStoreSyncComplete = std::move(callback);
751 std::lock_guard<std::mutex> lock(impl_->mutex);
752 impl_->onCloudSaveEvent = std::move(callback);
757 std::lock_guard<std::mutex> lock(impl_->mutex);
758 impl_->onDependencyEvent = std::move(callback);
767 impl_->cancelRequested =
true;
768 impl_->gogIntegration->cancelOperation();
769 impl_->legendaryIntegration->cancelOperation();
770 impl_->cloudSaveService->cancelOperation();
771 impl_->dependencyManager->cancelOperation();
static bool isProtontricksAvailable()
Check if protontricks is available.
static bool isWinetricksAvailable()
Check if winetricks is available.
OnStoreSyncComplete onStoreSyncComplete
std::unique_ptr< LegendaryIntegration > legendaryIntegration
OnCloudSaveEvent onCloudSaveEvent
std::unique_ptr< WineDependencyManager > dependencyManager
std::unique_ptr< GOGIntegration > gogIntegration
OnDependencyEvent onDependencyEvent
std::unique_ptr< CloudSaveService > cloudSaveService
std::atomic< bool > cancelRequested
void syncAllStores(const ProgressCallback &progressCallback=nullptr)
Sync all stores (GOG, Epic, etc.).
bool isEpicAvailable() const
Check if Epic/Legendary is available.
EpicAuthStatus getEpicAuthStatus() const
Get Epic authentication status.
GOGAuthStatus getGOGAuthStatus() const
Get GOG authentication status.
std::vector< EpicGameInfo > getEpicLibrary(bool forceRefresh=false)
Get all Epic library games.
std::vector< UnifiedGameInfo > getAllStoreGames() const
bool isDependencyInstalled(const std::string &prefixPath, const std::string &verbId) const
Check if a dependency is installed in a prefix.
void cancelOperation()
Cancel any ongoing operation.
std::future< bool > installEpicGame(const std::string &appName, const std::string &installPath="", const ProgressCallback &progressCallback=nullptr)
Install an Epic game.
int importEpicGames()
Import Epic games to main library.
std::vector< EpicGameInfo > getInstalledEpicGames() const
Get installed Epic games.
bool isWinetricksAvailable() const
Check if winetricks is available.
std::future< int > installDependencies(const std::string &prefixPath, const std::vector< std::string > &verbIds, const ProgressCallback &progressCallback=nullptr)
Install multiple dependencies.
bool restoreSaveSnapshot(const std::string &snapshotId, bool backupCurrent=true)
Restore saves from a snapshot.
PrefixDependencyStatus scanPrefixDependencies(const std::string &prefixPath) const
Scan a Wine prefix for installed dependencies.
bool isStoreAuthenticated(StoreType store) const
Check if authenticated to a store.
void setOnCloudSaveEvent(OnCloudSaveEvent callback)
std::vector< SaveLocation > getSaveLocations() const
Get all registered save locations.
void setAutoSync(const std::string &gameId, bool enabled)
Enable/disable auto-sync for a game.
void logoutGOG()
Log out of GOG.
StoreIntegrationController()
std::vector< UnifiedGameInfo > checkAllUpdates() const
Check for updates across all stores.
int syncGOGLibrary()
Sync GOG library to game database.
std::future< bool > installForSteamGame(uint32_t steamAppId, const std::vector< std::string > &verbIds, const ProgressCallback &progressCallback=nullptr)
Install dependencies for a Steam/Proton game.
std::vector< GOGGameInfo > getGOGLibrary(bool forceRefresh=false)
Get all GOG library games.
std::vector< WineDependency > getAllDependencies() const
Get all available dependencies.
void setOnDependencyEvent(OnDependencyEvent callback)
void authenticateGOG(const std::function< void(bool success, const std::string &message)> &callback)
Start GOG authentication flow.
bool deleteSaveSnapshot(const std::string &snapshotId)
Delete a snapshot.
void authenticateEpic(const std::function< void(bool success, const std::string &message)> &callback)
Start Epic authentication flow.
std::function< void(const CloudSaveEvent &)> OnCloudSaveEvent
void setCloudSyncDirectory(const std::string &path)
Set custom sync directory (e.g., Syncthing folder).
bool needsSaveSync(const std::string &gameId) const
Check if sync is needed.
bool registerSaveLocation(const SaveLocation &location)
Register a game's save location.
int64_t getTotalBackupSize() const
Get total backup size.
std::vector< GOGGameInfo > getInstalledGOGGames() const
Get installed GOG games.
~StoreIntegrationController()
std::function< void(const StoreSyncEvent &)> OnStoreSyncComplete
std::function< void(int percent, const std::string &status)> ProgressCallback
void onGameExit(const std::string &gameId)
Called when game exits (for auto-sync).
std::future< bool > installDependency(const std::string &prefixPath, const std::string &verbId, const ProgressCallback &progressCallback=nullptr)
Install a dependency.
std::vector< SaveSnapshot > getSaveSnapshots(const std::string &gameId) const
Get all snapshots for a game.
std::vector< SaveLocation > detectSaveLocations(const std::string &gameName, const std::string &prefixPath="") const
Detect save locations for a game.
StoreStatus getStoreStatus(StoreType store) const
Get status of a specific store.
std::future< bool > installGamingPreset(const std::string &prefixPath, const ProgressCallback &progressCallback=nullptr)
Install gaming preset (vcrun, dxvk, fonts).
void setOnStoreSyncComplete(OnStoreSyncComplete callback)
std::vector< WineDependency > searchDependencies(const std::string &query) const
Search for dependencies.
std::vector< WineDependency > getDependenciesByCategory(DependencyCategory category) const
Get dependencies by category.
bool uninstallEpicGame(const std::string &appName)
Uninstall an Epic game.
std::optional< SaveLocation > getSaveLocation(const std::string &gameId) const
Get save location for a game.
int syncEpicLibrary()
Sync Epic library to game database.
int importGOGGames()
Import GOG games to main library.
void onGameLaunch(const std::string &gameId)
Called when game launches (for auto-sync).
std::vector< std::string > getRecommendedDependencies() const
Get recommended dependencies for gaming.
bool isGOGAvailable() const
Check if GOG integration is available (Heroic or gogdl).
std::function< void(const DependencyEvent &)> OnDependencyEvent
bool isProtontricksAvailable() const
Check if protontricks is available.
std::future< bool > syncSaves(const std::string &gameId, SyncDirection direction, const ProgressCallback &progressCallback=nullptr)
Sync saves with cloud/custom directory.
std::future< bool > installGOGGame(const std::string &gameId, const std::string &installPath="", const ProgressCallback &progressCallback=nullptr)
Install a GOG game.
bool uninstallGOGGame(const std::string &gameId)
Uninstall a GOG game.
std::vector< StoreStatus > getAllStoreStatus() const
Get status of all available stores.
std::optional< std::string > createSaveSnapshot(const std::string &gameId, const std::string &description="")
Create a save snapshot (backup).
void logoutEpic()
Log out of Epic.
bool isStoreAvailable(StoreType store) const
Check if a store backend is available (tools installed).
SyncDirection
Direction of sync operation.
std::string storeTypeName(StoreType type)
Get human-readable store name.
Progress information during dependency installation.
std::string getStateStr() const
std::string currentStep
Current step description.
Epic Games authentication status.
GOG Galaxy authentication status.
Progress information for GOG operations.
Progress information for Legendary operations.
Status of dependencies in a Wine prefix.
Information about a game's save location.
Status of sync operation.
std::string getStateStr() const
Get games from all stores (unified view).
DependencyCategory
Categories of Wine dependencies.