summaryrefslogtreecommitdiffstats
path: root/src/core/hid
diff options
context:
space:
mode:
Diffstat (limited to '')
-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) {
}
Common::Input::DriverResult EmulatedController::SetPollingMode(
- Common::Input::PollingMode polling_mode) {
- LOG_INFO(Service_HID, "Set polling mode {}", polling_mode);
- auto& output_device = output_devices[static_cast<std::size_t>(DeviceIndex::Right)];
+ EmulatedDeviceIndex device_index, Common::Input::PollingMode polling_mode) {
+ LOG_INFO(Service_HID, "Set polling mode {}, device_index={}", polling_mode, device_index);
+
+ auto& left_output_device = output_devices[static_cast<std::size_t>(DeviceIndex::Left)];
+ auto& right_output_device = output_devices[static_cast<std::size_t>(DeviceIndex::Right)];
auto& nfc_output_device = output_devices[3];
- const auto virtual_nfc_result = nfc_output_device->SetPollingMode(polling_mode);
- const auto mapped_nfc_result = output_device->SetPollingMode(polling_mode);
+ if (device_index == EmulatedDeviceIndex::LeftIndex) {
+ return left_output_device->SetPollingMode(polling_mode);
+ }
- if (virtual_nfc_result == Common::Input::DriverResult::Success) {
- return virtual_nfc_result;
+ if (device_index == EmulatedDeviceIndex::RightIndex) {
+ const auto virtual_nfc_result = nfc_output_device->SetPollingMode(polling_mode);
+ const auto mapped_nfc_result = right_output_device->SetPollingMode(polling_mode);
+
+ if (virtual_nfc_result == Common::Input::DriverResult::Success) {
+ return virtual_nfc_result;
+ }
+ return mapped_nfc_result;
}
- return mapped_nfc_result;
+ left_output_device->SetPollingMode(polling_mode);
+ right_output_device->SetPollingMode(polling_mode);
+ nfc_output_device->SetPollingMode(polling_mode);
+ return Common::Input::DriverResult::Success;
}
bool 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:
/**
* Sets the desired data to be polled from a controller
+ * @param device_index index of the controller to set the polling mode
* @param polling_mode type of input desired buttons, gyro, nfc, ir, etc.
* @return driver result from this command
*/
- Common::Input::DriverResult SetPollingMode(Common::Input::PollingMode polling_mode);
+ Common::Input::DriverResult SetPollingMode(EmulatedDeviceIndex device_index,
+ Common::Input::PollingMode polling_mode);
/**
* Sets the desired camera format to be polled from a controller