summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common/host_memory.cpp4
-rw-r--r--src/common/thread.h2
-rw-r--r--src/common/threadsafe_queue.h4
-rw-r--r--src/core/hle/kernel/kernel.cpp16
-rw-r--r--src/core/hle/kernel/time_manager.cpp4
-rw-r--r--src/core/hle/service/hid/controllers/npad.cpp2
-rw-r--r--src/core/hle/service/nvflinger/buffer_item_consumer.cpp4
-rw-r--r--src/core/hle/service/nvflinger/buffer_queue_consumer.cpp8
-rw-r--r--src/core/hle/service/nvflinger/buffer_queue_core.cpp2
-rw-r--r--src/core/hle/service/nvflinger/buffer_queue_producer.cpp28
-rw-r--r--src/core/hle/service/nvflinger/consumer_base.cpp4
-rw-r--r--src/core/hle/service/nvflinger/hos_binder_driver_server.cpp4
-rw-r--r--src/core/perf_stats.cpp10
-rw-r--r--src/core/tools/freezer.cpp18
-rw-r--r--src/input_common/drivers/sdl_driver.cpp12
-rw-r--r--src/input_common/input_engine.cpp46
-rw-r--r--src/video_core/gpu.cpp6
-rw-r--r--src/video_core/gpu_thread.cpp2
-rw-r--r--src/video_core/renderer_opengl/gl_graphics_pipeline.cpp2
-rw-r--r--src/video_core/renderer_opengl/gl_shader_cache.cpp4
-rw-r--r--src/video_core/renderer_vulkan/pipeline_statistics.cpp4
-rw-r--r--src/video_core/renderer_vulkan/vk_compute_pipeline.cpp2
-rw-r--r--src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp2
-rw-r--r--src/video_core/renderer_vulkan/vk_pipeline_cache.cpp4
-rw-r--r--src/video_core/renderer_vulkan/vk_render_pass_cache.cpp2
-rw-r--r--src/video_core/renderer_vulkan/vk_scheduler.cpp6
-rw-r--r--src/video_core/shader_cache.cpp2
-rw-r--r--src/web_service/web_backend.cpp4
-rw-r--r--src/yuzu/util/controller_navigation.cpp2
29 files changed, 105 insertions, 105 deletions
diff --git a/src/common/host_memory.cpp b/src/common/host_memory.cpp
index e829af1ac..802943eb7 100644
--- a/src/common/host_memory.cpp
+++ b/src/common/host_memory.cpp
@@ -149,7 +149,7 @@ public:
149 } 149 }
150 150
151 void Unmap(size_t virtual_offset, size_t length) { 151 void Unmap(size_t virtual_offset, size_t length) {
152 std::lock_guard lock{placeholder_mutex}; 152 std::scoped_lock lock{placeholder_mutex};
153 153
154 // Unmap until there are no more placeholders 154 // Unmap until there are no more placeholders
155 while (UnmapOnePlaceholder(virtual_offset, length)) { 155 while (UnmapOnePlaceholder(virtual_offset, length)) {
@@ -169,7 +169,7 @@ public:
169 } 169 }
170 const size_t virtual_end = virtual_offset + length; 170 const size_t virtual_end = virtual_offset + length;
171 171
172 std::lock_guard lock{placeholder_mutex}; 172 std::scoped_lock lock{placeholder_mutex};
173 auto [it, end] = placeholders.equal_range({virtual_offset, virtual_end}); 173 auto [it, end] = placeholders.equal_range({virtual_offset, virtual_end});
174 while (it != end) { 174 while (it != end) {
175 const size_t offset = std::max(it->lower(), virtual_offset); 175 const size_t offset = std::max(it->lower(), virtual_offset);
diff --git a/src/common/thread.h b/src/common/thread.h
index a8c17c71a..626609372 100644
--- a/src/common/thread.h
+++ b/src/common/thread.h
@@ -17,7 +17,7 @@ namespace Common {
17class Event { 17class Event {
18public: 18public:
19 void Set() { 19 void Set() {
20 std::lock_guard lk{mutex}; 20 std::scoped_lock lk{mutex};
21 if (!is_set) { 21 if (!is_set) {
22 is_set = true; 22 is_set = true;
23 condvar.notify_one(); 23 condvar.notify_one();
diff --git a/src/common/threadsafe_queue.h b/src/common/threadsafe_queue.h
index 2c8c2b90e..7272ac6e8 100644
--- a/src/common/threadsafe_queue.h
+++ b/src/common/threadsafe_queue.h
@@ -52,7 +52,7 @@ public:
52 // line before cv.wait 52 // line before cv.wait
53 // TODO(bunnei): This can be replaced with C++20 waitable atomics when properly supported. 53 // TODO(bunnei): This can be replaced with C++20 waitable atomics when properly supported.
54 // See discussion on https://github.com/yuzu-emu/yuzu/pull/3173 for details. 54 // See discussion on https://github.com/yuzu-emu/yuzu/pull/3173 for details.
55 std::lock_guard lock{cv_mutex}; 55 std::scoped_lock lock{cv_mutex};
56 cv.notify_one(); 56 cv.notify_one();
57 } 57 }
58 58
@@ -159,7 +159,7 @@ public:
159 159
160 template <typename Arg> 160 template <typename Arg>
161 void Push(Arg&& t) { 161 void Push(Arg&& t) {
162 std::lock_guard lock{write_lock}; 162 std::scoped_lock lock{write_lock};
163 spsc_queue.Push(t); 163 spsc_queue.Push(t);
164 } 164 }
165 165
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp
index 6387d0c29..134a0b8e9 100644
--- a/src/core/hle/kernel/kernel.cpp
+++ b/src/core/hle/kernel/kernel.cpp
@@ -99,7 +99,7 @@ struct KernelCore::Impl {
99 // Close all open server ports. 99 // Close all open server ports.
100 std::unordered_set<KServerPort*> server_ports_; 100 std::unordered_set<KServerPort*> server_ports_;
101 { 101 {
102 std::lock_guard lk(server_ports_lock); 102 std::scoped_lock lk{server_ports_lock};
103 server_ports_ = server_ports; 103 server_ports_ = server_ports;
104 server_ports.clear(); 104 server_ports.clear();
105 } 105 }
@@ -157,7 +157,7 @@ struct KernelCore::Impl {
157 157
158 // Close kernel objects that were not freed on shutdown 158 // Close kernel objects that were not freed on shutdown
159 { 159 {
160 std::lock_guard lk(registered_in_use_objects_lock); 160 std::scoped_lock lk{registered_in_use_objects_lock};
161 if (registered_in_use_objects.size()) { 161 if (registered_in_use_objects.size()) {
162 for (auto& object : registered_in_use_objects) { 162 for (auto& object : registered_in_use_objects) {
163 object->Close(); 163 object->Close();
@@ -178,7 +178,7 @@ struct KernelCore::Impl {
178 178
179 // Track kernel objects that were not freed on shutdown 179 // Track kernel objects that were not freed on shutdown
180 { 180 {
181 std::lock_guard lk(registered_objects_lock); 181 std::scoped_lock lk{registered_objects_lock};
182 if (registered_objects.size()) { 182 if (registered_objects.size()) {
183 LOG_DEBUG(Kernel, "{} kernel objects were dangling on shutdown!", 183 LOG_DEBUG(Kernel, "{} kernel objects were dangling on shutdown!",
184 registered_objects.size()); 184 registered_objects.size());
@@ -660,7 +660,7 @@ struct KernelCore::Impl {
660 660
661 KClientPort* port = &search->second(system.ServiceManager(), system); 661 KClientPort* port = &search->second(system.ServiceManager(), system);
662 { 662 {
663 std::lock_guard lk(server_ports_lock); 663 std::scoped_lock lk{server_ports_lock};
664 server_ports.insert(&port->GetParent()->GetServerPort()); 664 server_ports.insert(&port->GetParent()->GetServerPort());
665 } 665 }
666 return port; 666 return port;
@@ -929,22 +929,22 @@ KClientPort* KernelCore::CreateNamedServicePort(std::string name) {
929} 929}
930 930
931void KernelCore::RegisterKernelObject(KAutoObject* object) { 931void KernelCore::RegisterKernelObject(KAutoObject* object) {
932 std::lock_guard lk(impl->registered_objects_lock); 932 std::scoped_lock lk{impl->registered_objects_lock};
933 impl->registered_objects.insert(object); 933 impl->registered_objects.insert(object);
934} 934}
935 935
936void KernelCore::UnregisterKernelObject(KAutoObject* object) { 936void KernelCore::UnregisterKernelObject(KAutoObject* object) {
937 std::lock_guard lk(impl->registered_objects_lock); 937 std::scoped_lock lk{impl->registered_objects_lock};
938 impl->registered_objects.erase(object); 938 impl->registered_objects.erase(object);
939} 939}
940 940
941void KernelCore::RegisterInUseObject(KAutoObject* object) { 941void KernelCore::RegisterInUseObject(KAutoObject* object) {
942 std::lock_guard lk(impl->registered_in_use_objects_lock); 942 std::scoped_lock lk{impl->registered_in_use_objects_lock};
943 impl->registered_in_use_objects.insert(object); 943 impl->registered_in_use_objects.insert(object);
944} 944}
945 945
946void KernelCore::UnregisterInUseObject(KAutoObject* object) { 946void KernelCore::UnregisterInUseObject(KAutoObject* object) {
947 std::lock_guard lk(impl->registered_in_use_objects_lock); 947 std::scoped_lock lk{impl->registered_in_use_objects_lock};
948 impl->registered_in_use_objects.erase(object); 948 impl->registered_in_use_objects.erase(object);
949} 949}
950 950
diff --git a/src/core/hle/kernel/time_manager.cpp b/src/core/hle/kernel/time_manager.cpp
index aa985d820..5b8fe8eae 100644
--- a/src/core/hle/kernel/time_manager.cpp
+++ b/src/core/hle/kernel/time_manager.cpp
@@ -24,7 +24,7 @@ TimeManager::TimeManager(Core::System& system_) : system{system_} {
24} 24}
25 25
26void TimeManager::ScheduleTimeEvent(KThread* thread, s64 nanoseconds) { 26void TimeManager::ScheduleTimeEvent(KThread* thread, s64 nanoseconds) {
27 std::lock_guard lock{mutex}; 27 std::scoped_lock lock{mutex};
28 if (nanoseconds > 0) { 28 if (nanoseconds > 0) {
29 ASSERT(thread); 29 ASSERT(thread);
30 ASSERT(thread->GetState() != ThreadState::Runnable); 30 ASSERT(thread->GetState() != ThreadState::Runnable);
@@ -35,7 +35,7 @@ void TimeManager::ScheduleTimeEvent(KThread* thread, s64 nanoseconds) {
35} 35}
36 36
37void TimeManager::UnscheduleTimeEvent(KThread* thread) { 37void TimeManager::UnscheduleTimeEvent(KThread* thread) {
38 std::lock_guard lock{mutex}; 38 std::scoped_lock lock{mutex};
39 system.CoreTiming().UnscheduleEvent(time_manager_event_type, 39 system.CoreTiming().UnscheduleEvent(time_manager_event_type,
40 reinterpret_cast<uintptr_t>(thread)); 40 reinterpret_cast<uintptr_t>(thread));
41} 41}
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp
index aa6cb34b7..4e17a952e 100644
--- a/src/core/hle/service/hid/controllers/npad.cpp
+++ b/src/core/hle/service/hid/controllers/npad.cpp
@@ -318,7 +318,7 @@ void Controller_NPad::OnRelease() {
318} 318}
319 319
320void Controller_NPad::RequestPadStateUpdate(Core::HID::NpadIdType npad_id) { 320void Controller_NPad::RequestPadStateUpdate(Core::HID::NpadIdType npad_id) {
321 std::lock_guard lock{mutex}; 321 std::scoped_lock lock{mutex};
322 auto& controller = GetControllerFromNpadIdType(npad_id); 322 auto& controller = GetControllerFromNpadIdType(npad_id);
323 const auto controller_type = controller.device->GetNpadStyleIndex(); 323 const auto controller_type = controller.device->GetNpadStyleIndex();
324 if (!controller.device->IsConnected()) { 324 if (!controller.device->IsConnected()) {
diff --git a/src/core/hle/service/nvflinger/buffer_item_consumer.cpp b/src/core/hle/service/nvflinger/buffer_item_consumer.cpp
index 93fa1ec10..d7ee5362b 100644
--- a/src/core/hle/service/nvflinger/buffer_item_consumer.cpp
+++ b/src/core/hle/service/nvflinger/buffer_item_consumer.cpp
@@ -21,7 +21,7 @@ Status BufferItemConsumer::AcquireBuffer(BufferItem* item, std::chrono::nanoseco
21 return Status::BadValue; 21 return Status::BadValue;
22 } 22 }
23 23
24 std::scoped_lock lock(mutex); 24 std::scoped_lock lock{mutex};
25 25
26 if (const auto status = AcquireBufferLocked(item, present_when); status != Status::NoError) { 26 if (const auto status = AcquireBufferLocked(item, present_when); status != Status::NoError) {
27 if (status != Status::NoBufferAvailable) { 27 if (status != Status::NoBufferAvailable) {
@@ -40,7 +40,7 @@ Status BufferItemConsumer::AcquireBuffer(BufferItem* item, std::chrono::nanoseco
40} 40}
41 41
42Status BufferItemConsumer::ReleaseBuffer(const BufferItem& item, Fence& release_fence) { 42Status BufferItemConsumer::ReleaseBuffer(const BufferItem& item, Fence& release_fence) {
43 std::scoped_lock lock(mutex); 43 std::scoped_lock lock{mutex};
44 44
45 if (const auto status = AddReleaseFenceLocked(item.buf, item.graphic_buffer, release_fence); 45 if (const auto status = AddReleaseFenceLocked(item.buf, item.graphic_buffer, release_fence);
46 status != Status::NoError) { 46 status != Status::NoError) {
diff --git a/src/core/hle/service/nvflinger/buffer_queue_consumer.cpp b/src/core/hle/service/nvflinger/buffer_queue_consumer.cpp
index c527c577e..3ab9a8c05 100644
--- a/src/core/hle/service/nvflinger/buffer_queue_consumer.cpp
+++ b/src/core/hle/service/nvflinger/buffer_queue_consumer.cpp
@@ -19,7 +19,7 @@ BufferQueueConsumer::~BufferQueueConsumer() = default;
19 19
20Status BufferQueueConsumer::AcquireBuffer(BufferItem* out_buffer, 20Status BufferQueueConsumer::AcquireBuffer(BufferItem* out_buffer,
21 std::chrono::nanoseconds expected_present) { 21 std::chrono::nanoseconds expected_present) {
22 std::scoped_lock lock(core->mutex); 22 std::scoped_lock lock{core->mutex};
23 23
24 // Check that the consumer doesn't currently have the maximum number of buffers acquired. 24 // Check that the consumer doesn't currently have the maximum number of buffers acquired.
25 const s32 num_acquired_buffers{ 25 const s32 num_acquired_buffers{
@@ -120,7 +120,7 @@ Status BufferQueueConsumer::ReleaseBuffer(s32 slot, u64 frame_number, const Fenc
120 120
121 std::shared_ptr<IProducerListener> listener; 121 std::shared_ptr<IProducerListener> listener;
122 { 122 {
123 std::scoped_lock lock(core->mutex); 123 std::scoped_lock lock{core->mutex};
124 124
125 // If the frame number has changed because the buffer has been reallocated, we can ignore 125 // If the frame number has changed because the buffer has been reallocated, we can ignore
126 // this ReleaseBuffer for the old buffer. 126 // this ReleaseBuffer for the old buffer.
@@ -180,7 +180,7 @@ Status BufferQueueConsumer::Connect(std::shared_ptr<IConsumerListener> consumer_
180 180
181 LOG_DEBUG(Service_NVFlinger, "controlled_by_app={}", controlled_by_app); 181 LOG_DEBUG(Service_NVFlinger, "controlled_by_app={}", controlled_by_app);
182 182
183 std::scoped_lock lock(core->mutex); 183 std::scoped_lock lock{core->mutex};
184 184
185 if (core->is_abandoned) { 185 if (core->is_abandoned) {
186 LOG_ERROR(Service_NVFlinger, "BufferQueue has been abandoned"); 186 LOG_ERROR(Service_NVFlinger, "BufferQueue has been abandoned");
@@ -199,7 +199,7 @@ Status BufferQueueConsumer::GetReleasedBuffers(u64* out_slot_mask) {
199 return Status::BadValue; 199 return Status::BadValue;
200 } 200 }
201 201
202 std::scoped_lock lock(core->mutex); 202 std::scoped_lock lock{core->mutex};
203 203
204 if (core->is_abandoned) { 204 if (core->is_abandoned) {
205 LOG_ERROR(Service_NVFlinger, "BufferQueue has been abandoned"); 205 LOG_ERROR(Service_NVFlinger, "BufferQueue has been abandoned");
diff --git a/src/core/hle/service/nvflinger/buffer_queue_core.cpp b/src/core/hle/service/nvflinger/buffer_queue_core.cpp
index 3a0481786..ec5aabaeb 100644
--- a/src/core/hle/service/nvflinger/buffer_queue_core.cpp
+++ b/src/core/hle/service/nvflinger/buffer_queue_core.cpp
@@ -15,7 +15,7 @@ BufferQueueCore::BufferQueueCore() = default;
15BufferQueueCore::~BufferQueueCore() = default; 15BufferQueueCore::~BufferQueueCore() = default;
16 16
17void BufferQueueCore::NotifyShutdown() { 17void BufferQueueCore::NotifyShutdown() {
18 std::scoped_lock lock(mutex); 18 std::scoped_lock lock{mutex};
19 19
20 is_shutting_down = true; 20 is_shutting_down = true;
21 21
diff --git a/src/core/hle/service/nvflinger/buffer_queue_producer.cpp b/src/core/hle/service/nvflinger/buffer_queue_producer.cpp
index 3d6e990c3..6f604a88e 100644
--- a/src/core/hle/service/nvflinger/buffer_queue_producer.cpp
+++ b/src/core/hle/service/nvflinger/buffer_queue_producer.cpp
@@ -38,7 +38,7 @@ BufferQueueProducer::~BufferQueueProducer() {
38Status BufferQueueProducer::RequestBuffer(s32 slot, std::shared_ptr<GraphicBuffer>* buf) { 38Status BufferQueueProducer::RequestBuffer(s32 slot, std::shared_ptr<GraphicBuffer>* buf) {
39 LOG_DEBUG(Service_NVFlinger, "slot {}", slot); 39 LOG_DEBUG(Service_NVFlinger, "slot {}", slot);
40 40
41 std::scoped_lock lock(core->mutex); 41 std::scoped_lock lock{core->mutex};
42 42
43 if (core->is_abandoned) { 43 if (core->is_abandoned) {
44 LOG_ERROR(Service_NVFlinger, "BufferQueue has been abandoned"); 44 LOG_ERROR(Service_NVFlinger, "BufferQueue has been abandoned");
@@ -65,7 +65,7 @@ Status BufferQueueProducer::SetBufferCount(s32 buffer_count) {
65 65
66 std::shared_ptr<IConsumerListener> listener; 66 std::shared_ptr<IConsumerListener> listener;
67 { 67 {
68 std::scoped_lock lock(core->mutex); 68 std::scoped_lock lock{core->mutex};
69 core->WaitWhileAllocatingLocked(); 69 core->WaitWhileAllocatingLocked();
70 70
71 if (core->is_abandoned) { 71 if (core->is_abandoned) {
@@ -236,7 +236,7 @@ Status BufferQueueProducer::DequeueBuffer(s32* out_slot, Fence* out_fence, bool
236 Status return_flags = Status::NoError; 236 Status return_flags = Status::NoError;
237 bool attached_by_consumer = false; 237 bool attached_by_consumer = false;
238 { 238 {
239 std::scoped_lock lock(core->mutex); 239 std::scoped_lock lock{core->mutex};
240 core->WaitWhileAllocatingLocked(); 240 core->WaitWhileAllocatingLocked();
241 241
242 if (format == PixelFormat::NoFormat) { 242 if (format == PixelFormat::NoFormat) {
@@ -295,7 +295,7 @@ Status BufferQueueProducer::DequeueBuffer(s32* out_slot, Fence* out_fence, bool
295 } 295 }
296 296
297 { 297 {
298 std::scoped_lock lock(core->mutex); 298 std::scoped_lock lock{core->mutex};
299 299
300 if (core->is_abandoned) { 300 if (core->is_abandoned) {
301 LOG_ERROR(Service_NVFlinger, "BufferQueue has been abandoned"); 301 LOG_ERROR(Service_NVFlinger, "BufferQueue has been abandoned");
@@ -320,7 +320,7 @@ Status BufferQueueProducer::DequeueBuffer(s32* out_slot, Fence* out_fence, bool
320Status BufferQueueProducer::DetachBuffer(s32 slot) { 320Status BufferQueueProducer::DetachBuffer(s32 slot) {
321 LOG_DEBUG(Service_NVFlinger, "slot {}", slot); 321 LOG_DEBUG(Service_NVFlinger, "slot {}", slot);
322 322
323 std::scoped_lock lock(core->mutex); 323 std::scoped_lock lock{core->mutex};
324 324
325 if (core->is_abandoned) { 325 if (core->is_abandoned) {
326 LOG_ERROR(Service_NVFlinger, "BufferQueue has been abandoned"); 326 LOG_ERROR(Service_NVFlinger, "BufferQueue has been abandoned");
@@ -356,7 +356,7 @@ Status BufferQueueProducer::DetachNextBuffer(std::shared_ptr<GraphicBuffer>* out
356 return Status::BadValue; 356 return Status::BadValue;
357 } 357 }
358 358
359 std::scoped_lock lock(core->mutex); 359 std::scoped_lock lock{core->mutex};
360 core->WaitWhileAllocatingLocked(); 360 core->WaitWhileAllocatingLocked();
361 361
362 if (core->is_abandoned) { 362 if (core->is_abandoned) {
@@ -399,7 +399,7 @@ Status BufferQueueProducer::AttachBuffer(s32* out_slot,
399 return Status::BadValue; 399 return Status::BadValue;
400 } 400 }
401 401
402 std::scoped_lock lock(core->mutex); 402 std::scoped_lock lock{core->mutex};
403 core->WaitWhileAllocatingLocked(); 403 core->WaitWhileAllocatingLocked();
404 404
405 Status return_flags = Status::NoError; 405 Status return_flags = Status::NoError;
@@ -460,7 +460,7 @@ Status BufferQueueProducer::QueueBuffer(s32 slot, const QueueBufferInput& input,
460 BufferItem item; 460 BufferItem item;
461 461
462 { 462 {
463 std::scoped_lock lock(core->mutex); 463 std::scoped_lock lock{core->mutex};
464 464
465 if (core->is_abandoned) { 465 if (core->is_abandoned) {
466 LOG_ERROR(Service_NVFlinger, "BufferQueue has been abandoned"); 466 LOG_ERROR(Service_NVFlinger, "BufferQueue has been abandoned");
@@ -576,7 +576,7 @@ Status BufferQueueProducer::QueueBuffer(s32 slot, const QueueBufferInput& input,
576 // Call back without the main BufferQueue lock held, but with the callback lock held so we can 576 // Call back without the main BufferQueue lock held, but with the callback lock held so we can
577 // ensure that callbacks occur in order 577 // ensure that callbacks occur in order
578 { 578 {
579 std::scoped_lock lock(callback_mutex); 579 std::scoped_lock lock{callback_mutex};
580 while (callback_ticket != current_callback_ticket) { 580 while (callback_ticket != current_callback_ticket) {
581 callback_condition.wait(callback_mutex); 581 callback_condition.wait(callback_mutex);
582 } 582 }
@@ -597,7 +597,7 @@ Status BufferQueueProducer::QueueBuffer(s32 slot, const QueueBufferInput& input,
597void BufferQueueProducer::CancelBuffer(s32 slot, const Fence& fence) { 597void BufferQueueProducer::CancelBuffer(s32 slot, const Fence& fence) {
598 LOG_DEBUG(Service_NVFlinger, "slot {}", slot); 598 LOG_DEBUG(Service_NVFlinger, "slot {}", slot);
599 599
600 std::scoped_lock lock(core->mutex); 600 std::scoped_lock lock{core->mutex};
601 601
602 if (core->is_abandoned) { 602 if (core->is_abandoned) {
603 LOG_ERROR(Service_NVFlinger, "BufferQueue has been abandoned"); 603 LOG_ERROR(Service_NVFlinger, "BufferQueue has been abandoned");
@@ -623,7 +623,7 @@ void BufferQueueProducer::CancelBuffer(s32 slot, const Fence& fence) {
623} 623}
624 624
625Status BufferQueueProducer::Query(NativeWindow what, s32* out_value) { 625Status BufferQueueProducer::Query(NativeWindow what, s32* out_value) {
626 std::scoped_lock lock(core->mutex); 626 std::scoped_lock lock{core->mutex};
627 627
628 if (out_value == nullptr) { 628 if (out_value == nullptr) {
629 LOG_ERROR(Service_NVFlinger, "outValue was nullptr"); 629 LOG_ERROR(Service_NVFlinger, "outValue was nullptr");
@@ -673,7 +673,7 @@ Status BufferQueueProducer::Query(NativeWindow what, s32* out_value) {
673Status BufferQueueProducer::Connect(const std::shared_ptr<IProducerListener>& listener, 673Status BufferQueueProducer::Connect(const std::shared_ptr<IProducerListener>& listener,
674 NativeWindowApi api, bool producer_controlled_by_app, 674 NativeWindowApi api, bool producer_controlled_by_app,
675 QueueBufferOutput* output) { 675 QueueBufferOutput* output) {
676 std::scoped_lock lock(core->mutex); 676 std::scoped_lock lock{core->mutex};
677 677
678 LOG_DEBUG(Service_NVFlinger, "api = {} producer_controlled_by_app = {}", api, 678 LOG_DEBUG(Service_NVFlinger, "api = {} producer_controlled_by_app = {}", api,
679 producer_controlled_by_app); 679 producer_controlled_by_app);
@@ -730,7 +730,7 @@ Status BufferQueueProducer::Disconnect(NativeWindowApi api) {
730 std::shared_ptr<IConsumerListener> listener; 730 std::shared_ptr<IConsumerListener> listener;
731 731
732 { 732 {
733 std::scoped_lock lock(core->mutex); 733 std::scoped_lock lock{core->mutex};
734 734
735 core->WaitWhileAllocatingLocked(); 735 core->WaitWhileAllocatingLocked();
736 736
@@ -780,7 +780,7 @@ Status BufferQueueProducer::SetPreallocatedBuffer(s32 slot,
780 return Status::BadValue; 780 return Status::BadValue;
781 } 781 }
782 782
783 std::scoped_lock lock(core->mutex); 783 std::scoped_lock lock{core->mutex};
784 784
785 slots[slot] = {}; 785 slots[slot] = {};
786 slots[slot].graphic_buffer = buffer; 786 slots[slot].graphic_buffer = buffer;
diff --git a/src/core/hle/service/nvflinger/consumer_base.cpp b/src/core/hle/service/nvflinger/consumer_base.cpp
index c2c80832c..30fc21acc 100644
--- a/src/core/hle/service/nvflinger/consumer_base.cpp
+++ b/src/core/hle/service/nvflinger/consumer_base.cpp
@@ -18,7 +18,7 @@ ConsumerBase::ConsumerBase(std::unique_ptr<BufferQueueConsumer> consumer_)
18 : consumer{std::move(consumer_)} {} 18 : consumer{std::move(consumer_)} {}
19 19
20ConsumerBase::~ConsumerBase() { 20ConsumerBase::~ConsumerBase() {
21 std::scoped_lock lock(mutex); 21 std::scoped_lock lock{mutex};
22 22
23 ASSERT_MSG(is_abandoned, "consumer is not abandoned!"); 23 ASSERT_MSG(is_abandoned, "consumer is not abandoned!");
24} 24}
@@ -44,7 +44,7 @@ void ConsumerBase::OnFrameReplaced(const BufferItem& item) {
44} 44}
45 45
46void ConsumerBase::OnBuffersReleased() { 46void ConsumerBase::OnBuffersReleased() {
47 std::scoped_lock lock(mutex); 47 std::scoped_lock lock{mutex};
48 48
49 LOG_DEBUG(Service_NVFlinger, "called"); 49 LOG_DEBUG(Service_NVFlinger, "called");
50 50
diff --git a/src/core/hle/service/nvflinger/hos_binder_driver_server.cpp b/src/core/hle/service/nvflinger/hos_binder_driver_server.cpp
index 0c937d682..094ba2542 100644
--- a/src/core/hle/service/nvflinger/hos_binder_driver_server.cpp
+++ b/src/core/hle/service/nvflinger/hos_binder_driver_server.cpp
@@ -14,7 +14,7 @@ HosBinderDriverServer::HosBinderDriverServer(Core::System& system_)
14HosBinderDriverServer::~HosBinderDriverServer() {} 14HosBinderDriverServer::~HosBinderDriverServer() {}
15 15
16u64 HosBinderDriverServer::RegisterProducer(std::unique_ptr<android::IBinder>&& binder) { 16u64 HosBinderDriverServer::RegisterProducer(std::unique_ptr<android::IBinder>&& binder) {
17 std::lock_guard lk{lock}; 17 std::scoped_lock lk{lock};
18 18
19 last_id++; 19 last_id++;
20 20
@@ -24,7 +24,7 @@ u64 HosBinderDriverServer::RegisterProducer(std::unique_ptr<android::IBinder>&&
24} 24}
25 25
26android::IBinder* HosBinderDriverServer::TryGetProducer(u64 id) { 26android::IBinder* HosBinderDriverServer::TryGetProducer(u64 id) {
27 std::lock_guard lk{lock}; 27 std::scoped_lock lk{lock};
28 28
29 if (auto search = producers.find(id); search != producers.end()) { 29 if (auto search = producers.find(id); search != producers.end()) {
30 return search->second.get(); 30 return search->second.get();
diff --git a/src/core/perf_stats.cpp b/src/core/perf_stats.cpp
index 52c43c857..6ef459b7a 100644
--- a/src/core/perf_stats.cpp
+++ b/src/core/perf_stats.cpp
@@ -53,13 +53,13 @@ PerfStats::~PerfStats() {
53} 53}
54 54
55void PerfStats::BeginSystemFrame() { 55void PerfStats::BeginSystemFrame() {
56 std::lock_guard lock{object_mutex}; 56 std::scoped_lock lock{object_mutex};
57 57
58 frame_begin = Clock::now(); 58 frame_begin = Clock::now();
59} 59}
60 60
61void PerfStats::EndSystemFrame() { 61void PerfStats::EndSystemFrame() {
62 std::lock_guard lock{object_mutex}; 62 std::scoped_lock lock{object_mutex};
63 63
64 auto frame_end = Clock::now(); 64 auto frame_end = Clock::now();
65 const auto frame_time = frame_end - frame_begin; 65 const auto frame_time = frame_end - frame_begin;
@@ -79,7 +79,7 @@ void PerfStats::EndGameFrame() {
79} 79}
80 80
81double PerfStats::GetMeanFrametime() const { 81double PerfStats::GetMeanFrametime() const {
82 std::lock_guard lock{object_mutex}; 82 std::scoped_lock lock{object_mutex};
83 83
84 if (current_index <= IgnoreFrames) { 84 if (current_index <= IgnoreFrames) {
85 return 0; 85 return 0;
@@ -91,7 +91,7 @@ double PerfStats::GetMeanFrametime() const {
91} 91}
92 92
93PerfStatsResults PerfStats::GetAndResetStats(microseconds current_system_time_us) { 93PerfStatsResults PerfStats::GetAndResetStats(microseconds current_system_time_us) {
94 std::lock_guard lock{object_mutex}; 94 std::scoped_lock lock{object_mutex};
95 95
96 const auto now = Clock::now(); 96 const auto now = Clock::now();
97 // Walltime elapsed since stats were reset 97 // Walltime elapsed since stats were reset
@@ -120,7 +120,7 @@ PerfStatsResults PerfStats::GetAndResetStats(microseconds current_system_time_us
120} 120}
121 121
122double PerfStats::GetLastFrameTimeScale() const { 122double PerfStats::GetLastFrameTimeScale() const {
123 std::lock_guard lock{object_mutex}; 123 std::scoped_lock lock{object_mutex};
124 124
125 constexpr double FRAME_LENGTH = 1.0 / 60; 125 constexpr double FRAME_LENGTH = 1.0 / 60;
126 return duration_cast<DoubleSecs>(previous_frame_length).count() / FRAME_LENGTH; 126 return duration_cast<DoubleSecs>(previous_frame_length).count() / FRAME_LENGTH;
diff --git a/src/core/tools/freezer.cpp b/src/core/tools/freezer.cpp
index 032c71aff..c81dc0e52 100644
--- a/src/core/tools/freezer.cpp
+++ b/src/core/tools/freezer.cpp
@@ -80,7 +80,7 @@ bool Freezer::IsActive() const {
80} 80}
81 81
82void Freezer::Clear() { 82void Freezer::Clear() {
83 std::lock_guard lock{entries_mutex}; 83 std::scoped_lock lock{entries_mutex};
84 84
85 LOG_DEBUG(Common_Memory, "Clearing all frozen memory values."); 85 LOG_DEBUG(Common_Memory, "Clearing all frozen memory values.");
86 86
@@ -88,7 +88,7 @@ void Freezer::Clear() {
88} 88}
89 89
90u64 Freezer::Freeze(VAddr address, u32 width) { 90u64 Freezer::Freeze(VAddr address, u32 width) {
91 std::lock_guard lock{entries_mutex}; 91 std::scoped_lock lock{entries_mutex};
92 92
93 const auto current_value = MemoryReadWidth(memory, width, address); 93 const auto current_value = MemoryReadWidth(memory, width, address);
94 entries.push_back({address, width, current_value}); 94 entries.push_back({address, width, current_value});
@@ -101,7 +101,7 @@ u64 Freezer::Freeze(VAddr address, u32 width) {
101} 101}
102 102
103void Freezer::Unfreeze(VAddr address) { 103void Freezer::Unfreeze(VAddr address) {
104 std::lock_guard lock{entries_mutex}; 104 std::scoped_lock lock{entries_mutex};
105 105
106 LOG_DEBUG(Common_Memory, "Unfreezing memory for address={:016X}", address); 106 LOG_DEBUG(Common_Memory, "Unfreezing memory for address={:016X}", address);
107 107
@@ -109,13 +109,13 @@ void Freezer::Unfreeze(VAddr address) {
109} 109}
110 110
111bool Freezer::IsFrozen(VAddr address) const { 111bool Freezer::IsFrozen(VAddr address) const {
112 std::lock_guard lock{entries_mutex}; 112 std::scoped_lock lock{entries_mutex};
113 113
114 return FindEntry(address) != entries.cend(); 114 return FindEntry(address) != entries.cend();
115} 115}
116 116
117void Freezer::SetFrozenValue(VAddr address, u64 value) { 117void Freezer::SetFrozenValue(VAddr address, u64 value) {
118 std::lock_guard lock{entries_mutex}; 118 std::scoped_lock lock{entries_mutex};
119 119
120 const auto iter = FindEntry(address); 120 const auto iter = FindEntry(address);
121 121
@@ -132,7 +132,7 @@ void Freezer::SetFrozenValue(VAddr address, u64 value) {
132} 132}
133 133
134std::optional<Freezer::Entry> Freezer::GetEntry(VAddr address) const { 134std::optional<Freezer::Entry> Freezer::GetEntry(VAddr address) const {
135 std::lock_guard lock{entries_mutex}; 135 std::scoped_lock lock{entries_mutex};
136 136
137 const auto iter = FindEntry(address); 137 const auto iter = FindEntry(address);
138 138
@@ -144,7 +144,7 @@ std::optional<Freezer::Entry> Freezer::GetEntry(VAddr address) const {
144} 144}
145 145
146std::vector<Freezer::Entry> Freezer::GetEntries() const { 146std::vector<Freezer::Entry> Freezer::GetEntries() const {
147 std::lock_guard lock{entries_mutex}; 147 std::scoped_lock lock{entries_mutex};
148 148
149 return entries; 149 return entries;
150} 150}
@@ -165,7 +165,7 @@ void Freezer::FrameCallback(std::uintptr_t, std::chrono::nanoseconds ns_late) {
165 return; 165 return;
166 } 166 }
167 167
168 std::lock_guard lock{entries_mutex}; 168 std::scoped_lock lock{entries_mutex};
169 169
170 for (const auto& entry : entries) { 170 for (const auto& entry : entries) {
171 LOG_DEBUG(Common_Memory, 171 LOG_DEBUG(Common_Memory,
@@ -178,7 +178,7 @@ void Freezer::FrameCallback(std::uintptr_t, std::chrono::nanoseconds ns_late) {
178} 178}
179 179
180void Freezer::FillEntryReads() { 180void Freezer::FillEntryReads() {
181 std::lock_guard lock{entries_mutex}; 181 std::scoped_lock lock{entries_mutex};
182 182
183 LOG_DEBUG(Common_Memory, "Updating memory freeze entries to current values."); 183 LOG_DEBUG(Common_Memory, "Updating memory freeze entries to current values.");
184 184
diff --git a/src/input_common/drivers/sdl_driver.cpp b/src/input_common/drivers/sdl_driver.cpp
index c17ea305e..b3e4c3f64 100644
--- a/src/input_common/drivers/sdl_driver.cpp
+++ b/src/input_common/drivers/sdl_driver.cpp
@@ -62,7 +62,7 @@ public:
62 62
63 bool UpdateMotion(SDL_ControllerSensorEvent event) { 63 bool UpdateMotion(SDL_ControllerSensorEvent event) {
64 constexpr float gravity_constant = 9.80665f; 64 constexpr float gravity_constant = 9.80665f;
65 std::lock_guard lock{mutex}; 65 std::scoped_lock lock{mutex};
66 const u64 time_difference = event.timestamp - last_motion_update; 66 const u64 time_difference = event.timestamp - last_motion_update;
67 last_motion_update = event.timestamp; 67 last_motion_update = event.timestamp;
68 switch (event.sensor) { 68 switch (event.sensor) {
@@ -241,7 +241,7 @@ private:
241}; 241};
242 242
243std::shared_ptr<SDLJoystick> SDLDriver::GetSDLJoystickByGUID(const std::string& guid, int port) { 243std::shared_ptr<SDLJoystick> SDLDriver::GetSDLJoystickByGUID(const std::string& guid, int port) {
244 std::lock_guard lock{joystick_map_mutex}; 244 std::scoped_lock lock{joystick_map_mutex};
245 const auto it = joystick_map.find(guid); 245 const auto it = joystick_map.find(guid);
246 246
247 if (it != joystick_map.end()) { 247 if (it != joystick_map.end()) {
@@ -263,7 +263,7 @@ std::shared_ptr<SDLJoystick> SDLDriver::GetSDLJoystickBySDLID(SDL_JoystickID sdl
263 auto sdl_joystick = SDL_JoystickFromInstanceID(sdl_id); 263 auto sdl_joystick = SDL_JoystickFromInstanceID(sdl_id);
264 const std::string guid = GetGUID(sdl_joystick); 264 const std::string guid = GetGUID(sdl_joystick);
265 265
266 std::lock_guard lock{joystick_map_mutex}; 266 std::scoped_lock lock{joystick_map_mutex};
267 const auto map_it = joystick_map.find(guid); 267 const auto map_it = joystick_map.find(guid);
268 268
269 if (map_it == joystick_map.end()) { 269 if (map_it == joystick_map.end()) {
@@ -297,7 +297,7 @@ void SDLDriver::InitJoystick(int joystick_index) {
297 297
298 const std::string guid = GetGUID(sdl_joystick); 298 const std::string guid = GetGUID(sdl_joystick);
299 299
300 std::lock_guard lock{joystick_map_mutex}; 300 std::scoped_lock lock{joystick_map_mutex};
301 if (joystick_map.find(guid) == joystick_map.end()) { 301 if (joystick_map.find(guid) == joystick_map.end()) {
302 auto joystick = std::make_shared<SDLJoystick>(guid, 0, sdl_joystick, sdl_gamecontroller); 302 auto joystick = std::make_shared<SDLJoystick>(guid, 0, sdl_joystick, sdl_gamecontroller);
303 PreSetController(joystick->GetPadIdentifier()); 303 PreSetController(joystick->GetPadIdentifier());
@@ -326,7 +326,7 @@ void SDLDriver::InitJoystick(int joystick_index) {
326void SDLDriver::CloseJoystick(SDL_Joystick* sdl_joystick) { 326void SDLDriver::CloseJoystick(SDL_Joystick* sdl_joystick) {
327 const std::string guid = GetGUID(sdl_joystick); 327 const std::string guid = GetGUID(sdl_joystick);
328 328
329 std::lock_guard lock{joystick_map_mutex}; 329 std::scoped_lock lock{joystick_map_mutex};
330 // This call to guid is safe since the joystick is guaranteed to be in the map 330 // This call to guid is safe since the joystick is guaranteed to be in the map
331 const auto& joystick_guid_list = joystick_map[guid]; 331 const auto& joystick_guid_list = joystick_map[guid];
332 const auto joystick_it = std::find_if(joystick_guid_list.begin(), joystick_guid_list.end(), 332 const auto joystick_it = std::find_if(joystick_guid_list.begin(), joystick_guid_list.end(),
@@ -392,7 +392,7 @@ void SDLDriver::HandleGameControllerEvent(const SDL_Event& event) {
392} 392}
393 393
394void SDLDriver::CloseJoysticks() { 394void SDLDriver::CloseJoysticks() {
395 std::lock_guard lock{joystick_map_mutex}; 395 std::scoped_lock lock{joystick_map_mutex};
396 joystick_map.clear(); 396 joystick_map.clear();
397} 397}
398 398
diff --git a/src/input_common/input_engine.cpp b/src/input_common/input_engine.cpp
index 738022ece..a16cca33d 100644
--- a/src/input_common/input_engine.cpp
+++ b/src/input_common/input_engine.cpp
@@ -8,37 +8,37 @@
8namespace InputCommon { 8namespace InputCommon {
9 9
10void InputEngine::PreSetController(const PadIdentifier& identifier) { 10void InputEngine::PreSetController(const PadIdentifier& identifier) {
11 std::lock_guard lock{mutex}; 11 std::scoped_lock lock{mutex};
12 controller_list.try_emplace(identifier); 12 controller_list.try_emplace(identifier);
13} 13}
14 14
15void InputEngine::PreSetButton(const PadIdentifier& identifier, int button) { 15void InputEngine::PreSetButton(const PadIdentifier& identifier, int button) {
16 std::lock_guard lock{mutex}; 16 std::scoped_lock lock{mutex};
17 ControllerData& controller = controller_list.at(identifier); 17 ControllerData& controller = controller_list.at(identifier);
18 controller.buttons.try_emplace(button, false); 18 controller.buttons.try_emplace(button, false);
19} 19}
20 20
21void InputEngine::PreSetHatButton(const PadIdentifier& identifier, int button) { 21void InputEngine::PreSetHatButton(const PadIdentifier& identifier, int button) {
22 std::lock_guard lock{mutex}; 22 std::scoped_lock lock{mutex};
23 ControllerData& controller = controller_list.at(identifier); 23 ControllerData& controller = controller_list.at(identifier);
24 controller.hat_buttons.try_emplace(button, u8{0}); 24 controller.hat_buttons.try_emplace(button, u8{0});
25} 25}
26 26
27void InputEngine::PreSetAxis(const PadIdentifier& identifier, int axis) { 27void InputEngine::PreSetAxis(const PadIdentifier& identifier, int axis) {
28 std::lock_guard lock{mutex}; 28 std::scoped_lock lock{mutex};
29 ControllerData& controller = controller_list.at(identifier); 29 ControllerData& controller = controller_list.at(identifier);
30 controller.axes.try_emplace(axis, 0.0f); 30 controller.axes.try_emplace(axis, 0.0f);
31} 31}
32 32
33void InputEngine::PreSetMotion(const PadIdentifier& identifier, int motion) { 33void InputEngine::PreSetMotion(const PadIdentifier& identifier, int motion) {
34 std::lock_guard lock{mutex}; 34 std::scoped_lock lock{mutex};
35 ControllerData& controller = controller_list.at(identifier); 35 ControllerData& controller = controller_list.at(identifier);
36 controller.motions.try_emplace(motion); 36 controller.motions.try_emplace(motion);
37} 37}
38 38
39void InputEngine::SetButton(const PadIdentifier& identifier, int button, bool value) { 39void InputEngine::SetButton(const PadIdentifier& identifier, int button, bool value) {
40 { 40 {
41 std::lock_guard lock{mutex}; 41 std::scoped_lock lock{mutex};
42 ControllerData& controller = controller_list.at(identifier); 42 ControllerData& controller = controller_list.at(identifier);
43 if (!configuring) { 43 if (!configuring) {
44 controller.buttons.insert_or_assign(button, value); 44 controller.buttons.insert_or_assign(button, value);
@@ -49,7 +49,7 @@ void InputEngine::SetButton(const PadIdentifier& identifier, int button, bool va
49 49
50void InputEngine::SetHatButton(const PadIdentifier& identifier, int button, u8 value) { 50void InputEngine::SetHatButton(const PadIdentifier& identifier, int button, u8 value) {
51 { 51 {
52 std::lock_guard lock{mutex}; 52 std::scoped_lock lock{mutex};
53 ControllerData& controller = controller_list.at(identifier); 53 ControllerData& controller = controller_list.at(identifier);
54 if (!configuring) { 54 if (!configuring) {
55 controller.hat_buttons.insert_or_assign(button, value); 55 controller.hat_buttons.insert_or_assign(button, value);
@@ -60,7 +60,7 @@ void InputEngine::SetHatButton(const PadIdentifier& identifier, int button, u8 v
60 60
61void InputEngine::SetAxis(const PadIdentifier& identifier, int axis, f32 value) { 61void InputEngine::SetAxis(const PadIdentifier& identifier, int axis, f32 value) {
62 { 62 {
63 std::lock_guard lock{mutex}; 63 std::scoped_lock lock{mutex};
64 ControllerData& controller = controller_list.at(identifier); 64 ControllerData& controller = controller_list.at(identifier);
65 if (!configuring) { 65 if (!configuring) {
66 controller.axes.insert_or_assign(axis, value); 66 controller.axes.insert_or_assign(axis, value);
@@ -71,7 +71,7 @@ void InputEngine::SetAxis(const PadIdentifier& identifier, int axis, f32 value)
71 71
72void InputEngine::SetBattery(const PadIdentifier& identifier, Common::Input::BatteryLevel value) { 72void InputEngine::SetBattery(const PadIdentifier& identifier, Common::Input::BatteryLevel value) {
73 { 73 {
74 std::lock_guard lock{mutex}; 74 std::scoped_lock lock{mutex};
75 ControllerData& controller = controller_list.at(identifier); 75 ControllerData& controller = controller_list.at(identifier);
76 if (!configuring) { 76 if (!configuring) {
77 controller.battery = value; 77 controller.battery = value;
@@ -82,7 +82,7 @@ void InputEngine::SetBattery(const PadIdentifier& identifier, Common::Input::Bat
82 82
83void InputEngine::SetMotion(const PadIdentifier& identifier, int motion, const BasicMotion& value) { 83void InputEngine::SetMotion(const PadIdentifier& identifier, int motion, const BasicMotion& value) {
84 { 84 {
85 std::lock_guard lock{mutex}; 85 std::scoped_lock lock{mutex};
86 ControllerData& controller = controller_list.at(identifier); 86 ControllerData& controller = controller_list.at(identifier);
87 if (!configuring) { 87 if (!configuring) {
88 controller.motions.insert_or_assign(motion, value); 88 controller.motions.insert_or_assign(motion, value);
@@ -92,7 +92,7 @@ void InputEngine::SetMotion(const PadIdentifier& identifier, int motion, const B
92} 92}
93 93
94bool InputEngine::GetButton(const PadIdentifier& identifier, int button) const { 94bool InputEngine::GetButton(const PadIdentifier& identifier, int button) const {
95 std::lock_guard lock{mutex}; 95 std::scoped_lock lock{mutex};
96 const auto controller_iter = controller_list.find(identifier); 96 const auto controller_iter = controller_list.find(identifier);
97 if (controller_iter == controller_list.cend()) { 97 if (controller_iter == controller_list.cend()) {
98 LOG_ERROR(Input, "Invalid identifier guid={}, pad={}, port={}", identifier.guid.RawString(), 98 LOG_ERROR(Input, "Invalid identifier guid={}, pad={}, port={}", identifier.guid.RawString(),
@@ -109,7 +109,7 @@ bool InputEngine::GetButton(const PadIdentifier& identifier, int button) const {
109} 109}
110 110
111bool InputEngine::GetHatButton(const PadIdentifier& identifier, int button, u8 direction) const { 111bool InputEngine::GetHatButton(const PadIdentifier& identifier, int button, u8 direction) const {
112 std::lock_guard lock{mutex}; 112 std::scoped_lock lock{mutex};
113 const auto controller_iter = controller_list.find(identifier); 113 const auto controller_iter = controller_list.find(identifier);
114 if (controller_iter == controller_list.cend()) { 114 if (controller_iter == controller_list.cend()) {
115 LOG_ERROR(Input, "Invalid identifier guid={}, pad={}, port={}", identifier.guid.RawString(), 115 LOG_ERROR(Input, "Invalid identifier guid={}, pad={}, port={}", identifier.guid.RawString(),
@@ -126,7 +126,7 @@ bool InputEngine::GetHatButton(const PadIdentifier& identifier, int button, u8 d
126} 126}
127 127
128f32 InputEngine::GetAxis(const PadIdentifier& identifier, int axis) const { 128f32 InputEngine::GetAxis(const PadIdentifier& identifier, int axis) const {
129 std::lock_guard lock{mutex}; 129 std::scoped_lock lock{mutex};
130 const auto controller_iter = controller_list.find(identifier); 130 const auto controller_iter = controller_list.find(identifier);
131 if (controller_iter == controller_list.cend()) { 131 if (controller_iter == controller_list.cend()) {
132 LOG_ERROR(Input, "Invalid identifier guid={}, pad={}, port={}", identifier.guid.RawString(), 132 LOG_ERROR(Input, "Invalid identifier guid={}, pad={}, port={}", identifier.guid.RawString(),
@@ -143,7 +143,7 @@ f32 InputEngine::GetAxis(const PadIdentifier& identifier, int axis) const {
143} 143}
144 144
145Common::Input::BatteryLevel InputEngine::GetBattery(const PadIdentifier& identifier) const { 145Common::Input::BatteryLevel InputEngine::GetBattery(const PadIdentifier& identifier) const {
146 std::lock_guard lock{mutex}; 146 std::scoped_lock lock{mutex};
147 const auto controller_iter = controller_list.find(identifier); 147 const auto controller_iter = controller_list.find(identifier);
148 if (controller_iter == controller_list.cend()) { 148 if (controller_iter == controller_list.cend()) {
149 LOG_ERROR(Input, "Invalid identifier guid={}, pad={}, port={}", identifier.guid.RawString(), 149 LOG_ERROR(Input, "Invalid identifier guid={}, pad={}, port={}", identifier.guid.RawString(),
@@ -155,7 +155,7 @@ Common::Input::BatteryLevel InputEngine::GetBattery(const PadIdentifier& identif
155} 155}
156 156
157BasicMotion InputEngine::GetMotion(const PadIdentifier& identifier, int motion) const { 157BasicMotion InputEngine::GetMotion(const PadIdentifier& identifier, int motion) const {
158 std::lock_guard lock{mutex}; 158 std::scoped_lock lock{mutex};
159 const auto controller_iter = controller_list.find(identifier); 159 const auto controller_iter = controller_list.find(identifier);
160 if (controller_iter == controller_list.cend()) { 160 if (controller_iter == controller_list.cend()) {
161 LOG_ERROR(Input, "Invalid identifier guid={}, pad={}, port={}", identifier.guid.RawString(), 161 LOG_ERROR(Input, "Invalid identifier guid={}, pad={}, port={}", identifier.guid.RawString(),
@@ -186,7 +186,7 @@ void InputEngine::ResetAnalogState() {
186} 186}
187 187
188void InputEngine::TriggerOnButtonChange(const PadIdentifier& identifier, int button, bool value) { 188void InputEngine::TriggerOnButtonChange(const PadIdentifier& identifier, int button, bool value) {
189 std::lock_guard lock{mutex_callback}; 189 std::scoped_lock lock{mutex_callback};
190 for (const auto& poller_pair : callback_list) { 190 for (const auto& poller_pair : callback_list) {
191 const InputIdentifier& poller = poller_pair.second; 191 const InputIdentifier& poller = poller_pair.second;
192 if (!IsInputIdentifierEqual(poller, identifier, EngineInputType::Button, button)) { 192 if (!IsInputIdentifierEqual(poller, identifier, EngineInputType::Button, button)) {
@@ -214,7 +214,7 @@ void InputEngine::TriggerOnButtonChange(const PadIdentifier& identifier, int but
214} 214}
215 215
216void InputEngine::TriggerOnHatButtonChange(const PadIdentifier& identifier, int button, u8 value) { 216void InputEngine::TriggerOnHatButtonChange(const PadIdentifier& identifier, int button, u8 value) {
217 std::lock_guard lock{mutex_callback}; 217 std::scoped_lock lock{mutex_callback};
218 for (const auto& poller_pair : callback_list) { 218 for (const auto& poller_pair : callback_list) {
219 const InputIdentifier& poller = poller_pair.second; 219 const InputIdentifier& poller = poller_pair.second;
220 if (!IsInputIdentifierEqual(poller, identifier, EngineInputType::HatButton, button)) { 220 if (!IsInputIdentifierEqual(poller, identifier, EngineInputType::HatButton, button)) {
@@ -243,7 +243,7 @@ void InputEngine::TriggerOnHatButtonChange(const PadIdentifier& identifier, int
243} 243}
244 244
245void InputEngine::TriggerOnAxisChange(const PadIdentifier& identifier, int axis, f32 value) { 245void InputEngine::TriggerOnAxisChange(const PadIdentifier& identifier, int axis, f32 value) {
246 std::lock_guard lock{mutex_callback}; 246 std::scoped_lock lock{mutex_callback};
247 for (const auto& poller_pair : callback_list) { 247 for (const auto& poller_pair : callback_list) {
248 const InputIdentifier& poller = poller_pair.second; 248 const InputIdentifier& poller = poller_pair.second;
249 if (!IsInputIdentifierEqual(poller, identifier, EngineInputType::Analog, axis)) { 249 if (!IsInputIdentifierEqual(poller, identifier, EngineInputType::Analog, axis)) {
@@ -270,7 +270,7 @@ void InputEngine::TriggerOnAxisChange(const PadIdentifier& identifier, int axis,
270 270
271void InputEngine::TriggerOnBatteryChange(const PadIdentifier& identifier, 271void InputEngine::TriggerOnBatteryChange(const PadIdentifier& identifier,
272 [[maybe_unused]] Common::Input::BatteryLevel value) { 272 [[maybe_unused]] Common::Input::BatteryLevel value) {
273 std::lock_guard lock{mutex_callback}; 273 std::scoped_lock lock{mutex_callback};
274 for (const auto& poller_pair : callback_list) { 274 for (const auto& poller_pair : callback_list) {
275 const InputIdentifier& poller = poller_pair.second; 275 const InputIdentifier& poller = poller_pair.second;
276 if (!IsInputIdentifierEqual(poller, identifier, EngineInputType::Battery, 0)) { 276 if (!IsInputIdentifierEqual(poller, identifier, EngineInputType::Battery, 0)) {
@@ -284,7 +284,7 @@ void InputEngine::TriggerOnBatteryChange(const PadIdentifier& identifier,
284 284
285void InputEngine::TriggerOnMotionChange(const PadIdentifier& identifier, int motion, 285void InputEngine::TriggerOnMotionChange(const PadIdentifier& identifier, int motion,
286 const BasicMotion& value) { 286 const BasicMotion& value) {
287 std::lock_guard lock{mutex_callback}; 287 std::scoped_lock lock{mutex_callback};
288 for (const auto& poller_pair : callback_list) { 288 for (const auto& poller_pair : callback_list) {
289 const InputIdentifier& poller = poller_pair.second; 289 const InputIdentifier& poller = poller_pair.second;
290 if (!IsInputIdentifierEqual(poller, identifier, EngineInputType::Motion, motion)) { 290 if (!IsInputIdentifierEqual(poller, identifier, EngineInputType::Motion, motion)) {
@@ -346,18 +346,18 @@ const std::string& InputEngine::GetEngineName() const {
346} 346}
347 347
348int InputEngine::SetCallback(InputIdentifier input_identifier) { 348int InputEngine::SetCallback(InputIdentifier input_identifier) {
349 std::lock_guard lock{mutex_callback}; 349 std::scoped_lock lock{mutex_callback};
350 callback_list.insert_or_assign(last_callback_key, std::move(input_identifier)); 350 callback_list.insert_or_assign(last_callback_key, std::move(input_identifier));
351 return last_callback_key++; 351 return last_callback_key++;
352} 352}
353 353
354void InputEngine::SetMappingCallback(MappingCallback callback) { 354void InputEngine::SetMappingCallback(MappingCallback callback) {
355 std::lock_guard lock{mutex_callback}; 355 std::scoped_lock lock{mutex_callback};
356 mapping_callback = std::move(callback); 356 mapping_callback = std::move(callback);
357} 357}
358 358
359void InputEngine::DeleteCallback(int key) { 359void InputEngine::DeleteCallback(int key) {
360 std::lock_guard lock{mutex_callback}; 360 std::scoped_lock lock{mutex_callback};
361 const auto& iterator = callback_list.find(key); 361 const auto& iterator = callback_list.find(key);
362 if (iterator == callback_list.end()) { 362 if (iterator == callback_list.end()) {
363 LOG_ERROR(Input, "Tried to delete non-existent callback {}", key); 363 LOG_ERROR(Input, "Tried to delete non-existent callback {}", key);
diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp
index ba9ba082f..789af452d 100644
--- a/src/video_core/gpu.cpp
+++ b/src/video_core/gpu.cpp
@@ -230,7 +230,7 @@ struct GPU::Impl {
230 void IncrementSyncPoint(u32 syncpoint_id) { 230 void IncrementSyncPoint(u32 syncpoint_id) {
231 auto& syncpoint = syncpoints.at(syncpoint_id); 231 auto& syncpoint = syncpoints.at(syncpoint_id);
232 syncpoint++; 232 syncpoint++;
233 std::lock_guard lock{sync_mutex}; 233 std::scoped_lock lock{sync_mutex};
234 sync_cv.notify_all(); 234 sync_cv.notify_all();
235 auto& interrupt = syncpt_interrupts.at(syncpoint_id); 235 auto& interrupt = syncpt_interrupts.at(syncpoint_id);
236 if (!interrupt.empty()) { 236 if (!interrupt.empty()) {
@@ -252,7 +252,7 @@ struct GPU::Impl {
252 } 252 }
253 253
254 void RegisterSyncptInterrupt(u32 syncpoint_id, u32 value) { 254 void RegisterSyncptInterrupt(u32 syncpoint_id, u32 value) {
255 std::lock_guard lock{sync_mutex}; 255 std::scoped_lock lock{sync_mutex};
256 auto& interrupt = syncpt_interrupts.at(syncpoint_id); 256 auto& interrupt = syncpt_interrupts.at(syncpoint_id);
257 bool contains = std::any_of(interrupt.begin(), interrupt.end(), 257 bool contains = std::any_of(interrupt.begin(), interrupt.end(),
258 [value](u32 in_value) { return in_value == value; }); 258 [value](u32 in_value) { return in_value == value; });
@@ -263,7 +263,7 @@ struct GPU::Impl {
263 } 263 }
264 264
265 [[nodiscard]] bool CancelSyncptInterrupt(u32 syncpoint_id, u32 value) { 265 [[nodiscard]] bool CancelSyncptInterrupt(u32 syncpoint_id, u32 value) {
266 std::lock_guard lock{sync_mutex}; 266 std::scoped_lock lock{sync_mutex};
267 auto& interrupt = syncpt_interrupts.at(syncpoint_id); 267 auto& interrupt = syncpt_interrupts.at(syncpoint_id);
268 const auto iter = 268 const auto iter =
269 std::find_if(interrupt.begin(), interrupt.end(), 269 std::find_if(interrupt.begin(), interrupt.end(),
diff --git a/src/video_core/gpu_thread.cpp b/src/video_core/gpu_thread.cpp
index 9547f277a..4e8999915 100644
--- a/src/video_core/gpu_thread.cpp
+++ b/src/video_core/gpu_thread.cpp
@@ -56,7 +56,7 @@ static void RunThread(std::stop_token stop_token, Core::System& system,
56 if (next.block) { 56 if (next.block) {
57 // We have to lock the write_lock to ensure that the condition_variable wait not get a 57 // We have to lock the write_lock to ensure that the condition_variable wait not get a
58 // race between the check and the lock itself. 58 // race between the check and the lock itself.
59 std::lock_guard lk(state.write_lock); 59 std::scoped_lock lk{state.write_lock};
60 state.cv.notify_all(); 60 state.cv.notify_all();
61 } 61 }
62 } 62 }
diff --git a/src/video_core/renderer_opengl/gl_graphics_pipeline.cpp b/src/video_core/renderer_opengl/gl_graphics_pipeline.cpp
index 9e6732abd..fd40966d5 100644
--- a/src/video_core/renderer_opengl/gl_graphics_pipeline.cpp
+++ b/src/video_core/renderer_opengl/gl_graphics_pipeline.cpp
@@ -253,7 +253,7 @@ GraphicsPipeline::GraphicsPipeline(
253 } 253 }
254 } 254 }
255 if (in_parallel) { 255 if (in_parallel) {
256 std::lock_guard lock{built_mutex}; 256 std::scoped_lock lock{built_mutex};
257 built_fence.Create(); 257 built_fence.Create();
258 // Flush this context to ensure compilation commands and fence are in the GPU pipe. 258 // Flush this context to ensure compilation commands and fence are in the GPU pipe.
259 glFlush(); 259 glFlush();
diff --git a/src/video_core/renderer_opengl/gl_shader_cache.cpp b/src/video_core/renderer_opengl/gl_shader_cache.cpp
index 6423992c3..05c5e702c 100644
--- a/src/video_core/renderer_opengl/gl_shader_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_cache.cpp
@@ -258,7 +258,7 @@ void ShaderCache::LoadDiskResources(u64 title_id, std::stop_token stop_loading,
258 [this, key, env = std::move(env), &state, &callback](Context* ctx) mutable { 258 [this, key, env = std::move(env), &state, &callback](Context* ctx) mutable {
259 ctx->pools.ReleaseContents(); 259 ctx->pools.ReleaseContents();
260 auto pipeline{CreateComputePipeline(ctx->pools, key, env)}; 260 auto pipeline{CreateComputePipeline(ctx->pools, key, env)};
261 std::lock_guard lock{state.mutex}; 261 std::scoped_lock lock{state.mutex};
262 if (pipeline) { 262 if (pipeline) {
263 compute_cache.emplace(key, std::move(pipeline)); 263 compute_cache.emplace(key, std::move(pipeline));
264 } 264 }
@@ -280,7 +280,7 @@ void ShaderCache::LoadDiskResources(u64 title_id, std::stop_token stop_loading,
280 } 280 }
281 ctx->pools.ReleaseContents(); 281 ctx->pools.ReleaseContents();
282 auto pipeline{CreateGraphicsPipeline(ctx->pools, key, MakeSpan(env_ptrs), false)}; 282 auto pipeline{CreateGraphicsPipeline(ctx->pools, key, MakeSpan(env_ptrs), false)};
283 std::lock_guard lock{state.mutex}; 283 std::scoped_lock lock{state.mutex};
284 if (pipeline) { 284 if (pipeline) {
285 graphics_cache.emplace(key, std::move(pipeline)); 285 graphics_cache.emplace(key, std::move(pipeline));
286 } 286 }
diff --git a/src/video_core/renderer_vulkan/pipeline_statistics.cpp b/src/video_core/renderer_vulkan/pipeline_statistics.cpp
index bfec931a6..7ccadf084 100644
--- a/src/video_core/renderer_vulkan/pipeline_statistics.cpp
+++ b/src/video_core/renderer_vulkan/pipeline_statistics.cpp
@@ -57,7 +57,7 @@ void PipelineStatistics::Collect(VkPipeline pipeline) {
57 stage_stats.basic_block_count = GetUint64(statistic); 57 stage_stats.basic_block_count = GetUint64(statistic);
58 } 58 }
59 } 59 }
60 std::lock_guard lock{mutex}; 60 std::scoped_lock lock{mutex};
61 collected_stats.push_back(stage_stats); 61 collected_stats.push_back(stage_stats);
62 } 62 }
63} 63}
@@ -66,7 +66,7 @@ void PipelineStatistics::Report() const {
66 double num{}; 66 double num{};
67 Stats total; 67 Stats total;
68 { 68 {
69 std::lock_guard lock{mutex}; 69 std::scoped_lock lock{mutex};
70 for (const Stats& stats : collected_stats) { 70 for (const Stats& stats : collected_stats) {
71 total.code_size += stats.code_size; 71 total.code_size += stats.code_size;
72 total.register_count += stats.register_count; 72 total.register_count += stats.register_count;
diff --git a/src/video_core/renderer_vulkan/vk_compute_pipeline.cpp b/src/video_core/renderer_vulkan/vk_compute_pipeline.cpp
index de36bcdb7..97b3594c2 100644
--- a/src/video_core/renderer_vulkan/vk_compute_pipeline.cpp
+++ b/src/video_core/renderer_vulkan/vk_compute_pipeline.cpp
@@ -77,7 +77,7 @@ ComputePipeline::ComputePipeline(const Device& device_, DescriptorPool& descript
77 if (pipeline_statistics) { 77 if (pipeline_statistics) {
78 pipeline_statistics->Collect(*pipeline); 78 pipeline_statistics->Collect(*pipeline);
79 } 79 }
80 std::lock_guard lock{build_mutex}; 80 std::scoped_lock lock{build_mutex};
81 is_built = true; 81 is_built = true;
82 build_condvar.notify_one(); 82 build_condvar.notify_one();
83 if (shader_notify) { 83 if (shader_notify) {
diff --git a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp
index d514b71d0..8959d6059 100644
--- a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp
+++ b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp
@@ -258,7 +258,7 @@ GraphicsPipeline::GraphicsPipeline(
258 pipeline_statistics->Collect(*pipeline); 258 pipeline_statistics->Collect(*pipeline);
259 } 259 }
260 260
261 std::lock_guard lock{build_mutex}; 261 std::scoped_lock lock{build_mutex};
262 is_built = true; 262 is_built = true;
263 build_condvar.notify_one(); 263 build_condvar.notify_one();
264 if (shader_notify) { 264 if (shader_notify) {
diff --git a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp
index 27e59df73..336d1e9dc 100644
--- a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp
+++ b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp
@@ -404,7 +404,7 @@ void PipelineCache::LoadDiskResources(u64 title_id, std::stop_token stop_loading
404 workers.QueueWork([this, key, env = std::move(env), &state, &callback]() mutable { 404 workers.QueueWork([this, key, env = std::move(env), &state, &callback]() mutable {
405 ShaderPools pools; 405 ShaderPools pools;
406 auto pipeline{CreateComputePipeline(pools, key, env, state.statistics.get(), false)}; 406 auto pipeline{CreateComputePipeline(pools, key, env, state.statistics.get(), false)};
407 std::lock_guard lock{state.mutex}; 407 std::scoped_lock lock{state.mutex};
408 if (pipeline) { 408 if (pipeline) {
409 compute_cache.emplace(key, std::move(pipeline)); 409 compute_cache.emplace(key, std::move(pipeline));
410 } 410 }
@@ -434,7 +434,7 @@ void PipelineCache::LoadDiskResources(u64 title_id, std::stop_token stop_loading
434 auto pipeline{CreateGraphicsPipeline(pools, key, MakeSpan(env_ptrs), 434 auto pipeline{CreateGraphicsPipeline(pools, key, MakeSpan(env_ptrs),
435 state.statistics.get(), false)}; 435 state.statistics.get(), false)};
436 436
437 std::lock_guard lock{state.mutex}; 437 std::scoped_lock lock{state.mutex};
438 graphics_cache.emplace(key, std::move(pipeline)); 438 graphics_cache.emplace(key, std::move(pipeline));
439 ++state.built; 439 ++state.built;
440 if (state.has_loaded) { 440 if (state.has_loaded) {
diff --git a/src/video_core/renderer_vulkan/vk_render_pass_cache.cpp b/src/video_core/renderer_vulkan/vk_render_pass_cache.cpp
index 451ffe019..d22bb6694 100644
--- a/src/video_core/renderer_vulkan/vk_render_pass_cache.cpp
+++ b/src/video_core/renderer_vulkan/vk_render_pass_cache.cpp
@@ -36,7 +36,7 @@ VkAttachmentDescription AttachmentDescription(const Device& device, PixelFormat
36RenderPassCache::RenderPassCache(const Device& device_) : device{&device_} {} 36RenderPassCache::RenderPassCache(const Device& device_) : device{&device_} {}
37 37
38VkRenderPass RenderPassCache::Get(const RenderPassKey& key) { 38VkRenderPass RenderPassCache::Get(const RenderPassKey& key) {
39 std::lock_guard lock{mutex}; 39 std::scoped_lock lock{mutex};
40 const auto [pair, is_new] = cache.try_emplace(key); 40 const auto [pair, is_new] = cache.try_emplace(key);
41 if (!is_new) { 41 if (!is_new) {
42 return *pair->second; 42 return *pair->second;
diff --git a/src/video_core/renderer_vulkan/vk_scheduler.cpp b/src/video_core/renderer_vulkan/vk_scheduler.cpp
index ad320991b..6a9416457 100644
--- a/src/video_core/renderer_vulkan/vk_scheduler.cpp
+++ b/src/video_core/renderer_vulkan/vk_scheduler.cpp
@@ -73,7 +73,7 @@ void VKScheduler::DispatchWork() {
73 return; 73 return;
74 } 74 }
75 { 75 {
76 std::lock_guard lock{work_mutex}; 76 std::scoped_lock lock{work_mutex};
77 work_queue.push(std::move(chunk)); 77 work_queue.push(std::move(chunk));
78 } 78 }
79 work_cv.notify_one(); 79 work_cv.notify_one();
@@ -157,7 +157,7 @@ void VKScheduler::WorkerThread(std::stop_token stop_token) {
157 if (has_submit) { 157 if (has_submit) {
158 AllocateWorkerCommandBuffer(); 158 AllocateWorkerCommandBuffer();
159 } 159 }
160 std::lock_guard reserve_lock{reserve_mutex}; 160 std::scoped_lock reserve_lock{reserve_mutex};
161 chunk_reserve.push_back(std::move(work)); 161 chunk_reserve.push_back(std::move(work));
162 } while (!stop_token.stop_requested()); 162 } while (!stop_token.stop_requested());
163} 163}
@@ -282,7 +282,7 @@ void VKScheduler::EndRenderPass() {
282} 282}
283 283
284void VKScheduler::AcquireNewChunk() { 284void VKScheduler::AcquireNewChunk() {
285 std::lock_guard lock{reserve_mutex}; 285 std::scoped_lock lock{reserve_mutex};
286 if (chunk_reserve.empty()) { 286 if (chunk_reserve.empty()) {
287 chunk = std::make_unique<CommandChunk>(); 287 chunk = std::make_unique<CommandChunk>();
288 return; 288 return;
diff --git a/src/video_core/shader_cache.cpp b/src/video_core/shader_cache.cpp
index 87636857d..75031767a 100644
--- a/src/video_core/shader_cache.cpp
+++ b/src/video_core/shader_cache.cpp
@@ -25,7 +25,7 @@ void ShaderCache::InvalidateRegion(VAddr addr, size_t size) {
25} 25}
26 26
27void ShaderCache::OnCPUWrite(VAddr addr, size_t size) { 27void ShaderCache::OnCPUWrite(VAddr addr, size_t size) {
28 std::lock_guard lock{invalidation_mutex}; 28 std::scoped_lock lock{invalidation_mutex};
29 InvalidatePagesInRegion(addr, size); 29 InvalidatePagesInRegion(addr, size);
30} 30}
31 31
diff --git a/src/web_service/web_backend.cpp b/src/web_service/web_backend.cpp
index 4208bd044..58b0c2f10 100644
--- a/src/web_service/web_backend.cpp
+++ b/src/web_service/web_backend.cpp
@@ -32,7 +32,7 @@ constexpr std::size_t TIMEOUT_SECONDS = 30;
32struct Client::Impl { 32struct Client::Impl {
33 Impl(std::string host, std::string username, std::string token) 33 Impl(std::string host, std::string username, std::string token)
34 : host{std::move(host)}, username{std::move(username)}, token{std::move(token)} { 34 : host{std::move(host)}, username{std::move(username)}, token{std::move(token)} {
35 std::lock_guard lock{jwt_cache.mutex}; 35 std::scoped_lock lock{jwt_cache.mutex};
36 if (this->username == jwt_cache.username && this->token == jwt_cache.token) { 36 if (this->username == jwt_cache.username && this->token == jwt_cache.token) {
37 jwt = jwt_cache.jwt; 37 jwt = jwt_cache.jwt;
38 } 38 }
@@ -147,7 +147,7 @@ struct Client::Impl {
147 if (result.result_code != WebResult::Code::Success) { 147 if (result.result_code != WebResult::Code::Success) {
148 LOG_ERROR(WebService, "UpdateJWT failed"); 148 LOG_ERROR(WebService, "UpdateJWT failed");
149 } else { 149 } else {
150 std::lock_guard lock{jwt_cache.mutex}; 150 std::scoped_lock lock{jwt_cache.mutex};
151 jwt_cache.username = username; 151 jwt_cache.username = username;
152 jwt_cache.token = token; 152 jwt_cache.token = token;
153 jwt_cache.jwt = jwt = result.returned_data; 153 jwt_cache.jwt = jwt = result.returned_data;
diff --git a/src/yuzu/util/controller_navigation.cpp b/src/yuzu/util/controller_navigation.cpp
index c2b13123d..9a1868cae 100644
--- a/src/yuzu/util/controller_navigation.cpp
+++ b/src/yuzu/util/controller_navigation.cpp
@@ -39,7 +39,7 @@ void ControllerNavigation::TriggerButton(Settings::NativeButton::Values native_b
39} 39}
40 40
41void ControllerNavigation::ControllerUpdateEvent(Core::HID::ControllerTriggerType type) { 41void ControllerNavigation::ControllerUpdateEvent(Core::HID::ControllerTriggerType type) {
42 std::lock_guard lock{mutex}; 42 std::scoped_lock lock{mutex};
43 if (!Settings::values.controller_navigation) { 43 if (!Settings::values.controller_navigation) {
44 return; 44 return;
45 } 45 }