summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/service/nfc/nfc_device.cpp16
-rw-r--r--src/core/hle/service/nfc/nfc_device.h1
-rw-r--r--src/core/hle/service/nfp/nfp_device.cpp16
-rw-r--r--src/core/hle/service/nfp/nfp_device.h1
-rw-r--r--src/video_core/renderer_vulkan/vk_scheduler.cpp9
5 files changed, 35 insertions, 8 deletions
diff --git a/src/core/hle/service/nfc/nfc_device.cpp b/src/core/hle/service/nfc/nfc_device.cpp
index 3f17d0c7a..c7db74d14 100644
--- a/src/core/hle/service/nfc/nfc_device.cpp
+++ b/src/core/hle/service/nfc/nfc_device.cpp
@@ -42,8 +42,18 @@ NfcDevice::~NfcDevice() {
};
void NfcDevice::NpadUpdate(Core::HID::ControllerTriggerType type) {
- if (type == Core::HID::ControllerTriggerType::Connected ||
- type == Core::HID::ControllerTriggerType::Disconnected) {
+ if (!is_initalized) {
+ return;
+ }
+
+ if (type == Core::HID::ControllerTriggerType::Connected) {
+ Initialize();
+ availability_change_event->Signal();
+ return;
+ }
+
+ if (type == Core::HID::ControllerTriggerType::Disconnected) {
+ device_state = NFP::DeviceState::Unavailable;
availability_change_event->Signal();
return;
}
@@ -113,6 +123,7 @@ void NfcDevice::Initialize() {
device_state =
npad_device->HasNfc() ? NFP::DeviceState::Initialized : NFP::DeviceState::Unavailable;
encrypted_tag_data = {};
+ is_initalized = true;
}
void NfcDevice::Finalize() {
@@ -121,6 +132,7 @@ void NfcDevice::Finalize() {
StopDetection();
}
device_state = NFP::DeviceState::Unavailable;
+ is_initalized = false;
}
Result NfcDevice::StartDetection(NFP::TagProtocol allowed_protocol) {
diff --git a/src/core/hle/service/nfc/nfc_device.h b/src/core/hle/service/nfc/nfc_device.h
index a6e114d36..ea63f0537 100644
--- a/src/core/hle/service/nfc/nfc_device.h
+++ b/src/core/hle/service/nfc/nfc_device.h
@@ -67,6 +67,7 @@ private:
Kernel::KEvent* deactivate_event = nullptr;
Kernel::KEvent* availability_change_event = nullptr;
+ bool is_initalized{};
NFP::TagProtocol allowed_protocols{};
NFP::DeviceState device_state{NFP::DeviceState::Unavailable};
diff --git a/src/core/hle/service/nfp/nfp_device.cpp b/src/core/hle/service/nfp/nfp_device.cpp
index 268337d2e..5990e1473 100644
--- a/src/core/hle/service/nfp/nfp_device.cpp
+++ b/src/core/hle/service/nfp/nfp_device.cpp
@@ -66,8 +66,18 @@ NfpDevice::~NfpDevice() {
};
void NfpDevice::NpadUpdate(Core::HID::ControllerTriggerType type) {
- if (type == Core::HID::ControllerTriggerType::Connected ||
- type == Core::HID::ControllerTriggerType::Disconnected) {
+ if (!is_initalized) {
+ return;
+ }
+
+ if (type == Core::HID::ControllerTriggerType::Connected) {
+ Initialize();
+ availability_change_event->Signal();
+ return;
+ }
+
+ if (type == Core::HID::ControllerTriggerType::Disconnected) {
+ device_state = DeviceState::Unavailable;
availability_change_event->Signal();
return;
}
@@ -145,6 +155,7 @@ void NfpDevice::Initialize() {
device_state = npad_device->HasNfc() ? DeviceState::Initialized : DeviceState::Unavailable;
encrypted_tag_data = {};
tag_data = {};
+ is_initalized = true;
}
void NfpDevice::Finalize() {
@@ -155,6 +166,7 @@ void NfpDevice::Finalize() {
StopDetection();
}
device_state = DeviceState::Unavailable;
+ is_initalized = false;
}
Result NfpDevice::StartDetection(TagProtocol allowed_protocol) {
diff --git a/src/core/hle/service/nfp/nfp_device.h b/src/core/hle/service/nfp/nfp_device.h
index 8813df998..27122e86e 100644
--- a/src/core/hle/service/nfp/nfp_device.h
+++ b/src/core/hle/service/nfp/nfp_device.h
@@ -92,6 +92,7 @@ private:
Kernel::KEvent* deactivate_event = nullptr;
Kernel::KEvent* availability_change_event = nullptr;
+ bool is_initalized{};
bool is_data_moddified{};
bool is_app_area_open{};
TagProtocol allowed_protocols{};
diff --git a/src/video_core/renderer_vulkan/vk_scheduler.cpp b/src/video_core/renderer_vulkan/vk_scheduler.cpp
index c636a1625..55e699552 100644
--- a/src/video_core/renderer_vulkan/vk_scheduler.cpp
+++ b/src/video_core/renderer_vulkan/vk_scheduler.cpp
@@ -65,12 +65,13 @@ void Scheduler::WaitWorker() {
DispatchWork();
// Ensure the queue is drained.
- std::unique_lock ql{queue_mutex};
- event_cv.wait(ql, [this] { return work_queue.empty(); });
+ {
+ std::unique_lock ql{queue_mutex};
+ event_cv.wait(ql, [this] { return work_queue.empty(); });
+ }
// Now wait for execution to finish.
- // This needs to be done in the same order as WorkerThread.
- std::unique_lock el{execution_mutex};
+ std::scoped_lock el{execution_mutex};
}
void Scheduler::DispatchWork() {