controllers/npad: Make press_state atomic

This commit is contained in:
Morph 2020-11-25 07:48:00 -05:00
parent 5836786246
commit 54ea3c47c8
2 changed files with 3 additions and 2 deletions

View File

@ -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 {

View File

@ -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{};