runtime: add the input clock to input trace state lines #3381

Manually merged
github merged 1 commit from github-bot/gh-3379 into gh-pr/3379/base 2026-11-29 10:14:46 +00:00 AGit
Owner

@⁠Leyukaka on GitHub · 2026-11-28 17:10 UTC · original
Leyukaka:runtime-input-trace-time → main · +15 −8 · 4 files · 1 commits · merged 2026-11-29 10:11 UTC

Refs #870.

Change

X2W_INPUT_TRACE=1 (#3179) writes a state line only when a reading is captured, so the 250 ms repeat does not give a steady cadence. In a 900 s run with manual input, counting the lines rebuilt 688.6 s. A recorded session therefore cannot be replayed from line counts. Each state line now ends with time=, the input clock in seconds since process start (process_milliseconds(), the clock the trace already uses for its 250 ms repeat). That is the time base of an X2W_INPUT_SCRIPT with base=start, so a press recorded at time=81.250 replays as a press at [email protected] in such a script.

x2w-input-trace state buttons=0x00000004 lt=0.000 rt=0.000 lx=0.000 ly=0.000 rx=0.000 ry=0.000 script=2.000 present=11 time=2.000

The field is appended, so prefix and substring matches on the existing fields still match. Event lines (wait, mark, group) are unchanged.

Verification

5acb107f on aec2e084, Windows 11 build 26300, release build.

  • ctest --test-dir out/build/release -R "gameinput|startup_run_ps1|input_script": 9/9 passed.
  • startup_gameinput_trace drives the clock with X2W_INPUT_CLOCK_MS. Its three expected state lines now end with time=2.000, time=2.500 and time=3.600.
  • Mutation: dividing the clock by 100 instead of 1000 fails startup_gameinput_trace on exactly those three lines.

Docs: docs/startup-runtime.md and docs/experiments/startup-input-trace.md describe the field.

Not covered: in startup_gameinput_trace the first poll is at 0 ms, so script and time print the same value; the test proves the field and its scale, not that time uses the process clock rather than the script clock. No tool turns a trace into a script yet.

**@⁠Leyukaka** on GitHub · 2026-11-28 17:10 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3379) `Leyukaka:runtime-input-trace-time` → `main` · +15 −8 · 4 files · 1 commits · merged 2026-11-29 10:11 UTC Refs #870. ## Change `X2W_INPUT_TRACE=1` (#3179) writes a state line only when a reading is captured, so the 250 ms repeat does not give a steady cadence. In a 900 s run with manual input, counting the lines rebuilt 688.6 s. A recorded session therefore cannot be replayed from line counts. Each state line now ends with `time=`, the input clock in seconds since process start (`process_milliseconds()`, the clock the trace already uses for its 250 ms repeat). That is the time base of an `X2W_INPUT_SCRIPT` with `base=start`, so a press recorded at `time=81.250` replays as a press at `[email protected]` in such a script. ```text x2w-input-trace state buttons=0x00000004 lt=0.000 rt=0.000 lx=0.000 ly=0.000 rx=0.000 ry=0.000 script=2.000 present=11 time=2.000 ``` The field is appended, so prefix and substring matches on the existing fields still match. Event lines (`wait`, `mark`, `group`) are unchanged. ## Verification `5acb107f` on `aec2e084`, Windows 11 build 26300, release build. - `ctest --test-dir out/build/release -R "gameinput|startup_run_ps1|input_script"`: 9/9 passed. - `startup_gameinput_trace` drives the clock with `X2W_INPUT_CLOCK_MS`. Its three expected state lines now end with `time=2.000`, `time=2.500` and `time=3.600`. - Mutation: dividing the clock by 100 instead of 1000 fails `startup_gameinput_trace` on exactly those three lines. Docs: `docs/startup-runtime.md` and `docs/experiments/startup-input-trace.md` describe the field. Not covered: in `startup_gameinput_trace` the first poll is at 0 ms, so `script` and `time` print the same value; the test proves the field and its scale, not that `time` uses the process clock rather than the script clock. No tool turns a trace into a script yet.
A trace line is written only when a reading is captured, so the 250 ms
repeat does not give a steady cadence and a recorded session cannot be
replayed from line counts. Each state line now ends with time=, the input
clock in seconds since process start, which is the time base of an
X2W_INPUT_SCRIPT with base=start.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 17:14:51 +00:00
Author
Owner

@⁠KelboLive on GitHub · 2026-11-28 20:35 UTC · original · approved these changes

LGTM — useful addition for session replay.

Adds time field (seconds since process start on the input clock) to x2w-input-trace state lines. This is the time base of an X2W_INPUT_SCRIPT with base=start, enabling recorded sessions to be replayed from it. Updates docs and tests consistently.

Ready to land.

**@⁠KelboLive** on GitHub · 2026-11-28 20:35 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3379#pullrequestreview-6099981807) · **approved these changes** LGTM — useful addition for session replay. Adds `time` field (seconds since process start on the input clock) to `x2w-input-trace state` lines. This is the time base of an `X2W_INPUT_SCRIPT` with `base=start`, enabling recorded sessions to be replayed from it. Updates docs and tests consistently. Ready to land.
Author
Owner

@⁠KelboLive on GitHub · 2026-11-28 21:57 UTC · original · approved these changes

LGTM — useful addition for session replay.

Adds time field (seconds since process start on the input clock) to x2w-input-trace state lines. This is the time base of an X2W_INPUT_SCRIPT with base=start, enabling recorded sessions to be replayed from it. Updates docs and tests consistently.

Ready to land.

**@⁠KelboLive** on GitHub · 2026-11-28 21:57 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3379#pullrequestreview-6100253252) · **approved these changes** LGTM — useful addition for session replay. Adds `time` field (seconds since process start on the input clock) to `x2w-input-trace state` lines. This is the time base of an `X2W_INPUT_SCRIPT` with `base=start`, enabling recorded sessions to be replayed from it. Updates docs and tests consistently. Ready to land.
github-bot changed target branch from main to gh-pr/3379/base 2026-11-29 10:14:44 +00:00
github manually merged commit 5acb107f03 into gh-pr/3379/base 2026-11-29 10:14:46 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.