From 6f1098372b2016db9744ad13dffbb55b77102671 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Pazdiora?= Date: Tue, 5 Jan 2021 03:50:45 +0100 Subject: add "Device Hardware ID" setting, to affect only specific device --- wrapper/wrapper.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'wrapper/wrapper.cpp') diff --git a/wrapper/wrapper.cpp b/wrapper/wrapper.cpp index fcbf2e8..7ac3a8d 100644 --- a/wrapper/wrapper.cpp +++ b/wrapper/wrapper.cpp @@ -51,7 +51,7 @@ public value struct Vec2 }; [JsonObject(ItemRequired = Required::Always)] -[StructLayout(LayoutKind::Sequential)] +[StructLayout(LayoutKind::Sequential, CharSet = CharSet::Unicode)] public ref struct DriverSettings { literal String^ Key = "Driver settings"; @@ -78,6 +78,10 @@ public ref struct DriverSettings [JsonProperty(Required = Required::Default)] double minimumTime; + [JsonProperty("Device Hardware ID", Required = Required::Default)] + [MarshalAs(UnmanagedType::ByValTStr, SizeConst = 512)] + String^ deviceHardwareID; + bool ShouldSerializeminimumTime() { return minimumTime > 0 && minimumTime != DEFAULT_TIME_MIN; -- cgit v1.2.3 From 6969310edd56edb555dd98acbc1478caa5728593 Mon Sep 17 00:00:00 2001 From: a1xd <68629610+a1xd@users.noreply.github.com> Date: Tue, 5 Jan 2021 18:05:48 -0500 Subject: size device id/hwids based on docs this also changes the connect ioctl to not abort when hwid query fails --- wrapper/wrapper.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'wrapper/wrapper.cpp') diff --git a/wrapper/wrapper.cpp b/wrapper/wrapper.cpp index 7ac3a8d..7e3f736 100644 --- a/wrapper/wrapper.cpp +++ b/wrapper/wrapper.cpp @@ -79,7 +79,7 @@ public ref struct DriverSettings double minimumTime; [JsonProperty("Device Hardware ID", Required = Required::Default)] - [MarshalAs(UnmanagedType::ByValTStr, SizeConst = 512)] + [MarshalAs(UnmanagedType::ByValTStr, SizeConst = MAX_HWID_LEN)] String^ deviceHardwareID; bool ShouldSerializeminimumTime() -- cgit v1.2.3 From 0e60e22b73dd0693b349cbb63cf9a390c01fd5dd Mon Sep 17 00:00:00 2001 From: a1xd <68629610+a1xd@users.noreply.github.com> Date: Tue, 12 Jan 2021 17:01:18 -0500 Subject: filter raw input based on id use device id (from device instance) over first hardware id use buffered method for all ioctls update gui/DeviceIDManager to match driver behavior respond to device change events desync MouseData and PointData accessors --- wrapper/wrapper.cpp | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'wrapper/wrapper.cpp') diff --git a/wrapper/wrapper.cpp b/wrapper/wrapper.cpp index 7e3f736..2c0d5e3 100644 --- a/wrapper/wrapper.cpp +++ b/wrapper/wrapper.cpp @@ -1,13 +1,16 @@ #pragma once #include +#include #include #include +#include #include "wrapper_io.hpp" using namespace System; +using namespace System::Collections::Generic; using namespace System::Runtime::InteropServices; using namespace System::Reflection; @@ -78,9 +81,9 @@ public ref struct DriverSettings [JsonProperty(Required = Required::Default)] double minimumTime; - [JsonProperty("Device Hardware ID", Required = Required::Default)] - [MarshalAs(UnmanagedType::ByValTStr, SizeConst = MAX_HWID_LEN)] - String^ deviceHardwareID; + [JsonProperty("Device ID", Required = Required::Default)] + [MarshalAs(UnmanagedType::ByValTStr, SizeConst = MAX_DEV_ID_LEN)] + String^ deviceID = ""; bool ShouldSerializeminimumTime() { @@ -221,6 +224,24 @@ public: } }; +public ref struct RawInputInterop +{ + static void AddHandlesFromID(String^ deviceID, List^ rawInputHandles) + { + try + { + std::vector nativeHandles = rawinput_handles_from_dev_id( + msclr::interop::marshal_as(deviceID)); + + for (auto nh : nativeHandles) rawInputHandles->Add(IntPtr(nh)); + } + catch (const std::exception& e) + { + throw gcnew System::Exception(gcnew String(e.what())); + } + } +}; + public ref struct DriverInterop { literal double WriteDelayMs = WRITE_DELAY; -- cgit v1.2.3