mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-18 20:36:04 +00:00
Merge remote-tracking branch 'droiddeck/main' into HEAD
# Conflicts: # tools/linuxfs/overlay/usr/local/bin/droiddeck-fex # tools/tests/test_droiddeck_fex.py
This commit is contained in:
commit
b36e5425d7
227 files changed
+12088
-1987
No files matched your search
@@ -5,6 +5,7 @@ import json
|
||||
import math
|
||||
import os
|
||||
import re
|
||||
import runpy
|
||||
import shutil
|
||||
import signal
|
||||
import subprocess
|
||||
@@ -16,6 +17,7 @@ import urllib.request
|
||||
HOME = os.environ.get("HOME") or "/root"
|
||||
BIN = "/usr/local/bin"
|
||||
PROTON_RUN = os.path.join(BIN, "droiddeck-proton-run")
|
||||
GAME_DEBUG = runpy.run_path(os.path.join(os.path.dirname(os.path.abspath(__file__)), "droiddeck-game-debug"))
|
||||
APP_ID = "2596113170"
|
||||
INSTALLER_URL = "https://downloader.battle.net/download/getInstallerForGame?os=win&gameProgram=BATTLENET_APP&version=Live"
|
||||
CLIENT_DIR = ("Program Files (x86)", "Battle.net")
|
||||
@@ -685,6 +687,7 @@ def steam_running(proc="/proc"):
|
||||
|
||||
def proton_env():
|
||||
env = dict(os.environ)
|
||||
env = GAME_DEBUG["apply_game_debug_logs"](env)
|
||||
if not steam_running():
|
||||
env.setdefault("PROTON_SPOOF_STEAMINPUT_VIDPID", "1")
|
||||
return env
|
||||
|
||||
@@ -24,6 +24,7 @@ import urllib.request
|
||||
HOME = os.environ.get("HOME") or "/root"
|
||||
SELF = os.path.abspath(__file__)
|
||||
BIN_DIR = os.path.dirname(SELF)
|
||||
GAME_DEBUG = runpy.run_path(os.path.join(BIN_DIR, "droiddeck-game-debug"))
|
||||
STATE = os.path.join(HOME, ".local", "share", "droiddeck-epic")
|
||||
CURRENT = os.path.join(STATE, "current.json")
|
||||
APPS = os.path.join(STATE, "app")
|
||||
@@ -1196,6 +1197,7 @@ def run_game(request, session_env, running=None):
|
||||
exe = native_path(request.get("exe") or "")
|
||||
args = request.get("args") or []
|
||||
env = {k: v for k, v in session_env.items() if not k.startswith(("FEX_", "DROIDDECK_EPIC", "EGL_", "WEBKIT_"))}
|
||||
env = GAME_DEBUG["apply_game_debug_logs"](env)
|
||||
preload = env.pop(STEAM_PRELOAD, "")
|
||||
if preload:
|
||||
env["LD_PRELOAD"] = preload
|
||||
|
||||
@@ -8,6 +8,7 @@ import os
|
||||
import re
|
||||
import runpy
|
||||
import shutil
|
||||
import stat
|
||||
import struct
|
||||
import subprocess
|
||||
import sys
|
||||
@@ -37,7 +38,9 @@ RUNTIMES = {SNIPER_APPID: ("sniper_platform_", "Steam Linux Runtime 3.0 (sniper"
|
||||
SLR4_APPID: ("steamrt4_platform_", "Steam Linux Runtime 4.0 (steamrt4")}
|
||||
MARKER = ".droiddeck-fex"
|
||||
LAYOUT = 1
|
||||
ROOTFS_LAYOUT = 9
|
||||
ROOTFS_LAYOUT = 10
|
||||
BLOB_DIRS = re.compile(r"^(?:\.ref|[0-9a-f]{2})$")
|
||||
ROOTFS_LIBRARY_DIRS = ("lib", "lib64")
|
||||
ARCH_DIRS = ("x86_64-linux-gnu", "i386-linux-gnu")
|
||||
INTERPRETERS = ("ld-linux-x86-64.so.2", "ld-linux.so.2")
|
||||
PROVIDED = frozenset((
|
||||
@@ -318,11 +321,40 @@ def provides_newer(base, provider):
|
||||
return True
|
||||
|
||||
|
||||
def mirror(source, provider, name, target):
|
||||
def clone(source, target, parents=()):
|
||||
real = os.path.realpath(source)
|
||||
if real in parents or not os.path.lexists(real):
|
||||
return
|
||||
if os.path.isdir(real):
|
||||
os.makedirs(target, exist_ok=True)
|
||||
for entry in os.listdir(real):
|
||||
clone(os.path.join(real, entry), os.path.join(target, entry), parents + (real,))
|
||||
shutil.copystat(real, target)
|
||||
return
|
||||
shutil.copy2(real, target)
|
||||
|
||||
|
||||
def remove_tree(path):
|
||||
if os.path.islink(path) or not os.path.isdir(path):
|
||||
with contextlib.suppress(FileNotFoundError):
|
||||
os.unlink(path)
|
||||
return
|
||||
os.chmod(path, os.lstat(path).st_mode | stat.S_IRWXU)
|
||||
for entry in os.listdir(path):
|
||||
remove_tree(os.path.join(path, entry))
|
||||
os.rmdir(path)
|
||||
|
||||
|
||||
def stays_in_libraries(root, target, link):
|
||||
resolved = os.path.normpath(os.path.join(os.path.relpath(target, root), link))
|
||||
return resolved.split(os.sep)[0] in ROOTFS_LIBRARY_DIRS
|
||||
|
||||
|
||||
def mirror(source, provider, name, target, root):
|
||||
usable_provider = provider and all(os.path.exists(os.path.join(provider, needed))
|
||||
for needed in (name,) + PROVIDED_NEEDS.get(name, ()))
|
||||
if name in PROVIDED and usable_provider:
|
||||
os.symlink(os.path.realpath(os.path.join(provider, name)), os.path.join(target, name))
|
||||
clone(os.path.join(provider, name), os.path.join(target, name))
|
||||
return
|
||||
path = os.path.join(source, name)
|
||||
if not os.path.lexists(path):
|
||||
@@ -334,10 +366,10 @@ def mirror(source, provider, name, target):
|
||||
link = os.path.join(os.path.dirname(link), name)
|
||||
if provider and GLIBC_BUILD.match(name):
|
||||
return
|
||||
if link and not link.startswith("/"):
|
||||
if link and not link.startswith("/") and stays_in_libraries(root, target, link):
|
||||
os.symlink(link, os.path.join(target, name))
|
||||
else:
|
||||
os.symlink(os.path.realpath(path), os.path.join(target, name))
|
||||
clone(path, os.path.join(target, name))
|
||||
|
||||
|
||||
def build_rootfs(base, provider):
|
||||
@@ -359,12 +391,12 @@ def build_rootfs(base, provider):
|
||||
return False
|
||||
for entry in os.listdir(STATE):
|
||||
if entry.startswith("rootfs."):
|
||||
shutil.rmtree(os.path.join(STATE, entry), ignore_errors=True)
|
||||
remove_tree(os.path.join(STATE, entry))
|
||||
tmp = "%s.%d.tmp" % (rootfs, os.getpid())
|
||||
os.makedirs(tmp)
|
||||
for entry in os.listdir(base_files):
|
||||
if entry not in ("lib", "lib64", "usr", MARKER):
|
||||
os.symlink(os.path.realpath(os.path.join(base_files, entry)), os.path.join(tmp, entry))
|
||||
if entry not in ("lib", "lib64", "usr", MARKER) and not BLOB_DIRS.match(entry):
|
||||
clone(os.path.join(base_files, entry), os.path.join(tmp, entry))
|
||||
os.symlink(".", os.path.join(tmp, "usr"))
|
||||
for top in ("lib", "lib64"):
|
||||
source = os.path.join(base_files, top)
|
||||
@@ -375,15 +407,15 @@ def build_rootfs(base, provider):
|
||||
provided = os.path.join(provider_files, top, entry)
|
||||
os.makedirs(os.path.join(tmp, top, entry))
|
||||
for name in set(os.listdir(path)) | {name for name in PROVIDED if os.path.exists(os.path.join(provided, name))}:
|
||||
mirror(path, provided, name, os.path.join(tmp, top, entry))
|
||||
mirror(path, provided, name, os.path.join(tmp, top, entry), tmp)
|
||||
else:
|
||||
mirror(source, None, entry, os.path.join(tmp, top))
|
||||
mirror(source, None, entry, os.path.join(tmp, top), tmp)
|
||||
write_if_changed(os.path.join(tmp, MARKER), stamp)
|
||||
old = "%s.%d.old" % (rootfs, os.getpid())
|
||||
if os.path.lexists(rootfs):
|
||||
os.rename(rootfs, old)
|
||||
os.rename(tmp, rootfs)
|
||||
shutil.rmtree(old, ignore_errors=True)
|
||||
remove_tree(old)
|
||||
return True
|
||||
|
||||
|
||||
@@ -463,7 +495,7 @@ def link_guest_sdk(root):
|
||||
continue
|
||||
os.makedirs(os.path.dirname(link), exist_ok=True)
|
||||
if os.path.lexists(link):
|
||||
os.unlink(link)
|
||||
remove_tree(link)
|
||||
os.symlink(directory, link)
|
||||
|
||||
|
||||
@@ -535,8 +567,6 @@ def prepare(app=SNIPER_APPID):
|
||||
root = os.path.join(platform, "files")
|
||||
if materialize(platform):
|
||||
say("prepared %s as the x86 runtime" % os.path.basename(platform))
|
||||
install_preloads(root)
|
||||
install_fonts(root)
|
||||
provider = None
|
||||
if app == SNIPER_APPID:
|
||||
provider = graphics_platform()
|
||||
@@ -553,6 +583,8 @@ def prepare(app=SNIPER_APPID):
|
||||
say("built the x86 runtime from %s with the C and C++ libraries of %s"
|
||||
% (os.path.basename(platform), os.path.basename(provider)))
|
||||
root = os.path.join(STATE, "rootfs")
|
||||
install_preloads(root)
|
||||
install_fonts(root)
|
||||
with contextlib.suppress(OSError):
|
||||
link_guest_sdk(root)
|
||||
write_config(fex, root)
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
#!/usr/bin/python3
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
GAME_DEBUG_CHANNELS = (
|
||||
"timestamp", "pid", "tid", "seh", "unwind", "threadname", "debugstr", "loaddll", "mscoree",
|
||||
)
|
||||
WINE_DEBUG_SELECTOR = re.compile(r"(?:(trace|warn|err|fixme))?([+-])([A-Za-z_][A-Za-z0-9_]*)")
|
||||
|
||||
|
||||
def game_debug_channels(*values):
|
||||
selectors = {}
|
||||
for value in values:
|
||||
if not isinstance(value, str) or "\0" in value or len(value) > 8192:
|
||||
continue
|
||||
for part in value.split(","):
|
||||
part = part.strip()
|
||||
match = WINE_DEBUG_SELECTOR.fullmatch(part)
|
||||
if match is None:
|
||||
continue
|
||||
key = (match[1] or "", match[3])
|
||||
selectors.pop(key, None)
|
||||
selectors[key] = part
|
||||
for channel in GAME_DEBUG_CHANNELS:
|
||||
key = ("", channel)
|
||||
selectors.pop(key, None)
|
||||
selectors[key] = "+" + channel
|
||||
formatted = ",".join(selectors.values())
|
||||
if len(formatted) > 8192:
|
||||
formatted = ",".join("+" + channel for channel in GAME_DEBUG_CHANNELS)
|
||||
return formatted
|
||||
|
||||
|
||||
def load_config():
|
||||
try:
|
||||
path = Path(os.environ.get("HOME") or "/root") / ".config/droiddeck/game-environment.json"
|
||||
with path.open(encoding="utf-8") as source:
|
||||
return json.load(source)
|
||||
except (OSError, ValueError):
|
||||
return None
|
||||
|
||||
|
||||
def session_debug_dir(env):
|
||||
return env.get("BL_DEBUG_DIR", "")
|
||||
|
||||
|
||||
def apply_game_debug_logs(env, config=None, debug_dir=None):
|
||||
if config is None:
|
||||
config = load_config()
|
||||
if not isinstance(config, dict) or config.get("version") != 1 or config.get("gameDebugLogs") is not True:
|
||||
return env
|
||||
if debug_dir is None:
|
||||
debug_dir = session_debug_dir(env)
|
||||
if (not isinstance(debug_dir, str) or "\0" in debug_dir or len(debug_dir) > 8192
|
||||
or not os.path.isabs(debug_dir) or not os.path.isdir(debug_dir)):
|
||||
print("droiddeck-game-env: game debug logs skipped; session log directory unavailable", file=sys.stderr)
|
||||
return env
|
||||
result = dict(env)
|
||||
result.update({
|
||||
"PROTON_LOG": "1",
|
||||
"PROTON_LOG_DIR": debug_dir,
|
||||
"PROTON_CRASH_REPORT_DIR": debug_dir,
|
||||
"DXVK_LOG_PATH": debug_dir,
|
||||
"DXVK_LOG_LEVEL": "debug",
|
||||
"VKD3D_DEBUG": "info",
|
||||
"WINEDEBUG": game_debug_channels(env.get("WINEDEBUG"), env.get("PROTON_LOG")),
|
||||
})
|
||||
return result
|
||||
@@ -17,6 +17,10 @@ D3D9_DEFAULT_MEMORY_MB = 4096
|
||||
SYNC_KEYS = ("BL_SYNC", "BL_SYNC_FALLBACK", "BL_FSYNC_FIRST", "BL_SYNC_MIN_NOFILE", "PROTON_NO_ESYNC", "PROTON_NO_FSYNC", "PROTON_NO_NTSYNC", "WINEESYNC")
|
||||
SEED_REDISTS = "/usr/local/bin/droiddeck-seed-redists"
|
||||
PACK_KEYS = ("WINESERVER", "BL_SYNC_PACK", "WINEESYNC", "PROTON_NO_ESYNC", "PROTON_NO_FSYNC")
|
||||
GAME_DEBUG = runpy.run_path(str(Path(__file__).with_name("droiddeck-game-debug")))
|
||||
game_debug_channels = GAME_DEBUG["game_debug_channels"]
|
||||
apply_game_debug_logs = GAME_DEBUG["apply_game_debug_logs"]
|
||||
session_debug_dir = GAME_DEBUG["session_debug_dir"]
|
||||
|
||||
|
||||
# Prefixes several games share; the game itself is the Steam app being launched.
|
||||
@@ -124,7 +128,8 @@ def godot_vulkan(game):
|
||||
@fix
|
||||
def godot_sentry(game):
|
||||
sentry = sorted(n[:-4] for n in game.files if n.startswith("libsentry.windows.") and n.endswith(".dll"))
|
||||
if is_godot(game) and sentry and ("coreclr.dll" in game.files or "godotsharp.dll" in game.files):
|
||||
# Sentry.Godot.dll's module initializer P/Invokes the native DLL; without it GodotPlugins fails to start.
|
||||
if is_godot(game) and sentry and ("coreclr.dll" in game.files or "godotsharp.dll" in game.files) and "sentry.godot.dll" not in game.files:
|
||||
return {"WINEDLLOVERRIDES": ";".join(n + "=d" for n in sentry)}, [], "Godot: Sentry crash handler off"
|
||||
|
||||
|
||||
@@ -188,6 +193,21 @@ def little_nightmares_threads(game):
|
||||
return {"PROTONFIXES_DISABLE": "1"}, [], "Little Nightmares: umu-protonfixes off (its -onethread puts the game and renderer on one thread)"
|
||||
|
||||
|
||||
def names_module(overrides, names):
|
||||
for entry in (overrides or "").split(";"):
|
||||
if "=" in entry and names & {re.sub(r"^\*|\.dll$", "", name.lower()) for name in re.split(r"[, \t]", entry.split("=", 1)[0])}:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def keyboard_helper_off(env):
|
||||
if env.get("SteamDeck") == "1" or names_module(env.get("WINEDLLOVERRIDES"), {"tabtip.exe"}):
|
||||
return None
|
||||
own = env.get("WINEDLLOVERRIDES")
|
||||
env["WINEDLLOVERRIDES"] = own + ";tabtip.exe=d" if own else "tabtip.exe=d"
|
||||
return "tabtip.exe off (it only opens Steam's keyboard with SteamDeck=1, and its UI Automation calls crash games)"
|
||||
|
||||
|
||||
def skip_red_launcher(command):
|
||||
if len(command) > 2 and os.path.basename(command[2]).lower() == "redprelauncher.exe":
|
||||
game = os.path.join(os.path.dirname(command[2]), "bin", "x64", "Cyberpunk2077.exe")
|
||||
@@ -361,6 +381,36 @@ def engine_fixes(exe, args):
|
||||
return env, extra, notes
|
||||
|
||||
|
||||
DS_APP_IDS = {"1190460", "1850570"}
|
||||
DS_SIZE = 86479872
|
||||
DS_WINDOW_OFFSET = 0x38FE190
|
||||
DS_WINDOW = bytes.fromhex("48895c240848896c2410488974241848897c242041564883ec70458bf1498bf0488bfa488be94885c9")
|
||||
DS_ORIGINAL = bytes.fromhex("0f85a5000000")
|
||||
DS_FIXED = bytes.fromhex("e9a600000090")
|
||||
|
||||
|
||||
def death_stranding_allocator(app_id, exe):
|
||||
# The game's bundled mimalloc tries one random address between 4 and 8 TiB and never falls back,
|
||||
# but a 39-bit kernel cannot map anything above 512 GiB. Jumping straight to its aligned path avoids it.
|
||||
if app_id not in DS_APP_IDS or os.path.basename(exe).lower() != "ds.exe":
|
||||
return False
|
||||
try:
|
||||
with open(exe, "r+b") as game:
|
||||
if os.fstat(game.fileno()).st_size != DS_SIZE:
|
||||
return False
|
||||
game.seek(DS_WINDOW_OFFSET)
|
||||
seen = game.read(len(DS_WINDOW) + len(DS_ORIGINAL))
|
||||
if seen[:len(DS_WINDOW)] != DS_WINDOW or seen[len(DS_WINDOW):] != DS_ORIGINAL:
|
||||
return False
|
||||
game.seek(DS_WINDOW_OFFSET + len(DS_WINDOW))
|
||||
game.write(DS_FIXED)
|
||||
except OSError as error:
|
||||
print("droiddeck-game-env: Death Stranding allocator fix not applied (%s)" % error, file=sys.stderr)
|
||||
return False
|
||||
print("droiddeck-game-env: Death Stranding: memory allocator no longer needs a high address (39-bit kernels)", file=sys.stderr)
|
||||
return True
|
||||
|
||||
|
||||
def win_components(compat, app_id, proton=None, env=None):
|
||||
if not compat:
|
||||
return ""
|
||||
@@ -550,7 +600,16 @@ def apply_config(env, config, app_id, fixes=None):
|
||||
if name == "WINEDLLOVERRIDES" and entries.get(name, env.get(name)):
|
||||
value = entries.get(name, env.get(name)) + ";" + value
|
||||
entries[name] = value
|
||||
entries.update(config.get("games", {}).get(app_id, {}))
|
||||
game = config.get("games", {}).get(app_id, {})
|
||||
fix = (fixes or {}).get("WINEDLLOVERRIDES")
|
||||
if fix and isinstance(game.get("WINEDLLOVERRIDES"), str):
|
||||
own = game["WINEDLLOVERRIDES"]
|
||||
combined = fix + ";" + own if own else fix
|
||||
if len(combined) > 8192:
|
||||
print("droiddeck-game-env: game WINEDLLOVERRIDES too long to add DroidDeck's overrides; using the game value only", file=sys.stderr)
|
||||
combined = own
|
||||
game = dict(game, WINEDLLOVERRIDES=combined)
|
||||
entries.update(game)
|
||||
for name, value in entries.items():
|
||||
if not re.fullmatch(r"[A-Za-z_][A-Za-z0-9_]*", name):
|
||||
raise ValueError("invalid environment name")
|
||||
@@ -615,55 +674,6 @@ def bridge_feature_level(env):
|
||||
return "Mali bridge: VKD3D_FEATURE_LEVEL %s capped at 12_0 (no ray tracing or mesh shaders)" % was
|
||||
|
||||
|
||||
GAME_DEBUG_CHANNELS = (
|
||||
"timestamp", "pid", "tid", "seh", "unwind", "threadname", "debugstr", "loaddll", "mscoree",
|
||||
)
|
||||
WINE_DEBUG_SELECTOR = re.compile(r"(?:(trace|warn|err|fixme))?([+-])([A-Za-z_][A-Za-z0-9_]*)")
|
||||
|
||||
|
||||
def game_debug_channels(*values):
|
||||
selectors = {}
|
||||
for value in values:
|
||||
if not isinstance(value, str) or "\0" in value or len(value) > 8192:
|
||||
continue
|
||||
for part in value.split(","):
|
||||
part = part.strip()
|
||||
match = WINE_DEBUG_SELECTOR.fullmatch(part)
|
||||
if match is None:
|
||||
continue
|
||||
key = (match[1] or "", match[3])
|
||||
selectors.pop(key, None)
|
||||
selectors[key] = part
|
||||
for channel in GAME_DEBUG_CHANNELS:
|
||||
key = ("", channel)
|
||||
selectors.pop(key, None)
|
||||
selectors[key] = "+" + channel
|
||||
formatted = ",".join(selectors.values())
|
||||
if len(formatted) > 8192:
|
||||
formatted = ",".join("+" + channel for channel in GAME_DEBUG_CHANNELS)
|
||||
return formatted
|
||||
|
||||
|
||||
def apply_game_debug_logs(env, config, debug_dir):
|
||||
if not isinstance(config, dict) or config.get("version") != 1 or config.get("gameDebugLogs") is not True:
|
||||
return env
|
||||
if (not isinstance(debug_dir, str) or "\0" in debug_dir or len(debug_dir) > 8192
|
||||
or not os.path.isabs(debug_dir) or not os.path.isdir(debug_dir)):
|
||||
print("droiddeck-game-env: game debug logs skipped; session log directory unavailable", file=sys.stderr)
|
||||
return env
|
||||
result = dict(env)
|
||||
result.update({
|
||||
"PROTON_LOG": "1",
|
||||
"PROTON_LOG_DIR": debug_dir,
|
||||
"PROTON_CRASH_REPORT_DIR": debug_dir,
|
||||
"DXVK_LOG_PATH": debug_dir,
|
||||
"DXVK_LOG_LEVEL": "debug",
|
||||
"VKD3D_DEBUG": "info",
|
||||
"WINEDEBUG": game_debug_channels(env.get("WINEDEBUG"), env.get("PROTON_LOG")),
|
||||
})
|
||||
return result
|
||||
|
||||
|
||||
def sync_config(config, app_id):
|
||||
games = config.get("games", {})
|
||||
return {
|
||||
@@ -897,14 +907,11 @@ PE = runpy.run_path(str(Path(__file__).resolve().parent / "droiddeck-wine-pe"))
|
||||
pe_machine = PE["pe_machine"]
|
||||
|
||||
|
||||
def repair_foreign_system_dlls(prefix, proton, env=None):
|
||||
def prefix_system_dlls(prefix, proton, env=None):
|
||||
dist = Path(proton).parent / "files/lib/wine"
|
||||
windows = Path(prefix) / "pfx/drive_c/windows"
|
||||
machines_by_folder = PE["proton_pe_machines"](proton, env or {})
|
||||
if machines_by_folder is None:
|
||||
return []
|
||||
repaired = []
|
||||
for folder, (libdir, machines) in machines_by_folder.items():
|
||||
for folder, (libdir, machines) in (machines_by_folder or {}).items():
|
||||
builtins = dist / libdir
|
||||
try:
|
||||
builtin_names = {name.lower(): name for name in os.listdir(builtins)}
|
||||
@@ -914,35 +921,83 @@ def repair_foreign_system_dlls(prefix, proton, env=None):
|
||||
names = sorted(os.listdir(windows / folder))
|
||||
except OSError:
|
||||
continue
|
||||
# Both restoration and repair may examine many DLLs. Index the backup
|
||||
# names from this directory listing instead of listing it for each DLL.
|
||||
backups = {}
|
||||
for entry in names:
|
||||
stem, marker, suffix = entry.partition(FOREIGN_SUFFIX)
|
||||
if not marker or not stem.lower().endswith(".dll"):
|
||||
continue
|
||||
if not suffix:
|
||||
serial = 0
|
||||
elif suffix.startswith(".") and suffix[1:].isdigit():
|
||||
serial = int(suffix[1:])
|
||||
else:
|
||||
continue
|
||||
backups.setdefault(stem, []).append((serial, windows / folder / entry))
|
||||
for copies in backups.values():
|
||||
copies.sort()
|
||||
for name in names:
|
||||
path = windows / folder / name
|
||||
builtin_name = builtin_names.get(name.lower())
|
||||
source = builtins / builtin_name if builtin_name else builtins / name
|
||||
if path.is_symlink() or not name.lower().endswith(".dll") or not source.is_file() or not path.is_file():
|
||||
if name.lower().endswith(".dll") and source.is_file():
|
||||
yield folder, name, windows / folder / name, source, machines, builtins, backups.get(name, ())
|
||||
|
||||
|
||||
def newest_foreign_backup(backups):
|
||||
return backups[-1][1] if backups else None
|
||||
|
||||
|
||||
def restore_compatible_system_dlls(prefix, proton, env=None):
|
||||
restored = []
|
||||
for folder, name, path, source, machines, builtins, backups in prefix_system_dlls(prefix, proton, env):
|
||||
if not path.is_symlink() or not path.is_file():
|
||||
continue
|
||||
try:
|
||||
if not os.path.samefile(path, source):
|
||||
continue
|
||||
machine = pe_machine(path)
|
||||
if machine is None or PE["machine_compatible"](path, machines, machine):
|
||||
continue
|
||||
link = windows / folder / (name + ".bl-new")
|
||||
backup = windows / folder / (name + FOREIGN_SUFFIX)
|
||||
serial = 1
|
||||
while os.path.lexists(backup):
|
||||
backup = windows / folder / (name + FOREIGN_SUFFIX + ".%d" % serial)
|
||||
serial += 1
|
||||
except OSError:
|
||||
continue
|
||||
backup = newest_foreign_backup(backups)
|
||||
if backup is None or backup.is_symlink() or not backup.is_file():
|
||||
continue
|
||||
machine = pe_machine(backup)
|
||||
if machine is None or not PE["machine_compatible"](backup, machines, machine, builtins, name):
|
||||
continue
|
||||
try:
|
||||
os.replace(backup, path)
|
||||
except OSError:
|
||||
continue
|
||||
restored.append("%s/%s (machine 0x%x)" % (folder, name, machine))
|
||||
return restored
|
||||
|
||||
|
||||
def repair_foreign_system_dlls(prefix, proton, env=None):
|
||||
repaired = []
|
||||
for folder, name, path, source, machines, builtins, backups in prefix_system_dlls(prefix, proton, env):
|
||||
if path.is_symlink() or not path.is_file():
|
||||
continue
|
||||
machine = pe_machine(path)
|
||||
if machine is None or PE["machine_compatible"](path, machines, machine, builtins):
|
||||
continue
|
||||
link = path.parent / (name + ".bl-new")
|
||||
backup = path.parent / (name + FOREIGN_SUFFIX)
|
||||
if backups:
|
||||
backup = path.parent / (name + FOREIGN_SUFFIX + ".%d" % (backups[-1][0] + 1))
|
||||
try:
|
||||
os.symlink(os.path.relpath(source, path.parent), link)
|
||||
os.replace(path, backup)
|
||||
try:
|
||||
os.symlink(os.path.relpath(source, path.parent), link)
|
||||
os.replace(path, backup)
|
||||
try:
|
||||
os.replace(link, path)
|
||||
except OSError:
|
||||
if not os.path.lexists(path) and os.path.lexists(backup):
|
||||
os.replace(backup, path)
|
||||
raise
|
||||
os.replace(link, path)
|
||||
except OSError:
|
||||
if link.is_symlink():
|
||||
link.unlink()
|
||||
continue
|
||||
repaired.append("%s/%s (machine 0x%x)" % (folder, name, machine))
|
||||
if not os.path.lexists(path) and os.path.lexists(backup):
|
||||
os.replace(backup, path)
|
||||
raise
|
||||
except OSError:
|
||||
if link.is_symlink():
|
||||
link.unlink()
|
||||
continue
|
||||
repaired.append("%s/%s (machine 0x%x)" % (folder, name, machine))
|
||||
return repaired
|
||||
|
||||
|
||||
@@ -1242,7 +1297,7 @@ def main():
|
||||
return 2
|
||||
env = game_gpu(os.environ.copy())
|
||||
mic_enabled = env.get("BL_MIC_ENABLED")
|
||||
debug_dir = env.get("BL_DEBUG_DIR", "")
|
||||
debug_dir = session_debug_dir(env)
|
||||
prefix_path = env.get("STEAM_COMPAT_DATA_PATH", "").rstrip("/")
|
||||
app_id = game_id(env)
|
||||
components = ""
|
||||
@@ -1272,10 +1327,14 @@ def main():
|
||||
components = win_components(prefix_path, app_id, command[0], effective_env)
|
||||
if prefix_path and command:
|
||||
try:
|
||||
restored = restore_compatible_system_dlls(prefix_path, command[0], effective_env)
|
||||
fixed = repair_foreign_system_dlls(prefix_path, command[0], effective_env)
|
||||
except OSError as error:
|
||||
fixed = []
|
||||
restored = fixed = []
|
||||
print("droiddeck-game-env: prefix system DLL check skipped (%s)" % error, file=sys.stderr)
|
||||
if restored:
|
||||
print("droiddeck-game-env: restored system DLLs this Proton's own programs do not load: %s" % ", ".join(restored),
|
||||
file=sys.stderr)
|
||||
if fixed:
|
||||
print("droiddeck-game-env: replaced foreign-architecture system DLLs with this Proton's own: %s" % ", ".join(fixed),
|
||||
file=sys.stderr)
|
||||
@@ -1300,6 +1359,8 @@ def main():
|
||||
fixes = {}
|
||||
if waiting:
|
||||
command = skip_red_launcher(command)
|
||||
if len(command) > 2:
|
||||
death_stranding_allocator(app_id, command[2])
|
||||
ubisoft_overlay_off(env)
|
||||
project_zomboid_jvm(command)
|
||||
fixes, extra, notes = engine_fixes(command[2], command[3:]) if len(command) > 2 else ({}, [], [])
|
||||
@@ -1320,6 +1381,9 @@ def main():
|
||||
if "vblank_mode" in config.get("shared", {}):
|
||||
fixes.pop("vblank_mode", None)
|
||||
env = apply_config(env, launch_config, app_id, fixes)
|
||||
note = keyboard_helper_off(env)
|
||||
if note:
|
||||
print("droiddeck-game-env: " + note, file=sys.stderr)
|
||||
else:
|
||||
path = Path.home() / ".config/droiddeck/game-environment.json"
|
||||
try:
|
||||
|
||||
@@ -972,6 +972,7 @@ case $mode in
|
||||
bl_session_pressure() {
|
||||
bl_memory_read
|
||||
[ "$_bl_game" = 1 ] && bl_memory_critical || return 0
|
||||
[ "${BL_ZRAM_IDLE:-1}" = 1 ] && bl_game_focused 0 || return 0
|
||||
local _wait=$_bl_tier_backoff _before _pids _targets
|
||||
[ "$_bl_available" -ge $((_bl_headroom / 2)) ] || [ "$_bl_tier_pushed" -lt 0 ] || _wait=30
|
||||
[ "$_bl_tier_at" -lt 0 ] || [ $((SECONDS - _bl_tier_at)) -ge "$_wait" ] || return 0
|
||||
@@ -1103,7 +1104,7 @@ case $mode in
|
||||
local id
|
||||
id=$(sed -n 's/.*"focusedApp"[[:space:]]*:[[:space:]]*\([0-9][0-9]*\).*/\1/p' \
|
||||
"$BL_LAUNCH_DIR/agent/focus.json" 2>/dev/null | head -1)
|
||||
[ -n "$id" ] || return 1
|
||||
[ -n "$id" ] || return "${1:-1}"
|
||||
case " ${_bl_apps-} " in
|
||||
*" $id "*) return 0 ;;
|
||||
esac
|
||||
|
||||
@@ -479,13 +479,15 @@ def save_state(compat, state):
|
||||
os.replace(temp, compat / STATE)
|
||||
|
||||
|
||||
def foreign_component(rel, path, machines):
|
||||
def foreign_component(rel, path, machines, dist=None):
|
||||
parts = Path(rel).parts
|
||||
folder = parts[2] if len(parts) > 2 and parts[:2] == ("drive_c", "windows") else None
|
||||
if not machines or folder not in PE_MACHINES or not rel.lower().endswith(".dll"):
|
||||
return False
|
||||
machine = pe_machine(path)
|
||||
return machine is not None and not machine_compatible(path, machines[folder][1], machine)
|
||||
libdir, compatible = machines[folder]
|
||||
builtins = dist / libdir if dist else None
|
||||
return machine is not None and not machine_compatible(path, compatible, machine, builtins)
|
||||
|
||||
|
||||
def pending_for(app_id, pending=PENDING):
|
||||
@@ -546,6 +548,7 @@ def apply(compat_path, app_id, selection=SELECTION, store=STORE, pending=PENDING
|
||||
skipped = set()
|
||||
placed_stems = set()
|
||||
machines = PE["proton_pe_machines"](proton, env) if proton else None
|
||||
dist = Path(proton).parent / "files/lib/wine" if proton else None
|
||||
saved_overrides = state.get("overrides") if isinstance(state.get("overrides"), dict) else {}
|
||||
saved_requires = state.get("requires") if isinstance(state.get("requires"), dict) else {}
|
||||
recorded = [c for c in state.get("components", []) if isinstance(c, str) and valid_id(c)]
|
||||
@@ -585,7 +588,7 @@ def apply(compat_path, app_id, selection=SELECTION, store=STORE, pending=PENDING
|
||||
kept_requires[cid] = list(requires)
|
||||
values += [(cid, value) for value in registry]
|
||||
for rel, src in files:
|
||||
foreign = foreign_component(rel, src, machines)
|
||||
foreign = foreign_component(rel, src, machines, dist)
|
||||
if foreign:
|
||||
skipped.add(Path(rel).stem.lower())
|
||||
changed = False
|
||||
@@ -606,7 +609,7 @@ def apply(compat_path, app_id, selection=SELECTION, store=STORE, pending=PENDING
|
||||
path = existing(pfx / rel)
|
||||
saved = compat / BACKUP / rel
|
||||
if saved.is_file():
|
||||
if foreign_component(rel, saved, machines):
|
||||
if foreign_component(rel, saved, machines, dist):
|
||||
if path is not None and not path.is_symlink():
|
||||
path.unlink()
|
||||
continue
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/python3
|
||||
import re
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
@@ -76,18 +76,105 @@ def pe_has_arm64ec_metadata(path):
|
||||
return False
|
||||
|
||||
|
||||
# Only x64 code and members of the same runtime family import these, so an x64 copy loads in an
|
||||
# ARM64EC prefix, and games check for a newer version than Wine's builtins report.
|
||||
VC_RUNTIME = re.compile(r"(msvc[pr]\d.*|vcruntime\d.*|vcomp\d*|vcamp\d.*|vccorlib\d.*|concrt\d.*|mfcm?\d.*)\.dll",
|
||||
re.IGNORECASE)
|
||||
def pe_imports(path):
|
||||
try:
|
||||
with open(path, "rb") as source:
|
||||
image = source.read()
|
||||
except OSError:
|
||||
return None
|
||||
try:
|
||||
if image[:2] != b"MZ":
|
||||
return None
|
||||
pe_offset = int.from_bytes(image[60:64], "little")
|
||||
if image[pe_offset:pe_offset + 4] != b"PE\0\0":
|
||||
return None
|
||||
section_count = int.from_bytes(image[pe_offset + 6:pe_offset + 8], "little")
|
||||
optional_size = int.from_bytes(image[pe_offset + 20:pe_offset + 22], "little")
|
||||
optional = pe_offset + 24
|
||||
magic = int.from_bytes(image[optional:optional + 2], "little")
|
||||
directories = optional + (112 if magic == 0x20B else 96)
|
||||
if directories > len(image):
|
||||
return None
|
||||
directory_count = int.from_bytes(image[directories - 4:directories], "little")
|
||||
sections = []
|
||||
for index in range(min(section_count, 96)):
|
||||
entry = optional + optional_size + index * 40
|
||||
if entry + 40 > len(image):
|
||||
return None
|
||||
sections.append((int.from_bytes(image[entry + 12:entry + 16], "little"),
|
||||
max(int.from_bytes(image[entry + 8:entry + 12], "little"),
|
||||
int.from_bytes(image[entry + 16:entry + 20], "little")),
|
||||
int.from_bytes(image[entry + 20:entry + 24], "little")))
|
||||
|
||||
def offset(rva):
|
||||
for address, size, raw in sections:
|
||||
if address <= rva < address + size:
|
||||
return rva - address + raw
|
||||
return None
|
||||
|
||||
names = set()
|
||||
for directory, step, field in ((1, 20, 12), (13, 32, 4)):
|
||||
if directory >= directory_count:
|
||||
continue
|
||||
if directories + directory * 8 + 8 > len(image):
|
||||
return None
|
||||
rva = int.from_bytes(image[directories + directory * 8:directories + directory * 8 + 4], "little")
|
||||
entry = offset(rva) if rva else None
|
||||
if rva and entry is None:
|
||||
return None
|
||||
while entry is not None:
|
||||
if entry + step > len(image):
|
||||
return None
|
||||
name_rva = int.from_bytes(image[entry + field:entry + field + 4], "little")
|
||||
if not name_rva:
|
||||
break
|
||||
name = offset(name_rva)
|
||||
end = image.find(b"\0", name) if name is not None else -1
|
||||
if end < 0:
|
||||
return None
|
||||
names.add(image[name:end].decode("ascii", "replace").lower())
|
||||
entry += step
|
||||
return names
|
||||
except (IndexError, ValueError):
|
||||
return None
|
||||
|
||||
|
||||
def machine_compatible(path, machines, machine=None):
|
||||
PROGRAM_IMPORTS = {}
|
||||
|
||||
|
||||
def program_imports(builtins):
|
||||
key = str(builtins)
|
||||
if key not in PROGRAM_IMPORTS:
|
||||
try:
|
||||
files = {name.lower(): Path(builtins) / name for name in os.listdir(builtins)}
|
||||
except OSError:
|
||||
files = None
|
||||
pending = [name for name in files or () if name.endswith(".exe") and pe_machine(files[name]) in (None, 0xAA64)]
|
||||
seen = set()
|
||||
while pending and files is not None:
|
||||
name = pending.pop()
|
||||
if name in seen:
|
||||
continue
|
||||
seen.add(name)
|
||||
if name in files:
|
||||
imports = pe_imports(files[name])
|
||||
if imports is None:
|
||||
files = None
|
||||
else:
|
||||
pending.extend(imports)
|
||||
PROGRAM_IMPORTS[key] = None if files is None else frozenset(name for name in seen if name.endswith(".dll"))
|
||||
return PROGRAM_IMPORTS[key]
|
||||
|
||||
|
||||
def machine_compatible(path, machines, machine=None, builtins=None, name=None):
|
||||
machine = pe_machine(path) if machine is None else machine
|
||||
if machine == 0x8664 and 0xA641 in machines and VC_RUNTIME.fullmatch(Path(path).name):
|
||||
return True
|
||||
if machine == 0x8664 and 0xA641 in machines:
|
||||
if pe_has_arm64ec_metadata(path):
|
||||
return True
|
||||
imported = program_imports(builtins) if builtins is not None else None
|
||||
return imported is not None and (name or Path(path).name).lower() not in imported
|
||||
if machine == 0x8664 and pe_has_arm64ec_metadata(path):
|
||||
return 0xA641 in machines
|
||||
return False
|
||||
return machine in machines
|
||||
|
||||
|
||||
|
||||
@@ -197,6 +197,172 @@ def wine(argv, source_env=None):
|
||||
pass
|
||||
|
||||
|
||||
# PlayFab Game Saves picks its provider from the Gaming Runtime unless HKLM\SOFTWARE\Microsoft\GamingServices
|
||||
# ForceUseInprocGameSaves is set, and its in-process provider needs a save folder the title never passes on Windows.
|
||||
# The runtime has no GRTS saves, so titles such as Forza Horizon 6 stop with E:0-17. xodus-nexus ships a proxy
|
||||
# (scripts/runtime-compat/playfab-save-folder.c, MIT) that keeps the title's own SDK as nexus_pgs_native.dll and
|
||||
# supplies both; this stages it the same way.
|
||||
PGS_PROXY = RUNTIME / 'compat' / 'PlayFabGameSave.dll'
|
||||
PGS_NATIVE = 'nexus_pgs_native.dll'
|
||||
PGS_EXPORTS = (
|
||||
'PFGameSaveFilesAddUserWithUiAsync', 'PFGameSaveFilesAddUserWithUiResult', 'PFGameSaveFilesGetFolder',
|
||||
'PFGameSaveFilesGetFolderSize', 'PFGameSaveFilesGetRemainingQuota', 'PFGameSaveFilesGetSaveDescriptionForDebug',
|
||||
'PFGameSaveFilesGetSaveDescriptionSizeForDebug', 'PFGameSaveFilesGetStatsJsonForDebug',
|
||||
'PFGameSaveFilesGetStatsJsonSizeForDebug', 'PFGameSaveFilesInitialize', 'PFGameSaveFilesIsConnectedToCloud',
|
||||
'PFGameSaveFilesPauseUploadForDebug', 'PFGameSaveFilesResetCloudAsync', 'PFGameSaveFilesResetCloudResult',
|
||||
'PFGameSaveFilesResumeUploadForDebug', 'PFGameSaveFilesSetActiveDeviceChangedCallback',
|
||||
'PFGameSaveFilesSetActiveDevicePollForceChangeForDebug', 'PFGameSaveFilesSetActiveDevicePollIntervalForDebug',
|
||||
'PFGameSaveFilesSetForceNullPendingManifestForDebug', 'PFGameSaveFilesSetForceOutOfStorageErrorForDebug',
|
||||
'PFGameSaveFilesSetForceSyncFailedErrorForDebug', 'PFGameSaveFilesSetMockDataFolderForDebug',
|
||||
'PFGameSaveFilesSetMockDeviceIdForDebug', 'PFGameSaveFilesSetMockForceOfflineForDebug',
|
||||
'PFGameSaveFilesSetMockManifestOffsetForDebug', 'PFGameSaveFilesSetMockRootFolderForDebug',
|
||||
'PFGameSaveFilesSetSaveDescriptionAsync', 'PFGameSaveFilesSetSaveDescriptionResult',
|
||||
'PFGameSaveFilesSetUiActiveDeviceContentionResponse', 'PFGameSaveFilesSetUiCallbacks',
|
||||
'PFGameSaveFilesSetUiConflictResponse', 'PFGameSaveFilesSetUiOutOfStorageResponse',
|
||||
'PFGameSaveFilesSetUiProgressResponse', 'PFGameSaveFilesSetUiSyncFailedResponse',
|
||||
'PFGameSaveFilesSetWriteManifestsToDiskForDebug', 'PFGameSaveFilesUiProgressGetProgress',
|
||||
'PFGameSaveFilesUninitializeAsync', 'PFGameSaveFilesUninitializeResult', 'PFGameSaveFilesUploadWithUiAsync',
|
||||
'PFGameSaveFilesUploadWithUiResult',
|
||||
)
|
||||
|
||||
|
||||
def pe_exports(data):
|
||||
"""(export address table size, [(name, ordinal index, forwarder or None) for each named export]) of an x64
|
||||
PE image, or None. The table size also counts exports that have no name."""
|
||||
def u16(offset):
|
||||
return int.from_bytes(data[offset:offset + 2], 'little')
|
||||
|
||||
def u32(offset):
|
||||
return int.from_bytes(data[offset:offset + 4], 'little')
|
||||
|
||||
def string(offset):
|
||||
end = data.find(b'\0', offset)
|
||||
return None if offset is None or end < 0 else data[offset:end].decode('ascii', 'replace')
|
||||
|
||||
if len(data) < 256 or data[:2] != b'MZ':
|
||||
return None
|
||||
pe = u32(60)
|
||||
if data[pe:pe + 4] != b'PE\0\0' or u16(pe + 4) != 0x8664:
|
||||
return None
|
||||
count, optional_size = u16(pe + 6), u16(pe + 20)
|
||||
optional = pe + 24
|
||||
if optional_size < 120 or u16(optional) != 0x20B or u32(optional + 108) < 1:
|
||||
return None
|
||||
sections = optional + optional_size
|
||||
|
||||
def offset_of(address):
|
||||
for index in range(count):
|
||||
section = sections + index * 40
|
||||
start, size, raw = u32(section + 12), u32(section + 16), u32(section + 20)
|
||||
if start <= address < start + size and raw + address - start < len(data):
|
||||
return raw + address - start
|
||||
return None
|
||||
|
||||
directory_rva, directory_size = u32(optional + 112), u32(optional + 116)
|
||||
directory = offset_of(directory_rva)
|
||||
if directory is None or u32(directory + 16) != 1:
|
||||
return None
|
||||
functions, names = u32(directory + 20), u32(directory + 24)
|
||||
function_table, name_table, ordinal_table = (offset_of(u32(directory + 28)), offset_of(u32(directory + 32)),
|
||||
offset_of(u32(directory + 36)))
|
||||
if None in (function_table, name_table, ordinal_table):
|
||||
return None
|
||||
exports = []
|
||||
for index in range(names):
|
||||
name = string(offset_of(u32(name_table + 4 * index)))
|
||||
ordinal = u16(ordinal_table + 2 * index)
|
||||
address = u32(function_table + 4 * ordinal) if ordinal < functions else 0
|
||||
if name is None or not address:
|
||||
return None
|
||||
forward = string(offset_of(address)) if directory_rva <= address < directory_rva + directory_size else None
|
||||
exports.append((name, ordinal, forward))
|
||||
return functions, exports
|
||||
|
||||
|
||||
def playfab_sdk(data):
|
||||
"""The PlayFab Game Saves SDK the proxy was written for: exactly its 40 exports, all named, none forwarded."""
|
||||
parsed = pe_exports(data)
|
||||
if parsed is None or parsed[0] != len(PGS_EXPORTS):
|
||||
return False
|
||||
exports = parsed[1]
|
||||
return ([(name, ordinal) for name, ordinal, _ in exports] == list(zip(PGS_EXPORTS, range(len(PGS_EXPORTS))))
|
||||
and all(forward is None for _, _, forward in exports))
|
||||
|
||||
|
||||
def playfab_proxy(data):
|
||||
"""A save-folder proxy (this one or an earlier build): the same 40 exports, forwarding into nexus_pgs_native."""
|
||||
parsed = pe_exports(data)
|
||||
if parsed is None or parsed[0] != len(PGS_EXPORTS):
|
||||
return False
|
||||
exports = parsed[1]
|
||||
return ([name for name, _, _ in exports] == list(PGS_EXPORTS)
|
||||
and any((forward or '').startswith(PGS_NATIVE[:-4] + '.') for _, _, forward in exports))
|
||||
|
||||
|
||||
def kept_sdk(native):
|
||||
"""True when nexus_pgs_native.dll is a regular file holding a recognised SDK."""
|
||||
return not native.is_symlink() and native.is_file() and playfab_sdk(native.read_bytes())
|
||||
|
||||
|
||||
def replace_file(directory, name, data):
|
||||
descriptor, temporary = tempfile.mkstemp(prefix='.droiddeck-pgs-', dir=directory)
|
||||
try:
|
||||
with os.fdopen(descriptor, 'wb') as file:
|
||||
file.write(data)
|
||||
file.flush()
|
||||
os.fsync(file.fileno())
|
||||
os.chmod(temporary, 0o644)
|
||||
os.replace(temporary, Path(directory) / name)
|
||||
except BaseException:
|
||||
try:
|
||||
os.unlink(temporary)
|
||||
except OSError:
|
||||
pass
|
||||
raise
|
||||
|
||||
|
||||
def stage_playfab_proxy(folder):
|
||||
"""Put the save-folder proxy in front of every PlayFab Game Saves SDK in the game folder. Returns how many."""
|
||||
try:
|
||||
proxy = PGS_PROXY.read_bytes()
|
||||
except OSError:
|
||||
return 0
|
||||
staged = 0
|
||||
for root, _, files in os.walk(folder):
|
||||
directory = Path(root)
|
||||
for name in files:
|
||||
if name.lower() != 'playfabgamesave.dll':
|
||||
continue
|
||||
path = directory / name
|
||||
native = directory / PGS_NATIVE
|
||||
try:
|
||||
if path.is_symlink():
|
||||
continue
|
||||
data = path.read_bytes()
|
||||
if playfab_sdk(data):
|
||||
# A first launch, or a game update that brought a new SDK: the update's copy becomes the native one,
|
||||
# but only in place of nothing or of an earlier SDK copy, never over an unknown file or a link.
|
||||
if os.path.lexists(native) and not kept_sdk(native):
|
||||
print('droiddeck-xbox: unknown %s next to the PlayFab Game Saves SDK in %s; left unchanged'
|
||||
% (PGS_NATIVE, directory), file=sys.stderr)
|
||||
continue
|
||||
replace_file(directory, PGS_NATIVE, data)
|
||||
elif not playfab_proxy(data):
|
||||
print('droiddeck-xbox: PlayFab Game Saves SDK with unknown exports in %s; left unchanged' % directory,
|
||||
file=sys.stderr)
|
||||
continue
|
||||
elif not kept_sdk(native):
|
||||
print('droiddeck-xbox: PlayFab save proxy without its SDK in %s; left unchanged' % directory,
|
||||
file=sys.stderr)
|
||||
continue
|
||||
if data != proxy:
|
||||
replace_file(directory, name, proxy)
|
||||
staged += 1
|
||||
except OSError as error:
|
||||
print('droiddeck-xbox: PlayFab save proxy not staged in %s (%s)' % (directory, error), file=sys.stderr)
|
||||
return staged
|
||||
|
||||
|
||||
def renew_lease(ask, channel, product, lease, stopped):
|
||||
while not stopped.wait(15):
|
||||
response = ask(channel, {'op': 'xbox-renew', 'id': product, 'lease': lease}, timeout=10)
|
||||
@@ -255,6 +421,12 @@ def launch(command, env):
|
||||
pass
|
||||
if roots:
|
||||
owned_env['XODUS_CONTENT_ROOTS'] = ';'.join(roots)
|
||||
# No DLL override for the proxy or the kept SDK: Wine has no builtin of either, so both load from the
|
||||
# game folder as they are. Forcing them native-only (as Nexus does) made Forza Horizon 6 fail with E:0-0-4.
|
||||
try:
|
||||
stage_playfab_proxy(folder)
|
||||
except Exception as error:
|
||||
print('droiddeck-xbox: PlayFab save proxy skipped (%s)' % error, file=sys.stderr)
|
||||
return wine([reply['exe']], owned_env)
|
||||
finally:
|
||||
stopped.set()
|
||||
|
||||
Reference in new issue
Block a user