Files
ppsspp/Core/TiltEventProcessor.h
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

34 lines
1.3 KiB
C++

#pragma once
#include "Common/Math/lin/vec3.h"
namespace TiltEventProcessor {
// generates a tilt in the correct coordinate system based on
// calibration. x, y, z is the current accelerometer reading (with no conversion).
void ProcessTilt(bool landscape, const float calibrationAngle, float x, float y, float z, bool invertX, bool invertY, float xSensitivity, float ySensitivity);
void ResetTiltEvents();
// Steadies the gravity vector by integrating gyroscope rates, and only slowly pulling the result toward the
// accelerometer. Both use the same device axes. Rates are in rad/s, the timestamp in seconds.
// ProcessGyro returns false until there's an accelerometer reading to start from.
void ProcessAccelerometerForFusion(float x, float y, float z);
bool ProcessGyro(float x, float y, float z, double timestamp, Lin::Vec3 *gravity);
// True if gyro data arrived recently, in which case the accelerometer shouldn't drive tilt directly.
bool GyroActive();
float GetCurrentYAngle();
// Lets you preview the amount of tilt in TiltAnalogSettingsScreen.
extern float rawTiltAnalogX;
extern float rawTiltAnalogY;
} // namespace
namespace MouseEventProcessor {
void ProcessDelta(double now, float dx, float dy);
void MouseDeltaToAxes(double now, float *mx, float *my);
} // namespace