[Qt/Input] Improve pad_settings_dialog a bit (#3611)

* Input: further work on remapping Xinput and begin work on remapping DS4

* Input: Improve pad_settings_dialog a bit and begin Remapping for XInput

* Input: begin evdev remapping and change all handlers to use cfg::string

* Input: finish work on remapping evdev

and some more crap

* Input: finish work on remapping Xinput and DS4

* Input: add DS4 Colors to DS4 config

* Input: Improve DS4 deadzone scaling

Jarves made some mistakes, so I'll fix them in the follow up commit

* Input: fix Jarves fixes on DS4 deadzone

and remove unnecessary usage of toUtf8

* Input: add primitive batterychecks to XInput and DS4

* Input: add mmjoystick remapping

* Input: Fix evdev and some Vibration issues

* Input: adjust capabilities to fix stick input for games like LoS 2

also fix threshold slider minimum
also add ps button to all the handlers

* Input: Further evdev work

based on danilaml code review and own debugging:
Fixed path issue, <= 0 issue, some captures, const, axis with same codes.
Adds a map to each device that differentiates negative and positive axis mappings.
adjusted rest of the file to tabs (ListDevices and beginning of threadProc)

* Input: use 20ms vibration update time for xbox one elite controllers.

* Input: Fix return type of Clamp()

* Input: Evdev Fix

* Input: Evdev Optional GetNextButtonPress

presumably better than the other

* Input: review changes

* Input: evdev: fix wrong index in axis handling

move bindpadtodevice down to keep consistency between handlers and not get crazy

* Input: evdev: fix expensive add_device in GetNextButtonPress

* cleanup

* Input: mmjoy: fix type

* Input: evdev: final fixes

* Input: evdev: exclude unnecessary buttons while mapping Xbox 360 or DS4

* Input: add deadzone preview by passing necessary values in callback

use 0.5 of max value for threshold in pad dialog

* Input: get rid of all-uppercase variables
This commit is contained in:
Megamouse 2017-11-27 22:31:15 +01:00 committed by Ivan
parent 695b4c1f06
commit 662fe8cc95
33 changed files with 3573 additions and 1796 deletions

View file

@ -27,8 +27,8 @@ pad_thread::~pad_thread()
void pad_thread::Init(const u32 max_connect)
{
std::memset(&m_info, 0, sizeof(m_info));
m_info.max_connect = max_connect;
m_info.now_connect = std::min(max_connect, (u32)7); // max 7 pads
m_info.max_connect = std::min(max_connect, (u32)7); // max 7 pads
m_info.now_connect = 0;
input_cfg.load();
@ -38,17 +38,19 @@ void pad_thread::Init(const u32 max_connect)
std::shared_ptr<NullPadHandler> nullpad = std::make_shared<NullPadHandler>();
handlers.emplace(pad_handler::null, nullpad);
for (u32 i = 0; i < m_info.now_connect; i++)
for (u32 i = 0; i < m_info.max_connect; i++)
{
std::shared_ptr<PadHandlerBase> cur_pad_handler;
if (handlers.count(input_cfg.player_input[i]) != 0)
const auto &handler_type = input_cfg.player_input[i];
if (handlers.count(handler_type) != 0)
{
cur_pad_handler = handlers[input_cfg.player_input[i]];
cur_pad_handler = handlers[handler_type];
}
else
{
switch (input_cfg.player_input[i])
switch (handler_type)
{
case pad_handler::keyboard:
keyptr = std::make_shared<keyboard_pad_handler>();
@ -75,7 +77,7 @@ void pad_thread::Init(const u32 max_connect)
break;
#endif
}
handlers.emplace(input_cfg.player_input[i], cur_pad_handler);
handlers.emplace(handler_type, cur_pad_handler);
}
cur_pad_handler->Init();
@ -88,9 +90,11 @@ void pad_thread::Init(const u32 max_connect)
if (cur_pad_handler->bindPadToDevice(m_pads.back(), input_cfg.player_device[i]->to_string()) == false)
{
//Failed to bind the device to cur_pad_handler so binds to NullPadHandler
LOG_ERROR(GENERAL, "Failed to bind device %s to handler %s", input_cfg.player_device[i]->to_string(), input_cfg.player_input[i].to_string());
LOG_ERROR(GENERAL, "Failed to bind device %s to handler %s", input_cfg.player_device[i]->to_string(), handler_type.to_string());
nullpad->bindPadToDevice(m_pads.back(), input_cfg.player_device[i]->to_string());
}
else if (handler_type != pad_handler::null)
m_info.now_connect++;
}
thread = std::make_shared<std::thread>(&pad_thread::ThreadFunc, this);