mirror of
https://github.com/cemu-project/Cemu.git
synced 2026-09-28 12:06:29 -05:00
Make controller button code thread-safe (#405)
* Refactor spinlock to meet Lockable requirements * Input: Refactor button code and make it thread-safe
This commit is contained in:
@@ -279,13 +279,9 @@ bool EmulatedController::is_mapping_down(uint64 mapping) const
|
||||
const auto it = m_mappings.find(mapping);
|
||||
if (it != m_mappings.cend())
|
||||
{
|
||||
if (const auto controller = it->second.controller.lock()) {
|
||||
auto& buttons=controller->get_state().buttons;
|
||||
auto buttonState=buttons.find(it->second.button);
|
||||
return buttonState!=buttons.end() && buttonState->second;
|
||||
}
|
||||
if (const auto controller = it->second.controller.lock())
|
||||
return controller->get_state().buttons.GetButtonState(it->second.button);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user