diff options
author | Narr the Reg <juangerman-13@hotmail.com> | 2023-04-12 04:39:05 +0200 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2023-06-03 09:05:56 +0200 |
commit | 5c1310dc5ddc022f70d376325e6c112e95348344 (patch) | |
tree | cc5c49deb2482c72b6a86bf3aa497def4cc4a8b1 /src/core/hid/emulated_controller.cpp | |
parent | android: Change wording for "Add Games" button (#100) (diff) | |
download | yuzu-5c1310dc5ddc022f70d376325e6c112e95348344.tar yuzu-5c1310dc5ddc022f70d376325e6c112e95348344.tar.gz yuzu-5c1310dc5ddc022f70d376325e6c112e95348344.tar.bz2 yuzu-5c1310dc5ddc022f70d376325e6c112e95348344.tar.lz yuzu-5c1310dc5ddc022f70d376325e6c112e95348344.tar.xz yuzu-5c1310dc5ddc022f70d376325e6c112e95348344.tar.zst yuzu-5c1310dc5ddc022f70d376325e6c112e95348344.zip |
Diffstat (limited to '')
-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() { Common::Input::CreateInputDevice); std::ranges::transform(virtual_stick_params, virtual_stick_devices.begin(), Common::Input::CreateInputDevice); + std::ranges::transform(virtual_motion_params, virtual_motion_devices.begin(), + Common::Input::CreateInputDevice); } void EmulatedController::LoadTASParams() { @@ -253,6 +255,12 @@ void EmulatedController::LoadVirtualGamepadParams() { for (auto& param : virtual_stick_params) { param = common_params; } + for (auto& param : virtual_stick_params) { + param = common_params; + } + for (auto& param : virtual_motion_params) { + param = common_params; + } // TODO(german77): Replace this with an input profile or something better virtual_button_params[Settings::NativeButton::A].Set("button", 0); @@ -284,6 +292,9 @@ void EmulatedController::LoadVirtualGamepadParams() { virtual_stick_params[Settings::NativeAnalog::LStick].Set("range", 1.0f); virtual_stick_params[Settings::NativeAnalog::RStick].Set("deadzone", 0.0f); virtual_stick_params[Settings::NativeAnalog::RStick].Set("range", 1.0f); + + virtual_motion_params[Settings::NativeMotion::MotionLeft].Set("motion", 0); + virtual_motion_params[Settings::NativeMotion::MotionRight].Set("motion", 0); } void EmulatedController::ReloadInput() { @@ -463,6 +474,18 @@ void EmulatedController::ReloadInput() { }, }); } + + for (std::size_t index = 0; index < virtual_motion_devices.size(); ++index) { + if (!virtual_motion_devices[index]) { + continue; + } + virtual_motion_devices[index]->SetCallback({ + .on_change = + [this, index](const Common::Input::CallbackStatus& callback) { + SetMotion(callback, index); + }, + }); + } turbo_button_state = 0; } @@ -500,6 +523,9 @@ void EmulatedController::UnloadInput() { for (auto& stick : virtual_stick_devices) { stick.reset(); } + for (auto& motion : virtual_motion_devices) { + motion.reset(); + } for (auto& camera : camera_devices) { camera.reset(); } |