Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed driver interface GUID from v2 to v3 #388

Merged
merged 3 commits into from
Nov 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions ControlApp/ControlApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<Version>3.0.0</Version>
<Configurations>Debug;Release</Configurations>
<IsPackable>false</IsPackable>
<NoWarn>CS1591</NoWarn>
</PropertyGroup>

<ItemGroup>
Expand All @@ -23,12 +24,12 @@

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" />
<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.2.46-beta">
<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.3.151">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Nefarius.Utilities.Bluetooth" Version="1.4.8" />
<PackageReference Include="Nefarius.Utilities.DeviceManagement" Version="3.22.0" />
<PackageReference Include="Nefarius.Utilities.Bluetooth" Version="1.6.2" />
<PackageReference Include="Nefarius.Utilities.DeviceManagement" Version="4.0.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Serilog.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
Expand Down Expand Up @@ -71,4 +72,8 @@
</EmbeddedResource>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\SDK\Nefarius.DsHidMini.IPC\Nefarius.DsHidMini.IPC.csproj" />
</ItemGroup>

</Project>
20 changes: 11 additions & 9 deletions ControlApp/Models/Drivers/BthPS3FilterDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@

using Microsoft.Win32.SafeHandles;

using Nefarius.Utilities.Bluetooth;

namespace Nefarius.DsHidMini.ControlApp.Models.Drivers;

public static class BthPS3FilterDriver
internal static class BthPS3FilterDriver
{
private const uint IOCTL_BTHPS3PSM_ENABLE_PSM_PATCHING = 0x002AAC04;
private const uint IOCTL_BTHPS3PSM_DISABLE_PSM_PATCHING = 0x002AAC08;
Expand All @@ -26,14 +28,14 @@ public static bool IsFilterAvailable
{
get
{
if (!BluetoothHelper.IsBluetoothRadioAvailable)
if (!HostRadio.IsOperable)
{
return false;
}

using SafeFileHandle? handle = PInvoke.CreateFile(
BTHPS3PSM_CONTROL_DEVICE_PATH,
FILE_ACCESS_FLAGS.FILE_GENERIC_READ | FILE_ACCESS_FLAGS.FILE_GENERIC_WRITE,
(uint)(FILE_ACCESS_RIGHTS.FILE_GENERIC_READ | FILE_ACCESS_RIGHTS.FILE_GENERIC_WRITE),
FILE_SHARE_MODE.FILE_SHARE_READ | FILE_SHARE_MODE.FILE_SHARE_WRITE,
null,
FILE_CREATION_DISPOSITION.OPEN_EXISTING,
Expand All @@ -53,14 +55,14 @@ public static unsafe bool IsFilterEnabled
{
get
{
if (!BluetoothHelper.IsBluetoothRadioAvailable)
if (!HostRadio.IsOperable)
{
return false;
}

using SafeFileHandle? handle = PInvoke.CreateFile(
BTHPS3PSM_CONTROL_DEVICE_PATH,
FILE_ACCESS_FLAGS.FILE_GENERIC_READ | FILE_ACCESS_FLAGS.FILE_GENERIC_WRITE,
(uint)(FILE_ACCESS_RIGHTS.FILE_GENERIC_READ | FILE_ACCESS_RIGHTS.FILE_GENERIC_WRITE),
FILE_SHARE_MODE.FILE_SHARE_READ | FILE_SHARE_MODE.FILE_SHARE_WRITE,
null,
FILE_CREATION_DISPOSITION.OPEN_EXISTING,
Expand All @@ -73,7 +75,7 @@ public static unsafe bool IsFilterEnabled
}

IntPtr payloadBuffer = Marshal.AllocHGlobal(Marshal.SizeOf<BTHPS3PSM_GET_PSM_PATCHING>());
BTHPS3PSM_GET_PSM_PATCHING payload = new BTHPS3PSM_GET_PSM_PATCHING { DeviceIndex = 0 };
BTHPS3PSM_GET_PSM_PATCHING payload = new() { DeviceIndex = 0 };

try
{
Expand Down Expand Up @@ -103,7 +105,7 @@ public static unsafe bool IsFilterEnabled
{
using SafeFileHandle? handle = PInvoke.CreateFile(
BTHPS3PSM_CONTROL_DEVICE_PATH,
FILE_ACCESS_FLAGS.FILE_GENERIC_READ | FILE_ACCESS_FLAGS.FILE_GENERIC_WRITE,
(uint)(FILE_ACCESS_RIGHTS.FILE_GENERIC_READ | FILE_ACCESS_RIGHTS.FILE_GENERIC_WRITE),
FILE_SHARE_MODE.FILE_SHARE_READ | FILE_SHARE_MODE.FILE_SHARE_WRITE,
null,
FILE_CREATION_DISPOSITION.OPEN_EXISTING,
Expand All @@ -116,9 +118,9 @@ public static unsafe bool IsFilterEnabled
}

IntPtr payloadEnableBuffer = Marshal.AllocHGlobal(Marshal.SizeOf<BTHPS3PSM_ENABLE_PSM_PATCHING>());
BTHPS3PSM_ENABLE_PSM_PATCHING payloadEnable = new BTHPS3PSM_ENABLE_PSM_PATCHING { DeviceIndex = 0 };
BTHPS3PSM_ENABLE_PSM_PATCHING payloadEnable = new() { DeviceIndex = 0 };
IntPtr payloadDisableBuffer = Marshal.AllocHGlobal(Marshal.SizeOf<BTHPS3PSM_DISABLE_PSM_PATCHING>());
BTHPS3PSM_DISABLE_PSM_PATCHING payloadDisable = new BTHPS3PSM_DISABLE_PSM_PATCHING { DeviceIndex = 0 };
BTHPS3PSM_DISABLE_PSM_PATCHING payloadDisable = new() { DeviceIndex = 0 };

try
{
Expand Down
109 changes: 0 additions & 109 deletions ControlApp/Models/Drivers/DsHidMiniDriver.cs

This file was deleted.

1 change: 1 addition & 0 deletions ControlApp/Models/DshmDevMan.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Nefarius.DsHidMini.ControlApp.Models.Drivers;
using Nefarius.DsHidMini.IPC.Models.Drivers;
using Nefarius.Utilities.DeviceManagement.PnP;
using Nefarius.Utilities.Bluetooth;
using Nefarius.Utilities.DeviceManagement.Extensions;
Expand Down
72 changes: 0 additions & 72 deletions ControlApp/Models/Util/BluetoothHelper.cs

This file was deleted.

3 changes: 2 additions & 1 deletion ControlApp/NativeMethods.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ BluetoothFindRadioClose
BLUETOOTH_FIND_RADIO_PARAMS
CreateFile
DeviceIoControl
WIN32_ERROR
WIN32_ERROR
FILE_ACCESS_RIGHTS
2 changes: 1 addition & 1 deletion ControlApp/ViewModels/UserControls/DeviceViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
using System.Text.RegularExpressions;

using Nefarius.DsHidMini.ControlApp.Models;
using Nefarius.DsHidMini.ControlApp.Models.Drivers;
using Nefarius.DsHidMini.ControlApp.Models.DshmConfigManager;
using Nefarius.DsHidMini.ControlApp.Models.DshmConfigManager.Enums;
using Nefarius.DsHidMini.ControlApp.Models.Enums;
using Nefarius.DsHidMini.ControlApp.Services;
using Nefarius.DsHidMini.IPC.Models.Drivers;
using Nefarius.Utilities.DeviceManagement.PnP;

using Wpf.Ui;
Expand Down
35 changes: 34 additions & 1 deletion ControlAppSolution.sln
Original file line number Diff line number Diff line change
@@ -1,16 +1,49 @@

Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ControlApp", "ControlApp\ControlApp.csproj", "{4FC75652-3769-44DC-8BC6-9810FD59C1B3}"
# Visual Studio Version 17
VisualStudioVersion = 17.11.35312.102
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ControlApp", "ControlApp\ControlApp.csproj", "{4FC75652-3769-44DC-8BC6-9810FD59C1B3}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "App", "App", "{2EA3786E-1A9C-4442-9279-63D238ACEB22}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SDK", "SDK", "{D0F6B995-AA89-4029-AFC8-0C90F62D8F71}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Nefarius.DsHidMini.IPC", "SDK\Nefarius.DsHidMini.IPC\Nefarius.DsHidMini.IPC.csproj", "{99F5F24C-06A7-4F6C-A2E5-81C8772BBDE6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4FC75652-3769-44DC-8BC6-9810FD59C1B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4FC75652-3769-44DC-8BC6-9810FD59C1B3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4FC75652-3769-44DC-8BC6-9810FD59C1B3}.Debug|x64.ActiveCfg = Debug|x64
{4FC75652-3769-44DC-8BC6-9810FD59C1B3}.Debug|x64.Build.0 = Debug|x64
{4FC75652-3769-44DC-8BC6-9810FD59C1B3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4FC75652-3769-44DC-8BC6-9810FD59C1B3}.Release|Any CPU.Build.0 = Release|Any CPU
{4FC75652-3769-44DC-8BC6-9810FD59C1B3}.Release|x64.ActiveCfg = Release|x64
{4FC75652-3769-44DC-8BC6-9810FD59C1B3}.Release|x64.Build.0 = Release|x64
{99F5F24C-06A7-4F6C-A2E5-81C8772BBDE6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{99F5F24C-06A7-4F6C-A2E5-81C8772BBDE6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{99F5F24C-06A7-4F6C-A2E5-81C8772BBDE6}.Debug|x64.ActiveCfg = Debug|Any CPU
{99F5F24C-06A7-4F6C-A2E5-81C8772BBDE6}.Debug|x64.Build.0 = Debug|Any CPU
{99F5F24C-06A7-4F6C-A2E5-81C8772BBDE6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{99F5F24C-06A7-4F6C-A2E5-81C8772BBDE6}.Release|Any CPU.Build.0 = Release|Any CPU
{99F5F24C-06A7-4F6C-A2E5-81C8772BBDE6}.Release|x64.ActiveCfg = Release|Any CPU
{99F5F24C-06A7-4F6C-A2E5-81C8772BBDE6}.Release|x64.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{4FC75652-3769-44DC-8BC6-9810FD59C1B3} = {2EA3786E-1A9C-4442-9279-63D238ACEB22}
{99F5F24C-06A7-4F6C-A2E5-81C8772BBDE6} = {D0F6B995-AA89-4029-AFC8-0C90F62D8F71}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {07C6077B-1137-4AC4-91C4-18B86B6406D9}
EndGlobalSection
EndGlobal
2 changes: 2 additions & 0 deletions ControlAppSolution.sln.DotSettings
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/UserDictionary/Words/=sixaxis/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
3 changes: 2 additions & 1 deletion SDK/Nefarius.DsHidMini.IPC/Models/Drivers/DsHidMiniDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public static class DsHidMiniDriver
/// <summary>
/// Interface GUID common to all devices the DsHidMini driver supports.
/// </summary>
public static Guid DeviceInterfaceGuid => Guid.Parse("{399ED672-E0BD-4FB3-AB0C-4955B56FB86A}");
public static Guid DeviceInterfaceGuid => Guid.Parse("{16F3FE42-B710-4F67-B6EE-9A8D249C9CE5}");

#region Read-only properties

Expand Down Expand Up @@ -132,6 +132,7 @@ public enum DsBatteryStatus : byte
[TypeConverter(typeof(EnumDescriptionTypeConverter))]
[SuppressMessage("ReSharper", "InconsistentNaming")]
[SuppressMessage("ReSharper", "UnusedMember.Global")]
[SuppressMessage("ReSharper", "UnusedType.Global")]
public enum DsHidDeviceMode : byte
{
/// <summary>
Expand Down
Loading