diff --git a/public/locales/en/translation.json b/public/locales/en/translation.json index 394060d27a..7ef0ccfdd4 100644 --- a/public/locales/en/translation.json +++ b/public/locales/en/translation.json @@ -318,6 +318,7 @@ }, "general": "Sync with EGL if you have a working installation of the Epic Games Launcher elsewhere and want to import your games to avoid downloading them again.", "mangohud": "MangoHUD is an overlay that displays and monitors FPS, temperatures, CPU/GPU load and other system resources.", + "msync": "Msync aims to reduce wineserver overhead in CPU-intensive games. Enabling may improve performance on supported Linux kernels.", "other": { "part4": "Use the ", "part5": "Game Arguments", @@ -655,6 +656,7 @@ "maxRecentGames": "Played Recently to Show", "maxworkers": "Maximum Number of Workers when downloading", "minimize-on-launch": "Minimize Heroic After Game Launch", + "msync": "Enable Msync", "offlinemode": "Run Game Offline", "prefered_language": "Prefered Language (Language Code)", "preferSystemLibs": "Prefer system libraries", diff --git a/src/backend/config.ts b/src/backend/config.ts index a1a1907827..8e2dde34ea 100644 --- a/src/backend/config.ts +++ b/src/backend/config.ts @@ -313,6 +313,7 @@ class GlobalConfigV0 extends GlobalConfig { wineVersion: defaultWine, enableEsync: true, enableFsync: isLinux, + enableMsync: isMac, eacRuntime: isLinux, battlEyeRuntime: isLinux, framelessWindow: false diff --git a/src/backend/game_config.ts b/src/backend/game_config.ts index a4c295e66d..c7a8c59c10 100644 --- a/src/backend/game_config.ts +++ b/src/backend/game_config.ts @@ -213,6 +213,7 @@ class GameConfigV0 extends GameConfig { autoSyncSaves, enableEsync, enableFSR, + enableMsync, enableFsync, maxSharpness, launcherArgs, @@ -242,6 +243,7 @@ class GameConfigV0 extends GameConfig { preferSystemLibs, autoSyncSaves, enableEsync, + enableMsync, enableFSR, enableFsync, maxSharpness, diff --git a/src/backend/launcher.ts b/src/backend/launcher.ts index 0a0181bf0b..e53e8ccf97 100644 --- a/src/backend/launcher.ts +++ b/src/backend/launcher.ts @@ -569,10 +569,17 @@ function setupWineEnvVars(gameSettings: GameSettings, gameId = '0') { if (!gameSettings.enableEsync && wineVersion.type === 'proton') { ret.PROTON_NO_ESYNC = '1' } - if (gameSettings.enableFsync && wineVersion.type !== 'proton') { + if (gameSettings.enableMsync && isMac) { + ret.WINEMSYNC = '1' + // This is to solve a problem with d3dmetal + if (wineVersion.type === 'toolkit') { + ret.WINEESYNC = '1' + } + } + if (isLinux && gameSettings.enableFsync && wineVersion.type !== 'proton') { ret.WINEFSYNC = '1' } - if (!gameSettings.enableFsync && wineVersion.type === 'proton') { + if (isLinux && !gameSettings.enableFsync && wineVersion.type === 'proton') { ret.PROTON_NO_FSYNC = '1' } if (wineVersion.type === 'proton') { @@ -585,14 +592,18 @@ function setupWineEnvVars(gameSettings: GameSettings, gameId = '0') { ret.PROTON_DISABLE_NVAPI = '1' } } - if (gameSettings.autoInstallDxvkNvapi && wineVersion.type === 'wine') { + if ( + isLinux && + gameSettings.autoInstallDxvkNvapi && + wineVersion.type === 'wine' + ) { ret.DXVK_ENABLE_NVAPI = '1' ret.DXVK_NVAPI_ALLOW_OTHER_DRIVERS = '1' } - if (gameSettings.eacRuntime) { + if (isLinux && gameSettings.eacRuntime) { ret.PROTON_EAC_RUNTIME = join(runtimePath, 'eac_runtime') } - if (gameSettings.battlEyeRuntime) { + if (isLinux && gameSettings.battlEyeRuntime) { ret.PROTON_BATTLEYE_RUNTIME = join(runtimePath, 'battleye_runtime') } if (wineVersion.type === 'proton') { diff --git a/src/common/types.ts b/src/common/types.ts index 6fba95bea7..82edcd7e5e 100644 --- a/src/common/types.ts +++ b/src/common/types.ts @@ -171,6 +171,7 @@ export interface GameSettings { enableDXVKFpsLimit: boolean enableEsync: boolean enableFSR: boolean + enableMsync: boolean enableFsync: boolean gamescope: GameScopeSettings enviromentOptions: EnviromentVariable[] diff --git a/src/frontend/screens/Settings/components/EnableMsync.tsx b/src/frontend/screens/Settings/components/EnableMsync.tsx new file mode 100644 index 0000000000..afa17e298a --- /dev/null +++ b/src/frontend/screens/Settings/components/EnableMsync.tsx @@ -0,0 +1,42 @@ +import ContextProvider from 'frontend/state/ContextProvider' +import React, { useContext } from 'react' +import { useTranslation } from 'react-i18next' +import SettingsContext from '../SettingsContext' +import useSetting from 'frontend/hooks/useSetting' +import { ToggleSwitch } from 'frontend/components/UI' +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' +import { faCircleInfo } from '@fortawesome/free-solid-svg-icons' + +const EnableMsync = () => { + const { t } = useTranslation() + const { platform } = useContext(ContextProvider) + const { isMacNative } = useContext(SettingsContext) + const isMac = platform === 'darwin' + const [enableMsync, setEnableMsync] = useSetting('enableMsync', false) + + if (!isMac || isMacNative) { + return <>> + } + + return ( +