diff options
| author | NotRexed <therealnothingfn@gmail.com> | 2026-11-26 02:12:27 -0500 |
|---|---|---|
| committer | NotRexed <therealnothingfn@gmail.com> | 2026-11-26 02:12:27 -0500 |
| commit | c8e826a3d8051e8db9875be5baed9d731450965b (patch) | |
| tree | c4212184253ed17ede78bdc233ba5e181b204ce4 /docs/gameinput.md | |
| parent | fb30806d8fb33a254825229d700af9798bdaa7a8 (diff) | |
gameinput: XInput, DualSense and keyboard shim for builds without SDL3
Port VIctory's GameInput module (gameinput.rs, gameinput/dualsense.rs,
GPL-3.0-or-later) as shims/gameinput_xinput.cpp: XInput pads 0-3, a
wired DualSense over HID, the keyboard as its own device, and a keyboard
pad that stands in while no other pad is connected. Readings per change
with a 32-deep history, blocking and async device enumeration,
UnregisterCallback waiting for a running callback, FindDeviceFromId and
XInput rumble, all as VIctory runs the title.
It is built into gta6rt when the SDL3 shim is not (the main build has no
SDL3), instead of binding the import to the host's GameInput.dll, which
has no keyboard pad; LEONIDA_GAMEINPUT=host keeps that path and
LEONIDA_KEYBOARD_PAD=off drops the keyboard pad. Registered by name and
ordinal #1. gameinput_xinput_test runs it over a fake host.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'docs/gameinput.md')
| -rw-r--r-- | docs/gameinput.md | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/docs/gameinput.md b/docs/gameinput.md index a9fee120b..27366eb52 100644 --- a/docs/gameinput.md +++ b/docs/gameinput.md | |||
| @@ -29,10 +29,20 @@ SDL3 is available in one of these ways: | |||
| 29 | - **A local copy of that tarball**: extract it and pass `-DFETCHCONTENT_SOURCE_DIR_SDL3=<path to SDL3-3.4.20>`; it is | 29 | - **A local copy of that tarball**: extract it and pass `-DFETCHCONTENT_SOURCE_DIR_SDL3=<path to SDL3-3.4.20>`; it is |
| 30 | built the same way, without a download. | 30 | built the same way, without a download. |
| 31 | 31 | ||
| 32 | Without any of these, or with `-DLEONIDA_SDL3=OFF`, configure prints a message and `gta6rt` is built without the shim: | 32 | Without any of these, or with `-DLEONIDA_SDL3=OFF`, configure prints a message and `gta6rt` is built without the SDL3 |
| 33 | it has no `GameInputCreate`, as before, so the loader binds it to the host's `GameInput.dll` or the unimplemented | 33 | shim. `gameinput_test` and `gameinput_probe` are not built, and CTest lists `gameinput` as not run (disabled) rather |
| 34 | thunk. `gameinput_test` and `gameinput_probe` are not built, and CTest lists `gameinput` as not run (disabled) rather | 34 | than failing. `GameInputCreate` is then served by the XInput shim, `runtime/shims/gameinput_xinput.cpp`, ported from |
| 35 | than failing. | 35 | VIctory's GameInput module (GPL-3.0-or-later): XInput pads in slots 0-3, a wired DualSense read over HID when no |
| 36 | XInput pad is there, the keyboard as a device of its own (key readings with scan codes and virtual keys), and a | ||
| 37 | keyboard pad that stands in while no other pad is connected (Esc Menu, Tab View, Enter A, Backspace B, X, Y, arrows | ||
| 38 | the d-pad, Q/E the shoulders, F/H the stick clicks, W/A/S/D the left stick, I/J/K/L the right stick, Z/C the | ||
| 39 | triggers; `LEONIDA_KEYBOARD_PAD=off` leaves it out). Keys count only while a window of this process has focus. | ||
| 40 | `LEONIDA_GAMEINPUT=host` binds the host's `GameInput.dll` instead, as builds without any shim did. `gameinput_xinput_test` | ||
| 41 | (CTest `gameinput_xinput`) runs it over a fake host and is built with or without SDL3. | ||
| 42 | |||
| 43 | Both shims register `GameInputCreate` by name and as ordinal `#1`: VIctory found that titles import `gameinput.dll` by | ||
| 44 | ordinal only, and the loader looks an ordinal import up as `#1`. Before, the SDL3 shim was registered by name only, so an | ||
| 45 | ordinal import skipped it and bound to the host's `GameInput.dll`, whose ordinal 1 is `GameInputCreate`. | ||
| 36 | 46 | ||
| 37 | `scripts/build_runtime.ps1` (what `make_game.py` runs) builds the shim only on its CMake path, when Visual Studio's | 47 | `scripts/build_runtime.ps1` (what `make_game.py` runs) builds the shim only on its CMake path, when Visual Studio's |
| 38 | C++ CMake tools are installed. Its direct-`cl.exe` fallback compiles a fixed file list without the shim and warns | 48 | C++ CMake tools are installed. Its direct-`cl.exe` fallback compiles a fixed file list without the shim and warns |