feat: ship proot, DirectAudio, Xbox, Comet and hand tracking as CI-built add-on packs (#1198)

* perf: download hand tracking models and native libs on first use

* feat: build and publish add-on packs in CI, add Xbox and Comet packs

* feat: ship proot and DirectAudio drivers as CI-built packs

* test: hand tracking readiness requires the tracking pack

* ci: attach PR test-build packs to the PR release instead of Components
This commit is contained in:
Kurt Himebauch authored and GitHub committed 2026-10-20 11:18:44 -04:00
1 parent ece1df0da8
commit 61254786e6
72 files changed
+710 -112

No files matched your search

+2 -2
View File
@@ -61,9 +61,9 @@ def build(full, lite, palm, output):
if __name__ == '__main__':
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('--full', type=Path, default=Path('app/src/main/assets/models/hand_landmarker.task'))
parser.add_argument('--full', type=Path, required=True)
parser.add_argument('--lite', type=Path, required=True, help='Pinned hand_landmark_lite.tflite from storage.googleapis.com/mediapipe-assets/')
parser.add_argument('--palm', type=Path, required=True, help='Pinned palm_detection_lite.tflite from storage.googleapis.com/mediapipe-assets/')
parser.add_argument('--output', type=Path, default=Path('app/src/main/assets/models/hand_landmarker_lite.task'))
parser.add_argument('--output', type=Path, required=True)
args = parser.parse_args()
build(args.full, args.lite, args.palm, args.output)
+1
View File
@@ -364,6 +364,7 @@ if ! restore_step comet "${comet_key}" "${comet_out}"; then
DROIDDECK_BUILD_IMAGE="${image_name}" bash tools/comet/build-local.sh
save_step comet "${comet_key}" "${comet_out}"
fi
bash tools/packs/build.sh app/build/packs
python3 tools/release/runtime_inputs.py record
./gradlew "${gradle_task}" --console=plain -PndkVersion="${ndk_version}" ${gradle_rust_arg}
python3 tools/release/check_session_assets.py "app/build/outputs/apk/${build_variant}/app-${build_variant}.apk"
+92
View File
@@ -0,0 +1,92 @@
#!/usr/bin/env bash
# Builds the add-on packs the app downloads on first use instead of shipping in the APK:
# proot.tar.zst the patched proot and its loader (built by tools/proot)
# directaudio.tar.zst the Wine DirectAudio drivers (fetched by tools/directaudio/fetch.sh)
# tracking.tar.zst hand-tracking models and the OpenCV/MediaPipe native libraries
# xbox.tar.zst the Xbox backend (built by tools/xbox) for /usr/local/lib/droiddeck-xbox
# comet.tar.zst the GOG Galaxy companion (built by tools/comet) for /usr/local/lib/droiddeck-comet
# Only CI publishes these (.github/workflows/publish-packs.yml); the APK built from the same
# directory pins each pack's SHA-256.
# Usage: tools/packs/build.sh <out-dir>
set -euo pipefail
here=$(cd "$(dirname "$0")" && pwd)
repo=$(cd "$here/../.." && pwd)
out=${1:?usage: build.sh <out-dir>}
mkdir -p "$out"
out=$(cd "$out" && pwd)
linuxfs="$repo/app/src/main/assets/linuxfs/usr/local/lib"
# shellcheck source=tracking/release.env
source "$here/tracking/release.env"
work=$(mktemp -d)
trap 'rm -rf "$work"' EXIT
sha256() { if command -v sha256sum >/dev/null; then sha256sum "$1" | cut -d' ' -f1; else shasum -a 256 "$1" | cut -d' ' -f1; fi; }
fetch() {
local url=$1 expected=$2 dest=$3
curl -fsSL --retry 4 -o "$dest" "$url"
local actual
actual=$(sha256 "$dest")
if [ "$actual" != "$expected" ]; then
echo "checksum mismatch for $url: $actual" >&2
exit 1
fi
}
pack() {
local name=$1 src=$2
shift 2
for required in "$@"; do
[ -f "$src/$required" ] || { echo "$name pack: $src/$required is missing" >&2; exit 1; }
done
python3 -I - "$src" "$work/$name.tar" <<'EOF'
import os, sys, tarfile
src, dest = sys.argv[1], sys.argv[2]
files = []
for base, dirs, names in os.walk(src):
dirs.sort()
for name in names:
path = os.path.join(base, name)
if os.path.islink(path) or not os.path.isfile(path):
sys.exit(f"{path}: only regular files can be packed")
files.append(os.path.relpath(path, src))
with tarfile.open(dest, "w", format=tarfile.USTAR_FORMAT) as tar:
for rel in sorted(files):
path = os.path.join(src, rel)
info = tar.gettarinfo(path, arcname=rel)
info.mtime, info.uid, info.gid, info.uname, info.gname = 0, 0, 0, "", ""
info.mode = 0o755 if os.stat(path).st_mode & 0o111 else 0o644
with open(path, "rb") as f:
tar.addfile(info, f)
EOF
zstd -q -19 -f "$work/$name.tar" -o "$out/$name.tar.zst"
echo "$name $(sha256 "$out/$name.tar.zst") $(wc -c < "$out/$name.tar.zst" | tr -d ' ')"
}
mkdir "$work/tracking"
fetch "https://storage.googleapis.com/mediapipe-models/hand_landmarker/hand_landmarker/float16/1/hand_landmarker.task" \
fbc2a30080c3c557093b5ddfc334698132eb341044ccee322ccf8bcf3607cde1 "$work/tracking/hand_landmarker.task"
fetch "https://storage.googleapis.com/mediapipe-models/pose_landmarker/pose_landmarker_lite/float16/1/pose_landmarker_lite.task" \
59929e1d1ee95287735ddd833b19cf4ac46d29bc7afddbbf6753c459690d574a "$work/tracking/pose_landmarker_lite.task"
cp "$here/tracking/hand_landmarker_lite.task" "$work/tracking/"
[ "$(sha256 "$work/tracking/hand_landmarker_lite.task")" = 173c0f47ecee7e935bd4a1e93aa580756b4180c1307c07d709313e82c28672c8 ] || {
echo "checksum mismatch for hand_landmarker_lite.task" >&2; exit 1; }
fetch "https://repo1.maven.org/maven2/org/opencv/opencv/${OPENCV_VERSION}/opencv-${OPENCV_VERSION}.aar" \
"$OPENCV_AAR_SHA256" "$work/opencv.aar"
fetch "https://dl.google.com/dl/android/maven2/com/google/mediapipe/tasks-core/${MEDIAPIPE_VERSION}/tasks-core-${MEDIAPIPE_VERSION}.aar" \
"$MEDIAPIPE_AAR_SHA256" "$work/tasks-core.aar"
unzip -q -j "$work/opencv.aar" jni/arm64-v8a/libopencv_java4.so -d "$work/tracking"
unzip -q -j "$work/tasks-core.aar" jni/arm64-v8a/libmediapipe_tasks_jni.so -d "$work/tracking"
chmod 0644 "$work/tracking"/*
mkdir "$work/proot"
install -m755 "$repo/app/src/main/jniLibs/arm64-v8a/libproot.so" "$repo/app/src/main/jniLibs/arm64-v8a/libproot-loader.so" "$work/proot/"
pack proot "$work/proot" libproot.so libproot-loader.so
pack directaudio "$repo/app/src/main/assets/directaudio" \
linux-wine11/version.txt linux-wine11-systhread/version.txt
pack tracking "$work/tracking" hand_landmarker.task hand_landmarker_lite.task pose_landmarker_lite.task \
libopencv_java4.so libmediapipe_tasks_jni.so
pack xbox "$linuxfs/droiddeck-xbox" version xodus-cli xodus-service
pack comet "$linuxfs/droiddeck-comet" version comet
@@ -0,0 +1,9 @@
{
"url": "https://storage.googleapis.com/mediapipe-models/hand_landmarker/hand_landmarker/float16/1/hand_landmarker.task",
"sha256": "fbc2a30080c3c557093b5ddfc334698132eb341044ccee322ccf8bcf3607cde1",
"bytes": 7819105,
"mediapipe": "com.google.mediapipe:tasks-vision:1.0.0",
"opencv": "org.opencv:opencv:4.13.0",
"documentation": "https://ai.google.dev/edge/mediapipe/solutions/vision/hand_landmarker",
"runtime": "Two video-mode instances; CPU default; GPU requires separate performance acceptance"
}
@@ -0,0 +1,12 @@
{
"sha256": "173c0f47ecee7e935bd4a1e93aa580756b4180c1307c07d709313e82c28672c8",
"composition": "Lite palm detector and lite hand landmarks with matching Tasks tensor metadata and associated files from the full bundle",
"palm_source": "https://storage.googleapis.com/mediapipe-assets/palm_detection_lite.tflite",
"palm_source_sha256": "e9a4aaddf90dda56a87235303cf00e4c2d3fb28725f68fd88772997dac905c18",
"landmark_source": "https://storage.googleapis.com/mediapipe-assets/hand_landmark_lite.tflite",
"landmark_source_sha256": "d7fde8ac11f8ce03f8663775bfc323f4fc9f2a38062b4f4efa142874ef5b2a48",
"metadata_source": "hand_landmarker.task",
"metadata_source_sha256": "fbc2a30080c3c557093b5ddfc334698132eb341044ccee322ccf8bcf3607cde1",
"builder": "tools/build_hand_lite.py; mediapipe==0.10.21; deterministic ZIP_STORED bundle and embedded associated-file archives",
"runtime": "com.google.mediapipe:tasks-vision:1.0.0; CPU by default; experimental stereo hand and wrist tracking"
}
Binary file not shown.
+4
View File
@@ -0,0 +1,4 @@
OPENCV_VERSION=4.13.0
OPENCV_AAR_SHA256=a8c9b0929d8d6367bb476320a1f36587db2b57ea18d8f7521ce509514903ca04
MEDIAPIPE_VERSION=1.0.0
MEDIAPIPE_AAR_SHA256=609c6fcfe59f58c9739194f65ae5882281c327710e1a616aa7f533a4d9238ca3
+47
View File
@@ -12,6 +12,14 @@ from zipfile import ZipFile
ROOT = Path(__file__).resolve().parents[2]
MANIFEST = Path('app/build/runtime-inputs.json')
PACKS = Path('app/build/packs')
# Runtime trees shipped as add-on packs (tools/packs/build.sh) rather than inside the APK.
PACKED = {'assets/linuxfs/usr/local/lib/droiddeck-xbox/': 'xbox', 'assets/linuxfs/usr/local/lib/droiddeck-comet/': 'comet',
'assets/directaudio/': 'directaudio'}
PACKED_FILES = {'lib/arm64-v8a/libproot.so': ('proot', 'libproot.so'),
'lib/arm64-v8a/libproot-loader.so': ('proot', 'libproot-loader.so')}
PACKED_LIBRARIES = ['lib/arm64-v8a/libopencv_java4.so', 'lib/arm64-v8a/libmediapipe_tasks_jni.so']
PACK_NAMES = ['proot', 'directaudio', 'tracking', 'xbox', 'comet']
SOURCE_PATHS = ['app/build.gradle', 'app/src/main/cpp/fakeinput_steam.cpp', 'app/src/main/assets/pulseaudio.tzst',
'tools/linuxfs', 'tools/proot', 'tools/aaudio-sink', 'tools/directaudio',
'tools/gamescope/release.env', 'tools/droiddeck-esync/release.env',
@@ -157,10 +165,49 @@ def verify(root=ROOT):
return data
def pack_digests(root, name):
path = root / PACKS / (name + '.tar.zst')
if not path.is_file():
raise ValueError('Missing add-on pack ' + name + '. Run tools/packs/build.sh app/build/packs.')
process = subprocess.Popen(['zstd', '-dc', str(path)], stdout=subprocess.PIPE)
digests = {}
try:
with tarfile.open(fileobj=process.stdout, mode='r|') as archive:
for member in archive:
if member.isfile():
digests[member.name] = hashlib.sha256(archive.extractfile(member).read()).hexdigest()
finally:
process.stdout.close()
if process.wait():
raise ValueError('Invalid add-on pack ' + name)
return digests
def check_apk(apk, root=ROOT):
data = verify(root)
packs = {name: pack_digests(root, name) for name in PACK_NAMES}
with ZipFile(apk) as package:
names = set(package.namelist())
for library in PACKED_LIBRARIES:
if library in names:
raise ValueError('APK still carries ' + library + ', which the tracking pack provides')
if library.rsplit('/', 1)[1] not in packs['tracking']:
raise ValueError('Tracking pack missing ' + library)
for name, output in data['outputs'].items():
if name in PACKED_FILES:
pack, rel = PACKED_FILES[name]
if name in names:
raise ValueError('APK still carries ' + name + ', which the ' + pack + ' pack provides')
if packs[pack].get(rel) != output['sha256']:
raise ValueError('Add-on pack ' + pack + ' is missing or has a stale ' + name)
continue
prefix = next((p for p in PACKED if name.startswith(p)), None)
if prefix:
if name in names:
raise ValueError('APK still carries ' + name + ', which the ' + PACKED[prefix] + ' pack provides')
if packs[PACKED[prefix]].get(name[len(prefix):]) != output['sha256']:
raise ValueError('Add-on pack ' + PACKED[prefix] + ' is missing or has a stale ' + name)
continue
try:
content = package.read(name)
except KeyError:
+72 -1
View File
@@ -29,6 +29,32 @@ class RuntimeInputsTest(unittest.TestCase):
self.source.parent.mkdir(parents=True)
self.source.write_text('current source')
self.audio(['pactl', 'modules/arm64/module-aaudio-sink.so', 'modules/arm64/module-directaudio-native-sink.so'])
self.packs()
def pack(self, name, files):
stream = io.BytesIO()
with tarfile.open(fileobj=stream, mode='w') as archive:
for rel, content in files.items():
entry = tarfile.TarInfo(rel)
entry.size = len(content)
archive.addfile(entry, io.BytesIO(content))
path = self.root / runtime.PACKS / (name + '.tar.zst')
path.parent.mkdir(parents=True, exist_ok=True)
path.write_bytes(subprocess.run(['zstd', '-q', '-c'], input=stream.getvalue(), capture_output=True, check=True).stdout)
def packs(self):
self.pack('tracking', {library.rsplit('/', 1)[1]: b'library' for library in runtime.PACKED_LIBRARIES})
proot = {}
for name, (pack, rel) in runtime.PACKED_FILES.items():
proot[rel] = (self.root / runtime.outputs(self.root)[name]).read_bytes()
self.pack('proot', proot)
for prefix, name in runtime.PACKED.items():
base = self.root / 'app/src/main' / prefix
self.pack(name, {path.relative_to(base).as_posix(): path.read_bytes() for path in base.rglob('*') if path.is_file()})
@staticmethod
def in_apk(name):
return name not in runtime.PACKED_FILES and not any(name.startswith(prefix) for prefix in runtime.PACKED)
def audio(self, names):
stream = io.BytesIO()
@@ -40,6 +66,11 @@ class RuntimeInputsTest(unittest.TestCase):
path = self.root / 'app/build/prepared-assets/pulseaudio.tzst'
path.write_bytes(subprocess.run(['zstd', '-q', '-c'], input=stream.getvalue(), capture_output=True, check=True).stdout)
def test_an_apk_still_carrying_proot_is_rejected(self):
apk = self.current_apk(self.root / 'bundled.apk', {'lib/arm64-v8a/libproot.so': b'prepared runtime'})
with self.assertRaisesRegex(ValueError, 'proot pack provides'):
runtime.check_apk(apk, self.root)
def test_missing_proot_cannot_be_attested(self):
(self.root / 'app/src/main/jniLibs/arm64-v8a/libproot.so').unlink()
with self.assertRaisesRegex(ValueError, 'libproot.so'):
@@ -82,6 +113,8 @@ class RuntimeInputsTest(unittest.TestCase):
apk = self.root / 'old.apk'
with ZipFile(apk, 'w') as package:
for name, output in data['outputs'].items():
if not self.in_apk(name):
continue
content = b'stale' if name == 'assets/linuxfs/libssbs.so' else (self.root / output['path']).read_bytes()
package.writestr(name, content)
with self.assertRaisesRegex(ValueError, 'stale runtime input'):
@@ -93,9 +126,43 @@ class RuntimeInputsTest(unittest.TestCase):
apk = self.root / 'current.apk'
with ZipFile(apk, 'w') as package:
for name, output in data['outputs'].items():
package.writestr(name, (self.root / output['path']).read_bytes())
if self.in_apk(name):
package.writestr(name, (self.root / output['path']).read_bytes())
runtime.check_apk(apk, self.root)
def current_apk(self, path, extra=None):
runtime.record(self.root)
data = runtime.verify(self.root)
with ZipFile(path, 'w') as package:
for name, output in data['outputs'].items():
if self.in_apk(name):
package.writestr(name, (self.root / output['path']).read_bytes())
for name, content in (extra or {}).items():
package.writestr(name, content)
return path
def test_an_apk_still_carrying_a_packed_tree_is_rejected(self):
apk = self.current_apk(self.root / 'bundled.apk', {'assets/linuxfs/usr/local/lib/droiddeck-xbox/xodus-cli': b'prepared runtime'})
with self.assertRaisesRegex(ValueError, 'xbox pack provides'):
runtime.check_apk(apk, self.root)
def test_an_apk_still_carrying_tracking_libraries_is_rejected(self):
apk = self.current_apk(self.root / 'bundled.apk', {runtime.PACKED_LIBRARIES[0]: b'library'})
with self.assertRaisesRegex(ValueError, 'tracking pack provides'):
runtime.check_apk(apk, self.root)
def test_a_stale_pack_is_rejected(self):
apk = self.current_apk(self.root / 'current.apk')
self.pack('comet', {'comet': b'old build', 'version': b'old'})
with self.assertRaisesRegex(ValueError, 'comet is missing or has a stale'):
runtime.check_apk(apk, self.root)
def test_a_missing_pack_is_rejected(self):
apk = self.current_apk(self.root / 'current.apk')
(self.root / runtime.PACKS / 'xbox.tar.zst').unlink()
with self.assertRaisesRegex(ValueError, 'Missing add-on pack xbox'):
runtime.check_apk(apk, self.root)
def test_windows_manifest_matches_portable_apk_paths(self):
path_type = type(self.root)
original_relative_to = path_type.relative_to
@@ -114,6 +181,8 @@ class RuntimeInputsTest(unittest.TestCase):
apk = self.root / 'portable.apk'
with ZipFile(apk, 'w') as package:
for name, output in data['outputs'].items():
if not self.in_apk(name):
continue
self.assertNotIn('\\', name)
self.assertNotIn('\\', output['path'])
package.writestr(name, (self.root / output['path']).read_bytes())
@@ -125,6 +194,8 @@ class RuntimeInputsTest(unittest.TestCase):
apk = self.root / 'expanded.apk'
with ZipFile(apk, 'w') as package:
for name, output in data['outputs'].items():
if not self.in_apk(name):
continue
content = (self.root / output['path']).read_bytes()
if name.endswith('.gzip'):
name = name.removesuffix('.gzip')