Repository navigation
Launcher: install for Proton games from under Wine - #105
Conversation
phantoslayer21
left a comment
There was a problem hiding this comment.
Thanks, this is the set we talked about, and the five-commit split makes it easy to read. I went through all ten files with one question first: does anything change on Windows? As far as reading shows, no. UnderWine() asks the loaded ntdll.dll for wine_get_version, every new path sits behind it, and the refusal, messages, RR state and written paths are the old ones when it is false. Good.
Three things before it goes in, all on the Wine side:
-
The game page still offers Prepare under Wine, and the button does nothing.
RrKernelsInGamenow returns true under Wine, but the page picks its text from the raw game rule (clean/installer/src/app/ui_game.cpp, around 1649-1663;ui_rrprep.cpparound 209-212), so a game without its own rule shows "Not prepared yet" with a Prepare button, and clicking it returns at once. Please have the page useRrKernelsInGameand the first-start text. -
A failed path conversion is silent. When
wine_get_unix_file_nameis missing or the walk can't resolve anything,PathForGamePrefixreturns the launcher-prefixC:path and the install writes it without a word (util.cpp249-268,install.cpp342-343 and 493). The player then gets a game that finds no model and no hint why. Please log it and put a line in the install result saying the model path could not be made reachable from the game's prefix, with the path. A sentence in the docs that this relies onZ:mapping the Linux root in the game's prefix would help too. -
The PCI fallback can vouch for a card the game doesn't use. With an integrated GPU plus an RX 9000 card, the first match in
card0..card15sets the card as supported while the driver field still comes from an unrelated DXGI adapter (checks.cpp45-55, 87-90). I'm fine with the fallback itself; please make what it reports honest: don't carry the other adapter's driver over, say in the name or the check's text that the card was found through Linux's device list and not confirmed as the adapter in use, and enumerate the cards that exist rather than stopping at 16.
Smaller, your call:
- The sysfs test reads the real machine's sysfs and repeats the id list, so on a PC without one of the four cards a broken reader would pass. A reader that can be pointed at a made-up folder (ids, junk values, missing files, two GPUs) would make it a real test.
- The vkd3d rule under Wine applies to anything the existing fingerprint classifies as vkd3d, including by a marker string. That's the existing classifier, so I'm not asking for a change here, just noting it now turns a refusal into a note for those too.
- The checklist's clean-room box is unticked here. Your statement in #52 covers this pull request as well, so nothing to do; tick it if you want the page to say so.
CI is running on it now. The maintainer-side scan runs before merge as usual. And #52 is still waiting on its README changes whenever you get to it.
5094d30 to
a53c009
Compare
|
Thanks. All three are done and folded into the commits they belong to, so each commit still stands on its own. The branch is rebased on current main (4e0601b).
On your optional point: the device-list folder is now a parameter. Noted on the vkd3d classifier. Tested under GE-Proton 11-11's Wine, on main + #52 + this branch: wg-core 91, launcher-core 230, coexist-core 187, wizard-policy 18 checks. Each commit alone on top of the |
Under Wine (Linux) the launcher runs in one prefix and Proton runs each game in its own. model_dir and rr_model were written as C: paths of the launcher's prefix, which the game's prefix cannot reach. They are now Z: paths (PathForGamePrefix); Z: maps the Linux root in every prefix. A model_dir the player set stays. Folders that do not exist yet (the RR data's F\ before its first conversion) are handled by converting the deepest existing folder. Nothing changes on Windows: PathForGamePrefix returns the path unchanged outside Wine. Needs: "let the launcher tell when it runs under Wine". Verified under GE-Proton 11-11's Wine with an llvm-mingw build of the launcher's unit tests (clean/linux/run_wine_tests.py --tests launcher on a checkout with this change and its one dependency). The missing-folder check was seen to fail with the walk-up taken out. Launcher installs into generated test games, started with `proton run` under GE-Proton 11-11, Proton 11.0 and Proton-CachyOS, wrote model_dir=Z:\... and rr_model=Z:\...\F\model.wgcm. Not run on Windows. Review (phantoslayer21#105): a path that can't be made a Z: path (Wine's wine_get_unix_file_name missing, nothing resolvable) is logged and listed in the install result instead of being written silently; the installer README says this relies on Z: mapping the Linux root in the game's prefix. wg_core_tests checks that a path on an unmapped drive comes back unchanged under Wine. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
DetectGpu falls back to Linux's PCI ids (Z:\sys\class\drm\cardN\device) when Wine's DXGI names an RDNA 4 card after an older Radeon, so the launcher does not refuse a supported card under Wine. The sysfs files report a size of 4096 bytes, so they are read to the end of file. Nothing changes on Windows: the fallback runs only under Wine. Needs: "let the launcher tell when it runs under Wine". Verified under GE-Proton 11-11's Wine on an RX 9070 XT (launcher unit tests on a checkout with this change and its one dependency). The check was seen to fail with the RDNA 4 id list emptied. Not run on Windows. Review (phantoslayer21#105): every DRM card the folder lists is looked at, in number order (connectors skipped), not just card0..card15. The name says the card was found in Linux's device list and not confirmed as the adapter the game uses, and the other DXGI adapter's driver version is no longer carried over (left unknown). The device-list folder is a parameter, and wg_core_tests runs it on a made-up folder (an iGPU, another vendor, a junk value, a missing file, a connector, card 20, two RDNA 4 cards) on any host; that check failed with the old 16-card limit put back. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
Under Wine the launcher's RR prepare helper runs in the launcher's own prefix. It fills neither of the caches a Proton game reads at its first start: vkd3d-proton.cache in the game's working folder and Mesa's cache in Steam's shader cache folder for the game. Measured on copies of the game's caches: a start with only one of the two took the full time again, under 30 ms with both. So under Wine RrKernelsInGame is true, the game's page says the game prepares them at its first start, and PrepareRr logs why and returns 4 without running the helper. Nothing changes on Windows. Needs: "let the launcher tell when it runs under Wine". Verified: wg-core-tests under GE-Proton 11-11's Wine (InGame, PrepareRr returns 4) on a checkout with this change and its one dependency; the check was seen to fail with the Wine branch taken out. Not run on Windows. Review (phantoslayer21#105): the game page asks RrKernelsInGame too, so under Wine it shows "Prepared by the game at its first start (under Proton its shader caches are its own)" instead of a Prepare button that would do nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
The launcher's MinGW build of main fails in convert_ignore.cpp: unknown type FILE_ID_INFO. context.h includes <functional> before base.h, and MinGW's _mingw.h then sets _WIN32_WINNT to 0x601 (Windows 7), so base.h's "#ifndef _WIN32_WINNT ... 0x0A00" no longer applies and winbase.h hides the Windows 8+ declarations. MSVC's headers leave _WIN32_WINNT unset, so the Windows CI build is unaffected. CMake now defines _WIN32_WINNT=0x0A00 and WINVER=0x0A00 for MinGW builds, the value base.h already asks for, whatever a file includes first. Verified with llvm-mingw 20261104: convert_ignore.cpp alone has 2 errors without the definition and none with it. The launcher's unit tests under Wine (clean/linux/run_wine_tests.py --tests launcher, GE-Proton 11-11) pass on main with this change: wg-core 79, launcher-core 237, coexist-core 186, wizard-policy 18 checks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
UnderWine() reports whether the launcher runs under Wine (Linux, for example with Proton's Wine): Wine's ntdll exports wine_get_version. Nothing calls it yet. The Wine-specific launcher changes that follow (model paths, graphics card, vkd3d-proton note, RR prepare) each need only this commit, not each other. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
Under Wine (Linux) the launcher runs in one prefix and Proton runs each game in its own. model_dir and rr_model were written as C: paths of the launcher's prefix, which the game's prefix cannot reach. They are now Z: paths (PathForGamePrefix); Z: maps the Linux root in every prefix. A model_dir the player set stays. Folders that do not exist yet (the RR data's F\ before its first conversion) are handled by converting the deepest existing folder. Nothing changes on Windows: PathForGamePrefix returns the path unchanged outside Wine. Needs: "let the launcher tell when it runs under Wine". Verified under GE-Proton 11-11's Wine with an llvm-mingw build of the launcher's unit tests (clean/linux/run_wine_tests.py --tests launcher on a checkout with this change and its one dependency). The missing-folder check was seen to fail with the walk-up taken out. Launcher installs into generated test games, started with `proton run` under GE-Proton 11-11, Proton 11.0 and Proton-CachyOS, wrote model_dir=Z:\... and rr_model=Z:\...\F\model.wgcm. Not run on Windows. Review (phantoslayer21#105): a path that can't be made a Z: path (Wine's wine_get_unix_file_name missing, nothing resolvable) is logged and listed in the install result instead of being written silently; the installer README says this relies on Z: mapping the Linux root in the game's prefix. wg_core_tests checks that a path on an unmapped drive comes back unchanged under Wine. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
DetectGpu falls back to Linux's PCI ids (Z:\sys\class\drm\cardN\device) when Wine's DXGI names an RDNA 4 card after an older Radeon, so the launcher does not refuse a supported card under Wine. The sysfs files report a size of 4096 bytes, so they are read to the end of file. Nothing changes on Windows: the fallback runs only under Wine. Needs: "let the launcher tell when it runs under Wine". Verified under GE-Proton 11-11's Wine on an RX 9070 XT (launcher unit tests on a checkout with this change and its one dependency). The check was seen to fail with the RDNA 4 id list emptied. Not run on Windows. Review (phantoslayer21#105): every DRM card the folder lists is looked at, in number order (connectors skipped), not just card0..card15. The name says the card was found in Linux's device list and not confirmed as the adapter the game uses, and the other DXGI adapter's driver version is no longer carried over (left unknown). The device-list folder is a parameter, and wg_core_tests runs it on a made-up folder (an iGPU, another vendor, a junk value, a missing file, a connector, card 20, two RDNA 4 cards) on any host; that check failed with the old 16-card limit put back. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
On Windows the launcher refuses a game with vkd3d-proton in its folder, because there it replaces Windows' own Direct3D 12. Under Wine (Proton on Linux) vkd3d-proton is the game's Direct3D 12, and a newer copy next to the game is how a player gets one with dxil-spirv pull request #362, which WrongGPU's kernels need. Under Wine it is now a note, not a refusal. DXVK next to a game is still refused. This is a policy choice for the maintainer and can be left out on its own. Needs: "let the launcher tell when it runs under Wine". Verified: coexist-core-tests under GE-Proton 11-11's Wine (Inform) and the same fixture expects Refuse outside Wine. The check was seen to fail with the Wine branch taken out. Not run on Windows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
Under Wine the launcher's RR prepare helper runs in the launcher's own prefix. It fills neither of the caches a Proton game reads at its first start: vkd3d-proton.cache in the game's working folder and Mesa's cache in Steam's shader cache folder for the game. Measured on copies of the game's caches: a start with only one of the two took the full time again, under 30 ms with both. So under Wine RrKernelsInGame is true, the game's page says the game prepares them at its first start, and PrepareRr logs why and returns 4 without running the helper. Nothing changes on Windows. Needs: "let the launcher tell when it runs under Wine". Verified: wg-core-tests under GE-Proton 11-11's Wine (InGame, PrepareRr returns 4) on a checkout with this change and its one dependency; the check was seen to fail with the Wine branch taken out. Not run on Windows. Review (phantoslayer21#105): the game page asks RrKernelsInGame too, so under Wine it shows "Prepared by the game at its first start (under Proton its shader caches are its own)" instead of a Prepare button that would do nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
a53c009 to
86f1697
Compare
|
Rebased onto current
The clean-room box is ticked, as you said #52's statement covers this PR. The checklist line on documents now names the one README paragraph, which has no numbers in it. 🤖 Generated with Claude Code |
|
Sorry for the silence on this. Your answers from last night slipped past me. CI had also been waiting on a maintainer approval since your first push, because GitHub holds runs from first-time contributors. I've approved it, so it's running on 86f1697 now. I'm going through the six commits again today, including the MinGW build fix, which looks worth taking whether or not the rest lands. |
phantoslayer21
left a comment
There was a problem hiding this comment.
All three points from my review are done:
- The RR row asks
RrKernelsInGameand shows the first-start text with no Prepare button under Wine. - Both model-path writes go through
ModelPathForGame, so a failed conversion is logged, shown and listed in the install result. - The PCI fallback says where the card came from, says that it isn't confirmed as the game's adapter, and goes past card15.
Every runtime change sits behind UnderWine(), and the MinGW define in CMakeLists.txt doesn't reach MSVC builds. Each feature commit applies on its own on top of the Wine-detection commit, as you said.
Two small edge cases. Neither blocks this; a follow-up PR for either is welcome:
- The path walk can miss the drive root. In
util.cpp:259-263, withC:\missing\F\model.wgcmwhere onlyC:\exists, the walk stops atC:\missingand never triesC:\. The install then warns and writes the prefix-local path. Keeping the separator on the root, plus a test for that case, would fix it. - The host test stops at card15.
wg_core_tests.cpp:237-246still probes card0–15 itself, so it disagrees withLinuxRdna4Name()when the only card is card16 or later. Either drop that assertion or enumerate the same way. Unlikely on a real machine, but it contradicts the new enumeration.
Approving once CI finishes green.
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>
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>
What this changes and why
Fixes from #49, #50, #37 and #35.
On Linux, players run the launcher under Wine (Proton's), while Proton runs each game in a Wine prefix of its own. Four things made for Windows went wrong there. This PR fixes them as five commits after a build fix. The first of the five adds only a check, and each of the other four needs only that first one, so any of them can be dropped:
UnderWine(): Wine's ntdll exportswine_get_version. Nothing calls it on its own.model_dirandrr_modelwere written asC:paths of the launcher's prefix, which the game's own prefix cannot reach. They are nowZ:paths (PathForGamePrefix, through Wine'swine_get_unix_file_name);Z:maps the Linux root in every prefix.model_dirthe player set stays.F\before its first conversion) are handled by converting the deepest folder that exists.DetectGpufalls back toZ:\sys\class\drm\cardN\device\{vendor,device}: 0x1002 with 0x7550, 0x7551, 0x7590 or 0x7591.vkd3d-proton.cachein the game's folder, and Mesa's cache in Steam's shader cache folder for the game.Every new code path checks
UnderWine()first, so nothing changes on Windows.What each new or substantially changed file is based on
All own design, using Wine's documented exports (
wine_get_version,wine_get_unix_file_name), the Linux kernel's sysfs layout for PCI devices (/sys/class/drm/card*/device/vendor,device) and AMD's public PCI ids for the RX 9070 / 9060 family. The tests inwg_core_tests.cppandcoexist_tests.cppuse synthetic fixtures only.How it was tested
build:commit): the launcher's MinGW build of currentmainfails inconvert_ignore.cpp(unknown typeFILE_ID_INFO).context.hincludes<functional>beforebase.h, so MinGW's_mingw.hsets_WIN32_WINNTto Windows 7 first. CMake now definesbase.h's Windows 10 value for MinGW builds; MSVC builds are unchanged. It is first because the tests below need it; it stands on its own.launchertest of the Linux test-runner PR (Linux tests: run the D3D12 and launcher tests under Wine with a Proton install #52), under GE-Proton 11-11's Wine on an RX 9070 XT, onmainat c4390ff.mainplus the build fix: wg-core-tests 79, launcher-core-tests 237, coexist-core-tests 186, wizard-policy-tests 18 checks pass.proton runon a new empty prefix, with the graphics-card check on.model_dir=Z:\...andrr_model=Z:\...\F\model.wgcmwere written, and the install went through with vkd3d-proton next to the game.files/bin/wineon a new prefix does not start the launcher at all:libvkd3d-shader-1.dllis missing.check_wording.py,check_source_size.pyandtools/ci/check_line_endings.pypass.Outside this PR, and not used to write or check it: I ran Model M and Ray Reconstruction in Cyberpunk 2077 under Proton as a player does, with the model files WrongGPU's launcher converts on my PC from my own copy of the game's upscaler files. None of that data, or anything computed from it, is in this PR or in its tests. I mention it so you can judge it against the clean-room statement.
Checklist
CONTRIBUTING.md
for this and all my contributions (required once, in my first pull request).
Signed-off-by:line (git commit -s; Developer Certificate of Origin 1.1).REUSE.toml. (No new files.)binaries; no paths, user or machine names of my PC.
Z:paths under Wine, has no numbers in it.)🤖 Generated with Claude Code