Skip to main content

Module attach

Module attach 

Source
Expand description

attach: a build that is already running, reached over the live link (ADR-0047) instead of a game started headless. It needs no project: the build is a debug build of a game with its backend’s link feature, started with SHUYI_LINK=<port>, and its log’s line shuyi link: listening on <address>, token <token> gives the address and the token.

It connects, says hello, plays the steps as a player’s input (keys, controller buttons, an action by name, waits counted in the build’s own frames: shuyi_platform::script’s steps, run’s), lets frames more frames pass, then reads the build’s status, its frame as text, its log from log_since, and, if asked, the window’s picture, written to a file. It changes nothing else in the build. The wire’s types are shuyi_platform::link’s, the build’s own.

With perf_since it reads the frames’ records too, summed up as run --perf sums them; with perf_follow it follows them instead, every 100 ms for follow_for seconds, writing each new record to a file as a perf trace’s line as the build runs, so an agent reads the file as it grows.

Structs§

AttachFollow
What perf_follow wrote.
AttachInput
What attach reaches and plays.
AttachLogEntry
One line of the build’s log, with its number.
AttachOutput
What attach saw.
AttachScreenshot
The window’s picture, as written.

Constants§

FOLLOW_EVERY
How often perf_follow reads the build’s records.
FOLLOW_FOR
How many seconds perf_follow follows when not said.
MAX_FOLLOW_FOR
The most seconds perf_follow follows.

Functions§

attach
attach: reaches the build input names, plays its steps and reads what it shows; the picture is written from cwd.
idle
frames frames with no input as waits the link plays as exactly that many: the whole seconds, then the frames left over (none for 0). A second’s 60 frames are exact in seconds, and so are fewer than 60.
parse_args
Reads attach’s arguments (not --json).
text
What attach saw, for people.
usage
The usage of attach.