diff options
| author | 2023-06-05 21:43:43 -0700 | |
|---|---|---|
| committer | 2023-06-05 21:43:43 -0700 | |
| commit | cb95d7fe1b6d81899fe6b279400da2c991e3132c (patch) | |
| tree | a856ac45b1053009c4c11ee141c49d7faa4c8a19 /src/core/hid/emulated_controller.cpp | |
| parent | Merge pull request #10611 from liamwhite/audio-deadlock (diff) | |
| parent | Merge pull request #10633 from t895/variable-surface-ratio (diff) | |
| download | yuzu-cb95d7fe1b6d81899fe6b279400da2c991e3132c.tar.gz yuzu-cb95d7fe1b6d81899fe6b279400da2c991e3132c.tar.xz yuzu-cb95d7fe1b6d81899fe6b279400da2c991e3132c.zip | |
Merge pull request #10508 from yuzu-emu/lime
Project Lime - yuzu Android Port
Diffstat (limited to 'src/core/hid/emulated_controller.cpp')
| -rw-r--r-- | src/core/hid/emulated_controller.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/core/hid/emulated_controller.cpp b/src/core/hid/emulated_controller.cpp index bbfea7117..0a7777732 100644 --- a/src/core/hid/emulated_controller.cpp +++ b/src/core/hid/emulated_controller.cpp | |||
| @@ -193,6 +193,8 @@ void EmulatedController::LoadDevices() { | |||
| 193 | Common::Input::CreateInputDevice); | 193 | Common::Input::CreateInputDevice); |
| 194 | std::ranges::transform(virtual_stick_params, virtual_stick_devices.begin(), | 194 | std::ranges::transform(virtual_stick_params, virtual_stick_devices.begin(), |
| 195 | Common::Input::CreateInputDevice); | 195 | Common::Input::CreateInputDevice); |
| 196 | std::ranges::transform(virtual_motion_params, virtual_motion_devices.begin(), | ||
| 197 | Common::Input::CreateInputDevice); | ||
| 196 | } | 198 | } |
| 197 | 199 | ||
| 198 | void EmulatedController::LoadTASParams() { | 200 | void EmulatedController::LoadTASParams() { |
| @@ -253,6 +255,12 @@ void EmulatedController::LoadVirtualGamepadParams() { | |||
| 253 | for (auto& param : virtual_stick_params) { | 255 | for (auto& param : virtual_stick_params) { |
| 254 | param = common_params; | 256 | param = common_params; |
| 255 | } | 257 | } |
| 258 | for (auto& param : virtual_stick_params) { | ||
| 259 | param = common_params; | ||
| 260 | } | ||
| 261 | for (auto& param : virtual_motion_params) { | ||
| 262 | param = common_params; | ||
| 263 | } | ||
| 256 | 264 | ||
| 257 | // TODO(german77): Replace this with an input profile or something better | 265 | // TODO(german77): Replace this with an input profile or something better |
| 258 | virtual_button_params[Settings::NativeButton::A].Set("button", 0); | 266 | virtual_button_params[Settings::NativeButton::A].Set("button", 0); |
| @@ -284,6 +292,9 @@ void EmulatedController::LoadVirtualGamepadParams() { | |||
| 284 | virtual_stick_params[Settings::NativeAnalog::LStick].Set("range", 1.0f); | 292 | virtual_stick_params[Settings::NativeAnalog::LStick].Set("range", 1.0f); |
| 285 | virtual_stick_params[Settings::NativeAnalog::RStick].Set("deadzone", 0.0f); | 293 | virtual_stick_params[Settings::NativeAnalog::RStick].Set("deadzone", 0.0f); |
| 286 | virtual_stick_params[Settings::NativeAnalog::RStick].Set("range", 1.0f); | 294 | virtual_stick_params[Settings::NativeAnalog::RStick].Set("range", 1.0f); |
| 295 | |||
| 296 | virtual_motion_params[Settings::NativeMotion::MotionLeft].Set("motion", 0); | ||
| 297 | virtual_motion_params[Settings::NativeMotion::MotionRight].Set("motion", 0); | ||
| 287 | } | 298 | } |
| 288 | 299 | ||
| 289 | void EmulatedController::ReloadInput() { | 300 | void EmulatedController::ReloadInput() { |
| @@ -463,6 +474,18 @@ void EmulatedController::ReloadInput() { | |||
| 463 | }, | 474 | }, |
| 464 | }); | 475 | }); |
| 465 | } | 476 | } |
| 477 | |||
| 478 | for (std::size_t index = 0; index < virtual_motion_devices.size(); ++index) { | ||
| 479 | if (!virtual_motion_devices[index]) { | ||
| 480 | continue; | ||
| 481 | } | ||
| 482 | virtual_motion_devices[index]->SetCallback({ | ||
| 483 | .on_change = | ||
| 484 | [this, index](const Common::Input::CallbackStatus& callback) { | ||
| 485 | SetMotion(callback, index); | ||
| 486 | }, | ||
| 487 | }); | ||
| 488 | } | ||
| 466 | turbo_button_state = 0; | 489 | turbo_button_state = 0; |
| 467 | } | 490 | } |
| 468 | 491 | ||
| @@ -500,6 +523,9 @@ void EmulatedController::UnloadInput() { | |||
| 500 | for (auto& stick : virtual_stick_devices) { | 523 | for (auto& stick : virtual_stick_devices) { |
| 501 | stick.reset(); | 524 | stick.reset(); |
| 502 | } | 525 | } |
| 526 | for (auto& motion : virtual_motion_devices) { | ||
| 527 | motion.reset(); | ||
| 528 | } | ||
| 503 | for (auto& camera : camera_devices) { | 529 | for (auto& camera : camera_devices) { |
| 504 | camera.reset(); | 530 | camera.reset(); |
| 505 | } | 531 | } |