summaryrefslogtreecommitdiff
path: root/driver/driver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'driver/driver.cpp')
-rw-r--r--driver/driver.cpp57
1 files changed, 31 insertions, 26 deletions
diff --git a/driver/driver.cpp b/driver/driver.cpp
index 235571c..5b9eca4 100644
--- a/driver/driver.cpp
+++ b/driver/driver.cpp
@@ -67,40 +67,45 @@ Arguments:
auto it = InputDataStart;
do {
- vec2d input = {
- static_cast<double>(it->LastX),
- static_cast<double>(it->LastY)
- };
-
- global.modifier.apply_rotation(input);
- global.modifier.apply_angle_snap(input);
-
- if (enable_accel) {
- auto time_supplier = [=] {
- counter_t now = KeQueryPerformanceCounter(NULL).QuadPart;
- counter_t ticks = now - devExt->counter;
- devExt->counter = now;
- milliseconds time = ticks * global.tick_interval;
- return clampsd(time, global.args.time_min, 100);
+ if (it->LastX || it->LastY) {
+ vec2d input = {
+ static_cast<double>(it->LastX),
+ static_cast<double>(it->LastY)
};
- global.modifier.apply_acceleration(input, time_supplier);
- }
+ global.modifier.apply_rotation(input);
+ global.modifier.apply_angle_snap(input);
+
+ if (enable_accel) {
+ auto time_supplier = [=] {
+ counter_t now = KeQueryPerformanceCounter(NULL).QuadPart;
+ counter_t ticks = now - devExt->counter;
+ devExt->counter = now;
+ milliseconds time = ticks * global.tick_interval;
+ return clampsd(time, global.args.time_min, 100);
+ };
- global.modifier.apply_sensitivity(input);
+ global.modifier.apply_acceleration(input, time_supplier);
+ }
- double carried_result_x = input.x + devExt->carry.x;
- double carried_result_y = input.y + devExt->carry.y;
+ global.modifier.apply_sensitivity(input);
- LONG out_x = static_cast<LONG>(carried_result_x);
- LONG out_y = static_cast<LONG>(carried_result_y);
+ double carried_result_x = input.x + devExt->carry.x;
+ double carried_result_y = input.y + devExt->carry.y;
- devExt->carry.x = carried_result_x - out_x;
- devExt->carry.y = carried_result_y - out_y;
+ LONG out_x = static_cast<LONG>(carried_result_x);
+ LONG out_y = static_cast<LONG>(carried_result_y);
- it->LastX = out_x;
- it->LastY = out_y;
+ double carry_x = carried_result_x - out_x;
+ double carry_y = carried_result_y - out_y;
+ if (!infnan(carry_x + carry_y)) {
+ devExt->carry.x = carried_result_x - out_x;
+ devExt->carry.y = carried_result_y - out_y;
+ it->LastX = out_x;
+ it->LastY = out_y;
+ }
+ }
} while (++it != InputDataEnd);
}