feat: fetch Proton, FEX and the runtimes automatically, and make Linux games run under FEX (#1045)

* fix: x86 Linux games that also ship for Windows run under Proton again

Since #749 the live compatibility helper treated every installed game with
both Windows and x86 Linux builds as a user's native choice, because the
client reports an empty tool for unmapped games. Those games were left on
the Steam Linux Runtime, which cannot start them here (bwrap fails, or FEX
looks for a RootFS that is not shipped), so Valheim, Moonlighter, Half-Life 2,
TF2 and others exited within seconds.

- An unmapped game the helper never managed now gets the default Proton.
  Clearing a mapping the helper set is still kept as a native choice.
- Native choices are stored under "native_choices". The old "native" list
  also held games nobody picked, so it is dropped.

* feat: Linux builds run under FEX by default, with the runtimes fetched automatically

- Steam fetches Proton, FEX, Steam Linux Runtime 3.0 and 4.0 on the first start and keeps them updated instead of leaving them pending.
- Games that ship a Linux build go to FEX once it can run them; Windows-only games and installed Windows builds keep the Proton default.
- FEX runs games on a combined x86 runtime with the newer glibc and libstdc++ the GL and Vulkan thunks need.
- Vulkan display extensions the driver cannot handle are hidden in front of the thunk, without an audit module.
- Mono's incremental garbage collector is turned off under FEX, which stops Unity games crashing.
- x86 Steamworks finds the x86 steamclient.
- 32-bit games read the virtual controller.

* fix: controllers work in Linux Unity games such as Valheim

Joystick ioctls on an event node now fail with EINVAL like the kernel's evdev, so the SDL2 that Unity embeds reads the pad's real ID instead of ignoring it as 0000:0000.

* test: skip the switch script test without node, and the ring tests without gcc

* fix: games with a Linux build keep the Proton default

The Windows build often runs better, so titles that ship both builds stay on the default Proton again. Users can still pick FEX for one, and that choice is kept. Linux-only titles still go to FEX.

* fix: unmapped dual-platform games get Proton even when config.vdf cannot be read
This commit is contained in:
MaxsTechReview authored and GitHub committed 2026-10-18 08:59:54 -04:00
1 parent 219548f4b6
commit 69c88aa344
17 files changed
+1035 -144

No files matched your search

+124 -20
View File
@@ -28,15 +28,25 @@ URUNTIME = "/usr/local/lib/droiddeck/uruntime"
HOST_PRELOAD = "/etc/ld.so.preload"
FEX_APPID = "3127680"
SNIPER_APPID = "1628350"
INSTALL_DIRS = {FEX_APPID: "FEX-Emu", SNIPER_APPID: "SteamLinuxRuntime_sniper"}
SLR4_APPID = "4183110"
INSTALL_DIRS = {FEX_APPID: "FEX-Emu", SNIPER_APPID: "SteamLinuxRuntime_sniper", SLR4_APPID: "SteamLinuxRuntime_4"}
MARKER = ".droiddeck-fex"
LAYOUT = 1
ROOTFS_LAYOUT = 1
ARCH_DIRS = ("x86_64-linux-gnu", "i386-linux-gnu")
INTERPRETERS = ("ld-linux-x86-64.so.2", "ld-linux.so.2")
PROVIDED = frozenset((
"ld-linux-x86-64.so.2", "ld-linux.so.2", "libc.so.6", "libm.so.6", "libmvec.so.1", "libpthread.so.0", "libdl.so.2",
"librt.so.1", "libutil.so.1", "libresolv.so.2", "libanl.so.1", "libBrokenLocale.so.1", "libnsl.so.1",
"libnss_compat.so.2", "libnss_dns.so.2", "libnss_files.so.2", "libnss_hesiod.so.2", "libthread_db.so.1",
"libmemusage.so", "libpcprofile.so", "libc_malloc_debug.so.0", "gconv", "libstdc++.so.6", "libgcc_s.so.1",
))
GLIBC_BUILD = re.compile(r"^(?:ld|lib[A-Za-z_]+)-2\.[0-9]+\.so$|^libSegFault\.so$")
GUEST_LIBDIRS = (("x86_64", "lib/x86_64-linux-gnu"), ("i386", "lib/i386-linux-gnu"))
PRELOAD_NAMES = ("libblsession.so", "libfakeinput.so")
FAULT_REPORT = "libfaultreport.so"
THUNK_AUDIT = "libthunkaudit.so"
THUNK_AUDIT_GUEST = "/usr/lib/x86_64-linux-gnu/droiddeck/" + THUNK_AUDIT
VULKAN_PIN = "libvulkan-thunk.so"
VULKAN_PIN_DIR = "lib/x86_64-linux-gnu/droiddeck/vulkan"
VULKAN_THUNK = "libvulkan-guest.so"
RUNTIME_LIBRARIES = (("libc.so.6", b"GLIBC_"), ("libstdc++.so.6", b"GLIBCXX_"))
VERSION_NAME = re.compile(rb"GLIBC(?:XX)?_[0-9][0-9.]*[0-9]")
@@ -164,15 +174,15 @@ def platform_version(path):
return tuple(int(part) for part in re.findall(r"\d+", os.path.basename(path)))
def runtime_platform():
runtime = app_dir(SNIPER_APPID)
def runtime_platform(appid=SNIPER_APPID, prefix="sniper_platform_"):
runtime = app_dir(appid)
if not runtime:
return None
try:
entries = os.listdir(runtime)
except OSError:
return None
platforms = [os.path.join(runtime, entry) for entry in entries if entry.startswith("sniper_platform_")]
platforms = [os.path.join(runtime, entry) for entry in entries if entry.startswith(prefix)]
platforms = [path for path in platforms if os.path.isdir(os.path.join(path, "files"))
and os.path.isfile(os.path.join(path, "usr-mtree.txt.gz"))]
return max(platforms, key=platform_version, default=None)
@@ -234,6 +244,75 @@ def materialize(platform):
return True
def graphics_platform():
return runtime_platform(SLR4_APPID, "steamrt4_platform_")
def provides_newer(base, provider):
for name, prefix in RUNTIME_LIBRARIES:
ours = {v for v in version_names(os.path.join(base, "files/lib/x86_64-linux-gnu", name)) if v.startswith(prefix)}
theirs = {v for v in version_names(os.path.join(provider, "files/lib/x86_64-linux-gnu", name)) if v.startswith(prefix)}
if not ours or not theirs or not ours < theirs:
return False
return True
def mirror(source, provider, name, target):
if provider and name in PROVIDED and os.path.lexists(os.path.join(provider, name)):
os.symlink(os.path.realpath(os.path.join(provider, name)), os.path.join(target, name))
return
path = os.path.join(source, name)
link = os.readlink(path) if os.path.islink(path) else None
if link and GLIBC_BUILD.match(os.path.basename(link)):
if name not in INTERPRETERS:
return
link = os.path.join(os.path.dirname(link), name)
if provider and GLIBC_BUILD.match(name):
return
if link and not link.startswith("/"):
os.symlink(link, os.path.join(target, name))
else:
os.symlink(os.path.realpath(path), os.path.join(target, name))
def build_rootfs(base, provider):
"""The runtime with glibc and libstdc++ taken from a newer one, which FEX's GL and Vulkan thunks are built against."""
base_files, provider_files = os.path.join(base, "files"), os.path.join(provider, "files")
rootfs = os.path.join(STATE, "rootfs")
stamp = "%d\n%s\n%s%s\n%s" % (ROOTFS_LAYOUT, os.path.realpath(base), read_text(os.path.join(base_files, MARKER)) or "",
os.path.realpath(provider), read_text(os.path.join(provider_files, MARKER)) or "")
if read_text(os.path.join(rootfs, MARKER)) == stamp:
return False
for entry in os.listdir(STATE):
if entry.startswith("rootfs."):
shutil.rmtree(os.path.join(STATE, entry), ignore_errors=True)
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))
os.symlink(".", os.path.join(tmp, "usr"))
for top in ("lib", "lib64"):
source = os.path.join(base_files, top)
os.makedirs(os.path.join(tmp, top))
for entry in os.listdir(source) if os.path.isdir(source) else ():
path = os.path.join(source, entry)
if entry in ARCH_DIRS and os.path.isdir(path) and not os.path.islink(path):
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.lexists(os.path.join(provided, name))}:
mirror(path, provided, name, os.path.join(tmp, top, entry))
else:
mirror(source, None, entry, os.path.join(tmp, top))
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)
return True
def host_preloads():
listed = read_text(HOST_PRELOAD) or ""
return [name for name in PRELOAD_NAMES if name in listed]
@@ -247,10 +326,14 @@ def install_preloads(root):
if os.path.isfile(source):
copy_if_changed(source, os.path.join(root, libdir, "droiddeck", name))
shipped.setdefault(name, set()).add(arch)
for name in (THUNK_AUDIT, VULKAN_PIN):
source = os.path.join(PRELOADS, "x86_64", name)
if os.path.isfile(source):
copy_if_changed(source, os.path.join(root, "lib/x86_64-linux-gnu/droiddeck", name))
pin = os.path.join(PRELOADS, "x86_64", VULKAN_PIN)
if os.path.isfile(pin):
copy_if_changed(pin, os.path.join(root, VULKAN_PIN_DIR, "libvulkan.so.1"))
alias = os.path.join(root, VULKAN_PIN_DIR, "libvulkan.so")
if not os.path.islink(alias) or os.readlink(alias) != "libvulkan.so.1":
if os.path.lexists(alias):
os.unlink(alias)
os.symlink("libvulkan.so.1", alias)
wanted = [name for name in host_preloads() if name in shipped]
if len(shipped.get(FAULT_REPORT, ())) == len(GUEST_LIBDIRS):
wanted.append(FAULT_REPORT)
@@ -270,14 +353,16 @@ def write_config(fex, root):
def link_steam_sdk():
for sdk, candidates in (("sdk64", ("linux64", "ubuntu12_64")), ("sdk32", ("linux32", "ubuntu12_32"))):
link = os.path.join(HOME, ".steam", sdk)
if os.path.lexists(link):
continue
want = "x86_64" if sdk == "sdk64" else "i386"
if elf_arch(os.path.join(link, "steamclient.so")) == want:
continue
for candidate in candidates:
directory = os.path.join(STEAM_ROOT, candidate)
if elf_arch(os.path.join(directory, "steamclient.so")) == want:
os.makedirs(os.path.dirname(link), exist_ok=True)
os.symlink(directory, link)
tmp = "%s.%d.tmp" % (link, os.getpid())
os.symlink(directory, tmp)
os.replace(tmp, link)
break
@@ -308,7 +393,7 @@ def request_install():
return []
def describe(fex, platform):
def describe(fex, platform, graphics=None):
return {
"fex": fex["bin"] if fex else None,
"server": fex["server"] if fex else None,
@@ -317,6 +402,7 @@ def describe(fex, platform):
"steamclient64": os.path.realpath(os.path.join(HOME, ".steam", "sdk64", "steamclient.so"))
if elf_arch(os.path.join(HOME, ".steam", "sdk64", "steamclient.so")) == "x86_64" else None,
"ready": bool(fex and fex["server"] and platform),
"graphics": graphics,
}
@@ -346,13 +432,27 @@ def prepare():
if materialize(platform):
say("prepared %s as the x86 runtime" % os.path.basename(platform))
install_preloads(root)
provider = graphics_platform()
if provider and materialize(provider):
say("prepared %s for the x86 runtime's C and C++ libraries" % os.path.basename(provider))
if not provider:
say("Steam Linux Runtime 4.0 (Steam app %s) is not installed yet; x86 games may not find their graphics drivers"
% SLR4_APPID)
elif not provides_newer(platform, provider):
say("%s has no newer C and C++ libraries than %s" % (os.path.basename(provider), os.path.basename(platform)))
provider = None
else:
if build_rootfs(platform, provider):
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")
write_config(fex, root)
fex["rootfs"] = root
try:
link_steam_sdk()
except OSError:
pass
status = describe(fex, platform)
status = describe(fex, platform, provider)
write_if_changed(STATUS_FILE, json.dumps(status, indent=2) + "\n")
with contextlib.suppress(OSError):
os.unlink(WANTED)
@@ -430,6 +530,8 @@ def guest_environment(fex, env):
result["STEAM_COMPAT_DATA_PATH"] = short
result.setdefault("FEX_SILENTLOG", "0")
result.setdefault("FEX_OUTPUTLOG", "stderr")
# Mono's incremental Boehm collector corrupts its heap under FEX, so Unity games crash at their first collections.
result.setdefault("GC_DISABLE_INCREMENTAL", "1")
if fex["portable"]:
result["FEX_PORTABLE"] = "1"
else:
@@ -445,7 +547,7 @@ def guest_environment(fex, env):
result["FEX_THUNKCONFIG"] = os.path.join(CONFIG_DIR, "ThunksConfig.json")
preload = [part for part in split_paths(result.get("LD_PRELOAD")) if os.path.exists(part) and not is_arm(part)]
library_path = [part for part in (result.get("LD_LIBRARY_PATH") or "").split(":")
if part and "steamrtarm64" not in part and "aarch64" not in part]
if part and "arm64" not in part and "aarch64" not in part]
for name, parts in (("LD_PRELOAD", preload), ("LD_LIBRARY_PATH", library_path)):
if parts:
result[name] = ":".join(parts)
@@ -483,6 +585,7 @@ def vulkan_thunk_loads(fex, folder):
needed = version_names(os.path.join(fex["guest_thunks"], VULKAN_THUNK))
if not needed:
return False
needed |= version_names(os.path.join(PRELOADS, "x86_64", VULKAN_PIN))
found = bundled_libraries(folder)
for name, prefix in RUNTIME_LIBRARIES:
library = found.get(name) or os.path.join(fex["rootfs"], "lib/x86_64-linux-gnu", name)
@@ -509,9 +612,10 @@ def launch(command, env, mode, decide=None):
x86_64 = elf_arch(program) != "i386"
thunks = "on" if "FEX_THUNKCONFIG" in guest else "off"
folder = decide if decide and os.path.isdir(decide) else os.path.dirname(program)
if thunks == "on" and x86_64 and all(os.path.isfile(os.path.join(PRELOADS, "x86_64", name)) for name in (THUNK_AUDIT, VULKAN_PIN)) \
if thunks == "on" and x86_64 and os.path.isfile(os.path.join(PRELOADS, "x86_64", VULKAN_PIN)) \
and vulkan_thunk_loads(fex, folder):
guest["LD_AUDIT"] = ":".join([THUNK_AUDIT_GUEST] + split_paths(guest.get("LD_AUDIT")))
# Any LD_AUDIT module makes Mono's garbage collector crash under FEX, so the Vulkan thunk is pinned by search path.
guest["LD_LIBRARY_PATH"] = ":".join(["/usr/" + VULKAN_PIN_DIR] + split_paths(guest.get("LD_LIBRARY_PATH")))
thunks = "on, its own Vulkan loader too"
say("running %s with %s (runtime %s, thunks %s)" % (program, fex["bin"], guest.get("FEX_ROOTFS", "none"), thunks))
return os.execve(fex["bin"], [fex["bin"], program] + command[1:], guest)
@@ -563,7 +667,7 @@ def extracted():
def want_fex():
with locked():
status = describe(fex_install(), runtime_platform())
status = describe(fex_install(), runtime_platform(), graphics_platform())
if not status["ready"]:
request_install()
write_if_changed(STATUS_FILE, json.dumps(status, indent=2) + "\n")
@@ -679,7 +783,7 @@ def main(argv):
return 0 if prepare() else 1
if action == "status":
with locked():
status = describe(fex_install(), runtime_platform())
status = describe(fex_install(), runtime_platform(), graphics_platform())
write_if_changed(STATUS_FILE, json.dumps(status, indent=2) + "\n")
print(json.dumps(status, indent=2))
return 0 if status["ready"] else 1
@@ -126,6 +126,29 @@ INSTALL_JS = r"""
return "installed";
})()
""".replace("__BINDING__", BINDING)
TOOLS_JS = r"""
(() => {
if (window.__droiddeckTools) return "present";
const installs = SteamClient.Installs, downloads = SteamClient.Downloads;
if (typeof installs?.OpenInstallWizard !== "function" || typeof installs?.RegisterForShowInstallWizard !== "function" ||
typeof installs?.ContinueInstall !== "function" || typeof downloads?.QueueAppUpdate !== "function")
throw new Error("the client's install calls are not ready");
const self = { asked: new Map() };
installs.RegisterForShowInstallWizard((state) => {
const app = Number(state?.currentAppID);
if (state?.eInstallState === 7 && Date.now() - (self.asked.get(app) || 0) < 120000) {
self.asked.delete(app);
installs.ContinueInstall();
}
});
self.install = (app) => { self.asked.set(app, Date.now()); installs.OpenInstallWizard([app], "0"); return true; };
self.update = (app) => { downloads.QueueAppUpdate(app, "0"); return true; };
window.__droiddeckTools = self;
return "installed";
})()
"""
TOOL_CHECK_SECONDS = 60
TOOL_RETRY_SECONDS = 300
SWITCH_BINDING = "droiddeckSwitchToDesktop"
SWITCH_JS = r"""
(() => {
@@ -397,6 +420,9 @@ class Page:
raise RuntimeError((details.get("exception") or {}).get("description") or details.get("text") or "script failed")
return result.get("result", {}).get("value")
def tools(self, call):
return self.evaluate("%s;\nwindow.__droiddeckTools.%s" % (TOOLS_JS, call))
def compat(self, call):
return self.evaluate("%s;\nwindow.__droiddeckCompat.%s" % (INSTALL_JS, call))
@@ -481,6 +507,8 @@ class Helper:
self.known = set()
self.installed = None
self.fex_asked = set()
self.tools_asked = {}
self.tools_checked = None
self.vr_launch = None
def attach(self):
@@ -524,7 +552,8 @@ class Helper:
prior_auto = state.get("auto", {})
if not isinstance(prior_auto, dict):
prior_auto = {}
prior_native = state.get("native", ())
# "native" from earlier builds also lists dual-platform games nobody chose to run natively.
prior_native = state.get("native_choices", ())
native_choices = set(prior_native if isinstance(prior_native, (list, tuple, set)) else ())
apps = sorted(set(installed) | set(picks) | set(prior_auto) | native_choices, key=COMPAT["app_order"])
overrides = COMPAT["requested_games"](
@@ -538,12 +567,19 @@ class Helper:
if raw_mapping is None:
for app in native_choices:
current[app] = ""
for app in set(native) - native_choices:
if not current.get(app):
current.pop(app, None)
else:
for app in set(native) | native_choices:
if app in raw_mapping:
current[app] = raw_mapping[app]
# The client shows an explicit native choice as the tool it inherits, and writes config.vdf late.
if raw_mapping[app] == "" or current.get(app) not in self.known:
current[app] = raw_mapping[app]
elif app in prior_auto or app in native_choices:
current[app] = ""
elif not current.get(app):
current.pop(app, None)
changes, auto = COMPAT["plan_mapping"](
current, installed, [t["name"] for t in live], default,
COMPAT["followers"](state, current), native, picks, overrides,
@@ -554,18 +590,36 @@ class Helper:
tool if tool is not None else "Steam native default"))
state.update(
auto={app: tool for app, tool in auto.items() if tool is not COMPAT["NATIVE_CHOICE"]},
native=sorted(app for app, tool in auto.items() if tool is COMPAT["NATIVE_CHOICE"]),
native_choices=sorted(app for app, tool in auto.items() if tool is COMPAT["NATIVE_CHOICE"]),
tools=catalog, live=True)
state.pop("native", None)
if waiting:
state["pending"] = wanted
say("%s is new to the running client; it applies when Steam next starts" % wanted)
else:
state.pop("pending", None)
COMPAT["write_json"](state_file, state)
if (any(app in installed and tool == COMPAT["FEX_TOOL"] for app, tool in native.items()) or
os.path.exists(COMPAT["fex_wanted_marker"]())):
for app in COMPAT["request_fex"](self.steam_root, self.fex_asked):
say("asked the client to install %s for x86 Linux titles and programs" % app)
def ensure_tools(self):
"""Proton, FEX and the runtimes FEX needs are fetched as soon as the client is up, never left pending."""
now = time.monotonic()
if self.tools_checked is not None and now - self.tools_checked < TOOL_CHECK_SECONDS:
return
self.tools_checked = now
if COMPAT["game_running"]():
return
for app, action in COMPAT["tool_downloads"](self.steam_root):
if now - self.tools_asked.get(app, -TOOL_RETRY_SECONDS) < TOOL_RETRY_SECONDS:
continue
self.tools_asked[app] = now
try:
self.page.tools("%s(%d)" % (action, int(app)))
say("asked the client to %s %s" % (action, app))
except Exception as e:
say("the client could not %s %s (%s)" % (action, app, e))
if action == "install":
for asked in COMPAT["request_fex"](self.steam_root, self.fex_asked):
say("asked the client to install %s through steam://install" % asked)
def request_waiting(self):
request = COMPAT["read_json"](COMPAT["state_path"]("request.json"))
@@ -592,6 +646,7 @@ class Helper:
f.write("%d\n" % os.getpid())
say("attached to the client on port %d" % self.port)
self.reconcile()
self.ensure_tools()
while True:
sources = [self.page.ws] + ([watcher] if watcher.fileno() >= 0 else [])
ready = [self.page.ws] if self.page.ws.pending() else select.select(sources, [], [], 30 if watcher.fileno() >= 0 else 2)[0]
@@ -606,6 +661,7 @@ class Helper:
watcher.changed()
self.drain()
self.reconcile()
self.ensure_tools()
def detach():
@@ -111,7 +111,8 @@ mkdir -p "$HOME/.steam"
ln -sfn "$steam_root" "$HOME/.steam/root"
ln -sfn "$steam_root" "$HOME/.steam/steam"
ln -sfn "$steam_root/steamrtarm64" "$HOME/.steam/bin64"
ln -sfn "$steam_root/linuxarm64" "$HOME/.steam/sdk64"
# sdk64 is where x86_64 Steamworks looks for steamclient.so; arm64 builds look in sdkarm64.
ln -sfn "$steam_root/linux64" "$HOME/.steam/sdk64"
ln -sfn "$steam_root/linuxarm64" "$HOME/.steam/sdkarm64"
ln -sfn "$steam_root/steamrtarm64" "$HOME/.steam/binarm64"
ln -sfn "$steam_root/linux32" "$HOME/.steam/sdk32"
@@ -21,7 +21,11 @@ FEX_LAUNCHER = "droiddeck-fex-tool"
FEX_FILES = ("toolmanifest.vdf", "compatibilitytool.vdf", FEX_LAUNCHER)
FEX_APPID = "3127680"
SNIPER_APPID = "1628350"
FEX_DEPENDENCIES = (FEX_APPID, SNIPER_APPID)
SLR4_APPID = "4183110"
FEX_DEPENDENCIES = (FEX_APPID, SNIPER_APPID, SLR4_APPID)
REQUIRED_TOOLS = (PROTON_ARM64_APPID,) + FEX_DEPENDENCIES
FULLY_INSTALLED = 4
UPDATE_REQUIRED = 2
REQUEST_HANDOFF_SECONDS = 30
PLAYABLE_TYPES = frozenset(("game", "demo", "application", "beta"))
COMPAT_DIR = os.path.join(os.environ.get("HOME", "/root"), ".local", "share", "droiddeck-compat")
@@ -850,6 +854,36 @@ def native_targets(steam_root, apps):
return targets
def app_manifest(steam_root, app):
for library in libraries(steam_root):
try:
with open(os.path.join(library, "steamapps", "appmanifest_%s.acf" % app), encoding="utf-8", errors="replace") as f:
return tokenize(f.read())
except OSError:
continue
return None
def manifest_flags(tokens):
for i in range(len(tokens) - 1):
if tokens[i].lower() == '"stateflags"':
value = tokens[i + 1].strip('"')
return int(value) if value.isdigit() else 0
return 0
def tool_downloads(steam_root):
"""(app, "install" or "update") for each tool the client has yet to install or bring up to date."""
wanted = []
for app in REQUIRED_TOOLS:
tokens = app_manifest(steam_root, app)
if tokens is None:
wanted.append((app, "install"))
elif not manifest_flags(tokens) & FULLY_INSTALLED or manifest_flags(tokens) & UPDATE_REQUIRED:
wanted.append((app, "update"))
return wanted
def fex_missing(steam_root):
missing = []
for app in FEX_DEPENDENCIES:
@@ -1174,6 +1208,21 @@ def steam_running():
return False
def game_running():
try:
pids = [p for p in os.listdir("/proc") if p.isdigit()]
except OSError:
return False
for pid in pids:
try:
with open("/proc/%s/cmdline" % pid, "rb") as f:
if b"\0SteamLaunch\0AppId=" in f.read():
return True
except OSError:
continue
return False
def live_helper_running(directory=None):
try:
with open(state_path("live.pid", directory)) as f:
@@ -1209,21 +1258,22 @@ def register_default(config_path, apps=(), protect=(), default=None, catalog=Non
default = state.get("default") if state.get("default") in names else TOOL
steam_root = os.path.dirname(os.path.dirname(os.path.abspath(config_path)))
overrides = requested_games(game_requests(directory), catalog)
native = native_targets(steam_root, set(apps) | set(picks))
managed = state.get("auto", {}).keys() if isinstance(state.get("auto"), dict) else ()
native_choices = state.get("native_choices", ())
native = native_targets(steam_root, set(apps) | set(picks) | set(managed) | set(native_choices))
if linux_tool != FEX_TOOL:
native = {app: linux_tool if tool == FEX_TOOL else tool for app, tool in native.items()}
changes, auto = plan_mapping(
current, apps, names, default, followers(state, current),
native, picks,
overrides, state.get("auto", {}).keys() if isinstance(state.get("auto"), dict) else (),
state.get("native", ()))
current, apps, names, default, followers(state, current), native, picks,
overrides, managed, native_choices)
for app, tool in changes.items():
set_mapping(tokens, mapping, app, tool)
text = serialize(tokens)
if text != serialize(tokenize(original)):
write_changed(config_path, text)
state["auto"] = {app: tool for app, tool in auto.items() if tool is not NATIVE_CHOICE}
state["native"] = sorted(app for app, tool in auto.items() if tool is NATIVE_CHOICE)
state["native_choices"] = sorted(app for app, tool in auto.items() if tool is NATIVE_CHOICE)
state.pop("native", None)
state["tools"] = catalog
state.setdefault("default", default)
write_json(state_path("state.json", directory), state)