Skip to content

feat(launcher): Wine/Proton compatibility for the FiveM client#4050

Open
Amzi-01 wants to merge 1 commit into
citizenfx:masterfrom
Amzi-01:wine-proton-fix
Open

feat(launcher): Wine/Proton compatibility for the FiveM client#4050
Amzi-01 wants to merge 1 commit into
citizenfx:masterfrom
Amzi-01:wine-proton-fix

Conversation

@Amzi-01

@Amzi-01 Amzi-01 commented Jun 27, 2026

Copy link
Copy Markdown
  • Add CfxIsProton() helper (detects Wine + Steam Proton env vars)
  • Remove Wine-forced insecure mode from ComponentLoader; only ARM (xtajit64.dll) still forces sticky.dll
  • Add WineCompat.Win32.cpp: installs a GetProcAddress hook before legitimacy.dll and adhesive.dll load, returning nullptr for wine_get_version/wine_get_build_id/wine_get_host_version so those components do not detect Wine and alter their behaviour
  • DllGameComponent: graceful sticky.dll fallback if adhesive fails to load under Wine, instead of a hard crash
  • EarlyMode: call WineCompat_InstallHooks() before any component loads
  • Launcher stability fixes under Wine: skip SetProcessMitigationPolicy, EarlyLdrBlock (NVIDIA GameFilter), cross-process MiniDump operations, CLSID_TaskbarList, and false "outdated Windows" OS version warning
  • GameSelect: auto-detect GTA V path via STEAM_COMPAT_INSTALL_PATH; fall back to GetOpenFileNameW when IFileDialog fails under Wine
  • ViabilityChecks: skip MediaFeatureCheck under Wine (stub mfreadwrite)

Goal of this PR

Allow the FiveM client launcher to start and run reliably under Wine/Proton on Linux. Currently several launcher and component code paths either assume a native Windows environment or deliberately change behaviour when Wine is detected, which leads to hard crashes, forced insecure mode, and a number of spurious failures/warnings. This PR makes the launcher Wine-aware so Linux users get a working, secure client without affecting native Windows behaviour.

How is this PR achieving the goal

The core of the change is a small compatibility layer that runs before any anti-cheat/legitimacy component loads:

  • A CfxIsProton() helper centralises Wine/Proton detection (Wine env + Steam Proton env vars).
  • WineCompat.Win32.cpp installs a GetProcAddress hook early (called from EarlyMode via WineCompat_InstallHooks()) that returns nullptr for wine_get_version / wine_get_build_id / wine_get_host_version, so legitimacy.dll no longer special-cases Wine.
  • The previous Wine-forced insecure mode in ComponentLoader is removed — only ARM (xtajit64.dll) still forces sticky.dll. DllGameComponent now falls back to sticky.dll gracefully if adhesive.dll fails to load under Wine instead of crashing.
  • Launcher-side stability fixes guard a set of Windows-only operations that fail or misbehave under Wine: SetProcessMitigationPolicy, EarlyLdrBlock (NVIDIA GameFilter), cross-process MiniDump operations, CLSID_TaskbarList, the false "outdated Windows" version warning, and MediaFeatureCheck in ViabilityChecks (stub mfreadwrite).
  • GameSelect auto-detects the GTA V install path from STEAM_COMPAT_INSTALL_PATH and falls back to GetOpenFileNameW when IFileDialog fails under Wine.

All Wine-specific behaviour is gated behind the detection helper, so native Windows paths are unchanged.

This PR applies to the following area(s)

FiveM, Launcher

Successfully tested on

Game builds: 3258
Platforms: Windows, Linux

Checklist

  • Code compiles and has been tested successfully.
  • Code explains itself well and/or is documented.
  • My commit message explains what the changes do and what they are for.
  • No extra compilation warnings are added by these changes.

Fixes issues

AI disclosure

Claude (Anthropic) was used solely for code review purposes. All code was written and tested by me; no code in this PR was authored by an AI.

- Add CfxIsProton() helper (detects Wine + Steam Proton env vars)
- Remove Wine-forced insecure mode from ComponentLoader; only ARM
  (xtajit64.dll) still forces sticky.dll
- Add WineCompat.Win32.cpp: installs a GetProcAddress hook before
  legitimacy.dll and adhesive.dll load, returning nullptr for
  wine_get_version/wine_get_build_id/wine_get_host_version so those
  components do not detect Wine and alter their behaviour
- DllGameComponent: graceful sticky.dll fallback if adhesive fails to
  load under Wine, instead of a hard crash
- EarlyMode: call WineCompat_InstallHooks() before any component loads
- Launcher stability fixes under Wine: skip SetProcessMitigationPolicy,
  EarlyLdrBlock (NVIDIA GameFilter), cross-process MiniDump operations,
  CLSID_TaskbarList, and false "outdated Windows" OS version warning
- GameSelect: auto-detect GTA V path via STEAM_COMPAT_INSTALL_PATH;
  fall back to GetOpenFileNameW when IFileDialog fails under Wine
- ViabilityChecks: skip MediaFeatureCheck under Wine (stub mfreadwrite)

Binary analysis of adhesive.dll confirmed: no kernel driver, no Wine
detection, fully userspace V8-based anti-cheat. legitimacy.dll is the
only component that checks wine_get_version, which the GetProcAddress
hook addresses.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions github-actions Bot added the invalid Requires changes before it's considered valid and can be (re)triaged label Jun 27, 2026
@Amzi-01 Amzi-01 changed the title Improve Wine/Proton compatibility for the FiveM client launcher feat: Improve Wine/Proton compatibility for the FiveM client launcher Jun 27, 2026
@Amzi-01 Amzi-01 changed the title feat: Improve Wine/Proton compatibility for the FiveM client launcher feat(launcher): Wine/Proton compatibility for the FiveM client Jun 27, 2026
@Gogsi

Gogsi commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

A few months ago I implemented only the bare minimum changes to get FiveM to launch in insecure mode here Gogsi@8ef2fcc. Those changes were:

  • Disabling the new Updater UI (TenUI), instead falling back to the simple Windows 8 update dialog. The lack of WindowsXamlManager made me not even bother with getting TenUI to work, when I noticed that the old code still exists.

  • Disabling the RtlLookupFunctionTable patch in SEHTableHandler.Win32.cpp. This just enables a debugging feature and it's an undocumented, memory layout-dependent patch, so I got rid of it.

  • Disabling the NtGlobalFlag patch in DllGameComponent.Win32.cpp. Another memory layout-dependent debug feature.

With those changes the game launched fine in insecure mode, tested on both latest wine-staging and Proton-GE 10.17 and Proton-CachyOS latest on multiple devices in May 2026.

Your PR has some nice improvements like disabling the Nvidia Game Filters (the check didn't exist when I wrote my code), improving the file selection dialog (it was kind of broken in my branch) and disabling more incompatible patches with the dump server. I'm not sure to the extent that you have tested it, but I don't think forgoing base Wine is a good idea, even if Proton is universally accepted to be "better" for games.

I recommend you also incorporate this patch which enables NUI Shared Resources/Texture on Wine, as later versions have support for it. This will greatly improve UI rendering and it removed the weird artifacting in the main menu I experienced in my tests.

What likely won't get merged any time soon is enabling adhesive under Wine/Proton. Even if it does load fine, which we can't know until it's tested, it is dangerous to enable, as anti-cheats often rely on subtle side effects to detect the presence of a cheat. Differences when running under Wine (such as different memory layout) can trigger detections even when you don't expect them to. It would take significant effort to test that no detection triggers unexpectedly and future detections would also need to be tested. We can wait for an official response from Cfx, but from the few private conversations I've had, it seem unlikely they would be willing to invest such effort, given the upcoming release of FiveM for GTA V Enhanced.

continue;
}

if (CfxIsWine() || GetModuleHandleW(L"xtajit64.dll") != nullptr)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't enable the Anticheat on Linux, so this edit needs to be removed.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adhesive and legitimacy dlls from my research are compatible with the latest versions of wine/proton my changes are designed to not interfere with windows versions at all im gathering this is more of a policy issue rather than a technical limitation? as there is quite a lot of people that would like to play FiveM on linux

@Amzi-01
Amzi-01 requested a review from radium-cfx June 29, 2026 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

invalid Requires changes before it's considered valid and can be (re)triaged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants