`LEONIDA_KBM_BINDS=scope:key=action;...` (scope foot, vehicle or both; key a
letter, digit or name such as Space, LShift, Numpad8, F5, MouseLeft; action a
pad input such as A, Square, RB, LT, DpadUp, LeftY+, or none) changes the
GTA V layout's two tables. An entry replaces every default bind of its key in
its scope; several keys may give one action. The tables are built once
(LazyLock) from the consts plus the entries, and the stand-in pad, `outputs`
and the hand-over rule (`changes`) all read the built tables, so a remapped key
that ends up another input in a vehicle than on foot waits for a fresh press
after a change of table.
Entries that do not read, and the runtime's own keys (F1 settings menu, F3
numbers panel, F4 trainer menu, F8 ped dump, F9 frame capture, Left/Right Alt,
Caps Lock), are skipped with one warning each naming the entry; nothing
panics. Unset, the tables are the consts bind for bind (tested over all 256
keys); LEONIDA_KBM=classic does not read the variable.
Tests: cargo test -p leonida-hle (257 passed, 2 ignored), clippy -p
leonida-hle --all-targets -D warnings clean; a counter-test that keeps the
default binds of a named key fails 3 of the new tests, one that runs the
hand-over on the default tables fails the remapped hand-over test.
docs/gameinput.md documents the syntax; d3d12/docs/switches.md regenerated.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tools/live_prompt_glyphs.py builds ps_live_prompt_glyphs.gfx over the
title's glyph movie on the player's PC: each Main_Button_N sprite holds the
PlayStation and the keyboard picture (the first keyboard piece named k),
and the title's ActionScript block gets three static Number slots on Main
(lnLo, lnFamily, lnHi, the outer two sentinels), four static methods that
show the pad or the keyboard pieces when a prompt is made and on each frame
while it is on the stage, and a call from SpriteAsset's constructor, the
base of exactly the 38 symbol classes. Everything added is in try blocks.
tools/abc_file.py reads and writes ABC byte for byte. Both sets and the
code fit the 28,148 bytes with 1,057 to spare on the user's movie.
leonida-hle serves the live movie for a PlayStation pad or the keyboard
(unless LEONIDA_PROMPTS forces a family; LEONIDA_PROMPTS_LIVE=0 restores
one family's movie, LEONIDA_PROMPTS_PAD=xbox keeps a keyboard start on the
keyboard movie), with lnFamily's default set to the family in use, then a
below-normal thread finds the slots by their sentinels through
ReadProcessMemory and writes each change of the active family.
prompt_glyph_movies.py builds the live movie too (only over the title's).
Tested: the added code checked path by path and run in an interpreter over
fake display objects, the sentinel scan and writes on a fake heap. Not yet
run in the title.
prompt_glyphs.md: the glyph movie's ActionScript is a symbol library with no
logic; the name is built, and a new sprite made at every prompt set-up, by a
class three larger movies carry, which loads the movie once and has a per-prompt
device suffix nothing on this build sets. The keyboard-and-mouse replacement and
its measured size and differences; the runtime's choice by family; and what is
certain and what is a guess about following a device switch during play.
gameinput.md: the start family from what is connected, and the switch guard as
it behaves.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
d3d12/README.md lists the keys on foot and in a vehicle. docs/gameinput.md
has the two tables with the pad button of each key, the GTA V keys left
out and why, the hand-over rule, what is read from the title (and that it
was read from the code, not yet seen running), the speed rule's limits and
the switches. docs/mod-menu.md counts the eleventh place.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The keyboard pad clips the cursor to the foreground window's client
area and re-applies the clip every 100 ms. A press on the title bar was
pulled into the client area, and during the modal move loop each re-clip
pulled the cursor, and the window with it, down the screen instead of
letting it be dragged.
The clip is now released while the window's thread is in a move/size or
menu loop (GetGUIThreadInfo: GUI_INMOVESIZE, GUI_INMENUMODE,
GUI_SYSTEMMENUMODE), and while a mouse press that began outside the
client area is held, including one that activated the window. A press
in the client area keeps the clip, so a click still cannot land on
another window. The decision is CursorClipGate (shims/gameinput_clip.h),
covered by the new gameinput_clip test.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sony pads (USB and Bluetooth) are read from the public HID report layouts without SDL, rumble goes out as output reports, and a pad
that XInput already shows through a remapper is not read twice. gameinput::active_family() says Xbox, PlayStation or keyboard and
mouse (LEONIDA_PROMPTS forces it). Unit-tested on hand-made report bytes; not run against a real pad.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What: the console title turns its camera with the right stick only, so the mouse's
motion (cursor re-centred each 8 ms sample, kept in the window with ClipCursor) becomes
a right-stick push merged into the pad the title plays with: speed over a 40 ms window,
full push at 1600 px/s (LEONIDA_MOUSE_SENSITIVITY scales it), lifted past a 0.24 dead
zone with a 0.6 power curve (LEONIDA_MOUSE_DEADZONE, LEONIDA_MOUSE_CURVE),
LEONIDA_MOUSE_INVERT_Y=1. The cursor is hidden over the window while held (WM_SETCURSOR
in both window procedures, leonida_gpu::MOUSE_CAPTURED). The click that takes the mouse
is not a shot; the mouse buttons are the triggers only while held. Esc, the F1 or F4
menu, or another window in front gives the mouse back. LEONIDA_MOUSE_LOOK=0 restores
the old behaviour. Also: held_from_file has a stand-in without diagnostics, so a
non-diagnostics build compiles again.
Why: the user saw the cursor stay on screen and the mouse not turn the camera.
How checked: cargo test -p leonida-hle --lib gameinput (13 pass, one new); not yet
tried in the title. AI-assisted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The keyboard-and-mouse stand-in pad had its triggers on Z and V only. Now the right mouse button pulls the left
trigger and the left button the right trigger, fully while held, in addition to Z and V. They count only while a window
of the runtime has focus (as the keys do), are not read while the F4 trainer menu is open, and the F1 menu already
returns no keys. The buttons travel as pseudo keys (virtual keys 1 and 2) into the pad and are removed before the
keyboard device reports its keys, so the title never sees them as keyboard input.
Checked: cargo test -p leonida-hle --features diagnostics --lib gameinput (12 passed, including the new
mouse_buttons_pull_the_triggers_and_stay_off_the_keyboard), cargo check --profile diag -p leonida --features
diagnostics. Not run in the game. docs/gameinput.md gains the D3D12 runtime's control table. AI-assisted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docs/gameinput.md conflicted on two passages, both kept:
- main's new LEONIDA_INPUT_FILE paragraph, with this branch's sentence on
make_game.py running build_runtime.ps1 with -FetchSdl3 (and --no-sdl3)
added to main's wording of the build paragraph;
- the settings table keeps this branch's LEONIDA_KEYBOARD_PAD default (1,
focused; off removes it), which gameinput.cpp reads, and takes main's longer
LEONIDA_INPUT_SCRIPT row (button@seconds:hold, the six-reads rule), saying
"on unless LEONIDA_KEYBOARD_PAD=off" for the keyboard pad.
No code conflicted. Tested: full ctest, 113 of 113, on Linux (the portable
subset; the gameinput shim is Windows-only).
Changes made by Claude Code (AI-assisted).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JPqXc6svM4pbBagTsVEYA3
#2372 started a detached thread that took the input lock every 8 ms, so that a scripted press that begins and ends
while the title is not reading reaches the reading history. That works around the cause and adds its own: the
history then depends on how the host schedules a Sleep(8) thread (a slow or loaded machine keeps fewer edges, and a
Windows timer tick of 15.6 ms drops a short hold), the thread never ends, and it contends with the title's reads.
The cause is that update() looked only at the state at the moment of the read. It now first adds a reading for every
start and end of a press since the last update, stamped with the script's time, then the state at the read: the
history is the same however often the title reads, on any machine, and no thread runs. The press log lines carry the
script's time of the press.
Also: LEONIDA_INPUT_TRACE (added by #2372) is documented in docs/gameinput.md and runtime/README.md, as
tests/test_docs_env_vars.py requires. gameinput_no_sdl_script gains y@10, which the title never reads while it is down
(reads at 4.5 s and 60 s): the press and its release must be in the history with their own timestamps. On main the
history has no Y reading.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tests/test_docs_env_vars.py requires every variable the code reads to be named in a document; the night's diagnostics were not.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
#2098 gave the SDL path its own loop (held 300 ms, then until the title
has read the pads six times, at most 5 s), which ignored button@seconds:hold.
A press now lasts its own hold, then the read latch, and never past 5 s or
its hold if longer. The long-script test checks both: X kept past 300 ms
until six reads, Y kept for its 0.6 s after them. It fails on the old loop.
Found by AndreiKocherzhinskiiA on #1608.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
At world-start frame rates the retail title reads its pad every few seconds,
so a 0.3 s scripted press falls between two reads and never arrives. An
entry may now give its own hold time; without one the press stays 0.3 s.
Holds of 0 or less, over 600 s or that are not a number reject the entry.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fall back to a dedicated buffer allocation when the shared arena fills.
Update console descriptors and resource backing, preserve pipeline cache
entries, and replay mesh records using bounded indirect arguments. Keep
scripted input available until read and cover the runtime and translator
paths with synthetic tests.
Co-authored-by: Plaaasma <47513553+Plaaasma@users.noreply.github.com>
Co-authored-by: ivanepsilondelta <264061546+ivanepsilondelta@users.noreply.github.com>
A build without SDL3 answered GameInputCreate with no devices and E_NOTIMPL
for every other slot, so the title waited at its first "press A" prompt
forever: no CI artifact or offline build could get past it.
With LEONIDA_INPUT_SCRIPT set, gameinput_no_sdl.cpp now serves one scripted
pad (an Xbox One gamepad) driven by the script alone: device enumeration
through RegisterDeviceCallback (blocking, async, dispatcher), FindDeviceFromId,
and GetCurrentReading/GetNextReading/GetPreviousReading whose gamepad and UI
navigation state follow the script. Readings are taken when the title asks,
so no thread polls. Without the variable it behaves as before.
The parser, the 300 ms timeline, the button names, the press log lines and
the UI navigation mapping move from gameinput.cpp into gameinput_script.h,
which both shims use; nothing in it needs SDL. gameinput.cpp checks the
shared SDL button numbers against SDL_GamepadButton at compile time.
gameinput_no_sdl_test --input-script (CTest gameinput_no_sdl_script) checks
the scripted pad on a fake clock. Docs: runtime/README.md, docs/gameinput.md,
docs/linux_proton.md, docs/README.md.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A pad connected after the title started was seen by the shim but not by the
title, while pads present at start worked. Pads present at start reach a title
through blocking enumeration, which runs synchronously in RegisterDeviceCallback.
A later pad reaches it only through a queued connect event. queue_event queued
every reading and guide change whether or not any callback listened. With a
dispatcher held, a title that runs one item a frame (Dispatch(0), the pattern
Microsoft's Dispatch page suggests) falls further behind every frame, because a
moving stick or a sensor pad's 125 Hz stream queues items faster. The later
pad's connect event then never comes out of the queue.
queue_event now drops an event no registered callback matches, as GameInput has
no work to dispatch then. The first few RegisterDeviceCallback calls and the
first CreateDispatcher and Dispatch calls are logged, so a retail run shows
whether the title holds a dispatcher (not yet confirmed for the retail title).
Test: test_late_pad_behind_dispatcher. A title with a dispatcher registers its
device callback with no pad, a first pad moves on every poll, and a pad attached
later must reach the callback within ten frames of Dispatch(0). Without the fix
it fails (2 of 371 checks); with it, 371 checks pass.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A build made with make_game.py on Windows had no input at all. The runtime
stage ran scripts/build_runtime.ps1 without -FetchSdl3, so on a machine without
an installed SDL3 the GameInput shim was not built. gta6rt then logged "served
without SDL3 (no devices)", and a connected DualSense or Xbox pad did nothing.
- make_game.py: the Windows runtime stage passes -FetchSdl3 (the pinned SDL3
3.4.20, SHA-256 checked by CMake). --no-sdl3 leaves the download out. The
docstring's "what it downloads" sentence names it.
- gameinput: LEONIDA_KEYBOARD_PAD defaults to the focused mode, so a player
without a pad still has the keyboard and mouse. Keys count only while the
game window has focus. "off" or "0" removes the pad.
- gameinput_test: the other cases set LEONIDA_KEYBOARD_PAD=off, as they count
only their own virtual pads. The keyboard pad case checks the new default.
- docs/gameinput.md: default and make_game behaviour.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merging.
**Why merged:** DOC-GAMEINPUT-API-DUPES: removes two stale duplicate rows from the docs/gameinput.md API table. KernelSmoker approved it.
**Why it's good:** Docs tests: 47 passed.
Tested on Windows 11 / RTX 4070 SUPER: merged alone onto main 0f98d193c. With it in, the repo-consistency set (cmake/translator-deps, shader_stage_resume, runtime_paths, docs, make_game, no-game-data, run_semantic_tests, ctest_registration) gives 578 passed / 5 skipped / 0 failed, and check_no_game_data on the changed files is clean. git merge-tree against current main: no conflicts. Security read of the three-dot diff: no binaries, game data, downloads, network calls or CI changes.
AI-assisted (Claude Code, Claude Opus 5.5).
Main had no keyboard pad script scheduler. Add timed button presses with
a full-length environment reader so entries beyond byte 63 reach the pad.
Combine scheduled and physical presses. Reject malformed entries and
report their count when the script is read on the first pad update.
Build gta6rt and gameinput_test. Exercise a long script, rejected items,
focus loss, configuration reload and release under Wine. Restore only the
old environment reader to reproduce the missing presses.
Co-authored-by: Plaaasma <47513553+Plaaasma@users.noreply.github.com>
AI-assisted (Codex and Claude Code agents).
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
gameinput_abi.h left out the labels of the public v0 layout. In
GameInputControllerAxisInfo and GameInputControllerButtonInfo a label
sits at offset 4, in what is otherwise padding, so the sizes matched
while isContinuous, restValue, legacyDInputIndex and rawReportIndex were
four bytes early. GameInputGamepadInfo and GameInputUiNavigationInfo are
tables of 14 and 21 labels; they were declared empty, and the pointers
in GameInputDeviceInfo led to one-byte members, so a title reading a
label read whatever followed.
The header declares the enum, the two tables and the two label members
and pins each offset that moved. fill_info gives every control the Xbox
label of its position on every pad, since every pad is presented as an
Xbox One pad.
gameinput_test reads the tables by the public header's byte offsets, so
the shim's own header cannot agree with itself.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
gameinput_probe with a DualSense (054c:0ce6) over USB on Windows 11: it
connects with trigger effects and gyro, each of the 14 gamepad buttons
sets its own bit of the mapping table, triggers and sticks reach full
scale, the accelerometer clamps at 1.00 on a hand shake, and the raw HID
tables and a changing raw input report are there. Rumble, trigger effects
and the lightbar are as reported by the person holding the pad.
Bluetooth, the resistance trigger mode, a DualShock 4 and a Switch Pro
are still to confirm.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
`--force-feedback` now reads the shim's output state once the poll thread has
picked the effect up, and says whether SDL created it and is running it, or why
it did not, so a wheel owner can tell a silent drop from a real run. The shim
records SDL_CreateHapticEffect's id, SDL_RunHapticEffect's result and SDL's
error text per device; gameinput_test asserts the success and the refusal.
AI-assisted