예제 #1
0
def init_lutris():
    """Run full initialization of Lutris"""
    logger.info("Initializing lutris")
    runners.inject_runners(load_json_runners())
    # Load runner names
    runners.RUNNER_NAMES = runners.get_runner_names()
    init_dirs()
    try:
        syncdb()
    except sqlite3.DatabaseError:
        raise RuntimeError(
            "Failed to open database file in %s. Try renaming this file and relaunch Lutris"
            % settings.PGA_DB)
    for service in DEFAULT_SERVICES:
        if not settings.read_setting(service, section="services"):
            settings.write_setting(service, True, section="services")

    if os.environ.get("LUTRIS_SKIP_INIT"):
        logger.info("Skipping initialization")
        return
    runtime_updater = RuntimeUpdater()
    components_to_update = runtime_updater.update()
    if components_to_update:
        while runtime_updater.current_updates:
            time.sleep(0.3)
    fetch_dxvk_versions()
    dxvk_manager = DXVKManager()
    if not dxvk_manager.is_available():
        logger.info("DXVK %s not available, downloading...",
                    dxvk_manager.version)
        dxvk_manager.download()
    logger.info("Runtime updated. Initialization complete.")
예제 #2
0
def init_lutris():
    """Run full initialization of Lutris"""
    logger.info("Initializing lutris")
    runners.inject_runners(load_json_runners())
    # Load runner names
    runners.RUNNER_NAMES = runners.get_runner_names()
    init_dirs()
    try:
        syncdb()
    except sqlite3.DatabaseError:
        raise RuntimeError(
            "Failed to open database file in %s. Try renaming this file and relaunch Lutris"
            % settings.PGA_DB)
    runtime_updater = RuntimeUpdater()
    components_to_update = runtime_updater.update()
    if components_to_update:
        while runtime_updater.current_updates:
            time.sleep(0.3)
    fetch_dxvk_versions()
    dxvk_manager = DXVKManager()
    if not dxvk_manager.is_available():
        logger.info("DXVK %s not available, downloading...",
                    dxvk_manager.version)
        dxvk_manager.download()
    logger.info("Runtime updated. Initialization complete.")
예제 #3
0
    def toggle_dxvk(self, enable, version=None, dxvk_manager: dxvk.DXVKManager = None):
        # manual version only sets the dlls to native
        if version.lower() != "manual":
            if enable:
                if not dxvk_manager.is_available():
                    dxvk_manager.download()
                dxvk_manager.enable()
            else:
                dxvk_manager.disable()

        if enable:
            for dll in dxvk_manager.dxvk_dlls:
                # We have to make sure that the dll exists before setting it to native
                if dxvk_manager.dxvk_dll_exists(dll):
                    self.dll_overrides[dll] = "n"
예제 #4
0
    def toggle_dxvk(self, enable, version=None, dxvk_manager: dxvk.DXVKManager = None):
        # manual version only sets the dlls to native
        if version.lower() != "manual":
            if enable:
                if not dxvk_manager.is_available():
                    dxvk_manager.download()
                dxvk_manager.enable()
            else:
                dxvk_manager.disable()

        if enable:
            for dll in dxvk_manager.dxvk_dlls:
                # We have to make sure that the dll exists before setting it to native
                if dxvk_manager.dxvk_dll_exists(dll):
                    self.dll_overrides[dll] = "n"
예제 #5
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,
            },
        ]