From f7a1883e4d26ebb2904518236656d53d8b5645b7 Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Tue, 28 Jul 2020 02:09:21 -0700 Subject: Remove extra mode from variables --- driver/driver.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'driver/driver.cpp') diff --git a/driver/driver.cpp b/driver/driver.cpp index e77ac5f..5523f28 100644 --- a/driver/driver.cpp +++ b/driver/driver.cpp @@ -83,7 +83,7 @@ Arguments: DebugPrint(("RA time < min with %d ticks\n", ticks)); } - input = global.vars.accel_fn(input, time, global.vars.accel_mode); + input = global.vars.accel_fn(input, time); } double result_x = input.x * global.vars.sensitivity.x + local_carry.x; -- cgit v1.2.3 From b1ef35050600978318581586691f5a8f119abf5b Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Tue, 28 Jul 2020 02:44:09 -0700 Subject: Rename variables and add modify functions --- driver/driver.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'driver/driver.cpp') diff --git a/driver/driver.cpp b/driver/driver.cpp index 5523f28..9704b21 100644 --- a/driver/driver.cpp +++ b/driver/driver.cpp @@ -15,7 +15,7 @@ using milliseconds = double; struct { milliseconds tick_interval = 0; // set in DriverEntry - ra::variables vars; + ra::mouse_modifier modifier; } global; VOID @@ -69,25 +69,25 @@ Arguments: static_cast(it->LastY) }; - if (global.vars.apply_rotate) { - input = global.vars.rotate(input); - } - - if (global.vars.apply_accel && local_apply_accel) { + if (global.modifier.apply_accel && local_apply_accel) { auto now = KeQueryPerformanceCounter(NULL).QuadPart; auto ticks = now - devExt->counter.QuadPart; devExt->counter.QuadPart = now; milliseconds time = ticks * global.tick_interval; - if (time < global.vars.accel_fn.time_min) { + if (time < global.modifier.accel_fn.time_min) { DebugPrint(("RA time < min with %d ticks\n", ticks)); } - input = global.vars.accel_fn(input, time); + input = global.modifier.modify(input, time); + } + else + { + input = global.modifier.modify(input); } - double result_x = input.x * global.vars.sensitivity.x + local_carry.x; - double result_y = input.y * global.vars.sensitivity.y + local_carry.y; + double result_x = input.x * global.modifier.sensitivity.x + local_carry.x; + double result_y = input.y * global.modifier.sensitivity.y + local_carry.y; LONG out_x = static_cast(result_x); LONG out_y = static_cast(result_y); @@ -154,7 +154,7 @@ Return Value: DebugPrint(("Ioctl received into filter control object.\n")); - if (InputBufferLength != sizeof(ra::variables)) { + if (InputBufferLength != sizeof(ra::mouse_modifier)) { DebugPrint(("Received unknown request of %u bytes\n", InputBufferLength)); // status maps to win32 error code 1784: ERROR_INVALID_USER_BUFFER WdfRequestComplete(Request, STATUS_INVALID_BUFFER_SIZE); @@ -163,7 +163,7 @@ Return Value: status = WdfRequestRetrieveInputBuffer( Request, - sizeof(ra::variables), + sizeof(ra::mouse_modifier), &input_buffer, &input_size ); @@ -175,7 +175,7 @@ Return Value: return; } - global.vars = *reinterpret_cast(input_buffer); + global.modifier = *reinterpret_cast(input_buffer); WdfRequestComplete(Request, STATUS_SUCCESS); } -- cgit v1.2.3 From 33317e79489848ae537ac78b9c9e70372857aee8 Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Wed, 29 Jul 2020 00:35:39 -0700 Subject: Separate accel implementations into files --- driver/driver.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'driver/driver.cpp') diff --git a/driver/driver.cpp b/driver/driver.cpp index 9704b21..1f9cebd 100644 --- a/driver/driver.cpp +++ b/driver/driver.cpp @@ -79,15 +79,15 @@ Arguments: DebugPrint(("RA time < min with %d ticks\n", ticks)); } - input = global.modifier.modify(input, time); + input = global.modifier.modify_with_accel(input, time); } else { - input = global.modifier.modify(input); + input = global.modifier.modify_without_accel(input); } - double result_x = input.x * global.modifier.sensitivity.x + local_carry.x; - double result_y = input.y * global.modifier.sensitivity.y + local_carry.y; + double result_x = input.x + local_carry.x; + double result_y = input.y + local_carry.y; LONG out_x = static_cast(result_x); LONG out_y = static_cast(result_y); -- cgit v1.2.3