mirror of
https://github.com/ayufan/steam-deck-tools.git
synced 2025-12-06 07:12:01 +01:00
Since some settings impact others, the application will apply them in a correct order with a fixed delay. This additionally exposes all settings, just some of them are not persisted on create, only on change.
37 lines
1.2 KiB
C#
37 lines
1.2 KiB
C#
using CommonHelpers;
|
|
|
|
namespace PowerControl.Options
|
|
{
|
|
public static class SteamController
|
|
{
|
|
public static Menu.MenuItemWithOptions Instance = new Menu.MenuItemWithOptions()
|
|
{
|
|
Name = "Controller",
|
|
PersistentKey = "SteamController",
|
|
PersistOnCreate = false,
|
|
ApplyDelay = 500,
|
|
OptionsValues = delegate ()
|
|
{
|
|
if (SharedData<SteamControllerSetting>.GetExistingValue(out var value))
|
|
return value.SelectableProfiles.SplitWithN();
|
|
return null;
|
|
},
|
|
CurrentValue = delegate ()
|
|
{
|
|
if (SharedData<SteamControllerSetting>.GetExistingValue(out var value))
|
|
return value.CurrentProfile.Length > 0 ? value.CurrentProfile : null;
|
|
return null;
|
|
},
|
|
ApplyValue = (selected) =>
|
|
{
|
|
if (!SharedData<SteamControllerSetting>.GetExistingValue(out var value))
|
|
return null;
|
|
value.DesiredProfile = selected;
|
|
if (!SharedData<SteamControllerSetting>.SetExistingValue(value))
|
|
return null;
|
|
return selected;
|
|
}
|
|
};
|
|
}
|
|
}
|