game_launcher 1.1.0
Modern Linux game launcher with Steam / Proton / Wine integration
Loading...
Searching...
No Matches
umu_launcher.h
Go to the documentation of this file.
1// SPDX-License-Identifier: MIT
2// ==============================================================================
3// umu_launcher.h
4// ==============================================================================
5// UMU (Unified Linux Wine Game Launcher) integration
6// ==============================================================================
7// Provides support for running non-Steam games with Proton via umu-run,
8// which enables Steam Runtime container and protonfixes outside of Steam.
9//
10// ## About UMU
11// UMU is a unified launcher for Windows games on Linux. It provides:
12// - Steam Runtime container environment for non-Steam games
13// - Automatic protonfixes application based on GAMEID
14// - Proton version management (UMU-Proton, GE-Proton)
15// - Wine prefix management
16//
17// ## Usage Example
18// @code
19// UMULauncher umu;
20// if (umu.isAvailable()) {
21// UMULaunchConfig config;
22// config.executable = "/path/to/game.exe";
23// config.winePrefix = "~/.wine";
24// config.protonPath = UMUProtonPath::GEProton; // Auto-download latest
25// config.gameId = "umu-dauntless";
26// config.store = "egs";
27//
28// auto cmd = umu.buildLaunchCommand(config);
29// // Execute cmd...
30// }
31// @endcode
32//
33// ## References
34// - https://github.com/Open-Wine-Components/umu-launcher
35// - https://man.archlinux.org/man/umu.1.en
36// ==============================================================================
37
38#pragma once
39
40#include <chrono>
41#include <functional>
42#include <map>
43#include <memory>
44#include <optional>
45#include <string>
46#include <vector>
47
48// ==============================================================================
49// Data Structures
50// ==============================================================================
51
52/**
53 * @enum UMUProtonPath
54 * @brief Proton version selection mode for UMU
55 */
56enum class UMUProtonPath
57{
58 Default, ///< Use UMU-Proton (stable Valve Proton with umu patches)
59 GEProton, ///< Auto-download latest GE-Proton
60 SystemProton, ///< Use system-installed Proton
61 Custom ///< Use custom PROTONPATH specified in customProtonPath
62};
63
64/**
65 * @enum UMUStore
66 * @brief Storefront identifiers for game fixes lookup
67 */
68enum class UMUStore
69{
70 None, ///< No specific store (generic fixes only)
71 Steam, ///< Steam (usually use Steam directly, but for reference)
72 EGS, ///< Epic Games Store
73 GOG, ///< GOG.com
74 Amazon, ///< Amazon Games
75 Ubisoft, ///< Ubisoft Connect
76 EA, ///< EA App / Origin
77 Humble, ///< Humble Bundle
78 Itch, ///< itch.io
79 Custom ///< Custom store identifier
80};
81
82/**
83 * @struct UMULaunchConfig
84 * @brief Configuration for launching a game via umu-run
85 */
87{
88 // Required
89 std::string executable; ///< Path to game executable
90
91 // Wine prefix
92 std::string winePrefix; ///< WINEPREFIX path (empty = default at $HOME/Games/umu/GAMEID)
93
94 // Proton selection
96 std::string customProtonPath; ///< Custom Proton path when mode is Custom
97
98 // Game identification (for protonfixes)
99 std::string gameId; ///< GAMEID for umu database lookup (e.g., "umu-dauntless")
100 UMUStore store = UMUStore::None; ///< Storefront for store-specific fixes
101 std::string customStore; ///< Custom store name when store is Custom
102
103 // Launch arguments
104 std::vector<std::string> arguments; ///< Arguments to pass to the executable
105
106 // Environment variables
107 std::map<std::string, std::string> environmentVariables;
108
109 // Debugging
110 bool enableUMULog = false; ///< Enable UMU debug logging
111 bool enableProtonLog = false; ///< Enable Proton verbose logging
112
113 // Advanced options
114 // (UMU_NO_RUNTIME was removed: it is not honored by umu-launcher and never
115 // skipped the Steam Linux Runtime container — see upstream issue #531.
116 // To run a native binary inside the SLR, use UMU_NO_PROTON via
117 // environmentVariables instead.)
118 std::string protonVerb; ///< PROTON_VERB (e.g., "runinprefix" for multi-game prefix)
119};
120
121/**
122 * @struct UMUGameInfo
123 * @brief Information about a game from the umu database
124 */
126{
127 std::string gameId; ///< umu game ID (e.g., "umu-dauntless")
128 std::string title; ///< Game title
129 std::string store; ///< Store identifier
130 std::vector<std::string> fixes; ///< List of fixes applied
131 bool found = false; ///< Whether game was found in database
132};
133
134/**
135 * @struct UMUProtonVersion
136 * @brief Information about an available Proton version
137 */
139{
140 std::string name; ///< Version name (e.g., "GE-Proton9-20")
141 std::string path; ///< Full path to the Proton directory
142 bool isGEProton = false; ///< Is GloriousEggroll build
143 bool isUMUProton = false; ///< Is official UMU-Proton build
144 bool isSystemProton = false; ///< Is system/Steam Proton
145 std::string version; ///< Parsed version number
146};
147
148/**
149 * @struct UMUInstallStatus
150 * @brief Status of UMU installation on the system
151 */
153{
154 bool isInstalled = false; ///< Is umu-run available
155 std::string umuRunPath; ///< Path to umu-run binary
156 std::string version; ///< UMU version string
157 std::string runtimePath; ///< Path to Steam Runtime (~/.local/share/umu)
158 bool hasGEProton = false; ///< Is GE-Proton available
159 bool hasUMUProton = false; ///< Is UMU-Proton available
160 std::vector<UMUProtonVersion> availableProton; ///< Available Proton versions
161};
162
163// ==============================================================================
164// UMULauncher Class
165// ==============================================================================
166
167/**
168 * @class UMULauncher
169 * @brief Service for launching games via UMU (umu-run)
170 *
171 * Provides integration with the UMU Unified Linux Wine Game Launcher,
172 * allowing non-Steam games to run with Steam's Proton in the Steam Runtime
173 * container with automatic protonfixes application.
174 */
176{
177 public:
178 using ProgressCallback = std::function<void(int percent, const std::string& status)>;
179
180 UMULauncher();
182
183 // Non-copyable
184 UMULauncher(const UMULauncher&) = delete;
186
187 // ==========================================================================
188 // Availability & Status
189 // ==========================================================================
190
191 /**
192 * @brief Check if umu-run is available on the system
193 * @return True if umu-run is installed and accessible
194 */
195 bool isAvailable() const;
196
197 /**
198 * @brief Get detailed installation status
199 * @return UMUInstallStatus with version, paths, and available Proton builds
200 */
202
203 /**
204 * @brief Get path to umu-run binary
205 * @return Path to umu-run or empty if not found
206 */
207 std::string getUMURunPath() const;
208
209 /**
210 * @brief Refresh the list of available Proton versions
211 */
213
214 /**
215 * @brief Get available Proton versions for UMU
216 * @return Vector of available Proton versions
217 */
218 std::vector<UMUProtonVersion> getAvailableProtonVersions() const;
219
220 // ==========================================================================
221 // Launch Command Building
222 // ==========================================================================
223
224 /**
225 * @brief Build the full launch command for umu-run
226 * @param config Launch configuration
227 * @return Complete command string ready for execution
228 *
229 * Returns a command string that can be passed to system() or a process
230 * manager. Environment variables are prepended, then umu-run with args.
231 */
232 std::string buildLaunchCommand(const UMULaunchConfig& config) const;
233
234 /**
235 * @brief Build launch command as separate components
236 * @param config Launch configuration
237 * @param[out] envVars Environment variables to set
238 * @param[out] command The umu-run command with arguments
239 *
240 * Useful when you need to set environment variables separately
241 * (e.g., with execve or QProcess).
242 */
243 void buildLaunchComponents(const UMULaunchConfig& config,
244 std::map<std::string, std::string>& envVars,
245 std::vector<std::string>& command) const;
246
247 // ==========================================================================
248 // Game Database
249 // ==========================================================================
250
251 /**
252 * @brief Look up a game in the umu database
253 * @param gameId Game ID to look up
254 * @return UMUGameInfo with details (check .found)
255 */
256 UMUGameInfo lookupGame(const std::string& gameId) const;
257
258 /**
259 * @brief Search for games in the umu database
260 * @param query Search query (game name)
261 * @param store Optional store filter
262 * @return Vector of matching games
263 */
264 std::vector<UMUGameInfo> searchGames(const std::string& query,
265 std::optional<UMUStore> store = std::nullopt) const;
266
267 /**
268 * @brief Get suggested GAMEID for a game name
269 * @param gameName Game name to match
270 * @param store Store the game is from
271 * @return Suggested GAMEID or empty if no match found
272 */
273 std::string suggestGameId(const std::string& gameName, UMUStore store = UMUStore::None) const;
274
275 // ==========================================================================
276 // Proton Management
277 // ==========================================================================
278
279 /**
280 * @brief Download latest GE-Proton for UMU
281 * @param progressCallback Progress callback
282 * @return True if download succeeded
283 *
284 * Downloads to ~/.local/share/Steam/compatibilitytools.d/
285 */
286 bool downloadGEProton(const ProgressCallback& progressCallback = nullptr);
287
288 /**
289 * @brief Download latest UMU-Proton
290 * @param progressCallback Progress callback
291 * @return True if download succeeded
292 */
293 bool downloadUMUProton(const ProgressCallback& progressCallback = nullptr);
294
295 /**
296 * @brief Check if Proton updates are available
297 * @return True if newer versions exist
298 */
299 bool hasProtonUpdates() const;
300
301 // ==========================================================================
302 // Wine Prefix Management
303 // ==========================================================================
304
305 /**
306 * @brief Get the default Wine prefix path for a GAMEID
307 * @param gameId Game ID
308 * @return Default prefix path ($HOME/Games/umu/GAMEID)
309 */
310 std::string getDefaultPrefixPath(const std::string& gameId) const;
311
312 /**
313 * @brief Check if a Wine prefix exists
314 * @param prefixPath Path to Wine prefix
315 * @return True if prefix directory exists
316 */
317 bool prefixExists(const std::string& prefixPath) const;
318
319 /**
320 * @brief Create a new Wine prefix via umu-run
321 * @param prefixPath Path for new prefix
322 * @param protonPath Proton version to use
323 * @return True if creation succeeded
324 */
325 bool createPrefix(const std::string& prefixPath, const std::string& protonPath = "");
326
327 /**
328 * @brief Run winetricks verbs in a prefix via umu
329 * @param prefixPath Wine prefix path
330 * @param verbs Winetricks verbs to install
331 * @param protonPath Proton version to use
332 * @param progressCallback Progress callback
333 * @return True if all verbs installed successfully
334 */
335 bool runWinetricks(const std::string& prefixPath, const std::vector<std::string>& verbs,
336 const std::string& protonPath = "",
337 const ProgressCallback& progressCallback = nullptr);
338
339 // ==========================================================================
340 // Utility
341 // ==========================================================================
342
343 /**
344 * @brief Get store identifier string from enum
345 * @param store Store enum value
346 * @return Store string (e.g., "egs", "gog")
347 */
348 static std::string storeToString(UMUStore store);
349
350 /**
351 * @brief Parse store identifier from string
352 * @param str Store string
353 * @return Store enum value
354 */
355 static UMUStore storeFromString(const std::string& str);
356
357 private:
358 class Impl;
359 std::unique_ptr<Impl> impl_;
360};
361
362/**
363 * @brief Get human-readable store name
364 * @param store Store enum
365 * @return Display name (e.g., "Epic Games Store")
366 */
367std::string umuStoreName(UMUStore store);
bool hasProtonUpdates() const
Check if Proton updates are available.
std::vector< UMUProtonVersion > getAvailableProtonVersions() const
Get available Proton versions for UMU.
bool downloadUMUProton(const ProgressCallback &progressCallback=nullptr)
Download latest UMU-Proton.
bool createPrefix(const std::string &prefixPath, const std::string &protonPath="")
Create a new Wine prefix via umu-run.
void refreshProtonVersions()
Refresh the list of available Proton versions.
bool runWinetricks(const std::string &prefixPath, const std::vector< std::string > &verbs, const std::string &protonPath="", const ProgressCallback &progressCallback=nullptr)
Run winetricks verbs in a prefix via umu.
std::string suggestGameId(const std::string &gameName, UMUStore store=UMUStore::None) const
Get suggested GAMEID for a game name.
UMUGameInfo lookupGame(const std::string &gameId) const
Look up a game in the umu database.
bool isAvailable() const
Check if umu-run is available on the system.
bool prefixExists(const std::string &prefixPath) const
Check if a Wine prefix exists.
static UMUStore storeFromString(const std::string &str)
Parse store identifier from string.
std::string buildLaunchCommand(const UMULaunchConfig &config) const
Build the full launch command for umu-run.
bool downloadGEProton(const ProgressCallback &progressCallback=nullptr)
Download latest GE-Proton for UMU.
static std::string storeToString(UMUStore store)
Get store identifier string from enum.
UMULauncher & operator=(const UMULauncher &)=delete
std::vector< UMUGameInfo > searchGames(const std::string &query, std::optional< UMUStore > store=std::nullopt) const
Search for games in the umu database.
std::function< void(int percent, const std::string &status)> ProgressCallback
std::string getDefaultPrefixPath(const std::string &gameId) const
Get the default Wine prefix path for a GAMEID.
std::string getUMURunPath() const
Get path to umu-run binary.
UMULauncher(const UMULauncher &)=delete
UMUInstallStatus getInstallStatus() const
Get detailed installation status.
void buildLaunchComponents(const UMULaunchConfig &config, std::map< std::string, std::string > &envVars, std::vector< std::string > &command) const
Build launch command as separate components.
Information about a game from the umu database.
std::string store
Store identifier.
bool found
Whether game was found in database.
std::string gameId
umu game ID (e.g., "umu-dauntless")
std::string title
Game title.
std::vector< std::string > fixes
List of fixes applied.
Status of UMU installation on the system.
std::string umuRunPath
Path to umu-run binary.
std::string runtimePath
Path to Steam Runtime (~/.local/share/umu).
bool hasGEProton
Is GE-Proton available.
bool hasUMUProton
Is UMU-Proton available.
std::string version
UMU version string.
std::vector< UMUProtonVersion > availableProton
Available Proton versions.
bool isInstalled
Is umu-run available.
Configuration for launching a game via umu-run.
UMUStore store
Storefront for store-specific fixes.
UMUProtonPath protonPathMode
std::string winePrefix
WINEPREFIX path (empty = default at $HOME/Games/umu/GAMEID).
bool enableProtonLog
Enable Proton verbose logging.
std::string protonVerb
PROTON_VERB (e.g., "runinprefix" for multi-game prefix).
std::map< std::string, std::string > environmentVariables
std::string gameId
GAMEID for umu database lookup (e.g., "umu-dauntless").
std::vector< std::string > arguments
Arguments to pass to the executable.
std::string customProtonPath
Custom Proton path when mode is Custom.
std::string customStore
Custom store name when store is Custom.
std::string executable
Path to game executable.
bool enableUMULog
Enable UMU debug logging.
Information about an available Proton version.
bool isUMUProton
Is official UMU-Proton build.
bool isGEProton
Is GloriousEggroll build.
bool isSystemProton
Is system/Steam Proton.
std::string version
Parsed version number.
std::string name
Version name (e.g., "GE-Proton9-20").
std::string path
Full path to the Proton directory.
std::string umuStoreName(UMUStore store)
Get human-readable store name.
UMUStore
Storefront identifiers for game fixes lookup.
@ Ubisoft
Ubisoft Connect.
@ Steam
Steam (usually use Steam directly, but for reference).
@ Itch
itch.io
@ None
No specific store (generic fixes only).
@ EGS
Epic Games Store.
@ EA
EA App / Origin.
@ GOG
GOG.com.
@ Humble
Humble Bundle.
@ Amazon
Amazon Games.
UMUProtonPath
Proton version selection mode for UMU.
@ GEProton
Auto-download latest GE-Proton.
@ Default
Use UMU-Proton (stable Valve Proton with umu patches).
@ Custom
Use custom PROTONPATH specified in customProtonPath.
@ SystemProton
Use system-installed Proton.