mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-06 06:55:09 +00:00
input: enable squircle settings in keyboard pad handler
Clamp squircled values to radius 1. Also set kb and evdev default to 8000 as the others
This commit is contained in:
parent
8131f40269
commit
e5a526e4d6
7 changed files with 211 additions and 266 deletions
|
|
@ -68,8 +68,8 @@ void keyboard_pad_handler::init_config(cfg_pad* cfg)
|
|||
cfg->rstickdeadzone.def = 0;
|
||||
cfg->ltriggerthreshold.def = 0;
|
||||
cfg->rtriggerthreshold.def = 0;
|
||||
cfg->lpadsquircling.def = 0;
|
||||
cfg->rpadsquircling.def = 0;
|
||||
cfg->lpadsquircling.def = 8000;
|
||||
cfg->rpadsquircling.def = 8000;
|
||||
|
||||
// apply defaults
|
||||
cfg->from_default();
|
||||
|
|
@ -1277,7 +1277,34 @@ void keyboard_pad_handler::process()
|
|||
{
|
||||
auto& pad = m_bindings[i].pad;
|
||||
ensure(pad);
|
||||
pad->m_buttons = m_pads_internal[i].m_buttons;
|
||||
pad->m_sticks = m_pads_internal[i].m_sticks;
|
||||
|
||||
const cfg_pad* cfg = &m_pad_configs[pad->m_player_id];
|
||||
ensure(cfg);
|
||||
|
||||
const Pad& pad_internal = m_pads_internal[i];
|
||||
|
||||
// Normalize and apply pad squircling
|
||||
// Copy sticks first. We don't want to modify the raw internal values
|
||||
std::vector<AnalogStick> squircled_sticks = pad_internal.m_sticks;
|
||||
|
||||
// Apply squircling
|
||||
if (cfg->lpadsquircling != 0)
|
||||
{
|
||||
u16& lx = squircled_sticks[0].m_value;
|
||||
u16& ly = squircled_sticks[1].m_value;
|
||||
|
||||
ConvertToSquirclePoint(lx, ly, cfg->lpadsquircling);
|
||||
}
|
||||
|
||||
if (cfg->rpadsquircling != 0)
|
||||
{
|
||||
u16& rx = squircled_sticks[2].m_value;
|
||||
u16& ry = squircled_sticks[3].m_value;
|
||||
|
||||
ConvertToSquirclePoint(rx, ry, cfg->rpadsquircling);
|
||||
}
|
||||
|
||||
pad->m_buttons = pad_internal.m_buttons;
|
||||
pad->m_sticks = std::move(squircled_sticks);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue