input: move pressure sensitivity to the handlers

This removes a data race where the button was kept pressed but the values ingame could vary
This commit is contained in:
Megamouse 2021-08-29 09:08:31 +02:00
parent 977d729ee0
commit b07960d3bc
3 changed files with 28 additions and 10 deletions

View file

@ -244,11 +244,8 @@ void pad_thread::ThreadFunc()
{
const auto& pad = m_pads[i];
// I guess this is the best place to add pressure sensitivity without too much code duplication.
if (pad->m_port_status & CELL_PAD_STATUS_CONNECTED)
{
const bool adjust_pressure = pad->m_pressure_intensity_button_index >= 0 && pad->m_buttons[pad->m_pressure_intensity_button_index].m_pressed;
for (auto& button : pad->m_buttons)
{
if (button.m_pressed)
@ -262,11 +259,6 @@ void pad_thread::ThreadFunc()
{
any_button_pressed = true;
}
if (adjust_pressure)
{
button.m_value = pad->m_pressure_intensity;
}
}
}
}