mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-12-12 10:37:02 +00: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:
parent
c40466f3a8
commit
028b3f7992
28 changed files with 311 additions and 220 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue