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

[UX] Default to WineCrossover and DXVK on for Intel macs #4397

Merged
merged 1 commit into from
Mar 9, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 3 additions & 2 deletions src/backend/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ import {
isWindows,
getSteamCompatFolder,
configStore,
isLinux
isLinux,
isIntelMac
} from './constants'

import { logError, logInfo, LogPrefix } from './logger/logger'
Expand Down Expand Up @@ -290,7 +291,7 @@ class GlobalConfigV0 extends GlobalConfig {
enableUpdates: false,
addDesktopShortcuts: false,
addStartMenuShortcuts: false,
autoInstallDxvk: isLinux,
autoInstallDxvk: isLinux || isIntelMac,
autoInstallVkd3d: isLinux,
autoInstallDxvkNvapi: isLinux,
addSteamShortcuts: false,
Expand Down
4 changes: 3 additions & 1 deletion src/backend/constants.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { spawnSync } from 'child_process'
import { homedir } from 'os'
import { homedir, cpus } from 'os'
import { join, resolve } from 'path'
import { parse } from '@node-steam/vdf'

Expand Down Expand Up @@ -28,6 +28,7 @@ const fontsStore = new TypeCheckedStoreBackend('fontsStore', {
})

const isMac = process.platform === 'darwin'
const isIntelMac = isMac && cpus()[0].model.includes('Intel') // so we can have different behavior for Intel Mac
const isWindows = process.platform === 'win32'
const isLinux = process.platform === 'linux'
const isSteamDeckGameMode = process.env.XDG_CURRENT_DESKTOP === 'gamescope'
Expand Down Expand Up @@ -261,6 +262,7 @@ export {
isFlatpak,
isSnap,
isMac,
isIntelMac,
isWindows,
isLinux,
legendaryConfigPath,
Expand Down
9 changes: 7 additions & 2 deletions src/backend/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ import {
GITHUB_API,
isMac,
configStore,
isLinux
isLinux,
isIntelMac
} from './constants'
import {
appendGamePlayLog,
Expand Down Expand Up @@ -922,7 +923,11 @@ export async function downloadDefaultWine() {
if (isLinux) {
return version.type === 'GE-Proton'
} else if (isMac) {
return version.type === 'Game-Porting-Toolkit'
if (isIntelMac) {
return version.type === 'Wine-Crossover'
} else {
return version.type === 'Game-Porting-Toolkit'
}
}
return false
})
Expand Down
11 changes: 8 additions & 3 deletions src/frontend/screens/WineManager/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default function WineManager(): JSX.Element | null {
</p>
)

const { refreshWineVersionInfo, refreshing, platform } =
const { refreshWineVersionInfo, refreshing, platform, isIntelMac } =
useContext(ContextProvider)
const isLinux = platform === 'linux'

Expand All @@ -55,17 +55,22 @@ export default function WineManager(): JSX.Element | null {
value: 'gpt',
enabled: !isLinux
}
const wineCrossover: WineManagerUISettings = {
type: 'Wine-Crossover',
value: 'winecrossover',
enabled: !isLinux
}

const [repository, setRepository] = useState<WineManagerUISettings>(
isLinux ? protonge : gamePortingToolkit
isLinux ? protonge : isIntelMac ? wineCrossover : gamePortingToolkit
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think those double ternary are not clean, maybe a method for that would be better.

)
const [wineManagerSettings, setWineManagerSettings] = useState<
WineManagerUISettings[]
>([
protonge,
{ type: 'Wine-GE', value: 'winege', enabled: isLinux },
gamePortingToolkit,
{ type: 'Wine-Crossover', value: 'winecrossover', enabled: !isLinux }
wineCrossover
])

const getWineVersions = (repo: Type) => {
Expand Down
1 change: 1 addition & 0 deletions src/frontend/state/ContextProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const initialContext: ContextType = {
libraryTopSection: 'disabled',
handleLibraryTopSection: () => null,
platform: 'unknown',
isIntelMac: false,
refresh: async () => Promise.resolve(),
refreshLibrary: async () => Promise.resolve(),
refreshWineVersionInfo: async () => Promise.resolve(),
Expand Down
3 changes: 3 additions & 0 deletions src/frontend/state/GlobalState.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ interface StateProps {
libraryStatus: GameStatus[]
libraryTopSection: string
platform: NodeJS.Platform
isIntelMac: boolean
refreshing: boolean
refreshingInTheBackground: boolean
hiddenGames: HiddenGame[]
Expand Down Expand Up @@ -168,6 +169,8 @@ class GlobalState extends PureComponent<Props> {
libraryStatus: [],
libraryTopSection: globalSettings?.libraryTopSection || 'disabled',
platform: window.platform,
isIntelMac:
window.platform === 'darwin' && navigator.platform === 'MacIntel',
refreshing: false,
refreshingInTheBackground: true,
hiddenGames: configStore.get('games.hidden', []),
Expand Down
1 change: 1 addition & 0 deletions src/frontend/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export interface ContextType {
libraryTopSection: string
handleLibraryTopSection: (value: LibraryTopSectionOptions) => void
platform: NodeJS.Platform | 'unknown'
isIntelMac: boolean
refresh: (library: Runner, checkUpdates?: boolean) => Promise<void>
refreshLibrary: (options: RefreshOptions) => Promise<void>
refreshWineVersionInfo: (fetch: boolean) => void
Expand Down
Loading