startup: add a Linux launcher and an opt-in switch to hide the title's own window #2241
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2249"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by JohnConnorNPC on 2026-11-25T07:41:30Z.
startup: add a Linux launcher and an opt-in switch to hide the title's own window
This PR bundles two behaviours because they are used together on Linux hosts. Each has its own checks, listed below.
1.
tools/startup/run.sh: a Linux counterpart ofrun.ps1Why. Until now the only launcher was
run.ps1. On Linux,docs/wine.mdsaid to set the variables by hand and startdebug_launch.pywith a Windows Python inside Wine. That route cannot start the shader watcher. With a cold shader cache, draws have no translated pipelines until a translation pass runs, so draws are skipped and the output stays black until the pass catches up (a run on a cold cache loggedtranslated draws 0andpipelines translated 0 / missing 3).-Translatefills the cache during the run, and Linux had no equivalent.Design.
run.ps1, as GNU long options (--exe --data --log --seconds --render --translate --fake-user --gpu-mirror --host-cpu --startup-below-40 --trace-calls --hide-title-window ...), with--console 1as the default.WINEPREFIXandX2W_WIN_PYTHON(a Windowspython.exe).WINEorPROTONpicks the Wine binary. The script does no prefix bootstrap; prefix setup stays indocs/non-windows-hosts.md.--data,--log,--storageand--shader-cacheaccept host paths or drive paths such asG:\.Z:spelling.MicrosoftGame.config, taking the first tag in any case, asrun.ps1does.docs/wine.md:X2W_XMEM_SHARED_VIEWS=1,WINEDLLOVERRIDES=d3d12,d3d12core,dxgi,d3d11=n,WINEFSYNC=1,WINEDEBUG=-all, and the VKD3D cache underout/.XDG_RUNTIME_DIRis unset, andPULSE_SERVERis set only when the socket exists. Values the caller set are kept, exceptXDG_RUNTIME_DIR.--render --translaterunsgfx2hlsl.py --watchin its own process group (setsid). Only that group getsd3dcompiler_47=n; the title's process does not. An EXIT trap stops the whole group: TERM first, then KILL after 2 s.2.
X2W_HIDE_TITLE_WINDOW=1: hide the title's own window (opt-in, off by default on every host)Why. The stand-in presents into its own output window ("Xbox2Windows ... - output"). The title's own top-level window has no paint code of its own. Under an X11 window manager it is a plain white window that can sit above the output window and cover the picture. This was seen on a live Wine run.
Design.
TitleWindowHiderinsrc/startup_stubs/overlay_window.h: a 500 ms timer on the output window's thread.#32770).ShowWindowAsync, so a busy title thread cannot stall the output window.run.sh --hide-title-windowsets the variable; without--renderit warns, because there is no output window then.Tests and results (Linux host)
python -B tools/run_checks_parallel.py <the 101 scripts of windows.yml "Run Python checks">all 101 checks passed, exit 0python -B tests/startup_run_sh_check.py -v(new; cteststartup_run_sh, exit 77 skip on Windows)startup run.sh: 0 failed; 29 mutants ofrun.sh, each detectedshellcheck tools/startup/run.shpython -B tests/docs_links_check.pyChecked 18 Markdown files and 418 links.startup_overlay_window,d3d12_xsstartup_overlay_window.exeunder Wine (Proton)foreground handed to the output window before the hidestartup_run_sh_check.pyruns the real script under bash. A stub Wine starts the host Python, anddebug_launch.pyandgfx2hlsl.pyare stubs. It covers:--data/--log/--shader-cache, a one-line and a lower-case config, and the overrides only the watcher gets;Mutants include:
setsid, no KILL fallback, no INT trap;--render;startup_overlay_window(extended): exits 8–21 check that:1(unset,0and10are off);WM_TIMERarrives;The fixture's 9 mutants were run under Wine, each restored by hash: gate always on → 8, accepts
10→ 16, no presenter exclusion → 2, no owner exclusion → 2, no dialog exclusion → 12, noSetTimer→ 19, gate>= 0→ 17, noSetForegroundWindow→ 21, no re-show → 18.Title runs under Wine (local; no title data in this PR)
Two runs used the same build and flags,
run.sh --render --translate ..., one with and one without--hide-title-window. Window state was sampled every 10 s withxwininfo.x2w-present X2W_HIDE_TITLE_WINDOW: hid 1 title window(s). The output window stayed mapped and kept counting frames.Not measured
startup_overlay_window. It is not in theprpreset, so it runs only in the main/manual CI.GameInputreads the keyboard only while a window of the process is in front. Under Wine the fixture's foreground handoff worked, but with the title it was not established.ShowWindowAsyncacross threads: the fixture's windows are on its own thread.SetForegroundWindowto the test: it printsforeground handoff not checkedand still exits 0. It ran under Wine; on Windows CI it may be skipped this way.run.shoutside this Proton Experimental setup (other Wine builds, distributions or window managers).run.shand its check need bash 4.4 or newer, GNUrealpathandsetsid.AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T07:45:29Z.
Review: COMMENTED
Review of head
d7593763fbVerdict: no P1, no P2 found. Two nits. Not approving or merging (external review only).
Commands run locally (Linux, in a worktree of this head)
git diff --stat origin/main...HEAD: 12 files, +857/-12.python3 -B tests/startup_run_sh_check.py->startup run.sh: 0 failedpython3 tests/docs_links_check.py-> self-test passed, 18 Markdown files, 418 linkspython3 tests/bidi_controls_check.py-> no bidirectional controls in 1507 filesgit diff --check origin/main...HEAD-> cleanbash -n tools/startup/run.sh-> OK--hide-title-windowexportingX2W_HIDE_TITLE_WINDOW=0instead of1-> check fails 2 cases (killed).-$watcherto$watcher-> the check refuses to run (its own mutation anchor count guard fires, expected 3 found 2), so the guard is itself tested.git checkout -- ..tests/startup_overlay_window.cppand the presenter changes (Windows-only C++); CI "Build and test on Windows" was still pending when I looked. I did not queue the Windows VM.Read-through
run.sh: option set mirrorsrun.ps1; required env checked up front; drive-path handling goes through dosdevices; watcher runs in its own process group with TERM then KILL on exit/INT; the exit code of the debugger is passed through. Looks right.TitleWindowHider::step: hides only whenpresents > 0 && last_shown, restores when frames stop, usesShowWindowAsyncso the output thread keeps pumping, skips#32770dialogs, takes the foreground first. State is touched from the output thread only;last_frame_shownandwindow_presentsare read with interlocked ops. Looks right.startup_run_shusesSKIP_RETURN_CODE 77; workflow list updated; docs updated.Nits
tools/startup/run.sh(config parse): values must start on the tag's line and UTF-16 configs are not read. Already documented in the script comment; maybe also say it indocs/wine.md.src/startup_stubs/d3d12_present.inl(WM_TIMER handler): thestatic bool told_*flags are function-local statics shared across any output window. Fine today (one window), only worth a comment.P1=0 P2=0
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T09:15:39Z.
Review: COMMENTED
Re-review of head
99d38bdef107c2e46140b7988cad9ac0f91bb6c3(previous review coveredd759376).What changed since
d759376(git diff d759376 HEAD, 2 files, +5/-1):docs/wine.md: states that title id and storage size come fromMicrosoftGame.config(first tag, any case), that a value must start on its tag's line, and that UTF-16 configs are not read.src/startup_stubs/d3d12_present.inl: comment only, noting thetold_*flags are shared by every output window (logged once per process).No logic change, so the behaviour I reviewed before is unchanged. The doc limits match what
tools/startup/run.shdoes.Commands run locally on this head
python3 tests/startup_run_sh_check.py->startup run.sh: 0 failedpython3 tests/docs_links_check.py->Checked 18 Markdown files and 418 links.Self-test passed.python3 tests/bidi_controls_check.py->Checked 1507 tracked ... files: no bidirectional controls.git diff --check origin/main...HEAD-> cleanexport X2W_HIDE_TITLE_WINDOW=1to=0intools/startup/run.sh:138->FAIL stub exit 0 --hide-title-window ... expected '1',2 failed. The test kills it. Reverted withgit checkout -- ..gh pr checks: "Build and test on Windows" passes. Two Linux jobs fail ("Assemble and translate gfx1013 fixtures" and "Run platform-independent Python checks on Linux") withTypeError: 'NoneType' object is not an iteratorfromtools/mesh_entry_aot.py/mesh_dynamic_aot.pyunder LLVM 15. This PR does not touch those files, so it looks unrelated (a pre-existing failure on main or a runner problem). Please re-run or confirm on main before Ready.Findings: P1=0, P2=0.
Win2025 WARP was not run by me: the new delta is docs and a comment only.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T10:23:40Z.
Review: COMMENTED
Re-review of head
601d67b7bde6b41a7224a3ba26ceb05c61e76a30Previous review covered
99d38bd.What changed since
99d38bd: a merge oforigin/mainonly. Comparedgit diff <old merge-base> 99d38bdwithgit diff origin/main...HEAD: the PR's own change is the same 12 files (+861/-12), and only hunk offsets and neighbouring context lines differ. No new logic inrun.sh, the overlay window, the presenter, the tests or the docs.Commands run locally on this head
git diff --stat origin/main...HEAD-> 12 files, +861/-12python3 tests/startup_run_sh_check.py-> run 1:FAIL mutant 'watcher without --render' was not detected,1 failed. Run 2 (same tree, nothing changed):startup run.sh: 0 failed.python3 tests/docs_links_check.py-> self-test passed, 18 Markdown files, 442 linkspython3 tests/bidi_controls_check.py-> 1581 files, no bidirectional controlsgit diff --check origin/main...HEAD-> cleanbash -n tools/startup/run.sh-> OKexport X2W_HIDE_TITLE_WINDOW=1->=0attools/startup/run.sh:138-> 2 cases fail (--hide-title-windowexpects'1'),2 failed. Killed. Restored withgit checkout -- ..gh pr checks: all pass, including "Build and test on Windows" (3m3s) and both Linux jobs (the earlier gfx1013 failures are gone). Mergeable, title neutral, no clean-room concerns.Findings
tests/startup_run_sh_check.py:383(mutant "watcher without --render"): it was reported as not detected on one run and detected on the next, with the same tree. The machine load average was about 8 at the time. Which run fails looks timing dependent (the case at line 331 that expects no translator to start, or the watcher-running check around lines 293-306). The check fails in the PR's own required list, so a loaded CI runner could fail it at random. I did not root-cause it. Suggest waiting for the translator stand-in's start marker (or a longer bounded wait) before deciding the watcher "did not start".P1=0, P2=1
Win2025 WARP was not run by me: the delta since the last review is a main merge and does not touch shader or C++ logic in this PR.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T10:39:27Z.
Review: COMMENTED
Re-review of head
ea1c25249105a30403f2778172707644fce19059Previous review covered
601d67b.What changed since
601d67b: one commit,tests/startup_overlay_window.cpponly (+17/-4). The Win32 overlay fixture now waits (bounded 3 s, pumping the thread's messages) for the posted show/hide to take effect before checkingIsWindowVisible. This is a sound fix for the asyncShowWindowAsyncrace.tests/startup_run_sh_check.pyandtools/startup/run.share unchanged.Commands run locally on this head
git diff 601d67b HEAD --stat-> 1 file, +17/-4python3 tests/startup_run_sh_check.pyx5 (same tree, load average about 8): 4 runsstartup run.sh: 0 failed, 1 runFAIL mutant 'watcher without --render' was not detected/1 failedpython3 tests/docs_links_check.py-> self-test passed, 18 Markdown files, 442 linkspython3 tests/bidi_controls_check.py-> 1581 files, no bidirectional controlsgit diff --check origin/main...HEAD-> cleangh pr checks: all pass, including "Build and test on Windows" and both Linux jobs. Mergeable, title neutral, no clean-room concerns.X2W_HIDE_TITLE_WINDOW=1 -> 0mutation was already killed on the prior head.Findings
tests/startup_run_sh_check.py:383: the mutant "watcher without --render" is intermittently reported as not detected (1 of 5 runs here, same tree). It is the same failure as on the previous head, so the earlier P2 is not resolved. This commit fixes the Win32 fixture race, which is a different test. Likely cause: the check decides the watcher "did not start" after a short fixed wait, so under load the mutant's watcher has not started yet. Suggest waiting for the translator stand-in's start marker, or a longer bounded wait, before deciding.P1=0, P2=1
Win2025 WARP was not run by me: the delta is a Win32 fixture wait in a test, with no shader or lowering logic. The repo's own Windows CI job passes.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-25T10:26:08Z.
The source-built launcher suite passed in Ubuntu 22.04 under WSL. I also rebuilt the overlay fixture on native Windows. It consistently exited at check 12 because it read visibility before the
ShowWindowAsyncrequest was dispatched. I pushedea1c2524so the test pumps the owning thread's queue before asserting hide and re-show.ctest --preset release --no-tests=error -R '^startup_overlay_window$' -Vnow passes. This host declinedSetForegroundWindowto the test, so the foreground handoff remains covered by your Proton result.