diff options
| author | Tauwni <102470988+Tauwni@users.noreply.github.com> | 2026-11-26 04:01:08 +0100 |
|---|---|---|
| committer | Tauwni <102470988+Tauwni@users.noreply.github.com> | 2026-11-26 04:01:08 +0100 |
| commit | 5af6cd3d69dc69baec78aa06fc418fc4bcbf83b5 (patch) | |
| tree | 4529bc04eac714e9c393fb1085bb1d67169843c0 /docs/gameinput.md | |
| parent | 459cbb9b19193ffd4fbb18442497bc885de8c728 (diff) | |
| parent | 7f3d0095a2d51892bc7048f24505c37168f25c34 (diff) | |
Merge remote-tracking branch 'origin/main' into gpu-results-m3
# Conflicts:
# docs/gpu_test_results.md
Diffstat (limited to 'docs/gameinput.md')
| -rw-r--r-- | docs/gameinput.md | 53 |
1 files changed, 47 insertions, 6 deletions
diff --git a/docs/gameinput.md b/docs/gameinput.md index feed39153..1301a4a49 100644 --- a/docs/gameinput.md +++ b/docs/gameinput.md | |||
| @@ -37,10 +37,42 @@ SDL3 is available in one of these ways: | |||
| 37 | - **A local copy of that tarball**: extract it and pass `-DFETCHCONTENT_SOURCE_DIR_SDL3=<path to SDL3-3.4.20>`; it is | 37 | - **A local copy of that tarball**: extract it and pass `-DFETCHCONTENT_SOURCE_DIR_SDL3=<path to SDL3-3.4.20>`; it is |
| 38 | built the same way, without a download. | 38 | built the same way, without a download. |
| 39 | 39 | ||
| 40 | Without any of these, or with `-DLEONIDA_SDL3=OFF`, configure prints a message and `gta6rt` is built without the shim: | 40 | Without any of these, or with `-DLEONIDA_SDL3=OFF`, configure prints a message and `gta6rt` is built without the SDL3 |
| 41 | it has no `GameInputCreate`, as before, so the loader binds it to the host's `GameInput.dll` or the unimplemented | 41 | shim. It links `runtime/shims/gameinput_no_sdl.cpp` instead, which still serves `GameInputCreate` (by name and as |
| 42 | thunk. `gameinput_test` and `gameinput_probe` are not built, and CTest lists `gameinput` as not run (disabled) rather | 42 | `gameinput.dll!#1`): with no devices, or with `LEONIDA_INPUT_SCRIPT` set with one scripted pad (see |
| 43 | than failing. | 43 | [Scripted input without SDL3](#scripted-input-without-sdl3)). `gameinput_test` and `gameinput_probe` are not built, |
| 44 | and CTest lists `gameinput` and `gameinput_script` as not run (disabled) rather than failing; `gameinput_no_sdl` and | ||
| 45 | `gameinput_no_sdl_script` run instead. | ||
| 46 | |||
| 47 | ### Scripted input without SDL3 | ||
| 48 | |||
| 49 | The Windows artifacts of CI and offline builds have no SDL3. Without a device, the title waits at its first "press A" | ||
| 50 | prompt forever, so no headless or CI run could get past it. With `LEONIDA_INPUT_SCRIPT` set, such a build serves one | ||
| 51 | scripted pad, driven by the script alone: | ||
| 52 | |||
| 53 | - **The device:** an Xbox One gamepad named `Scripted pad (Leonida)`, connected from the first `GameInputCreate`. It | ||
| 54 | is reported by `RegisterDeviceCallback` enumeration (blocking on the caller's thread, async from a thread of the | ||
| 55 | shim, or through `IGameInputDispatcher::Dispatch` once the title made a dispatcher) and found by `FindDeviceFromId`. | ||
| 56 | It is already connected, so a callback registered without enumeration hears nothing. | ||
| 57 | - **The readings:** `GetCurrentReading`, `GetNextReading` and `GetPreviousReading`, with gamepad, UI navigation, | ||
| 58 | controller axis and controller button state. A reading is taken when the title asks for one and the script's state | ||
| 59 | has changed since the last, so no thread polls; the history keeps the last 64 readings. | ||
| 60 | - **The timeline:** the same as with SDL3 (`runtime/shims/gameinput_script.h` holds the parser, the timeline and the | ||
| 61 | log lines for both): seconds from the first `GameInputCreate`, each press held 300 ms, then released. | ||
| 62 | - **Not served:** reading callbacks, aggregate devices, rumble and every other device. Those slots answer `E_NOTIMPL` | ||
| 63 | and log the slot once. Controllers and the [keyboard pad](#keyboard-pad) still need SDL3. | ||
| 64 | |||
| 65 | The start of the run logs one line with the counts, and each press logs the same lines as with SDL3: | ||
| 66 | |||
| 67 | ```text | ||
| 68 | [rt] gameinput: served without SDL3: one scripted pad for LEONIDA_INPUT_SCRIPT (3 scripted press(es), 0 rejected); controllers and the keyboard pad need SDL3 | ||
| 69 | [rt] gameinput: scripted press of button 0 at 40.0 s | ||
| 70 | [rt] gameinput: press a@40.0 (Scripted pad (Leonida)) | ||
| 71 | ``` | ||
| 72 | |||
| 73 | A press is logged when the title reads it, so a press the title never reads is not logged. `LEONIDA_INPUT_LOG=0` | ||
| 74 | turns the `press` lines off. Without `LEONIDA_INPUT_SCRIPT`, the shim serves no devices and answers `E_NOTIMPL` for | ||
| 75 | every slot past `Release`, as before. | ||
| 44 | 76 | ||
| 45 | `scripts/build_runtime.ps1` (what `make_game.py` runs) builds the shim only on its CMake path, when Visual Studio's | 77 | `scripts/build_runtime.ps1` (what `make_game.py` runs) builds the shim only on its CMake path, when Visual Studio's |
| 46 | C++ CMake tools are installed. Its direct-`cl.exe` fallback compiles a fixed file list without the shim and warns | 78 | C++ CMake tools are installed. Its direct-`cl.exe` fallback compiles a fixed file list without the shim and warns |
| @@ -81,7 +113,8 @@ The title reads gamepads only, so keyboard input has to arrive as a gamepad. Wit | |||
| 81 | shim attaches one SDL virtual gamepad named `Keyboard pad (Leonida)` and presses its buttons from the keyboard on | 113 | shim attaches one SDL virtual gamepad named `Keyboard pad (Leonida)` and presses its buttons from the keyboard on |
| 82 | every poll. It then goes through the same path as a real pad: a device object, the next free player slot, readings, | 114 | every poll. It then goes through the same path as a real pad: a device object, the next free player slot, readings, |
| 83 | reading and device callbacks, and UI navigation derived from its buttons. It reports no rumble motors. It is off by | 115 | reading and device callbacks, and UI navigation derived from its buttons. It reports no rumble motors. It is off by |
| 84 | default. | 116 | default. If SDL fails to attach or open the keyboard pad, the shim retries after one second while the pad is |
| 117 | enabled. Only the first failure in a continuous series is logged; turning the pad off and back on retries immediately. | ||
| 85 | 118 | ||
| 86 | | key | button | | 119 | | key | button | |
| 87 | |---|---| | 120 | |---|---| |
| @@ -302,7 +335,7 @@ line is logged when it takes effect); tracking goes on underneath, so clearing i | |||
| 302 | | `LEONIDA_PROMPTS_SWITCH_MS` | `300` | shortest time between two changes of the active input family, 0..2000 ms | | 335 | | `LEONIDA_PROMPTS_SWITCH_MS` | `300` | shortest time between two changes of the active input family, 0..2000 ms | |
| 303 | | `LEONIDA_GAMEINPUT_THREAD` | `1` | `0` stops the background poll thread; only `rt::gameinput::poll()` then reads the pads (tests) | | 336 | | `LEONIDA_GAMEINPUT_THREAD` | `1` | `0` stops the background poll thread; only `rt::gameinput::poll()` then reads the pads (tests) | |
| 304 | | `LEONIDA_KEYBOARD_PAD` | `off` | `1` adds the [keyboard pad](#keyboard-pad), read while this process has focus; `always` reads keys whatever has focus | | 337 | | `LEONIDA_KEYBOARD_PAD` | `off` | `1` adds the [keyboard pad](#keyboard-pad), read while this process has focus; `always` reads keys whatever has focus | |
| 305 | | `LEONIDA_INPUT_SCRIPT` | unset | With the keyboard pad enabled, set comma-separated `button@seconds` entries, e.g. `a@2,a@4,start@6`. The first pad update reads the script once at startup and starts the clock. `reload_config()` does not reread it. Each press lasts 300 ms. Buttons are `a b x y start back lb rb up down left right`. Spaces around entries are allowed. Empty entries, unknown buttons and invalid times (including negative or non-finite values) are counted and ignored. | | 338 | | `LEONIDA_INPUT_SCRIPT` | unset | Comma-separated `button@seconds` entries, e.g. `a@2,a@4,start@6`. With SDL3 they drive the keyboard pad, which has to be enabled; without SDL3 they drive [one scripted pad](#scripted-input-without-sdl3), the only device. The first pad update (without SDL3, the first `GameInputCreate`) reads the script once at startup and starts the clock. `reload_config()` does not reread it. Each press lasts 300 ms. Buttons are `a b x y start back lb rb up down left right`. Spaces around entries are allowed. Empty entries, unknown buttons and invalid times (including negative or non-finite values) are counted and ignored. | |
| 306 | | `LEONIDA_MOUSE_SENSITIVITY` | `1` | scales how far the mouse moves the keyboard pad's right stick, 0.1..10 | | 339 | | `LEONIDA_MOUSE_SENSITIVITY` | `1` | scales how far the mouse moves the keyboard pad's right stick, 0.1..10 | |
| 307 | 340 | ||
| 308 | SDL's own hints (`SDL_JOYSTICK_*`, see SDL's `SDL_hints.h`) also apply, for example `SDL_JOYSTICK_HIDAPI_PS5=0` to | 341 | SDL's own hints (`SDL_JOYSTICK_*`, see SDL's `SDL_hints.h`) also apply, for example `SDL_JOYSTICK_HIDAPI_PS5=0` to |
| @@ -457,6 +490,14 @@ rests on a transcription rather than on a side-by-side compile. | |||
| 457 | button, the touchpad, a trigger or a stick, stick drift and a one-count mouse jitter ignored, a real mouse movement | 490 | button, the touchpad, a trigger or a stick, stick drift and a one-count mouse jitter ignored, a real mouse movement |
| 458 | counted, the 300 ms window on the real clock, and `LEONIDA_PROMPTS` forcing, changing, ignoring an unknown value | 491 | counted, the 300 ms window on the real clock, and `LEONIDA_PROMPTS` forcing, changing, ignoring an unknown value |
| 459 | and clearing. | 492 | and clearing. |
| 493 | - `gameinput_no_sdl_test` (CTest, only in a build without SDL3, no controller): `gameinput_no_sdl` checks the | ||
| 494 | identity-only object (both names served, `AddRef`/`Release`, `E_NOTIMPL` without touching the out-parameter). | ||
| 495 | `gameinput_no_sdl_script` sets `LEONIDA_INPUT_SCRIPT` with overlapping presses, a mixed-case name, `rsup` and three | ||
| 496 | rejected entries, puts the shim on a fake clock and checks the scripted pad: blocking, async and dispatcher | ||
| 497 | enumeration (and none without enumeration, for another status or another kind), the device info, `FindDeviceFromId`, | ||
| 498 | the buttons, UI navigation and right stick read at chosen times (held for 0.3 s, a later press of the same button | ||
| 499 | not cut short, nothing after the script), no new reading without a change, `GetPreviousReading` and | ||
| 500 | `GetNextReading`, no motion, and reading callbacks answering `E_NOTIMPL`. | ||
| 460 | - `gameinput_test` (CTest, no controller): turns SDL's real backends off and drives the shim through | 501 | - `gameinput_test` (CTest, no controller): turns SDL's real backends off and drives the shim through |
| 461 | `rt::shims::find` with SDL virtual joysticks, an Xbox-style pad with trigger motors, a DualSense (Sony | 502 | `rt::shims::find` with SDL virtual joysticks, an Xbox-style pad with trigger motors, a DualSense (Sony |
| 462 | `054c:0ce6`) and a pad without trigger motors. It checks enumeration and device callbacks, the button, stick, | 503 | `054c:0ce6`) and a pad without trigger motors. It checks enumeration and device callbacks, the button, stick, |