Repository navigation
Conversation
26 of 42 tasks
v0lumehi
force-pushed
the
dm-rec
branch
4 times, most recently
from
October 28, 2026 16:41
409dbe7 to
816d610
Compare
DM_REC=<file> writes player 1's physical input (keyboard, mouse touches, player 1's controller and the controllers a one-player game merges into it) to the file as DM_KEYS steps, so a run plays again from the same save and build: a bug report's path without game data, or a smoke route recorded instead of written (roadmap item in seedds#313). It records where the front ends publish (dm_input_set, dm_pad_set_player, dm_touch_set), so the Mac and iOS front ends both feed it; DM_KEYS and DM_CTL touch through a new dm_touch_script and keep their own button path, so scripted input is never recorded. Off, a publish costs one relaxed load and branch; on, the publishing thread compares and formats into memory and a writer thread appends to the file every 250 ms and at exit. Each step is one state from the presented frame it began to the frame it ended ("f1524:A+L0.50/-0.25~f12,"), because under DM_DETCLOCK the guest clock follows the presents while seconds drift with load. DM_KEYS gains what replaying that needs: "~f<frames>" holds in frames, and a step due when such a hold ends follows it without a release (buttons stay held, a dragged finger moves instead of lifting). Commas, spaces and newlines separate steps, the parser takes the whole value (it cut at 4,096 bytes) and up to 1,048,576 steps (was 1,024), ordered by a stable merge sort. Existing routes behave as before. Sticks are kept to hundredths and re-recorded on a 0.02 move; touch to thousandths and a 0.005 move. Checked: t_hid's new round trip records a known sequence (keyboard, controller stick with drift, a sub-frame tap, a dragged touch, shake, a press held at exit, and scripted presses that must not appear), compares the exact text, parses it back with the DM_KEYS parser and replays it on the scripted path with a simulated frame clock: the game's view of every frame matches the recording (130 checks, also under ThreadSanitizer). Host unit tests, Mario and Breath of the Wild host builds, the Python tool tests, docs and env-switch tests pass; lint shows no new findings. On the Mac host, Breath of the Wild ran 75 s with DM_REC and frame-held DM_KEYS steps: the steps ran in order, SIGTERM flushed through the graceful exit, and the recording stayed empty (only scripted input). Recording real keyboard input on the Mac was not tried.
seedds
added a commit
that referenced
this pull request
Oct 30, 2026
DM_REC=<file> writes player 1's physical input (keyboard, mouse touches, player 1's controller and the controllers a one-player game merges into it) to the file as DM_KEYS steps, so a run plays again from the same save and build: a bug report's path without game data, or a smoke route recorded instead of written (#313). It records where the front ends publish (dm_input_set, dm_pad_set_player, dm_touch_set), so the Mac and iOS front ends both feed it; DM_KEYS and DM_CTL touch through a new dm_touch_script and keep their own button path, so scripted input is never recorded. Off, a publish costs one relaxed load and branch; on, the publishing thread compares and formats into memory and a writer thread appends to the file every 250 ms and at exit. Each step is one state from the presented frame it began to the frame it ended ("f1524:A+L0.50/-0.25~f12,"), because under DM_DETCLOCK the guest clock follows the presents while seconds drift with load. DM_KEYS gains what replaying that needs: "~f<frames>" holds in frames, and a step that begins where such a hold ends follows it without a release (buttons stay held, a dragged finger moves instead of lifting). A gap between steps is a release: the next frame step presses in a later frame than the release, so two taps stay two presses when the replay runs late (handing over to any step already due merged them into one press). Commas, spaces and newlines separate steps, the parser takes the whole value and up to 1,048,576 steps, ordered by a stable merge sort. DM_KEYS=@<file> reads the steps from a file: an environment value is capped by ARG_MAX (1 MiB on macOS, about 40,000 recorded steps) and iOS's env.txt takes one line per switch. A replayed press can still reach the game a frame early or late (stamped when input arrives, replayed within 5 ms of the present); the docs say so. Checked: t_hid records a known sequence, compares the exact text, parses it back and replays it with a simulated frame clock (the game's view of every frame matches), replays two taps late (two presses; the old rule fails this check) and reads a 50,000-step file of more than 1 MiB: 140 checks, also under ThreadSanitizer. Host unit tests, tool tests, docs and env-switch tests pass; regress.py not run. Co-authored-by: v0lumehi <[email protected]>
Owner
|
Thanks! Landed as 96820ed with you as co-author. Two changes on top:
The docs now say a replayed step matches its recorded frame to within a frame, not exactly. On your questions: (1) the |
Owner
|
Follow-up on question 2: replay is now frame-exact, in 710559c.
|
Know-It-All-Brother
pushed a commit
to Know-It-All-Brother/nxnative
that referenced
this pull request
Nov 9, 2026
…edds#448) DM_REC=<file> writes player 1's physical input (keyboard, mouse touches, player 1's controller and the controllers a one-player game merges into it) to the file as DM_KEYS steps, so a run plays again from the same save and build: a bug report's path without game data, or a smoke route recorded instead of written (seedds#313). It records where the front ends publish (dm_input_set, dm_pad_set_player, dm_touch_set), so the Mac and iOS front ends both feed it; DM_KEYS and DM_CTL touch through a new dm_touch_script and keep their own button path, so scripted input is never recorded. Off, a publish costs one relaxed load and branch; on, the publishing thread compares and formats into memory and a writer thread appends to the file every 250 ms and at exit. Each step is one state from the presented frame it began to the frame it ended ("f1524:A+L0.50/-0.25~f12,"), because under DM_DETCLOCK the guest clock follows the presents while seconds drift with load. DM_KEYS gains what replaying that needs: "~f<frames>" holds in frames, and a step that begins where such a hold ends follows it without a release (buttons stay held, a dragged finger moves instead of lifting). A gap between steps is a release: the next frame step presses in a later frame than the release, so two taps stay two presses when the replay runs late (handing over to any step already due merged them into one press). Commas, spaces and newlines separate steps, the parser takes the whole value and up to 1,048,576 steps, ordered by a stable merge sort. DM_KEYS=@<file> reads the steps from a file: an environment value is capped by ARG_MAX (1 MiB on macOS, about 40,000 recorded steps) and iOS's env.txt takes one line per switch. A replayed press can still reach the game a frame early or late (stamped when input arrives, replayed within 5 ms of the present); the docs say so. Checked: t_hid records a known sequence, compares the exact text, parses it back and replays it with a simulated frame clock (the game's view of every frame matches), replays two taps late (two presses; the old rule fails this check) and reads a 50,000-step file of more than 1 MiB: 140 checks, also under ThreadSanitizer. Host unit tests, tool tests, docs and env-switch tests pass; regress.py not run. Co-authored-by: v0lumehi <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #313 ("Reproducible bug reports without sharing game data":
DM_RECrecords a player's inputs with timestamps inDM_KEYSsyntax).Problem
A bug that needs a path through the game ("open the map, turn left, the sky goes white") can only be reproduced by someone who plays it the same way. The reporter can't send that path, and smoke routes for
regress.pyare written by hand.Change
DM_REC=<file>writes what the player does asDM_KEYSsteps. With the reporter's save, the same build andDM_DETCLOCK, feeding the file back asDM_KEYSreplays the path.dm_input_set(keyboard, the iOS touch gamepad),dm_pad_set_player(controllers) anddm_touch_set(mouse, iOS touches). It records player 1 as the game reads it, including controllers a one-player game merges into player 1. It lives inhle_hid.c, so iOS has it too. Scripted input (DM_KEYS,DM_CTL, Give scripted input a path of its own, so a connected controller cannot overwrite it #326) is never recorded;dm_touch_scriptkeeps scripted touches out as well.f<frame>:<keys>~f<frames>,. Idle stretches are left out.Shakeis included. A press shorter than one frame is kept as~f0.DM_DETCLOCKthe guest clock follows the presents, so frame N of a replay is frame N of the recording. Seconds since start drift with load.DM_KEYSgrows a little so the recording can be replayed. Existing routes behave as before (tool tests, incl.regress.py's andbench.py's, pass):~f<frames>holds a step for that many frames;mergesort.DM_RECunset, one branch per input publish. When on, the input thread compares and formats into memory under a mutex. A writer thread appends to the file every 250 ms and at exit (atexit, and SIGTERM throughdm_host_shutdown).docs/development.md"Recording input (DM_REC)": how to pair it withDM_DETCLOCKand a copied save, and how a recording becomes a smoke route. Also05-debugging.md,06-dev-loop.md, anddocs/env_switches.tsv.Checked
t_recint_hid.cfeeds a known sequence and checks the recorded text exactly. The sequence: keyboard A, a controller stick with drift, B tapped within one frame, a stick flick within one frame (dropped, as it should be), a dragged touch, ZR plus Shake, scripted presses that must not appear, and Y still held at exit.DM_KEYSparser and replays it on a simulated frame clock: the game's view matches in all 62 frames, and the drag replays as one finger. A second check confirms the merge sort keeps listed order at equal times.hid players: 130 checks, 0 failed, also under ThreadSanitizer.make -C dm/hostfor Mario and Breath of the Wild;make -C dm/host/tests run; tool tests,test_docs,test_env_switches; lint ratchet 0 new.DM_RECand frame-heldDM_KEYSsteps. The steps ran in order, SIGTERM took the graceful exit, and the recording stayed empty, as it should with only scripted input. A recording of real keyboard input and its replay in a game is still to do.dm/host/tests/Makefileanddocs/development.mdalso change in #386; whichever lands second needs a small rebase.Questions
DM_KEYS(~f, the hand-over without a release, whitespace, the higher limit) fine, or shouldDM_RECkeep to the old syntax?dm_guest_frame_tickwould make it exact. Worth a follow-up?DM_KEYShas no syntax for them yet.env.txt. ADM_KEYS=@<file>form would help there.Unrelated, seen while reading:
dm/host/dm_input.hdeclaresdm_pad_hook,DM_HID_RECEIPT_LOGanddm_input_sampled_right, and nothing implements them. Left alone here.