mirror of
https://github.com/libretro/RetroArch.git
synced 2026-11-22 01:33:23 -10:00
The Pro Controller, and the pads that pass for one (8BitDo's in Switch mode among them), now give a core their accelerometer and gyroscope, read as SDL reads them: - The sensors' calibration is read from the pad's flash with the stick calibration: the factory's at 0x6020, then the user's origins at 0x8026 where the user calibrated. - Subcommand 0x40 turns the sensors on while a core asks for them and off when it is done, sent from the poll like the player lights. - Each report 0x30 carries three samples; the newest one is kept. The values go out in g and radians a second, on the axes SDL gives them, which are the DualShock 4's, and so on the same axes as winraw's DualShock 4 and DualSense. How it gets there: - Pad handlers can now have set_sensor and sensor ops. - hidraw and winusb route the driver's sensor calls to the slot's handler. - The hid joypad driver passes the frontend's set_sensor_state and get_sensor_input on to its hid driver. - The beside layer sends a hid pad's sensor calls to the hid driver rather than to the joypad driver it stands beside. connect_parity_test checks the calibration reads, the 0x40 commands and the values from a sample.