startup: run a package with shared presets (console, OS, GPU) #3380

Manually merged
github merged 8 commits from github-bot/gh-3378 into gh-pr/3378/base 2026-11-29 12:22:08 +00:00 AGit
Owner

@⁠pigalot on GitHub · 2026-11-28 17:00 UTC · original
pigalot:startup/run-presets → main · +782 −0 · 7 files · 8 commits · merged 2026-11-29 12:16 UTC

Change

Adds tools/startup/run_preset.py, a launcher for runs of a local package. It has three choices: console (x or s), GPU (nvidia or amd) and OS (win11, win10 or linux; the host by default). Every other setting comes from tools/startup/run_presets.json, which is applied in layers: base, then OS, console, GPU. Each layer says why its settings are there and gives the measured run behind them.

.\out\pe-env\Scripts\python.exe -B tools\startup\run_preset.py --package <package root> --console x --gpu nvidia

The launcher also:

  • stages the executable folder's PE files in the run folder, hard-linked where the volume allows and copied otherwise, so the package is never written;
  • gives each run an empty storage folder;
  • maps the package on G: with subst for the run and removes the mapping afterwards. It refuses a letter that is taken, unless subst already maps it onto this package;
  • writes the merged settings to settings.json, starts run.ps1 (or run.sh on Linux) and prints triage_run.py for the logs.

--print shows the merged settings and the exact command without starting anything.

The base layer sets:

  • -SuspendOthers 0 (#3334);
  • X2W_PROBE_PRECHECK=0 (#3315);
  • X2W_D3D12_RING_RELEASE_AT_SUBMIT (#2949), X2W_D3D12_ROOT_SRV_AT_DRAW (#3028) and X2W_D3D12_TABLE_ALIAS (#2977);
  • X2W_HIDE_TITLE_WINDOW=1, so only the output window stays on screen;
  • the switches common to the furthest #870 reports.

AGENTS.md gets a short section that points to the launcher and asks contributors to keep the presets current, with evidence for each change.

Why subst and not run.ps1 -MapDrive: -MapDrive rewrites only opens that pass through the debugger's file hooks. With it, a real-package run stayed on its first screens, with 11 pipelines translated in 420 s. The same settings on a subst drive kept loading and reached 76.

Refs #870, #3333

Verification

Build: 4d1b42bd (this branch on aec2e084), release, Windows 11 Pro 26200, NVIDIA.

  • python -B tests/startup_run_preset_check.py: OK: 12 preset choices, staging and controls. The check covers:

    • every console × OS × GPU choice against the real run.ps1/run.sh switch names;
    • the layer merge rules;
    • staging on a synthetic package, checking the package is left unchanged;
    • subst handling with a fake subst.

    Negative controls, each of which must be refused or caught:

    • a misspelt switch, an unknown key, a non-X2W env name, a number as an env value, an empty choice list and an unknown choice;
    • a letter mapped elsewhere or held by a volume, and a failing subst;
    • a config without an Executable.

    Taking X2W_HIDE_TITLE_WINDOW out of base fails all 12 choices.

  • python -B tests/startup_run_ps1_check.py: exit 0.

  • python -B tests/docs_links_check.py: Checked 156 Markdown files and 681 links.

  • tests/startup_run_sh_check.py skips on Windows (POSIX launcher), so it was not run.

Real-package runs (local data, not reproducible from this repository), Series X / NVIDIA preset, 420 s, same input script and seed storage on every run:

Build Settings Result
ec71c290 + #3334 previous shared settings, holding off alive, 75,028 translated draws, 62 pipelines
ec71c290 + #3334 this preset with -MapDrive alive, 73,780 draws, 11 pipelines
ec71c290 + #3334 this preset with subst, before PROBE_PRECHECK=0 alive, 162,303 draws, 74 pipelines, 2,134 textures
ec71c290 + #3334 + X2W_PROBE_PRECHECK=0 alive, 1,142,089 draws, 78 pipelines, 5,372 textures
ec71c290 + #3334 + X2W_HIDE_TITLE_WINDOW=1 alive, title window hidden once and not shown again, 975,488 draws, 77 pipelines
4d1b42bd (this branch) as committed alive, title window hidden once, ConsoleMode 0x64, input first read at 52 s, 655,334 draws, 79 / 482 pipelines translated / missing, 4,247 textures

The Series S preset (--console s) on ec71c290 + #3334 was also alive at 420 s, with 1,008,389 draws and 75 pipelines.

With one run per configuration, the draw counts vary a lot from run to run: the two Series X runs with the same settings drew 975k and 1.14M. The table supports "runs to the timeout with these settings", not a ranking of small differences.

Evidence and follow-up

Not measured: AMD, Linux (Wine/Proton) and Windows 10. The AMD and NVIDIA layers are deliberately identical. They exist so that a measured difference has somewhere to go. The Linux layer copies run.sh's defaults and the lazy-commit pair from the one reported Linux run (#1198, #2911).

Left out on purpose:

  • X2W_D3D12_VIEW_TOKEN_GUARDED (#3097), because main does not read it yet;
  • lazy commit on Windows, because our runs with it crashed at about 190 to 250 s;
  • the native-shader switches, because they need a desktop DXC and packs that not every run has.

Whether keyboard input reaches the title after its window is hidden is still unmeasured. The output window belongs to the same process, so the input stand-in's focus check still sees the process in front. The runs above used the input script.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated README/docs when a capability or build requirement changed.
  • I did not include game files, dumps, distribution links or secrets.

This pull request was AI-assisted.

**@⁠pigalot** on GitHub · 2026-11-28 17:00 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3378) `pigalot:startup/run-presets` → `main` · +782 −0 · 7 files · 8 commits · merged 2026-11-29 12:16 UTC ## Change Adds `tools/startup/run_preset.py`, a launcher for runs of a local package. It has three choices: console (`x` or `s`), GPU (`nvidia` or `amd`) and OS (`win11`, `win10` or `linux`; the host by default). Every other setting comes from `tools/startup/run_presets.json`, which is applied in layers: base, then OS, console, GPU. Each layer says why its settings are there and gives the measured run behind them. ```powershell .\out\pe-env\Scripts\python.exe -B tools\startup\run_preset.py --package <package root> --console x --gpu nvidia ``` The launcher also: - stages the executable folder's PE files in the run folder, hard-linked where the volume allows and copied otherwise, so the package is never written; - gives each run an empty storage folder; - maps the package on `G:` with `subst` for the run and removes the mapping afterwards. It refuses a letter that is taken, unless `subst` already maps it onto this package; - writes the merged settings to `settings.json`, starts `run.ps1` (or `run.sh` on Linux) and prints `triage_run.py` for the logs. `--print` shows the merged settings and the exact command without starting anything. The base layer sets: - `-SuspendOthers 0` (#3334); - `X2W_PROBE_PRECHECK=0` (#3315); - `X2W_D3D12_RING_RELEASE_AT_SUBMIT` (#2949), `X2W_D3D12_ROOT_SRV_AT_DRAW` (#3028) and `X2W_D3D12_TABLE_ALIAS` (#2977); - `X2W_HIDE_TITLE_WINDOW=1`, so only the output window stays on screen; - the switches common to the furthest #870 reports. `AGENTS.md` gets a short section that points to the launcher and asks contributors to keep the presets current, with evidence for each change. Why `subst` and not `run.ps1 -MapDrive`: `-MapDrive` rewrites only opens that pass through the debugger's file hooks. With it, a real-package run stayed on its first screens, with 11 pipelines translated in 420 s. The same settings on a `subst` drive kept loading and reached 76. Refs #870, #3333 ## Verification Build: `4d1b42bd` (this branch on `aec2e084`), release, Windows 11 Pro 26200, NVIDIA. - `python -B tests/startup_run_preset_check.py`: `OK: 12 preset choices, staging and controls`. The check covers: - every console × OS × GPU choice against the real `run.ps1`/`run.sh` switch names; - the layer merge rules; - staging on a synthetic package, checking the package is left unchanged; - `subst` handling with a fake `subst`. Negative controls, each of which must be refused or caught: - a misspelt switch, an unknown key, a non-X2W env name, a number as an env value, an empty choice list and an unknown choice; - a letter mapped elsewhere or held by a volume, and a failing `subst`; - a config without an `Executable`. Taking `X2W_HIDE_TITLE_WINDOW` out of base fails all 12 choices. - `python -B tests/startup_run_ps1_check.py`: exit 0. - `python -B tests/docs_links_check.py`: `Checked 156 Markdown files and 681 links.` - `tests/startup_run_sh_check.py` skips on Windows (POSIX launcher), so it was not run. Real-package runs (local data, not reproducible from this repository), Series X / NVIDIA preset, 420 s, same input script and seed storage on every run: | Build | Settings | Result | |---|---|---| | `ec71c290` + #3334 | previous shared settings, holding off | alive, 75,028 translated draws, 62 pipelines | | `ec71c290` + #3334 | this preset with `-MapDrive` | alive, 73,780 draws, 11 pipelines | | `ec71c290` + #3334 | this preset with `subst`, before `PROBE_PRECHECK=0` | alive, 162,303 draws, 74 pipelines, 2,134 textures | | `ec71c290` + #3334 | + `X2W_PROBE_PRECHECK=0` | alive, 1,142,089 draws, 78 pipelines, 5,372 textures | | `ec71c290` + #3334 | + `X2W_HIDE_TITLE_WINDOW=1` | alive, title window hidden once and not shown again, 975,488 draws, 77 pipelines | | `4d1b42bd` (this branch) | as committed | alive, title window hidden once, ConsoleMode 0x64, input first read at 52 s, 655,334 draws, 79 / 482 pipelines translated / missing, 4,247 textures | The Series S preset (`--console s`) on `ec71c290` + #3334 was also alive at 420 s, with 1,008,389 draws and 75 pipelines. With one run per configuration, the draw counts vary a lot from run to run: the two Series X runs with the same settings drew 975k and 1.14M. The table supports "runs to the timeout with these settings", not a ranking of small differences. ## Evidence and follow-up Not measured: AMD, Linux (Wine/Proton) and Windows 10. The AMD and NVIDIA layers are deliberately identical. They exist so that a measured difference has somewhere to go. The Linux layer copies `run.sh`'s defaults and the lazy-commit pair from the one reported Linux run (#1198, #2911). Left out on purpose: - `X2W_D3D12_VIEW_TOKEN_GUARDED` (#3097), because main does not read it yet; - lazy commit on Windows, because our runs with it crashed at about 190 to 250 s; - the native-shader switches, because they need a desktop DXC and packs that not every run has. Whether keyboard input reaches the title after its window is hidden is still unmeasured. The output window belongs to the same process, so the input stand-in's focus check still sees the process in front. The runs above used the input script. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I considered a negative control or failure case for a new fixture. - [x] I updated README/docs when a capability or build requirement changed. - [x] I did not include game files, dumps, distribution links or secrets. This pull request was AI-assisted.
tools/startup/run_preset.py takes three choices (--console x|s, --gpu nvidia|amd, --os win11|win10|linux,
default this host) and reads every other setting from tools/startup/run_presets.json: a base layer, then
one layer per choice, each entry with the reason it is there. The launcher stages the executable's PE files
(hard links, else copies) so the package is never written, gives every run an empty storage folder, maps the
package on its drive letter with subst for the run, starts run.ps1 or run.sh, and runs triage_run.py.

The base layer turns off #1408's thread holding (run.ps1 -SuspendOthers 0, #3332) and uses subst rather
than run.ps1 -MapDrive; the measurements behind both, and behind the D3D12 switches it sets, are in the
preset's "why" text and docs/startup-runtime.md.

tests/startup_run_preset_check.py checks all 12 choices against the switches run.ps1 and run.sh define,
the layer rules, drive mapping through a fake subst, and staging on a synthetic package, with refusal
controls. Registered in CTest and the python-linux check list.
X2W_PROBE_PRECHECK=0 (#3313) skips the VirtualQuery the stand-ins run before each probe and copy while a
debugger is attached; title runs always start under debug_launch.py. Same package, input and 420 s, NVIDIA,
Windows 11, ec71c290: 1,142,089 vs 162,303 translated draws, 80,175 vs 15,001 executes, 5,372 vs 2,134
textures uploaded. The reason is recorded in run_presets.json and docs/startup-runtime.md.
The base layer now sets X2W_HIDE_TITLE_WINDOW=1 on every host, so once
presents reach the output window the title's own window, which nothing
presents to, is hidden. Dialogs stay visible and the window comes back
when a present misses the output window. The Linux layer's
hide_title_window switch is dropped: run.sh's flag only exports the same
variable.

The preset check asserts the variable for all 12 choices; removing it
from base fails all 12.

Real run (420 s, Series X / NVIDIA preset, Windows 11, ec71c290): the
stand-in logged that it hid one title window and never showed it again,
the run was alive at the timeout, and the title read input from 58 s.
Translated draws were 975,488 (1,142,089 in the run before this change).
AGENTS.md now says to start package runs with tools/startup/run_preset.py, and to keep tools/startup/run_presets.json current: add a helpful opt-in switch to its layer, change a setting when a measured run shows it, put the evidence in the layer's why, and leave out switches that main does not read yet.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 17:03:21 +00:00
Author
Owner

@⁠Leyukaka on GitHub · 2026-11-28 17:13 UTC · original · requested changes

Reviewed 4d1b42bd by its diff.

The package folder can be written. stage() in tools/startup/run_preset.py hard-links every .exe/.dll of the executable's folder into the stage (os.link(f, target), copy only on OSError), and the command runs the staged executable. run.ps1 then copies the 8 stand-ins into that folder ($runDir = Split-Path -Parent $Exe, Copy-Item ... -Force, tools/startup/run.ps1:43-47), and run.sh does the same with cp -f (run.sh:99-102). If the executable's folder holds a file with a stand-in's name and the stage is on the same volume, the staged entry is a hard link to the package's file. cp -f truncates and rewrites an existing destination in place, so on Linux the copy writes into the package's file when it is writable; Copy-Item -Force likely does the same on Windows (not measured). The docs say "the package folder itself is never written", and the stage() docstring "Nothing under the package is written". Fix: do not link a file whose name is one of the stand-ins (copy or skip it), or copy instead of linking, and add a test with such a file that checks the package copy is unchanged.

Caller environment is not recorded. The child starts from dict(os.environ) and the layers are applied on top (env = dict(os.environ); env.update(settings["env"])). An X2W_* already set in the caller's shell reaches the run, settings.json (choice, run, env, layers, command) does not record it, and an env: null in a layer cannot remove it, because null only drops values from earlier layers. Fix: record the inherited X2W_* values in settings.json and make null remove the variable from the child's environment. If inherited values are dropped instead, keep the ones run.sh reads from the caller (X2W_WIN_PYTHON, X2W_FXC, X2W_HOST_PYTHON).

**@⁠Leyukaka** on GitHub · 2026-11-28 17:13 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3378#pullrequestreview-6099224088) · **requested changes** Reviewed `4d1b42bd` by its diff. **The package folder can be written.** `stage()` in `tools/startup/run_preset.py` hard-links every `.exe`/`.dll` of the executable's folder into the stage (`os.link(f, target)`, copy only on `OSError`), and the command runs the staged executable. `run.ps1` then copies the 8 stand-ins into that folder (`$runDir = Split-Path -Parent $Exe`, `Copy-Item ... -Force`, `tools/startup/run.ps1:43-47`), and `run.sh` does the same with `cp -f` (`run.sh:99-102`). If the executable's folder holds a file with a stand-in's name and the stage is on the same volume, the staged entry is a hard link to the package's file. `cp -f` truncates and rewrites an existing destination in place, so on Linux the copy writes into the package's file when it is writable; `Copy-Item -Force` likely does the same on Windows (not measured). The docs say "the package folder itself is never written", and the `stage()` docstring "Nothing under the package is written". Fix: do not link a file whose name is one of the stand-ins (copy or skip it), or copy instead of linking, and add a test with such a file that checks the package copy is unchanged. **Caller environment is not recorded.** The child starts from `dict(os.environ)` and the layers are applied on top (`env = dict(os.environ); env.update(settings["env"])`). An `X2W_*` already set in the caller's shell reaches the run, `settings.json` (`choice`, `run`, `env`, `layers`, `command`) does not record it, and an `env: null` in a layer cannot remove it, because `null` only drops values from earlier layers. Fix: record the inherited `X2W_*` values in `settings.json` and make `null` remove the variable from the child's environment. If inherited values are dropped instead, keep the ones `run.sh` reads from the caller (`X2W_WIN_PYTHON`, `X2W_FXC`, `X2W_HOST_PYTHON`).
Author
Owner

@⁠JohnConnorNPC on GitHub · 2026-11-28 17:15 UTC · original

Thanks for this. Checked at 4d1b42bd: the trial merge onto main aec2e084 is clean (git merge-tree --write-tree, rc 0), CI is 3/3 green, startup_run_preset_check.py prints OK: 12 preset choices, staging and controls, the run.sh/run.ps1 text checks, docs links and check fragments pass, 11 of 11 mutations of the new check fail it, and nothing under src/ changes. I'd ask for one change before merge.

MUST: run.sh writes into the package through the hard link. stage() calls os.link for every .exe/.dll in the executable's folder. run.sh then runs cp -f "$build_dir/$dll.dll" "$run_dir/" for the 8 stand-in names. That rewrites the linked file in place, so a package that ships one of those names gets modified, even though the docs say the package is never written. To reproduce on a synthetic package (Linux, repo root):

P=/tmp/p; mkdir -p $P/pkg/bin $P/build && printf 'MZ pkg' >$P/pkg/bin/xg_xs.dll && printf 'MZ exe' >$P/pkg/bin/t.exe && printf 'MZ stand-in' >$P/build/xg_xs.dll
python3 -c "import sys; sys.path.insert(0, 'tools/startup'); import run_preset as r; from pathlib import Path as P; print(r.stage(P('$P/pkg'), P('$P/pkg/bin/t.exe'), P('$P/run/stage'))[1:])"
cp -f $P/build/xg_xs.dll $P/run/stage/bin/ && cat $P/pkg/bin/xg_xs.dll

This prints (2, 0), so both files were linked, and then MZ stand-in: the package's own file was replaced. run.ps1's Copy-Item … -Force probably does the same on NTFS, but I didn't run it on Windows. I also haven't measured whether a real package ships any of these names. This would show it: ls <exe folder> | grep -ixE '(xmem|d3d12_xs|AcpHal|XCRDAPI|chad|xapu|xg_xs|GameInput)\.dll'. The check's "package unchanged" test covers only stage(), and its fixture has no stand-in name. Suggested fix: copy (or skip) the stand-in names instead of linking them, and add one to the fixture along with a run.sh-style copy step.

SHOULD: the check AMD and NVIDIA differ without a recorded reason fails on exactly the edit that the PR body ("so that a measured difference has somewhere to go") and the new AGENTS.md text ("put it in that host's layer") invite. Adding "env": {"X2W_SPLIT_INDIRECT_DISPATCH": "1"} to gpu.amd, with the reason in its why, makes python3 tests/startup_run_preset_check.py exit 1 with FAIL: win11: AMD and NVIDIA differ without a recorded reason (win10 and linux fail the same way). Could it either be dropped, or accept a difference whose key is named in that layer's why?

Minor: Linux --suspend-others 0 is never asserted (only Windows -SuspendOthers is), and removing -StoragePath crashes the check in cmd.index (ValueError) instead of giving a named FAIL.

This comment was AI-assisted.

**@⁠JohnConnorNPC** on GitHub · 2026-11-28 17:15 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3378#issuecomment-7242874870) Thanks for this. Checked at 4d1b42bd: the trial merge onto main aec2e084 is clean (`git merge-tree --write-tree`, rc 0), CI is 3/3 green, `startup_run_preset_check.py` prints `OK: 12 preset choices, staging and controls`, the run.sh/run.ps1 text checks, docs links and check fragments pass, 11 of 11 mutations of the new check fail it, and nothing under `src/` changes. I'd ask for one change before merge. **MUST: run.sh writes into the package through the hard link.** `stage()` calls `os.link` for every .exe/.dll in the executable's folder. run.sh then runs `cp -f "$build_dir/$dll.dll" "$run_dir/"` for the 8 stand-in names. That rewrites the linked file in place, so a package that ships one of those names gets modified, even though the docs say the package is never written. To reproduce on a synthetic package (Linux, repo root): ``` P=/tmp/p; mkdir -p $P/pkg/bin $P/build && printf 'MZ pkg' >$P/pkg/bin/xg_xs.dll && printf 'MZ exe' >$P/pkg/bin/t.exe && printf 'MZ stand-in' >$P/build/xg_xs.dll python3 -c "import sys; sys.path.insert(0, 'tools/startup'); import run_preset as r; from pathlib import Path as P; print(r.stage(P('$P/pkg'), P('$P/pkg/bin/t.exe'), P('$P/run/stage'))[1:])" cp -f $P/build/xg_xs.dll $P/run/stage/bin/ && cat $P/pkg/bin/xg_xs.dll ``` This prints `(2, 0)`, so both files were linked, and then `MZ stand-in`: the package's own file was replaced. run.ps1's `Copy-Item … -Force` probably does the same on NTFS, but I didn't run it on Windows. I also haven't measured whether a real package ships any of these names. This would show it: `ls <exe folder> | grep -ixE '(xmem|d3d12_xs|AcpHal|XCRDAPI|chad|xapu|xg_xs|GameInput)\.dll'`. The check's "package unchanged" test covers only `stage()`, and its fixture has no stand-in name. Suggested fix: copy (or skip) the stand-in names instead of linking them, and add one to the fixture along with a run.sh-style copy step. **SHOULD:** the check `AMD and NVIDIA differ without a recorded reason` fails on exactly the edit that the PR body ("so that a measured difference has somewhere to go") and the new AGENTS.md text ("put it in that host's layer") invite. Adding `"env": {"X2W_SPLIT_INDIRECT_DISPATCH": "1"}` to `gpu.amd`, with the reason in its `why`, makes `python3 tests/startup_run_preset_check.py` exit 1 with `FAIL: win11: AMD and NVIDIA differ without a recorded reason` (win10 and linux fail the same way). Could it either be dropped, or accept a difference whose key is named in that layer's `why`? Minor: Linux `--suspend-others 0` is never asserted (only Windows `-SuspendOthers` is), and removing `-StoragePath` crashes the check in `cmd.index` (ValueError) instead of giving a named FAIL. This comment was AI-assisted.
run.ps1 (Copy-Item -Force) and run.sh (cp -f) copy the 8 stand-ins next to the staged executable and
rewrite an existing file in place. A package file with a stand-in's name was hard-linked into the stage,
so that copy wrote into the package. Measured on NTFS with a synthetic package: after Copy-Item -Force
under pwsh 7.7 and Windows PowerShell 5.1, the package's linked xg_xs.dll held the stand-in's bytes.

stage() now always copies a file whose name (any case) is one of STAND_INS. The check stages a package
with GameInput.dll and XMEM.dll, rewrites the stand-ins over the stage the way the scripts do, and
compares the package; a control with the names linked must change it. STAND_INS is checked against the
lists in run.ps1 and run.sh.
The run's environment starts from the caller's shell. An X2W_* value set there reached the run without
appearing in settings.json, and a layer's null only dropped an earlier layer's value, not the caller's.

merge() now also returns `unset`, the keys whose last value is null, and child_env() removes them from
the child's environment before the layers apply. The X2W_* and WINE* values that reach the run unchanged
are recorded in settings.json as `inherited_env` and listed by --print, so the variables run.sh reads from
the caller (X2W_WIN_PYTHON, X2W_FXC, X2W_HOST_PYTHON) are kept and shown. The check covers child_env()
and a run with the child start replaced: the environment it is given and what settings.json records.
The check refused any difference between the AMD and NVIDIA merges, so the edit the docs ask for (a
measured switch in that host's layer, with its reason) failed it: adding X2W_SPLIT_INDIRECT_DISPATCH to
gpu.amd printed "AMD and NVIDIA differ without a recorded reason".

A difference in env or run between GPU choices is now accepted when each GPU layer that sets the key
names it in its `why`, for every OS and console. Controls: that same edit passes, and an unnamed env value
plus an unnamed run option fail on every OS and console. AGENTS.md and docs/startup-runtime.md say to name
the switch in the layer's why.
The Linux commands were never checked for --suspend-others 0, only the Windows -SuspendOthers. A command
without -StoragePath, --storage, -SuspendOthers or -Seconds raised ValueError in cmd.index instead of a
named FAIL. arg_after() returns None for a missing flag. Mutations: dropping -StoragePath gives 8 named
FAILs (per-run storage), and leaving --suspend-others out of run.sh commands gives 4.
Author
Owner

@⁠pigalot on GitHub · 2026-11-28 17:42 UTC · original

Thanks @⁠Leyukaka and @⁠JohnConnorNPC. Pushed four commits on top of 4d1b42bd; the branch still merges
cleanly onto current main (git merge-tree --write-tree, rc 0) and nothing under src/ changes.

Package written through the hard link (both of you). Confirmed on Windows too: on NTFS, with a synthetic
package, Copy-Item -Force over a hard-linked xg_xs.dll replaced the package's file under pwsh 7.7 and
Windows PowerShell 5.1. Fixed in 6d656cdf: stage() always copies a file whose name (any case) is one of
the 8 stand-ins, and links only the rest. STAND_INS in run_preset.py is checked against the lists in
run.ps1 and run.sh. The check now stages a package with GameInput.dll and XMEM.dll, rewrites the
stand-ins over the stage the way the scripts do (an in-place write), and compares the package; a control with
those names linked must change it. John's repro on the new head prints (1, 1) and then MZ pkg.

Caller environment (Leyukaka). d2215885: merge() also returns unset (keys whose last value is
null), and those are removed from the child's environment, so null now also drops a value set in the
caller's shell. Caller X2W_* and WINE* values that reach the run are kept (so X2W_WIN_PYTHON, X2W_FXC,
X2W_HOST_PYTHON still work), written to settings.json as inherited_env, and listed by --print. The
check covers it end to end with the child start replaced: the environment it gets and what settings.json
records.

GPU check vs. the documented edit (John, SHOULD). 5f28d9b2: a difference between GPU choices (env or
run) is now accepted when each GPU layer that sets the key names it in its why, for every OS and console.
Your edit (X2W_SPLIT_INDIRECT_DISPATCH in gpu.amd) passes; an unnamed env value and an unnamed run option
fail. AGENTS.md and the docs say to name the switch in the layer's why.

Minor (John). 30fdfe5e: Linux commands are checked for --suspend-others 0, and a missing flag gives a
named FAIL instead of a ValueError (dropping -StoragePath now gives 8 per-run storage FAILs).

After each commit: startup_run_preset_check.py (OK: 12 preset choices, staging and controls, also under
Linux), startup_run_ps1_check.py and docs_links_check.py pass. Each new check was mutation-tested: the old
linking, the old environment handling, a missing -StoragePath and a missing --suspend-others each fail it.

This reply was AI-assisted.

**@⁠pigalot** on GitHub · 2026-11-28 17:42 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3378#issuecomment-7243226095) Thanks @⁠Leyukaka and @⁠JohnConnorNPC. Pushed four commits on top of `4d1b42bd`; the branch still merges cleanly onto current main (`git merge-tree --write-tree`, rc 0) and nothing under `src/` changes. **Package written through the hard link (both of you).** Confirmed on Windows too: on NTFS, with a synthetic package, `Copy-Item -Force` over a hard-linked `xg_xs.dll` replaced the package's file under pwsh 7.7 and Windows PowerShell 5.1. Fixed in `6d656cdf`: `stage()` always copies a file whose name (any case) is one of the 8 stand-ins, and links only the rest. `STAND_INS` in `run_preset.py` is checked against the lists in `run.ps1` and `run.sh`. The check now stages a package with `GameInput.dll` and `XMEM.dll`, rewrites the stand-ins over the stage the way the scripts do (an in-place write), and compares the package; a control with those names linked must change it. John's repro on the new head prints `(1, 1)` and then `MZ pkg`. **Caller environment (Leyukaka).** `d2215885`: `merge()` also returns `unset` (keys whose last value is `null`), and those are removed from the child's environment, so `null` now also drops a value set in the caller's shell. Caller `X2W_*` and `WINE*` values that reach the run are kept (so `X2W_WIN_PYTHON`, `X2W_FXC`, `X2W_HOST_PYTHON` still work), written to `settings.json` as `inherited_env`, and listed by `--print`. The check covers it end to end with the child start replaced: the environment it gets and what `settings.json` records. **GPU check vs. the documented edit (John, SHOULD).** `5f28d9b2`: a difference between GPU choices (env or run) is now accepted when each GPU layer that sets the key names it in its `why`, for every OS and console. Your edit (`X2W_SPLIT_INDIRECT_DISPATCH` in `gpu.amd`) passes; an unnamed env value and an unnamed run option fail. AGENTS.md and the docs say to name the switch in the layer's `why`. **Minor (John).** `30fdfe5e`: Linux commands are checked for `--suspend-others 0`, and a missing flag gives a named FAIL instead of a `ValueError` (dropping `-StoragePath` now gives 8 `per-run storage` FAILs). After each commit: `startup_run_preset_check.py` (`OK: 12 preset choices, staging and controls`, also under Linux), `startup_run_ps1_check.py` and `docs_links_check.py` pass. Each new check was mutation-tested: the old linking, the old environment handling, a missing `-StoragePath` and a missing `--suspend-others` each fail it. This reply was AI-assisted.
Author
Owner

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

LGTM — well-structured launcher with solid test coverage.

run_preset.py and run_presets.json replace hand-written run lines with layered settings (base → OS → console → GPU). Each entry carries its why. Staging hard-links PE files while protecting stand-in-named DLLs from in-place rewrite. Drive mapping via subst (not -MapDrive) avoids debugger file hook issues. The Python fixture covers all console/OS/GPU combos, staging, refusals, and the --print path.

Ready to land.

**@⁠KelboLive** on GitHub · 2026-11-28 20:39 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3378#pullrequestreview-6099993665) · **approved these changes** LGTM — well-structured launcher with solid test coverage. `run_preset.py` and `run_presets.json` replace hand-written run lines with layered settings (base → OS → console → GPU). Each entry carries its `why`. Staging hard-links PE files while protecting stand-in-named DLLs from in-place rewrite. Drive mapping via `subst` (not `-MapDrive`) avoids debugger file hook issues. The Python fixture covers all console/OS/GPU combos, staging, refusals, and the --print path. Ready to land.
Author
Owner

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

LGTM — well-structured launcher with layered config and thorough tests.

run_preset.py starts a package run with settings from run_presets.json: base, OS, console, GPU layers merge in order; null unsets; strict validation (no unknown keys, no non-X2W env, string values only). Launcher stages PE files (hard-linked, stand-ins always copied), maps package on subst drive, disables thread holding, hides title window, runs run.ps1/run.sh, and prints triage. Presets file documents every setting with why, runs, and measured results. Test covers layer merging, GPU unexplained differences check, drive mapping, staging, and negative controls.

Ready to land.

**@⁠KelboLive** on GitHub · 2026-11-28 21:06 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3378#pullrequestreview-6100088928) · **approved these changes** LGTM — well-structured launcher with layered config and thorough tests. run_preset.py starts a package run with settings from run_presets.json: base, OS, console, GPU layers merge in order; null unsets; strict validation (no unknown keys, no non-X2W env, string values only). Launcher stages PE files (hard-linked, stand-ins always copied), maps package on subst drive, disables thread holding, hides title window, runs run.ps1/run.sh, and prints triage. Presets file documents every setting with why, runs, and measured results. Test covers layer merging, GPU unexplained differences check, drive mapping, staging, and negative controls. Ready to land.
Author
Owner

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

LGTM — clean launcher for shared real-run settings.

run_preset.py picks console (x/s), GPU (nvidia/amd), OS (win11/win10/linux) and merges layered settings from run_presets.json (base → OS → console → GPU). Each layer records why it exists. Null env values unset earlier settings. Staging hard-links PE files (copies stand-in-named ones), maps the package via subst (not run.ps1 -MapDrive), disables thread holding (#1408), and hides the title window once presents reach the output window.

run_presets.json ships measured settings: RING_RELEASE_AT_SUBMIT, ROOT_SRV_AT_DRAW, TABLE_ALIAS, RUNTIME_LOCAL, PROBE_PRECHECK=0, etc. with cited evidence. GPU layers are documented with why fields.

Tests cover layer merging, null unsets, caller env recording, drive mapping (fake subst), staging (hard links, stand-in copies, synthetic package), validation (unknown keys, misspelt switches, non-X2W env names), and --print output.

Documentation in AGENTS.md and startup-runtime.md explains the workflow and maintenance rules.

**@⁠KelboLive** on GitHub · 2026-11-28 21:17 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3378#pullrequestreview-6100121881) · **approved these changes** LGTM — clean launcher for shared real-run settings. run_preset.py picks console (x/s), GPU (nvidia/amd), OS (win11/win10/linux) and merges layered settings from run_presets.json (base → OS → console → GPU). Each layer records why it exists. Null env values unset earlier settings. Staging hard-links PE files (copies stand-in-named ones), maps the package via subst (not run.ps1 -MapDrive), disables thread holding (#1408), and hides the title window once presents reach the output window. run_presets.json ships measured settings: RING_RELEASE_AT_SUBMIT, ROOT_SRV_AT_DRAW, TABLE_ALIAS, RUNTIME_LOCAL, PROBE_PRECHECK=0, etc. with cited evidence. GPU layers are documented with why fields. Tests cover layer merging, null unsets, caller env recording, drive mapping (fake subst), staging (hard links, stand-in copies, synthetic package), validation (unknown keys, misspelt switches, non-X2W env names), and --print output. Documentation in AGENTS.md and startup-runtime.md explains the workflow and maintenance rules.
Author
Owner

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

LGTM — clean launcher for shared real-run settings.

run_preset.py picks console (x/s), GPU (nvidia/amd), OS (win11/win10/linux) and merges layered settings from run_presets.json (base → OS → console → GPU). Each layer records why it exists. Null env values unset earlier settings. Staging hard-links PE files (copies stand-in-named ones), maps the package via subst (not run.ps1 -MapDrive), disables thread holding (#1408), and hides the title window once presents reach the output window.

run_presets.json ships measured settings: RING_RELEASE_AT_SUBMIT, ROOT_SRV_AT_DRAW, TABLE_ALIAS, RUNTIME_LOCAL, PROBE_PRECHECK=0, etc. with cited evidence. GPU layers are documented with why fields.

Tests cover layer merging, null unsets, caller env recording, drive mapping (fake subst), staging (hard links, stand-in copies, synthetic package), validation (unknown keys, misspelt switches, non-X2W env names), and --print output.

Documentation in AGENTS.md and startup-runtime.md explains the workflow and maintenance rules.

**@⁠KelboLive** on GitHub · 2026-11-28 21:57 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3378#pullrequestreview-6100253505) · **approved these changes** LGTM — clean launcher for shared real-run settings. run_preset.py picks console (x/s), GPU (nvidia/amd), OS (win11/win10/linux) and merges layered settings from run_presets.json (base → OS → console → GPU). Each layer records why it exists. Null env values unset earlier settings. Staging hard-links PE files (copies stand-in-named ones), maps the package via subst (not run.ps1 -MapDrive), disables thread holding (#1408), and hides the title window once presents reach the output window. run_presets.json ships measured settings: RING_RELEASE_AT_SUBMIT, ROOT_SRV_AT_DRAW, TABLE_ALIAS, RUNTIME_LOCAL, PROBE_PRECHECK=0, etc. with cited evidence. GPU layers are documented with why fields. Tests cover layer merging, null unsets, caller env recording, drive mapping (fake subst), staging (hard links, stand-in copies, synthetic package), validation (unknown keys, misspelt switches, non-X2W env names), and --print output. Documentation in AGENTS.md and startup-runtime.md explains the workflow and maintenance rules.
Author
Owner

@⁠lukaslw-lab on GitHub · 2026-11-29 00:09 UTC · original

Not a blocker. On "lazy commit on Windows, because our runs with it crashed at about 190 to 250 s": do you still have one of those run folders? triage_run.py on it shows how it ended. If not, a lazy on/off pair on the same build would show whether lazy is the cause.

What we saw: before #2209's fix (c40e3dac), lazy-on runs stopped with access violations in the title's code at 315–430 s (3 of 3), while the lazy-off control ran 600 s. The cause was a block released while the fault handler was committing it. Since that fix, with X2W_XMEM_LAZY_COMMIT=1 + X2W_XMEM_LAZY_STARTUP=1 (Windows 10, 16 GB RAM, RTX 3080 Ti), 189 runs ran to their timeout (171 past 190 s), and none ended in xmem.dll.

This comment was AI-assisted.

**@⁠lukaslw-lab** on GitHub · 2026-11-29 00:09 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3378#issuecomment-7247920027) Not a blocker. On "lazy commit on Windows, because our runs with it crashed at about 190 to 250 s": do you still have one of those run folders? `triage_run.py` on it shows how it ended. If not, a lazy on/off pair on the same build would show whether lazy is the cause. What we saw: before #2209's fix (`c40e3dac`), lazy-on runs stopped with access violations in the title's code at 315–430 s (3 of 3), while the lazy-off control ran 600 s. The cause was a block released while the fault handler was committing it. Since that fix, with `X2W_XMEM_LAZY_COMMIT=1` + `X2W_XMEM_LAZY_STARTUP=1` (Windows 10, 16 GB RAM, RTX 3080 Ti), 189 runs ran to their timeout (171 past 190 s), and none ended in `xmem.dll`. This comment was AI-assisted.
Author
Owner

@⁠Leyukaka on GitHub · 2026-11-29 07:34 UTC · original · approved these changes

Re-reviewed at 30fdfe5e by the diff from 4d1b42bd. This replaces my earlier review; both points are fixed.

  • Hard link: stage() copies a file named like one of the 8 stand-ins (any case) and links only the rest. STAND_INS is compared with the lists in run.ps1 and run.sh. The check stages a package holding GameInput.dll and XMEM.dll, rewrites the stand-ins in place over the stage and compares the package (bytes and mtime); the control with STAND_INS = () must change the package where links work.
  • Environment: null now removes the caller's value (unset, child_env()), and caller X2W_*/WINE* values that reach the run are written to settings.json as inherited_env and listed by --print. X2W_WIN_PYTHON, X2W_FXC and X2W_HOST_PYTHON are kept. Covered by child_env() directly and by a main() run with the child start replaced.

Minor, not blocking: unexplained_gpu_differences() accepts a key with key not in why, a plain substring test, so a run key such as render or seconds passes on any why that contains the word, and X2W_A passes when the why names X2W_AB.

git merge-tree --write-tree onto origin/main 212d4b5f: clean.

**@⁠Leyukaka** on GitHub · 2026-11-29 07:34 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3378#pullrequestreview-6101925294) · **approved these changes** Re-reviewed at `30fdfe5e` by the diff from `4d1b42bd`. This replaces my earlier review; both points are fixed. - Hard link: `stage()` copies a file named like one of the 8 stand-ins (any case) and links only the rest. `STAND_INS` is compared with the lists in `run.ps1` and `run.sh`. The check stages a package holding `GameInput.dll` and `XMEM.dll`, rewrites the stand-ins in place over the stage and compares the package (bytes and mtime); the control with `STAND_INS = ()` must change the package where links work. - Environment: `null` now removes the caller's value (`unset`, `child_env()`), and caller `X2W_*`/`WINE*` values that reach the run are written to `settings.json` as `inherited_env` and listed by `--print`. `X2W_WIN_PYTHON`, `X2W_FXC` and `X2W_HOST_PYTHON` are kept. Covered by `child_env()` directly and by a `main()` run with the child start replaced. Minor, not blocking: `unexplained_gpu_differences()` accepts a key with `key not in why`, a plain substring test, so a `run` key such as `render` or `seconds` passes on any `why` that contains the word, and `X2W_A` passes when the `why` names `X2W_AB`. `git merge-tree --write-tree` onto `origin/main` `212d4b5f`: clean.
github-bot changed target branch from main to gh-pr/3378/base 2026-11-29 12:22:05 +00:00
github manually merged commit 30fdfe5e4b into gh-pr/3378/base 2026-11-29 12:22:07 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.