diff options
| author | a1xd <[email protected]> | 2021-01-12 17:01:18 -0500 |
|---|---|---|
| committer | a1xd <[email protected]> | 2021-01-12 17:01:18 -0500 |
| commit | 0e60e22b73dd0693b349cbb63cf9a390c01fd5dd (patch) | |
| tree | 493bfaeb2b59b7db452c52e9ec9713e8b8296510 /wrapper/wrapper.cpp | |
| parent | Small behavior improvements (diff) | |
| download | rawaccel-0e60e22b73dd0693b349cbb63cf9a390c01fd5dd.tar.xz rawaccel-0e60e22b73dd0693b349cbb63cf9a390c01fd5dd.zip | |
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
Diffstat (limited to 'wrapper/wrapper.cpp')
| -rw-r--r-- | wrapper/wrapper.cpp | 27 |
1 files changed, 24 insertions, 3 deletions
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 <type_traits> +#include <msclr\marshal_cppstd.h> #include <rawaccel.hpp> #include <rawaccel-version.h> +#include <utility-rawinput.hpp> #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<IntPtr>^ rawInputHandles) + { + try + { + std::vector<HANDLE> nativeHandles = rawinput_handles_from_dev_id( + msclr::interop::marshal_as<std::wstring>(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; |