mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-12-21 01:37:04 +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
|
|
@ -121,7 +121,7 @@ ControllerState XInputController::raw_state()
|
|||
|
||||
// Buttons
|
||||
for(int i=0;i<std::numeric_limits<WORD>::digits;i++)
|
||||
result.buttons[i] = state.Gamepad.wButtons & (1<<i);
|
||||
result.buttons.SetButtonState(i, (state.Gamepad.wButtons & (1 << i)) != 0);
|
||||
|
||||
if (state.Gamepad.sThumbLX > 0)
|
||||
result.axis.x = (float)state.Gamepad.sThumbLX / std::numeric_limits<sint16>::max();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue