mirror of
https://github.com/ayufan/steam-deck-tools.git
synced 2026-04-04 13:57:39 +00:00
PowerControl: Update and expose UserProfiles that can persist per-game settings
This commit is contained in:
parent
3252e799cb
commit
2d5f8c498f
11 changed files with 436 additions and 200 deletions
71
PowerControl/Options/Profiles.cs
Normal file
71
PowerControl/Options/Profiles.cs
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
namespace PowerControl.Options
|
||||
{
|
||||
public static class Profiles
|
||||
{
|
||||
public static ProfilesController? Controller;
|
||||
|
||||
public static Menu.MenuItemWithOptions Instance = new Menu.MenuItemWithOptions()
|
||||
{
|
||||
Name = "Profiles",
|
||||
OptionsValues = delegate ()
|
||||
{
|
||||
var currentProfileSettings = Controller?.CurrentProfileSettings;
|
||||
if (currentProfileSettings == null)
|
||||
return null;
|
||||
|
||||
if (currentProfileSettings.Exists)
|
||||
{
|
||||
return new string[] {
|
||||
currentProfileSettings.ProfileName,
|
||||
"Save All",
|
||||
"Delete"
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
return new string[] {
|
||||
"None",
|
||||
"Create New",
|
||||
"Save All"
|
||||
};
|
||||
}
|
||||
},
|
||||
CycleOptions = false,
|
||||
CurrentValue = delegate ()
|
||||
{
|
||||
var currentProfileSettings = Controller?.CurrentProfileSettings;
|
||||
if (currentProfileSettings == null)
|
||||
return null;
|
||||
|
||||
if (currentProfileSettings.Exists)
|
||||
return currentProfileSettings.ProfileName;
|
||||
else
|
||||
return "None";
|
||||
},
|
||||
ApplyValue = (selected) =>
|
||||
{
|
||||
switch (selected)
|
||||
{
|
||||
case "Delete":
|
||||
Controller?.DeleteProfile();
|
||||
return "None";
|
||||
|
||||
case "Create New":
|
||||
Controller?.CreateProfile(false);
|
||||
return Controller?.CurrentProfileSettings?.ProfileName;
|
||||
|
||||
case "Save All":
|
||||
Controller?.CreateProfile(true);
|
||||
return Controller?.CurrentProfileSettings?.ProfileName;
|
||||
|
||||
default:
|
||||
return selected;
|
||||
}
|
||||
},
|
||||
AfterApply = () =>
|
||||
{
|
||||
Instance?.Update();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -25,7 +25,7 @@ namespace PowerControl.Options
|
|||
ApplyValue = (selected) =>
|
||||
{
|
||||
DisplayResolutionController.SetRefreshRate(int.Parse(selected));
|
||||
|
||||
|
||||
return DisplayResolutionController.GetRefreshRate().ToString();
|
||||
},
|
||||
AfterApply = () =>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue