diff --git a/app/src/main/cpp/fakeinput_steam.cpp b/app/src/main/cpp/fakeinput_steam.cpp index 9558d780c..f67515ba6 100644 --- a/app/src/main/cpp/fakeinput_steam.cpp +++ b/app/src/main/cpp/fakeinput_steam.cpp @@ -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(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) { diff --git a/tools/linuxfs/overlay/usr/local/bin/droiddeck-game-env b/tools/linuxfs/overlay/usr/local/bin/droiddeck-game-env index 9fb3c39c6..e382dfd87 100755 --- a/tools/linuxfs/overlay/usr/local/bin/droiddeck-game-env +++ b/tools/linuxfs/overlay/usr/local/bin/droiddeck-game-env @@ -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: diff --git a/tools/nativeguest/hook/fileops.c b/tools/nativeguest/hook/fileops.c index fdad4e024..7913a281d 100644 --- a/tools/nativeguest/hook/fileops.c +++ b/tools/nativeguest/hook/fileops.c @@ -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; diff --git a/tools/nativeguest/hook/files.c b/tools/nativeguest/hook/files.c index 1643f988d..0e5ee1a08 100644 --- a/tools/nativeguest/hook/files.c +++ b/tools/nativeguest/hook/files.c @@ -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; diff --git a/tools/nativeguest/hook/paths.c b/tools/nativeguest/hook/paths.c index 79d9746c2..8a5c2a322 100644 Binary files a/tools/nativeguest/hook/paths.c and b/tools/nativeguest/hook/paths.c differ