XSEmu launcher (Qt 6, design C) with runners, plus XSEmu.exe hosting, control pipe and warm-up progress #12

Manually merged
github merged 85 commits from gh-pr/12/head into gh-pr/12/base 2026-11-27 04:57:14 +00:00
Owner

@⁠zortos293 on GitHub · 2026-11-26 14:54 UTC · original
zortos293:capy/xsemu-launcher → main · +30244 −192 · 264 files · 85 commits · merged 2026-11-26 22:42 UTC

Adds XSEmuLauncher, a Qt 6 Widgets desktop launcher for XSEmu (design C, "Cover grid"), plus the emulator-side hooks it needs. XSEmu.exe stays a separate process. The launcher starts it, hosts its window and talks to it over a named pipe. The contract is docs/launcher-protocol.md.

Emulator side (crates/xcl)

  • XSEmu.exe: the binary is now XSEmu; the crate stays xcl. The "other emulator running" check matches both XSEmu.exe and xcl.exe. windows.yml uploads XSEmu-debug.
  • run --host-hwnd <hex> (hosting.rs): the game window becomes a child of the launcher's window. Keyboard and mouse focus follow the hosted window (hle/kbm.rs, hle/gameinput.rs), and it is DPI aware.
  • run --control-pipe <name> (control.rs): JSON lines carrying status, present counts and exit reasons, plus pause, resume and stop commands. present.rs, eh.rs, loader.rs and host.rs report into it.
  • warm-up --progress-json (warm_up_json.rs, real.rs, main.rs): progress events on stdout. Cancel with {"cmd":"cancel"} or by closing stdin. Cancelling starts no new builds; what is already built stays, so the warm-up resumes where it stopped.
  • App icon: assets/logo/XSEmu.ico is linked through build.rs.

All three options are opt-in: without them, run and warm-up behave as before. Shader translator sources are untouched, so caches are not rekeyed.

Launcher (launcher/)

  • Library: reads game folders (the manifest's name, publisher and version), resume hero, search, sort and drag-and-drop folders. Covers are opt-in: they need SteamGridDB enabled in Settings with the user's own key. Only grids and heroes are fetched, never logos, and no art ships with the app.
  • First launch: console model, network and game folders. It shows the PC's real RAM and GPU (DXGI).
  • Game details: Play and Warm-up, last run (result, fps, stalls, peak RAM), shader cache state, per-game overrides written to the title's xcl.toml, and a Runs-with picker.
  • In-game: the window is hosted by the launcher, with a bar showing the game, runner, console model, fps and frame time, free RAM, pause, overlay, fullscreen and stop. Boot, crash and device-removed states have clear exits. A runner without hosting gets its own window plus a floating HUD pill.
  • Warm-up: progress per phase, RAM-floor pauses, cancel and resume, a log view, and warm-up through a runner.
  • Settings: Console, Graphics, Input, Network (offline is the default), Overlay, Shaders (sizes and clear), Folders, Logs and About. About shows the emulator path, its version and whether it is ready.
  • Runners: XSEmu is the default. VIctory-7900XTX (AMD), DexNom/VIctory (AMD) and Kelvaroq are curated, pinned builds. Each is installed into its own folder with staged steps, and updates only when the user clicks Update. Runner processes start hidden, with no console window. Kelvaroq's own store-licence behaviour is flagged on its card.
  • Safety: the launcher only starts an emulator that speaks this protocol (--version starts with XSEmu , and --help lists --control-pipe and --progress-json). Older builds are refused with "This XSEmu build is too old for the launcher". Play and Warm-up are refused while XSEmu.exe, xcl.exe or game_scarlett_master.exe runs, or while a configured busy-marker file exists. Only one emulator process tree runs at a time.
  • Not wired yet: "Start in" (window or fullscreen) and "Low latency" show as "Not in this XSEmu build yet" until the emulator exposes them.

The app is C++17 and CMake. launcher.yml builds it with Qt 6.8 MSVC plus windeployqt and uploads the XSEmuLauncher-windows artifact before tests run. It also builds with Qt 6.4 on Ubuntu with -Werror and runs ctest: 11 test executables (protocol, controllers, library, settings, title config, shader cache, cover art, runners, in-game, reparent) driven against fake-xsemu.

Screenshots

Grabbed from the app itself with the dev lever (--state … --grab) against fake-xsemu fixtures. All art is drawn in code.

Library Game details
In-game Warm-up
Runners Runner install
Runner in own window About

Notes

  • The 3 WARP test failures on main (ZOR-605) predate this PR.
  • assets/logo/XSEmu.ico is a binary outside tests/data/, which scripts/pr_check.py flags. The icon is original art for the app.

Open in Capy

**@⁠zortos293** on GitHub · 2026-11-26 14:54 UTC · [original](https://github.com/zortos293/XSEmu/pull/12) `zortos293:capy/xsemu-launcher` → `main` · +30244 −192 · 264 files · 85 commits · merged 2026-11-26 22:42 UTC Adds `XSEmuLauncher`, a Qt 6 Widgets desktop launcher for XSEmu (design C, "Cover grid"), plus the emulator-side hooks it needs. `XSEmu.exe` stays a separate process. The launcher starts it, hosts its window and talks to it over a named pipe. The contract is [docs/launcher-protocol.md](docs/launcher-protocol.md). ## Emulator side (`crates/xcl`) - **XSEmu.exe:** the binary is now `XSEmu`; the crate stays `xcl`. The "other emulator running" check matches both `XSEmu.exe` and `xcl.exe`. windows.yml uploads `XSEmu-debug`. - **`run --host-hwnd <hex>`** (`hosting.rs`): the game window becomes a child of the launcher's window. Keyboard and mouse focus follow the hosted window (`hle/kbm.rs`, `hle/gameinput.rs`), and it is DPI aware. - **`run --control-pipe <name>`** (`control.rs`): JSON lines carrying status, present counts and exit reasons, plus pause, resume and stop commands. `present.rs`, `eh.rs`, `loader.rs` and `host.rs` report into it. - **`warm-up --progress-json`** (`warm_up_json.rs`, `real.rs`, `main.rs`): progress events on stdout. Cancel with `{"cmd":"cancel"}` or by closing stdin. Cancelling starts no new builds; what is already built stays, so the warm-up resumes where it stopped. - **App icon:** `assets/logo/XSEmu.ico` is linked through `build.rs`. All three options are opt-in: without them, `run` and `warm-up` behave as before. Shader translator sources are untouched, so caches are not rekeyed. ## Launcher (`launcher/`) - **Library:** reads game folders (the manifest's name, publisher and version), resume hero, search, sort and drag-and-drop folders. Covers are opt-in: they need SteamGridDB enabled in Settings with the user's own key. Only grids and heroes are fetched, never logos, and no art ships with the app. - **First launch:** console model, network and game folders. It shows the PC's real RAM and GPU (DXGI). - **Game details:** Play and Warm-up, last run (result, fps, stalls, peak RAM), shader cache state, per-game overrides written to the title's `xcl.toml`, and a Runs-with picker. - **In-game:** the window is hosted by the launcher, with a bar showing the game, runner, console model, fps and frame time, free RAM, pause, overlay, fullscreen and stop. Boot, crash and device-removed states have clear exits. A runner without hosting gets its own window plus a floating HUD pill. - **Warm-up:** progress per phase, RAM-floor pauses, cancel and resume, a log view, and warm-up through a runner. - **Settings:** Console, Graphics, Input, Network (offline is the default), Overlay, Shaders (sizes and clear), Folders, Logs and About. About shows the emulator path, its version and whether it is ready. - **Runners:** XSEmu is the default. VIctory-7900XTX (AMD), DexNom/VIctory (AMD) and Kelvaroq are curated, pinned builds. Each is installed into its own folder with staged steps, and updates only when the user clicks Update. Runner processes start hidden, with no console window. Kelvaroq's own store-licence behaviour is flagged on its card. - **Safety:** the launcher only starts an emulator that speaks this protocol (`--version` starts with `XSEmu `, and `--help` lists `--control-pipe` and `--progress-json`). Older builds are refused with "This XSEmu build is too old for the launcher". Play and Warm-up are refused while `XSEmu.exe`, `xcl.exe` or `game_scarlett_master.exe` runs, or while a configured busy-marker file exists. Only one emulator process tree runs at a time. - **Not wired yet:** "Start in" (window or fullscreen) and "Low latency" show as "Not in this XSEmu build yet" until the emulator exposes them. The app is C++17 and CMake. `launcher.yml` builds it with Qt 6.8 MSVC plus windeployqt and uploads the `XSEmuLauncher-windows` artifact before tests run. It also builds with Qt 6.4 on Ubuntu with `-Werror` and runs ctest: 11 test executables (protocol, controllers, library, settings, title config, shader cache, cover art, runners, in-game, reparent) driven against `fake-xsemu`. ## Screenshots Grabbed from the app itself with the dev lever (`--state … --grab`) against `fake-xsemu` fixtures. All art is drawn in code. | | | |---|---| | ![Library](https://api-nightly.capy.ai/pr-assets/DyE8fMsKSvnUueFd6b7pG-9zFbufWf8XWebx_iazRqo.png) | ![Game details](https://api-nightly.capy.ai/pr-assets/sr6WhFst1Ihtm9CJmLAnRsA07GT1sc4h1fNGop24Jxg.png) | | ![In-game](https://api-nightly.capy.ai/pr-assets/HU0zzYLSnCQltQF1RBG5qb2xlq4fJRlIDnCgYSbsRwo.png) | ![Warm-up](https://api-nightly.capy.ai/pr-assets/zEtmrFzDBAhobS30FcNY3Yhx57hCJMmaiwkiSMVM0Uc.png) | | ![Runners](https://api-nightly.capy.ai/pr-assets/k3rzAwB5FWBjWSeZuiCPmyaKb9Tk6XFJA9tUypn9XCE.png) | ![Runner install](https://api-nightly.capy.ai/pr-assets/MrxrMIHq43BcfHCy4i9w8-OKq1nA-bSsUw_OISr8WkI.png) | | ![Runner in own window](https://api-nightly.capy.ai/pr-assets/DOUUW-QBXnjcwB87YrZwvCoVqvJVqu50UK3FXv7Zn8s.png) | ![About](https://api-nightly.capy.ai/pr-assets/oXhgI3TsSpoUfpKVu4lUeGkeEPo1H0rN8kOX7BgIagw.png) | ## Notes - The 3 WARP test failures on main (ZOR-605) predate this PR. - `assets/logo/XSEmu.ico` is a binary outside `tests/data/`, which `scripts/pr_check.py` flags. The icon is original art for the app. <!-- capy-badge:start --> <a href="https://nightly.capy.ai/thread/jam_01M8C3T6WCB39DZKREVQE9HKQC"><picture><source media="(prefers-color-scheme: dark)" srcset="https://capy.ai/badge/accent-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://capy.ai/badge/accent-light.svg"><img alt="Open in Capy" src="https://capy.ai/badge/accent-light.svg"></picture></a> <!-- capy-badge:end -->
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
xcl warm-up [--full] --progress-json writes warmup_start, warmup_progress
(once a second and at the end), warmup_done and error as JSON lines on
stdout (docs/launcher-protocol.md); the process's stdout handle points at
stderr, so the console text goes there. {"cmd":"cancel"} or the end of
stdin cancels: no build starts (a compile waiting for its governor slot
gives up with Refused::Cancelled and is not noted in the --full record),
those running finish, built blobs and the --full record stay, exit code 4.

The encoding, the stdin command reader, the per-phase rate/ETA and the
option parsing live in warm_up_json.rs with unit tests. Without
--progress-json nothing changes.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
done/total count the current phase (phase ids listed), eta_s is left out
while unknown, warmup_start.total is the kept pipelines, a cancel abandons
compiles waiting for a slot, and --progress-json is warm-up [--full] only.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
The Cargo bin is now XSEmu (the crate and library stay xcl). Help, version
output (XSEmu <version>), the double-click menu, scripts, CI, docs and the
e2e tests (CARGO_BIN_EXE_XSEmu) name XSEmu.exe. The one-process check and
the never-pick-the-emulator-as-the-game check match both XSEmu.exe and
xcl.exe, so mixed installs keep the rule. Windows CI uploads
target/debug/XSEmu.exe right after the build.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
XSEmu run [--host-hwnd <hex>] <game>: launcher options sit between run and the
game (hosting::parse_run_args) and reach the host process through
XSEMU_HOST_HWND. There the window thread makes the XCL window a
WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN child of the host at boot, sized
to the largest centred 16:9 rectangle of the host's client area (the swap
chain stretches over the window, so the window is the letterbox; the host's
background is the bars) and moved when a 33 ms timer sees the host's client
rect change. window_pos and the window size from xcl.toml do not apply. The
host window closing or disappearing ends the title the clean way.

The host process turns per-monitor DPI aware (v2) only when hosted, before
any window exists: a cross-process child with another DPI awareness is
scaled or refused, and a manifest entry would change top-level runs too.

Keyboard and mouse focus: a child window is never the foreground window and
gets no WM_ACTIVATE, so hosted the focus is "the launcher's root window is in
the foreground and the XCL window holds the keyboard focus" (WM_SETFOCUS /
WM_KILLFOCUS; a click calls SetFocus). The cursor is held only while focused
and freed on kill-focus; raw mouse input targets the child with
RIDEV_INPUTSINK and reaches the game only while captured. The menu keys
(gameinput::keyboard) follow the same focus. Top-level runs are unchanged.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
control.rs (new) connects as a client to \\.\pipe\<name> (the launcher's
QLocalServer), passed to the host process as XSEMU_CONTROL_PIPE, and speaks
docs/launcher-protocol.md: hello (with the child window with --host-hwnd),
state booting -> running (first frame) -> paused/running -> stopping, stats
once a second while booting or running, key, and exit before deliberate
ends. The handle is overlapped and lines go out through one writer thread,
so the reader never blocks a write and no caller waits on the launcher.

Commands: pause holds the title's presentation (a gate at the top of
PresentX and present_now, where no XCL lock is held, so the window thread
and its watchdog go on) and gives the title no keyboard, mouse or gamepad
input; resume undoes it; stop ends the title the clean way (end_title);
overlay toggles a frame-time graph drawn with the progress bar's clears
(present::fill_rects); focus posts SetFocus to the child window.

Exit reasons: stopped (stop, host window gone, window closed), title_exit
(entry point returned, or ExitProcess: written at DLL_PROCESS_DETACH by that
thread, with the status from the NtTerminateProcess hook), device_removed
(stop_if_device_removed), error (launcher and host boot failures), crash
(the unhandled-exception filter, written directly to the pipe). The pipe
closing ends the title.

Hosted, F1, F3, F11 and Escape go to the launcher as key events and not to
the title (Escape is no longer B there). Stats: fps, frame_ms, worst_ms and
stalls (frames 100 ms or more after the last) from present intervals,
ram_free_mb from GlobalMemoryStatusEx, vram_used_mb / vram_budget_mb from
QueryVideoMemoryInfo's local segment, pipelines / compiling from
pso_async::counts. The protocol doc gains these details.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
build.rs turns the .ico into the .res that rc.exe makes of
1 ICON "XSEmu.ico" (an RT_ICON per image and RT_GROUP_ICON 1; byte for
byte what llvm-rc /L 0x409 produces) and hands it to the linker as an input
for the XSEmu bin, on Windows MSVC targets only. No rc.exe and no new
build-dependency, so it builds the same with MSVC in CI and with cargo-xwin;
the translator source hash is untouched.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Theme tokens and light/dark palettes from the Paper file, the component kit (labels, buttons,
badges, toggles, segmented control, search box, cover tiles, progress block, cards, dialogs),
the frameless window with title bar, sidebar, router and in-game mode, page stubs for Library,
Warm-up, Settings, Game details and First launch, launch and exit error dialogs, and
--state/--grab for headless renders on fixture data. Labels take their colour from a style
sheet so a live theme switch cannot restore the old palette.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
LaunchConfig writes the Settings-owned xcl.toml keys (device_type, log_level,
keyboard_mouse, mouse_sensitivity, display_mode, raytracing, present,
d3d12_adapter) into each title's xcl.toml at launch, a per-game override
first, and builds the game environment (XCL_NETWORK, XCL_STORE,
XCL_FULL_DUMP). The shader cache folder follows XCL_DXIL_CACHE. Controls
the emulator cannot back are shown disabled with the reason. The giant
compile cap, which never reached XSEmu, is gone.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

# Conflicts:
#	launcher/src/app/DevLever.cpp
#	launcher/src/core/AppSettings.h
#	launcher/tests/tst_settings.cpp
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
- EmulatorBuild asks the emulator --version and --help (hidden, 3 s each, once per build) and accepts it only when the version starts with "XSEmu " and the help names --control-pipe and --progress-json. Older xcl.exe builds are shown with their version and never started.
- ProcessGate::external(): XSEmu.exe, xcl.exe or game_scarlett_master.exe running, or the busy marker file (emulator/busyMarker, env XSEMU_BUSY_MARKER) existing. Re-checked every 2 s and right before each spawn; the emulator is never probed while busy.
- Game details disables Play and Warm-up with the reason; About shows the emulator path, its version, the capability and busy state, and lets you choose XSEmu.exe or xcl.exe.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
The pipelines, driver and translated folders, <16 hex>.dxil and its .tmp<pid> partial, used-pipelines.txt and skipped-pipelines.txt (crates/xcl dxc.rs, pso.rs, pso_manifest.rs, real.rs, pso_async.rs). Anything else in the folder stays and is listed in the dialog. Clearing also waits while another emulator or the busy marker holds the PC.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Game details now writes every choice, xcl.toml keys included, to AppSettings::gameOverrides, shows them from there, and "Use defaults" clears them there. LaunchConfig::prepareTitle writes the xcl.toml keys from that store into the title's xcl.toml at launch, so it no longer resets a Series X pick to the global lockhart. tst_settings checks that an override survives prepareTitle and that clearing it brings the default back.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Install steps now look their program up on the PATH the step gets (RunnerInstall::resolveProgram) rather than relying on CreateProcess, which searches the launcher's own PATH on Windows. A bare "cargo" therefore finds _toolchains/cargo/bin/cargo.exe after rustup-init. tst_runners covers a program that is only on the step's PATH.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
titleShaderState counts a finished warm-up as Ready only while the cache still holds driver blobs, so details, the library and the cold-shaders prompt see a cleared cache as never warmed up. A failed or partial last run still shows as such.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
statsChanged also fires for memory polls and overlay toggles, so Game details was adding the same fps and stall sample several times. Stats now carry a sample number that only a protocol stats message advances, and the fps sum and stall count use each sample once. Peaks and minimums still update on every change.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
SetParent returns the window's previous parent, which may be null for a top-level window. reparent() now clears the last error first and fails only on a null result with an error set. The final GetParent check stays.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
EmulatorController: :startRunner and WarmupController::startRunnerStep now resolve the console with LaunchConfig::deviceType, which reads titleValues (the per-game override over the launcher default). A Series X game played only with a runner now starts as Series X, and after "Use defaults" a stale xcl.toml no longer leaks into the runner. The Game details note says what a runner game gets. tst_settings checks a Series X override reaching the Kelvaroq launch arguments with no xcl.toml present, and the default coming back past a stale one.
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Every page switch to Game details took 2.7 s and Settings > Shaders 1.4 s on a
PC-shaped cache (650 MB pipelines.bin, 30k driver blobs, 166k DXIL files),
because ShaderCacheInfo::readDefault() read the whole manifest and walked the
folder on the UI thread. Library, Warm-up, the in-game view and the sidebar
also re-read it, or decoded cover art from disk, on every emulator stats tick.

- ShaderCacheMonitor (Services::shaderCache) scans on a worker thread, one scan
  at a time with requests coalesced, and keeps the last snapshot. Pages read the
  snapshot and follow changed(). Refreshes: startup, a page shown with a
  snapshot older than 10 s, a warm-up finishing, a game exiting, Clear, and the
  cache folder setting changing. A scan of a folder the setting no longer
  points at is dropped.
- pipelines.bin is parsed incrementally in 4 MB chunks: the offset and key set
  carry over, and it starts over when the file shrinks, its first bytes change
  or the path changes. One folder walk gives the size and the driver blobs.
- Before the first scan nothing is claimed about the cache (titleShaderState
  uses only the launcher's records), and Settings > Shaders shows Measuring.
- Clear runs on a worker thread; the dialog shows Clearing...
- HardwareMonitor (Services::hardware) reads DXGI and RAM once on a worker at
  startup; GPU labels, the runner recommendation, the adapter list and the
  first-launch note fill in when it lands.
- RunnerManager::installedBytes measures on a worker and caches per runner
  (reset on install and uninstall); the unused cacheBytes walk is gone.
- Services::art decodes cover art once and keeps it until the art changes.
- The dev lever grabs a state once the first scans have landed.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Generates 40 games and a shader cache in the emulator's format (a tenth of
the PC by default; XSEMU_PERF_SCALE=1 for about 650 MB of manifest, 30k
driver blobs and 166k DXIL files) and times every page switch on the UI
thread once the background snapshots are warm. Fails above 100 ms
(XSEMU_PERF_BUDGET_MS). XSEMU_PERF_DIR keeps the generated install for
reruns. Nothing generated is committed.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Store::rewrite (pso_manifest.rs) drops broken and repeated entries from the
middle of pipelines.bin through a temporary file and a rename, and warm-up
appends can grow it past the launcher's saved offset before the next scan.
The size and first-bytes checks miss that, so the parse resumed inside an
entry: wrong keys and counts, and with a large length read, a buffer that
grew to the rest of the file on every scan.

- The manifest state keeps the last complete entry's offset, length and
  fnv64. A scan resumes only when that entry is still there unchanged, the
  file's creation time is the same (a rename gives a new file) and it has
  not shrunk; otherwise it parses from the start.
- A length prefix above 16 MiB (kMaxManifestEntry; real entries are a few
  KB because shaders live in their own files) stops the parse. After a
  resume that means a stale offset, so it parses from the start; from the
  start it ends the entries there, as the emulator's own reader does. A bad
  length at the spot the previous scan stopped is not parsed again. The
  buffer holds at most one partial entry and one 4 MB chunk.
- tst_shadercache: drop an entry before the offset, append past the old
  end, in place and through a rename; the incremental scan equals a full
  parse. An oversized length stops at its offset and is not counted twice.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
An allow-list of shareable keys (the per-game overrides, the xcl.toml keys
LaunchConfig writes except the D3D12 adapter, the runner by id and pin, and
the launcher defaults Settings manages), *.xsemu-settings JSON with schema
xsemu-settings v1, XSEMU1: share codes (zlib + base64url), strict parsing
with per-key notes, a preview of what would change, and apply to a game or
as defaults. Online, store modes other than the offline error and features
not in this build are never applied. Tested in tst_settingsprofile.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
ShareSettingsDialog: name, note, what the profile carries, the share code
with its length, Copy code and Save file. ImportSettingsDialog: parses a
pasted code or a file, shows current -> new for a game (picked when not
started from one) or the launcher defaults, the lines that are not applied
with why, an Install button for a runner that isn't installed
(RunnerManager::install), ignored and rejected keys in a note, and Apply to
this game / Apply as defaults / Cancel. Malformed input gets an error
dialog. ProfileCard is the shared card in the style of Game details.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Game details "more" menu: Share settings, Paste settings code, Import
settings file. Settings > About: Share settings and Import settings rows.
MainWindow: drop a .xsemu-settings file on the window, or Ctrl+Shift+V to
paste a code (not in game or first launch).

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Game details and the Warm-up page never followed RunnerManager, so a
runner installed while either was on screen kept reading "not installed"
(Game details: "VIctory (DexNom) not installed") although runner.json and
the program were in place and RunnerManager::status() said Installed.
Starting the install from Game details (Runs-with picker, or the launch
error's Install button) and waiting there is exactly that case.

RunnerManager now emits stateChanged(id) when an install starts or ends
and on uninstall; Game details, Warm-up and an open Runs-with picker
follow it. Game details says "Installing <runner>" and "<runner> install
failed" instead of "not installed".

A failed install keeps its reason across restarts (install-failed.json)
and every run writes runners/<id>/install.log; the Runners card shows the
reason and an "Open install log" link. The install record is written
with QSaveFile and a failed write fails the install instead of reporting
success with nothing recorded.

tst_runnerstate builds a runner with DexNom's layout (cargo --target
x86_64-pc-windows-msvc, three bins, host build dirs), fails once, then
succeeds, and reads the Runners card, Game details, the picker and the
Warm-up page right after finished() and after a restart.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Settings, Game folders, Runners: the folder community runners are
downloaded and built in, with the Rust toolchain cache (_toolchains).
Default %LOCALAPPDATA%\XSEmu\runners; XSEMU_RUNNERS_DIR still wins. A
folder picker, the free space on that drive, and a warning under 20 GB
(DiskSpace::kRunnerLowBytes): a source build keeps Rust, the checkout and
CARGO_TARGET_DIR there and can run out of room part way. Changing it
leaves installed runners where they are (their location is pinned).

Runners page: Change location on every non-built-in card that is
installed or installable. The runner's own folder (checkout, target,
bin/app, data, cache, runner.json, install log) goes to <folder>\<id>.
An installed runner offers Move (rename on the same drive, else copy,
check file count, bytes and the program, then delete the old folder;
state Moving meanwhile) or Rebuild there (a fresh install there; the old
folder goes once it succeeds, and a failure keeps the old one in use).
Refused while that runner installs, builds or moves, or runs a game or
a pre-cache (Services wires EmulatorController and WarmupController).

Both persist in settings.ini (runners/folder, runners/locations) and
Paths follows them, so runner.json, Installed, the executable, launch
tokens ({runnerDir}, {installDir}) and cache dirs use the new place.

Tests: persistence across a new AppSettings/RunnerManager, Installed and
tokens at the new place after Move, a cross-drive copy with checks,
Rebuild there, refusals while busy (and through Services: a game and a
pre-cache), the Runners folder pinning installed runners, and the
free-space warning with an injected free-bytes function. Dev lever
states settings-runners-folder and runners-change-location.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Switching games, or a stats or state change, used to rebuild every card row
on Game details. The card rows now sit in one grid per card and update in
place, and only rows from the first one whose label differs are rebuilt.
The per-game overrides and the Folder row are built once and refilled. The
held/busy state on the page comes from what the ProcessGate worker last saw
and the cached emulator answers, so a refresh starts no process.

ProcessGate looks for emulator processes and the busy marker on a worker
every 2 s instead of on the UI thread; external() still looks right away
for the check just before a launch. The emulator version probe in Settings,
About runs on a worker. Button, Badge and CoverTile setters return early
when the value is unchanged.

tst_perf: Game details must switch in under 16 ms (median of nine rounds),
for the same game and for another one; other pages keep 100 ms. A new test
times a stats tick on Library, Warm-up and the in-game view with the fake
emulator running and the fixture warm, under 8 ms on the UI thread.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
tst_controllers runs a stand-in named xcl.exe to prove the launcher refuses
a second emulator. A launch in tst_ingame or tst_perf at the same moment was
refused as "Emulator busy: xcl.exe ... is running", so crashScreen
(files_missing) failed now and then under ctest -j4. The three tests now
share a ctest RESOURCE_LOCK.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
RunnerManager::uninstall refused only while the runner installed or
moved; it never asked busyReason(), so Uninstall during a game or a
pre-cache on that runner deleted runner.json and every unlocked file and
the card read Not installed while the game kept running. The card also
dropped uninstall()'s error.

uninstall() now refuses whenever busyReason(id) is non-empty (installing,
building, moving, uninstalling, or the game/pre-cache check Services
wires). The delete runs on a worker thread with the runner Uninstalling
meanwhile; install, relocate and a second uninstall of it are refused
until uninstalled(id, ok, error) lands. runner.json goes last, so files
in use leave the runner installed rather than half deleted.

The Runners card disables Uninstall with the reason as its tooltip while
the runner is busy (it follows the emulator's and warm-up's state), and
shows the error of a refused or incomplete uninstall.

Tests: refused while a game or a pre-cache uses the runner (through
Services and on the card), refused with an in-use check in RunnerManager,
and the async delete ending NotInstalled with the folder gone.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
The About section asks the emulator --version and --help on a worker, and
ProcessGate polls for other emulators on a worker every 2 s. The probe's own
XSEmu.exe child matched the names the gate looks for, so for its lifetime
the gate could report "Emulator busy: XSEmu.exe <pid>" and turn Play and
Warm-up off.

EmulatorBuild now starts its children through startHelper, which records
the pid under the same lock it starts under; runningEmulatorProcesses skips
those pids, so a scan on another thread never sees a helper unrecorded.
The About probe checks right before it asks that this launcher holds no game
or warm-up, and abandons the question (kills the child, keeps no answer)
as soon as one starts.

tst_controllers::probeChildIsNotAnotherEmulator runs a copy of fake-xsemu
named XSEmu.exe that takes 1.5 s to answer --version (new
FAKE_XSEMU_VERSION_DELAY_MS) and checks the gate stays free throughout, and
that a launch starting mid-probe cuts it short with nothing kept.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Both VIctory forks stop when VICTORY_CONFIG names a missing file, and the
launcher set VICTORY_CONFIG without ever writing it, so every DexNom and
7900 XTX warm-up and launch failed at once with exit code 1.

- RunnerSpec::writeConfig writes [paths] game_dir, cache_dir and data_dir
  atomically (QSaveFile, TOML-escaped) under the runner's current location,
  before each pre-cache step and each launch.
- 7900 XTX: warm --used runs only when known-pipelines.bin and
  early-pipelines.txt are there and non-empty; its runs record the book
  (VICTORY_PIPELINE_BOOK=1).
- WarmupRun::Result::NothingToBuild: Kelvaroq's empty check, a skipped step
  with nothing built, and a pre-cache that exits 0 having built nothing in
  under 2 s; the Warm-up page shows it as a warning with the reason.
- A runner whose record survives but whose program is gone reads Failed
  (files left in <folder>) with Reinstall and Uninstall on its card.
- Tests: fake-xsemu refuses a missing or unknown-keyed config like the forks;
  fake-cargo replaces the shell stand-in so tst_runnerstate runs on Windows.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
The early return when ToolHelp gives no snapshot still named the old
result list, which eab07a6 replaced; MSVC stopped on it.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Pinned to the audited f4b48ad (tree 832b1ea). Its GitHub original is gone,
so source builds can now name several remotes: each is fetched in turn
(by commit, else its HEAD) and FETCH_HEAD and the checkout must match the
pinned commit and tree, or the remote is refused.

- Launch: its own victory.exe run <exe> --console series-s --execute, always
  a Series S; Play-VIctory.cmd's preset environment (lines 20-37) without the
  ambient light, VICTORY_PIPELINE_BOOK=1, cache and data under the runner's
  folder, no VICTORY_CONFIG, and VICTORY_KEYS never passed on.
- Runner options: per-runner switches on the card that add environment;
  cool_fox's "Author's ambient light" (VICTORY_AMBIENT=0.8,
  VICTORY_AMBIENT_AIR=1.5) is off by default.
- Pre-cache: shaders (indeterminate, about 25,985), then warm --used once
  known-pipelines.bin is there; the warm parser reads the closing summary.
- Tests: parsers against the fork's lines, the fetch fallback with local bare
  repos (gone, other commit refused, pin) and a wrong tree pin refused, and
  fake-exe pre-cache and launch with its environment and switch.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
A folder picked as c:/runners is the default C:/Runners there, and a move
into its own folder is refused whatever the case. The new tests compare the
runner's working folder through QFileInfo and read git's ids whitespace-split,
so drive-letter case, short names and CRLF don't matter on Windows.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Conflicting emulator files take launcher-protocol patch v3, which is the
same hooks rebased onto this tree (no giants_max, admission by fit), with
the XSEmu.exe naming kept.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Admission is by fit now, so there is no fixed number of giants to show:
the Giant compiles column shows the count compiling, and the finished
view leaves it out.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 04:57:12 +00:00
github manually merged commit 769fc7a1cb into gh-pr/12/base 2026-11-27 04:57:14 +00:00
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-11-26 14:54 UTC · original · edited 2026-11-26 22:33 UTC

Important

Review skipped

Too many files!

This PR contains 217 files, which is 67 over the limit of 150.

To get a review, reduce the PR to 150 files or fewer by splitting it into smaller PRs or changing its base branch.

Upgrade to a paid plan to raise the limit.

This organization's CodeRabbit subscription is cancelled. Resubscribe in Billing to continue reviews beyond the free-tier limit.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 6486f89e-892f-4052-a322-faa76a034efd
Commits

Reviewing files that changed from the base of the PR and between 9fbb9152c9 and 769fc7a1cb.

Files ignored due to path filters: 47

  • assets/logo/XSEmu.ico is excluded by !**/*.ico
  • assets/logo/xsemu-mark-dark.svg is excluded by !**/*.svg
  • assets/logo/xsemu-mark-mono.svg is excluded by !**/*.svg
  • assets/logo/xsemu-mark.svg is excluded by !**/*.svg
  • assets/logo/xsemu-wordmark-dark.svg is excluded by !**/*.svg
  • assets/logo/xsemu-wordmark-light.svg is excluded by !**/*.svg
  • launcher/resources/icons/back.svg is excluded by !**/*.svg
  • launcher/resources/icons/bolt.svg is excluded by !**/*.svg
  • launcher/resources/icons/build.svg is excluded by !**/*.svg
  • launcher/resources/icons/check.svg is excluded by !**/*.svg
  • launcher/resources/icons/chevron-down.svg is excluded by !**/*.svg
  • launcher/resources/icons/chevron-right.svg is excluded by !**/*.svg
  • launcher/resources/icons/chip.svg is excluded by !**/*.svg
  • launcher/resources/icons/clock.svg is excluded by !**/*.svg
  • launcher/resources/icons/close.svg is excluded by !**/*.svg
  • launcher/resources/icons/download.svg is excluded by !**/*.svg
  • launcher/resources/icons/external.svg is excluded by !**/*.svg
  • launcher/resources/icons/file.svg is excluded by !**/*.svg
  • launcher/resources/icons/folder.svg is excluded by !**/*.svg
  • launcher/resources/icons/fullscreen.svg is excluded by !**/*.svg
  • launcher/resources/icons/gamepad.svg is excluded by !**/*.svg
  • launcher/resources/icons/gear.svg is excluded by !**/*.svg
  • launcher/resources/icons/info.svg is excluded by !**/*.svg
  • launcher/resources/icons/key.svg is excluded by !**/*.svg
  • launcher/resources/icons/keyboard.svg is excluded by !**/*.svg
  • launcher/resources/icons/library.svg is excluded by !**/*.svg
  • launcher/resources/icons/lock.svg is excluded by !**/*.svg
  • launcher/resources/icons/monitor.svg is excluded by !**/*.svg
  • launcher/resources/icons/more.svg is excluded by !**/*.svg
  • launcher/resources/icons/network-off.svg is excluded by !**/*.svg
  • launcher/resources/icons/network.svg is excluded by !**/*.svg
  • launcher/resources/icons/overlay.svg is excluded by !**/*.svg
  • launcher/resources/icons/pause.svg is excluded by !**/*.svg
  • launcher/resources/icons/pending.svg is excluded by !**/*.svg
  • launcher/resources/icons/play.svg is excluded by !**/*.svg
  • launcher/resources/icons/plus.svg is excluded by !**/*.svg
  • launcher/resources/icons/refresh.svg is excluded by !**/*.svg
  • launcher/resources/icons/runner.svg is excluded by !**/*.svg
  • launcher/resources/icons/search.svg is excluded by !**/*.svg
  • launcher/resources/icons/stop.svg is excluded by !**/*.svg
  • launcher/resources/icons/trash.svg is excluded by !**/*.svg
  • launcher/resources/icons/warning.svg is excluded by !**/*.svg
  • launcher/resources/icons/win-close.svg is excluded by !**/*.svg
  • launcher/resources/icons/win-max.svg is excluded by !**/*.svg
  • launcher/resources/icons/win-min.svg is excluded by !**/*.svg
  • launcher/resources/icons/win-restore.svg is excluded by !**/*.svg
  • launcher/resources/icons/window.svg is excluded by !**/*.svg
Files selected for processing: 217

  • .github/workflows/launcher.yml
  • .github/workflows/windows.yml
  • CONTRIBUTING.md
  • README.md
  • THIRD_PARTY.md
  • UPSTREAM.md
  • crates/xcl/Cargo.toml
  • crates/xcl/build.rs
  • crates/xcl/src/control.rs
  • crates/xcl/src/eh.rs
  • crates/xcl/src/gpu/recomp/dxc.rs
  • crates/xcl/src/hle/d3d12x/present.rs
  • crates/xcl/src/hle/d3d12x/pso_sched.rs
  • crates/xcl/src/hle/d3d12x/real.rs
  • crates/xcl/src/hle/d3d12x/title_list.rs
  • crates/xcl/src/hle/gameinput.rs
  • crates/xcl/src/hle/kbm.rs
  • crates/xcl/src/hle/opus.rs
  • crates/xcl/src/host.rs
  • crates/xcl/src/hosting.rs
  • crates/xcl/src/launcher.rs
  • crates/xcl/src/lib.rs
  • crates/xcl/src/loader.rs
  • crates/xcl/src/main.rs
  • crates/xcl/src/preflight.rs
  • crates/xcl/src/tls.rs
  • crates/xcl/src/warm_up_json.rs
  • crates/xcl/tests/disasm_e2e.rs
  • crates/xcl/tests/e2e.rs
  • crates/xcl/tests/rpf_e2e.rs
  • docs/launcher-protocol.md
  • launcher/CMakeLists.txt
  • launcher/README.md
  • launcher/resources/branding/app.rc
  • launcher/resources/launcher.qrc
  • launcher/src/app/DevLever.cpp
  • launcher/src/app/DevLever.h
  • launcher/src/app/Services.cpp
  • launcher/src/app/Services.h
  • launcher/src/core/AppSettings.cpp
  • launcher/src/core/AppSettings.h
  • launcher/src/core/CoverArtService.cpp
  • launcher/src/core/CoverArtService.h
  • launcher/src/core/DevFixtures.cpp
  • launcher/src/core/DevFixtures.h
  • launcher/src/core/DiskSpace.cpp
  • launcher/src/core/DiskSpace.h
  • launcher/src/core/EmulatorBuild.cpp
  • launcher/src/core/EmulatorBuild.h
  • launcher/src/core/EmulatorController.cpp
  • launcher/src/core/EmulatorController.h
  • launcher/src/core/Format.cpp
  • launcher/src/core/Format.h
  • launcher/src/core/Game.cpp
  • launcher/src/core/Game.h
  • launcher/src/core/GameManifest.cpp
  • launcher/src/core/GameManifest.h
  • launcher/src/core/HardwareInfo.cpp
  • launcher/src/core/HardwareInfo.h
  • launcher/src/core/LaunchConfig.cpp
  • launcher/src/core/LaunchConfig.h
  • launcher/src/core/Library.cpp
  • launcher/src/core/Library.h
  • launcher/src/core/NativeWindow.cpp
  • launcher/src/core/NativeWindow.h
  • launcher/src/core/Paths.cpp
  • launcher/src/core/Paths.h
  • launcher/src/core/ProcessGate.cpp
  • launcher/src/core/ProcessGate.h
  • launcher/src/core/ProcessTree.cpp
  • launcher/src/core/ProcessTree.h
  • launcher/src/core/ProgressParsers.cpp
  • launcher/src/core/ProgressParsers.h
  • launcher/src/core/Protocol.cpp
  • launcher/src/core/Protocol.h
  • launcher/src/core/Runner.cpp
  • launcher/src/core/Runner.h
  • launcher/src/core/RunnerInstall.cpp
  • launcher/src/core/RunnerInstall.h
  • launcher/src/core/RunnerManager.cpp
  • launcher/src/core/RunnerManager.h
  • launcher/src/core/SettingsProfile.cpp
  • launcher/src/core/SettingsProfile.h
  • launcher/src/core/ShaderCacheInfo.cpp
  • launcher/src/core/ShaderCacheInfo.h
  • launcher/src/core/ShaderCacheMonitor.cpp
  • launcher/src/core/ShaderCacheMonitor.h
  • launcher/src/core/TitleConfig.cpp
  • launcher/src/core/TitleConfig.h
  • launcher/src/core/WarmupController.cpp
  • launcher/src/core/WarmupController.h
  • launcher/src/main.cpp
  • launcher/src/pages/FirstLaunchPage.cpp
  • launcher/src/pages/FirstLaunchPage.h
  • launcher/src/pages/GameDetailsPage.cpp
  • launcher/src/pages/GameDetailsPage.h
  • launcher/src/pages/ImportSettingsDialog.cpp
  • launcher/src/pages/ImportSettingsDialog.h
  • launcher/src/pages/LibraryPage.cpp
  • launcher/src/pages/LibraryPage.h
  • launcher/src/pages/PageScaffold.cpp
  • launcher/src/pages/PageScaffold.h
  • launcher/src/pages/ProfileCard.cpp
  • launcher/src/pages/ProfileCard.h
  • launcher/src/pages/RunnerUi.cpp
  • launcher/src/pages/RunnerUi.h
  • launcher/src/pages/RunnersPage.cpp
  • launcher/src/pages/RunnersPage.h
  • launcher/src/pages/RunsWithPicker.cpp
  • launcher/src/pages/RunsWithPicker.h
  • launcher/src/pages/SettingsPage.cpp
  • launcher/src/pages/SettingsPage.h
  • launcher/src/pages/ShareSettingsDialog.cpp
  • launcher/src/pages/ShareSettingsDialog.h
  • launcher/src/pages/WarmupPage.cpp
  • launcher/src/pages/WarmupPage.h
  • launcher/src/pages/settings/AboutSection.cpp
  • launcher/src/pages/settings/ConsoleSection.cpp
  • launcher/src/pages/settings/GameFoldersSection.cpp
  • launcher/src/pages/settings/GraphicsSection.cpp
  • launcher/src/pages/settings/InputSection.cpp
  • launcher/src/pages/settings/LogsSection.cpp
  • launcher/src/pages/settings/NetworkSection.cpp
  • launcher/src/pages/settings/OverlaySection.cpp
  • launcher/src/pages/settings/Sections.h
  • launcher/src/pages/settings/SettingsKit.cpp
  • launcher/src/pages/settings/SettingsKit.h
  • launcher/src/pages/settings/ShadersSection.cpp
  • launcher/src/shell/FloatingBar.cpp
  • launcher/src/shell/FloatingBar.h
  • launcher/src/shell/InGameView.cpp
  • launcher/src/shell/InGameView.h
  • launcher/src/shell/LaunchErrors.cpp
  • launcher/src/shell/LaunchErrors.h
  • launcher/src/shell/MainWindow.cpp
  • launcher/src/shell/MainWindow.h
  • launcher/src/shell/Page.h
  • launcher/src/shell/Sidebar.cpp
  • launcher/src/shell/Sidebar.h
  • launcher/src/shell/TitleBar.cpp
  • launcher/src/shell/TitleBar.h
  • launcher/src/shell/WindowButtons.cpp
  • launcher/src/shell/WindowButtons.h
  • launcher/src/theme/Theme.cpp
  • launcher/src/theme/Theme.h
  • launcher/src/widgets/Badge.cpp
  • launcher/src/widgets/Badge.h
  • launcher/src/widgets/Button.cpp
  • launcher/src/widgets/Button.h
  • launcher/src/widgets/Card.cpp
  • launcher/src/widgets/Card.h
  • launcher/src/widgets/ChoiceCard.cpp
  • launcher/src/widgets/ChoiceCard.h
  • launcher/src/widgets/CoverThumb.cpp
  • launcher/src/widgets/CoverThumb.h
  • launcher/src/widgets/CoverTile.cpp
  • launcher/src/widgets/CoverTile.h
  • launcher/src/widgets/Dialog.cpp
  • launcher/src/widgets/Dialog.h
  • launcher/src/widgets/Icon.cpp
  • launcher/src/widgets/Icon.h
  • launcher/src/widgets/InfoNote.cpp
  • launcher/src/widgets/InfoNote.h
  • launcher/src/widgets/NavItem.cpp
  • launcher/src/widgets/NavItem.h
  • launcher/src/widgets/PageHeader.cpp
  • launcher/src/widgets/PageHeader.h
  • launcher/src/widgets/ProgressBlock.cpp
  • launcher/src/widgets/ProgressBlock.h
  • launcher/src/widgets/SearchBox.cpp
  • launcher/src/widgets/SearchBox.h
  • launcher/src/widgets/SegmentedControl.cpp
  • launcher/src/widgets/SegmentedControl.h
  • launcher/src/widgets/Spinner.cpp
  • launcher/src/widgets/Spinner.h
  • launcher/src/widgets/Text.cpp
  • launcher/src/widgets/Text.h
  • launcher/src/widgets/Toggle.cpp
  • launcher/src/widgets/Toggle.h
  • launcher/tests/CMakeLists.txt
  • launcher/tests/fake-cargo.cpp
  • launcher/tests/fixtures/.gitattributes
  • launcher/tests/fixtures/games/Archive/Quiet/LongQuiet.exe.fixture
  • launcher/tests/fixtures/games/Archive/Quiet/MicrosoftGame.config.fixture
  • launcher/tests/fixtures/games/Coastline Drive/Binaries/CoastlineDrive.exe.fixture
  • launcher/tests/fixtures/games/Coastline Drive/MicrosoftGame.config.fixture
  • launcher/tests/fixtures/games/NoExe/MicrosoftGame.config.fixture
  • launcher/tests/fixtures/games/README.md
  • launcher/tests/fixtures/games/SignalGarden/MicrosoftGame.config.fixture
  • launcher/tests/fixtures/games/SignalGarden/SignalGarden.exe.fixture
  • launcher/tests/fixtures/xcl-data/NorthwindInteractive.SignalGarden/xcl.toml
  • launcher/tests/reparent-helper.cpp
  • launcher/tests/tst_controllers.cpp
  • launcher/tests/tst_coverart.cpp
  • launcher/tests/tst_ingame.cpp
  • launcher/tests/tst_library.cpp
  • launcher/tests/tst_perf.cpp
  • launcher/tests/tst_protocol.cpp
  • launcher/tests/tst_reparent.cpp
  • launcher/tests/tst_runners.cpp
  • launcher/tests/tst_runnerstate.cpp
  • launcher/tests/tst_settings.cpp
  • launcher/tests/tst_settingsprofile.cpp
  • launcher/tests/tst_shadercache.cpp
  • launcher/tests/tst_titleconfig.cpp
  • launcher/tools/fake-xsemu/CMakeLists.txt
  • launcher/tools/fake-xsemu/FakeRun.cpp
  • launcher/tools/fake-xsemu/FakeRun.h
  • launcher/tools/fake-xsemu/FakeRunner.cpp
  • launcher/tools/fake-xsemu/FakeRunner.h
  • launcher/tools/fake-xsemu/FakeWarmup.cpp
  • launcher/tools/fake-xsemu/FakeWarmup.h
  • launcher/tools/fake-xsemu/Scene.cpp
  • launcher/tools/fake-xsemu/Scene.h
  • launcher/tools/fake-xsemu/main.cpp
  • scripts/re/check_layout.py
  • scripts/smoke.ps1

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.
**@⁠coderabbitai[bot]** on GitHub · 2026-11-26 14:54 UTC · [original](https://github.com/zortos293/XSEmu/pull/12#issuecomment-7195508937) · edited 2026-11-26 22:33 UTC <!-- coderabbit-ai-generated:v1 --> <!-- This is an auto-generated comment: summarize by coderabbit.ai --> <!-- This is an auto-generated comment: rate limited by coderabbit.ai --> > [!IMPORTANT] > ## Review skipped > > Too many files! > > This PR contains 217 files, which is 67 over the limit of 150. > > To get a review, reduce the PR to 150 files or fewer by splitting it into smaller PRs or changing its base branch. > > Upgrade to a paid plan to raise the limit. > > This organization's CodeRabbit subscription is cancelled. Resubscribe in [Billing](https://app.coderabbit.ai/settings/billing?orgId=5003f9f2-a0ee-4db6-a1c6-5e48e9bba3ce) to continue reviews beyond the free-tier limit. > > <details> > <summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/cog-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/cog.svg" width="16" height="16" align="absmiddle" alt=""></picture> Run configuration</strong></summary> > <dl> > <dd> > <br> > > - **Source mode**: Auto > - **Repository**: Unavailable > - **Branch**: Unavailable > - **File**: No configuration file from this repository applied > - **Commit**: Unavailable > - **Layers**: defaults > - **Review profile**: CHILL > - **Plan**: Advanced > - **Run ID**: `6486f89e-892f-4052-a322-faa76a034efd` > > </dd> > </dl> > </details> > > <details> > <summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/git-commit-horizontal-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/git-commit-horizontal.svg" width="16" height="16" align="absmiddle" alt=""></picture> Commits</strong></summary> > <dl> > <dd> > <br> > > Reviewing files that changed from the base of the PR and between 9fbb9152c9b1083134e85a5fd1562dd276a3d872 and 769fc7a1cbb41a0d825e46a3a1b6b72fdabf20c6. > > </dd> > </dl> > </details> > > <details> > <summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-minus-corner-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-minus-corner.svg" width="16" height="16" align="absmiddle" alt=""></picture> Files ignored due to path filters: 47</strong></summary> > <dl> > <dd> > <br> > > * `assets/logo/XSEmu.ico` is excluded by `!**/*.ico` > * `assets/logo/xsemu-mark-dark.svg` is excluded by `!**/*.svg` > * `assets/logo/xsemu-mark-mono.svg` is excluded by `!**/*.svg` > * `assets/logo/xsemu-mark.svg` is excluded by `!**/*.svg` > * `assets/logo/xsemu-wordmark-dark.svg` is excluded by `!**/*.svg` > * `assets/logo/xsemu-wordmark-light.svg` is excluded by `!**/*.svg` > * `launcher/resources/icons/back.svg` is excluded by `!**/*.svg` > * `launcher/resources/icons/bolt.svg` is excluded by `!**/*.svg` > * `launcher/resources/icons/build.svg` is excluded by `!**/*.svg` > * `launcher/resources/icons/check.svg` is excluded by `!**/*.svg` > * `launcher/resources/icons/chevron-down.svg` is excluded by `!**/*.svg` > * `launcher/resources/icons/chevron-right.svg` is excluded by `!**/*.svg` > * `launcher/resources/icons/chip.svg` is excluded by `!**/*.svg` > * `launcher/resources/icons/clock.svg` is excluded by `!**/*.svg` > * `launcher/resources/icons/close.svg` is excluded by `!**/*.svg` > * `launcher/resources/icons/download.svg` is excluded by `!**/*.svg` > * `launcher/resources/icons/external.svg` is excluded by `!**/*.svg` > * `launcher/resources/icons/file.svg` is excluded by `!**/*.svg` > * `launcher/resources/icons/folder.svg` is excluded by `!**/*.svg` > * `launcher/resources/icons/fullscreen.svg` is excluded by `!**/*.svg` > * `launcher/resources/icons/gamepad.svg` is excluded by `!**/*.svg` > * `launcher/resources/icons/gear.svg` is excluded by `!**/*.svg` > * `launcher/resources/icons/info.svg` is excluded by `!**/*.svg` > * `launcher/resources/icons/key.svg` is excluded by `!**/*.svg` > * `launcher/resources/icons/keyboard.svg` is excluded by `!**/*.svg` > * `launcher/resources/icons/library.svg` is excluded by `!**/*.svg` > * `launcher/resources/icons/lock.svg` is excluded by `!**/*.svg` > * `launcher/resources/icons/monitor.svg` is excluded by `!**/*.svg` > * `launcher/resources/icons/more.svg` is excluded by `!**/*.svg` > * `launcher/resources/icons/network-off.svg` is excluded by `!**/*.svg` > * `launcher/resources/icons/network.svg` is excluded by `!**/*.svg` > * `launcher/resources/icons/overlay.svg` is excluded by `!**/*.svg` > * `launcher/resources/icons/pause.svg` is excluded by `!**/*.svg` > * `launcher/resources/icons/pending.svg` is excluded by `!**/*.svg` > * `launcher/resources/icons/play.svg` is excluded by `!**/*.svg` > * `launcher/resources/icons/plus.svg` is excluded by `!**/*.svg` > * `launcher/resources/icons/refresh.svg` is excluded by `!**/*.svg` > * `launcher/resources/icons/runner.svg` is excluded by `!**/*.svg` > * `launcher/resources/icons/search.svg` is excluded by `!**/*.svg` > * `launcher/resources/icons/stop.svg` is excluded by `!**/*.svg` > * `launcher/resources/icons/trash.svg` is excluded by `!**/*.svg` > * `launcher/resources/icons/warning.svg` is excluded by `!**/*.svg` > * `launcher/resources/icons/win-close.svg` is excluded by `!**/*.svg` > * `launcher/resources/icons/win-max.svg` is excluded by `!**/*.svg` > * `launcher/resources/icons/win-min.svg` is excluded by `!**/*.svg` > * `launcher/resources/icons/win-restore.svg` is excluded by `!**/*.svg` > * `launcher/resources/icons/window.svg` is excluded by `!**/*.svg` > > </dd> > </dl> > </details> > > <details> > <summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-plus-corner-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-plus-corner.svg" width="16" height="16" align="absmiddle" alt=""></picture> Files selected for processing: 217</strong></summary> > <dl> > <dd> > <br> > > * `.github/workflows/launcher.yml` > * `.github/workflows/windows.yml` > * `CONTRIBUTING.md` > * `README.md` > * `THIRD_PARTY.md` > * `UPSTREAM.md` > * `crates/xcl/Cargo.toml` > * `crates/xcl/build.rs` > * `crates/xcl/src/control.rs` > * `crates/xcl/src/eh.rs` > * `crates/xcl/src/gpu/recomp/dxc.rs` > * `crates/xcl/src/hle/d3d12x/present.rs` > * `crates/xcl/src/hle/d3d12x/pso_sched.rs` > * `crates/xcl/src/hle/d3d12x/real.rs` > * `crates/xcl/src/hle/d3d12x/title_list.rs` > * `crates/xcl/src/hle/gameinput.rs` > * `crates/xcl/src/hle/kbm.rs` > * `crates/xcl/src/hle/opus.rs` > * `crates/xcl/src/host.rs` > * `crates/xcl/src/hosting.rs` > * `crates/xcl/src/launcher.rs` > * `crates/xcl/src/lib.rs` > * `crates/xcl/src/loader.rs` > * `crates/xcl/src/main.rs` > * `crates/xcl/src/preflight.rs` > * `crates/xcl/src/tls.rs` > * `crates/xcl/src/warm_up_json.rs` > * `crates/xcl/tests/disasm_e2e.rs` > * `crates/xcl/tests/e2e.rs` > * `crates/xcl/tests/rpf_e2e.rs` > * `docs/launcher-protocol.md` > * `launcher/CMakeLists.txt` > * `launcher/README.md` > * `launcher/resources/branding/app.rc` > * `launcher/resources/launcher.qrc` > * `launcher/src/app/DevLever.cpp` > * `launcher/src/app/DevLever.h` > * `launcher/src/app/Services.cpp` > * `launcher/src/app/Services.h` > * `launcher/src/core/AppSettings.cpp` > * `launcher/src/core/AppSettings.h` > * `launcher/src/core/CoverArtService.cpp` > * `launcher/src/core/CoverArtService.h` > * `launcher/src/core/DevFixtures.cpp` > * `launcher/src/core/DevFixtures.h` > * `launcher/src/core/DiskSpace.cpp` > * `launcher/src/core/DiskSpace.h` > * `launcher/src/core/EmulatorBuild.cpp` > * `launcher/src/core/EmulatorBuild.h` > * `launcher/src/core/EmulatorController.cpp` > * `launcher/src/core/EmulatorController.h` > * `launcher/src/core/Format.cpp` > * `launcher/src/core/Format.h` > * `launcher/src/core/Game.cpp` > * `launcher/src/core/Game.h` > * `launcher/src/core/GameManifest.cpp` > * `launcher/src/core/GameManifest.h` > * `launcher/src/core/HardwareInfo.cpp` > * `launcher/src/core/HardwareInfo.h` > * `launcher/src/core/LaunchConfig.cpp` > * `launcher/src/core/LaunchConfig.h` > * `launcher/src/core/Library.cpp` > * `launcher/src/core/Library.h` > * `launcher/src/core/NativeWindow.cpp` > * `launcher/src/core/NativeWindow.h` > * `launcher/src/core/Paths.cpp` > * `launcher/src/core/Paths.h` > * `launcher/src/core/ProcessGate.cpp` > * `launcher/src/core/ProcessGate.h` > * `launcher/src/core/ProcessTree.cpp` > * `launcher/src/core/ProcessTree.h` > * `launcher/src/core/ProgressParsers.cpp` > * `launcher/src/core/ProgressParsers.h` > * `launcher/src/core/Protocol.cpp` > * `launcher/src/core/Protocol.h` > * `launcher/src/core/Runner.cpp` > * `launcher/src/core/Runner.h` > * `launcher/src/core/RunnerInstall.cpp` > * `launcher/src/core/RunnerInstall.h` > * `launcher/src/core/RunnerManager.cpp` > * `launcher/src/core/RunnerManager.h` > * `launcher/src/core/SettingsProfile.cpp` > * `launcher/src/core/SettingsProfile.h` > * `launcher/src/core/ShaderCacheInfo.cpp` > * `launcher/src/core/ShaderCacheInfo.h` > * `launcher/src/core/ShaderCacheMonitor.cpp` > * `launcher/src/core/ShaderCacheMonitor.h` > * `launcher/src/core/TitleConfig.cpp` > * `launcher/src/core/TitleConfig.h` > * `launcher/src/core/WarmupController.cpp` > * `launcher/src/core/WarmupController.h` > * `launcher/src/main.cpp` > * `launcher/src/pages/FirstLaunchPage.cpp` > * `launcher/src/pages/FirstLaunchPage.h` > * `launcher/src/pages/GameDetailsPage.cpp` > * `launcher/src/pages/GameDetailsPage.h` > * `launcher/src/pages/ImportSettingsDialog.cpp` > * `launcher/src/pages/ImportSettingsDialog.h` > * `launcher/src/pages/LibraryPage.cpp` > * `launcher/src/pages/LibraryPage.h` > * `launcher/src/pages/PageScaffold.cpp` > * `launcher/src/pages/PageScaffold.h` > * `launcher/src/pages/ProfileCard.cpp` > * `launcher/src/pages/ProfileCard.h` > * `launcher/src/pages/RunnerUi.cpp` > * `launcher/src/pages/RunnerUi.h` > * `launcher/src/pages/RunnersPage.cpp` > * `launcher/src/pages/RunnersPage.h` > * `launcher/src/pages/RunsWithPicker.cpp` > * `launcher/src/pages/RunsWithPicker.h` > * `launcher/src/pages/SettingsPage.cpp` > * `launcher/src/pages/SettingsPage.h` > * `launcher/src/pages/ShareSettingsDialog.cpp` > * `launcher/src/pages/ShareSettingsDialog.h` > * `launcher/src/pages/WarmupPage.cpp` > * `launcher/src/pages/WarmupPage.h` > * `launcher/src/pages/settings/AboutSection.cpp` > * `launcher/src/pages/settings/ConsoleSection.cpp` > * `launcher/src/pages/settings/GameFoldersSection.cpp` > * `launcher/src/pages/settings/GraphicsSection.cpp` > * `launcher/src/pages/settings/InputSection.cpp` > * `launcher/src/pages/settings/LogsSection.cpp` > * `launcher/src/pages/settings/NetworkSection.cpp` > * `launcher/src/pages/settings/OverlaySection.cpp` > * `launcher/src/pages/settings/Sections.h` > * `launcher/src/pages/settings/SettingsKit.cpp` > * `launcher/src/pages/settings/SettingsKit.h` > * `launcher/src/pages/settings/ShadersSection.cpp` > * `launcher/src/shell/FloatingBar.cpp` > * `launcher/src/shell/FloatingBar.h` > * `launcher/src/shell/InGameView.cpp` > * `launcher/src/shell/InGameView.h` > * `launcher/src/shell/LaunchErrors.cpp` > * `launcher/src/shell/LaunchErrors.h` > * `launcher/src/shell/MainWindow.cpp` > * `launcher/src/shell/MainWindow.h` > * `launcher/src/shell/Page.h` > * `launcher/src/shell/Sidebar.cpp` > * `launcher/src/shell/Sidebar.h` > * `launcher/src/shell/TitleBar.cpp` > * `launcher/src/shell/TitleBar.h` > * `launcher/src/shell/WindowButtons.cpp` > * `launcher/src/shell/WindowButtons.h` > * `launcher/src/theme/Theme.cpp` > * `launcher/src/theme/Theme.h` > * `launcher/src/widgets/Badge.cpp` > * `launcher/src/widgets/Badge.h` > * `launcher/src/widgets/Button.cpp` > * `launcher/src/widgets/Button.h` > * `launcher/src/widgets/Card.cpp` > * `launcher/src/widgets/Card.h` > * `launcher/src/widgets/ChoiceCard.cpp` > * `launcher/src/widgets/ChoiceCard.h` > * `launcher/src/widgets/CoverThumb.cpp` > * `launcher/src/widgets/CoverThumb.h` > * `launcher/src/widgets/CoverTile.cpp` > * `launcher/src/widgets/CoverTile.h` > * `launcher/src/widgets/Dialog.cpp` > * `launcher/src/widgets/Dialog.h` > * `launcher/src/widgets/Icon.cpp` > * `launcher/src/widgets/Icon.h` > * `launcher/src/widgets/InfoNote.cpp` > * `launcher/src/widgets/InfoNote.h` > * `launcher/src/widgets/NavItem.cpp` > * `launcher/src/widgets/NavItem.h` > * `launcher/src/widgets/PageHeader.cpp` > * `launcher/src/widgets/PageHeader.h` > * `launcher/src/widgets/ProgressBlock.cpp` > * `launcher/src/widgets/ProgressBlock.h` > * `launcher/src/widgets/SearchBox.cpp` > * `launcher/src/widgets/SearchBox.h` > * `launcher/src/widgets/SegmentedControl.cpp` > * `launcher/src/widgets/SegmentedControl.h` > * `launcher/src/widgets/Spinner.cpp` > * `launcher/src/widgets/Spinner.h` > * `launcher/src/widgets/Text.cpp` > * `launcher/src/widgets/Text.h` > * `launcher/src/widgets/Toggle.cpp` > * `launcher/src/widgets/Toggle.h` > * `launcher/tests/CMakeLists.txt` > * `launcher/tests/fake-cargo.cpp` > * `launcher/tests/fixtures/.gitattributes` > * `launcher/tests/fixtures/games/Archive/Quiet/LongQuiet.exe.fixture` > * `launcher/tests/fixtures/games/Archive/Quiet/MicrosoftGame.config.fixture` > * `launcher/tests/fixtures/games/Coastline Drive/Binaries/CoastlineDrive.exe.fixture` > * `launcher/tests/fixtures/games/Coastline Drive/MicrosoftGame.config.fixture` > * `launcher/tests/fixtures/games/NoExe/MicrosoftGame.config.fixture` > * `launcher/tests/fixtures/games/README.md` > * `launcher/tests/fixtures/games/SignalGarden/MicrosoftGame.config.fixture` > * `launcher/tests/fixtures/games/SignalGarden/SignalGarden.exe.fixture` > * `launcher/tests/fixtures/xcl-data/NorthwindInteractive.SignalGarden/xcl.toml` > * `launcher/tests/reparent-helper.cpp` > * `launcher/tests/tst_controllers.cpp` > * `launcher/tests/tst_coverart.cpp` > * `launcher/tests/tst_ingame.cpp` > * `launcher/tests/tst_library.cpp` > * `launcher/tests/tst_perf.cpp` > * `launcher/tests/tst_protocol.cpp` > * `launcher/tests/tst_reparent.cpp` > * `launcher/tests/tst_runners.cpp` > * `launcher/tests/tst_runnerstate.cpp` > * `launcher/tests/tst_settings.cpp` > * `launcher/tests/tst_settingsprofile.cpp` > * `launcher/tests/tst_shadercache.cpp` > * `launcher/tests/tst_titleconfig.cpp` > * `launcher/tools/fake-xsemu/CMakeLists.txt` > * `launcher/tools/fake-xsemu/FakeRun.cpp` > * `launcher/tools/fake-xsemu/FakeRun.h` > * `launcher/tools/fake-xsemu/FakeRunner.cpp` > * `launcher/tools/fake-xsemu/FakeRunner.h` > * `launcher/tools/fake-xsemu/FakeWarmup.cpp` > * `launcher/tools/fake-xsemu/FakeWarmup.h` > * `launcher/tools/fake-xsemu/Scene.cpp` > * `launcher/tools/fake-xsemu/Scene.h` > * `launcher/tools/fake-xsemu/main.cpp` > * `scripts/re/check_layout.py` > * `scripts/smoke.ps1` > > </dd> > </dl> > </details> > > You can disable this status message by setting the `reviews.review_status` to `false` in the CodeRabbit configuration file. <!-- end of auto-generated comment: rate limited by coderabbit.ai --> <!-- autopilot:start --> - [ ] <!-- {"checkboxId":"2708ad07-9f24-4260-9c11-7dc76a49f2e3"} --> <strong title="Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts">Autofix</strong> · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts <!-- autopilot:end --> <!-- tips_start --> Thanks for using [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=zortos293/XSEmu&utm_content=12)! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. <details> <summary><strong>Share</strong></summary> <dl> <dd> <br> - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code) </dd> </dl> </details> <!-- tips_end --> <!-- verify_invitation_start --> ### CodeRabbit Verify - [ ] <!-- {"checkboxId":"run-qa-agent"} --> Run CodeRabbit Verify to test the changes in this pull request. <!-- verify_invitation_end -->
Author
Owner

@⁠capy-ai[bot] on GitHub · 2026-11-26 18:12 UTC · original · reviewed

Capy found 3 potential issues (1 high, 2 medium).

View 3 other findings in Capy.

Open in Capy

**@⁠capy-ai[bot]** on GitHub · 2026-11-26 18:12 UTC · [original](https://github.com/zortos293/XSEmu/pull/12#pullrequestreview-6078829765) · **reviewed** Capy found 3 potential issues (1 high, 2 medium). View 3 other findings in Capy. <!-- capy-badge:start --> <a href="https://capy.ai/pull/zortos293/XSEmu/12"><picture><source media="(prefers-color-scheme: dark)" srcset="https://capy.ai/badge/neutral-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://capy.ai/badge/neutral-light.svg"><img alt="Open in Capy" src="https://capy.ai/badge/neutral-light.svg"></picture></a> <!-- capy-badge:end -->
Author
Owner

@⁠capy-ai[bot] on GitHub · 2026-11-26 18:12 UTC · original
On launcher/src/pages/settings/ShadersSection.cpp line 69 (outdated):

@@ -0,0 +1,212 @@
+#include "Sections.h"
+#include "SettingsKit.h"
+
+#include "app/Services.h"
+#include "core/Format.h"
+#include "core/LaunchConfig.h"
+#include "core/Paths.h"
+#include "core/ShaderCacheInfo.h"
+#include "widgets/Button.h"
+#include "widgets/Dialog.h"
+#include "widgets/InfoNote.h"
+#include "widgets/Text.h"
+#include "widgets/Toggle.h"
+
+#include <QDesktopServices>
+#include <QDir>
+#include <QDirIterator>
+#include <QCoreApplication>
+#include <QFileDialog>
+#include <QHBoxLayout>
+#include <QPointer>
+#include <QThreadPool>
+#include <QUrl>
+#include <QVBoxLayout>
+
+namespace {
+
+// The folders XSEmu writes into its shader cache (crates/xcl/src/hle/d3d12x/pso_manifest.rs,
+// real.rs, gpu/recomp/pso.rs). The launcher only empties a folder that holds them, or nothing.
+bool isShaderCacheFolder(const QDir& dir)
+{
+    if (!dir.exists())
+        return false;
+    if (dir.isRoot() || QDir::cleanPath(dir.absolutePath()) == QDir::cleanPath(QDir::homePath()))
+        return false;
+    if (dir.isEmpty(QDir::AllEntries | QDir::NoDotAndDotDot | QDir::Hidden))
+        return true;
+    for (const char* sub : {"pipelines", "driver", "translated"}) {
+        if (QFileInfo(dir.filePath(QLatin1String(sub))).isDir())
+            return true;
+    }
+    return false;
+}
+
+qint64 folderBytes(const QString& path)
+{
+    qint64 total = 0;
+    QDirIterator it(path, QDir::Files | QDir::Hidden | QDir::NoSymLinks, QDirIterator::Subdirectories);
+    while (it.hasNext()) {
+        it.next();
+        total += it.fileInfo().size();
+    }
+    return total;
+}
+
+// Deletes everything inside the shader cache folder and keeps the folder. Never the GPU driver's cache.
+bool clearShaderCache(const QString& path, QString* error)
+{
+    QDir dir(path);
+    if (!isShaderCacheFolder(dir)) {
+        *error = QStringLiteral("%1 doesn't look like an XSEmu shader cache, so nothing was deleted.").arg(QDir::toNativeSeparators(path));
+        return false;
+    }
+    bool ok = true;
+    for (const QFileInfo& fi : dir.entryInfoList(QDir::AllEntries | QDir::NoDotAndDotDot | QDir::Hidden | QDir::System)) {
+        if (fi.isDir() && !fi.isSymLink())
+            ok = QDir(fi.absoluteFilePath()).removeRecursively() && ok;
+        else
+            ok = QFile::remove(fi.absoluteFilePath()) && ok;

Clearing the shader cache can delete unrelated user files

High Severity

A user can select a non-cache folder containing a subdirectory named driver, pipelines, or translated: isShaderCacheFolder accepts it without checking its other contents. Clear cache then recursively deletes every entry in that folder, including unrelated documents or source files, although the confirmation describes only compiled shaders. The same problem occurs when unrelated files share a legitimate cache directory. Restrict deletion to verified cache-owned entries and reject ambiguous directories rather than treating one matching subdirectory as ownership of the entire folder.

Open in Capy

**@⁠capy-ai[bot]** on GitHub · 2026-11-26 18:12 UTC · [original](https://github.com/zortos293/XSEmu/pull/12#discussion_r4712090219) On `launcher/src/pages/settings/ShadersSection.cpp` line 69 (outdated): ```diff @@ -0,0 +1,212 @@ +#include "Sections.h" +#include "SettingsKit.h" + +#include "app/Services.h" +#include "core/Format.h" +#include "core/LaunchConfig.h" +#include "core/Paths.h" +#include "core/ShaderCacheInfo.h" +#include "widgets/Button.h" +#include "widgets/Dialog.h" +#include "widgets/InfoNote.h" +#include "widgets/Text.h" +#include "widgets/Toggle.h" + +#include <QDesktopServices> +#include <QDir> +#include <QDirIterator> +#include <QCoreApplication> +#include <QFileDialog> +#include <QHBoxLayout> +#include <QPointer> +#include <QThreadPool> +#include <QUrl> +#include <QVBoxLayout> + +namespace { + +// The folders XSEmu writes into its shader cache (crates/xcl/src/hle/d3d12x/pso_manifest.rs, +// real.rs, gpu/recomp/pso.rs). The launcher only empties a folder that holds them, or nothing. +bool isShaderCacheFolder(const QDir& dir) +{ + if (!dir.exists()) + return false; + if (dir.isRoot() || QDir::cleanPath(dir.absolutePath()) == QDir::cleanPath(QDir::homePath())) + return false; + if (dir.isEmpty(QDir::AllEntries | QDir::NoDotAndDotDot | QDir::Hidden)) + return true; + for (const char* sub : {"pipelines", "driver", "translated"}) { + if (QFileInfo(dir.filePath(QLatin1String(sub))).isDir()) + return true; + } + return false; +} + +qint64 folderBytes(const QString& path) +{ + qint64 total = 0; + QDirIterator it(path, QDir::Files | QDir::Hidden | QDir::NoSymLinks, QDirIterator::Subdirectories); + while (it.hasNext()) { + it.next(); + total += it.fileInfo().size(); + } + return total; +} + +// Deletes everything inside the shader cache folder and keeps the folder. Never the GPU driver's cache. +bool clearShaderCache(const QString& path, QString* error) +{ + QDir dir(path); + if (!isShaderCacheFolder(dir)) { + *error = QStringLiteral("%1 doesn't look like an XSEmu shader cache, so nothing was deleted.").arg(QDir::toNativeSeparators(path)); + return false; + } + bool ok = true; + for (const QFileInfo& fi : dir.entryInfoList(QDir::AllEntries | QDir::NoDotAndDotDot | QDir::Hidden | QDir::System)) { + if (fi.isDir() && !fi.isSymLink()) + ok = QDir(fi.absoluteFilePath()).removeRecursively() && ok; + else + ok = QFile::remove(fi.absoluteFilePath()) && ok; ``` ### Clearing the shader cache can delete unrelated user files **High Severity** A user can select a non-cache folder containing a subdirectory named `driver`, `pipelines`, or `translated`: `isShaderCacheFolder` accepts it without checking its other contents. Clear cache then recursively deletes every entry in that folder, including unrelated documents or source files, although the confirmation describes only compiled shaders. The same problem occurs when unrelated files share a legitimate cache directory. Restrict deletion to verified cache-owned entries and reject ambiguous directories rather than treating one matching subdirectory as ownership of the entire folder. <!-- capy-badge:start --> <a href="https://capy.ai/pull/zortos293/XSEmu/12"><picture><source media="(prefers-color-scheme: dark)" srcset="https://capy.ai/badge/neutral-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://capy.ai/badge/neutral-light.svg"><img alt="Open in Capy" src="https://capy.ai/badge/neutral-light.svg"></picture></a> <!-- capy-badge:end -->
Author
Owner

@⁠capy-ai[bot] on GitHub · 2026-11-26 18:12 UTC · original
On launcher/src/pages/GameDetailsPage.cpp line 760 (outdated):

@@ -0,0 +1,791 @@
+#include "GameDetailsPage.h"
+
+#include "RunsWithPicker.h"
+
+#include "app/Services.h"
+#include "core/Format.h"
+#include "core/Paths.h"
+#include "core/ShaderCacheInfo.h"
+#include "core/TitleConfig.h"
+#include "shell/LaunchErrors.h"
+#include "widgets/Badge.h"
+#include "widgets/Button.h"
+#include "widgets/Card.h"
+#include "widgets/CoverThumb.h"
+#include "widgets/Icon.h"
+#include "widgets/SegmentedControl.h"
+#include "widgets/Text.h"
+
+#include <QDesktopServices>
+#include <QDir>
+#include <QFileInfo>
+#include <QHBoxLayout>
+#include <QLinearGradient>
+#include <QMenu>
+#include <QMouseEvent>
+#include <QPainter>
+#include <QPainterPath>
+#include <QRegularExpression>
+#include <QScrollArea>
+#include <QTimer>
+#include <QUrl>
+#include <QVBoxLayout>
+
+#include <cmath>
+
+namespace {
+
+QString lowerFirst(const QString& s)
+{
+    return s.isEmpty() ? s : s.at(0).toLower() + s.mid(1);
+}
+
+// "Today 09:02", "Yesterday 21:40", "24 Nov 21:40"
+QString when(const QDateTime& at)
+{
+    if (!at.isValid())
+        return QStringLiteral("Never");
+    const QDateTime local = at.toLocalTime();
+    const qint64 days = local.date().daysTo(QDate::currentDate());
+    const QString time = local.toString(QStringLiteral("HH:mm"));
+    if (days == 0)
+        return QStringLiteral("Today %1").arg(time);
+    if (days == 1)
+        return QStringLiteral("Yesterday %1").arg(time);
+    return QStringLiteral("%1 %2").arg(local.toString(QStringLiteral("d MMM")), time);
+}
+
+QString minutes(qint64 s)
+{
+    return Format::duration(s).remove(QRegularExpression(QStringLiteral(" \\d+ s$")));
+}
+
+}
+
+// The action bar: surface with a hairline below.
+class ActionBar : public QWidget {
+protected:
+    void paintEvent(QPaintEvent*) override
+    {
+        QPainter p(this);
+        p.fillRect(rect(), Theme::color(Theme::Role::Surface));
+        p.fillRect(QRect(0, height() - 1, width(), 1), Theme::color(Theme::Role::Border));
+    }
+};
+
+// The 232 px band on top: hero art under a dark scrim, or the no-art fallback; the back link, the
+// cover and the title with the play record.
+class DetailsHero : public QWidget {
+public:
+    explicit DetailsHero(QWidget* parent = nullptr)
+        : QWidget(parent)
+        , m_cover(new CoverThumb(QSize(96, 144), this))
+        , m_findArt(new Button(QStringLiteral("Find art"), Button::Variant::Link, Button::Size::Tiny, {}, this))
+    {
+        setFixedHeight(232);
+        setMouseTracking(true);
+        connect(&Theme::instance(), &Theme::changed, this, qOverload<>(&QWidget::update));
+    }
+    Button* findArt() const { return m_findArt; }
+    std::function<void()> onBack;
+
+    void set(const QString& title, const QString& meta, const QPixmap& cover, const QPixmap& hero, bool canFindArt)
+    {
+        m_title = title;
+        m_meta = meta;
+        m_hero = hero;
+        m_cover->setCover(cover, title);
+        m_findArt->setVisible(hero.isNull() && canFindArt);
+        layoutChildren();
+        update();
+    }
+
+protected:
+    void resizeEvent(QResizeEvent*) override { layoutChildren(); }
+
+    void mouseMoveEvent(QMouseEvent* e) override
+    {
+        const bool over = backRect().contains(e->position());
+        if (over != m_backHover) {
+            m_backHover = over;
+            setCursor(over ? Qt::PointingHandCursor : Qt::ArrowCursor);
+            update();
+        }
+    }
+    void leaveEvent(QEvent*) override
+    {
+        m_backHover = false;
+        update();
+    }
+    void mouseReleaseEvent(QMouseEvent* e) override
+    {
+        if (e->button() == Qt::LeftButton && backRect().contains(e->position()) && onBack)
+            onBack();
+    }
+
+    void paintEvent(QPaintEvent*) override
+    {
+        const Palette& c = Theme::instance().palette();
+        QPainter p(this);
+        p.setRenderHint(QPainter::Antialiasing);
+        p.setRenderHint(QPainter::SmoothPixmapTransform);
+        const QRectF r = rect();
+        const bool art = !m_hero.isNull();
+        if (art) {
+            p.fillRect(r, QColor(0x1A, 0x1A, 0x1A));
+            const QSizeF scaled = QSizeF(m_hero.size()).scaled(QSizeF(r.width(), r.width() * 340.0 / 1056.0), Qt::KeepAspectRatioByExpanding);
+            p.drawPixmap(QRectF(r.center().x() - scaled.width() / 2, 0, scaled.width(), scaled.height()), m_hero, QRectF(m_hero.rect()));
+            QLinearGradient g(r.topLeft(), r.topRight());
+            g.setColorAt(0, QColor(0x08, 0x08, 0x0C, 0xD1));
+            g.setColorAt(0.55, QColor(0x08, 0x08, 0x0C, 0x59));
+            g.setColorAt(1, QColor(0x08, 0x08, 0x0C, 0x00));
+            p.fillRect(r, g);
+        } else {
+            p.fillRect(r, c.sunken);
+            p.fillRect(QRectF(0, r.height() - 1, r.width(), 1), c.border);
+            p.setFont(Theme::font(12));
+            p.setPen(c.text3);
+            const qreal right = m_findArt->isVisible() ? m_findArt->x() - 8 : r.width() - 32;
+            p.drawText(QRectF(0, 24, right, 16), Qt::AlignRight | Qt::AlignVCenter, QStringLiteral("No hero art"));
+        }
+        const QColor back = art ? (m_backHover ? QColor(Qt::white) : QColor(255, 255, 255, 0xE6)) : (m_backHover ? c.text : c.text2);
+        Icon::paint(p, QRectF(32, 24, 14, 16), QStringLiteral("back"), back, 14);
+        p.setFont(Theme::font(13, 500));
+        p.setPen(back);
+        p.drawText(QRectF(52, 24, 80, 16), Qt::AlignLeft | Qt::AlignVCenter, QStringLiteral("Library"));
+
+        const qreal x = 32 + 96 + 20;
+        const qreal textW = r.width() - x - 32;
+        const QFont tf = Theme::font(28, 600, -0.02);
+        p.setFont(tf);
+        p.setPen(art ? QColor(Qt::white) : c.text);
+        p.drawText(QRectF(x, r.height() - 24 - 4 - 16 - 6 - 34, textW, 34), Qt::AlignLeft | Qt::AlignVCenter,
+                   QFontMetrics(tf).elidedText(m_title, Qt::ElideRight, int(textW)));
+        p.setFont(Theme::font(13));
+        p.setPen(art ? QColor(255, 255, 255, 0xBF) : c.text2);
+        p.drawText(QRectF(x, r.height() - 24 - 4 - 16, textW, 16), Qt::AlignLeft | Qt::AlignVCenter, m_meta);
+    }
+
+private:
+    QRectF backRect() const { return QRectF(28, 20, 92, 24); }
+    void layoutChildren()
+    {
+        m_cover->move(32, height() - 24 - 144);
+        const QSize s = m_findArt->sizeHint();
+        m_findArt->setGeometry(width() - 32 - s.width() + 8, 19, s.width(), s.height());
+    }
+
+    CoverThumb* m_cover;
+    Button* m_findArt;
+    QString m_title;
+    QString m_meta;
+    QPixmap m_hero;
+    bool m_backHover = false;
+};
+
+// A details card: caps title with an optional widget on the right, then 36 px label/value rows with
+// a hairline above each.
+class InfoCard : public Card {
+public:
+    explicit InfoCard(const QString& title)
+        : Card(Card::Kind::Surface, 12)
+        , m_rows(new QVBoxLayout)
+        , m_trailing(new QHBoxLayout)
+    {
+        auto* v = new QVBoxLayout(this);
+        v->setContentsMargins(18, 16, 18, 6);
+        v->setSpacing(0);
+        auto* head = new QHBoxLayout;
+        head->setContentsMargins(0, 0, 0, 10);
+        head->addWidget(new Label(title, Label::Style::CapsMedium, Theme::Role::Text3));
+        head->addStretch(1);
+        m_trailing->setSpacing(10);
+        head->addLayout(m_trailing);
+        v->addLayout(head);
+        m_rows->setSpacing(0);
+        v->addLayout(m_rows);
+    }
+
+    void setTrailing(const QList<QWidget*>& widgets)
+    {
+        while (QLayoutItem* item = m_trailing->takeAt(0)) {
+            if (item->widget())
+                item->widget()->deleteLater();
+            delete item;
+        }
+        for (QWidget* w : widgets)
+            m_trailing->addWidget(w);
+    }
+
+    void clear()
+    {
+        while (QLayoutItem* item = m_rows->takeAt(0)) {
+            if (item->widget())
+                item->widget()->deleteLater();
+            delete item;
+        }
+    }
+
+    QWidget* addRow(const QString& label, QWidget* value, QWidget* below = nullptr)
+    {
+        auto* row = new Row;
+        auto* v = new QVBoxLayout(row);
+        v->setContentsMargins(0, 1, 0, 0);
+        v->setSpacing(0);
+        auto* h = new QHBoxLayout;
+        h->setContentsMargins(0, 0, 0, 0);
+        h->setSpacing(12);
+        auto* l = new Label(label, Label::Style::Small, Theme::Role::Text2);
+        l->setFixedWidth(132);
+        h->addWidget(l);
+        h->addWidget(value, 1);
+        auto* line = new QWidget;
+        line->setMinimumHeight(35);
+        line->setLayout(h);
+        v->addWidget(line);
+        if (below) {
+            auto* b = new QHBoxLayout;
+            b->setContentsMargins(144, 0, 0, 8);
+            b->addWidget(below);
+            v->addLayout(b);
+        }
+        m_rows->addWidget(row);
+        return row;
+    }
+
+    QWidget* addText(const QString& label, const QString& value, Theme::Role role = Theme::Role::Text)
+    {
+        auto* v = new Label(value, Label::Style::SmallMedium, role);
+        v->setWordWrap(true);
+        v->setTextInteractionFlags(Qt::TextSelectableByMouse);
+        return addRow(label, v);
+    }
+
+private:
+    class Row : public QWidget {
+    protected:
+        void paintEvent(QPaintEvent*) override
+        {
+            QPainter p(this);
+            p.fillRect(QRect(0, 0, width(), 1), Theme::color(Theme::Role::Border));
+        }
+    };
+
+    QVBoxLayout* m_rows;
+    QHBoxLayout* m_trailing;
+};
+
+namespace {
+
+struct OverrideSpec {
+    QString key;            // xcl.toml key, or the launcher's per-game key when launcherSide
+    QString label;
+    QStringList labels;     // [0] is "Default"
+    QVariantList values;    // [0] unused
+    QVariant defaultValue;  // what applies without an override
+    bool launcherSide = false;
+    bool backed = true;
+};
+
+bool sameValue(const QVariant& a, const QVariant& b)
+{
+    if (a.typeId() == QMetaType::QString || b.typeId() == QMetaType::QString)
+        return a.toString().compare(b.toString(), Qt::CaseInsensitive) == 0;
+    if (a.typeId() == QMetaType::Bool || b.typeId() == QMetaType::Bool)
+        return a.toBool() == b.toBool();
+    return std::abs(a.toDouble() - b.toDouble()) < 1e-6;
+}
+
+}
+
+GameDetailsPage::GameDetailsPage(Services& services, QWidget* parent)
+    : QWidget(parent)
+    , m_s(services)
+    , m_hero(new DetailsHero)
+    , m_primary(new Button(QStringLiteral("Play"), Button::Variant::Primary, Button::Size::Large, QStringLiteral("play")))
+    , m_secondary(new Button(QStringLiteral("Warm up again"), Button::Variant::Secondary, Button::Size::Large, QStringLiteral("bolt")))
+    , m_state(new Badge)
+    , m_runsWith(new RunsWithSelector(services))
+    , m_openFolder(new Button(QStringLiteral("Open folder"), Button::Variant::Ghost, Button::Size::Small, QStringLiteral("folder")))
+    , m_more(new Button({}, Button::Variant::Ghost, Button::Size::Small, QStringLiteral("more")))
+    , m_gameCard(new InfoCard(QStringLiteral("Game")))
+    , m_cacheCard(new InfoCard(QStringLiteral("Shader cache")))
+    , m_runCard(new InfoCard(QStringLiteral("Last run")))
+    , m_overrides(new InfoCard(QStringLiteral("Per-game overrides")))
+    , m_overridesNote(new Label({}, Label::Style::Caption, Theme::Role::Text3))
+{
+    auto* v = new QVBoxLayout(this);
+    v->setContentsMargins(0, 0, 0, 0);
+    v->setSpacing(0);
+    v->addWidget(m_hero);
+
+    auto* bar = new ActionBar;
+    bar->setFixedHeight(68);
+    auto* bh = new QHBoxLayout(bar);
+    bh->setContentsMargins(32, 0, 32, 1);
+    bh->setSpacing(8);
+    bh->addWidget(m_primary);
+    bh->addWidget(m_secondary);
+    bh->addSpacing(12);
+    bh->addWidget(m_state);
+    bh->addStretch(1);
+    bh->addWidget(m_runsWith);
+    bh->addSpacing(8);
+    bh->addWidget(m_openFolder);
+    connect(m_runsWith, &RunsWithSelector::manageRunners, this, &GameDetailsPage::manageRunners);
+    m_more->setToolTip(QStringLiteral("More"));
+    bh->addWidget(m_more);
+    v->addWidget(bar);
+
+    auto* scroll = new QScrollArea;
+    scroll->setWidgetResizable(true);
+    scroll->setFrameShape(QFrame::NoFrame);
+    scroll->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+    auto* inner = new QWidget;
+    inner->setObjectName(QStringLiteral("scrollContents"));
+    auto* cols = new QHBoxLayout(inner);
+    cols->setContentsMargins(32, 20, 32, 24);
+    cols->setSpacing(16);
+    auto* left = new QVBoxLayout;
+    left->setSpacing(16);
+    left->addWidget(m_gameCard);
+    left->addWidget(m_runCard);
+    left->addStretch(1);
+    auto* right = new QVBoxLayout;
+    right->setSpacing(16);
+    right->addWidget(m_cacheCard);
+    right->addWidget(m_overrides);
+    m_overridesNote->setWordWrap(true);
+    right->addWidget(m_overridesNote);
+    right->addStretch(1);
+    cols->addLayout(left, 1);
+    cols->addLayout(right, 1);
+    scroll->setWidget(inner);
+    v->addWidget(scroll, 1);
+
+    m_hero->onBack = [this] { emit back(); };
+    connect(m_hero->findArt(), &Button::clicked, this, [this] { m_s.covers.refresh(m_game); });
+    connect(m_primary, &Button::clicked, this, [this] {
+        if (m_primary->property("warmup").toBool())
+            emit warmupRequested(m_game);
+        else
+            requestPlay();
+    });
+    connect(m_secondary, &Button::clicked, this, [this] {
+        if (m_secondary->property("warmup").toBool())
+            emit warmupRequested(m_game);
+        else
+            emit playRequested(m_game);
+    });
+    connect(m_openFolder, &Button::clicked, this, [this] { QDesktopServices::openUrl(QUrl::fromLocalFile(m_game.folder)); });
+    connect(m_more, &Button::clicked, this, [this] {
+        QMenu menu(this);
+        const QString toml = Paths::xclToml(m_game.titleId());
+        QAction* openToml = menu.addAction(QStringLiteral("Open xcl.toml"));
+        openToml->setEnabled(QFileInfo::exists(toml));
+        QAction* openLogs = menu.addAction(QStringLiteral("Open logs folder"));
+        openLogs->setEnabled(QFileInfo(LaunchErrors::logsFolder(m_game)).isDir());
+        QAction* findArt = nullptr;
+        if (m_s.covers.canLookUp())
+            findArt = menu.addAction(QStringLiteral("Find art again"));
+        QAction* chosen = menu.exec(m_more->mapToGlobal(QPoint(0, m_more->height() + 4)));
+        if (chosen == openToml)
+            QDesktopServices::openUrl(QUrl::fromLocalFile(toml));
+        else if (chosen == openLogs)
+            QDesktopServices::openUrl(QUrl::fromLocalFile(LaunchErrors::logsFolder(m_game)));
+        else if (chosen && chosen == findArt)
+            m_s.covers.refresh(m_game);
+    });
+    connect(&m_s.gate, &ProcessGate::changed, this, &GameDetailsPage::refresh);
+    connect(&m_s.emulator, &EmulatorController::stateChanged, this, &GameDetailsPage::refresh);
+    connect(&m_s.emulator, &EmulatorController::statsChanged, this, &GameDetailsPage::onStats);
+    connect(&m_s.emulator, &EmulatorController::exited, this, &GameDetailsPage::onExit);
+    connect(&m_s.covers, &CoverArtService::artChanged, this, [this](const QString& id) {
+        if (id == m_game.titleId())
+            refresh();
+    });
+    connect(&m_s.settings, &AppSettings::changed, this, [this](const QString& key) {
+        if (!m_game.isValid())
+            return;
+        if (key == QLatin1String(AppSettings::Key::RecentWarmups) || key == QLatin1String(AppSettings::Key::PlayStats)
+            || key == QLatin1String(AppSettings::Key::SteamGridDbKey))
+            refresh();
+        else if (key == QLatin1String(AppSettings::Key::DefaultDeviceType) || key == QLatin1String(AppSettings::Key::OverlayDefault))
+            refreshOverrides();
+    });
+}
+
+void GameDetailsPage::setGame(const Game& game)
+{
+    m_game = game;
+    m_runsWith->setGame(game);
+    refresh();
+}
+
+void GameDetailsPage::requestPlay()
+{
+    const Game g = m_game;
+    LaunchErrors::confirmPlay(window(), m_s, g, [this, g] { emit playRequested(g); }, [this, g] { emit warmupRequested(g); });
+}
+
+void GameDetailsPage::onStats()
+{
+    const EmulatorController::State st = m_s.emulator.state();
+    if (st != EmulatorController::State::Running && st != EmulatorController::State::Paused && st != EmulatorController::State::Booting)
+        return;
+    const QString id = m_s.emulator.game().titleId();
+    if (id != m_runId) {
+        m_runId = id;
+        m_fpsSum = 0;
+        m_fpsSamples = 0;
+        m_stalls = 0;
+        m_worstMs = 0;
+        m_heldPeak = -1;
+        m_freeMinMb = -1;
+    }
+    const EmulatorController::Stats s = m_s.emulator.stats();
+    if (st == EmulatorController::State::Running && s.fps) {
+        m_fpsSum += *s.fps;
+        ++m_fpsSamples;
+    }
+    if (s.stalls)
+        m_stalls += *s.stalls;
+    if (s.worstMs)
+        m_worstMs = qMax(m_worstMs, *s.worstMs);
+    if (s.heldBytes > m_heldPeak)
+        m_heldPeak = s.heldBytes;
+    if (s.ramFreeMb && (m_freeMinMb < 0 || *s.ramFreeMb < m_freeMinMb))
+        m_freeMinMb = *s.ramFreeMb;
+}
+
+void GameDetailsPage::onExit(const EmulatorController::ExitInfo& info)
+{
+    using K = EmulatorController::ExitInfo::Kind;
+    const QString id = info.game.titleId();
+    QString result;
+    switch (info.kind) {
+    case K::Stopped: result = info.killed ? QStringLiteral("Stopped by you (forced after 5 s)") : QStringLiteral("Stopped by you"); break;
+    case K::TitleExit: result = QStringLiteral("The game exited"); break;
+    case K::Crash: result = QStringLiteral("Crashed (exit code %1)").arg(Format::exitCode(info.exitCode)); break;
+    case K::DeviceRemoved: result = QStringLiteral("GPU device removed"); break;
+    case K::Error: result = QStringLiteral("Couldn't start"); break;
+    }
+    QVariantMap run{
+        {QStringLiteral("result"), result},
+        {QStringLiteral("at"), info.at.toUTC().toString(Qt::ISODate)},
+        {QStringLiteral("seconds"), info.playedSeconds},
+    };
+    if (id == m_runId) {
+        if (m_fpsSamples > 0)
+            run.insert(QStringLiteral("fpsAverage"), m_fpsSum / m_fpsSamples);
+        if (m_fpsSamples > 0 || m_stalls > 0)
+            run.insert(QStringLiteral("stalls"), m_stalls);
+        if (m_heldPeak > 0)
+            run.insert(QStringLiteral("heldPeakBytes"), m_heldPeak);
+        if (m_freeMinMb >= 0)
+            run.insert(QStringLiteral("freeMinMb"), m_freeMinMb);
+    }
+    m_runId.clear();
+    m_s.settings.setLastRun(id, run);
+}
+
+void GameDetailsPage::refresh()
+{
+    if (!m_game.isValid())
+        return;
+    const Game& g = m_game;
+    const QString id = g.titleId();
+    const qint64 played = m_s.settings.playSeconds(id);
+    const QDateTime last = m_s.settings.lastPlayed(id);
+    QStringList meta;
+    if (!g.publisher.isEmpty())
+        meta << g.publisher;
+    if (played > 0)
+        meta << QStringLiteral("%1 played").arg(Format::playTime(played)) << QStringLiteral("last played %1").arg(lowerFirst(Format::ago(last)));
+    else
+        meta << QStringLiteral("Not played");
+    const QString grid = m_s.covers.artPath(id, CoverCache::Kind::Grid);
+    const QString hero = m_s.covers.artPath(id, CoverCache::Kind::Hero);
+    m_hero->set(g.title(), meta.join(QStringLiteral(" · ")), grid.isEmpty() ? QPixmap() : QPixmap(grid), hero.isEmpty() ? QPixmap() : QPixmap(hero),
+                m_s.covers.canLookUp());
+
+    // actions and the shader state
+    const QList<WarmupRun> recent = m_s.settings.recentWarmups();
+    const ShaderCacheInfo cache = ShaderCacheInfo::readDefault();
+    const TitleShaderState state = titleShaderState(id, recent, cache);
+    std::optional<WarmupRun> lastWarmup;
+    for (const WarmupRun& r : recent) {
+        if (r.titleId == id) {
+            lastWarmup = r;
+            break;
+        }
+    }
+    const bool playingThis = m_s.emulator.isActive() && m_s.emulator.game().titleId() == id;
+    const bool cold = LaunchErrors::shadersCold(m_s, g);
+    m_primary->setProperty("warmup", cold && !playingThis);
+    m_secondary->setProperty("warmup", !cold || playingThis);
+    if (playingThis) {
+        m_primary->setText(QStringLiteral("Return to game"));
+        m_primary->setIconName(QStringLiteral("play"));
+    } else if (cold) {
+        m_primary->setText(QStringLiteral("Warm up"));
+        m_primary->setIconName(QStringLiteral("bolt"));
+        m_secondary->setText(QStringLiteral("Play anyway"));
+        m_secondary->setIconName(QStringLiteral("play"));
+    } else {
+        m_primary->setText(QStringLiteral("Play"));
+        m_primary->setIconName(QStringLiteral("play"));
+        m_secondary->setText(state == TitleShaderState::Ready ? QStringLiteral("Warm up again") : QStringLiteral("Warm up"));
+        m_secondary->setIconName(QStringLiteral("bolt"));
+    }
+    m_secondary->setVisible(!playingThis);
+    const RunnerSpec& runner = m_s.emulator.runnerFor(g);
+    if (!runner.isBuiltIn()) {
+        m_secondary->setText(QStringLiteral("Pre-cache with %1").arg(runner.name));
+        m_secondary->setIconName(QStringLiteral("bolt"));
+        m_secondary->setVisible(!playingThis && !runner.precache.isEmpty());
+    }
+    QString stateText;
+    QString cacheState;
+    Theme::Tone tone = Theme::Tone::Neutral;
+    Theme::Role cacheRole = Theme::Role::Text2;
+    switch (state) {
+    case TitleShaderState::Ready: stateText = QStringLiteral("Shaders ready"); cacheState = QStringLiteral("Ready"); tone = Theme::Tone::Success; cacheRole = Theme::Role::Success; break;
+    case TitleShaderState::NeverWarmed: stateText = QStringLiteral("Never warmed up"); cacheState = QStringLiteral("Empty"); cacheRole = Theme::Role::Text3; break;
+    case TitleShaderState::LastRunIncomplete: stateText = QStringLiteral("Warm-up needed"); cacheState = QStringLiteral("Last warm-up stopped part way"); tone = Theme::Tone::Warning; cacheRole = Theme::Role::Warning; break;
+    case TitleShaderState::LastRunFailed: stateText = QStringLiteral("Warm-up failed"); cacheState = QStringLiteral("Last warm-up failed"); tone = Theme::Tone::Danger; cacheRole = Theme::Role::Danger; break;
+    case TitleShaderState::Unknown: stateText = QStringLiteral("Not warmed up here"); cacheState = QStringLiteral("Not warmed up from this launcher"); break;
+    }
+    if (!runner.isBuiltIn()) {
+        std::optional<WarmupRun> pre;
+        for (const WarmupRun& r : recent) {
+            if (r.titleId == id && r.runnerId == runner.id) {
+                pre = r;
+                break;
+            }
+        }
+        if (!m_s.runners.isRunnable(runner.id)) {
+            stateText = QStringLiteral("%1 not installed").arg(runner.name);
+            tone = Theme::Tone::Warning;
+        } else if (pre && pre->result == WarmupRun::Result::Finished && pre->total > 0) {
+            stateText = QStringLiteral("%1 cache ready").arg(runner.name);
+            tone = Theme::Tone::Success;
+        } else if (pre && pre->result == WarmupRun::Result::Failed) {
+            stateText = QStringLiteral("%1 pre-cache failed").arg(runner.name);
+            tone = Theme::Tone::Danger;
+        } else {
+            stateText = QStringLiteral("%1 keeps its own cache").arg(runner.name);
+            tone = Theme::Tone::Neutral;
+        }
+    }
+    // an older emulator build, or another emulator (or job) holding the PC: Play and Warm-up wait, saying why
+    using P = EmulatorController::LaunchCheck::Problem;
+    const EmulatorController::LaunchCheck check = playingThis ? EmulatorController::LaunchCheck{} : m_s.emulator.checkLaunch(g);
+    const bool held = check.problem == P::OtherEmulatorRunning || check.problem == P::EmulatorTooOld;
+    for (Button* b : {m_primary, m_secondary}) {
+        b->setEnabled(!held);
+        b->setToolTip(held ? check.reason : QString());
+    }
+    if (held) {
+        stateText = check.problem == P::EmulatorTooOld ? QStringLiteral("XSEmu build too old") : QStringLiteral("Emulator busy");
+        tone = check.problem == P::EmulatorTooOld ? Theme::Tone::Danger : Theme::Tone::Warning;
+    }
+    m_state->setText(stateText);
+    m_state->setToolTip(held ? check.reason : QString());
+    m_state->setTone(tone);
+
+    // GAME
+    m_gameCard->clear();
+    m_gameCard->addText(QStringLiteral("Version"), g.version.isEmpty() ? QStringLiteral("Unknown") : g.version);
+    m_gameCard->addText(QStringLiteral("Publisher"), g.publisher.isEmpty() ? QStringLiteral("Unknown") : g.publisher);
+    m_gameCard->addText(QStringLiteral("Install size"), g.sizeBytes < 0 ? QStringLiteral("Not measured") : Format::bytes(g.sizeBytes));
+    {
+        auto* box = new QWidget;
+        auto* h = new QHBoxLayout(box);
+        h->setContentsMargins(0, 0, 0, 0);
+        h->setSpacing(8);
+        const QString native = QDir::toNativeSeparators(g.folder);
+        auto* path = new Label(native, Label::Style::Mono, Theme::Role::Text);
+        path->setFont(Theme::mono(12));
+        path->setToolTip(native);
+        path->setMinimumWidth(40);
+        path->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Preferred);
+        path->setText(QFontMetrics(path->font()).elidedText(native, Qt::ElideMiddle, 230));
+        h->addWidget(path, 1);
+        auto* show = new Button(QStringLiteral("Show"), Button::Variant::Ghost, Button::Size::Tiny);
+        const QString folder = g.folder;
+        connect(show, &Button::clicked, this, [folder] { QDesktopServices::openUrl(QUrl::fromLocalFile(folder)); });
+        h->addWidget(show);
+        m_gameCard->addRow(QStringLiteral("Folder"), box);
+    }
+
+    // SHADER CACHE (machine-wide; per title only what this launcher's warm-ups recorded)
+    m_cacheCard->clear();
+    m_cacheCard->setTrailing({new Label(QStringLiteral("Shared by all games"), Label::Style::Caption, Theme::Role::Text3)});
+    m_cacheCard->addText(QStringLiteral("State"), cacheState, cacheRole);
+    if (lastWarmup && lastWarmup->total > 0)
+        m_cacheCard->addText(QStringLiteral("Pipelines"), QStringLiteral("%1 of %2 built · %3 failed")
+                                                              .arg(Format::count(lastWarmup->done - lastWarmup->failed), Format::count(lastWarmup->total), Format::count(lastWarmup->failed)));
+    else
+        m_cacheCard->addText(QStringLiteral("Pipelines"), cache.pipelines >= 0 ? QStringLiteral("%1 recorded on this PC").arg(Format::count(cache.pipelines)) : QStringLiteral("0 cached"));
+    m_cacheCard->addText(QStringLiteral("Last warm-up"), lastWarmup ? QStringLiteral("%1 · %2").arg(when(lastWarmup->finishedAt), lastWarmup->tookS >= 60 ? minutes(qint64(lastWarmup->tookS)) : Format::shortDuration(lastWarmup->tookS))
+                                                                   : QStringLiteral("Never"));
+
+    // LAST RUN
+    m_runCard->clear();
+    const QVariantMap run = m_s.settings.lastRun(id);
+    const QString log = Paths::xclLog(id);
+    if (QFileInfo::exists(log)) {
+        auto* open = new Button(QStringLiteral("Open log"), Button::Variant::Link, Button::Size::Tiny);
+        connect(open, &Button::clicked, this, [log] { QDesktopServices::openUrl(QUrl::fromLocalFile(log)); });
+        m_runCard->setTrailing({open});
+    } else {
+        m_runCard->setTrailing({});
+    }
+    if (run.isEmpty()) {
+        m_runCard->addText(QStringLiteral("Result"), played > 0 ? QStringLiteral("Not recorded") : QStringLiteral("Not played yet"), Theme::Role::Text3);
+    } else {
+        m_runCard->addText(QStringLiteral("Result"), run.value(QStringLiteral("result")).toString());
+        const QDateTime at = QDateTime::fromString(run.value(QStringLiteral("at")).toString(), Qt::ISODate);
+        const qint64 secs = run.value(QStringLiteral("seconds")).toLongLong();
+        m_runCard->addText(QStringLiteral("When"), secs > 0 ? QStringLiteral("%1 · ran %2").arg(when(at), minutes(secs)) : when(at));
+        if (run.contains(QStringLiteral("fpsAverage"))) {
+            const qint64 stalls = run.value(QStringLiteral("stalls")).toLongLong();
+            m_runCard->addText(QStringLiteral("Frame rate"), QStringLiteral("%1 fps average · %2")
+                                                                 .arg(qRound(run.value(QStringLiteral("fpsAverage")).toDouble()))
+                                                                 .arg(stalls == 1 ? QStringLiteral("1 stall over 100 ms") : QStringLiteral("%1 stalls over 100 ms").arg(stalls)));
+        }
+        QStringList ram;
+        if (run.contains(QStringLiteral("heldPeakBytes")))
+            ram << QStringLiteral("%1 held").arg(Format::gigabytes(run.value(QStringLiteral("heldPeakBytes")).toLongLong()));
+        if (run.contains(QStringLiteral("freeMinMb")))
+            ram << QStringLiteral("%1 free at lowest").arg(Format::gigabytesFromMb(run.value(QStringLiteral("freeMinMb")).toLongLong()));
+        if (!ram.isEmpty())
+            m_runCard->addText(QStringLiteral("Peak RAM"), ram.join(QStringLiteral(" · ")));
+    }
+
+    refreshOverrides();
+}
+
+void GameDetailsPage::refreshOverrides()
+{
+    if (!m_game.isValid())
+        return;
+    const QString id = m_game.titleId();
+    const QString deviceDefault = m_s.settings.defaultDeviceType();
+    const bool defaultIsS = deviceDefault != QLatin1String("anaconda");
+    const QList<OverrideSpec> specs = {
+        {QStringLiteral("device_type"), QStringLiteral("Console"),
+         {defaultIsS ? QStringLiteral("Default (S)") : QStringLiteral("Default (X)"), QStringLiteral("Series S"), QStringLiteral("Series X")},
+         {QVariant(), QStringLiteral("lockhart"), QStringLiteral("anaconda")}, deviceDefault},
+        {QStringLiteral("startIn"), QStringLiteral("Start in"), {QStringLiteral("Default"), QStringLiteral("Window"), QStringLiteral("Fullscreen")},
+         {QVariant(), QStringLiteral("window"), QStringLiteral("fullscreen")}, {}, true, false},
+        {QStringLiteral("overlay"), QStringLiteral("Overlay"), {QStringLiteral("Default"), QStringLiteral("On"), QStringLiteral("Off")},
+         {QVariant(), true, false}, m_s.settings.overlayDefault(), true},
+        {QStringLiteral("lowLatency"), QStringLiteral("Low latency"), {QStringLiteral("Default"), QStringLiteral("On"), QStringLiteral("Off")},
+         {QVariant(), true, false}, {}, true, false},
+        {QStringLiteral("display_mode"), QStringLiteral("Display mode"),
+         {QStringLiteral("Default"), QStringLiteral("720p"), QStringLiteral("1080p"), QStringLiteral("1440p"), QStringLiteral("4K")},
+         {QVariant(), QStringLiteral("1280x720"), QStringLiteral("1920x1080"), QStringLiteral("2560x1440"), QStringLiteral("3840x2160")}, QStringLiteral("auto")},
+        {QStringLiteral("raytracing"), QStringLiteral("Raytracing"),
+         {QStringLiteral("Default"), QStringLiteral("Tier 1.1"), QStringLiteral("Tier 1.0"), QStringLiteral("Off")},
+         {QVariant(), QStringLiteral("tier1_1"), QStringLiteral("tier1_0"), QStringLiteral("off")}, QStringLiteral("auto")},
+        {QStringLiteral("keyboard_mouse"), QStringLiteral("Keyboard & mouse"), {QStringLiteral("Default"), QStringLiteral("On"), QStringLiteral("Off")},
+         {QVariant(), true, false}, true},
+        {QStringLiteral("mouse_sensitivity"), QStringLiteral("Mouse speed"),
+         {QStringLiteral("Default"), QStringLiteral("0.5×"), QStringLiteral("1.5×"), QStringLiteral("2×")},
+         {QVariant(), 0.5, 1.5, 2.0}, 1.0},
+        {QStringLiteral("log_level"), QStringLiteral("Log level"),
+         {QStringLiteral("Default"), QStringLiteral("Warn"), QStringLiteral("Debug"), QStringLiteral("Trace")},
+         {QVariant(), QStringLiteral("warn"), QStringLiteral("debug"), QStringLiteral("trace")}, QStringLiteral("info")},
+    };
+    const QString tomlPath = Paths::xclToml(id);
+    const QVariantMap toml = TitleConfig(tomlPath).values();
+    const QVariantMap launcher = m_s.settings.gameOverrides(id);
+
+    m_overrides->clear();
+    int count = 0;
+    for (const OverrideSpec& spec : specs) {
+        QStringList labels = spec.labels;
+        int current = 0;
+        if (spec.backed) {
+            const QVariantMap& source = spec.launcherSide ? launcher : toml;
+            const QVariant value = source.value(spec.key);
+            if (value.isValid() && !sameValue(value, spec.defaultValue)) {
+                current = -1;
+                for (int i = 1; i < spec.values.size(); ++i) {
+                    if (sameValue(value, spec.values[i]))
+                        current = i;
+                }
+                if (current < 0) {
+                    labels << (value.typeId() == QMetaType::Double ? QStringLiteral("%1×").arg(value.toDouble()) : value.toString());
+                    current = int(labels.size()) - 1;
+                }
+                ++count;
+            }
+        }
+        auto* seg = new SegmentedControl(labels);
+        seg->setCurrentIndex(current);
+        seg->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
+        auto* holder = new QWidget;
+        auto* hh = new QHBoxLayout(holder);
+        hh->setContentsMargins(0, 0, 0, 0);
+        hh->addWidget(seg);
+        hh->addStretch(1);
+        Label* note = nullptr;
+        if (!spec.backed) {
+            seg->setEnabled(false);
+            note = new Label(QStringLiteral("Not in this XSEmu build yet"), Label::Style::Caption, Theme::Role::Text3);
+        }
+        QWidget* row = m_overrides->addRow(spec.label, holder, note);
+        row->setToolTip(spec.launcherSide ? QString() : QStringLiteral("%1 in xcl.toml").arg(spec.key));
+        if (!spec.backed)
+            continue;
+        const QVariantList values = spec.values;
+        const QString key = spec.key;
+        const bool launcherSide = spec.launcherSide;
+        connect(seg, &SegmentedControl::currentChanged, this, [this, id, tomlPath, key, values, launcherSide](int index) {
+            if (index >= values.size())
+                return;
+            if (launcherSide) {
+                if (index == 0)
+                    m_s.settings.clearGameOverride(id, key);
+                else
+                    m_s.settings.setGameOverride(id, key, values[index]);
+            } else {
+                TitleConfig cfg(tomlPath);
+                if (index == 0)
+                    cfg.remove({key});
+                else
+                    cfg.set(key, values[index]);

Per-game emulator overrides are overwritten at launch

Medium Severity

With the global console set to Series S, selecting Series X here writes anaconda only into xcl.toml. On the next Play, EmulatorController::start calls LaunchConfig::prepareTitle, whose titleValues reads overrides from AppSettings::gameOverrides, finds none, and overwrites the file with lockhart. Other per-game controls are likewise overwritten whenever their launcher-wide default is set. Persist and clear these choices in the override store used by launch preparation, and read that same store when displaying them.

Open in Capy

**@⁠capy-ai[bot]** on GitHub · 2026-11-26 18:12 UTC · [original](https://github.com/zortos293/XSEmu/pull/12#discussion_r4712090229) On `launcher/src/pages/GameDetailsPage.cpp` line 760 (outdated): ```diff @@ -0,0 +1,791 @@ +#include "GameDetailsPage.h" + +#include "RunsWithPicker.h" + +#include "app/Services.h" +#include "core/Format.h" +#include "core/Paths.h" +#include "core/ShaderCacheInfo.h" +#include "core/TitleConfig.h" +#include "shell/LaunchErrors.h" +#include "widgets/Badge.h" +#include "widgets/Button.h" +#include "widgets/Card.h" +#include "widgets/CoverThumb.h" +#include "widgets/Icon.h" +#include "widgets/SegmentedControl.h" +#include "widgets/Text.h" + +#include <QDesktopServices> +#include <QDir> +#include <QFileInfo> +#include <QHBoxLayout> +#include <QLinearGradient> +#include <QMenu> +#include <QMouseEvent> +#include <QPainter> +#include <QPainterPath> +#include <QRegularExpression> +#include <QScrollArea> +#include <QTimer> +#include <QUrl> +#include <QVBoxLayout> + +#include <cmath> + +namespace { + +QString lowerFirst(const QString& s) +{ + return s.isEmpty() ? s : s.at(0).toLower() + s.mid(1); +} + +// "Today 09:02", "Yesterday 21:40", "24 Nov 21:40" +QString when(const QDateTime& at) +{ + if (!at.isValid()) + return QStringLiteral("Never"); + const QDateTime local = at.toLocalTime(); + const qint64 days = local.date().daysTo(QDate::currentDate()); + const QString time = local.toString(QStringLiteral("HH:mm")); + if (days == 0) + return QStringLiteral("Today %1").arg(time); + if (days == 1) + return QStringLiteral("Yesterday %1").arg(time); + return QStringLiteral("%1 %2").arg(local.toString(QStringLiteral("d MMM")), time); +} + +QString minutes(qint64 s) +{ + return Format::duration(s).remove(QRegularExpression(QStringLiteral(" \\d+ s$"))); +} + +} + +// The action bar: surface with a hairline below. +class ActionBar : public QWidget { +protected: + void paintEvent(QPaintEvent*) override + { + QPainter p(this); + p.fillRect(rect(), Theme::color(Theme::Role::Surface)); + p.fillRect(QRect(0, height() - 1, width(), 1), Theme::color(Theme::Role::Border)); + } +}; + +// The 232 px band on top: hero art under a dark scrim, or the no-art fallback; the back link, the +// cover and the title with the play record. +class DetailsHero : public QWidget { +public: + explicit DetailsHero(QWidget* parent = nullptr) + : QWidget(parent) + , m_cover(new CoverThumb(QSize(96, 144), this)) + , m_findArt(new Button(QStringLiteral("Find art"), Button::Variant::Link, Button::Size::Tiny, {}, this)) + { + setFixedHeight(232); + setMouseTracking(true); + connect(&Theme::instance(), &Theme::changed, this, qOverload<>(&QWidget::update)); + } + Button* findArt() const { return m_findArt; } + std::function<void()> onBack; + + void set(const QString& title, const QString& meta, const QPixmap& cover, const QPixmap& hero, bool canFindArt) + { + m_title = title; + m_meta = meta; + m_hero = hero; + m_cover->setCover(cover, title); + m_findArt->setVisible(hero.isNull() && canFindArt); + layoutChildren(); + update(); + } + +protected: + void resizeEvent(QResizeEvent*) override { layoutChildren(); } + + void mouseMoveEvent(QMouseEvent* e) override + { + const bool over = backRect().contains(e->position()); + if (over != m_backHover) { + m_backHover = over; + setCursor(over ? Qt::PointingHandCursor : Qt::ArrowCursor); + update(); + } + } + void leaveEvent(QEvent*) override + { + m_backHover = false; + update(); + } + void mouseReleaseEvent(QMouseEvent* e) override + { + if (e->button() == Qt::LeftButton && backRect().contains(e->position()) && onBack) + onBack(); + } + + void paintEvent(QPaintEvent*) override + { + const Palette& c = Theme::instance().palette(); + QPainter p(this); + p.setRenderHint(QPainter::Antialiasing); + p.setRenderHint(QPainter::SmoothPixmapTransform); + const QRectF r = rect(); + const bool art = !m_hero.isNull(); + if (art) { + p.fillRect(r, QColor(0x1A, 0x1A, 0x1A)); + const QSizeF scaled = QSizeF(m_hero.size()).scaled(QSizeF(r.width(), r.width() * 340.0 / 1056.0), Qt::KeepAspectRatioByExpanding); + p.drawPixmap(QRectF(r.center().x() - scaled.width() / 2, 0, scaled.width(), scaled.height()), m_hero, QRectF(m_hero.rect())); + QLinearGradient g(r.topLeft(), r.topRight()); + g.setColorAt(0, QColor(0x08, 0x08, 0x0C, 0xD1)); + g.setColorAt(0.55, QColor(0x08, 0x08, 0x0C, 0x59)); + g.setColorAt(1, QColor(0x08, 0x08, 0x0C, 0x00)); + p.fillRect(r, g); + } else { + p.fillRect(r, c.sunken); + p.fillRect(QRectF(0, r.height() - 1, r.width(), 1), c.border); + p.setFont(Theme::font(12)); + p.setPen(c.text3); + const qreal right = m_findArt->isVisible() ? m_findArt->x() - 8 : r.width() - 32; + p.drawText(QRectF(0, 24, right, 16), Qt::AlignRight | Qt::AlignVCenter, QStringLiteral("No hero art")); + } + const QColor back = art ? (m_backHover ? QColor(Qt::white) : QColor(255, 255, 255, 0xE6)) : (m_backHover ? c.text : c.text2); + Icon::paint(p, QRectF(32, 24, 14, 16), QStringLiteral("back"), back, 14); + p.setFont(Theme::font(13, 500)); + p.setPen(back); + p.drawText(QRectF(52, 24, 80, 16), Qt::AlignLeft | Qt::AlignVCenter, QStringLiteral("Library")); + + const qreal x = 32 + 96 + 20; + const qreal textW = r.width() - x - 32; + const QFont tf = Theme::font(28, 600, -0.02); + p.setFont(tf); + p.setPen(art ? QColor(Qt::white) : c.text); + p.drawText(QRectF(x, r.height() - 24 - 4 - 16 - 6 - 34, textW, 34), Qt::AlignLeft | Qt::AlignVCenter, + QFontMetrics(tf).elidedText(m_title, Qt::ElideRight, int(textW))); + p.setFont(Theme::font(13)); + p.setPen(art ? QColor(255, 255, 255, 0xBF) : c.text2); + p.drawText(QRectF(x, r.height() - 24 - 4 - 16, textW, 16), Qt::AlignLeft | Qt::AlignVCenter, m_meta); + } + +private: + QRectF backRect() const { return QRectF(28, 20, 92, 24); } + void layoutChildren() + { + m_cover->move(32, height() - 24 - 144); + const QSize s = m_findArt->sizeHint(); + m_findArt->setGeometry(width() - 32 - s.width() + 8, 19, s.width(), s.height()); + } + + CoverThumb* m_cover; + Button* m_findArt; + QString m_title; + QString m_meta; + QPixmap m_hero; + bool m_backHover = false; +}; + +// A details card: caps title with an optional widget on the right, then 36 px label/value rows with +// a hairline above each. +class InfoCard : public Card { +public: + explicit InfoCard(const QString& title) + : Card(Card::Kind::Surface, 12) + , m_rows(new QVBoxLayout) + , m_trailing(new QHBoxLayout) + { + auto* v = new QVBoxLayout(this); + v->setContentsMargins(18, 16, 18, 6); + v->setSpacing(0); + auto* head = new QHBoxLayout; + head->setContentsMargins(0, 0, 0, 10); + head->addWidget(new Label(title, Label::Style::CapsMedium, Theme::Role::Text3)); + head->addStretch(1); + m_trailing->setSpacing(10); + head->addLayout(m_trailing); + v->addLayout(head); + m_rows->setSpacing(0); + v->addLayout(m_rows); + } + + void setTrailing(const QList<QWidget*>& widgets) + { + while (QLayoutItem* item = m_trailing->takeAt(0)) { + if (item->widget()) + item->widget()->deleteLater(); + delete item; + } + for (QWidget* w : widgets) + m_trailing->addWidget(w); + } + + void clear() + { + while (QLayoutItem* item = m_rows->takeAt(0)) { + if (item->widget()) + item->widget()->deleteLater(); + delete item; + } + } + + QWidget* addRow(const QString& label, QWidget* value, QWidget* below = nullptr) + { + auto* row = new Row; + auto* v = new QVBoxLayout(row); + v->setContentsMargins(0, 1, 0, 0); + v->setSpacing(0); + auto* h = new QHBoxLayout; + h->setContentsMargins(0, 0, 0, 0); + h->setSpacing(12); + auto* l = new Label(label, Label::Style::Small, Theme::Role::Text2); + l->setFixedWidth(132); + h->addWidget(l); + h->addWidget(value, 1); + auto* line = new QWidget; + line->setMinimumHeight(35); + line->setLayout(h); + v->addWidget(line); + if (below) { + auto* b = new QHBoxLayout; + b->setContentsMargins(144, 0, 0, 8); + b->addWidget(below); + v->addLayout(b); + } + m_rows->addWidget(row); + return row; + } + + QWidget* addText(const QString& label, const QString& value, Theme::Role role = Theme::Role::Text) + { + auto* v = new Label(value, Label::Style::SmallMedium, role); + v->setWordWrap(true); + v->setTextInteractionFlags(Qt::TextSelectableByMouse); + return addRow(label, v); + } + +private: + class Row : public QWidget { + protected: + void paintEvent(QPaintEvent*) override + { + QPainter p(this); + p.fillRect(QRect(0, 0, width(), 1), Theme::color(Theme::Role::Border)); + } + }; + + QVBoxLayout* m_rows; + QHBoxLayout* m_trailing; +}; + +namespace { + +struct OverrideSpec { + QString key; // xcl.toml key, or the launcher's per-game key when launcherSide + QString label; + QStringList labels; // [0] is "Default" + QVariantList values; // [0] unused + QVariant defaultValue; // what applies without an override + bool launcherSide = false; + bool backed = true; +}; + +bool sameValue(const QVariant& a, const QVariant& b) +{ + if (a.typeId() == QMetaType::QString || b.typeId() == QMetaType::QString) + return a.toString().compare(b.toString(), Qt::CaseInsensitive) == 0; + if (a.typeId() == QMetaType::Bool || b.typeId() == QMetaType::Bool) + return a.toBool() == b.toBool(); + return std::abs(a.toDouble() - b.toDouble()) < 1e-6; +} + +} + +GameDetailsPage::GameDetailsPage(Services& services, QWidget* parent) + : QWidget(parent) + , m_s(services) + , m_hero(new DetailsHero) + , m_primary(new Button(QStringLiteral("Play"), Button::Variant::Primary, Button::Size::Large, QStringLiteral("play"))) + , m_secondary(new Button(QStringLiteral("Warm up again"), Button::Variant::Secondary, Button::Size::Large, QStringLiteral("bolt"))) + , m_state(new Badge) + , m_runsWith(new RunsWithSelector(services)) + , m_openFolder(new Button(QStringLiteral("Open folder"), Button::Variant::Ghost, Button::Size::Small, QStringLiteral("folder"))) + , m_more(new Button({}, Button::Variant::Ghost, Button::Size::Small, QStringLiteral("more"))) + , m_gameCard(new InfoCard(QStringLiteral("Game"))) + , m_cacheCard(new InfoCard(QStringLiteral("Shader cache"))) + , m_runCard(new InfoCard(QStringLiteral("Last run"))) + , m_overrides(new InfoCard(QStringLiteral("Per-game overrides"))) + , m_overridesNote(new Label({}, Label::Style::Caption, Theme::Role::Text3)) +{ + auto* v = new QVBoxLayout(this); + v->setContentsMargins(0, 0, 0, 0); + v->setSpacing(0); + v->addWidget(m_hero); + + auto* bar = new ActionBar; + bar->setFixedHeight(68); + auto* bh = new QHBoxLayout(bar); + bh->setContentsMargins(32, 0, 32, 1); + bh->setSpacing(8); + bh->addWidget(m_primary); + bh->addWidget(m_secondary); + bh->addSpacing(12); + bh->addWidget(m_state); + bh->addStretch(1); + bh->addWidget(m_runsWith); + bh->addSpacing(8); + bh->addWidget(m_openFolder); + connect(m_runsWith, &RunsWithSelector::manageRunners, this, &GameDetailsPage::manageRunners); + m_more->setToolTip(QStringLiteral("More")); + bh->addWidget(m_more); + v->addWidget(bar); + + auto* scroll = new QScrollArea; + scroll->setWidgetResizable(true); + scroll->setFrameShape(QFrame::NoFrame); + scroll->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + auto* inner = new QWidget; + inner->setObjectName(QStringLiteral("scrollContents")); + auto* cols = new QHBoxLayout(inner); + cols->setContentsMargins(32, 20, 32, 24); + cols->setSpacing(16); + auto* left = new QVBoxLayout; + left->setSpacing(16); + left->addWidget(m_gameCard); + left->addWidget(m_runCard); + left->addStretch(1); + auto* right = new QVBoxLayout; + right->setSpacing(16); + right->addWidget(m_cacheCard); + right->addWidget(m_overrides); + m_overridesNote->setWordWrap(true); + right->addWidget(m_overridesNote); + right->addStretch(1); + cols->addLayout(left, 1); + cols->addLayout(right, 1); + scroll->setWidget(inner); + v->addWidget(scroll, 1); + + m_hero->onBack = [this] { emit back(); }; + connect(m_hero->findArt(), &Button::clicked, this, [this] { m_s.covers.refresh(m_game); }); + connect(m_primary, &Button::clicked, this, [this] { + if (m_primary->property("warmup").toBool()) + emit warmupRequested(m_game); + else + requestPlay(); + }); + connect(m_secondary, &Button::clicked, this, [this] { + if (m_secondary->property("warmup").toBool()) + emit warmupRequested(m_game); + else + emit playRequested(m_game); + }); + connect(m_openFolder, &Button::clicked, this, [this] { QDesktopServices::openUrl(QUrl::fromLocalFile(m_game.folder)); }); + connect(m_more, &Button::clicked, this, [this] { + QMenu menu(this); + const QString toml = Paths::xclToml(m_game.titleId()); + QAction* openToml = menu.addAction(QStringLiteral("Open xcl.toml")); + openToml->setEnabled(QFileInfo::exists(toml)); + QAction* openLogs = menu.addAction(QStringLiteral("Open logs folder")); + openLogs->setEnabled(QFileInfo(LaunchErrors::logsFolder(m_game)).isDir()); + QAction* findArt = nullptr; + if (m_s.covers.canLookUp()) + findArt = menu.addAction(QStringLiteral("Find art again")); + QAction* chosen = menu.exec(m_more->mapToGlobal(QPoint(0, m_more->height() + 4))); + if (chosen == openToml) + QDesktopServices::openUrl(QUrl::fromLocalFile(toml)); + else if (chosen == openLogs) + QDesktopServices::openUrl(QUrl::fromLocalFile(LaunchErrors::logsFolder(m_game))); + else if (chosen && chosen == findArt) + m_s.covers.refresh(m_game); + }); + connect(&m_s.gate, &ProcessGate::changed, this, &GameDetailsPage::refresh); + connect(&m_s.emulator, &EmulatorController::stateChanged, this, &GameDetailsPage::refresh); + connect(&m_s.emulator, &EmulatorController::statsChanged, this, &GameDetailsPage::onStats); + connect(&m_s.emulator, &EmulatorController::exited, this, &GameDetailsPage::onExit); + connect(&m_s.covers, &CoverArtService::artChanged, this, [this](const QString& id) { + if (id == m_game.titleId()) + refresh(); + }); + connect(&m_s.settings, &AppSettings::changed, this, [this](const QString& key) { + if (!m_game.isValid()) + return; + if (key == QLatin1String(AppSettings::Key::RecentWarmups) || key == QLatin1String(AppSettings::Key::PlayStats) + || key == QLatin1String(AppSettings::Key::SteamGridDbKey)) + refresh(); + else if (key == QLatin1String(AppSettings::Key::DefaultDeviceType) || key == QLatin1String(AppSettings::Key::OverlayDefault)) + refreshOverrides(); + }); +} + +void GameDetailsPage::setGame(const Game& game) +{ + m_game = game; + m_runsWith->setGame(game); + refresh(); +} + +void GameDetailsPage::requestPlay() +{ + const Game g = m_game; + LaunchErrors::confirmPlay(window(), m_s, g, [this, g] { emit playRequested(g); }, [this, g] { emit warmupRequested(g); }); +} + +void GameDetailsPage::onStats() +{ + const EmulatorController::State st = m_s.emulator.state(); + if (st != EmulatorController::State::Running && st != EmulatorController::State::Paused && st != EmulatorController::State::Booting) + return; + const QString id = m_s.emulator.game().titleId(); + if (id != m_runId) { + m_runId = id; + m_fpsSum = 0; + m_fpsSamples = 0; + m_stalls = 0; + m_worstMs = 0; + m_heldPeak = -1; + m_freeMinMb = -1; + } + const EmulatorController::Stats s = m_s.emulator.stats(); + if (st == EmulatorController::State::Running && s.fps) { + m_fpsSum += *s.fps; + ++m_fpsSamples; + } + if (s.stalls) + m_stalls += *s.stalls; + if (s.worstMs) + m_worstMs = qMax(m_worstMs, *s.worstMs); + if (s.heldBytes > m_heldPeak) + m_heldPeak = s.heldBytes; + if (s.ramFreeMb && (m_freeMinMb < 0 || *s.ramFreeMb < m_freeMinMb)) + m_freeMinMb = *s.ramFreeMb; +} + +void GameDetailsPage::onExit(const EmulatorController::ExitInfo& info) +{ + using K = EmulatorController::ExitInfo::Kind; + const QString id = info.game.titleId(); + QString result; + switch (info.kind) { + case K::Stopped: result = info.killed ? QStringLiteral("Stopped by you (forced after 5 s)") : QStringLiteral("Stopped by you"); break; + case K::TitleExit: result = QStringLiteral("The game exited"); break; + case K::Crash: result = QStringLiteral("Crashed (exit code %1)").arg(Format::exitCode(info.exitCode)); break; + case K::DeviceRemoved: result = QStringLiteral("GPU device removed"); break; + case K::Error: result = QStringLiteral("Couldn't start"); break; + } + QVariantMap run{ + {QStringLiteral("result"), result}, + {QStringLiteral("at"), info.at.toUTC().toString(Qt::ISODate)}, + {QStringLiteral("seconds"), info.playedSeconds}, + }; + if (id == m_runId) { + if (m_fpsSamples > 0) + run.insert(QStringLiteral("fpsAverage"), m_fpsSum / m_fpsSamples); + if (m_fpsSamples > 0 || m_stalls > 0) + run.insert(QStringLiteral("stalls"), m_stalls); + if (m_heldPeak > 0) + run.insert(QStringLiteral("heldPeakBytes"), m_heldPeak); + if (m_freeMinMb >= 0) + run.insert(QStringLiteral("freeMinMb"), m_freeMinMb); + } + m_runId.clear(); + m_s.settings.setLastRun(id, run); +} + +void GameDetailsPage::refresh() +{ + if (!m_game.isValid()) + return; + const Game& g = m_game; + const QString id = g.titleId(); + const qint64 played = m_s.settings.playSeconds(id); + const QDateTime last = m_s.settings.lastPlayed(id); + QStringList meta; + if (!g.publisher.isEmpty()) + meta << g.publisher; + if (played > 0) + meta << QStringLiteral("%1 played").arg(Format::playTime(played)) << QStringLiteral("last played %1").arg(lowerFirst(Format::ago(last))); + else + meta << QStringLiteral("Not played"); + const QString grid = m_s.covers.artPath(id, CoverCache::Kind::Grid); + const QString hero = m_s.covers.artPath(id, CoverCache::Kind::Hero); + m_hero->set(g.title(), meta.join(QStringLiteral(" · ")), grid.isEmpty() ? QPixmap() : QPixmap(grid), hero.isEmpty() ? QPixmap() : QPixmap(hero), + m_s.covers.canLookUp()); + + // actions and the shader state + const QList<WarmupRun> recent = m_s.settings.recentWarmups(); + const ShaderCacheInfo cache = ShaderCacheInfo::readDefault(); + const TitleShaderState state = titleShaderState(id, recent, cache); + std::optional<WarmupRun> lastWarmup; + for (const WarmupRun& r : recent) { + if (r.titleId == id) { + lastWarmup = r; + break; + } + } + const bool playingThis = m_s.emulator.isActive() && m_s.emulator.game().titleId() == id; + const bool cold = LaunchErrors::shadersCold(m_s, g); + m_primary->setProperty("warmup", cold && !playingThis); + m_secondary->setProperty("warmup", !cold || playingThis); + if (playingThis) { + m_primary->setText(QStringLiteral("Return to game")); + m_primary->setIconName(QStringLiteral("play")); + } else if (cold) { + m_primary->setText(QStringLiteral("Warm up")); + m_primary->setIconName(QStringLiteral("bolt")); + m_secondary->setText(QStringLiteral("Play anyway")); + m_secondary->setIconName(QStringLiteral("play")); + } else { + m_primary->setText(QStringLiteral("Play")); + m_primary->setIconName(QStringLiteral("play")); + m_secondary->setText(state == TitleShaderState::Ready ? QStringLiteral("Warm up again") : QStringLiteral("Warm up")); + m_secondary->setIconName(QStringLiteral("bolt")); + } + m_secondary->setVisible(!playingThis); + const RunnerSpec& runner = m_s.emulator.runnerFor(g); + if (!runner.isBuiltIn()) { + m_secondary->setText(QStringLiteral("Pre-cache with %1").arg(runner.name)); + m_secondary->setIconName(QStringLiteral("bolt")); + m_secondary->setVisible(!playingThis && !runner.precache.isEmpty()); + } + QString stateText; + QString cacheState; + Theme::Tone tone = Theme::Tone::Neutral; + Theme::Role cacheRole = Theme::Role::Text2; + switch (state) { + case TitleShaderState::Ready: stateText = QStringLiteral("Shaders ready"); cacheState = QStringLiteral("Ready"); tone = Theme::Tone::Success; cacheRole = Theme::Role::Success; break; + case TitleShaderState::NeverWarmed: stateText = QStringLiteral("Never warmed up"); cacheState = QStringLiteral("Empty"); cacheRole = Theme::Role::Text3; break; + case TitleShaderState::LastRunIncomplete: stateText = QStringLiteral("Warm-up needed"); cacheState = QStringLiteral("Last warm-up stopped part way"); tone = Theme::Tone::Warning; cacheRole = Theme::Role::Warning; break; + case TitleShaderState::LastRunFailed: stateText = QStringLiteral("Warm-up failed"); cacheState = QStringLiteral("Last warm-up failed"); tone = Theme::Tone::Danger; cacheRole = Theme::Role::Danger; break; + case TitleShaderState::Unknown: stateText = QStringLiteral("Not warmed up here"); cacheState = QStringLiteral("Not warmed up from this launcher"); break; + } + if (!runner.isBuiltIn()) { + std::optional<WarmupRun> pre; + for (const WarmupRun& r : recent) { + if (r.titleId == id && r.runnerId == runner.id) { + pre = r; + break; + } + } + if (!m_s.runners.isRunnable(runner.id)) { + stateText = QStringLiteral("%1 not installed").arg(runner.name); + tone = Theme::Tone::Warning; + } else if (pre && pre->result == WarmupRun::Result::Finished && pre->total > 0) { + stateText = QStringLiteral("%1 cache ready").arg(runner.name); + tone = Theme::Tone::Success; + } else if (pre && pre->result == WarmupRun::Result::Failed) { + stateText = QStringLiteral("%1 pre-cache failed").arg(runner.name); + tone = Theme::Tone::Danger; + } else { + stateText = QStringLiteral("%1 keeps its own cache").arg(runner.name); + tone = Theme::Tone::Neutral; + } + } + // an older emulator build, or another emulator (or job) holding the PC: Play and Warm-up wait, saying why + using P = EmulatorController::LaunchCheck::Problem; + const EmulatorController::LaunchCheck check = playingThis ? EmulatorController::LaunchCheck{} : m_s.emulator.checkLaunch(g); + const bool held = check.problem == P::OtherEmulatorRunning || check.problem == P::EmulatorTooOld; + for (Button* b : {m_primary, m_secondary}) { + b->setEnabled(!held); + b->setToolTip(held ? check.reason : QString()); + } + if (held) { + stateText = check.problem == P::EmulatorTooOld ? QStringLiteral("XSEmu build too old") : QStringLiteral("Emulator busy"); + tone = check.problem == P::EmulatorTooOld ? Theme::Tone::Danger : Theme::Tone::Warning; + } + m_state->setText(stateText); + m_state->setToolTip(held ? check.reason : QString()); + m_state->setTone(tone); + + // GAME + m_gameCard->clear(); + m_gameCard->addText(QStringLiteral("Version"), g.version.isEmpty() ? QStringLiteral("Unknown") : g.version); + m_gameCard->addText(QStringLiteral("Publisher"), g.publisher.isEmpty() ? QStringLiteral("Unknown") : g.publisher); + m_gameCard->addText(QStringLiteral("Install size"), g.sizeBytes < 0 ? QStringLiteral("Not measured") : Format::bytes(g.sizeBytes)); + { + auto* box = new QWidget; + auto* h = new QHBoxLayout(box); + h->setContentsMargins(0, 0, 0, 0); + h->setSpacing(8); + const QString native = QDir::toNativeSeparators(g.folder); + auto* path = new Label(native, Label::Style::Mono, Theme::Role::Text); + path->setFont(Theme::mono(12)); + path->setToolTip(native); + path->setMinimumWidth(40); + path->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Preferred); + path->setText(QFontMetrics(path->font()).elidedText(native, Qt::ElideMiddle, 230)); + h->addWidget(path, 1); + auto* show = new Button(QStringLiteral("Show"), Button::Variant::Ghost, Button::Size::Tiny); + const QString folder = g.folder; + connect(show, &Button::clicked, this, [folder] { QDesktopServices::openUrl(QUrl::fromLocalFile(folder)); }); + h->addWidget(show); + m_gameCard->addRow(QStringLiteral("Folder"), box); + } + + // SHADER CACHE (machine-wide; per title only what this launcher's warm-ups recorded) + m_cacheCard->clear(); + m_cacheCard->setTrailing({new Label(QStringLiteral("Shared by all games"), Label::Style::Caption, Theme::Role::Text3)}); + m_cacheCard->addText(QStringLiteral("State"), cacheState, cacheRole); + if (lastWarmup && lastWarmup->total > 0) + m_cacheCard->addText(QStringLiteral("Pipelines"), QStringLiteral("%1 of %2 built · %3 failed") + .arg(Format::count(lastWarmup->done - lastWarmup->failed), Format::count(lastWarmup->total), Format::count(lastWarmup->failed))); + else + m_cacheCard->addText(QStringLiteral("Pipelines"), cache.pipelines >= 0 ? QStringLiteral("%1 recorded on this PC").arg(Format::count(cache.pipelines)) : QStringLiteral("0 cached")); + m_cacheCard->addText(QStringLiteral("Last warm-up"), lastWarmup ? QStringLiteral("%1 · %2").arg(when(lastWarmup->finishedAt), lastWarmup->tookS >= 60 ? minutes(qint64(lastWarmup->tookS)) : Format::shortDuration(lastWarmup->tookS)) + : QStringLiteral("Never")); + + // LAST RUN + m_runCard->clear(); + const QVariantMap run = m_s.settings.lastRun(id); + const QString log = Paths::xclLog(id); + if (QFileInfo::exists(log)) { + auto* open = new Button(QStringLiteral("Open log"), Button::Variant::Link, Button::Size::Tiny); + connect(open, &Button::clicked, this, [log] { QDesktopServices::openUrl(QUrl::fromLocalFile(log)); }); + m_runCard->setTrailing({open}); + } else { + m_runCard->setTrailing({}); + } + if (run.isEmpty()) { + m_runCard->addText(QStringLiteral("Result"), played > 0 ? QStringLiteral("Not recorded") : QStringLiteral("Not played yet"), Theme::Role::Text3); + } else { + m_runCard->addText(QStringLiteral("Result"), run.value(QStringLiteral("result")).toString()); + const QDateTime at = QDateTime::fromString(run.value(QStringLiteral("at")).toString(), Qt::ISODate); + const qint64 secs = run.value(QStringLiteral("seconds")).toLongLong(); + m_runCard->addText(QStringLiteral("When"), secs > 0 ? QStringLiteral("%1 · ran %2").arg(when(at), minutes(secs)) : when(at)); + if (run.contains(QStringLiteral("fpsAverage"))) { + const qint64 stalls = run.value(QStringLiteral("stalls")).toLongLong(); + m_runCard->addText(QStringLiteral("Frame rate"), QStringLiteral("%1 fps average · %2") + .arg(qRound(run.value(QStringLiteral("fpsAverage")).toDouble())) + .arg(stalls == 1 ? QStringLiteral("1 stall over 100 ms") : QStringLiteral("%1 stalls over 100 ms").arg(stalls))); + } + QStringList ram; + if (run.contains(QStringLiteral("heldPeakBytes"))) + ram << QStringLiteral("%1 held").arg(Format::gigabytes(run.value(QStringLiteral("heldPeakBytes")).toLongLong())); + if (run.contains(QStringLiteral("freeMinMb"))) + ram << QStringLiteral("%1 free at lowest").arg(Format::gigabytesFromMb(run.value(QStringLiteral("freeMinMb")).toLongLong())); + if (!ram.isEmpty()) + m_runCard->addText(QStringLiteral("Peak RAM"), ram.join(QStringLiteral(" · "))); + } + + refreshOverrides(); +} + +void GameDetailsPage::refreshOverrides() +{ + if (!m_game.isValid()) + return; + const QString id = m_game.titleId(); + const QString deviceDefault = m_s.settings.defaultDeviceType(); + const bool defaultIsS = deviceDefault != QLatin1String("anaconda"); + const QList<OverrideSpec> specs = { + {QStringLiteral("device_type"), QStringLiteral("Console"), + {defaultIsS ? QStringLiteral("Default (S)") : QStringLiteral("Default (X)"), QStringLiteral("Series S"), QStringLiteral("Series X")}, + {QVariant(), QStringLiteral("lockhart"), QStringLiteral("anaconda")}, deviceDefault}, + {QStringLiteral("startIn"), QStringLiteral("Start in"), {QStringLiteral("Default"), QStringLiteral("Window"), QStringLiteral("Fullscreen")}, + {QVariant(), QStringLiteral("window"), QStringLiteral("fullscreen")}, {}, true, false}, + {QStringLiteral("overlay"), QStringLiteral("Overlay"), {QStringLiteral("Default"), QStringLiteral("On"), QStringLiteral("Off")}, + {QVariant(), true, false}, m_s.settings.overlayDefault(), true}, + {QStringLiteral("lowLatency"), QStringLiteral("Low latency"), {QStringLiteral("Default"), QStringLiteral("On"), QStringLiteral("Off")}, + {QVariant(), true, false}, {}, true, false}, + {QStringLiteral("display_mode"), QStringLiteral("Display mode"), + {QStringLiteral("Default"), QStringLiteral("720p"), QStringLiteral("1080p"), QStringLiteral("1440p"), QStringLiteral("4K")}, + {QVariant(), QStringLiteral("1280x720"), QStringLiteral("1920x1080"), QStringLiteral("2560x1440"), QStringLiteral("3840x2160")}, QStringLiteral("auto")}, + {QStringLiteral("raytracing"), QStringLiteral("Raytracing"), + {QStringLiteral("Default"), QStringLiteral("Tier 1.1"), QStringLiteral("Tier 1.0"), QStringLiteral("Off")}, + {QVariant(), QStringLiteral("tier1_1"), QStringLiteral("tier1_0"), QStringLiteral("off")}, QStringLiteral("auto")}, + {QStringLiteral("keyboard_mouse"), QStringLiteral("Keyboard & mouse"), {QStringLiteral("Default"), QStringLiteral("On"), QStringLiteral("Off")}, + {QVariant(), true, false}, true}, + {QStringLiteral("mouse_sensitivity"), QStringLiteral("Mouse speed"), + {QStringLiteral("Default"), QStringLiteral("0.5×"), QStringLiteral("1.5×"), QStringLiteral("2×")}, + {QVariant(), 0.5, 1.5, 2.0}, 1.0}, + {QStringLiteral("log_level"), QStringLiteral("Log level"), + {QStringLiteral("Default"), QStringLiteral("Warn"), QStringLiteral("Debug"), QStringLiteral("Trace")}, + {QVariant(), QStringLiteral("warn"), QStringLiteral("debug"), QStringLiteral("trace")}, QStringLiteral("info")}, + }; + const QString tomlPath = Paths::xclToml(id); + const QVariantMap toml = TitleConfig(tomlPath).values(); + const QVariantMap launcher = m_s.settings.gameOverrides(id); + + m_overrides->clear(); + int count = 0; + for (const OverrideSpec& spec : specs) { + QStringList labels = spec.labels; + int current = 0; + if (spec.backed) { + const QVariantMap& source = spec.launcherSide ? launcher : toml; + const QVariant value = source.value(spec.key); + if (value.isValid() && !sameValue(value, spec.defaultValue)) { + current = -1; + for (int i = 1; i < spec.values.size(); ++i) { + if (sameValue(value, spec.values[i])) + current = i; + } + if (current < 0) { + labels << (value.typeId() == QMetaType::Double ? QStringLiteral("%1×").arg(value.toDouble()) : value.toString()); + current = int(labels.size()) - 1; + } + ++count; + } + } + auto* seg = new SegmentedControl(labels); + seg->setCurrentIndex(current); + seg->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); + auto* holder = new QWidget; + auto* hh = new QHBoxLayout(holder); + hh->setContentsMargins(0, 0, 0, 0); + hh->addWidget(seg); + hh->addStretch(1); + Label* note = nullptr; + if (!spec.backed) { + seg->setEnabled(false); + note = new Label(QStringLiteral("Not in this XSEmu build yet"), Label::Style::Caption, Theme::Role::Text3); + } + QWidget* row = m_overrides->addRow(spec.label, holder, note); + row->setToolTip(spec.launcherSide ? QString() : QStringLiteral("%1 in xcl.toml").arg(spec.key)); + if (!spec.backed) + continue; + const QVariantList values = spec.values; + const QString key = spec.key; + const bool launcherSide = spec.launcherSide; + connect(seg, &SegmentedControl::currentChanged, this, [this, id, tomlPath, key, values, launcherSide](int index) { + if (index >= values.size()) + return; + if (launcherSide) { + if (index == 0) + m_s.settings.clearGameOverride(id, key); + else + m_s.settings.setGameOverride(id, key, values[index]); + } else { + TitleConfig cfg(tomlPath); + if (index == 0) + cfg.remove({key}); + else + cfg.set(key, values[index]); ``` ### Per-game emulator overrides are overwritten at launch **Medium Severity** With the global console set to Series S, selecting Series X here writes `anaconda` only into `xcl.toml`. On the next Play, `EmulatorController::start` calls `LaunchConfig::prepareTitle`, whose `titleValues` reads overrides from `AppSettings::gameOverrides`, finds none, and overwrites the file with `lockhart`. Other per-game controls are likewise overwritten whenever their launcher-wide default is set. Persist and clear these choices in the override store used by launch preparation, and read that same store when displaying them. <!-- capy-badge:start --> <a href="https://capy.ai/pull/zortos293/XSEmu/12"><picture><source media="(prefers-color-scheme: dark)" srcset="https://capy.ai/badge/neutral-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://capy.ai/badge/neutral-light.svg"><img alt="Open in Capy" src="https://capy.ai/badge/neutral-light.svg"></picture></a> <!-- capy-badge:end -->
@ -0,0 +457,4 @@
m_env.insert(QStringLiteral("CARGO_HOME"), QDir::toNativeSeparators(cargoHome));
m_env.insert(QStringLiteral("RUSTUP_HOME"), QDir::toNativeSeparators(QDir(home).filePath(QStringLiteral("rustup"))));
const QString bin = QDir(cargoHome).filePath(QStringLiteral("bin"));
m_env.insert(QStringLiteral("PATH"), QDir::toNativeSeparators(bin) + QDir::listSeparator() + m_env.value(QStringLiteral("PATH")));
Author
Owner

@⁠capy-ai[bot] on GitHub · 2026-11-26 18:12 UTC · original

Bootstrapped Cargo cannot be located on Windows

Medium Severity

On a Windows PC without Cargo in the launcher's original PATH, ensureRust installs it under _toolchains/cargo/bin and adds that directory only to m_env. Both curated source runners subsequently invoke the bare program name cargo through runProcess. Windows executable lookup uses the parent process's search path, not the environment block supplied to the child, so the build fails to start even after Rust setup succeeds. Retain the absolute path to the selected or installed Cargo executable and use it for build steps.

Open in Capy

**@⁠capy-ai[bot]** on GitHub · 2026-11-26 18:12 UTC · [original](https://github.com/zortos293/XSEmu/pull/12#discussion_r4712090237) ### Bootstrapped Cargo cannot be located on Windows **Medium Severity** On a Windows PC without Cargo in the launcher's original PATH, `ensureRust` installs it under `_toolchains/cargo/bin` and adds that directory only to `m_env`. Both curated source runners subsequently invoke the bare program name `cargo` through `runProcess`. Windows executable lookup uses the parent process's search path, not the environment block supplied to the child, so the build fails to start even after Rust setup succeeds. Retain the absolute path to the selected or installed Cargo executable and use it for build steps. <!-- capy-badge:start --> <a href="https://capy.ai/pull/zortos293/XSEmu/12"><picture><source media="(prefers-color-scheme: dark)" srcset="https://capy.ai/badge/neutral-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://capy.ai/badge/neutral-light.svg"><img alt="Open in Capy" src="https://capy.ai/badge/neutral-light.svg"></picture></a> <!-- capy-badge:end -->
Author
Owner

@⁠capy-ai[bot] on GitHub · 2026-11-26 18:33 UTC · original · reviewed

Capy found 1 potential issue (1 medium).

Open in Capy

**@⁠capy-ai[bot]** on GitHub · 2026-11-26 18:33 UTC · [original](https://github.com/zortos293/XSEmu/pull/12#pullrequestreview-6079031191) · **reviewed** Capy found 1 potential issue (1 medium). <!-- capy-badge:start --> <a href="https://capy.ai/pull/zortos293/XSEmu/12"><picture><source media="(prefers-color-scheme: dark)" srcset="https://capy.ai/badge/neutral-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://capy.ai/badge/neutral-light.svg"><img alt="Open in Capy" src="https://capy.ai/badge/neutral-light.svg"></picture></a> <!-- capy-badge:end -->
Author
Owner

@⁠capy-ai[bot] on GitHub · 2026-11-26 18:33 UTC · original
On launcher/src/pages/GameDetailsPage.cpp line 755 (outdated):

@@ -0,0 +1,783 @@
+#include "GameDetailsPage.h"
+
+#include "RunsWithPicker.h"
+
+#include "app/Services.h"
+#include "core/Format.h"
+#include "core/Paths.h"
+#include "core/ShaderCacheInfo.h"
+#include "shell/LaunchErrors.h"
+#include "widgets/Badge.h"
+#include "widgets/Button.h"
+#include "widgets/Card.h"
+#include "widgets/CoverThumb.h"
+#include "widgets/Icon.h"
+#include "widgets/SegmentedControl.h"
+#include "widgets/Text.h"
+
+#include <QDesktopServices>
+#include <QDir>
+#include <QFileInfo>
+#include <QHBoxLayout>
+#include <QLinearGradient>
+#include <QMenu>
+#include <QMouseEvent>
+#include <QPainter>
+#include <QPainterPath>
+#include <QRegularExpression>
+#include <QScrollArea>
+#include <QTimer>
+#include <QUrl>
+#include <QVBoxLayout>
+
+#include <cmath>
+
+namespace {
+
+QString lowerFirst(const QString& s)
+{
+    return s.isEmpty() ? s : s.at(0).toLower() + s.mid(1);
+}
+
+// "Today 09:02", "Yesterday 21:40", "24 Nov 21:40"
+QString when(const QDateTime& at)
+{
+    if (!at.isValid())
+        return QStringLiteral("Never");
+    const QDateTime local = at.toLocalTime();
+    const qint64 days = local.date().daysTo(QDate::currentDate());
+    const QString time = local.toString(QStringLiteral("HH:mm"));
+    if (days == 0)
+        return QStringLiteral("Today %1").arg(time);
+    if (days == 1)
+        return QStringLiteral("Yesterday %1").arg(time);
+    return QStringLiteral("%1 %2").arg(local.toString(QStringLiteral("d MMM")), time);
+}
+
+QString minutes(qint64 s)
+{
+    return Format::duration(s).remove(QRegularExpression(QStringLiteral(" \\d+ s$")));
+}
+
+}
+
+// The action bar: surface with a hairline below.
+class ActionBar : public QWidget {
+protected:
+    void paintEvent(QPaintEvent*) override
+    {
+        QPainter p(this);
+        p.fillRect(rect(), Theme::color(Theme::Role::Surface));
+        p.fillRect(QRect(0, height() - 1, width(), 1), Theme::color(Theme::Role::Border));
+    }
+};
+
+// The 232 px band on top: hero art under a dark scrim, or the no-art fallback; the back link, the
+// cover and the title with the play record.
+class DetailsHero : public QWidget {
+public:
+    explicit DetailsHero(QWidget* parent = nullptr)
+        : QWidget(parent)
+        , m_cover(new CoverThumb(QSize(96, 144), this))
+        , m_findArt(new Button(QStringLiteral("Find art"), Button::Variant::Link, Button::Size::Tiny, {}, this))
+    {
+        setFixedHeight(232);
+        setMouseTracking(true);
+        connect(&Theme::instance(), &Theme::changed, this, qOverload<>(&QWidget::update));
+    }
+    Button* findArt() const { return m_findArt; }
+    std::function<void()> onBack;
+
+    void set(const QString& title, const QString& meta, const QPixmap& cover, const QPixmap& hero, bool canFindArt)
+    {
+        m_title = title;
+        m_meta = meta;
+        m_hero = hero;
+        m_cover->setCover(cover, title);
+        m_findArt->setVisible(hero.isNull() && canFindArt);
+        layoutChildren();
+        update();
+    }
+
+protected:
+    void resizeEvent(QResizeEvent*) override { layoutChildren(); }
+
+    void mouseMoveEvent(QMouseEvent* e) override
+    {
+        const bool over = backRect().contains(e->position());
+        if (over != m_backHover) {
+            m_backHover = over;
+            setCursor(over ? Qt::PointingHandCursor : Qt::ArrowCursor);
+            update();
+        }
+    }
+    void leaveEvent(QEvent*) override
+    {
+        m_backHover = false;
+        update();
+    }
+    void mouseReleaseEvent(QMouseEvent* e) override
+    {
+        if (e->button() == Qt::LeftButton && backRect().contains(e->position()) && onBack)
+            onBack();
+    }
+
+    void paintEvent(QPaintEvent*) override
+    {
+        const Palette& c = Theme::instance().palette();
+        QPainter p(this);
+        p.setRenderHint(QPainter::Antialiasing);
+        p.setRenderHint(QPainter::SmoothPixmapTransform);
+        const QRectF r = rect();
+        const bool art = !m_hero.isNull();
+        if (art) {
+            p.fillRect(r, QColor(0x1A, 0x1A, 0x1A));
+            const QSizeF scaled = QSizeF(m_hero.size()).scaled(QSizeF(r.width(), r.width() * 340.0 / 1056.0), Qt::KeepAspectRatioByExpanding);
+            p.drawPixmap(QRectF(r.center().x() - scaled.width() / 2, 0, scaled.width(), scaled.height()), m_hero, QRectF(m_hero.rect()));
+            QLinearGradient g(r.topLeft(), r.topRight());
+            g.setColorAt(0, QColor(0x08, 0x08, 0x0C, 0xD1));
+            g.setColorAt(0.55, QColor(0x08, 0x08, 0x0C, 0x59));
+            g.setColorAt(1, QColor(0x08, 0x08, 0x0C, 0x00));
+            p.fillRect(r, g);
+        } else {
+            p.fillRect(r, c.sunken);
+            p.fillRect(QRectF(0, r.height() - 1, r.width(), 1), c.border);
+            p.setFont(Theme::font(12));
+            p.setPen(c.text3);
+            const qreal right = m_findArt->isVisible() ? m_findArt->x() - 8 : r.width() - 32;
+            p.drawText(QRectF(0, 24, right, 16), Qt::AlignRight | Qt::AlignVCenter, QStringLiteral("No hero art"));
+        }
+        const QColor back = art ? (m_backHover ? QColor(Qt::white) : QColor(255, 255, 255, 0xE6)) : (m_backHover ? c.text : c.text2);
+        Icon::paint(p, QRectF(32, 24, 14, 16), QStringLiteral("back"), back, 14);
+        p.setFont(Theme::font(13, 500));
+        p.setPen(back);
+        p.drawText(QRectF(52, 24, 80, 16), Qt::AlignLeft | Qt::AlignVCenter, QStringLiteral("Library"));
+
+        const qreal x = 32 + 96 + 20;
+        const qreal textW = r.width() - x - 32;
+        const QFont tf = Theme::font(28, 600, -0.02);
+        p.setFont(tf);
+        p.setPen(art ? QColor(Qt::white) : c.text);
+        p.drawText(QRectF(x, r.height() - 24 - 4 - 16 - 6 - 34, textW, 34), Qt::AlignLeft | Qt::AlignVCenter,
+                   QFontMetrics(tf).elidedText(m_title, Qt::ElideRight, int(textW)));
+        p.setFont(Theme::font(13));
+        p.setPen(art ? QColor(255, 255, 255, 0xBF) : c.text2);
+        p.drawText(QRectF(x, r.height() - 24 - 4 - 16, textW, 16), Qt::AlignLeft | Qt::AlignVCenter, m_meta);
+    }
+
+private:
+    QRectF backRect() const { return QRectF(28, 20, 92, 24); }
+    void layoutChildren()
+    {
+        m_cover->move(32, height() - 24 - 144);
+        const QSize s = m_findArt->sizeHint();
+        m_findArt->setGeometry(width() - 32 - s.width() + 8, 19, s.width(), s.height());
+    }
+
+    CoverThumb* m_cover;
+    Button* m_findArt;
+    QString m_title;
+    QString m_meta;
+    QPixmap m_hero;
+    bool m_backHover = false;
+};
+
+// A details card: caps title with an optional widget on the right, then 36 px label/value rows with
+// a hairline above each.
+class InfoCard : public Card {
+public:
+    explicit InfoCard(const QString& title)
+        : Card(Card::Kind::Surface, 12)
+        , m_rows(new QVBoxLayout)
+        , m_trailing(new QHBoxLayout)
+    {
+        auto* v = new QVBoxLayout(this);
+        v->setContentsMargins(18, 16, 18, 6);
+        v->setSpacing(0);
+        auto* head = new QHBoxLayout;
+        head->setContentsMargins(0, 0, 0, 10);
+        head->addWidget(new Label(title, Label::Style::CapsMedium, Theme::Role::Text3));
+        head->addStretch(1);
+        m_trailing->setSpacing(10);
+        head->addLayout(m_trailing);
+        v->addLayout(head);
+        m_rows->setSpacing(0);
+        v->addLayout(m_rows);
+    }
+
+    void setTrailing(const QList<QWidget*>& widgets)
+    {
+        while (QLayoutItem* item = m_trailing->takeAt(0)) {
+            if (item->widget())
+                item->widget()->deleteLater();
+            delete item;
+        }
+        for (QWidget* w : widgets)
+            m_trailing->addWidget(w);
+    }
+
+    void clear()
+    {
+        while (QLayoutItem* item = m_rows->takeAt(0)) {
+            if (item->widget())
+                item->widget()->deleteLater();
+            delete item;
+        }
+    }
+
+    QWidget* addRow(const QString& label, QWidget* value, QWidget* below = nullptr)
+    {
+        auto* row = new Row;
+        auto* v = new QVBoxLayout(row);
+        v->setContentsMargins(0, 1, 0, 0);
+        v->setSpacing(0);
+        auto* h = new QHBoxLayout;
+        h->setContentsMargins(0, 0, 0, 0);
+        h->setSpacing(12);
+        auto* l = new Label(label, Label::Style::Small, Theme::Role::Text2);
+        l->setFixedWidth(132);
+        h->addWidget(l);
+        h->addWidget(value, 1);
+        auto* line = new QWidget;
+        line->setMinimumHeight(35);
+        line->setLayout(h);
+        v->addWidget(line);
+        if (below) {
+            auto* b = new QHBoxLayout;
+            b->setContentsMargins(144, 0, 0, 8);
+            b->addWidget(below);
+            v->addLayout(b);
+        }
+        m_rows->addWidget(row);
+        return row;
+    }
+
+    QWidget* addText(const QString& label, const QString& value, Theme::Role role = Theme::Role::Text)
+    {
+        auto* v = new Label(value, Label::Style::SmallMedium, role);
+        v->setWordWrap(true);
+        v->setTextInteractionFlags(Qt::TextSelectableByMouse);
+        return addRow(label, v);
+    }
+
+private:
+    class Row : public QWidget {
+    protected:
+        void paintEvent(QPaintEvent*) override
+        {
+            QPainter p(this);
+            p.fillRect(QRect(0, 0, width(), 1), Theme::color(Theme::Role::Border));
+        }
+    };
+
+    QVBoxLayout* m_rows;
+    QHBoxLayout* m_trailing;
+};
+
+namespace {
+
+struct OverrideSpec {
+    QString key;            // xcl.toml key, or the launcher's per-game key when launcherSide
+    QString label;
+    QStringList labels;     // [0] is "Default"
+    QVariantList values;    // [0] unused
+    QVariant defaultValue;  // what applies without an override
+    bool launcherSide = false;
+    bool backed = true;
+};
+
+bool sameValue(const QVariant& a, const QVariant& b)
+{
+    if (a.typeId() == QMetaType::QString || b.typeId() == QMetaType::QString)
+        return a.toString().compare(b.toString(), Qt::CaseInsensitive) == 0;
+    if (a.typeId() == QMetaType::Bool || b.typeId() == QMetaType::Bool)
+        return a.toBool() == b.toBool();
+    return std::abs(a.toDouble() - b.toDouble()) < 1e-6;
+}
+
+}
+
+GameDetailsPage::GameDetailsPage(Services& services, QWidget* parent)
+    : QWidget(parent)
+    , m_s(services)
+    , m_hero(new DetailsHero)
+    , m_primary(new Button(QStringLiteral("Play"), Button::Variant::Primary, Button::Size::Large, QStringLiteral("play")))
+    , m_secondary(new Button(QStringLiteral("Warm up again"), Button::Variant::Secondary, Button::Size::Large, QStringLiteral("bolt")))
+    , m_state(new Badge)
+    , m_runsWith(new RunsWithSelector(services))
+    , m_openFolder(new Button(QStringLiteral("Open folder"), Button::Variant::Ghost, Button::Size::Small, QStringLiteral("folder")))
+    , m_more(new Button({}, Button::Variant::Ghost, Button::Size::Small, QStringLiteral("more")))
+    , m_gameCard(new InfoCard(QStringLiteral("Game")))
+    , m_cacheCard(new InfoCard(QStringLiteral("Shader cache")))
+    , m_runCard(new InfoCard(QStringLiteral("Last run")))
+    , m_overrides(new InfoCard(QStringLiteral("Per-game overrides")))
+    , m_overridesNote(new Label({}, Label::Style::Caption, Theme::Role::Text3))
+{
+    auto* v = new QVBoxLayout(this);
+    v->setContentsMargins(0, 0, 0, 0);
+    v->setSpacing(0);
+    v->addWidget(m_hero);
+
+    auto* bar = new ActionBar;
+    bar->setFixedHeight(68);
+    auto* bh = new QHBoxLayout(bar);
+    bh->setContentsMargins(32, 0, 32, 1);
+    bh->setSpacing(8);
+    bh->addWidget(m_primary);
+    bh->addWidget(m_secondary);
+    bh->addSpacing(12);
+    bh->addWidget(m_state);
+    bh->addStretch(1);
+    bh->addWidget(m_runsWith);
+    bh->addSpacing(8);
+    bh->addWidget(m_openFolder);
+    connect(m_runsWith, &RunsWithSelector::manageRunners, this, &GameDetailsPage::manageRunners);
+    m_more->setToolTip(QStringLiteral("More"));
+    bh->addWidget(m_more);
+    v->addWidget(bar);
+
+    auto* scroll = new QScrollArea;
+    scroll->setWidgetResizable(true);
+    scroll->setFrameShape(QFrame::NoFrame);
+    scroll->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+    auto* inner = new QWidget;
+    inner->setObjectName(QStringLiteral("scrollContents"));
+    auto* cols = new QHBoxLayout(inner);
+    cols->setContentsMargins(32, 20, 32, 24);
+    cols->setSpacing(16);
+    auto* left = new QVBoxLayout;
+    left->setSpacing(16);
+    left->addWidget(m_gameCard);
+    left->addWidget(m_runCard);
+    left->addStretch(1);
+    auto* right = new QVBoxLayout;
+    right->setSpacing(16);
+    right->addWidget(m_cacheCard);
+    right->addWidget(m_overrides);
+    m_overridesNote->setWordWrap(true);
+    right->addWidget(m_overridesNote);
+    right->addStretch(1);
+    cols->addLayout(left, 1);
+    cols->addLayout(right, 1);
+    scroll->setWidget(inner);
+    v->addWidget(scroll, 1);
+
+    m_hero->onBack = [this] { emit back(); };
+    connect(m_hero->findArt(), &Button::clicked, this, [this] { m_s.covers.refresh(m_game); });
+    connect(m_primary, &Button::clicked, this, [this] {
+        if (m_primary->property("warmup").toBool())
+            emit warmupRequested(m_game);
+        else
+            requestPlay();
+    });
+    connect(m_secondary, &Button::clicked, this, [this] {
+        if (m_secondary->property("warmup").toBool())
+            emit warmupRequested(m_game);
+        else
+            emit playRequested(m_game);
+    });
+    connect(m_openFolder, &Button::clicked, this, [this] { QDesktopServices::openUrl(QUrl::fromLocalFile(m_game.folder)); });
+    connect(m_more, &Button::clicked, this, [this] {
+        QMenu menu(this);
+        const QString toml = Paths::xclToml(m_game.titleId());
+        QAction* openToml = menu.addAction(QStringLiteral("Open xcl.toml"));
+        openToml->setEnabled(QFileInfo::exists(toml));
+        QAction* openLogs = menu.addAction(QStringLiteral("Open logs folder"));
+        openLogs->setEnabled(QFileInfo(LaunchErrors::logsFolder(m_game)).isDir());
+        QAction* findArt = nullptr;
+        if (m_s.covers.canLookUp())
+            findArt = menu.addAction(QStringLiteral("Find art again"));
+        QAction* chosen = menu.exec(m_more->mapToGlobal(QPoint(0, m_more->height() + 4)));
+        if (chosen == openToml)
+            QDesktopServices::openUrl(QUrl::fromLocalFile(toml));
+        else if (chosen == openLogs)
+            QDesktopServices::openUrl(QUrl::fromLocalFile(LaunchErrors::logsFolder(m_game)));
+        else if (chosen && chosen == findArt)
+            m_s.covers.refresh(m_game);
+    });
+    connect(&m_s.gate, &ProcessGate::changed, this, &GameDetailsPage::refresh);
+    connect(&m_s.emulator, &EmulatorController::stateChanged, this, &GameDetailsPage::refresh);
+    connect(&m_s.emulator, &EmulatorController::statsChanged, this, &GameDetailsPage::onStats);
+    connect(&m_s.emulator, &EmulatorController::exited, this, &GameDetailsPage::onExit);
+    connect(&m_s.covers, &CoverArtService::artChanged, this, [this](const QString& id) {
+        if (id == m_game.titleId())
+            refresh();
+    });
+    connect(&m_s.settings, &AppSettings::changed, this, [this](const QString& key) {
+        if (!m_game.isValid())
+            return;
+        if (key == QLatin1String(AppSettings::Key::RecentWarmups) || key == QLatin1String(AppSettings::Key::PlayStats)
+            || key == QLatin1String(AppSettings::Key::SteamGridDbKey))
+            refresh();
+        else if (key == QLatin1String(AppSettings::Key::DefaultDeviceType) || key == QLatin1String(AppSettings::Key::OverlayDefault))
+            refreshOverrides();
+    });
+}
+
+void GameDetailsPage::setGame(const Game& game)
+{
+    m_game = game;
+    m_runsWith->setGame(game);
+    refresh();
+}
+
+void GameDetailsPage::requestPlay()
+{
+    const Game g = m_game;
+    LaunchErrors::confirmPlay(window(), m_s, g, [this, g] { emit playRequested(g); }, [this, g] { emit warmupRequested(g); });
+}
+
+void GameDetailsPage::onStats()
+{
+    const EmulatorController::State st = m_s.emulator.state();
+    if (st != EmulatorController::State::Running && st != EmulatorController::State::Paused && st != EmulatorController::State::Booting)
+        return;
+    const QString id = m_s.emulator.game().titleId();
+    if (id != m_runId) {
+        m_runId = id;
+        m_fpsSum = 0;
+        m_fpsSamples = 0;
+        m_stalls = 0;
+        m_worstMs = 0;
+        m_heldPeak = -1;
+        m_freeMinMb = -1;
+    }
+    const EmulatorController::Stats s = m_s.emulator.stats();
+    // statsChanged also fires for memory polls and the overlay: sum each protocol sample once
+    if (s.sample != 0 && s.sample != m_lastSample) {
+        m_lastSample = s.sample;
+        if (st == EmulatorController::State::Running && s.fps) {
+            m_fpsSum += *s.fps;
+            ++m_fpsSamples;
+        }
+        if (s.stalls)
+            m_stalls += *s.stalls;
+    }
+    if (s.worstMs)
+        m_worstMs = qMax(m_worstMs, *s.worstMs);
+    if (s.heldBytes > m_heldPeak)
+        m_heldPeak = s.heldBytes;
+    if (s.ramFreeMb && (m_freeMinMb < 0 || *s.ramFreeMb < m_freeMinMb))
+        m_freeMinMb = *s.ramFreeMb;
+}
+
+void GameDetailsPage::onExit(const EmulatorController::ExitInfo& info)
+{
+    using K = EmulatorController::ExitInfo::Kind;
+    const QString id = info.game.titleId();
+    QString result;
+    switch (info.kind) {
+    case K::Stopped: result = info.killed ? QStringLiteral("Stopped by you (forced after 5 s)") : QStringLiteral("Stopped by you"); break;
+    case K::TitleExit: result = QStringLiteral("The game exited"); break;
+    case K::Crash: result = QStringLiteral("Crashed (exit code %1)").arg(Format::exitCode(info.exitCode)); break;
+    case K::DeviceRemoved: result = QStringLiteral("GPU device removed"); break;
+    case K::Error: result = QStringLiteral("Couldn't start"); break;
+    }
+    QVariantMap run{
+        {QStringLiteral("result"), result},
+        {QStringLiteral("at"), info.at.toUTC().toString(Qt::ISODate)},
+        {QStringLiteral("seconds"), info.playedSeconds},
+    };
+    if (id == m_runId) {
+        if (m_fpsSamples > 0)
+            run.insert(QStringLiteral("fpsAverage"), m_fpsSum / m_fpsSamples);
+        if (m_fpsSamples > 0 || m_stalls > 0)
+            run.insert(QStringLiteral("stalls"), m_stalls);
+        if (m_heldPeak > 0)
+            run.insert(QStringLiteral("heldPeakBytes"), m_heldPeak);
+        if (m_freeMinMb >= 0)
+            run.insert(QStringLiteral("freeMinMb"), m_freeMinMb);
+    }
+    m_runId.clear();
+    m_s.settings.setLastRun(id, run);
+}
+
+void GameDetailsPage::refresh()
+{
+    if (!m_game.isValid())
+        return;
+    const Game& g = m_game;
+    const QString id = g.titleId();
+    const qint64 played = m_s.settings.playSeconds(id);
+    const QDateTime last = m_s.settings.lastPlayed(id);
+    QStringList meta;
+    if (!g.publisher.isEmpty())
+        meta << g.publisher;
+    if (played > 0)
+        meta << QStringLiteral("%1 played").arg(Format::playTime(played)) << QStringLiteral("last played %1").arg(lowerFirst(Format::ago(last)));
+    else
+        meta << QStringLiteral("Not played");
+    const QString grid = m_s.covers.artPath(id, CoverCache::Kind::Grid);
+    const QString hero = m_s.covers.artPath(id, CoverCache::Kind::Hero);
+    m_hero->set(g.title(), meta.join(QStringLiteral(" · ")), grid.isEmpty() ? QPixmap() : QPixmap(grid), hero.isEmpty() ? QPixmap() : QPixmap(hero),
+                m_s.covers.canLookUp());
+
+    // actions and the shader state
+    const QList<WarmupRun> recent = m_s.settings.recentWarmups();
+    const ShaderCacheInfo cache = ShaderCacheInfo::readDefault();
+    const TitleShaderState state = titleShaderState(id, recent, cache);
+    std::optional<WarmupRun> lastWarmup;
+    for (const WarmupRun& r : recent) {
+        if (r.titleId == id) {
+            lastWarmup = r;
+            break;
+        }
+    }
+    const bool playingThis = m_s.emulator.isActive() && m_s.emulator.game().titleId() == id;
+    const bool cold = LaunchErrors::shadersCold(m_s, g);
+    m_primary->setProperty("warmup", cold && !playingThis);
+    m_secondary->setProperty("warmup", !cold || playingThis);
+    if (playingThis) {
+        m_primary->setText(QStringLiteral("Return to game"));
+        m_primary->setIconName(QStringLiteral("play"));
+    } else if (cold) {
+        m_primary->setText(QStringLiteral("Warm up"));
+        m_primary->setIconName(QStringLiteral("bolt"));
+        m_secondary->setText(QStringLiteral("Play anyway"));
+        m_secondary->setIconName(QStringLiteral("play"));
+    } else {
+        m_primary->setText(QStringLiteral("Play"));
+        m_primary->setIconName(QStringLiteral("play"));
+        m_secondary->setText(state == TitleShaderState::Ready ? QStringLiteral("Warm up again") : QStringLiteral("Warm up"));
+        m_secondary->setIconName(QStringLiteral("bolt"));
+    }
+    m_secondary->setVisible(!playingThis);
+    const RunnerSpec& runner = m_s.emulator.runnerFor(g);
+    if (!runner.isBuiltIn()) {
+        m_secondary->setText(QStringLiteral("Pre-cache with %1").arg(runner.name));
+        m_secondary->setIconName(QStringLiteral("bolt"));
+        m_secondary->setVisible(!playingThis && !runner.precache.isEmpty());
+    }
+    QString stateText;
+    QString cacheState;
+    Theme::Tone tone = Theme::Tone::Neutral;
+    Theme::Role cacheRole = Theme::Role::Text2;
+    switch (state) {
+    case TitleShaderState::Ready: stateText = QStringLiteral("Shaders ready"); cacheState = QStringLiteral("Ready"); tone = Theme::Tone::Success; cacheRole = Theme::Role::Success; break;
+    case TitleShaderState::NeverWarmed: stateText = QStringLiteral("Never warmed up"); cacheState = QStringLiteral("Empty"); cacheRole = Theme::Role::Text3; break;
+    case TitleShaderState::LastRunIncomplete: stateText = QStringLiteral("Warm-up needed"); cacheState = QStringLiteral("Last warm-up stopped part way"); tone = Theme::Tone::Warning; cacheRole = Theme::Role::Warning; break;
+    case TitleShaderState::LastRunFailed: stateText = QStringLiteral("Warm-up failed"); cacheState = QStringLiteral("Last warm-up failed"); tone = Theme::Tone::Danger; cacheRole = Theme::Role::Danger; break;
+    case TitleShaderState::Unknown: stateText = QStringLiteral("Not warmed up here"); cacheState = QStringLiteral("Not warmed up from this launcher"); break;
+    }
+    if (!runner.isBuiltIn()) {
+        std::optional<WarmupRun> pre;
+        for (const WarmupRun& r : recent) {
+            if (r.titleId == id && r.runnerId == runner.id) {
+                pre = r;
+                break;
+            }
+        }
+        if (!m_s.runners.isRunnable(runner.id)) {
+            stateText = QStringLiteral("%1 not installed").arg(runner.name);
+            tone = Theme::Tone::Warning;
+        } else if (pre && pre->result == WarmupRun::Result::Finished && pre->total > 0) {
+            stateText = QStringLiteral("%1 cache ready").arg(runner.name);
+            tone = Theme::Tone::Success;
+        } else if (pre && pre->result == WarmupRun::Result::Failed) {
+            stateText = QStringLiteral("%1 pre-cache failed").arg(runner.name);
+            tone = Theme::Tone::Danger;
+        } else {
+            stateText = QStringLiteral("%1 keeps its own cache").arg(runner.name);
+            tone = Theme::Tone::Neutral;
+        }
+    }
+    // an older emulator build, or another emulator (or job) holding the PC: Play and Warm-up wait, saying why
+    using P = EmulatorController::LaunchCheck::Problem;
+    const EmulatorController::LaunchCheck check = playingThis ? EmulatorController::LaunchCheck{} : m_s.emulator.checkLaunch(g);
+    const bool held = check.problem == P::OtherEmulatorRunning || check.problem == P::EmulatorTooOld;
+    for (Button* b : {m_primary, m_secondary}) {
+        b->setEnabled(!held);
+        b->setToolTip(held ? check.reason : QString());
+    }
+    if (held) {
+        stateText = check.problem == P::EmulatorTooOld ? QStringLiteral("XSEmu build too old") : QStringLiteral("Emulator busy");
+        tone = check.problem == P::EmulatorTooOld ? Theme::Tone::Danger : Theme::Tone::Warning;
+    }
+    m_state->setText(stateText);
+    m_state->setToolTip(held ? check.reason : QString());
+    m_state->setTone(tone);
+
+    // GAME
+    m_gameCard->clear();
+    m_gameCard->addText(QStringLiteral("Version"), g.version.isEmpty() ? QStringLiteral("Unknown") : g.version);
+    m_gameCard->addText(QStringLiteral("Publisher"), g.publisher.isEmpty() ? QStringLiteral("Unknown") : g.publisher);
+    m_gameCard->addText(QStringLiteral("Install size"), g.sizeBytes < 0 ? QStringLiteral("Not measured") : Format::bytes(g.sizeBytes));
+    {
+        auto* box = new QWidget;
+        auto* h = new QHBoxLayout(box);
+        h->setContentsMargins(0, 0, 0, 0);
+        h->setSpacing(8);
+        const QString native = QDir::toNativeSeparators(g.folder);
+        auto* path = new Label(native, Label::Style::Mono, Theme::Role::Text);
+        path->setFont(Theme::mono(12));
+        path->setToolTip(native);
+        path->setMinimumWidth(40);
+        path->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Preferred);
+        path->setText(QFontMetrics(path->font()).elidedText(native, Qt::ElideMiddle, 230));
+        h->addWidget(path, 1);
+        auto* show = new Button(QStringLiteral("Show"), Button::Variant::Ghost, Button::Size::Tiny);
+        const QString folder = g.folder;
+        connect(show, &Button::clicked, this, [folder] { QDesktopServices::openUrl(QUrl::fromLocalFile(folder)); });
+        h->addWidget(show);
+        m_gameCard->addRow(QStringLiteral("Folder"), box);
+    }
+
+    // SHADER CACHE (machine-wide; per title only what this launcher's warm-ups recorded)
+    m_cacheCard->clear();
+    m_cacheCard->setTrailing({new Label(QStringLiteral("Shared by all games"), Label::Style::Caption, Theme::Role::Text3)});
+    m_cacheCard->addText(QStringLiteral("State"), cacheState, cacheRole);
+    if (lastWarmup && lastWarmup->total > 0)
+        m_cacheCard->addText(QStringLiteral("Pipelines"), QStringLiteral("%1 of %2 built · %3 failed")
+                                                              .arg(Format::count(lastWarmup->done - lastWarmup->failed), Format::count(lastWarmup->total), Format::count(lastWarmup->failed)));
+    else
+        m_cacheCard->addText(QStringLiteral("Pipelines"), cache.pipelines >= 0 ? QStringLiteral("%1 recorded on this PC").arg(Format::count(cache.pipelines)) : QStringLiteral("0 cached"));
+    m_cacheCard->addText(QStringLiteral("Last warm-up"), lastWarmup ? QStringLiteral("%1 · %2").arg(when(lastWarmup->finishedAt), lastWarmup->tookS >= 60 ? minutes(qint64(lastWarmup->tookS)) : Format::shortDuration(lastWarmup->tookS))
+                                                                   : QStringLiteral("Never"));
+
+    // LAST RUN
+    m_runCard->clear();
+    const QVariantMap run = m_s.settings.lastRun(id);
+    const QString log = Paths::xclLog(id);
+    if (QFileInfo::exists(log)) {
+        auto* open = new Button(QStringLiteral("Open log"), Button::Variant::Link, Button::Size::Tiny);
+        connect(open, &Button::clicked, this, [log] { QDesktopServices::openUrl(QUrl::fromLocalFile(log)); });
+        m_runCard->setTrailing({open});
+    } else {
+        m_runCard->setTrailing({});
+    }
+    if (run.isEmpty()) {
+        m_runCard->addText(QStringLiteral("Result"), played > 0 ? QStringLiteral("Not recorded") : QStringLiteral("Not played yet"), Theme::Role::Text3);
+    } else {
+        m_runCard->addText(QStringLiteral("Result"), run.value(QStringLiteral("result")).toString());
+        const QDateTime at = QDateTime::fromString(run.value(QStringLiteral("at")).toString(), Qt::ISODate);
+        const qint64 secs = run.value(QStringLiteral("seconds")).toLongLong();
+        m_runCard->addText(QStringLiteral("When"), secs > 0 ? QStringLiteral("%1 · ran %2").arg(when(at), minutes(secs)) : when(at));
+        if (run.contains(QStringLiteral("fpsAverage"))) {
+            const qint64 stalls = run.value(QStringLiteral("stalls")).toLongLong();
+            m_runCard->addText(QStringLiteral("Frame rate"), QStringLiteral("%1 fps average · %2")
+                                                                 .arg(qRound(run.value(QStringLiteral("fpsAverage")).toDouble()))
+                                                                 .arg(stalls == 1 ? QStringLiteral("1 stall over 100 ms") : QStringLiteral("%1 stalls over 100 ms").arg(stalls)));
+        }
+        QStringList ram;
+        if (run.contains(QStringLiteral("heldPeakBytes")))
+            ram << QStringLiteral("%1 held").arg(Format::gigabytes(run.value(QStringLiteral("heldPeakBytes")).toLongLong()));
+        if (run.contains(QStringLiteral("freeMinMb")))
+            ram << QStringLiteral("%1 free at lowest").arg(Format::gigabytesFromMb(run.value(QStringLiteral("freeMinMb")).toLongLong()));
+        if (!ram.isEmpty())
+            m_runCard->addText(QStringLiteral("Peak RAM"), ram.join(QStringLiteral(" · ")));
+    }
+
+    refreshOverrides();
+}
+
+void GameDetailsPage::refreshOverrides()
+{
+    if (!m_game.isValid())
+        return;
+    const QString id = m_game.titleId();
+    const QString deviceDefault = m_s.settings.defaultDeviceType();
+    const bool defaultIsS = deviceDefault != QLatin1String("anaconda");
+    const QList<OverrideSpec> specs = {
+        {QStringLiteral("device_type"), QStringLiteral("Console"),
+         {defaultIsS ? QStringLiteral("Default (S)") : QStringLiteral("Default (X)"), QStringLiteral("Series S"), QStringLiteral("Series X")},
+         {QVariant(), QStringLiteral("lockhart"), QStringLiteral("anaconda")}, deviceDefault},
+        {QStringLiteral("startIn"), QStringLiteral("Start in"), {QStringLiteral("Default"), QStringLiteral("Window"), QStringLiteral("Fullscreen")},
+         {QVariant(), QStringLiteral("window"), QStringLiteral("fullscreen")}, {}, true, false},
+        {QStringLiteral("overlay"), QStringLiteral("Overlay"), {QStringLiteral("Default"), QStringLiteral("On"), QStringLiteral("Off")},
+         {QVariant(), true, false}, m_s.settings.overlayDefault(), true},
+        {QStringLiteral("lowLatency"), QStringLiteral("Low latency"), {QStringLiteral("Default"), QStringLiteral("On"), QStringLiteral("Off")},
+         {QVariant(), true, false}, {}, true, false},
+        {QStringLiteral("display_mode"), QStringLiteral("Display mode"),
+         {QStringLiteral("Default"), QStringLiteral("720p"), QStringLiteral("1080p"), QStringLiteral("1440p"), QStringLiteral("4K")},
+         {QVariant(), QStringLiteral("1280x720"), QStringLiteral("1920x1080"), QStringLiteral("2560x1440"), QStringLiteral("3840x2160")}, QStringLiteral("auto")},
+        {QStringLiteral("raytracing"), QStringLiteral("Raytracing"),
+         {QStringLiteral("Default"), QStringLiteral("Tier 1.1"), QStringLiteral("Tier 1.0"), QStringLiteral("Off")},
+         {QVariant(), QStringLiteral("tier1_1"), QStringLiteral("tier1_0"), QStringLiteral("off")}, QStringLiteral("auto")},
+        {QStringLiteral("keyboard_mouse"), QStringLiteral("Keyboard & mouse"), {QStringLiteral("Default"), QStringLiteral("On"), QStringLiteral("Off")},
+         {QVariant(), true, false}, true},
+        {QStringLiteral("mouse_sensitivity"), QStringLiteral("Mouse speed"),
+         {QStringLiteral("Default"), QStringLiteral("0.5×"), QStringLiteral("1.5×"), QStringLiteral("2×")},
+         {QVariant(), 0.5, 1.5, 2.0}, 1.0},
+        {QStringLiteral("log_level"), QStringLiteral("Log level"),
+         {QStringLiteral("Default"), QStringLiteral("Warn"), QStringLiteral("Debug"), QStringLiteral("Trace")},
+         {QVariant(), QStringLiteral("warn"), QStringLiteral("debug"), QStringLiteral("trace")}, QStringLiteral("info")},
+    };
+    // every per-game choice lives in AppSettings::gameOverrides: LaunchConfig::prepareTitle writes the
+    // xcl.toml keys from there into the title's xcl.toml when the game starts
+    const QString tomlPath = Paths::xclToml(id);
+    const QVariantMap chosen = m_s.settings.gameOverrides(id);
+
+    m_overrides->clear();
+    int count = 0;
+    for (const OverrideSpec& spec : specs) {
+        QStringList labels = spec.labels;
+        int current = 0;
+        if (spec.backed) {
+            const QVariant value = chosen.value(spec.key);
+            if (value.isValid() && !sameValue(value, spec.defaultValue)) {
+                current = -1;
+                for (int i = 1; i < spec.values.size(); ++i) {
+                    if (sameValue(value, spec.values[i]))
+                        current = i;
+                }
+                if (current < 0) {
+                    labels << (value.typeId() == QMetaType::Double ? QStringLiteral("%1×").arg(value.toDouble()) : value.toString());
+                    current = int(labels.size()) - 1;
+                }
+                ++count;
+            }
+        }
+        auto* seg = new SegmentedControl(labels);
+        seg->setCurrentIndex(current);
+        seg->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
+        auto* holder = new QWidget;
+        auto* hh = new QHBoxLayout(holder);
+        hh->setContentsMargins(0, 0, 0, 0);
+        hh->addWidget(seg);
+        hh->addStretch(1);
+        Label* note = nullptr;
+        if (!spec.backed) {
+            seg->setEnabled(false);
+            note = new Label(QStringLiteral("Not in this XSEmu build yet"), Label::Style::Caption, Theme::Role::Text3);
+        }
+        QWidget* row = m_overrides->addRow(spec.label, holder, note);
+        row->setToolTip(spec.launcherSide ? QString() : QStringLiteral("%1 in xcl.toml").arg(spec.key));
+        if (!spec.backed)
+            continue;
+        const QVariantList values = spec.values;
+        const QString key = spec.key;
+        connect(seg, &SegmentedControl::currentChanged, this, [this, id, key, values](int index) {
+            if (index >= values.size())
+                return;
+            if (index == 0)
+                m_s.settings.clearGameOverride(id, key);
+            else
+                m_s.settings.setGameOverride(id, key, values[index]);

Per-game console choice no longer reaches runner launches and runner warm-up

Medium Severity

The commit moved every Game details choice into AppSettings::gameOverrides and removed the direct write to the title's xcl.toml. Only LaunchConfig::prepareTitle copies those overrides to xcl.toml, and EmulatorController::start calls it only for built-in XSEmu (if (!spec.isBuiltIn()) return startRunner(...) returns before prepareTitle). EmulatorController::startRunner (EmulatorController.cpp:255-256) and WarmupController::startRunnerStep (WarmupController.cpp:305) take the console from xcl.toml with fallback to defaultDeviceType(), then pass it into the runner tokens (Runner.cpp:60 maps anaconda to series-x). Example: a game set to Series X under Game details, never played with built-in XSEmu, has no xcl.toml; a runner Play or runner warm-up therefore uses the launcher default console, and the UI still shows Series X. Before this commit the UI wrote device_type into xcl.toml, so runners honored it. After Use defaults, a runner keeps whatever stale value xcl.toml holds. The new note text at GameDetailsPage.cpp:781 ('written to xcl.toml when the game starts') is also false for runner games. Fix by resolving the effective per-game values (via LaunchConfig::titleValues) in the runner start and precache paths, or by calling prepareTitle before the runner branch.

Open in Capy

**@⁠capy-ai[bot]** on GitHub · 2026-11-26 18:33 UTC · [original](https://github.com/zortos293/XSEmu/pull/12#discussion_r4712260463) On `launcher/src/pages/GameDetailsPage.cpp` line 755 (outdated): ```diff @@ -0,0 +1,783 @@ +#include "GameDetailsPage.h" + +#include "RunsWithPicker.h" + +#include "app/Services.h" +#include "core/Format.h" +#include "core/Paths.h" +#include "core/ShaderCacheInfo.h" +#include "shell/LaunchErrors.h" +#include "widgets/Badge.h" +#include "widgets/Button.h" +#include "widgets/Card.h" +#include "widgets/CoverThumb.h" +#include "widgets/Icon.h" +#include "widgets/SegmentedControl.h" +#include "widgets/Text.h" + +#include <QDesktopServices> +#include <QDir> +#include <QFileInfo> +#include <QHBoxLayout> +#include <QLinearGradient> +#include <QMenu> +#include <QMouseEvent> +#include <QPainter> +#include <QPainterPath> +#include <QRegularExpression> +#include <QScrollArea> +#include <QTimer> +#include <QUrl> +#include <QVBoxLayout> + +#include <cmath> + +namespace { + +QString lowerFirst(const QString& s) +{ + return s.isEmpty() ? s : s.at(0).toLower() + s.mid(1); +} + +// "Today 09:02", "Yesterday 21:40", "24 Nov 21:40" +QString when(const QDateTime& at) +{ + if (!at.isValid()) + return QStringLiteral("Never"); + const QDateTime local = at.toLocalTime(); + const qint64 days = local.date().daysTo(QDate::currentDate()); + const QString time = local.toString(QStringLiteral("HH:mm")); + if (days == 0) + return QStringLiteral("Today %1").arg(time); + if (days == 1) + return QStringLiteral("Yesterday %1").arg(time); + return QStringLiteral("%1 %2").arg(local.toString(QStringLiteral("d MMM")), time); +} + +QString minutes(qint64 s) +{ + return Format::duration(s).remove(QRegularExpression(QStringLiteral(" \\d+ s$"))); +} + +} + +// The action bar: surface with a hairline below. +class ActionBar : public QWidget { +protected: + void paintEvent(QPaintEvent*) override + { + QPainter p(this); + p.fillRect(rect(), Theme::color(Theme::Role::Surface)); + p.fillRect(QRect(0, height() - 1, width(), 1), Theme::color(Theme::Role::Border)); + } +}; + +// The 232 px band on top: hero art under a dark scrim, or the no-art fallback; the back link, the +// cover and the title with the play record. +class DetailsHero : public QWidget { +public: + explicit DetailsHero(QWidget* parent = nullptr) + : QWidget(parent) + , m_cover(new CoverThumb(QSize(96, 144), this)) + , m_findArt(new Button(QStringLiteral("Find art"), Button::Variant::Link, Button::Size::Tiny, {}, this)) + { + setFixedHeight(232); + setMouseTracking(true); + connect(&Theme::instance(), &Theme::changed, this, qOverload<>(&QWidget::update)); + } + Button* findArt() const { return m_findArt; } + std::function<void()> onBack; + + void set(const QString& title, const QString& meta, const QPixmap& cover, const QPixmap& hero, bool canFindArt) + { + m_title = title; + m_meta = meta; + m_hero = hero; + m_cover->setCover(cover, title); + m_findArt->setVisible(hero.isNull() && canFindArt); + layoutChildren(); + update(); + } + +protected: + void resizeEvent(QResizeEvent*) override { layoutChildren(); } + + void mouseMoveEvent(QMouseEvent* e) override + { + const bool over = backRect().contains(e->position()); + if (over != m_backHover) { + m_backHover = over; + setCursor(over ? Qt::PointingHandCursor : Qt::ArrowCursor); + update(); + } + } + void leaveEvent(QEvent*) override + { + m_backHover = false; + update(); + } + void mouseReleaseEvent(QMouseEvent* e) override + { + if (e->button() == Qt::LeftButton && backRect().contains(e->position()) && onBack) + onBack(); + } + + void paintEvent(QPaintEvent*) override + { + const Palette& c = Theme::instance().palette(); + QPainter p(this); + p.setRenderHint(QPainter::Antialiasing); + p.setRenderHint(QPainter::SmoothPixmapTransform); + const QRectF r = rect(); + const bool art = !m_hero.isNull(); + if (art) { + p.fillRect(r, QColor(0x1A, 0x1A, 0x1A)); + const QSizeF scaled = QSizeF(m_hero.size()).scaled(QSizeF(r.width(), r.width() * 340.0 / 1056.0), Qt::KeepAspectRatioByExpanding); + p.drawPixmap(QRectF(r.center().x() - scaled.width() / 2, 0, scaled.width(), scaled.height()), m_hero, QRectF(m_hero.rect())); + QLinearGradient g(r.topLeft(), r.topRight()); + g.setColorAt(0, QColor(0x08, 0x08, 0x0C, 0xD1)); + g.setColorAt(0.55, QColor(0x08, 0x08, 0x0C, 0x59)); + g.setColorAt(1, QColor(0x08, 0x08, 0x0C, 0x00)); + p.fillRect(r, g); + } else { + p.fillRect(r, c.sunken); + p.fillRect(QRectF(0, r.height() - 1, r.width(), 1), c.border); + p.setFont(Theme::font(12)); + p.setPen(c.text3); + const qreal right = m_findArt->isVisible() ? m_findArt->x() - 8 : r.width() - 32; + p.drawText(QRectF(0, 24, right, 16), Qt::AlignRight | Qt::AlignVCenter, QStringLiteral("No hero art")); + } + const QColor back = art ? (m_backHover ? QColor(Qt::white) : QColor(255, 255, 255, 0xE6)) : (m_backHover ? c.text : c.text2); + Icon::paint(p, QRectF(32, 24, 14, 16), QStringLiteral("back"), back, 14); + p.setFont(Theme::font(13, 500)); + p.setPen(back); + p.drawText(QRectF(52, 24, 80, 16), Qt::AlignLeft | Qt::AlignVCenter, QStringLiteral("Library")); + + const qreal x = 32 + 96 + 20; + const qreal textW = r.width() - x - 32; + const QFont tf = Theme::font(28, 600, -0.02); + p.setFont(tf); + p.setPen(art ? QColor(Qt::white) : c.text); + p.drawText(QRectF(x, r.height() - 24 - 4 - 16 - 6 - 34, textW, 34), Qt::AlignLeft | Qt::AlignVCenter, + QFontMetrics(tf).elidedText(m_title, Qt::ElideRight, int(textW))); + p.setFont(Theme::font(13)); + p.setPen(art ? QColor(255, 255, 255, 0xBF) : c.text2); + p.drawText(QRectF(x, r.height() - 24 - 4 - 16, textW, 16), Qt::AlignLeft | Qt::AlignVCenter, m_meta); + } + +private: + QRectF backRect() const { return QRectF(28, 20, 92, 24); } + void layoutChildren() + { + m_cover->move(32, height() - 24 - 144); + const QSize s = m_findArt->sizeHint(); + m_findArt->setGeometry(width() - 32 - s.width() + 8, 19, s.width(), s.height()); + } + + CoverThumb* m_cover; + Button* m_findArt; + QString m_title; + QString m_meta; + QPixmap m_hero; + bool m_backHover = false; +}; + +// A details card: caps title with an optional widget on the right, then 36 px label/value rows with +// a hairline above each. +class InfoCard : public Card { +public: + explicit InfoCard(const QString& title) + : Card(Card::Kind::Surface, 12) + , m_rows(new QVBoxLayout) + , m_trailing(new QHBoxLayout) + { + auto* v = new QVBoxLayout(this); + v->setContentsMargins(18, 16, 18, 6); + v->setSpacing(0); + auto* head = new QHBoxLayout; + head->setContentsMargins(0, 0, 0, 10); + head->addWidget(new Label(title, Label::Style::CapsMedium, Theme::Role::Text3)); + head->addStretch(1); + m_trailing->setSpacing(10); + head->addLayout(m_trailing); + v->addLayout(head); + m_rows->setSpacing(0); + v->addLayout(m_rows); + } + + void setTrailing(const QList<QWidget*>& widgets) + { + while (QLayoutItem* item = m_trailing->takeAt(0)) { + if (item->widget()) + item->widget()->deleteLater(); + delete item; + } + for (QWidget* w : widgets) + m_trailing->addWidget(w); + } + + void clear() + { + while (QLayoutItem* item = m_rows->takeAt(0)) { + if (item->widget()) + item->widget()->deleteLater(); + delete item; + } + } + + QWidget* addRow(const QString& label, QWidget* value, QWidget* below = nullptr) + { + auto* row = new Row; + auto* v = new QVBoxLayout(row); + v->setContentsMargins(0, 1, 0, 0); + v->setSpacing(0); + auto* h = new QHBoxLayout; + h->setContentsMargins(0, 0, 0, 0); + h->setSpacing(12); + auto* l = new Label(label, Label::Style::Small, Theme::Role::Text2); + l->setFixedWidth(132); + h->addWidget(l); + h->addWidget(value, 1); + auto* line = new QWidget; + line->setMinimumHeight(35); + line->setLayout(h); + v->addWidget(line); + if (below) { + auto* b = new QHBoxLayout; + b->setContentsMargins(144, 0, 0, 8); + b->addWidget(below); + v->addLayout(b); + } + m_rows->addWidget(row); + return row; + } + + QWidget* addText(const QString& label, const QString& value, Theme::Role role = Theme::Role::Text) + { + auto* v = new Label(value, Label::Style::SmallMedium, role); + v->setWordWrap(true); + v->setTextInteractionFlags(Qt::TextSelectableByMouse); + return addRow(label, v); + } + +private: + class Row : public QWidget { + protected: + void paintEvent(QPaintEvent*) override + { + QPainter p(this); + p.fillRect(QRect(0, 0, width(), 1), Theme::color(Theme::Role::Border)); + } + }; + + QVBoxLayout* m_rows; + QHBoxLayout* m_trailing; +}; + +namespace { + +struct OverrideSpec { + QString key; // xcl.toml key, or the launcher's per-game key when launcherSide + QString label; + QStringList labels; // [0] is "Default" + QVariantList values; // [0] unused + QVariant defaultValue; // what applies without an override + bool launcherSide = false; + bool backed = true; +}; + +bool sameValue(const QVariant& a, const QVariant& b) +{ + if (a.typeId() == QMetaType::QString || b.typeId() == QMetaType::QString) + return a.toString().compare(b.toString(), Qt::CaseInsensitive) == 0; + if (a.typeId() == QMetaType::Bool || b.typeId() == QMetaType::Bool) + return a.toBool() == b.toBool(); + return std::abs(a.toDouble() - b.toDouble()) < 1e-6; +} + +} + +GameDetailsPage::GameDetailsPage(Services& services, QWidget* parent) + : QWidget(parent) + , m_s(services) + , m_hero(new DetailsHero) + , m_primary(new Button(QStringLiteral("Play"), Button::Variant::Primary, Button::Size::Large, QStringLiteral("play"))) + , m_secondary(new Button(QStringLiteral("Warm up again"), Button::Variant::Secondary, Button::Size::Large, QStringLiteral("bolt"))) + , m_state(new Badge) + , m_runsWith(new RunsWithSelector(services)) + , m_openFolder(new Button(QStringLiteral("Open folder"), Button::Variant::Ghost, Button::Size::Small, QStringLiteral("folder"))) + , m_more(new Button({}, Button::Variant::Ghost, Button::Size::Small, QStringLiteral("more"))) + , m_gameCard(new InfoCard(QStringLiteral("Game"))) + , m_cacheCard(new InfoCard(QStringLiteral("Shader cache"))) + , m_runCard(new InfoCard(QStringLiteral("Last run"))) + , m_overrides(new InfoCard(QStringLiteral("Per-game overrides"))) + , m_overridesNote(new Label({}, Label::Style::Caption, Theme::Role::Text3)) +{ + auto* v = new QVBoxLayout(this); + v->setContentsMargins(0, 0, 0, 0); + v->setSpacing(0); + v->addWidget(m_hero); + + auto* bar = new ActionBar; + bar->setFixedHeight(68); + auto* bh = new QHBoxLayout(bar); + bh->setContentsMargins(32, 0, 32, 1); + bh->setSpacing(8); + bh->addWidget(m_primary); + bh->addWidget(m_secondary); + bh->addSpacing(12); + bh->addWidget(m_state); + bh->addStretch(1); + bh->addWidget(m_runsWith); + bh->addSpacing(8); + bh->addWidget(m_openFolder); + connect(m_runsWith, &RunsWithSelector::manageRunners, this, &GameDetailsPage::manageRunners); + m_more->setToolTip(QStringLiteral("More")); + bh->addWidget(m_more); + v->addWidget(bar); + + auto* scroll = new QScrollArea; + scroll->setWidgetResizable(true); + scroll->setFrameShape(QFrame::NoFrame); + scroll->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + auto* inner = new QWidget; + inner->setObjectName(QStringLiteral("scrollContents")); + auto* cols = new QHBoxLayout(inner); + cols->setContentsMargins(32, 20, 32, 24); + cols->setSpacing(16); + auto* left = new QVBoxLayout; + left->setSpacing(16); + left->addWidget(m_gameCard); + left->addWidget(m_runCard); + left->addStretch(1); + auto* right = new QVBoxLayout; + right->setSpacing(16); + right->addWidget(m_cacheCard); + right->addWidget(m_overrides); + m_overridesNote->setWordWrap(true); + right->addWidget(m_overridesNote); + right->addStretch(1); + cols->addLayout(left, 1); + cols->addLayout(right, 1); + scroll->setWidget(inner); + v->addWidget(scroll, 1); + + m_hero->onBack = [this] { emit back(); }; + connect(m_hero->findArt(), &Button::clicked, this, [this] { m_s.covers.refresh(m_game); }); + connect(m_primary, &Button::clicked, this, [this] { + if (m_primary->property("warmup").toBool()) + emit warmupRequested(m_game); + else + requestPlay(); + }); + connect(m_secondary, &Button::clicked, this, [this] { + if (m_secondary->property("warmup").toBool()) + emit warmupRequested(m_game); + else + emit playRequested(m_game); + }); + connect(m_openFolder, &Button::clicked, this, [this] { QDesktopServices::openUrl(QUrl::fromLocalFile(m_game.folder)); }); + connect(m_more, &Button::clicked, this, [this] { + QMenu menu(this); + const QString toml = Paths::xclToml(m_game.titleId()); + QAction* openToml = menu.addAction(QStringLiteral("Open xcl.toml")); + openToml->setEnabled(QFileInfo::exists(toml)); + QAction* openLogs = menu.addAction(QStringLiteral("Open logs folder")); + openLogs->setEnabled(QFileInfo(LaunchErrors::logsFolder(m_game)).isDir()); + QAction* findArt = nullptr; + if (m_s.covers.canLookUp()) + findArt = menu.addAction(QStringLiteral("Find art again")); + QAction* chosen = menu.exec(m_more->mapToGlobal(QPoint(0, m_more->height() + 4))); + if (chosen == openToml) + QDesktopServices::openUrl(QUrl::fromLocalFile(toml)); + else if (chosen == openLogs) + QDesktopServices::openUrl(QUrl::fromLocalFile(LaunchErrors::logsFolder(m_game))); + else if (chosen && chosen == findArt) + m_s.covers.refresh(m_game); + }); + connect(&m_s.gate, &ProcessGate::changed, this, &GameDetailsPage::refresh); + connect(&m_s.emulator, &EmulatorController::stateChanged, this, &GameDetailsPage::refresh); + connect(&m_s.emulator, &EmulatorController::statsChanged, this, &GameDetailsPage::onStats); + connect(&m_s.emulator, &EmulatorController::exited, this, &GameDetailsPage::onExit); + connect(&m_s.covers, &CoverArtService::artChanged, this, [this](const QString& id) { + if (id == m_game.titleId()) + refresh(); + }); + connect(&m_s.settings, &AppSettings::changed, this, [this](const QString& key) { + if (!m_game.isValid()) + return; + if (key == QLatin1String(AppSettings::Key::RecentWarmups) || key == QLatin1String(AppSettings::Key::PlayStats) + || key == QLatin1String(AppSettings::Key::SteamGridDbKey)) + refresh(); + else if (key == QLatin1String(AppSettings::Key::DefaultDeviceType) || key == QLatin1String(AppSettings::Key::OverlayDefault)) + refreshOverrides(); + }); +} + +void GameDetailsPage::setGame(const Game& game) +{ + m_game = game; + m_runsWith->setGame(game); + refresh(); +} + +void GameDetailsPage::requestPlay() +{ + const Game g = m_game; + LaunchErrors::confirmPlay(window(), m_s, g, [this, g] { emit playRequested(g); }, [this, g] { emit warmupRequested(g); }); +} + +void GameDetailsPage::onStats() +{ + const EmulatorController::State st = m_s.emulator.state(); + if (st != EmulatorController::State::Running && st != EmulatorController::State::Paused && st != EmulatorController::State::Booting) + return; + const QString id = m_s.emulator.game().titleId(); + if (id != m_runId) { + m_runId = id; + m_fpsSum = 0; + m_fpsSamples = 0; + m_stalls = 0; + m_worstMs = 0; + m_heldPeak = -1; + m_freeMinMb = -1; + } + const EmulatorController::Stats s = m_s.emulator.stats(); + // statsChanged also fires for memory polls and the overlay: sum each protocol sample once + if (s.sample != 0 && s.sample != m_lastSample) { + m_lastSample = s.sample; + if (st == EmulatorController::State::Running && s.fps) { + m_fpsSum += *s.fps; + ++m_fpsSamples; + } + if (s.stalls) + m_stalls += *s.stalls; + } + if (s.worstMs) + m_worstMs = qMax(m_worstMs, *s.worstMs); + if (s.heldBytes > m_heldPeak) + m_heldPeak = s.heldBytes; + if (s.ramFreeMb && (m_freeMinMb < 0 || *s.ramFreeMb < m_freeMinMb)) + m_freeMinMb = *s.ramFreeMb; +} + +void GameDetailsPage::onExit(const EmulatorController::ExitInfo& info) +{ + using K = EmulatorController::ExitInfo::Kind; + const QString id = info.game.titleId(); + QString result; + switch (info.kind) { + case K::Stopped: result = info.killed ? QStringLiteral("Stopped by you (forced after 5 s)") : QStringLiteral("Stopped by you"); break; + case K::TitleExit: result = QStringLiteral("The game exited"); break; + case K::Crash: result = QStringLiteral("Crashed (exit code %1)").arg(Format::exitCode(info.exitCode)); break; + case K::DeviceRemoved: result = QStringLiteral("GPU device removed"); break; + case K::Error: result = QStringLiteral("Couldn't start"); break; + } + QVariantMap run{ + {QStringLiteral("result"), result}, + {QStringLiteral("at"), info.at.toUTC().toString(Qt::ISODate)}, + {QStringLiteral("seconds"), info.playedSeconds}, + }; + if (id == m_runId) { + if (m_fpsSamples > 0) + run.insert(QStringLiteral("fpsAverage"), m_fpsSum / m_fpsSamples); + if (m_fpsSamples > 0 || m_stalls > 0) + run.insert(QStringLiteral("stalls"), m_stalls); + if (m_heldPeak > 0) + run.insert(QStringLiteral("heldPeakBytes"), m_heldPeak); + if (m_freeMinMb >= 0) + run.insert(QStringLiteral("freeMinMb"), m_freeMinMb); + } + m_runId.clear(); + m_s.settings.setLastRun(id, run); +} + +void GameDetailsPage::refresh() +{ + if (!m_game.isValid()) + return; + const Game& g = m_game; + const QString id = g.titleId(); + const qint64 played = m_s.settings.playSeconds(id); + const QDateTime last = m_s.settings.lastPlayed(id); + QStringList meta; + if (!g.publisher.isEmpty()) + meta << g.publisher; + if (played > 0) + meta << QStringLiteral("%1 played").arg(Format::playTime(played)) << QStringLiteral("last played %1").arg(lowerFirst(Format::ago(last))); + else + meta << QStringLiteral("Not played"); + const QString grid = m_s.covers.artPath(id, CoverCache::Kind::Grid); + const QString hero = m_s.covers.artPath(id, CoverCache::Kind::Hero); + m_hero->set(g.title(), meta.join(QStringLiteral(" · ")), grid.isEmpty() ? QPixmap() : QPixmap(grid), hero.isEmpty() ? QPixmap() : QPixmap(hero), + m_s.covers.canLookUp()); + + // actions and the shader state + const QList<WarmupRun> recent = m_s.settings.recentWarmups(); + const ShaderCacheInfo cache = ShaderCacheInfo::readDefault(); + const TitleShaderState state = titleShaderState(id, recent, cache); + std::optional<WarmupRun> lastWarmup; + for (const WarmupRun& r : recent) { + if (r.titleId == id) { + lastWarmup = r; + break; + } + } + const bool playingThis = m_s.emulator.isActive() && m_s.emulator.game().titleId() == id; + const bool cold = LaunchErrors::shadersCold(m_s, g); + m_primary->setProperty("warmup", cold && !playingThis); + m_secondary->setProperty("warmup", !cold || playingThis); + if (playingThis) { + m_primary->setText(QStringLiteral("Return to game")); + m_primary->setIconName(QStringLiteral("play")); + } else if (cold) { + m_primary->setText(QStringLiteral("Warm up")); + m_primary->setIconName(QStringLiteral("bolt")); + m_secondary->setText(QStringLiteral("Play anyway")); + m_secondary->setIconName(QStringLiteral("play")); + } else { + m_primary->setText(QStringLiteral("Play")); + m_primary->setIconName(QStringLiteral("play")); + m_secondary->setText(state == TitleShaderState::Ready ? QStringLiteral("Warm up again") : QStringLiteral("Warm up")); + m_secondary->setIconName(QStringLiteral("bolt")); + } + m_secondary->setVisible(!playingThis); + const RunnerSpec& runner = m_s.emulator.runnerFor(g); + if (!runner.isBuiltIn()) { + m_secondary->setText(QStringLiteral("Pre-cache with %1").arg(runner.name)); + m_secondary->setIconName(QStringLiteral("bolt")); + m_secondary->setVisible(!playingThis && !runner.precache.isEmpty()); + } + QString stateText; + QString cacheState; + Theme::Tone tone = Theme::Tone::Neutral; + Theme::Role cacheRole = Theme::Role::Text2; + switch (state) { + case TitleShaderState::Ready: stateText = QStringLiteral("Shaders ready"); cacheState = QStringLiteral("Ready"); tone = Theme::Tone::Success; cacheRole = Theme::Role::Success; break; + case TitleShaderState::NeverWarmed: stateText = QStringLiteral("Never warmed up"); cacheState = QStringLiteral("Empty"); cacheRole = Theme::Role::Text3; break; + case TitleShaderState::LastRunIncomplete: stateText = QStringLiteral("Warm-up needed"); cacheState = QStringLiteral("Last warm-up stopped part way"); tone = Theme::Tone::Warning; cacheRole = Theme::Role::Warning; break; + case TitleShaderState::LastRunFailed: stateText = QStringLiteral("Warm-up failed"); cacheState = QStringLiteral("Last warm-up failed"); tone = Theme::Tone::Danger; cacheRole = Theme::Role::Danger; break; + case TitleShaderState::Unknown: stateText = QStringLiteral("Not warmed up here"); cacheState = QStringLiteral("Not warmed up from this launcher"); break; + } + if (!runner.isBuiltIn()) { + std::optional<WarmupRun> pre; + for (const WarmupRun& r : recent) { + if (r.titleId == id && r.runnerId == runner.id) { + pre = r; + break; + } + } + if (!m_s.runners.isRunnable(runner.id)) { + stateText = QStringLiteral("%1 not installed").arg(runner.name); + tone = Theme::Tone::Warning; + } else if (pre && pre->result == WarmupRun::Result::Finished && pre->total > 0) { + stateText = QStringLiteral("%1 cache ready").arg(runner.name); + tone = Theme::Tone::Success; + } else if (pre && pre->result == WarmupRun::Result::Failed) { + stateText = QStringLiteral("%1 pre-cache failed").arg(runner.name); + tone = Theme::Tone::Danger; + } else { + stateText = QStringLiteral("%1 keeps its own cache").arg(runner.name); + tone = Theme::Tone::Neutral; + } + } + // an older emulator build, or another emulator (or job) holding the PC: Play and Warm-up wait, saying why + using P = EmulatorController::LaunchCheck::Problem; + const EmulatorController::LaunchCheck check = playingThis ? EmulatorController::LaunchCheck{} : m_s.emulator.checkLaunch(g); + const bool held = check.problem == P::OtherEmulatorRunning || check.problem == P::EmulatorTooOld; + for (Button* b : {m_primary, m_secondary}) { + b->setEnabled(!held); + b->setToolTip(held ? check.reason : QString()); + } + if (held) { + stateText = check.problem == P::EmulatorTooOld ? QStringLiteral("XSEmu build too old") : QStringLiteral("Emulator busy"); + tone = check.problem == P::EmulatorTooOld ? Theme::Tone::Danger : Theme::Tone::Warning; + } + m_state->setText(stateText); + m_state->setToolTip(held ? check.reason : QString()); + m_state->setTone(tone); + + // GAME + m_gameCard->clear(); + m_gameCard->addText(QStringLiteral("Version"), g.version.isEmpty() ? QStringLiteral("Unknown") : g.version); + m_gameCard->addText(QStringLiteral("Publisher"), g.publisher.isEmpty() ? QStringLiteral("Unknown") : g.publisher); + m_gameCard->addText(QStringLiteral("Install size"), g.sizeBytes < 0 ? QStringLiteral("Not measured") : Format::bytes(g.sizeBytes)); + { + auto* box = new QWidget; + auto* h = new QHBoxLayout(box); + h->setContentsMargins(0, 0, 0, 0); + h->setSpacing(8); + const QString native = QDir::toNativeSeparators(g.folder); + auto* path = new Label(native, Label::Style::Mono, Theme::Role::Text); + path->setFont(Theme::mono(12)); + path->setToolTip(native); + path->setMinimumWidth(40); + path->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Preferred); + path->setText(QFontMetrics(path->font()).elidedText(native, Qt::ElideMiddle, 230)); + h->addWidget(path, 1); + auto* show = new Button(QStringLiteral("Show"), Button::Variant::Ghost, Button::Size::Tiny); + const QString folder = g.folder; + connect(show, &Button::clicked, this, [folder] { QDesktopServices::openUrl(QUrl::fromLocalFile(folder)); }); + h->addWidget(show); + m_gameCard->addRow(QStringLiteral("Folder"), box); + } + + // SHADER CACHE (machine-wide; per title only what this launcher's warm-ups recorded) + m_cacheCard->clear(); + m_cacheCard->setTrailing({new Label(QStringLiteral("Shared by all games"), Label::Style::Caption, Theme::Role::Text3)}); + m_cacheCard->addText(QStringLiteral("State"), cacheState, cacheRole); + if (lastWarmup && lastWarmup->total > 0) + m_cacheCard->addText(QStringLiteral("Pipelines"), QStringLiteral("%1 of %2 built · %3 failed") + .arg(Format::count(lastWarmup->done - lastWarmup->failed), Format::count(lastWarmup->total), Format::count(lastWarmup->failed))); + else + m_cacheCard->addText(QStringLiteral("Pipelines"), cache.pipelines >= 0 ? QStringLiteral("%1 recorded on this PC").arg(Format::count(cache.pipelines)) : QStringLiteral("0 cached")); + m_cacheCard->addText(QStringLiteral("Last warm-up"), lastWarmup ? QStringLiteral("%1 · %2").arg(when(lastWarmup->finishedAt), lastWarmup->tookS >= 60 ? minutes(qint64(lastWarmup->tookS)) : Format::shortDuration(lastWarmup->tookS)) + : QStringLiteral("Never")); + + // LAST RUN + m_runCard->clear(); + const QVariantMap run = m_s.settings.lastRun(id); + const QString log = Paths::xclLog(id); + if (QFileInfo::exists(log)) { + auto* open = new Button(QStringLiteral("Open log"), Button::Variant::Link, Button::Size::Tiny); + connect(open, &Button::clicked, this, [log] { QDesktopServices::openUrl(QUrl::fromLocalFile(log)); }); + m_runCard->setTrailing({open}); + } else { + m_runCard->setTrailing({}); + } + if (run.isEmpty()) { + m_runCard->addText(QStringLiteral("Result"), played > 0 ? QStringLiteral("Not recorded") : QStringLiteral("Not played yet"), Theme::Role::Text3); + } else { + m_runCard->addText(QStringLiteral("Result"), run.value(QStringLiteral("result")).toString()); + const QDateTime at = QDateTime::fromString(run.value(QStringLiteral("at")).toString(), Qt::ISODate); + const qint64 secs = run.value(QStringLiteral("seconds")).toLongLong(); + m_runCard->addText(QStringLiteral("When"), secs > 0 ? QStringLiteral("%1 · ran %2").arg(when(at), minutes(secs)) : when(at)); + if (run.contains(QStringLiteral("fpsAverage"))) { + const qint64 stalls = run.value(QStringLiteral("stalls")).toLongLong(); + m_runCard->addText(QStringLiteral("Frame rate"), QStringLiteral("%1 fps average · %2") + .arg(qRound(run.value(QStringLiteral("fpsAverage")).toDouble())) + .arg(stalls == 1 ? QStringLiteral("1 stall over 100 ms") : QStringLiteral("%1 stalls over 100 ms").arg(stalls))); + } + QStringList ram; + if (run.contains(QStringLiteral("heldPeakBytes"))) + ram << QStringLiteral("%1 held").arg(Format::gigabytes(run.value(QStringLiteral("heldPeakBytes")).toLongLong())); + if (run.contains(QStringLiteral("freeMinMb"))) + ram << QStringLiteral("%1 free at lowest").arg(Format::gigabytesFromMb(run.value(QStringLiteral("freeMinMb")).toLongLong())); + if (!ram.isEmpty()) + m_runCard->addText(QStringLiteral("Peak RAM"), ram.join(QStringLiteral(" · "))); + } + + refreshOverrides(); +} + +void GameDetailsPage::refreshOverrides() +{ + if (!m_game.isValid()) + return; + const QString id = m_game.titleId(); + const QString deviceDefault = m_s.settings.defaultDeviceType(); + const bool defaultIsS = deviceDefault != QLatin1String("anaconda"); + const QList<OverrideSpec> specs = { + {QStringLiteral("device_type"), QStringLiteral("Console"), + {defaultIsS ? QStringLiteral("Default (S)") : QStringLiteral("Default (X)"), QStringLiteral("Series S"), QStringLiteral("Series X")}, + {QVariant(), QStringLiteral("lockhart"), QStringLiteral("anaconda")}, deviceDefault}, + {QStringLiteral("startIn"), QStringLiteral("Start in"), {QStringLiteral("Default"), QStringLiteral("Window"), QStringLiteral("Fullscreen")}, + {QVariant(), QStringLiteral("window"), QStringLiteral("fullscreen")}, {}, true, false}, + {QStringLiteral("overlay"), QStringLiteral("Overlay"), {QStringLiteral("Default"), QStringLiteral("On"), QStringLiteral("Off")}, + {QVariant(), true, false}, m_s.settings.overlayDefault(), true}, + {QStringLiteral("lowLatency"), QStringLiteral("Low latency"), {QStringLiteral("Default"), QStringLiteral("On"), QStringLiteral("Off")}, + {QVariant(), true, false}, {}, true, false}, + {QStringLiteral("display_mode"), QStringLiteral("Display mode"), + {QStringLiteral("Default"), QStringLiteral("720p"), QStringLiteral("1080p"), QStringLiteral("1440p"), QStringLiteral("4K")}, + {QVariant(), QStringLiteral("1280x720"), QStringLiteral("1920x1080"), QStringLiteral("2560x1440"), QStringLiteral("3840x2160")}, QStringLiteral("auto")}, + {QStringLiteral("raytracing"), QStringLiteral("Raytracing"), + {QStringLiteral("Default"), QStringLiteral("Tier 1.1"), QStringLiteral("Tier 1.0"), QStringLiteral("Off")}, + {QVariant(), QStringLiteral("tier1_1"), QStringLiteral("tier1_0"), QStringLiteral("off")}, QStringLiteral("auto")}, + {QStringLiteral("keyboard_mouse"), QStringLiteral("Keyboard & mouse"), {QStringLiteral("Default"), QStringLiteral("On"), QStringLiteral("Off")}, + {QVariant(), true, false}, true}, + {QStringLiteral("mouse_sensitivity"), QStringLiteral("Mouse speed"), + {QStringLiteral("Default"), QStringLiteral("0.5×"), QStringLiteral("1.5×"), QStringLiteral("2×")}, + {QVariant(), 0.5, 1.5, 2.0}, 1.0}, + {QStringLiteral("log_level"), QStringLiteral("Log level"), + {QStringLiteral("Default"), QStringLiteral("Warn"), QStringLiteral("Debug"), QStringLiteral("Trace")}, + {QVariant(), QStringLiteral("warn"), QStringLiteral("debug"), QStringLiteral("trace")}, QStringLiteral("info")}, + }; + // every per-game choice lives in AppSettings::gameOverrides: LaunchConfig::prepareTitle writes the + // xcl.toml keys from there into the title's xcl.toml when the game starts + const QString tomlPath = Paths::xclToml(id); + const QVariantMap chosen = m_s.settings.gameOverrides(id); + + m_overrides->clear(); + int count = 0; + for (const OverrideSpec& spec : specs) { + QStringList labels = spec.labels; + int current = 0; + if (spec.backed) { + const QVariant value = chosen.value(spec.key); + if (value.isValid() && !sameValue(value, spec.defaultValue)) { + current = -1; + for (int i = 1; i < spec.values.size(); ++i) { + if (sameValue(value, spec.values[i])) + current = i; + } + if (current < 0) { + labels << (value.typeId() == QMetaType::Double ? QStringLiteral("%1×").arg(value.toDouble()) : value.toString()); + current = int(labels.size()) - 1; + } + ++count; + } + } + auto* seg = new SegmentedControl(labels); + seg->setCurrentIndex(current); + seg->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); + auto* holder = new QWidget; + auto* hh = new QHBoxLayout(holder); + hh->setContentsMargins(0, 0, 0, 0); + hh->addWidget(seg); + hh->addStretch(1); + Label* note = nullptr; + if (!spec.backed) { + seg->setEnabled(false); + note = new Label(QStringLiteral("Not in this XSEmu build yet"), Label::Style::Caption, Theme::Role::Text3); + } + QWidget* row = m_overrides->addRow(spec.label, holder, note); + row->setToolTip(spec.launcherSide ? QString() : QStringLiteral("%1 in xcl.toml").arg(spec.key)); + if (!spec.backed) + continue; + const QVariantList values = spec.values; + const QString key = spec.key; + connect(seg, &SegmentedControl::currentChanged, this, [this, id, key, values](int index) { + if (index >= values.size()) + return; + if (index == 0) + m_s.settings.clearGameOverride(id, key); + else + m_s.settings.setGameOverride(id, key, values[index]); ``` ### Per-game console choice no longer reaches runner launches and runner warm-up **Medium Severity** The commit moved every Game details choice into `AppSettings::gameOverrides` and removed the direct write to the title's `xcl.toml`. Only `LaunchConfig::prepareTitle` copies those overrides to `xcl.toml`, and `EmulatorController::start` calls it only for built-in XSEmu (`if (!spec.isBuiltIn()) return startRunner(...)` returns before `prepareTitle`). `EmulatorController::startRunner` (EmulatorController.cpp:255-256) and `WarmupController::startRunnerStep` (WarmupController.cpp:305) take the console from `xcl.toml` with fallback to `defaultDeviceType()`, then pass it into the runner tokens (`Runner.cpp:60` maps `anaconda` to `series-x`). Example: a game set to Series X under Game details, never played with built-in XSEmu, has no `xcl.toml`; a runner Play or runner warm-up therefore uses the launcher default console, and the UI still shows Series X. Before this commit the UI wrote `device_type` into `xcl.toml`, so runners honored it. After Use defaults, a runner keeps whatever stale value `xcl.toml` holds. The new note text at GameDetailsPage.cpp:781 ('written to xcl.toml when the game starts') is also false for runner games. Fix by resolving the effective per-game values (via `LaunchConfig::titleValues`) in the runner start and precache paths, or by calling `prepareTitle` before the runner branch. <!-- capy-badge:start --> <a href="https://capy.ai/pull/zortos293/XSEmu/12"><picture><source media="(prefers-color-scheme: dark)" srcset="https://capy.ai/badge/neutral-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://capy.ai/badge/neutral-light.svg"><img alt="Open in Capy" src="https://capy.ai/badge/neutral-light.svg"></picture></a> <!-- capy-badge:end -->
Author
Owner

@⁠capy-ai[bot] on GitHub · 2026-11-26 18:45 UTC · original · reviewed

Capy found no issues.

Open in Capy

**@⁠capy-ai[bot]** on GitHub · 2026-11-26 18:45 UTC · [original](https://github.com/zortos293/XSEmu/pull/12#pullrequestreview-6079132590) · **reviewed** Capy found no issues. <!-- capy-badge:start --> <a href="https://capy.ai/pull/zortos293/XSEmu/12"><picture><source media="(prefers-color-scheme: dark)" srcset="https://capy.ai/badge/neutral-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://capy.ai/badge/neutral-light.svg"><img alt="Open in Capy" src="https://capy.ai/badge/neutral-light.svg"></picture></a> <!-- capy-badge:end -->
Author
Owner

@⁠capy-ai[bot] on GitHub · 2026-11-26 19:42 UTC · original · reviewed

Capy found 1 potential issue (1 medium).

Open in Capy

**@⁠capy-ai[bot]** on GitHub · 2026-11-26 19:42 UTC · [original](https://github.com/zortos293/XSEmu/pull/12#pullrequestreview-6079678024) · **reviewed** Capy found 1 potential issue (1 medium). <!-- capy-badge:start --> <a href="https://capy.ai/pull/zortos293/XSEmu/12"><picture><source media="(prefers-color-scheme: dark)" srcset="https://capy.ai/badge/neutral-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://capy.ai/badge/neutral-light.svg"><img alt="Open in Capy" src="https://capy.ai/badge/neutral-light.svg"></picture></a> <!-- capy-badge:end -->
Author
Owner

@⁠capy-ai[bot] on GitHub · 2026-11-26 19:42 UTC · original
On launcher/src/core/ShaderCacheInfo.cpp line 29 (outdated):

@@ -0,0 +1,169 @@
+#include "ShaderCacheInfo.h"
+
+#include <QDir>
+#include <QDirIterator>
+#include <QFile>
+#include <QFileInfo>
+#include <QRegularExpression>
+#include <QSet>
+
+quint64 ShaderCacheInfo::fnv64(const char* data, qsizetype len)
+{
+    quint64 h = 0xcbf29ce484222325ULL;
+    for (qsizetype i = 0; i < len; ++i) {
+        h ^= static_cast<unsigned char>(data[i]);
+        h *= 0x100000001b3ULL;
+    }
+    return h;
+}
+
+bool ShaderCacheInfo::readManifest(const QString& path, Manifest& m, const std::atomic<bool>* cancel)
+{
+    QFile file(path);
+    if (!file.open(QIODevice::ReadOnly)) {
+        m = Manifest{};
+        return false;
+    }
+    const qint64 size = file.size();
+    const QByteArray head = file.read(64);
+    if (m.path != path || size < m.offset || !head.startsWith(m.head))

Incremental manifest parse keeps a stale offset after pipelines.bin is rewritten

Medium Severity

readManifest resumes from the byte offset saved by the previous scan. It resets only when the file is shorter than that offset or its first 64 bytes changed. The emulator's warm-up calls Store::rewrite (crates/xcl/src/hle/d3d12x/real.rs:5177-5179, pso_manifest.rs:337-349) whenever its load found broken or repeated entries, and that rewrite drops them from pipelines.bin. If a dropped entry sits before the saved offset, every later entry boundary shifts left by that entry's size. The saved offset then lands inside an entry. The warm-up's appends can carry the file past that offset before the warm-up-finished refresh runs, so the size check does not fire. The first 64 bytes only change if the dropped entry was the first one, so the head check does not fire either. Parsing from the stale offset reads a garbage length prefix. If the length exceeds the buffered data, the loop keeps reading and buf grows to the rest of the file on every scan, and the offset never advances. Otherwise garbage keys and entries are added to keys and entries. Either way pipelines and manifestEntries are wrong, and they stay wrong until pipelines.bin shrinks below the stale offset. They are shown in Shaders settings, Game details, Library and the in-game boot card ("N pipelines cached"). Fix: do not trust size plus a 64-byte head to prove the bytes before the saved offset are unchanged. Store a hash of the last parsed entry, and before resuming check that it still sits at offset minus its length prefix and length. Reset when it does not match. The new incrementalParseMatchesFullParse test covers a head change and a shrink, but not an entry dropped before the offset with the file regrown.

Open in Capy

**@⁠capy-ai[bot]** on GitHub · 2026-11-26 19:42 UTC · [original](https://github.com/zortos293/XSEmu/pull/12#discussion_r4712770231) On `launcher/src/core/ShaderCacheInfo.cpp` line 29 (outdated): ```diff @@ -0,0 +1,169 @@ +#include "ShaderCacheInfo.h" + +#include <QDir> +#include <QDirIterator> +#include <QFile> +#include <QFileInfo> +#include <QRegularExpression> +#include <QSet> + +quint64 ShaderCacheInfo::fnv64(const char* data, qsizetype len) +{ + quint64 h = 0xcbf29ce484222325ULL; + for (qsizetype i = 0; i < len; ++i) { + h ^= static_cast<unsigned char>(data[i]); + h *= 0x100000001b3ULL; + } + return h; +} + +bool ShaderCacheInfo::readManifest(const QString& path, Manifest& m, const std::atomic<bool>* cancel) +{ + QFile file(path); + if (!file.open(QIODevice::ReadOnly)) { + m = Manifest{}; + return false; + } + const qint64 size = file.size(); + const QByteArray head = file.read(64); + if (m.path != path || size < m.offset || !head.startsWith(m.head)) ``` ### Incremental manifest parse keeps a stale offset after pipelines.bin is rewritten **Medium Severity** readManifest resumes from the byte offset saved by the previous scan. It resets only when the file is shorter than that offset or its first 64 bytes changed. The emulator's warm-up calls Store::rewrite (crates/xcl/src/hle/d3d12x/real.rs:5177-5179, pso_manifest.rs:337-349) whenever its load found broken or repeated entries, and that rewrite drops them from pipelines.bin. If a dropped entry sits before the saved offset, every later entry boundary shifts left by that entry's size. The saved offset then lands inside an entry. The warm-up's appends can carry the file past that offset before the warm-up-finished refresh runs, so the size check does not fire. The first 64 bytes only change if the dropped entry was the first one, so the head check does not fire either. Parsing from the stale offset reads a garbage length prefix. If the length exceeds the buffered data, the loop keeps reading and `buf` grows to the rest of the file on every scan, and the offset never advances. Otherwise garbage keys and entries are added to `keys` and `entries`. Either way `pipelines` and `manifestEntries` are wrong, and they stay wrong until pipelines.bin shrinks below the stale offset. They are shown in Shaders settings, Game details, Library and the in-game boot card ("N pipelines cached"). Fix: do not trust size plus a 64-byte head to prove the bytes before the saved offset are unchanged. Store a hash of the last parsed entry, and before resuming check that it still sits at offset minus its length prefix and length. Reset when it does not match. The new incrementalParseMatchesFullParse test covers a head change and a shrink, but not an entry dropped before the offset with the file regrown. <!-- capy-badge:start --> <a href="https://capy.ai/pull/zortos293/XSEmu/12"><picture><source media="(prefers-color-scheme: dark)" srcset="https://capy.ai/badge/neutral-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://capy.ai/badge/neutral-light.svg"><img alt="Open in Capy" src="https://capy.ai/badge/neutral-light.svg"></picture></a> <!-- capy-badge:end -->
Author
Owner

@⁠capy-ai[bot] on GitHub · 2026-11-26 20:14 UTC · original · reviewed

Capy found 1 potential issue (1 medium).

View 1 other finding in Capy.

Open in Capy

**@⁠capy-ai[bot]** on GitHub · 2026-11-26 20:14 UTC · [original](https://github.com/zortos293/XSEmu/pull/12#pullrequestreview-6080023139) · **reviewed** Capy found 1 potential issue (1 medium). View 1 other finding in Capy. <!-- capy-badge:start --> <a href="https://capy.ai/pull/zortos293/XSEmu/12"><picture><source media="(prefers-color-scheme: dark)" srcset="https://capy.ai/badge/neutral-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://capy.ai/badge/neutral-light.svg"><img alt="Open in Capy" src="https://capy.ai/badge/neutral-light.svg"></picture></a> <!-- capy-badge:end -->
Author
Owner

@⁠capy-ai[bot] on GitHub · 2026-11-26 20:14 UTC · original
On launcher/src/core/RunnerManager.cpp line 415 (outdated):

@@ -0,0 +1,479 @@
+#include "RunnerManager.h"
+
+#include "AppSettings.h"
+#include "Paths.h"
+#include "RunnerInstall.h"
+
+#include <QCoreApplication>
+#include <QDir>
+#include <QDirIterator>
+#include <QFile>
+#include <QFileInfo>
+#include <QJsonDocument>
+#include <QJsonObject>
+#include <QThreadPool>
+
+namespace {
+
+QJsonObject readJson(const QString& path)
+{
+    QFile f(path);
+    if (!f.open(QIODevice::ReadOnly))
+        return {};
+    return QJsonDocument::fromJson(f.readAll()).object();
+}
+
+QJsonObject installRecord(const QString& id) { return readJson(QDir(Paths::runnerDir(id)).filePath(QStringLiteral("runner.json"))); }
+
+QString clean(const QString& path) { return path.isEmpty() ? QString() : QDir::cleanPath(QDir::fromNativeSeparators(path)); }
+
+bool inside(const QString& path, const QString& dir) { return path == dir || path.startsWith(dir + QLatin1Char('/')); }
+
+struct Tree {
+    qint64 files = 0;
+    qint64 bytes = 0;
+};
+
+Tree measure(const QString& dir)
+{
+    Tree t;
+    QDirIterator it(dir, QDir::Files | QDir::Hidden | QDir::System | QDir::NoSymLinks, QDirIterator::Subdirectories);
+    while (it.hasNext()) {
+        it.next();
+        ++t.files;
+        t.bytes += it.fileInfo().size();
+    }
+    return t;
+}
+
+}
+
+RunnerManager::RunnerManager(QObject* parent)
+    : QObject(parent)
+{
+}
+
+RunnerManager::~RunnerManager()
+{
+    if (m_task)
+        m_task->cancel();
+}
+
+void RunnerManager::setSettings(AppSettings* settings)
+{
+    m_settings = settings;
+    applyLocations();
+    connect(settings, &AppSettings::changed, this, [this](const QString& key) {
+        if (key == QLatin1String(AppSettings::Key::RunnersFolder) || key == QLatin1String(AppSettings::Key::RunnerLocations))
+            applyLocations();
+    });
+}
+
+void RunnerManager::setInUseCheck(std::function<QString(const QString& id)> check) { m_inUse = std::move(check); }
+
+void RunnerManager::applyLocations()
+{
+    Paths::setRunnersFolder(m_settings->runnersFolder());
+    Paths::setRunnerLocations(m_settings->runnerLocations());
+    m_sizes.clear();
+    for (const RunnerSpec& r : Runners::curated()) {
+        if (r.isBuiltIn())
+            continue;
+        emit changed(r.id);
+        emit stateChanged(r.id);
+    }
+}
+
+void RunnerManager::setLocation(const QString& id, const QString& folder)
+{
+    const QString runners = Paths::runnersDir();
+    m_settings->setRunnerLocation(id, clean(folder) == runners ? QString() : clean(folder));
+}
+
+QString RunnerManager::location(const QString& id) const { return Paths::runnerLocation(id); }
+
+QString RunnerManager::busyReason(const QString& id) const
+{
+    const RunnerSpec* spec = Runners::find(id);
+    const QString name = spec ? spec->name : id;
+    if (m_move) {
+        const RunnerSpec* moving = Runners::find(m_move->id);
+        return QStringLiteral("%1 is being moved; wait for it to finish.").arg(moving ? moving->name : m_move->id);
+    }
+    if (m_task && m_taskId == id) {
+        const bool building = spec && spec->install == RunnerSpec::Install::BuildFromSource;
+        return QStringLiteral("%1 is %2; wait for it or cancel it first.").arg(name, building ? QStringLiteral("building") : QStringLiteral("installing"));
+    }
+    return m_inUse ? m_inUse(id) : QString();
+}
+
+bool RunnerManager::relocate(const QString& id, const QString& folder, Relocation how, QString* error)
+{
+    auto refuse = [error](const QString& why) {
+        if (error)
+            *error = why;
+        return false;
+    };
+    const RunnerSpec* spec = Runners::find(id);
+    if (!spec || spec->isBuiltIn())
+        return refuse(QStringLiteral("XSEmu comes with the launcher; it has no folder of its own to move."));
+    if (!m_settings)
+        return refuse(QStringLiteral("Runner locations need the launcher settings."));
+    if (const QString busy = busyReason(id); !busy.isEmpty())
+        return refuse(busy);
+    const QString target = clean(folder);
+    if (target.isEmpty() || !QDir::isAbsolutePath(target))
+        return refuse(QStringLiteral("Pick a folder for %1.").arg(spec->name));
+    const QString from = clean(Paths::runnerDir(id));
+    const QString to = clean(QDir(target).filePath(id));
+    if (to == from)
+        return refuse(QStringLiteral("%1 is already in %2.").arg(spec->name, QDir::toNativeSeparators(target)));
+    if (inside(to, from))
+        return refuse(QStringLiteral("%1 can't move into its own folder.").arg(spec->name));
+    if (QDir(to).exists() && !QDir(to).isEmpty(QDir::AllEntries | QDir::NoDotAndDotDot | QDir::Hidden | QDir::System))
+        return refuse(QStringLiteral("%1 already has a %2 folder; pick another folder or delete that one first.").arg(QDir::toNativeSeparators(target), id));
+
+    const QJsonObject rec = installRecord(id);
+    if (how == Relocation::Rebuild && !rec.isEmpty()) {
+        m_rebuild = Rebuild{id, m_settings->runnerLocations().value(id), from};
+        setLocation(id, target);
+        if (!install(id, error)) {
+            m_settings->setRunnerLocation(id, m_rebuild->previous);
+            m_rebuild.reset();
+            return false;
+        }
+        return true;
+    }
+    if (!QFileInfo::exists(from)) {
+        setLocation(id, target);
+        emit relocated(id, true, {});
+        return true;
+    }
+
+    const QString exeRel = rec.isEmpty() ? QString() : QDir(from).relativeFilePath(QDir(spec->installDir()).filePath(rec.value(QLatin1String("executable")).toString()));
+    m_move = Move{id, target, to, 0, -1, QDateTime::currentDateTime()};
+    emit changed(id);
+    emit stateChanged(id);
+    const QPointer<RunnerManager> self = this;
+    QThreadPool::globalInstance()->start([self, id, from, to, exeRel] {
+        const auto progress = [self, id](qint64 done, qint64 total) {
+            QMetaObject::invokeMethod(qApp, [self, id, done, total] {
+                if (!self || !self->m_move || self->m_move->id != id)
+                    return;
+                self->m_move->done = done;
+                self->m_move->total = total;
+                emit self->changed(id);
+            });
+        };
+        QString why;
+        QString note;
+        const bool ok = moveFolder(from, to, exeRel, &why, &note, progress);
+        QMetaObject::invokeMethod(qApp, [self, ok, why, note] {
+            if (self)
+                self->finishMove(ok, ok ? note : why);
+        });
+    });
+    return true;
+}
+
+void RunnerManager::finishMove(bool ok, const QString& message)
+{
+    const Move move = *m_move;
+    m_move.reset();
+    if (ok)
+        setLocation(move.id, move.folder);
+    m_sizes.remove(move.id);
+    emit changed(move.id);
+    emit stateChanged(move.id);
+    emit relocated(move.id, ok, message);
+}
+
+bool RunnerManager::moveFolder(const QString& from, const QString& to, const QString& exeRel, QString* error, QString* note,
+                               const std::function<void(qint64, qint64)>& progress, bool allowRename)
+{
+    auto failed = [error, to](const QString& why) {
+        QDir(to).removeRecursively();
+        *error = why;
+        return false;
+    };
+    QDir().mkpath(QFileInfo(to).absolutePath());
+    if (allowRename && QDir(to).exists() && QDir(to).isEmpty(QDir::AllEntries | QDir::NoDotAndDotDot | QDir::Hidden | QDir::System))
+        QDir().rmdir(to);
+    if (allowRename && QDir().rename(from, to)) {
+        if (!exeRel.isEmpty() && !QFileInfo::exists(QDir(to).filePath(exeRel))) {
+            QDir().rename(to, from);
+            *error = QStringLiteral("After the move %1 was missing, so the runner stayed where it was.").arg(QDir::toNativeSeparators(exeRel));
+            return false;
+        }
+        return true;
+    }
+
+    if (!QFileInfo(from).isDir()) {
+        *error = QStringLiteral("%1 is not there any more.").arg(QDir::toNativeSeparators(from));
+        return false;
+    }
+    // another drive: copy every file, check the copy, then delete the original
+    const Tree source = measure(from);
+    qint64 done = 0;
+    qint64 reported = 0;
+    if (progress)
+        progress(0, source.bytes);
+    QDirIterator it(from, QDir::AllEntries | QDir::NoDotAndDotDot | QDir::Hidden | QDir::System | QDir::NoSymLinks, QDirIterator::Subdirectories);
+    if (!QDir().mkpath(to))
+        return failed(QStringLiteral("Cannot create %1.").arg(QDir::toNativeSeparators(to)));
+    while (it.hasNext()) {
+        it.next();
+        const QFileInfo fi = it.fileInfo();
+        const QString dst = QDir(to).filePath(QDir(from).relativeFilePath(fi.absoluteFilePath()));
+        if (fi.isDir()) {
+            if (!QDir().mkpath(dst))
+                return failed(QStringLiteral("Cannot create %1.").arg(QDir::toNativeSeparators(dst)));
+            continue;
+        }
+        QDir().mkpath(QFileInfo(dst).absolutePath());
+        QFile src(fi.absoluteFilePath());
+        if (!src.copy(dst))
+            return failed(QStringLiteral("Cannot copy %1: %2. Nothing was moved.").arg(QDir::toNativeSeparators(fi.absoluteFilePath()), src.errorString()));
+        done += fi.size();
+        if (progress && (done - reported > 64LL * 1024 * 1024 || done == source.bytes)) {
+            reported = done;
+            progress(done, source.bytes);
+        }
+    }
+    const Tree copy = measure(to);
+    if (copy.files != source.files || copy.bytes != source.bytes)
+        return failed(QStringLiteral("The copy has %1 files and %2 bytes, the original %3 and %4, so nothing was moved.")
+                          .arg(copy.files).arg(copy.bytes).arg(source.files).arg(source.bytes));
+    if (!exeRel.isEmpty() && (!QFileInfo::exists(QDir(to).filePath(exeRel)) || QFileInfo(QDir(to).filePath(exeRel)).size() != QFileInfo(QDir(from).filePath(exeRel)).size()))
+        return failed(QStringLiteral("The copied %1 does not match the original, so nothing was moved.").arg(QDir::toNativeSeparators(exeRel)));
+    if (!QDir(from).removeRecursively() && note)
+        *note = QStringLiteral("Moved. Some files in %1 could not be deleted; delete that folder yourself.").arg(QDir::toNativeSeparators(from));
+    return true;
+}
+
+bool RunnerManager::setRunnersFolder(const QString& folder, QString* error)
+{
+    auto refuse = [error](const QString& why) {
+        if (error)
+            *error = why;
+        return false;
+    };
+    if (!m_settings)
+        return refuse(QStringLiteral("The Runners folder needs the launcher settings."));
+    if (Paths::runnersDirFromEnvironment())
+        return refuse(QStringLiteral("XSEMU_RUNNERS_DIR sets the Runners folder; unset it to choose one here."));
+    if (m_task) {
+        const RunnerSpec* busy = Runners::find(m_taskId);
+        return refuse(QStringLiteral("%1 is installing and uses the Runners folder; wait for it or cancel it first.").arg(busy ? busy->name : m_taskId));
+    }
+    if (m_move)
+        return refuse(busyReason(m_move->id));
+    const QString next = clean(folder).isEmpty() ? Paths::defaultRunnersDir() : clean(folder);
+    const QString current = Paths::runnersDir();
+    if (next != current) {
+        const QHash<QString, QString> locations = m_settings->runnerLocations();
+        for (const RunnerSpec& r : Runners::curated()) {
+            if (!r.isBuiltIn() && !locations.contains(r.id) && QFileInfo::exists(Paths::runnerDir(r.id)))
+                m_settings->setRunnerLocation(r.id, current);
+        }
+    }
+    m_settings->setRunnersFolder(next == Paths::defaultRunnersDir() ? QString() : next);
+    return true;
+}
+
+RunnerManager::Status RunnerManager::status(const QString& id) const
+{
+    if (m_simulated.contains(id))
+        return m_simulated.value(id);
+    Status s;
+    const RunnerSpec* spec = Runners::find(id);
+    if (!spec) {
+        s.state = State::Unavailable;
+        return s;
+    }
+    s.pinnedVersion = spec->pinnedVersion();
+    if (spec->isBuiltIn()) {
+        s.state = State::BuiltIn;
+        return s;
+    }
+    const QJsonObject rec = installRecord(id);
+    if (!rec.isEmpty()) {
+        s.installedVersion = rec.value(QLatin1String("version")).toString();
+        s.executable = QDir(spec->installDir()).filePath(rec.value(QLatin1String("executable")).toString());
+    }
+    if (m_taskId == id && m_task) {
+        s.state = State::Installing;
+        s.progress = m_task->progress();
+        return s;
+    }
+    if (m_move && m_move->id == id) {
+        s.state = State::Moving;
+        s.progress.step = QStringLiteral("Moving");
+        s.progress.bytes = true;
+        s.progress.done = m_move->done;
+        s.progress.total = m_move->total;
+        s.progress.detail = QDir::toNativeSeparators(m_move->to);
+        s.progress.startedAt = m_move->startedAt;
+        return s;
+    }
+    s.error = m_errors.value(id);
+    if (s.error.isEmpty())
+        s.error = readJson(RunnerInstall::failurePath(id)).value(QLatin1String("error")).toString();
+    if (!rec.isEmpty())
+        s.state = spec->isPinned() && s.installedVersion != s.pinnedVersion ? State::UpdateAvailable : State::Installed;
+    else if (!s.error.isEmpty())
+        s.state = State::Failed;
+    else
+        s.state = spec->isPinned() ? State::NotInstalled : State::Unavailable;
+    return s;
+}
+
+bool RunnerManager::isRunnable(const QString& id) const
+{
+    const Status s = status(id);
+    return s.state == State::BuiltIn || ((s.state == State::Installed || s.state == State::UpdateAvailable) && QFileInfo::exists(s.executable));
+}
+
+bool RunnerManager::isInstallable(const QString& id) const
+{
+    if (isRunnable(id))
+        return true;
+    const RunnerSpec* spec = Runners::find(id);
+    return spec && spec->isPinned();
+}
+
+QString RunnerManager::busyId() const
+{
+    return m_task ? m_taskId : QString();
+}
+
+bool RunnerManager::install(const QString& id, QString* error)
+{
+    auto refuse = [error](const QString& why) {
+        if (error)
+            *error = why;
+        return false;
+    };
+    const RunnerSpec* spec = Runners::find(id);
+    if (!spec || spec->isBuiltIn())
+        return refuse(QStringLiteral("XSEmu comes with the launcher and has nothing to install."));
+    if (!spec->isPinned())
+        return refuse(QStringLiteral("%1 is not available yet: no release is pinned for this launcher version.").arg(spec->name));
+    if (m_task) {
+        const RunnerSpec* busy = Runners::find(m_taskId);
+        return refuse(QStringLiteral("%1 is installing; wait for it or cancel it first.").arg(busy ? busy->name : m_taskId));
+    }
+    if (m_move)
+        return refuse(busyReason(id));
+    m_errors.remove(id);
+    m_taskId = id;
+    m_task = new RunnerInstall(*spec, this);
+    connect(m_task, &RunnerInstall::progressChanged, this, [this, id] { emit changed(id); });
+    connect(m_task, &RunnerInstall::finished, this, [this, id](bool ok, const QString& why) {
+        if (!ok)
+            m_errors.insert(id, why);
+        m_task->deleteLater();
+        m_task.clear();
+        m_taskId.clear();
+        m_sizes.remove(id);
+        if (m_rebuild && m_rebuild->id == id) {
+            const Rebuild rebuild = *m_rebuild;
+            m_rebuild.reset();
+            if (ok) {
+                QThreadPool::globalInstance()->start([dir = rebuild.oldDir] { QDir(dir).removeRecursively(); });
+            } else {
+                // the old copy still works: keep running it from where it was
+                m_settings->setRunnerLocation(id, rebuild.previous);
+                m_errors.insert(id, QStringLiteral("%1 It still runs from %2.").arg(why, QDir::toNativeSeparators(rebuild.oldDir)));
+            }
+            emit relocated(id, ok, ok ? QString() : m_errors.value(id));
+        }
+        emit changed(id);
+        emit stateChanged(id);
+        emit installFinished(id, ok, why);
+    });
+    m_task->start();
+    emit changed(id);
+    emit stateChanged(id);
+    return true;
+}
+
+void RunnerManager::cancel()
+{
+    if (m_task)
+        m_task->cancel();
+}
+
+bool RunnerManager::uninstall(const QString& id, QString* error)
+{
+    const RunnerSpec* spec = Runners::find(id);
+    if (!spec || spec->isBuiltIn()) {
+        if (error)
+            *error = QStringLiteral("XSEmu comes with the launcher and cannot be uninstalled here.");
+        return false;
+    }
+    if ((m_taskId == id && m_task) || (m_move && m_move->id == id)) {

Uninstall deletes a runner folder while a game or pre-cache is using it

Medium Severity

RunnerManager::uninstall (launcher/src/core/RunnerManager.cpp:407-428) refuses only while this runner is installing or moving (line 415). It never consults busyReason() or the in-use check that relocate() relies on; that check is wired in Services.cpp:13-21 and covers a running game on this runner (emulator.isActive() && runnerId()==id) and an active pre-cache. RunnersPage.cpp:264 connects the Uninstall button, shown for Installed and UpdateAvailable (RunnersPage.cpp:278), straight to uninstall(m_spec.id) and discards the returned error. So while a game runs on the runner, Uninstall proceeds to QDir(Paths::runnerDir(id)).removeRecursively() on the live runner. Where the running executable is locked (Windows), removal deletes the other files, including runner.json, so the launcher reports NotInstalled while the game keeps running, with no message to the user. Fix: refuse at line 415 when busyReason(id) is non-empty, matching relocate(), and have the Runners page either hide Uninstall while busyReason is set or show the returned error. Verified statically from the code path; the Windows file-locking outcome is reasoned from the Qt call, not run.

Open in Capy

**@⁠capy-ai[bot]** on GitHub · 2026-11-26 20:14 UTC · [original](https://github.com/zortos293/XSEmu/pull/12#discussion_r4713000034) On `launcher/src/core/RunnerManager.cpp` line 415 (outdated): ```diff @@ -0,0 +1,479 @@ +#include "RunnerManager.h" + +#include "AppSettings.h" +#include "Paths.h" +#include "RunnerInstall.h" + +#include <QCoreApplication> +#include <QDir> +#include <QDirIterator> +#include <QFile> +#include <QFileInfo> +#include <QJsonDocument> +#include <QJsonObject> +#include <QThreadPool> + +namespace { + +QJsonObject readJson(const QString& path) +{ + QFile f(path); + if (!f.open(QIODevice::ReadOnly)) + return {}; + return QJsonDocument::fromJson(f.readAll()).object(); +} + +QJsonObject installRecord(const QString& id) { return readJson(QDir(Paths::runnerDir(id)).filePath(QStringLiteral("runner.json"))); } + +QString clean(const QString& path) { return path.isEmpty() ? QString() : QDir::cleanPath(QDir::fromNativeSeparators(path)); } + +bool inside(const QString& path, const QString& dir) { return path == dir || path.startsWith(dir + QLatin1Char('/')); } + +struct Tree { + qint64 files = 0; + qint64 bytes = 0; +}; + +Tree measure(const QString& dir) +{ + Tree t; + QDirIterator it(dir, QDir::Files | QDir::Hidden | QDir::System | QDir::NoSymLinks, QDirIterator::Subdirectories); + while (it.hasNext()) { + it.next(); + ++t.files; + t.bytes += it.fileInfo().size(); + } + return t; +} + +} + +RunnerManager::RunnerManager(QObject* parent) + : QObject(parent) +{ +} + +RunnerManager::~RunnerManager() +{ + if (m_task) + m_task->cancel(); +} + +void RunnerManager::setSettings(AppSettings* settings) +{ + m_settings = settings; + applyLocations(); + connect(settings, &AppSettings::changed, this, [this](const QString& key) { + if (key == QLatin1String(AppSettings::Key::RunnersFolder) || key == QLatin1String(AppSettings::Key::RunnerLocations)) + applyLocations(); + }); +} + +void RunnerManager::setInUseCheck(std::function<QString(const QString& id)> check) { m_inUse = std::move(check); } + +void RunnerManager::applyLocations() +{ + Paths::setRunnersFolder(m_settings->runnersFolder()); + Paths::setRunnerLocations(m_settings->runnerLocations()); + m_sizes.clear(); + for (const RunnerSpec& r : Runners::curated()) { + if (r.isBuiltIn()) + continue; + emit changed(r.id); + emit stateChanged(r.id); + } +} + +void RunnerManager::setLocation(const QString& id, const QString& folder) +{ + const QString runners = Paths::runnersDir(); + m_settings->setRunnerLocation(id, clean(folder) == runners ? QString() : clean(folder)); +} + +QString RunnerManager::location(const QString& id) const { return Paths::runnerLocation(id); } + +QString RunnerManager::busyReason(const QString& id) const +{ + const RunnerSpec* spec = Runners::find(id); + const QString name = spec ? spec->name : id; + if (m_move) { + const RunnerSpec* moving = Runners::find(m_move->id); + return QStringLiteral("%1 is being moved; wait for it to finish.").arg(moving ? moving->name : m_move->id); + } + if (m_task && m_taskId == id) { + const bool building = spec && spec->install == RunnerSpec::Install::BuildFromSource; + return QStringLiteral("%1 is %2; wait for it or cancel it first.").arg(name, building ? QStringLiteral("building") : QStringLiteral("installing")); + } + return m_inUse ? m_inUse(id) : QString(); +} + +bool RunnerManager::relocate(const QString& id, const QString& folder, Relocation how, QString* error) +{ + auto refuse = [error](const QString& why) { + if (error) + *error = why; + return false; + }; + const RunnerSpec* spec = Runners::find(id); + if (!spec || spec->isBuiltIn()) + return refuse(QStringLiteral("XSEmu comes with the launcher; it has no folder of its own to move.")); + if (!m_settings) + return refuse(QStringLiteral("Runner locations need the launcher settings.")); + if (const QString busy = busyReason(id); !busy.isEmpty()) + return refuse(busy); + const QString target = clean(folder); + if (target.isEmpty() || !QDir::isAbsolutePath(target)) + return refuse(QStringLiteral("Pick a folder for %1.").arg(spec->name)); + const QString from = clean(Paths::runnerDir(id)); + const QString to = clean(QDir(target).filePath(id)); + if (to == from) + return refuse(QStringLiteral("%1 is already in %2.").arg(spec->name, QDir::toNativeSeparators(target))); + if (inside(to, from)) + return refuse(QStringLiteral("%1 can't move into its own folder.").arg(spec->name)); + if (QDir(to).exists() && !QDir(to).isEmpty(QDir::AllEntries | QDir::NoDotAndDotDot | QDir::Hidden | QDir::System)) + return refuse(QStringLiteral("%1 already has a %2 folder; pick another folder or delete that one first.").arg(QDir::toNativeSeparators(target), id)); + + const QJsonObject rec = installRecord(id); + if (how == Relocation::Rebuild && !rec.isEmpty()) { + m_rebuild = Rebuild{id, m_settings->runnerLocations().value(id), from}; + setLocation(id, target); + if (!install(id, error)) { + m_settings->setRunnerLocation(id, m_rebuild->previous); + m_rebuild.reset(); + return false; + } + return true; + } + if (!QFileInfo::exists(from)) { + setLocation(id, target); + emit relocated(id, true, {}); + return true; + } + + const QString exeRel = rec.isEmpty() ? QString() : QDir(from).relativeFilePath(QDir(spec->installDir()).filePath(rec.value(QLatin1String("executable")).toString())); + m_move = Move{id, target, to, 0, -1, QDateTime::currentDateTime()}; + emit changed(id); + emit stateChanged(id); + const QPointer<RunnerManager> self = this; + QThreadPool::globalInstance()->start([self, id, from, to, exeRel] { + const auto progress = [self, id](qint64 done, qint64 total) { + QMetaObject::invokeMethod(qApp, [self, id, done, total] { + if (!self || !self->m_move || self->m_move->id != id) + return; + self->m_move->done = done; + self->m_move->total = total; + emit self->changed(id); + }); + }; + QString why; + QString note; + const bool ok = moveFolder(from, to, exeRel, &why, &note, progress); + QMetaObject::invokeMethod(qApp, [self, ok, why, note] { + if (self) + self->finishMove(ok, ok ? note : why); + }); + }); + return true; +} + +void RunnerManager::finishMove(bool ok, const QString& message) +{ + const Move move = *m_move; + m_move.reset(); + if (ok) + setLocation(move.id, move.folder); + m_sizes.remove(move.id); + emit changed(move.id); + emit stateChanged(move.id); + emit relocated(move.id, ok, message); +} + +bool RunnerManager::moveFolder(const QString& from, const QString& to, const QString& exeRel, QString* error, QString* note, + const std::function<void(qint64, qint64)>& progress, bool allowRename) +{ + auto failed = [error, to](const QString& why) { + QDir(to).removeRecursively(); + *error = why; + return false; + }; + QDir().mkpath(QFileInfo(to).absolutePath()); + if (allowRename && QDir(to).exists() && QDir(to).isEmpty(QDir::AllEntries | QDir::NoDotAndDotDot | QDir::Hidden | QDir::System)) + QDir().rmdir(to); + if (allowRename && QDir().rename(from, to)) { + if (!exeRel.isEmpty() && !QFileInfo::exists(QDir(to).filePath(exeRel))) { + QDir().rename(to, from); + *error = QStringLiteral("After the move %1 was missing, so the runner stayed where it was.").arg(QDir::toNativeSeparators(exeRel)); + return false; + } + return true; + } + + if (!QFileInfo(from).isDir()) { + *error = QStringLiteral("%1 is not there any more.").arg(QDir::toNativeSeparators(from)); + return false; + } + // another drive: copy every file, check the copy, then delete the original + const Tree source = measure(from); + qint64 done = 0; + qint64 reported = 0; + if (progress) + progress(0, source.bytes); + QDirIterator it(from, QDir::AllEntries | QDir::NoDotAndDotDot | QDir::Hidden | QDir::System | QDir::NoSymLinks, QDirIterator::Subdirectories); + if (!QDir().mkpath(to)) + return failed(QStringLiteral("Cannot create %1.").arg(QDir::toNativeSeparators(to))); + while (it.hasNext()) { + it.next(); + const QFileInfo fi = it.fileInfo(); + const QString dst = QDir(to).filePath(QDir(from).relativeFilePath(fi.absoluteFilePath())); + if (fi.isDir()) { + if (!QDir().mkpath(dst)) + return failed(QStringLiteral("Cannot create %1.").arg(QDir::toNativeSeparators(dst))); + continue; + } + QDir().mkpath(QFileInfo(dst).absolutePath()); + QFile src(fi.absoluteFilePath()); + if (!src.copy(dst)) + return failed(QStringLiteral("Cannot copy %1: %2. Nothing was moved.").arg(QDir::toNativeSeparators(fi.absoluteFilePath()), src.errorString())); + done += fi.size(); + if (progress && (done - reported > 64LL * 1024 * 1024 || done == source.bytes)) { + reported = done; + progress(done, source.bytes); + } + } + const Tree copy = measure(to); + if (copy.files != source.files || copy.bytes != source.bytes) + return failed(QStringLiteral("The copy has %1 files and %2 bytes, the original %3 and %4, so nothing was moved.") + .arg(copy.files).arg(copy.bytes).arg(source.files).arg(source.bytes)); + if (!exeRel.isEmpty() && (!QFileInfo::exists(QDir(to).filePath(exeRel)) || QFileInfo(QDir(to).filePath(exeRel)).size() != QFileInfo(QDir(from).filePath(exeRel)).size())) + return failed(QStringLiteral("The copied %1 does not match the original, so nothing was moved.").arg(QDir::toNativeSeparators(exeRel))); + if (!QDir(from).removeRecursively() && note) + *note = QStringLiteral("Moved. Some files in %1 could not be deleted; delete that folder yourself.").arg(QDir::toNativeSeparators(from)); + return true; +} + +bool RunnerManager::setRunnersFolder(const QString& folder, QString* error) +{ + auto refuse = [error](const QString& why) { + if (error) + *error = why; + return false; + }; + if (!m_settings) + return refuse(QStringLiteral("The Runners folder needs the launcher settings.")); + if (Paths::runnersDirFromEnvironment()) + return refuse(QStringLiteral("XSEMU_RUNNERS_DIR sets the Runners folder; unset it to choose one here.")); + if (m_task) { + const RunnerSpec* busy = Runners::find(m_taskId); + return refuse(QStringLiteral("%1 is installing and uses the Runners folder; wait for it or cancel it first.").arg(busy ? busy->name : m_taskId)); + } + if (m_move) + return refuse(busyReason(m_move->id)); + const QString next = clean(folder).isEmpty() ? Paths::defaultRunnersDir() : clean(folder); + const QString current = Paths::runnersDir(); + if (next != current) { + const QHash<QString, QString> locations = m_settings->runnerLocations(); + for (const RunnerSpec& r : Runners::curated()) { + if (!r.isBuiltIn() && !locations.contains(r.id) && QFileInfo::exists(Paths::runnerDir(r.id))) + m_settings->setRunnerLocation(r.id, current); + } + } + m_settings->setRunnersFolder(next == Paths::defaultRunnersDir() ? QString() : next); + return true; +} + +RunnerManager::Status RunnerManager::status(const QString& id) const +{ + if (m_simulated.contains(id)) + return m_simulated.value(id); + Status s; + const RunnerSpec* spec = Runners::find(id); + if (!spec) { + s.state = State::Unavailable; + return s; + } + s.pinnedVersion = spec->pinnedVersion(); + if (spec->isBuiltIn()) { + s.state = State::BuiltIn; + return s; + } + const QJsonObject rec = installRecord(id); + if (!rec.isEmpty()) { + s.installedVersion = rec.value(QLatin1String("version")).toString(); + s.executable = QDir(spec->installDir()).filePath(rec.value(QLatin1String("executable")).toString()); + } + if (m_taskId == id && m_task) { + s.state = State::Installing; + s.progress = m_task->progress(); + return s; + } + if (m_move && m_move->id == id) { + s.state = State::Moving; + s.progress.step = QStringLiteral("Moving"); + s.progress.bytes = true; + s.progress.done = m_move->done; + s.progress.total = m_move->total; + s.progress.detail = QDir::toNativeSeparators(m_move->to); + s.progress.startedAt = m_move->startedAt; + return s; + } + s.error = m_errors.value(id); + if (s.error.isEmpty()) + s.error = readJson(RunnerInstall::failurePath(id)).value(QLatin1String("error")).toString(); + if (!rec.isEmpty()) + s.state = spec->isPinned() && s.installedVersion != s.pinnedVersion ? State::UpdateAvailable : State::Installed; + else if (!s.error.isEmpty()) + s.state = State::Failed; + else + s.state = spec->isPinned() ? State::NotInstalled : State::Unavailable; + return s; +} + +bool RunnerManager::isRunnable(const QString& id) const +{ + const Status s = status(id); + return s.state == State::BuiltIn || ((s.state == State::Installed || s.state == State::UpdateAvailable) && QFileInfo::exists(s.executable)); +} + +bool RunnerManager::isInstallable(const QString& id) const +{ + if (isRunnable(id)) + return true; + const RunnerSpec* spec = Runners::find(id); + return spec && spec->isPinned(); +} + +QString RunnerManager::busyId() const +{ + return m_task ? m_taskId : QString(); +} + +bool RunnerManager::install(const QString& id, QString* error) +{ + auto refuse = [error](const QString& why) { + if (error) + *error = why; + return false; + }; + const RunnerSpec* spec = Runners::find(id); + if (!spec || spec->isBuiltIn()) + return refuse(QStringLiteral("XSEmu comes with the launcher and has nothing to install.")); + if (!spec->isPinned()) + return refuse(QStringLiteral("%1 is not available yet: no release is pinned for this launcher version.").arg(spec->name)); + if (m_task) { + const RunnerSpec* busy = Runners::find(m_taskId); + return refuse(QStringLiteral("%1 is installing; wait for it or cancel it first.").arg(busy ? busy->name : m_taskId)); + } + if (m_move) + return refuse(busyReason(id)); + m_errors.remove(id); + m_taskId = id; + m_task = new RunnerInstall(*spec, this); + connect(m_task, &RunnerInstall::progressChanged, this, [this, id] { emit changed(id); }); + connect(m_task, &RunnerInstall::finished, this, [this, id](bool ok, const QString& why) { + if (!ok) + m_errors.insert(id, why); + m_task->deleteLater(); + m_task.clear(); + m_taskId.clear(); + m_sizes.remove(id); + if (m_rebuild && m_rebuild->id == id) { + const Rebuild rebuild = *m_rebuild; + m_rebuild.reset(); + if (ok) { + QThreadPool::globalInstance()->start([dir = rebuild.oldDir] { QDir(dir).removeRecursively(); }); + } else { + // the old copy still works: keep running it from where it was + m_settings->setRunnerLocation(id, rebuild.previous); + m_errors.insert(id, QStringLiteral("%1 It still runs from %2.").arg(why, QDir::toNativeSeparators(rebuild.oldDir))); + } + emit relocated(id, ok, ok ? QString() : m_errors.value(id)); + } + emit changed(id); + emit stateChanged(id); + emit installFinished(id, ok, why); + }); + m_task->start(); + emit changed(id); + emit stateChanged(id); + return true; +} + +void RunnerManager::cancel() +{ + if (m_task) + m_task->cancel(); +} + +bool RunnerManager::uninstall(const QString& id, QString* error) +{ + const RunnerSpec* spec = Runners::find(id); + if (!spec || spec->isBuiltIn()) { + if (error) + *error = QStringLiteral("XSEmu comes with the launcher and cannot be uninstalled here."); + return false; + } + if ((m_taskId == id && m_task) || (m_move && m_move->id == id)) { ``` ### Uninstall deletes a runner folder while a game or pre-cache is using it **Medium Severity** RunnerManager::uninstall (launcher/src/core/RunnerManager.cpp:407-428) refuses only while this runner is installing or moving (line 415). It never consults busyReason() or the in-use check that relocate() relies on; that check is wired in Services.cpp:13-21 and covers a running game on this runner (emulator.isActive() && runnerId()==id) and an active pre-cache. RunnersPage.cpp:264 connects the Uninstall button, shown for Installed and UpdateAvailable (RunnersPage.cpp:278), straight to uninstall(m_spec.id) and discards the returned error. So while a game runs on the runner, Uninstall proceeds to QDir(Paths::runnerDir(id)).removeRecursively() on the live runner. Where the running executable is locked (Windows), removal deletes the other files, including runner.json, so the launcher reports NotInstalled while the game keeps running, with no message to the user. Fix: refuse at line 415 when busyReason(id) is non-empty, matching relocate(), and have the Runners page either hide Uninstall while busyReason is set or show the returned error. Verified statically from the code path; the Windows file-locking outcome is reasoned from the Qt call, not run. <!-- capy-badge:start --> <a href="https://capy.ai/pull/zortos293/XSEmu/12"><picture><source media="(prefers-color-scheme: dark)" srcset="https://capy.ai/badge/neutral-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://capy.ai/badge/neutral-light.svg"><img alt="Open in Capy" src="https://capy.ai/badge/neutral-light.svg"></picture></a> <!-- capy-badge:end -->
Author
Owner

@⁠capy-ai[bot] on GitHub · 2026-11-26 20:26 UTC · original · reviewed

Capy found no issues.

View 4 other findings in Capy.

Open in Capy

**@⁠capy-ai[bot]** on GitHub · 2026-11-26 20:26 UTC · [original](https://github.com/zortos293/XSEmu/pull/12#pullrequestreview-6080140619) · **reviewed** Capy found no issues. View 4 other findings in Capy. <!-- capy-badge:start --> <a href="https://capy.ai/pull/zortos293/XSEmu/12"><picture><source media="(prefers-color-scheme: dark)" srcset="https://capy.ai/badge/neutral-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://capy.ai/badge/neutral-light.svg"><img alt="Open in Capy" src="https://capy.ai/badge/neutral-light.svg"></picture></a> <!-- capy-badge:end -->
Author
Owner

@⁠capy-ai[bot] on GitHub · 2026-11-26 21:04 UTC · original · reviewed

Capy found no issues.

View 4 other findings in Capy.

Open in Capy

**@⁠capy-ai[bot]** on GitHub · 2026-11-26 21:04 UTC · [original](https://github.com/zortos293/XSEmu/pull/12#pullrequestreview-6080466633) · **reviewed** Capy found no issues. View 4 other findings in Capy. <!-- capy-badge:start --> <a href="https://capy.ai/pull/zortos293/XSEmu/12"><picture><source media="(prefers-color-scheme: dark)" srcset="https://capy.ai/badge/neutral-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://capy.ai/badge/neutral-light.svg"><img alt="Open in Capy" src="https://capy.ai/badge/neutral-light.svg"></picture></a> <!-- capy-badge:end -->
Author
Owner

@⁠capy-ai[bot] on GitHub · 2026-11-26 22:30 UTC · original · reviewed

Capy found no issues.

View 3 other findings in Capy.

Open in Capy

**@⁠capy-ai[bot]** on GitHub · 2026-11-26 22:30 UTC · [original](https://github.com/zortos293/XSEmu/pull/12#pullrequestreview-6081137723) · **reviewed** Capy found no issues. View 3 other findings in Capy. <!-- capy-badge:start --> <a href="https://capy.ai/pull/zortos293/XSEmu/12"><picture><source media="(prefers-color-scheme: dark)" srcset="https://capy.ai/badge/neutral-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://capy.ai/badge/neutral-light.svg"><img alt="Open in Capy" src="https://capy.ai/badge/neutral-light.svg"></picture></a> <!-- capy-badge:end -->
Author
Owner

@⁠capy-ai[bot] on GitHub · 2026-11-26 22:34 UTC · original · reviewed

Capy found no issues.

View 1 other finding in Capy.

Open in Capy

**@⁠capy-ai[bot]** on GitHub · 2026-11-26 22:34 UTC · [original](https://github.com/zortos293/XSEmu/pull/12#pullrequestreview-6081163990) · **reviewed** Capy found no issues. View 1 other finding in Capy. <!-- capy-badge:start --> <a href="https://capy.ai/pull/zortos293/XSEmu/12"><picture><source media="(prefers-color-scheme: dark)" srcset="https://capy.ai/badge/neutral-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://capy.ai/badge/neutral-light.svg"><img alt="Open in Capy" src="https://capy.ai/badge/neutral-light.svg"></picture></a> <!-- capy-badge:end -->
This discussion has been locked. Commenting is limited to contributors.
No description provided.