mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-01-29 00:33:01 +00:00
Fixes evdev settings & multiple pads handling
This commit is contained in:
parent
af0bd7136d
commit
4ff6acf6ba
@ -256,11 +256,11 @@ std::unordered_map<u64, std::pair<u16, bool>> evdev_joystick_handler::GetButtonV
|
|||||||
std::shared_ptr<evdev_joystick_handler::EvdevDevice> evdev_joystick_handler::get_evdev_device(const std::string& device)
|
std::shared_ptr<evdev_joystick_handler::EvdevDevice> evdev_joystick_handler::get_evdev_device(const std::string& device)
|
||||||
{
|
{
|
||||||
// Add device if not yet present
|
// Add device if not yet present
|
||||||
m_pad_index = add_device(device, nullptr, true);
|
int pad_index = add_device(device, nullptr, true);
|
||||||
if (m_pad_index < 0)
|
if (pad_index < 0)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
auto dev = bindings[m_pad_index];
|
auto dev = bindings[pad_index];
|
||||||
|
|
||||||
// Check if our device is connected
|
// Check if our device is connected
|
||||||
if (!update_device(dev.first))
|
if (!update_device(dev.first))
|
||||||
@ -611,8 +611,8 @@ std::vector<std::string> evdev_joystick_handler::ListDevices()
|
|||||||
|
|
||||||
int evdev_joystick_handler::add_device(const std::string& device, const std::shared_ptr<Pad>& pad, bool in_settings)
|
int evdev_joystick_handler::add_device(const std::string& device, const std::shared_ptr<Pad>& pad, bool in_settings)
|
||||||
{
|
{
|
||||||
if (in_settings && m_pad_index >= 0)
|
if (in_settings && settings_added.count(device))
|
||||||
return m_pad_index;
|
return settings_added.at(device);
|
||||||
|
|
||||||
// Now we need to find the device with the same name, and make sure not to grab any duplicates.
|
// Now we need to find the device with the same name, and make sure not to grab any duplicates.
|
||||||
std::unordered_map<std::string, u32> unique_names;
|
std::unordered_map<std::string, u32> unique_names;
|
||||||
@ -662,6 +662,12 @@ int evdev_joystick_handler::add_device(const std::string& device, const std::sha
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (in_settings)
|
||||||
|
{
|
||||||
|
m_dev = std::make_shared<EvdevDevice>();
|
||||||
|
settings_added[device] = bindings.size();
|
||||||
|
}
|
||||||
|
|
||||||
// Alright, now that we've confirmed we haven't added this joystick yet, les do dis.
|
// Alright, now that we've confirmed we haven't added this joystick yet, les do dis.
|
||||||
m_dev->device = dev;
|
m_dev->device = dev;
|
||||||
m_dev->path = path;
|
m_dev->path = path;
|
||||||
@ -881,6 +887,8 @@ bool evdev_joystick_handler::bindPadToDevice(std::shared_ptr<Pad> pad, const std
|
|||||||
int i = 0; // increment to know the axis location (17-24). Be careful if you ever add more find_key() calls in here (BUTTON_COUNT = 17)
|
int i = 0; // increment to know the axis location (17-24). Be careful if you ever add more find_key() calls in here (BUTTON_COUNT = 17)
|
||||||
int last_type = EV_ABS;
|
int last_type = EV_ABS;
|
||||||
|
|
||||||
|
m_dev = std::make_shared<EvdevDevice>();
|
||||||
|
|
||||||
int index = static_cast<int>(bindings.size());
|
int index = static_cast<int>(bindings.size());
|
||||||
m_pad_configs[index].load();
|
m_pad_configs[index].load();
|
||||||
m_dev->config = &m_pad_configs[index];
|
m_dev->config = &m_pad_configs[index];
|
||||||
|
@ -355,7 +355,7 @@ private:
|
|||||||
positive_axis m_pos_axis_config;
|
positive_axis m_pos_axis_config;
|
||||||
std::vector<u32> m_positive_axis;
|
std::vector<u32> m_positive_axis;
|
||||||
std::vector<std::string> blacklist;
|
std::vector<std::string> blacklist;
|
||||||
int m_pad_index = -1;
|
std::unordered_map<std::string, int> settings_added;
|
||||||
std::shared_ptr<EvdevDevice> m_dev;
|
std::shared_ptr<EvdevDevice> m_dev;
|
||||||
bool m_is_button_or_trigger;
|
bool m_is_button_or_trigger;
|
||||||
bool m_is_negative;
|
bool m_is_negative;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user