mirror of
https://github.com/ayufan/steam-deck-tools.git
synced 2026-01-06 08:39:59 +01:00
PowerControl: All options accept String
This commit is contained in:
parent
29e373d169
commit
81d4be30ce
|
|
@ -22,6 +22,13 @@ namespace PowerControl.Helpers
|
|||
|
||||
public DisplayResolution(int width, int height) { Width = width; Height = height; }
|
||||
|
||||
public DisplayResolution(String text)
|
||||
{
|
||||
var options = text.Split("x", 2);
|
||||
Width = int.Parse(options[0]);
|
||||
Height = int.Parse(options[1]);
|
||||
}
|
||||
|
||||
public static bool operator ==(DisplayResolution sz1, DisplayResolution sz2) => sz1.Width == sz2.Width && sz1.Height == sz2.Height;
|
||||
|
||||
public static bool operator !=(DisplayResolution sz1, DisplayResolution sz2) => !(sz1 == sz2);
|
||||
|
|
|
|||
|
|
@ -2,16 +2,16 @@ namespace PowerControl.Menu
|
|||
{
|
||||
public class MenuItemWithOptions : MenuItem
|
||||
{
|
||||
public IList<Object> Options { get; set; } = new List<Object>();
|
||||
public Object? SelectedOption { get; set; }
|
||||
public Object? ActiveOption { get; set; }
|
||||
public IList<string> Options { get; set; } = new List<string>();
|
||||
public string? SelectedOption { get; private set; }
|
||||
public string? ActiveOption { get; set; }
|
||||
public int ApplyDelay { get; set; }
|
||||
public bool CycleOptions { get; set; } = true;
|
||||
|
||||
public Func<object?>? CurrentValue { get; set; }
|
||||
public Func<object[]?>? OptionsValues { get; set; }
|
||||
public Func<object, object?>? ApplyValue { get; set; }
|
||||
public Func<object?>? ResetValue { get; set; }
|
||||
public Func<string?>? CurrentValue { get; set; }
|
||||
public Func<string[]?>? OptionsValues { get; set; }
|
||||
public Func<string, string?>? ApplyValue { get; set; }
|
||||
public Func<string?>? ResetValue { get; set; }
|
||||
|
||||
private System.Windows.Forms.Timer delayTimer = new System.Windows.Forms.Timer();
|
||||
private ToolStripMenuItem toolStripItem = new ToolStripMenuItem();
|
||||
|
|
@ -25,7 +25,7 @@ namespace PowerControl.Menu
|
|||
if (delayTimer != null)
|
||||
delayTimer.Stop();
|
||||
|
||||
onApply();
|
||||
FinalizeSet();
|
||||
};
|
||||
|
||||
toolStripItem.DropDownOpening += delegate
|
||||
|
|
@ -34,13 +34,9 @@ namespace PowerControl.Menu
|
|||
|
||||
foreach (var option in Options)
|
||||
{
|
||||
var item = new ToolStripMenuItem(option.ToString());
|
||||
item.Checked = Object.Equals(option, SelectedOption ?? ActiveOption);
|
||||
item.Click += delegate
|
||||
{
|
||||
SelectedOption = option;
|
||||
onApply();
|
||||
};
|
||||
var item = new ToolStripMenuItem(option);
|
||||
item.Checked = option == (SelectedOption ?? ActiveOption);
|
||||
item.Click += delegate { FinalizeSet(); };
|
||||
toolStripItem.DropDownItems.Add(item);
|
||||
}
|
||||
};
|
||||
|
|
@ -52,11 +48,10 @@ namespace PowerControl.Menu
|
|||
return;
|
||||
|
||||
var resetOption = ResetValue();
|
||||
if (resetOption == null || resetOption.Equals(ActiveOption))
|
||||
if (resetOption == null || resetOption == ActiveOption)
|
||||
return;
|
||||
|
||||
SelectedOption = resetOption;
|
||||
onApply();
|
||||
Set(resetOption, true);
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
|
|
@ -88,31 +83,26 @@ namespace PowerControl.Menu
|
|||
ActiveOption = Options.First();
|
||||
}
|
||||
|
||||
private void scheduleApply()
|
||||
public void Set(String value, bool immediately = false)
|
||||
{
|
||||
if (delayTimer != null)
|
||||
delayTimer.Stop();
|
||||
|
||||
if (ApplyDelay == 0)
|
||||
SelectedOption = value;
|
||||
|
||||
if (ApplyDelay == 0 || immediately)
|
||||
{
|
||||
onApply();
|
||||
FinalizeSet();
|
||||
return;
|
||||
}
|
||||
|
||||
delayTimer.Interval = ApplyDelay > 0 ? ApplyDelay : 1;
|
||||
delayTimer.Tick += delegate (object? sender, EventArgs e)
|
||||
{
|
||||
if (delayTimer != null)
|
||||
delayTimer.Stop();
|
||||
|
||||
onApply();
|
||||
};
|
||||
delayTimer.Enabled = true;
|
||||
}
|
||||
|
||||
private void onApply()
|
||||
private void FinalizeSet()
|
||||
{
|
||||
if (ApplyValue != null)
|
||||
if (ApplyValue != null && SelectedOption != null)
|
||||
ActiveOption = ApplyValue(SelectedOption);
|
||||
else
|
||||
ActiveOption = SelectedOption;
|
||||
|
|
@ -132,13 +122,12 @@ namespace PowerControl.Menu
|
|||
if (Options.Count == 0)
|
||||
return;
|
||||
|
||||
SelectedOption = Options[Math.Clamp(index, 0, Options.Count - 1)];
|
||||
scheduleApply();
|
||||
Set(Options[Math.Clamp(index, 0, Options.Count - 1)], false);
|
||||
}
|
||||
|
||||
public override void SelectNext(int change)
|
||||
{
|
||||
int index = Options.IndexOf(SelectedOption ?? ActiveOption);
|
||||
int index = Options.IndexOf(SelectedOption ?? ActiveOption ?? "");
|
||||
if (index < 0)
|
||||
{
|
||||
if (change > 0)
|
||||
|
|
@ -154,22 +143,6 @@ namespace PowerControl.Menu
|
|||
SelectIndex(index + change);
|
||||
}
|
||||
|
||||
private String optionText(Object option)
|
||||
{
|
||||
String text;
|
||||
|
||||
if (option == null)
|
||||
text = Color("?", Colors.White);
|
||||
else if (Object.Equals(option, SelectedOption ?? ActiveOption))
|
||||
text = Color(option.ToString(), Colors.Red);
|
||||
else if (Object.Equals(option, ActiveOption))
|
||||
text = Color(option.ToString(), Colors.White);
|
||||
else
|
||||
text = Color(option.ToString(), Colors.Green);
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
public override string Render(MenuItem? selected)
|
||||
{
|
||||
string output = "";
|
||||
|
|
@ -181,10 +154,26 @@ namespace PowerControl.Menu
|
|||
|
||||
output += optionText(SelectedOption ?? ActiveOption);
|
||||
|
||||
if (SelectedOption != null && !Object.Equals(ActiveOption, SelectedOption))
|
||||
if (SelectedOption != null && ActiveOption != SelectedOption)
|
||||
output += " (active: " + optionText(ActiveOption) + ")";
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
private String optionText(String? option)
|
||||
{
|
||||
String text;
|
||||
|
||||
if (option is null)
|
||||
text = Color("?", Colors.White);
|
||||
else if (option == (SelectedOption ?? ActiveOption))
|
||||
text = Color(option, Colors.Red);
|
||||
else if (option == ActiveOption)
|
||||
text = Color(option, Colors.White);
|
||||
else
|
||||
text = Color(option, Colors.Green);
|
||||
|
||||
return text;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,17 +5,16 @@ namespace PowerControl.Options
|
|||
public static Menu.MenuItemWithOptions Instance = new Menu.MenuItemWithOptions()
|
||||
{
|
||||
Name = "Brightness",
|
||||
Options = { 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100 },
|
||||
Options = { "0", "5", "10", "15", "20", "25", "30", "35", "40", "45", "50", "55", "60", "65", "70", "75", "80", "85", "90", "95", "100" },
|
||||
CycleOptions = false,
|
||||
CurrentValue = delegate ()
|
||||
{
|
||||
return Helpers.WindowsSettingsBrightnessController.Get(5.0);
|
||||
return Helpers.WindowsSettingsBrightnessController.Get(5.0).ToString();
|
||||
},
|
||||
ApplyValue = delegate (object selected)
|
||||
ApplyValue = (selected) =>
|
||||
{
|
||||
Helpers.WindowsSettingsBrightnessController.Set((int)selected);
|
||||
|
||||
return Helpers.WindowsSettingsBrightnessController.Get(5.0);
|
||||
Helpers.WindowsSettingsBrightnessController.Set(int.Parse(selected));
|
||||
return Helpers.WindowsSettingsBrightnessController.Get(5.0).ToString();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ namespace PowerControl.Options
|
|||
ActiveOption = "?",
|
||||
Visible = VangoghGPU.IsSupported,
|
||||
ResetValue = () => { return "Default"; },
|
||||
ApplyValue = delegate (object selected)
|
||||
ApplyValue = (selected) =>
|
||||
{
|
||||
if (!Settings.Default.AckAntiCheat(
|
||||
Controller.TitleWithVersion,
|
||||
|
|
@ -21,7 +21,7 @@ namespace PowerControl.Options
|
|||
)
|
||||
return null;
|
||||
|
||||
return CommonHelpers.Instance.WithGlobalMutex<object>(200, () =>
|
||||
return CommonHelpers.Instance.WithGlobalMutex<string>(200, () =>
|
||||
{
|
||||
using (var sd = VangoghGPU.Open())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -13,9 +13,12 @@ namespace PowerControl.Options
|
|||
OptionsValues = delegate ()
|
||||
{
|
||||
var refreshRate = DisplayResolutionController.GetRefreshRate();
|
||||
return new object[]
|
||||
return new string[]
|
||||
{
|
||||
refreshRate / 4, refreshRate / 2, refreshRate, "Off"
|
||||
(refreshRate / 4).ToString(),
|
||||
(refreshRate / 2).ToString(),
|
||||
refreshRate.ToString(),
|
||||
"Off"
|
||||
};
|
||||
},
|
||||
CurrentValue = delegate ()
|
||||
|
|
@ -24,18 +27,18 @@ namespace PowerControl.Options
|
|||
{
|
||||
RTSS.LoadProfile();
|
||||
if (RTSS.GetProfileProperty("FramerateLimit", out int framerate))
|
||||
return (framerate == 0) ? "Off" : framerate;
|
||||
return (framerate == 0) ? "Off" : framerate.ToString();
|
||||
}
|
||||
catch { }
|
||||
return null;
|
||||
},
|
||||
ApplyValue = delegate (object selected)
|
||||
ApplyValue = (selected) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
int framerate = 0;
|
||||
if (selected != null && selected.ToString() != "Off")
|
||||
framerate = (int)selected;
|
||||
if (selected != "Off")
|
||||
framerate = int.Parse(selected);
|
||||
|
||||
RTSS.LoadProfile();
|
||||
if (!RTSS.SetProfileProperty("FramerateLimit", framerate))
|
||||
|
|
@ -44,7 +47,7 @@ namespace PowerControl.Options
|
|||
return null;
|
||||
RTSS.SaveProfile();
|
||||
RTSS.UpdateProfiles();
|
||||
return (framerate == 0) ? "Off" : framerate;
|
||||
return (framerate == 0) ? "Off" : framerate.ToString();
|
||||
}
|
||||
catch { }
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -10,19 +10,19 @@ namespace PowerControl.Options
|
|||
ApplyDelay = 500,
|
||||
OptionsValues = delegate ()
|
||||
{
|
||||
return Enum.GetValues<FanMode>().Select(item => (object)item).ToArray();
|
||||
return Enum.GetNames<FanMode>();
|
||||
},
|
||||
CurrentValue = delegate ()
|
||||
{
|
||||
if (SharedData<FanModeSetting>.GetExistingValue(out var value))
|
||||
return value.Current;
|
||||
return value.Current.ToString();
|
||||
return null;
|
||||
},
|
||||
ApplyValue = delegate (object selected)
|
||||
ApplyValue = (selected) =>
|
||||
{
|
||||
if (!SharedData<FanModeSetting>.GetExistingValue(out var value))
|
||||
return null;
|
||||
value.Desired = (FanMode)selected;
|
||||
value.Desired = Enum.Parse<FanMode>(selected);
|
||||
if (!SharedData<FanModeSetting>.SetExistingValue(value))
|
||||
return null;
|
||||
return selected;
|
||||
|
|
|
|||
|
|
@ -8,19 +8,19 @@ namespace PowerControl.Options
|
|||
{
|
||||
Name = "Colors",
|
||||
ApplyDelay = 1000,
|
||||
Options = Enum.GetValues<DCE.Mode>().Cast<object>().ToList(),
|
||||
Options = Enum.GetNames<DCE.Mode>(),
|
||||
CurrentValue = delegate ()
|
||||
{
|
||||
return DCE.Current;
|
||||
return DCE.Current.ToString();
|
||||
},
|
||||
ApplyValue = delegate (object selected)
|
||||
ApplyValue = (selected) =>
|
||||
{
|
||||
if (DCE.Current is null)
|
||||
return null;
|
||||
|
||||
DCE.Current = (DCE.Mode)selected;
|
||||
DCE.Current = Enum.Parse<DCE.Mode>(selected);
|
||||
RadeonSoftware.Kill();
|
||||
return DCE.Current;
|
||||
return DCE.Current.ToString();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ namespace PowerControl.Options
|
|||
Visible = VangoghGPU.IsSupported,
|
||||
ActiveOption = "?",
|
||||
ResetValue = () => { return "Default"; },
|
||||
ApplyValue = delegate (object selected)
|
||||
ApplyValue = (selected) =>
|
||||
{
|
||||
if (!Settings.Default.AckAntiCheat(
|
||||
Controller.TitleWithVersion,
|
||||
|
|
@ -21,20 +21,20 @@ namespace PowerControl.Options
|
|||
)
|
||||
return null;
|
||||
|
||||
return CommonHelpers.Instance.WithGlobalMutex<object>(200, () =>
|
||||
return CommonHelpers.Instance.WithGlobalMutex<string>(200, () =>
|
||||
{
|
||||
using (var sd = VangoghGPU.Open())
|
||||
{
|
||||
if (sd is null)
|
||||
return null;
|
||||
|
||||
if (selected.ToString() == "Default")
|
||||
if (selected == "Default")
|
||||
{
|
||||
sd.HardMinGfxClock = 200;
|
||||
return selected;
|
||||
}
|
||||
|
||||
sd.HardMinGfxClock = uint.Parse(selected.ToString()?.Replace("MHz", "") ?? "200");
|
||||
sd.HardMinGfxClock = uint.Parse(selected.Replace("MHz", ""));
|
||||
return selected;
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -8,24 +8,24 @@ namespace PowerControl.Options
|
|||
{
|
||||
Name = "GPU Scaling",
|
||||
ApplyDelay = 1000,
|
||||
Options = Enum.GetValues<GPUScaling.ScalingMode>().Cast<object>().Prepend("Off").ToArray(),
|
||||
Options = Enum.GetNames<GPUScaling.ScalingMode>().Prepend("Off").ToArray(),
|
||||
CurrentValue = delegate ()
|
||||
{
|
||||
if (!GPUScaling.IsSupported)
|
||||
return null;
|
||||
if (!GPUScaling.Enabled)
|
||||
return "Off";
|
||||
return GPUScaling.Mode;
|
||||
return GPUScaling.Mode.ToString();
|
||||
},
|
||||
ApplyValue = delegate (object selected)
|
||||
ApplyValue = (selected) =>
|
||||
{
|
||||
if (!GPUScaling.IsSupported)
|
||||
return null;
|
||||
|
||||
if (selected is GPUScaling.ScalingMode)
|
||||
GPUScaling.Mode = (GPUScaling.ScalingMode)selected;
|
||||
else
|
||||
if (selected == "Off")
|
||||
GPUScaling.Enabled = false;
|
||||
else
|
||||
GPUScaling.Mode = Enum.Parse<GPUScaling.ScalingMode>(selected);
|
||||
|
||||
// Since the RadeonSoftware will try to revert values
|
||||
RadeonSoftware.Kill();
|
||||
|
|
@ -37,7 +37,7 @@ namespace PowerControl.Options
|
|||
|
||||
if (!GPUScaling.Enabled)
|
||||
return "Off";
|
||||
return GPUScaling.Mode;
|
||||
return GPUScaling.Mode.ToString();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,19 +10,19 @@ namespace PowerControl.Options
|
|||
ApplyDelay = 500,
|
||||
OptionsValues = delegate ()
|
||||
{
|
||||
return Enum.GetValues<OverlayEnabled>().Select(item => (object)item).ToArray();
|
||||
return Enum.GetNames<OverlayEnabled>();
|
||||
},
|
||||
CurrentValue = delegate ()
|
||||
{
|
||||
if (SharedData<OverlayModeSetting>.GetExistingValue(out var value))
|
||||
return value.CurrentEnabled;
|
||||
return value.CurrentEnabled.ToString();
|
||||
return null;
|
||||
},
|
||||
ApplyValue = delegate (object selected)
|
||||
ApplyValue = (selected) =>
|
||||
{
|
||||
if (!SharedData<OverlayModeSetting>.GetExistingValue(out var value))
|
||||
return null;
|
||||
value.DesiredEnabled = (OverlayEnabled)selected;
|
||||
value.DesiredEnabled = Enum.Parse<OverlayEnabled>(selected);
|
||||
if (!SharedData<OverlayModeSetting>.SetExistingValue(value))
|
||||
return null;
|
||||
return selected;
|
||||
|
|
@ -35,19 +35,19 @@ namespace PowerControl.Options
|
|||
ApplyDelay = 500,
|
||||
OptionsValues = delegate ()
|
||||
{
|
||||
return Enum.GetValues<OverlayMode>().Select(item => (object)item).ToArray();
|
||||
return Enum.GetNames<OverlayMode>();
|
||||
},
|
||||
CurrentValue = delegate ()
|
||||
{
|
||||
if (SharedData<OverlayModeSetting>.GetExistingValue(out var value))
|
||||
return value.Current;
|
||||
return value.Current.ToString();
|
||||
return null;
|
||||
},
|
||||
ApplyValue = delegate (object selected)
|
||||
ApplyValue = (selected) =>
|
||||
{
|
||||
if (!SharedData<OverlayModeSetting>.GetExistingValue(out var value))
|
||||
return null;
|
||||
value.Desired = (OverlayMode)selected;
|
||||
value.Desired = Enum.Parse<OverlayMode>(selected);
|
||||
if (!SharedData<OverlayModeSetting>.SetExistingValue(value))
|
||||
return null;
|
||||
return selected;
|
||||
|
|
@ -60,19 +60,19 @@ namespace PowerControl.Options
|
|||
ApplyDelay = 500,
|
||||
OptionsValues = delegate ()
|
||||
{
|
||||
return Enum.GetValues<KernelDriversLoaded>().Select(item => (object)item).ToArray();
|
||||
return Enum.GetNames<KernelDriversLoaded>();
|
||||
},
|
||||
CurrentValue = delegate ()
|
||||
{
|
||||
if (SharedData<OverlayModeSetting>.GetExistingValue(out var value))
|
||||
return value.KernelDriversLoaded;
|
||||
return value.KernelDriversLoaded.ToString();
|
||||
return null;
|
||||
},
|
||||
ApplyValue = delegate (object selected)
|
||||
ApplyValue = (selected) =>
|
||||
{
|
||||
if (!SharedData<OverlayModeSetting>.GetExistingValue(out var value))
|
||||
return null;
|
||||
value.DesiredKernelDriversLoaded = (KernelDriversLoaded)selected;
|
||||
value.DesiredKernelDriversLoaded = Enum.Parse<KernelDriversLoaded>(selected);
|
||||
if (!SharedData<OverlayModeSetting>.SetExistingValue(value))
|
||||
return null;
|
||||
return selected;
|
||||
|
|
|
|||
|
|
@ -9,25 +9,25 @@ namespace PowerControl.Options
|
|||
{
|
||||
Name = "Refresh Rate",
|
||||
ApplyDelay = 1000,
|
||||
ResetValue = () => { return DisplayResolutionController.GetRefreshRates().Max(); },
|
||||
ResetValue = () => { return DisplayResolutionController.GetRefreshRates().Max().ToString(); },
|
||||
OptionsValues = delegate ()
|
||||
{
|
||||
var refreshRates = DisplayResolutionController.GetRefreshRates();
|
||||
if (refreshRates.Count() > 1)
|
||||
return refreshRates.Select(item => (object)item).ToArray();
|
||||
return refreshRates.Select(item => item.ToString()).ToArray();
|
||||
return null;
|
||||
},
|
||||
CurrentValue = delegate ()
|
||||
{
|
||||
return DisplayResolutionController.GetRefreshRate();
|
||||
return DisplayResolutionController.GetRefreshRate().ToString();
|
||||
},
|
||||
ApplyValue = delegate (object selected)
|
||||
ApplyValue = (selected) =>
|
||||
{
|
||||
DisplayResolutionController.SetRefreshRate((int)selected);
|
||||
DisplayResolutionController.SetRefreshRate(int.Parse(selected));
|
||||
// force reset and refresh of FPS limit
|
||||
FPSLimit.Instance.Reset();
|
||||
FPSLimit.Instance.Update();
|
||||
return DisplayResolutionController.GetRefreshRate();
|
||||
return DisplayResolutionController.GetRefreshRate().ToString();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,30 +13,31 @@ namespace PowerControl.Options
|
|||
{
|
||||
if (!GPUScaling.SafeResolutionChange && !Settings.Default.EnableExperimentalFeatures)
|
||||
return null;
|
||||
return DisplayResolutionController.GetAllResolutions().Last();
|
||||
return DisplayResolutionController.GetAllResolutions().Last().ToString();
|
||||
},
|
||||
OptionsValues = delegate ()
|
||||
{
|
||||
var resolutions = DisplayResolutionController.GetAllResolutions();
|
||||
if (resolutions.Count() > 1)
|
||||
return resolutions.Select(item => (object)item).ToArray();
|
||||
return resolutions.Select(item => item.ToString()).ToArray();
|
||||
return null;
|
||||
},
|
||||
CurrentValue = delegate ()
|
||||
{
|
||||
if (!GPUScaling.SafeResolutionChange && !Settings.Default.EnableExperimentalFeatures)
|
||||
return null;
|
||||
return DisplayResolutionController.GetResolution();
|
||||
return DisplayResolutionController.GetResolution().ToString();
|
||||
},
|
||||
ApplyValue = delegate (object selected)
|
||||
ApplyValue = (selected) =>
|
||||
{
|
||||
DisplayResolutionController.SetResolution((DisplayResolutionController.DisplayResolution)selected);
|
||||
var selectedResolution = new DisplayResolutionController.DisplayResolution(selected);
|
||||
DisplayResolutionController.SetResolution(selectedResolution);
|
||||
// force refresh Refresh Rate
|
||||
RefreshRate.Instance.Update();
|
||||
// force reset and refresh of FPS limit
|
||||
FPSLimit.Instance.Reset();
|
||||
FPSLimit.Instance.Update();
|
||||
return DisplayResolutionController.GetResolution();
|
||||
return DisplayResolutionController.GetResolution().ToString();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ namespace PowerControl.Options
|
|||
|
||||
return ProcessorCores.IsUsingSMT(processId) ? "Yes" : "No";
|
||||
},
|
||||
ApplyValue = delegate (object selected)
|
||||
ApplyValue = (selected) =>
|
||||
{
|
||||
if (!RTSS.IsOSDForeground(out var processId))
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ namespace PowerControl.Options
|
|||
return null;
|
||||
return value.Value ? "On" : "Off";
|
||||
},
|
||||
ApplyValue = delegate (object selected)
|
||||
ApplyValue = (selected) =>
|
||||
{
|
||||
ImageSharpening.Enabled = (string)selected == "On";
|
||||
|
||||
|
|
|
|||
|
|
@ -20,11 +20,11 @@ namespace PowerControl.Options
|
|||
return value.CurrentProfile.Length > 0 ? value.CurrentProfile : null;
|
||||
return null;
|
||||
},
|
||||
ApplyValue = delegate (object selected)
|
||||
ApplyValue = (selected) =>
|
||||
{
|
||||
if (!SharedData<SteamControllerSetting>.GetExistingValue(out var value))
|
||||
return null;
|
||||
value.DesiredProfile = (String)selected;
|
||||
value.DesiredProfile = selected;
|
||||
if (!SharedData<SteamControllerSetting>.SetExistingValue(value))
|
||||
return null;
|
||||
return selected;
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ namespace PowerControl.Options
|
|||
ApplyDelay = 1000,
|
||||
ResetValue = () => { return "15W"; },
|
||||
ActiveOption = "?",
|
||||
ApplyValue = delegate (object selected)
|
||||
ApplyValue = (selected) =>
|
||||
{
|
||||
if (!Settings.Default.AckAntiCheat(
|
||||
Controller.TitleWithVersion,
|
||||
|
|
@ -21,15 +21,11 @@ namespace PowerControl.Options
|
|||
)
|
||||
return null;
|
||||
|
||||
var selectedText = selected.ToString();
|
||||
if (selectedText is null)
|
||||
return null;
|
||||
|
||||
uint mW = uint.Parse(selectedText.Replace("W", "")) * 1000;
|
||||
uint mW = uint.Parse(selected.Replace("W", "")) * 1000;
|
||||
|
||||
if (VangoghGPU.IsSupported)
|
||||
{
|
||||
return CommonHelpers.Instance.WithGlobalMutex<object>(200, () =>
|
||||
return CommonHelpers.Instance.WithGlobalMutex<string>(200, () =>
|
||||
{
|
||||
using (var sd = VangoghGPU.Open())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5,21 +5,21 @@ namespace PowerControl.Options
|
|||
public static Menu.MenuItemWithOptions Instance = new Menu.MenuItemWithOptions()
|
||||
{
|
||||
Name = "Volume",
|
||||
Options = { 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100 },
|
||||
Options = { "0", "5", "10", "15", "20", "25", "30", "35", "40", "45", "50", "55", "60", "65", "70", "75", "80", "85", "90", "95", "100" },
|
||||
CycleOptions = false,
|
||||
CurrentValue = delegate ()
|
||||
{
|
||||
try { return Helpers.AudioManager.GetMasterVolume(5.0); }
|
||||
try { return Helpers.AudioManager.GetMasterVolume(5.0).ToString(); }
|
||||
catch (Exception) { return null; }
|
||||
},
|
||||
ApplyValue = delegate (object selected)
|
||||
ApplyValue = (selected) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
Helpers.AudioManager.SetMasterVolumeMute(false);
|
||||
Helpers.AudioManager.SetMasterVolume((int)selected);
|
||||
Helpers.AudioManager.SetMasterVolume(int.Parse(selected));
|
||||
|
||||
return Helpers.AudioManager.GetMasterVolume(5.0);
|
||||
return Helpers.AudioManager.GetMasterVolume(5.0).ToString();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue