Skip to content

Commit c600146

Browse files
committed
[Feat] Add better Compatibility layer support for Intel Macs
1 parent 8451368 commit c600146

File tree

5 files changed

+32
-6
lines changed

5 files changed

+32
-6
lines changed

src/backend/config.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ import {
1919
isWindows,
2020
getSteamCompatFolder,
2121
configStore,
22-
isLinux
22+
isLinux,
23+
isIntelMac
2324
} from './constants'
2425

2526
import { logError, logInfo, LogPrefix } from './logger/logger'
@@ -290,7 +291,7 @@ class GlobalConfigV0 extends GlobalConfig {
290291
enableUpdates: false,
291292
addDesktopShortcuts: false,
292293
addStartMenuShortcuts: false,
293-
autoInstallDxvk: isLinux,
294+
autoInstallDxvk: isLinux || isIntelMac,
294295
autoInstallVkd3d: isLinux,
295296
autoInstallDxvkNvapi: false,
296297
addSteamShortcuts: false,

src/backend/constants.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { spawnSync } from 'child_process'
2-
import { homedir, platform } from 'os'
2+
import { cpus, homedir, platform } from 'os'
33
import { join } from 'path'
44
import { parse } from '@node-steam/vdf'
55

@@ -36,6 +36,7 @@ const fontsStore = new TypeCheckedStoreBackend('fontsStore', {
3636
})
3737

3838
const isMac = platform() === 'darwin'
39+
const isIntelMac: boolean = isMac && cpus()[0].model.includes('Intel') // so we can have different behavior for Intel Macs
3940
const isWindows = platform() === 'win32'
4041
const isLinux = platform() === 'linux'
4142
const isSteamDeckGameMode = process.env.XDG_CURRENT_DESKTOP === 'gamescope'
@@ -270,6 +271,7 @@ export {
270271
installed,
271272
isFlatpak,
272273
isMac,
274+
isIntelMac,
273275
isWindows,
274276
isLinux,
275277
legendaryConfigPath,

src/backend/launcher.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { join, normalize } from 'path'
1212
import {
1313
defaultWinePrefix,
1414
flatPakHome,
15+
isIntelMac,
1516
isLinux,
1617
isMac,
1718
isWindows,
@@ -515,7 +516,8 @@ export async function validWine(
515516
const haveAll = necessary.every((binary) => existsSync(binary as string))
516517

517518
if (isMac && type === 'toolkit') {
518-
const isGPTKCompatible = await isMacSonomaOrHigher()
519+
const isMacOSUpToDate = await isMacSonomaOrHigher()
520+
const isGPTKCompatible: boolean = isMacOSUpToDate && !isIntelMac
519521
if (!isGPTKCompatible) {
520522
return false
521523
}

src/backend/utils/compatibility_layers.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
configPath,
44
getSteamLibraries,
55
icon,
6+
isIntelMac,
67
isLinux,
78
isMac,
89
isWindows,
@@ -624,7 +625,9 @@ export async function downloadDefaultWine() {
624625
const availableWine = wineDownloaderInfoStore.get('wine-releases', [])
625626

626627
// use Proton-GE type if on Linux and GPTK or Wine-Crossover if on Mac
627-
const isGPTKCompatible = isMac ? await isMacSonomaOrHigher() : false
628+
const isMacOSUpToDate = await isMacSonomaOrHigher()
629+
const isGPTKCompatible = isMac ? isMacOSUpToDate && !isIntelMac : false
630+
628631
const results = await Promise.all(
629632
availableWine.map(async (version) => {
630633
if (isLinux) {

src/frontend/screens/WineManager/index.tsx

+19-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ const configStore = new TypeCheckedStoreFrontend('wineManagerConfigStore', {
2626
export default React.memo(function WineManager(): JSX.Element | null {
2727
const { t } = useTranslation()
2828
const { refreshWineVersionInfo, platform } = useContext(ContextProvider)
29+
const isIntelMac = platform === 'darwin' && process.arch === 'x64'
2930
const isLinux = platform === 'linux'
3031

3132
const protonge: WineManagerUISettings = {
@@ -40,9 +41,26 @@ export default React.memo(function WineManager(): JSX.Element | null {
4041
enabled: !isLinux
4142
}
4243

44+
const wineCrossover: WineManagerUISettings = {
45+
type: 'Wine-Crossover',
46+
value: 'winecrossover',
47+
enabled: !isLinux
48+
}
49+
50+
const getDefaultRepository = (): WineManagerUISettings => {
51+
if (isLinux) {
52+
return protonge
53+
} else if (isIntelMac) {
54+
return wineCrossover
55+
} else {
56+
return gamePortingToolkit
57+
}
58+
}
59+
4360
const [repository, setRepository] = useState<WineManagerUISettings>(
44-
isLinux ? protonge : gamePortingToolkit
61+
getDefaultRepository()
4562
)
63+
4664
const [wineManagerSettings, setWineManagerSettings] = useState<
4765
WineManagerUISettings[]
4866
>([

0 commit comments

Comments
 (0)