Salvaging code (#9432)

* Minor input refactoring

* fix sys_config_unregister_io_error_listener log message

* Remove unused variables in RepaintTextColors

Co-authored-by: GermanAizek <GermanAizek@yandex.ru>
This commit is contained in:
Megamouse 2020-12-14 14:33:43 +01:00 committed by GitHub
parent ab23e5ca0e
commit 03ad5c6830
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 208 additions and 181 deletions

View file

@ -279,7 +279,7 @@ std::shared_ptr<evdev_joystick_handler::EvdevDevice> evdev_joystick_handler::get
void evdev_joystick_handler::get_next_button_press(const std::string& padId, const pad_callback& callback, const pad_fail_callback& fail_callback, bool get_blacklist, const std::vector<std::string>& buttons)
{
if (get_blacklist)
blacklist.clear();
m_blacklist.clear();
// Get our evdev device
auto device = get_evdev_device(padId);
@ -343,7 +343,7 @@ void evdev_joystick_handler::get_next_button_press(const std::string& padId, con
if (padId.find("Sony") != umax && (code == BTN_TL2 || code == BTN_TR2))
continue;
if (!get_blacklist && std::find(blacklist.begin(), blacklist.end(), name) != blacklist.end())
if (!get_blacklist && std::find(m_blacklist.begin(), m_blacklist.end(), name) != m_blacklist.end())
continue;
const u16 value = data[code].first;
@ -351,7 +351,7 @@ void evdev_joystick_handler::get_next_button_press(const std::string& padId, con
{
if (get_blacklist)
{
blacklist.emplace_back(name);
m_blacklist.emplace_back(name);
evdev_log.error("Evdev Calibration: Added button [ %d = %s = %s ] to blacklist. Value = %d", code, libevdev_event_code_get_name(EV_KEY, code), name, value);
}
else if (value > pressed_button.first)
@ -364,7 +364,7 @@ void evdev_joystick_handler::get_next_button_press(const std::string& padId, con
if (data[code].second)
continue;
if (!get_blacklist && std::find(blacklist.begin(), blacklist.end(), name) != blacklist.end())
if (!get_blacklist && std::find(m_blacklist.begin(), m_blacklist.end(), name) != m_blacklist.end())
continue;
const u16 value = data[code].first;
@ -374,7 +374,7 @@ void evdev_joystick_handler::get_next_button_press(const std::string& padId, con
{
const int min = libevdev_get_abs_minimum(dev, code);
const int max = libevdev_get_abs_maximum(dev, code);
blacklist.emplace_back(name);
m_blacklist.emplace_back(name);
evdev_log.error("Evdev Calibration: Added axis [ %d = %s = %s ] to blacklist. [ Value = %d ] [ Min = %d ] [ Max = %d ]", code, libevdev_event_code_get_name(EV_ABS, code), name, value, min, max);
}
else if (value > pressed_button.first)
@ -387,7 +387,7 @@ void evdev_joystick_handler::get_next_button_press(const std::string& padId, con
if (!data[code].second)
continue;
if (!get_blacklist && std::find(blacklist.begin(), blacklist.end(), name) != blacklist.end())
if (!get_blacklist && std::find(m_blacklist.begin(), m_blacklist.end(), name) != m_blacklist.end())
continue;
const u16 value = data[code].first;
@ -397,7 +397,7 @@ void evdev_joystick_handler::get_next_button_press(const std::string& padId, con
{
const int min = libevdev_get_abs_minimum(dev, code);
const int max = libevdev_get_abs_maximum(dev, code);
blacklist.emplace_back(name);
m_blacklist.emplace_back(name);
evdev_log.error("Evdev Calibration: Added rev axis [ %d = %s = %s ] to blacklist. [ Value = %d ] [ Min = %d ] [ Max = %d ]", code, libevdev_event_code_get_name(EV_ABS, code), name, value, min, max);
}
else if (value > pressed_button.first)
@ -407,7 +407,7 @@ void evdev_joystick_handler::get_next_button_press(const std::string& padId, con
if (get_blacklist)
{
if (blacklist.empty())
if (m_blacklist.empty())
evdev_log.success("Evdev Calibration: Blacklist is clear. No input spam detected");
return;
}
@ -618,8 +618,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)
{
if (in_settings && settings_added.count(device))
return settings_added.at(device);
if (in_settings && m_settings_added.count(device))
return m_settings_added.at(device);
// 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;
@ -671,7 +671,7 @@ int evdev_joystick_handler::add_device(const std::string& device, const std::sha
if (in_settings)
{
m_dev = std::make_shared<EvdevDevice>();
settings_added[device] = bindings.size();
m_settings_added[device] = bindings.size();
// Let's log axis information while we are in the settings in order to identify problems more easily.
for (const auto& [code, axis_name] : axis_list)