diff options
| -rw-r--r-- | src/core/hid/emulated_controller.cpp | 28 | ||||
| -rw-r--r-- | src/core/hid/emulated_controller.h | 4 | ||||
| -rw-r--r-- | src/core/hle/service/hid/controllers/npad.cpp | 14 | ||||
| -rw-r--r-- | src/core/hle/service/hid/hidbus/ringcon.cpp | 6 | ||||
| -rw-r--r-- | src/core/hle/service/hid/irs.cpp | 27 | ||||
| -rw-r--r-- | src/core/hle/service/nfc/nfc_device.cpp | 6 | ||||
| -rw-r--r-- | src/core/hle/service/nfp/nfp_device.cpp | 6 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_ringcon.cpp | 6 |
8 files changed, 70 insertions, 27 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 | ||
| 1210 | Common::Input::DriverResult EmulatedController::SetPollingMode( | 1210 | Common::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 | ||
| 1226 | bool EmulatedController::SetCameraFormat( | 1238 | 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: | |||
| 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 |
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp index fe5bf94d2..5713f1288 100644 --- a/src/core/hle/service/hid/controllers/npad.cpp +++ b/src/core/hle/service/hid/controllers/npad.cpp | |||
| @@ -337,7 +337,19 @@ void Controller_NPad::InitNewlyAddedController(Core::HID::NpadIdType npad_id) { | |||
| 337 | controller.is_connected = true; | 337 | controller.is_connected = true; |
| 338 | controller.device->Connect(); | 338 | controller.device->Connect(); |
| 339 | controller.device->SetLedPattern(); | 339 | controller.device->SetLedPattern(); |
| 340 | controller.device->SetPollingMode(Common::Input::PollingMode::Active); | 340 | if (controller_type == Core::HID::NpadStyleIndex::JoyconDual) { |
| 341 | if (controller.is_dual_left_connected) { | ||
| 342 | controller.device->SetPollingMode(Core::HID::EmulatedDeviceIndex::LeftIndex, | ||
| 343 | Common::Input::PollingMode::Active); | ||
| 344 | } | ||
| 345 | if (controller.is_dual_right_connected) { | ||
| 346 | controller.device->SetPollingMode(Core::HID::EmulatedDeviceIndex::RightIndex, | ||
| 347 | Common::Input::PollingMode::Active); | ||
| 348 | } | ||
| 349 | } else { | ||
| 350 | controller.device->SetPollingMode(Core::HID::EmulatedDeviceIndex::AllDevices, | ||
| 351 | Common::Input::PollingMode::Active); | ||
| 352 | } | ||
| 341 | SignalStyleSetChangedEvent(npad_id); | 353 | SignalStyleSetChangedEvent(npad_id); |
| 342 | WriteEmptyEntry(controller.shared_memory); | 354 | WriteEmptyEntry(controller.shared_memory); |
| 343 | } | 355 | } |
diff --git a/src/core/hle/service/hid/hidbus/ringcon.cpp b/src/core/hle/service/hid/hidbus/ringcon.cpp index af776d506..78ed47014 100644 --- a/src/core/hle/service/hid/hidbus/ringcon.cpp +++ b/src/core/hle/service/hid/hidbus/ringcon.cpp | |||
| @@ -18,12 +18,14 @@ RingController::RingController(Core::HID::HIDCore& hid_core_, | |||
| 18 | RingController::~RingController() = default; | 18 | RingController::~RingController() = default; |
| 19 | 19 | ||
| 20 | void RingController::OnInit() { | 20 | void RingController::OnInit() { |
| 21 | input->SetPollingMode(Common::Input::PollingMode::Ring); | 21 | input->SetPollingMode(Core::HID::EmulatedDeviceIndex::RightIndex, |
| 22 | Common::Input::PollingMode::Ring); | ||
| 22 | return; | 23 | return; |
| 23 | } | 24 | } |
| 24 | 25 | ||
| 25 | void RingController::OnRelease() { | 26 | void RingController::OnRelease() { |
| 26 | input->SetPollingMode(Common::Input::PollingMode::Active); | 27 | input->SetPollingMode(Core::HID::EmulatedDeviceIndex::RightIndex, |
| 28 | Common::Input::PollingMode::Active); | ||
| 27 | return; | 29 | return; |
| 28 | }; | 30 | }; |
| 29 | 31 | ||
diff --git a/src/core/hle/service/hid/irs.cpp b/src/core/hle/service/hid/irs.cpp index 1a6fa2a44..52f402c56 100644 --- a/src/core/hle/service/hid/irs.cpp +++ b/src/core/hle/service/hid/irs.cpp | |||
| @@ -108,7 +108,8 @@ void IRS::StopImageProcessor(Kernel::HLERequestContext& ctx) { | |||
| 108 | auto result = IsIrCameraHandleValid(parameters.camera_handle); | 108 | auto result = IsIrCameraHandleValid(parameters.camera_handle); |
| 109 | if (result.IsSuccess()) { | 109 | if (result.IsSuccess()) { |
| 110 | // TODO: Stop Image processor | 110 | // TODO: Stop Image processor |
| 111 | npad_device->SetPollingMode(Common::Input::PollingMode::Active); | 111 | npad_device->SetPollingMode(Core::HID::EmulatedDeviceIndex::RightIndex, |
| 112 | Common::Input::PollingMode::Active); | ||
| 112 | result = ResultSuccess; | 113 | result = ResultSuccess; |
| 113 | } | 114 | } |
| 114 | 115 | ||
| @@ -140,7 +141,8 @@ void IRS::RunMomentProcessor(Kernel::HLERequestContext& ctx) { | |||
| 140 | MakeProcessor<MomentProcessor>(parameters.camera_handle, device); | 141 | MakeProcessor<MomentProcessor>(parameters.camera_handle, device); |
| 141 | auto& image_transfer_processor = GetProcessor<MomentProcessor>(parameters.camera_handle); | 142 | auto& image_transfer_processor = GetProcessor<MomentProcessor>(parameters.camera_handle); |
| 142 | image_transfer_processor.SetConfig(parameters.processor_config); | 143 | image_transfer_processor.SetConfig(parameters.processor_config); |
| 143 | npad_device->SetPollingMode(Common::Input::PollingMode::IR); | 144 | npad_device->SetPollingMode(Core::HID::EmulatedDeviceIndex::RightIndex, |
| 145 | Common::Input::PollingMode::IR); | ||
| 144 | } | 146 | } |
| 145 | 147 | ||
| 146 | IPC::ResponseBuilder rb{ctx, 2}; | 148 | IPC::ResponseBuilder rb{ctx, 2}; |
| @@ -172,7 +174,8 @@ void IRS::RunClusteringProcessor(Kernel::HLERequestContext& ctx) { | |||
| 172 | auto& image_transfer_processor = | 174 | auto& image_transfer_processor = |
| 173 | GetProcessor<ClusteringProcessor>(parameters.camera_handle); | 175 | GetProcessor<ClusteringProcessor>(parameters.camera_handle); |
| 174 | image_transfer_processor.SetConfig(parameters.processor_config); | 176 | image_transfer_processor.SetConfig(parameters.processor_config); |
| 175 | npad_device->SetPollingMode(Common::Input::PollingMode::IR); | 177 | npad_device->SetPollingMode(Core::HID::EmulatedDeviceIndex::RightIndex, |
| 178 | Common::Input::PollingMode::IR); | ||
| 176 | } | 179 | } |
| 177 | 180 | ||
| 178 | IPC::ResponseBuilder rb{ctx, 2}; | 181 | IPC::ResponseBuilder rb{ctx, 2}; |
| @@ -222,7 +225,8 @@ void IRS::RunImageTransferProcessor(Kernel::HLERequestContext& ctx) { | |||
| 222 | GetProcessor<ImageTransferProcessor>(parameters.camera_handle); | 225 | GetProcessor<ImageTransferProcessor>(parameters.camera_handle); |
| 223 | image_transfer_processor.SetConfig(parameters.processor_config); | 226 | image_transfer_processor.SetConfig(parameters.processor_config); |
| 224 | image_transfer_processor.SetTransferMemoryPointer(transfer_memory); | 227 | image_transfer_processor.SetTransferMemoryPointer(transfer_memory); |
| 225 | npad_device->SetPollingMode(Common::Input::PollingMode::IR); | 228 | npad_device->SetPollingMode(Core::HID::EmulatedDeviceIndex::RightIndex, |
| 229 | Common::Input::PollingMode::IR); | ||
| 226 | } | 230 | } |
| 227 | 231 | ||
| 228 | IPC::ResponseBuilder rb{ctx, 2}; | 232 | IPC::ResponseBuilder rb{ctx, 2}; |
| @@ -298,7 +302,8 @@ void IRS::RunTeraPluginProcessor(Kernel::HLERequestContext& ctx) { | |||
| 298 | auto& image_transfer_processor = | 302 | auto& image_transfer_processor = |
| 299 | GetProcessor<TeraPluginProcessor>(parameters.camera_handle); | 303 | GetProcessor<TeraPluginProcessor>(parameters.camera_handle); |
| 300 | image_transfer_processor.SetConfig(parameters.processor_config); | 304 | image_transfer_processor.SetConfig(parameters.processor_config); |
| 301 | npad_device->SetPollingMode(Common::Input::PollingMode::IR); | 305 | npad_device->SetPollingMode(Core::HID::EmulatedDeviceIndex::RightIndex, |
| 306 | Common::Input::PollingMode::IR); | ||
| 302 | } | 307 | } |
| 303 | 308 | ||
| 304 | IPC::ResponseBuilder rb{ctx, 2}; | 309 | IPC::ResponseBuilder rb{ctx, 2}; |
| @@ -348,7 +353,8 @@ void IRS::RunPointingProcessor(Kernel::HLERequestContext& ctx) { | |||
| 348 | MakeProcessor<PointingProcessor>(camera_handle, device); | 353 | MakeProcessor<PointingProcessor>(camera_handle, device); |
| 349 | auto& image_transfer_processor = GetProcessor<PointingProcessor>(camera_handle); | 354 | auto& image_transfer_processor = GetProcessor<PointingProcessor>(camera_handle); |
| 350 | image_transfer_processor.SetConfig(processor_config); | 355 | image_transfer_processor.SetConfig(processor_config); |
| 351 | npad_device->SetPollingMode(Common::Input::PollingMode::IR); | 356 | npad_device->SetPollingMode(Core::HID::EmulatedDeviceIndex::RightIndex, |
| 357 | Common::Input::PollingMode::IR); | ||
| 352 | } | 358 | } |
| 353 | 359 | ||
| 354 | IPC::ResponseBuilder rb{ctx, 2}; | 360 | IPC::ResponseBuilder rb{ctx, 2}; |
| @@ -459,7 +465,8 @@ void IRS::RunImageTransferExProcessor(Kernel::HLERequestContext& ctx) { | |||
| 459 | GetProcessor<ImageTransferProcessor>(parameters.camera_handle); | 465 | GetProcessor<ImageTransferProcessor>(parameters.camera_handle); |
| 460 | image_transfer_processor.SetConfig(parameters.processor_config); | 466 | image_transfer_processor.SetConfig(parameters.processor_config); |
| 461 | image_transfer_processor.SetTransferMemoryPointer(transfer_memory); | 467 | image_transfer_processor.SetTransferMemoryPointer(transfer_memory); |
| 462 | npad_device->SetPollingMode(Common::Input::PollingMode::IR); | 468 | npad_device->SetPollingMode(Core::HID::EmulatedDeviceIndex::RightIndex, |
| 469 | Common::Input::PollingMode::IR); | ||
| 463 | } | 470 | } |
| 464 | 471 | ||
| 465 | IPC::ResponseBuilder rb{ctx, 2}; | 472 | IPC::ResponseBuilder rb{ctx, 2}; |
| @@ -486,7 +493,8 @@ void IRS::RunIrLedProcessor(Kernel::HLERequestContext& ctx) { | |||
| 486 | MakeProcessor<IrLedProcessor>(camera_handle, device); | 493 | MakeProcessor<IrLedProcessor>(camera_handle, device); |
| 487 | auto& image_transfer_processor = GetProcessor<IrLedProcessor>(camera_handle); | 494 | auto& image_transfer_processor = GetProcessor<IrLedProcessor>(camera_handle); |
| 488 | image_transfer_processor.SetConfig(processor_config); | 495 | image_transfer_processor.SetConfig(processor_config); |
| 489 | npad_device->SetPollingMode(Common::Input::PollingMode::IR); | 496 | npad_device->SetPollingMode(Core::HID::EmulatedDeviceIndex::RightIndex, |
| 497 | Common::Input::PollingMode::IR); | ||
| 490 | } | 498 | } |
| 491 | 499 | ||
| 492 | IPC::ResponseBuilder rb{ctx, 2}; | 500 | IPC::ResponseBuilder rb{ctx, 2}; |
| @@ -512,7 +520,8 @@ void IRS::StopImageProcessorAsync(Kernel::HLERequestContext& ctx) { | |||
| 512 | auto result = IsIrCameraHandleValid(parameters.camera_handle); | 520 | auto result = IsIrCameraHandleValid(parameters.camera_handle); |
| 513 | if (result.IsSuccess()) { | 521 | if (result.IsSuccess()) { |
| 514 | // TODO: Stop image processor async | 522 | // TODO: Stop image processor async |
| 515 | npad_device->SetPollingMode(Common::Input::PollingMode::Active); | 523 | npad_device->SetPollingMode(Core::HID::EmulatedDeviceIndex::RightIndex, |
| 524 | Common::Input::PollingMode::Active); | ||
| 516 | result = ResultSuccess; | 525 | result = ResultSuccess; |
| 517 | } | 526 | } |
| 518 | 527 | ||
diff --git a/src/core/hle/service/nfc/nfc_device.cpp b/src/core/hle/service/nfc/nfc_device.cpp index c9815edbc..9a3234e8c 100644 --- a/src/core/hle/service/nfc/nfc_device.cpp +++ b/src/core/hle/service/nfc/nfc_device.cpp | |||
| @@ -130,7 +130,8 @@ Result NfcDevice::StartDetection(NFP::TagProtocol allowed_protocol) { | |||
| 130 | return WrongDeviceState; | 130 | return WrongDeviceState; |
| 131 | } | 131 | } |
| 132 | 132 | ||
| 133 | if (npad_device->SetPollingMode(Common::Input::PollingMode::NFC) != | 133 | if (npad_device->SetPollingMode(Core::HID::EmulatedDeviceIndex::RightIndex, |
| 134 | Common::Input::PollingMode::NFC) != | ||
| 134 | Common::Input::DriverResult::Success) { | 135 | Common::Input::DriverResult::Success) { |
| 135 | LOG_ERROR(Service_NFC, "Nfc not supported"); | 136 | LOG_ERROR(Service_NFC, "Nfc not supported"); |
| 136 | return NfcDisabled; | 137 | return NfcDisabled; |
| @@ -142,7 +143,8 @@ Result NfcDevice::StartDetection(NFP::TagProtocol allowed_protocol) { | |||
| 142 | } | 143 | } |
| 143 | 144 | ||
| 144 | Result NfcDevice::StopDetection() { | 145 | Result NfcDevice::StopDetection() { |
| 145 | npad_device->SetPollingMode(Common::Input::PollingMode::Active); | 146 | npad_device->SetPollingMode(Core::HID::EmulatedDeviceIndex::RightIndex, |
| 147 | Common::Input::PollingMode::Active); | ||
| 146 | 148 | ||
| 147 | if (device_state == NFP::DeviceState::Initialized) { | 149 | if (device_state == NFP::DeviceState::Initialized) { |
| 148 | return ResultSuccess; | 150 | return ResultSuccess; |
diff --git a/src/core/hle/service/nfp/nfp_device.cpp b/src/core/hle/service/nfp/nfp_device.cpp index 7b8013961..e67a76f55 100644 --- a/src/core/hle/service/nfp/nfp_device.cpp +++ b/src/core/hle/service/nfp/nfp_device.cpp | |||
| @@ -152,7 +152,8 @@ Result NfpDevice::StartDetection(TagProtocol allowed_protocol) { | |||
| 152 | return WrongDeviceState; | 152 | return WrongDeviceState; |
| 153 | } | 153 | } |
| 154 | 154 | ||
| 155 | if (npad_device->SetPollingMode(Common::Input::PollingMode::NFC) != | 155 | if (npad_device->SetPollingMode(Core::HID::EmulatedDeviceIndex::RightIndex, |
| 156 | Common::Input::PollingMode::NFC) != | ||
| 156 | Common::Input::DriverResult::Success) { | 157 | Common::Input::DriverResult::Success) { |
| 157 | LOG_ERROR(Service_NFP, "Nfc not supported"); | 158 | LOG_ERROR(Service_NFP, "Nfc not supported"); |
| 158 | return NfcDisabled; | 159 | return NfcDisabled; |
| @@ -164,7 +165,8 @@ Result NfpDevice::StartDetection(TagProtocol allowed_protocol) { | |||
| 164 | } | 165 | } |
| 165 | 166 | ||
| 166 | Result NfpDevice::StopDetection() { | 167 | Result NfpDevice::StopDetection() { |
| 167 | npad_device->SetPollingMode(Common::Input::PollingMode::Active); | 168 | npad_device->SetPollingMode(Core::HID::EmulatedDeviceIndex::RightIndex, |
| 169 | Common::Input::PollingMode::Active); | ||
| 168 | 170 | ||
| 169 | if (device_state == DeviceState::Initialized) { | 171 | if (device_state == DeviceState::Initialized) { |
| 170 | return ResultSuccess; | 172 | return ResultSuccess; |
diff --git a/src/yuzu/configuration/configure_ringcon.cpp b/src/yuzu/configuration/configure_ringcon.cpp index 697c36fb4..1275f10c8 100644 --- a/src/yuzu/configuration/configure_ringcon.cpp +++ b/src/yuzu/configuration/configure_ringcon.cpp | |||
| @@ -214,7 +214,8 @@ ConfigureRingController::ConfigureRingController(QWidget* parent, | |||
| 214 | } | 214 | } |
| 215 | 215 | ||
| 216 | ConfigureRingController::~ConfigureRingController() { | 216 | ConfigureRingController::~ConfigureRingController() { |
| 217 | emulated_controller->SetPollingMode(Common::Input::PollingMode::Active); | 217 | emulated_controller->SetPollingMode(Core::HID::EmulatedDeviceIndex::RightIndex, |
| 218 | Common::Input::PollingMode::Active); | ||
| 218 | emulated_controller->DisableConfiguration(); | 219 | emulated_controller->DisableConfiguration(); |
| 219 | 220 | ||
| 220 | if (is_controller_set) { | 221 | if (is_controller_set) { |
| @@ -290,7 +291,8 @@ void ConfigureRingController::EnableRingController() { | |||
| 290 | // SetPollingMode is blocking. Allow to update the button status before calling the command | 291 | // SetPollingMode is blocking. Allow to update the button status before calling the command |
| 291 | repaint(); | 292 | repaint(); |
| 292 | 293 | ||
| 293 | const auto result = emulated_controller->SetPollingMode(Common::Input::PollingMode::Ring); | 294 | const auto result = emulated_controller->SetPollingMode( |
| 295 | Core::HID::EmulatedDeviceIndex::RightIndex, Common::Input::PollingMode::Ring); | ||
| 294 | switch (result) { | 296 | switch (result) { |
| 295 | case Common::Input::DriverResult::Success: | 297 | case Common::Input::DriverResult::Success: |
| 296 | is_ring_enabled = true; | 298 | is_ring_enabled = true; |