Commit Graph
28 Commits
Author SHA1 Message Date
Henrik RydgårdandClaude Opus 5.5 fbf0cc2df4 Android: Detect the accelerometer and gyro instead of assuming them
SYSPROP_HAS_ACCELEROMETER was true for every phone and tablet, whether or
not it had the sensor. The activity now tells the native side what the
sensor manager found, which also answers the new SYSPROP_HAS_GYRO. VR
headsets still report neither. Every other platform returns false for the
gyro for now.

The "Use gyroscope" checkbox uses the new property instead of waiting for
gyro data to show up.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-21 12:20:20 +02:00
Henrik RydgårdandClaude Opus 5.5 010a9c7e2a Tilt: Add the right analog stick as a tilt output
Appended to the end of the tilt types, so stored values keep their meaning.
It shares the left stick's deadzone settings and preview, and like other
right-stick input it goes to CTRL_STICK_RIGHT.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-21 10:49:00 +02:00
Henrik RydgårdandClaude Opus 5.5 f84e63f753 Tilt: Steady the tilt input with the gyroscope where there is one
Tilt used the raw accelerometer as the gravity vector, which jitters with
sensor noise and jumps when the device is shaken. Now, when gyro data is
coming in, a complementary filter integrates the gyro rates and only pulls
the result toward the accelerometer with a 0.5 s time constant, trusting
the accelerometer less the further it reads from 1g. The fused vector goes
through the same ProcessTilt path, so calibration and sensitivity work as
before. Without a gyro, nothing changes.

The fusion lives in TiltEventProcessor behind NativeGyroscope(), so other
sources (DualSense) can feed it too. Android registers TYPE_GYROSCOPE next
to the accelerometer. A "Use gyroscope" checkbox (on by default, per game)
appears in tilt setup once gyro data has been seen.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-21 10:45:37 +02:00
Henrik Rydgård ab0fa898ae Fix the latent tail from the Common/Core review
Buffer::PeekAll resized the destination and then appended, so it returned twice the
data with zeros in front. No callers today.

The assert dialog's caption was a function-local static, so it froze at whichever
kind of assert fired first in the session - a later Critical Assert would still be
titled 'Debug Assert'. Made it a plain const char *.

containsNoCase passed a possibly-negative char to std::toupper, which is UB for
anything but EOF; non-ASCII bytes get here from ELF symbol names.

ApplyDeadzoneXY's circular path lacked the deadzone >= 0.99f guard its own sibling
ApplyDeadzoneAxis has one function above, so it divided by ~0.
2026-10-16 18:14:44 +02:00
Henrik Rydgård d6d2c24e24 Fix the toggle touch controls input (properly this time) 2026-02-05 09:44:42 +01:00
Henrik Rydgård f546dc3835 Add an Enable checkbox to tilt control, add mappable control
- Fixes #20830
2026-02-05 09:44:11 +01:00
Henrik Rydgård 09e067c6e1 Revert "Get rid of remains of support for non-square screen DPIs"
This reverts commit f206ed95eb.
2025-05-21 21:41:50 +02:00
Henrik Rydgård f206ed95eb Get rid of remains of support for non-square screen DPIs 2025-02-20 11:14:26 -06:00
Henrik Rydgård 4dd3621fa0 Remove some unnecessary <algorithm> includes. 2024-12-18 17:04:27 +01:00
Henrik Rydgård d397635e49 Mouse input: Approximate the old smoothing function 2023-12-14 19:24:39 +01:00
Henrik Rydgård 7b0ee5440d Move the mouse event processing code out from NativeApp 2023-12-14 19:01:19 +01:00
Henrik Rydgård 94fb81466f Tilt: Make the deadzone circular, in addition to the inverse (low end radius). 2023-12-12 17:55:13 +01:00
Henrik Rydgård 4f2f1c4392 Tilt: Fix some edge cases leading to division by zero and similar. 2023-11-09 19:14:31 +01:00
Henrik Rydgård 3b004e7a4b Remove the last use of accelerometer axis events (calibration) 2023-09-27 11:33:40 +02:00
Henrik Rydgård 2ceb9942f3 Tilt: Add back inverse deadzone (low end radius). Allow choosing circular or per-axis. 2023-05-22 10:13:57 +02:00
Henrik Rydgård 53ed8a164e Prevent tilt-controlled left/right dpad butons from getting stuck
Silly typo from the input refactoring.

Fixes #17384
2023-05-02 22:29:30 +02:00
Henrik Rydgård 04d3d3111c Clean up __Ctrl button functions. 2023-04-01 08:55:45 +02:00
Henrik Rydgård 38f4cc4cc9 Make reverse mapping lookup work for the simple PSP buttons. 2023-03-31 11:05:29 +02:00
Henrik Rydgård 64e80423a6 Simplify the tilt code, tweak a bit 2023-02-16 11:07:57 +01:00
Henrik Rydgård 3e286b7a27 Apply sensitivity before deadzone. Feels more intuitive 2023-02-16 10:35:38 +01:00
Henrik Rydgård a288c59841 Simplify tilt, step 1 2023-02-16 10:33:47 +01:00
Henrik Rydgård 7d40ed6ba1 Tilt control: Split the deadzone parameter since it needs to be different for different types.
Can at least share the string without problems.

Also rearrange the settings a little bit.
2023-02-11 23:42:55 +01:00
Unknown W. Brackets 2cada63087 UI: Buildfix on MSVC 2017. 2023-02-02 17:08:24 -08:00
Henrik Rydgård af8e4cd36b Fixes for portrait mode. Move the haptic feedback setting where it belongs. 2023-02-02 11:59:56 +01:00
Henrik Rydgård 59dec197d8 Add previews for more types, fix mappings. 2023-02-02 01:09:33 +01:00
Henrik Rydgård 1f51a31544 Remove the separate deadzone-skip value. 2023-02-02 01:09:30 +01:00
Henrik Rydgård 4aeb1ef703 Better math, fix tilt calibration (was entirely broken) 2023-02-02 01:01:05 +01:00
Henrik Rydgård 3b36a1bb66 TiltEventProcessor belongs in Core, not UI. 2023-02-01 15:04:32 +01:00