diff options
| author | Jordan Woyak <jordan.woyak@gmail.com> | 2019-01-08 09:28:24 -0600 |
|---|---|---|
| committer | Jordan Woyak <jordan.woyak@gmail.com> | 2019-01-17 12:10:50 -0600 |
| commit | 52aa39991ca9964f491ee241f04f31eb6864ae9e (patch) | |
| tree | fa6ca09437cab28e0e53ae0ecf6422116b56fa24 /Source/Core/InputCommon/ControllerInterface/evdev/evdev.h | |
| parent | 3627ef8a0489765eb10ab29a7988866b52493239 (diff) | |
ControllerInterface: evdev: Cleanup rumble effect processing so effects aren't removed and re-uploaded with every SetState() call. Split the "LeftRight" output into separate "Strong" and "Weak" outputs. Other minor cleanups.
Diffstat (limited to 'Source/Core/InputCommon/ControllerInterface/evdev/evdev.h')
| -rw-r--r-- | Source/Core/InputCommon/ControllerInterface/evdev/evdev.h | 59 |
1 files changed, 45 insertions, 14 deletions
diff --git a/Source/Core/InputCommon/ControllerInterface/evdev/evdev.h b/Source/Core/InputCommon/ControllerInterface/evdev/evdev.h index c1a3da2ada..cce4044cb9 100644 --- a/Source/Core/InputCommon/ControllerInterface/evdev/evdev.h +++ b/Source/Core/InputCommon/ControllerInterface/evdev/evdev.h @@ -44,24 +44,56 @@ private: private: const u16 m_code; const u8 m_index; - const bool m_upper; int m_range; - int m_min; + int m_base; libevdev* m_dev; }; - class ForceFeedback : public Core::Device::Output + class Effect : public Core::Device::Output { public: - std::string GetName() const override; - ForceFeedback(u16 type, libevdev* dev) : m_type(type), m_id(-1) { m_fd = libevdev_get_fd(dev); } - ~ForceFeedback(); + Effect(int fd); + ~Effect(); void SetState(ControlState state) override; + protected: + virtual bool UpdateParameters(ControlState state) = 0; + + ff_effect m_effect = {}; + + static constexpr int DISABLED_EFFECT_TYPE = 0; + + private: + void UpdateEffect(); + + int const m_fd; + }; + + class ConstantEffect : public Effect + { + public: + ConstantEffect(int fd); + bool UpdateParameters(ControlState state) override; + std::string GetName() const override; + }; + + class PeriodicEffect : public Effect + { + public: + PeriodicEffect(int fd, u16 waveform); + bool UpdateParameters(ControlState state) override; + std::string GetName() const override; + }; + + class RumbleEffect : public Effect + { + public: + RumbleEffect(int fd, bool use_strong); + bool UpdateParameters(ControlState state) override; + std::string GetName() const override; + private: - const u16 m_type; - int m_fd; - int m_id; + const bool m_use_strong_motor; }; public: @@ -73,15 +105,14 @@ public: std::string GetName() const override { return m_name; } std::string GetSource() const override { return "evdev"; } - bool IsInteresting() const { return m_initialized && m_interesting; } + bool IsInteresting() const { return m_interesting; } private: const std::string m_devfile; int m_fd; libevdev* m_dev; std::string m_name; - bool m_initialized; - bool m_interesting; + bool m_interesting = false; }; -} -} +} // namespace evdev +} // namespace ciface |
