Added fallbacks for fsync issues on CachyOS.
This commit is contained in:
@@ -7,6 +7,7 @@ from datetime import datetime
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
import platform
|
||||
import shutil
|
||||
import sys
|
||||
from typing import Mapping
|
||||
@@ -25,6 +26,8 @@ WINETRICKS_CODEPAGE_PROBE = (
|
||||
'winetricks_early_wine_arch cmd.exe /c "chcp 65001 > nul & echo %$1%"'
|
||||
)
|
||||
WINETRICKS_PROTON7_PROBE = 'winetricks_early_wine_arch cmd.exe /c "echo %$1%"'
|
||||
RUNTIME_DEFAULT_SYNC = "runtime-default"
|
||||
CACHYOS_MARKER = "cachyos"
|
||||
|
||||
|
||||
class RuntimeErrorPT(RuntimeError):
|
||||
@@ -238,7 +241,11 @@ def run_game(
|
||||
WINDOWS_GAME_EXE,
|
||||
"PTEU_REBORN",
|
||||
]
|
||||
environment = _proton_environment(paths, selection)
|
||||
environment = _proton_environment(
|
||||
paths,
|
||||
selection,
|
||||
synchronization=resolve_proton_sync_mode(settings.proton_sync),
|
||||
)
|
||||
if use_gamebox:
|
||||
game_command = build_gamebox_command(game_command, settings)
|
||||
environment["PYTHONPATH"] = _runtime_python_path(
|
||||
@@ -274,10 +281,12 @@ def _umu_environment(paths: AppPaths) -> dict[str, str]:
|
||||
def _proton_environment(
|
||||
paths: AppPaths,
|
||||
selection: RuntimeSelection,
|
||||
*,
|
||||
synchronization: str = RUNTIME_DEFAULT_SYNC,
|
||||
) -> dict[str, str]:
|
||||
if not selection.steam_root:
|
||||
raise RuntimeErrorPT("Steam root is missing for Proton")
|
||||
return {
|
||||
environment = {
|
||||
"STEAM_COMPAT_CLIENT_INSTALL_PATH": selection.steam_root,
|
||||
"STEAM_COMPAT_DATA_PATH": str(paths.compat_data),
|
||||
"STEAM_COMPAT_INSTALL_PATH": str(paths.runtime_view),
|
||||
@@ -288,6 +297,57 @@ def _proton_environment(
|
||||
"PROTON_LOG": "0",
|
||||
"DXVK_STATE_CACHE_PATH": str(paths.dxvk_cache),
|
||||
}
|
||||
environment.update(_proton_sync_environment(synchronization))
|
||||
return environment
|
||||
|
||||
|
||||
def detect_distribution_id() -> str:
|
||||
"""Return the freedesktop distribution ID without invoking distro tools."""
|
||||
|
||||
try:
|
||||
value = platform.freedesktop_os_release().get("ID", "")
|
||||
except OSError:
|
||||
return ""
|
||||
return value.strip().casefold()
|
||||
|
||||
|
||||
def resolve_proton_sync_mode(
|
||||
configured: str,
|
||||
*,
|
||||
distribution_id: str | None = None,
|
||||
kernel_release: str | None = None,
|
||||
) -> str:
|
||||
"""Resolve the configured mode, applying the narrow CachyOS compatibility fallback."""
|
||||
|
||||
if configured not in {"auto", "fsync", "esync"}:
|
||||
raise ValueError(f"unsupported Proton synchronization mode: {configured}")
|
||||
if configured != "auto":
|
||||
return configured
|
||||
distribution = detect_distribution_id() if distribution_id is None else distribution_id
|
||||
kernel = platform.release() if kernel_release is None else kernel_release
|
||||
if CACHYOS_MARKER in distribution.casefold() or CACHYOS_MARKER in kernel.casefold():
|
||||
return "esync"
|
||||
return RUNTIME_DEFAULT_SYNC
|
||||
|
||||
|
||||
def _proton_sync_environment(synchronization: str) -> dict[str, str]:
|
||||
if synchronization == RUNTIME_DEFAULT_SYNC:
|
||||
return {}
|
||||
if synchronization == "esync":
|
||||
return {
|
||||
"PROTON_NO_FSYNC": "1",
|
||||
"WINEFSYNC": "0",
|
||||
"PROTON_NO_ESYNC": "0",
|
||||
"WINEESYNC": "1",
|
||||
}
|
||||
if synchronization == "fsync":
|
||||
return {
|
||||
"PROTON_NO_FSYNC": "0",
|
||||
"WINEFSYNC": "1",
|
||||
"PROTON_NO_ESYNC": "0",
|
||||
"WINEESYNC": "1",
|
||||
}
|
||||
raise ValueError(f"unsupported resolved Proton synchronization mode: {synchronization}")
|
||||
|
||||
|
||||
def _ensure_proton_game_link(paths: AppPaths) -> None:
|
||||
|
||||
Reference in New Issue
Block a user