fix(native): controllers reach Steam and the install-script evaluator no longer blocks game moves

This commit is contained in:
Kurt Himebauch committed 2026-11-08 23:37:57 -05:00
1 parent b835ecbe28
commit c50d424e92
5 files changed
+18 -1

No files matched your search

+9 -1
View File
@@ -2311,7 +2311,15 @@ __attribute__((visibility("hidden"))) static bool is_deck_sysfs_path(const char
if (!path) return false;
if (!strncmp(path, "/sys/devices/droiddeck", 22) || !strncmp(path, "/sys/class/hidraw", 17)) return true;
const char *listing = deck_listing_dir();
return listing && !strncmp(path, listing, strlen(listing));
if (!listing) return false;
if (!strncmp(path, listing, strlen(listing))) return true;
// Without proot, a descriptor's /proc/self/fd link names the stand-in where it really is (the
// listing's parent holds devices/ and class-hidraw/), not /sys
const char *slash = strrchr(listing, '/');
if (!slash || slash == listing) return false;
size_t root = static_cast<size_t>(slash - listing);
return !strncmp(path, listing, root) && path[root] == '/' &&
(!strncmp(path + root, "/devices", 8) || !strncmp(path + root, "/class-hidraw", 13));
}
__attribute__((visibility("hidden"))) static bool is_deck_sysfs_fd(int fd) {
@@ -1147,6 +1147,10 @@ def main():
if scripts and install_scripts_done(scripts, env):
print("droiddeck-game-env: install scripts already run in this prefix; evaluator skipped", file=sys.stderr)
return 0
if scripts and not env.get("DBUS_SESSION_BUS_ADDRESS"):
# libdbus would autolaunch a session bus under the evaluator's reaper, which then waits for it
# forever: Steam keeps seeing the app as running and cannot move or update it
env["DBUS_SESSION_BUS_ADDRESS"] = "disabled:"
try:
digest = scripts_digest(scripts) if scripts else None
except OSError:
+2
View File
@@ -13,6 +13,7 @@ int faccessat(int dirfd, const char *pathname, int mode, int flags) {
errno = EFAULT;
return -1;
}
DDNATV_AT_REMAP(dirfd, pathname);
struct stat st;
int stat_flags = (flags & AT_SYMLINK_NOFOLLOW) ? AT_SYMLINK_NOFOLLOW : 0;
@@ -328,6 +329,7 @@ ssize_t readlinkat(int dirfd, const char *pathname, char *buf, size_t bufsiz) {
}
static ssize_t (*orig_readlinkat)(int, const char *, char *, size_t) = NULL;
if (!orig_readlinkat) orig_readlinkat = (ssize_t (*)(int, const char *, char *, size_t))dlsym(RTLD_NEXT, "readlinkat");
DDNATV_AT_REMAP(dirfd, pathname);
char pbuf[PATH_MAX];
const char *target = (pathname && pathname[0] == '/') ? rewrite_path(pathname, pbuf, sizeof(pbuf)) : pathname;
ssize_t ret = orig_readlinkat ? orig_readlinkat(dirfd, target, buf, bufsiz) : -1;
+3
View File
@@ -121,6 +121,7 @@ int openat(int dirfd, const char *pathname, int flags, ...) {
static int (*orig_openat)(int, const char *, int, ...) = NULL;
if (!orig_openat) orig_openat = (int (*)(int, const char *, int, ...))dlsym(RTLD_NEXT, "openat");
init_ddnatv_hook();
DDNATV_AT_REMAP(dirfd, pathname);
char exe_buf[PATH_MAX];
if (is_proc_self_exe(pathname)) {
if (g_real_exe[0] != '\0') {
@@ -513,6 +514,7 @@ int lstat(const char *pathname, struct stat *statbuf) {
int fstatat(int dirfd, const char *pathname, struct stat *statbuf, int flags) {
static int (*orig_fstatat)(int, const char *, struct stat *, int) = NULL;
if (!orig_fstatat) orig_fstatat = (int (*)(int, const char *, struct stat *, int))dlsym(RTLD_NEXT, "fstatat");
DDNATV_AT_REMAP(dirfd, pathname);
char buf[PATH_MAX];
const char *target = (pathname && pathname[0] == '/') ? rewrite_path(pathname, buf, sizeof(buf)) : pathname;
int ret = orig_fstatat ? orig_fstatat(dirfd, target, statbuf, flags) : -1;
@@ -607,6 +609,7 @@ int statx(int dirfd, const char *pathname, int flags, unsigned int mask, struct
__asm__ volatile("" : "+r"(pathname), "+r"(statxbuf));
static int (*orig_statx)(int, const char *, int, unsigned int, struct statx *) = NULL;
if (!orig_statx) orig_statx = (int (*)(int, const char *, int, unsigned int, struct statx *))dlsym(RTLD_NEXT, "statx");
DDNATV_AT_REMAP(dirfd, pathname);
char buf[PATH_MAX];
const char *target = (pathname && pathname[0] == '/') ? rewrite_path(pathname, buf, sizeof(buf)) : pathname;
int ret = orig_statx ? orig_statx(dirfd, target, flags, mask, statxbuf) : -1;
Binary file not shown.