Skip to content

Commit

Permalink
InputManager: Fix exit menu button forwarding to game
Browse files Browse the repository at this point in the history
  • Loading branch information
stenzek committed May 26, 2024
1 parent 2d12703 commit 9187e7e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pcsx2/Input/InputManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -963,7 +963,7 @@ bool InputManager::ProcessEvent(InputBindingKey key, float value, bool skip_butt
// and 0 on release (when the full state changes).
if (IsAxisHandler(binding->handler))
{
if (value_to_pass >= 0.0f)
if (value_to_pass >= 0.0f && (!skip_button_handlers || value_to_pass == 0.0f))

This comment has been minimized.

Copy link
@neoh4x0r

neoh4x0r May 26, 2024

This might be pedantic, but for a minimal boolean expression (so you don't check for equality twice) you could use the following expression (I've checked it using a truth table and a k-map):

if (value_to_pass == 0.0f) || (!skip_button_handlers && value_to_pass > 0.0f)
    std::get<InputAxisEventHandler>(binding->handler)(value_to_pass);

This comment has been minimized.

Copy link
@stenzek

stenzek May 27, 2024

Author Contributor

Still the same number of comparisons, so the same number of operations. I suppose it'd be ever-so-slightly faster if it short-circuited to the zero side, but practically, this isn't hot code so it would make no difference :)

std::get<InputAxisEventHandler>(binding->handler)(value_to_pass);
}
else if (binding->num_keys >= min_num_keys)
Expand Down

0 comments on commit 9187e7e

Please sign in to comment.