input: use left and right squircle values

This commit is contained in:
Megamouse 2020-07-12 19:30:45 +02:00
parent d6623e0f22
commit 4d9533ea54
8 changed files with 37 additions and 31 deletions

View file

@ -84,7 +84,8 @@ void evdev_joystick_handler::init_config(pad_config* cfg, const std::string& nam
cfg->rstickdeadzone.def = 30; // between 0 and 255
cfg->ltriggerthreshold.def = 0; // between 0 and 255
cfg->rtriggerthreshold.def = 0; // between 0 and 255
cfg->padsquircling.def = 5000;
cfg->lpadsquircling.def = 5000;
cfg->rpadsquircling.def = 5000;
// apply defaults
cfg->from_default();
@ -830,18 +831,11 @@ void evdev_joystick_handler::get_mapping(const std::shared_ptr<PadDevice>& devic
const auto profile = m_dev->config;
// Normalize our two stick's axis based on the thresholds
u16 lx, ly, rx, ry;
// Normalize our two stick's axis based on the thresholds
std::tie(lx, ly) = NormalizeStickDeadzone(m_dev->stick_val[0], m_dev->stick_val[1], profile->lstickdeadzone);
std::tie(rx, ry) = NormalizeStickDeadzone(m_dev->stick_val[2], m_dev->stick_val[3], profile->rstickdeadzone);
if (profile->padsquircling != 0)
{
std::tie(lx, ly) = ConvertToSquirclePoint(lx, ly, profile->padsquircling);
std::tie(rx, ry) = ConvertToSquirclePoint(rx, ry, profile->padsquircling);
}
// Normalize and apply pad squircling
convert_stick_values(lx, ly, m_dev->stick_val[0], m_dev->stick_val[1], profile->lstickdeadzone, profile->lpadsquircling);
convert_stick_values(rx, ry, m_dev->stick_val[2], m_dev->stick_val[3], profile->rstickdeadzone, profile->rpadsquircling);
pad->m_sticks[0].m_value = lx;
pad->m_sticks[1].m_value = 255 - ly;