summaryrefslogtreecommitdiff
path: root/wrapper
diff options
context:
space:
mode:
authorJacob Palecki <[email protected]>2021-01-20 00:42:24 -0800
committerJacob Palecki <[email protected]>2021-01-20 00:42:24 -0800
commit77b4c7876918cac82494ec8fc15a22fdab5cf714 (patch)
tree66b2c7d86cecf0846c3b5cdaa69c6991858ed931 /wrapper
parentRemove debug statement (diff)
parentshow custom dialog on bad input (#63) (diff)
downloadrawaccel-77b4c7876918cac82494ec8fc15a22fdab5cf714.tar.xz
rawaccel-77b4c7876918cac82494ec8fc15a22fdab5cf714.zip
merge with master builds
Diffstat (limited to 'wrapper')
-rw-r--r--wrapper/wrapper.cpp27
-rw-r--r--wrapper/wrapper.vcxproj4
2 files changed, 28 insertions, 3 deletions
diff --git a/wrapper/wrapper.cpp b/wrapper/wrapper.cpp
index fdde5a4..7fd0a92 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;
@@ -59,7 +62,7 @@ public value struct DomainArgs
};
[JsonObject(ItemRequired = Required::Always)]
-[StructLayout(LayoutKind::Sequential)]
+[StructLayout(LayoutKind::Sequential, CharSet = CharSet::Unicode)]
public ref struct DriverSettings
{
literal String^ Key = "Driver settings";
@@ -92,6 +95,10 @@ public ref struct DriverSettings
[JsonProperty(Required = Required::Default)]
double minimumTime;
+ [JsonProperty("Device ID", Required = Required::Default)]
+ [MarshalAs(UnmanagedType::ByValTStr, SizeConst = MAX_DEV_ID_LEN)]
+ String^ deviceID = "";
+
bool ShouldSerializeminimumTime()
{
return minimumTime > 0 && minimumTime != DEFAULT_TIME_MIN;
@@ -231,6 +238,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;
diff --git a/wrapper/wrapper.vcxproj b/wrapper/wrapper.vcxproj
index 4f8ed1c..721a981 100644
--- a/wrapper/wrapper.vcxproj
+++ b/wrapper/wrapper.vcxproj
@@ -59,7 +59,7 @@
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
- <AdditionalDependencies />
+ <AdditionalDependencies>User32.lib;</AdditionalDependencies>
</Link>
<ResourceCompile>
<AdditionalIncludeDirectories>$(SolutionDir)/common;</AdditionalIncludeDirectories>
@@ -72,7 +72,7 @@
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
- <AdditionalDependencies />
+ <AdditionalDependencies>User32.lib;</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>copy /Y "$(TargetPath)" "$(SolutionDir)signed\$(TargetFileName)" &amp;