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:
authormarquezini <felipemarquesini10@gmail.com>2026-11-22 14:31:09 -0300
committermarquezini <felipemarquesini10@gmail.com>2026-11-22 14:31:09 -0300
commit2aed56c6e50c4fa577c50e5b10976ba9f9a7379f (patch)
tree17d97c52f6d32794c0a98f9fb75edd66beba3713 /docs/gameinput.md
parent49475796c226c8511b9470bf97a4daf57b8af323 (diff)
RT-176: IGameInputDispatcher::Dispatch honours its quota
Dispatch ran the whole queue whatever quota it was given. It now runs queued events oldest first, at least one per call (a quota of 0 runs exactly one, as the GDK documents), takes no further event once the quota has passed, and returns whether events remain. While events remain the wait handle is signalled again, so a title that waits on it before each call comes back for the rest. The automatic path (no dispatcher, poll thread) still delivers the whole queue. gameinput_test checks Dispatch(0), a 1 ms quota against a 5 ms callback, a large quota draining the queue, and an empty queue.
Diffstat (limited to 'docs/gameinput.md')
-rw-r--r--docs/gameinput.md8
1 files changed, 5 insertions, 3 deletions
diff --git a/docs/gameinput.md b/docs/gameinput.md
index f848ab0d2..383b16558 100644
--- a/docs/gameinput.md
+++ b/docs/gameinput.md
@@ -181,7 +181,9 @@ pads, closes removed ones, takes a reading of each, and applies rumble requests.
181the latest reading or leave a rumble request, so a call costs a lock and a copy. Callbacks (device, reading, guide 181the latest reading or leave a rumble request, so a call costs a lock and a copy. Callbacks (device, reading, guide
182button) run on that thread, as GameInput runs them on its own threads. Once the title creates a dispatcher 182button) run on that thread, as GameInput runs them on its own threads. Once the title creates a dispatcher
183(`IGameInput::CreateDispatcher`), callbacks are queued instead, the dispatcher's wait handle is signalled, and 183(`IGameInput::CreateDispatcher`), callbacks are queued instead, the dispatcher's wait handle is signalled, and
184`IGameInputDispatcher::Dispatch` runs them on the title's thread. 184`IGameInputDispatcher::Dispatch` runs them on the title's thread, oldest first, within its quota: at least one queued
185event per call (a quota of 0 runs exactly one), no further event once the quota has passed, and the wait handle is
186signalled again while events remain.
185 187
186The API surface: 188The API surface:
187 189
@@ -190,7 +192,7 @@ The API surface:
190| `IGameInput` | `GetCurrentTimestamp` (µs), `GetCurrentReading`, `GetNextReading`, `GetPreviousReading`, `RegisterReadingCallback`, `RegisterDeviceCallback` (blocking and async enumeration), `RegisterGuideButtonCallback`, `RegisterKeyboardLayoutCallback` (never fires), `StopCallback`, `UnregisterCallback`, `CreateDispatcher`, `FindDeviceFromId`, `EnableOemDeviceSupport` (no-op), `SetFocusPolicy` (no-op) | `GetTemporalReading`, `CreateAggregateDevice`, `FindDeviceFromObject/PlatformHandle/PlatformString` | 192| `IGameInput` | `GetCurrentTimestamp` (µs), `GetCurrentReading`, `GetNextReading`, `GetPreviousReading`, `RegisterReadingCallback`, `RegisterDeviceCallback` (blocking and async enumeration), `RegisterGuideButtonCallback`, `RegisterKeyboardLayoutCallback` (never fires), `StopCallback`, `UnregisterCallback`, `CreateDispatcher`, `FindDeviceFromId`, `EnableOemDeviceSupport` (no-op), `SetFocusPolicy` (no-op) | `GetTemporalReading`, `CreateAggregateDevice`, `FindDeviceFromObject/PlatformHandle/PlatformString` |
191| `IGameInputReading` | kind, sequence number, timestamp, device, gamepad state, UI navigation state, controller axes and buttons, motion state | raw report, keyboard, mouse, touch, arcade/flight stick, racing wheel (all return nothing) | 193| `IGameInputReading` | kind, sequence number, timestamp, device, gamepad state, UI navigation state, controller axes and buttons, motion state | raw report, keyboard, mouse, touch, arcade/flight stick, racing wheel (all return nothing) |
192| `IGameInputDevice` | device info, status, battery, `SetRumbleState` | force feedback and haptic motors (none reported), raw device I/O, power off, input synchronization (no-ops) | 194| `IGameInputDevice` | device info, status, battery, `SetRumbleState` | force feedback and haptic motors (none reported), raw device I/O, power off, input synchronization (no-ops) |
193| `IGameInputDispatcher` | `Dispatch`, `OpenWaitHandle` | the quota (the queue is short) | 195| `IGameInputDispatcher` | `Dispatch` (with its quota), `OpenWaitHandle` | |
194 196
195A device object stays alive for the whole process. When a pad is unplugged its status drops to 197A device object stays alive for the whole process. When a pad is unplugged its status drops to
196`GameInputDeviceNoStatus` and its device callback runs; when the same pad is plugged in again (matched by SDL GUID and 198`GameInputDeviceNoStatus` and its device callback runs; when the same pad is plugged in again (matched by SDL GUID and
@@ -256,7 +258,7 @@ shim fills (`GameInputDeviceInfo` 320 bytes with `deviceFamily` at 96 and the in
256 the fact, both directions, two pads interleaved and filtered by device, ageing out, held readings, unplug and 258 the fact, both directions, two pads interleaved and filtered by device, ageing out, held readings, unplug and
257 replug), the guide button, motor and trigger 259 replug), the guide button, motor and trigger
258 rumble as SDL receives them, the DualSense effect bytes in each `LEONIDA_DS_TRIGGERS` mode, the lightbar, a 260 rumble as SDL receives them, the DualSense effect bytes in each `LEONIDA_DS_TRIGGERS` mode, the lightbar, a
259 dispatcher, async and blocking enumeration, unregistering, unplugging and replugging, and three identical pads 261 dispatcher and its quota, async and blocking enumeration, unregistering, unplugging and replugging, and three identical pads
260 (an id each, `FindDeviceFromId` and device-filtered readings per pad, replugging one, two and all three, and the 262 (an id each, `FindDeviceFromId` and device-filtered readings per pad, replugging one, two and all three, and the
261 first twin's id equal to the single-pad id). Motion runs on a virtual pad with sensors (`nsensors` in the 263 first twin's id equal to the single-pad id). Motion runs on a virtual pad with sensors (`nsensors` in the
262 virtual-joystick description, fed with `SDL_SendJoystickVirtualSensorData`): the kind and `motionInfo` on a sensor 264 virtual-joystick description, fed with `SDL_SendJoystickVirtualSensorData`): the kind and `motionInfo` on a sensor