summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon/ControllerInterface/evdev
diff options
context:
space:
mode:
authorPierre Bourdon <delroth@gmail.com>2016-07-11 14:30:14 +0200
committerGitHub <noreply@github.com>2016-07-11 14:30:14 +0200
commit7530a2d2069a76aa65640ac97755d75871359a46 (patch)
tree08efdcb0f4ea6e585526339f6b0b4b31714c3784 /Source/Core/InputCommon/ControllerInterface/evdev
parentf57aec05257b23b097609263a7352aecca75b874 (diff)
parent6cc4591226f81ed7b27d6d4245375e18c4c40449 (diff)
Merge pull request #3999 from leoetlino/evdev-clamp
evdev: Clamp axis values to the 0.0-1.0 range
Diffstat (limited to 'Source/Core/InputCommon/ControllerInterface/evdev')
-rw-r--r--Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp b/Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp
index 658a442420..1e5f702b70 100644
--- a/Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp
+++ b/Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp
@@ -9,6 +9,7 @@
#include "Common/Assert.h"
#include "Common/Logging/Log.h"
+#include "Common/MathUtil.h"
#include "InputCommon/ControllerInterface/ControllerInterface.h"
#include "InputCommon/ControllerInterface/evdev/evdev.h"
@@ -196,7 +197,7 @@ ControlState evdevDevice::Axis::GetState() const
libevdev_fetch_event_value(m_dev, EV_ABS, m_code, &value);
// Value from 0.0 to 1.0
- ControlState fvalue = double(value - m_min) / double(m_range);
+ ControlState fvalue = MathUtil::Clamp(double(value - m_min) / double(m_range), 0.0, 1.0);
// Split into two axis, each covering half the range from 0.0 to 1.0
if (m_upper)