mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-11 09:18:40 +12:00
Fix evdev controller detection, add joystick squircling
This commit is contained in:
parent
e9f057c91b
commit
66a43c35db
2 changed files with 83 additions and 10 deletions
|
@ -8,6 +8,7 @@
|
|||
#include <vector>
|
||||
#include <thread>
|
||||
|
||||
#define JOYSTICK_BUSTYPE 3
|
||||
|
||||
enum { EVDEV_DPAD_HAT_AXIS_X = -1, EVDEV_DPAD_HAT_AXIS_Y = -2 };
|
||||
|
||||
|
@ -45,6 +46,8 @@ struct evdev_joystick_config final : cfg::node
|
|||
cfg::_bool lyreverse{this, "Reverse left stick Y axis", false};
|
||||
|
||||
cfg::_bool axistrigger{this, "Z axis triggers", true};
|
||||
cfg::_bool squirclejoysticks{this, "Squircle Joysticks", true};
|
||||
cfg::int32 squirclefactor{this, "Squircle Factor", 5000};
|
||||
|
||||
bool load()
|
||||
{
|
||||
|
@ -74,6 +77,7 @@ public:
|
|||
|
||||
private:
|
||||
void update_devs();
|
||||
std::tuple<u16, u16> ConvertToSquirclePoint(u16 inX, u16 inY);
|
||||
bool try_open_dev(u32 index);
|
||||
int scale_axis(int axis, int value);
|
||||
void thread_func();
|
||||
|
@ -84,6 +88,8 @@ private:
|
|||
std::vector<libevdev*> joy_devs;
|
||||
std::vector<std::vector<int>> joy_button_maps;
|
||||
std::vector<std::vector<int>> joy_axis_maps;
|
||||
// joy_axis is only used for squircling
|
||||
std::vector<std::vector<int>> joy_axis;
|
||||
std::vector<int> joy_hat_ids;
|
||||
bool axistrigger;
|
||||
std::map<int, std::pair<int, int>> axis_ranges;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue