mirror of
https://github.com/RPCS3/rpcs3.git
synced 2026-06-05 22:55:04 -06:00
Input: optimize keyboard button handling on release
This commit is contained in:
parent
5578edf9e4
commit
7b58340a60
@ -86,8 +86,6 @@ void keyboard_pad_handler::Key(const u32 code, bool pressed, u16 value)
|
|||||||
{
|
{
|
||||||
const auto register_new_button_value = [code, pressed, value](Button& btn) -> u16
|
const auto register_new_button_value = [code, pressed, value](Button& btn) -> u16
|
||||||
{
|
{
|
||||||
u16 actual_value = 0;
|
|
||||||
|
|
||||||
// Make sure we keep this button pressed until all related keys are released.
|
// Make sure we keep this button pressed until all related keys are released.
|
||||||
if (pressed)
|
if (pressed)
|
||||||
{
|
{
|
||||||
@ -96,8 +94,16 @@ void keyboard_pad_handler::Key(const u32 code, bool pressed, u16 value)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
btn.m_pressed_keys.erase(code);
|
btn.m_pressed_keys.erase(code);
|
||||||
|
|
||||||
|
// Optimization: just skip the whole combo parsing if there are no keys pressed
|
||||||
|
if (btn.m_pressed_keys.empty())
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
u16 actual_value = 0;
|
||||||
|
|
||||||
// Get the max value of all pressed keys for this DS3 button
|
// Get the max value of all pressed keys for this DS3 button
|
||||||
for (const std::set<u32>& key_codes : btn.m_key_combos)
|
for (const std::set<u32>& key_codes : btn.m_key_combos)
|
||||||
{
|
{
|
||||||
@ -262,7 +268,7 @@ void keyboard_pad_handler::Key(const u32 code, bool pressed, u16 value)
|
|||||||
{
|
{
|
||||||
const u16 actual_value = pressed ? MultipliedInput(value, is_left_stick ? l_stick_multiplier : r_stick_multiplier) : value;
|
const u16 actual_value = pressed ? MultipliedInput(value, is_left_stick ? l_stick_multiplier : r_stick_multiplier) : value;
|
||||||
|
|
||||||
const auto register_new_stick_value = [&](bool is_max)
|
const auto register_new_stick_value = [&](bool is_max) -> std::pair<bool, u16>
|
||||||
{
|
{
|
||||||
const std::vector<std::set<u32>>& key_combos = is_max ? stick.m_key_combos_max : stick.m_key_combos_min;
|
const std::vector<std::set<u32>>& key_combos = is_max ? stick.m_key_combos_max : stick.m_key_combos_min;
|
||||||
std::map<u32, u16>& pressed_keys = is_max ? stick.m_pressed_keys_max : stick.m_pressed_keys_min;
|
std::map<u32, u16>& pressed_keys = is_max ? stick.m_pressed_keys_max : stick.m_pressed_keys_min;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user