Skip to content

Commit 2930644

Browse files
authored
Set Steam App ID variables when using the Runtime on Proton + fixup setting user-defined env vars on native games (#1355)
* Set STEAM_COMPAT_APP_ID and SteamAppId for Runtime * Add user-defined env vars for native games again * Also set SteamGameId This makes PROTON_LOG work * Set SteamGameId based on the Game Name * Fixup local flatpak install file * Override Proton log dir to make it work on Flatpak * Fixup typo * Also set WINEDEBUG * Only set WINEDEBUG if PROTON_LOG is set
1 parent 37cdf7e commit 2930644

File tree

2 files changed

+32
-16
lines changed

2 files changed

+32
-16
lines changed

electron/launcher.ts

+28-12
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,8 @@ async function prepareWineLaunch(game: LegendaryGame | GOGGame): Promise<{
189189
}
190190
}
191191

192-
const envVars = setupWineEnvVars(gameSettings)
192+
const installFolderName = (await game.getGameInfo()).folder_name
193+
const envVars = setupWineEnvVars(gameSettings, installFolderName)
193194

194195
return { success: true, envVars: envVars }
195196
}
@@ -209,16 +210,28 @@ function setupEnvVars(gameSettings: GameSettings) {
209210
if (gameSettings.audioFix) {
210211
ret.PULSE_LATENCY_MSEC = '60'
211212
}
213+
if (gameSettings.otherOptions) {
214+
gameSettings.otherOptions
215+
.split(' ')
216+
.filter((val) => val.indexOf('=') !== -1)
217+
.forEach((envKeyAndVar) => {
218+
const keyAndValueSplit = envKeyAndVar.split('=')
219+
const key = keyAndValueSplit.shift()
220+
const value = keyAndValueSplit.join('=')
221+
ret[key] = value
222+
})
223+
}
212224

213225
return ret
214226
}
215227

216228
/**
217229
* Maps Wine-related settings to environment variables
218230
* @param gameSettings The GameSettings to get the environment variables for
231+
* @param gameId If Proton and the Steam Runtime are used, the SteamGameId variable will be set to `heroic-gameId`
219232
* @returns A Record that can be passed to execAsync/spawn
220233
*/
221-
function setupWineEnvVars(gameSettings: GameSettings) {
234+
function setupWineEnvVars(gameSettings: GameSettings, gameId = '0') {
222235
const { wineVersion } = gameSettings
223236

224237
// Add WINEPREFIX / STEAM_COMPAT_DATA_PATH / CX_BOTTLE
@@ -246,16 +259,19 @@ function setupWineEnvVars(gameSettings: GameSettings) {
246259
if (gameSettings.enableResizableBar) {
247260
ret.VKD3D_CONFIG = 'upload_hvv'
248261
}
249-
if (gameSettings.otherOptions) {
250-
gameSettings.otherOptions
251-
.split(' ')
252-
.filter((val) => val.indexOf('=') !== -1)
253-
.forEach((envKeyAndVar) => {
254-
const keyAndValueSplit = envKeyAndVar.split('=')
255-
const key = keyAndValueSplit.shift()
256-
const value = keyAndValueSplit.join('=')
257-
ret[key] = value
258-
})
262+
if (gameSettings.useSteamRuntime) {
263+
// If we don't set this, GE-Proton tries to guess the AppID from the prefix path, which doesn't work in our case
264+
ret.STEAM_COMPAT_APP_ID = '0'
265+
ret.SteamAppId = ret.STEAM_COMPAT_APP_ID
266+
// This sets the name of the log file given when setting PROTON_LOG=1
267+
ret.SteamGameId = `heroic-${gameId}`
268+
ret.PROTON_LOG_DIR = flatPakHome
269+
270+
// Only set WINEDEBUG if PROTON_LOG is set since Proton will also log if just WINEDEBUG is set
271+
if (gameSettings.otherOptions.includes('PROTON_LOG=')) {
272+
// Stop Proton from overriding WINEDEBUG; this prevents logs growing to a few GB for some games
273+
ret.WINEDEBUG = 'timestamp'
274+
}
259275
}
260276
return ret
261277
}

flatpak/local.heroic.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ modules:
124124
- name: heroic
125125
buildsystem: simple
126126
build-commands:
127-
- unappimage Heroic-2.3.1.AppImage
128-
- rm Heroic-2.3.1.AppImage
127+
- unappimage Heroic-2.3.3.AppImage
128+
- rm Heroic-2.3.3.AppImage
129129
- mv squashfs-root /app/bin/heroic
130130
- install -D heroic-run -t /app/bin
131131
sources:
@@ -135,9 +135,9 @@ modules:
135135
- zypak-wrapper /app/bin/heroic/heroic "$@"
136136

137137
- type: file
138-
filename: Heroic-2.3.1.AppImage
138+
filename: Heroic-2.3.3.AppImage
139139
# put right path here
140-
path: ../dist/Heroic-2.3.1.AppImage
140+
path: ../dist/Heroic-2.3.3.AppImage
141141

142142
- name: platform-bootstrap
143143
buildsystem: simple

0 commit comments

Comments
 (0)