summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorliamwhite <liamwhite@users.noreply.github.com>2023-06-26 20:31:23 +0200
committerGitHub <noreply@github.com>2023-06-26 20:31:23 +0200
commitb82c649b0fab7779d21c7381a8bad514ee698c04 (patch)
treea39301bfa6a211fc143ad73efc7e68d411bc6077 /src/core
parentMerge pull request #10901 from german77/sdl_fix (diff)
parentcore: hid: Allow to read bin files while switch controller is available (diff)
downloadyuzu-b82c649b0fab7779d21c7381a8bad514ee698c04.tar
yuzu-b82c649b0fab7779d21c7381a8bad514ee698c04.tar.gz
yuzu-b82c649b0fab7779d21c7381a8bad514ee698c04.tar.bz2
yuzu-b82c649b0fab7779d21c7381a8bad514ee698c04.tar.lz
yuzu-b82c649b0fab7779d21c7381a8bad514ee698c04.tar.xz
yuzu-b82c649b0fab7779d21c7381a8bad514ee698c04.tar.zst
yuzu-b82c649b0fab7779d21c7381a8bad514ee698c04.zip
Diffstat (limited to 'src/core')
-rw-r--r--src/core/hid/emulated_controller.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/core/hid/emulated_controller.cpp b/src/core/hid/emulated_controller.cpp
index c937495f9..1ebc32c1e 100644
--- a/src/core/hid/emulated_controller.cpp
+++ b/src/core/hid/emulated_controller.cpp
@@ -1250,6 +1250,11 @@ Common::Input::DriverResult EmulatedController::SetPollingMode(
const auto virtual_nfc_result = nfc_output_device->SetPollingMode(polling_mode);
const auto mapped_nfc_result = right_output_device->SetPollingMode(polling_mode);
+ // Restore previous state
+ if (mapped_nfc_result != Common::Input::DriverResult::Success) {
+ right_output_device->SetPollingMode(Common::Input::PollingMode::Active);
+ }
+
if (virtual_nfc_result == Common::Input::DriverResult::Success) {
return virtual_nfc_result;
}
@@ -1329,16 +1334,22 @@ bool EmulatedController::StartNfcPolling() {
auto& nfc_output_device = output_devices[static_cast<std::size_t>(DeviceIndex::Right)];
auto& nfc_virtual_output_device = output_devices[3];
- return nfc_output_device->StartNfcPolling() == Common::Input::NfcState::Success ||
- nfc_virtual_output_device->StartNfcPolling() == Common::Input::NfcState::Success;
+ const auto device_result = nfc_output_device->StartNfcPolling();
+ const auto virtual_device_result = nfc_virtual_output_device->StartNfcPolling();
+
+ return device_result == Common::Input::NfcState::Success ||
+ virtual_device_result == Common::Input::NfcState::Success;
}
bool EmulatedController::StopNfcPolling() {
auto& nfc_output_device = output_devices[static_cast<std::size_t>(DeviceIndex::Right)];
auto& nfc_virtual_output_device = output_devices[3];
- return nfc_output_device->StopNfcPolling() == Common::Input::NfcState::Success ||
- nfc_virtual_output_device->StopNfcPolling() == Common::Input::NfcState::Success;
+ const auto device_result = nfc_output_device->StopNfcPolling();
+ const auto virtual_device_result = nfc_virtual_output_device->StopNfcPolling();
+
+ return device_result == Common::Input::NfcState::Success ||
+ virtual_device_result == Common::Input::NfcState::Success;
}
bool EmulatedController::ReadAmiiboData(std::vector<u8>& data) {