Skip to content

A games launcher for GOG, Amazon and Epic Games for Linux, Windows and macOS.

[macOS] Steam support through Aurelia (#6185)

Flávio Fearnf1f08d184c0c
diff --git a/meta/downloadHelperBinaries.ts b/meta/downloadHelperBinaries.ts
index 1ce172525..1e7b549b9 100644
--- a/meta/downloadHelperBinaries.ts
+++ b/meta/downloadHelperBinaries.ts
@@ -32,7 +32,7 @@ const RELEASE_TAGS = {
gogdl: 'v1.4.1',
nile: 'v1.2.0',
comet: 'v0.4.1',
- aurelia: 'v0.4.1',
+ aurelia: 'v0.5.1',
'epic-integration': 'v0.4',
// butler is distributed via itch.io's broth channel system rather than
// GitHub releases; "LATEST" resolves the channel's newest version at
@@ -323,10 +323,12 @@ async function downloadAurelia() {
{
x64: {
linux: 'aurelia_linux_x86_64',
+ darwin: 'aurelia_macos_x86_64',
win32: 'aurelia_windows_x86_64.exe'
},
arm64: {
linux: 'aurelia_linux_arm64',
+ darwin: 'aurelia_macos_arm64',
win32: 'aurelia_windows_arm64.exe'
}
}
diff --git a/public/locales/en/gamepage.json b/public/locales/en/gamepage.json
index 379277876..ae9d982b1 100644
--- a/public/locales/en/gamepage.json
+++ b/public/locales/en/gamepage.json
@@ -266,6 +266,7 @@
"space-after-install": "After Install",
"steam-no-libraries": "No Steam library folders found — add a drive in Steam first.",
"steam-path": "Install Path (Steam library)",
+ "steam-single-library": "This game will be installed on your Steam library",
"tabs": {
"ariaLabel": "Install sections",
"components": "Components",
diff --git a/public/locales/en/translation.json b/public/locales/en/translation.json
index 96713cdd1..61c7b9508 100644
--- a/public/locales/en/translation.json
+++ b/public/locales/en/translation.json
@@ -114,10 +114,13 @@
}
},
"steam": {
+ "exe-not-found": "The game executable was not found at {{path}}",
"language-change": "Could not change the language of {{game}}",
"language-change-unknown": "Aurelia gave no reason. The Steam log has details.",
+ "no-windows-build": "This Steam game has no Windows launch entry to start.",
"running": "Steam is running. Close Steam and try again, or restart Steam once to let Heroic manage shortcuts while Steam is running.",
- "running-gamemode": "A one-time Steam restart is required before Heroic can manage Steam shortcuts on this device. Restart Steam and try again."
+ "running-gamemode": "A one-time Steam restart is required before Heroic can manage Steam shortcuts on this device. Restart Steam and try again.",
+ "wine-not-ready": "Wine is not configured correctly for this game."
},
"steam-move-no-library": "Choose a Steam library folder to move the game to.",
"steam-platform-switch": {
@@ -246,6 +249,7 @@
"title": "Wine not found!"
}
},
+ "windowsSteamPrefix": "Select Windows Steam prefix folder",
"wineprefix": "Select WinePrefix folder",
"yes": "YES"
},
@@ -650,6 +654,18 @@
},
"favourites": "Favourites",
"game": {
+ "drm": {
+ "denuvo": "Denuvo",
+ "none": "No DRM found",
+ "noneHint": "No Steam DRM or third-party DRM notice found. This does not guarantee the game runs without Steam.",
+ "noSteam": "No Steam DRM",
+ "noSteamHint": "No Steam DRM wrapper found. Third-party DRM was not checked.",
+ "steam": "Steam DRM",
+ "steamHint": "Steam DRM wrapper detected. This game needs the Steam client.",
+ "steamworks": "Needs Steam",
+ "steamworksHint": "Steamworks API detected. This game may need the Steam client.",
+ "thirdParty": "Third-party DRM"
+ },
"modify": "Modify installation",
"settings": "Game settings",
"store": "Store",
@@ -1554,16 +1570,20 @@
"info": {
"host": "Host Steam: starts your installed Steam client silently in the background. Needed for online play, multiplayer and DRM.",
"none": "No Steam: starts the game without Steam. Online features and DRM-protected games may not work.",
- "runtime": "In-Wine Steam runtime: runs a separate Steam client inside Wine, for when Steam is not installed on your system."
+ "runtime": "Windows Steam: runs a separate Steam client inside Wine, for when Steam is not installed on your system."
},
- "installRuntime": "Install Steam runtime",
- "missingBuild": "not downloaded",
- "missingRuntime": "Steam runtime not installed",
+ "installDone": "Windows Steam installed. Sign in to it before launching.",
+ "installRuntime": "Install Windows Steam",
"native": "Native",
"none": "No Steam",
+ "opening": "Opening Windows Steam…",
+ "openingFailed": "Windows Steam did not open. Check the log and try again.",
"platformSwitchNote": "Switching platform downloads it on next launch.",
"platformSwitchNoteNow": "Switching platform downloads it when you close the settings.",
- "runtime": "In-Wine Steam runtime",
+ "runtime": "Windows Steam",
+ "signIn": "Sign in to Windows Steam",
+ "signInOpened": "Sign in in the Windows Steam window. This page will update automatically.",
+ "steamRunning": "Windows Steam is open. Sign in in that window.",
"title": "Game version to launch"
},
"steamPlatformSwitchInstall": "Download Steam game versions when switching",
@@ -1590,6 +1610,22 @@
"description": "Enable verbose logs",
"hint": "Record a detailed log on every launch, useful for reporting problems"
},
+ "windowsSteamPrefix": "Windows Steam prefix",
+ "windowsSteamRuntime": {
+ "checking": "Checking…",
+ "install": "Install Windows Steam",
+ "installDone": "Windows Steam installed. Sign in to it before launching.",
+ "loginOpened": "Sign in in the Windows Steam window, then refresh this page.",
+ "notInstalled": "Windows Steam is not installed. Install it to play Steam-DRM Windows games on macOS.",
+ "notSignedIn": "Windows Steam is installed but not signed in.",
+ "openFailed": "Could not open Windows Steam.",
+ "opening": "Opening Windows Steam…",
+ "openingFailed": "Windows Steam did not open. Check the log and try again.",
+ "ready": "Windows Steam is ready.",
+ "running": "Windows Steam is open. Sign in in that window.",
+ "signIn": "Sign in to Windows Steam",
+ "unsupported": "This Aurelia version does not support Windows Steam."
+ },
"winecfg": {
"description": "Open the Wine configuration panel for this prefix"
},
diff --git a/src/backend/storeManagers/steam/__tests__/drm.test.ts b/src/backend/storeManagers/steam/__tests__/drm.test.ts
new file mode 100644
index 000000000..82990b0f9
--- /dev/null
+++ b/src/backend/storeManagers/steam/__tests__/drm.test.ts
@@ -0,0 +1,74 @@
+import { mkdtempSync, rmSync, writeFileSync } from 'fs'
+import { tmpdir } from 'os'
+import { join } from 'path'
+import { detectSteamDrm, readPeSections } from '../drm'
+
+function peFile(sections: string[]): Buffer {
+ const buffer = Buffer.alloc(1024)
+ buffer.write('MZ', 0, 'latin1')
+ const pe = 0x80
+ buffer.writeUInt32LE(pe, 0x3c)
+ buffer.write('PE\0\0', pe, 'latin1')
+ buffer.writeUInt16LE(sections.length, pe + 6)
+ buffer.writeUInt16LE(0xe0, pe + 20)
+ let offset = pe + 24 + 0xe0
+ for (const section of sections) {
+ buffer.write(section, offset, 'latin1')
+ offset += 40
+ }
+ return buffer
+}
+
+describe('Steam DRM detection', () => {
+ let directory: string
+
+ beforeEach(() => {
+ directory = mkdtempSync(join(tmpdir(), 'heroic-drm-'))
+ })
+
+ afterEach(() => {
+ rmSync(directory, { recursive: true, force: true })
+ })
+
+ it('reads PE section names', () => {
+ const executable = join(directory, 'game.exe')
+ writeFileSync(executable, peFile(['.text', '.rdata']))
+ expect(readPeSections(executable)).toEqual(['.text', '.rdata'])
+ })
+
+ it('finds the SteamStub .bind section', () => {
+ const executable = join(directory, 'game.exe')
+ writeFileSync(executable, peFile(['.text', '.bind']))
+ expect(detectSteamDrm(directory, executable)).toMatchObject({
+ steamDrm: true,
+ scanned: true
+ })
+ })
+
+ it('reports no Steam DRM without .bind', () => {
+ const executable = join(directory, 'game.exe')
+ writeFileSync(executable, peFile(['.text', '.rdata']))
+ expect(detectSteamDrm(directory, executable)).toMatchObject({
+ steamDrm: false,
+ scanned: true
+ })
+ })
+
+ it('detects Steamworks DLLs next to the executable', () => {
+ const executable = join(directory, 'game.exe')
+ writeFileSync(executable, peFile(['.text']))
+ writeFileSync(join(directory, 'steam_api64.dll'), '')
+ expect(detectSteamDrm(directory, executable)).toMatchObject({
+ steamworks: true
+ })
+ })
+
+ it('does not scan non-PE files', () => {
+ const executable = join(directory, 'game.exe')
+ writeFileSync(executable, 'not a PE')
+ expect(detectSteamDrm(directory, executable)).toMatchObject({
+ steamDrm: false,
+ scanned: false
+ })
+ })
+})
diff --git a/src/backend/storeManagers/steam/__tests__/runtime_runner.test.ts b/src/backend/storeManagers/steam/__tests__/runtime_runner.test.ts
new file mode 100644
index 000000000..763b4a1a4
--- /dev/null
+++ b/src/backend/storeManagers/steam/__tests__/runtime_runner.test.ts
@@ -0,0 +1,49 @@
+import type { WineInstallation } from 'common/types'
+import { isGptkRunner, selectSteamRuntimeRunner } from '../runtime_runner'
+
+function wine(
+ name: string,
+ type: WineInstallation['type'],
+ bin = `/wines/${name}/bin/wine`
+): WineInstallation {
+ return { name, type, bin }
+}
+
+describe('Steam runtime runner', () => {
+ it('prefers a DXMT Wine over other builds', () => {
+ const candidate = selectSteamRuntimeRunner([
+ wine('Wine - 11.1', 'wine'),
+ wine('Wine - 11.5-DXMT', 'wine'),
+ wine('CrossOver - 26.3', 'crossover')
+ ])
+ expect(candidate?.name).toBe('Wine - 11.5-DXMT')
+ })
+
+ it('falls back to CrossOver when there is no DXMT build', () => {
+ const candidate = selectSteamRuntimeRunner([
+ wine('Wine - 11.5', 'wine'),
+ wine('CrossOver - 26.3', 'crossover')
+ ])
+ expect(candidate?.name).toBe('CrossOver - 26.3')
+ })
+
+ it('never selects GPTK', () => {
+ const candidate = selectSteamRuntimeRunner([
+ wine('Game-Porting-Toolkit - 4.0', 'toolkit'),
+ wine('Wine - 11.5', 'wine')
+ ])
+ expect(candidate?.name).toBe('Wine - 11.5')
+ expect(
+ selectSteamRuntimeRunner([wine('Game-Porting-Toolkit - 4.0', 'toolkit')])
+ ).toBeUndefined()
+ })
+
+ it('recognises a GPTK runner path', () => {
+ expect(
+ isGptkRunner('/heroic/tools/game-porting-toolkit/GPTK-4.0/bin/wine')
+ ).toBe(true)
+ expect(isGptkRunner('/heroic/tools/wine/Wine-11.5-DXMT/bin/wine')).toBe(
+ false
+ )
+ })
+})
diff --git a/src/backend/storeManagers/steam/__tests__/utils.test.ts b/src/backend/storeManagers/steam/__tests__/utils.test.ts
index 96eca67d2..23afcdb55 100644
--- a/src/backend/storeManagers/steam/__tests__/utils.test.ts
+++ b/src/backend/storeManagers/steam/__tests__/utils.test.ts
@@ -10,7 +10,7 @@ import { showDialogBoxModalAuto } from 'backend/dialog/dialog'
jest.mock('backend/launcher', () => ({ callRunner: jest.fn() }))
jest.mock('backend/utils', () => ({
- getAureliaBin: jest.fn(() => ({ dir: '', bin: 'aurelia' }))
+ getAureliaBin: () => ({ dir: '', bin: 'aurelia' })
}))
jest.mock('backend/logger', () => ({
logError: jest.fn(),
@@ -116,13 +116,19 @@ describe('pickLaunchTarget', () => {
})
describe('isSteamSupported', () => {
- const load = async (env: { isMac: boolean; isFlatpak: boolean }) => {
+ const load = async (
+ env: { isMac: boolean; isFlatpak: boolean },
+ aureliaExists = false
+ ) => {
let mod: typeof import('../utils') | undefined
await jest.isolateModulesAsync(async () => {
jest.doMock('backend/constants/environment', () => ({
isWindows: false,
...env
}))
+ jest.doMock('graceful-fs', () => ({
+ existsSync: () => aureliaExists
+ }))
mod = await import('../utils')
})
return mod!
@@ -138,8 +144,13 @@ describe('isSteamSupported', () => {
expect(utils.isSteamSupported()).toBe(false)
})
- it('is disabled on macOS', async () => {
+ it('is disabled on macOS without an Aurelia binary', async () => {
const utils = await load({ isMac: true, isFlatpak: false })
expect(utils.isSteamSupported()).toBe(false)
})
+
+ it('is supported on macOS when Aurelia is available', async () => {
+ const utils = await load({ isMac: true, isFlatpak: false }, true)
+ expect(utils.isSteamSupported()).toBe(true)
+ })
})
diff --git a/src/backend/storeManagers/steam/aurelia.ts b/src/backend/storeManagers/steam/aurelia.ts
index 88319cca2..44a5abe22 100644
--- a/src/backend/storeManagers/steam/aurelia.ts
+++ b/src/backend/storeManagers/steam/aurelia.ts
@@ -15,9 +15,13 @@ import type {
AureliaFeaturesResponse,
AureliaInfoResponse,
AureliaLibrariesResponse,
- AureliaProgressEvent
+ AureliaProgressEvent,
+ AureliaSteamRuntimeStatus
} from './aurelia_types'
-import type { SteamInstallLibrary } from 'common/types/steam'
+import type {
+ SteamInstallLibrary,
+ SteamWindowsRuntimeStatus
+} from 'common/types/steam'
export class AureliaError extends Error {
readonly aborted: boolean
@@ -670,6 +674,38 @@ export async function setSteamPlatformSwitchInstall(
return result.platform_switch_install
}
+/** The in-Wine Windows Steam runtime status. */
+export async function getSteamRuntimeStatus(): Promise<SteamWindowsRuntimeStatus> {
+ try {
+ const status = await runAurelia<AureliaSteamRuntimeStatus>([
+ 'steam-wine',
+ 'status'
+ ])
+ return {
+ installed: status.steam_exe_present,
+ loggedIn: status.logged_in,
+ savedLogin: status.saved_login ?? false,
+ running: status.running,
+ supported: status.supported,
+ runnerConfigured: status.steam_wine_runner_configured,
+ runnerPath: status.steam_wine_runner ?? undefined
+ }
+ } catch (error) {
+ logWarning(
+ ['Unable to read the Windows Steam runtime status', error],
+ LogPrefix.Steam
+ )
+ return {
+ installed: false,
+ loggedIn: false,
+ savedLogin: false,
+ running: false,
+ supported: false,
+ runnerConfigured: false
+ }
+ }
+}
+
/**
* Lists the Steam library folders
*/
diff --git a/src/backend/storeManagers/steam/aurelia_types.ts b/src/backend/storeManagers/steam/aurelia_types.ts
index 8c7048b90..bf721adc2 100644
--- a/src/backend/storeManagers/steam/aurelia_types.ts
+++ b/src/backend/storeManagers/steam/aurelia_types.ts
@@ -26,7 +26,7 @@ export interface AureliaInstallListEntry {
total_bytes?: number
percent?: number
status?: string
- /** Backlog only: `windows` or `linux`. */
+ /** Backlog only: `windows`, `linux` or `macos`. */
platform?: string
/** Backlog only: library root. */
library?: string
@@ -101,6 +101,7 @@ export interface AureliaInfoResponse {
tags?: string[]
metacritic?: number | null
website?: string | null
+ drm_notice?: string | null
requirements?: {
minimum?: string[]
recommended?: string[]
@@ -141,7 +142,22 @@ export interface AureliaLibrariesResponse {
libraries: Array<{ path: string; free_bytes: number | null }>
}
-interface AureliaLaunchOption {
+/** Result of `aurelia steam-wine status --json`. */
+export interface AureliaSteamRuntimeStatus {
+ root_dir: string
+ wine_prefix: string
+ layout_kind: string
+ steam_exe: string | null
+ steam_exe_present: boolean
+ logged_in: boolean
+ saved_login?: boolean
+ running: boolean
+ steam_wine_runner: string | null
+ steam_wine_runner_configured: boolean
+ supported: boolean
+}
+
+export interface AureliaLaunchOption {
id: string | number
description?: string
executable?: string
@@ -198,12 +214,12 @@ export interface AureliaCapabilitiesResponse {
/** One entry from `aurelia launch-targets <id> --json`. */
export interface AureliaLaunchTarget {
id: string
- platform: 'linux' | 'windows'
- steam_mode: 'runtime' | 'host' | 'none' | null
+ platform: 'linux' | 'macos' | 'windows'
+ steam_mode: 'wine' | 'host' | 'none' | null
// `aurelia play` flags selecting it
flags: string[]
available: boolean
- missing: 'build' | 'steam-runtime' | 'host-steam' | null
+ missing: 'build' | 'steam-wine' | 'steam-sign-in' | 'host-steam' | null
default: boolean
}
diff --git a/src/backend/storeManagers/steam/drm.ts b/src/backend/storeManagers/steam/drm.ts
new file mode 100644
index 000000000..8f0187797
--- /dev/null
+++ b/src/backend/storeManagers/steam/drm.ts
@@ -0,0 +1,89 @@
+import {
+ closeSync,
+ existsSync,
+ openSync,
+ readSync,
+ readdirSync
+} from 'graceful-fs'
+import { dirname } from 'path'
+import type { SteamDrmInfo } from 'common/types/steam'
+
+const PE_HEADER_SIZE = 16 * 1024
+
+/** Section names of a Windows PE file, or undefined when it is not one. */
+export function readPeSections(path: string): string[] | undefined {
+ let fd: number | undefined
+ try {
+ fd = openSync(path, 'r')
+ const buffer = Buffer.alloc(PE_HEADER_SIZE)
+ const bytes = readSync(fd, buffer, 0, buffer.length, 0)
+ if (bytes < 0x40) return undefined
+ const header = buffer.subarray(0, bytes)
+ if (header.readUInt16LE(0) !== 0x5a4d) return undefined
+
+ const pe = header.readUInt32LE(0x3c)
+ if (pe + 24 > header.length) return undefined
+ if (header.toString('latin1', pe, pe + 4) !== 'PE\0\0') return undefined
+
+ const sectionCount = header.readUInt16LE(pe + 6)
+ const optionalSize = header.readUInt16LE(pe + 20)
+ let offset = pe + 24 + optionalSize
+ const sections: string[] = []
+ for (let index = 0; index < sectionCount; index++) {
+ if (offset + 8 > header.length) return undefined
+ sections.push(
+ header.toString('latin1', offset, offset + 8).replace(/\0+$/, '')
+ )
+ offset += 40
+ }
+ return sections
+ } catch {
+ return undefined
+ } finally {
+ if (fd !== undefined) closeSync(fd)
+ }
+}
+
+function hasFile(directory: string, name: string): boolean {
+ try {
+ return readdirSync(directory).some(
+ (entry) => entry.toLowerCase() === name.toLowerCase()
+ )
+ } catch {
+ return false
+ }
+}
+
+function hasSteamApi(installPath: string, executable: string): boolean {
+ const directories = new Set([installPath, dirname(executable)])
+ for (const directory of directories) {
+ if (
+ hasFile(directory, 'steam_api.dll') ||
+ hasFile(directory, 'steam_api64.dll')
+ ) {
+ return true
+ }
+ }
+ return false
+}
+
+/** Steam DRM and Steamworks markers on an installed game's launch executable. */
+export function detectSteamDrm(
+ installPath: string,
+ executable: string
+): SteamDrmInfo {
+ const steamworks = hasSteamApi(installPath, executable)
+ if (!existsSync(executable)) {
+ return { steamDrm: false, steamworks, scanned: false, storeChecked: false }
+ }
+ const sections = readPeSections(executable)
+ if (!sections) {
+ return { steamDrm: false, steamworks, scanned: false, storeChecked: false }
+ }
+ return {
+ steamDrm: sections.some((section) => section.toLowerCase() === '.bind'),
+ steamworks,
+ scanned: true,
+ storeChecked: false
+ }
+}
diff --git a/src/backend/storeManagers/steam/electronStores.ts b/src/backend/storeManagers/steam/electronStores.ts
index e745010f8..7bd678363 100644
--- a/src/backend/storeManagers/steam/electronStores.ts
+++ b/src/backend/storeManagers/steam/electronStores.ts
@@ -18,7 +18,7 @@ const configStore = new TypeCheckedStoreBackend('steamConfigStore', {
const libraryStore = new CacheStore<GameInfo[], 'games'>('steam_library', null)
// Caches the Steam storefront "appdetails" response.
-const extraInfoStore = new CacheStore<ExtraInfo>('steam_extra_info_v3')
+const extraInfoStore = new CacheStore<ExtraInfo>('steam_extra_info_v5')
const installInfoStore = new CacheStore<SteamInstallInfo>('steam_install_info')
diff --git a/src/backend/storeManagers/steam/games.ts b/src/backend/storeManagers/steam/games.ts
index 4a3d7d047..70fd722d4 100644
--- a/src/backend/storeManagers/steam/games.ts
+++ b/src/backend/storeManagers/steam/games.ts
@@ -1,7 +1,8 @@
-import { existsSync } from 'graceful-fs'
-import { dirname, normalize } from 'path'
+import { existsSync, mkdirSync, writeFileSync } from 'graceful-fs'
+import { dirname, join, normalize } from 'path'
import { dialog } from 'electron'
import { t } from 'i18next'
+import { split as splitArgs } from 'shlex'
import { GameConfig } from '../../game_config'
import {
ExtraInfo,
@@ -29,15 +30,26 @@ import {
removeShortcuts as removeShortcutsUtil
} from '../../shortcuts/shortcuts/shortcuts'
import { Game, InstallResult, RemoveArgs } from 'common/types/game_manager'
-import { sendGameStatusUpdate } from 'backend/utils'
+import { sendGameStatusUpdate, shutdownWine } from 'backend/utils'
import { sendFrontendMessage } from 'backend/ipc'
-import { isLinux } from 'backend/constants/environment'
+import { isLinux, isMac } from 'backend/constants/environment'
import { libraryManagerMap } from '..'
import { isOnline } from 'backend/online_monitor'
-import { launchCleanup, prepareLaunch, setupWrappers } from 'backend/launcher'
+import {
+ launchCleanup,
+ prepareLaunch,
+ prepareWineLaunch,
+ runWineCommand,
+ setupWrappers,
+ setupWrapperEnvVars
+} from 'backend/launcher'
import { removeQuoteIfNecessary } from 'backend/utils'
import { showDialogBoxModalAuto } from 'backend/dialog/dialog'
-import { aureliaPrefixArgs, buildAureliaLaunchOptions } from './launch_options'
+import {
+ aureliaPrefixArgs,
+ buildAureliaLaunchOptions,
+ parseSteamLaunchLine
+} from './launch_options'
import { userHome } from 'backend/constants/paths'
import { syncDirectionFromArg } from './sync_args'
import { configStore, extraInfoStore } from './electronStores'
@@ -53,6 +65,7 @@ import {
getSteamPlatformSwitchInstall,
aureliaSupportsLaunchOption,
disableAureliaCloudSync,
+ getSteamRuntimeStatus,
runAurelia,
fetchAureliaInfo,
parseAureliaJson,
@@ -81,10 +94,13 @@ import {
isSteamLanguageName,
toSteamApiLanguage
} from './languages'
+import { GlobalConfig } from 'backend/config'
import type {
AureliaAchievementsResponse,
AureliaCloudConflict,
AureliaCloudSyncResponse,
+ AureliaLaunchOption,
+ AureliaLaunchOptionsResponse,
AureliaLaunchTarget,
AureliaLaunchTargetsResponse,
AureliaMoveResult
@@ -93,14 +109,18 @@ import type {
SteamCloudFile,
SteamCloudSyncDirection,
SteamCloudSyncStatus,
+ SteamDrmInfo,
SteamLaunchTargets,
SteamPendingDlcChange
} from 'common/types/steam'
+import { detectSteamDrm } from './drm'
import type LogWriter from 'backend/logger/log_writer'
// Launches before a DLC change stops
const MAX_DLC_ATTEMPTS = 3
+/** Games currently launched through the in-Wine Steam client. */
+const macSteamRuntimeLaunches = new Set<string>()
/**
* Steam game manager.
@@ -150,6 +170,9 @@ export default class SteamGame implements Game {
* Only viable choices are returned.
*/
private async fetchLaunchTargets(): Promise<AureliaLaunchTarget[]> {
+ if (this.isMacWindowsBuild()) {
+ return this.macWindowsLaunchTargets()
+ }
const res = await runAurelia<AureliaLaunchTargetsResponse>([
'launch-targets',
this.id
@@ -157,6 +180,40 @@ export default class SteamGame implements Game {
return this.viableLaunchTargets(res.targets ?? [])
}
+ /**
+ * Windows builds on macOS can run either through the in-Wine Steam client
+ * (required by Steam DRM) or directly through Heroic's Wine setup.
+ */
+ private async macWindowsLaunchTargets(): Promise<AureliaLaunchTarget[]> {
+ const runtime = await getSteamRuntimeStatus()
+ const runtimeReady = runtime.installed
+ const loggedIn = runtimeReady && (runtime.loggedIn || runtime.savedLogin)
+ return [
+ {
+ id: 'windows-wine',
+ platform: 'windows',
+ steam_mode: 'wine',
+ flags: ['--platform', 'windows', '--steam-mode', 'wine'],
+ available: runtimeReady,
+ missing: !runtimeReady
+ ? 'steam-wine'
+ : loggedIn
+ ? null
+ : 'steam-sign-in',
+ default: loggedIn
+ },
+ {
+ id: 'windows-standalone',
+ platform: 'windows',
+ steam_mode: 'none',
+ flags: [],
+ available: true,
+ missing: null,
+ default: !loggedIn
+ }
+ ]
+ }
+
/**
* Split native Linux by Steam mode, drop impossible choices.
*/
@@ -401,7 +458,10 @@ export default class SteamGame implements Game {
if (!isLinux || !(await aureliaPinsPlatform())) return target.flags
const selected = configStore.get('steamLaunchTarget', {})[this.id]
// Automatic: Aurelia picks, nothing enforced
- const pinned = selected === target.id ? target.platform : undefined
+ const pinned =
+ selected === target.id && target.platform !== 'macos'
+ ? target.platform
+ : undefined
const { failure } = await this.setPinnedPlatform(pinned, logWriter)
if (failure) {
await logWriter.logWarning(`Platform not enforced: ${failure}`)
@@ -557,6 +617,238 @@ export default class SteamGame implements Game {
return id
}
+ /**
+ * The Windows launch entry Heroic should start for a macOS Wine launch.
+ */
+ private async fetchWindowsLaunchEntry(
+ launchArguments: LaunchOption | undefined,
+ logWriter: LogWriter
+ ): Promise<AureliaLaunchOption | undefined> {
+ let response: AureliaLaunchOptionsResponse
+ try {
+ response = await runAurelia<AureliaLaunchOptionsResponse>([
+ 'launch-options',
+ this.id
+ ])
+ } catch (error) {
+ await logWriter.logWarning(
+ `Could not list Windows launch options: ${describeError(error)}`
+ )
+ return undefined
+ }
+ const options = (response.launch_options ?? []).filter(
+ (option) =>
+ option.executable &&
+ (!option.oslist ||
+ option.oslist
+ .toLowerCase()
+ .split(',')
+ .some((os) => os.trim() === 'windows'))
+ )
+ if (!options.length) {
+ await logWriter.logWarning('No Windows launch options found')
+ return undefined
+ }
+
+ const selectedId =
+ launchArguments &&
+ launchArguments.type !== 'dlc' &&
+ launchArguments.type !== 'altExe'
+ ? launchArguments.steamLaunchId
+ : undefined
+ if (selectedId) {
+ const selected = options.find(
+ (option) => String(option.id) === String(selectedId)
+ )
+ if (selected) return selected
+ await logWriter.logWarning(
+ `Launch option ${selectedId} is not a Windows launch option, using the default`
+ )
+ }
+ return options.find((option) => String(option.id) === '0') ?? options[0]
+ }
+
+ /**
+ * Starts a Windows Steam build through Heroic's Wine settings on macOS.
+ */
+ private async launchWindowsGameOnMac(
+ gameInfo: GameInfo,
+ gameSettings: GameSettings,
+ launchArguments: LaunchOption | undefined,
+ wrappers: string[],
+ logWriter: LogWriter
+ ): Promise<boolean> {
+ const installPath = gameInfo.install.install_path
+ if (!installPath) {
+ return false
+ }
+
+ const entry = await this.fetchWindowsLaunchEntry(launchArguments, logWriter)
+ if (!entry?.executable) {
+ showDialogBoxModalAuto({
+ title: t('box.error.launchAborted', 'Launch aborted'),
+ message: t(
+ 'box.error.steam.no-windows-build',
+ 'This Steam game has no Windows launch entry to start.'
+ ),
+ type: 'ERROR'
+ })
+ return false
+ }
+
+ const overrideExe =
+ gameSettings.targetExe ||
+ (launchArguments?.type === 'altExe'
+ ? launchArguments.executable
+ : undefined)
+ const executable =
+ overrideExe ?? this.installRelativePath(installPath, entry.executable)
+ const workingDir = entry.working_dir?.trim()
+ ? this.installRelativePath(installPath, entry.working_dir)
+ : installPath
+
+ if (!existsSync(executable)) {
+ await logWriter.logError(`Executable not found: ${executable}`)
+ showDialogBoxModalAuto({
+ title: t('box.error.launchAborted', 'Launch aborted'),
+ message: t(
+ 'box.error.steam.exe-not-found',
+ 'The game executable was not found at {{path}}',
+ { path: executable }
+ ),
+ type: 'ERROR'
+ })
+ return false
+ }
+
+ if (!existsSync(workingDir)) {
+ mkdirSync(workingDir, { recursive: true })
+ }
+
+ const args = splitArgs(entry.arguments ?? '')
+ const launchWrappers = [...wrappers]
+ const envOptions = (gameSettings.enviromentOptions ?? []).map((entry) => ({
+ ...entry
+ }))
+ const setEnv = (name: string, value: string) => {
+ const existing = envOptions.find((option) => option.key === name)
+ if (existing) {
+ existing.value = value
+ } else {
+ envOptions.push({ key: name, value })
+ }
+ }
+
+ const launcherArgs = gameSettings.launcherArgs?.trim()
+ if (launcherArgs?.includes('%command%')) {
+ const steamLine = parseSteamLaunchLine(launcherArgs)
+ for (const [name, value] of steamLine?.env ?? []) {
+ setEnv(name, value)
+ }
+ launchWrappers.push(...(steamLine?.wrappers ?? []))
+ args.push(...(steamLine?.args ?? []))
+ } else if (launcherArgs) {
+ args.push(...splitArgs(launcherArgs))
+ }
+
+ setEnv('SteamAppId', this.id)
+ setEnv('SteamGameId', this.id)
+ const steamDlls =
+ 'steamclient=n;steamclient64=n;steam_api=n;steam_api64=n;vstdlib_s=n;tier0_s=n'
+ const dllOverrides = envOptions.find(
+ (option) => option.key.toLowerCase() === 'winedlloverrides'
+ )
+ if (dllOverrides) {
+ dllOverrides.value = [dllOverrides.value, steamDlls]
+ .filter(Boolean)
+ .join(';')
+ } else {
+ envOptions.push({ key: 'WINEDLLOVERRIDES', value: steamDlls })
+ }
+
+ const appIdFile = join(workingDir, 'steam_appid.txt')
+ if (!existsSync(appIdFile)) {
+ try {
+ writeFileSync(appIdFile, this.id)
+ } catch (error) {
+ logWarning(
+ [`Could not write ${appIdFile}`, describeError(error)],
+ LogPrefix.Steam
+ )
+ }
+ }
+
+ await logWriter.logInfo(`Executable: ${executable}`)
+ await logWriter.logInfo(`Working directory: ${workingDir}`)
+ if (args.length)
+ await logWriter.logInfo(`Game arguments: ${args.join(' ')}`)
+
+ const { code } = await runWineCommand({
+ commandParts: [executable, ...args],
+ gameSettings: { ...gameSettings, enviromentOptions: envOptions },
+ wait: true,
+ protonVerb: 'waitforexitandrun',
+ gameInstallPath: installPath,
+ startFolder: workingDir,
+ options: {
+ env: setupWrapperEnvVars({ appName: this.id, appRunner: 'steam' }),
+ wrappers: launchWrappers,
+ logWriters: [logWriter],
+ logMessagePrefix: `Launching ${gameInfo.title}`
+ }
+ })
+ if (code) {
+ await logWriter.logWarning(`Game exited with code ${code}`)
+ }
+ return true
+ }
+
+ /**
+ * Steam DRM and Steamworks markers on the launch executable.
+ */
+ private async getSteamDrmInfo(): Promise<SteamDrmInfo> {
+ const info = this.getGameInfo()
+ const installPath = info.install.install_path
+ const unscanned: SteamDrmInfo = {
+ steamDrm: false,
+ steamworks: false,
+ scanned: false,
+ storeChecked: false
+ }
+ if (!isSteamSupported() || !info.is_installed || !installPath) {
+ return unscanned
+ }
+
+ let executable: string | undefined
+ try {
+ const response = await runAurelia<AureliaLaunchOptionsResponse>([
+ 'launch-options',
+ this.id
+ ])
+ const options = (response.launch_options ?? []).filter(
+ (option) => option.executable
+ )
+ const entry =
+ options.find((option) => String(option.id) === '0') ?? options[0]
+ if (entry?.executable) {
+ executable = this.installRelativePath(installPath, entry.executable)
+ }
+ } catch (error) {
+ logWarning(
+ [
+ `Unable to read launch options for ${this.id} DRM detection:`,
+ describeError(error)
+ ],
+ LogPrefix.Steam
+ )
+ }
+
+ if (!executable) {
+ return unscanned
+ }
+ return detectSteamDrm(installPath, executable)
+ }
+
async getExtraInfo(lang = 'en-US'): Promise<ExtraInfo> {
const steamLang = toSteamApiLanguage(lang)
const cacheKey = `${this.id}-${steamLang}`
@@ -565,13 +857,15 @@ export default class SteamGame implements Game {
return cached
}
+ const localDrm = await this.getSteamDrmInfo()
const empty: ExtraInfo = {
about: { description: '', shortDescription: '' },
reqs: [],
releaseDate: undefined,
storeUrl: libraryManagerMap['steam'].getGameInfo(this.id)?.store_url,
changelog: undefined,
- genres: []
+ genres: [],
+ steamDrm: localDrm
}
if (!isSteamSupported()) {
@@ -597,6 +891,8 @@ export default class SteamGame implements Game {
// `--extended` populate rich fields
const ext = details.extended ?? {}
+ const storeChecked =
+ !!details.extended && 'drm_notice' in details.extended
const assets = details.assets ?? {}
const extraInfo: ExtraInfo = {
@@ -623,7 +919,12 @@ export default class SteamGame implements Game {
? String(ext.metacritic)
: undefined,
platforms: toInstallPlatforms(details.platforms),
- screenshots
+ screenshots,
+ steamDrm: {
+ ...localDrm,
+ notice: ext.drm_notice ?? undefined,
+ storeChecked
+ }
}
extraInfoStore.set(cacheKey, extraInfo)
@@ -849,6 +1150,11 @@ export default class SteamGame implements Game {
return
}
+ private invalidateExtraInfoCache() {
+ const language = GlobalConfig.get().getSettings().language || 'en-US'
+ extraInfoStore.delete(`${this.id}-${toSteamApiLanguage(language)}`)
+ }
+
async install({
platformToInstall,
path,
@@ -891,6 +1197,7 @@ export default class SteamGame implements Game {
)
if (result.status === 'done') {
+ this.invalidateExtraInfoCache()
void this.addShortcuts()
await libraryManagerMap['steam'].markInstalled(this.id)
logInfo(
@@ -904,7 +1211,17 @@ export default class SteamGame implements Game {
// TODO: Add Heroic handler to Aurelia
// Currently Aurelia handles Proton layer
isNative(): boolean {
- return true
+ return !this.isMacWindowsBuild()
+ }
+
+ private isMacWindowsBuild(): boolean {
+ return isMac && this.getGameInfo().install.platform === 'windows'
+ }
+
+ private installRelativePath(installPath: string, relative: string): string {
+ const cleaned = relative.trim().replace(/^[/\\]+/, '')
+ if (!cleaned) return installPath
+ return join(installPath, ...cleaned.split(/[/\\]+/).filter(Boolean))
}
async addShortcuts(fromMenu?: boolean): Promise<void> {
@@ -1344,11 +1661,18 @@ export default class SteamGame implements Game {
return false
}
+ const isMacWindows = isMac && gameInfo.install.platform === 'windows'
logInfo(
- `Launching ${gameInfo.title} (${this.id}) through Aurelia`,
+ `Launching ${gameInfo.title} (${this.id}) through ${
+ isMacWindows ? 'Wine on macOS' : 'Aurelia'
+ }`,
LogPrefix.Steam
)
- await logWriter.logInfo(`Launching ${gameInfo.title} through Aurelia`)
+ await logWriter.logInfo(
+ `Launching ${gameInfo.title} through ${
+ isMacWindows ? 'Wine on macOS' : 'Aurelia'
+ }`
+ )
await this.applyPendingDlcChanges()
@@ -1358,7 +1682,7 @@ export default class SteamGame implements Game {
{ ...gameSettings, steamRuntime: false },
logWriter,
gameInfo,
- true
+ !isMacWindows
)
if (!prep.success) {
await logWriter.logError(['Launch aborted:', prep.failureReason])
@@ -1370,29 +1694,62 @@ export default class SteamGame implements Game {
})
return false
}
- await this.applyLaunchOptions(
+ const wrappers = setupWrappers(
gameSettings,
- setupWrappers(
- gameSettings,
- prep.mangoHudCommand,
- prep.gameModeBin,
- prep.gameScopeCommand
- ),
- logWriter
- )
- await this.applyPrefix(gameSettings, logWriter)
- await this.applyLinuxRuntime(
- gameSettings,
- gameInfo.install.platform === 'linux',
- logWriter
+ prep.mangoHudCommand,
+ prep.gameModeBin,
+ prep.gameScopeCommand
)
- await this.keepAureliaFromSyncing(logWriter)
+ const target = await this.resolveLaunchTarget(logWriter)
+ const useWindowsSteam = isMacWindows && target?.steam_mode === 'wine'
+ if (useWindowsSteam) {
+ macSteamRuntimeLaunches.add(this.id)
+ } else {
+ macSteamRuntimeLaunches.delete(this.id)
+ }
+
+ if (useWindowsSteam) {
+ await logWriter.logInfo(
+ 'Launching with the Windows Steam runtime (in-Wine)'
+ )
+ } else if (isMacWindows) {
+ const winePrep = await prepareWineLaunch(this, logWriter)
+ if (!winePrep.success) {
+ const message =
+ winePrep.failureReason ??
+ t(
+ 'box.error.steam.wine-not-ready',
+ 'Wine is not configured correctly for this game.'
+ )
+ await logWriter.logError(['Launch aborted:', message])
+ launchCleanup(prep.rpcClient)
+ showDialogBoxModalAuto({
+ title: t('box.error.launchAborted', 'Launch aborted'),
+ message,
+ type: 'ERROR'
+ })
+ return false
+ }
+ } else {
+ await this.applyLaunchOptions(gameSettings, wrappers, logWriter)
+ await this.applyPrefix(gameSettings, logWriter)
+ await this.applyLinuxRuntime(
+ gameSettings,
+ gameInfo.install.platform === 'linux',
+ logWriter
+ )
+ await this.keepAureliaFromSyncing(logWriter)
+ }
// Sync before starting a game
- const syncSaves = await this.shouldAutoSyncSaves()
+ const syncSaves = !isMacWindows && (await this.shouldAutoSyncSaves())
if (syncSaves) {
await this.syncCloudSaves('down', logWriter)
+ } else if (isMacWindows) {
+ await logWriter.logInfo(
+ 'Steam Cloud sync skipped for Windows games launched through Wine on macOS'
+ )
} else {
await logWriter.logInfo('Steam Cloud sync skipped (disabled or offline)')
}
@@ -1403,61 +1760,121 @@ export default class SteamGame implements Game {
status: 'playing'
})
- const playCommand = ['play', this.id, '--json']
- const pushProton = async () => {
- const { wineVersion } = await this.getSettings()
- if (wineVersion?.type === 'proton' && wineVersion.bin) {
- playCommand.push('--proton', dirname(wineVersion.bin))
- }
- }
+ if (useWindowsSteam) {
+ // Rendered by Aurelia's Windows Steam runtime in its own prefix. Per-game
+ // launch options, wrappers and Wine settings cannot be applied until GPTK 4.
+ const res = await libraryManagerMap['steam'].runRunnerCommand(
+ [
+ 'play',
+ this.id,
+ '--platform',
+ 'windows',
+ '--steam-mode',
+ 'wine',
+ '--json'
+ ],
+ {
+ abortId: this.id,
+ logWriters: [logWriter]
+ }
+ )
- const target = await this.resolveLaunchTarget(logWriter)
- if (target) {
- // Target flags pick build and Steam mode
- await logWriter.logInfo(`Launch target: ${target.id}`)
- playCommand.push(...(await this.applyPlatformPin(target, logWriter)))
- if (isLinux && target.platform === 'windows') {
- await pushProton()
+ launchCleanup(prep.rpcClient)
+
+ if (res.error && !res.error.includes('signal')) {
+ logError(
+ [
+ `Failed to launch ${this.id} through the Windows Steam runtime`,
+ res.error
+ ],
+ LogPrefix.Steam
+ )
+ await this.showLaunchFailure(res, logWriter)
+ return false
+ }
+ } else if (isMacWindows) {
+ let launched = false
+ try {
+ launched = await this.launchWindowsGameOnMac(
+ gameInfo,
+ gameSettings,
+ launchArguments,
+ wrappers,
+ logWriter
+ )
+ } catch (error) {
+ logError(
+ [`Failed to launch ${this.id} through Wine on macOS`, error],
+ LogPrefix.Steam
+ )
+ await logWriter.logError(['Launch aborted:', describeError(error)])
+ } finally {
+ launchCleanup(prep.rpcClient)
+ }
+ if (!launched) {
+ return false
}
} else {
- // Ignore on native Linux handling
- if (isLinux && !gameInfo.is_linux_native) {
- await pushProton()
+ const playCommand = ['play', this.id, '--json']
+ const pushProton = async () => {
+ const { wineVersion } = await this.getSettings()
+ if (wineVersion?.type === 'proton' && wineVersion.bin) {
+ playCommand.push('--proton', dirname(wineVersion.bin))
+ }
}
- }
- const launchOptionId = await this.resolveLaunchOptionId(
- launchArguments,
- logWriter
- )
- if (launchOptionId) {
- await logWriter.logInfo(`Launch option: ${launchOptionId}`)
- playCommand.push('--launch-option', launchOptionId)
- }
-
- const platformInstall = this.platformInstallTracker(
- gameInfo,
- 'playing',
- logWriter
- )
- const res = await libraryManagerMap['steam'].runRunnerCommand(playCommand, {
- abortId: this.id,
- logWriters: [logWriter],
- onOutput: platformInstall.onOutput
- })
- await platformInstall.settle()
+ if (target) {
+ // Target flags pick build and Steam mode
+ await logWriter.logInfo(`Launch target: ${target.id}`)
+ playCommand.push(...(await this.applyPlatformPin(target, logWriter)))
+ if (isLinux && target.platform === 'windows') {
+ await pushProton()
+ }
+ } else {
+ // Ignore on native Linux handling
+ if (isLinux && !gameInfo.is_linux_native) {
+ await pushProton()
+ }
+ }
- launchCleanup(prep.rpcClient)
+ const launchOptionId = await this.resolveLaunchOptionId(
+ launchArguments,
+ logWriter
+ )
+ if (launchOptionId) {
+ await logWriter.logInfo(`Launch option: ${launchOptionId}`)
+ playCommand.push('--launch-option', launchOptionId)
+ }
- if (res.error && !res.error.includes('signal')) {
- logError(
- [`Failed to launch ${this.id} through Aurelia`, res.error],
- LogPrefix.Steam
+ const platformInstall = this.platformInstallTracker(
+ gameInfo,
+ 'playing',
+ logWriter
)
- await this.showLaunchFailure(res, logWriter)
- return false
+ const res = await libraryManagerMap['steam'].runRunnerCommand(
+ playCommand,
+ {
+ abortId: this.id,
+ logWriters: [logWriter],
+ onOutput: platformInstall.onOutput
+ }
+ )
+ await platformInstall.settle()
+
+ launchCleanup(prep.rpcClient)
+
+ if (res.error && !res.error.includes('signal')) {
+ logError(
+ [`Failed to launch ${this.id} through Aurelia`, res.error],
+ LogPrefix.Steam
+ )
+ await this.showLaunchFailure(res, logWriter)
+ return false
+ }
+ await this.reportForcedSteam(res.stdout, logWriter)
}
- await this.reportForcedSteam(res.stdout, logWriter)
+
+ macSteamRuntimeLaunches.delete(this.id)
// Sync after game stopped
if (syncSaves && isOnline()) {
@@ -1577,6 +1994,14 @@ export default class SteamGame implements Game {
if (!isSteamSupported()) {
return { ...result, reason: 'not-supported' }
}
+ if (this.isMacWindowsBuild()) {
+ return {
+ ...result,
+ reason: 'not-supported',
+ output:
+ 'Steam Cloud sync is not available for Windows games on macOS yet'
+ }
+ }
const direction = syncDirectionFromArg(arg)
const directionFlag = direction ? [`--${direction}`] : []
const pathArg = path ? ['--path', path] : []
@@ -1659,6 +2084,7 @@ export default class SteamGame implements Game {
return { stdout: '', stderr: describeError(error) }
}
+ this.invalidateExtraInfoCache()
await removeShortcutsUtil(this)
libraryManagerMap['steam'].installState(this.id, false)
await libraryManagerMap['steam'].refresh()
@@ -1686,6 +2112,7 @@ export default class SteamGame implements Game {
'update'
)
if (result.status === 'done') {
+ this.invalidateExtraInfoCache()
await libraryManagerMap['steam'].refresh()
}
return result
@@ -1742,6 +2169,29 @@ export default class SteamGame implements Game {
}
const gameInfo = this.getGameInfo()
logInfo(`Stopping ${gameInfo.title} (${this.id})`, LogPrefix.Steam)
+ if (this.isMacWindowsBuild()) {
+ const gameSettings = await this.getSettings()
+ const stopWine = macSteamRuntimeLaunches.has(this.id)
+ ? runAurelia(['stop', this.id])
+ : gameSettings.wineVersion.type === 'crossover'
+ ? runWineCommand({
+ gameSettings,
+ commandParts: ['wineboot', '-k'],
+ wait: true,
+ protonVerb: 'run'
+ })
+ : shutdownWine(gameSettings)
+ const results = await Promise.allSettled([this.stopDownload(), stopWine])
+ for (const result of results) {
+ if (result.status === 'rejected') {
+ logWarning(
+ [`Failed to stop ${this.id}`, describeError(result.reason)],
+ LogPrefix.Steam
+ )
+ }
+ }
+ return
+ }
// This is invoked both to stop a running game and a download
const results = await Promise.allSettled([
this.stopDownload(),
diff --git a/src/backend/storeManagers/steam/ipc_handler.ts b/src/backend/storeManagers/steam/ipc_handler.ts
index 345a45610..15ef03e67 100644
--- a/src/backend/storeManagers/steam/ipc_handler.ts
+++ b/src/backend/storeManagers/steam/ipc_handler.ts
@@ -4,22 +4,35 @@ import { libraryManagerMap } from '..'
import {
getSteamDownloadLimit,
getSteamPlatformSwitchInstall,
+ getSteamRuntimeStatus,
runAurelia,
setSteamDownloadLimit,
setSteamPlatformSwitchInstall
} from './aurelia'
-import { describeError } from './utils'
+import { describeError, isSteamSupported } from './utils'
import {
getSteamLinuxRuntimeSettings,
setSteamLinuxRuntimeSetting,
getSteamLinuxRuntime,
setSteamLinuxRuntime
} from './linux_runtime'
-import { logError, LogPrefix } from 'backend/logger'
+import { logError, logWarning, LogPrefix } from 'backend/logger'
import { isLinux } from 'backend/constants/environment'
+import { GlobalConfig } from 'backend/config'
+import {
+ installWineVersion,
+ updateWineVersionInfos
+} from 'backend/wine/manager/utils'
+import { notify } from 'backend/dialog/dialog'
+import { t } from 'i18next'
+import { Repositorys } from 'common/types'
+import type { WineVersionInfo } from 'common/types'
+import { isGptkRunner, selectSteamRuntimeRunner } from './runtime_runner'
addHandler('getSteamUsers', () => SteamUser.getAccounts())
+addHandler('isSteamSupported', () => isSteamSupported())
+
addHandler('getSteamDlcInfo', async (_e, appName, noCache) =>
libraryManagerMap['steam'].getDLCInfo(appName, noCache)
)
@@ -109,10 +122,68 @@ addHandler('applySteamLaunchTarget', (_e, appName) =>
libraryManagerMap['steam'].getGame(appName).applyLaunchTarget()
)
+addHandler('getSteamRuntimeStatus', async () => getSteamRuntimeStatus())
+
+async function latestWineStaging(): Promise<WineVersionInfo | undefined> {
+ const releases = await updateWineVersionInfos(
+ true,
+ [Repositorys.WINESTAGINGMACOS],
+ 10
+ )
+ return releases
+ .filter(
+ (release) => release.type === 'Wine-Staging-macOS' && !!release.download
+ )
+ .sort((a, b) => Date.parse(b.date) - Date.parse(a.date))[0]
+}
+
+async function ensureSteamRuntimeRunner(): Promise<void> {
+ const status = await getSteamRuntimeStatus()
+ if (status.runnerConfigured && !isGptkRunner(status.runnerPath)) {
+ return
+ }
+
+ let candidate = selectSteamRuntimeRunner(
+ await GlobalConfig.get().getAlternativeWine()
+ )
+ if (!candidate?.bin) {
+ const release = await latestWineStaging()
+ if (!release) {
+ throw new Error('No Wine Staging release is available to download.')
+ }
+ notify({ title: release.version, body: t('notify.install.startInstall') })
+ const result = await installWineVersion(release, () => {})
+ notify({
+ title: release.version,
+ body:
+ result === 'success'
+ ? t('notify.install.finished')
+ : t('notify.install.error')
+ })
+ if (result !== 'success') {
+ throw new Error(`Failed to install ${release.version}.`)
+ }
+ candidate = selectSteamRuntimeRunner(
+ await GlobalConfig.get().getAlternativeWine()
+ )
+ }
+ if (!candidate?.bin) {
+ throw new Error(
+ 'Could not find a Wine build for the Windows Steam runtime.'
+ )
+ }
+ logWarning(
+ ['Configuring the Windows Steam runtime to use', candidate.bin],
+ LogPrefix.Steam
+ )
+ await runAurelia(['config', 'steam-wine-runner', candidate.bin])
+}
+
// Opens the Windows Steam installer under Wine
addHandler('installSteamWineRuntime', async () => {
try {
- await runAurelia(['steam-runtime', 'install'])
+ await ensureSteamRuntimeRunner()
+ await runAurelia(['steam-wine', 'install'])
return { status: 'done' as const }
} catch (error) {
logError(
@@ -123,6 +194,21 @@ addHandler('installSteamWineRuntime', async () => {
}
})
+// Opens the Windows Steam client so the user can sign in
+addHandler('loginSteamWineRuntime', async () => {
+ try {
+ await ensureSteamRuntimeRunner()
+ await runAurelia(['steam-wine', 'login'])
+ return { status: 'done' as const }
+ } catch (error) {
+ logError(
+ ['Failed to open the in-Wine Steam sign-in', describeError(error)],
+ LogPrefix.Steam
+ )
+ return { status: 'error' as const, error: describeError(error) }
+ }
+})
+
addListener('logoutSteamAccount', (_e, steamId) => {
void SteamUser.logoutAccount(steamId)
})
diff --git a/src/backend/storeManagers/steam/launch_options.ts b/src/backend/storeManagers/steam/launch_options.ts
index 01907e7a4..29b43bb59 100644
--- a/src/backend/storeManagers/steam/launch_options.ts
+++ b/src/backend/storeManagers/steam/launch_options.ts
@@ -37,6 +37,12 @@ interface SteamLine {
args: string[]
}
+/** Split a Steam launch line around `%command%`. */
+export function parseSteamLaunchLine(line: string): SteamLine | undefined {
+ if (!line.includes(COMMAND_MARKER)) return undefined
+ return splitSteamLine(line)
+}
+
/** `NAME=value` with a shell name. */
function envAssignment(token: string): [string, string] | undefined {
const eq = token.indexOf('=')
diff --git a/src/backend/storeManagers/steam/runtime_runner.ts b/src/backend/storeManagers/steam/runtime_runner.ts
new file mode 100644
index 000000000..5cc6ff3d2
--- /dev/null
+++ b/src/backend/storeManagers/steam/runtime_runner.ts
@@ -0,0 +1,21 @@
+import type { WineInstallation } from 'common/types'
+
+/** GPTK cannot host the Windows Steam client reliably. */
+export function isGptkRunner(path: string | undefined): boolean {
+ return !!path && /game-porting-toolkit|gptk/i.test(path)
+}
+
+/**
+ * Wine that should host the Windows Steam runtime: DXMT builds first, then
+ * CrossOver, then any other plain Wine. GPTK is never a candidate.
+ */
+export function selectSteamRuntimeRunner(
+ wines: WineInstallation[]
+): WineInstallation | undefined {
+ const playable = wines.filter((wine) => wine.bin && wine.type !== 'toolkit')
+ return (
+ playable.find((wine) => wine.type === 'wine' && /dxmt/i.test(wine.name)) ??
+ playable.find((wine) => wine.type === 'crossover') ??
+ playable.find((wine) => wine.type === 'wine')
+ )
+}
diff --git a/src/backend/storeManagers/steam/utils.ts b/src/backend/storeManagers/steam/utils.ts
index 0bc6b1751..f7400b981 100644
--- a/src/backend/storeManagers/steam/utils.ts
+++ b/src/backend/storeManagers/steam/utils.ts
@@ -1,6 +1,8 @@
-import { sep } from 'path'
+import { join, sep } from 'path'
+import { existsSync } from 'graceful-fs'
import { logError, logWarning, LogPrefix } from 'backend/logger'
import { isFlatpak, isMac, isWindows } from 'backend/constants/environment'
+import { getAureliaBin } from 'backend/utils'
import type { InstallPlatform } from 'common/types'
import type { SteamDataKind } from 'common/types/steam'
import type { AureliaLibraryGame } from './aurelia_types'
@@ -12,9 +14,14 @@ import { AureliaError } from './aurelia'
/** Returned by every unsupported command. */
export const STEAM_UNSUPPORTED = 'Steam support is not available'
-// No macOS binaries, Flatpak unsupported
+function hasAureliaBinary(): boolean {
+ const { dir, bin } = getAureliaBin()
+ return existsSync(dir ? join(dir, bin) : bin)
+}
+
+// macOS needs the Aurelia binary; Flatpak is unsupported.
export function isSteamSupported(): boolean {
- return !isMac && !isFlatpak
+ return !isFlatpak && (!isMac || hasAureliaBinary())
}
export function describeError(error: unknown): string {
diff --git a/src/common/types.ts b/src/common/types.ts
index c9e11af65..f055faef2 100644
--- a/src/common/types.ts
+++ b/src/common/types.ts
@@ -20,7 +20,11 @@ import {
ZoomInstalledInfo,
ZoomInstallInfo
} from './types/zoom'
-import { SteamInstallInfo, SteamLinuxRuntimeChoice } from './types/steam'
+import {
+ SteamDrmInfo,
+ SteamInstallInfo,
+ SteamLinuxRuntimeChoice
+} from './types/steam'
import { TitleBarOverlay } from 'electron'
import { ChildProcess } from 'child_process'
import type { HeroicHowLongToBeatEntry } from 'backend/wiki_game_info/howlongtobeat/utils'
@@ -214,6 +218,7 @@ export interface ExtraInfo {
score?: string
platforms?: InstallPlatform[]
screenshots?: GameScreenshot[]
+ steamDrm?: SteamDrmInfo
}
export interface GameScreenshot {
diff --git a/src/common/types/ipc.ts b/src/common/types/ipc.ts
index b7825af6b..589a223e3 100644
--- a/src/common/types/ipc.ts
+++ b/src/common/types/ipc.ts
@@ -87,7 +87,8 @@ import type {
SteamLinuxRuntimeChoice,
SteamLinuxRuntimeGame,
SteamLinuxRuntimeSettings,
- SteamLoginData
+ SteamLoginData,
+ SteamWindowsRuntimeStatus
} from './steam'
import { ParsedProtonShorctut } from './proton_shorctuts'
@@ -261,6 +262,7 @@ interface AsyncIPCFunctions {
getItchioUserInfo: () => Promise<ItchioUserData | undefined>
getZoomUserInfo: () => Promise<{ username: string } | undefined>
getSteamUserInfo: () => Promise<{ username: string } | undefined>
+ isSteamSupported: () => Promise<boolean>
getSteamDlcInfo: (
appName: string,
noCache?: boolean
@@ -297,10 +299,15 @@ interface AsyncIPCFunctions {
getSteamLaunchTargets: (appName: string) => Promise<SteamLaunchTargets>
setSteamLaunchTarget: (appName: string, targetId: string) => void
applySteamLaunchTarget: (appName: string) => void
+ getSteamRuntimeStatus: () => Promise<SteamWindowsRuntimeStatus>
installSteamWineRuntime: () => Promise<{
status: 'done' | 'error'
error?: string
}>
+ loginSteamWineRuntime: () => Promise<{
+ status: 'done' | 'error'
+ error?: string
+ }>
isLoggedIn: () => boolean
login: (sid: string) => Promise<{
status: 'done' | 'failed'
diff --git a/src/common/types/steam.ts b/src/common/types/steam.ts
index 093c0e1c9..50657ba38 100644
--- a/src/common/types/steam.ts
+++ b/src/common/types/steam.ts
@@ -31,12 +31,12 @@ export interface SteamPendingDlcChange {
/** An installed build plus how Steam runs alongside it. */
export interface SteamLaunchTarget {
id: string
- platform: 'linux' | 'windows'
+ platform: 'linux' | 'macos' | 'windows'
// Only set for Windows builds
- steamMode: 'runtime' | 'host' | 'none' | null
+ steamMode: 'wine' | 'host' | 'none' | null
available: boolean
- // What must be installed first
- missing: 'build' | 'steam-runtime' | 'host-steam' | null
+ // What must be installed or signed in first
+ missing: 'build' | 'steam-wine' | 'steam-sign-in' | 'host-steam' | null
// What Aurelia picks without a choice
isDefault: boolean
}
@@ -54,6 +54,31 @@ export interface SteamInstallLibrary {
free_bytes: number | null
}
+/** Best-effort DRM information for an installed Steam game. */
+export interface SteamDrmInfo {
+ /** Third-party DRM declared on the Steam store, e.g. Denuvo. */
+ notice?: string
+ /** SteamStub wrapper found on the launch executable. */
+ steamDrm: boolean
+ /** Steamworks API DLLs present. Not DRM by itself. */
+ steamworks: boolean
+ /** The installed executable was read successfully. */
+ scanned: boolean
+ /** The store notice was checked (Aurelia returns the field). */
+ storeChecked: boolean
+}
+
+/** The in-Wine Windows Steam runtime used for Steam-DRM Windows games. */
+export interface SteamWindowsRuntimeStatus {
+ installed: boolean
+ loggedIn: boolean
+ savedLogin: boolean
+ running: boolean
+ supported: boolean
+ runnerConfigured: boolean
+ runnerPath?: string
+}
+
export interface SteamInstallLanguages {
// Steam names, e.g. german
languages: string[]
diff --git a/src/frontend/components/UI/Badge/index.tsx b/src/frontend/components/UI/Badge/index.tsx
index 15e8fc7ec..d0fa67af2 100644
--- a/src/frontend/components/UI/Badge/index.tsx
+++ b/src/frontend/components/UI/Badge/index.tsx
@@ -20,6 +20,8 @@ interface BadgeProps {
variant?: BadgeVariant
glyph?: LucideIcon
title?: string
+ /** Accessible label for badges whose title carries extra meaning. */
+ ariaLabel?: string
className?: string
onOverlay?: boolean
}
@@ -29,6 +31,7 @@ export default function Badge({
variant = 'neutral',
glyph,
title,
+ ariaLabel,
className,
onOverlay = false
}: BadgeProps) {
@@ -41,6 +44,8 @@ export default function Badge({
className
)}
title={title}
+ role={ariaLabel ? 'img' : undefined}
+ aria-label={ariaLabel}
>
{glyph && <Icon glyph={glyph} size="xs" />}
{children}
diff --git a/src/frontend/hooks/useSteamLaunchTargets.ts b/src/frontend/hooks/useSteamLaunchTargets.ts
index 7873260b4..576c79c90 100644
--- a/src/frontend/hooks/useSteamLaunchTargets.ts
+++ b/src/frontend/hooks/useSteamLaunchTargets.ts
@@ -101,6 +101,7 @@ export function useSteamLaunchTargets(
/** Platform encoded in a target id. */
function targetIdPlatform(targetId: string): string | undefined {
if (targetId.startsWith('linux')) return 'linux'
+ if (targetId.startsWith('macos')) return 'macos'
if (targetId.startsWith('windows')) return 'windows'
return undefined
}
diff --git a/src/frontend/screens/Game/GamePage/components/GameBadges.tsx b/src/frontend/screens/Game/GamePage/components/GameBadges.tsx
index e0b136950..a8e62c285 100644
--- a/src/frontend/screens/Game/GamePage/components/GameBadges.tsx
+++ b/src/frontend/screens/Game/GamePage/components/GameBadges.tsx
@@ -1,9 +1,13 @@
-import { GameInfo } from 'common/types'
+import { ShieldAlert, ShieldCheck } from 'lucide-react'
+import { useTranslation } from 'react-i18next'
+import { ExtraInfo, GameInfo, Runner } from 'common/types'
import { Badge } from 'frontend/components/UI'
interface Props {
gameInfo: GameInfo
genres: string[]
+ runner: Runner
+ extraInfo?: ExtraInfo | null
}
const PLATFORM_LABELS: Record<string, string> = {
@@ -17,14 +21,111 @@ const PLATFORM_LABELS: Record<string, string> = {
Browser: 'Browser'
}
-const GameBadges = ({ gameInfo, genres }: Props) => {
+const withHint = (label: string, hint: string) => `${label}. ${hint}`
+
+const GameBadges = ({ gameInfo, genres, runner, extraInfo }: Props) => {
+ const { t } = useTranslation()
const rawPlatform = gameInfo.install.platform || 'Windows'
const platformLabel = PLATFORM_LABELS[rawPlatform] ?? rawPlatform
const visibleGenres = genres.filter((genre) => genre.trim() !== '')
+ const drmBadge = () => {
+ if (runner !== 'steam' || !extraInfo?.steamDrm) {
+ return null
+ }
+ const drm = extraInfo.steamDrm
+ const notice = drm.notice?.trim()
+ if (notice) {
+ const label = /denuvo/i.test(notice)
+ ? t('game.drm.denuvo', 'Denuvo')
+ : t('game.drm.thirdParty', 'Third-party DRM')
+ return (
+ <Badge
+ variant="error"
+ glyph={ShieldAlert}
+ title={notice}
+ ariaLabel={withHint(label, notice)}
+ >
+ {label}
+ </Badge>
+ )
+ }
+ if (drm.steamDrm) {
+ const hint = t(
+ 'game.drm.steamHint',
+ 'Steam DRM wrapper detected. This game needs the Steam client.'
+ )
+ const label = t('game.drm.steam', 'Steam DRM')
+ return (
+ <Badge
+ variant="warning"
+ glyph={ShieldAlert}
+ title={hint}
+ ariaLabel={withHint(label, hint)}
+ >
+ {label}
+ </Badge>
+ )
+ }
+ if (drm.steamworks) {
+ // Copy pending the owner's review.
+ const hint = t(
+ 'game.drm.steamworksHint',
+ 'Steamworks API detected. This game may need the Steam client.'
+ )
+ const label = t('game.drm.steamworks', 'Needs Steam')
+ return (
+ <Badge
+ variant="warning"
+ glyph={ShieldAlert}
+ title={hint}
+ ariaLabel={withHint(label, hint)}
+ >
+ {label}
+ </Badge>
+ )
+ }
+ if (drm.scanned && !drm.storeChecked) {
+ const hint = t(
+ 'game.drm.noSteamHint',
+ 'No Steam DRM wrapper found. Third-party DRM was not checked.'
+ )
+ const label = t('game.drm.noSteam', 'No Steam DRM')
+ return (
+ <Badge
+ variant="neutral"
+ glyph={ShieldCheck}
+ title={hint}
+ ariaLabel={withHint(label, hint)}
+ >
+ {label}
+ </Badge>
+ )
+ }
+ if (drm.scanned) {
+ const hint = t(
+ 'game.drm.noneHint',
+ 'No Steam DRM or third-party DRM notice found. This does not guarantee the game runs without Steam.'
+ )
+ const label = t('game.drm.none', 'No DRM found')
+ return (
+ <Badge
+ variant="neutral"
+ glyph={ShieldCheck}
+ title={hint}
+ ariaLabel={withHint(label, hint)}
+ >
+ {label}
+ </Badge>
+ )
+ }
+ return null
+ }
+
return (
<div className="gamePage__badges">
<Badge variant="strong">{platformLabel}</Badge>
+ {drmBadge()}
{visibleGenres.map((genre) => (
<Badge key={genre} variant="neutral">
{genre}
diff --git a/src/frontend/screens/Game/GamePage/index.tsx b/src/frontend/screens/Game/GamePage/index.tsx
index 85e56ed0f..4a3c4bae0 100644
--- a/src/frontend/screens/Game/GamePage/index.tsx
+++ b/src/frontend/screens/Game/GamePage/index.tsx
@@ -693,7 +693,12 @@ export default React.memo(function GamePage(): JSX.Element | null {
<section className="gamePage__hero">
<div className="gamePage__heroMain">
<h1 className="gamePage__title">{title}</h1>
- <GameBadges gameInfo={gameInfo} genres={genres} />
+ <GameBadges
+ gameInfo={gameInfo}
+ genres={genres}
+ runner={runner}
+ extraInfo={extraInfo}
+ />
<Description />
{showInstallInfoError && (
diff --git a/src/frontend/screens/Library/components/InstallModal/DownloadDialog/SteamLibrarySelector.tsx b/src/frontend/screens/Library/components/InstallModal/DownloadDialog/SteamLibrarySelector.tsx
index b05bb37e4..2a0ec79b1 100644
--- a/src/frontend/screens/Library/components/InstallModal/DownloadDialog/SteamLibrarySelector.tsx
+++ b/src/frontend/screens/Library/components/InstallModal/DownloadDialog/SteamLibrarySelector.tsx
@@ -30,20 +30,36 @@ export default function SteamLibrarySelector({
if (!libraries.length) {
return (
- <SelectField
- label={label}
- htmlId="steamLibrarySelector"
- value=""
- disabled
- onChange={() => undefined}
- >
- <MenuItem value="">
+ <div className="InstallModal__steamLibraryNotice">
+ <span>
{t(
'install.steam-no-libraries',
'No Steam library folders found — add a drive in Steam first.'
)}
- </MenuItem>
- </SelectField>
+ </span>
+ </div>
+ )
+ }
+
+ if (libraries.length === 1) {
+ const library = libraries[0]
+ return (
+ <div className="InstallModal__steamLibraryNotice">
+ <span>
+ {t(
+ 'install.steam-single-library',
+ 'This game will be installed on your Steam library'
+ )}
+ </span>
+ <span className="smallInputInfo">
+ {library.free_bytes !== null
+ ? `${library.path} (${size(library.free_bytes)} ${t(
+ 'install.free',
+ 'free'
+ )})`
+ : library.path}
+ </span>
+ </div>
)
}
@@ -58,7 +74,6 @@ export default function SteamLibrarySelector({
label={label}
htmlId="steamLibrarySelector"
value={value}
- disabled={libraries.length <= 1}
onChange={(e) => onChange(e.target.value)}
>
{libraries.map((lib) => (
diff --git a/src/frontend/screens/Library/components/InstallModal/DownloadDialog/__tests__/SteamLibrarySelector.test.tsx b/src/frontend/screens/Library/components/InstallModal/DownloadDialog/__tests__/SteamLibrarySelector.test.tsx
new file mode 100644
index 000000000..990c1ead9
--- /dev/null
+++ b/src/frontend/screens/Library/components/InstallModal/DownloadDialog/__tests__/SteamLibrarySelector.test.tsx
@@ -0,0 +1,60 @@
+/**
+ * @jest-environment jsdom
+ */
+import { render, screen } from '@testing-library/react'
+import { createInstance } from 'i18next'
+import { I18nextProvider } from 'react-i18next'
+import type { SteamInstallLibrary } from 'common/types/steam'
+import gamepage from '../../../../../../../../public/locales/en/gamepage.json'
+import SteamLibrarySelector from '../SteamLibrarySelector'
+
+jest.mock('frontend/helpers', () => ({ size: () => '1 GB' }))
+
+const i18n = createInstance()
+
+beforeAll(async () => {
+ await i18n.init({
+ lng: 'en',
+ ns: ['gamepage'],
+ defaultNS: 'gamepage',
+ resources: { en: { gamepage } },
+ interpolation: { escapeValue: false },
+ react: { useSuspense: false }
+ })
+})
+
+const renderSelector = (libraries: SteamInstallLibrary[]) =>
+ render(
+ <I18nextProvider i18n={i18n}>
+ <SteamLibrarySelector
+ libraries={libraries}
+ selectedPath=""
+ onChange={jest.fn()}
+ />
+ </I18nextProvider>
+ )
+
+describe('SteamLibrarySelector empty states', () => {
+ it('shows the no-library warning outside the select', () => {
+ renderSelector([])
+
+ expect(
+ screen.getByText(
+ 'No Steam library folders found — add a drive in Steam first.'
+ ).textContent
+ ).toBe('No Steam library folders found — add a drive in Steam first.')
+ expect(screen.queryByRole('combobox')).toBeNull()
+ })
+
+ it('keeps the single-library notice with its path', () => {
+ renderSelector([{ path: '/steam/library', free_bytes: null }])
+
+ expect(
+ screen.getByText('This game will be installed on your Steam library')
+ .textContent
+ ).toBe('This game will be installed on your Steam library')
+ expect(screen.getByText('/steam/library').textContent).toBe(
+ '/steam/library'
+ )
+ })
+})
diff --git a/src/frontend/screens/Library/components/InstallModal/DownloadDialog/index.tsx b/src/frontend/screens/Library/components/InstallModal/DownloadDialog/index.tsx
index 0dc991ebe..df9f7eb85 100644
--- a/src/frontend/screens/Library/components/InstallModal/DownloadDialog/index.tsx
+++ b/src/frontend/screens/Library/components/InstallModal/DownloadDialog/index.tsx
@@ -168,9 +168,9 @@ export default function DownloadDialog({
(game: GameStatus) => game.appName === appName
)[0]
- const [steamLibraries, setSteamLibraries] = useState<SteamInstallLibrary[]>(
- []
- )
+ const [steamLibraries, setSteamLibraries] = useState<
+ SteamInstallLibrary[] | null
+ >(null)
const [dlcsToInstall, setDlcsToInstall] = useState<string[]>([])
const [sdls, setSdls] = useState<SelectiveDownload[]>([])
@@ -568,21 +568,28 @@ export default function DownloadDialog({
useEffect(() => {
if (!isSteam) return
let cancelled = false
- void window.api.getSteamInstallLibraries().then((libraries) => {
- if (cancelled) return
- setSteamLibraries(libraries)
- if (!libraries.length) return
- const configuredPath =
- gameInstallInfo &&
- 'game' in gameInstallInfo &&
- 'path' in gameInstallInfo.game
- ? gameInstallInfo.game.path
- : ''
- const preselected =
- libraries.find((lib) => configuredPath.startsWith(lib.path))?.path ??
- libraries[0].path
- setInstallPath(preselected)
- })
+ void window.api
+ .getSteamInstallLibraries()
+ .then((libraries) => {
+ if (cancelled) return
+ setSteamLibraries(libraries)
+ if (!libraries.length) return
+ const configuredPath =
+ gameInstallInfo &&
+ 'game' in gameInstallInfo &&
+ 'path' in gameInstallInfo.game
+ ? gameInstallInfo.game.path
+ : ''
+ const preselected =
+ libraries.find((lib) => configuredPath.startsWith(lib.path))?.path ??
+ libraries[0].path
+ setInstallPath(preselected)
+ })
+ .catch((error) => {
+ if (cancelled) return
+ window.api.logError(`Could not load Steam libraries: ${error}`)
+ setSteamLibraries([])
+ })
return () => {
cancelled = true
}
@@ -816,19 +823,25 @@ export default function DownloadDialog({
'Select at least one game file to continue.'
)
: ''
+ const steamLibrariesReady = !isSteam || !!steamLibraries?.length
const showInstallSpinner =
- gettingInstallInfo || (!isZoom && !diskSize) || (isZoom && !zoomFilesLoaded)
+ gettingInstallInfo ||
+ (!isZoom && !diskSize) ||
+ (isZoom && !zoomFilesLoaded) ||
+ (isSteam && steamLibraries === null)
const readyToInstall = isZoom
? !!installPath &&
!gettingInstallInfo &&
validFlatpakPath &&
zoomSelectionReady &&
- wineSelectionValid
+ wineSelectionValid &&
+ steamLibrariesReady
: installPath &&
!!diskSize &&
!gettingInstallInfo &&
validFlatpakPath &&
- wineSelectionValid
+ wineSelectionValid &&
+ steamLibrariesReady
const hasDlcs = DLCList.length > 0
const hasWine = Boolean(wineSelector)
@@ -933,11 +946,13 @@ export default function DownloadDialog({
)}
{isSteam ? (
- <SteamLibrarySelector
- libraries={steamLibraries}
- selectedPath={installPath}
- onChange={setInstallPath}
- />
+ steamLibraries && (
+ <SteamLibrarySelector
+ libraries={steamLibraries}
+ selectedPath={installPath}
+ onChange={setInstallPath}
+ />
+ )
) : (
<PathSelectionBox
type="directory"
diff --git a/src/frontend/screens/Library/components/InstallModal/index.scss b/src/frontend/screens/Library/components/InstallModal/index.scss
index b68b955ec..da8a86a43 100644
--- a/src/frontend/screens/Library/components/InstallModal/index.scss
+++ b/src/frontend/screens/Library/components/InstallModal/index.scss
@@ -73,6 +73,14 @@
color: var(--text-secondary);
}
+.InstallModal__steamLibraryNotice {
+ display: flex;
+ flex-direction: column;
+ gap: var(--space-xs);
+ margin: var(--space-md) 0;
+ color: var(--text-secondary);
+}
+
.InstallModal__toggle {
display: flex;
align-items: center;
diff --git a/src/frontend/screens/Library/components/InstallModal/index.tsx b/src/frontend/screens/Library/components/InstallModal/index.tsx
index bc4557d72..53cb67265 100644
--- a/src/frontend/screens/Library/components/InstallModal/index.tsx
+++ b/src/frontend/screens/Library/components/InstallModal/index.tsx
@@ -159,7 +159,7 @@ function InstallModal({ appName, runner, gameInfo = null }: Props) {
}, [steamPlatforms, runner])
const hasWine =
- platformToInstall === 'Windows' && !isWin && runner !== 'steam'
+ platformToInstall === 'Windows' && !isWin && (runner !== 'steam' || isMac)
const wineSelectionValid =
!hasWine || isWineVersionListed(wineVersion, wineVersionList)
diff --git a/src/frontend/screens/Settings/components/SteamLaunchTarget.css b/src/frontend/screens/Settings/components/SteamLaunchTarget.css
index 7c0c180cb..f4b028be2 100644
--- a/src/frontend/screens/Settings/components/SteamLaunchTarget.css
+++ b/src/frontend/screens/Settings/components/SteamLaunchTarget.css
@@ -12,14 +12,26 @@
gap: var(--space-2xs);
}
-.steamLaunchTarget__missing {
- display: inline-flex;
- margin-inline-start: auto;
- color: var(--text-secondary);
+.steamLaunchTarget__row .SettingRow__control {
+ flex-wrap: wrap;
+}
+
+.SettingsCard .selectFieldWrapper.steamLaunchTarget__select {
+ grid-template-areas: 'select';
+ grid-template-columns: minmax(0, 1fr);
+ flex: 1 1 220px;
+ min-width: 200px;
+ max-width: 340px;
+}
- & svg {
- width: 16px;
- height: 16px;
- fill: currentColor;
- }
+.steamLaunchTarget__action {
+ flex-shrink: 0;
+}
+
+.steamLaunchTarget__hints {
+ display: flex;
+ flex-direction: column;
+ align-items: flex-end;
+ gap: var(--space-2xs);
+ margin-block-start: var(--space-xs);
}
diff --git a/src/frontend/screens/Settings/components/SteamLaunchTarget.tsx b/src/frontend/screens/Settings/components/SteamLaunchTarget.tsx
index 6b79889eb..61f7a0e9d 100644
--- a/src/frontend/screens/Settings/components/SteamLaunchTarget.tsx
+++ b/src/frontend/screens/Settings/components/SteamLaunchTarget.tsx
@@ -1,11 +1,16 @@
import { useContext, useEffect, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { MenuItem, SelectChangeEvent } from '@mui/material'
-import DownIcon from 'frontend/assets/down-icon.svg?react'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
-import { faLinux, faWindows } from '@fortawesome/free-brands-svg-icons'
-import { SelectField } from 'frontend/components/UI'
+import { faApple, faLinux, faWindows } from '@fortawesome/free-brands-svg-icons'
+import {
+ Button,
+ InfoTooltip,
+ SelectField,
+ SettingRow
+} from 'frontend/components/UI'
import SettingsContext from '../SettingsContext'
+import type { InstallPlatform } from 'common/types'
import type { SteamLaunchTarget as Target } from 'common/types/steam'
import type { SteamLaunchTargetsState } from 'frontend/hooks/useSteamLaunchTargets'
import './SteamLaunchTarget.css'
@@ -24,7 +29,9 @@ const SteamLaunchTarget = ({ state }: Props) => {
const { targets, selected, select, refresh, pinsPlatform } = state
const [busy, setBusy] = useState(false)
+ const [steamRunning, setSteamRunning] = useState(false)
const [error, setError] = useState('')
+ const [message, setMessage] = useState('')
const [downloadsOnSwitch, setDownloadsOnSwitch] = useState(false)
useEffect(() => {
@@ -36,6 +43,32 @@ const SteamLaunchTarget = ({ state }: Props) => {
const installPath = gameInfo?.install?.install_path
+ useEffect(() => {
+ if (window.platform !== 'darwin' || gameInfo?.runner !== 'steam') return
+ const needsAttention = targets.some(
+ (target) =>
+ target.id === 'windows-wine' &&
+ (target.missing === 'steam-wine' || target.missing === 'steam-sign-in')
+ )
+ if (!needsAttention) return
+
+ let cancelled = false
+ const check = async () => {
+ const runtime = await window.api.getSteamRuntimeStatus()
+ if (cancelled) return
+ setSteamRunning(runtime.running)
+ if (runtime.loggedIn || runtime.savedLogin) {
+ await refresh()
+ }
+ }
+ void check()
+ const timer = setInterval(check, 3000)
+ return () => {
+ cancelled = true
+ clearInterval(timer)
+ }
+ }, [gameInfo?.runner, targets, refresh])
+
// Nothing to choose between
if (isDefault || !gameInfo || targets.length < 2) {
return <></>
@@ -43,8 +76,8 @@ const SteamLaunchTarget = ({ state }: Props) => {
const modeLabel = (target: Target) => {
switch (target.steamMode) {
- case 'runtime':
- return t('setting.steamLaunchTarget.runtime', 'In-Wine Steam runtime')
+ case 'wine':
+ return t('setting.steamLaunchTarget.runtime', 'Windows Steam')
case 'host':
return t('setting.steamLaunchTarget.host', 'Host Steam')
case 'none':
@@ -55,12 +88,22 @@ const SteamLaunchTarget = ({ state }: Props) => {
}
const labelFor = (target: Target) => {
- const isLinuxBuild = target.platform === 'linux'
- const platformName = isLinuxBuild ? 'Linux' : 'Windows'
+ const platformName =
+ target.platform === 'linux'
+ ? 'Linux'
+ : target.platform === 'macos'
+ ? 'macOS'
+ : 'Windows'
+ const platformIcon =
+ target.platform === 'linux'
+ ? faLinux
+ : target.platform === 'macos'
+ ? faApple
+ : faWindows
return (
<span className="steamLaunchTarget__label">
<FontAwesomeIcon
- icon={isLinuxBuild ? faLinux : faWindows}
+ icon={platformIcon}
title={platformName}
aria-label={platformName}
/>
@@ -69,19 +112,8 @@ const SteamLaunchTarget = ({ state }: Props) => {
)
}
- const missingLabel = (target: Target) => {
- switch (target.missing) {
- case 'build':
- return t('setting.steamLaunchTarget.missingBuild', 'not downloaded')
- case 'steam-runtime':
- return t(
- 'setting.steamLaunchTarget.missingRuntime',
- 'Steam runtime not installed'
- )
- default:
- return ''
- }
- }
+ const installPlatformFor = (platform: Target['platform']): InstallPlatform =>
+ platform === 'linux' ? 'linux' : platform === 'macos' ? 'Mac' : 'Windows'
const fallback = targets.find((target) => target.isDefault)
const current = targets.find((target) => target.id === selected)
@@ -89,19 +121,21 @@ const SteamLaunchTarget = ({ state }: Props) => {
const handleChange = async (event: SelectChangeEvent) => {
const value = event.target.value === AUTOMATIC ? '' : event.target.value
setError('')
+ setMessage('')
await select(value)
}
const download = async () => {
if (!current) return
setError('')
+ setMessage('')
if (current.missing === 'build' && installPath) {
// Queued like any other download
await window.api.install({
appName,
runner: 'steam',
path: installPath,
- platformToInstall: current.platform === 'linux' ? 'linux' : 'Windows',
+ platformToInstall: installPlatformFor(current.platform),
gameInfo,
installDlcs: [],
sdlList: [],
@@ -109,13 +143,55 @@ const SteamLaunchTarget = ({ state }: Props) => {
})
return
}
- if (current.missing === 'steam-runtime') {
+ if (current.missing === 'steam-wine') {
setBusy(true)
const result = await window.api.installSteamWineRuntime()
setBusy(false)
if (result.status === 'error') {
setError(result.error ?? '')
}
+ setMessage(
+ t(
+ 'setting.steamLaunchTarget.installDone',
+ 'Windows Steam installed. Sign in to it before launching.'
+ )
+ )
+ await refresh()
+ }
+ if (current.missing === 'steam-sign-in') {
+ setBusy(true)
+ setMessage(
+ t('setting.steamLaunchTarget.opening', 'Opening Windows Steam…')
+ )
+ const result = await window.api.loginSteamWineRuntime()
+ if (result.status === 'error') {
+ setBusy(false)
+ setError(result.error ?? '')
+ return
+ }
+
+ let running = false
+ for (let attempt = 0; attempt < 20; attempt++) {
+ await new Promise((resolve) => setTimeout(resolve, 1000))
+ const runtime = await window.api.getSteamRuntimeStatus()
+ if (runtime.running) {
+ running = true
+ break
+ }
+ }
+ setBusy(false)
+ setSteamRunning(running)
+ setMessage(
+ running
+ ? t(
+ 'setting.steamLaunchTarget.signInOpened',
+ 'Sign in in the Windows Steam window. This page will update automatically.'
+ )
+ : t(
+ 'setting.steamLaunchTarget.openingFailed',
+ 'Windows Steam did not open. Check the log and try again.'
+ )
+ )
await refresh()
}
}
@@ -129,58 +205,110 @@ const SteamLaunchTarget = ({ state }: Props) => {
const canDownload =
(current?.missing === 'build' && !downloadsItself) ||
- current?.missing === 'steam-runtime'
+ current?.missing === 'steam-wine' ||
+ current?.missing === 'steam-sign-in'
+
+ const info = () => (
+ <ul>
+ <li>
+ {t(
+ 'setting.steamLaunchTarget.info.host',
+ 'Host Steam: starts your installed Steam client silently in the background. Needed for online play, multiplayer and DRM.'
+ )}
+ </li>
+ <li>
+ {t(
+ 'setting.steamLaunchTarget.info.runtime',
+ 'Windows Steam: runs a separate Steam client inside Wine, for when Steam is not installed on your system.'
+ )}
+ </li>
+ <li>
+ {t(
+ 'setting.steamLaunchTarget.info.none',
+ 'No Steam: starts the game without Steam. Online features and DRM-protected games may not work.'
+ )}
+ </li>
+ </ul>
+ )
+
+ const label = t('setting.steamLaunchTarget.title', 'Game version to launch')
return (
- <SelectField
- htmlId="steamLaunchTarget"
- label={t('setting.steamLaunchTarget.title', 'Game version to launch')}
- info={
- <ul>
- <li>
- {t(
- 'setting.steamLaunchTarget.info.host',
- 'Host Steam: starts your installed Steam client silently in the background. Needed for online play, multiplayer and DRM.'
- )}
- </li>
- <li>
- {t(
- 'setting.steamLaunchTarget.info.runtime',
- 'In-Wine Steam runtime: runs a separate Steam client inside Wine, for when Steam is not installed on your system.'
- )}
- </li>
- <li>
- {t(
- 'setting.steamLaunchTarget.info.none',
- 'No Steam: starts the game without Steam. Online features and DRM-protected games may not work.'
- )}
- </li>
- </ul>
- }
- value={selected || AUTOMATIC}
- onChange={handleChange}
- afterSelect={
- <>
- {canDownload && (
- <button
- className="button is-primary"
+ <div className="steamLaunchTarget">
+ <SettingRow
+ label={label}
+ labelAfter={<InfoTooltip content={info()} label={label} />}
+ htmlFor="steamLaunchTarget"
+ className="steamLaunchTarget__row"
+ >
+ <SelectField
+ htmlId="steamLaunchTarget"
+ extraClass="steamLaunchTarget__select"
+ value={selected || AUTOMATIC}
+ onChange={handleChange}
+ >
+ <MenuItem value={AUTOMATIC}>
+ <span className="steamLaunchTarget__label">
+ {t('setting.steamLaunchTarget.automatic', 'Automatic')}
+ {fallback && <>({labelFor(fallback)})</>}
+ </span>
+ </MenuItem>
+ {targets.map((target) => (
+ <MenuItem key={target.id} value={target.id}>
+ <span className="steamLaunchTarget__option">
+ {labelFor(target)}
+ </span>
+ </MenuItem>
+ ))}
+ </SelectField>
+ {canDownload &&
+ !(current?.missing === 'steam-sign-in' && steamRunning) && (
+ <Button
+ variant="secondary"
+ className="steamLaunchTarget__action"
disabled={busy}
onClick={download}
>
- {current?.missing === 'build'
- ? t('setting.steamLaunchTarget.downloadBuild', 'Download')
- : t(
- 'setting.steamLaunchTarget.installRuntime',
- 'Install Steam runtime'
- )}
- </button>
+ {busy && current?.missing === 'steam-sign-in'
+ ? t(
+ 'setting.steamLaunchTarget.opening',
+ 'Opening Windows Steam…'
+ )
+ : current?.missing === 'build'
+ ? t('setting.steamLaunchTarget.downloadBuild', 'Download')
+ : current?.missing === 'steam-sign-in'
+ ? t(
+ 'setting.steamLaunchTarget.signIn',
+ 'Sign in to Windows Steam'
+ )
+ : t(
+ 'setting.steamLaunchTarget.installRuntime',
+ 'Install Windows Steam'
+ )}
+ </Button>
)}
+ </SettingRow>
+ {(message ||
+ error ||
+ (current?.missing === 'steam-sign-in' && steamRunning) ||
+ switchesPlatform ||
+ (current && !current.available && !downloadsItself && fallback)) && (
+ <div className="steamLaunchTarget__hints">
{current && !current.available && !downloadsItself && fallback && (
<span className="smallInputInfo steamLaunchTarget__label">
- {t('setting.steamLaunchTarget.fallback', 'Until then, Play uses')}
- {labelFor(fallback)}
+ {t('setting.steamLaunchTarget.fallback', 'Until then, Play uses')}{' '}
+ {modeLabel(fallback)}
</span>
)}
+ {current?.missing === 'steam-sign-in' && steamRunning && (
+ <span className="smallInputInfo">
+ {t(
+ 'setting.steamLaunchTarget.steamRunning',
+ 'Windows Steam is open. Sign in in that window.'
+ )}
+ </span>
+ )}
+ {message && <span className="smallInputInfo">{message}</span>}
{error && <span className="smallInputInfo danger">{error}</span>}
{switchesPlatform && (
<span className="smallInputInfo">
@@ -195,32 +323,9 @@ const SteamLaunchTarget = ({ state }: Props) => {
)}
</span>
)}
- </>
- }
- >
- <MenuItem value={AUTOMATIC}>
- <span className="steamLaunchTarget__label">
- {t('setting.steamLaunchTarget.automatic', 'Automatic')}
- {fallback && <>({labelFor(fallback)})</>}
- </span>
- </MenuItem>
- {targets.map((target) => (
- <MenuItem key={target.id} value={target.id}>
- <span className="steamLaunchTarget__option">
- {labelFor(target)}
- {target.missing && (
- <span
- className="steamLaunchTarget__missing"
- title={missingLabel(target)}
- aria-label={missingLabel(target)}
- >
- <DownIcon />
- </span>
- )}
- </span>
- </MenuItem>
- ))}
- </SelectField>
+ </div>
+ )}
+ </div>
)
}
diff --git a/src/frontend/screens/Settings/components/WindowsSteamRuntime.tsx b/src/frontend/screens/Settings/components/WindowsSteamRuntime.tsx
new file mode 100644
index 000000000..40b9ebfdd
--- /dev/null
+++ b/src/frontend/screens/Settings/components/WindowsSteamRuntime.tsx
@@ -0,0 +1,175 @@
+import { useCallback, useContext, useEffect, useState } from 'react'
+import { useTranslation } from 'react-i18next'
+import type { SteamWindowsRuntimeStatus } from 'common/types/steam'
+import { Button } from 'frontend/components/UI'
+import ContextProvider from 'frontend/state/ContextProvider'
+
+export default function WindowsSteamRuntime() {
+ const { t } = useTranslation()
+ const { platform } = useContext(ContextProvider)
+ const [status, setStatus] = useState<SteamWindowsRuntimeStatus | null>(null)
+ const [busy, setBusy] = useState(false)
+ const [message, setMessage] = useState('')
+ const [error, setError] = useState('')
+ const [signingIn, setSigningIn] = useState(false)
+
+ const refresh = useCallback(async () => {
+ setStatus(await window.api.getSteamRuntimeStatus())
+ }, [])
+
+ useEffect(() => {
+ if (platform === 'darwin') void refresh()
+ }, [platform, refresh])
+
+ useEffect(() => {
+ if (
+ platform !== 'darwin' ||
+ !status ||
+ !status.supported ||
+ !status.installed ||
+ status.loggedIn ||
+ status.savedLogin ||
+ (!status.running && !signingIn)
+ ) {
+ return
+ }
+ const timer = setInterval(() => {
+ void refresh()
+ }, 3000)
+ return () => clearInterval(timer)
+ }, [platform, status, refresh, signingIn])
+
+ if (platform !== 'darwin') return null
+
+ const run = async (
+ action: () => Promise<{ status: 'done' | 'error'; error?: string }>,
+ done: string
+ ) => {
+ setBusy(true)
+ setError('')
+ setMessage('')
+ const result = await action()
+ setBusy(false)
+ if (result.status === 'error') {
+ setError(result.error ?? '')
+ } else {
+ setMessage(done)
+ }
+ await refresh()
+ }
+
+ const install = () =>
+ run(
+ () => window.api.installSteamWineRuntime(),
+ t(
+ 'setting.windowsSteamRuntime.installDone',
+ 'Windows Steam installed. Sign in to it before launching.'
+ )
+ )
+
+ const login = async () => {
+ setSigningIn(true)
+ setBusy(true)
+ setError('')
+ setMessage(
+ t('setting.windowsSteamRuntime.opening', 'Opening Windows Steam…')
+ )
+ try {
+ const result = await window.api.loginSteamWineRuntime()
+ if (result.status === 'error') {
+ setError(result.error ?? '')
+ return
+ }
+
+ let running = false
+ for (let attempt = 0; attempt < 20; attempt++) {
+ await new Promise((resolve) => setTimeout(resolve, 1000))
+ const runtime = await window.api.getSteamRuntimeStatus()
+ if (runtime.running) {
+ running = true
+ break
+ }
+ }
+ setMessage(
+ running
+ ? t(
+ 'setting.windowsSteamRuntime.loginOpened',
+ 'Sign in in the Windows Steam window. This page will update automatically.'
+ )
+ : t(
+ 'setting.windowsSteamRuntime.openingFailed',
+ 'Windows Steam did not open. Check the log and try again.'
+ )
+ )
+ await refresh()
+ } catch (error) {
+ setError(
+ error instanceof Error
+ ? error.message
+ : t(
+ 'setting.windowsSteamRuntime.openFailed',
+ 'Could not open Windows Steam.'
+ )
+ )
+ } finally {
+ setSigningIn(false)
+ setBusy(false)
+ }
+ }
+
+ return (
+ <div className="smallInputInfo">
+ <p>
+ {!status
+ ? t('setting.windowsSteamRuntime.checking', 'Checking…')
+ : !status.supported
+ ? t(
+ 'setting.windowsSteamRuntime.unsupported',
+ 'This Aurelia version does not support Windows Steam.'
+ )
+ : !status.installed
+ ? t(
+ 'setting.windowsSteamRuntime.notInstalled',
+ 'Windows Steam is not installed. Install it to play Steam-DRM Windows games on macOS.'
+ )
+ : !status.loggedIn && !status.savedLogin
+ ? status.running
+ ? t(
+ 'setting.windowsSteamRuntime.running',
+ 'Windows Steam is open. Sign in in that window.'
+ )
+ : t(
+ 'setting.windowsSteamRuntime.notSignedIn',
+ 'Windows Steam is installed but not signed in.'
+ )
+ : t(
+ 'setting.windowsSteamRuntime.ready',
+ 'Windows Steam is ready.'
+ )}
+ </p>
+ {status?.supported && !status.installed && (
+ <Button variant="secondary" disabled={busy} onClick={install}>
+ {t('setting.windowsSteamRuntime.install', 'Install Windows Steam')}
+ </Button>
+ )}
+ {status?.installed &&
+ !status.loggedIn &&
+ !status.savedLogin &&
+ !status.running && (
+ <Button variant="secondary" disabled={busy} onClick={login}>
+ {busy
+ ? t(
+ 'setting.windowsSteamRuntime.opening',
+ 'Opening Windows Steam…'
+ )
+ : t(
+ 'setting.windowsSteamRuntime.signIn',
+ 'Sign in to Windows Steam'
+ )}
+ </Button>
+ )}
+ {message && <p>{message}</p>}
+ {error && <p className="danger">{error}</p>}
+ </div>
+ )
+}
diff --git a/src/frontend/screens/Settings/components/WinePrefix.tsx b/src/frontend/screens/Settings/components/WinePrefix.tsx
index 814a273bb..10d878a32 100644
--- a/src/frontend/screens/Settings/components/WinePrefix.tsx
+++ b/src/frontend/screens/Settings/components/WinePrefix.tsx
@@ -14,17 +14,28 @@ const WinePrefix = () => {
const wineVersion = getSetting('wineVersion', defaultWineVersion)
const isWin = platform === 'win32'
+ const isMacWindowsSteam =
+ runner === 'steam' &&
+ platform === 'darwin' &&
+ gameInfo?.install?.platform === 'windows'
const [sharedWinePrefix] = useSetting('sharedWinePrefix', '')
const [winePrefix, setWinePrefix] = useSetting('winePrefix', sharedWinePrefix)
const [steamPrefix, setSteamPrefix] = useSetting('steamPrefix', '')
+ const prefixLabel = isMacWindowsSteam
+ ? t('setting.windowsSteamPrefix', 'Windows Steam prefix')
+ : t('setting.wineprefix', 'WinePrefix folder')
+ const prefixDialogTitle = isMacWindowsSteam
+ ? t('box.windowsSteamPrefix', 'Select Windows Steam prefix folder')
+ : t('box.wineprefix')
+
if (isWin || wineVersion.type === 'crossover') {
return <></>
}
// Empty: Steam's compatdata folder
- if (runner === 'steam') {
+ if (runner === 'steam' && !isMacWindowsSteam) {
const compatdata = steamCompatdataPrefix(
gameInfo?.install.install_path,
gameInfo?.app_name
@@ -51,11 +62,11 @@ const WinePrefix = () => {
<>
<PathSelectionBox
htmlId="selectWinePrefix"
- label={t('setting.wineprefix')}
+ label={prefixLabel}
path={winePrefix}
onPathChange={setWinePrefix}
type="directory"
- pathDialogTitle={t('box.wineprefix')}
+ pathDialogTitle={prefixDialogTitle}
pathDialogDefaultPath={winePrefix}
noDeleteButton
info={
diff --git a/src/frontend/screens/Settings/components/index.ts b/src/frontend/screens/Settings/components/index.ts
index 4af0174d0..004248c33 100644
--- a/src/frontend/screens/Settings/components/index.ts
+++ b/src/frontend/screens/Settings/components/index.ts
@@ -19,6 +19,7 @@ export { default as CustomWineProton } from './CustomWineProton'
export { default as CustomCSS } from './CustomCSS'
export { default as DefaultInstallPath } from './DefaultInstallPath'
export { default as DefaultSteamPath } from './DefaultSteamPath'
+export { default as WindowsSteamRuntime } from './WindowsSteamRuntime'
export { default as DisableController } from './DisableController'
export { default as DisableGuideButton } from './DisableGuideButton'
export { default as DetectedControllers } from './DetectedControllers'
diff --git a/src/frontend/screens/Settings/sections/GamesSettings/index.tsx b/src/frontend/screens/Settings/sections/GamesSettings/index.tsx
index 760fb3f43..730564caf 100644
--- a/src/frontend/screens/Settings/sections/GamesSettings/index.tsx
+++ b/src/frontend/screens/Settings/sections/GamesSettings/index.tsx
@@ -104,22 +104,38 @@ export default function GamesSettings({ initialTab }: Props = {}) {
const [disableUMU] = useSetting('disableUMU', false)
const [nativeFromApi, setIsNative] = useState(false)
const isLinux = platform === 'linux'
- const steamTargets = useSteamLaunchTargets(appName, gameInfo, isLinux)
+ const isWin = platform === 'win32'
+ const isMac = platform === 'darwin'
+ const steamTargets = useSteamLaunchTargets(
+ appName,
+ gameInfo,
+ isLinux || isMac
+ )
+ // Windows Steam games run through Wine on macOS, not through Aurelia
+ const isMacWindowsSteam =
+ gameInfo?.runner === 'steam' &&
+ isMac &&
+ gameInfo?.install?.platform === 'windows'
// Steam: follows the chosen game version
const steamPlatform = steamTargets.platform
- const isNative = steamPlatform ? steamPlatform === 'linux' : nativeFromApi
+ const isNative =
+ isMac && gameInfo?.runner === 'steam'
+ ? !isMacWindowsSteam
+ : steamPlatform
+ ? steamPlatform === 'linux'
+ : nativeFromApi
// Hide card when both rows hide
const showSteamCard =
gameInfo?.runner === 'steam' &&
!isDefault &&
- (isLinux || steamTargets.targets.length > 1)
- const isWin = platform === 'win32'
- const isMac = platform === 'darwin'
+ (isLinux || (isMac && steamTargets.targets.length > 1))
const isCrossover = wineVersion?.type === 'crossover'
const showCloudSavesTab =
gameInfo?.runner === 'gog' ||
gameInfo?.runner === 'legendary' ||
- (gameInfo?.runner === 'steam' && gameInfo.is_installed)
+ (gameInfo?.runner === 'steam' &&
+ gameInfo.is_installed &&
+ !isMacWindowsSteam)
const isBrowserGame = gameInfo?.install.platform === 'Browser'
const isSideloaded = gameInfo?.runner === 'sideload'
// Steam uses Modify installation instead
diff --git a/src/frontend/screens/Settings/sections/RunnersSettings/index.tsx b/src/frontend/screens/Settings/sections/RunnersSettings/index.tsx
index ba8c94c31..215e6465e 100644
--- a/src/frontend/screens/Settings/sections/RunnersSettings/index.tsx
+++ b/src/frontend/screens/Settings/sections/RunnersSettings/index.tsx
@@ -13,7 +13,8 @@ import {
EgsSettings,
LegendaryApiTimeout,
ShowValveProton,
- SteamLinuxRuntimeSettings
+ SteamLinuxRuntimeSettings,
+ WindowsSteamRuntime
} from '../../components'
export default function RunnersSettings() {
@@ -47,6 +48,7 @@ export default function RunnersSettings() {
<SettingsCard glyph={Boxes} title={t('settings.section.steam', 'Steam')}>
<AltAureliaBin />
<DefaultSteamPath />
+ <WindowsSteamRuntime />
{isLinux && <ShowValveProton />}
{isLinux && <SteamLinuxRuntimeSettings />}
</SettingsCard>
diff --git a/src/frontend/state/GlobalState.tsx b/src/frontend/state/GlobalState.tsx
index 71281861c..89796ca81 100644
--- a/src/frontend/state/GlobalState.tsx
+++ b/src/frontend/state/GlobalState.tsx
@@ -266,7 +266,8 @@ class GlobalState extends PureComponent<Props> {
? this.loadSteamLibrary()
: [],
username: steamConfigStore.get_nodefault('username'),
- enabled: window.platform !== 'darwin' && !window.isFlatpak,
+ // On macOS the backend confirms that the Aurelia helper exists.
+ enabled: !window.isFlatpak && window.platform !== 'darwin',
users: []
},
wineVersions: wineDownloaderInfoStore.get('wine-releases', []),
@@ -811,7 +812,20 @@ class GlobalState extends PureComponent<Props> {
})
await this.loadSteamUsers()
- this.handleSuccessfulLogin('steam')
+ storage.setItem('category', 'all')
+ // The startup refresh may still be running; refresh Steam directly so the
+ // new session's library is not dropped by refreshLibrary's guard.
+ try {
+ await window.api.refreshLibrary('steam')
+ } catch (error) {
+ window.api.logError(`Steam library refresh failed: ${String(error)}`)
+ }
+ this.setState((prev) => ({
+ steam: {
+ ...(prev as StateProps).steam,
+ library: this.loadSteamLibrary()
+ }
+ }))
}
return response
@@ -934,7 +948,8 @@ class GlobalState extends PureComponent<Props> {
}
let steamLibrary: GameInfo[] = []
- if (steam.enabled && steam.username) {
+ const steamUsername = steam.username ?? this.state.steam.username
+ if (steam.enabled && steamUsername) {
steamLibrary = this.loadSteamLibrary(overrides)
if (!steamLibrary.length || !steam.library.length) {
window.api.logInfo('No cache found, getting data from steam...')
@@ -974,7 +989,10 @@ class GlobalState extends PureComponent<Props> {
enabled: zoom.enabled
},
steam: {
- library: steamLibrary,
+ // A Steam login can arrive while this refresh is running
+ library: this.state.steam.username
+ ? this.loadSteamLibrary(overrides)
+ : [],
// Live values; loaded during refresh
username: (prev as StateProps).steam.username,
enabled: steam.enabled,
@@ -1125,7 +1143,18 @@ class GlobalState extends PureComponent<Props> {
}
}
- if (steam.enabled) {
+ // A failing support check must not abort the rest of this refresh.
+ const steamSupported = await window.api
+ .isSteamSupported()
+ .catch(() => false)
+ if (steamSupported !== this.state.steam.enabled) {
+ this.setState((prev) => {
+ const state = prev as StateProps
+ return { steam: { ...state.steam, enabled: steamSupported } }
+ })
+ }
+
+ if (steamSupported) {
void this.loadSteamUsers()
}
diff --git a/src/preload/api/steam.ts b/src/preload/api/steam.ts
index 088f4d8fd..d77dda733 100644
--- a/src/preload/api/steam.ts
+++ b/src/preload/api/steam.ts
@@ -1,6 +1,7 @@
import { makeHandlerInvoker, makeListenerCaller, frontendListenerSlot } from '../ipc'
export const getSteamUserInfo = makeHandlerInvoker('getSteamUserInfo')
+export const isSteamSupported = makeHandlerInvoker('isSteamSupported')
export const getSteamDlcInfo = makeHandlerInvoker('getSteamDlcInfo')
export const getSteamInstallLibraries = makeHandlerInvoker('getSteamInstallLibraries')
export const getSteamDownloadLimit = makeHandlerInvoker('getSteamDownloadLimit')
@@ -15,7 +16,9 @@ export const setSteamLinuxRuntime = makeHandlerInvoker('setSteamLinuxRuntime')
export const getSteamLaunchTargets = makeHandlerInvoker('getSteamLaunchTargets')
export const setSteamLaunchTarget = makeHandlerInvoker('setSteamLaunchTarget')
export const applySteamLaunchTarget = makeHandlerInvoker('applySteamLaunchTarget')
+export const getSteamRuntimeStatus = makeHandlerInvoker('getSteamRuntimeStatus')
export const installSteamWineRuntime = makeHandlerInvoker('installSteamWineRuntime')
+export const loginSteamWineRuntime = makeHandlerInvoker('loginSteamWineRuntime')
export const loginSteam = makeHandlerInvoker('loginSteam')
export const loginSteamQr = makeHandlerInvoker('loginSteamQr')
export const cancelSteamQrLogin = makeListenerCaller('cancelSteamQrLogin')