Skip to content

Commit e374731

Browse files
authored
Mac msync (#3630)
* On (no branch): add_msync_backend * mac_msyncfe * fix_lint * Fix: PR Comments
1 parent c674e04 commit e374731

File tree

8 files changed

+67
-5
lines changed

8 files changed

+67
-5
lines changed

public/locales/en/translation.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@
318318
},
319319
"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.",
320320
"mangohud": "MangoHUD is an overlay that displays and monitors FPS, temperatures, CPU/GPU load and other system resources.",
321+
"msync": "Msync aims to reduce wineserver overhead in CPU-intensive games. Enabling may improve performance on supported Linux kernels.",
321322
"other": {
322323
"part4": "Use the ",
323324
"part5": "Game Arguments",
@@ -655,6 +656,7 @@
655656
"maxRecentGames": "Played Recently to Show",
656657
"maxworkers": "Maximum Number of Workers when downloading",
657658
"minimize-on-launch": "Minimize Heroic After Game Launch",
659+
"msync": "Enable Msync",
658660
"offlinemode": "Run Game Offline",
659661
"prefered_language": "Prefered Language (Language Code)",
660662
"preferSystemLibs": "Prefer system libraries",

src/backend/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,7 @@ class GlobalConfigV0 extends GlobalConfig {
313313
wineVersion: defaultWine,
314314
enableEsync: true,
315315
enableFsync: isLinux,
316+
enableMsync: isMac,
316317
eacRuntime: isLinux,
317318
battlEyeRuntime: isLinux,
318319
framelessWindow: false

src/backend/game_config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ class GameConfigV0 extends GameConfig {
213213
autoSyncSaves,
214214
enableEsync,
215215
enableFSR,
216+
enableMsync,
216217
enableFsync,
217218
maxSharpness,
218219
launcherArgs,
@@ -242,6 +243,7 @@ class GameConfigV0 extends GameConfig {
242243
preferSystemLibs,
243244
autoSyncSaves,
244245
enableEsync,
246+
enableMsync,
245247
enableFSR,
246248
enableFsync,
247249
maxSharpness,

src/backend/launcher.ts

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -569,10 +569,17 @@ function setupWineEnvVars(gameSettings: GameSettings, gameId = '0') {
569569
if (!gameSettings.enableEsync && wineVersion.type === 'proton') {
570570
ret.PROTON_NO_ESYNC = '1'
571571
}
572-
if (gameSettings.enableFsync && wineVersion.type !== 'proton') {
572+
if (gameSettings.enableMsync && isMac) {
573+
ret.WINEMSYNC = '1'
574+
// This is to solve a problem with d3dmetal
575+
if (wineVersion.type === 'toolkit') {
576+
ret.WINEESYNC = '1'
577+
}
578+
}
579+
if (isLinux && gameSettings.enableFsync && wineVersion.type !== 'proton') {
573580
ret.WINEFSYNC = '1'
574581
}
575-
if (!gameSettings.enableFsync && wineVersion.type === 'proton') {
582+
if (isLinux && !gameSettings.enableFsync && wineVersion.type === 'proton') {
576583
ret.PROTON_NO_FSYNC = '1'
577584
}
578585
if (wineVersion.type === 'proton') {
@@ -585,14 +592,18 @@ function setupWineEnvVars(gameSettings: GameSettings, gameId = '0') {
585592
ret.PROTON_DISABLE_NVAPI = '1'
586593
}
587594
}
588-
if (gameSettings.autoInstallDxvkNvapi && wineVersion.type === 'wine') {
595+
if (
596+
isLinux &&
597+
gameSettings.autoInstallDxvkNvapi &&
598+
wineVersion.type === 'wine'
599+
) {
589600
ret.DXVK_ENABLE_NVAPI = '1'
590601
ret.DXVK_NVAPI_ALLOW_OTHER_DRIVERS = '1'
591602
}
592-
if (gameSettings.eacRuntime) {
603+
if (isLinux && gameSettings.eacRuntime) {
593604
ret.PROTON_EAC_RUNTIME = join(runtimePath, 'eac_runtime')
594605
}
595-
if (gameSettings.battlEyeRuntime) {
606+
if (isLinux && gameSettings.battlEyeRuntime) {
596607
ret.PROTON_BATTLEYE_RUNTIME = join(runtimePath, 'battleye_runtime')
597608
}
598609
if (wineVersion.type === 'proton') {

src/common/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ export interface GameSettings {
171171
enableDXVKFpsLimit: boolean
172172
enableEsync: boolean
173173
enableFSR: boolean
174+
enableMsync: boolean
174175
enableFsync: boolean
175176
gamescope: GameScopeSettings
176177
enviromentOptions: EnviromentVariable[]
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import ContextProvider from 'frontend/state/ContextProvider'
2+
import React, { useContext } from 'react'
3+
import { useTranslation } from 'react-i18next'
4+
import SettingsContext from '../SettingsContext'
5+
import useSetting from 'frontend/hooks/useSetting'
6+
import { ToggleSwitch } from 'frontend/components/UI'
7+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
8+
import { faCircleInfo } from '@fortawesome/free-solid-svg-icons'
9+
10+
const EnableMsync = () => {
11+
const { t } = useTranslation()
12+
const { platform } = useContext(ContextProvider)
13+
const { isMacNative } = useContext(SettingsContext)
14+
const isMac = platform === 'darwin'
15+
const [enableMsync, setEnableMsync] = useSetting('enableMsync', false)
16+
17+
if (!isMac || isMacNative) {
18+
return <></>
19+
}
20+
21+
return (
22+
<div className="toggleRow">
23+
<ToggleSwitch
24+
htmlId="msyncToggle"
25+
value={enableMsync || false}
26+
handleChange={() => setEnableMsync(!enableMsync)}
27+
title={t('setting.msync', 'Enable Msync')}
28+
/>
29+
30+
<FontAwesomeIcon
31+
className="helpIcon"
32+
icon={faCircleInfo}
33+
title={t(
34+
'help.msync',
35+
'Msync aims to reduce wineserver overhead in CPU-intensive games. Enabling may improve performance on supported Linux kernels.'
36+
)}
37+
/>
38+
</div>
39+
)
40+
}
41+
42+
export default EnableMsync

src/frontend/screens/Settings/components/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export { default as EacRuntime } from './EacRuntime'
2020
export { default as EgsSettings } from './EgsSettings'
2121
export { default as EnableEsync } from './EnableEsync'
2222
export { default as EnableFSR } from './EnableFSR'
23+
export { default as EnableMsync } from './EnableMsync'
2324
export { default as EnableFsync } from './EnableFsync'
2425
export { default as Gamescope } from './Gamescope'
2526
export { default as EnvVariablesTable } from './EnvVariablesTable'

src/frontend/screens/Settings/sections/GamesSettings/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
EnableEsync,
1515
EnableFSR,
1616
EnableFsync,
17+
EnableMsync,
1718
EnvVariablesTable,
1819
GameMode,
1920
LauncherArgs,
@@ -201,6 +202,7 @@ export default function GamesSettings() {
201202
)}
202203
<EnableEsync />
203204
<EnableFsync />
205+
<EnableMsync />
204206
<EnableFSR />
205207
<EnableDXVKFpsLimit />
206208
<Tools />

0 commit comments

Comments
 (0)