|
game_launcher 1.1.0
Modern Linux game launcher with Steam / Proton / Wine integration
|
Service for generating smart game setting recommendations. More...
#include <game_suggestion_service.h>
Public Types | |
| using | SuggestionsCallback = std::function<void(const GameSuggestions&)> |
Static Public Member Functions | |
| static int | applySuggestions (Game &game, const GameSuggestions &suggestions, SuggestionPriority applyLevel=SuggestionPriority::Recommended) |
| Apply suggestions to a game's runner config. | |
| static std::string | categoryToString (SuggestionCategory category) |
| Get category as human-readable string. | |
| static std::vector< std::string > | checkConflicts (const GameSuggestions &suggestions) |
| Check for conflicting environment variables. | |
| static GameSuggestions | getLocalSuggestions (const Game &game) |
| Get local-only suggestions (no network requests). | |
| static GameSuggestions | getSuggestions (const Game &game) |
| Get suggestions for a game. | |
| static GameSuggestions | getSuggestions (int steamAppId, const std::string &gameName) |
| Get suggestions by Steam App ID. | |
| static void | getSuggestionsAsync (const Game &game, SuggestionsCallback callback) |
| Get suggestions asynchronously. | |
| static void | getSuggestionsAsync (int steamAppId, const std::string &gameName, SuggestionsCallback callback) |
| Get suggestions by Steam App ID asynchronously. | |
| static bool | isRunnerAvailable (const std::string &runnerName) |
| Check if a runner exists on the system. | |
| static std::string | priorityToString (SuggestionPriority priority) |
| Get priority as human-readable string. | |
| static void | setCapabilitiesOverrideForTesting (const SystemCapabilities *caps) |
| Override the SystemCapabilities consulted by suggestion generation. | |
| static bool | validateSuggestion (const GameSuggestion &suggestion, std::string &reason) |
| Validate a suggestion before applying. | |
Service for generating smart game setting recommendations.
Definition at line 196 of file game_suggestion_service.h.
| using GameSuggestionService::SuggestionsCallback = std::function<void(const GameSuggestions&)> |
Definition at line 200 of file game_suggestion_service.h.
|
static |
Apply suggestions to a game's runner config.
| game | Game to modify (in-place) |
| suggestions | Suggestions to apply |
| applyLevel | What priority level to auto-apply |
Definition at line 2137 of file game_suggestion_service.cpp.
References GameRunnerConfig::arguments, checkConflicts(), Logger::debug(), GameRunnerConfig::environmentVariables, GameSuggestions::gameName, Logger::info(), priorityToString(), Proton, GameRunnerConfig::protonVersion, Game::runner, Game::runnerConfig, GameRunnerConfig::runnerVersion, GameSuggestions::suggestions, validateSuggestion(), Logger::warn(), and GameRunnerConfig::wineDLL.
|
static |
Get category as human-readable string.
Definition at line 2531 of file game_suggestion_service.cpp.
References Audio, Compatibility, Environment, General, Graphics, Input, Performance, and Runner.
|
static |
Check for conflicting environment variables.
| suggestions | All suggestions being applied |
Definition at line 2425 of file game_suggestion_service.cpp.
References AMD, Intel, NVIDIA, and GameSuggestions::suggestions.
Referenced by applySuggestions().
|
static |
Get local-only suggestions (no network requests).
| game | The game to get suggestions for |
Safe to call from the UI thread. Skips ProtonDB lookups.
Definition at line 2622 of file game_suggestion_service.cpp.
References GameSuggestions::detectedGPU, GameSuggestions::gameName, GameSuggestions::isCachyOS, Game::metadata, Game::name, GameMetadata::steamAppId, and GameSuggestions::steamAppId.
|
static |
Get suggestions for a game.
| game | The game to get suggestions for |
This may make network requests to ProtonDB. For UI updates, prefer getSuggestionsAsync().
Definition at line 389 of file game_suggestion_service.cpp.
References getSuggestions(), Game::metadata, Game::name, and GameMetadata::steamAppId.
Referenced by getSuggestions(), getSuggestionsAsync(), and RecommendationsWidget::loadRecommendations().
|
static |
Get suggestions by Steam App ID.
| steamAppId | Steam App ID |
| gameName | Game name (for display) |
Definition at line 395 of file game_suggestion_service.cpp.
References Critical, Logger::debug(), GameSuggestions::detectedGPU, GameSuggestions::gameName, GameSuggestions::getConfidenceScore(), GameSuggestions::getConfidenceSummary(), GameSuggestions::hasLutrisInstaller, GameSuggestions::hasNativeLinux, Logger::info(), Informational, GameSuggestions::isCachyOS, GameSuggestions::lutrisDownloadCount, Optional, priorityToString(), GameSuggestions::protondbReportCount, GameSuggestions::protondbTier, Recommended, GameSuggestions::steamAppId, GameSuggestions::steamDeckStatus, GameSuggestions::suggestions, and suggestionsCache_.
|
static |
Get suggestions asynchronously.
| game | The game to get suggestions for |
| callback | Function to call with results |
Definition at line 564 of file game_suggestion_service.cpp.
References getSuggestionsAsync(), Game::metadata, Game::name, and GameMetadata::steamAppId.
Referenced by getSuggestionsAsync().
|
static |
Get suggestions by Steam App ID asynchronously.
| steamAppId | Steam App ID |
| gameName | Game name |
| callback | Function to call with results |
Definition at line 569 of file game_suggestion_service.cpp.
References getSuggestions(), and Logger::warn().
|
static |
Check if a runner exists on the system.
| runnerName | The runner name to check |
Definition at line 2339 of file game_suggestion_service.cpp.
References Logger::debug(), and Logger::warn().
Referenced by validateSuggestion().
|
static |
Get priority as human-readable string.
Definition at line 2514 of file game_suggestion_service.cpp.
References Critical, Informational, Optional, and Recommended.
Referenced by applySuggestions(), and getSuggestions().
|
static |
Override the SystemCapabilities consulted by suggestion generation.
Intended for unit tests that need to exercise platform-dependent branches deterministically (e.g., NTSync available, CachyOS detected, AMD vs NVIDIA GPU).
When set to non-null, every internal capabilities read returns the override instead of calling SystemInfoService::instance(). Reset to nullptr to restore normal behaviour.
Not thread-safe — intended for single-threaded test code.
Definition at line 2581 of file game_suggestion_service.cpp.
|
static |
Validate a suggestion before applying.
| suggestion | The suggestion to validate |
| reason | Output: reason if invalid |
Validation checks:
Definition at line 2241 of file game_suggestion_service.cpp.
References AMD, GameSuggestion::envKey, GameSuggestion::envValue, Intel, isRunnerAvailable(), NVIDIA, and GameSuggestion::recommendedRunner.
Referenced by applySuggestions().