From 35f624299559ed389d7769b8ffbb99d8787c4f00 Mon Sep 17 00:00:00 2001 From: lewisalex86 Date: Sat, 28 Nov 2026 15:52:57 +0000 Subject: [PATCH 1/8] startup: run a package with shared presets (console, OS, GPU) 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. --- docs/startup-runtime.md | 47 ++++ tests/checks/python-linux/run_preset.txt | 2 + tests/cmake/startup_run_preset.cmake | 7 + tests/startup_run_preset_check.py | 181 ++++++++++++++ tools/startup/run_preset.py | 296 +++++++++++++++++++++++ tools/startup/run_presets.json | 71 ++++++ 6 files changed, 604 insertions(+) create mode 100644 tests/checks/python-linux/run_preset.txt create mode 100644 tests/cmake/startup_run_preset.cmake create mode 100644 tests/startup_run_preset_check.py create mode 100644 tools/startup/run_preset.py create mode 100644 tools/startup/run_presets.json diff --git a/docs/startup-runtime.md b/docs/startup-runtime.md index 8c4a1625f..dc84ffccc 100644 --- a/docs/startup-runtime.md +++ b/docs/startup-runtime.md @@ -921,6 +921,53 @@ It writes: | `/files.txt` | every file the process opened | | `/translate.txt` | with `-Translate`: one line per shader request translated during the run | +### Run with the shared presets + +`tools/startup/run_preset.py` starts a run with the settings kept in `tools/startup/run_presets.json` +instead of a hand-picked set of switches. It takes three choices and the package root: + +```powershell +.\out\pe-env\Scripts\python.exe -B tools\startup\run_preset.py --package --console x --gpu nvidia +``` + +| Choice | Values | Default | +|---|---|---| +| `--console` | `x` (Series X), `s` (Series S) | required | +| `--gpu` | `nvidia`, `amd` | required | +| `--os` | `win11`, `win10`, `linux` | this host | + +The settings file has a `base` layer and one layer per choice. They apply in the order base, OS, +console, GPU. A later layer overrides an earlier one, and an `env` value of `null` unsets it. Each entry +records why it is there. To change what everyone runs with, change the file and cite the run that +supports the change. Do not add a launcher option for it. `--print` shows the merged switches, the +environment and the command without staging or starting anything. + +The launcher: + +- reads the executable's path from the package's `MicrosoftGame.config`; +- stages the PE files of that executable's folder in `/stage`, hard-linked where the volume + allows and copied otherwise. `run.ps1` and `run.sh` copy the stand-ins next to the executable, so + the package folder itself is never written; +- gives every run an empty storage folder (`/storage`); +- maps the package on its console drive letter with `subst` for the run and removes the mapping + afterwards. A letter that is taken is refused, unless `subst` already maps it onto this package. It + does not use `run.ps1 -MapDrive`: that rewrites only opens that pass through the debugger's file + hooks, and a real-title run with it stayed on its first screens where the same settings on a `subst` + drive went on loading. Under Wine, link `dosdevices/g:` in the prefix yourself; +- turns off the debugger's thread holding (`run.ps1 -SuspendOthers 0`, #3332). With holding on, real + runs on main stopped before the first input poll; a bisect points at #1408; +- starts `run.ps1`, or `run.sh` on Linux, then prints `tools/startup/triage_run.py` for the run's logs. + +Runs go to `out/startup/runs/