summaryrefslogtreecommitdiff
path: root/src/core/hid
diff options
context:
space:
mode:
authorGravatar german772023-07-02 19:21:16 -0600
committerGravatar german772023-07-02 19:21:16 -0600
commit9cd698e8ad584a199048f072ed65986ee10ba31a (patch)
tree2959ccd4fd535565d4b7aa28d289ca3ecce461fa /src/core/hid
parentMerge pull request #10998 from Morph1984/qt-stop-messing-with-me (diff)
downloadyuzu-9cd698e8ad584a199048f072ed65986ee10ba31a.tar.gz
yuzu-9cd698e8ad584a199048f072ed65986ee10ba31a.tar.xz
yuzu-9cd698e8ad584a199048f072ed65986ee10ba31a.zip
service: nfc: Ensure controller is in the correct mode
Diffstat (limited to 'src/core/hid')
-rw-r--r--src/core/hid/emulated_controller.cpp12
-rw-r--r--src/core/hid/emulated_controller.h8
2 files changed, 20 insertions, 0 deletions
diff --git a/src/core/hid/emulated_controller.cpp b/src/core/hid/emulated_controller.cpp
index 1ebc32c1e..94bd656fe 100644
--- a/src/core/hid/emulated_controller.cpp
+++ b/src/core/hid/emulated_controller.cpp
@@ -1243,10 +1243,12 @@ Common::Input::DriverResult EmulatedController::SetPollingMode(
1243 auto& nfc_output_device = output_devices[3]; 1243 auto& nfc_output_device = output_devices[3];
1244 1244
1245 if (device_index == EmulatedDeviceIndex::LeftIndex) { 1245 if (device_index == EmulatedDeviceIndex::LeftIndex) {
1246 controller.left_polling_mode = polling_mode;
1246 return left_output_device->SetPollingMode(polling_mode); 1247 return left_output_device->SetPollingMode(polling_mode);
1247 } 1248 }
1248 1249
1249 if (device_index == EmulatedDeviceIndex::RightIndex) { 1250 if (device_index == EmulatedDeviceIndex::RightIndex) {
1251 controller.right_polling_mode = polling_mode;
1250 const auto virtual_nfc_result = nfc_output_device->SetPollingMode(polling_mode); 1252 const auto virtual_nfc_result = nfc_output_device->SetPollingMode(polling_mode);
1251 const auto mapped_nfc_result = right_output_device->SetPollingMode(polling_mode); 1253 const auto mapped_nfc_result = right_output_device->SetPollingMode(polling_mode);
1252 1254
@@ -1261,12 +1263,22 @@ Common::Input::DriverResult EmulatedController::SetPollingMode(
1261 return mapped_nfc_result; 1263 return mapped_nfc_result;
1262 } 1264 }
1263 1265
1266 controller.left_polling_mode = polling_mode;
1267 controller.right_polling_mode = polling_mode;
1264 left_output_device->SetPollingMode(polling_mode); 1268 left_output_device->SetPollingMode(polling_mode);
1265 right_output_device->SetPollingMode(polling_mode); 1269 right_output_device->SetPollingMode(polling_mode);
1266 nfc_output_device->SetPollingMode(polling_mode); 1270 nfc_output_device->SetPollingMode(polling_mode);
1267 return Common::Input::DriverResult::Success; 1271 return Common::Input::DriverResult::Success;
1268} 1272}
1269 1273
1274Common::Input::PollingMode EmulatedController::GetPollingMode(
1275 EmulatedDeviceIndex device_index) const {
1276 if (device_index == EmulatedDeviceIndex::LeftIndex) {
1277 return controller.left_polling_mode;
1278 }
1279 return controller.right_polling_mode;
1280}
1281
1270bool EmulatedController::SetCameraFormat( 1282bool EmulatedController::SetCameraFormat(
1271 Core::IrSensor::ImageTransferProcessorFormat camera_format) { 1283 Core::IrSensor::ImageTransferProcessorFormat camera_format) {
1272 LOG_INFO(Service_HID, "Set camera format {}", camera_format); 1284 LOG_INFO(Service_HID, "Set camera format {}", camera_format);
diff --git a/src/core/hid/emulated_controller.h b/src/core/hid/emulated_controller.h
index d511e5fac..88d77db8d 100644
--- a/src/core/hid/emulated_controller.h
+++ b/src/core/hid/emulated_controller.h
@@ -143,6 +143,8 @@ struct ControllerStatus {
143 CameraState camera_state{}; 143 CameraState camera_state{};
144 RingSensorForce ring_analog_state{}; 144 RingSensorForce ring_analog_state{};
145 NfcState nfc_state{}; 145 NfcState nfc_state{};
146 Common::Input::PollingMode left_polling_mode{};
147 Common::Input::PollingMode right_polling_mode{};
146}; 148};
147 149
148enum class ControllerTriggerType { 150enum class ControllerTriggerType {
@@ -370,6 +372,12 @@ public:
370 */ 372 */
371 Common::Input::DriverResult SetPollingMode(EmulatedDeviceIndex device_index, 373 Common::Input::DriverResult SetPollingMode(EmulatedDeviceIndex device_index,
372 Common::Input::PollingMode polling_mode); 374 Common::Input::PollingMode polling_mode);
375 /**
376 * Get the current polling mode from a controller
377 * @param device_index index of the controller to set the polling mode
378 * @return current polling mode
379 */
380 Common::Input::PollingMode GetPollingMode(EmulatedDeviceIndex device_index) const;
373 381
374 /** 382 /**
375 * Sets the desired camera format to be polled from a controller 383 * Sets the desired camera format to be polled from a controller