Skip to content

[Linux] Added option to prefer system libs #1564

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 12 commits into from
Jul 13, 2022
25 changes: 25 additions & 0 deletions electron/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ abstract class GlobalConfig {
bin: wineBin,
name: `Wine - ${version}`,
type: 'wine',
...this.getWineLibs(wineBin),
...this.getWineExecs(wineBin)
})
})
Expand All @@ -224,6 +225,7 @@ abstract class GlobalConfig {
bin: wineBin,
name: `Wine - ${version}`,
type: 'wine',
...this.getWineLibs(wineBin),
...this.getWineExecs(wineBin)
})
})
Expand Down Expand Up @@ -306,6 +308,28 @@ abstract class GlobalConfig {
return ret
}

/**
* Checks if a Wine version has lib/lib32 folders and returns the path to those if they're present
* @param wineBin The unquoted path to the Wine binary ('wine')
* @returns The paths to lib and lib32, if present
*/
public getWineLibs(wineBin: string): {
lib: string
lib32: string
} {
const wineDir = dirname(wineBin)
const ret = { lib: '', lib32: '' }
const potLib32Path = join(wineDir, '../lib')
if (existsSync(potLib32Path)) {
ret.lib32 = potLib32Path
}
const potLibPath = join(wineDir, '../lib64')
if (existsSync(potLibPath)) {
ret.lib = potLibPath
}
return ret
}

/**
* Gets the actual settings from the config file.
* Does not modify its parent object.
Expand Down Expand Up @@ -453,6 +477,7 @@ class GlobalConfigV0 extends GlobalConfig {
addStartMenuShortcuts: false,
autoInstallDxvk: false,
autoInstallVkd3d: false,
preferSystemLibs: false,
checkForUpdatesOnStartup: !isFlatpak,
customWinePaths: isWindows ? null : [],
defaultInstallPath: heroicInstallPath,
Expand Down
2 changes: 2 additions & 0 deletions electron/game_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ class GameConfigV0 extends GameConfig {
audioFix,
autoInstallDxvk,
autoInstallVkd3d,
preferSystemLibs,
autoSyncSaves,
enableEsync,
enableFSR,
Expand All @@ -237,6 +238,7 @@ class GameConfigV0 extends GameConfig {
audioFix,
autoInstallDxvk,
autoInstallVkd3d,
preferSystemLibs,
autoSyncSaves,
enableEsync,
enableFSR,
Expand Down
25 changes: 25 additions & 0 deletions electron/launcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,13 @@ function setupEnvVars(gameSettings: GameSettings) {
})
}

// setup LD_PRELOAD if not defined
// fixes the std::log_error for Fall Guys
// thanks to https://github.com/Diyou
if (!process.env.LD_PRELOAD) {
ret.LD_PRELOAD = ''
}

return ret
}

Expand Down Expand Up @@ -303,6 +310,24 @@ function setupWineEnvVars(gameSettings: GameSettings, gameId = '0') {
ret.WINEDEBUG = 'timestamp'
}
}
if (!gameSettings.preferSystemLibs && wineVersion.type === 'wine') {
if (wineVersion.lib32 && wineVersion.lib) {
// append wine libs at the beginning
ret.LD_LIBRARY_PATH = [
wineVersion.lib32,
wineVersion.lib,
process.env.LD_LIBRARY_PATH
].join(':')
} else {
logError(
[
`Couldn't find all library folders of ${wineVersion.name}!`,
`Missing ${wineVersion.lib32} or ${wineVersion.lib}!`,
`Falling back to system libraries!`
].join('\n')
)
}
}
return ret
}

Expand Down
4 changes: 4 additions & 0 deletions electron/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export interface AppSettings {
audioFix: boolean
autoInstallDxvk: boolean
autoInstallVkd3d: boolean
preferSystemLibs: boolean
autoSyncSaves: boolean
checkForUpdatesOnStartup: boolean
customWinePaths: string[]
Expand Down Expand Up @@ -133,6 +134,7 @@ export interface GameSettings {
audioFix: boolean
autoInstallDxvk: boolean
autoInstallVkd3d: boolean
preferSystemLibs: boolean
autoSyncSaves: boolean
enableEsync: boolean
enableFSR: boolean
Expand Down Expand Up @@ -236,6 +238,8 @@ export interface WineInstallation {
bin: string
name: string
type: 'wine' | 'proton' | 'crossover'
lib?: string
lib32?: string
wineboot?: string
wineserver?: string
}
Expand Down
2 changes: 2 additions & 0 deletions public/locales/bg/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@
"part6": " които да се викнат след командата за пускане, например: ",
"part7": " за да се пропусне стартиращата програма в някои игри и т.н."
},
"preferSystemLibs": "Custom Wine versions (Wine-GE, Wine-Lutris) are shipped with their library dependencies. By enabling this option, these shipped libraries will be ignored and Wine will load system libraries instead. Warning! Issues may occur if dependencies are not met.",
"resizablebar": "NVIDIA's Resizable Bar helps boost framerate by making the CPU access the entire graphics buffer. Enabling may improve performance for Vulkan-based games.",
"steamruntime": "Custom libraries provided by Steam to help run Linux and Windows (Proton) games. Enabling might improve compatibility.",
"sync": {
Expand Down Expand Up @@ -363,6 +364,7 @@
"minimize-on-launch": "Минимизиране на Heroic при пускане на игра",
"offlinemode": "Пускане на играта в режим „извън линия“",
"prefered_language": "Предпочитан език (код на езика)",
"preferSystemLibs": "Prefer system libraries",
"primerun": "Използване на отделната видео-карта",
"resizableBar": "Включване на „Resizable BAR“ (Само за NVIDIA RTX 30xx)",
"runexe": {
Expand Down
2 changes: 2 additions & 0 deletions public/locales/ca/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@
"part6": " després de l'ordre d'inici, com ara: ",
"part7": " per a ometre el llançador a alguns jocs, etc."
},
"preferSystemLibs": "Custom Wine versions (Wine-GE, Wine-Lutris) are shipped with their library dependencies. By enabling this option, these shipped libraries will be ignored and Wine will load system libraries instead. Warning! Issues may occur if dependencies are not met.",
"resizablebar": "NVIDIA's Resizable Bar helps boost framerate by making the CPU access the entire graphics buffer. Enabling may improve performance for Vulkan-based games.",
"steamruntime": "Custom libraries provided by Steam to help run Linux and Windows (Proton) games. Enabling might improve compatibility.",
"sync": {
Expand Down Expand Up @@ -363,6 +364,7 @@
"minimize-on-launch": "Minimitza el Heroic després d'executar un joc",
"offlinemode": "Executa el joc sense connexió",
"prefered_language": "Idioma preferit (codi de l'idioma)",
"preferSystemLibs": "Prefer system libraries",
"primerun": "Usa la targeta gràfica dedicada",
"resizableBar": "Activa el BAR redimensionable (només amb NVIDIA RTX 30xx)",
"runexe": {
Expand Down
2 changes: 2 additions & 0 deletions public/locales/cs/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@
"part6": " které budou použity při spuštění hry, například: ",
"part7": " pro přeskočení spouštěče u některých her, apod."
},
"preferSystemLibs": "Custom Wine versions (Wine-GE, Wine-Lutris) are shipped with their library dependencies. By enabling this option, these shipped libraries will be ignored and Wine will load system libraries instead. Warning! Issues may occur if dependencies are not met.",
"resizablebar": "NVIDIA's Resizable Bar helps boost framerate by making the CPU access the entire graphics buffer. Enabling may improve performance for Vulkan-based games.",
"steamruntime": "Custom libraries provided by Steam to help run Linux and Windows (Proton) games. Enabling might improve compatibility.",
"sync": {
Expand Down Expand Up @@ -363,6 +364,7 @@
"minimize-on-launch": "Minimalizujte Heroic po spuštění hry",
"offlinemode": "Spustit hru offline",
"prefered_language": "Preferovaný jazyk (kód jazyka)",
"preferSystemLibs": "Prefer system libraries",
"primerun": "Použít dedikovanou grafickou kartu",
"resizableBar": "Používat Resizable BAR (pouze s NVIDIA RTX 30xx)",
"runexe": {
Expand Down
2 changes: 2 additions & 0 deletions public/locales/de/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@
"part6": " die nach dem Startbefehl aufgerufen werden, z.B.: ",
"part7": " um den Launcher in einigen Spielen zu überspringen, usw."
},
"preferSystemLibs": "Custom Wine versions (Wine-GE, Wine-Lutris) are shipped with their library dependencies. By enabling this option, these shipped libraries will be ignored and Wine will load system libraries instead. Warning! Issues may occur if dependencies are not met.",
"resizablebar": "NVIDIA's Resizable Bar helps boost framerate by making the CPU access the entire graphics buffer. Enabling may improve performance for Vulkan-based games.",
"steamruntime": "Custom libraries provided by Steam to help run Linux and Windows (Proton) games. Enabling might improve compatibility.",
"sync": {
Expand Down Expand Up @@ -363,6 +364,7 @@
"minimize-on-launch": "Heroic nach Spielstart minimieren",
"offlinemode": "Spiel offline ausführen",
"prefered_language": "Prefered Language (Language Code)",
"preferSystemLibs": "Prefer system libraries",
"primerun": "Dedizierte Grafikkarte verwenden",
"resizableBar": "Resizable BAR aktivieren (nur NVIDIA RTX 30xx)",
"runexe": {
Expand Down
2 changes: 2 additions & 0 deletions public/locales/el/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@
"part6": " για κλήση μετά την εντολή εκκίνησης, για παράδειγμα: ",
"part7": " για παράλειψη του εκκινητή σε κάποια παιχνίδια, κτλ."
},
"preferSystemLibs": "Custom Wine versions (Wine-GE, Wine-Lutris) are shipped with their library dependencies. By enabling this option, these shipped libraries will be ignored and Wine will load system libraries instead. Warning! Issues may occur if dependencies are not met.",
"resizablebar": "NVIDIA's Resizable Bar helps boost framerate by making the CPU access the entire graphics buffer. Enabling may improve performance for Vulkan-based games.",
"steamruntime": "Custom libraries provided by Steam to help run Linux and Windows (Proton) games. Enabling might improve compatibility.",
"sync": {
Expand Down Expand Up @@ -363,6 +364,7 @@
"minimize-on-launch": "Ελαχιστοποίηση Heroic Μετά Την 'Εναρξη",
"offlinemode": "Εκτέλεση Παιχνιδιού Εκτός Δικτύου",
"prefered_language": "Prefered Language (Language Code)",
"preferSystemLibs": "Prefer system libraries",
"primerun": "Ενεργοποίηση Nvidia Prime Render",
"resizableBar": "Ενεργοποίηση Μεταβλητού BAR (NVIDIA RTX 30xx μόνο)",
"runexe": {
Expand Down
2 changes: 2 additions & 0 deletions public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@
"part6": " to be called after the launch command, for instance: ",
"part7": " to skip the launcher in some games, etc."
},
"preferSystemLibs": "Custom Wine versions (Wine-GE, Wine-Lutris) are shipped with their library dependencies. By enabling this option, these shipped libraries will be ignored and Wine will load system libraries instead. Warning! Issues may occur if dependencies are not met.",
"resizablebar": "NVIDIA's Resizable Bar helps boost framerate by making the CPU access the entire graphics buffer. Enabling may improve performance for Vulkan-based games.",
"steamruntime": "Custom libraries provided by Steam to help run Linux and Windows (Proton) games. Enabling might improve compatibility.",
"sync": {
Expand Down Expand Up @@ -363,6 +364,7 @@
"minimize-on-launch": "Minimize Heroic After Game Launch",
"offlinemode": "Run Game Offline",
"prefered_language": "Prefered Language (Language Code)",
"preferSystemLibs": "Prefer system libraries",
"primerun": "Use Dedicated Graphics Card",
"resizableBar": "Enable Resizable BAR (NVIDIA RTX 30xx only)",
"runexe": {
Expand Down
2 changes: 2 additions & 0 deletions public/locales/es/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@
"part6": " para ser llamado después del comando de lanzamiento, por ejemplo: ",
"part7": " para omitir el lanzador en algunos juegos, etc."
},
"preferSystemLibs": "Custom Wine versions (Wine-GE, Wine-Lutris) are shipped with their library dependencies. By enabling this option, these shipped libraries will be ignored and Wine will load system libraries instead. Warning! Issues may occur if dependencies are not met.",
"resizablebar": "NVIDIA's Resizable Bar helps boost framerate by making the CPU access the entire graphics buffer. Enabling may improve performance for Vulkan-based games.",
"steamruntime": "Custom libraries provided by Steam to help run Linux and Windows (Proton) games. Enabling might improve compatibility.",
"sync": {
Expand Down Expand Up @@ -363,6 +364,7 @@
"minimize-on-launch": "Minimizar Heroic al ejecutar un juego",
"offlinemode": "Ejecutar juego sin conexión",
"prefered_language": "Prefered Language (Language Code)",
"preferSystemLibs": "Prefer system libraries",
"primerun": "Utilizar tarjeta de video dedicada",
"resizableBar": "Habilitar Resizable Bar (NVIDIA RTX 30xx únicamente)",
"runexe": {
Expand Down
2 changes: 2 additions & 0 deletions public/locales/et/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@
"part6": " kutsutakse pärast käivituskäsku, näiteks: ",
"part7": " et jätta mõnedes mängudes käivitaja vahele jne."
},
"preferSystemLibs": "Custom Wine versions (Wine-GE, Wine-Lutris) are shipped with their library dependencies. By enabling this option, these shipped libraries will be ignored and Wine will load system libraries instead. Warning! Issues may occur if dependencies are not met.",
"resizablebar": "NVIDIA's Resizable Bar helps boost framerate by making the CPU access the entire graphics buffer. Enabling may improve performance for Vulkan-based games.",
"steamruntime": "Custom libraries provided by Steam to help run Linux and Windows (Proton) games. Enabling might improve compatibility.",
"sync": {
Expand Down Expand Up @@ -363,6 +364,7 @@
"minimize-on-launch": "Minimeeri Heroic pärast mängu käivitamist",
"offlinemode": "Käivita mäng võrguühenduseta",
"prefered_language": "Eelistatud keel (keelekood)",
"preferSystemLibs": "Prefer system libraries",
"primerun": "Kasuta spetsiaalset graafikakaarti",
"resizableBar": "Luba muudetav BAR (ainult NVIDIA RTX 30xx)",
"runexe": {
Expand Down
2 changes: 2 additions & 0 deletions public/locales/fa/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@
"part6": " تا قبل از اجرای دستور صدا زده شود، به عنوان مثال: ",
"part7": " تا لانچر در برخی بازیها رد شود، غیره."
},
"preferSystemLibs": "Custom Wine versions (Wine-GE, Wine-Lutris) are shipped with their library dependencies. By enabling this option, these shipped libraries will be ignored and Wine will load system libraries instead. Warning! Issues may occur if dependencies are not met.",
"resizablebar": "NVIDIA's Resizable Bar helps boost framerate by making the CPU access the entire graphics buffer. Enabling may improve performance for Vulkan-based games.",
"steamruntime": "Custom libraries provided by Steam to help run Linux and Windows (Proton) games. Enabling might improve compatibility.",
"sync": {
Expand Down Expand Up @@ -363,6 +364,7 @@
"minimize-on-launch": "کوچک کردن Heroic بعد از اجرای بازی",
"offlinemode": "اجرای آفلاین بازی",
"prefered_language": "زبان ترجیحی (کد زبان)",
"preferSystemLibs": "Prefer system libraries",
"primerun": "استفاده از کارت گرافیک اختصاص یافته",
"resizableBar": "فعالسازی Resizable BAR (فقط محصولات NVIDIA RTX 30xx)",
"runexe": {
Expand Down
2 changes: 2 additions & 0 deletions public/locales/fi/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@
"part6": " kutsutaan käynnistyskomennon jälkeen, esimerkiksi: ",
"part7": " ohittaa käynnistys joissakin peleissä jne."
},
"preferSystemLibs": "Custom Wine versions (Wine-GE, Wine-Lutris) are shipped with their library dependencies. By enabling this option, these shipped libraries will be ignored and Wine will load system libraries instead. Warning! Issues may occur if dependencies are not met.",
"resizablebar": "NVIDIA's Resizable Bar helps boost framerate by making the CPU access the entire graphics buffer. Enabling may improve performance for Vulkan-based games.",
"steamruntime": "Custom libraries provided by Steam to help run Linux and Windows (Proton) games. Enabling might improve compatibility.",
"sync": {
Expand Down Expand Up @@ -363,6 +364,7 @@
"minimize-on-launch": "Minimoi Heroic pelin käynnistämisen jälkeen",
"offlinemode": "Käynnistä peli offline-tilassa",
"prefered_language": "Prefered Language (Language Code)",
"preferSystemLibs": "Prefer system libraries",
"primerun": "Ota käyttöön Nvidia Prime Render",
"resizableBar": "Ota käyttöön Resizable BAR (Vain NVIDIA RTX 30xx)",
"runexe": {
Expand Down
2 changes: 2 additions & 0 deletions public/locales/fr/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@
"part6": " pour être averti après la commande, par exemple : ",
"part7": " pour passer le launcher dans certains jeux, etc."
},
"preferSystemLibs": "Custom Wine versions (Wine-GE, Wine-Lutris) are shipped with their library dependencies. By enabling this option, these shipped libraries will be ignored and Wine will load system libraries instead. Warning! Issues may occur if dependencies are not met.",
"resizablebar": "NVIDIA's Resizable Bar helps boost framerate by making the CPU access the entire graphics buffer. Enabling may improve performance for Vulkan-based games.",
"steamruntime": "Custom libraries provided by Steam to help run Linux and Windows (Proton) games. Enabling might improve compatibility.",
"sync": {
Expand Down Expand Up @@ -363,6 +364,7 @@
"minimize-on-launch": "Minimiser Heroic après le lancement du jeu",
"offlinemode": "Lancer le jeu hors ligne",
"prefered_language": "Prefered Language (Language Code)",
"preferSystemLibs": "Prefer system libraries",
"primerun": "Utiliser une carte graphique dédiée",
"resizableBar": "Activer Resizable BAR (NVIDIA RTX 30xx seulement)",
"runexe": {
Expand Down
2 changes: 2 additions & 0 deletions public/locales/gl/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@
"part6": " para ser chamados despois da orde de lanzamento, por exemplo: ",
"part7": " omitir o lanzador dalgúns xogos, etc."
},
"preferSystemLibs": "Custom Wine versions (Wine-GE, Wine-Lutris) are shipped with their library dependencies. By enabling this option, these shipped libraries will be ignored and Wine will load system libraries instead. Warning! Issues may occur if dependencies are not met.",
"resizablebar": "NVIDIA's Resizable Bar helps boost framerate by making the CPU access the entire graphics buffer. Enabling may improve performance for Vulkan-based games.",
"steamruntime": "Custom libraries provided by Steam to help run Linux and Windows (Proton) games. Enabling might improve compatibility.",
"sync": {
Expand Down Expand Up @@ -363,6 +364,7 @@
"minimize-on-launch": "Minimize Heroic After Game Launch",
"offlinemode": "Executar xogo sen conexión",
"prefered_language": "Prefered Language (Language Code)",
"preferSystemLibs": "Prefer system libraries",
"primerun": "Activar renderizado de Nvidia Prime",
"resizableBar": "Activar Resizable Bar (só NVIDIA RTX 30xx)",
"runexe": {
Expand Down
Loading