SteamController: Allow to EnableDS4Support=false

This commit is contained in:
Kamil Trzciński 2023-05-21 16:44:01 +02:00
parent af6cee0bff
commit eb774e11fa
7 changed files with 26 additions and 10 deletions

View file

@ -9,6 +9,7 @@
## 0.6.x ## 0.6.x
- SteamController: Allow to `EnableDS4Support=false` to hide DS4 controller
- All: Support [unofficial APU drivers](https://sourceforge.net/projects/amernimezone/files/Release%20Polaris-Vega-Navi/AMD%20SOC%20Driver%20Variant/) that present themselves as `AMD Radeon 670M` - All: Support [unofficial APU drivers](https://sourceforge.net/projects/amernimezone/files/Release%20Polaris-Vega-Navi/AMD%20SOC%20Driver%20Variant/) that present themselves as `AMD Radeon 670M`
- PowerControl: Show Game Profiles menu item - PowerControl: Show Game Profiles menu item
- PowerControl: Support SMU of Vangogh GPU shipped with BIOS 115 - PowerControl: Support SMU of Vangogh GPU shipped with BIOS 115

View file

@ -95,9 +95,7 @@ namespace SteamController
#endif #endif
// Set available profiles // Set available profiles
ProfilesSettings.Helpers.ProfileStringConverter.Profiles = context.Profiles. ProfilesSettings.Helpers.ProfileStringConverter.Profiles = context.Profiles;
Where((profile) => profile.Visible).
Select((profile) => profile.Name).ToArray();
var contextMenu = new ContextMenuStrip(components); var contextMenu = new ContextMenuStrip(components);
@ -109,7 +107,7 @@ namespace SteamController
foreach (var profile in context.Profiles) foreach (var profile in context.Profiles)
{ {
if (profile.Name == "" || !profile.Visible) if (profile.Name == "")
continue; continue;
var profileItem = new ToolStripMenuItem(profile.Name); var profileItem = new ToolStripMenuItem(profile.Name);
@ -119,6 +117,7 @@ namespace SteamController
profileItem.Checked = context.CurrentProfile == profile; profileItem.Checked = context.CurrentProfile == profile;
profileItem.ToolTipText = String.Join("\n", profile.Errors ?? new string[0]); profileItem.ToolTipText = String.Join("\n", profile.Errors ?? new string[0]);
profileItem.Enabled = profile.Errors is null; profileItem.Enabled = profile.Errors is null;
profileItem.Visible = profile.Visible;
}; };
contextMenu.Items.Add(profileItem); contextMenu.Items.Add(profileItem);
} }

View file

@ -16,9 +16,15 @@ namespace SteamController.Profiles.Predefined
} }
} }
public override bool Visible
{
get => Settings.Default.EnableDS4Support && base.Visible;
set => base.Visible = value;
}
public override bool Selected(Context context) public override bool Selected(Context context)
{ {
return context.Enabled && context.DS4.Valid && context.KeyboardMouseValid && !context.State.SteamUsesSteamInput; return Settings.Default.EnableDS4Support && context.Enabled && context.DS4.Valid && context.KeyboardMouseValid && !context.State.SteamUsesSteamInput;
} }
internal override ProfilesSettings.BackPanelSettings BackPanelSettings internal override ProfilesSettings.BackPanelSettings BackPanelSettings

View file

@ -5,13 +5,16 @@ namespace SteamController.ProfilesSettings.Helpers
{ {
internal class ProfileStringConverter : TypeConverter internal class ProfileStringConverter : TypeConverter
{ {
public static string[] Profiles = new string[0]; public static List<Profiles.Profile> Profiles = new List<Profiles.Profile>();
private volatile StandardValuesCollection? collection; private volatile StandardValuesCollection? collection;
public override StandardValuesCollection? GetStandardValues(ITypeDescriptorContext? context) public override StandardValuesCollection? GetStandardValues(ITypeDescriptorContext? context)
{ {
return collection ??= new StandardValuesCollection(Profiles.ToArray()); return collection ??= new StandardValuesCollection(Profiles.
Where((profile) => profile.Visible).
Select((profile) => profile.Name).
ToArray());
} }
public override bool GetStandardValuesSupported(ITypeDescriptorContext? context) public override bool GetStandardValuesSupported(ITypeDescriptorContext? context)
@ -26,7 +29,7 @@ namespace SteamController.ProfilesSettings.Helpers
public override bool IsValid(ITypeDescriptorContext? context, object? value) public override bool IsValid(ITypeDescriptorContext? context, object? value)
{ {
return Profiles.Contains(value?.ToString()); return Profiles.Find((profile) => profile.Name == value?.ToString()) is not null;
} }
} }
} }

View file

@ -27,6 +27,13 @@ namespace SteamController
set { Set("KeepX360AlwaysConnected", value); } set { Set("KeepX360AlwaysConnected", value); }
} }
[Description("Enable DS4 support. If disabled the DS4 will be hidden.")]
public bool EnableDS4Support
{
get { return Get<bool>("EnableDS4Support", true); }
set { Set("EnableDS4Support", value); }
}
[Description("If current foreground process uses overlay, treat it as a game.")] [Description("If current foreground process uses overlay, treat it as a game.")]
public bool DetectRTSSForeground public bool DetectRTSSForeground
{ {

View file

@ -11,7 +11,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Compile Remove="ControllerProfiles\examples\Turbo.x360.cs" /> <Compile Remove="ControllerProfiles\Turbo.x360.example.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@ -23,7 +23,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="ControllerProfiles\examples\Turbo.x360.cs"> <Content Include="ControllerProfiles\Turbo.x360.example.cs">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
</ItemGroup> </ItemGroup>