Better evdev joystick axis scaling (#3202)

Fix evdev scaling when the minimum value is <0
Declare a trigger as pressed as long as any value >0 is given
This commit is contained in:
Ryan Gonzalez 2017-08-15 14:14:13 -05:00 committed by Ivan
parent 956117a74f
commit 6d14583f28
2 changed files with 37 additions and 24 deletions

View file

@ -44,7 +44,6 @@ struct evdev_joystick_config final : cfg::node
cfg::_bool lxreverse{this, "Reverse left stick X axis", false};
cfg::_bool lyreverse{this, "Reverse left stick Y axis", false};
cfg::_bool needscale{this, "Axis scaling", true};
cfg::_bool axistrigger{this, "Z axis triggers", true};
bool load()
@ -76,6 +75,7 @@ public:
private:
void update_devs();
bool try_open_dev(u32 index);
int scale_axis(int axis, int value);
void thread_func();
std::unique_ptr<std::thread> joy_thread;
@ -85,6 +85,7 @@ private:
std::vector<std::vector<int>> joy_button_maps;
std::vector<std::vector<int>> joy_axis_maps;
std::vector<int> joy_hat_ids;
bool needscale, axistrigger;
bool axistrigger;
std::map<int, std::pair<int, int>> axis_ranges;
std::vector<bool> revaxis;
};