mirror of
https://github.com/lutris/lutris
synced 2024-09-04 23:13:35 +00:00
Get rid of annoying/useless esync/fsync checks
This commit is contained in:
parent
69112c3799
commit
992d421a0e
|
@ -44,18 +44,10 @@ class UnavailableRunnerError(Exception):
|
|||
"""Raised when a runner is not installed or not installed fully."""
|
||||
|
||||
|
||||
class EsyncUnavailableError(Exception):
|
||||
"""Raised when ESYNC is enabled, but the Wine version does not support it."""
|
||||
|
||||
|
||||
class EsyncLimitError(Exception):
|
||||
"""Raised when the ESYNC limit is not set correctly."""
|
||||
|
||||
|
||||
class FsyncUnavailableError(Exception):
|
||||
"""Raised when FSYNC is enabled, but the Wine version does not support it."""
|
||||
|
||||
|
||||
class FsyncUnsupportedError(Exception):
|
||||
"""Raised when FSYNC is enabled, but is not supported by the kernel."""
|
||||
|
||||
|
|
|
@ -12,9 +12,7 @@ from lutris import services, settings
|
|||
from lutris.database import categories as categories_db
|
||||
from lutris.database import games as games_db
|
||||
from lutris.database.services import ServiceGameCollection
|
||||
from lutris.exceptions import (
|
||||
EsyncLimitError, EsyncUnavailableError, FsyncUnavailableError, FsyncUnsupportedError, watch_errors
|
||||
)
|
||||
from lutris.exceptions import EsyncLimitError, FsyncUnsupportedError, watch_errors
|
||||
from lutris.game import Game
|
||||
from lutris.gui import dialogs
|
||||
from lutris.gui.addgameswindow import AddGamesWindow
|
||||
|
@ -36,10 +34,7 @@ from lutris.services.lutris import LutrisService
|
|||
from lutris.util import datapath
|
||||
from lutris.util.log import logger
|
||||
from lutris.util.system import update_desktop_icons
|
||||
from lutris.util.wine.wine import (
|
||||
esync_display_limit_warning, esync_display_version_warning, fsync_display_support_warning,
|
||||
fsync_display_version_warning
|
||||
)
|
||||
from lutris.util.wine.wine import esync_display_limit_warning, fsync_display_support_warning
|
||||
|
||||
|
||||
@GtkTemplate(ui=os.path.join(datapath.get(), "ui", "lutris-window.ui"))
|
||||
|
@ -905,12 +900,8 @@ class LutrisWindow(Gtk.ApplicationWindow,
|
|||
|
||||
if isinstance(error, FsyncUnsupportedError):
|
||||
fsync_display_support_warning(parent=self)
|
||||
elif isinstance(error, FsyncUnavailableError):
|
||||
fsync_display_version_warning(parent=self)
|
||||
elif isinstance(error, EsyncLimitError):
|
||||
esync_display_limit_warning(parent=self)
|
||||
elif isinstance(error, EsyncUnavailableError):
|
||||
esync_display_version_warning(parent=self)
|
||||
else:
|
||||
dialogs.ErrorDialog(error, parent=self)
|
||||
return True
|
||||
|
|
|
@ -5,7 +5,7 @@ import shlex
|
|||
from gettext import gettext as _
|
||||
|
||||
from lutris import runtime, settings
|
||||
from lutris.exceptions import EsyncLimitError, EsyncUnavailableError, FsyncUnavailableError, FsyncUnsupportedError
|
||||
from lutris.exceptions import EsyncLimitError, FsyncUnsupportedError
|
||||
from lutris.gui.dialogs import FileDialog
|
||||
from lutris.runners.commands.wine import ( # noqa: F401 pylint: disable=unused-import
|
||||
create_prefix, delete_registry_key, eject_disc, install_cab_component, open_wine_terminal, set_regedit,
|
||||
|
@ -29,7 +29,7 @@ from lutris.util.wine.vkd3d import VKD3DManager
|
|||
from lutris.util.wine.wine import (
|
||||
WINE_DEFAULT_ARCH, WINE_DIR, WINE_PATHS, detect_arch, get_default_version, get_installed_wine_versions,
|
||||
get_overrides_env, get_proton_paths, get_real_executable, get_system_wine_version, is_esync_limit_set,
|
||||
is_fsync_supported, is_gstreamer_build, is_version_esync, is_version_fsync
|
||||
is_fsync_supported, is_gstreamer_build
|
||||
)
|
||||
|
||||
|
||||
|
@ -142,33 +142,19 @@ def _get_path_for_version(config, version=None):
|
|||
def _get_esync_warning(config, _option_key):
|
||||
if config.get("esync"):
|
||||
limits_set = is_esync_limit_set()
|
||||
wine_path = _get_path_for_version(config)
|
||||
wine_ver = is_version_esync(wine_path)
|
||||
|
||||
if not wine_ver:
|
||||
return _("<b>Warning</b> The Wine build you have selected does not support Esync")
|
||||
|
||||
if not limits_set:
|
||||
return _("<b>Warning</b> Your limits are not set correctly. Please increase them as described here:\n"
|
||||
"<a href='https://github.com/lutris/docs/blob/master/HowToEsync.md'>"
|
||||
"How-to-Esync (https://github.com/lutris/docs/blob/master/HowToEsync.md)</a>")
|
||||
|
||||
return None
|
||||
return ""
|
||||
|
||||
|
||||
def _get_fsync_warning(config, _option_key):
|
||||
if config.get("fsync"):
|
||||
fsync_supported = is_fsync_supported()
|
||||
wine_path = _get_path_for_version(config)
|
||||
wine_ver = is_version_fsync(wine_path)
|
||||
|
||||
if not wine_ver:
|
||||
return _("<b>Warning</b> The Wine build you have selected does not support Fsync.")
|
||||
|
||||
if not fsync_supported:
|
||||
return _("<b>Warning</b> Your kernel is not patched for fsync.")
|
||||
|
||||
return None
|
||||
return ""
|
||||
|
||||
|
||||
class wine(Runner):
|
||||
|
@ -1093,21 +1079,15 @@ class wine(Runner):
|
|||
|
||||
if launch_info["env"].get("WINEESYNC") == "1":
|
||||
limit_set = is_esync_limit_set()
|
||||
wine_supports_esync = is_version_esync(self.get_executable())
|
||||
|
||||
if not limit_set:
|
||||
raise EsyncLimitError(_("Your ESYNC limits are not set correctly."))
|
||||
if not wine_supports_esync:
|
||||
raise EsyncUnavailableError(_("The Wine build you have selected does not support Esync."))
|
||||
|
||||
if launch_info["env"].get("WINEFSYNC") == "1":
|
||||
fsync_supported = is_fsync_supported()
|
||||
wine_supports_fsync = is_version_fsync(self.get_executable())
|
||||
|
||||
if not fsync_supported:
|
||||
raise FsyncUnsupportedError(_("Your kernel is not patched for fsync."))
|
||||
if not wine_supports_fsync:
|
||||
raise FsyncUnavailableError(_("The Wine build you have selected does not support Fsync."))
|
||||
|
||||
command = [self.get_executable()]
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ from gettext import gettext as _
|
|||
from lutris import runtime, settings
|
||||
from lutris.api import get_default_runner_version
|
||||
from lutris.exceptions import UnavailableRunnerError
|
||||
from lutris.gui.dialogs import ErrorDialog, WarningMessageDialog
|
||||
from lutris.gui.dialogs import ErrorDialog
|
||||
from lutris.util import linux, system
|
||||
from lutris.util.log import logger
|
||||
from lutris.util.steam.config import get_steamapps_dirs
|
||||
|
@ -252,47 +252,6 @@ def get_system_wine_version(wine_path="wine"):
|
|||
return version
|
||||
|
||||
|
||||
def is_version_esync(path):
|
||||
"""Determines if a Wine build is Esync capable"""
|
||||
compat_versions = ["esync", "lutris", "tkg", "ge", "proton", "staging"]
|
||||
try:
|
||||
version = path.split("/")[-3].lower()
|
||||
except IndexError:
|
||||
logger.error("Invalid path '%s'", path)
|
||||
return False
|
||||
for is_esync in compat_versions:
|
||||
if is_esync in version:
|
||||
return True
|
||||
system_version = get_system_wine_version(path)
|
||||
if system_version:
|
||||
system_version = system_version.lower()
|
||||
for is_esync in compat_versions:
|
||||
if is_esync in system_version:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def is_version_fsync(path):
|
||||
"""Determines if a Wine build is Fsync capable"""
|
||||
compat_versions = ["fsync", "lutris", "tkg", "ge", "proton"]
|
||||
try:
|
||||
version = path.split("/")[-3].lower()
|
||||
except IndexError:
|
||||
logger.error("Invalid path '%s'", path)
|
||||
return False
|
||||
for fsync_version in compat_versions:
|
||||
if fsync_version in version:
|
||||
return True
|
||||
system_version = get_system_wine_version(path)
|
||||
if system_version:
|
||||
system_version = system_version.lower()
|
||||
for is_esync in compat_versions:
|
||||
if is_esync in system_version:
|
||||
return True
|
||||
return "fsync" in system_version.lower()
|
||||
return False
|
||||
|
||||
|
||||
def get_real_executable(windows_executable, working_dir=None):
|
||||
"""Given a Windows executable, return the real program
|
||||
capable of launching it along with necessary arguments."""
|
||||
|
@ -330,30 +289,6 @@ def fsync_display_support_warning(parent=None):
|
|||
), parent=parent)
|
||||
|
||||
|
||||
def esync_display_version_warning(parent=None):
|
||||
WarningMessageDialog(
|
||||
_("Incompatible Wine version detected"),
|
||||
secondary_message=_(
|
||||
"The Wine build you have selected "
|
||||
"does not support Esync.\n"
|
||||
"Please switch to an Esync-capable version."
|
||||
),
|
||||
parent=parent
|
||||
)
|
||||
|
||||
|
||||
def fsync_display_version_warning(parent=None):
|
||||
WarningMessageDialog(
|
||||
_("Incompatible Wine version detected"),
|
||||
secondary_message=_(
|
||||
"The Wine build you have selected "
|
||||
"does not support Fsync.\n"
|
||||
"Please switch to an Fsync-capable version."
|
||||
),
|
||||
parent=parent
|
||||
)
|
||||
|
||||
|
||||
def get_overrides_env(overrides):
|
||||
"""
|
||||
Output a string of dll overrides usable with WINEDLLOVERRIDES
|
||||
|
|
Loading…
Reference in a new issue