示例#1
0
    def get_env(self, os_env=False):
        """Return environment variables used by the game"""
        # Always false to runner.get_env, the default value
        # of os_env is inverted in the wine class,
        # the OS env is read later.
        env = super().get_env(False)
        if os_env:
            env.update(os.environ.copy())
        show_debug = self.runner_config.get("show_debug", "-all")
        if show_debug != "inherit":
            env["WINEDEBUG"] = show_debug
        if show_debug == "-all":
            env["DXVK_LOG_LEVEL"] = "none"
        env["WINEARCH"] = self.wine_arch
        env["WINE"] = self.get_executable()
        env["WINE_MONO_CACHE_DIR"] = os.path.join(WINE_DIR, self.get_version(),
                                                  "mono")
        env["WINE_GECKO_CACHE_DIR"] = os.path.join(WINE_DIR,
                                                   self.get_version(), "gecko")
        if is_gstreamer_build(self.get_executable()):
            path_64 = os.path.join(WINE_DIR, self.get_version(),
                                   "lib64/gstreamer-1.0/")
            path_32 = os.path.join(WINE_DIR, self.get_version(),
                                   "lib/gstreamer-1.0/")
            if os.path.exists(path_64) or os.path.exists(path_32):
                env["GST_PLUGIN_SYSTEM_PATH_1_0"] = path_64 + ":" + path_32
        if self.prefix_path:
            env["WINEPREFIX"] = self.prefix_path

        if not ("WINEESYNC" in env and env["WINEESYNC"] == "1"):
            env["WINEESYNC"] = "1" if self.runner_config.get("esync") else "0"

        if not ("WINEFSYNC" in env and env["WINEFSYNC"] == "1"):
            env["WINEFSYNC"] = "1" if self.runner_config.get("fsync") else "0"

        if self.runner_config.get("fsr"):
            env["WINE_FULLSCREEN_FSR"] = "1"

        if self.runner_config.get("dxvk_nvapi"):
            env["DXVK_NVAPIHACK"] = "0"

        if self.runner_config.get("battleye"):
            env["PROTON_BATTLEYE_RUNTIME"] = os.path.join(
                settings.RUNTIME_DIR, "battleye_runtime")

        overrides = self.get_dll_overrides()
        if overrides:
            self.dll_overrides.update(overrides)
        env["WINEDLLOVERRIDES"] = get_overrides_env(self.dll_overrides)
        return env
示例#2
0
文件: wine.py 项目: xnick/lutris
    def get_env(self, os_env=False):
        """Return environment variables used by the game"""
        # Always false to runner.get_env, the default value
        # of os_env is inverted in the wine class,
        # the OS env is read later.
        env = super(wine, self).get_env(False)
        if os_env:
            env.update(os.environ.copy())
        show_debug = self.runner_config.get("show_debug", "-all")
        if show_debug != "inherit":
            env["WINEDEBUG"] = show_debug
        env["WINEARCH"] = self.wine_arch
        env["WINE"] = self.get_executable()
        if is_gstreamer_build(self.get_executable()):
            path_64 = os.path.join(WINE_DIR, self.get_version(),
                                   "lib64/gstreamer-1.0/")
            path_32 = os.path.join(WINE_DIR, self.get_version(),
                                   "lib/gstreamer-1.0/")
            if os.path.exists(path_64) or os.path.exists(path_32):
                env["GST_PLUGIN_SYSTEM_PATH_1_0"] = path_64 + ":" + path_32
        if self.prefix_path:
            env["WINEPREFIX"] = self.prefix_path

        if not ("WINEESYNC" in env and env["WINEESYNC"] == "1"):
            env["WINEESYNC"] = "1" if self.runner_config.get("esync") else "0"

        if not ("WINEFSYNC" in env and env["WINEFSYNC"] == "1"):
            env["WINEFSYNC"] = "1" if self.runner_config.get("fsync") else "0"

        # On AMD, mimic the video memory management behavior of Windows DX12
        # drivers more closely, otherwise d3d12 games will crash and have other
        # funky issues.
        # RADV_DEBUG is a comma separated list. If it is already set, we want to
        # append to it.
        if self.runner_config.get("dxvk") and drivers.is_amd():
            if "RADV_DEBUG" not in env or not env["RADV_DEBUG"]:
                env["RADV_DEBUG"] = "zerovram"
            elif "zerovram" not in env["RADV_DEBUG"]:
                env["RADV_DEBUG"] += ",zerovram"

        overrides = self.get_dll_overrides()
        if overrides:
            self.dll_overrides.update(overrides)
        env["WINEDLLOVERRIDES"] = get_overrides_env(self.dll_overrides)
        return env