Example #1
0
File: wine.py Project: xnick/lutris
    def get_executable(self, version=None, fallback=True):
        """Return the path to the Wine executable.
        A specific version can be specified if needed.
        """
        if version is None:
            version = self.get_version()
        if not version:
            return

        wine_path = self.get_path_for_version(version)
        if system.path_exists(wine_path):
            return wine_path

        if fallback:
            # Fallback to default version
            default_version = get_default_version()
            wine_path = self.get_path_for_version(default_version)
            if wine_path:
                # Update the version in the config
                if version == self.runner_config.get("version"):
                    self.runner_config["version"] = default_version
                    # TODO: runner_config is a dict so we have to instanciate a
                    # LutrisConfig object to save it.
                    # XXX: The version key could be either in the game specific
                    # config or the runner specific config. We need to know
                    # which one to get the correct LutrisConfig object.
            return wine_path
Example #2
0
    def get_executable(self, version=None, fallback=True):
        """Return the path to the Wine executable.
        A specific version can be specified if needed.
        """
        if version is None:
            version = self.get_version()
        if not version:
            return

        wine_path = self.get_path_for_version(version)
        if system.path_exists(wine_path):
            return wine_path

        if fallback:
            # Fallback to default version
            default_version = get_default_version()
            wine_path = self.get_path_for_version(default_version)
            if wine_path:
                # Update the version in the config
                if version == self.runner_config.get("version"):
                    self.runner_config["version"] = default_version
                    # TODO: runner_config is a dict so we have to instanciate a
                    # LutrisConfig object to save it.
                    # XXX: The version key could be either in the game specific
                    # config or the runner specific config. We need to know
                    # which one to get the correct LutrisConfig object.
            return wine_path
Example #3
0
File: wine.py Project: xnick/lutris
 def get_version(self, use_default=True):
     """Return the Wine version to use. use_default can be set to false to
     force the installation of a specific wine version"""
     runner_version = self.runner_config.get("version")
     if runner_version:
         return runner_version
     if use_default:
         return get_default_version()
Example #4
0
 def get_version(self, use_default=True):
     """Return the Wine version to use. use_default can be set to false to
     force the installation of a specific wine version"""
     runner_version = self.runner_config.get("version")
     if runner_version:
         return runner_version
     if use_default:
         return get_default_version()
Example #5
0
File: wine.py Project: xnick/lutris
    def __init__(self, config=None):  # noqa: C901
        super(wine, self).__init__(config)
        self.dll_overrides = {"winemenubuilder.exe": "d"}

        def get_wine_version_choices():
            version_choices = [(_("Custom (select executable below)"),
                                "custom")]
            labels = {
                "winehq-devel": _("WineHQ Devel ({})"),
                "winehq-staging": _("WineHQ Staging ({})"),
                "wine-development": _("Wine Development ({})"),
                "system": _("System ({})"),
            }
            versions = get_wine_versions()
            for version in versions:
                if version in labels.keys():
                    version_number = get_system_wine_version(
                        WINE_PATHS[version])
                    label = labels[version].format(version_number)
                else:
                    label = version
                version_choices.append((label, version))
            return version_choices

        def dxvk_choices(manager_class):
            version_choices = [
                (_("Manual"), "manual"),
            ]
            for version in manager_class.versions:
                version_choices.append((version, version))
            return version_choices

        def get_dxvk_choices():
            return dxvk_choices(dxvk.DXVKManager())

        def esync_limit_callback(widget, option, config):
            limits_set = is_esync_limit_set()
            wine_path = self.get_path_for_version(config["version"])
            wine_ver = is_version_esync(wine_path)
            response = True

            if not wine_ver:
                response = thread_safe_call(esync_display_version_warning)

            if not limits_set:
                thread_safe_call(esync_display_limit_warning)
                response = False

            return widget, option, response

        def fsync_support_callback(widget, option, config):
            fsync_supported = is_fsync_supported()
            wine_path = self.get_path_for_version(config["version"])
            wine_ver = is_version_fsync(wine_path)
            response = True

            if not wine_ver:
                response = thread_safe_call(fsync_display_version_warning)

            if not fsync_supported:
                thread_safe_call(fsync_display_support_warning)
                response = False

            return widget, option, response

        def dxvk_vulkan_callback(widget, option, config):
            response = True
            if not is_vulkan_supported():
                if not thread_safe_call(display_vulkan_error):
                    response = False
            return widget, option, response

        self.runner_options = [
            {
                "option":
                "version",
                "label":
                _("Wine version"),
                "type":
                "choice",
                "choices":
                get_wine_version_choices,
                "default":
                get_default_version(),
                "help":
                _("The version of Wine used to launch the game.\n"
                  "Using the last version is generally recommended, "
                  "but some games work better on older versions."),
            },
            {
                "option":
                "custom_wine_path",
                "label":
                _("Custom Wine executable"),
                "type":
                "file",
                "advanced":
                True,
                "help":
                _("The Wine executable to be used if you have "
                  'selected "Custom" as the Wine version.'),
            },
            {
                "option": "system_winetricks",
                "label": _("Use system winetricks"),
                "type": "bool",
                "default": False,
                "advanced": True,
                "help":
                _("Switch on to use /usr/bin/winetricks for winetricks."),
            },
            {
                "option":
                "dxvk",
                "label":
                _("Enable DXVK/VKD3D"),
                "type":
                "extended_bool",
                "callback":
                dxvk_vulkan_callback,
                "callback_on":
                True,
                "default":
                True,
                "active":
                True,
                "help":
                _("Use DXVK and VKD3D to enable support for Direct3D 12 and "
                  "increase compatibility and performance in Direct3D 11, 10 "
                  "and 9 applications by translating their calls to Vulkan."),
            },
            {
                "option": "dxvk_version",
                "label": _("DXVK version"),
                "advanced": True,
                "type": "choice_with_entry",
                "choices": get_dxvk_choices,
                "default": dxvk.DXVKManager().version,
            },
            {
                "option":
                "esync",
                "label":
                _("Enable Esync"),
                "type":
                "extended_bool",
                "callback":
                esync_limit_callback,
                "callback_on":
                True,
                "active":
                True,
                "help":
                _("Enable eventfd-based synchronization (esync). "
                  "This will increase performance in applications "
                  "that take advantage of multi-core processors."),
            },
            {
                "option":
                "fsync",
                "label":
                _("Enable Fsync"),
                "type":
                "extended_bool",
                "callback":
                fsync_support_callback,
                "callback_on":
                True,
                "active":
                True,
                "help":
                _("Enable futex-based synchronization (fsync). "
                  "This will increase performance in applications "
                  "that take advantage of multi-core processors. "
                  "Requires a custom kernel with the fsync patchset."),
            },
            {
                "option":
                "gallium_nine",
                "label":
                _("Enable Gallium Nine"),
                "type":
                "bool",
                "default":
                False,
                "condition":
                nine.NineManager.is_available(),
                "advanced":
                True,
                "help":
                _("Gallium Nine allows to run Direct3D 9 applications faster.\n"
                  "Make sure your active graphics card supports Gallium Nine state "
                  "tracker before enabling this option.\n"
                  "Note: This feature is not supported by proprietary Nvidia driver."
                  ),
            },
            {
                "option":
                "x360ce-path",
                "label":
                _("Path to the game's executable, for x360ce support"),
                "type":
                "directory_chooser",
                "help":
                _("Locate the path for the game's executable for x360 support"
                  ),
                "advanced":
                True,
            },
            {
                "option":
                "x360ce-dinput",
                "label":
                _("x360ce DInput 8 mode"),
                "type":
                "bool",
                "default":
                False,
                "help":
                _("Configure x360ce with dinput8.dll, required for some games"
                  ),
                "advanced":
                True,
            },
            {
                "option":
                "x360ce-xinput9",
                "label":
                _("x360ce XInput 9.1.0 mode"),
                "type":
                "bool",
                "default":
                False,
                "help":
                _("Configure x360ce with xinput9_1_0.dll, required for some newer games"
                  ),
                "advanced":
                True,
            },
            {
                "option": "dumbxinputemu",
                "label": _("Use Dumb XInput Emulator (experimental)"),
                "type": "bool",
                "default": False,
                "help": _("Use the dlls from kozec/dumbxinputemu"),
                "advanced": True,
            },
            {
                "option":
                "xinput-arch",
                "label":
                _("XInput architecture"),
                "type":
                "choice",
                "choices": [
                    (_("Same as Wine prefix"), ""),
                    (_("32-bit"), "win32"),
                    (_("64-bit"), "win64"),
                ],
                "default":
                "",
                "advanced":
                True,
            },
            {
                "option":
                "Desktop",
                "label":
                _("Windowed (virtual desktop)"),
                "type":
                "bool",
                "default":
                False,
                "help":
                _("Run the whole Windows desktop in a window.\n"
                  "Otherwise, run it fullscreen.\n"
                  "This corresponds to Wine's Virtual Desktop option."),
            },
            {
                "option": "WineDesktop",
                "label": _("Virtual desktop resolution"),
                "type": "choice_with_entry",
                "choices": DISPLAY_MANAGER.get_resolutions,
                "help": _("The size of the virtual desktop in pixels."),
            },
            {
                "option":
                "MouseWarpOverride",
                "label":
                _("Mouse Warp Override"),
                "type":
                "choice",
                "choices": [
                    (_("Enable"), "enable"),
                    (_("Disable"), "disable"),
                    (_("Force"), "force"),
                ],
                "default":
                "enable",
                "advanced":
                True,
                "help":
                _("Override the default mouse pointer warping behavior\n"
                  "<b>Enable</b>: (Wine default) warp the pointer when the "
                  "mouse is exclusively acquired \n"
                  "<b>Disable</b>: never warp the mouse pointer \n"
                  "<b>Force</b>: always warp the pointer"),
            },
            {
                "option":
                "OffscreenRenderingMode",
                "label":
                _("Offscreen Rendering Mode"),
                "type":
                "choice",
                "choices": [("FBO", "fbo"), ("BackBuffer", "backbuffer")],
                "default":
                "fbo",
                "advanced":
                True,
                "help":
                _("Select the offscreen rendering implementation.\n"
                  "<b>FBO</b>: (Wine default) Use framebuffer objects "
                  "for offscreen rendering \n"
                  "<b>Backbuffer</b>: Render offscreen render targets "
                  "in the backbuffer."),
            },
            {
                "option":
                "StrictDrawOrdering",
                "label":
                _("Strict Draw Ordering"),
                "type":
                "choice",
                "choices": [(_("Enabled"), "enabled"),
                            (_("Disabled"), "disabled")],
                "default":
                "disabled",
                "advanced":
                True,
                "help":
                _("This option ensures any pending drawing operations are "
                  "submitted to the driver, but at a significant performance "
                  "cost. This setting is deprecated since Wine-2.6 and will "
                  'likely be removed after Wine-3.0. Use "csmt" instead.'),
            },
            {
                "option":
                "UseGLSL",
                "label":
                _("Use GLSL"),
                "type":
                "choice",
                "choices": [(_("Enabled"), "enabled"),
                            (_("Disabled"), "disabled")],
                "default":
                "enabled",
                "advanced":
                True,
                "help":
                _('When set to "disabled", this disables the use of GLSL for shaders. '
                  "In general disabling GLSL is not recommended, "
                  "only use this for debugging purposes."),
            },
            {
                "option":
                "SampleCount",
                "label":
                _("Anti-aliasing Sample Count"),
                "type":
                "choice",
                "choices": [
                    (_("Auto"), "auto"),
                    ("0", "0"),
                    ("2", "2"),
                    ("4", "4"),
                    ("8", "8"),
                    ("16", "16"),
                ],
                "default":
                "auto",
                "advanced":
                True,
                "help":
                _("Override swapchain sample count. It can be used to force enable multisampling "
                  "with applications that otherwise don't support it, like the similar control "
                  "panel setting available with some GPU drivers. This one might work in more "
                  "cases than the driver setting though. "
                  "Not all applications are compatible with all sample counts. "
                  ),
            },
            {
                "option":
                "UseXVidMode",
                "label":
                _("Use XVidMode to switch resolutions"),
                "type":
                "bool",
                "default":
                False,
                "advanced":
                True,
                "help":
                _('Set this to "Y" to allow Wine switch the resolution using XVidMode extension.'
                  ),
            },
            {
                "option":
                "Audio",
                "label":
                _("Audio driver"),
                "type":
                "choice",
                "advanced":
                True,
                "choices": [
                    (_("Auto"), "auto"),
                    ("ALSA", "alsa"),
                    ("PulseAudio", "pulse"),
                    ("OSS", "oss"),
                ],
                "default":
                "auto",
                "help":
                _("Which audio backend to use.\n"
                  "By default, Wine automatically picks the right one "
                  "for your system."),
            },
            {
                "option": "overrides",
                "type": "mapping",
                "label": _("DLL overrides"),
                "help": _("Sets WINEDLLOVERRIDES when launching the game."),
            },
            {
                "option":
                "show_debug",
                "label":
                _("Output debugging info"),
                "type":
                "choice",
                "choices": [
                    (_("Disabled"), "-all"),
                    (_("Enabled"), ""),
                    (_("Inherit from environment"), "inherit"),
                    (_("Show FPS"), "+fps"),
                    (_("Full (CAUTION: Will cause MASSIVE slowdown)"), "+all"),
                ],
                "default":
                "-all",
                "help":
                _("Output debugging information in the game log "
                  "(might affect performance)"),
            },
            {
                "option": "ShowCrashDialog",
                "label": _("Show crash dialogs"),
                "type": "bool",
                "default": False,
                "advanced": True,
            },
            {
                "option":
                "autoconf_joypad",
                "type":
                "bool",
                "label":
                _("Autoconfigure joypads"),
                "advanced":
                True,
                "default":
                True,
                "help":
                _("Automatically disables one of Wine's detected joypad "
                  "to avoid having 2 controllers detected"),
            },
            {
                "option":
                "sandbox",
                "type":
                "bool",
                "label":
                _("Create a sandbox for Wine folders"),
                "default":
                True,
                "advanced":
                True,
                "help":
                _("Do not use $HOME for desktop integration folders.\n"
                  "By default, it use the directories in the confined "
                  "Windows environment."),
            },
            {
                "option": "sandbox_dir",
                "type": "directory_chooser",
                "label": _("Sandbox directory"),
                "help": _("Custom directory for desktop integration folders."),
                "advanced": True,
            },
        ]
Example #6
0
    def __init__(self, config=None):
        super(wine, self).__init__(config)
        self.dll_overrides = {}
        self.context_menu_entries = [
            ("wineexec", "Run EXE inside wine prefix", self.run_wineexec),
            ("winecfg", "Wine configuration", self.run_winecfg),
            ("wine-regedit", "Wine registry", self.run_regedit),
            ("winekill", "Kill all wine processes", self.run_winekill),
            ("winetricks", "Winetricks", self.run_winetricks),
            ("joycpl", "Joystick Control Panel", self.run_joycpl),
        ]

        def get_wine_version_choices():
            version_choices = [("Custom (select executable below)", "custom")]
            labels = {
                "winehq-devel": "WineHQ devel ({})",
                "winehq-staging": "WineHQ staging ({})",
                "wine-development": "Wine Development ({})",
                "system": "System ({})",
            }
            versions = get_wine_versions()
            for version in versions:
                if version in labels.keys():
                    version_number = get_system_wine_version(WINE_PATHS[version])
                    label = labels[version].format(version_number)
                else:
                    label = version
                version_choices.append((label, version))
            return version_choices

        def get_dxvk_choices():
            version_choices = [
                ("Manual", "manual"),
                (dxvk.DXVK_LATEST, dxvk.DXVK_LATEST),
            ]
            for version in dxvk.DXVK_PAST_RELEASES:
                version_choices.append((version, version))
            return version_choices

        def esync_limit_callback(widget, option, config):
            limits_set = is_esync_limit_set()
            wine_path = self.get_path_for_version(config["version"])
            wine_ver = is_version_esync(wine_path)
            response = True

            if not wine_ver:
                response = thread_safe_call(esync_display_version_warning)

            if not limits_set:
                thread_safe_call(esync_display_limit_warning)
                response = False

            return widget, option, response

        def dxvk_vulkan_callback(widget, option, config):
            response = True
            if not is_vulkan_supported():
                if not thread_safe_call(display_vulkan_error):
                    response = False
            return widget, option, response

        self.runner_options = [
            {
                "option": "version",
                "label": "Wine version",
                "type": "choice",
                "choices": get_wine_version_choices,
                "default": get_default_version(),
                "help": (
                    "The version of Wine used to launch the game.\n"
                    "Using the last version is generally recommended, "
                    "but some games work better on older versions."
                ),
            },
            {
                "option": "custom_wine_path",
                "label": "Custom Wine executable",
                "type": "file",
                "advanced": True,
                "help": (
                    "The Wine executable to be used if you have "
                    'selected "Custom" as the Wine version.'
                ),
            },
            {
                "option": "dxvk",
                "label": "Enable DXVK",
                "type": "extended_bool",
                "help": "Use DXVK to translate DirectX 11 calls to Vulkan",
                "callback": dxvk_vulkan_callback,
                "callback_on": True,
                "active": True,
            },
            {
                "option": "dxvk_version",
                "label": "DXVK version",
                "advanced": True,
                "type": "choice_with_entry",
                "choices": get_dxvk_choices,
                "default": dxvk.DXVK_LATEST,
            },
            {
                "option": "esync",
                "label": "Enable Esync",
                "type": "extended_bool",
                "help": "Enable eventfd-based synchronization (esync)",
                "callback": esync_limit_callback,
                "callback_on": True,
                "active": True,
            },
            {
                "option": "x360ce-path",
                "label": "Path to the game's executable, for x360ce support",
                "type": "directory_chooser",
                "help": "Locate the path for the game's executable for x360 support",
                "advanced": True,
            },
            {
                "option": "x360ce-dinput",
                "label": "x360ce dinput 8 mode",
                "type": "bool",
                "default": False,
                "help": "Configure x360ce with dinput8.dll, required for some games",
                "advanced": True,
            },
            {
                "option": "x360ce-xinput9",
                "label": "x360ce xinput 9.1.0 mode",
                "type": "bool",
                "default": False,
                "help": "Configure x360ce with xinput9_1_0.dll, required for some newer games",
                "advanced": True,
            },
            {
                "option": "dumbxinputemu",
                "label": "Use Dumb xinput Emulator (experimental)",
                "type": "bool",
                "default": False,
                "help": "Use the dlls from kozec/dumbxinputemu",
                "advanced": True,
            },
            {
                "option": "xinput-arch",
                "label": "Xinput architecture",
                "type": "choice",
                "choices": [
                    ("Same as wine prefix", ""),
                    ("32 bit", "win32"),
                    ("64 bit", "win64"),
                ],
                "default": "",
                "advanced": True,
            },
            {
                "option": "Desktop",
                "label": "Windowed (virtual desktop)",
                "type": "bool",
                "default": False,
                "help": (
                    "Run the whole Windows desktop in a window.\n"
                    "Otherwise, run it fullscreen.\n"
                    "This corresponds to Wine's Virtual Desktop option."
                ),
            },
            {
                "option": "WineDesktop",
                "label": "Virtual desktop resolution",
                "type": "choice_with_entry",
                "choices": display.get_unique_resolutions,
                "help": "The size of the virtual desktop in pixels.",
            },
            {
                "option": "MouseWarpOverride",
                "label": "Mouse Warp Override",
                "type": "choice",
                "choices": [
                    ("Enable", "enable"),
                    ("Disable", "disable"),
                    ("Force", "force"),
                ],
                "default": "enable",
                "advanced": True,
                "help": (
                    "Override the default mouse pointer warping behavior\n"
                    "<b>Enable</b>: (Wine default) warp the pointer when the "
                    "mouse is exclusively acquired \n"
                    "<b>Disable</b>: never warp the mouse pointer \n"
                    "<b>Force</b>: always warp the pointer"
                ),
            },
            {
                "option": "OffscreenRenderingMode",
                "label": "Offscreen Rendering Mode",
                "type": "choice",
                "choices": [("FBO", "fbo"), ("BackBuffer", "backbuffer")],
                "default": "fbo",
                "advanced": True,
                "help": (
                    "Select the offscreen rendering implementation.\n"
                    "<b>FBO</b>: (Wine default) Use framebuffer objects "
                    "for offscreen rendering \n"
                    "<b>Backbuffer</b>: Render offscreen render targets "
                    "in the backbuffer."
                ),
            },
            {
                "option": "StrictDrawOrdering",
                "label": "Strict Draw Ordering",
                "type": "choice",
                "choices": [("Enabled", "enabled"), ("Disabled", "disabled")],
                "default": "disabled",
                "advanced": True,
                "help": (
                    "This option ensures any pending drawing operations are "
                    "submitted to the driver, but at a significant performance "
                    'cost. Set to "enabled" to enable. This setting is deprecated '
                    "since wine-2.6 and will likely be removed after wine-3.0. "
                    'Use "csmt" instead.'
                ),
            },
            {
                "option": "UseGLSL",
                "label": "Use GLSL",
                "type": "choice",
                "choices": [("Enabled", "enabled"), ("Disabled", "disabled")],
                "default": "enabled",
                "advanced": True,
                "help": (
                    'When set to "disabled", this disables the use of GLSL for shaders. '
                    "In general disabling GLSL is not recommended, "
                    "only use this for debugging purposes."
                ),
            },
            {
                "option": "UseXVidMode",
                "label": "Use XVidMode to switch resolutions",
                "type": "bool",
                "default": False,
                "advanced": True,
                "help": (
                    'Set this to "Y" to allow wine switch the resolution using XVidMode extension.'
                ),
            },
            {
                "option": "Audio",
                "label": "Audio driver",
                "type": "choice",
                "advanced": True,
                "choices": [
                    ("Auto", "auto"),
                    ("ALSA", "alsa"),
                    ("PulseAudio", "pulse"),
                    ("OSS", "oss"),
                ],
                "default": "auto",
                "help": (
                    "Which audio backend to use.\n"
                    "By default, Wine automatically picks the right one "
                    "for your system."
                ),
            },
            {
                "option": "overrides",
                "type": "mapping",
                "label": "DLL overrides",
                "help": "Sets WINEDLLOVERRIDES when launching the game.",
            },
            {
                "option": "show_debug",
                "label": "Output debugging info",
                "type": "choice",
                "choices": [
                    ("Disabled", "-all"),
                    ("Enabled", ""),
                    ("Inherit from environment", "inherit"),
                    ("Show FPS", "+fps"),
                    ("Full (CAUTION: Will cause MASSIVE slowdown)", "+all"),
                ],
                "default": "-all",
                "help": (
                    "Output debugging information in the game log "
                    "(might affect performance)"
                ),
            },
            {
                "option": "ShowCrashDialog",
                "label": "Show crash dialogs",
                "type": "bool",
                "default": False,
                "advanced": True,
            },
            {
                "option": "autoconf_joypad",
                "type": "bool",
                "label": "Autoconfigure joypads",
                "advanced": True,
                "default": True,
                "help": (
                    "Automatically disables one of Wine's detected joypad "
                    "to avoid having 2 controllers detected"
                ),
            },
            {
                "option": "sandbox",
                "type": "bool",
                "label": "Create a sandbox for wine folders",
                "default": True,
                "advanced": True,
                "help": (
                    "Do not use $HOME for desktop integration folders.\n"
                    "By default, it use the directories in the confined "
                    "Windows environment."
                ),
            },
            {
                "option": "sandbox_dir",
                "type": "directory_chooser",
                "label": "Sandbox directory",
                "help": "Custom directory for desktop integration folders.",
                "advanced": True,
            },
        ]
Example #7
0
    def __init__(self, config=None):  # noqa: C901
        super().__init__(config)
        self.dll_overrides = DEFAULT_DLL_OVERRIDES.copy(
        )  # we'll modify this, so we better copy it

        def get_wine_version_choices():
            version_choices = [(_("Custom (select executable below)"),
                                "custom")]
            labels = {
                "winehq-devel": _("WineHQ Devel ({})"),
                "winehq-staging": _("WineHQ Staging ({})"),
                "wine-development": _("Wine Development ({})"),
                "system": _("System ({})"),
            }
            versions = get_wine_versions()
            for version in versions:
                if version in labels:
                    version_number = get_wine_version(WINE_PATHS[version])
                    label = labels[version].format(version_number)
                else:
                    label = version
                version_choices.append((label, version))
            return version_choices

        def esync_limit_callback(widget, option, config):
            limits_set = is_esync_limit_set()
            wine_path = self.get_path_for_version(config["version"])
            wine_ver = is_version_esync(wine_path)
            response = True

            if not wine_ver:
                response = thread_safe_call(esync_display_version_warning)

            if not limits_set:
                thread_safe_call(esync_display_limit_warning)
                response = False

            return widget, option, response

        def fsync_support_callback(widget, option, config):
            fsync_supported = is_fsync_supported()
            wine_path = self.get_path_for_version(config["version"])
            wine_ver = is_version_fsync(wine_path)
            response = True

            if not wine_ver:
                response = thread_safe_call(fsync_display_version_warning)

            if not fsync_supported:
                thread_safe_call(fsync_display_support_warning)
                response = False

            return widget, option, response

        def dxvk_vulkan_callback(widget, option, config):
            response = True
            if not is_vulkan_supported():
                if not thread_safe_call(display_vulkan_error):
                    response = False
            return widget, option, response

        self.runner_options = [
            {
                "option":
                "version",
                "label":
                _("Wine version"),
                "type":
                "choice",
                "choices":
                get_wine_version_choices,
                "default":
                get_default_version(),
                "help":
                _("The version of Wine used to launch the game.\n"
                  "Using the last version is generally recommended, "
                  "but some games work better on older versions."),
            },
            {
                "option":
                "custom_wine_path",
                "label":
                _("Custom Wine executable"),
                "type":
                "file",
                "advanced":
                True,
                "help":
                _("The Wine executable to be used if you have "
                  'selected "Custom" as the Wine version.'),
            },
            {
                "option": "system_winetricks",
                "label": _("Use system winetricks"),
                "type": "bool",
                "default": False,
                "advanced": True,
                "help":
                _("Switch on to use /usr/bin/winetricks for winetricks."),
            },
            {
                "option":
                "dxvk",
                "label":
                _("Enable DXVK"),
                "type":
                "extended_bool",
                "callback":
                dxvk_vulkan_callback,
                "callback_on":
                True,
                "default":
                True,
                "active":
                True,
                "help":
                _("Use DXVK to "
                  "increase compatibility and performance in Direct3D 11, 10 "
                  "and 9 applications by translating their calls to Vulkan."),
            },
            {
                "option": "dxvk_version",
                "label": _("DXVK version"),
                "advanced": True,
                "type": "choice_with_entry",
                "choices": DXVKManager().version_choices,
                "default": DXVKManager().version,
            },
            {
                "option":
                "vkd3d",
                "label":
                _("Enable VKD3D"),
                "type":
                "extended_bool",
                "callback":
                dxvk_vulkan_callback,
                "callback_on":
                True,
                "default":
                True,
                "active":
                True,
                "help":
                _("Use VKD3D to enable support for Direct3D 12 "
                  "applications by translating their calls to Vulkan."),
            },
            {
                "option": "vkd3d_version",
                "label": _("VKD3D version"),
                "advanced": True,
                "type": "choice_with_entry",
                "choices": VKD3DManager().version_choices,
                "default": VKD3DManager().version,
            },
            {
                "option":
                "d3d_extras",
                "label":
                _("Enable D3D Extras"),
                "type":
                "bool",
                "default":
                True,
                "advanced":
                True,
                "help":
                _("Replace Wine's D3DX and D3DCOMPILER libraries with alternative ones. "
                  "Needed for proper functionality of DXVK with some games."),
            },
            {
                "option": "d3d_extras_version",
                "label": _("D3D Extras version"),
                "advanced": True,
                "type": "choice_with_entry",
                "choices": D3DExtrasManager().version_choices,
                "default": D3DExtrasManager().version,
            },
            {
                "option":
                "dxvk_nvapi",
                "label":
                _("Enable DXVK-NVAPI / DLSS"),
                "type":
                "bool",
                "default":
                True,
                "advanced":
                True,
                "help":
                _("Enable emulation of Nvidia's NVAPI and add DLSS support, if available."
                  ),
            },
            {
                "option": "dxvk_nvapi_version",
                "label": _("DXVK NVAPI version"),
                "advanced": True,
                "type": "choice_with_entry",
                "choices": DXVKNVAPIManager().version_choices,
                "default": DXVKNVAPIManager().version,
            },
            {
                "option":
                "dgvoodoo2",
                "label":
                _("Enable dgvoodoo2"),
                "type":
                "bool",
                "default":
                False,
                "advanced":
                False,
                "help":
                _("dgvoodoo2 is an alternative translation layer for rendering old games "
                  "that utilize D3D1-7 and Glide APIs. As it translates to D3D11, it's "
                  "recommended to use it in combination with DXVK. Only 32-bit apps are supported."
                  ),
            },
            {
                "option": "dgvoodoo2_version",
                "label": _("dgvoodoo2 version"),
                "advanced": True,
                "type": "choice_with_entry",
                "choices": dgvoodoo2Manager().version_choices,
                "default": dgvoodoo2Manager().version,
            },
            {
                "option":
                "esync",
                "label":
                _("Enable Esync"),
                "type":
                "extended_bool",
                "callback":
                esync_limit_callback,
                "callback_on":
                True,
                "active":
                True,
                "default":
                True,
                "help":
                _("Enable eventfd-based synchronization (esync). "
                  "This will increase performance in applications "
                  "that take advantage of multi-core processors."),
            },
            {
                "option":
                "fsync",
                "label":
                _("Enable Fsync"),
                "type":
                "extended_bool",
                "default":
                True,
                "callback":
                fsync_support_callback,
                "callback_on":
                True,
                "active":
                True,
                "help":
                _("Enable futex-based synchronization (fsync). "
                  "This will increase performance in applications "
                  "that take advantage of multi-core processors. "
                  "Requires a custom kernel with the fsync patchset."),
            },
            {
                "option":
                "fsr",
                "label":
                _("Enable AMD FidelityFX Super Resolution (FSR)"),
                "type":
                "bool",
                "default":
                True,
                "help":
                _("Use FSR to upscale the game window to native resolution.\n"
                  "Requires Lutris Wine FShack >= 6.13 and setting the game to a lower resolution.\n"
                  "Does not work with games running in borderless window mode or that perform their own upscaling."
                  ),
            },
            {
                "option":
                "battleye",
                "label":
                _("Enable BattlEye Anti-Cheat"),
                "type":
                "bool",
                "default":
                False,
                "help":
                _("Enable support for BattlEye Anti-Cheat in supported games\n"
                  "Requires Lutris Wine 6.21-2 and newer or any other compatible Wine build.\n"
                  ),
            },
            {
                "option":
                "Desktop",
                "label":
                _("Windowed (virtual desktop)"),
                "type":
                "bool",
                "default":
                False,
                "help":
                _("Run the whole Windows desktop in a window.\n"
                  "Otherwise, run it fullscreen.\n"
                  "This corresponds to Wine's Virtual Desktop option."),
            },
            {
                "option": "WineDesktop",
                "label": _("Virtual desktop resolution"),
                "type": "choice_with_entry",
                "choices": DISPLAY_MANAGER.get_resolutions,
                "help": _("The size of the virtual desktop in pixels."),
            },
            {
                "option":
                "Dpi",
                "label":
                _("Enable DPI Scaling"),
                "type":
                "bool",
                "default":
                False,
                "help":
                _("Enables the Windows application's DPI scaling.\n"
                  "Otherwise, disables DPI scaling by using 96 DPI.\n"
                  "This corresponds to Wine's Screen Resolution option."),
            },
            {
                "option":
                "ExplicitDpi",
                "label":
                _("DPI"),
                "type":
                "string",
                "help":
                _("The DPI to be used if 'Enable DPI Scaling' is turned on.\n"
                  "If blank or 'auto', Lutris will auto-detect this."),
            },
            {
                "option":
                "MouseWarpOverride",
                "label":
                _("Mouse Warp Override"),
                "type":
                "choice",
                "choices": [
                    (_("Enable"), "enable"),
                    (_("Disable"), "disable"),
                    (_("Force"), "force"),
                ],
                "default":
                "enable",
                "advanced":
                True,
                "help":
                _("Override the default mouse pointer warping behavior\n"
                  "<b>Enable</b>: (Wine default) warp the pointer when the "
                  "mouse is exclusively acquired \n"
                  "<b>Disable</b>: never warp the mouse pointer \n"
                  "<b>Force</b>: always warp the pointer"),
            },
            {
                "option":
                "Audio",
                "label":
                _("Audio driver"),
                "type":
                "choice",
                "advanced":
                True,
                "choices": [
                    (_("Auto"), "auto"),
                    ("ALSA", "alsa"),
                    ("PulseAudio", "pulse"),
                    ("OSS", "oss"),
                ],
                "default":
                "auto",
                "help":
                _("Which audio backend to use.\n"
                  "By default, Wine automatically picks the right one "
                  "for your system."),
            },
            {
                "option": "overrides",
                "type": "mapping",
                "label": _("DLL overrides"),
                "help": _("Sets WINEDLLOVERRIDES when launching the game."),
            },
            {
                "option":
                "show_debug",
                "label":
                _("Output debugging info"),
                "type":
                "choice",
                "choices": [
                    (_("Disabled"), "-all"),
                    (_("Enabled"), ""),
                    (_("Inherit from environment"), "inherit"),
                    (_("Show FPS"), "+fps"),
                    (_("Full (CAUTION: Will cause MASSIVE slowdown)"), "+all"),
                ],
                "default":
                "-all",
                "help":
                _("Output debugging information in the game log "
                  "(might affect performance)"),
            },
            {
                "option": "ShowCrashDialog",
                "label": _("Show crash dialogs"),
                "type": "bool",
                "default": False,
                "advanced": True,
            },
            {
                "option":
                "autoconf_joypad",
                "type":
                "bool",
                "label":
                _("Autoconfigure joypads"),
                "advanced":
                True,
                "default":
                False,
                "help":
                _("Automatically disables one of Wine's detected joypad "
                  "to avoid having 2 controllers detected"),
            },
            {
                "option":
                "sandbox",
                "type":
                "bool",
                "label":
                _("Create a sandbox for Wine folders"),
                "default":
                True,
                "advanced":
                True,
                "help":
                _("Do not use $HOME for desktop integration folders.\n"
                  "By default, it use the directories in the confined "
                  "Windows environment."),
            },
            {
                "option": "sandbox_dir",
                "type": "directory_chooser",
                "label": _("Sandbox directory"),
                "help": _("Custom directory for desktop integration folders."),
                "advanced": True,
            },
        ]
Example #8
0
    def __init__(self, config=None):
        super(wine, self).__init__(config)
        self.dll_overrides = {}

        def get_wine_version_choices():
            version_choices = [("Custom (select executable below)", "custom")]
            labels = {
                "winehq-devel": "WineHQ devel ({})",
                "winehq-staging": "WineHQ staging ({})",
                "wine-development": "Wine Development ({})",
                "system": "System ({})",
            }
            versions = get_wine_versions()
            for version in versions:
                if version in labels.keys():
                    version_number = get_system_wine_version(WINE_PATHS[version])
                    label = labels[version].format(version_number)
                else:
                    label = version
                version_choices.append((label, version))
            return version_choices

        def dxvk_choices(manager_class):
            version_choices = [
                ("Manual", "manual"),
                (manager_class.DXVK_LATEST, manager_class.DXVK_LATEST),
            ]
            for version in manager_class.DXVK_PAST_RELEASES:
                version_choices.append((version, version))
            return version_choices

        def get_dxvk_choices():
            return dxvk_choices(dxvk.DXVKManager)

        def get_d9vk_choices():
            return dxvk_choices(dxvk.D9VKManager)

        def esync_limit_callback(widget, option, config):
            limits_set = is_esync_limit_set()
            wine_path = self.get_path_for_version(config["version"])
            wine_ver = is_version_esync(wine_path)
            response = True

            if not wine_ver:
                response = thread_safe_call(esync_display_version_warning)

            if not limits_set:
                thread_safe_call(esync_display_limit_warning)
                response = False

            return widget, option, response

        def dxvk_vulkan_callback(widget, option, config):
            response = True
            if not is_vulkan_supported():
                if not thread_safe_call(display_vulkan_error):
                    response = False
            return widget, option, response

        self.runner_options = [
            {
                "option": "version",
                "label": "Wine version",
                "type": "choice",
                "choices": get_wine_version_choices,
                "default": get_default_version(),
                "help": (
                    "The version of Wine used to launch the game.\n"
                    "Using the last version is generally recommended, "
                    "but some games work better on older versions."
                ),
            },
            {
                "option": "custom_wine_path",
                "label": "Custom Wine executable",
                "type": "file",
                "advanced": True,
                "help": (
                    "The Wine executable to be used if you have "
                    'selected "Custom" as the Wine version.'
                ),
            },
            {
                "option": "dxvk",
                "label": "Enable DXVK",
                "type": "extended_bool",
                "help": "Use DXVK to translate DirectX 11 calls to Vulkan",
                "callback": dxvk_vulkan_callback,
                "callback_on": True,
                "active": True,
            },
            {
                "option": "dxvk_version",
                "label": "DXVK version",
                "advanced": True,
                "type": "choice_with_entry",
                "choices": get_dxvk_choices,
                "default": dxvk.DXVKManager.DXVK_LATEST,
            },
            {
                "option": "d9vk",
                "label": "Enable D9VK",
                "type": "extended_bool",
                "help": "Use D9VK to translate DirectX 9 calls to Vulkan",
                "callback": dxvk_vulkan_callback,
                "callback_on": True,
                "active": True,
            },
            {
                "option": "d9vk_version",
                "label": "D9VK version",
                "advanced": True,
                "type": "choice_with_entry",
                "choices": get_d9vk_choices,
                "default": dxvk.D9VKManager.DXVK_LATEST,
            },
            {
                "option": "esync",
                "label": "Enable Esync",
                "type": "extended_bool",
                "help": "Enable eventfd-based synchronization (esync)",
                "callback": esync_limit_callback,
                "callback_on": True,
                "active": True,
            },
            {
                "option": "x360ce-path",
                "label": "Path to the game's executable, for x360ce support",
                "type": "directory_chooser",
                "help": "Locate the path for the game's executable for x360 support",
                "advanced": True,
            },
            {
                "option": "x360ce-dinput",
                "label": "x360ce dinput 8 mode",
                "type": "bool",
                "default": False,
                "help": "Configure x360ce with dinput8.dll, required for some games",
                "advanced": True,
            },
            {
                "option": "x360ce-xinput9",
                "label": "x360ce xinput 9.1.0 mode",
                "type": "bool",
                "default": False,
                "help": "Configure x360ce with xinput9_1_0.dll, required for some newer games",
                "advanced": True,
            },
            {
                "option": "dumbxinputemu",
                "label": "Use Dumb xinput Emulator (experimental)",
                "type": "bool",
                "default": False,
                "help": "Use the dlls from kozec/dumbxinputemu",
                "advanced": True,
            },
            {
                "option": "xinput-arch",
                "label": "Xinput architecture",
                "type": "choice",
                "choices": [
                    ("Same as wine prefix", ""),
                    ("32 bit", "win32"),
                    ("64 bit", "win64"),
                ],
                "default": "",
                "advanced": True,
            },
            {
                "option": "Desktop",
                "label": "Windowed (virtual desktop)",
                "type": "bool",
                "default": False,
                "help": (
                    "Run the whole Windows desktop in a window.\n"
                    "Otherwise, run it fullscreen.\n"
                    "This corresponds to Wine's Virtual Desktop option."
                ),
            },
            {
                "option": "WineDesktop",
                "label": "Virtual desktop resolution",
                "type": "choice_with_entry",
                "choices": display.get_unique_resolutions,
                "help": "The size of the virtual desktop in pixels.",
            },
            {
                "option": "MouseWarpOverride",
                "label": "Mouse Warp Override",
                "type": "choice",
                "choices": [
                    ("Enable", "enable"),
                    ("Disable", "disable"),
                    ("Force", "force"),
                ],
                "default": "enable",
                "advanced": True,
                "help": (
                    "Override the default mouse pointer warping behavior\n"
                    "<b>Enable</b>: (Wine default) warp the pointer when the "
                    "mouse is exclusively acquired \n"
                    "<b>Disable</b>: never warp the mouse pointer \n"
                    "<b>Force</b>: always warp the pointer"
                ),
            },
            {
                "option": "OffscreenRenderingMode",
                "label": "Offscreen Rendering Mode",
                "type": "choice",
                "choices": [("FBO", "fbo"), ("BackBuffer", "backbuffer")],
                "default": "fbo",
                "advanced": True,
                "help": (
                    "Select the offscreen rendering implementation.\n"
                    "<b>FBO</b>: (Wine default) Use framebuffer objects "
                    "for offscreen rendering \n"
                    "<b>Backbuffer</b>: Render offscreen render targets "
                    "in the backbuffer."
                ),
            },
            {
                "option": "StrictDrawOrdering",
                "label": "Strict Draw Ordering",
                "type": "choice",
                "choices": [("Enabled", "enabled"), ("Disabled", "disabled")],
                "default": "disabled",
                "advanced": True,
                "help": (
                    "This option ensures any pending drawing operations are "
                    "submitted to the driver, but at a significant performance "
                    'cost. Set to "enabled" to enable. This setting is deprecated '
                    "since wine-2.6 and will likely be removed after wine-3.0. "
                    'Use "csmt" instead.'
                ),
            },
            {
                "option": "UseGLSL",
                "label": "Use GLSL",
                "type": "choice",
                "choices": [("Enabled", "enabled"), ("Disabled", "disabled")],
                "default": "enabled",
                "advanced": True,
                "help": (
                    'When set to "disabled", this disables the use of GLSL for shaders. '
                    "In general disabling GLSL is not recommended, "
                    "only use this for debugging purposes."
                ),
            },
            {
                "option": "SampleCount",
                "label": "Anti-aliasing Sample Count",
                "type": "choice",
                "choices": [
                    ("Auto", "auto"),
                    ("0", "0"),
                    ("2", "2"),
                    ("4", "4"),
                    ("8", "8"),
                    ("16", "16")
                ],
                "default": "auto",
                "advanced": True,
                "help": (
                    "Override swapchain sample count. It can be used to force enable multisampling "
                    "with applications that otherwise don't support it, like the similar control "
                    "panel setting available with some GPU drivers. This one might work in more "
                    "cases than the driver setting though. "
                    "Not all applications are compatible with all sample counts. "
                )
            },
            {
                "option": "UseXVidMode",
                "label": "Use XVidMode to switch resolutions",
                "type": "bool",
                "default": False,
                "advanced": True,
                "help": (
                    'Set this to "Y" to allow wine switch the resolution using XVidMode extension.'
                ),
            },
            {
                "option": "Audio",
                "label": "Audio driver",
                "type": "choice",
                "advanced": True,
                "choices": [
                    ("Auto", "auto"),
                    ("ALSA", "alsa"),
                    ("PulseAudio", "pulse"),
                    ("OSS", "oss"),
                ],
                "default": "auto",
                "help": (
                    "Which audio backend to use.\n"
                    "By default, Wine automatically picks the right one "
                    "for your system."
                ),
            },
            {
                "option": "overrides",
                "type": "mapping",
                "label": "DLL overrides",
                "help": "Sets WINEDLLOVERRIDES when launching the game.",
            },
            {
                "option": "show_debug",
                "label": "Output debugging info",
                "type": "choice",
                "choices": [
                    ("Disabled", "-all"),
                    ("Enabled", ""),
                    ("Inherit from environment", "inherit"),
                    ("Show FPS", "+fps"),
                    ("Full (CAUTION: Will cause MASSIVE slowdown)", "+all"),
                ],
                "default": "-all",
                "help": (
                    "Output debugging information in the game log "
                    "(might affect performance)"
                ),
            },
            {
                "option": "ShowCrashDialog",
                "label": "Show crash dialogs",
                "type": "bool",
                "default": False,
                "advanced": True,
            },
            {
                "option": "autoconf_joypad",
                "type": "bool",
                "label": "Autoconfigure joypads",
                "advanced": True,
                "default": True,
                "help": (
                    "Automatically disables one of Wine's detected joypad "
                    "to avoid having 2 controllers detected"
                ),
            },
            {
                "option": "sandbox",
                "type": "bool",
                "label": "Create a sandbox for wine folders",
                "default": True,
                "advanced": True,
                "help": (
                    "Do not use $HOME for desktop integration folders.\n"
                    "By default, it use the directories in the confined "
                    "Windows environment."
                ),
            },
            {
                "option": "sandbox_dir",
                "type": "directory_chooser",
                "label": "Sandbox directory",
                "help": "Custom directory for desktop integration folders.",
                "advanced": True,
            },
        ]