summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service
diff options
context:
space:
mode:
authorgerman77 <juangerman-13@hotmail.com>2023-07-03 03:21:16 +0200
committergerman77 <juangerman-13@hotmail.com>2023-07-03 03:21:16 +0200
commit9cd698e8ad584a199048f072ed65986ee10ba31a (patch)
tree2959ccd4fd535565d4b7aa28d289ca3ecce461fa /src/core/hle/service
parentMerge pull request #10998 from Morph1984/qt-stop-messing-with-me (diff)
downloadyuzu-9cd698e8ad584a199048f072ed65986ee10ba31a.tar
yuzu-9cd698e8ad584a199048f072ed65986ee10ba31a.tar.gz
yuzu-9cd698e8ad584a199048f072ed65986ee10ba31a.tar.bz2
yuzu-9cd698e8ad584a199048f072ed65986ee10ba31a.tar.lz
yuzu-9cd698e8ad584a199048f072ed65986ee10ba31a.tar.xz
yuzu-9cd698e8ad584a199048f072ed65986ee10ba31a.tar.zst
yuzu-9cd698e8ad584a199048f072ed65986ee10ba31a.zip
Diffstat (limited to 'src/core/hle/service')
-rw-r--r--src/core/hle/service/nfc/common/device.cpp32
1 files changed, 21 insertions, 11 deletions
diff --git a/src/core/hle/service/nfc/common/device.cpp b/src/core/hle/service/nfc/common/device.cpp
index 5bf289818..2d633b03f 100644
--- a/src/core/hle/service/nfc/common/device.cpp
+++ b/src/core/hle/service/nfc/common/device.cpp
@@ -66,10 +66,6 @@ NfcDevice::~NfcDevice() {
};
void NfcDevice::NpadUpdate(Core::HID::ControllerTriggerType type) {
- if (!is_initalized) {
- return;
- }
-
if (type == Core::HID::ControllerTriggerType::Connected) {
Initialize();
availability_change_event->Signal();
@@ -77,12 +73,12 @@ void NfcDevice::NpadUpdate(Core::HID::ControllerTriggerType type) {
}
if (type == Core::HID::ControllerTriggerType::Disconnected) {
- device_state = DeviceState::Unavailable;
+ Finalize();
availability_change_event->Signal();
return;
}
- if (type != Core::HID::ControllerTriggerType::Nfc) {
+ if (!is_initalized) {
return;
}
@@ -90,6 +86,17 @@ void NfcDevice::NpadUpdate(Core::HID::ControllerTriggerType type) {
return;
}
+ // Ensure nfc mode is always active
+ if (npad_device->GetPollingMode(Core::HID::EmulatedDeviceIndex::RightIndex) ==
+ Common::Input::PollingMode::Active) {
+ npad_device->SetPollingMode(Core::HID::EmulatedDeviceIndex::RightIndex,
+ Common::Input::PollingMode::NFC);
+ }
+
+ if (type != Core::HID::ControllerTriggerType::Nfc) {
+ return;
+ }
+
const auto nfc_status = npad_device->GetNfc();
switch (nfc_status.state) {
case Common::Input::NfcState::NewAmiibo:
@@ -207,11 +214,14 @@ void NfcDevice::Initialize() {
}
void NfcDevice::Finalize() {
- if (device_state == DeviceState::TagMounted) {
- Unmount();
- }
- if (device_state == DeviceState::SearchingForTag || device_state == DeviceState::TagRemoved) {
- StopDetection();
+ if (npad_device->IsConnected()) {
+ if (device_state == DeviceState::TagMounted) {
+ Unmount();
+ }
+ if (device_state == DeviceState::SearchingForTag ||
+ device_state == DeviceState::TagRemoved) {
+ StopDetection();
+ }
}
if (device_state != DeviceState::Unavailable) {