controllers/npad: Make press_state atomic

merge-requests/60/head
Morph 2020-11-25 07:48:00 +07:00
parent 5836786246
commit 54ea3c47c8
2 changed files with 3 additions and 2 deletions

@ -1058,7 +1058,7 @@ void Controller_NPad::ClearAllControllers() {
}
u32 Controller_NPad::GetAndResetPressState() {
return std::exchange(press_state, 0);
return press_state.exchange(0);
}
bool Controller_NPad::IsControllerSupported(NPadControllerType controller) const {

@ -5,6 +5,7 @@
#pragma once
#include <array>
#include <atomic>
#include "common/bit_field.h"
#include "common/common_types.h"
#include "core/frontend/input.h"
@ -415,7 +416,7 @@ private:
bool IsControllerSupported(NPadControllerType controller) const;
void RequestPadStateUpdate(u32 npad_id);
u32 press_state{};
std::atomic<u32> press_state{};
NpadStyleSet style{};
std::array<NPadEntry, 10> shared_memory_entries{};