mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-26 00:06:02 +00:00
fix: native Linux games under FEX reach FEXServer, and a refused compat app no longer loops the sync (#1213)
FEX launched through a script (Valve's _v2-entry-point) was judged 32-bit, so the fast path stayed off in the FEX client while FEXServer bound its socket through it. The fast path now follows #! lines before judging the program. The live compat sync drops apps the client refuses GetCompatTools for instead of reattaching forever.
This commit is contained in:
1 parent
1f71cbd117
commit
1e33eee3f2
3 files changed
+67
-13
No files matched your search
@@ -141,6 +141,27 @@ static int traced_by_match(const char *key) {
|
||||
return found;
|
||||
}
|
||||
|
||||
static int program_32bit(const char *prog, int scripts) {
|
||||
char head[256];
|
||||
long fd = syscall(SYS_openat, AT_FDCWD, prog, O_RDONLY | O_CLOEXEC);
|
||||
if (fd < 0) return 1;
|
||||
long n = syscall(SYS_read, fd, head, sizeof head - 1);
|
||||
syscall(SYS_close, fd);
|
||||
if (n < 0) return 1;
|
||||
head[n] = 0;
|
||||
if (n >= 2 && head[0] == '#' && head[1] == '!') {
|
||||
if (scripts <= 0) return 1;
|
||||
char *p = head + 2;
|
||||
while (*p == ' ' || *p == '\t') p++;
|
||||
char *e = p;
|
||||
while (*e && *e != ' ' && *e != '\t' && *e != '\n' && *e != '\r') e++;
|
||||
if (e == p || (!*e && n == (long)sizeof head - 1)) return 1;
|
||||
*e = 0;
|
||||
return program_32bit(p, scripts - 1);
|
||||
}
|
||||
return !(n >= 5 && memcmp(head, "\x7f" "ELF", 4) == 0 && head[4] == 2);
|
||||
}
|
||||
|
||||
static int fex_runs_32bit(void) {
|
||||
if (strcmp(program_invocation_short_name, "FEX") != 0 && strcmp(program_invocation_short_name, "FEXInterpreter") != 0)
|
||||
return 0;
|
||||
@@ -153,12 +174,7 @@ static int fex_runs_32bit(void) {
|
||||
args[n] = 0;
|
||||
const char *prog = args + strlen(args) + 1;
|
||||
if (prog >= args + n || !*prog) return 1;
|
||||
unsigned char ident[5];
|
||||
fd = syscall(SYS_openat, AT_FDCWD, prog, O_RDONLY | O_CLOEXEC);
|
||||
if (fd < 0) return 1;
|
||||
n = syscall(SYS_read, fd, ident, sizeof ident);
|
||||
syscall(SYS_close, fd);
|
||||
return !(n == 5 && memcmp(ident, "\x7f" "ELF", 4) == 0 && ident[4] == 2);
|
||||
return program_32bit(prog, 4);
|
||||
}
|
||||
|
||||
static int in_tracer(struct bind *bd) {
|
||||
|
||||
Reference in new issue
Block a user