upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/docs/gameinput.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/gameinput.md')
-rw-r--r--docs/gameinput.md37
1 files changed, 30 insertions, 7 deletions
diff --git a/docs/gameinput.md b/docs/gameinput.md
index 90e0a3d2e..4b617b487 100644
--- a/docs/gameinput.md
+++ b/docs/gameinput.md
@@ -227,7 +227,9 @@ intensity 0; waveform indices other than 0 are `E_INVALIDARG`.
227Pads whose SDL gamepad reports both a gyroscope and an accelerometer (a DualSense, a Switch Pro, Steam Input pads) get 227Pads whose SDL gamepad reports both a gyroscope and an accelerometer (a DualSense, a Switch Pro, Steam Input pads) get
228`GameInputKindMotion` in `supportedInput` and a `motionInfo` (`GameInputMotionInfo`, Microsoft's v0 layout); `IGameInputReading::GetMotionState` 228`GameInputKindMotion` in `supportedInput` and a `motionInfo` (`GameInputMotionInfo`, Microsoft's v0 layout); `IGameInputReading::GetMotionState`
229returns a `GameInputMotionState` on their readings, and `GetCurrentReading`/`GetNextReading` answer a 229returns a `GameInputMotionState` on their readings, and `GetCurrentReading`/`GetNextReading` answer a
230`GameInputKindMotion` query for such a pad and return `GAMEINPUT_E_READING_NOT_FOUND` for a pad without sensors. The 230`GameInputKindMotion` query for such a pad and return `GAMEINPUT_E_READING_NOT_FOUND` for a pad without sensors. A
231reading callback registered for `GameInputKindMotion` hears only such pads: like a device callback, it is limited to
232devices that support at least one of the kinds it names (Microsoft's `RegisterReadingCallback` reference). The
231sensors are enabled when the pad is opened, at SDL's requested rate, and every poll reads the latest sample. 233sensors are enabled when the pad is opened, at SDL's requested rate, and every poll reads the latest sample.
232 234
233- The state carries **signed fractions of the maxima `motionInfo` reports** (1.0 = full magnitude), which is the 235- The state carries **signed fractions of the maxima `motionInfo` reports** (1.0 = full magnitude), which is the
@@ -451,8 +453,8 @@ rests on a transcription rather than on a side-by-side compile.
451 first twin's id equal to the single-pad id). Motion runs on a virtual pad with sensors (`nsensors` in the 453 first twin's id equal to the single-pad id). Motion runs on a virtual pad with sensors (`nsensors` in the
452 virtual-joystick description, fed with `SDL_SendJoystickVirtualSensorData`): the kind and `motionInfo` on a sensor 454 virtual-joystick description, fed with `SDL_SendJoystickVirtualSensorData`): the kind and `motionInfo` on a sensor
453 pad and not on a plain one, no motion before the first sample, normalisation against the `motionInfo` maxima, the 455 pad and not on a plain one, no motion before the first sample, normalisation against the `motionInfo` maxima, the
454 accuracy values, the ±1 clamp, the ~8 ms cadence, and that a motion query on a pad without sensors is 456 accuracy values, the ±1 clamp, the ~8 ms cadence, that a motion query on a pad without sensors is
455 `GAMEINPUT_E_READING_NOT_FOUND`. The keyboard pad is 457 `GAMEINPUT_E_READING_NOT_FOUND`, and that a Motion reading callback hears only the sensor pad. The keyboard pad is
456 driven through `rt::gameinput::set_keyboard_source` and `set_cursor_source` with fake keys, focus and cursor: every 458 driven through `rt::gameinput::set_keyboard_source` and `set_cursor_source` with fake keys, focus and cursor: every
457 binding, two keys at once, each WASD direction, opposite keys cancelling, diagonals, the mouse moving the right 459 binding, two keys at once, each WASD direction, opposite keys cancelling, diagonals, the mouse moving the right
458 stick, clamping and decaying to 0, the mouse-button triggers, no input out of focus, release of buttons, sticks and 460 stick, clamping and decaying to 0, the mouse-button triggers, no input out of focus, release of buttons, sticks and
@@ -464,6 +466,22 @@ rests on a transcription rather than on a side-by-side compile.
464 tables, the kind and status bits, a reading's raw report (newest declared id, without the id byte, an undeclared id 466 tables, the kind and status bits, a reading's raw report (newest declared id, without the id byte, an undeclared id
465 ignored), creating, sending and reading back output and feature reports with their id byte, `SetRawData`'s exact 467 ignored), creating, sending and reading back output and feature reports with their id byte, `SetRawData`'s exact
466 size, the item calls, `E_INVALIDARG` / `E_FAIL` / `E_NOTIMPL`, and the HID device closing on unplug. 468 size, the item calls, `E_INVALIDARG` / `E_FAIL` / `E_NOTIMPL`, and the HID device closing on unplug.
469- `gameinput_probe [--seconds N] [--rumble] [--force-feedback]` (by hand, with a pad connected): lists the pads with
470 each one's raw HID report tables (or why it has none), plays each motor and trigger for a second with `--rumble`,
471 holds a constant force at magnitude 1.0 on motor 0 for a second with `--force-feedback` (skipped, with the reason
472 printed, on a pad the shim reports no force-feedback motor for), and prints whether SDL created that effect and is
473 running it, separately from GameInput accepting it, then prints the live reading and the newest raw input report.
474
475On hardware so far, with `gameinput_probe` and SDL 3.4.20 on Windows 11: a DualSense (`054c:0ce6`) over USB. It
476connects as player 1 with trigger effects and gyro (`motors=0xf forcefeedback=0 haptic=2`). Pressed one at a time,
477each of the 14 gamepad buttons set the one bit of the name [Mapping](#mapping) gives it: Cross, Circle, Square and Triangle
478as `A`, `B`, `X` and `Y`, the d-pad, L1/R1, L3/R3, Create as `View` and Options as `Menu`. Both triggers reached
4791.00 and both sticks -1.00 and +1.00 on each axis. At rest the accelerometer read about 0.5 on one axis and the gyro
4800.0; shaking the pad by hand reached 1.00 on the accelerometer. With `--rumble` (the default `rumble` trigger mode)
481and `LEONIDA_DS_LIGHTBAR=00ff00`, the person holding the pad reported the motors, the trigger effects and the lightbar
482as working; nothing measured them, and the `resistance` mode was not tried.
483 size, the item calls, `E_INVALIDARG` / `E_FAIL` / `E_NOTIMPL`, the HID device closing on unplug, and a held
484 reading's `GetRawReport` waiting while a reconnect rebuilds the report tables.
467- `gameinput_probe [--seconds N] [--rumble]` (by hand, with a pad connected): lists the pads with each one's raw HID 485- `gameinput_probe [--seconds N] [--rumble]` (by hand, with a pad connected): lists the pads with each one's raw HID
468 report tables (or why it has none), plays each motor and trigger for a second with `--rumble`, then prints the live 486 report tables (or why it has none), plays each motor and trigger for a second with `--rumble`, then prints the live
469 reading and the newest raw input report. 487 reading and the newest raw input report.
@@ -489,7 +507,8 @@ These need the game executable or a test on hardware:
489- **`UnregisterCallback` timeout** is not honoured; it waits for a callback that is running. 507- **`UnregisterCallback` timeout** is not honoured; it waits for a callback that is running.
490- **Motion normalisation maxima** (2 g accel, 2000 deg/s gyro) are this shim's choice; SDL exposes no sensor range, 508- **Motion normalisation maxima** (2 g accel, 2000 deg/s gyro) are this shim's choice; SDL exposes no sensor range,
491 and whether the game reads motion, and against what scale, is unknown until it runs. The accelerometer range a 509 and whether the game reads motion, and against what scale, is unknown until it runs. The accelerometer range a
492 DualSense exposes can also be wider than 2 g, so hard shakes may clamp at 1.0. 510 DualSense exposes can also be wider than 2 g, so hard shakes may clamp at 1.0: a hand shake of a real DualSense
511 did reach 1.00 on one axis.
493- **Motion members the shim does not provide** (magnetic field, orientation) are zero with 512- **Motion members the shim does not provide** (magnetic field, orientation) are zero with
494 `GameInputMotionAccuracyUnknown`; whether a title wants a synthesised quaternion there is unknown. 513 `GameInputMotionAccuracyUnknown`; whether a title wants a synthesised quaternion there is unknown.
495- **Device family**: every pad is reported as `GameInputFamilyXboxOne`; a title that filters on family sees only 514- **Device family**: every pad is reported as `GameInputFamilyXboxOne`; a title that filters on family sees only
@@ -525,11 +544,15 @@ These need the game executable or a test on hardware:
525- **Haptic waveforms**: the single intensity waveform (usage 0x0F/0x58) is this shim's choice, not the pad's table, so 544- **Haptic waveforms**: the single intensity waveform (usage 0x0F/0x58) is this shim's choice, not the pad's table, so
526 a title that asks for a particular waveform gets intensity-only behaviour. Whether the game uses haptic motors at 545 a title that asks for a particular waveform gets intensity-only behaviour. Whether the game uses haptic motors at
527 all — as opposed to `SetRumbleState` — is unknown. 546 all — as opposed to `SetRumbleState` — is unknown.
528- **Raw HID on a real pad**: only the synthetic tests and the XInput refusal have run. 547- **Raw HID on a real pad**: the synthetic tests, the XInput refusal and one DualSense over USB have run.
529 - What ran: an Xbox Series X controller over Bluetooth on Windows 11 connects and plays normally, with no raw I/O, 548 - What ran: an Xbox Series X controller over Bluetooth on Windows 11 connects and plays normally, with no raw I/O,
530 and the log names the reason. 549 and the log names the reason.
531 - Still to confirm: a DualSense, DualShock 4 or Switch Pro through `gameinput_probe`, which should print the 550 - What ran: a DualSense (`054c:0ce6`) over USB on Windows 11 through `gameinput_probe`. Its descriptor gives 1
532 descriptor's reports and changing raw input bytes. 551 input report (id 1, 63 bytes), 1 output report (id 2, 47 bytes) and 20 feature reports, and the raw input report
552 changed on every reading (2,442 distinct reports in a 40 s capture). No output or feature report was sent
553 through the raw calls.
554 - Still to confirm: a DualSense over Bluetooth, a DualShock 4 or a Switch Pro through `gameinput_probe`, which
555 should print the descriptor's reports and changing raw input bytes.
533 - Size convention: report sizes exclude the id byte, and `GetRawData` returns the payload without it. What 556 - Size convention: report sizes exclude the id byte, and `GetRawData` returns the payload without it. What
534 Microsoft's runtime does for a device with report ids is not documented on the reference pages. 557 Microsoft's runtime does for a device with report ids is not documented on the reference pages.
535 - Readings: a pad that streams reports makes a reading for each changed one, like the runtime's 558 - Readings: a pad that streams reports makes a reading for each changed one, like the runtime's