game_launcher 1.1.0
Modern Linux game launcher with Steam / Proton / Wine integration
Loading...
Searching...
No Matches
game.h
Go to the documentation of this file.
1// SPDX-License-Identifier: MIT
2// ==============================================================================
3// game.h
4// ==============================================================================
5// Game data structures and classes for storing game information
6// ==============================================================================
7// This file defines the core Game class and related data structures for
8// managing game information in the launcher. It includes:
9// - Game metadata (cover art, description, genres, etc.)
10// - Runner configuration (Wine, Proton, native execution settings)
11// - Statistics tracking (play time, launch count, last played)
12// - Serialization for persistent storage
13// ==============================================================================
14
15#pragma once
16
17// ==============================================================================
18// Includes
19// ==============================================================================
20
21#include <cstdint>
22#include <ctime>
23#include <map>
24#include <string>
25#include <vector>
26
27// ==============================================================================
28// Enumerations
29// ==============================================================================
30
31/**
32 * @enum GameSource
33 * @brief Where the game was acquired from (store/service/local)
34 *
35 * Identifies the source or storefront where the game was obtained.
36 * This is separate from how the game runs (GameRunner).
37 */
38enum class GameSource
39{
40 Local, ///< Manually added game (not from a store)
41 Steam, ///< Steam store/platform
42 GOG, ///< GOG.com (DRM-free games)
43 Epic, ///< Epic Games Store
44 Itch, ///< itch.io indie games
45 Lutris, ///< Lutris community scripts
46 Flatpak, ///< Flatpak package
47 Unknown ///< Unknown or unspecified source
48};
49
50/**
51 * @enum GamePlatform
52 * @brief Platform/runner type for executing the game
53 *
54 * @deprecated This enum mixes source and runner concepts. Use GameSource + GameRunner instead.
55 * Kept for backward compatibility during migration.
56 *
57 * Determines how the game should be launched and what compatibility
58 * layer (if any) should be used.
59 */
60enum class GamePlatform
61{
62 Native, ///< Native Linux executable (no compatibility layer)
63 Wine, ///< Windows game via Wine compatibility layer
64 Proton, ///< Windows game via Proton (Steam's Wine fork)
65 Steam, ///< Steam game (launched via Steam client)
66 GOG, ///< GOG game (DRM-free game from GOG.com)
67 Epic, ///< Epic Games Store game
68 DOSBox, ///< DOS game via DOSBox emulator
69 ScummVM, ///< ScummVM game (adventure game engine)
70 RetroArch ///< RetroArch/emulated game (console emulation)
71};
72
73/**
74 * @enum GameRunner
75 * @brief Runner/compatibility layer for executing the game
76 *
77 * Determines which runtime or compatibility layer should be used
78 * to launch the game.
79 */
80enum class GameRunner
81{
82 Native, ///< Native Linux executable (no compatibility layer)
83 Wine, ///< Wine compatibility layer
84 Proton, ///< Proton (Steam's Wine fork)
85 DOSBox, ///< DOSBox emulator
86 ScummVM ///< ScummVM engine
87};
88
89/**
90 * @enum GameStatus
91 * @brief Current installation and execution status of the game
92 *
93 * Tracks the lifecycle state of a game from addition to library
94 * through installation and execution.
95 */
96enum class GameStatus
97{
98 NotInstalled, ///< Game is in library but not installed
99 Installed, ///< Game is installed and ready to play
100 Launching, ///< Game is being launched (waiting for process to start)
101 Running, ///< Game is currently running
102 Closing, ///< Game is shutting down (waiting for process to terminate)
103 Installing, ///< Game is being installed
104 Updating ///< Game is being updated
105};
106
107/**
108 * @enum CompletionStatus
109 * @brief User's completion/play status for tracking backlog
110 *
111 * Inspired by Playnite's completion tracking system. Allows users to
112 * organize games by their personal progress through them.
113 */
115{
116 NotPlayed, ///< Never played (backlog)
117 Playing, ///< Currently playing
118 Beaten, ///< Main story/campaign completed
119 Completed, ///< 100% completion (achievements, side content, etc.)
120 OnHold, ///< Temporarily paused
121 Abandoned, ///< Stopped playing, unlikely to return
122 Played ///< Played but no clear completion criteria (e.g., multiplayer)
123};
124
125// ==============================================================================
126// Game Runner Configuration
127// ==============================================================================
128
129/**
130 * @struct GameRunnerConfig
131 * @brief Configuration for how to launch and run a game
132 *
133 * Contains all settings needed to properly execute a game, including
134 * executable path, working directory, environment variables, and
135 * platform-specific settings (Wine/Proton configuration).
136 */
138{
139 std::string runnerType; ///< Runner type: "wine", "proton", "native", etc.
140 std::string runnerVersion; ///< Runner version: "wine-8.0", "proton-8.0-5", etc.
141 std::string executablePath; ///< Full path to game executable
142 std::string workingDirectory; ///< Working directory for game execution
143 std::string arguments; ///< Command line arguments to pass to game
144
145 /// Environment variables to set before launching (KEY=VALUE pairs)
146 std::map<std::string, std::string> environmentVariables;
147
148 // =========================================================================
149 // Launch Configuration Mode
150 // =========================================================================
151
152 /// For Steam games: if true, don't sync custom env vars/wrappers to Steam's VDF files.
153 /// Default is true — Steam manages its own launch options. Set to false only when the
154 /// user explicitly configures custom wrappers that need VDF sync (advanced).
155 bool useSteamDefaults = true;
156
157 /// For Steam games: if true, launch via "steam -applaunch" instead of direct Proton.
158 /// This is a fallback for games with aggressive DRM or those that require Steam's
159 /// runtime to function (e.g., CEG-protected titles, games using Steamworks networking).
160 /// Default is false — direct Proton launch gives full control over wrappers/env vars.
161 bool useSteamLaunch = false;
162
163 // =========================================================================
164 // Wine/Proton Specific Settings
165 // =========================================================================
166
167 std::string winePrefix; ///< WINEPREFIX path (Wine install location)
168 std::string winePath; ///< Custom Wine binary path (e.g., from Lutris config)
169 std::string wineDLL; ///< DLL overrides (e.g., "d3d11=native,builtin")
170 std::string protonVersion; ///< Proton version (e.g., "proton-cachyos-slr")
171
172 /// Processes to exclude when tracking launcher child processes
173 /// These are helper processes that should not be considered "the game"
174 /// Example: "Agent.exe", "Battle.net Helper.exe"
175 std::vector<std::string> excludeProcesses;
176 bool useVirtualDesktop; ///< Launch game in Wine virtual desktop
177 int virtualDesktopWidth; ///< Virtual desktop width in pixels
178 int virtualDesktopHeight; ///< Virtual desktop height in pixels
179
180 // =========================================================================
181 // Performance Wrappers
182 // =========================================================================
183
184 bool enableMangoHud; ///< Enable MangoHud performance overlay
185 std::string mangoHudConfigFile; ///< Per-game MangoHud config file path (MANGOHUD_CONFIGFILE)
186 bool enableGameMode; ///< Enable GameMode CPU governor optimization
187 bool enableGamePerformance; ///< Enable game-performance wrapper (CachyOS)
188 bool enableVkBasalt; ///< Enable VkBasalt shader injection
189
190 // =========================================================================
191 // Gamescope Configuration
192 // =========================================================================
193
194 bool enableGamescope; ///< Enable Gamescope compositor
195 int gamescopeWidth; ///< Gamescope output width (0 = native)
196 int gamescopeHeight; ///< Gamescope output height (0 = native)
197 int gamescopeInternalWidth; ///< Internal render width for FSR upscaling (0 = native)
198 int gamescopeInternalHeight; ///< Internal render height for FSR upscaling (0 = native)
199 int gamescopeRefreshRate; ///< Refresh rate limit (0 = no limit)
200 bool gamescopeFullscreen; ///< Run in fullscreen mode
201 bool gamescopeBorderless; ///< Borderless window mode
202 bool gamescopeEnableFSR; ///< Enable AMD FSR upscaling
203 int gamescopeFSRSharpness; ///< FSR sharpness (0-20, 0 = max sharp)
204 bool gamescopeEnableVRR; ///< Enable Variable Refresh Rate
205 bool gamescopeEnableHDR; ///< Enable HDR output
206 bool gamescopeEnableITM; ///< Enable HDR inverse tone mapping for SDR games
207 int gamescopeITMSDRNits; ///< ITM SDR nits reference (0 = use default)
208 bool gamescopeIntegerScaling; ///< Enable integer scaling filter
209 bool gamescopeForceGrabCursor; ///< Force cursor grab (useful for some games)
210
211 // =========================================================================
212 // Synchronization Options
213 // =========================================================================
214
215 bool enableFsync; ///< Enable Fsync (kernel 5.16+, best performance)
216 bool autoDetectSync; ///< Auto-detect best sync method (default: true)
217
218 // =========================================================================
219 // Debugging
220 // =========================================================================
221
222 bool enableDetailedLogging; ///< Enable detailed Wine/Proton logging
223
224 /// Round-trip-preservation buffer. Holds any JSON keys present in the
225 /// on-disk runner_config blob that this build doesn't recognise (e.g.
226 /// fields written by a newer launcher version). Stored as a serialised
227 /// JSON object string so game.h stays lightweight (no nlohmann include).
228 /// On serialise, the unknown fields are merged back into the output
229 /// alongside the typed fields. Empty by default.
230 std::string unknownJsonExtras;
231
232 /**
233 * @brief Constructor with sensible defaults
234 *
235 * Initializes Wine/Proton settings to common defaults:
236 * - Virtual desktop disabled
237 * - 1920x1080 virtual desktop size (if enabled)
238 * - Gamescope disabled
239 * - Auto-detect sync enabled
240 * - Wrappers disabled by default
241 */
254};
255
256// ==============================================================================
257// Launch Info - Applied Optimizations
258// ==============================================================================
259
260/**
261 * @struct LaunchInfo
262 * @brief Information about optimizations and settings applied during game launch
263 *
264 * Captures what was actually applied when launching a game, useful for
265 * displaying to the user so they know what's running.
266 */
268{
269 // Runner info
270 std::string runner; ///< Runner used: "Wine", "Proton", "Native"
271 std::string runnerVersion; ///< Version: wine-cachyos, UMU-Proton, etc.
272 std::string winePrefix; ///< Wine prefix path used
273
274 // Synchronization
275 std::string syncMethod; ///< "Fsync", "Esync", or "None"
276
277 // GPU optimizations
278 std::string gpuVendor; ///< "AMD", "NVIDIA", "Intel"
279 bool amdAntiLag = false; ///< AMD Anti-Lag enabled
280 bool nvidiaNvapi = false; ///< NVIDIA NVAPI enabled
281
282 // Performance wrappers
283 bool mangoHud = false; ///< MangoHud enabled
284 bool gameMode = false; ///< GameMode enabled
285 bool gamePerformance = false; ///< game-performance enabled
286 bool vkBasalt = false; ///< VkBasalt enabled
287 bool gamescope = false; ///< Gamescope compositor enabled
288 std::string gamescopeMode; ///< Gamescope mode info (e.g., "1920x1080@144 FSR")
289
290 // Application-specific fixes
291 std::vector<std::string> appliedFixes; ///< e.g., "WINE_SIMULATE_WRITECOPY=1"
292
293 // Environment variables count
294 int customEnvVars = 0; ///< Number of custom environment variables
295
296 /**
297 * @brief Generate a human-readable summary of applied optimizations
298 * @param detailed If true, include all details; if false, just key items
299 * @return Summary string suitable for display
300 */
301 std::string getSummary(bool detailed = false) const
302 {
303 std::string summary;
304
305 // Runner
306 summary += runner;
307 if (!runnerVersion.empty())
308 summary += " (" + runnerVersion + ")";
309
310 // Sync method (NTSync is best, highlight it)
311 if (!syncMethod.empty())
312 summary += " | " + syncMethod;
313
314 // GPU opts
315 if (amdAntiLag)
316 summary += " | AMD Anti-Lag";
317 if (nvidiaNvapi)
318 summary += " | NVAPI";
319
320 // Wrappers and compositors
321 std::vector<std::string> wrappers;
322 if (gamescope)
323 {
324 std::string gs = "Gamescope";
325 if (!gamescopeMode.empty())
326 gs += " (" + gamescopeMode + ")";
327 wrappers.push_back(gs);
328 }
329 if (mangoHud)
330 wrappers.push_back("MangoHud");
331 if (gameMode)
332 wrappers.push_back("GameMode");
333 if (gamePerformance)
334 wrappers.push_back("game-performance");
335 if (vkBasalt)
336 wrappers.push_back("VkBasalt");
337
338 if (!wrappers.empty())
339 {
340 summary += " | ";
341 for (size_t i = 0; i < wrappers.size(); i++)
342 {
343 if (i > 0)
344 summary += ", ";
345 summary += wrappers[i];
346 }
347 }
348
349 // Fixes (detailed only)
350 if (detailed && !appliedFixes.empty())
351 {
352 summary += " | Fixes: ";
353 for (size_t i = 0; i < appliedFixes.size(); i++)
354 {
355 if (i > 0)
356 summary += ", ";
357 summary += appliedFixes[i];
358 }
359 }
360
361 return summary;
362 }
363};
364
365// ==============================================================================
366// Actual Runtime Info - Read from running process
367// ==============================================================================
368
369/**
370 * @struct ActualRuntimeInfo
371 * @brief Actual environment and command line read from a running process
372 *
373 * This struct captures the REAL runtime environment of a game process by
374 * reading from `/proc/{pid}/environ` and `/proc/{pid}/cmdline`. This
375 * serves as a "sanity check" to verify what was actually applied vs
376 * what was configured.
377 */
379{
380 int pid = -1; ///< Process ID this info was read from
381 std::string commandLine; ///< Full command line from /proc/pid/cmdline
382 std::map<std::string, std::string> envVars; ///< All environment variables
383 bool valid = false; ///< Whether the read was successful
384
385 // Key gaming-related env vars to highlight
386 static const std::vector<std::string>& getKeyEnvVars()
387 {
388 static std::vector<std::string> keys = {
389 // Sync
390 "PROTON_NO_ESYNC",
391 "PROTON_NO_FSYNC",
392 "WINEESYNC",
393 "WINEFSYNC",
394 // Proton/Wine
395 "PROTON_LOG",
396 "PROTON_USE_WINED3D",
397 "PROTON_FORCE_NVAPI",
398 "PROTON_USE_WOW64",
399 "PROTON_HIDE_NVIDIA_GPU",
400 "PROTON_NO_WRITE_WATCH",
401 "PROTON_USE_XALIA",
402 "PROTON_EAC_RUNTIME",
403 "PROTON_BATTLEYE_RUNTIME",
404 "WINE_FULLSCREEN_FSR",
405 "WINE_SIMULATE_WRITECOPY",
406 "WINEPREFIX",
407 "WINEDLLOVERRIDES",
408 // DXVK
409 "DXVK_HUD",
410 "DXVK_ASYNC",
411 "DXVK_HDR",
412 "DXVK_LOG_LEVEL",
413 "DXVK_STATE_CACHE_PATH",
414 "__GL_SHADER_DISK_CACHE_SKIP_CLEANUP",
415 // FSR/Upscaling
416 "WINE_FULLSCREEN_FSR",
417 "WINE_FULLSCREEN_FSR_STRENGTH",
418 "ENABLE_GAMESCOPE_WSI",
419 // NVIDIA
420 "PROTON_FORCE_NVAPI",
421 "DXVK_ENABLE_NVAPI",
422 "__NV_PRIME_RENDER_OFFLOAD",
423 "VKD3D_FEATURE_LEVEL",
424 // AMD
425 "RADV_PERFTEST",
426 "AMD_VULKAN_ICD",
427 "mesa_glthread",
428 // Performance
429 "MANGOHUD",
430 "MANGOHUD_CONFIG",
431 "ENABLE_VKBASALT",
432 "__GL_THREADED_OPTIMIZATIONS",
433 // Steam
434 "STEAM_COMPAT_DATA_PATH",
435 "STEAM_COMPAT_CLIENT_INSTALL_PATH",
436 "SteamAppId",
437 "SteamGameId",
438 // UMU
439 "GAMEID",
440 "PROTONPATH",
441 "WINEPREFIX",
442 };
443 return keys;
444 }
445
446 /**
447 * @brief Read actual runtime info from a process
448 * @param processId PID to read from
449 * @return Populated ActualRuntimeInfo (check .valid to see if successful)
450 */
451 static ActualRuntimeInfo readFromProcess(int processId);
452
453 /**
454 * @brief Get only gaming-related environment variables
455 * @return Map of key env var name -> value (only if set)
456 */
457 std::map<std::string, std::string> getKeyEnvironment() const;
458
459 /**
460 * @brief Compare configured vs actual environment
461 * @param configured Expected environment variables (key=value strings)
462 * @return Vector of differences: "KEY: expected 'X', actual 'Y'" or "KEY: missing" or "KEY:
463 * unexpected 'Y'"
464 */
465 std::vector<std::string>
466 compareWithConfigured(const std::vector<std::string>& configured) const;
467};
468
469// ==============================================================================
470// Game Image Types
471// ==============================================================================
472
473/**
474 * @enum ImageType
475 * @brief Types of game images available
476 */
477enum class ImageType
478{
479 VerticalCover, ///< Vertical cover art (600x900, portrait)
480 HeroImage, ///< Wide banner/hero image (landscape)
481 Logo, ///< Game logo with transparency (PNG)
482 Header, ///< Small header image (460x215)
483 Capsule, ///< Store capsule image (616x353)
484 Icon ///< Small square icon
485};
486
487/**
488 * @struct GameImagePaths
489 * @brief Paths to various game image assets
490 *
491 * Stores paths to different image types for a game. For Steam games, these
492 * typically point directly to Steam's cache directory. For other games, they
493 * may point to downloaded/cached images.
494 */
496{
497 std::string verticalCover; ///< Vertical cover art (library_600x900.jpg)
498 std::string heroImage; ///< Wide banner/hero image (library_hero.jpg)
499 std::string logo; ///< Game logo with transparency (logo.png)
500 std::string header; ///< Small header image (header.jpg, 460x215)
501 std::string capsule; ///< Store capsule image (capsule_616x353.jpg)
502 std::string icon; ///< Small square icon (icon.jpg)
503};
504
505// ==============================================================================
506// Steam Cloud Saves
507// ==============================================================================
508
509/**
510 * @struct CloudSaveInfo
511 * @brief Information about Steam Cloud save synchronization
512 *
513 * Stores cloud save status for Steam games including whether cloud saves
514 * are enabled, storage size, and last sync status.
515 */
517{
518 bool enabled = false; ///< Cloud saves enabled for this game
519 bool supported = false; ///< Game supports Steam Cloud
520 int lastSyncState = 0; ///< 0=synced, 1=uploading, 2=downloading, 3=error
521 uint64_t storageBytes = 0; ///< Cloud storage used in bytes
522 time_t lastSyncTime = 0; ///< Last successful sync timestamp
523};
524
525// ==============================================================================
526// DLC Information
527// ==============================================================================
528
529/**
530 * @struct DLCInfo
531 * @brief Information about downloadable content (DLC)
532 *
533 * Stores information about a single DLC item for a game.
534 */
536{
537 int appId = 0; ///< Steam App ID of the DLC
538 std::string name; ///< DLC display name
539 bool installed = false; ///< True if DLC is installed
540 uint64_t sizeBytes = 0; ///< Installation size in bytes
541};
542
543// ==============================================================================
544// Game Metadata
545// ==============================================================================
546
547/**
548 * @struct GameMetadata
549 * @brief Descriptive information and media for a game
550 *
551 * Stores user-facing information about the game including cover art,
552 * description, genres, and ratings. This data is displayed in the UI
553 * and helps users organize and find games.
554 */
556{
557 // Image paths
558 std::string
559 coverArtPath; ///< Path to cover art image file (DEPRECATED - use imagePaths.verticalCover)
560 std::string
561 bannerPath; ///< Path to banner/header image file (DEPRECATED - use imagePaths.heroImage)
562 GameImagePaths imagePaths; ///< Paths to all available image assets
563
564 // Descriptive metadata
565 std::string description; ///< Game description text
566 std::vector<std::string> genres; ///< Game genres (RPG, FPS, Strategy, etc.)
567 std::vector<std::string> tags; ///< User-defined tags for organization
568 std::string developer; ///< Developer/studio name
569 std::string publisher; ///< Publisher name
570 int releaseYear; ///< Year the game was released
571 float userRating; ///< User rating (0.0-5.0 scale)
572
573 // Steam-specific metadata
574 bool isSteamGame = false; ///< True if imported from Steam
575 int steamAppId = 0; ///< Steam App ID (0 if not a Steam game)
576 bool steamInstalled = false; ///< True if Steam game is installed (set during Steam import)
577 std::string steamLaunchOptions; ///< Steam launch options from localconfig.vdf
578 std::string steamBuildId; ///< Steam build ID
579 uint32_t steamPlaytime2Weeks = 0; ///< Playtime in last 2 weeks (minutes)
580 time_t steamLastLaunch = 0; ///< Last launch timestamp from Steam
581 time_t steamLastExit = 0; ///< Last exit timestamp from Steam
582 std::string steamType; ///< Steam app type: game, dlc, demo, tool, music, etc.
583 std::vector<std::string>
584 steamCategories; ///< Steam categories (Single-player, Multi-player, etc.)
585
586 // Steam installation/update progress tracking
587 uint32_t steamStateFlags = 0; ///< Steam StateFlags from appmanifest
588 uint64_t steamBytesDownloaded = 0; ///< Bytes downloaded so far
589 uint64_t steamBytesToDownload = 0; ///< Total bytes to download
590 bool steamIsDownloading = false; ///< Currently downloading/updating
591 bool steamIsUpdatePending = false; ///< Update available but not yet started
592
593 // Phase 5 Enhancements: Additional Steam Integration
594 std::vector<std::string>
595 steamUserCategories; ///< User-defined categories from Steam (tags section)
596 CloudSaveInfo cloudSave; ///< Steam Cloud save information
597 std::vector<DLCInfo> dlc; ///< Installed DLC for this game
598
599 // ProtonDB Compatibility Cache
600 std::string
601 protondbTier; ///< Cached tier: "platinum", "gold", "silver", "bronze", "borked", "native"
602 std::string protondbConfidence; ///< Cached confidence: "strong", "good", "weak"
603 float protondbScore = 0.0f; ///< Cached score (0.0-1.0)
604 time_t protondbLastUpdated = 0; ///< When ProtonDB data was last fetched
605
606 /// Round-trip-preservation buffer. See GameRunnerConfig::unknownJsonExtras.
607 std::string unknownJsonExtras;
608
609 /**
610 * @brief Constructor with defaults
611 *
612 * Initializes numeric fields to zero/empty values.
613 */
615};
616
617// ==============================================================================
618// Play Session Tracking
619// ==============================================================================
620
621/**
622 * @struct PlaySession
623 * @brief Record of a single game play session
624 *
625 * Tracks individual play sessions with start/end times, duration, and
626 * metadata about the session. Enables detailed playtime analytics and
627 * session history viewing (like Playnite).
628 */
630{
631 int64_t sessionId = 0; ///< Unique session ID (auto-generated)
632 time_t startTime = 0; ///< Unix timestamp when session started
633 time_t endTime = 0; ///< Unix timestamp when session ended (0 if still running)
634 double durationSeconds = 0; ///< Session duration in seconds
635
636 // Session metadata
637 std::string protonVersion; ///< Proton/Wine version used
638 std::string exitReason; ///< "normal", "crash", "timeout", "force_stop"
639 int exitCode = 0; ///< Process exit code
640
641 // Performance metrics (if captured)
642 float avgFps = 0.0f; ///< Average FPS during session (0 if not captured)
643 float minFps = 0.0f; ///< Minimum FPS during session
644 float avgFrametime = 0.0f; ///< Average frametime in ms
645
646 /**
647 * @brief Check if session is still active
648 */
649 bool isActive() const
650 {
651 return endTime == 0;
652 }
653
654 /**
655 * @brief Get formatted duration string
656 * @return Duration in "Xh Ym" format
657 */
658 std::string getFormattedDuration() const;
659};
660
661// ==============================================================================
662// HowLongToBeat Data
663// ==============================================================================
664
665/**
666 * @struct HowLongToBeatInfo
667 * @brief Time-to-beat estimates from HowLongToBeat.com
668 *
669 * Provides completion time estimates for planning play sessions.
670 */
672{
673 int hltbId = 0; ///< HowLongToBeat game ID
674 std::string matchedName; ///< Name matched on HLTB
675
676 // Time estimates in hours
677 double mainStoryHours = 0.0; ///< Main story/campaign only
678 double mainPlusExtrasHours = 0.0; ///< Main + side content
679 double completionistHours = 0.0; ///< 100% completion
680 double allStylesHours = 0.0; ///< Average across all playstyles
681
682 // Metadata
683 time_t lastUpdated = 0; ///< When this data was fetched
684 bool found = false; ///< Whether a match was found
685
686 /**
687 * @brief Check if data is stale (older than 30 days)
688 */
689 bool isStale() const;
690
691 /**
692 * @brief Get formatted time string for a playstyle
693 * @param hours Time in hours
694 * @return Formatted string like "25h" or "120h"
695 */
696 static std::string formatHours(double hours);
697};
698
699// ==============================================================================
700// Game Statistics
701// ==============================================================================
702
703/**
704 * @struct GameStatistics
705 * @brief Play statistics and usage tracking for a game
706 *
707 * Tracks how often and how long a game has been played, as well as
708 * important dates (when added, when installed, when last played).
709 * This data is used for "Recently Played" and "Most Played" features.
710 */
712{
713 int timesLaunched; ///< Number of times game was launched
714 double totalPlayTimeSeconds; ///< Total play time in seconds (for all sessions)
715 time_t lastPlayed; ///< Unix timestamp of last play session
716 time_t dateAdded; ///< Unix timestamp when added to library
717 time_t dateInstalled; ///< Unix timestamp when installed
718
719 // Launch details
720 std::string lastLaunchCommand; ///< Full command used for last launch (with env vars)
721 std::string lastProtonVersion; ///< Proton version used in last launch
722 std::map<std::string, std::string>
723 lastEnvironmentVars; ///< Environment variables from last launch
724
725 // Exit tracking (for Steam games)
726 std::string lastExitReason; ///< Reason game stopped: "normal", "crash", "timeout", "unknown"
727 time_t lastExitTime; ///< Unix timestamp of last exit
728 int crashCount; ///< Number of times game has crashed
729
730 /**
731 * @brief Constructor with defaults
732 *
733 * Initializes all counters and timestamps to zero.
734 */
740};
741
742// ==============================================================================
743// Game Class
744// ==============================================================================
745
746/**
747 * @class Game
748 * @brief Complete representation of a game in the library
749 *
750 * The Game class stores all information about a game, including:
751 * - Core identifying information (id, name, platform)
752 * - How to run the game (runnerConfig)
753 * - Descriptive metadata (cover art, description, genres)
754 * - Usage statistics (play time, launch count)
755 * - User organization (favorites, collections)
756 * - Installation details (path, size, status)
757 *
758 * ## Data Persistence
759 * Games are persisted in the SQLite-backed GameLibrary. Per-field JSON
760 * serialization is used for nested structs (runner config, metadata).
761 *
762 * ## Thread Safety
763 * This class is NOT thread-safe. External synchronization is required
764 * if a Game object is accessed from multiple threads.
765 */
766class Game
767{
768 public:
769 // ==========================================================================
770 // Core Properties
771 // ==========================================================================
772
773 std::string id; ///< Unique identifier (auto-generated or user-specified)
774 std::string name; ///< Display name shown in UI
775 GameSource source; ///< Where the game was acquired from (Steam, GOG, Local, etc.)
776 GamePlatform platform; ///< @deprecated Platform/runner type for execution (use source + runner)
777 GameRunner runner; ///< Runner/compatibility layer to use (Native, Proton, Wine, etc.)
778 GameStatus status; ///< Current installation and execution status
779
780 // ==========================================================================
781 // Configuration
782 // ==========================================================================
783
784 GameRunnerConfig runnerConfig; ///< How to launch and run the game
785 GameMetadata metadata; ///< Descriptive information and media
786 GameStatistics statistics; ///< Play statistics and usage tracking
787
788 // ==========================================================================
789 // Configuration Templates (saved presets for this game)
790 // ==========================================================================
791
792 /// Named configuration templates (presets) that can be switched between
793 /// Key is template name (e.g., "Performance", "Quality", "Compatibility")
794 std::map<std::string, GameRunnerConfig> configTemplates;
795
796 /// Currently active template name (empty = using runnerConfig directly)
798
799 // ==========================================================================
800 // User Organization
801 // ==========================================================================
802
803 bool isFavorite; ///< Is this marked as a favorite game?
804 std::vector<std::string> collections; ///< Collections this game belongs to
805
806 // ==========================================================================
807 // Completion & Progress Tracking
808 // ==========================================================================
809
811 std::vector<PlaySession> recentSessions; ///< Recent play sessions (last 20 kept in memory)
812 HowLongToBeatInfo hltbInfo; ///< Time-to-beat estimates
813 std::string userNotes; ///< User's personal notes about the game
814
815 // ==========================================================================
816 // Installation
817 // ==========================================================================
818
819 std::string installPath; ///< Installation directory path
820 uint64_t installSizeBytes; ///< Installation size in bytes
821
822 // ==========================================================================
823 // Performance Cache (Mutable for lazy computation)
824 // ==========================================================================
825
826 /// Cached lowercase name for case-insensitive search (computed on first access)
827 mutable std::string nameLowerCache_;
828 /// Cached lowercase developer for case-insensitive search (computed on first access)
829 mutable std::string developerLowerCache_;
830 /// Cached lowercase publisher for case-insensitive search (computed on first access)
831 mutable std::string publisherLowerCache_;
832 /// Cached lowercase description for case-insensitive search (computed on first access)
833 mutable std::string descriptionLowerCache_;
834 /// True if caches have been computed
835 mutable bool cacheInitialized_ = false;
836
837 // ==========================================================================
838 // Constructor & Destructor
839 // ==========================================================================
840
841 /**
842 * @brief Default constructor
843 *
844 * Creates a new Game with default values:
845 * - Source: Local
846 * - Platform: Native (deprecated)
847 * - Runner: Native
848 * - Status: NotInstalled
849 * - Not a favorite
850 * - Zero install size
851 */
857
858 // No user-declared destructor: per [class.copy.ctor]/8 and
859 // [class.copy.assign]/4, declaring even a defaulted destructor
860 // suppresses the implicit move constructor/assignment, which would
861 // make `games_[id] = std::move(game)` silently fall back to copy.
862 // The compiler-generated implicit destructor is sufficient here
863 // (no resources held that need explicit cleanup).
864
865 // ==========================================================================
866 // Helper Methods
867 // ==========================================================================
868
869 /**
870 * @brief Get human-readable source name
871 * @return Source name as string (e.g., "Steam", "GOG", "Local")
872 */
873 std::string getSourceName() const;
874
875 /**
876 * @brief Get human-readable runner name
877 * @return Runner name as string (e.g., "Native", "Proton", "Wine")
878 */
879 std::string getRunnerName() const;
880
881 /**
882 * @brief Get human-readable platform name
883 * @return Platform name as string (e.g., "Native Linux", "Wine", "Proton")
884 * @deprecated Use getSourceName() and getRunnerName() instead
885 */
886 std::string getPlatformName() const;
887
888 /**
889 * @brief Get human-readable status name
890 * @return Status name as string (e.g., "Installed", "Running", "Not Installed")
891 */
892 std::string getStatusName() const;
893
894 /**
895 * @brief Format total play time as human-readable string
896 * @return Formatted play time (e.g., "42h 30m", "2h 15m", "45m")
897 */
898 std::string getFormattedPlayTime() const;
899
900 /**
901 * @brief Format install size as human-readable string
902 * @return Formatted size (e.g., "1.5 GB", "250 MB", "45.2 KB")
903 */
904 std::string getFormattedInstallSize() const;
905
906 /**
907 * @brief Sync the deprecated platform field from the current runner and source
908 *
909 * Call this after setting runner/source to keep platform consistent.
910 * This exists for backward compatibility with code that still reads platform.
911 */
913 {
914 switch (runner)
915 {
918 break;
919 case GameRunner::Wine:
921 break;
924 break;
927 break;
930 break;
931 }
932 // Override for Steam source games
935 }
936
937 /**
938 * @brief Check if game is currently installed
939 * @return True if status is Installed or Running
940 *
941 * For Steam games, the steamInstalled metadata flag takes precedence
942 * since it's synced from Steam's actual state.
943 */
944 bool isInstalled() const
945 {
946 // For Steam games, steamInstalled flag is the source of truth
947 // (synced from appmanifest state during import/refresh)
948 if (source == GameSource::Steam && metadata.steamAppId > 0)
949 {
950 return metadata.steamInstalled;
951 }
953 }
954
955 /**
956 * @brief Check if game is currently running
957 * @return True if status is Running
958 */
959 bool isRunning() const
960 {
961 return status == GameStatus::Running;
962 }
963
964 /**
965 * @brief Get human-readable completion status name
966 * @return Status name (e.g., "Not Played", "Playing", "Beaten")
967 */
968 std::string getCompletionStatusName() const;
969
970 /**
971 * @brief Get estimated remaining playtime based on HLTB data
972 * @param targetStyle Target playstyle (0=main, 1=main+extras, 2=completionist)
973 * @return Remaining hours (negative if exceeded estimate), or -1 if no data
974 */
975 double getRemainingPlaytime(int targetStyle = 0) const;
976
977 /**
978 * @brief Get completion percentage based on HLTB estimate
979 * @param targetStyle Target playstyle (0=main, 1=main+extras, 2=completionist)
980 * @return Percentage 0-100+ (can exceed 100 if played longer than estimate)
981 */
982 double getCompletionPercentage(int targetStyle = 0) const;
983
984 /**
985 * @brief Get average session duration for this game
986 * @return Average session length in seconds
987 */
988 double getAverageSessionDuration() const;
989
990 // ==========================================================================
991 // Performance Cache Access
992 // ==========================================================================
993
994 /**
995 * @brief Get lowercase name (cached for performance)
996 * @return Lowercase version of game name
997 *
998 * This method computes lowercase strings on first access and caches them
999 * to avoid 15M+ string transformations per second during search/filtering.
1000 */
1001 const std::string& getNameLower() const;
1002
1003 /**
1004 * @brief Get lowercase developer (cached for performance)
1005 * @return Lowercase version of developer name
1006 */
1007 const std::string& getDeveloperLower() const;
1008
1009 /**
1010 * @brief Get lowercase publisher (cached for performance)
1011 * @return Lowercase version of publisher name
1012 */
1013 const std::string& getPublisherLower() const;
1014
1015 /**
1016 * @brief Get lowercase description (cached for performance)
1017 * @return Lowercase version of description text
1018 */
1019 const std::string& getDescriptionLower() const;
1020
1021 /**
1022 * @brief Invalidate lowercase caches (call when name/metadata changes)
1023 *
1024 * Call this method after modifying name, developer, publisher, or description
1025 * to ensure cached lowercase versions are recomputed on next access.
1026 */
1027 void invalidateCache() const
1028 {
1029 cacheInitialized_ = false;
1030 }
1031
1032 /**
1033 * @brief Get path for a specific image type
1034 * @param type Type of image
1035 * @return Path to image file (empty string if not available)
1036 *
1037 * Returns the path for the requested image type, checking both new imagePaths
1038 * and legacy coverArtPath/bannerPath fields for backwards compatibility.
1039 */
1040 std::string getImagePath(ImageType type) const;
1041
1042 // ==========================================================================
1043 // JSON Serialization (for SQLite storage)
1044 // ==========================================================================
1045
1046 /**
1047 * @brief Serialize runner configuration to JSON
1048 * @return JSON string containing runner config
1049 */
1050 std::string serializeRunnerConfig() const;
1051
1052 /**
1053 * @brief Deserialize runner configuration from JSON
1054 * @param json JSON string to parse
1055 */
1056 void deserializeRunnerConfig(const std::string& json);
1057
1058 /**
1059 * @brief Serialize metadata to JSON
1060 * @return JSON string containing metadata
1061 */
1062 std::string serializeMetadata() const;
1063
1064 /**
1065 * @brief Deserialize metadata from JSON
1066 * @param json JSON string to parse
1067 */
1068 void deserializeMetadata(const std::string& json);
1069};
std::string publisherLowerCache_
Cached lowercase publisher for case-insensitive search (computed on first access).
Definition game.h:831
std::string nameLowerCache_
Cached lowercase name for case-insensitive search (computed on first access).
Definition game.h:827
GameMetadata metadata
Descriptive information and media.
Definition game.h:785
std::string getPlatformName() const
Get human-readable platform name.
Definition game.cpp:68
void deserializeMetadata(const std::string &json)
Deserialize metadata from JSON.
Definition game.cpp:888
std::vector< PlaySession > recentSessions
Recent play sessions (last 20 kept in memory).
Definition game.h:811
std::string userNotes
User's personal notes about the game.
Definition game.h:813
std::string getFormattedInstallSize() const
Format install size as human-readable string.
Definition game.cpp:144
std::vector< std::string > collections
Collections this game belongs to.
Definition game.h:804
std::string installPath
Installation directory path.
Definition game.h:819
CompletionStatus completionStatus
User's completion status.
Definition game.h:810
bool cacheInitialized_
True if caches have been computed.
Definition game.h:835
const std::string & getDeveloperLower() const
Get lowercase developer (cached for performance).
Definition game.cpp:190
bool isFavorite
Is this marked as a favorite game?
Definition game.h:803
std::string name
Display name shown in UI.
Definition game.h:774
const std::string & getNameLower() const
Get lowercase name (cached for performance).
Definition game.cpp:176
std::string getSourceName() const
Get human-readable source name.
Definition game.cpp:25
std::string serializeRunnerConfig() const
Serialize runner configuration to JSON.
Definition game.cpp:647
std::string id
Unique identifier (auto-generated or user-specified).
Definition game.h:773
std::string descriptionLowerCache_
Cached lowercase description for case-insensitive search (computed on first access).
Definition game.h:833
void syncPlatformFromRunner()
Sync the deprecated platform field from the current runner and source.
Definition game.h:912
GameStatistics statistics
Play statistics and usage tracking.
Definition game.h:786
GameRunner runner
Runner/compatibility layer to use (Native, Proton, Wine, etc.).
Definition game.h:777
double getAverageSessionDuration() const
Get average session duration for this game.
Definition game.cpp:367
const std::string & getPublisherLower() const
Get lowercase publisher (cached for performance).
Definition game.cpp:199
void invalidateCache() const
Invalidate lowercase caches (call when name/metadata changes).
Definition game.h:1027
GameRunnerConfig runnerConfig
How to launch and run the game.
Definition game.h:784
std::string getFormattedPlayTime() const
Format total play time as human-readable string.
Definition game.cpp:114
std::string getCompletionStatusName() const
Get human-readable completion status name.
Definition game.cpp:286
GameStatus status
Current installation and execution status.
Definition game.h:778
std::string getStatusName() const
Get human-readable status name.
Definition game.cpp:95
HowLongToBeatInfo hltbInfo
Time-to-beat estimates.
Definition game.h:812
std::map< std::string, GameRunnerConfig > configTemplates
Named configuration templates (presets) that can be switched between Key is template name (e....
Definition game.h:794
uint64_t installSizeBytes
Installation size in bytes.
Definition game.h:820
Game()
Default constructor.
Definition game.h:852
std::string developerLowerCache_
Cached lowercase developer for case-insensitive search (computed on first access).
Definition game.h:829
bool isInstalled() const
Check if game is currently installed.
Definition game.h:944
double getRemainingPlaytime(int targetStyle=0) const
Get estimated remaining playtime based on HLTB data.
Definition game.cpp:309
std::string serializeMetadata() const
Serialize metadata to JSON.
Definition game.cpp:817
std::string activeTemplateName
Currently active template name (empty = using runnerConfig directly).
Definition game.h:797
void deserializeRunnerConfig(const std::string &json)
Deserialize runner configuration from JSON.
Definition game.cpp:724
bool isRunning() const
Check if game is currently running.
Definition game.h:959
GameSource source
Where the game was acquired from (Steam, GOG, Local, etc.).
Definition game.h:775
double getCompletionPercentage(int targetStyle=0) const
Get completion percentage based on HLTB estimate.
Definition game.cpp:338
std::string getRunnerName() const
Get human-readable runner name.
Definition game.cpp:49
std::string getImagePath(ImageType type) const
Get path for a specific image type.
Definition game.cpp:221
const std::string & getDescriptionLower() const
Get lowercase description (cached for performance).
Definition game.cpp:208
GameSource
Where the game was acquired from (store/service/local).
Definition game.h:39
@ Steam
Steam store/platform.
Definition game.h:41
@ Local
Manually added game (not from a store).
Definition game.h:40
@ Itch
itch.io indie games
Definition game.h:44
@ Lutris
Lutris community scripts.
Definition game.h:45
@ Unknown
Unknown or unspecified source.
Definition game.h:47
@ GOG
GOG.com (DRM-free games).
Definition game.h:42
@ Flatpak
Flatpak package.
Definition game.h:46
@ Epic
Epic Games Store.
Definition game.h:43
GamePlatform
Platform/runner type for executing the game.
Definition game.h:61
@ ScummVM
ScummVM game (adventure game engine).
Definition game.h:69
@ RetroArch
RetroArch/emulated game (console emulation).
Definition game.h:70
@ Steam
Steam game (launched via Steam client).
Definition game.h:65
@ Proton
Windows game via Proton (Steam's Wine fork).
Definition game.h:64
@ Native
Native Linux executable (no compatibility layer).
Definition game.h:62
@ Wine
Windows game via Wine compatibility layer.
Definition game.h:63
@ DOSBox
DOS game via DOSBox emulator.
Definition game.h:68
ImageType
Types of game images available.
Definition game.h:478
@ HeroImage
Wide banner/hero image (landscape).
Definition game.h:480
@ Capsule
Store capsule image (616x353).
Definition game.h:483
@ VerticalCover
Vertical cover art (600x900, portrait).
Definition game.h:479
@ Icon
Small square icon.
Definition game.h:484
@ Logo
Game logo with transparency (PNG).
Definition game.h:481
@ Header
Small header image (460x215).
Definition game.h:482
GameStatus
Current installation and execution status of the game.
Definition game.h:97
@ Installing
Game is being installed.
Definition game.h:103
@ NotInstalled
Game is in library but not installed.
Definition game.h:98
@ Running
Game is currently running.
Definition game.h:101
@ Closing
Game is shutting down (waiting for process to terminate).
Definition game.h:102
@ Updating
Game is being updated.
Definition game.h:104
@ Installed
Game is installed and ready to play.
Definition game.h:99
@ Launching
Game is being launched (waiting for process to start).
Definition game.h:100
GameRunner
Runner/compatibility layer for executing the game.
Definition game.h:81
@ ScummVM
ScummVM engine.
Definition game.h:86
@ Proton
Proton (Steam's Wine fork).
Definition game.h:84
@ Native
Native Linux executable (no compatibility layer).
Definition game.h:82
@ Wine
Wine compatibility layer.
Definition game.h:83
@ DOSBox
DOSBox emulator.
Definition game.h:85
CompletionStatus
User's completion/play status for tracking backlog.
Definition game.h:115
@ Played
Played but no clear completion criteria (e.g., multiplayer).
Definition game.h:122
@ Completed
100% completion (achievements, side content, etc.)
Definition game.h:119
@ Abandoned
Stopped playing, unlikely to return.
Definition game.h:121
@ Beaten
Main story/campaign completed.
Definition game.h:118
@ OnHold
Temporarily paused.
Definition game.h:120
@ Playing
Currently playing.
Definition game.h:117
@ NotPlayed
Never played (backlog).
Definition game.h:116
nlohmann::json json
Actual environment and command line read from a running process.
Definition game.h:379
static const std::vector< std::string > & getKeyEnvVars()
Definition game.h:386
std::vector< std::string > compareWithConfigured(const std::vector< std::string > &configured) const
Compare configured vs actual environment.
Definition game.cpp:1085
int pid
Process ID this info was read from.
Definition game.h:380
static ActualRuntimeInfo readFromProcess(int processId)
Read actual runtime info from a process.
Definition game.cpp:999
std::map< std::string, std::string > envVars
All environment variables.
Definition game.h:382
std::map< std::string, std::string > getKeyEnvironment() const
Get only gaming-related environment variables.
Definition game.cpp:1067
std::string commandLine
Full command line from /proc/pid/cmdline.
Definition game.h:381
bool valid
Whether the read was successful.
Definition game.h:383
Information about Steam Cloud save synchronization.
Definition game.h:517
uint64_t storageBytes
Cloud storage used in bytes.
Definition game.h:521
time_t lastSyncTime
Last successful sync timestamp.
Definition game.h:522
bool enabled
Cloud saves enabled for this game.
Definition game.h:518
bool supported
Game supports Steam Cloud.
Definition game.h:519
int lastSyncState
0=synced, 1=uploading, 2=downloading, 3=error
Definition game.h:520
Information about downloadable content (DLC).
Definition game.h:536
int appId
Steam App ID of the DLC.
Definition game.h:537
bool installed
True if DLC is installed.
Definition game.h:539
uint64_t sizeBytes
Installation size in bytes.
Definition game.h:540
std::string name
DLC display name.
Definition game.h:538
Paths to various game image assets.
Definition game.h:496
std::string header
Small header image (header.jpg, 460x215).
Definition game.h:500
std::string capsule
Store capsule image (capsule_616x353.jpg).
Definition game.h:501
std::string logo
Game logo with transparency (logo.png).
Definition game.h:499
std::string icon
Small square icon (icon.jpg).
Definition game.h:502
std::string verticalCover
Vertical cover art (library_600x900.jpg).
Definition game.h:497
std::string heroImage
Wide banner/hero image (library_hero.jpg).
Definition game.h:498
Descriptive information and media for a game.
Definition game.h:556
float userRating
User rating (0.0-5.0 scale).
Definition game.h:571
time_t steamLastLaunch
Last launch timestamp from Steam.
Definition game.h:580
std::vector< std::string > steamCategories
Steam categories (Single-player, Multi-player, etc.).
Definition game.h:584
bool isSteamGame
True if imported from Steam.
Definition game.h:574
std::string coverArtPath
Path to cover art image file (DEPRECATED - use imagePaths.verticalCover).
Definition game.h:559
bool steamInstalled
True if Steam game is installed (set during Steam import).
Definition game.h:576
time_t steamLastExit
Last exit timestamp from Steam.
Definition game.h:581
std::string steamType
Steam app type: game, dlc, demo, tool, music, etc.
Definition game.h:582
uint64_t steamBytesDownloaded
Bytes downloaded so far.
Definition game.h:588
int steamAppId
Steam App ID (0 if not a Steam game).
Definition game.h:575
float protondbScore
Cached score (0.0-1.0).
Definition game.h:603
GameImagePaths imagePaths
Paths to all available image assets.
Definition game.h:562
uint32_t steamStateFlags
Steam StateFlags from appmanifest.
Definition game.h:587
std::string unknownJsonExtras
Round-trip-preservation buffer. See GameRunnerConfig::unknownJsonExtras.
Definition game.h:607
CloudSaveInfo cloudSave
Steam Cloud save information.
Definition game.h:596
std::string description
Game description text.
Definition game.h:565
std::string bannerPath
Path to banner/header image file (DEPRECATED - use imagePaths.heroImage).
Definition game.h:561
std::string developer
Developer/studio name.
Definition game.h:568
bool steamIsUpdatePending
Update available but not yet started.
Definition game.h:591
std::string steamBuildId
Steam build ID.
Definition game.h:578
uint32_t steamPlaytime2Weeks
Playtime in last 2 weeks (minutes).
Definition game.h:579
std::string steamLaunchOptions
Steam launch options from localconfig.vdf.
Definition game.h:577
uint64_t steamBytesToDownload
Total bytes to download.
Definition game.h:589
std::vector< std::string > tags
User-defined tags for organization.
Definition game.h:567
std::vector< std::string > steamUserCategories
User-defined categories from Steam (tags section).
Definition game.h:595
time_t protondbLastUpdated
When ProtonDB data was last fetched.
Definition game.h:604
int releaseYear
Year the game was released.
Definition game.h:570
std::string publisher
Publisher name.
Definition game.h:569
std::string protondbTier
Cached tier: "platinum", "gold", "silver", "bronze", "borked", "native".
Definition game.h:601
GameMetadata()
Constructor with defaults.
Definition game.h:614
std::vector< DLCInfo > dlc
Installed DLC for this game.
Definition game.h:597
std::vector< std::string > genres
Game genres (RPG, FPS, Strategy, etc.).
Definition game.h:566
std::string protondbConfidence
Cached confidence: "strong", "good", "weak".
Definition game.h:602
bool steamIsDownloading
Currently downloading/updating.
Definition game.h:590
Configuration for how to launch and run a game.
Definition game.h:138
bool enableVkBasalt
Enable VkBasalt shader injection.
Definition game.h:188
int gamescopeInternalHeight
Internal render height for FSR upscaling (0 = native).
Definition game.h:198
std::string executablePath
Full path to game executable.
Definition game.h:141
int gamescopeITMSDRNits
ITM SDR nits reference (0 = use default).
Definition game.h:207
bool gamescopeIntegerScaling
Enable integer scaling filter.
Definition game.h:208
bool useSteamDefaults
For Steam games: if true, don't sync custom env vars/wrappers to Steam's VDF files.
Definition game.h:155
int virtualDesktopWidth
Virtual desktop width in pixels.
Definition game.h:177
std::string wineDLL
DLL overrides (e.g., "d3d11=native,builtin").
Definition game.h:169
bool gamescopeFullscreen
Run in fullscreen mode.
Definition game.h:200
std::string workingDirectory
Working directory for game execution.
Definition game.h:142
bool useVirtualDesktop
Launch game in Wine virtual desktop.
Definition game.h:176
std::string arguments
Command line arguments to pass to game.
Definition game.h:143
std::vector< std::string > excludeProcesses
Processes to exclude when tracking launcher child processes These are helper processes that should no...
Definition game.h:175
std::string unknownJsonExtras
Round-trip-preservation buffer.
Definition game.h:230
int gamescopeHeight
Gamescope output height (0 = native).
Definition game.h:196
bool gamescopeEnableFSR
Enable AMD FSR upscaling.
Definition game.h:202
bool enableMangoHud
Enable MangoHud performance overlay.
Definition game.h:184
std::string winePath
Custom Wine binary path (e.g., from Lutris config).
Definition game.h:168
std::string winePrefix
WINEPREFIX path (Wine install location).
Definition game.h:167
int gamescopeFSRSharpness
FSR sharpness (0-20, 0 = max sharp).
Definition game.h:203
bool gamescopeEnableVRR
Enable Variable Refresh Rate.
Definition game.h:204
bool enableGamePerformance
Enable game-performance wrapper (CachyOS).
Definition game.h:187
bool enableFsync
Enable Fsync (kernel 5.16+, best performance).
Definition game.h:215
int gamescopeRefreshRate
Refresh rate limit (0 = no limit).
Definition game.h:199
bool autoDetectSync
Auto-detect best sync method (default: true).
Definition game.h:216
bool gamescopeEnableITM
Enable HDR inverse tone mapping for SDR games.
Definition game.h:206
int gamescopeWidth
Gamescope output width (0 = native).
Definition game.h:195
bool enableDetailedLogging
Enable detailed Wine/Proton logging.
Definition game.h:222
std::string mangoHudConfigFile
Per-game MangoHud config file path (MANGOHUD_CONFIGFILE).
Definition game.h:185
std::string runnerVersion
Runner version: "wine-8.0", "proton-8.0-5", etc.
Definition game.h:140
std::string runnerType
Runner type: "wine", "proton", "native", etc.
Definition game.h:139
int gamescopeInternalWidth
Internal render width for FSR upscaling (0 = native).
Definition game.h:197
bool enableGameMode
Enable GameMode CPU governor optimization.
Definition game.h:186
int virtualDesktopHeight
Virtual desktop height in pixels.
Definition game.h:178
bool enableGamescope
Enable Gamescope compositor.
Definition game.h:194
std::string protonVersion
Proton version (e.g., "proton-cachyos-slr").
Definition game.h:170
std::map< std::string, std::string > environmentVariables
Environment variables to set before launching (KEY=VALUE pairs).
Definition game.h:146
bool gamescopeEnableHDR
Enable HDR output.
Definition game.h:205
bool useSteamLaunch
For Steam games: if true, launch via "steam -applaunch" instead of direct Proton.
Definition game.h:161
bool gamescopeBorderless
Borderless window mode.
Definition game.h:201
GameRunnerConfig()
Constructor with sensible defaults.
Definition game.h:242
bool gamescopeForceGrabCursor
Force cursor grab (useful for some games).
Definition game.h:209
Play statistics and usage tracking for a game.
Definition game.h:712
time_t lastExitTime
Unix timestamp of last exit.
Definition game.h:727
std::string lastExitReason
Reason game stopped: "normal", "crash", "timeout", "unknown".
Definition game.h:726
std::string lastProtonVersion
Proton version used in last launch.
Definition game.h:721
time_t dateInstalled
Unix timestamp when installed.
Definition game.h:717
std::map< std::string, std::string > lastEnvironmentVars
Environment variables from last launch.
Definition game.h:723
std::string lastLaunchCommand
Full command used for last launch (with env vars).
Definition game.h:720
double totalPlayTimeSeconds
Total play time in seconds (for all sessions).
Definition game.h:714
time_t lastPlayed
Unix timestamp of last play session.
Definition game.h:715
int timesLaunched
Number of times game was launched.
Definition game.h:713
time_t dateAdded
Unix timestamp when added to library.
Definition game.h:716
GameStatistics()
Constructor with defaults.
Definition game.h:735
int crashCount
Number of times game has crashed.
Definition game.h:728
Time-to-beat estimates from HowLongToBeat.com.
Definition game.h:672
bool isStale() const
Check if data is stale (older than 30 days).
Definition game.cpp:419
time_t lastUpdated
When this data was fetched.
Definition game.h:683
double allStylesHours
Average across all playstyles.
Definition game.h:680
double completionistHours
100% completion
Definition game.h:679
int hltbId
HowLongToBeat game ID.
Definition game.h:673
bool found
Whether a match was found.
Definition game.h:684
std::string matchedName
Name matched on HLTB.
Definition game.h:674
double mainPlusExtrasHours
Main + side content.
Definition game.h:678
double mainStoryHours
Main story/campaign only.
Definition game.h:677
static std::string formatHours(double hours)
Get formatted time string for a playstyle.
Definition game.cpp:429
Information about optimizations and settings applied during game launch.
Definition game.h:268
bool amdAntiLag
AMD Anti-Lag enabled.
Definition game.h:279
bool gameMode
GameMode enabled.
Definition game.h:284
int customEnvVars
Number of custom environment variables.
Definition game.h:294
bool vkBasalt
VkBasalt enabled.
Definition game.h:286
bool nvidiaNvapi
NVIDIA NVAPI enabled.
Definition game.h:280
bool mangoHud
MangoHud enabled.
Definition game.h:283
std::string getSummary(bool detailed=false) const
Generate a human-readable summary of applied optimizations.
Definition game.h:301
std::string winePrefix
Wine prefix path used.
Definition game.h:272
std::string runner
Runner used: "Wine", "Proton", "Native".
Definition game.h:270
bool gamePerformance
game-performance enabled
Definition game.h:285
std::string gpuVendor
"AMD", "NVIDIA", "Intel"
Definition game.h:278
std::string gamescopeMode
Gamescope mode info (e.g., "1920x1080@144 FSR").
Definition game.h:288
std::string runnerVersion
Version: wine-cachyos, UMU-Proton, etc.
Definition game.h:271
std::vector< std::string > appliedFixes
e.g., "WINE_SIMULATE_WRITECOPY=1"
Definition game.h:291
std::string syncMethod
"Fsync", "Esync", or "None"
Definition game.h:275
bool gamescope
Gamescope compositor enabled.
Definition game.h:287
Record of a single game play session.
Definition game.h:630
std::string getFormattedDuration() const
Get formatted duration string.
Definition game.cpp:391
bool isActive() const
Check if session is still active.
Definition game.h:649
time_t startTime
Unix timestamp when session started.
Definition game.h:632
float minFps
Minimum FPS during session.
Definition game.h:643
std::string exitReason
"normal", "crash", "timeout", "force_stop"
Definition game.h:638
int64_t sessionId
Unique session ID (auto-generated).
Definition game.h:631
double durationSeconds
Session duration in seconds.
Definition game.h:634
time_t endTime
Unix timestamp when session ended (0 if still running).
Definition game.h:633
float avgFrametime
Average frametime in ms.
Definition game.h:644
int exitCode
Process exit code.
Definition game.h:639
std::string protonVersion
Proton/Wine version used.
Definition game.h:637
float avgFps
Average FPS during session (0 if not captured).
Definition game.h:642