Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 25 additions & 21 deletions rare/commands/launcher/lgd_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ def get_game_params(rgame: RareGameSlim, init: InitParams, launch: LaunchParams)

full_params = []
full_params.extend(params.launch_command)
if "LEGENDARY_WRAPPER_EXE" in params.environment:
lgd_wrapper = params.environment.pop("LEGENDARY_WRAPPER_EXE").strip()
if os.path.isfile(lgd_wrapper):
full_params.append(lgd_wrapper)
full_params.append(os.path.join(params.game_directory, params.game_executable))
full_params.extend(params.game_parameters)
full_params.extend(params.egl_parameters)
Expand Down Expand Up @@ -154,38 +158,38 @@ def get_launch_params(rgame: RareGameSlim, init: InitParams = None) -> LaunchPar
def prepare_process(command: List[str], environment: Dict) -> Tuple[str, List[str], Dict]:
logger.debug("Preparing process: %s", command)

environ = environment.copy()
_env = environment.copy()
# Sanity check environment (mostly for Linux)
# ensure shader compat dirs exist
if platform.system() in {"Linux", "FreeBSD"}:
command_line = shlex.join(command)
if os.environ.get("XDG_CURRENT_DESKTOP", None) == "gamescope" or "gamescope" in command_line:
_cmd_line = shlex.join(command)
if os.environ.get("XDG_CURRENT_DESKTOP", None) == "gamescope" or "gamescope" in _cmd_line:
# disable mangohud in gamescope
environ["MANGOHUD"] = "0"
if "STEAM_COMPAT_CLIENT_INSTALL_PATH" not in environ:
environ["STEAM_COMPAT_CLIENT_INSTALL_PATH"] = ""
if "STEAM_COMPAT_DATA_PATH" in environ:
compat_pfx = os.path.join(environ["STEAM_COMPAT_DATA_PATH"], "pfx")
_env["MANGOHUD"] = "0"
if "STEAM_COMPAT_CLIENT_INSTALL_PATH" not in _env:
_env["STEAM_COMPAT_CLIENT_INSTALL_PATH"] = ""
if "STEAM_COMPAT_DATA_PATH" in _env:
compat_pfx = os.path.join(_env["STEAM_COMPAT_DATA_PATH"], "pfx")
os.makedirs(compat_pfx, exist_ok=True)
create_compat_users(compat_pfx)
if "WINEPREFIX" in environ and not os.path.isdir(environ["WINEPREFIX"]):
os.makedirs(environ["WINEPREFIX"], exist_ok=True)
create_compat_users(environ["WINEPREFIX"])
if "STEAM_COMPAT_SHADER_PATH" in environ:
environ.update(setup_compat_shaders_dir(environ["STEAM_COMPAT_SHADER_PATH"]))
environ["WINEDLLOVERRIDES"] = environ.get("WINEDLLOVERRIDES", "") + ";lsteamclient=d;"
if "WINEPREFIX" in _env and not os.path.isdir(_env["WINEPREFIX"]):
os.makedirs(_env["WINEPREFIX"], exist_ok=True)
create_compat_users(_env["WINEPREFIX"])
if "STEAM_COMPAT_SHADER_PATH" in _env:
_env.update(setup_compat_shaders_dir(_env["STEAM_COMPAT_SHADER_PATH"]))
_env["WINEDLLOVERRIDES"] = _env.get("WINEDLLOVERRIDES", "") + ";lsteamclient=d;"

_env = os.environ.copy()
_command = command.copy()
final_env = os.environ.copy()
final_cmd = command.copy()

if os.environ.get("container") == "flatpak":
flatpak_command = ["flatpak-spawn", "--host"]
flatpak_command.extend(f"--env={name}={value}" for name, value in environ.items())
_command = flatpak_command + command
_flat_cmd = ["flatpak-spawn", "--host"]
_flat_cmd.extend(f"--env={name}={value}" for name, value in _env.items())
final_cmd = _flat_cmd + command
else:
_env.update(environ)
final_env.update(_env)

return _command[0], _command[1:] if len(_command) > 1 else [], _env
return final_cmd[0], final_cmd[1:] if len(final_cmd) > 1 else [], final_env


def dict_to_qprocenv(env: Dict) -> QProcessEnvironment:
Expand Down
1 change: 1 addition & 0 deletions rare/components/tabs/library/details/game.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def __init__(self, rcore: RareCore, parent=None):
save_func=self.__override_exe_save_callback,
parent=self,
)
self.override_exe_edit.line_edit.setReadOnly(False)

self.launch_params_edit = QLineEdit(self)
self.launch_params_edit.setPlaceholderText(self.tr("Game specific command line arguments"))
Expand Down
1 change: 1 addition & 0 deletions rare/components/tabs/settings/widgets/launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def __init__(self, rcore: RareCore, wrapper_widget: Type[WrapperSettings], paren
edit_func=self.__prelaunch_cmd_edit_callback,
save_func=self.__prelaunch_cmd_save_callback,
)
self.prelaunch_cmd.line_edit.setReadOnly(False)

self.prelaunch_args = QLineEdit("")
self.prelaunch_args.setPlaceholderText(self.tr("Arguments to the script or program to run before the game"))
Expand Down
2 changes: 2 additions & 0 deletions rare/components/tabs/settings/widgets/wine.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def __init__(self, settings: RareAppSettings, rcore: RareCore, parent=None):
edit_func=self._wine_prefix_edit,
save_func=self.save_prefix,
)
self.wine_prefix_edit.line_edit.setReadOnly(False)

# Wine executable
self.wine_execut_edit = PathEdit(
Expand All @@ -47,6 +48,7 @@ def __init__(self, settings: RareAppSettings, rcore: RareCore, parent=None):
),
save_func=self.save_execut,
)
self.wine_execut_edit.line_edit.setReadOnly(False)

layout = QFormLayout(self)
layout.addRow(self.tr("Executable"), self.wine_execut_edit)
Expand Down