def play(self): game_exe = self.game_exe arguments = self.game_config.get('args', '') using_dxvk = self.runner_config.get('dxvk') if using_dxvk: if not is_vulkan_supported(): if not display_vulkan_error(True): return {'error': 'VULKAN_NOT_FOUND'} if not system.path_exists(game_exe): return {'error': 'FILE_NOT_FOUND', 'file': game_exe} launch_info = { 'env': self.get_env(os_env=False) } if 'WINEESYNC' in launch_info['env'].get('WINEESYNC') == "1": limit_set = is_esync_limit_set() wine_ver = is_version_esync(self.get_executable()) if not limit_set and not wine_ver: esync_display_version_warning(True) esync_display_limit_warning() return {'error': 'ESYNC_LIMIT_NOT_SET'} if not is_esync_limit_set(): esync_display_limit_warning() return {'error': 'ESYNC_LIMIT_NOT_SET'} if not wine_ver: if not esync_display_version_warning(True): return {'error': 'NON_ESYNC_WINE_VERSION'} command = [self.get_executable()] game_exe, args, _working_dir = get_real_executable(game_exe, self.working_dir) command.append(game_exe) if args: command = command + args if arguments: for arg in shlex.split(arguments): command.append(arg) launch_info['command'] = command return launch_info
def wineexec( executable, args="", wine_path=None, prefix=None, arch=None, # pylint: disable=too-many-locals working_dir=None, winetricks_wine='', blocking=False, config=None, include_processes=[], exclude_processes=[], disable_runtime=False, env={}, overrides=None): """ Execute a Wine command. Args: executable (str): wine program to run, pass None to run wine itself args (str): program arguments wine_path (str): path to the wine version to use prefix (str): path to the wine prefix to use arch (str): wine architecture of the prefix working_dir (str): path to the working dir for the process winetricks_wine (str): path to the wine version used by winetricks blocking (bool): if true, do not run the process in a thread config (LutrisConfig): LutrisConfig object for the process context watch (list): list of process names to monitor (even when in a ignore list) Returns: Process results if the process is running in blocking mode or LutrisThread instance otherwise. """ executable = str(executable) if executable else '' if not wine_path: wine = import_runner('wine') wine_path = wine().get_executable() if not wine_path: raise RuntimeError("Wine is not installed") if not working_dir: if os.path.isfile(executable): working_dir = os.path.dirname(executable) executable, _args, working_dir = get_real_executable( executable, working_dir) if _args: args = '{} "{}"'.format(_args[0], _args[1]) # Create prefix if necessary if arch not in ('win32', 'win64'): arch = detect_arch(prefix, wine_path) if not detect_prefix_arch(prefix): wine_bin = winetricks_wine if winetricks_wine else wine_path create_prefix(prefix, wine_path=wine_bin, arch=arch) wineenv = {'WINEARCH': arch} if winetricks_wine: wineenv['WINE'] = winetricks_wine else: wineenv['WINE'] = wine_path if prefix: wineenv['WINEPREFIX'] = prefix wine_config = config or LutrisConfig(runner_slug='wine') disable_runtime = disable_runtime or wine_config.system_config[ 'disable_runtime'] if use_lutris_runtime(wine_path=wineenv['WINE'], force_disable=disable_runtime): if WINE_DIR in wine_path: wine_root_path = os.path.dirname(os.path.dirname(wine_path)) elif WINE_DIR in winetricks_wine: wine_root_path = os.path.dirname(os.path.dirname(winetricks_wine)) else: wine_root_path = None wineenv['LD_LIBRARY_PATH'] = ':'.join( runtime.get_paths(prefer_system_libs=wine_config. system_config['prefer_system_libs'], wine_path=wine_root_path)) if overrides: wineenv['WINEDLLOVERRIDES'] = get_overrides_env(overrides) wineenv.update(env) command = [wine_path] if executable: command.append(executable) command += shlex.split(args) if blocking: return system.execute(command, env=wineenv, cwd=working_dir) wine = import_runner('wine') thread = LutrisThread(command, runner=wine(), env=wineenv, cwd=working_dir, include_processes=include_processes, exclude_processes=exclude_processes) thread.start() return thread