diff options
author | Rodrigo Locatti <rodrigo.locatti@gmail.com> | 2021-06-22 08:16:21 +0200 |
---|---|---|
committer | Rodrigo Locatti <rodrigo.locatti@gmail.com> | 2021-06-22 08:16:21 +0200 |
commit | 15cc561d12719ef4e7bfc62701be88526f4869fe (patch) | |
tree | 5476a0527b131d64cbde0b477c34fb9282e331b6 /src/core/hle/service/hid/controllers/npad.cpp | |
parent | Merge pull request #6499 from FernandoS27/we-were-on-a-break (diff) | |
download | yuzu-15cc561d12719ef4e7bfc62701be88526f4869fe.tar yuzu-15cc561d12719ef4e7bfc62701be88526f4869fe.tar.gz yuzu-15cc561d12719ef4e7bfc62701be88526f4869fe.tar.bz2 yuzu-15cc561d12719ef4e7bfc62701be88526f4869fe.tar.lz yuzu-15cc561d12719ef4e7bfc62701be88526f4869fe.tar.xz yuzu-15cc561d12719ef4e7bfc62701be88526f4869fe.tar.zst yuzu-15cc561d12719ef4e7bfc62701be88526f4869fe.zip |
Diffstat (limited to 'src/core/hle/service/hid/controllers/npad.cpp')
-rw-r--r-- | src/core/hle/service/hid/controllers/npad.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp index 7acad3798..1eb02aee2 100644 --- a/src/core/hle/service/hid/controllers/npad.cpp +++ b/src/core/hle/service/hid/controllers/npad.cpp @@ -314,6 +314,8 @@ void Controller_NPad::OnInit() { void Controller_NPad::OnLoadInputDevices() { const auto& players = Settings::values.players.GetValue(); + + std::lock_guard lock{mutex}; for (std::size_t i = 0; i < players.size(); ++i) { std::transform(players[i].buttons.begin() + Settings::NativeButton::BUTTON_HID_BEGIN, players[i].buttons.begin() + Settings::NativeButton::BUTTON_HID_END, @@ -348,6 +350,8 @@ void Controller_NPad::OnRelease() { } void Controller_NPad::RequestPadStateUpdate(u32 npad_id) { + std::lock_guard lock{mutex}; + const auto controller_idx = NPadIdToIndex(npad_id); const auto controller_type = connected_controllers[controller_idx].type; if (!connected_controllers[controller_idx].is_connected) { |