diff options
author | Narr the Reg <juangerman-13@hotmail.com> | 2023-03-22 03:04:01 +0100 |
---|---|---|
committer | Narr the Reg <juangerman-13@hotmail.com> | 2023-03-22 03:09:36 +0100 |
commit | 6ff4bf9b1c48f4cd148cbebc9f0f21bcc74cdac8 (patch) | |
tree | 3aec9d001317af55a6610ea8ca28da7758492c35 /src/core/hle/service/nfc | |
parent | Merge pull request #9966 from bunnei/bounded-polyfill (diff) | |
download | yuzu-6ff4bf9b1c48f4cd148cbebc9f0f21bcc74cdac8.tar yuzu-6ff4bf9b1c48f4cd148cbebc9f0f21bcc74cdac8.tar.gz yuzu-6ff4bf9b1c48f4cd148cbebc9f0f21bcc74cdac8.tar.bz2 yuzu-6ff4bf9b1c48f4cd148cbebc9f0f21bcc74cdac8.tar.lz yuzu-6ff4bf9b1c48f4cd148cbebc9f0f21bcc74cdac8.tar.xz yuzu-6ff4bf9b1c48f4cd148cbebc9f0f21bcc74cdac8.tar.zst yuzu-6ff4bf9b1c48f4cd148cbebc9f0f21bcc74cdac8.zip |
Diffstat (limited to 'src/core/hle/service/nfc')
-rw-r--r-- | src/core/hle/service/nfc/nfc_device.cpp | 16 | ||||
-rw-r--r-- | src/core/hle/service/nfc/nfc_device.h | 1 |
2 files changed, 15 insertions, 2 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}; |