| Age | Commit message (Collapse) | Author |
|
#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>
|
|
(TEST-GAMEINPUT-SCRIPT-READS)
Since #2098 a scripted press lasts its 300 ms and then until the title has made
six GetCurrentReading calls since it began. gameinput_test --input-script still
expected the press to be over after 350 ms and three reads, so ctest
gameinput_script failed on main in every build with SDL3 (it is disabled
without SDL3, so CI did not show it).
The test now checks that the press is still held at that point, reads the pad
six more times and then expects the release. Test only.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
|
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>
|
|
GameInputCreate import
The retail executable imports GameInputCreate from GameInput.dll by ordinal 1. The loader looks ordinal imports up
as "#1", which the shim table did not have, so the import bound to the host's GameInput.dll. On Windows the
installed GameInput answers; under Wine it is the builtin stub, the call fails and the title stops on its result.
The alias maps #1 to the same GameInputCreate, and gameinput_test checks it.
(cherry picked from commit 5e45c7da942d7ac08fc57561e9ed924bcfc76476)
|
|
|
|
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>
|
|
|
|
wrapping
IGameInputDevice::SetHapticMotorState computed the end of a request as
duration * playCount + repeatDelay * (playCount - 1), then now + total, all
in uint64 microseconds with no overflow check. A very long request wrapped:
duration = UINT64_MAX with playCount 1 put the deadline just before now, so
the motor never played, and duration = 2^63 + 50 ms with playCount 2 wrapped
to a 100 ms request that stopped early.
The products and sums now saturate at UINT64_MAX, a deadline the poll
thread never reaches, so such a request plays until the state is set again.
Requests that fit are unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts:
# docs/gameinput.md
|
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
|
Signed-off-by: Maxime Mansiet <AirKyzzZ@users.noreply.github.com>
|
|
Signed-off-by: Maxime Mansiet <AirKyzzZ@users.noreply.github.com>
|
|
released (RT-262)
ForceFeedbackEffect::Release() drops the count to 0 and deletes the
effect; its destructor then waits for g().mu to unlink it from the
device. In that window apply_effects (holding g().mu) could AddRef the
dying effect from 0 to 1, sync it after it was freed, and delete it a
second time with its own Release (@AAyberkU's finding).
apply_effects now takes a reference only on a live effect
(add_ref_if_live: a compare-exchange that never moves a count up from 0),
so an effect whose last Release ran is skipped.
gameinput_test: add_ref_if_live itself, and 20,000 effects created and
released while a second thread runs the poll step. With the old AddRef
that run ends in STATUS_HEAP_CORRUPTION (0xC0000374) every time here.
Co-Authored-By: Claude Opus 5.5 <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
|
|
|
|
The shim tells the title every pad is an Xbox One pad, so nothing could
say what the player is really holding. rt::gameinput::active_input()
now returns the family of the device used last (Xbox, PlayStation 5,
PlayStation 4, PlayStation 3, Nintendo, or the keyboard pad), a
generation that counts changes, and whether LEONIDA_PROMPTS forced it.
It is groundwork for button prompts that follow the device in use.
Only deliberate input counts: a button going down, a trigger past 0.3
or a stick leaving a 0.35 radius. Held input, stick drift and noise do
not; a pad's first reading after it connects is its baseline; and
after a change the next one waits LEONIDA_PROMPTS_SWITCH_MS (300 ms).
The rules live in runtime/src/active_input.h with no SDL, tested by
active_input_test; gameinput_test drives them on SDL virtual pads.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
|
# Conflicts:
# docs/gameinput.md
|
|
|
|
Keep RT-160's force-feedback interface and tests next to the raw HID ones.
The raw HID test fakes are renamed (FakeRawHid, raw_*) so they no longer clash
with the haptic fakes. The API table gets one IGameInputDevice row with both
feature sets; the stale duplicate IGameInputDevice and IGameInputDispatcher
rows are dropped.
|
|
The shim opens each pad's HID device with SDL_hid_* (by SDL's device path, else the one game-pad collection with the
pad's vendor and product id) and reads its report descriptor for every input, output and feature report's id and
size. Such a pad reports GameInputKindRawDeviceReport and GameInputDeviceRawIoEnabled and fills inputReportInfo,
outputReportInfo and featureReportInfo (no item tables). Readings carry the newest raw input report, and
IGameInputReading::GetRawReport returns it as an IGameInputRawDeviceReport. CreateRawDeviceReport,
GetRawDeviceFeature, SetRawDeviceFeature and SendRawDeviceOutput work through the backend; an undeclared id or kind
is E_INVALIDARG, a failed transfer E_FAIL, and a pad without a HID device keeps E_NOTIMPL.
gameinput_abi.h declares IGameInputRawDeviceReport, GameInputRawDeviceReportKind and the three raw report info
structs, checked against Microsoft's v0 header (offsetof for every field, the 12 vtable slots, the IID). Xbox pads on
Windows go through XInput, whose HID interface SDL's hidapi skips, so they have no raw I/O; the log says so.
gameinput_test covers the descriptor parser and the whole path with a fake HID backend (24 checks);
gameinput_probe prints each pad's report tables and newest raw input report. docs/gameinput.md: "Raw HID".
|
|
|
|
Review follow-up. Dispatch took events one at a time from the live
queue, so readings queued during the call (by the poll thread, or by a
callback) were delivered in the same call: with an unlimited quota a busy
queue could keep the title inside Dispatch, and each erase at the front
made a drain O(n^2) under deliver_mu.
Dispatch now swaps out the batch present at entry and walks it in order;
events it leaves (quota spent) go back to the front of the queue, ahead of
newer ones. gameinput_test adds a callback that queues a reading from
inside the call: each Dispatch(UINT64_MAX) runs exactly its starting batch
and returns true (the previous version never returned). The docs say so,
and the dispatcher row's open column reads a dash instead of a blank.
|
|
# Conflicts:
# docs/gameinput.md
|
|
|
|
HapticApi carried SDL_GetNumHapticAxes and SDL_HapticEffectSupported, which
nothing calls: the motor's axes are the shim's choice and the effect kinds are
gated on SDL_GetHapticFeatures. They are gone from the table, its SDL
implementation and the test's fake, so the seam is exactly the calls a pad's
force feedback makes.
AI-assisted.
|
|
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.
|
|
haptics (RT-160)
IGameInputDevice answered the force-feedback and haptic half of the API with
nothing: no motors in GameInputDeviceInfo, E_INVALIDARG from
CreateForceFeedbackEffect, false from IsForceFeedbackMotorPoweredOn, a no-op
SetForceFeedbackMotorGain and E_INVALIDARG from SetHapticMotorState. A pad SDL
opens as a haptic device now reports one force-feedback motor with the effect
kinds SDL lists, and a pad with trigger motors reports two haptic motors.
Force feedback goes to SDL_CreateHapticEffect/RunHapticEffect on the poll
thread, so title calls still never touch SDL; the eleven GameInput effect kinds
are SDL's eleven force-feedback effects. The trigger haptic motors play their
one waveform as an intensity on the existing trigger output. A pad with neither
keeps the old answers, and LEONIDA_RUMBLE=0 silences both. gameinput_test drives
all of it through a fake haptic backend, because SDL's virtual joysticks report
no haptics.
AI-assisted.
|
|
|
|
|
|
Microsoft's reference page says IGameInput::GetTemporalReading "was never
implemented in v0" and returns E_NOTIMPL, and v1 removed it, so the shim's
E_NOTIMPL already matches the API the title was built against. A history
lookup would answer what no GameInput runtime does. The v0 header (NuGet
Microsoft.GameInput 0.2303.22621.3038) declares (timestamp, device,
reading), the shim's layout; the page's five-parameter form doesn't match it.
Pin the behaviour in gameinput_test (E_NOTIMPL with the reading cleared, for
past, present and current timestamps, with and without a device filter;
E_POINTER for a null output) and say so in docs/gameinput.md instead of
listing the method as a gap.
|
|
the cursor in the window
GetCursorPos deltas stop at the screen edge and include pointer
acceleration. A message-only window on its own thread now registers for
raw mouse input (RIDEV_INPUTSINK) and sums the relative counts; the poll
takes the difference of that total. Absolute reports are ignored, and
GetCursorPos stays as the fallback if registration fails.
With raw input on and a window of this process in the foreground, the
cursor is clipped to that window's client area (re-applied every 100 ms),
and released on focus loss or when the pad is turned off.
LEONIDA_MOUSE_SENSITIVITY (0.1..10, default 1) scales the axis units per
count.
|
|
E_NOTIMPL guards
|
|
|
|
Expose SDL3's gyroscope and accelerometer through the GameInput shim:
- gameinput_abi.h: GameInputMotionAccuracy, GameInputMotionInfo and
GameInputMotionState with the v0 layouts (Microsoft's public docs),
size asserts included.
- The shim enables both sensors when a pad with them is opened, reads
the latest sample each poll, and reports GameInputKindMotion plus a
GameInputMotionInfo on such pads. GetMotionState returns the state as
signed fractions of the motionInfo maxima (2 g accel, 2000 deg/s
gyro, the shim's choice since SDL exposes no sensor range; VERIFY).
All-zero accel means no sample yet, so readings before the device's
first sample carry no motion. Magnetic field and orientation stay
zero and Unknown: SDL has no compass and nothing synthesises a
quaternion. Pads with sensors stream a reading every ~8 ms so motion
is not stuck at the last button event; other pads keep the old
change-driven behaviour.
- GetCurrentReading and GetNextReading with a device filter now reject
kinds the device does not support (READING_NOT_FOUND), matching the
v0 docs and the device-less path, so a motion query on a plain pad
fails instead of returning a reading without motion.
- gameinput_test: a virtual pad with SDL sensors covers kind/motionInfo
presence, no-motion-before-first-sample, normalisation, accuracy
values, the +-1 clamp, the cadence, and the plain-pad rejection.
gameinput_probe prints the live accel and gyro fractions.
- docs/gameinput.md: a Motion section, the API table, and VERIFY notes
for the chosen maxima and the unprovided members.
Tested: gameinput_test 185/185 and ctest 90/90 (RelWithDebInfo) on
Windows 11 Pro 10.0.26200; SDL3 3.4.20 via -DLEONIDA_SDL3_FETCH=ON.
Follows: #660. AI-assisted (ZCode agent).
|
|
mouse buttons LT/RT
The keyboard pad only pressed buttons, enough for menus. WASD now drives
the left stick (opposite keys cancel, diagonals on the round gate), cursor
movement the right stick (decaying back to center), and the right/left
mouse buttons the left/right triggers. Everything is released on focus
loss. A set_cursor_source seam sits beside set_keyboard_source for tests.
|
|
|
|
|
|
|
|
The title reads gamepads only, so keys reach it as one more pad: an SDL
virtual gamepad whose buttons are pressed from GetAsyncKeyState on each
poll. It goes through open_pad/read_pad like a real controller (device
object, player slot, readings, callbacks, UI navigation) and reports no
motors.
Arrows d-pad, Enter A, Backspace B, X X, Y Y, Q/E shoulders, Esc Menu,
Tab View. Off by default; =1 reads keys only while a window of this
process is in the foreground and releases everything on focus loss,
=always ignores focus (console tools). Sticks and triggers stay at rest.
gameinput_test drives it through set_keyboard_source with fake keys and
focus: 31 new checks.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
|
lightbar)
GameInputCreate and the v0 IGameInput/IGameInputDevice/IGameInputReading/IGameInputDispatcher surface a title uses
for gamepads, served from SDL3 gamepads so DualSense, DualShock 4, Switch Pro and Xbox pads all work. Rumble goes to
SDL_RumbleGamepad, impulse-trigger rumble to SDL_RumbleGamepadTriggers, and on a DualSense to adaptive-trigger effects
through SDL_SendGamepadEffect (LEONIDA_DS_TRIGGERS=off|rumble|resistance). Lightbar via LEONIDA_DS_LIGHTBAR.
SDL3 (zlib) comes from an installed package or a pinned, hash-checked release tarball via FetchContent;
-DLEONIDA_SDL3=OFF skips the shim. gameinput_test covers the shim on SDL virtual joysticks; gameinput_probe is the
manual check on a real pad. docs/gameinput.md has the mapping, settings and VERIFY list.
AI-assisted (Claude Code).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|