Skip to content

[Linux] Set some more Wine-related env vars when launching with built-in libraries #1852

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 11, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 24 additions & 7 deletions src/backend/launcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,20 +330,37 @@ function setupWineEnvVars(gameSettings: GameSettings, gameId = '0') {
}
}
if (!gameSettings.preferSystemLibs && wineVersion.type === 'wine') {
if (wineVersion.lib32 && wineVersion.lib) {
// https://github.com/ValveSoftware/Proton/blob/4221d9ef07cc38209ff93dbbbca9473581a38255/proton#L1091-L1093
if (!process.env.ORIG_LD_LIBRARY_PATH) {
ret.ORIG_LD_LIBRARY_PATH = process.env.LD_LIBRARY_PATH ?? ''
}

const { lib32, lib } = wineVersion
if (lib32 && lib) {
// append wine libs at the beginning
ret.LD_LIBRARY_PATH = [
wineVersion.lib32,
wineVersion.lib,
process.env.LD_LIBRARY_PATH
]
ret.LD_LIBRARY_PATH = [lib, lib32, process.env.LD_LIBRARY_PATH]
.filter(Boolean)
.join(':')

// https://github.com/ValveSoftware/Proton/blob/4221d9ef07cc38209ff93dbbbca9473581a38255/proton#L1099
// NOTE: Proton does not make sure that these folders exist first, I believe we should :^)
const gstp_path_lib64 = join(lib, 'gstreamer-1.0')
const gstp_path_lib32 = join(lib32, 'gstreamer-1.0')
if (existsSync(gstp_path_lib64) && existsSync(gstp_path_lib32)) {
ret.GST_PLUGIN_SYSTEM_PATH_1_0 = gstp_path_lib64 + ':' + gstp_path_lib32
}

// https://github.com/ValveSoftware/Proton/blob/4221d9ef07cc38209ff93dbbbca9473581a38255/proton#L1097
const winedll_path_lib64 = join(lib, 'wine')
const winedll_path_lib32 = join(lib32, 'wine')
if (existsSync(winedll_path_lib64) && existsSync(winedll_path_lib32)) {
ret.WINEDLLPATH = winedll_path_lib64 + ':' + winedll_path_lib32
}
} else {
logError(
[
`Couldn't find all library folders of ${wineVersion.name}!`,
`Missing ${wineVersion.lib32} or ${wineVersion.lib}!`,
`Missing ${lib32} and/or ${lib}!`,
`Falling back to system libraries!`
].join('\n')
)
Expand Down