summaryrefslogtreecommitdiff
path: root/src/core/hid
diff options
context:
space:
mode:
authorGravatar Narr the Reg2023-01-13 13:39:33 -0600
committerGravatar Narr the Reg2023-01-19 18:05:23 -0600
commit4a307a7b3aa3afea7d62674f6cf40b76f3ffb5e3 (patch)
treec104ff9a8a48cf29fd3dc67c84f5af71224744f7 /src/core/hid
parentinput_common: Drop Pro controller support from custom driver (diff)
downloadyuzu-4a307a7b3aa3afea7d62674f6cf40b76f3ffb5e3.tar.gz
yuzu-4a307a7b3aa3afea7d62674f6cf40b76f3ffb5e3.tar.xz
yuzu-4a307a7b3aa3afea7d62674f6cf40b76f3ffb5e3.zip
core: hid: Only set the polling mode to the correct side
Diffstat (limited to 'src/core/hid')
-rw-r--r--src/core/hid/emulated_controller.cpp28
-rw-r--r--src/core/hid/emulated_controller.h4
2 files changed, 23 insertions, 9 deletions
diff --git a/src/core/hid/emulated_controller.cpp b/src/core/hid/emulated_controller.cpp
index faf9e7c4e..f83abad05 100644
--- a/src/core/hid/emulated_controller.cpp
+++ b/src/core/hid/emulated_controller.cpp
@@ -1208,19 +1208,31 @@ bool EmulatedController::IsVibrationEnabled(std::size_t device_index) {
1208} 1208}
1209 1209
1210Common::Input::DriverResult EmulatedController::SetPollingMode( 1210Common::Input::DriverResult EmulatedController::SetPollingMode(
1211 Common::Input::PollingMode polling_mode) { 1211 EmulatedDeviceIndex device_index, Common::Input::PollingMode polling_mode) {
1212 LOG_INFO(Service_HID, "Set polling mode {}", polling_mode); 1212 LOG_INFO(Service_HID, "Set polling mode {}, device_index={}", polling_mode, device_index);
1213 auto& output_device = output_devices[static_cast<std::size_t>(DeviceIndex::Right)]; 1213
1214 auto& left_output_device = output_devices[static_cast<std::size_t>(DeviceIndex::Left)];
1215 auto& right_output_device = output_devices[static_cast<std::size_t>(DeviceIndex::Right)];
1214 auto& nfc_output_device = output_devices[3]; 1216 auto& nfc_output_device = output_devices[3];
1215 1217
1216 const auto virtual_nfc_result = nfc_output_device->SetPollingMode(polling_mode); 1218 if (device_index == EmulatedDeviceIndex::LeftIndex) {
1217 const auto mapped_nfc_result = output_device->SetPollingMode(polling_mode); 1219 return left_output_device->SetPollingMode(polling_mode);
1220 }
1218 1221
1219 if (virtual_nfc_result == Common::Input::DriverResult::Success) { 1222 if (device_index == EmulatedDeviceIndex::RightIndex) {
1220 return virtual_nfc_result; 1223 const auto virtual_nfc_result = nfc_output_device->SetPollingMode(polling_mode);
1224 const auto mapped_nfc_result = right_output_device->SetPollingMode(polling_mode);
1225
1226 if (virtual_nfc_result == Common::Input::DriverResult::Success) {
1227 return virtual_nfc_result;
1228 }
1229 return mapped_nfc_result;
1221 } 1230 }
1222 1231
1223 return mapped_nfc_result; 1232 left_output_device->SetPollingMode(polling_mode);
1233 right_output_device->SetPollingMode(polling_mode);
1234 nfc_output_device->SetPollingMode(polling_mode);
1235 return Common::Input::DriverResult::Success;
1224} 1236}
1225 1237
1226bool EmulatedController::SetCameraFormat( 1238bool EmulatedController::SetCameraFormat(
diff --git a/src/core/hid/emulated_controller.h b/src/core/hid/emulated_controller.h
index edebfc15c..3ac77b2b5 100644
--- a/src/core/hid/emulated_controller.h
+++ b/src/core/hid/emulated_controller.h
@@ -363,10 +363,12 @@ public:
363 363
364 /** 364 /**
365 * Sets the desired data to be polled from a controller 365 * Sets the desired data to be polled from a controller
366 * @param device_index index of the controller to set the polling mode
366 * @param polling_mode type of input desired buttons, gyro, nfc, ir, etc. 367 * @param polling_mode type of input desired buttons, gyro, nfc, ir, etc.
367 * @return driver result from this command 368 * @return driver result from this command
368 */ 369 */
369 Common::Input::DriverResult SetPollingMode(Common::Input::PollingMode polling_mode); 370 Common::Input::DriverResult SetPollingMode(EmulatedDeviceIndex device_index,
371 Common::Input::PollingMode polling_mode);
370 372
371 /** 373 /**
372 * Sets the desired camera format to be polled from a controller 374 * Sets the desired camera format to be polled from a controller