def prelaunch(self): if not system.path_exists(os.path.join(self.prefix_path, "user.reg")): create_prefix(self.prefix_path, arch=self.wine_arch) prefix_manager = WinePrefixManager(self.prefix_path) if self.runner_config.get("autoconf_joypad", True): prefix_manager.configure_joypads() self.sandbox(prefix_manager) self.set_regedit_keys() self.setup_x360ce(self.runner_config.get("x360ce-path")) self.setup_dxvk( "dxvk", dxvk_manager=dxvk.DXVKManager( self.prefix_path, arch=self.wine_arch, version=self.runner_config.get("dxvk_version")), ) # we don't want d9vk to restore d3d9.dll, because dxvk could set it already if bool(self.runner_config.get("d9vk")): self.setup_dxvk( "d9vk", dxvk_manager=dxvk.D9VKManager( self.prefix_path, arch=self.wine_arch, version=self.runner_config.get("d9vk_version")), ) return True
def prelaunch(self): if not system.path_exists(os.path.join(self.prefix_path, "user.reg")): create_prefix(self.prefix_path, arch=self.wine_arch) prefix_manager = WinePrefixManager(self.prefix_path) if self.runner_config.get("autoconf_joypad", True): prefix_manager.configure_joypads() self.sandbox(prefix_manager) self.set_regedit_keys() self.setup_x360ce(self.runner_config.get("x360ce-path")) self.setup_dxvk( "dxvk", dxvk_manager=dxvk.DXVKManager( self.prefix_path, arch=self.wine_arch, version=self.runner_config.get("dxvk_version"), ), ) # we don't want d9vk to restore d3d9.dll, because dxvk could set it already if bool(self.runner_config.get("d9vk")): self.setup_dxvk( "d9vk", dxvk_manager=dxvk.D9VKManager( self.prefix_path, arch=self.wine_arch, version=self.runner_config.get("d9vk_version"), ), ) try: self.setup_nine(self.runner_config.get("gallium_nine")) except nine.NineUnavailable as ex: raise GameConfigError("Unable to configure GalliumNine: %s" % ex) return True
def toggle_dxvk(self, enable, version=None): dxvk_manager = dxvk.DXVKManager( self.prefix_path, arch=self.wine_arch, version=version ) # 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: self.dll_overrides[dll] = "n"
def get_dxvk_choices(): return dxvk_choices(dxvk.DXVKManager())
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, }, ]