Skip to content

Linux: the launcher as a native program, with an AppImage build - #221

Open
j0nsh1n wants to merge 59 commits into
phantoslayer21:mainfrom
j0nsh1n:feat/linux-launcher
Open

j0nsh1n wants to merge 59 commits into
phantoslayer21:mainfrom
j0nsh1n:feat/linux-launcher

Conversation

@j0nsh1n

@j0nsh1n j0nsh1n commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

What this changes and why

Draft, for your read on the approach before more goes in. #105 runs the Windows launcher under Wine; this builds the same launcher as a native Linux program from the same sources, so a Linux player gets a normal window instead of Wine's. clean/installer/build-appimage.sh turns it into one AppImage, and the script is meant to keep working when the launcher changes (the app's source list is shared with the Windows build).

How it is put together (the Windows build is unchanged; everything Linux-only is in its own files or behind #ifndef _WIN32):

  • src/platform/posix/: stand-in Windows headers and a POSIX implementation of the Win32 calls the launcher core and window use (files and handles with Windows sharing rules, Z:\ paths, processes, a file-backed registry under $XDG_DATA_HOME/WrongGPU/registry.ini).
  • The window: SDL3 emulating the Win32 messages, timers and EDIT controls the UI code uses; drawing: a Cairo/Pango backend of the Gfx interface, with bundled look-alike fonts (Selawik, Fluent System Icons, Noto Sans Math for symbols).
  • The payload is embedded with .incbin (resources.S); Steam's JPEG art through libjpeg-turbo; after an OptiScaler install the game page shows the Steam launch option Proton needs (WINEDLLOVERRIDES="dxgi=n,b" %command%), with Copy.
  • tools/ci/check_portable.py catches the two Windows-only habits a Windows build lets through; .github/workflows/linux-appimage.yml builds the AppImage with the test payload, only when started by hand from the Actions tab (Linux AppImage, Run workflow); no pull request or push starts it.
  • README-linux.md has the build, the AppImage and the known limits (no restorer, no downloads, no screen reader yet; with a released Proton the upscaler does not start yet, so for now the native launcher covers install and settings only).

Size of the Win32 layer, measured on this branch (names taken from the layer's own declarations, then counted as calls in the sources with comments and strings stripped):

Distinct Win32 functions Notes
src/wg_core 114 (about 605 call sites) files and handles 35, processes / modules / environment 30, paths 8, registry 8, time 6, strings 4, other 23 (11 WinHTTP, 5 resources, 4 COM, 3 memory, GetLastError)
src/app (window code) 150, of which 106 are not in the core
declared by the layer 232 12 are called by no shipped code: 7 by tests only, 5 inside the layer

Lines (wc -l): stand-in headers 1014, internal headers 158, implementation 2497, window layer 1923, tests 800: about 6,400 in total. The 15 most-used core calls: GetLastError 85, CloseHandle 46, GetFileAttributesW 26, MoveFileExW 26, DeleteFileW 25, RemoveDirectoryW 21, CreateFileW 18, GetProcAddress 14, ReadFile 13, RegCloseKey 13, FindClose 10, RegOpenKeyExW 10, FindNextFileW 9, GetTickCount64 9, FindFirstFileW 8. So the registry and strings are a handful; files and processes are not.

The launcher suite runs natively too (ctest launcher-native, tests/run_launcher_tests.py --native-linux); its Windows-only sections are skipped with their reasons, and the test_rr check of #219 while it fails on main.

Added since the 0.6.5 update: the parts that needed Proton

  • GPU check: the card is read from /sys/class/drm (PCI ids, driver), named from a built-in list of the RDNA 4 ids, and only an RDNA 4 card counts as supported. It names the card the system has, not the one a game picks.

  • Ray Reconstruction: under Proton the game prepares its kernels at its first start, so the launcher runs no helper and Play never waits on it; the game page says so.

  • Engine.ini (Borderlands 4, Hogwarts Legacy): written into the game's Proton prefix (steamapps/compatdata/<appid>/pfx, every Steam library); nothing is written until Steam has made that folder. A non-Steam game asks once for its Wine prefix's Windows user folder (WrongGPU windows-folder), remembered in the data folder. The "Myself" steps use Linux words.

  • First run and the launch line: Linux wording, no "Install for this user" (an AppImage has no installer entry), and numbered steps for Steam's launch option with a Copy button.

  • Uninstall from the AppImage (Settings > Uninstall WrongGPU, or uninstall-appimage --confirm): after one confirmation that names both, it deletes the running AppImage file and WrongGPU's data folder, nothing else. It refuses unless the system shows that $APPIMAGE is the file being run (the FUSE mount at $APPDIR is served by a process whose executable is that file), re-checks the file just before deleting it, and refuses while a game still has WrongGPU.

  • Downloads are off on Linux, and Settings says so (OptiScaler: choose your own download; no release-check switch).

  • Known limits of the Linux additions (found in review, left for now): the "uninstall from your games first" line in Settings can be up to a few seconds old (the Uninstall button looks again itself); a --data override is not carried into the copied Windows-folder command; a data folder whose configured spelling differs only in letter case from an existing one; an AppImage moved while the launcher is open (Copy uses the path it was started from; uninstall checks the file again); a made-up $APPIMAGE with $APPDIR around a plain build gets the "AppImage" label (never the uninstall).

What each new or substantially changed file is based on

Own design throughout: the POSIX layer follows the documented Win32 behaviour the core relies on; the window layer follows documented Win32 message semantics; fonts are unmodified upstream releases under their own licences (REUSE.toml, THIRD-PARTY-NOTICES). No game or model data; tests use synthetic fixtures.

How it was tested

  • Fresh build on main at 0ef4b90 (merged in): ctest 22/22; launcher-native 366 passed, 0 failed, 5 skipped (4 Windows-only sections and the test_rr check of Launcher suite: two uninstall checks fail on main (RR settings after an in-game edit, RE9 mirror) #219).
  • On WrongGPU 0.6.5 with the additions above: ctest 24/24 (including two suites for the Linux wording: whole strings on the real Settings, dialog and Copy states, and a live click on Uninstall), with tests for each new failure path (another valid WrongGPU AppImage, a file swapped in before the delete, linked data folders, malformed libraryfolders.vdf, a prefix without steamuser, unreadable sysfs files); each, except the prefix without steamuser, was broken once to see it fail. The Windows build (MinGW under Wine here) gives the same results as before the additions. The AppImage builds in the pinned container and was uninstalled for real from a scratch home.
  • The UI was rendered offscreen at 1180x760 (scales 1 and 2) next to ui-render of the Windows launcher on a GitHub windows-2022 runner; the mean share of strongly differing pixels over 221 pages is 2.4%.
  • The AppImage starts and renders in a bare ubuntu:22.04 container with only libx11-6 added.
  • reuse lint, check_wording.py, check_source_size.py, check_line_endings.py pass.
  • Not run: the MSVC build (CI's job); the AppImage on distributions other than Ubuntu 22.04 and this Fedora-based host.

Checklist

  • I make the clean-room statement of CONTRIBUTING.md for this and all my contributions (required once, in my first pull request). (Made in Launcher: install for Proton games from under Wine #105.)
  • Every commit has a Signed-off-by: line (git commit -s; Developer Certificate of Origin 1.1).
  • New source files carry the SPDX licence line for MIT, or are covered in REUSE.toml.

The launcher's core (src/wg_core) and its unit tests now build and pass on
Linux with GCC, the first step of a native Linux launcher. The core's
source stays Windows-style and unchanged: on Linux, CMake puts
src/platform/posix first on the include path, where stand-ins for
<windows.h> and the other Windows headers the core includes declare the
calls it makes, and win32_posix*.cpp implements them on POSIX:

- files, mapped files, find, move/copy/delete, attributes and last-error
  codes; paths cross to the OS as UTF-8, "Z:\" is "/" (as in Wine), '\'
  is '/'; names match case-insensitively
- a file-backed registry (HKCU in $XDG_DATA_HOME/WrongGPU/registry.ini;
  in memory in WRONGGPU_TESTING builds); Steam's SteamPath answers the
  Linux Steam folder, so the core's Steam discovery works as is
- processes via posix_spawn with Windows' command-line rules, pipes, a
  minimal job object; known folders via XDG
- fail cleanly as "not available": WinHTTP, COM objects, DXGI, the event
  log, LoadLibrary, WinVerifyTrust, embedded resources

A Windows call the layer lacks fails the Linux build at that line.
CMake keeps every Windows-only target behind if(WIN32) and adds a
posix-layer test (88 checks) on Linux.

Two portable fixes in the core and a test, identical on Windows:
convert_ignore.cpp decodes a UTF-16 ignore list unit by unit (it copied
the bytes into a wstring, which assumes a 2-byte wchar_t), and the test
writes its UTF-16 input unit by unit. MinGW builds also get
_WIN32_WINNT=0x0A00 (the same fix as in phantoslayer21#105; main does not build with
MinGW without it).

Verified: Linux (GCC 16, fresh build): ctest 12/12 (wg-core,
launcher-core, coexist-core, convert-ignore, wizard-policy, posix-layer,
converter tests, source-size, wording). Windows (llvm-mingw under Wine,
GE-Proton 11-11): wg-core 79, launcher-core 237, coexist-core 186,
wizard-policy 18 (the same as main), convert-ignore 213. The posix-layer
test goes red when its share-mode rule is broken on purpose.

Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
The launcher's screens all draw through one class, Gfx (ui_shell.h). On
Linux it now has its own implementation, ui_gfx_cairo.cpp, on Cairo and
Pango with fontconfig, so the same page code can run on both systems:
shapes, rounded and per-corner rects, gradients, shadows and glows (a
cached box-blurred mask), clips, fades, offsets, text with wrapping,
ellipsis trimming, spacing, line height and TextLead's two-colour run,
icons, the three image modes, the backdrop blur, Freeze/DrawFrozen, the
dry measuring pass, and offscreen frames to PNG. The live window comes
with the window layer (next step).

ui_shell.h keeps every public Gfx method's signature. Its Direct2D,
DirectWrite and WIC includes and members, and the Windows-only rest of
the header, are behind #ifdef _WIN32; the ic:: icon constants moved up
beside Gfx unchanged.

Fonts, bundled so the look is the same on every distribution (Windows'
fonts can't ship): Selawik 1.01 (Microsoft's open Segoe UI substitute,
SIL OFL 1.1, licence text from microsoft/Selawik) for text, and Fluent
System Icons Regular (MIT, microsoft/fluentui-system-icons 67e6dec1) for
icons, mapped from the Segoe Fluent Icons code points by name. REUSE.toml,
LICENSES/OFL-1.1.txt and THIRD-PARTY-NOTICES list them.

Verified: Linux ctest 13/13, including the new gfx-linux-smoke test
(sample frames at 1x and 2x to PNG; text widths grow with text, size and
weight; wrapping grows the height; the dry pass draws nothing; clips,
fades and the blur behave; it goes red with Shadow disabled). reuse lint
5.0.2 and the line-ending check pass. MinGW: every launcher object that
includes ui_shell.h compiles; ui_gfx.cpp, ui_art.cpp and ui_uia.cpp fail
on main as well (constants missing from llvm-mingw's headers).

Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
The launcher (WrongGPU) now builds and runs as a native Linux program
with the same screens and window procedure as on Windows. A window layer
in src/platform/posix (win32_window_*.cpp) supplies the Win32 window
calls the app makes, on SDL3: windows and a message loop (PostMessage
from worker threads included), timers, paint, sizes and DPI, cursors,
capture and focus, the clipboard, and SDL's events turned into the WM_*
messages launcher_ui.cpp already handles. The custom caption's
WM_NCHITTEST answers become SDL's window hit test (drag, resize, caption
buttons on Wayland and X11). Text boxes (Win32 EDIT children) are a
single-line edit control drawn through Gfx.

The live Gfx on Linux draws into a Cairo image surface and copies it to
SDL's window surface (the page is CPU-drawn either way: no GPU context
for one copy). Gfx gains PushRotate/PopRotate, used by the Library's
spinner instead of the raw Direct2D target (ui_gfx.cpp keeps the same
transform).

Shared app files change only where Windows-only code is: the wizard and
widget kit (app.h, main.cpp: Linux has main() and wizard stubs), title
bar/placement/tooltips/file picker (ui_frame.cpp), UI Automation
(ui_uia.cpp: stubs), image decoding (ui_art.cpp: Cairo PNG on Linux;
JPEG art shows the no-art fallback for now) and the embedded payload
(payload_embed.cpp: empty on Linux). launcher_ui.cpp is unchanged.

CMake's Linux branch builds the WrongGPU executable (SDL3 static, cairo,
pangocairo, fontconfig), installs it with assets/fonts, and adds the
linux-ui test: ui-render and ui-dump offscreen, then a scripted live
window under SDL's offscreen driver (a click on Settings, a scroll,
typing into the search box), closed by WM_CLOSE.

Verified: Linux ctest 14/14 (linux-ui goes red with WM_CHAR delivery
broken on purpose); ui-dump of a real Steam library lists its six games
and has the keys and values Windows' test_ui_dump checks. Windows: the
MinGW objects that compiled on main still compile (ui_art, ui_gfx and
ui_uia need three constants llvm-mingw lacks, on main too); Wine
launcher tests wg-core 79, launcher-core 237, coexist-core 186,
wizard-policy 18.

Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
…e folding, registry writes)

Each fix got a check in posix_layer_tests.cpp first; the new checks failed
on the old code (16 of 115 red), then passed after the fix (115 of 115).

- Process image and snapshot names: QueryFullProcessImageNameW returns the
  Z:\ spelling; for a Wine loader it returns the first .exe in the command
  line (Windows paths kept, others converted) and fails when there is none.
  Process32*W names come from argv[0] (or that .exe), not the 15-character
  comm. Checks: a copy of sleep with a 29-character .exe name shows its full
  name and its Z:\ image path equals the file's.
- CREATE_SUSPENDED: fork, the child stops itself before exec, the parent
  waits for the stop; ResumeThread sends SIGCONT and returns 1 then 0, -1 for
  a bad handle. Check: /proc state is T, resume gives 1, state leaves T,
  second resume gives 0.
- Case folding: simple Unicode mapping through a private C.UTF-8 locale
  (towlower_l/towupper_l; towlower if absent) in FixCase (decoded names),
  the FindFirstFileW wildcard, CompareStringOrdinal, _wcsicmp, _wcsnicmp.
  Checks: E-acute.txt found by its lower-case spelling, by FindFirstFileW,
  by wildcard; CompareStringOrdinal and _wcsicmp agree.
- Registry writes: Save reports every fopen, write, fflush, fsync, fclose
  and rename failure; create, set and delete return ACCESS_DENIED
  (EACCES, EPERM, EROFS) or WRITE_FAULT and undo the in-memory change.
  Checks: a hive whose folder is a file, and a read-only folder.
- FormatMessageW has text for ERROR_INVALID_NAME.
- Finished children leave g_children once reaped and no process handle names
  them (handle counts; also swept on the next start). Check: PollChild is
  false after CloseHandle of a finished child.
- detect.cpp: (uint32_t) instead of (unsigned long) for the 0x800B0100
  compare; the same on Windows.

Verified: fresh cmake and ninja build on Linux, ctest 13 of 13 pass with the
posix-layer check at 115 of 115; MinGW -fsyntax-only on detect.cpp is clean.
Not covered by a test: the Wine-loader branches of the image and snapshot
code (no Wine process in the test run).

Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
The Linux WrongGPU now carries the release payload and does the work its
screens offer: install, settings, repair, uninstall and model conversion.

- Payload: tools/make_payload.py also writes resources.S (one .incbin per
  resource, the same ids as resources.rc, and a table); the POSIX
  FindResourceW / LoadResource / SizeofResource / LockResource read it,
  so payload.cpp and payload_embed.cpp work unchanged. Its Windows outputs
  (resources.rc, payload_table.h, app.ico) are byte-identical.
- wg::FsPath (util.h) turns the core's Windows-style paths into host
  paths for the converter, which takes std::filesystem paths: on Linux a
  "Z:\..." path was read as a relative name. On Windows it is the same
  expression as before (12 call sites in logs.cpp, model.cpp, rr.cpp).
- pe.cpp: an ELF file has no PE link time; the Linux launcher's own file
  time stands in (Linux only).
- POSIX layer: the handle, registry, child, job and view tables outlive
  static destruction (App's destructor still calls into them at exit:
  intermittent crashes after install); ntdll's RtlGetVersion answers
  Windows 10 as a Proton prefix does.
- tests: run_launcher_tests.py --native-linux <WrongGPU> --work <dir>
  runs the launcher suite against the Linux binary (tests/native_linux.py:
  the environment, the registry file reader, the skip list). Checks that
  cannot apply on Linux are skipped with a printed reason: the restorer
  exe, the RR prepare helper (Windows driver), cross-process share locks,
  the edition download (no HTTP client yet), the launcher's own
  Windows install (.lnk, Apps & features), NTFS junctions. ctest
  launcher-native runs it.

Verified: Linux ctest 15/15; launcher-native 364 passed, 0 failed, 7
skipped with reasons; model convert on the three synthetic cases is
byte-identical to the installer suite's reference container; the suite
goes red with FindResourceW broken on purpose. Windows: Wine launcher
tests wg-core 79, launcher-core 237, coexist-core 186, wizard-policy 18.

Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
…s, image path)

CREATE_SUSPENDED forks, stops the child, then execs. Three defects in that path:

- Early failures: the program is now found (PATH search as posix_spawnp does)
  and checked (regular file, execute bit, ELF or #! start) in the parent before
  fork, so a missing, non-executable or non-program file fails the call with
  2 / 5 / 193, as it does without the flag. Before, it returned success and
  the child later exited 127. The child execs the pre-resolved path with
  execve, not execvpe.
  RED on b1a51f9: missing program got error 6 (call succeeded), a non-ELF
  file 193 check and a no-execute-bit file 5 check failed. GREEN now.
- Signals: the parent blocks all signals around fork, so the child starts with
  none deliverable; the child resets every caught handler to SIG_DFL (ignored
  signals stay ignored, as through exec and in the posix_spawn path), stops,
  and restores the parent's mask just before execve. Only async-signal-safe
  calls run in the child.
  RED: a SIGUSR1 handler that never returns (stands in for a deadlocking
  one) ran in the child and it stayed in the parent's image. GREEN: the
  signal stays pending, then ends the child by default action.
- Inherited files: the child closes every close-on-exec fd (read from
  /proc/self/fd with getdents64, else a loop to the fd limit) before it stops.
  Non-close-on-exec fds are kept, which is what the posix_spawn path gives
  the program after exec.
  RED: a pipe2(O_CLOEXEC) reader saw no POLLHUP after the parent closed
  the write end while the child was stopped. GREEN: HUP at once.
- Image: the resolved real path is kept in the child record. While the
  child has not exec'd (its /proc exe still equals the parent's),
  QueryFullProcessImageNameW gives the target's Z:\ path and the Process32
  snapshot its basename; afterwards /proc answers.
  RED: both showed the test's own program. GREEN: the target's.

The unsuspended posix_spawn path is unchanged.

Tests (posix_layer_tests.cpp, SuspendedStart): 131 checks, 7 of the 16 new
ones failed on b1a51f9, all pass now, 20 runs in a row without a flake.
Fresh Linux build plus ctest: 12/12 pass. wg-core and launcher-core fail
the same way on b1a51f9 when TMPDIR is inside the worktree's folder and
pass with a TMPDIR outside it; not caused by this change.

Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
Fixes from the independent review of 60493e6. Each has a check that was
run red on the unfixed code first (tests/window_linux_tests.cpp, new
window-linux ctest, SDL offscreen with events pushed by the test; the
Gfx one in tests/gfx_linux_smoke.cpp). A test-only hook
(TestSetPixelDensity) stands in for a display scale change the
offscreen driver cannot make.

- DPI: the window's density is read again on pixel size, display scale
  and display changes, before the suggested rect is made or
  WM_DPICHANGED is posted. The rect lives in the window, not in a
  function-local static, so queued events do not share one.
  Red: both windows saw the last window's rect (600 vs 800 wide), the
  window ended 1200 wide (scaled twice), a click missed the field.
  Green: each rect is its own, the window is 800 wide, the click hits.
- GetKeyState: every input message carries the keys and buttons as its
  own SDL event left them; GetKeyState reports those for the message
  last taken off the queue (TranslateMessage reads them too).
  Red: Ctrl-down, A-down, A-up, Ctrl-up in one batch did not select
  all. Green: it selects all. (The layer has no GetAsyncKeyState.)
- Edit caret: WM_SETTEXT and the title given to CreateWindowExW go
  through one function, which leaves anchor and caret at the start, as a
  Win32 edit does (Wine's edit control too); the launcher selects all
  itself where it wants that (EM_SETSEL 0, -1 on the search box). The
  test pins it: "0.5" then typing "1" gives "10.5"; SetWindowText("xyz")
  then "!" gives "!xyz" (an end-placed caret fails it).
- WM_QUIT is returned before a due paint or timer.
  Red: 50 paints/timers came first. Green: none.
- Enqueue no longer reads g_mouse from another thread: a cross-thread
  PostMessageW has pt {0,0} and leaves the key state alone.
  Red: pt was the pointer. Green: {0,0}.
- PopClip, PopRoundClip and PopFade keep the matrix as it is instead of
  rebuilding it from identity, so an open PushRotate survives.
  Red: the bar stayed unrotated after the pop. Green: it is rotated.
- SetCapture tells the previous capture window with WM_CAPTURECHANGED.
  Red: no message. Green: one, naming the new window.
- PeekMessageW and GetMessageW honour the window and message range;
  synthesized WM_PAINT and WM_TIMER too; PM_NOREMOVE leaves a timer due
  instead of moving it to its next period.
  Red: b was handed a's paint, a range without WM_PAINT got one, a
  looked-at timer vanished. Green: all as Win32.

Verified: fresh Linux build, ctest 15/15 (the 14 before plus
window-linux). Windows is unaffected: Linux-only files.

Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
A scale change while the window's last WM_DPICHANGED was still queued (a
filtered PeekMessage pumped SDL but left the message there) queued a
second one pointing at the same rect: the first message's DPI then
disagreed with the rect it pointed to. The queued message is now updated
in place, so its DPI and rect always describe the latest scale (the
launcher's own unfiltered loop never hit this; review finding on
7b070ea).

Verified: window-linux's new check (2x then 3x with WM_DPICHANGED kept
queued by a WM_PAINT-only peek: one message, DPI 288, rect 900 wide)
fails without the change (two messages) and passes with it; ctest
window-linux, linux-ui, gfx-linux-smoke, posix-layer green.

Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
clean/installer/build-appimage.sh builds the launcher into an AppImage
that runs on any Linux with glibc 2.35 or newer (Ubuntu 22.04 era). It
runs in a pinned ubuntu:22.04 container (build-appimage-container.sh:
podman or docker), installs the build packages, fetches and checks the
pinned tools (SDL 3.4.18, linuxdeploy 1-alpha-20251107-1, appimagetool
1.9.1, type2 runtime 20251108; every one by SHA-256), builds SDL3
static, builds the CMake target WrongGPU, and packs what `cmake
--install` puts in the AppDir (binary, fonts, menu entry, icon taken from
assets/wronggpu.ico) with linuxdeploy and appimagetool. It lists no
sources, screens or libraries, so launcher changes need no script edit.
Its last step fails if any bundled file needs a glibc newer than 2.35 or
the fonts are missing. --payload <folder> takes the release payload (as
WRONGGPU_PAYLOAD_DIR on Windows); --test-payload makes a smoke build.

.github/workflows/linux-appimage.yml does the --test-payload build on
pull requests in the same container digest (no artifact upload: that
needs an action the repo does not use yet).

tools/ci/check_portable.py (ctest portable, portable-selftest) catches
the two mistakes a Windows-only build lets through: a
std::filesystem::path built from a wstring (use wg::FsPath) and
Direct2D/DirectWrite/WIC/DWM/UIA names in shared UI code outside
#ifdef _WIN32. README-linux.md explains the layers, the rule (a Windows
call the layer lacks fails the Linux build: add it in
src/platform/posix), building, testing and the AppImage.

Verified: the --test-payload AppImage (9.8 MB, about 55 s cold) built in
the pinned container; it renders the library, settings and game pages
(ui-render) on this host (glibc 2.43) and in a bare ubuntu:22.04
container (glibc 2.35, --appimage-extract-and-run) with the bundled
fonts; the glibc check fails with its limit lowered to 2.30 and with the
fonts removed. check_portable: 0 findings on the tree, red on planted
violations. Linux ctest 18/18; reuse lint, line endings and source size
pass.

Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
Without an embedded restorer, install and adopt copied the running
program into wronggpu-setup\uninstall.exe. On Linux that is the 15 MB
ELF launcher, which cannot start in the game's Wine prefix. Linux now
writes no uninstall.exe; the launcher's own uninstall removes the
install (README-linux.md, "No restorer"). Windows is unchanged: the copy
is behind #ifdef _WIN32. Review finding on 1adf722.

The launcher suite's skipped restorer check is now a Linux check that no
uninstall.exe is written.

Verified: Linux ctest 18/18 (launcher-native includes the new check).

Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
`std::filesystem::path p = wide;` compiles on Linux as well and keeps a
Windows-style path as a relative name; the check only caught the
constructor forms. It now flags copy-initialisation unless the right-hand
side is a narrow literal or wg::FsPath. Review suggestion on 1adf722.

Verified: the self-test's new planted case is red, the clean sample
(now with both allowed forms) green; the tree has 0 findings; a planted
`std::filesystem::path p = w;` in a copy of model.cpp is reported.

Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
…heck, SDL stamp, CI pin)

- CMakeLists.txt: one list of src/app sources (WRONGGPU_APP_SOURCES) for the
  Windows and the Linux WrongGPU targets; WRONGGPU_APP_SOURCES_WINDOWS
  (wizard.cpp, ui_gfx.cpp) and WRONGGPU_APP_SOURCES_LINUX
  (ui_live_hook_linux.cpp) hold the exceptions. Evidence: the MinGW target's
  input list (ninja -t query WrongGPU.exe) is identical before and after; a
  dummy src/app/ui_probe.cpp added to the shared list only was compiled by the
  Linux and the MinGW build.
- build-appimage.sh, step 9: fails when a bundled ELF file needs a library that
  is neither in the AppDir nor in HOST_LIBS (glibc family, libX11, libxcb, libz,
  libuuid; derived from the AppDir's NEEDED entries). A failing readelf or
  objdump now fails the step (it was hidden by `|| true`), and GLIBCXX/CXXABI
  above Ubuntu 22.04's libstdc++ (3.4.30, 1.3.13) are reported. Evidence:
  removing libpng16 from the AppDir fails; a library with a NEEDED-only
  dependency on libresolv fails and passes once it is bundled; a copied newer
  libstdc++ fails; a faked readelf or objdump failure fails. The rebuilt
  AppImage passes, renders on this host and in a bare ubuntu:22.04 container
  with only libx11-6 (libxcb1 comes with it) installed; without libx11-6 the
  container run fails on libxcb.so.1.
- build-appimage.sh, SDL: the stamp is written only after build and install
  both succeed. Plain `a && b` would not do it: set -e ignores a failing a, so
  the commands run on separate lines. A forced build failure leaves no stamp
  and stops the script (the old form wrote the stamp and went on).
- linux-appimage.yml: the pin check needs a full 64-digit digest in the
  container line and compares the whole image reference with CONTAINER_IMAGE in
  build-appimage.sh. Run against copies: the good file passes; no digest, a
  short digest and a differing digest each fail.
- README-linux.md: the source lists, the glibc and X11 requirement, the host
  libraries the script lists, what the last step checks, and the install() line
  a new asset folder needs.
- launcher.cpp: the Detach message no longer promises "its own uninstaller" on
  Linux, where none is written (smallest #ifdef); check_wording.py passes.
- check_portable.py: also flags `p = w;` (a wstring or wide literal assigned to
  a std::filesystem::path of the same function). The tree has no finding; the
  planted cases go red and the clean sample (path = path, FsPath(w), wstring =
  wstring) stays green.

Verified: Linux ctest 18/18 under the safety environment; Wine launcher tests
79/237/186/18; reuse lint, line-ending, source-size and wording checks pass.

Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
Cairo reads PNG only, so the Linux launcher showed the plain plate where
Steam's hero, header and capsule (all JPEG) belong. Ui_art.cpp's Linux
Decode now sends a file with the JPEG signature to
src/app/jpeg_decode_linux.cpp (libjpeg API of libjpeg-turbo, found with
pkg-config; BGRA out, DCT scaling by 2/4/8 while the result stays as wide
as the tile needs). Windows keeps WIC: the new file is in
WRONGGPU_APP_SOURCES_LINUX and the header is only included under
#ifndef _WIN32.

Decode also read paths with ToUtf8, which leaves "Z:\home\..." as it is:
no art file was ever found on Linux, PNG logos included. It now uses
wg::FsPath like the rest of the layer.

- build-appimage.sh: libjpeg-turbo8-dev in the apt packages; linuxdeploy
  bundles libjpeg.so.8 (528 KB), step 9 passes with it.
- CMake installs THIRD-PARTY-NOTICES to share/doc/wronggpu: the IJG licence
  asks binary distributions to say the software is based in part on the
  work of the Independent JPEG Group; section 4 of the notices does, with
  the IJG and BSD-3-Clause texts. Nothing is vendored, so REUSE.toml needs
  no entry.
- README-linux.md: the art limit is gone; build requirements list it.

Verified: jpeg-linux-tests makes its own JPEGs (plain, progressive, grey)
and checks size, orientation, colours within +-14 and the DCT-scaled
sizes, a missing, truncated and junk file; with RGB and BGR swapped it
fails (6 failures), restored it passes. linux-ui renders a fixture game
whose Steam cache holds a synthetic hero: its green block covers over
20000 pixels of the game page, and none without the file. Rebuilt AppImage
(build-appimage-container.sh --test-payload, 9.9 MB) passes step 9 and
renders the JPEG hero on this host and in bare ubuntu:22.04 with only
libx11-6. ctest jpeg-linux, gfx-linux-smoke, linux-ui, portable(+selftest)
pass; reuse lint, line endings, source size, wording and portable checks
pass.

Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
Under Proton, OptiScaler installed as dxgi.dll loads only when Steam's
launch option for the game says WINEDLLOVERRIDES="dxgi=n,b" %command%
(Wine otherwise uses its own dxgi.dll). The player chose to be shown the
line, not to have WrongGPU edit Steam's config (Steam owns that file and
rewrites it).

The game page's OptiScaler section, once WrongGPU's setup is in the game,
now has a "Steam launch option" cell under the list: two sentences, the
line in a monospaced box, and a Copy button in the page's existing
pattern (as the Engine.ini steps' Copy: clipboard, then a toast). The line
uses the proxy name the install chose (dxgi, or another DLL name), so it
stays true when OptiScaler loads as another file. It is all behind
#ifndef _WIN32 (ProtonLaunchNote, CopyLaunchOption, the activation case,
ui_frame.cpp's sidecar); only the ID_G_PROTONOPT_COPY enumerator is in the
shared header, in a free slot before ID_G_OPTI0, so no other id moves.
The Windows build compiles none of the new code (not built here: no
MinGW on this host).

ui-render also writes <frame>.png.texts on Linux (id, role, name of each
control) so the test reads the page's words instead of guessing from
pixels.

Verified: linux-ui's new "proton" check renders the installed fixture game
(Cyberpunk, proxy dxgi.dll) and finds the note with the exact line and the
Copy button, and none on the Library; with the section's condition forced
off both checks fail, restored they pass. The PNG shows the cell between
the OptiScaler list and "WrongGPU manages some of OptiScaler's settings".
ctest jpeg-linux, gfx-linux-smoke, linux-ui, window-linux, portable pass;
check_wording, reuse lint, line endings, source size, check_portable pass.

Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
Selawik has no U+2192, so "0.4.5 -> 0.6.0" and "1706 x 960 -> 2560 x 1440"
showed Pango's hex box wherever no system font covered it (a bare system
or container). A scan of the UI strings (raw and \u escapes in src/app and
src/wg_core) found these non-ASCII characters; Selawik lacks the arrow
(U+2192), the no-break space (U+00A0), the narrow no-break space (U+202F)
and the en space (U+2002); it has the ellipsis, middle dot, quotes, dash,
guillemets, the multiplication sign and fractions; the icon font has none
of them. Noto Sans Math has all four; Noto Sans Symbols 2 lacks the arrow
and the spaces.

- assets/fonts/notosansmath: NotoSansMath-Regular.ttf, the unhinted TTF of
  notofonts/math release NotoSansMath-v3.000, whole and unmodified (657 KB,
  sha256 b127e846...b4aa; the release zip is ac351837...8356, downloaded
  from the release page and checked), with its OFL.txt. Not subset: a
  subset would be a modified file to keep in step with the release, for
  about 600 KB (the Fluent icon font beside it is 2.9 MB).
- ui_gfx_cairo.cpp: the text family list is "Selawik,Noto Sans Math,
  sans-serif", so the font draws what Selawik lacks before any system font.
- REUSE.toml, THIRD-PARTY-NOTICES (1.4, Fluent is now 1.5), README-linux.md.
  LICENSES/OFL-1.1.txt already exists.
- build-appimage.sh step 9 also fails when the font is missing from the
  AppDir. The AppImage grows from 9.9 MB to 11 MB.

Verified: gfx-linux-smoke now runs with an empty fontconfig set (no system
fonts) and checks the arrow is not as wide as the hex box of another
four-digit code and is about an em wide; with the font folder moved away it
fails, restored it passes. Rebuilt AppImage (--test-payload) passes step 9
and ui-render in bare ubuntu:22.04 with only libx11-6 shows the arrow in the
game page's Size row, where it was a box before. Full Linux ctest 19/19;
reuse lint, line endings, source size, wording and portable checks pass.

Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
The workflow built the AppImage and threw it away because the repo used no
upload action. It now uploads out/*.AppImage with actions/upload-artifact,
pinned to the full commit SHA of v4.6.2 (ea165f8d..., tag published
2025-03-19), retention 3 days, failing when no file is found. The AppImage
carries the test payload and never ships; the step says so. Permissions stay
contents: read (the upload needs no more).

Verified: the file loads with python yaml (permissions {contents: read}, the
upload step's inputs as written); the digest-check step's shell run as
written against the files passes (full sha256 digest, equal to
CONTAINER_IMAGE); actionlint 1.7.7 reports only the existing SC2015 note of
that step. The SHA resolves to the v4.6.2 commit through gh api. The upload
itself can only run on GitHub.

Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
The decoder resized a std::vector between setjmp and a possible longjmp,
so after a libjpeg error raised once decoding had started (a bad marker
before the end of the file) the vector's value was indeterminate when its
destructor ran; a bad_alloc from the resize also skipped
jpeg_destroy_decompress and fclose. The pixels now live in malloc storage
behind a volatile pointer, nothing with a destructor crosses the jump, and
the copy into the caller's vector happens after the decoder and the file
are released, with the buffer freed on every path.

THIRD-PARTY-NOTICES labelled a generic MIT disclaimer as libjpeg-turbo's
README.ijg; it now carries README.ijg's LEGAL ISSUES text from tag 2.1.2
verbatim, after the acknowledgement condition (2) asks for.

Verified: jpeg-linux-tests has a new case, a whole picture with a
zero-length DHT marker before EOI, which fails in jpeg_finish_decompress
after the buffer exists; it returns false and leaves the outputs alone.
Built with clang -fsanitize=address the tests pass with no leak; with the
buffer's free removed on purpose LeakSanitizer reports the leak, restored
it is clean (the plain ctest build cannot see a leak). ctest jpeg-linux,
gfx-linux-smoke, linux-ui, portable pass; reuse lint 5.0.2 compliant.

Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
What: Gfx::Icon draws the Fluent glyph larger (1.35x) and, at 13.5 px or less, takes its _16/_12 variant (kIcons now carries those codepoints; icons the font has no small glyph for keep _20) and centres it on a pixel row.
Why: the Fluent _20 glyphs carry grid padding (ink is 0.7-0.75 of the em, Segoe's fills it), so icons were ~70% of the Windows size with half-pixel strokes.
How verified: ui-render at 1x/2x, caption buttons, search, chevrons and checks compared against the Windows renders at 3x zoom; the minimise line is now one crisp row. Maximise stays a rounded square (the font has no sharp one).

Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
What: MakeLayout gives text without a set line height Segoe UI's 1.33 em line and shifts it so the baseline is 1.079 em down (the layout's dy, used by Text, TextLead and TextEnd); the icon font is left alone.
Why: Pango used Selawik's 0.990 + 0.210 em box, so titles sat 2-3 px high, rows ~1 px high and bottom-aligned titles ~1 px low against Windows. Both metrics were read from the bundled fonts (hhea 2027/-431 of 2048, Segoe UI's usWin 2210/514 of 2048 by the same ratio).
How verified: ui-render 1x/2x, the Library title's L now starts on the same pixel row as the Windows render (79 vs 76 before); mean difference over the 221 scale-1 pages fell from 2.867 to 2.752. Texts with a set line height keep Pango's own placement: putting their baseline at 0.8 of the line (DirectWrite's rule) measured worse (2.831).

Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
What: text at weight 600 or more (and a lead range at such a weight) gets letter spacing of -0.0075 em, added to the style's own spacing.
Why: Selawik's semibold and bold run 1-3% wider than Segoe UI's, so pills, names and paragraphs wrapped differently (the OptiScaler paragraph on settings-set now wraps to 4 lines like Windows).
How verified: swept the value over the 221 scale-1 pages against the Windows renders: none 2.752, -0.005 2.498, -0.0075 2.366, -0.01 2.404, -0.0125 2.522, -0.015 2.634, -0.02 2.831 (mean percent of pixels differing); -0.0075 is kept, not the -0.015 first suggested. No page rose by more than 0.07 points.

Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
Brings the launcher branch up to upstream main (217 commits: phantoslayer21#47, phantoslayer21#105,
phantoslayer21#196, phantoslayer21#197, phantoslayer21#209, Model K/L, frame generation, ...). Changes beyond
resolving the three conflicts (CMakeLists.txt project(), util.h's includes,
the restorer test):

- POSIX layer: the Win32 calls main's handle-based restore uses
  (SetFileInformationByHandle with FileBasicInfo, FileDispositionInfo and
  FileDispositionInfoEx's POSIX delete, GetFileInformationByHandleEx
  FileBasicInfo, SetEndOfFile, ExitProcess, GetProcessHeap/HeapFree, CDECL,
  ERROR_TOO_MANY_LINKS/FILE_CORRUPT/READ_FAULT), with posix-layer tests.
- run_launcher_tests.py stays below the 256 KB source limit: the edition
  section moves unchanged to launcher_edition_cases.py and the Linux run's
  plumbing to native_linux.NativeT.
- launcher-native runs only in a -DWRONGGPU_PRESET_K=OFF build (like CI's
  launcher build: the suite expects no seeded wronggpu-asi.ini); its two
  checks that fail on main's own launcher too (phantoslayer21#219) are skipped while
  they fail (native_linux.KNOWN_ON_MAIN).

Verified: fresh build, ctest 22/22 (launcher-native 365 passed, 0 failed,
6 skipped: 4 Windows-only sections, the 2 phantoslayer21#219 checks); reuse lint passes.

Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
@phantoslayer21 phantoslayer21 added this to the 0.6.6 milestone Nov 15, 2026
@phantoslayer21

Copy link
Copy Markdown
Owner

The approach reads well: the Windows build untouched, Linux-only code in its own files or behind #ifndef _WIN32, and the launcher suite running natively. This goes to 0.6.6, not 0.6.5. 0.6.5 is locked to Models L and K running natively on D3D12 plus the release fixes, so a full review of this one comes after that ships.

Two things to think about before more goes in:

  1. Size of the Win32 layer. Stand-in Windows headers plus a POSIX implementation of the calls the core uses is roughly 10k lines that have to follow every launcher change. Where the core uses only a handful of calls (files with sharing rules, processes, the registry), a small platform interface in the core may be cheaper to keep correct than emulating the Win32 surface. If you've measured how many distinct Win32 calls the core really needs, put that number in the description; it decides which way is less work.
  2. What a Linux player gets today. Under Proton the upscaler still can't start until dxil-spirv handles the WMMA kernels (your dxil-spirv#362), so for now the native launcher covers install and settings only. The README's known-limits section should say that plainly, so nobody expects it to upscale yet.

#219 is being fixed separately; once that lands, the two skipped checks should run here too.

Conflicts resolved in src/app/ui_art.cpp (main's MinGW fallback kept beside the
Linux includes) and tests/run_launcher_tests.py (main's per-test argument
dispatch kept with the Linux skipped count).

Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
Main's rrconfig.cpp replaces Engine.ini with ReplaceFileW and reads
ERROR_UNABLE_TO_REMOVE_REPLACED (1175), ERROR_UNABLE_TO_MOVE_REPLACEMENT
(1176) and ERROR_UNABLE_TO_MOVE_REPLACEMENT_2 (1177); the layer had none of
them, so the Linux build stopped there (the only missing names ninja -k 0
listed). ReplaceFileW renames the replacement onto the replaced file's name
and, with a backup name, the old file onto that name first. A missing file is
file not found, a read-only or folder target is access denied, a replaced file
held without delete sharing is 1175, a held replacement is a sharing
violation. The replaced file's mode stays on the new file.

The Hidden attribute is now kept (a user extended attribute), because main's
new Engine.ini check requires a replace to keep it and the layer had no
storage for it: GetFileAttributesW, Find*, the by-handle calls,
SetFileAttributesW and ReplaceFileW use it.

Verified: posix-layer-tests 215 checks, 0 failed; breaking the backup rename
and the read-only check on purpose turned 7 and 4 checks red, restored green;
full ctest 22 of 22 (launcher-native 365 passed, 0 failed, 6 skipped).

Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
With a released Proton, WrongGPU's upscaler does not start: vkd3d-proton's
dxil-spirv cannot translate the matrix kernels until dxil-spirv pull request
362 is in a Proton release, so the native launcher covers install and
settings only. Also notes how the Hidden attribute is kept.

Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
The no-backup path deleted the replaced file and then renamed the
replacement onto its name, so a stop between the two left no file. rename()
replaces the target in one step: the name never goes missing, and a failure
leaves both files where they were (reported as 1175, nothing moved). The
core always passes a backup name; only tests reach this path.

Verified: posix-layer, launcher-core, wg-core, unit and portable pass after
the change; the full ctest (22 of 22, launcher-native 365 passed, 0 failed,
6 skipped) ran on the commit before it.

Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
…21#226)

One conflict, in run_launcher_tests.py: main (phantoslayer21#222) keeps a two-line
test_edition_download that calls launcher_edition_cases.py; the branch had
called the module from main(). Main's form is kept, and the Linux run skips
that section through it.

phantoslayer21#222 put test_re9's corrected check on main, so its entry leaves
native_linux.KNOWN_ON_MAIN: the check runs and passes natively. The
test_rr check stays skipped until main's fix for phantoslayer21#219 lands.

Verified: fresh build, ctest 22 of 22; launcher-native 366 passed, 0
failed, 5 skipped; reuse lint passes.

Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
@j0nsh1n

j0nsh1n commented Nov 15, 2026

Copy link
Copy Markdown
Contributor Author

Thanks. Both points are in, and the branch is on main at 0ef4b90 again.

  1. Size of the Win32 layer. Measured and added to the description: the core (src/wg_core) calls 114 distinct Win32 functions at about 605 call sites; the window code calls 106 more. By area in the core: files and handles 35, processes / modules / environment 30, paths 8, registry 8, time 6, strings 4, other 23 (11 of them WinHTTP). The layer is about 6,400 lines (headers 1,170, implementation 2,500, window layer 1,900, tests 800). So a platform interface would be a handful of calls for the registry and strings, but about 65 for files and processes, where the core leans on Win32 semantics (share modes, delete through a handle, ReplaceFileW). I don't have a view yet on which way is less work; the numbers are there for when you review.
  2. What a Linux player gets today. README-linux.md's known limits now say it: with a released Proton the upscaler does not start yet (dxil-spirv 362), so the native launcher covers install and settings only for now.

Also in this push:

Since this is for 0.6.6, I'll stop following every commit on main and bring the branch up to date once 0.6.5 is out.

@phantoslayer21

Copy link
Copy Markdown
Owner

The numbers help, thanks. With roughly 65 calls in files and processes that lean on Win32 semantics, emulating them is a fair choice. I'll weigh it properly in the 0.6.6 review. Storing Hidden as user.wronggpu.hidden is fine.

A heads-up for when you rebase after 0.6.5: #226 (now on main) added clean/wgshared/include/wg_state.h, used by the launcher, the front end and the RR plugin. It relies on more Win32 semantics your layer will need: named mutexes from a folder's volume serial and file index, share-mode-0 opens with FILE_WRITE_DATA to detect a loaded image (a sharing violation means the game holds it), rename and delete through a held handle (SetFileInformationByHandle with FileRenameInfo / disposition), and MoveFileExW with WRITE_THROUGH. The "game is running" check is the one that matters for a native launcher, since there's no loaded Windows image to detect. Its Linux equivalent needs some thought (Proton's process, or a file lock the game side holds).

Windows refuses an open that would write to a loaded image, and 0.6.5's
operation guard relies on that to refuse an uninstall, repair or update while
the game runs ("in use by the game ... Close the game and try again"). Linux
let every such open through, so a game running under Proton was not seen.

CreateFileW now applies Windows' image rule: an open with write or append
access, or a truncating disposition, of a Windows program or DLL (first bytes
"MZ") fails with ERROR_SHARING_VIOLATION while a Windows program under Wine
has it mapped. Looked at: this user's Wine processes (command line a Windows
path, an .exe, or wine*; Wine names its processes so), their
/proc/<pid>/maps (a loaded DLL is mapped there; checked against a real Wine
process), each match confirmed through /proc/<pid>/root. A Wine process of the
user whose maps cannot be read (not dumpable) cannot be ruled out: the open
fails with ERROR_CANT_ACCESS_FILE, which the guard reports as "could not tell
whether the game is using its files; close the game and try again". Not
counted: native programs (a data mapping, which Windows does not refuse
either), unreadable processes that are not Wine programs, files that are not
Windows images. Not seen: another user's processes; a game that loads the DLL
after the guard's open (Windows refuses that load; Linux cannot).

Tests (posix-layer-tests, 305 checks): the game has the DLL loaded (refused,
also truncating; reads still work; the guard says GameRunning and to close the
game), it ended (Ok), a native program or a non-image file (not refused), an
unreadable Wine process (could not tell; the guard says Unknown), an
unreadable native process (not counted), a Wine process named wine*. Each of
the five rules broken once went red; restored, green. With a real Wine process
(GE-Proton11-11) holding a DLL, the guard refuses; before and after, Ok.

Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
… WrongGPU loaded

The state cases' section 4 now runs on Linux instead of being skipped: a
stand-in game (a process named like a Windows program under Wine, with
wronggpu_runtime.dll mapped) makes uninstall, repair and update refuse (exit
2, nothing changed, the file named, the words say to close the game). A second
case makes that process not dumpable: refused with "could not tell whether the
game is using its files; close the game" (any binary may be named: that
process could have any of them loaded). The stand-in is not named Game.exe, so
the guard decides, not the older check by process name (which, for an
unreadable process of the game's name, already assumes the game runs). The
"another program has it open" case stays skipped on Linux (share modes
between processes are not emulated).

Verified: --only state on the Linux launcher: 49 passed; with the layer's
image check switched off, these 6 checks (and 2 that follow) fail.

Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
…inux runs too

0.6.5's launcher suite runs a program only after checking it is a
WRONGGPU_TESTING build (phantoslayer21#243): an identity resource, a matching PE checksum and
the test hooks' strings, and negative controls (canaries) it must refuse. On
Linux that check read PE structure only, so every launcher call was refused.
The guard stays; Linux gets its own counterparts:

- identity: a section .wg_testing_id in the testing launcher
  (src/platform/posix/testing_identity_linux.cpp, the same identity text as the
  Windows resource) and, after the link, the file's SHA-256 written into it
  with those 32 bytes counted as zero (tools/elf_testing_identity.py, a
  POST_BUILD step; what the PE checksum is on Windows: a byte changed, data
  appended or a strip after the link no longer matches);
- launcher_build_facts.testing_identity reads an ELF file that way (wide
  strings are UTF-32 on Linux); the build list names WrongGPU and the canaries
  without .exe;
- negative controls: tests/canary.cpp built for Linux too (its wmain through
  the POSIX layer; lstrcatW added there), a Linux load marker
  (tests/canary_dll_linux.cpp, writes <file>.loaded from a constructor);
- self_checks on Linux: --native-linux as the entry point, host paths for
  programs and child suites, a symbolic link where Windows uses a junction,
  ctypes.CDLL for the load marker; the native launcher is checked before
  anything runs, as --launcher is.

Verified: ctest 22/22 (launcher-native 425 passed, 0 failed, 5 skipped; its
preflight and every negative control pass on Linux). The check accepts the
testing launcher and refuses 42c933e's testing launcher, both canaries, and
the launcher with a byte changed, data appended, stripped, the identity text
changed (sum rewritten) or the sum never written; three ways of breaking the
checker each let one of those through (red), restored green. The suite given
a non-testing program refuses before it makes its work folder. The MinGW
build of the Windows canaries is unchanged in behaviour (Wine tests as before).

Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
The state lock and the refusal while a Wine game has WrongGPU's files loaded now exist on Linux; the limits list said cross-process locking was not emulated at all. It now says what is covered and what is not (other users, files only open, a game started after the check).

Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
… and changes nothing

On a file system without RENAME_NOREPLACE, FileRenameInfo without replace
links the new name and unlinks the old one. The unlink's result was ignored:
when it failed (for example a folder the user may not write), the call
reported success with the file under both names, and the handle followed the
new one. Now the new link is removed again and the call fails with the
unlink's error, so the file keeps only its old name as before the call. If that
removal fails too, both names are left and the call still fails (said in
win32_posix.h). From the review of the 0.6.5 port.

Test seams (posix_layer_tests only): g_renameat2 and g_unlink, so the test can
force the fallback (renameat2 answers EINVAL). New checks: the fallback moves a
file and still refuses an existing name; a read-only source folder with a
writable target: the call fails (access denied), only the old name is left, the
handle still names it; both unlinks failing: the call fails. Without the fix
these three checks fail (310 checks, 3 failed); with it, 310 pass.

Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
7fd9be5 made the state cases uninstall and remove their game when a build
without Preset K writes no wronggpu-asi.ini, but ignored the uninstall's
result, so a failing uninstall would pass unseen and its folder be deleted.
It is now a check. From the review of the 0.6.5 port.

Verified: the launcher verbs suite passes (426 checks, this one among them);
with that uninstall made to fail for real (a stand-in game under Wine holding
the runtime DLL during it, in a scratch wrapper outside the repo) the check
fails, with the launcher's refusal as its detail.

Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
@j0nsh1n

j0nsh1n commented Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

Brought this branch up to 0.6.5 (a merge of main, three small conflicts). 0.6.5's new Windows calls have Linux versions in the POSIX layer, with no #ifdef in shared code:

  • the per-game state lock is a named mutex on Linux open-file-description locks: timed wait, a crashed owner reported as abandoned, recursive per thread;
  • rename by handle uses renameat2 (never over a file unless asked to replace; on a file system without it, a checked link-and-unlink that rolls back on failure);
  • the Restart Manager check reads /proc;
  • plus GetLongPathNameW and events.

Two things now work on Linux the way they do on Windows:

  • Uninstall, repair and update are refused while the game runs under Proton. Windows refuses a write to a loaded DLL; the Linux layer now does the same for DLLs and programs that one of the user's Wine processes has mapped (checked with a real Wine process). If such a process cannot be inspected, the launcher says it could not tell and asks to close the game; it does not go ahead. Not covered: other users' processes, files a program only has open, and a game started after the check.
  • 0.6.5's test-build preflight also guards Linux runs. The Linux test launcher carries an identity section plus a SHA-256 written after the link (the counterpart of the PE checksum), and there are Linux canaries. The preflight and all its negative controls pass on Linux, and it refuses a non-test build.

Native ctest passes 22/22, including the launcher verbs suite against the Linux binary (426 passed, 5 Windows-only sections skipped). Each new rule was broken once to see its check fail. The AppImage builds in the pinned container and starts headless.

Note for bisecting: the merge commit itself does not build on Linux or link under MinGW; the commits right after it fix that.

Two small things that are not Linux-specific are fixed here and filed as #274 and #275: the MinGW build needs rstrtmgr named in target_link_libraries (the #pragma comment(lib) is MSVC-only), and in a build without Preset K the state test cases leave an install behind.

Under Wine, the launcher-core Engine.ini check fails on the old branch head as well: Wine refuses a FILE_WRITE_ATTRIBUTES open of a read-only file, which Windows allows.

The previous run failed one Windows wg_state case (a binary loaded in another process) that this branch does not touch; main passed it three times today. Empty commit to get a fresh run.

Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
@j0nsh1n
j0nsh1n marked this pull request as ready for review November 17, 2026 17:49
A native launcher has no DXGI, so DetectGpu returned an empty card and the
install check blocked every Linux install without --force. It now reads
/sys/class/drm: an RDNA 4 board is named from a built-in PCI id list, any
other card by its code, the AMD RDNA 4 card wins over other cards, and only
RDNA 4 counts as supported (RX 7000 series stays not supported).

NativeLinux() tells the POSIX layer from Windows and Wine without an #ifdef.

Verified: ctest 22/22; the new checks fail when an RDNA 4 id is changed.
Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
WRONGGPU_TEST_DRM_ROOT (WRONGGPU_TESTING builds only, as the HIP candidate
override) names the folder a native launcher reads its cards from, so the UI
tests and screenshots do not depend on this machine's GPU.

Verified: posix-layer 323 checks green; portable, wording, source-size green.
Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
…o the game

Natively RrKernelsInGame was false, so Play ran a prepare step that found no
driver and failed with "no AMD graphics card found", and the game page offered
a Prepare button that could do nothing. Every game here runs under Proton,
whose shader caches are the game's own, so the native launcher now answers as
the Wine one does (UnderProton() = Wine or native Linux): state in-game, the
Proton words, no helper, no failing step at Play.

Verified: ctest 22/22 (launcher-native with new native rr-prepare cases);
the new checks fail with the old gate.

Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
… prefix

The native launcher looked for Engine.ini in this account's Documents, which a
Proton game never reads. For a Steam game it now finds
<library>/steamapps/compatdata/<appid>/pfx (the game's own library, then every
library the library lists name) and uses its Windows profile; until Steam has
made that folder it refuses in plain words and writes nothing. For a game that
is not from Steam, the player points at the game's Windows user folder once
(the windows-folder verb, stored in the launcher's data folder) and it is
remembered. A test root (ctx.playerDocuments, WRONGGPU_TEST_DOCUMENTS,
LOCALAPPDATA) still comes first; Windows and Wine are unchanged. The game page
says why no folder is known.

Verified: ctest 22/22 with new core checks and a native proton section in the
launcher suite (fake Steam trees only); the new checks fail when the prefix
lookup is broken.

Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
The first-run checks showed a Windows 10 stand-in line, 'Direct3D 12: Ready',
a HIP line nothing here uses, and an 'Install for this user' choice that always
fails natively (the launcher's self-install is Windows-only). Natively the
sheet now names the distribution, says 'Direct3D 12 (through Proton)', leaves
out the HIP line and the install choice. The Steam launch option card now says
step by step where to paste the line (Properties, Launch Options, Copy), and
that WrongGPU does not write Steam's settings.

Windows and Wine text is unchanged (the label and the lines are chosen by
NativeLinux()). Collect-logs says Linux too.

Verified: ctest 22/22 with new ui-dump checks (three made-up cards) and
os-release parsing checks; the new checks fail with the old words.

Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
An AppImage has no installer entry, so the native Settings page offered a
broken 'Install for this user' and no way out. Settings now has Uninstall
WrongGPU: one confirmation that names the AppImage file and WrongGPU's data
folder, then both are deleted and nothing else. It refuses unless $APPIMAGE is a
plain file (not a link) called WrongGPU...AppImage with an AppImage header and
this program runs inside that AppImage's $APPDIR, and while a game still has
WrongGPU. The window saves nothing into the folder after it is gone. Also as
the uninstall-appimage verb (--confirm), for tests.

Verified: ctest 22/22; ten ownership checks in the posix layer tests and a
native launcher section (every refusal leaves both untouched, the confirmed run
leaves a sibling AppImage, another program's data and the games alone); the
checks fail when the name guard is removed. The tests scrub APPIMAGE and APPDIR
from the environment they inherit.

Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
The core spells paths as Z:\home\x\..., which a Linux player should not read.
The Uninstall WrongGPU question and Settings row show /home/x/... instead.

Verified: ctest 22/22; the question's screenshot shows /home/... paths.
Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
The native launcher has no HTTP client, so the OptiScaler edition download and
the release check could only fail with a network error. DownloadsAvailable() is
false natively: the edition fetch and the release check answer in plain words at
once, Settings' OptiScaler row asks for the player's own OptiScaler download,
and the release check row has no switch or address field (it says it is off on
Linux and to get the new AppImage by hand). Windows and Wine are unchanged.
ui-dump also writes the whole Settings page as settings-tall.png.

Verified: ctest 22/22 with new posix-layer and ui checks; they fail when
downloads are switched on.

Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
The old check only compared $APPDIR with the running program, both from the environment, so a valid WrongGPU AppImage elsewhere
could be deleted instead of the one that was started, and a file renamed into the path after the check was deleted unchecked.

Now $APPIMAGE, $APPDIR and the running program are canonicalized case-sensitively, and the system itself ties them together:
$APPDIR must be a FUSE mount in /proc/self/mountinfo that the program runs on, and a live process whose executable has the same
st_dev/st_ino as the AppImage file must hold that mount's /dev/fuse connection (fuse_connection in its fdinfo). That is how the
pinned type2 runtime mounts: it serves the mount from its own file. No proof (unpacked AppImage, unreadable /proc) refuses.
The file's identity and header are kept, re-checked just before the delete, and the file goes before the data; a game still
using the data is looked for before the file goes.

Tests: a fake process folder (WRONGGPU_TEST_PROC_ROOT, test builds only) in the posix layer tests, the launcher verbs suite and the
UI tests; a valid AppImage elsewhere, a copy, a file renamed in after the check, a link put in the path, data-folder root and
nested links. Each check was broken once and went red (logs/appimage-fix-red*.log), then green. Verified on the real runtime:
the built test AppImage refuses another AppImage, an unpacked run and a case-variant $APPDIR, and uninstalls itself.

Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
…inux

The toolbar line still said only "Direct3D 12" for an RDNA 4 card, while the first-run sheet already said "(through Proton)".
GpuToolbarLine now picks the Proton wording only when NativeLinux() is true; Windows and Wine keep the old string.

Tests: native assertions in posix_layer_tests (RDNA 4, other card, no card); the wg-core check expects the Proton string natively and
the old one elsewhere. With the Proton branch removed both native checks failed (logs/toolbar-red.log), restored: green.

Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
Settings and the Engine.ini "Myself" steps still spoke Windows on the native Linux launcher:
- Appearance: "the desktop's light or dark setting" instead of "Windows' app mode" (the launcher cannot read the desktop's setting
  yet, so the row says what it uses for now)
- Accent colour: no Windows swatch (six swatches); a saved "windows" accent shows green
- "Settings and logs" shows the data folder as /home/... (new wg::ShownPath, also used by the uninstall question)
- Engine.ini "Myself": file manager, a text editor, and making the file read-only through its permissions (game page, the CLI's steps,
  the can't-read texts). Proton terms such as "Windows user folder" and Steam's own launch-option steps are kept.
Windows and Wine keep every old string (NativeLinux() gates each one).

Tests: native assertions for the exact strings in run_linux_ui_tests.py (Settings with and without an AppImage, the Myself frames),
run_launcher_tests.py (CLI steps, window rows), the unproven-AppImage UI test now in the default list. With the native branches
removed these failed (logs/ui-fix3-red.log, logs/launcher-native-fix3-red.log), restored: green. Before/after pictures in
build/launcher-step4/shots/fix/.

Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
…n unreadable sysfs file

The review's smaller test gaps for S1 and S3:
- a cut-off, binary and empty libraryfolders.vdf finds nothing and does not break the Proton prefix search; the good list works again
- a pfx whose Windows user is not steamuser is not a prefix WrongGPU knows, and no steamuser folder is made in it
- a sysfs file the system will not let the program open (chmod 000) is skipped, a different failure from garbage text; the only card
  being unreadable gives no GPU, no crash

Checked to be able to fail: reading an unreadable sysfs file as an AMD id fails the new GPU check; accepting any users folder fails the
prefix checks (at the earlier "found by app id" check, before the new one); feeding the good list as a "malformed" one fails the vdf
check (logs/gaps-red.log). Restored: green.

Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
… AppImage row, first run)

Native Linux only; Windows and Wine strings are unchanged.
- A non-Steam game's card gives a command the player can run: the real
  $APPIMAGE path (this program's own path outside an AppImage) and the
  game's exe, shell-quoted, in a code box with a Copy button; "Wine prefix"
  wording gone.
- Settings "Launcher install": status "Runs from an AppImage", the file and
  the data folder named once, "Uninstall WrongGPU from your games first."
  when a game has WrongGPU. The side label says "AppImage", not "Not installed".
- The AppImage uninstall puts the player's ignore-files.txt back
  (RemoveSharedData), so the dialog and the row say "Your ignore-files.txt
  list is kept." when there is one.
- First run with no card: "No graphics card found. ..."; a long check label
  ("Graphics card detected") no longer has the next row drawn over it.
- Appearance row shows its Linux caveat whatever is chosen; the HIP row says
  Model M runs through Proton's Direct3D 12.
- ui-dump saves a picture of the first-run sheet with Show details open.

Verified: new linux-ui-wording ctest (red with six strings broken, then green);
native ctest 23/23; MinGW WrongGPU.exe builds; check_wording, check_source_size,
check_line_endings pass.

Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
…; the list and warning follow the uninstall

The command is headed by the proven AppImage (the same proof the uninstall uses, in its Linux spelling) or else the running
program, never an inherited $APPIMAGE. EnvVar no longer drops a value longer than 1040 characters. The card says how to quote
a folder that has an apostrophe. The ignore-list promise is made only for a plain file, and the "games first" warning uses the
uninstall's own look (registered and managed games). The headless clipboard stand-in now keeps what was set.

Verified: native ctest 24/24 (tests follow in the next commits).

Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
…bar says AppImage; Linux-only diagnostics

Settings uses AppDataPath (not a --data override) for the folder and the list check, the preflight for the warning, and a
separate "runs inside an AppImage" check for the sidebar and the row's status (the uninstall button keeps the strict proof).
The new ui-dump keys and picture, the ui-render dialog's list sentence and the Copy action are gated by NativeLinux(), so
Windows and Wine output is unchanged. ui-dump now also records the Copy click's clipboard text and the live dialog's text.

Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
…l UI states

New linux-ui-codexfix test: the Q4 command from the Copy click (proven, apostrophe, long path, own-file fallback, inherited
variable), the Settings row and the live dialog text (registered game outside the libraries, --data, linked list), the sidebar
without a mount proof, the expanded sheet picture, the HIP Found row and the Light caveat. The wording test now checks the
card's complete texts.

Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
… look off the paint thread

The Windows-folder command and the AppImage checks read the running file from /proc/self/exe (HostSelfPath) instead of a round trip through the core's spelling, so a long path is not cut and a literal backslash in a Linux name stays one. SelfPath grows its buffer until the name fits. In the live window, Settings' 'uninstall from your games first' look runs on a worker and the page is drawn again when it finishes, so a game on an offline share cannot hold the painting; the dumps and offscreen frames still look at once, and the Uninstall button looks again itself.

Verified: native ctest 24/24; MinGW build of WrongGPU.exe; check_wording, check_source_size, check_line_endings, check_portable.
Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
… Uninstall question, whole

The live window's dump carries the open dialog's title and body. New checks: this program run from a path over 600 characters and from a folder with a backslash in its name names its real file in the command and gets the AppImage label inside its AppImage folder; a click on Uninstall in the live window shows the whole question (and Cancel deletes nothing).

Red/green: with the command and label back on the core's spelling, the backslash checks fail; with SelfPath's fixed buffer as well, the long-path check fails; with a different live question, the live check fails. Restored: all pass.

Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
…inux launcher

clean/installer/CMakeLists.txt conflicted with phantoslayer21#291: main links rstrtmgr for
non-MSVC test builds, while this branch already names rstrtmgr for every
WIN32 build of wg_core (record.cpp's #pragma comment(lib) is read by MSVC
only). The branch's version is kept; it covers phantoslayer21#291's case.

Verified: fresh Linux build (WRONGGPU_TESTING=ON, Release, Ninja), ctest
24/24 passed, launcher-native included.

Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants