Skip to content

Commit 7f91117

Browse files
authored
[UX] Warn when Shader Pre-Cache is disabled and using umu in SD's gaming mode (#4328)
1 parent 7279908 commit 7f91117

File tree

1 file changed

+40
-2
lines changed

1 file changed

+40
-2
lines changed

src/backend/logger/logger.ts

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,18 @@ import { backendEvents } from 'backend/backend_events'
1111
import { GlobalConfig } from 'backend/config'
1212
import { getGOGdlBin, getLegendaryBin } from 'backend/utils'
1313
import { dirname, join } from 'path'
14-
import { formatSystemInfo, getSystemInfo } from '../utils/systeminfo'
14+
import {
15+
formatSystemInfo,
16+
getSystemInfo,
17+
SystemInformation
18+
} from '../utils/systeminfo'
1519
import { appendFile, writeFile } from 'fs/promises'
1620
import { gamesConfigPath, isWindows } from 'backend/constants'
1721
import { gameManagerMap } from 'backend/storeManagers'
1822
import { existsSync, mkdirSync, openSync } from 'graceful-fs'
1923
import { Winetricks } from 'backend/tools'
2024
import { gameAnticheatInfo } from 'backend/anticheat/utils'
25+
import { isUmuSupported } from 'backend/utils/compatibility_layers'
2126

2227
export enum LogPrefix {
2328
General = '',
@@ -461,6 +466,31 @@ class LogWriter {
461466
}
462467
}
463468

469+
/*
470+
* If we are running on a SteamDeck's gaming mode and the game is configured to use umu,
471+
* we can check the availability of the env variables added by Steam's Shared Pre-cache
472+
* that are required by umu to work properly
473+
*
474+
* More details: https://github.com/Open-Wine-Components/umu-launcher/wiki/Frequently-asked-questions-(FAQ)#why-am-i-not-able-to-see-my-game-when-using-my-launcher-from-steam-mode-gaming-mode
475+
*/
476+
const shouldToggleShaderPreCacheOn = async (
477+
info: SystemInformation | null,
478+
gameSettings: GameSettings
479+
) => {
480+
if (!info) return false
481+
if (!info.steamDeckInfo.isDeck) return false
482+
if (info.steamDeckInfo.mode !== 'game') return false
483+
if (!(await isUmuSupported(gameSettings))) return false
484+
485+
// check if all of the following env variables are undefined
486+
return [
487+
'STEAM_COMPAT_TRANSCODED_MEDIA_PATH',
488+
'STEAM_COMPAT_MEDIA_PATH',
489+
'STEAM_FOSSILIZE_DUMP_PATH',
490+
'DXVK_STATE_CACHE_PATH'
491+
].every((envVar) => !process.env[envVar])
492+
}
493+
464494
class GameLogWriter extends LogWriter {
465495
gameInfo: GameInfo
466496

@@ -494,9 +524,10 @@ class GameLogWriter extends LogWriter {
494524
`Installed in: ${installPath}\n\n`
495525
)
496526

527+
let info: SystemInformation | null = null
497528
try {
498529
// log system information
499-
const info = await getSystemInfo()
530+
info = await getSystemInfo()
500531
const systemInfo = await formatSystemInfo(info)
501532

502533
await appendFile(this.filePath, `System Info:\n${systemInfo}\n\n`)
@@ -527,6 +558,13 @@ class GameLogWriter extends LogWriter {
527558
)
528559
}
529560

561+
if (await shouldToggleShaderPreCacheOn(info, gameSettings)) {
562+
await appendFile(
563+
this.filePath,
564+
`Warning: Steam's Shader Pre-Caching is disabled and umu is enabled. Steam's Shader Pre-cache is required by umu to work properly on the SteamDeck's Gaming mode.\n\n`
565+
)
566+
}
567+
530568
await appendFile(
531569
this.filePath,
532570
`Game launched at: ${startPlayingDate}\n\n`

0 commit comments

Comments
 (0)