Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mac msync #3630

Merged
merged 4 commits into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -654,6 +655,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",
Expand Down
1 change: 1 addition & 0 deletions src/backend/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ class GlobalConfigV0 extends GlobalConfig {
wineVersion: defaultWine,
enableEsync: true,
enableFsync: isLinux,
enableMsync: isMac,
eacRuntime: isLinux,
battlEyeRuntime: isLinux,
framelessWindow: false
Expand Down
21 changes: 16 additions & 5 deletions src/backend/launcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand All @@ -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') {
Expand Down
1 change: 1 addition & 0 deletions src/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ export interface GameSettings {
enableDXVKFpsLimit: boolean
enableEsync: boolean
enableFSR: boolean
enableMsync: boolean
flavioislima marked this conversation as resolved.
Show resolved Hide resolved
enableFsync: boolean
gamescope: GameScopeSettings
enviromentOptions: EnviromentVariable[]
Expand Down
42 changes: 42 additions & 0 deletions src/frontend/screens/Settings/components/EnableMsync.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<div className="toggleRow">
<ToggleSwitch
htmlId="msyncToggle"
value={enableMsync || false}
handleChange={() => setEnableMsync(!enableMsync)}
title={t('setting.msync', 'Enable Msync')}
/>

<FontAwesomeIcon
className="helpIcon"
icon={faCircleInfo}
title={t(
'help.msync',
'Msync aims to reduce wineserver overhead in CPU-intensive games. Enabling may improve performance on supported Linux kernels.'
)}
/>
</div>
)
}

export default EnableMsync
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import SyncSaves from '../SyncSaves'
import FooterInfo from '../FooterInfo'
import { Tabs, Tab } from '@mui/material'
import { GameInfo } from 'common/types'
import EnableMsync from '../../components/EnableMsync'
Mariaboni marked this conversation as resolved.
Show resolved Hide resolved

type TabPanelProps = {
children?: React.ReactNode
Expand Down Expand Up @@ -201,6 +202,7 @@ export default function GamesSettings() {
)}
<EnableEsync />
<EnableFsync />
<EnableMsync />
<EnableFSR />
<EnableDXVKFpsLimit />
<Tools />
Expand Down
Loading