diff options
| author | 2024-02-17 22:22:06 -0500 | |
|---|---|---|
| committer | 2024-02-17 22:22:06 -0500 | |
| commit | e7146309dec4fab504977186571228571efed009 (patch) | |
| tree | b1302cb237f91c5f0ccb9863a0b0a2fb427a3c14 /src/hid_core | |
| parent | Merge pull request #13017 from liamwhite/suspension (diff) | |
| parent | android: Input mapping (diff) | |
| download | yuzu-e7146309dec4fab504977186571228571efed009.tar.gz yuzu-e7146309dec4fab504977186571228571efed009.tar.xz yuzu-e7146309dec4fab504977186571228571efed009.zip | |
Merge pull request #13034 from t895/map-all-the-inputs
android: Input mapping
Diffstat (limited to 'src/hid_core')
| -rw-r--r-- | src/hid_core/frontend/emulated_controller.cpp | 10 | ||||
| -rw-r--r-- | src/hid_core/frontend/emulated_controller.h | 3 |
2 files changed, 12 insertions, 1 deletions
diff --git a/src/hid_core/frontend/emulated_controller.cpp b/src/hid_core/frontend/emulated_controller.cpp index 819460eb5..3fa06d188 100644 --- a/src/hid_core/frontend/emulated_controller.cpp +++ b/src/hid_core/frontend/emulated_controller.cpp | |||
| @@ -176,16 +176,19 @@ void EmulatedController::LoadDevices() { | |||
| 176 | camera_params[1] = Common::ParamPackage{"engine:camera,camera:1"}; | 176 | camera_params[1] = Common::ParamPackage{"engine:camera,camera:1"}; |
| 177 | ring_params[1] = Common::ParamPackage{"engine:joycon,axis_x:100,axis_y:101"}; | 177 | ring_params[1] = Common::ParamPackage{"engine:joycon,axis_x:100,axis_y:101"}; |
| 178 | nfc_params[0] = Common::ParamPackage{"engine:virtual_amiibo,nfc:1"}; | 178 | nfc_params[0] = Common::ParamPackage{"engine:virtual_amiibo,nfc:1"}; |
| 179 | android_params = Common::ParamPackage{"engine:android,port:100"}; | ||
| 179 | } | 180 | } |
| 180 | 181 | ||
| 181 | output_params[LeftIndex] = left_joycon; | 182 | output_params[LeftIndex] = left_joycon; |
| 182 | output_params[RightIndex] = right_joycon; | 183 | output_params[RightIndex] = right_joycon; |
| 183 | output_params[2] = camera_params[1]; | 184 | output_params[2] = camera_params[1]; |
| 184 | output_params[3] = nfc_params[0]; | 185 | output_params[3] = nfc_params[0]; |
| 186 | output_params[4] = android_params; | ||
| 185 | output_params[LeftIndex].Set("output", true); | 187 | output_params[LeftIndex].Set("output", true); |
| 186 | output_params[RightIndex].Set("output", true); | 188 | output_params[RightIndex].Set("output", true); |
| 187 | output_params[2].Set("output", true); | 189 | output_params[2].Set("output", true); |
| 188 | output_params[3].Set("output", true); | 190 | output_params[3].Set("output", true); |
| 191 | output_params[4].Set("output", true); | ||
| 189 | 192 | ||
| 190 | LoadTASParams(); | 193 | LoadTASParams(); |
| 191 | LoadVirtualGamepadParams(); | 194 | LoadVirtualGamepadParams(); |
| @@ -578,6 +581,9 @@ void EmulatedController::DisableConfiguration() { | |||
| 578 | 581 | ||
| 579 | // Get Joycon colors before turning on the controller | 582 | // Get Joycon colors before turning on the controller |
| 580 | for (const auto& color_device : color_devices) { | 583 | for (const auto& color_device : color_devices) { |
| 584 | if (color_device == nullptr) { | ||
| 585 | continue; | ||
| 586 | } | ||
| 581 | color_device->ForceUpdate(); | 587 | color_device->ForceUpdate(); |
| 582 | } | 588 | } |
| 583 | 589 | ||
| @@ -1277,6 +1283,10 @@ bool EmulatedController::SetVibration(DeviceIndex device_index, const VibrationV | |||
| 1277 | .high_frequency = vibration.high_frequency, | 1283 | .high_frequency = vibration.high_frequency, |
| 1278 | .type = type, | 1284 | .type = type, |
| 1279 | }; | 1285 | }; |
| 1286 | |||
| 1287 | // Send vibrations to Android's input overlay | ||
| 1288 | output_devices[4]->SetVibration(status); | ||
| 1289 | |||
| 1280 | return output_devices[index]->SetVibration(status) == Common::Input::DriverResult::Success; | 1290 | return output_devices[index]->SetVibration(status) == Common::Input::DriverResult::Success; |
| 1281 | } | 1291 | } |
| 1282 | 1292 | ||
diff --git a/src/hid_core/frontend/emulated_controller.h b/src/hid_core/frontend/emulated_controller.h index 701b38300..ab3c6fcd3 100644 --- a/src/hid_core/frontend/emulated_controller.h +++ b/src/hid_core/frontend/emulated_controller.h | |||
| @@ -21,7 +21,7 @@ | |||
| 21 | 21 | ||
| 22 | namespace Core::HID { | 22 | namespace Core::HID { |
| 23 | const std::size_t max_emulated_controllers = 2; | 23 | const std::size_t max_emulated_controllers = 2; |
| 24 | const std::size_t output_devices_size = 4; | 24 | const std::size_t output_devices_size = 5; |
| 25 | struct ControllerMotionInfo { | 25 | struct ControllerMotionInfo { |
| 26 | Common::Input::MotionStatus raw_status{}; | 26 | Common::Input::MotionStatus raw_status{}; |
| 27 | MotionInput emulated{}; | 27 | MotionInput emulated{}; |
| @@ -597,6 +597,7 @@ private: | |||
| 597 | CameraParams camera_params; | 597 | CameraParams camera_params; |
| 598 | RingAnalogParams ring_params; | 598 | RingAnalogParams ring_params; |
| 599 | NfcParams nfc_params; | 599 | NfcParams nfc_params; |
| 600 | Common::ParamPackage android_params; | ||
| 600 | OutputParams output_params; | 601 | OutputParams output_params; |
| 601 | 602 | ||
| 602 | ButtonDevices button_devices; | 603 | ButtonDevices button_devices; |