Merge latest origin/main and resolve conflicts

This commit is contained in:
DroidDeck Merge committed 2026-11-02 10:44:24 +08:00
commit 8171bf20fd
581 files changed
+14773 -4227

No files matched your search

-3
View File
@@ -29,15 +29,12 @@ int main(void) {
assert(cursor_scene_positions(3840, CARDBOARD_SOURCE_SBS, 1920, 0, out) == 2);
assert(out[0] == 1920 && out[1] == 0);
/* A hotspot that pushes the image across the seam must not move the mirror to the
* other eye: the pointer decides the eye, the hotspot only shifts the image. */
assert(cursor_scene_positions(1920, CARDBOARD_SOURCE_SBS, 960, 32, out) == 2);
assert(out[0] == 928 && out[1] == -32);
assert(cursor_scene_positions(1920, CARDBOARD_SOURCE_SBS, 959, 32, out) == 2);
assert(out[0] == 927 && out[1] == 1887);
/* Each copy is cropped to its own eye, so nothing bleeds into the other eye's half. */
assert(cursor_clip_to_eye(1920, -1, 100, 32, &dx, &sx, &dw) == 1);
assert(dx == 100 && sx == 0 && dw == 32);
+56
View File
@@ -0,0 +1,56 @@
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include "kgsl_busy.h"
#define ENTRIES 819
static uint32_t memstore[ENTRIES * KGSL_BUSY_ENTRY_WORDS];
static void stamp(int entry, uint32_t sop, uint32_t eop) {
memstore[entry * KGSL_BUSY_ENTRY_WORDS + KGSL_BUSY_SOP] = sop;
memstore[entry * KGSL_BUSY_ENTRY_WORDS + KGSL_BUSY_EOP] = eop;
}
int main(void) {
assert(kgsl_busy_first_slot(8 * 4096) == 813);
assert(kgsl_busy_first_slot(8 * 16384) == 3270);
assert(kgsl_busy_first_slot(7 * 40) == -1);
int first = kgsl_busy_first_slot(sizeof(memstore));
uint32_t last[KGSL_BUSY_SLOTS] = {0};
int moved = 0;
stamp(first, 100, 100);
stamp(first + 2, 7, 7);
assert(kgsl_busy_sample(memstore, first, last, &moved) == 0);
assert(moved == 1 && last[0] == 100 && last[2] == 7);
moved = 0;
assert(kgsl_busy_sample(memstore, first, last, &moved) == 0);
assert(moved == 0);
stamp(first + 2, 8, 7);
assert(kgsl_busy_sample(memstore, first, last, &moved) == 1);
assert(moved == 1);
moved = 0;
stamp(first + 2, 8, 8);
assert(kgsl_busy_sample(memstore, first, last, &moved) == 0);
assert(moved == 0);
stamp(first + 4, 3, 2);
assert(kgsl_busy_sample(memstore, first, last, &moved) == 1);
memset(memstore, 0, sizeof(memstore));
stamp(first - 1, 5, 4);
stamp(first + KGSL_BUSY_SLOTS, 9, 8);
memset(last, 0, sizeof(last));
moved = 0;
assert(kgsl_busy_sample(memstore, first, last, &moved) == 0);
assert(moved == 0);
puts("PASS: kgsl memstore busy");
return 0;
}
-2
View File
@@ -23,8 +23,6 @@ static void wl_pointer_send_button(struct wl_resource *r, uint32_t serial,
r->held &= ~(1u << (button - 0x110));
r->releases++;
}
/* The old dispatcher calls this even for releases, emitting stale coordinates.
* Recording this boundary detects that unwanted motion/focus routing path. */
static void pointer_input(double x, double y, int relative, uint32_t button, int pressed) {
assert(x == 0 && y == 0 && relative == 1 && button >= 0x110 && button <= 0x112);
assert(pressed == 1);
-1
View File
@@ -1,4 +1,3 @@
"""Single-core Steam affinity is rechecked even if its thread count stayed the same."""
import subprocess
import tempfile
import unittest
-1
View File
@@ -1,4 +1,3 @@
"""Exercise the compositor's real cursor placement rule for glasses output."""
import os
from pathlib import Path
import re
-1
View File
@@ -316,7 +316,6 @@ class GameFolderTest(Temp):
def appinfo(apps):
"""appinfo.vdf as the client writes it (format 29: keys in a string table)."""
strings = []
def key(name):
-3
View File
@@ -1,4 +1,3 @@
"""The guest agent: its request files, exec, errors and the DevTools client, without a session."""
import base64
import hashlib
import importlib.machinery
@@ -26,7 +25,6 @@ loader.exec_module(agent)
class FakeDevTools(threading.Thread):
"""GET /json lists one target; its WebSocket answers Runtime.evaluate the way Chromium does."""
def __init__(self, answer):
super().__init__(daemon=True)
@@ -857,7 +855,6 @@ class VrFocusTest(unittest.TestCase):
self.assertEqual(focus.order([42, 9, 7], [7, 42], None), [9, 7])
self.assertIsNone(focus.order([9, 7], [7], 42))
self.assertEqual(focus.order([9, 7], [7, 42], 42), [42, 9, 7])
# Do not overwrite a different focus order installed after our last write.
self.assertIsNone(focus.order([123, 7], [7, 42], None))
def test_scene_requires_live_server_and_game_environment(self):
+1 -5
View File
@@ -1,4 +1,3 @@
"""droiddeckctl and droiddeck-scenario against a fake adb: the JSON contract and exit codes."""
import base64
import contextlib
import importlib.machinery
@@ -88,8 +87,6 @@ def timestats_record(name, frames, histogram, hz):
f"present2present histogram is as below:\n{bins}\nlatch2present histogram is as below:\n8ms={frames}\n")
# A capture where the panel went from 60 to 120 Hz: the game layer is split in two records. The
# activity's own window and an unrelated app draw too, and must not count.
TIMESTATS_SPLIT = "SurfaceFlinger TimeStats:\ntotalFrames = 2000\n" + "".join([
timestats_record("droiddeck_wayland_game#6110", 900, {16: 700, 33: 199}, 60),
timestats_record("droiddeck_wayland_game#6110", 900, {16: 850, 25: 49}, 120),
@@ -99,7 +96,6 @@ TIMESTATS_SPLIT = "SurfaceFlinger TimeStats:\ntotalFrames = 2000\n" + "".join([
timestats_record("StatusBar#106", 1, {}, 60),
])
# A build that presents the game on the session's SurfaceView instead of a layer of its own.
TIMESTATS_SURFACEVIEW = "SurfaceFlinger TimeStats:\n" + "".join([
timestats_record("a1b2c3 SurfaceView[com.droiddeck.launcher/com.droiddeck.launcher.SessionActivity]#77",
1800, {16: 1796, 33: 3}, 120),
@@ -155,7 +151,7 @@ class DroiddeckctlTest(FakeAdbTest):
with unittest.mock.patch.dict(os.environ, {"DROIDDECK_PACKAGE": "com.antutu.benchmark.full"}):
variant = load("droiddeckctl")
self.assertEqual("content://com.antutu.benchmark.full.agent", variant.AUTHORITY)
with self.assertRaises(variant.ControlError): # the fake adb does not answer `am start`
with self.assertRaises(variant.ControlError):
variant.start_agent_activity(str(self.adb), "fake-1", {"mode": "steam"})
started = [e["args"] for e in self.calls() if e["args"][:3] == ["shell", "am", "start"]]
self.assertIn("com.antutu.benchmark.full/com.droiddeck.launcher.agent.AgentStartActivity", started[0])
-1
View File
@@ -1,4 +1,3 @@
"""The Quick Access Frame Limit follows the panel when its refresh rate changes."""
from pathlib import Path
import runpy
import subprocess
+32 -2
View File
@@ -246,7 +246,6 @@ class DirtTelemetryFixTest(unittest.TestCase):
class EgoCorePlanTest(unittest.TestCase):
"""DiRT 3's restrictions as shipped: plans for 2, 3, 4, 6 and 8+ cores, one core for anything else."""
@staticmethod
def rule(op, value, worker_map):
@@ -460,7 +459,6 @@ class GameDebugLoggingTest(unittest.TestCase):
result = launch([str(probe), verb], {**env, "STEAM_COMPAT_DATA_PATH": str(home / "compatdata" / prefix)})
self.assertEqual(result["env"]["PROTON_LOG"], "0")
self.assertEqual(result["env"]["WINEDEBUG"], "-all")
# Non-Steam shortcuts use the same normalized unsigned compatdata identity.
result = launch(command, {**env, "STEAM_COMPAT_DATA_PATH": str(home / "compatdata/-1")})
self.assertEqual(result["env"]["PROTON_LOG"], "1")
self.assertFalse((home / "never-created").exists())
@@ -884,6 +882,38 @@ class GameEnvironmentTest(unittest.TestCase):
(game / "D3DGear64.DLL").unlink()
self.assertEqual(MODULE["engine_fixes"](str(game / "TheCrew2.exe"), []), ({}, [], []))
def test_doom_2016_keeps_the_swapchain_image_count_it_asks_for(self):
with tempfile.TemporaryDirectory() as tmp:
game = Path(tmp) / "DOOM (2016)"
game.mkdir()
for name in ("DOOMx64.exe", "DOOMx64vk.exe", "Galaxy64.dll"):
(game / name).touch()
images = {
"GAMESCOPE_WSI_MIN_IMAGE_COUNT": None,
"GAMESCOPE_WSI_ENSURE_MIN_IMAGE_COUNT": None,
"vk_x11_strict_image_count": "true",
}
for exe in ("DOOMx64.exe", "DOOMx64vk.exe"):
env, extra, notes = MODULE["engine_fixes"](str(game / exe), [])
self.assertEqual((env, extra), (images, []))
self.assertTrue(notes)
launched = {"GAMESCOPE_WSI_MIN_IMAGE_COUNT": "8", "GAMESCOPE_WSI_ENSURE_MIN_IMAGE_COUNT": "1"}
result = MODULE["apply_config"](launched, {"version": 1}, "3566086475", env)
self.assertNotIn("GAMESCOPE_WSI_MIN_IMAGE_COUNT", result)
self.assertNotIn("GAMESCOPE_WSI_ENSURE_MIN_IMAGE_COUNT", result)
self.assertEqual(result["vk_x11_strict_image_count"], "true")
config = {"version": 1, "games": {"3566086475": {"GAMESCOPE_WSI_MIN_IMAGE_COUNT": "3"}}}
self.assertEqual(MODULE["apply_config"](launched, config, "3566086475", env)["GAMESCOPE_WSI_MIN_IMAGE_COUNT"], "3")
eternal = Path(tmp) / "DOOMEternal"
eternal.mkdir()
(eternal / "DOOMEternalx64vk.exe").touch()
self.assertEqual(MODULE["engine_fixes"](str(eternal / "DOOMEternalx64vk.exe"), []), ({}, [], []))
other = Path(tmp) / "Other"
other.mkdir()
for name in ("Other.exe", "DOOMx64vk.exe"):
(other / name).touch()
self.assertEqual(MODULE["engine_fixes"](str(other / "Other.exe"), []), ({}, [], []))
def test_dll_overrides_from_several_fixes_are_all_kept(self):
with tempfile.TemporaryDirectory() as tmp:
for name in ("Game.exe", "Game.pck", "GodotSharp.dll", "libsentry.windows.release.x86_64.dll", "d3dgear64.dll"):
-3
View File
@@ -106,9 +106,6 @@ def main():
surface = alloc()
send(comp, 0, U(surface))
if not args.unassigned_control:
# wlroots 0.20.2 assigns the cursor role before forwarding this serial
# to Gamescope, so zero avoids needing pointer focus but still tests the
# role guard in xwayland_surface_commit.
send(pointer, 0, U(0, surface, 0, 0))
roundtrip()
before = count()
+1 -1
View File
@@ -14,7 +14,7 @@ READER = ROOT / "app/src/main/cpp/waylandcomp/src/hudframes.c"
def patch_writer():
added = [line[1:] for line in PATCH.read_text().splitlines() if line.startswith("+") and not line.startswith("+++")]
text = "\n".join(added)
start = text.index("// DroidDeck's own HUD reads")
start = text.index("static constexpr uint32_t k_uDroidDeckHudFramesMagic")
end = text.index("\n}\n", text.index("static void publish_droiddeck_hud_info()", start)) + 3
return text[start:end]
+33
View File
@@ -0,0 +1,33 @@
"""Exercise the HUD's kgsl memstore busy sampling (app/src/main/cpp/gpuclock/kgsl_busy.h)."""
import os
from pathlib import Path
import shutil
import subprocess
import tempfile
import unittest
REPO = Path(__file__).resolve().parents[2]
class KgslBusyTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
compiler = shutil.which(os.environ.get('CC', 'cc'))
if compiler is None:
raise unittest.SkipTest('A host C compiler is required')
cls.temp = tempfile.TemporaryDirectory(prefix='droiddeck-kgsl-busy-')
cls.addClassCleanup(cls.temp.cleanup)
cls.binary = Path(cls.temp.name) / 'kgsl-busy-test'
subprocess.run([compiler, '-std=c11', '-Wall', '-Wextra', '-Werror',
'-I', str(REPO / 'app/src/main/cpp/gpuclock'),
str(REPO / 'tools/tests/kgsl_busy_harness.c'), '-o', str(cls.binary)],
check=True, capture_output=True, text=True)
def test_ringbuffer_slots_and_busy_rule(self):
result = subprocess.run([str(self.binary)], capture_output=True, text=True)
self.assertEqual(result.returncode, 0, result.stdout + result.stderr)
self.assertIn('PASS: kgsl memstore busy', result.stdout)
if __name__ == '__main__':
unittest.main()
-1
View File
@@ -19,7 +19,6 @@ ALL = set(range(8))
class FakeCores:
"""Per-thread masks and priorities, with every change recorded."""
def __init__(self):
self.state = {}
-1
View File
@@ -1,4 +1,3 @@
"""Real login1 sleep handshakes; run with dbus-run-session and python3-gi."""
import os
from pathlib import Path
import subprocess
-1
View File
@@ -10,7 +10,6 @@ COMPONENTS = runpy.run_path(str(BIN / "droiddeck-wincomponents"))
class FakePackage:
"""A package's tables in memory, as msiinfo would give them."""
def __init__(self, tables, summary=None):
self.path = "fake.msi"
-4
View File
@@ -1,7 +1,3 @@
"""NetworkManager contract and real D-Bus handovers (requires python3-gi and dbus).
Run on Linux: dbus-run-session -- python3 -m unittest discover -s tools/tests -p test_netmanager.py
"""
import importlib.machinery
import importlib.util
import json
-4
View File
@@ -9,8 +9,6 @@ import unittest
PRELOAD = Path(__file__).resolve().parents[1] / "linuxfs/preload"
FASTPATH = Path(__file__).resolve().parents[1] / "proot/fastpath/fastpath.c"
# Opens each "<dirfd>\t<flags>\t<path>" case with openat2(RESOLVE_IN_ROOT) as FEX does: first through the kernel's own
# openat2 on argv[1] when it has one, then, with openat2 failing ENOSYS as under proot, through the preload on argv[2].
PROGRAM = r"""
#define _GNU_SOURCE
#include <dlfcn.h>
@@ -225,7 +223,6 @@ int main(int argc, char **argv) {
O_PATH = getattr(os, "O_PATH", 0o10000000)
# (dirfd: r = the tree, o = "/"), flags, path, expected: a path in the tree, an errno name, or "proc" for a file outside it.
CASES = [
("r", os.O_RDONLY, "etc/alternatives/hn", "etc/hostname"),
("r", os.O_RDONLY, "/lib64/x86_64-linux-gnu/libfoo.so.1", "usr/lib/x86_64-linux-gnu/libfoo.so.1.2"),
@@ -256,7 +253,6 @@ CASES = [
("o", os.O_RDONLY, "proc/self/status", "proc"),
]
# Only the preload: an absolute link to a path missing in the tree but present outside it, as droiddeck-fex's rootfs has.
HOST_CASES = [
("r", os.O_RDONLY, "lib/x86_64-linux-gnu/libbar.so.2", "host:libbar.so.2"),
("r", os.O_RDONLY, "hostdir/sub/data", "host:sub/data"),
@@ -1,4 +1,3 @@
"""Test the renderer's actual map and inverse map without a Vulkan device."""
import os
from pathlib import Path
import shutil
-1
View File
@@ -1,4 +1,3 @@
"""Exercise the compositor's real button dispatcher with a recording Wayland sink."""
import os
from pathlib import Path
import shutil
-1
View File
@@ -30,7 +30,6 @@ class PreloadSnapshotTest(unittest.TestCase):
directory = tempfile.TemporaryDirectory()
self.addCleanup(directory.cleanup)
self.root = Path(directory.name)
# Real repository inputs exercise the transitive include walker and build recipe.
for group in snapshots.INPUTS:
for name in snapshots.source_files(group):
if name.startswith('@'):
-2
View File
@@ -10,8 +10,6 @@ ROOT = Path(__file__).resolve().parents[2]
@unittest.skipUnless(shutil.which('cc'), 'needs a C compiler')
class QuestBackdropTest(unittest.TestCase):
def test_first_frame_requires_client_content(self):
# Compile the real entrypoint with controlled layer outcomes, including the
# successful no-op that previously dismissed the loading UI on a black frame.
source = (ROOT / 'app/src/main/cpp/waylandcomp/src/vk_present.c').read_text()
start = source.index('\nint vkp_render(')
end = source.index('\nint vkp_render_hdr(', start)
-1
View File
@@ -1,4 +1,3 @@
"""Exercise the Windows launcher without building an APK or contacting a phone."""
import os
from pathlib import Path
import shutil
@@ -1,4 +1,3 @@
"""Gamescope composites the cursor only when a Steam session asks for it."""
import os
from pathlib import Path
import re
@@ -1,9 +1,3 @@
"""Exercise the literal launch prefix from SessionService without an Android runtime.
This is a focused source/exec regression check, not a Kotlin or PRoot integration
test. PRoot executes the first guest argument directly; KEY=VALUE is meaningful
only after /usr/bin/env. Read the production prefix rather than duplicate it.
"""
import json
from pathlib import Path
import re
-1
View File
@@ -1,4 +1,3 @@
"""Steam owns game caps; the nested compositor follows the output refresh rate."""
import os
from pathlib import Path
import subprocess
-2
View File
@@ -9,8 +9,6 @@ PACKAGE = 'com.droiddeck.launcher'
class SignApkRenamesTest(unittest.TestCase):
def test_variants_rename_every_authority_and_task_named_after_the_package(self):
# sign-apk.sh renames a fixed list of names for the pubg/antutu/ludashi variants and fails the
# main build on any authority or task affinity it leaves on the base package; PR builds do not sign.
manifest = (ROOT / 'app/src/main/AndroidManifest.xml').read_text()
names = set()
for attribute in ('authorities', 'taskAffinity'):
-2
View File
@@ -1,4 +1,3 @@
"""Retry a dropped shortcut without duplicating a launch that is still preparing its first window."""
import os
from pathlib import Path
import subprocess
@@ -29,7 +28,6 @@ class SteamColdLaunchTest(unittest.TestCase):
self.agent_count = self.root / "agent-count"
self.focus_count = self.root / "focus-count"
# FOCUS lists the focused app per xprop call; the last value repeats.
xprop = self.bin / "xprop"
xprop.write_text(
"#!/bin/sh\n"
-4
View File
@@ -50,14 +50,12 @@ CONFIG = '''"InstallConfigStore"
class X64RepointTest(unittest.TestCase):
"""steam-compatibility --x64: the x86-64 client's Proton entries go to its arm64 wrapper."""
def setUp(self):
self.home = tempfile.TemporaryDirectory()
self.root = Path(self.home.name) / "Steam"
(self.root / "config").mkdir(parents=True)
(self.root / "config" / "config.vdf").write_text(CONFIG)
# A wrapper of its own whose name starts with "proton": kept, never repointed.
own = self.root / "compatibilitytools.d" / "proton-cachyos-a64"
own.mkdir(parents=True)
(own / "compatibilitytool.vdf").write_text('"compatibilitytools"\n{\n\t"compat_tools"\n\t{\n\t\t"proton-cachyos-a64"\n\t\t{\n\t\t}\n\t}\n}\n')
@@ -82,12 +80,10 @@ class X64RepointTest(unittest.TestCase):
self.assertEqual(m["550"], "GE-Proton11-7-a64")
self.assertEqual(m["620"], "proton-cachyos-a64")
self.assertEqual(m["730"], "steamlinuxruntime")
# The arm64 client's own Proton name, which this client ignores.
self.assertEqual(m["880"], "GE-Proton11-7-a64")
self.assertEqual(m["0"], "GE-Proton11-7-a64")
def test_repoints_arm64_name_even_with_its_stray_tool(self):
# An arm64 compat pass that ran against this client also left its tool folder here.
stray = self.root / "compatibilitytools.d" / "droiddeck-proton-arm64"
stray.mkdir(parents=True)
(stray / "compatibilitytool.vdf").write_text('"compatibilitytools"\n{\n\t"compat_tools"\n\t{\n\t\t"droiddeck-proton-arm64"\n\t\t{\n\t\t}\n\t}\n}\n')
+24 -1
View File
@@ -1,4 +1,3 @@
"""Desktop Steam stays on KDE; explicit Big Picture still switches sessions."""
import fcntl
import os
from pathlib import Path
@@ -92,6 +91,30 @@ class DesktopSteamLaunchTest(unittest.TestCase):
'-cef-disable-gpu', 'steam://open/settings'])
self.assertFalse((self.session / 'steam-launch').exists())
def _running_client(self):
steam = self.root / 'data/Steam/steamrtarm64/steam'
steam.parent.mkdir(parents=True)
steam.write_text('#!/bin/bash\nprintf "%s\\n" "$@"\n')
steam.chmod(0o755)
(self.root / '.steam').mkdir()
os.mkfifo(self.root / '.steam/steam.pipe')
(self.root / '.steam/steam.pid').write_text(str(os.getpid()))
def test_bottom_screen_desktop_hands_games_to_the_running_client(self):
self._running_client()
self.env['BL_BOTTOM_DESKTOP'] = '1'
result = self.launch('desktop', '501590')
self.assertEqual(result.returncode, 0, result.stderr)
self.assertEqual(result.stdout.splitlines(), ['-nobigpicture', '-no-cef-sandbox', '-cef-ozone-platform=x11',
'-cef-disable-gpu', 'steam://rungameid/501590'])
self.assertFalse((self.root / 'cache/droiddeck/steam-desktop.lock').exists())
def test_bottom_screen_desktop_starts_its_own_client_when_none_runs(self):
self.env.update(BL_BOTTOM_DESKTOP='1', DISPLAY=':7')
result = self.launch('desktop')
self.assertEqual(result.returncode, 0, result.stderr)
self.assertEqual(result.stdout.splitlines(), ['1', 'desktop', ':7', 'steam', 'steam://open/library'])
def test_second_click_forwards_to_the_x86_64_client_in_its_own_home(self):
lock = self.root / 'cache/droiddeck/steam-desktop.lock'
lock.parent.mkdir(parents=True)
-2
View File
@@ -280,8 +280,6 @@ done(28 if end < len(data) else 0)
self.assertFalse(self.requests.exists())
def publish(self, **parts):
"""The CDN's client as these parts (block name -> byte count of incompressible content),
listed with sizes as Valve's manifest lists them."""
files = {}
blocks = ''
for block, length in parts.items():
+14
View File
@@ -90,6 +90,20 @@ class LibraryListTest(unittest.TestCase):
self.assertIn(self.pc, self.paths(self.run_main()))
self.assertIn(self.card, self.paths(self.vdf.read_text()))
def test_added_library_is_registered_while_listed_and_forgotten_once_removed(self):
added = self.root / "lib" / "1"
manifest(added / "steamapps", 20)
with patch.object(library, "ADDED_DIR", str(self.root / "lib") + "/"):
self.listing.write_text(json.dumps([{"path": str(added), "label": "Documents"}]))
text = self.run_main()
self.assertIn(added, self.paths(text))
self.assertIn('"20"\t\t"0"', text)
self.listing.write_text(json.dumps([]))
text = self.run_main()
self.assertNotIn(added, self.paths(text))
self.assertIn(self.user, self.paths(text))
self.assertTrue((added / "steamapps/appmanifest_20.acf").is_file())
def test_without_a_list_only_the_card_is_managed(self):
text = self.run_main(listing=False)
self.assertEqual([self.steam, self.old, self.user, self.card], self.paths(text))
+54
View File
@@ -0,0 +1,54 @@
from pathlib import Path
import runpy
import shutil
import subprocess
import tempfile
import unittest
BIN = Path(__file__).resolve().parents[1] / "linuxfs/overlay/usr/local/bin"
LIVE = runpy.run_path(str(BIN / "droiddeck-steam-compat"))
HARNESS = """
const reports = [];
global.appStore = {
BHasCachedLibraryAsset(appid, version, type) {
if ((version ?? 0) & (1 << type)) return true;
reports.push([appid, type]);
return false;
},
};
const first = eval(process.argv[2]);
const second = eval(process.argv[2]);
const check = (name, actual, expected) => { if (actual !== expected) throw new Error(name + ": " + actual); };
check("install", first, "installed");
check("reinstall", second, "present");
check("no logon", appStore.BHasCachedLibraryAsset(10, undefined, 3), true);
check("zero version", appStore.BHasCachedLibraryAsset(10, 0, 3), true);
check("reported", reports.length, 2);
check("bit set", appStore.BHasCachedLibraryAsset(10, 1 << 3, 3), true);
check("bit missing", appStore.BHasCachedLibraryAsset(10, 1 << 2, 3), false);
check("reported again", reports.length, 3);
"""
@unittest.skipUnless(shutil.which("node"), "node is not installed")
class LibraryArtTest(unittest.TestCase):
def run_node(self, harness):
with tempfile.TemporaryDirectory() as directory:
script = Path(directory, "harness.js")
script.write_text("global.window = {};\n" + harness)
return subprocess.run(["node", str(script), LIVE["LIBRARY_ART_JS"]], capture_output=True, text=True, timeout=20)
def test_apps_without_a_client_cache_report_read_from_the_local_library_cache(self):
result = self.run_node(HARNESS)
self.assertEqual(result.returncode, 0, result.stderr)
def test_a_page_without_the_app_store_is_left_alone(self):
result = self.run_node("""
if (eval(process.argv[2]) !== "unavailable") throw new Error("installed without an app store");
""")
self.assertEqual(result.returncode, 0, result.stderr)
if __name__ == "__main__":
unittest.main()
-3
View File
@@ -1,6 +1,3 @@
"""droiddeck-store-launch: a launch from anywhere - the Steam client's own Play button included -
asks the app for an Epic game's sign-in code before Proton starts. These pin how it recognises a
store game, how it asks, and that both Proton launchers call it."""
import importlib.machinery
import importlib.util
import json
-5
View File
@@ -1,6 +1,3 @@
"""The shortcuts writer and a store install: the app registers a game GOG, Epic or Amazon
installed through the same listing as an added folder, pointing the shortcut at the game's
launcher .bat when it has one. These pin the parts of the writer that contract relies on."""
import importlib.machinery
import importlib.util
import json
@@ -28,8 +25,6 @@ LAUNCHER = FOLDER + '/.droiddeck-launch.bat'
def app_id(exe, name):
"""The appid the app computes for a shortcut (AddedGames.scanGame): CRC32 of the quoted exe
and the name, high bit set - what Steam itself derives for a shortcut it is given."""
return (zlib.crc32(('"%s"' % exe + name).encode()) | 0x80000000) & 0xFFFFFFFF
-2
View File
@@ -12,7 +12,6 @@ TERMUX_DIR = TESTS.parents[1] / "app/src/main/cpp/termux"
def jni_include_dir():
"""A directory holding jni.h: JNI_INCLUDE, then the JDK, then the Android NDK."""
candidates = [os.environ.get("JNI_INCLUDE")]
java_home = os.environ.get("JAVA_HOME")
if java_home:
@@ -29,7 +28,6 @@ def jni_include_dir():
def include_flags():
"""-I flags for jni.h, plus the JDK's per-platform directory that holds jni_md.h."""
base = jni_include_dir()
flags = ["-I", base]
for sub in glob.glob(os.path.join(base, "*")):
@@ -8,7 +8,6 @@ import unittest
PRELOAD = Path(__file__).resolve().parents[1] / "linuxfs/preload"
# Stands in for libfakeinput.so, which ld.so.preload lists after libblsession.so.
SHIM = r"""
#include <linux/input.h>
#include <stdarg.h>