game_launcher 1.1.0
Modern Linux game launcher with Steam / Proton / Wine integration
Loading...
Searching...
No Matches
WineDependencyManager Class Reference

Service for managing Wine prefix dependencies. More...

#include <wine_dependency_manager.h>

Classes

struct  Impl

Public Types

using ProgressCallback = std::function<void(const DependencyInstallProgress&)>

Public Member Functions

 WineDependencyManager ()
 ~WineDependencyManager ()
void cancelOperation ()
 Cancel ongoing operation.
void clearCache ()
 Clear winetricks cache.
std::vector< WineDependency > getAllDependencies () const
 Get all available dependencies.
std::filesystem::path getCacheDirectory () const
 Get winetricks cache directory.
std::vector< WineDependency > getDependenciesByCategory (DependencyCategory category) const
 Get dependencies by category.
std::optional< WineDependency > getDependencyInfo (const std::string &verbId) const
 Get dependency info by ID.
std::vector< DLLOverride > getDLLOverrides (const std::filesystem::path &prefixPath) const
 Get DLL overrides for a prefix.
std::vector< std::string > getMissingDependencies (const std::filesystem::path &prefixPath, const std::vector< std::string > &requiredVerbs) const
 Get missing dependencies for a game.
std::vector< std::string > getRecommendedDependencies () const
 Get recommended dependencies for common game requirements.
int installDependencies (const std::filesystem::path &prefixPath, const std::vector< std::string > &verbIds, const ProgressCallback &progressCallback=nullptr)
 Install multiple dependencies.
bool installDependency (const std::filesystem::path &prefixPath, const std::string &verbId, const ProgressCallback &progressCallback=nullptr)
 Install a single dependency.
std::future< bool > installDependencyAsync (const std::filesystem::path &prefixPath, const std::string &verbId, const ProgressCallback &progressCallback=nullptr)
 Install a dependency asynchronously.
bool installDirectXPreset (const std::filesystem::path &prefixPath, const ProgressCallback &progressCallback=nullptr)
 Install DirectX dependencies.
bool installDotNet (const std::filesystem::path &prefixPath, const std::string &version="48", const ProgressCallback &progressCallback=nullptr)
 Install .NET Framework.
bool installForSteamGame (uint32_t steamAppId, const std::vector< std::string > &verbIds, const ProgressCallback &progressCallback=nullptr)
 Install dependencies for a Steam/Proton game.
bool installGamingPreset (const std::filesystem::path &prefixPath, const ProgressCallback &progressCallback=nullptr)
 Install common gaming dependencies.
bool isDependencyInstalled (const std::filesystem::path &prefixPath, const std::string &verbId) const
 Check if a specific dependency is installed.
bool removeDLLOverride (const std::filesystem::path &prefixPath, const std::string &dllName)
 Remove a DLL override.
PrefixDependencyStatus scanPrefix (const std::filesystem::path &prefixPath) const
 Scan a prefix for installed dependencies.
std::vector< WineDependency > searchDependencies (const std::string &query) const
 Search for dependencies.
bool setDLLOverride (const std::filesystem::path &prefixPath, const std::string &dllName, const std::string &mode)
 Set a DLL override.
void setGuiMode (bool enabled)
 Enable/disable GUI mode for winetricks.
void setWinePath (const std::filesystem::path &winePath)
 Set custom Wine binary path.
void setWinetricksPath (const std::filesystem::path &path)
 Set winetricks path.
bool updateWinetricks ()
 Update winetricks to latest version.

Static Public Member Functions

static std::string getProtontricksVersion ()
 Get protontricks version.
static std::string getWinetricksVersion ()
 Get winetricks version.
static bool isProtontricksAvailable ()
 Check if protontricks is available.
static bool isWinetricksAvailable ()
 Check if winetricks is available.

Detailed Description

Service for managing Wine prefix dependencies.

Provides methods for installing and managing Windows components in Wine prefixes using winetricks or protontricks.

Prerequisites

  • winetricks installed for Wine prefixes
  • protontricks installed for Proton prefixes (optional)

Usage Example

// Install Visual C++ 2019 redistributable
manager.installDependency(prefixPath, "vcrun2019", [](const auto& p) {
std::cout << p.currentStep << std::endl;
});
// Install multiple dependencies
manager.installDependencies(prefixPath, {"vcrun2019", "dxvk"});
int installDependencies(const std::filesystem::path &prefixPath, const std::vector< std::string > &verbIds, const ProgressCallback &progressCallback=nullptr)
Install multiple dependencies.
bool installDependency(const std::filesystem::path &prefixPath, const std::string &verbId, const ProgressCallback &progressCallback=nullptr)
Install a single dependency.

Definition at line 162 of file wine_dependency_manager.h.

Member Typedef Documentation

◆ ProgressCallback

Definition at line 165 of file wine_dependency_manager.h.

Constructor & Destructor Documentation

◆ WineDependencyManager()

WineDependencyManager::WineDependencyManager ( )

Definition at line 188 of file wine_dependency_manager.cpp.

◆ ~WineDependencyManager()

WineDependencyManager::~WineDependencyManager ( )

Definition at line 193 of file wine_dependency_manager.cpp.

Member Function Documentation

◆ cancelOperation()

void WineDependencyManager::cancelOperation ( )

Cancel ongoing operation.

Definition at line 694 of file wine_dependency_manager.cpp.

◆ clearCache()

void WineDependencyManager::clearCache ( )

Clear winetricks cache.

Definition at line 713 of file wine_dependency_manager.cpp.

References getCacheDirectory().

◆ getAllDependencies()

std::vector< WineDependency > WineDependencyManager::getAllDependencies ( ) const

Get all available dependencies.

Returns
Vector of all known dependencies

Definition at line 250 of file wine_dependency_manager.cpp.

◆ getCacheDirectory()

std::filesystem::path WineDependencyManager::getCacheDirectory ( ) const

Get winetricks cache directory.

Definition at line 723 of file wine_dependency_manager.cpp.

Referenced by clearCache().

◆ getDependenciesByCategory()

std::vector< WineDependency > WineDependencyManager::getDependenciesByCategory ( DependencyCategory category) const

Get dependencies by category.

Parameters
categoryCategory to filter by
Returns
Vector of dependencies in that category

Definition at line 257 of file wine_dependency_manager.cpp.

◆ getDependencyInfo()

std::optional< WineDependency > WineDependencyManager::getDependencyInfo ( const std::string & verbId) const

Get dependency info by ID.

Parameters
verbIdWinetricks verb ID
Returns
Dependency info if found

Definition at line 272 of file wine_dependency_manager.cpp.

◆ getDLLOverrides()

std::vector< DLLOverride > WineDependencyManager::getDLLOverrides ( const std::filesystem::path & prefixPath) const

Get DLL overrides for a prefix.

Parameters
prefixPathPath to Wine prefix
Returns
List of DLL overrides

Definition at line 561 of file wine_dependency_manager.cpp.

References DLLOverride::dllName.

◆ getMissingDependencies()

std::vector< std::string > WineDependencyManager::getMissingDependencies ( const std::filesystem::path & prefixPath,
const std::vector< std::string > & requiredVerbs ) const

Get missing dependencies for a game.

Parameters
prefixPathPath to Wine prefix
requiredVerbsList of required verb IDs
Returns
List of missing verb IDs

Definition at line 419 of file wine_dependency_manager.cpp.

References isDependencyInstalled().

◆ getProtontricksVersion()

std::string WineDependencyManager::getProtontricksVersion ( )
static

Get protontricks version.

Definition at line 237 of file wine_dependency_manager.cpp.

References isProtontricksAvailable().

◆ getRecommendedDependencies()

std::vector< std::string > WineDependencyManager::getRecommendedDependencies ( ) const

Get recommended dependencies for common game requirements.

Returns
List of commonly needed dependency IDs

Definition at line 327 of file wine_dependency_manager.cpp.

Referenced by scanPrefix().

◆ getWinetricksVersion()

std::string WineDependencyManager::getWinetricksVersion ( )
static

Get winetricks version.

Definition at line 228 of file wine_dependency_manager.cpp.

References isWinetricksAvailable().

◆ installDependencies()

int WineDependencyManager::installDependencies ( const std::filesystem::path & prefixPath,
const std::vector< std::string > & verbIds,
const ProgressCallback & progressCallback = nullptr )

Install multiple dependencies.

Parameters
prefixPathPath to Wine prefix
verbIdsList of verb IDs to install
progressCallbackProgress updates
Returns
Number of successfully installed dependencies

Definition at line 486 of file wine_dependency_manager.cpp.

References DependencyInstallProgress::Cancelled, DependencyInstallProgress::Completed, DependencyInstallProgress::currentVerb, DependencyInstallProgress::percentComplete, DependencyInstallProgress::state, DependencyInstallProgress::verbsCompleted, and DependencyInstallProgress::verbsTotal.

Referenced by installDirectXPreset(), and installGamingPreset().

◆ installDependency()

bool WineDependencyManager::installDependency ( const std::filesystem::path & prefixPath,
const std::string & verbId,
const ProgressCallback & progressCallback = nullptr )

Install a single dependency.

Parameters
prefixPathPath to Wine prefix
verbIdWinetricks verb ID
progressCallbackProgress updates
Returns
True on success

Definition at line 437 of file wine_dependency_manager.cpp.

References DependencyInstallProgress::errorMessage, DependencyInstallProgress::Failed, isWinetricksAvailable(), and DependencyInstallProgress::state.

Referenced by installDependencyAsync(), and installDotNet().

◆ installDependencyAsync()

std::future< bool > WineDependencyManager::installDependencyAsync ( const std::filesystem::path & prefixPath,
const std::string & verbId,
const ProgressCallback & progressCallback = nullptr )

Install a dependency asynchronously.

Definition at line 459 of file wine_dependency_manager.cpp.

References installDependency().

◆ installDirectXPreset()

bool WineDependencyManager::installDirectXPreset ( const std::filesystem::path & prefixPath,
const ProgressCallback & progressCallback = nullptr )

Install DirectX dependencies.

Parameters
prefixPathPath to Wine prefix
progressCallbackProgress updates
Returns
True on success

Definition at line 656 of file wine_dependency_manager.cpp.

References installDependencies().

◆ installDotNet()

bool WineDependencyManager::installDotNet ( const std::filesystem::path & prefixPath,
const std::string & version = "48",
const ProgressCallback & progressCallback = nullptr )

Install .NET Framework.

Parameters
prefixPathPath to Wine prefix
version.NET version (e.g., "48" for 4.8)
progressCallbackProgress updates
Returns
True on success

Definition at line 665 of file wine_dependency_manager.cpp.

References installDependency().

◆ installForSteamGame()

bool WineDependencyManager::installForSteamGame ( uint32_t steamAppId,
const std::vector< std::string > & verbIds,
const ProgressCallback & progressCallback = nullptr )

Install dependencies for a Steam/Proton game.

Parameters
steamAppIdSteam app ID
verbIdsList of verb IDs to install
progressCallbackProgress updates
Returns
True on success

Definition at line 535 of file wine_dependency_manager.cpp.

References DependencyInstallProgress::errorMessage, DependencyInstallProgress::Failed, isProtontricksAvailable(), and DependencyInstallProgress::state.

◆ installGamingPreset()

bool WineDependencyManager::installGamingPreset ( const std::filesystem::path & prefixPath,
const ProgressCallback & progressCallback = nullptr )

Install common gaming dependencies.

Parameters
prefixPathPath to Wine prefix
progressCallbackProgress updates
Returns
True on success

Installs: vcrun2019, dxvk, corefonts

Definition at line 648 of file wine_dependency_manager.cpp.

References installDependencies().

◆ isDependencyInstalled()

bool WineDependencyManager::isDependencyInstalled ( const std::filesystem::path & prefixPath,
const std::string & verbId ) const

Check if a specific dependency is installed.

Parameters
prefixPathPath to Wine prefix
verbIdWinetricks verb ID
Returns
True if installed

Definition at line 388 of file wine_dependency_manager.cpp.

Referenced by getMissingDependencies().

◆ isProtontricksAvailable()

bool WineDependencyManager::isProtontricksAvailable ( )
static

Check if protontricks is available.

Definition at line 223 of file wine_dependency_manager.cpp.

Referenced by getProtontricksVersion(), installForSteamGame(), and core::StoreIntegrationController::isProtontricksAvailable().

◆ isWinetricksAvailable()

bool WineDependencyManager::isWinetricksAvailable ( )
static

◆ removeDLLOverride()

bool WineDependencyManager::removeDLLOverride ( const std::filesystem::path & prefixPath,
const std::string & dllName )

Remove a DLL override.

Parameters
prefixPathPath to Wine prefix
dllNameDLL name
Returns
True on success

Definition at line 630 of file wine_dependency_manager.cpp.

References ShellUtils::escapeArg().

◆ scanPrefix()

PrefixDependencyStatus WineDependencyManager::scanPrefix ( const std::filesystem::path & prefixPath) const

Scan a prefix for installed dependencies.

Parameters
prefixPathPath to Wine prefix
Returns
Status of dependencies in prefix

Definition at line 344 of file wine_dependency_manager.cpp.

References PrefixDependencyStatus::architecture, getRecommendedDependencies(), PrefixDependencyStatus::installedVerbs, PrefixDependencyStatus::lastScanned, PrefixDependencyStatus::missingRecommended, and PrefixDependencyStatus::prefixPath.

◆ searchDependencies()

std::vector< WineDependency > WineDependencyManager::searchDependencies ( const std::string & query) const

Search for dependencies.

Parameters
querySearch query
Returns
Matching dependencies

Definition at line 294 of file wine_dependency_manager.cpp.

◆ setDLLOverride()

bool WineDependencyManager::setDLLOverride ( const std::filesystem::path & prefixPath,
const std::string & dllName,
const std::string & mode )

Set a DLL override.

Parameters
prefixPathPath to Wine prefix
dllNameDLL name (without .dll extension)
modeOverride mode
Returns
True on success

Definition at line 608 of file wine_dependency_manager.cpp.

References ShellUtils::escapeArg(), and isWinetricksAvailable().

◆ setGuiMode()

void WineDependencyManager::setGuiMode ( bool enabled)

Enable/disable GUI mode for winetricks.

Parameters
enabledWhether to show winetricks GUI

Definition at line 689 of file wine_dependency_manager.cpp.

◆ setWinePath()

void WineDependencyManager::setWinePath ( const std::filesystem::path & winePath)

Set custom Wine binary path.

Parameters
winePathPath to Wine binary

Definition at line 677 of file wine_dependency_manager.cpp.

◆ setWinetricksPath()

void WineDependencyManager::setWinetricksPath ( const std::filesystem::path & path)

Set winetricks path.

Parameters
pathPath to winetricks script

Definition at line 683 of file wine_dependency_manager.cpp.

◆ updateWinetricks()

bool WineDependencyManager::updateWinetricks ( )

Update winetricks to latest version.

Returns
True on success

Definition at line 703 of file wine_dependency_manager.cpp.

References isWinetricksAvailable().


The documentation for this class was generated from the following files: