(cd "$games/<id>" && ./<id> --seconds=60 --script=15000:400,16000:1 --press-len=300 --shot=out)
python3 tools/run_game.py <id> --runs 5 --seconds 60 --dump "$work/Game" --script ""
python3 tools/symbols.py "$work/Game" cf34380
python3 tools/disasm.py "$work/Game" NvRmStreamFlushSync
python3 tools/disasm.py "$work/Game" cf34240 cf343c0
build/scarletnx --scan-log ~/.local/state/scarletnx/recompiled/<id>/<id>.log [--format markdown]
--scan-log (src/common/utilities/logscan.c, also built as build/snx-logscan): a log, or the launcher's Share
log file (the game log in it), as a summary: the build (with the day its commit was made, when the log says it),
title ID, game version and GPU from the log's header, how the run ended, the game function it is pinned on (for
svcBreak, the first frame past the SDK's abort), the service commands the runtime doesn't implement, warnings, the
frames over 50 ms (how many, the slowest, and what the slowest did, from the renderer's frame lines), and a signature
that is the same for every log failing the same way. An iOS day log holds the launcher's starts one after another: the
summary is of the last one that ran a game or failed (its outcome, build and counts alone), with how many starts the
log has and how the earlier ones ended.
JSON (a line a log, versioned by schema) or a markdown summary for an issue. Paths are shortened to ~, and the
crash report's code and memory dumps are left out. The launcher's Share Log puts the same summary at the top of
scarletnx.log. A log is read once, a line at a time, in fixed memory: a gigabyte takes about two seconds.
scarletnx --mcp [--data DIR] (src/nx/runtime/driver/mcp.c): an MCP server over stdio for an agent looking into a
failure on this machine, built into the program so a player's agent has it too. .mcp.json starts it for agents
opened in the checkout (build/scarletnx --mcp --data .). Its tools: scan_log (the summary above), read_log
(a log's lines holding a text, | between alternatives, with context, or a range, or its last lines, only under
the data folder and its state, cache and settings folders), find_game (the extracted games in work/ with their
title IDs and versions), state_info (a recompiled game's save states: slot, program, when, play time, the build
and stamp that saved each, and why this build can't load one), symbolize and disassemble (as tools/symbols.py and tools/disasm.py, each A64
instruction as the A64 decoder's op and arguments: ADD_i rd=1 rn=2 imm=291 sf=1, a64.decode's name and each
argument in decimal). The last game loaded stays loaded for the next call. Its
Amberlith tools turn a confirmed report into an Amberlith case (Amberlith). Its GDB tools
(mcp_gdb.c, Usage) run one GDB over its machine interface (MI 3,
resumes as -exec-* commands in the background). They find a guest thread's KThread through its host thread's
t_hle.thread.cur, by the runtime's debug information, and guest memory at g_mem. The game reports
on GitHub come from GitHub's own MCP server or scripts/game-reports.py index.
Game reports: .github/workflows/game-reports.yml builds snx-logscan and runs scripts/game-reports.py triage on
each issue and comment. An issue with a log attached (.log, .txt, .gz, .zip) or pasted in a fenced block gets
one comment with the summary of each, edited as logs are added, the labels game report and log: <how it ended>,
and the other reports with the same signature named. triage --issue N --dry-run --logscan build/snx-logscan shows
what it would post, and gh workflow run game-reports.yml -f issue=N runs the workflow for that issue (one whose run
failed), failing on a pull request or an issue without a log. scripts/game-reports.py index [--title-id ID]
[--signature TEXT] lists the reports and their logs as JSON lines. A maintainer's status: confirmed label on a
report gets one comment: ready for an Amberlith case, with the steps. The ctest game_reports_workflow runs the
workflow's build step on the files its sparse checkout lists alone, so a file the log summary comes to include fails a
pull request until the list has it.
Runtime: --seconds=N / --frames=N, counted from the game's start, after the shader loading screen
(prepare_shaders=2, which the first run after a rebuild spends translating the game's shaders again);
--shot=out → CWD out.ppm; --shot-every=N → every N frames.
--script=ms:hexbuttons,... (or Nf:hexbuttons to press at present N), --press-len=ms (default 300).
--input-record=N records player 1's input as the game takes it (the controls', the script's and the on-screen
controls' together) to the game's slot N, 1 to 9: <game folder>/tas/<id>.<N>.snxtas, as save states are
states/<id>.<slot>.snxstate. What the slot held is replaced, and the log says how many frames that was. The file
has a line frame:buttons:lx,ly,rx,ry each present the input changed, at most one a present: frame the presents
since the game's start, buttons hex as the script's masks, each stick axis -32767 to 32767. --input-replay=N
plays slot N's recording as player 1's input: each present takes the last line at or before its frame, neutral
before the first, and the controls come back at the present after the last line's. # lines and empty ones are
left for notes; a line not in that form, an axis out of range or a frame not past the one before ends the run with
the slot, its line number and its text, and so do a slot outside 0 to 9 and one slot both recorded and played. Both
on, on two slots, record what the replay gave. A paused game takes no input, so neither writes nor plays there;
touch and motion are not recorded. The run still ends at --seconds or --frames. The replay goes by presents:
where one build takes more presents than another to load a scene, the route slides from there on.
--swkbd-text=TEXT: the software keyboard answers TEXT instead of showing its box over the game.
--pause=at:length,... pauses the whole game at at ms of the script's clock for length ms, and logs whether
guest memory and guest time stayed unchanged while it held (pause: lines).
--state-save=at:slot,... and --state-load=at:slot,... save the game to a save state slot and load one at those
times (state: lines); the files are <game folder>/states/<id>.<slot>.snxstate.
Masks: A/B/X/Y 1/2/4/8, L/R 40/80, ZL/ZR 100/200, Plus/Minus 400/800,
left/up/right/down 1000/2000/4000/8000.
run_game.py: by default, the input sequence that starts a new game in the game it was written for.
--script "" disables it.
--out DIR → runN.log + PNG (PPM without Pillow); default fresh temp dir.
Summary: exit, PC/symbol (--dump), frames/FPS. Unknown args pass through, e.g. --fps-limit=0.
Guest VAs: hex; disasm function queries: substrings. Disasm requires llvm-objcopy + llvm-objdump.
symbols.py and disasm.py read the modules with the recompiler's loader, through
build/scarletnx --dump-modules PROGRAM DIR (SNX_SCARLETNX names another binary), cached per game folder in
~/.cache/scarletnx/module-dumps. The dump's format is described in src/nx/loader/loader.h.
--log=2: verbose; Windows --profile=1: profile.txt every 10 s.
The game's [Debug] settings (Settings) are for investigating. Each is also given for one run as
--key=value on the game's command line. One not at its default, and the GDB stub, is said at the top of the game's
picture while it runs (Debug on: log=2, gdbstub, a text setting by its key alone), in the log's header
(debug: log=2 (default 1), gdbstub), and in the launcher, as (Debug on) on the game's row and its Play and the list
beside it:
--log-max=MiB (1 to 1024, default 16): the game log's size. Past it the log keeps the run's start (its first
64 KiB) and its last lines, half of log_max in all, with a line saying how much went between them
(log: reached log_max=16 MiB: 7.4 MiB of lines between the run's start and here cut), and the first time the
game's picture says so for 3 s. --log=2 with a long run is what fills it.--log=2 also logs the process's resources, alike on every system. Each second a resources: line: the
footprint, what the system still gives the process (? where it tells none) and the renderer's blocks of device memory; on iOS
Metal's memory, the thermal state and low power mode too. Every 5 s a threads: line: the three threads with the
most time on the processors, by the names the runtime gives them (Linux and Android keep 15 bytes of a name,
FreeBSD 19). A memory: under N MiB free line, with each GPU heap, the first time what the system still gives
falls under 1024, 512, 256 and 128 MiB: on iOS the app's own room, elsewhere the system's free memory.--log=2 also counts the IPC requests the services serve, by service and command, with the time each took from
its arrival to its reply (the clock's, so a command that waits in its handler counts the wait). At the renderer's
first present and every 600 after, an ipc: line gives the requests since the line before, their time, and the 8
commands that took the most (ISystemClock cmd 0 600 in 0.412 ms). Up to 1024 commands count apart; the line
gives the rest as one sum.memory: line with the same values and each
GPU heap, 6 in a run at most: the memory pressure of iOS and macOS, SDL's low memory event (iOS; Android up to 13,
and from 14 only as the app goes to the background), Linux's pressure stall trigger (tasks waiting for memory
0.2 s of 2 s; a kernel from 6.5 with PSI, else a line says why there is none) and Windows' low memory
notification. FreeBSD tells a process none. A Vulkan out-of-memory logs each heap and the descriptor pools, at
the first 3.--gpu-trace-target=0x5acf62e00[:bytes]: logs (gpu-trace-target:, at most 64 lines of each kind) the clears
and draws that write a render target starting in that GPU address range, with its size, vertex or index count and
shader addresses. A color clear lists every bound target in the range. Write the address with 0x; without a size
the range is one byte. It finds what produced a wrong intermediate target.nvn: the game resolved
NAME, which nvn doesn't implement), and the game stops with its name when it calls one. NVN
has what the SDK does.Made from docs/dev/development.md at 69237645142c. GPL-3.0-or-later.