mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-23 06:46: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
@@ -54,6 +54,7 @@ class FakeSocket {
|
||||
state.authed = dec.decode(h[40][0]) === "secret" && dec.decode(body[1][0]) === "secret";
|
||||
result = state.authed ? 1 : 5;
|
||||
} else if (!state.authed) result = 5;
|
||||
else if (method === "CompatManager.GetCompatTools#1" && ["16", "128"].includes(String(body[1][0]))) result = Number(body[1][0]);
|
||||
else if (method === "CompatManager.GetCompatTools#1") {
|
||||
const app = String(body[1] ? body[1][0] : 0n);
|
||||
for (const name of state.known) { const t = []; lenField(1, enc.encode(name), t); lenField(2, enc.encode(name + " shown"), t); lenField(1, t, out); }
|
||||
@@ -79,17 +80,19 @@ const install = require("fs").readFileSync(process.argv[4], "utf8");
|
||||
const before = await c.get(0);
|
||||
await c.set(0, "droiddeck-proton-11-arm64");
|
||||
await c.set(42, "");
|
||||
const after = await c.many(["0", "42", "43"]);
|
||||
const after = await c.many(["0", "42", "43", "128"]);
|
||||
const timedOut = await c.many(["0", "16"]).then(() => null, (e) => e.eresult);
|
||||
await new Promise((r) => setTimeout(r, 10));
|
||||
console.log(JSON.stringify({ before, after, log: state.log, notify: state.notify, url: state.socket.url }));
|
||||
console.log(JSON.stringify({ before, after, timedOut, log: state.log, notify: state.notify, url: state.socket.url }));
|
||||
})().catch((e) => { console.error(e.stack || String(e)); process.exit(1); });
|
||||
"""
|
||||
|
||||
|
||||
class FakePage:
|
||||
def __init__(self, mapping, known):
|
||||
def __init__(self, mapping, known, refused=()):
|
||||
self.mapping = dict(mapping)
|
||||
self.known = list(known)
|
||||
self.refused = set(refused)
|
||||
self.sets = []
|
||||
|
||||
def compat(self, call):
|
||||
@@ -98,8 +101,10 @@ class FakePage:
|
||||
if name == "get":
|
||||
return {"selected": self.mapping.get(str(args[0]), ""), "fallback": "proton_experimental", "tools": self.known}
|
||||
if name == "many":
|
||||
return {app: self.mapping.get(app, "") for app in args[0]}
|
||||
return {app: self.mapping.get(app, "") for app in args[0] if app not in self.refused}
|
||||
if name == "set":
|
||||
if str(args[0]) in self.refused:
|
||||
raise RuntimeError("SpecifyCompatTool %s failed (128)" % args[0])
|
||||
self.mapping[str(args[0])] = args[1]
|
||||
self.sets.append((str(args[0]), args[1]))
|
||||
return True
|
||||
@@ -202,6 +207,7 @@ assert.deepStrictEqual(calls, [['611670', 'custom args', -1, 100], ['2508200', '
|
||||
self.assertEqual(out["url"], "ws://127.0.0.1:4242/transportsocket/")
|
||||
self.assertEqual(out["before"], {"selected": TOOL, "fallback": "proton_experimental", "tools": [TOOL, TOOL_11, "proton_experimental"]})
|
||||
self.assertEqual(out["after"], {"0": TOOL_11, "42": "", "43": ""})
|
||||
self.assertEqual(out["timedOut"], 16)
|
||||
self.assertEqual(out["log"], ["0=" + TOOL_11, "42="])
|
||||
self.assertEqual(out["notify"], ["1", "2"])
|
||||
|
||||
@@ -264,6 +270,21 @@ class ReconcileTest(unittest.TestCase):
|
||||
self.assertTrue(state["live"])
|
||||
self.assertEqual(self.helper.installed, ["10", "11"])
|
||||
|
||||
def test_an_app_the_client_refuses_is_dropped_instead_of_failing_the_sync(self):
|
||||
page = FakePage({"0": TOOL, "10": TOOL, "11": "proton_experimental"}, [TOOL, TOOL_11], refused={"1628350"})
|
||||
(self.state / "state.json").write_text(json.dumps({"default": TOOL, "auto": {"10": TOOL, "1628350": TOOL}}))
|
||||
(self.state / "games.json").write_text(json.dumps({"version": 1, "games": {"1628350": {"valve": True, "dir": "Proton 11.0 (ARM64)"}}}))
|
||||
state = self.reconcile(page)
|
||||
self.assertEqual(page.sets, [("11", TOOL)])
|
||||
self.assertEqual(state["auto"], {"10": TOOL, "11": TOOL})
|
||||
|
||||
def test_a_refused_apps_native_choice_is_kept(self):
|
||||
page = FakePage({"0": TOOL, "10": TOOL, "11": TOOL}, [TOOL, TOOL_11], refused={"20"})
|
||||
(self.state / "state.json").write_text(json.dumps({"default": TOOL, "auto": {"10": TOOL, "11": TOOL}, "native_choices": ["20"]}))
|
||||
state = self.reconcile(page)
|
||||
self.assertEqual(page.sets, [])
|
||||
self.assertEqual(state["native_choices"], ["20"])
|
||||
|
||||
def test_app_request_moves_the_default_and_followers(self):
|
||||
page = FakePage({"0": TOOL, "10": TOOL, "11": "GE-Proton11-7"}, [TOOL, TOOL_11])
|
||||
(self.state / "state.json").write_text(json.dumps({"default": TOOL, "auto": {"10": TOOL}}))
|
||||
|
||||
Reference in new issue
Block a user