mirror of
https://github.com/lutris/lutris
synced 2024-09-20 16:21:48 +00:00
Auto-disable Lutris runtime for Wine games if Wine is installed system wide
This commit is contained in:
parent
cd6285aaaa
commit
4ac6ac50f4
|
@ -247,11 +247,9 @@ def wineexec(executable, args="", wine_path=None, prefix=None, arch=None,
|
|||
wineenv['WINEPREFIX'] = prefix
|
||||
|
||||
wine_config = config or LutrisConfig(runner_slug='wine')
|
||||
if (
|
||||
not runtime.RUNTIME_DISABLED and
|
||||
not disable_runtime and
|
||||
not wine_config.system_config['disable_runtime']
|
||||
):
|
||||
|
||||
if use_lutris_runtime(force_disable=disable_runtime or
|
||||
wine_config.system_config['disable_runtime']):
|
||||
wineenv['LD_LIBRARY_PATH'] = ':'.join(runtime.get_paths())
|
||||
|
||||
if overrides:
|
||||
|
@ -360,6 +358,24 @@ def set_drive_path(prefix, letter, path):
|
|||
os.symlink(path, drive_path)
|
||||
|
||||
|
||||
def use_lutris_runtime(force_disable=False):
|
||||
"""Returns whether to use the Lutris runtime.
|
||||
The runtime can be forced to be disabled, otherwise it's disabled
|
||||
automatically if Wine is installed system wide.
|
||||
"""
|
||||
if force_disable or runtime.RUNTIME_DISABLED:
|
||||
return False
|
||||
return not is_installed_systemwide()
|
||||
|
||||
|
||||
def is_installed_systemwide():
|
||||
"""Return whether Wine is installed outside of Lutris"""
|
||||
for build in WINE_PATHS.keys():
|
||||
if system.find_executable(WINE_PATHS[build]):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def get_wine_versions():
|
||||
"""Return the list of Wine versions installed"""
|
||||
versions = []
|
||||
|
@ -498,6 +514,13 @@ class wine(Runner):
|
|||
}
|
||||
]
|
||||
|
||||
system_options_override = [
|
||||
{
|
||||
'option': 'disable_runtime',
|
||||
'default': is_installed_systemwide(),
|
||||
}
|
||||
]
|
||||
|
||||
reg_prefix = "HKEY_CURRENT_USER\Software\Wine"
|
||||
reg_keys = {
|
||||
"RenderTargetLockMode": r"%s\Direct3D" % reg_prefix,
|
||||
|
|
Loading…
Reference in a new issue