summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authora1xd <[email protected]>2021-09-19 03:22:31 -0400
committera1xd <[email protected]>2021-09-23 22:37:03 -0400
commit5f997e3658944149bfd18c234de5f41b4bfae913 (patch)
tree12c0eab2a16ce6d42d836b0c51be2d9a4f07570d
parentfix jump fields (diff)
downloadrawaccel-5f997e3658944149bfd18c234de5f41b4bfae913.tar.xz
rawaccel-5f997e3658944149bfd18c234de5f41b4bfae913.zip
fix input checks
only check for cap < offset if relevant modes are selected
-rw-r--r--common/rawaccel-validate.hpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/common/rawaccel-validate.hpp b/common/rawaccel-validate.hpp
index 4ea7936..b84fdb7 100644
--- a/common/rawaccel-validate.hpp
+++ b/common/rawaccel-validate.hpp
@@ -77,8 +77,14 @@ namespace rawaccel {
error("cap (output) can not be 0");
}
- if (args.cap.x > 0 && args.cap.x < args.input_offset ||
- args.cap.y > 0 && args.cap.y < args.output_offset) {
+ if ((args.mode == accel_mode::classic &&
+ args.cap.x > 0 &&
+ args.cap.x < args.input_offset &&
+ args.cap_mode != cap_mode::out) ||
+ (args.mode == accel_mode::power &&
+ args.cap.y > 0 &&
+ args.cap.y < args.output_offset &&
+ args.cap_mode != cap_mode::in)) {
error("cap < offset");
}