summaryrefslogtreecommitdiff
path: root/driver
diff options
context:
space:
mode:
authora1xd <[email protected]>2020-09-22 03:01:34 -0400
committera1xd <[email protected]>2020-09-22 03:01:34 -0400
commit75c5f80cad2b671df2d20c4b0395b5aec1bc10af (patch)
tree6f899c988afc2a7e36d632d5a6b742f4cf670990 /driver
parentMerge remote-tracking branch 'downstream/experiment' into Experiment (diff)
downloadrawaccel-75c5f80cad2b671df2d20c4b0395b5aec1bc10af.tar.xz
rawaccel-75c5f80cad2b671df2d20c4b0395b5aec1bc10af.zip
add lut exp to driver
Diffstat (limited to 'driver')
-rw-r--r--driver/driver.cpp29
1 files changed, 27 insertions, 2 deletions
diff --git a/driver/driver.cpp b/driver/driver.cpp
index fb47477..4dd3d62 100644
--- a/driver/driver.cpp
+++ b/driver/driver.cpp
@@ -12,11 +12,13 @@
namespace ra = rawaccel;
using milliseconds = double;
+using lut_value_t = ra::si_pair;
struct {
ra::settings args;
milliseconds tick_interval = 0; // set in DriverEntry
ra::mouse_modifier modifier;
+ vec2<lut_value_t*> lookups = {};
} global;
VOID
@@ -168,8 +170,14 @@ Return Value:
return;
}
- global.args = *reinterpret_cast<ra::settings*>(buffer);
- global.modifier = { global.args };
+ ra::settings new_settings = *reinterpret_cast<ra::settings*>(buffer);
+
+ if (new_settings.time_min <= 0 || _isnanf(new_settings.time_min)) {
+ new_settings.time_min = ra::settings{}.time_min;
+ }
+
+ global.args = new_settings;
+ global.modifier = { global.args, global.lookups };
WdfRequestComplete(Request, STATUS_SUCCESS);
}
@@ -251,6 +259,23 @@ Routine Description:
KeQueryPerformanceCounter(&freq);
global.tick_interval = 1e3 / freq.QuadPart;
+ auto make_lut = [] {
+ const size_t POOL_SIZE = sizeof(lut_value_t) * ra::LUT_SIZE;
+
+ auto pool = ExAllocatePoolWithTag(NonPagedPool, POOL_SIZE, 'AR');
+
+ if (!pool) {
+ DebugPrint(("RA - failed to allocate LUT\n"));
+ }
+ else {
+ RtlZeroMemory(pool, POOL_SIZE);
+ }
+
+ return reinterpret_cast<lut_value_t*>(pool);
+ };
+
+ global.lookups = { make_lut(), make_lut() };
+
CreateControlDevice(driver);
}
else {