def change_resolution(resolution): """Change display resolution. Takes a string for single monitors or a list of displays as returned by get_outputs(). """ if not resolution: logger.warning("No resolution provided") return if isinstance(resolution, str): logger.debug("Switching resolution to %s", resolution) if resolution not in get_resolutions(): logger.warning("Resolution %s doesn't exist.", resolution) else: logger.info("Changing resolution to %s", resolution) with subprocess.Popen( [LINUX_SYSTEM.get("xrandr"), "-s", resolution]) as xrandr: xrandr.communicate() else: for display in resolution: logger.debug("Switching to %s on %s", display.mode, display.name) if display.rotation is not None and display.rotation in ( "normal", "left", "right", "inverted", ): rotation = display.rotation else: rotation = "normal" logger.info("Switching resolution of %s to %s", display.name, display.mode) with subprocess.Popen([ LINUX_SYSTEM.get("xrandr"), "--output", display.name, "--mode", display.mode, "--pos", display.position, "--rotate", rotation, "--rate", display.rate, ]) as xrandr: xrandr.communicate()
def check_libs(all_components=False): """Checks that required libraries are installed on the system""" missing_libs = LINUX_SYSTEM.get_missing_libs() if all_components: components = LINUX_SYSTEM.requirements else: components = LINUX_SYSTEM.critical_requirements missing_vulkan_libs = [] for req in components: for index, arch in enumerate(LINUX_SYSTEM.runtime_architectures): for lib in missing_libs[req][index]: if req == "VULKAN": missing_vulkan_libs.append(arch) logger.error("%s %s missing (needed by %s)", arch, lib, req.lower()) if missing_vulkan_libs: setting = "dismiss-missing-vulkan-library-warning" if settings.read_setting(setting) != "True": DontShowAgainDialog( setting, _("Missing vulkan libraries"), secondary_message=_( "Lutris was unable to detect Vulkan support for " "the %s architecture.\n" "This will prevent many games and programs from working.\n" "To install it, please use the following guide: " "<a href='%s'>Installing Graphics Drivers</a>" ) % ( _(" and ").join(missing_vulkan_libs), settings.DRIVER_HOWTO_URL, ) )
def on_entry_changed(self, widget): """Entry changed callback""" self.clear_warnings() path = widget.get_text() if not path: return path = os.path.expanduser(path) self.update_completion(path) if self.warn_if_ntfs and LINUX_SYSTEM.get_fs_type_for_path(path) == "ntfs": ntfs_box = Gtk.Box(spacing=6, visible=True) warning_image = Gtk.Image(visible=True) warning_image.set_from_pixbuf(get_stock_icon("dialog-warning", 32)) ntfs_box.add(warning_image) ntfs_label = Gtk.Label(visible=True) ntfs_label.set_markup( "<b>Warning!</b> The selected path is located on a NTFS drive.\n" "Installing games on NTFS partitions is known to cause issues." ) ntfs_box.add(ntfs_label) self.pack_end(ntfs_box, False, False, 10) if self.warn_if_non_empty and os.path.exists(path) and os.listdir(path): non_empty_label = Gtk.Label(visible=True) non_empty_label.set_markup( "<b>Warning!</b> The selected path " "contains files. Installation might not work properly." ) self.pack_end(non_empty_label, False, False, 10)
def on_entry_changed(self, widget): """Entry changed callback""" self.clear_warnings() path = widget.get_text() if not path: return path = os.path.expanduser(path) self.update_completion(path) if self.warn_if_ntfs and LINUX_SYSTEM.get_fs_type_for_path( path) == "ntfs": ntfs_box = Gtk.Box(spacing=6, visible=True) warning_image = Gtk.Image(visible=True) warning_image.set_from_pixbuf(get_stock_icon("dialog-warning", 32)) ntfs_box.add(warning_image) ntfs_label = Gtk.Label(visible=True) ntfs_label.set_markup( "<b>Warning!</b> The selected path is located on a drive formatted by Windows.\n" "Games and programs installed on Windows drives usually <b>don't work</b>." ) ntfs_box.add(ntfs_label) self.pack_end(ntfs_box, False, False, 10) if self.warn_if_non_empty and os.path.exists(path) and os.listdir( path): non_empty_label = Gtk.Label(visible=True) non_empty_label.set_markup( "<b>Warning!</b> The selected path " "contains files. Installation might not work properly.") self.pack_end(non_empty_label, False, False, 10)
def check_libs(all_components=False): """Checks that required libraries are installed on the system""" missing_libs = LINUX_SYSTEM.get_missing_libs() if all_components: components = LINUX_SYSTEM.requirements else: components = LINUX_SYSTEM.critical_requirements missing_vulkan_libs = [] for req in components: for index, arch in enumerate(LINUX_SYSTEM.runtime_architectures): for lib in missing_libs[req][index]: if req == "VULKAN": missing_vulkan_libs.append(arch) logger.error("%s %s missing (needed by %s)", arch, lib, req.lower()) if missing_vulkan_libs: setting = "dismiss-missing-vulkan-library-warning" if settings.read_setting(setting) != "True": DontShowAgainDialog( setting, "Missing vulkan libraries", secondary_message="The Vulkan library for %s has not been found. " "This will prevent games using Vulkan (such as DXVK games) from running. " "To install it, please follow " "<a href='https://github.com/lutris/lutris/wiki/Installing-drivers'>" "the instructions on our Wiki</a>" % " and ".join(missing_vulkan_libs) )
def get_runtime_paths(version=None, prefer_system_libs=True, wine_path=None): """Return Lutris runtime paths""" version = version or DEFAULT_RUNTIME lutris_runtime_path = "%s-i686" % version runtime_paths = [ lutris_runtime_path, "steam/i386/lib/i386-linux-gnu", "steam/i386/lib", "steam/i386/usr/lib/i386-linux-gnu", "steam/i386/usr/lib", ] if LINUX_SYSTEM.is_64_bit: lutris_runtime_path = "%s-x86_64" % version runtime_paths += [ lutris_runtime_path, "steam/amd64/lib/x86_64-linux-gnu", "steam/amd64/lib", "steam/amd64/usr/lib/x86_64-linux-gnu", "steam/amd64/usr/lib", ] paths = [] if prefer_system_libs: if wine_path: paths += get_winelib_paths(wine_path) paths += list(LINUX_SYSTEM.iter_lib_folders()) # Then resolve absolute paths for the runtime paths += [ os.path.join(settings.RUNTIME_DIR, path) for path in runtime_paths ] return paths
def check_libs(all_components=False): """Checks that required libraries are installed on the system""" missing_libs = LINUX_SYSTEM.get_missing_libs() if all_components: components = LINUX_SYSTEM.requirements else: components = LINUX_SYSTEM.critical_requirements missing_vulkan_libs = [] for req in components: for index, arch in enumerate(LINUX_SYSTEM.runtime_architectures): for lib in missing_libs[req][index]: if req == "VULKAN": missing_vulkan_libs.append(arch) logger.error("%s %s missing (needed by %s)", arch, lib, req.lower()) if missing_vulkan_libs: setting = "dismiss-missing-vulkan-library-warning" if settings.read_setting(setting) != "True": DontShowAgainDialog( setting, "Missing vulkan libraries", secondary_message= "The Vulkan library for %s has not been found. " "This will prevent games using Vulkan (such as DXVK games) from running. " "To install it, please follow " "<a href='https://github.com/lutris/lutris/wiki/Installing-drivers'>" "the instructions on our Wiki</a>" % " and ".join(missing_vulkan_libs))
def find_executable(exec_name): """Return the absolute path of an executable""" if not exec_name: return None cached = LINUX_SYSTEM.get(exec_name) if cached: return cached return shutil.which(exec_name)
def gather_system_info(): """Get all system information in a single data structure""" system_info = {} if drivers.is_nvidia(): system_info["nvidia_driver"] = drivers.get_nvidia_driver_info() system_info["nvidia_gpus"] = [ drivers.get_nvidia_gpu_info(gpu_id) for gpu_id in drivers.get_nvidia_gpu_ids() ] system_info["gpus"] = [ drivers.get_gpu_info(gpu) for gpu in drivers.get_gpus() ] system_info["env"] = dict(os.environ) system_info["missing_libs"] = LINUX_SYSTEM.get_missing_libs() system_info["cpus"] = LINUX_SYSTEM.get_cpus() system_info["drives"] = LINUX_SYSTEM.get_drives() system_info["ram"] = LINUX_SYSTEM.get_ram_info() system_info["dist"] = LINUX_SYSTEM.get_dist_info() system_info["glxinfo"] = GlxInfo().as_dict() return system_info
def check_libs(all_components=False): """Checks that required libraries are installed on the system""" missing_libs = LINUX_SYSTEM.get_missing_libs() if all_components: components = LINUX_SYSTEM.requirements else: components = LINUX_SYSTEM.critical_requirements for req in components: for index, arch in enumerate(LINUX_SYSTEM.runtime_architectures): for lib in missing_libs[req][index]: logger.error("%s %s missing (needed by %s)", arch, lib, req.lower())
def turn_off_except(display): """Use XrandR to turn off displays except the one referenced by `display`""" if not display: logger.error("No active display given, no turning off every display") return for output in get_outputs(): if output.name != display: logger.info("Turning off %s", output[0]) with subprocess.Popen( [LINUX_SYSTEM.get("xrandr"), "--output", output.name, "--off"]) as xrandr: xrandr.communicate()
def get_runtime_paths(version=None, prefer_system_libs=True, wine_path=None): """Return Lutris runtime paths""" version = version or DEFAULT_RUNTIME if version.startswith("Ubuntu"): lutris_runtime_path = "%s-i686" % version elif version == "legacy": lutris_runtime_path = "lib32" else: raise ValueError("Invalid runtime version %s" % version) runtime_paths = [ lutris_runtime_path, "steam/i386/lib/i386-linux-gnu", "steam/i386/lib", "steam/i386/usr/lib/i386-linux-gnu", "steam/i386/usr/lib", ] if LINUX_SYSTEM.is_64_bit: if version == "legacy": lutris_runtime_path = "lib64" else: lutris_runtime_path = "%s-x86_64" % version runtime_paths += [ lutris_runtime_path, "steam/amd64/lib/x86_64-linux-gnu", "steam/amd64/lib", "steam/amd64/usr/lib/x86_64-linux-gnu", "steam/amd64/usr/lib", ] paths = [] if prefer_system_libs: if wine_path: paths += get_winelib_paths(wine_path) paths += list(LINUX_SYSTEM.iter_lib_folders()) # Then resolve absolute paths for the runtime paths += [ os.path.join(settings.RUNTIME_DIR, path) for path in runtime_paths ] return paths
def _get_vidmodes(): """Return video modes from XrandR""" logger.debug("Retrieving video modes from XrandR") return read_process_output([LINUX_SYSTEM.get("xrandr")]).split("\n")
def get_terminal_apps(): """Return the list of installed terminal emulators""" return LINUX_SYSTEM.get_terminals()
def get_launch_parameters(runner, gameplay_info): system_config = runner.system_config launch_arguments = gameplay_info["command"] env = {} # Optimus optimus = system_config.get("optimus") if optimus == "primusrun" and system.find_executable("primusrun"): launch_arguments.insert(0, "primusrun") elif optimus == "optirun" and system.find_executable("optirun"): launch_arguments.insert(0, "virtualgl") launch_arguments.insert(0, "-b") launch_arguments.insert(0, "optirun") elif optimus == "pvkrun" and system.find_executable("pvkrun"): launch_arguments.insert(0, "pvkrun") mango_args, mango_env = get_mangohud_conf(system_config) if mango_args: launch_arguments = mango_args + launch_arguments env.update(mango_env) # Libstrangle fps_limit = system_config.get("fps_limit") or "" if fps_limit: strangle_cmd = system.find_executable("strangle") if strangle_cmd: launch_arguments = [strangle_cmd, fps_limit] + launch_arguments else: logger.warning( "libstrangle is not available on this system, FPS limiter disabled" ) prefix_command = system_config.get("prefix_command") or "" if prefix_command: launch_arguments = (shlex.split(os.path.expandvars(prefix_command)) + launch_arguments) single_cpu = system_config.get("single_cpu") or False if single_cpu: logger.info("The game will run on a single CPU core") launch_arguments.insert(0, "0") launch_arguments.insert(0, "-c") launch_arguments.insert(0, "taskset") env.update(runner.get_env()) env.update(gameplay_info.get("env") or {}) # Set environment variables dependent on gameplay info # LD_PRELOAD ld_preload = gameplay_info.get("ld_preload") if ld_preload: env["LD_PRELOAD"] = ld_preload # LD_LIBRARY_PATH game_ld_libary_path = gameplay_info.get("ld_library_path") if game_ld_libary_path: ld_library_path = env.get("LD_LIBRARY_PATH") if not ld_library_path: ld_library_path = "$LD_LIBRARY_PATH" env["LD_LIBRARY_PATH"] = ":".join( [game_ld_libary_path, ld_library_path]) # Feral gamemode gamemode = system_config.get( "gamemode") and LINUX_SYSTEM.gamemode_available() if gamemode and system.find_executable("gamemoderun"): launch_arguments.insert(0, "gamemoderun") return launch_arguments, env
def configure_game(self, prelaunched, error=None): # noqa: C901 """Get the game ready to start, applying all the options This methods sets the game_runtime_config attribute. """ # pylint: disable=too-many-locals,too-many-branches,too-many-statements # TODO: split into multiple methods to reduce complexity (42) if error: logger.error(error) dialogs.ErrorDialog(str(error)) if not prelaunched: logger.error("Game prelaunch unsuccessful") dialogs.ErrorDialog(_("An error prevented the game from running")) self.state = self.STATE_STOPPED self.emit("game-stop") return system_config = self.runner.system_config self.original_outputs = DISPLAY_MANAGER.get_config() gameplay_info = self.runner.play() if "error" in gameplay_info: self.show_error_message(gameplay_info) self.state = self.STATE_STOPPED self.emit("game-stop") return logger.debug("Launching %s", self.name) logger.debug(json.dumps(gameplay_info, indent=2)) env = {} sdl_gamecontrollerconfig = system_config.get( "sdl_gamecontrollerconfig") if sdl_gamecontrollerconfig: path = os.path.expanduser(sdl_gamecontrollerconfig) if system.path_exists(path): with open(path, "r") as controllerdb_file: sdl_gamecontrollerconfig = controllerdb_file.read() env["SDL_GAMECONTROLLERCONFIG"] = sdl_gamecontrollerconfig sdl_video_fullscreen = system_config.get("sdl_video_fullscreen") or "" env["SDL_VIDEO_FULLSCREEN_DISPLAY"] = sdl_video_fullscreen restrict_to_display = system_config.get("display") if restrict_to_display != "off": if restrict_to_display == "primary": restrict_to_display = None for output in self.original_outputs: if output.primary: restrict_to_display = output.name break if not restrict_to_display: logger.warning("No primary display set") else: found = False for output in self.original_outputs: if output.name == restrict_to_display: found = True break if not found: logger.warning("Selected display %s not found", restrict_to_display) restrict_to_display = None if restrict_to_display: turn_off_except(restrict_to_display) time.sleep(3) self.resolution_changed = True resolution = system_config.get("resolution") if resolution != "off": DISPLAY_MANAGER.set_resolution(resolution) time.sleep(3) self.resolution_changed = True if system_config.get("reset_pulse"): audio.reset_pulse() self.killswitch = system_config.get("killswitch") if self.killswitch and not system.path_exists(self.killswitch): # Prevent setting a killswitch to a file that doesn't exists self.killswitch = None # Command launch_arguments = gameplay_info["command"] optimus = system_config.get("optimus") if optimus == "primusrun" and system.find_executable("primusrun"): launch_arguments.insert(0, "primusrun") elif optimus == "optirun" and system.find_executable("optirun"): launch_arguments.insert(0, "virtualgl") launch_arguments.insert(0, "-b") launch_arguments.insert(0, "optirun") elif optimus == "pvkrun" and system.find_executable("pvkrun"): launch_arguments.insert(0, "pvkrun") xephyr = system_config.get("xephyr") or "off" if xephyr != "off": if not system.find_executable("Xephyr"): raise GameConfigError( "Unable to find Xephyr, install it or disable the Xephyr option" ) xephyr_depth = "8" if xephyr == "8bpp" else "16" xephyr_resolution = system_config.get( "xephyr_resolution") or "640x480" xephyr_command = [ "Xephyr", ":2", "-ac", "-screen", xephyr_resolution + "x" + xephyr_depth, "-glamor", "-reset", "-terminate", ] if system_config.get("xephyr_fullscreen"): xephyr_command.append("-fullscreen") xephyr_thread = MonitoredCommand(xephyr_command) xephyr_thread.start() time.sleep(3) env["DISPLAY"] = ":2" if system_config.get("use_us_layout"): setxkbmap_command = [ "setxkbmap", "-model", "pc101", "us", "-print" ] xkbcomp_command = ["xkbcomp", "-", os.environ.get("DISPLAY", ":0")] xkbcomp = subprocess.Popen(xkbcomp_command, stdin=subprocess.PIPE) subprocess.Popen(setxkbmap_command, env=os.environ, stdout=xkbcomp.stdin).communicate() xkbcomp.communicate() if system_config.get("aco"): env["RADV_PERFTEST"] = "aco" pulse_latency = system_config.get("pulse_latency") if pulse_latency: env["PULSE_LATENCY_MSEC"] = "60" vk_icd = system_config.get("vk_icd") if vk_icd and vk_icd != "off" and system.path_exists(vk_icd): env["VK_ICD_FILENAMES"] = vk_icd fps_limit = system_config.get("fps_limit") or "" if fps_limit: strangle_cmd = system.find_executable("strangle") if strangle_cmd: launch_arguments = [strangle_cmd, fps_limit] + launch_arguments else: logger.warning( "libstrangle is not available on this system, FPS limiter disabled" ) prefix_command = system_config.get("prefix_command") or "" if prefix_command: launch_arguments = ( shlex.split(os.path.expandvars(prefix_command)) + launch_arguments) single_cpu = system_config.get("single_cpu") or False if single_cpu: logger.info("The game will run on a single CPU core") launch_arguments.insert(0, "0") launch_arguments.insert(0, "-c") launch_arguments.insert(0, "taskset") terminal = system_config.get("terminal") if terminal: terminal = system_config.get("terminal_app", system.get_default_terminal()) if terminal and not system.find_executable(terminal): dialogs.ErrorDialog( _("The selected terminal application could not be launched:\n%s" ) % terminal) self.state = self.STATE_STOPPED self.emit("game-stop") return # Env vars game_env = gameplay_info.get("env") or self.runner.get_env() env.update(game_env) env["game_name"] = self.name # Prime vars prime = system_config.get("prime") if prime: env["__NV_PRIME_RENDER_OFFLOAD"] = "1" env["__GLX_VENDOR_LIBRARY_NAME"] = "nvidia" env["__VK_LAYER_NV_optimus"] = "NVIDIA_only" # LD_PRELOAD ld_preload = gameplay_info.get("ld_preload") if ld_preload: env["LD_PRELOAD"] = ld_preload # Feral gamemode gamemode = system_config.get( "gamemode") and LINUX_SYSTEM.gamemode_available() if gamemode: if system.find_executable("gamemoderun"): launch_arguments.insert(0, "gamemoderun") else: env["LD_PRELOAD"] = ":".join([ path for path in [ env.get("LD_PRELOAD"), "libgamemodeauto.so", ] if path ]) # LD_LIBRARY_PATH game_ld_libary_path = gameplay_info.get("ld_library_path") if game_ld_libary_path: ld_library_path = env.get("LD_LIBRARY_PATH") if not ld_library_path: ld_library_path = "$LD_LIBRARY_PATH" env["LD_LIBRARY_PATH"] = ":".join( [game_ld_libary_path, ld_library_path]) include_processes = shlex.split( system_config.get("include_processes", "")) exclude_processes = shlex.split( system_config.get("exclude_processes", "")) self.game_runtime_config = { "args": launch_arguments, "env": env, "terminal": terminal, "include_processes": include_processes, "exclude_processes": exclude_processes, } if system_config.get("disable_compositor"): self.set_desktop_compositing(False) prelaunch_command = system_config.get("prelaunch_command") if prelaunch_command: command_array = shlex.split(prelaunch_command) if system.path_exists(command_array[0]): self.prelaunch_executor = MonitoredCommand( command_array, include_processes=[os.path.basename(command_array[0])], env=self.game_runtime_config["env"], cwd=self.directory, ) self.prelaunch_executor.start() logger.info("Running %s in the background", prelaunch_command) if system_config.get("prelaunch_wait"): self.heartbeat = GLib.timeout_add(HEARTBEAT_DELAY, self.prelaunch_beat) else: self.start_game()
def get_launch_parameters(runner, gameplay_info): system_config = runner.system_config launch_arguments = gameplay_info["command"] env = {"DISABLE_LAYER_AMD_SWITCHABLE_GRAPHICS_1": "1"} # Steam compatibility if os.environ.get("SteamAppId"): logger.info("Game launched from steam (AppId: %s)", os.environ["SteamAppId"]) env["LC_ALL"] = "" # Optimus optimus = system_config.get("optimus") if optimus == "primusrun" and system.find_executable("primusrun"): launch_arguments.insert(0, "primusrun") elif optimus == "optirun" and system.find_executable("optirun"): launch_arguments.insert(0, "virtualgl") launch_arguments.insert(0, "-b") launch_arguments.insert(0, "optirun") elif optimus == "pvkrun" and system.find_executable("pvkrun"): launch_arguments.insert(0, "pvkrun") mango_args, mango_env = get_mangohud_conf(system_config) if mango_args: launch_arguments = mango_args + launch_arguments env.update(mango_env) # Libstrangle fps_limit = system_config.get("fps_limit") or "" if fps_limit: strangle_cmd = system.find_executable("strangle") if strangle_cmd: launch_arguments = [strangle_cmd, fps_limit] + launch_arguments else: logger.warning( "libstrangle is not available on this system, FPS limiter disabled" ) prefix_command = system_config.get("prefix_command") or "" if prefix_command: launch_arguments = (shlex.split(os.path.expandvars(prefix_command)) + launch_arguments) single_cpu = system_config.get("single_cpu") or False if single_cpu: logger.info("The game will run on a single CPU core") launch_arguments.insert(0, "0") launch_arguments.insert(0, "-c") launch_arguments.insert(0, "taskset") env.update(runner.get_env()) env.update(gameplay_info.get("env") or {}) # Set environment variables dependent on gameplay info # LD_PRELOAD ld_preload = gameplay_info.get("ld_preload") if ld_preload: env["LD_PRELOAD"] = ld_preload # LD_LIBRARY_PATH game_ld_library_path = gameplay_info.get("ld_library_path") if game_ld_library_path: ld_library_path = env.get("LD_LIBRARY_PATH") env["LD_LIBRARY_PATH"] = os.pathsep.join( filter(None, [game_ld_library_path, ld_library_path])) # Feral gamemode gamemode = system_config.get( "gamemode") and LINUX_SYSTEM.gamemode_available() if gamemode: launch_arguments.insert(0, "gamemoderun") # Gamescope gamescope = system_config.get("gamescope") and system.find_executable( "gamescope") if gamescope: launch_arguments = get_gamescope_args(launch_arguments, system_config) return launch_arguments, env
def prelaunch(self): if not LINUX_SYSTEM.get_soundfonts(): logger.warning( "FluidSynth is not installed, you might not have any music") return True
def get_launch_parameters(self, gameplay_info): system_config = self.runner.system_config launch_arguments = gameplay_info["command"] optimus = system_config.get("optimus") if optimus == "primusrun" and system.find_executable("primusrun"): launch_arguments.insert(0, "primusrun") elif optimus == "optirun" and system.find_executable("optirun"): launch_arguments.insert(0, "virtualgl") launch_arguments.insert(0, "-b") launch_arguments.insert(0, "optirun") elif optimus == "pvkrun" and system.find_executable("pvkrun"): launch_arguments.insert(0, "pvkrun") # Mangohud activation mangohud = system_config.get("mangohud") or "" if mangohud and system.find_executable("mangohud"): # This is probably not the way to go. This only work with a few # Wine games. It will probably crash it, or do nothing at all. # I have never got mangohud to work on anything other than a Wine # game. dialogs.NoticeDialog("MangoHud support is experimental. Expect the " "game to crash or the framerate counter not to " "appear at all.") launch_arguments = ["mangohud"] + launch_arguments fps_limit = system_config.get("fps_limit") or "" if fps_limit: strangle_cmd = system.find_executable("strangle") if strangle_cmd: launch_arguments = [strangle_cmd, fps_limit] + launch_arguments else: logger.warning("libstrangle is not available on this system, FPS limiter disabled") prefix_command = system_config.get("prefix_command") or "" if prefix_command: launch_arguments = (shlex.split(os.path.expandvars(prefix_command)) + launch_arguments) single_cpu = system_config.get("single_cpu") or False if single_cpu: logger.info("The game will run on a single CPU core") launch_arguments.insert(0, "0") launch_arguments.insert(0, "-c") launch_arguments.insert(0, "taskset") env = {} env.update(self.runner.get_env()) env.update(gameplay_info.get("env") or {}) env["game_name"] = self.name # Set environment variables dependent on gameplay info # LD_PRELOAD ld_preload = gameplay_info.get("ld_preload") if ld_preload: env["LD_PRELOAD"] = ld_preload # LD_LIBRARY_PATH game_ld_libary_path = gameplay_info.get("ld_library_path") if game_ld_libary_path: ld_library_path = env.get("LD_LIBRARY_PATH") if not ld_library_path: ld_library_path = "$LD_LIBRARY_PATH" env["LD_LIBRARY_PATH"] = ":".join([game_ld_libary_path, ld_library_path]) # Feral gamemode gamemode = system_config.get("gamemode") and LINUX_SYSTEM.gamemode_available() if gamemode: if system.find_executable("gamemoderun"): launch_arguments.insert(0, "gamemoderun") else: env["LD_PRELOAD"] = ":".join([path for path in [ env.get("LD_PRELOAD"), "libgamemodeauto.so", ] if path]) return launch_arguments, env