diff options
| author | 2023-02-12 00:19:22 -0800 | |
|---|---|---|
| committer | 2023-02-12 00:19:22 -0800 | |
| commit | 8b74047b1b4eac10c6152a18920d0a8e1861fecd (patch) | |
| tree | 74a64e8a680771cede461bb0945fa4242deae2ed /src/core/hid/emulated_controller.cpp | |
| parent | Merge pull request #9746 from ameerj/ogl-msaa-texcache (diff) | |
| parent | core: hid: Use gyro thresholds modes set by the game (diff) | |
| download | yuzu-8b74047b1b4eac10c6152a18920d0a8e1861fecd.tar.gz yuzu-8b74047b1b4eac10c6152a18920d0a8e1861fecd.tar.xz yuzu-8b74047b1b4eac10c6152a18920d0a8e1861fecd.zip | |
Merge pull request #9757 from german77/gyro
core: hid: Use gyro thresholds modes set by the game
Diffstat (limited to 'src/core/hid/emulated_controller.cpp')
| -rw-r--r-- | src/core/hid/emulated_controller.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/core/hid/emulated_controller.cpp b/src/core/hid/emulated_controller.cpp index 631aa6ad2..6d5a3dead 100644 --- a/src/core/hid/emulated_controller.cpp +++ b/src/core/hid/emulated_controller.cpp | |||
| @@ -957,7 +957,7 @@ void EmulatedController::SetMotion(const Common::Input::CallbackStatus& callback | |||
| 957 | raw_status.gyro.y.value, | 957 | raw_status.gyro.y.value, |
| 958 | raw_status.gyro.z.value, | 958 | raw_status.gyro.z.value, |
| 959 | }); | 959 | }); |
| 960 | emulated.SetGyroThreshold(raw_status.gyro.x.properties.threshold); | 960 | emulated.SetUserGyroThreshold(raw_status.gyro.x.properties.threshold); |
| 961 | emulated.UpdateRotation(raw_status.delta_timestamp); | 961 | emulated.UpdateRotation(raw_status.delta_timestamp); |
| 962 | emulated.UpdateOrientation(raw_status.delta_timestamp); | 962 | emulated.UpdateOrientation(raw_status.delta_timestamp); |
| 963 | force_update_motion = raw_status.force_update; | 963 | force_update_motion = raw_status.force_update; |
| @@ -1284,6 +1284,26 @@ void EmulatedController::SetLedPattern() { | |||
| 1284 | } | 1284 | } |
| 1285 | } | 1285 | } |
| 1286 | 1286 | ||
| 1287 | void EmulatedController::SetGyroscopeZeroDriftMode(GyroscopeZeroDriftMode mode) { | ||
| 1288 | for (auto& motion : controller.motion_values) { | ||
| 1289 | switch (mode) { | ||
| 1290 | case GyroscopeZeroDriftMode::Loose: | ||
| 1291 | motion_sensitivity = motion.emulated.IsAtRestLoose; | ||
| 1292 | motion.emulated.SetGyroThreshold(motion.emulated.ThresholdLoose); | ||
| 1293 | break; | ||
| 1294 | case GyroscopeZeroDriftMode::Tight: | ||
| 1295 | motion_sensitivity = motion.emulated.IsAtRestThight; | ||
| 1296 | motion.emulated.SetGyroThreshold(motion.emulated.ThresholdThight); | ||
| 1297 | break; | ||
| 1298 | case GyroscopeZeroDriftMode::Standard: | ||
| 1299 | default: | ||
| 1300 | motion_sensitivity = motion.emulated.IsAtRestStandard; | ||
| 1301 | motion.emulated.SetGyroThreshold(motion.emulated.ThresholdStandard); | ||
| 1302 | break; | ||
| 1303 | } | ||
| 1304 | } | ||
| 1305 | } | ||
| 1306 | |||
| 1287 | void EmulatedController::SetSupportedNpadStyleTag(NpadStyleTag supported_styles) { | 1307 | void EmulatedController::SetSupportedNpadStyleTag(NpadStyleTag supported_styles) { |
| 1288 | supported_style_tag = supported_styles; | 1308 | supported_style_tag = supported_styles; |
| 1289 | if (!is_connected) { | 1309 | if (!is_connected) { |