|
game_launcher 1.1.0
Modern Linux game launcher with Steam / Proton / Wine integration
|
Service for managing per-game performance profiles. More...
#include <performance_profile_service.h>
Classes | |
| class | Impl |
Public Types | |
| using | OnProfileChanged |
Public Member Functions | |
| PerformanceProfileService () | |
| PerformanceProfileService (const PerformanceProfileService &)=delete | |
| ~PerformanceProfileService () | |
| PerformanceProfile | createFromPreset (PerformancePreset preset, const std::string &name="") const |
| Create a profile from a preset. | |
| bool | createGlobalProfile (const PerformanceProfile &profile) |
| Create a global profile. | |
| bool | createProfile (const std::string &gameId, const PerformanceProfile &profile) |
| Create a new performance profile for a game. | |
| PerformanceProfile | createSmartDefault (const std::string &gameId, const std::string &protondbTier="") const |
| Create game-specific default profile based on system info. | |
| bool | deleteProfile (const std::string &gameId, const std::string &profileId) |
| Delete a profile. | |
| std::string | duplicateProfile (const std::string &gameId, const std::string &sourceProfileId, const std::string &newName) |
| Duplicate an existing profile. | |
| bool | exportGameProfiles (const std::string &gameId, const std::string &filePath) const |
| Export all profiles for a game. | |
| std::string | exportProfileToJson (const PerformanceProfile &profile) const |
| Export a profile to JSON. | |
| std::optional< PerformanceProfile > | getActiveProfile (const std::string &gameId) const |
| Get the active profile for a game. | |
| PerformanceProfile | getDefaultProfile () const |
| Get the default profile template. | |
| int | getGamesWithProfilesCount () const |
| Get number of games with custom profiles. | |
| std::vector< PerformanceProfile > | getGlobalProfiles () const |
| Get global profiles (shared across games). | |
| std::optional< PerformanceProfile > | getMostUsedProfile (const std::string &gameId) const |
| Get most used profile for a game. | |
| std::optional< PerformanceProfile > | getProfile (const std::string &gameId, const std::string &profileId) const |
| Get a specific profile. | |
| std::vector< PerformanceProfile > | getProfiles (const std::string &gameId) const |
| Get all profiles for a game. | |
| int | getTotalProfileCount () const |
| Get total number of profiles. | |
| int | importGameProfiles (const std::string &gameId, const std::string &filePath) |
| Import profiles for a game. | |
| std::optional< PerformanceProfile > | importProfileFromJson (const std::string &json) const |
| Import a profile from JSON. | |
| bool | initialize (const std::string &dataDir) |
| Initialize the service with a data directory. | |
| bool | isInitialized () const |
| Check if service is initialized. | |
| bool | linkToGlobalProfile (const std::string &gameId, const std::string &globalProfileId) |
| Link a game to use a global profile. | |
| PerformanceProfileService & | operator= (const PerformanceProfileService &)=delete |
| std::map< std::string, std::string > | profileToEnvVars (const PerformanceProfile &profile) const |
| Convert a profile to environment variables. | |
| std::vector< std::string > | profileToGamescopeArgs (const PerformanceProfile &profile) const |
| Convert a profile to Gamescope arguments. | |
| void | recordMetrics (const std::string &gameId, const std::string &profileId, double avgFps, double avgFrametime) |
| Record performance metrics for a profile. | |
| bool | setActiveProfile (const std::string &gameId, const std::string &profileId) |
| Set the active profile for a game. | |
| void | setOnProfileChanged (OnProfileChanged callback) |
| bool | updateProfile (const std::string &gameId, const PerformanceProfile &profile) |
| Update an existing profile. | |
Service for managing per-game performance profiles.
Provides Steam Deck-style performance profile management, allowing users to save and switch between different performance configurations per game.
Definition at line 220 of file performance_profile_service.h.
Definition at line 223 of file performance_profile_service.h.
| PerformanceProfileService::PerformanceProfileService | ( | ) |
Definition at line 543 of file performance_profile_service.cpp.
Referenced by PerformanceProfileService(), and operator=().
|
default |
|
delete |
References PerformanceProfileService().
| PerformanceProfile PerformanceProfileService::createFromPreset | ( | PerformancePreset | preset, |
| const std::string & | name = "" ) const |
Create a profile from a preset.
| preset | Preset type |
| name | Custom name for the profile |
Definition at line 765 of file performance_profile_service.cpp.
References PowerSettings::allowBoost, SyncSettings::autoDetect, Balanced, BatteryLife, Compatibility, Custom, PerformanceProfile::description, ScalingSettings::enableDLSS, ScalingSettings::enableFSR, SyncSettings::enableFsync, WrapperSettings::enableGameMode, WrapperSettings::enableGamePerformance, WrapperSettings::enableVkBasalt, FramerateSettings::enableVRR, PowerSettings::fanCurvePreset, FramerateSettings::fpsLimit, PerformanceProfile::framerate, FramerateSettings::halfRateShading, ScalingSettings::internalHeight, ScalingSettings::internalWidth, PerformanceProfile::name, Performance, performancePresetName(), PerformanceProfile::power, PerformanceProfile::preset, Quality, PerformanceProfile::scaling, Silent, PerformanceProfile::sync, PowerSettings::tdpLimit, and PerformanceProfile::wrappers.
Referenced by createSmartDefault(), and getDefaultProfile().
| bool PerformanceProfileService::createGlobalProfile | ( | const PerformanceProfile & | profile | ) |
Create a global profile.
| profile | Profile to create globally |
Definition at line 1044 of file performance_profile_service.cpp.
References PerformanceProfile::createdAt, exportProfileToJson(), generateUUID(), and PerformanceProfile::id.
| bool PerformanceProfileService::createProfile | ( | const std::string & | gameId, |
| const PerformanceProfile & | profile ) |
Create a new performance profile for a game.
| gameId | Game ID |
| profile | Profile to create |
Definition at line 557 of file performance_profile_service.cpp.
References PerformanceProfile::createdAt, generateUUID(), PerformanceProfile::id, PerformanceProfile::name, and Logger::warn().
Referenced by duplicateProfile().
| PerformanceProfile PerformanceProfileService::createSmartDefault | ( | const std::string & | gameId, |
| const std::string & | protondbTier = "" ) const |
Create game-specific default profile based on system info.
| gameId | Game ID |
| protondbTier | ProtonDB tier for the game |
Definition at line 843 of file performance_profile_service.cpp.
References SyncSettings::autoDetect, Compatibility, createFromPreset(), WrapperSettings::enableGamePerformance, WrapperSettings::enableVkBasalt, FramerateSettings::enableVRR, FramerateSettings::fpsLimit, PerformanceProfile::framerate, getDefaultProfile(), PerformanceProfile::name, PerformanceProfile::sync, and PerformanceProfile::wrappers.
| bool PerformanceProfileService::deleteProfile | ( | const std::string & | gameId, |
| const std::string & | profileId ) |
Delete a profile.
| gameId | Game ID |
| profileId | Profile ID to delete |
Definition at line 627 of file performance_profile_service.cpp.
References PerformanceProfile::id, and Logger::warn().
| std::string PerformanceProfileService::duplicateProfile | ( | const std::string & | gameId, |
| const std::string & | sourceProfileId, | ||
| const std::string & | newName ) |
Duplicate an existing profile.
| gameId | Game ID |
| sourceProfileId | Profile to duplicate |
| newName | Name for the duplicate |
Definition at line 669 of file performance_profile_service.cpp.
References PerformanceProfile::createdAt, createProfile(), generateUUID(), getProfile(), PerformanceProfile::id, PerformanceProfile::lastUsedAt, PerformanceProfile::name, and PerformanceProfile::useCount.
| bool PerformanceProfileService::exportGameProfiles | ( | const std::string & | gameId, |
| const std::string & | filePath ) const |
Export all profiles for a game.
| gameId | Game ID |
| filePath | Output file path |
Definition at line 1140 of file performance_profile_service.cpp.
References exportProfileToJson().
| std::string PerformanceProfileService::exportProfileToJson | ( | const PerformanceProfile & | profile | ) | const |
Export a profile to JSON.
| profile | Profile to export |
Definition at line 1088 of file performance_profile_service.cpp.
References SyncSettings::autoDetect, PerformanceProfile::createdAt, PerformanceProfile::description, SyncSettings::enableEsync, ScalingSettings::enableFSR, SyncSettings::enableFsync, WrapperSettings::enableGameMode, WrapperSettings::enableGamePerformance, WrapperSettings::enableMangoHud, SyncSettings::enableNTSync, WrapperSettings::enableVkBasalt, FramerateSettings::enableVRR, FramerateSettings::fpsLimit, PerformanceProfile::framerate, ScalingSettings::fsrSharpness, PerformanceProfile::id, ScalingSettings::internalHeight, ScalingSettings::internalWidth, jsonEscape(), PerformanceProfile::lastUsedAt, PerformanceProfile::name, PerformanceProfile::preset, FramerateSettings::refreshRate, PerformanceProfile::scaling, PerformanceProfile::sync, PerformanceProfile::useCount, FramerateSettings::useGamescope, and PerformanceProfile::wrappers.
Referenced by createGlobalProfile(), and exportGameProfiles().
| std::optional< PerformanceProfile > PerformanceProfileService::getActiveProfile | ( | const std::string & | gameId | ) | const |
Get the active profile for a game.
| gameId | Game ID |
Definition at line 722 of file performance_profile_service.cpp.
References getProfile().
| PerformanceProfile PerformanceProfileService::getDefaultProfile | ( | ) | const |
Get the default profile template.
Definition at line 837 of file performance_profile_service.cpp.
References Balanced, and createFromPreset().
Referenced by createSmartDefault().
| int PerformanceProfileService::getGamesWithProfilesCount | ( | ) | const |
Get number of games with custom profiles.
Definition at line 1246 of file performance_profile_service.cpp.
| std::vector< PerformanceProfile > PerformanceProfileService::getGlobalProfiles | ( | ) | const |
Get global profiles (shared across games).
Definition at line 1039 of file performance_profile_service.cpp.
| std::optional< PerformanceProfile > PerformanceProfileService::getMostUsedProfile | ( | const std::string & | gameId | ) | const |
Get most used profile for a game.
| gameId | Game ID |
Definition at line 1252 of file performance_profile_service.cpp.
| std::optional< PerformanceProfile > PerformanceProfileService::getProfile | ( | const std::string & | gameId, |
| const std::string & | profileId ) const |
Get a specific profile.
| gameId | Game ID |
| profileId | Profile ID |
Definition at line 704 of file performance_profile_service.cpp.
Referenced by duplicateProfile(), and getActiveProfile().
| std::vector< PerformanceProfile > PerformanceProfileService::getProfiles | ( | const std::string & | gameId | ) | const |
Get all profiles for a game.
| gameId | Game ID |
Definition at line 693 of file performance_profile_service.cpp.
| int PerformanceProfileService::getTotalProfileCount | ( | ) | const |
Get total number of profiles.
Definition at line 1235 of file performance_profile_service.cpp.
| int PerformanceProfileService::importGameProfiles | ( | const std::string & | gameId, |
| const std::string & | filePath ) |
Import profiles for a game.
| gameId | Game ID |
| filePath | Input file path |
Definition at line 1166 of file performance_profile_service.cpp.
References generateUUID(), PerformanceProfile::id, and jsonParseProfile().
| std::optional< PerformanceProfile > PerformanceProfileService::importProfileFromJson | ( | const std::string & | json | ) | const |
Import a profile from JSON.
| json | JSON string |
Definition at line 1132 of file performance_profile_service.cpp.
References PerformanceProfile::id, and jsonParseProfile().
| bool PerformanceProfileService::initialize | ( | const std::string & | dataDir | ) |
Initialize the service with a data directory.
| dataDir | Directory to store profile data |
Definition at line 547 of file performance_profile_service.cpp.
| bool PerformanceProfileService::isInitialized | ( | ) | const |
Check if service is initialized.
Definition at line 552 of file performance_profile_service.cpp.
| bool PerformanceProfileService::linkToGlobalProfile | ( | const std::string & | gameId, |
| const std::string & | globalProfileId ) |
Link a game to use a global profile.
| gameId | Game ID |
| globalProfileId | Global profile ID |
Definition at line 1067 of file performance_profile_service.cpp.
|
delete |
References PerformanceProfileService().
| std::map< std::string, std::string > PerformanceProfileService::profileToEnvVars | ( | const PerformanceProfile & | profile | ) | const |
Convert a profile to environment variables.
| profile | Profile to convert |
Definition at line 878 of file performance_profile_service.cpp.
References SyncSettings::autoDetect, SyncSettings::enableEsync, ScalingSettings::enableFSR, SyncSettings::enableFsync, WrapperSettings::enableGameMode, WrapperSettings::enableGamePerformance, WrapperSettings::enableMangoHud, SyncSettings::enableNTSync, WrapperSettings::enableVkBasalt, PerformanceProfile::environmentVariables, ScalingSettings::fsrSharpness, WrapperSettings::mangoHudConfig, PerformanceProfile::scaling, PerformanceProfile::sync, WrapperSettings::vkBasaltEffects, and PerformanceProfile::wrappers.
| std::vector< std::string > PerformanceProfileService::profileToGamescopeArgs | ( | const PerformanceProfile & | profile | ) | const |
Convert a profile to Gamescope arguments.
| profile | Profile to convert |
Definition at line 956 of file performance_profile_service.cpp.
References ScalingSettings::enableFSR, ScalingSettings::enableIntegerScale, FramerateSettings::enableVRR, FramerateSettings::fpsLimit, PerformanceProfile::framerate, ScalingSettings::fsrSharpness, FramerateSettings::gamescopeUnfocusedFps, ScalingSettings::internalHeight, ScalingSettings::internalWidth, ScalingSettings::outputHeight, ScalingSettings::outputWidth, FramerateSettings::refreshRate, and PerformanceProfile::scaling.
| void PerformanceProfileService::recordMetrics | ( | const std::string & | gameId, |
| const std::string & | profileId, | ||
| double | avgFps, | ||
| double | avgFrametime ) |
Record performance metrics for a profile.
| gameId | Game ID |
| profileId | Profile that was active |
| avgFps | Average FPS achieved |
| avgFrametime | Average frametime achieved |
Definition at line 1020 of file performance_profile_service.cpp.
| bool PerformanceProfileService::setActiveProfile | ( | const std::string & | gameId, |
| const std::string & | profileId ) |
Set the active profile for a game.
| gameId | Game ID |
| profileId | Profile ID to activate |
Definition at line 731 of file performance_profile_service.cpp.
| void PerformanceProfileService::setOnProfileChanged | ( | OnProfileChanged | callback | ) |
Definition at line 1230 of file performance_profile_service.cpp.
| bool PerformanceProfileService::updateProfile | ( | const std::string & | gameId, |
| const PerformanceProfile & | profile ) |
Update an existing profile.
| gameId | Game ID |
| profile | Updated profile (matched by profile.id) |
Definition at line 604 of file performance_profile_service.cpp.
References PerformanceProfile::id.