summaryrefslogtreecommitdiff
path: root/common/rawaccel-validate.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'common/rawaccel-validate.hpp')
-rw-r--r--common/rawaccel-validate.hpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/common/rawaccel-validate.hpp b/common/rawaccel-validate.hpp
index a88d514..23deb5f 100644
--- a/common/rawaccel-validate.hpp
+++ b/common/rawaccel-validate.hpp
@@ -50,16 +50,20 @@ namespace rawaccel {
error("data size > max");
}
- if (args.offset < 0) {
+ if (args.input_offset < 0) {
error("offset can not be negative");
}
- else if (args.mode == accel_mode::jump && args.offset == 0) {
+ else if (args.mode == accel_mode::jump && args.input_offset == 0) {
error("offset can not be 0");
}
+ if (args.output_offset < 0) {
+ error("offset can not be negative");
+ }
+
bool jump_or_io_cap =
(args.mode == accel_mode::jump ||
- (args.mode == accel_mode::classic &&
+ ((args.mode == accel_mode::classic || args.mode == accel_mode::power) &&
args.cap_mode == classic_cap_mode::io));
if (args.cap.x < 0) {
@@ -76,6 +80,11 @@ 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) {
+ error("cap < offset");
+ }
+
if (args.growth_rate <= 0 ||
args.decay_rate <= 0 ||
args.acceleration <= 0) {