Added umu download and repair for missing components on install, update and manual repair.

This commit is contained in:
2026-09-02 21:42:49 +02:00
parent 6f20b5e359
commit 7ce6ac3dd7
9 changed files with 660 additions and 40 deletions

View File

@@ -20,6 +20,7 @@ from .depot import DEFAULT_DEPOT_START_OPTION, DepotStartOption
from .gamebox import build_gamebox_command
from .paths import AppPaths
from .settings import Settings
from .umu import find_umu_launcher
WINDOWS_GAME_DIRECTORY = r"C:\Program Files (x86)\Pristontale EU"
@@ -61,11 +62,12 @@ def select_runtime(
settings: Settings,
environment: Mapping[str, str] | None = None,
*,
paths: AppPaths | None = None,
distribution_id: str | None = None,
kernel_release: str | None = None,
) -> RuntimeSelection:
env = os.environ if environment is None else environment
umu = shutil.which("umu-run", path=env.get("PATH"))
umu = find_umu_launcher(paths, env)
current_umu_host = prefers_current_umu_host(
distribution_id=distribution_id,
kernel_release=kernel_release,
@@ -257,7 +259,7 @@ def prepare_game_runtime(
paths.create_base_directories()
results: list[CommandOutcome] = []
if selection.kind == "umu":
environment = _umu_environment(paths)
environment = _umu_environment(paths, selection)
if not native_d3d_ready(paths.umu_prefix):
results.append(
runner.run(
@@ -398,7 +400,7 @@ def run_game(
native_executable,
*game_arguments,
]
environment = _umu_environment(paths)
environment = _umu_environment(paths, selection)
elif selection.kind == "proton7-container":
if not selection.proton_path:
raise RuntimeErrorPT("Proton script path is missing")
@@ -550,7 +552,7 @@ def run_runtime_prefix_command(
raise ValueError("runtime-prefix command arguments cannot be empty")
if selection.kind == "umu":
command = [selection.executable, *arguments]
environment = _umu_environment(paths)
environment = _umu_environment(paths, selection)
elif selection.kind == "proton7-container":
if not selection.proton_path or not selection.steam_root:
raise RuntimeErrorPT("incomplete Proton 7 runtime selection")
@@ -586,14 +588,19 @@ def _runtime_python_path(existing: str | None) -> str:
return os.pathsep.join((package_root, existing))
def _umu_environment(paths: AppPaths) -> dict[str, str]:
return {
def _umu_environment(
paths: AppPaths,
selection: RuntimeSelection,
) -> dict[str, str]:
environment = {
"WINEPREFIX": str(paths.umu_prefix),
"GAMEID": "umu-pristontale-eu",
"STORE": "none",
"DXVK_STATE_CACHE_PATH": str(paths.dxvk_cache),
"WINEDEBUG": "-all",
}
environment.update(_portable_umu_environment(paths, selection))
return environment
def _umu_proton7_environment(
@@ -619,10 +626,26 @@ def _umu_proton7_environment(
"DXVK_STATE_CACHE_PATH": str(paths.dxvk_cache),
"WINEDEBUG": "-all",
}
environment.update(_portable_umu_environment(paths, selection))
environment.update(_proton_sync_environment(synchronization))
return environment
def _portable_umu_environment(
paths: AppPaths,
selection: RuntimeSelection,
) -> dict[str, str]:
"""Keep downloads made by our zipapp inside the selected installation."""
try:
selected = Path(selection.executable).expanduser().resolve()
except (OSError, RuntimeError):
return {}
if selected != paths.managed_umu_executable.resolve():
return {}
return {"UMU_FOLDERS_PATH": str(paths.runtime_tools)}
def _proton_environment(
paths: AppPaths,
selection: RuntimeSelection,