diff --git a/public/locales/en/translation.json b/public/locales/en/translation.json index 955adcdcd..faebf0018 100644 --- a/public/locales/en/translation.json +++ b/public/locales/en/translation.json @@ -338,6 +338,7 @@ "store": "Filter Store" }, "help": { + "advertiseAvxForRosetta": "Enables AVX instruction set support when running Windows games through Rosetta on Apple Silicon Macs. This may be required for some games like Death Stranding that need AVX support.", "amdfsr": "AMD's FSR helps boost framerate by upscaling lower resolutions in Fullscreen Mode. Image quality increases from 5 to 1 at the cost of a slight performance hit. Enabling may improve performance.", "custom_themes_path": "Do not use CSS files from untrusted sources. When in doubt, ask for a review in our Discord channel.", "custom_themes_wiki": "Check the Wiki for more details on adding custom themes. Click here.", @@ -927,6 +928,7 @@ "addgamestoapplications": "Add games to Applications automatically", "addgamestostartmenu": "Add games to start menu automatically", "addgamestosteam": "Add games to Steam automatically", + "advertiseAvxForRosetta": "Advertise AVX for Rosetta", "autodxvk": "Auto Install/Update DXVK on Prefix", "autodxvknvapi": "Auto Install/Update DXVK-NVAPI on Prefix", "autoLaunchHyperPlay": "Auto Launch HyperPlay", diff --git a/src/backend/config.ts b/src/backend/config.ts index 38d56c08e..ba141af35 100644 --- a/src/backend/config.ts +++ b/src/backend/config.ts @@ -286,6 +286,8 @@ class GlobalConfigV0 extends GlobalConfig { // @ts-expect-error TODO: We need to settle on *one* place to define settings defaults return { + advertiseAvxForRosetta: + isMac && (defaultWine as WineInstallation)?.type === 'toolkit', checkUpdatesInterval: 10, enableUpdates: false, addDesktopShortcuts: false, diff --git a/src/backend/game_config.ts b/src/backend/game_config.ts index 4f33820e4..c56c83afb 100644 --- a/src/backend/game_config.ts +++ b/src/backend/game_config.ts @@ -206,6 +206,7 @@ class GameConfigV0 extends GameConfig { // The settings defined work as overrides. const { + advertiseAvxForRosetta, autoInstallDxvk, autoInstallVkd3d, preferSystemLibs, @@ -236,6 +237,7 @@ class GameConfigV0 extends GameConfig { const defaultSettings = { autoInstallDxvk, autoInstallVkd3d, + advertiseAvxForRosetta, preferSystemLibs, autoSyncSaves, enableEsync, @@ -288,8 +290,8 @@ class GameConfigV0 extends GameConfig { } } - public setSetting(key: string, value: unknown) { - this.config[key] = value + public setSetting(key: keyof GameSettings, value: unknown) { + this.config[key] = value as never logInfo(`${this.appName}: Setting ${key} to ${JSON.stringify(value)}`) return this.flush() } diff --git a/src/backend/launcher.ts b/src/backend/launcher.ts index 069778cd7..fbad97bcc 100644 --- a/src/backend/launcher.ts +++ b/src/backend/launcher.ts @@ -464,6 +464,12 @@ function setupWineEnvVars( ) } } + + // Set Rosetta AVX setting for macOS + if (isMac && gameSettings.advertiseAvxForRosetta) { + ret.ROSETTA_ADVERTISE_AVX = '1' + } + return ret } diff --git a/src/common/types.ts b/src/common/types.ts index f1e535b31..a72241a7a 100644 --- a/src/common/types.ts +++ b/src/common/types.ts @@ -191,6 +191,7 @@ export interface GameInfo { } export interface GameSettings { + advertiseAvxForRosetta: boolean autoInstallDxvk: boolean autoInstallVkd3d: boolean autoInstallDxvkNvapi: boolean diff --git a/src/frontend/screens/Settings/components/AdvertiseAvxForRosetta.tsx b/src/frontend/screens/Settings/components/AdvertiseAvxForRosetta.tsx new file mode 100644 index 000000000..2aba47529 --- /dev/null +++ b/src/frontend/screens/Settings/components/AdvertiseAvxForRosetta.tsx @@ -0,0 +1,48 @@ +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' +import { defaultWineVersion } from '..' + +const AdvertiseAvxForRosetta = () => { + const { t } = useTranslation() + const { platform } = useContext(ContextProvider) + const { isMacNative } = useContext(SettingsContext) + const isMac = platform === 'darwin' + const [wineVersion] = useSetting('wineVersion', defaultWineVersion) + const [advertiseAvxForRosetta, setAdvertiseAvxForRosetta] = useSetting( + 'advertiseAvxForRosetta', + false + ) + + // Only show on macOS when using toolkit wine and not native games + if (!isMac || isMacNative || wineVersion.type !== 'toolkit') { + return <>> + } + + return ( +