Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dbabb37343 | ||
|
|
7afee4bf59 | ||
|
|
7367a35176 | ||
|
|
9948f946c5 | ||
|
|
3870500972 | ||
|
|
a7b02c00ee | ||
|
|
09c7bb6ea7 | ||
|
|
3761dfd62d | ||
|
|
f86d9021f9 | ||
|
|
83e901a682 | ||
|
|
246e5fc5ee | ||
|
|
17403779cb | ||
|
|
0e03e061a4 | ||
|
|
d8cf19fb20 | ||
|
|
7cd9a38eaf | ||
|
|
4f3593192f | ||
|
|
974426d1d0 | ||
|
|
b7a0e0cb5b | ||
|
|
38edc26092 | ||
|
|
e96e25bade | ||
|
|
67c991ca4f | ||
|
|
d2017194f3 | ||
|
|
7a11706b3a | ||
|
|
76d4390b19 | ||
|
|
2022d9986a | ||
|
|
9ff7edf93b | ||
|
|
a5722b50a0 | ||
|
|
0a13ca72a2 | ||
|
|
c53d754007 | ||
|
|
a1662da17d | ||
|
|
0141bad259 | ||
|
|
6ed95684dc | ||
|
|
a6ca8385a9 | ||
|
|
210410f125 | ||
|
|
7e2502a552 | ||
|
|
a57d89e874 | ||
|
|
aade29982f | ||
|
|
d94cab6048 | ||
|
|
f17fdbf271 | ||
|
|
fb70c09d72 | ||
|
|
69bf2700e1 | ||
|
|
0b28da5521 | ||
|
|
9e9a4c0f6c | ||
|
|
bb3f6b9e7c | ||
|
|
dc7533e4e1 | ||
|
|
3660167bd8 | ||
|
|
6a47fad8f7 | ||
|
|
0f8062f881 | ||
|
|
65369f154c | ||
|
|
aefb5adc07 | ||
|
|
5603edeef7 | ||
|
|
5c47185938 | ||
|
|
fefdc19cac | ||
|
|
db6ccece32 | ||
|
|
59018cb396 | ||
|
|
70216de397 | ||
|
|
bef61563d5 | ||
|
|
1b728d7c75 | ||
|
|
60cde5f846 | ||
|
|
c3a63bbd85 | ||
|
|
bbe76ab888 | ||
|
|
b89e48cec0 | ||
|
|
dc020a2cb7 | ||
|
|
cc3febfae4 | ||
|
|
e729f3f4bc | ||
|
|
2fecfbf6ea | ||
|
|
6e0bb8ee59 | ||
|
|
26679114ed | ||
|
|
b8e49a3419 | ||
|
|
f196cf556d | ||
|
|
1b0345b15b | ||
|
|
4508608dcf | ||
|
|
3e16199e64 | ||
|
|
a7fa1c06d7 | ||
|
|
dabd9b2095 | ||
|
|
0774536473 | ||
|
|
4a7fe3645c | ||
|
|
204aa70ada | ||
|
|
8bb3df0ec8 | ||
|
|
d9f9695360 | ||
|
|
d45d391683 | ||
|
|
b0682ee570 | ||
|
|
d1cf305c0a | ||
|
|
d22f416489 | ||
|
|
2dc92a090f | ||
|
|
23a47880e0 | ||
|
|
da399ef77a | ||
|
|
f0192c0e9d | ||
|
|
cad54bb2dd | ||
|
|
507dd4ca6e | ||
|
|
a361cdc84d | ||
|
|
fa7567503f | ||
|
|
1c90669eb4 | ||
|
|
942a71dd54 | ||
|
|
e462907c49 | ||
|
|
60efbbe7a9 | ||
|
|
321588d94b | ||
|
|
b4ae5e0023 | ||
|
|
4ba148908a | ||
|
|
7af21e17ce | ||
|
|
fa3544565a | ||
|
|
f7b59a75b3 | ||
|
|
58eaab3c19 | ||
|
|
3d32be1a98 | ||
|
|
8da5a44efb | ||
|
|
51f0a5d75c | ||
|
|
b06cc9659b |
No files matched your search
@@ -1,6 +1,7 @@
|
||||
name: build
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
tags: ["v*"]
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
@@ -12,10 +13,13 @@ jobs:
|
||||
- uses: actions/checkout@v7
|
||||
- uses: astral-sh/setup-uv@v10.2.0
|
||||
- run: uv sync --extra dev
|
||||
- name: Lint
|
||||
run: uv run ruff check .
|
||||
- run: uv run pytest -m "not games and not device"
|
||||
|
||||
bundle:
|
||||
needs: test
|
||||
if: github.event_name != 'push' || startsWith(github.ref, 'refs/tags/v') # pushes to main: tests only
|
||||
permissions:
|
||||
contents: read
|
||||
id-token: write # build provenance attestations (Sigstore)
|
||||
@@ -31,10 +35,13 @@ jobs:
|
||||
include:
|
||||
- os: windows-latest
|
||||
archive: FramePort-windows-x64.zip
|
||||
- os: macos-latest
|
||||
- os: macos-26 # Apple Silicon + Xcode 26 (macos-15's Xcode 16.4 fails a Flutter plugin; macos-latest
|
||||
# went unassigned on 2026-10-02)
|
||||
archive: FramePort-macos-arm64.zip
|
||||
- os: ubuntu-22.04 # oldest supported: the bundle needs the build host's GLib/glibc or newer
|
||||
archive: FramePort-linux-x64.tar.gz
|
||||
- os: ubuntu-22.04-arm # Linux ARM64 (same base as x64)
|
||||
archive: FramePort-linux-arm64.tar.gz
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
@@ -45,9 +52,9 @@ jobs:
|
||||
- run: uv sync --extra dev
|
||||
- id: flet
|
||||
run: uv run python scripts/package.py
|
||||
continue-on-error: ${{ runner.os == 'macOS' }}
|
||||
- name: macOS fallback (PyInstaller bundle)
|
||||
if: runner.os == 'macOS' && steps.flet.outcome == 'failure'
|
||||
continue-on-error: ${{ runner.os == 'macOS' || runner.arch == 'ARM64' }}
|
||||
- name: macOS / Linux ARM64 fallback (PyInstaller bundle)
|
||||
if: (runner.os == 'macOS' || runner.arch == 'ARM64') && steps.flet.outcome == 'failure'
|
||||
run: uv run --with pyinstaller python scripts/package.py --pyinstaller
|
||||
|
||||
# ---- signing: self-signed certificate on Windows, ad-hoc on macOS ----
|
||||
@@ -90,7 +97,9 @@ jobs:
|
||||
run: ditto -c -k --keepParent "$(find dist -maxdepth 3 -name '*.app' -type d | head -1)" ${{ matrix.archive }}
|
||||
- name: Package (Linux)
|
||||
if: runner.os == 'Linux'
|
||||
run: tar czf ${{ matrix.archive }} -C dist --transform 's,^linux,FramePort,' linux
|
||||
run: | # flet build -> dist/linux; the PyInstaller fallback -> dist/FramePort (one folder)
|
||||
if [ -d dist/linux ]; then tar czf ${{ matrix.archive }} -C dist --transform 's,^linux,FramePort,' linux
|
||||
else tar czf ${{ matrix.archive }} -C dist FramePort; fi
|
||||
# self-update with this archive: unpack, verify the layout (+ the signer on Windows), run the real swap script
|
||||
- name: Update smoke test
|
||||
run: uv run python scripts/update_smoke.py ${{ matrix.archive }}
|
||||
@@ -132,10 +141,10 @@ jobs:
|
||||
git fetch --force origin "refs/tags/${tag}:refs/tags/${tag}"
|
||||
whatsnew=$(git tag -l --format='%(contents:body)' "$tag")
|
||||
[ -n "$whatsnew" ] || whatsnew=$(git tag -l --format='%(contents:subject)' "$tag")
|
||||
{ echo "FramePort ${tag}: Windows (x64), macOS (Apple Silicon) and Linux (x64)."; echo;
|
||||
{ echo "FramePort ${tag}: Windows (x64), macOS (Apple Silicon) and Linux (x64, ARM64)."; echo;
|
||||
if [ -n "$whatsnew" ] && [ "$(git cat-file -t "$tag")" = tag ]; then
|
||||
echo "## What's new"; echo; echo "$whatsnew"; echo; fi
|
||||
echo "Already have FramePort? It offers this update itself (Library → **Update now**, or \`frameport update\`)."
|
||||
echo; sed -n '/^## First launch/,$p' docs/INSTALL.md; } > "$notes"
|
||||
echo "Already have FramePort? It offers this update itself (Library → **Update now**)."
|
||||
echo; cat packaging/release-footer.md; } > "$notes" # short: the update dialog shows these notes
|
||||
gh release delete "$tag" --yes 2>/dev/null || true
|
||||
gh release create "$tag" out/* packaging/FramePort-selfsigned.cer --title "FramePort ${tag}" --notes-file "$notes"
|
||||
@@ -13,3 +13,9 @@ native/.cache/
|
||||
native/**/build/
|
||||
# per-machine Claude Code settings (contain home paths)
|
||||
.claude/settings.local.json
|
||||
|
||||
# maintainer-local notes for Claude Code (accounts, credentials)
|
||||
CLAUDE.local.md
|
||||
# outputs of `frameport report` / `parity` / ruff
|
||||
REPORT.md
|
||||
.ruff_cache/
|
||||
@@ -14,7 +14,14 @@ Read `docs/PLAYBOOK.md` (symptom → fix) before debugging a game, and `docs/FRA
|
||||
status_row, art_fill, confirm, `update()` = safe update: in Flet 1.0 reading `.page` of an unmounted control
|
||||
raises), `jobs.py` (background FIFO job queue, one at a time, cancel via Reporter; no Flet), `views/`
|
||||
(library: search/filters/tags/sort as pure tested helpers; game: hero + one-click install, patches under
|
||||
"Customize"; frame: device + readiness + installed, or connect wizard; settings; welcome; activity panel).
|
||||
"Customize"; frame: device + readiness + installed, or connect wizard; files: the Frame's file manager (persistent
|
||||
like the library; locations = Videos/Downloads/Documents from agent `storage_targets`, each installed Quest game's
|
||||
storage, the home folder; SFTP via `install/files.py` list_dir/upload/download/make_dir/rename/delete, all
|
||||
confined to the location by `files.inside`; Lepton's links in a game's storage can't be renamed/deleted; replaced
|
||||
the "Send files" dialog, game menu → "Add videos & files…" = `go("files", pkg)`; multi-select bar (download/
|
||||
delete); drag-and-drop from the OS via the `flet-dropzone` extension (Apache-2.0, Flutter `desktop_drop`), which
|
||||
only a `flet build` bundle contains: `files.dropzone_available()` keeps it out of source runs and the PyInstaller
|
||||
fallback, which would show an unknown control); settings; welcome; activity panel).
|
||||
User tags live in library entries (`tags`), filters in library setting `ui.library`.
|
||||
**Performance rules** (the app froze before): never put image bytes in controls — artwork is served by URL from the
|
||||
GUI assets dir (= user data dir; `ft.run(assets_dir=…)`), as thumbnails (`artwork/thumbs.py`, Pillow); the
|
||||
@@ -36,8 +43,9 @@ Read `docs/PLAYBOOK.md` (symptom → fix) before debugging a game, and `docs/FRA
|
||||
- **PC VR repacks are pre-patched to run directly** (proven: Rick and Morty, Vader Immortal run when the exe is
|
||||
launched directly; Revive breaks them). So Rift games default to `as_is` = install the copy unchanged and launch
|
||||
the exe directly (`pcvr.xr_timefix` for the Frame OpenXR-1.1→1.0 fix, `pcvr.no_crash_reporter` for Unreal).
|
||||
**Revive is off by default, opt-in** (`pcvr.revive`, and `pcvr.oculus_unreal`): only for an un-cracked Oculus game
|
||||
that fails at "Initializing OVR session". Those (Lone Echo, Robo Recall, Lies Beneath: crack .7z not extracted /
|
||||
**Revive is only suggested for games with Oculus (LibOVR) code** (`pcvr.revive`, and `pcvr.oculus_unreal`; repacks
|
||||
with a bundled Revive and SteamVR/OpenXR games run directly): needed by an un-cracked Oculus game that fails at
|
||||
"Initializing OVR session". Those (Lone Echo, Robo Recall, Lies Beneath: crack .7z not extracted /
|
||||
Platform SDK) hit Revive's Oculus-runtime **signature check** under Proton-arm64 — Revive's LoadLibrary/WinVerifyTrust
|
||||
hooks don't install (ARM64EC), and the game's Oculus SDK shim rejects the unsigned Revive runtime (wintrust +
|
||||
crypt32 signer "Oculus VR") — so they don't run on the Frame without extracting the repack's crack (which FramePort
|
||||
@@ -74,7 +82,8 @@ Rick and Morty runs on the Frame via its catalog recipe (OpenVR, no Revive),
|
||||
package or Rift match) + Steam appdetails (exact title: developer, release date, up to 6 screenshots → artwork
|
||||
`shot_N.jpg`). Meta store pages reject scraping, so Oculus exclusives have no screenshots. Genres become automatic
|
||||
tags. Steam shortcuts get a complete composed art set (`artwork/steam.py`: 600×900 / 920×430 / 1920×620 / logo /
|
||||
256 icon, blurred-backdrop compositing for square-only covers) and tags: how it runs, the original platform
|
||||
256 icon, blurred-backdrop compositing for square-only covers; no store art (at most the APK icon) → a placeholder
|
||||
set: the name on a colour from the title hash + the APK icon, `steam_set_for`; 2D Android apps get no store lookups) and tags: how it runs, the original platform
|
||||
(Meta Quest / Oculus Rift), genres, user tags — merged with tags set in Steam (non-Steam shortcuts can't hold a
|
||||
description).
|
||||
- Quest/Rift twins stay separate entries, shown and named in Steam "Title (Quest)"/"(Rift)" (`core/titles.py`).
|
||||
@@ -132,11 +141,14 @@ Rick and Morty runs on the Frame via its catalog recipe (OpenVR, no Revive),
|
||||
[--yes]`, once-a-day stderr hint read from the cache only (`refresh_cache()` in a daemon thread writes no
|
||||
settings, to avoid read-modify-write races). `scripts/update_smoke.py <archive>` runs the real extract + swap script
|
||||
(no relaunch) — CI runs it on all three OS with the archive it just built.
|
||||
Verified: Linux + Windows (native, signer check) smoke with the v0.2.0 bundles; macOS only via the CI smoke.
|
||||
Verified end to end (2026-10-02): real 0.3.3 bundles on Windows and Linux (Ubuntu 22.04/WSLg) found, staged and
|
||||
installed 0.3.4 ("Install updates automatically" path) and relaunched as 0.3.4 with settings kept. Not yet clicked
|
||||
by hand: the "Update now" button path (same apply(), called from the running app). macOS: CI smoke only.
|
||||
- `agent/frameport_agent.py` — runs **on the Frame** (python3 stdlib only), JSON over SSH. Owns the install layout,
|
||||
launch.sh template, Steam shortcuts (binary VDF), launch tests. Bump `AGENT_VERSION` when changing it.
|
||||
- `bootstrap/bootstrap.sh` — one-time Frame setup served by the pairing server (sshd, app key, avahi service, Lepton).
|
||||
- `catalog/games/<package>.yaml` — 34 recipes verified 2026-09-28 + Deadpool VR (2026-10-01, owner-confirmed); `catalog/triage.yaml` — log signatures → fixes.
|
||||
- `catalog/games/<package>.yaml` — 38 recipes (34 verified 2026-09-28; Deadpool VR, 4XVR, NEX Player and AC Nexus's
|
||||
90 Hz default confirmed later by the owner); `catalog/triage.yaml` — log signatures → fixes.
|
||||
- `native/` — sources of the prebuilt binaries in `artifacts/` (adapter, VrApi bridge patches, GL shim, stubs).
|
||||
`native/build.py` rebuilds them with NDK r27c (downloaded on demand into `native/.cache`, git-ignored; uses
|
||||
`-ffile-prefix-map` so no local paths get embedded; zip symlinks are restored as copies). Users never need the NDK.
|
||||
@@ -149,9 +161,9 @@ Rick and Morty runs on the Frame via its catalog recipe (OpenVR, no Revive),
|
||||
UV_LINK_MODE=copy uv sync --extra dev # creates/updates ./.venv
|
||||
uv run pytest # unit tests (no device, no game files)
|
||||
uv run frameport --help # CLI; uv run frameport-gui for the GUI
|
||||
uv run frameport parity --known-good <PATCHED/_known-good-*> --sources "<VR CyberDeck downloads>"
|
||||
uv run frameport parity --known-good <PATCHED/_known-good-*> --sources "<folder with the game dumps>"
|
||||
```
|
||||
Games/device tests: `pytest -m games` (FRAMEPORT_GAMES=<downloads dir>), `pytest -m device` (FRAMEPORT_FRAME=steamos@host);
|
||||
Games tests: `pytest -m games` (FRAMEPORT_GAMES=<downloads dir>); on-device checks are CLI commands (below);
|
||||
native layer test: `FRAMEPORT_NATIVE_TESTS=1 pytest -m native` (compiles with the NDK, ~2 min on NTFS).
|
||||
Repo is on an NTFS drive (`core.fileMode=false`); line endings are LF (`.gitattributes`).
|
||||
- `FRAMEPORT_HOME=<dir>` isolates all app data (tests use it); `FRAMEPORT_JAVA/_OVERPORT_JAR/_APKSIGNER_JAR` override
|
||||
@@ -159,7 +171,7 @@ Repo is on an NTFS drive (`core.fileMode=false`); line endings are LF (`.gitattr
|
||||
artwork, frames.json, the app's SSH key which the dev Frame authorizes).
|
||||
- Device checks: `frameport test <pkg>` / `frameport parity-device --results <parity.json> --baseline <launch.txt>
|
||||
[--test-only]`; the pre-FramePort baseline is `PATCHED/_known-good-2026-09-28/_frame-state/baseline-launch.txt`.
|
||||
- Docs screenshots (`docs/images/`): `python scripts/scrub_library.py ~/.local/share/frameport <dir>` (copies
|
||||
- Docs screenshots (`docs/images/`): `python scripts/scrub_library.py ~/.local/share/frameport <dir> --status works,issues` (copies
|
||||
library + artwork only; titles replace folder names, local paths → `D:/Games/...`, sort by size) then
|
||||
`FRAMEPORT_HOME=<dir> python scripts/ui_smoke.py --out <shots> --docs --fake-frame --game <pkg>` (set
|
||||
FRAMEPORT_JAVA/_OVERPORT_JAR/_APKSIGNER_JAR so no tool download toast appears; `--viewport 1280x2600` + crop for the
|
||||
@@ -178,6 +190,25 @@ Repo is on an NTFS drive (`core.fileMode=false`); line endings are LF (`.gitattr
|
||||
an `expand` child in a `wrap=True` Row).
|
||||
- Stopping the GUI: `pkill -f` patterns match your own shell — use `pgrep -f "[b]in/frameport-gui|[f]let-desktop-light"`.
|
||||
|
||||
## Round-2 polish (2026-10-02)
|
||||
- `errors.py`: `explain(exc)` (plain sentence for GUI + CLI), `is_connection_error`. Install/test jobs for the Frame
|
||||
(`Job.needs_frame`) that lose the connection go back to the queue front and the queue pauses (`jobs.paused`);
|
||||
`app._poll` retries every 10 s and resumes (owner-verified on the device 2026-10-02: the queue resumed after the
|
||||
connection was lost). Wake lock: agent v30 `keep_awake` (systemd-inhibit idle:sleep, idle-only
|
||||
fallback because polkit `inhibit-block-sleep` is auth_admin for non-local sessions), held while Frame jobs exist.
|
||||
- **Already converted inputs** (`analysis.is_overport_output`, e.g. the owner's library points at `PATCHED/` copies)
|
||||
are not converted again: a second OVRPort run replaced libovrplatformloader.so and dropped its DT_NEEDED on
|
||||
libovrstubs.so (Wallace & Gromit / Espire 2 crashed: cannot locate symbol ovr_…). Alt builds come from the saved
|
||||
`<pkg>.alt-noforcequit.apk`, else one OVRPort run (frame.ovrstubs relinks). `missing_ovr_symbols` only counts
|
||||
linked stub/compat libs. Converted copies in `output/` are removed after a Frame install (`build.keep_copies`).
|
||||
- Art: `.picked` marker = user's pick, automatic fetches never overwrite it and only fill missing kinds; a Meta
|
||||
result's picture is the OculusDB image shown in the picker (the ovrp image service served "dogfooding" placeholder
|
||||
covers for some packages, e.g. Asgard's Wrath 2). `steam_art_stale` → game page reminder. No store art → generated
|
||||
`cover.jpg`/`banner.jpg` (APK icon via `fetch.apk_icon`).
|
||||
- Game settings dialog (`ui/views/adapter_dialog.py`, metadata `patches/settings.UI`); plain patch summaries
|
||||
(`patches/summaries.py`, `Patch.summary`, "Show technical details" = setting `ui.patch_details`); share nudge
|
||||
(`views/game.should_ask_to_share`); saving a recipe keeps its status (was always "works").
|
||||
|
||||
## Hard-won facts (don't re-learn these)
|
||||
**Frame runtime (SteamOS 0.3.0, build 20260922):**
|
||||
- No AArch32: 32-bit-only APKs fail with `INSTALL_FAILED_NO_MATCHING_ABIS`. Unfixable; point to Rift + Revive.
|
||||
@@ -194,7 +225,28 @@ Repo is on an NTFS drive (`core.fileMode=false`); line endings are LF (`.gitattr
|
||||
- **Tracking only works with the headset worn.** SSH/headless launches never reach VISIBLE/FOCUSED and poses have
|
||||
flags 0x3. So automated tests prove startup (process alive, instance/session created, frames paced), never visuals.
|
||||
|
||||
**Setup / pairing (2026-10-02, verified on the device):** Developer Mode = `"DevModeEnabled"` in
|
||||
`~/.local/share/Steam/config/config.vdf` (InstallConfigStore/developer), applied by Valve's
|
||||
`/usr/bin/steamos-polkit-helpers/steamos-devkit-mode --enable|--disable` (polkit allow_any: no password; enables/
|
||||
disables sshd, xrdp, steamos-devkit-service, debug port forwards; sentinel `/etc/steamos-devkit-enabled`). Steam
|
||||
re-asserts the config value at every start and rewrites config.vdf on exit → stop Steam, edit, helper, start.
|
||||
**Desktop Mode is a nested Plasma inside steam.service** (own XDG_RUNTIME_DIR `/run/user/1000/nested_plasma` + private
|
||||
D-Bus): `systemd-run --user` from Konsole fails ("Failed to connect to user scope bus") unless XDG_RUNTIME_DIR/
|
||||
DBUS_SESSION_BUS_ADDRESS point at `/run/user/$UID`, and stopping Steam ends the desktop and everything started in
|
||||
it → bootstrap.sh runs the Dev Mode job + Lepton request + `/paired` as a user unit (log `~/.cache/frameport-setup.log`);
|
||||
no sudo/password anywhere (verified: naive Frame → connected, password never set). Valve's devkit pairing (fallback,
|
||||
PC → Frame only): `POST :32000/register` with an **ssh-rsa** key (`connection.devkit_key`, `frame/devkit.py`) works only
|
||||
while Steam is in pairing mode (Settings → Developer → Pair new host), else 403 at once; approve hook waits 30 s.
|
||||
The Frame runs firewalld (22 and 32000 open). PC side: the setup server needs inbound TCP 8765–8767 — WSL's Hyper-V
|
||||
firewall blocks it silently (`DefaultInboundAction Block`): `pairing.ensure_reachable` adds a temporary rule via one
|
||||
UAC prompt, removed when the server stops (flag file in %TEMP%, max 35 min); hints per OS after 45 s without a request
|
||||
(`pairing.firewall_hint`). Flet 1.0 patches aren't thread-safe → `app.serialize_flet_updates()` (a dialog shown while a
|
||||
scan redraw ran never closed: "dropped a patch for unknown control").
|
||||
**Lepton:** needs an activity with category **LAUNCHER** (Quest apps often only have INFO → "APP_ACTIVITY is empty").
|
||||
**2D apps:** Lepton runs every app headless (`lepton.headless=true`, only OpenXR output reaches the headset) unless the app folder (`<base>/lepton-app/`) has a `lepton-show-flatscreen` file (liblepton/app_metadata.sh) → Waydroid window on gamescope; agent v28 `set_flatscreen` at finalize for `vr_kind == "none"`. Android 11's navbar covered the
|
||||
app's controls → patch `device.hide_navbar` (default on for vr_kind none, migration `flat_hide_navbar`) exports
|
||||
`qemu.hw.mainkeys=1` as a second line of `LEPTON_GFXRECON_FP_PROPS` (runtime alternatives failed, see
|
||||
docs/FRAME_RUNTIME.md). Verified in the headset 2026-10-02 (2048).
|
||||
Lepton = Steam app 3029110 (+ "Lepton Development" 3056000, needs Developer Mode). Per-game env: STEAM_COMPAT_INSTALL_PATH
|
||||
/DATA_PATH/SHADER_PATH, SteamAppId. Logs: `<base>/launch.log` and `~/.local/share/Steam/logs/lepton-logcats/steamlaunch-<appid>`.
|
||||
Containers are podman `lepton-steamlaunch-<appid>`. Some Unreal games create save dirs without u+rwx → launcher repairs every 2 s.
|
||||
@@ -276,6 +328,12 @@ the **unpatched** upstream of our `frame.vrapi_bridge` (`native/vrapi` unchanged
|
||||
experimental CLI built with `-PwithVrApi=true` (stable jars list it but fail). The owner prefers OVRPort's fixes over
|
||||
ours where they work as well (less to maintain): compare in the headset before switching a default.
|
||||
`frameport install <pkg> --apk <file>` installs a specific (test) build signed with the game's key.
|
||||
Headset results (2026-10-02, `PATCHED/_test-ovrport-1.2.5/TESTING.md`): OVRPort's own VrApi translator fails on the
|
||||
Frame (Climb 2: requests VkFormat 37 → crash; POTW: no GLES path, missing `vrapi_GetTextureSwapChainHandle`) → keep
|
||||
`frame.vrapi_bridge`; those two changes are upstream candidates. 1.2.5 builds (its platform compat, new permissions)
|
||||
work. AC Nexus: `patch_ac_nexus_no_appsw_90` is the catalog default (owner preferred 90 Hz); `STRICT` patches are only
|
||||
taken from a catalog recipe where `applies()` holds (the AC Nexus ones need build MAIN.450412.207706.final, else the
|
||||
whole overport run fails).
|
||||
|
||||
**Patching gotchas:**
|
||||
- UnityPy re-serialization breaks scene loading → patch QualitySettings ints in place.
|
||||
@@ -335,7 +393,91 @@ swapchain was halved (1536/eye) in case memory is the limit (unverified). Frame
|
||||
(SteamVR runtimes, Lepton scripts, logs; never commit Valve binaries): `~/frameport-research/frame-data-2026-09-30/`.
|
||||
Not yet verified in the headset.
|
||||
|
||||
**Lepton storage (2026-09-30):** each app's /sdcard (= /storage/emulated/0 → `<base>/lepton-data/external`) has `Movies`/`Download`/`Documents` symlinked to the Frame's `~/Videos`/`~/Downloads`/`~/Documents` (liblepton/mounting.sh, only if they exist at start); agent v24 `storage_targets` reads that mapping. Android's MediaProvider canonicalises paths to /home/steamos/... and rejects every file ("doesn't appear under [/system/media...]"), `sm list-volumes` is empty: the media index never works, apps must browse folders. Lepton installs with `adb install -g` (runtime permissions granted, MANAGE_EXTERNAL_STORAGE too). Send files: `install/files.py`, `frameport frame send|storage`, GUI Frame → Send files.
|
||||
**Companion apps / intents (2026-10-03, tested with Stremio + 4XVR):** a second APK can be installed into a running
|
||||
Lepton container (`podman exec -i lepton-steamlaunch-<appid> pm install -g -S <size> < apk`) and runs there, VR
|
||||
included (4XVR in Stremio's flatscreen container: FrameBridge 72 fps, settings via LEPTON_ENV_FRAMEBRIDGE_CONFIG). But
|
||||
Lepton's services.jar (`ActivityStarter.execute`) intercepts **every** `android.intent.action.VIEW` with data (any
|
||||
scheme, explicit component or not, no property to disable): it writes `steam://openurl/<uri>` to `/lepton/steam.pipe`
|
||||
(= the host Steam client's `~/.steam/steam.pipe`) and starts nothing. So "open in external player" hand-offs (Stremio
|
||||
→ 4XVR) can't work inside Lepton; don't retry without Valve changing it. Lepton installs exactly one `*.apk` per app
|
||||
folder (two break `get_apk_path`).
|
||||
**Text input (2026-10-03, verified in the headset with Stremio VR):** Lepton's Android has no IME (`ime list` empty)
|
||||
and runs VR apps headless (`lepton.headless=true`): no Android window has input focus (`dumpsys input` FocusedWindows
|
||||
empty), so neither `input text`, a USB keyboard nor Steam's keyboard reach the app. `lepton-show-flatscreen` on a VR
|
||||
app keeps VR working (FrameBridge 72 fps) and gives the window focus; Steam's on-screen keyboard then opens for text
|
||||
fields. Unity's TMP_InputField on non-Quest Android waits for the system keyboard (`TouchScreenKeyboardShouldBeUsed`)
|
||||
and deselects a frame later unless `isKeyboardUsingEvents` (Android: `InPlaceEditing() && m_HideSoftKeyboard`);
|
||||
uGUI InputField's LateUpdate keeps the field when `InPlaceEditing()`. Patch `frame.unity_text_input` rewrites them
|
||||
(`mov w0,#0|#1; ret`) at Cpp2IL's **Offset** (= file offset; RVA differs by 0x4000 in Stremio's lib), Cpp2IL
|
||||
2022.1 pre-release (Unity 6 / metadata v31; Il2CppDumper can't), cached per libil2cpp sha. `/dev/uinput` has an ACL
|
||||
for steamos (Steam Input) → agent v33 `_keyboard` uinput keyboard ("Type on Frame") reaches everything with focus.
|
||||
Installing a second APK into a container with `pm install` re-runs Lepton's post-install hook on the **main** app
|
||||
(`lepton.active_app_id`; moves its files to /data/steam_app) and corrupts it on the next start (fix: touch the APK →
|
||||
re-bake); `cmd_real package install` skips the hook.
|
||||
**User reports (2026-10-04, issues #4-#10):** Steam shortcuts go to the signed-in account (`loginusers.vdf`
|
||||
MostRecent) else every account (agent v35 `library_users`; it used to refuse with >1 account → Play gave Steam's "Game
|
||||
configuration unavailable"); `launch` uses the shortcut's own appid and errors `NOT_IN_LIBRARY`, the app then adds it
|
||||
and plays. Unity IL2CPP fixes share one Cpp2IL run (`unity_text_input.Il2cppReturnPatch`, `ALL_TARGETS`, cache keyed by
|
||||
global-metadata.dat): `frame.unity_runtime_msaa_off` (OVRManager raises MSAA to 4x at runtime: "Switching to the
|
||||
recommended level" → Lucky's Tale restarted the headset; `OVRDisplay.get_recommendedMSAALevel` → 0) and
|
||||
`frame.unity_multipass` (Oculus XR Plugin multiview → MultiPass via `OculusSettings.GetStereoRenderingMode`; I Am Cat's
|
||||
right eye grey). Both checked against Toy Master's Cpp2IL output, not yet in a headset. VR4 quits itself (System.exit
|
||||
after the intro movie) → catalog `use_alt`. **Catalog changes reach existing games** without hardcoded migrations:
|
||||
recipes store `catalog_rev` (= `CatalogEntry.rev()`), `library._follow_catalog` re-derives non-user recipes whose entry
|
||||
changed; a maintained entry beats the user's shared copy when its `updated`/verified date is later (`catalog._newer`).
|
||||
**Round 2 of reports (2026-10-04):** VR4's campaign hang = one fragment shader reading an uninitialized loop counter
|
||||
(reporter's capture): vkshim `vk_shader_fix` setting (`<size>:<sha256>:<offset>:<words>`, from the recipe's `adapter:`;
|
||||
matched by size + SHA-256, words inserted into a copy) — on the device the module is fixed at load ("fixed shader
|
||||
module (6488 -> 6512 bytes)"); campaign itself not yet seen in a headset by us. Text settings (kind "str") stay out of
|
||||
the Game settings dialog (saving it dropped them). I Am Cat: `GetStereoRenderingMode` is inlined (no call sites) →
|
||||
`Il2cppReturnPatch.field_loads` rewrites the field read in `OculusLoader.Initialize` (Cpp2IL gives the field offset,
|
||||
`field:<name>`); verified with Toy Master: eye swapchains array=1 ×2 instead of array=2. Builds record `recipe_fp`
|
||||
(`patches/base.recipe_fingerprint`, `Patch.revision`): a changed recipe or revised patch shows "Update on Frame".
|
||||
Remembered Frames are found again after an address change (`Frame.relocate`: scan, same SSH host key, before
|
||||
login). Packaged apps show artwork by file path (`thumbs.use_file_paths`, #16). Diagnostics: this boot's kernel log.
|
||||
Device tests of requested games (2026-10-04, headless): I Am Cat, Myst 3.3.0, BattleGlide, Blade & Sorcery: Nomad
|
||||
start (RUNNING, frames). Roblox: SIGSEGV in je_free from libroblox.so ~3 s in (likely its anti-tamper vs the re-signed
|
||||
APK). BONELAB (Unity 2021.3 Vulkan, OVRPlugin 1.94): SIGSEGV with pc == fault addr in vkCreateInstance, called from
|
||||
libSLZQuestNative.so's Vulkan hooks into an unmapped (unloaded) library right after OVRPlugin's pre-init
|
||||
xrDestroyInstance; pinning openxr/vrclient libraries (RTLD_NODELETE) did NOT help — find the unloaded library with the
|
||||
linker's dlopen/dlclose logging next. Accounting+ (Unity 2017.4 built-in Oculus, libOVRPlugin + libvrapi): Unity
|
||||
never starts VR on the Frame (no OVRPlugin/OpenXR lines; runs as a 2D app), which is why its "controller setup"
|
||||
screen can't be passed — Unity 2017's Oculus device check, not the controller profiles. Cpp2IL can't read Unity 2017.
|
||||
The Frame's Android runtime (vrclient.so) knows oculus/touch_controller but not Meta's Touch Plus/Pro profiles
|
||||
(OVRPlugin suggests those too, routinely) → adapter `profile_remap`.
|
||||
Headset round 2 (2026-10-04): the Frame drops focus often (ms to 7 s; only some are presence/standby) → games pause
|
||||
or recentre (B&S Player.OnVRPresence → Teleport, BattleGlide/Unreal pauses); focus_hold now 1 s focused / 1 s max dip
|
||||
(longer must still pause). Myst crash = vrclient xrSyncActions race after FOCUSED → `sync_guard` (confirmed); its
|
||||
object glitches: app space warp suspected (FB_space_warp is advertised and used) → recipe `patch_disable_space_warp`.
|
||||
I Am Cat multipass: poses/times consistent, but every frame is submitted after the next xrWaitFrame (one period late;
|
||||
Zink + doubled draws) and the game clamps its physics step to 10 ms → judder while still; testing scale 0.8. Roblox's
|
||||
newest crash is on Fossilize's recording thread → vk_sanitize extended to own-engine libs (engine "Other").
|
||||
Accounting+: unity_oculus_check + native/ovrpshim (libfp_ovrp.so waits via ovrp_WaitToBeginFrame before Unity
|
||||
2017's ovrp_Update2) → VR in the headset at ~72 fps (2026-10-04), but stuck at "press any button" although input
|
||||
reaches its OVRInput cleanly (probe: both Touch connected 0x63, individual buttons, input focus 1) → works with issues.
|
||||
"outside of frame bounds" warnings stay (~2/frame) and are harmless.
|
||||
Steam library (GitHub #4/#21/#27, agent v38): shortcuts go to every Steam account (signed-in first; MostRecent isn't
|
||||
always the account on the Frame); stop_steam also waits for Steam's helpers; after the restart the agent re-reads
|
||||
shortcuts.vdf and writes once more if Steam put its old copy back (`shortcuts_lost`), else reports it. 0.6.3's Play
|
||||
auto-repair (`_add_then_play`) crashed (its job got a Job, not a reporter). Uploads resume on a transient OSError.
|
||||
Lepton's Android 11 has no clipboard service (134 services; checked with `podman exec … service check clipboard`):
|
||||
SDL/LÖVE apps crashed at start → `frame.sdl_clipboard` (`apk/dex.py`: in-place dex edit, nops one invoke, fixes
|
||||
the header checksum/signature; verified with LÖVE for Android 11.5, GitHub #24 Dramatic Shape). 2D apps (vr_kind none)
|
||||
keep every suggested patch that isn't about VR (`needs_vr = False`), not a fixed list. FramePort on the Frame:
|
||||
`frame/local.py` (127.0.0.1, own key authorized; "This Frame (experimental)"; app data in
|
||||
~/.local/share/frameport-app because ~/.local/share/frameport is the agent's) and Steam library changes wait while
|
||||
Desktop Mode is open. Verified on the device 2026-10-04 (install + launch test from the Frame). Library updates on the
|
||||
Frame run one at a time (agent v40 flock): two quick uninstalls used to bring a removed shortcut back (Roblox).
|
||||
Headset round 3 (owner's verdicts, 2026-10-04): Blade & Sorcery works — its freezes were the headset's wear sensor
|
||||
flickering off while worn (vrserver.txt "HMD off/on" 0.5-2 s) → per-game `focus_hold_ms=2500` (only this game reacts;
|
||||
not a default). BattleGlide works (focus_hold). Myst works with issues (object glitches; space warp ruled out, its
|
||||
recipe keeps it on). I Am Cat works with issues (judder; scale 0.8 no help). Roblox unsupported (je_free in
|
||||
libroblox, also with the Vulkan shim). Installs skip the Steam restart when the shortcut is unchanged and wait while a
|
||||
game runs (agent v37). New default fixes in FramePort's code reach games already in a library: after every app update
|
||||
`library._follow_catalog` re-derives each non-user recipe once (setting `recipes.app_version`; tests switch it off via
|
||||
`library.REFRESH_ON_UPDATE`); analysis fields added later still need a re-analysis. Troubleshooting techniques: docs/PLAYBOOK.md "Debugging techniques". Unity `boot.config` "vulkan" substring mislabels GLES games as Vulkan
|
||||
(I Am Cat ran GLES); OVRPlugin's "Unavailable OpenXR extension: XR_FB_scene" is routine (no longer triaged).
|
||||
**Lepton storage (2026-09-30):** each app's /sdcard (= /storage/emulated/0 → `<base>/lepton-data/external`) has `Movies`/`Download`/`Documents` symlinked to the Frame's `~/Videos`/`~/Downloads`/`~/Documents` (liblepton/mounting.sh, only if they exist at start); agent v24 `storage_targets` reads that mapping. Android's MediaProvider canonicalises paths to /home/steamos/... and rejects every file ("doesn't appear under [/system/media...]"), `sm list-volumes` is empty: the media index never works, apps must browse folders. Lepton installs with `adb install -g` (runtime permissions granted, MANAGE_EXTERNAL_STORAGE too). Files: `install/files.py`, `frameport frame send|storage`, GUI Files tab (formerly Frame → Send files).
|
||||
**SteamVR per-app settings (2026-09-30):** editing steamvr.vrsettings while SteamVR runs is lost; the web API (127.0.0.1:27062 /app/setsettings) needs `x-steamvr-secret`. `native/vrsettings` = `fp_vrsettings.exe` (freestanding, OpenVR `FnTable:IVRSettings_003` as a Utility app, loads SteamVR's bin/win64/openvr_api.dll) sets them live and SteamVR persists them: section `steam.app.<shortcut appid>`, keys `preferredRefreshRate` (float) and `motionSmoothingOverride` (0 global, 1 on, 2 off, 3 always). Steam Link (vrlink) lists the Frame's rates 72/80/90/96/108/120/144 in vrserver.txt and follows the per-app preference ("host preferred N Hz"; whether the key is honoured is unverified in-headset yet). Judder metric: vrcompositor.txt session summary dropped + "Timed out. N total" (Stormland: 0 dropped but 313 timeouts in 2 min); fpsVR (`%LOCALAPPDATA%\fpsVR\*.json`, 0.1 ms histograms) gives p99 CPU/GPU ms. `pcvr.steamvr_tuning` (default on, PC only) applies on Play: highest rate whose budget ≥ p99×1.05, at least one step down, smoothing on.
|
||||
|
||||
**Unresolved (as of 2026-09-28):** Arcsmith (right-eye distortion) and Time Stall (both eyes) — swap, tracking, Valve
|
||||
@@ -343,10 +485,12 @@ layers, depth, pacing ruled out. Sniper Elite VR (DEVICE LOST), Espire 1 (Mesa G
|
||||
crash): use PC versions.
|
||||
|
||||
## Releases, CI, GitHub
|
||||
Maintainer-only notes (accounts, credentials, key locations) live in the git-ignored `CLAUDE.local.md`.
|
||||
Public repo `github.com/spoopyghosty0/frameport` (branch `main`). Push a `v*` tag → CI (`.github/workflows/build.yml`)
|
||||
tests, builds Windows x64 / macOS arm64 / Linux x64 bundles, signs, attests and publishes a GitHub Release
|
||||
(`FramePort-*.zip/.tar.gz`, the CLI wheel `frameport-<ver>-py3-none-any.whl`, `SHA256SUMS.txt`,
|
||||
`FramePort-selfsigned.cer`; notes = "What's new" from the annotated tag message + `docs/INSTALL.md` from "First launch").
|
||||
`FramePort-selfsigned.cer`; notes = "What's new" from the annotated tag message + the short `packaging/release-footer.md`; owner: keep release
|
||||
notes short — a few "What's new" bullets, nothing long after them).
|
||||
Installed apps find the release themselves (self-update), so the notes are what users see in the update dialog.
|
||||
- **Release checklist:** bump `src/frameport/_version.py` (the only version; `scripts/package.py` fails a tag build
|
||||
whose tag ≠ `v<_version>`), commit, `git tag -a vX.Y.Z -m "FramePort X.Y.Z" -m "<What's new, Markdown bullets>"`,
|
||||
@@ -355,14 +499,17 @@ Installed apps find the release themselves (self-update), so the notes are what
|
||||
- Signing is **free/self-signed by the owner's choice** (no paid certs, no SignPath): Windows binaries are signed with
|
||||
a self-signed "FramePort (self-signed)" code-signing cert (RSA 3072, valid to 2031, SHA-256
|
||||
`4E:12:98:91:62:C0:E4:50:FB:65:1D:34:BB:73:00:09:7B:78:BE:88:5C:A7:6C:42:23:46:9B:92:A1:59:A7:6E`); secrets
|
||||
`WINDOWS_CODESIGN_PFX` (base64) + `WINDOWS_CODESIGN_PASSWORD`. Private key: `~/.config/frameport-signing/` (WSL) and
|
||||
the backup `PATCHED/_signing-keys/frameport-app-codesign/` — never commit it. macOS is ad-hoc signed only (Gatekeeper
|
||||
`WINDOWS_CODESIGN_PFX` (base64) + `WINDOWS_CODESIGN_PASSWORD`. The private key is never committed (its
|
||||
location is in `CLAUDE.local.md`). macOS is ad-hoc signed only (Gatekeeper
|
||||
needs right-click → Open; notarization would need the paid Apple program). Users still see SmartScreen unless they
|
||||
import the .cer into Trusted Root.
|
||||
- CI gotchas: `flet build` needs `--yes --no-rich-output` (it prompts to install Flutter; rich output crashes the
|
||||
Windows console) plus PYTHONUTF8; macOS builds need `--python-version 3.12 --arch arm64` (cryptography has no wheels
|
||||
for flet's default Python / x86_64 cross-build), with a PyInstaller fallback step; `astral-sh/setup-uv` has no
|
||||
floating major tags after v7 → pin the exact version; force-moving a tag starts duplicate runs (cancel one).
|
||||
- macOS runner (2026-10-02): `macos-latest` jobs went unassigned (cancelled after 15 min, no steps); `macos-15`'s Xcode
|
||||
16.4 fails a Flutter plugin (`NWPath has no member`); `macos-26` (Xcode 26) builds with `flet build`. The PyInstaller
|
||||
fallback (`package.py --pyinstaller`) passes `--yes` so a failed `flet build`'s folder doesn't stop it at a prompt.
|
||||
- Windows PowerShell calls from Python (`updates._powershell()`): use `%SystemRoot%\System32\WindowsPowerShell\v1.0\
|
||||
powershell.exe` with `PSModulePath` removed from the environment — started under PowerShell 7 (CI's default shell,
|
||||
or a user's pwsh terminal) it couldn't run Get-AuthenticodeSignature (v0.3.0's Windows update smoke failed on it).
|
||||
@@ -373,14 +520,6 @@ Installed apps find the release themselves (self-update), so the notes are what
|
||||
open). Windows installs of 0.3.1/0.3.2 can't update themselves: they need one manual download.
|
||||
- The Linux bundle is built on ubuntu-22.04: a 24.04-built Flutter bundle needs GLib 2.80 (`undefined symbol:
|
||||
g_once_init_enter_pointer` on 22.04).
|
||||
- **This project's GitHub identity is `spoopyghosty0`** (a dedicated account; the machine's default gh/git login is a
|
||||
different, personal account that must never touch this repo). `gh` (`~/.local/bin/gh`) uses it through
|
||||
`GH_CONFIG_DIR=~/.config/gh-spoopyghosty0` (set for Claude Code in the git-ignored `.claude/settings.local.json`);
|
||||
git pushes from this folder authenticate as it through a repo-local credential helper, and commits use the repo-local
|
||||
identity `spoopyghosty0 <336754034+spoopyghosty0@users.noreply.github.com>`. Check with `gh api user --jq .login`
|
||||
before any GitHub action.
|
||||
- **No Claude trailers** (`Co-Authored-By: Claude …`, `Claude-Session: …`) in commits or PR descriptions — the owner's
|
||||
rule; history was rewritten to remove them.
|
||||
- **The repo is public: never commit personal data** — the Frame's IP address, the Steam user id, the owner's email,
|
||||
local home paths (native builds use `-ffile-prefix-map`). History was rewritten once to remove them.
|
||||
|
||||
@@ -403,11 +542,14 @@ GLAD/GLES); Unreal → alternate no-ForceQuit build. Score changes with
|
||||
- Reinstalls keep one rollback copy (`<base>/previous-game.apk`, `settings.conf.previous`); `frameport frame cleanup`
|
||||
removes them (and `--path ~/X` extra folders under home).
|
||||
|
||||
## Project status (2026-09-29)
|
||||
## Project status (2026-10-02)
|
||||
Self-update, the Files tab, OVRPort 1.2.5, non-Quest Android apps (vr_kind) and GUI localisation (tr(), 0.3.x) are
|
||||
in; see the sections above. Earlier state (2026-09-29):
|
||||
34 Quest games ported; the owner confirmed in the headset that all FramePort-rebuilt games work: 23 work, 5 work with
|
||||
issues (Arcsmith/Time Stall eye distortion, AC Nexus some flipped launch text, Phantom DLC button, Silhouette hands),
|
||||
6 can't run (Sniper Elite VR, Espire 1, HITMAN, and the 32-bit Journey of the Gods / Shadow Point / Sports Scramble).
|
||||
Parity: all 34 rebuilt from the dumps match the known-good builds (`docs/parity-report.md`) and were reinstalled +
|
||||
Parity: all 34 rebuilt from the dumps match the known-good builds (`docs/parity-report.md`, generated locally and
|
||||
git-ignored; 34/34 again with OVRPort 1.2.5 on 2026-10-02) and were reinstalled +
|
||||
launch-tested with 0 regressions (`docs/parity-device-report.md`). `PATCHED/` holds exactly the installed builds.
|
||||
Owner preferences: manual installs (no third-party installer apps), Python + Flet, dynamic data over hardcoding,
|
||||
free tooling only, public repo scrubbed of personal data, keep the known-good backups.
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
# Code of conduct
|
||||
|
||||
This project follows the [Contributor Covenant, version 2.1](https://www.contributor-covenant.org/version/2/1/code_of_conduct/).
|
||||
In short: be respectful and constructive, assume good faith, and keep discussions about the project. Harassment and
|
||||
personal attacks aren't tolerated.
|
||||
|
||||
Report unacceptable behaviour privately through a GitHub security advisory on this repository (it reaches the
|
||||
maintainer only). Reports are handled confidentially.
|
||||
@@ -0,0 +1,54 @@
|
||||
# Contributing
|
||||
|
||||
Thanks for helping. The quickest contributions:
|
||||
|
||||
- **A game works on the Frame?** In FramePort: the game's menu → **Share working config…** opens a prefilled issue
|
||||
with its recipe. Accepted configs become built-in recipes.
|
||||
- **Something doesn't work?** The game's menu → **Report a problem…** saves a diagnostics zip (personal data
|
||||
removed) and opens a prefilled issue to attach it to.
|
||||
|
||||
## Development
|
||||
```
|
||||
uv sync --extra dev # Python 3.11+, uv (https://docs.astral.sh/uv/)
|
||||
uv run frameport-gui # the app
|
||||
uv run frameport --help # the command line
|
||||
uv run pytest # tests (no headset or game files needed)
|
||||
uv run ruff check . # lint
|
||||
```
|
||||
- Code and architecture: `CLAUDE.md`, `docs/ARCHITECTURE.md`; per-game symptoms and fixes: `docs/PLAYBOOK.md`.
|
||||
- Interface wording: `docs/STYLE.md`. GUI texts go through `tr()`; after changing them run
|
||||
`python scripts/i18n_extract.py`.
|
||||
- Translations: see [Translating FramePort](#translating-frameport) below.
|
||||
- New fixes are patch modules (`src/frameport/patches/`), with a triage signature (`catalog/triage.yaml`), a PLAYBOOK
|
||||
row and a unit test.
|
||||
- Native binaries in `artifacts/` are rebuilt with `python native/build.py` (downloads the NDK).
|
||||
|
||||
## Adding a tested game
|
||||
|
||||
Tested a game on the Steam Frame? The easiest way is in FramePort: open the game → **…** → **Share working config…**.
|
||||
It opens a prefilled GitHub issue with the exact recipe; after review a workflow turns it into
|
||||
`catalog/games/<package>.yaml`. Without the app: [working config form](https://github.com/spoopyghosty0/frameport/issues/new?template=working-config.yml). Something doesn't run: the game's
|
||||
**Report a problem…** (diagnostics zip, personal data removed) or the [problem report form](https://github.com/spoopyghosty0/frameport/issues/new?template=bug-report.yml).
|
||||
After catalog changes, regenerate the games list: `python scripts/compat_list.py`.
|
||||
|
||||
## Translating FramePort
|
||||
The app's texts (screens, help, patch and setting descriptions) can be translated; the command line, logs and
|
||||
diagnostics stay English. No programming needed:
|
||||
|
||||
1. Copy `src/frameport/locales/template.json` to `src/frameport/locales/<code>.json`, where `<code>` is the language
|
||||
code (`de`, `fr`, `pt`, `ja`, …).
|
||||
2. Add `"_language": "<the language's own name>"` (e.g. `"Deutsch"`); it's shown in Settings → Language.
|
||||
3. Fill in the values. Each key is the English text; leave a value empty to keep the English text. Plural entries
|
||||
have a list value: `["<one>", "<other>"]`. Keep `{placeholders}` such as `{title}` or `{n}` exactly as they are,
|
||||
and keep `…`, `·` and line breaks where the English has them.
|
||||
4. Try it: `uv run frameport-gui`, choose the language in Settings → Language, restart FramePort.
|
||||
5. Open a pull request with the file. When the English texts change, `python scripts/i18n_extract.py` refreshes the
|
||||
template; new texts then show in English until they're translated.
|
||||
|
||||
Wording rules for English (and a guide for tone) are in `docs/STYLE.md`.
|
||||
|
||||
## Ground rules
|
||||
- Use only games you own. Contributions that help bypass DRM, licence or entitlement checks, or that add game files,
|
||||
are not accepted.
|
||||
- Never commit personal data (IP addresses, user names, home paths, Steam IDs).
|
||||
- By contributing you agree to license your work under GPL-3.0-only.
|
||||
@@ -1,107 +1,112 @@
|
||||
# FramePort
|
||||
|
||||
FramePort installs Meta Quest standalone games and Oculus Rift PC VR games on the **Valve Steam Frame**. It patches a
|
||||
game so it runs on the Frame's runtimes, copies it to the headset over Wi-Fi and adds it to the Frame's Steam library
|
||||
with artwork.
|
||||
[](https://github.com/spoopyghosty0/frameport/releases/latest)
|
||||
[](https://github.com/spoopyghosty0/frameport/actions/workflows/build.yml)
|
||||
[](https://github.com/spoopyghosty0/frameport/releases)
|
||||
[](LICENSE)
|
||||

|
||||

|
||||
|
||||
Install games that target the Meta Quest, Android, or general PCVR onto your **Valve Steam Frame**. FramePort handles everything from uploading game files, setting up your Frame, injecting compatibility patches, and adding shortcuts to your Steam library. FramePort aims to be as simple as possible by taking advantage of the fact that the Steam Frame runs on Linux.
|
||||
|
||||

|
||||
|
||||
## Purpose
|
||||
> **Notice:** FramePort explicitly does NOT download, share, or unlock games. You must provide legally obtained game
|
||||
> executables. Core features of FramePort simply download and wrap other published tools (see [Built on](#built-on))
|
||||
> with patches provided by FramePort adding a hardware compatibility layer. This enables users to use games/apps legally
|
||||
> purchased on sites like [SideQuest](https://sidequestvr.com/).
|
||||
|
||||
FramePort is a **proof of concept**: it shows that VR software built for other platforms (Meta Quest, Oculus Rift) can
|
||||
run on the Steam Frame with a translation layer and a few targeted fixes. Most of the work is done by the projects
|
||||
FramePort wraps (see [Built on](#built-on)); FramePort selects and applies their fixes per game, adds Steam
|
||||
Frame-specific patches, and handles installing, testing and launching.
|
||||
## Features
|
||||
|
||||
FramePort is **not a piracy tool**. It does not download, share or unlock games, and it does not remove DRM, licence or
|
||||
entitlement checks. Use it only with games you own. Games that check their licence through the Oculus Platform SDK are
|
||||
marked as not runnable on the Frame.
|
||||
- **Painless setup:** one short command on the Frame. No root, no `sudo`, no password.
|
||||
[What it changes](docs/FRAME_SETUP.md).
|
||||
- **Type on Frame:** use your computer's keyboard on the Frame: in VR apps, Android apps, Steam and the desktop.
|
||||
[More](#type-on-frame).
|
||||
- **One click per game:** convert, patch, sign, upload, add to Steam with artwork, launch test.
|
||||
- **Per-game recipes:** a tested catalog plus detection rules; every patch explained in plain words.
|
||||
- **FrameBridge:** FramePort's OpenXR adapter emulates what the Frame natively lacks (passthrough, room, controller models,
|
||||
curved and 360° layers); game settings as simple switches.
|
||||
- **Beyond Quest:** Android apps as windows, PC VR via Proton or Revive, Windows (non-VR) games via Proton, a Files
|
||||
tab with drag and drop.
|
||||
- **Self-updating** releases, redacted diagnostics, one-click problem reports and working-config sharing.
|
||||
|
||||
## Getting started
|
||||
## Quick start
|
||||
|
||||
1. **Download** the archive for your computer from the
|
||||
[latest release](https://github.com/spoopyghosty0/frameport/releases/latest) and extract it anywhere:
|
||||
1. [Download](https://github.com/spoopyghosty0/frameport/releases/latest) and unzip the build for Windows, macOS
|
||||
(Apple Silicon) or Linux, then start FramePort.
|
||||
2. **Connect the Frame** (once):
|
||||
1. In FramePort click **Steam Frame → Show setup command**. Keep FramePort open; the Frame and your computer must
|
||||
be on the same Wi-Fi.
|
||||
2. On the Frame open the **SteamVR dashboard → Launch a program → Desktop**: the Linux desktop opens on a virtual
|
||||
screen.
|
||||
3. Open the app menu (bottom-left corner of that desktop) → **System → Konsole** (or search for Konsole).
|
||||
4. Type the command FramePort shows exactly as shown (on-screen keyboard or any USB/Bluetooth keyboard) and press
|
||||
**Enter**. This will run the following [bash setup script](bootstrap/bootstrap.sh).
|
||||
5. After a few seconds the desktop closes by itself (Steam restarts once); that's expected. If
|
||||
Steam asks to install **Lepton**, confirm it. FramePort shows the Frame as connected within a minute. No
|
||||
password needed.
|
||||
3. **Add games → Scan a folder** with your game backups (APK + OBB, or PC VR game folders).
|
||||
4. Open a game → **Install on Frame**, then play it from the Frame's Steam library.
|
||||
|
||||
| Computer | File | Start |
|
||||
|---|---|---|
|
||||
| Windows 10/11 (x64) | `FramePort-windows-x64.zip` | `FramePort.exe` |
|
||||
| macOS (Apple Silicon) | `FramePort-macos-arm64.zip` | `FramePort.app` |
|
||||
| Linux (x64) | `FramePort-linux-x64.tar.gz` | `FramePort/FramePort` |
|
||||
Full guide, firewalls and troubleshooting: [docs/INSTALL.md](docs/INSTALL.md).
|
||||
|
||||
The builds are self-signed, so the first start shows a warning: Windows → **More info → Run anyway**;
|
||||
macOS → right-click the app → **Open**. Details: [docs/INSTALL.md](docs/INSTALL.md).
|
||||
2. **Get the tools**: on first start FramePort downloads what it needs (Java runtime, OVRPort, apksigner) into its own
|
||||
folder. Nothing is installed system-wide.
|
||||
3. **Connect the Frame**: turn on Developer Mode on the Frame (Settings → System → Developer). In FramePort open
|
||||
**Steam Frame**; if the Frame isn't listed, switch it to Desktop mode, open Konsole and paste the one command
|
||||
FramePort shows. This is needed once.
|
||||
4. **Add games**: **Add games → Scan a folder** with your Quest game backups (APK + OBB) or Rift game folders.
|
||||
FramePort identifies each game and fetches its artwork and store details.
|
||||
5. **Install**: open a game and click **Install on Frame**. FramePort patches, checks, uploads and adds the game to the
|
||||
Frame's Steam library, then runs a short launch test.
|
||||
6. **Play**: put the headset on and start the game from the Steam library (or click **Play on Frame**).
|
||||
## Type on Frame
|
||||
|
||||

|
||||
Typing in VR is painful, so FramePort turns your computer's keyboard into a keyboard for the Frame. Open **Type on
|
||||
Frame** (keyboard icon on the sidebar's Frame card, the Steam Frame page, or a game's menu), select a text field in
|
||||
the headset and type: searches, logins, chat, in any app, in Steam or on the desktop. Paste longer text to type it in
|
||||
one go. Nothing to install: FramePort adds a virtual keyboard on the Frame while the window is open, without root.
|
||||
|
||||
FramePort updates itself: when a new version is released, the Library shows **Update now**.
|
||||

|
||||
|
||||
## What works
|
||||
Unity apps whose text fields close the moment you select them on the Frame (no system keyboard there) get a per-game
|
||||
fix, so Steam's on-screen keyboard and Type on Frame work in them too.
|
||||
[Details](docs/INSTALL.md#typing-on-the-frame).
|
||||
|
||||
The built-in catalog has tested settings for 38 games (27 work, 5 work with known issues, 6 can't run on the Frame).
|
||||
Other games get suggested patches from detection rules; each suggestion states its reason, and every patch can be
|
||||
switched on or off under **Customize**.
|
||||
## Compatibility
|
||||
|
||||

|
||||
If a game has already been tested with FramePort, it will automatically use the optimal game config. Otherwise, FramePort
|
||||
will attempt to guess key patches. If you find a new config that works for an app you are testing, please consider submitting it to the community!
|
||||
|
||||
- Quest games run in Valve's Android runtime (Lepton). 32-bit-only Quest games can't run (the Frame has no 32-bit ARM
|
||||
support).
|
||||
- Rift games run through Proton on the Frame (experimental) or on a Windows PC with SteamVR, streamed to the Frame.
|
||||
Games that use the Oculus Platform SDK need the Oculus app and a licence, so they run on the PC only.
|
||||
- Automated launch tests confirm a game starts; visuals can only be checked in the headset.
|
||||
**[List of tested games](docs/GAMES.md)**
|
||||
|
||||

|
||||
**Tested something? Share it.** In FramePort open the game → **…** → **Share working config…** (it fills in the
|
||||
recipe for you) or **Report a problem…** (attaches a diagnostics zip with personal data removed). Without the app:
|
||||
[share a working config](https://github.com/spoopyghosty0/frameport/issues/new?template=working-config.yml) · [report a problem](https://github.com/spoopyghosty0/frameport/issues/new?template=bug-report.yml). Shared configs become built-in recipes for everyone.
|
||||
|
||||
## Built on
|
||||
|
||||
FramePort is a front end for other projects; most of the functionality comes from them:
|
||||
|
||||
| Project | Used for |
|
||||
|---|---|
|
||||
| [OVRPort](https://github.com/Android-XR-Bridge/OVRPort) (overport, originally [ovrport/app](https://github.com/ovrport/app)) | Converts Quest games to OpenXR: its CLI applies the game patches and supplies the OpenXR loader; FramePort also includes its VrApi→OpenXR adapter |
|
||||
| Valve Lepton, Proton and SteamVR | Run Android games, Windows games and OpenXR on the Frame |
|
||||
| [Revive](https://github.com/LibreVR/Revive) (LibreVR) | Runs Oculus Rift games on OpenXR / SteamVR |
|
||||
| Mesa (Zink) | OpenGL ES on Vulkan on the Frame |
|
||||
| [Khronos OpenXR SDK](https://github.com/KhronosGroup/OpenXR-SDK) | OpenXR headers for the native layers |
|
||||
| Eclipse Temurin, Android apksigner, Android NDK | Java runtime, APK signing, building the native layers |
|
||||
| [Flet](https://flet.dev) | The desktop app |
|
||||
| OculusDB, Steam store | Game descriptions, genres and artwork |
|
||||
|
||||
FramePort's own parts: game detection and recipes, the Steam Frame OpenXR adapter (FrameBridge) and the other native
|
||||
fixes in `native/`, the installer agent that runs on the Frame, and the desktop/command-line app.
|
||||
|
||||
## Command line
|
||||
|
||||
The same functions are available as `frameport` (included in the source tree; also released as a Python wheel):
|
||||
`frameport scan`, `frameport build`, `frameport install`, `frameport test`, `frameport update`. Run
|
||||
`frameport --help` for the full list.
|
||||
[OVRPort](https://github.com/Android-XR-Bridge/OVRPort) (Quest → OpenXR, originally
|
||||
[ovrport/app](https://github.com/ovrport/app)) · Valve Lepton, Proton and SteamVR ·
|
||||
[Revive](https://github.com/LibreVR/Revive) · Mesa (Zink) · [Khronos OpenXR SDK](https://github.com/KhronosGroup/OpenXR-SDK)
|
||||
· Eclipse Temurin, Android apksigner and NDK · [Flet](https://flet.dev) · OculusDB and Steam store data.
|
||||
What FramePort adds itself: [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md).
|
||||
|
||||
## Documentation
|
||||
|
||||
- [docs/INSTALL.md](docs/INSTALL.md): installing, first launch, updating, Rift games, sending files, reporting problems.
|
||||
- [docs/PLAYBOOK.md](docs/PLAYBOOK.md): symptoms and fixes per game.
|
||||
- [docs/FRAME_RUNTIME.md](docs/FRAME_RUNTIME.md): Steam Frame runtime facts.
|
||||
- [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md): how the code is organised.
|
||||
| | |
|
||||
|---|---|
|
||||
| [INSTALL.md](docs/INSTALL.md) | Install, connect, update, PC VR, files, problem reports |
|
||||
| [FRAME_SETUP.md](docs/FRAME_SETUP.md) | What setup changes on the Frame, networks and firewalls, undoing it |
|
||||
| [COMPATIBILITY.md](docs/COMPATIBILITY.md) | What runs and how well |
|
||||
| [GAMES.md](docs/GAMES.md) | Tested games and how well they run |
|
||||
| [PLAYBOOK.md](docs/PLAYBOOK.md) | Symptoms and fixes per game |
|
||||
| [FRAME_RUNTIME.md](docs/FRAME_RUNTIME.md) | Steam Frame runtime facts |
|
||||
| [ARCHITECTURE.md](docs/ARCHITECTURE.md) | How the code is organised |
|
||||
| [CONTRIBUTING.md](CONTRIBUTING.md) | Code, recipes, translations |
|
||||
|
||||
## Development
|
||||
|
||||
```
|
||||
uv sync --extra dev
|
||||
uv run frameport-gui # the app
|
||||
uv run frameport --help # command line
|
||||
uv run pytest # tests
|
||||
```
|
||||
|
||||
See `CLAUDE.md` for project notes and `native/README.md` for the native components.
|
||||
## AI Usage Notice
|
||||
While I would like to program everything manually, I no longer have much free time for personal projects. As a result I make use of AI tools to make it significantly quicker to debug compatibility issues.
|
||||
|
||||
## License
|
||||
|
||||
GPL-3.0-only (it includes GPL-3.0 code from OVRPort). Not affiliated with Valve or Meta.
|
||||
GPL-3.0-only (includes GPL-3.0 code from OVRPort). Not affiliated with Valve or Meta.
|
||||
@@ -0,0 +1,8 @@
|
||||
# Security
|
||||
|
||||
FramePort talks to your Steam Frame over SSH with its own key and runs a small agent there; it also downloads tools
|
||||
and its own updates (checked against the release's SHA-256 sums and, on Windows, its signature).
|
||||
|
||||
To report a vulnerability, please open a GitHub security advisory for this repository (Security → Report a
|
||||
vulnerability) instead of a public issue. Include the FramePort version (`frameport --version`) and how to reproduce
|
||||
it. Fixes are released as normal updates; FramePort offers them automatically.
|
||||
@@ -0,0 +1,27 @@
|
||||
# Third-party notices
|
||||
|
||||
FramePort is GPL-3.0-only (see `LICENSE`). It includes or downloads the following third-party work.
|
||||
|
||||
## Included in this repository / the release bundles
|
||||
| Component | Where | License |
|
||||
|---|---|---|
|
||||
| OVRPort VrApi → OpenXR adapter (`native/vrapi`, github.com/Android-XR-Bridge/OVRPort), with FramePort's changes | `native/vrapi-bridge/`, `artifacts/arm64-v8a/libvrapi.so` | GPL-3.0 (`native/vrapi-bridge/LICENSE.upstream`) |
|
||||
| OVRPort platform compatibility library (`native/platform`) | `native/platformcompat/`, `artifacts/arm64-v8a/libovrplatformcompat.so` | GPL-3.0; Meta Platform SDK headers under the Meta Platform Technologies SDK License (`native/platformcompat/licenses/OCULUS-PLATFORM-SDK.txt`) |
|
||||
| Khronos OpenXR SDK headers | used to build the native layers | Apache-2.0 / MIT (`native/vrapi-bridge/licenses/OPENXR-SDK.txt`) |
|
||||
| Android NDK runtime (statically linked libc++) | native Android libraries | Apache-2.0 with LLVM exception, plus legacy notices (`native/vrapi-bridge/licenses/ANDROID-NDK.txt`) |
|
||||
| Flet and Flutter (desktop app runtime) | release bundles | Apache-2.0 / BSD-3-Clause |
|
||||
| flet-dropzone / desktop_drop (drag-and-drop) | release bundles | Apache-2.0 / MIT |
|
||||
| Python packages (paramiko, zeroconf, psutil, pyelftools, capstone, UnityPy, PyYAML, requests, typer, pyaxmlparser, Pillow, cryptography, …) | release bundles | their own licenses (see each package's metadata) |
|
||||
|
||||
FramePort's own native code (the FrameBridge adapter, GL/Vulkan/OpenXR shims, the Windows helpers) is GPL-3.0-only.
|
||||
|
||||
## Downloaded at run time (not redistributed)
|
||||
| Tool | Source | License |
|
||||
|---|---|---|
|
||||
| OVRPort / overport CLI | github.com/Android-XR-Bridge/OVRPort releases (fallback github.com/ovrport/app) | GPL-3.0 |
|
||||
| Eclipse Temurin JRE | api.adoptium.net | GPL-2.0 with Classpath Exception |
|
||||
| apksigner (Android build-tools) | dl.google.com Android repository | Apache-2.0 |
|
||||
| Revive (portable copy, only if Revive isn't installed) | github.com/LibreVR/Revive releases | GPL-3.0 |
|
||||
|
||||
Valve's Lepton, Proton and SteamVR, and Meta's software, are used on your devices as installed by Steam / Meta;
|
||||
FramePort doesn't distribute them.
|
||||
@@ -1,10 +1,11 @@
|
||||
0f681f54b59cfad2efc8883aee5a0971c2fba09d9ba2dca15a136b0ac74a59b8 ./arm64-v8a/libfp_vk.so
|
||||
a5b03bb7ae5d953d7ded2bf117b0a19c57fae604f16f54310847f8e89593dde6 ./arm64-v8a/libfp_ovrp.so
|
||||
6d2b9f8cea2f2cf33b8ff30d29a2f3d9c4d55549260a867168a24e44abada021 ./arm64-v8a/libfp_vk.so
|
||||
8e00552d1ab90f82749db3caad4f773351fa8a28edcc5ea5cbd1b31c434ff32a ./arm64-v8a/libframe_xrshim.so
|
||||
3dfcb0f2bec47857bcecc7261c58e076d872d4649718c40850f29e10c75477dd ./arm64-v8a/libglshim.so
|
||||
dc62857b4f7a23b194060599339dfe72b38c16cdf4a9eb1b1f3b4d1fb9071a6d ./arm64-v8a/libopenxr_loader_generic.so
|
||||
f326df1a5bd600033661f53509f076b9b4ecbb6226e9050460b1d0cfdd70fb9d ./arm64-v8a/libopenxr_loader_generic.so
|
||||
1feaeafad467c4cafdf2b018a4d84b0bee200c3f711697b4ce97e66a3ba256ca ./arm64-v8a/libovrplatformcompat.so
|
||||
32525cd0a9ee3d9993d8871cd6905bdcf22cde4f4ba28f5db6434ce7d6554758 ./arm64-v8a/libvrapi.so
|
||||
a79c598744b98b9bf581664a80bcee1a0d11a62fdcdb99f05a0f6f381b6498cd ./armeabi-v7a/libopenxr_loader_generic.so
|
||||
ddfd8b6c319bfd0ea8aada3b5e941981288ac10aa6443a79843a7b8c288f82fe ./armeabi-v7a/libopenxr_loader_generic.so
|
||||
1871eae093432d277da4bc751bf5f3269dfcf11f9168260b0c3caadb0dedb19d ./dex/oculusos-stubs.dex
|
||||
1aa733117cf57ccff7cf23f0425dbfd73b0332a3ef1c905ceeca0ccd0449c4e0 ./linux-arm64/XR_APILAYER_FRAMEPORT_timefix.json
|
||||
28c2430a02bbd8902c5bfb9562c6fd0e318654f9e05c095bfeb94b0450ab1b07 ./linux-arm64/libxr_frameport_timefix.so
|
||||
|
||||
@@ -1,59 +1,134 @@
|
||||
#!/usr/bin/env bash
|
||||
# FramePort one-time Steam Frame setup. Run in the Frame's Desktop Mode terminal (Konsole):
|
||||
# curl -fsSL http://<pc>:<port>/bootstrap.sh | bash
|
||||
# FramePort one-time Steam Frame setup. Run in the Frame's desktop terminal (SteamVR dashboard -> Launch a program
|
||||
# -> Desktop, then System -> Konsole):
|
||||
# curl -fsS <pc-ip>:<port>/<code> | bash
|
||||
# (the FramePort app shows the exact line and serves this script while its Setup page is open).
|
||||
#
|
||||
# What it does (asks before anything that needs sudo):
|
||||
# 1. sets a password for the 'steamos' user if it has none (sudo needs one)
|
||||
# 2. enables the SSH server (sshd)
|
||||
# 3. authorizes the FramePort app's SSH key (no password needed afterwards)
|
||||
# 4. announces this Frame on the local network (avahi service "_frameport._tcp") so the app finds it
|
||||
# 5. checks for Valve's Lepton Android runtime and asks Steam to install it if missing
|
||||
# What it does (no password, no sudo):
|
||||
# 1. authorizes the FramePort app's SSH key (no password needed afterwards)
|
||||
# 2. configures podman for Lepton (avoids a kernel keyring leak after ~200 game starts)
|
||||
# 3. turns on Developer Mode if it's off (Valve's own helper; it also enables the SSH server and announces the
|
||||
# Frame on the network as a SteamOS devkit). Steam restarts for that, which closes Desktop Mode: the rest
|
||||
# runs on its own as a user service and the Frame returns to its normal view.
|
||||
# 4. asks Steam to install Valve's Lepton Android runtime if it's missing, then tells the app it's done
|
||||
# Log of the part that runs on its own: ~/.cache/frameport-setup.log
|
||||
set -euo pipefail
|
||||
PC_URL="__PC_URL__" # filled in by the app when serving the script
|
||||
PAIR_CODE="__PAIR_CODE__"
|
||||
say() { printf '\n\033[1;36m==> %s\033[0m\n' "$*"; }
|
||||
|
||||
DEVKIT_HELPER=/usr/bin/steamos-polkit-helpers/steamos-devkit-mode
|
||||
STEAM_CONFIG=~/.local/share/Steam/config/config.vdf
|
||||
JOB=~/.cache/frameport-setup.sh
|
||||
LOG=~/.cache/frameport-setup.log
|
||||
|
||||
# Desktop Mode on SteamOS is a nested Plasma session inside steam.service, with its own XDG_RUNTIME_DIR and D-Bus:
|
||||
# systemctl/systemd-run --user only reach the user's systemd through the real runtime dir.
|
||||
user_systemd() {
|
||||
XDG_RUNTIME_DIR="/run/user/$(id -u)" DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/$(id -u)/bus" "$@"
|
||||
}
|
||||
|
||||
say "FramePort setup for $(hostname) ($(. /etc/os-release; echo "$NAME $VERSION_ID"))"
|
||||
|
||||
if ! passwd -S "$USER" 2>/dev/null | grep -q ' P '; then
|
||||
say "Your user has no password yet. SteamOS needs one for sudo (and as an SSH fallback)."
|
||||
passwd
|
||||
fi
|
||||
|
||||
say "Enabling the SSH server (sudo)"
|
||||
sudo systemctl enable --now sshd
|
||||
|
||||
say "Authorizing the FramePort app's key"
|
||||
key=$(curl -fsSL "$PC_URL/key?code=$PAIR_CODE")
|
||||
key=$(curl -fsS "$PC_URL/key?code=$PAIR_CODE")
|
||||
[[ "$key" == ssh-ed25519\ * ]] || { echo "Could not fetch the app's key from $PC_URL (is the app still open?)"; exit 1; }
|
||||
mkdir -p ~/.ssh && chmod 700 ~/.ssh && touch ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys
|
||||
grep -qxF "$key" ~/.ssh/authorized_keys || echo "$key" >> ~/.ssh/authorized_keys
|
||||
|
||||
say "Announcing this Frame on the network (avahi)"
|
||||
svc="<?xml version=\"1.0\" standalone='no'?>
|
||||
<!DOCTYPE service-group SYSTEM \"avahi-service.dtd\">
|
||||
<service-group>
|
||||
<name replace-wildcards=\"yes\">FramePort on %h</name>
|
||||
<service><type>_frameport._tcp</type><port>22</port><txt-record>user=$USER</txt-record><txt-record>pair=$PAIR_CODE</txt-record></service>
|
||||
</service-group>"
|
||||
echo "$svc" | sudo tee /etc/avahi/services/frameport.service >/dev/null || true
|
||||
sudo systemctl enable --now avahi-daemon >/dev/null 2>&1 || true
|
||||
sudo systemctl reload avahi-daemon >/dev/null 2>&1 || true
|
||||
|
||||
say "Configuring podman for Lepton"
|
||||
# rootless podman leaks one kernel keyring per container start; ~200 game launches would exhaust the quota
|
||||
mkdir -p ~/.config/containers
|
||||
grep -qs '^ *keyring *=' ~/.config/containers/containers.conf || printf '[containers]\nkeyring = false\n' >> ~/.config/containers/containers.conf
|
||||
|
||||
say "Checking for Lepton (Valve's Android runtime)"
|
||||
if ls ~/.local/share/Steam/steamapps/common/Lepton/lepton >/dev/null 2>&1; then
|
||||
echo "Lepton found."
|
||||
# The rest: Developer Mode (if needed), Lepton, telling the app. As a file, so it can run as its own user service:
|
||||
# stopping Steam ends Desktop Mode and every program started in it, this terminal included.
|
||||
mkdir -p ~/.cache
|
||||
cat >"$JOB" <<'JOB'
|
||||
set -u
|
||||
MODE=$1 PC_URL=$2 PAIR_CODE=$3 CONFIG=$4 HELPER=$5
|
||||
log() { echo "$(date +%T) $*"; }
|
||||
if [[ $MODE == devmode ]]; then
|
||||
sleep 5 # let the user read the terminal before Desktop Mode closes
|
||||
# Steam re-applies "DevModeEnabled" from config.vdf at every start (calling Valve's helper) and rewrites
|
||||
# config.vdf when it exits: stop Steam, set the value, run the helper (pkexec, allowed without a password), start.
|
||||
log "stopping Steam"
|
||||
systemctl --user stop steam.service
|
||||
for _ in $(seq 40); do pgrep -x steam >/dev/null || break; sleep 1; done
|
||||
if pgrep -x steam >/dev/null; then
|
||||
log "Steam didn't stop"
|
||||
systemctl --user start steam.service
|
||||
exit 1
|
||||
fi
|
||||
cp "$CONFIG" "$CONFIG.before-frameport"
|
||||
python3 - "$CONFIG" <<'PY'
|
||||
import re, sys
|
||||
path = sys.argv[1]
|
||||
text = open(path, encoding="utf-8").read()
|
||||
if re.search(r'"DevModeEnabled"\s+"\d+"', text):
|
||||
text = re.sub(r'("DevModeEnabled"\s+)"\d+"', r'\1"1"', text)
|
||||
else: # Steam keeps it in InstallConfigStore/developer
|
||||
lines, keys, key, at = text.splitlines(keepends=True), [], None, None
|
||||
for i, line in enumerate(lines):
|
||||
s = line.strip()
|
||||
if s == "{":
|
||||
keys.append((key or "").lower())
|
||||
if keys == ["installconfigstore", "developer"]:
|
||||
at = ("in", i, line[:len(line) - len(line.lstrip())] + "\t")
|
||||
break
|
||||
elif s == "}":
|
||||
if keys == ["installconfigstore"]: # end of the top section without a developer block
|
||||
at = ("new", i, line[:len(line) - len(line.lstrip())] + "\t")
|
||||
break
|
||||
keys.pop()
|
||||
elif re.fullmatch(r'"[^"]*"', s):
|
||||
key = s.strip('"')
|
||||
if at is None:
|
||||
sys.exit("unexpected config.vdf layout")
|
||||
kind, i, ind = at
|
||||
if kind == "in":
|
||||
lines.insert(i + 1, f'{ind}"DevModeEnabled"\t\t"1"\n')
|
||||
else:
|
||||
lines[i:i] = [f'{ind}"developer"\n', f"{ind}{{\n", f'{ind}\t"DevModeEnabled"\t\t"1"\n', f"{ind}}}\n"]
|
||||
text = "".join(lines)
|
||||
open(path, "w", encoding="utf-8").write(text)
|
||||
PY
|
||||
rc=$?
|
||||
[[ $rc == 0 ]] && { "$HELPER" --enable; rc=$?; }
|
||||
log "Developer Mode: $([[ $rc == 0 && -f /etc/steamos-devkit-enabled ]] && echo on || echo "failed ($rc)")"
|
||||
systemctl --user start steam.service
|
||||
[[ $rc == 0 ]] || exit 1
|
||||
for _ in $(seq 90); do pgrep -x steam >/dev/null && break; sleep 1; done
|
||||
sleep 20 # let Steam finish starting before asking it for anything
|
||||
fi
|
||||
if [[ -e ~/.local/share/Steam/steamapps/common/Lepton/lepton ]]; then
|
||||
log "Lepton found"
|
||||
else
|
||||
echo "Lepton is missing. Make sure Developer Mode is on (Settings > System > Developer)."
|
||||
echo "Asking Steam to install it now; confirm in Steam, or launch 'Lepton Development' from your library once."
|
||||
(steam steam://install/3029110 >/dev/null 2>&1 &) || true
|
||||
log "asking Steam to install Lepton (confirm it in Steam)"
|
||||
steam steam://install/3029110 >/dev/null 2>&1 &
|
||||
fi
|
||||
if curl -fsS "$PC_URL/paired?code=$PAIR_CODE&user=$(id -un)&host=$(hostname)" >/dev/null; then
|
||||
log "told FramePort: done"
|
||||
else
|
||||
log "couldn't reach FramePort at $PC_URL"
|
||||
fi
|
||||
JOB
|
||||
|
||||
if [[ -f /etc/steamos-devkit-enabled ]]; then
|
||||
say "Developer Mode is on"
|
||||
bash "$JOB" finish "$PC_URL" "$PAIR_CODE" "$STEAM_CONFIG" "$DEVKIT_HELPER" 2>&1 | tee "$LOG"
|
||||
say "Done. Return to FramePort on your PC: this Frame should now appear as connected."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
curl -fsS "$PC_URL/paired?code=$PAIR_CODE&user=$USER&host=$(hostname)" >/dev/null 2>&1 || true
|
||||
say "Done. Return to FramePort on your PC: this Frame should now appear as connected."
|
||||
say "Turning on Developer Mode"
|
||||
if [[ ! -x "$DEVKIT_HELPER" || ! -f "$STEAM_CONFIG" ]] || \
|
||||
! user_systemd systemd-run --user --collect --quiet --unit="frameport-setup-$$" \
|
||||
bash -c 'bash "$0" "$@" >"$HOME/.cache/frameport-setup.log" 2>&1' \
|
||||
"$JOB" devmode "$PC_URL" "$PAIR_CODE" "$STEAM_CONFIG" "$DEVKIT_HELPER"; then
|
||||
echo "Couldn't turn it on automatically. Turn it on in Settings > System > Developer, then run this command again."
|
||||
exit 1
|
||||
fi
|
||||
echo "Steam restarts to turn it on. That closes the desktop in a few seconds and the Frame returns to its"
|
||||
echo "normal view; setup finishes on its own. If Steam asks to install Lepton, confirm it."
|
||||
echo "Then return to FramePort on your PC: the Frame appears as connected within a minute."
|
||||
@@ -0,0 +1,20 @@
|
||||
package: com.Appnori.AllInOneSports
|
||||
title: AllInOneSports
|
||||
status: works
|
||||
tested_version: 1.9.0
|
||||
engine: Unity
|
||||
xr: OpenXR
|
||||
frame:
|
||||
- frame.unity_text_input
|
||||
- frame.oculusos
|
||||
device:
|
||||
- device.text_input_window
|
||||
verified:
|
||||
date: '2026-10-04'
|
||||
known_good_sha256: a1f9535ac569068bba25f137f131db9d4c3e997c072f3e790beac8ffef701fe3
|
||||
app: 0.6.3
|
||||
overport_cli: 1.2.5
|
||||
frame_build: '20260930.6234839'
|
||||
agent: 35
|
||||
issue: 13
|
||||
source_hint: All In One Sports
|
||||
@@ -0,0 +1,28 @@
|
||||
package: com.Armature.VR4
|
||||
title: VR4
|
||||
status: works
|
||||
notes: Installs the no-ForceQuit build and fixes a campaign shader that hung the GPU after the opening cutscene.
|
||||
details: Entering the campaign gave a black screen, slowing audio and a crash (Mercenaries loaded). One fragment shader
|
||||
reads a loop counter before setting it, which hangs the GPU; the Vulkan shim zeroes it (vk_shader_fix). The
|
||||
no-ForceQuit build is kept. Diagnosed and confirmed on a Frame by the reporter of GitHub issue 10.
|
||||
tested_version: '2.3'
|
||||
engine: Unreal
|
||||
xr: VrApi
|
||||
alt_overport:
|
||||
- patch_remove_unreal_force_quit
|
||||
use_alt: true
|
||||
adapter:
|
||||
# one campaign shader reads an uninitialized loop counter and hangs the GPU (black screen, slowing audio, crash);
|
||||
# the Vulkan shim inserts two OpStores that zero it and its accumulator (from the reporter's capture, GitHub
|
||||
# issue 10)
|
||||
vk_shader_fix: 6488:5dcd842db8d21e3fdd13ec916d2e34dd0cfdf12a92fffaf8a27115072ef55c59:2624:0x0003003e,138,18,0x0003003e,150,42
|
||||
verified:
|
||||
date: '2026-10-02'
|
||||
known_good_sha256: 40ff74e37264b28ae8826923b69d0731d9620094c76462be34159643d6ae91b3
|
||||
app: 0.3.4
|
||||
overport_cli: 1.2.5
|
||||
frame_build: '20260930.6234839'
|
||||
agent: 26
|
||||
issue: 1
|
||||
updated: '2026-10-04'
|
||||
source_hint: Resident Evil 4
|
||||
@@ -0,0 +1,19 @@
|
||||
package: com.CyanWorlds.Myst
|
||||
title: Myst
|
||||
status: issues
|
||||
notes: Minor graphical glitches on some objects.
|
||||
details: The crash is in the Frame's SteamVR runtime (vrclient.so CVRInputLatest::UpdateActionStateInternal via
|
||||
xrSyncActions) on the first input sync after focus, in 2 of 4 headset sessions. sync_guard serialises input syncs
|
||||
with event polling and pauses them for 250 ms after focus returns (confirmed in the headset, no crash). The object
|
||||
glitches are not application space warp (turning it off didn't change them and ran slightly worse).
|
||||
tested_version: 3.3.0
|
||||
engine: Unreal
|
||||
xr: OpenXR
|
||||
alt_overport:
|
||||
- patch_remove_unreal_force_quit
|
||||
adapter:
|
||||
sync_guard: 1
|
||||
verified:
|
||||
date: '2026-10-04'
|
||||
updated: '2026-10-04'
|
||||
source_hint: Myst
|
||||
@@ -0,0 +1,20 @@
|
||||
package: com.CyanWorlds.Riven
|
||||
title: Riven
|
||||
status: works
|
||||
notes: Plays as expected.
|
||||
tested_version: 1.9.0
|
||||
engine: Unreal
|
||||
xr: OpenXR
|
||||
alt_overport:
|
||||
- patch_remove_unreal_force_quit
|
||||
adapter:
|
||||
equirect_emul: 1
|
||||
verified:
|
||||
date: '2026-10-04'
|
||||
known_good_sha256: 7c211588f39c21d67998ac6a6aeb44a8ad66c6551a1b0feb1bcf44e2cef98bdf
|
||||
app: 0.6.3
|
||||
overport_cli: 1.2.5
|
||||
frame_build: '20260930.6234839'
|
||||
agent: 35
|
||||
issue: 26
|
||||
source_hint: Riven
|
||||
@@ -0,0 +1,16 @@
|
||||
package: com.GhostlyBirdGames.BattleGlide
|
||||
title: BattleGlide
|
||||
status: works
|
||||
notes: Freezes from the headset's brief focus losses are hidden (focus_hold).
|
||||
details: The Frame drops the session out of focus for ~0.5 s every few seconds (11 times in 80 s of play) and Unreal
|
||||
pauses each time; focus_hold hides dips up to 1 s once the game has been focused for 1 s. Longer dips (real
|
||||
interruptions) still pause it.
|
||||
tested_version: 0.4.1 (BETA)
|
||||
engine: Unreal
|
||||
xr: OpenXR
|
||||
adapter:
|
||||
focus_hold: 1
|
||||
verified:
|
||||
date: '2026-10-04'
|
||||
updated: '2026-10-04'
|
||||
source_hint: BattleGlide
|
||||
@@ -0,0 +1,23 @@
|
||||
package: com.NewFolderGames.IAmCat
|
||||
title: I Am Cat
|
||||
status: issues
|
||||
notes: The view vibrates slightly, even when holding still.
|
||||
details: Unity 2022.3 with the Oculus XR Plugin falls back to GLES (Zink) on the Frame, where its single-pass
|
||||
(multiview) rendering drew the right eye wrong (GitHub issue 8); frame.unity_multipass renders each eye in its own
|
||||
pass (OculusSettings.GetStereoRenderingMode + its inlined read in OculusLoader.Initialize). Poses and frame times
|
||||
are consistent, but every frame reaches the runtime one display period late (two passes on Zink) and the game
|
||||
clamps its physics step to 10 ms, so the view judders; scale 0.8 didn't change it. Possible next steps are fixing the
|
||||
multiview path instead or the game's fixed timestep.
|
||||
tested_version: 1.4.0.0
|
||||
engine: Unity
|
||||
xr: OpenXR
|
||||
frame:
|
||||
- frame.unity_text_input
|
||||
- frame.unity_multipass
|
||||
device:
|
||||
- device.text_input_window
|
||||
verified:
|
||||
date: '2026-10-03'
|
||||
issue: 8
|
||||
updated: '2026-10-04'
|
||||
source_hint: I Am Cat
|
||||
@@ -0,0 +1,15 @@
|
||||
package: com.StressLevelZero.BONELAB
|
||||
title: BONELAB
|
||||
status: unsupported
|
||||
notes: Crashes while starting its graphics (Vulkan); no fix yet.
|
||||
details: SIGSEGV in vkCreateInstance, called from the game's own Vulkan hooks (libSLZQuestNative.so) into code that no
|
||||
longer exists, right after OVRPlugin's pre-initialization creates and destroys an OpenXR instance. Keeping the
|
||||
runtime (vrclient.so) and Steam's Fossilize layer loaded didn't help, so the stale pointer is to memory freed with
|
||||
that first instance.
|
||||
tested_version: 1.2974.57485
|
||||
engine: Unity
|
||||
xr: OpenXR
|
||||
verified:
|
||||
date: '2026-10-04'
|
||||
updated: '2026-10-04'
|
||||
source_hint: BONELAB
|
||||
@@ -9,8 +9,11 @@ notes: Some launch warning text is still upside down; the rest of the UI is fixe
|
||||
may not work.
|
||||
details: Ubisoft online login may not work. Data folder holds raw assets (start0..2, .climb, bundles), not .obb
|
||||
files; install to obb as-is.
|
||||
overport_extra:
|
||||
- patch_ac_nexus_no_appsw_90
|
||||
verified:
|
||||
date: '2026-09-28'
|
||||
overport_cli: 1.2.3
|
||||
overport_runtime: 3.4.3-23204ea
|
||||
known_good_sha256: 89644a12bf8df956fa3d3a9a40540ba9e1fb62f63494714a05c9f05984383ac8
|
||||
no_appsw_90: '2026-10-02, OVRPort 1.2.5 (owner: 90 Hz felt better than 72 Hz; same known issues)'
|
||||
@@ -0,0 +1,22 @@
|
||||
package: com.Warpfrog.BladeAndSorcery
|
||||
title: 'Blade & Sorcery: Nomad'
|
||||
status: works
|
||||
notes: The headset's brief focus losses are hidden (focus_hold, up to 2.5 s).
|
||||
details: The Frame's runtime drops focus now and then (mostly 1.5-7 s, some only milliseconds); the game pauses
|
||||
("System menu opened", the world freezes) and re-aligns the player when focus returns (Player.OnVRPresence ->
|
||||
Teleport, the sideways jump). They match the headset's wear sensor flickering off while worn (SteamVR "HMD off" 0.5-2
|
||||
s), which only this game reacts to; focus_hold hides dips up to 2.5 s here. Rendering keeps 72 fps throughout.
|
||||
tested_version: 1.3.1
|
||||
engine: Unity
|
||||
xr: OpenXR
|
||||
frame:
|
||||
- frame.unity_text_input
|
||||
device:
|
||||
- device.text_input_window
|
||||
adapter:
|
||||
focus_hold: 1
|
||||
focus_hold_ms: 2500
|
||||
verified:
|
||||
date: '2026-10-04'
|
||||
updated: '2026-10-04'
|
||||
source_hint: Blade & Sorcery Nomad
|
||||
@@ -0,0 +1,23 @@
|
||||
package: com.beatgames.beatpaber
|
||||
title: Beat Saber (co-existence build)
|
||||
status: works
|
||||
notes: A Beat Saber build with its own package name, so a modded and an unmodded Beat Saber can be installed side by
|
||||
side.
|
||||
details: The submitted build's app label was very long and the game didn't appear in the Frame's Steam library (GitHub
|
||||
issue 27, a shortcut Steam dropped again; fixed in 0.7.0); the recipe's title names it.
|
||||
tested_version: 1.45.1_27839
|
||||
engine: Unity
|
||||
xr: OpenXR
|
||||
frame:
|
||||
- frame.unity_text_input
|
||||
device:
|
||||
- device.text_input_window
|
||||
verified:
|
||||
date: '2026-10-05'
|
||||
known_good_sha256: 9965b01d5d1a3707bce1762f60d5419ce3e89bc095c63586f6940bb69696e9fd
|
||||
app: 0.6.3
|
||||
overport_cli: 1.2.5
|
||||
frame_build: '20260930.6234839'
|
||||
agent: 35
|
||||
issue: 29
|
||||
source_hint: Beat Saber
|
||||
@@ -0,0 +1,19 @@
|
||||
package: com.beatgames.beatsaber
|
||||
title: Beat Saber
|
||||
status: works
|
||||
tested_version: 1.40.8_7379
|
||||
engine: Unity
|
||||
xr: OpenXR
|
||||
frame:
|
||||
- frame.unity_text_input
|
||||
device:
|
||||
- device.text_input_window
|
||||
verified:
|
||||
date: '2026-10-03'
|
||||
known_good_sha256: ee720e040931f2547f7611e58ec5ad72d86e800dd4cf3135f576019683f2f359
|
||||
app: 0.6.1
|
||||
overport_cli: 1.2.5
|
||||
frame_build: '20260930.6234839'
|
||||
agent: 33
|
||||
issue: 6
|
||||
source_hint: Beat Saber
|
||||
@@ -0,0 +1,17 @@
|
||||
package: com.crowscrowscrows.AccountingPlus
|
||||
title: Accounting+
|
||||
status: issues
|
||||
notes: Starts in VR, but doesn't get past its "press any button" screen.
|
||||
details: Unity 2017.4 built-in Oculus support. frame.unity_oculus_check gets VR started (Meta's system-app check and
|
||||
the frame wait its legacy loop never makes, libfp_ovrp.so), ~72 fps. Controller input reaches the game's OVRInput
|
||||
cleanly (both Touch controllers connected, individual button bits, input focus 1 while focused) but the screen
|
||||
doesn't continue; Cpp2IL can't read this Unity version to see what it waits for.
|
||||
tested_version: 1.24.35
|
||||
engine: Unity
|
||||
xr: VrApi
|
||||
frame:
|
||||
- frame.unity_oculus_check
|
||||
verified:
|
||||
date: '2026-10-04'
|
||||
updated: '2026-10-04'
|
||||
source_hint: Accounting+
|
||||
@@ -0,0 +1,20 @@
|
||||
package: com.iillusions.spacepiratetrainerquest
|
||||
title: Space Pirate Trainer Quest
|
||||
status: works
|
||||
tested_version: '1.97'
|
||||
engine: Unity
|
||||
xr: VrApi
|
||||
frame:
|
||||
- frame.unity_text_input
|
||||
- frame.unity_runtime_msaa_off
|
||||
device:
|
||||
- device.text_input_window
|
||||
verified:
|
||||
date: '2026-10-04'
|
||||
known_good_sha256: 711d87e6c1fa14fdcdc8bab5792657523d0281b5d904f7f1abafd98f3189d2c0
|
||||
app: 0.6.3
|
||||
overport_cli: 1.2.5
|
||||
frame_build: '20260930.6234839'
|
||||
agent: 35
|
||||
issue: 14
|
||||
source_hint: Space Pirate Trainer
|
||||
@@ -0,0 +1,19 @@
|
||||
package: com.lakento.dinosquest
|
||||
title: Dinosaur Island
|
||||
status: works
|
||||
tested_version: 1.7.5
|
||||
engine: Unity
|
||||
xr: VrApi
|
||||
frame:
|
||||
- frame.unity_text_input
|
||||
device:
|
||||
- device.text_input_window
|
||||
verified:
|
||||
date: '2026-10-03'
|
||||
known_good_sha256: 41ecbc728dc533eebcc3980e140fe1764fbd1958735d8a299c63fa9cda13a923
|
||||
app: 0.6.2
|
||||
overport_cli: 1.2.5
|
||||
frame_build: '20260930.6234839'
|
||||
agent: 33
|
||||
issue: 12
|
||||
source_hint: DINOSAUR ISLAND
|
||||
@@ -0,0 +1,19 @@
|
||||
package: com.owlchemylabs.jobsimulator
|
||||
title: Job Simulator
|
||||
status: works
|
||||
tested_version: 1.4.0.6515
|
||||
engine: Unity
|
||||
xr: OpenXR
|
||||
frame:
|
||||
- frame.unity_text_input
|
||||
device:
|
||||
- device.text_input_window
|
||||
verified:
|
||||
date: '2026-10-03'
|
||||
known_good_sha256: 64638d7f93bb93cc61f422a43a08bb0d35b9bb4b463e90a42da7002147f03d1b
|
||||
app: 0.6.2
|
||||
overport_cli: 1.2.5
|
||||
frame_build: '20260930.6234839'
|
||||
agent: 33
|
||||
issue: 11
|
||||
source_hint: Job Simulator
|
||||
@@ -0,0 +1,20 @@
|
||||
package: com.parkline.wander
|
||||
title: Wander
|
||||
status: works
|
||||
tested_version: '0.3569'
|
||||
engine: Unity
|
||||
xr: OpenXR
|
||||
frame:
|
||||
- frame.unity_text_input
|
||||
- frame.unity_runtime_msaa_off
|
||||
device:
|
||||
- device.text_input_window
|
||||
verified:
|
||||
date: '2026-10-04'
|
||||
known_good_sha256: c0c9de22b3646f35009a53796757d26f8d4e95259713f26a18fae2be995b23aa
|
||||
app: 0.6.3
|
||||
overport_cli: 1.2.5
|
||||
frame_build: '20260930.6234839'
|
||||
agent: 35
|
||||
issue: 17
|
||||
source_hint: Wander
|
||||
@@ -0,0 +1,20 @@
|
||||
package: com.playful.LuckysTale
|
||||
title: Lucky's Tale
|
||||
status: issues
|
||||
notes: Keeps MSAA off; the game turned it on by itself and the whole Frame restarted in a menu.
|
||||
details: Meta's OVRManager raises MSAA to 4x at runtime ("Switching to the recommended level"); multisampled
|
||||
render-to-texture on GLES (Zink) hung the Frame's GPU (GitHub issue 9). frame.unity_runtime_msaa_off keeps it at 0;
|
||||
not yet confirmed in a headset.
|
||||
tested_version: 1.0.55
|
||||
engine: Unity
|
||||
xr: VrApi
|
||||
frame:
|
||||
- frame.unity_text_input
|
||||
- frame.unity_runtime_msaa_off
|
||||
device:
|
||||
- device.text_input_window
|
||||
verified:
|
||||
date: '2026-10-03'
|
||||
issue: 9
|
||||
updated: '2026-10-04'
|
||||
source_hint: Luckys Tale
|
||||
@@ -0,0 +1,19 @@
|
||||
package: com.resolutiongames.cookinggame
|
||||
title: Cook-Out
|
||||
status: works
|
||||
tested_version: 1.20.0.10625-release
|
||||
engine: Unity
|
||||
xr: OpenXR
|
||||
frame:
|
||||
- frame.unity_text_input
|
||||
device:
|
||||
- device.text_input_window
|
||||
verified:
|
||||
date: '2026-10-03'
|
||||
known_good_sha256: 7217649c503adf76f3a959fc72858c446c2a42a9ce9e209286977b1950397915
|
||||
app: 0.6.1
|
||||
overport_cli: 1.2.5
|
||||
frame_build: '20260930.6234839'
|
||||
agent: 33
|
||||
issue: 3
|
||||
source_hint: com.resolutiongames.cookinggame
|
||||
@@ -0,0 +1,14 @@
|
||||
package: com.roblox.client
|
||||
title: Roblox
|
||||
status: unsupported
|
||||
notes: Crashes on its first VR frame on the Frame.
|
||||
details: SIGSEGV on Roblox's render thread right after it re-creates its eye swapchains (format 37, which the Frame
|
||||
doesn't offer, retried as sRGB 43) — in its own code or inside the runtime's xrBeginFrame. No integrity or login
|
||||
check involved; also needs an online login once it runs.
|
||||
tested_version: 2.741.1051
|
||||
engine: Other
|
||||
xr: OpenXR
|
||||
verified:
|
||||
date: '2026-10-04'
|
||||
updated: '2026-10-04'
|
||||
source_hint: Roblox
|
||||
@@ -0,0 +1,19 @@
|
||||
package: com.steelcrategames.keeptalkingandnobodyexplodes
|
||||
title: Keep Talking and Nobody Explodes
|
||||
status: works
|
||||
tested_version: 1.10.15
|
||||
engine: Unity
|
||||
xr: OpenXR
|
||||
frame:
|
||||
- frame.unity_text_input
|
||||
device:
|
||||
- device.text_input_window
|
||||
verified:
|
||||
date: '2026-10-04'
|
||||
known_good_sha256: 1a6f18e6d7b077e2662c7e633d473018067f4c871f5c45c4632c58233feaeac5
|
||||
app: 0.6.3
|
||||
overport_cli: 1.2.5
|
||||
frame_build: '20260930.6234839'
|
||||
agent: 35
|
||||
issue: 15
|
||||
source_hint: Keep Talking and Nobody Explodes
|
||||
@@ -0,0 +1,21 @@
|
||||
package: com.stremio.vrone
|
||||
title: Stremio
|
||||
status: works
|
||||
notes: 'Unity 6 VR media centre (its interface is web pages in Vuplex 3D WebView). Text fields closed at once on the
|
||||
Frame (no system keyboard): frame.unity_text_input keeps them selected and device.text_input_window shows the
|
||||
Android window so Steam''s on-screen keyboard (or Type on Frame from the PC) types into them; confirmed in the
|
||||
headset by the owner (2026-10-03), who confirmed it working. Note: the add-ons page can stay blank in VR (the
|
||||
add-on sync itself succeeds). "Play in an external player" can''t reach another app: Lepton sends every link to
|
||||
Steam''s browser.'
|
||||
details: 'Patches: frame.unity_text_input (TMP_InputField.TouchScreenKeyboardShouldBeUsed -> false,
|
||||
isKeyboardUsingEvents -> true; uGUI InputField too), device.text_input_window (lepton-show-flatscreen).'
|
||||
tested_version: 0.7.5
|
||||
engine: Unity
|
||||
xr: OpenXR
|
||||
frame:
|
||||
- frame.unity_text_input
|
||||
device:
|
||||
- device.text_input_window
|
||||
verified:
|
||||
date: '2026-10-03'
|
||||
source_hint: Stremio
|
||||
@@ -0,0 +1,20 @@
|
||||
package: rift.superhot_vr
|
||||
title: SUPERHOT VR
|
||||
status: works
|
||||
notes: 'Supports SteamVR/OpenXR itself: runs directly, without Revive.'
|
||||
engine: Unity
|
||||
xr: OpenXR
|
||||
kind: rift
|
||||
pcvr:
|
||||
- pcvr.xr_timefix
|
||||
- pcvr.steamvr_tuning
|
||||
pcvr_remove:
|
||||
- pcvr.revive
|
||||
as_is: true
|
||||
verified:
|
||||
date: '2026-10-05'
|
||||
known_good_sha256: 143dd3c6a93a45819a98e3cca8fd1535b461cdf860c927d955ca54815faf5d7b
|
||||
app: 0.6.3
|
||||
overport_cli: 1.2.5
|
||||
issue: 28
|
||||
source_hint: SUPERHOT VR
|
||||
@@ -5,11 +5,15 @@ source_hint: Nano
|
||||
engine: Unity
|
||||
xr: OpenXR
|
||||
status: works
|
||||
notes: Needed Oculus OS telemetry class stubs.
|
||||
notes: Needs Oculus OS telemetry class stubs and the no-ForceQuit build (the normal build quits right after
|
||||
starting).
|
||||
verified:
|
||||
date: '2026-09-28'
|
||||
date: '2026-10-02' # owner-confirmed with the no-ForceQuit build
|
||||
overport_cli: 1.2.3
|
||||
overport_runtime: 3.4.3-23204ea
|
||||
known_good_sha256: 31469d50b8ee292597291db7cc3bc3eca8e851f533cd92bba0d64214893580cc
|
||||
frame:
|
||||
- frame.oculusos
|
||||
alt_overport:
|
||||
- patch_remove_unreal_force_quit
|
||||
use_alt: true
|
||||
@@ -44,7 +44,43 @@ signatures:
|
||||
pattern: 'zink.*DEVICE[_ ]LOST|VK_ERROR_DEVICE_LOST'
|
||||
severity: fatal
|
||||
diagnosis: The GPU hung (Zink/Mesa). For GLES Unity games MSAA render-to-texture is the usual cause.
|
||||
suggest: [frame.unity_no_msaa]
|
||||
suggest: [frame.unity_no_msaa, frame.unity_runtime_msaa_off]
|
||||
- id: unity-runtime-msaa
|
||||
pattern: 'recommended MSAA level is [248]\. Switching to the recommended level'
|
||||
severity: info
|
||||
diagnosis: The game's OVRManager turns MSAA on at runtime (QualitySettings can't keep it off). On GLES this can
|
||||
hang the Frame's GPU or restart the headset; if it does, keep it off in the game's code.
|
||||
suggest: [frame.unity_runtime_msaa_off]
|
||||
- id: runtime-input-crash
|
||||
pattern: 'vrclient\.so[^\n]*(UpdateActionStateInternal|sxr_xrSyncActions)'
|
||||
severity: fatal
|
||||
diagnosis: The Frame's runtime crashed in its controller-input code (xrSyncActions), typically right after the game
|
||||
got focus. sync_guard serialises input syncs and pauses them briefly after focus returns.
|
||||
suggest: [adapter.sync_guard]
|
||||
- id: focus-dip-teleport
|
||||
pattern: 'OnVRPresence[^\n]*Teleport'
|
||||
severity: warning
|
||||
diagnosis: The game moves the player when the headset reports presence again, which the Frame's brief focus dips
|
||||
trigger (the view jumps). focus_hold hides dips under 600 ms.
|
||||
suggest: [adapter.focus_hold]
|
||||
- id: unity-vr-device-none
|
||||
pattern: 'NewtonVR.*(not setup properly|no headset found)|Loaded VR device: None|XR: Oculus could not be loaded'
|
||||
severity: fatal
|
||||
diagnosis: Unity didn't start its Oculus VR device (older Unity checks for Meta's system apps first), so the game
|
||||
runs as a hidden 2D app.
|
||||
suggest: [frame.unity_oculus_check]
|
||||
- id: sdl-no-clipboard
|
||||
pattern: 'ClipboardManager\.addPrimaryClipChangedListener|SDLClipboardHandler\.<init>'
|
||||
severity: fatal
|
||||
diagnosis: An SDL app (SDL2 / LÖVE) crashed at start because Lepton's Android has no clipboard service.
|
||||
suggest: [frame.sdl_clipboard]
|
||||
- id: controller-profile-rejected
|
||||
pattern: 'PATH_UNSUPPORTED.*xrSuggestInteractionProfileBindings|xrSuggestInteractionProfileBindings.*(-48|PATH_UNSUPPORTED)'
|
||||
severity: info
|
||||
diagnosis: The runtime rejected controller bindings for a profile it doesn't know (Meta's Touch Plus/Pro). Usually
|
||||
harmless (Meta's OVRPlugin suggests plain Touch too); a game that suggests only these gets them again as Touch
|
||||
(profile_remap, on by default; log "controller profile ... -> oculus/touch_controller").
|
||||
suggest: []
|
||||
- id: gl-shader-failed
|
||||
pattern: 'GLShim\s*: SHADER COMPILE FAILED|#extension directive is not allowed in the middle|could not implicitly convert operands'
|
||||
severity: error
|
||||
@@ -79,7 +115,8 @@ signatures:
|
||||
agent's controller_models command).
|
||||
suggest: []
|
||||
- id: scene-missing
|
||||
pattern: 'XR_FB_scene|XR_FB_spatial_entity.*(not supported|UNSUPPORTED)|xrQuerySpacesFB'
|
||||
# not OVRPlugin's routine "Unavailable OpenXR extension: XR_FB_scene" (printed by every OVRPlugin game)
|
||||
pattern: '(?<!Unavailable OpenXR extension: )XR_FB_scene|XR_FB_spatial_entity.*(not supported|UNSUPPORTED)|xrQuerySpacesFB'
|
||||
severity: warning
|
||||
diagnosis: The game uses the Meta scene (room) API; enable the adapter's guardian-based room emulation.
|
||||
suggest: [adapter.scene_emul]
|
||||
|
||||
@@ -84,3 +84,21 @@ update [--check] [--yes]`. CI runs `scripts/update_smoke.py` on every OS with th
|
||||
overport CLI release (Android-XR-Bridge/OVRPort, fallback ovrport/app) + patch list + titles, Temurin JRE (Adoptium API), apksigner (Google repository index),
|
||||
store artwork/titles (overport image API), catalog (optional remote), Lepton location/appid (Frame appmanifests),
|
||||
Steam user (Frame userdata).
|
||||
|
||||
## Built on
|
||||
|
||||
FramePort is a front end for other projects; most of the functionality comes from them:
|
||||
|
||||
| Project | Used for |
|
||||
|---|---|
|
||||
| [OVRPort](https://github.com/Android-XR-Bridge/OVRPort) (overport, originally [ovrport/app](https://github.com/ovrport/app)) | Converts Quest games to OpenXR: its CLI applies the game patches and supplies the OpenXR loader; FramePort also includes its VrApi→OpenXR adapter |
|
||||
| Valve Lepton, Proton and SteamVR | Run Android games, Windows games and OpenXR on the Frame |
|
||||
| [Revive](https://github.com/LibreVR/Revive) (LibreVR) | Runs Oculus Rift games on OpenXR / SteamVR |
|
||||
| Mesa (Zink) | OpenGL ES on Vulkan on the Frame |
|
||||
| [Khronos OpenXR SDK](https://github.com/KhronosGroup/OpenXR-SDK) | OpenXR headers for the native layers |
|
||||
| Eclipse Temurin, Android apksigner, Android NDK | Java runtime, APK signing, building the native layers |
|
||||
| [Flet](https://flet.dev) | The desktop app |
|
||||
| OculusDB, Steam store | Game descriptions, genres and artwork |
|
||||
|
||||
FramePort's own parts: game detection and recipes, the Steam Frame OpenXR adapter (FrameBridge) and the other native
|
||||
fixes in `native/`, the installer agent that runs on the Frame, and the desktop/command-line app.
|
||||
@@ -0,0 +1,30 @@
|
||||
# Compatibility
|
||||
|
||||
The built-in catalog has tested settings for games, each marked as working, working with known issues, or not
|
||||
running on the Frame: see the [list of tested games](GAMES.md) (recipes in [catalog/games](../catalog/games)).
|
||||
Other games get suggested patches from detection rules; each suggestion states its reason, and every patch can be
|
||||
switched on or off under **Customize**: described in plain words, with **Show technical details** for the exact
|
||||
effect of each patch.
|
||||
|
||||
Tried an untested game? Its page asks how it runs; **Share working config…** opens a prefilled GitHub issue so your
|
||||
recipe can join the built-in catalog for everyone.
|
||||
|
||||

|
||||
|
||||
| Kind of app | On the Steam Frame |
|
||||
|---|---|
|
||||
| Meta Quest games (APK) | Translated to OpenXR (OVRPort) and patched for the Frame; run in Valve's Android runtime (Lepton) |
|
||||
| Other Android VR apps using OpenXR (e.g. Pico builds) | Translated the same way; the other headset's own extensions and store services aren't available |
|
||||
| Ordinary Android apps and games (no VR) | Installed unchanged and shown as a flat window in the headset |
|
||||
| PC VR games (Windows; OpenXR, SteamVR or Oculus) | Run through Proton on the Frame (experimental), or on a Windows PC with SteamVR and streamed to the Frame; Oculus-only games use Revive |
|
||||
| Can't run | 32-bit-only or x86-only APKs, Pico/HTC Wave SDK apps, Android XR apps, and games that check an Oculus licence (they need the Oculus app on a PC) |
|
||||
|
||||
Automated launch tests confirm that a game starts; visuals can only be checked in the headset.
|
||||
|
||||

|
||||
|
||||
The **Files** tab manages files on the Frame: upload videos, documents, mods or saves from the computer (buttons or
|
||||
drag-and-drop), download, rename and delete (one entry or a selection), in the shared folders every game sees or in
|
||||
one game's own storage.
|
||||
|
||||

|
||||
@@ -14,6 +14,19 @@
|
||||
`keyring = false` in `~/.config/containers/containers.conf`; a reboot clears already-leaked keys.
|
||||
- Picks the activity with category LAUNCHER (`APP_ACTIVITY`). Game data is visible at `/sdcard/Android/{obb,data}/<pkg>`.
|
||||
- 64-bit only (no AArch32).
|
||||
- `<install>/lepton-shaders/` holds Mesa's shader cache (Lepton sets `mesa.shader.cache.dir=/data/shaders`):
|
||||
`foz_cache.foz` + `foz_cache_idx.foz` per graphics driver (Turnip Vulkan, zink GL), typically 4–6 files and 7–19 MB
|
||||
per game, 2D apps included. It speeds up later starts; deleting it only costs one slower start.
|
||||
- **2D apps** (verified 2026-10-02 with an open-source 2048 game): Lepton runs every app headless
|
||||
(`lepton.headless=true`; only OpenXR output reaches the headset) unless the app folder (`STEAM_COMPAT_INSTALL_PATH`)
|
||||
contains a file `lepton-show-flatscreen` (`liblepton/app_metadata.sh`): then Android (11, Waydroid) gets a Wayland
|
||||
window shown as a flat panel in the headset. FramePort creates the file for Android apps without VR. Android's
|
||||
back/home/recents bar is drawn over the app's own controls; `qemu.hw.mainkeys=1` removes it, but it's only read at
|
||||
boot and Lepton has no setting for extra properties, so patch `device.hide_navbar` (default on for apps without
|
||||
VR) passes it as a second line of a
|
||||
`LEPTON_GFXRECON_*` value (Lepton copies those into the boot properties unescaped). Runtime alternatives didn't
|
||||
work on Android 11: `policy_control` is gone, `cmd statusbar send-disable-flag home recents` has no `back` and
|
||||
moves the back button onto the app's controls, the `sysui_nav_bar` layout and disabling SystemUI had no effect.
|
||||
|
||||
## OpenXR runtime (as seen by games through overport's loader)
|
||||
- Instance extensions present include KHR_android_create_instance (must be enabled; the adapter adds it),
|
||||
@@ -92,3 +105,14 @@
|
||||
- Processes started from Steam (Konsole, SSH sessions?) share steam.service's cgroup: use `systemd-run --user`.
|
||||
- SSH: `sshd` must be enabled (`sudo systemctl enable --now sshd`), which needs a user password (`passwd`).
|
||||
- mDNS: avahi-daemon runs by default; hostname `frame` → `frame.local`.
|
||||
|
||||
## Text input
|
||||
|
||||
- Lepton's Android has no on-screen keyboard (IME) and VR apps run headless, so no Android window has keyboard focus
|
||||
and key presses (Steam's keyboard, USB/Bluetooth keyboards, `input text`) don't reach VR apps. The app folder's
|
||||
`lepton-show-flatscreen` marker shows the window (VR keeps working) and gives it focus; Steam's on-screen keyboard
|
||||
then opens for its text fields (FramePort patch `device.text_input_window`).
|
||||
- `/dev/uinput` is writable by the steamos user (ACL for Steam Input): a uinput virtual keyboard works like a real
|
||||
one everywhere (FramePort's "Type on Frame", agent `_keyboard`).
|
||||
- Unity text fields close without a system keyboard; see `frame.unity_text_input` in PLAYBOOK.md.
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
# Frame setup: what changes, networks, undoing it
|
||||
|
||||
For the steps themselves see [INSTALL.md](INSTALL.md#connecting-the-steam-frame).
|
||||
|
||||
## What the setup changes
|
||||
|
||||
The setup command runs [`bootstrap/bootstrap.sh`](../bootstrap/bootstrap.sh), served by the app over your
|
||||
local network. Everything it changes:
|
||||
|
||||
| Change | Where | How to undo |
|
||||
|---|---|---|
|
||||
| Turns on **Developer Mode** (only if it's off). Steam restarts once, which closes Desktop Mode; the rest of the setup finishes on its own as a user service (log: `~/.cache/frameport-setup.log`). | `"DevModeEnabled" "1"` in `~/.local/share/Steam/config/config.vdf` (old file kept as `config.vdf.before-frameport`), then Valve's own `steamos-polkit-helpers/steamos-devkit-mode --enable`. That helper enables the SSH server (`sshd`), the devkit service that makes the Frame findable on the network, the remote-desktop and debug services, and system crash dumps. | Settings → System → Developer → Developer Mode off. Valve's helper switches all of those services off again. |
|
||||
| Lets the app's SSH key in. | One line ending in `frameport` in `~/.ssh/authorized_keys`. The folder and file are created if missing. | Delete that line. |
|
||||
| Configures podman for Lepton. Rootless podman leaks one kernel keyring per container start, and after about 200 game starts every game fails. | `[containers]` / `keyring = false` in `~/.config/containers/containers.conf`. | Remove those lines. |
|
||||
| Asks Steam to install **Lepton** (Valve's Android runtime, Steam app 3029110) if it's missing. You confirm it in Steam. | Steam library | Uninstall it in Steam. |
|
||||
|
||||
The script runs as your user: no root, no `sudo`, no password. The only system-level change, Developer Mode, is
|
||||
made by Valve's own helper, the same one the Settings switch uses. If Developer Mode can't be turned on
|
||||
automatically, the script asks you to turn it on in Settings → System → Developer and run the command again.
|
||||
|
||||
Nothing else on the system is touched: no packages, no read-only-filesystem changes, no polkit rules. The script
|
||||
also leaves two files: `~/.cache/frameport-setup.sh` (the part that runs on its own) and its log.
|
||||
|
||||
**Later, the app adds** (all as your user, no root, no `sudo`):
|
||||
- FramePort's helper in `~/.local/share/frameport/`;
|
||||
- the games, each with a launcher and its data in `~/Applications/quest-frame/<package>/`;
|
||||
- their Steam library entries and artwork (`shortcuts.vdf` + `config/grid/`);
|
||||
- for PC VR games: an OpenXR layer (`~/.local/share/openxr/1/api_layers/explicit.d/XR_APILAYER_FRAMEPORT_timefix.json`)
|
||||
and, when the first PC VR game is installed, Valve's ARM64 Proton and its Steam Linux Runtime (Steam downloads them;
|
||||
Steam restarts once).
|
||||
|
||||
**Settings → Uninstall FramePort → Also remove from the Frame** deletes the games, their Steam entries, the helper
|
||||
folder, the OpenXR layer and the setup script's files. Developer Mode, the SSH key line, the podman setting, Lepton
|
||||
and Proton stay. Undo them as shown above or in Steam.
|
||||
|
||||
## Network and firewalls
|
||||
|
||||
The setup command is the only time the Frame connects to your computer: it downloads the script from FramePort on
|
||||
TCP port 8765 (8766/8767 if taken), only while the setup command is shown and for at most 30 minutes. Everything
|
||||
else goes from the computer to the Frame. If the command just says "timed out", the setup page shows what is likely
|
||||
blocking it after about 45 seconds:
|
||||
|
||||
- **Windows:** allow FramePort (or Python, when running from source) when Windows asks. On a network Windows treats as
|
||||
**Public** it stays blocked unless you allow public networks; set your home network to Private in Windows'
|
||||
network settings instead.
|
||||
- **macOS:** with the firewall on (System Settings → Network → Firewall), allow incoming connections for FramePort
|
||||
when asked.
|
||||
- **Linux:** firewalld: `sudo firewall-cmd --add-port=8765/tcp` (until the next restart). ufw:
|
||||
`sudo ufw allow 8765/tcp`, afterwards `sudo ufw delete allow 8765/tcp`.
|
||||
- **WSL:** Windows' Hyper-V firewall blocks connections into WSL without asking. FramePort adds a temporary rule for
|
||||
the setup ports (one admin prompt) and removes it again when setup is done or after 35 minutes. WSL must use
|
||||
mirrored networking: `networkingMode=mirrored` under `[wsl2]` in `%UserProfile%\.wslconfig`, then `wsl --shutdown`.
|
||||
- Or skip the setup command and use the devkit pairing (see [INSTALL.md](INSTALL.md#connecting-the-steam-frame)): it needs no connection into your computer.
|
||||
@@ -0,0 +1,67 @@
|
||||
# Tested games
|
||||
|
||||
Games tested on the Steam Frame with FramePort's recipes. Games not listed here may work too: FramePort suggests patches for them, and a working config can be shared from the app (**Share working config…**).
|
||||
Tested a game? [Share a working config](https://github.com/spoopyghosty0/frameport/issues/new?template=working-config.yml) or [report a problem](https://github.com/spoopyghosty0/frameport/issues/new?template=bug-report.yml) (in the app: the game's **…** menu does both and fills in the details).
|
||||
Generated from [catalog/games](../catalog/games) by `scripts/compat_list.py`.
|
||||
|
||||
| Game | Platform | Status | Notes |
|
||||
|---|---|---|---|
|
||||
| 4XVR Video Player | Quest | ✅ Works | |
|
||||
| AllInOneSports | Quest | ✅ Works | |
|
||||
| Asgard's Wrath 2 | Quest | ✅ Works | |
|
||||
| BAM | Quest | ✅ Works | |
|
||||
| BARTENDER VR SIMULATOR | Quest | ✅ Works | |
|
||||
| Batman: Arkham Shadow | Quest | ✅ Works | |
|
||||
| BattleGlide | Quest | ✅ Works | |
|
||||
| Beat Saber | Quest | ✅ Works | |
|
||||
| Beat Saber (co-existence build) | Quest | ✅ Works | |
|
||||
| Blade & Sorcery: Nomad | Quest | ✅ Works | |
|
||||
| Carve Snowboarding | Quest | ✅ Works | |
|
||||
| Cook-Out | Quest | ✅ Works | |
|
||||
| Demeter | Quest | ✅ Works | |
|
||||
| Dinosaur Island | Quest | ✅ Works | |
|
||||
| Espire 2 | Quest | ✅ Works | |
|
||||
| Genotype | Quest | ✅ Works | |
|
||||
| H.U.N.T | Quest | ✅ Works | |
|
||||
| In Death: Unchained | Quest | ✅ Works | |
|
||||
| Job Simulator | Quest | ✅ Works | |
|
||||
| Keep Talking and Nobody Explodes | Quest | ✅ Works | |
|
||||
| LEGO® Bricktales | Quest | ✅ Works | |
|
||||
| Marvel's Deadpool VR | Quest | ✅ Works | |
|
||||
| Medieval Dynasty New Settlement | Quest | ✅ Works | |
|
||||
| Mobile Suit Gundam: Silver Phantom | Quest | ✅ Works | |
|
||||
| Nano | Quest | ✅ Works | |
|
||||
| NEX Player | Quest | ✅ Works | |
|
||||
| NOPE CHALLENGE | Quest | ✅ Works | |
|
||||
| Path of the Warrior | Quest | ✅ Works | |
|
||||
| PowerWash Simulator VR | Quest | ✅ Works | |
|
||||
| Rick and Morty: Virtual Rick-ality | PC VR | ✅ Works | |
|
||||
| Riven | Quest | ✅ Works | |
|
||||
| Robo Recall | Quest | ✅ Works | |
|
||||
| Sniper Elite VR: Winter Warrior | Quest | ✅ Works | |
|
||||
| Space Pirate Trainer Quest | Quest | ✅ Works | |
|
||||
| Stremio | Quest | ✅ Works | |
|
||||
| SUPERHOT VR | PC VR | ✅ Works | |
|
||||
| The Climb 2 | Quest | ✅ Works | |
|
||||
| Toy Master | Quest | ✅ Works | |
|
||||
| Under Cover | Quest | ✅ Works | |
|
||||
| VR4 | Quest | ✅ Works | |
|
||||
| Wallace & Gromit in The Grand Getaway | Quest | ✅ Works | |
|
||||
| Wander | Quest | ✅ Works | |
|
||||
| Accounting+ | Quest | ⚠️ Works with issues | Starts in VR, but doesn't get past its "press any button" screen. |
|
||||
| Arcsmith | Quest | ⚠️ Works with issues | Right eye distorts during movement (unresolved; swap, tracking, Valve layers, depth and pacing ruled out). |
|
||||
| Assassin's Creed Nexus | Quest | ⚠️ Works with issues | Some launch warning text is still upside down; the rest of the UI is fixed by flip emulation. |
|
||||
| I Am Cat | Quest | ⚠️ Works with issues | The view vibrates slightly, even when holding still. |
|
||||
| Lucky's Tale | Quest | ⚠️ Works with issues | Keeps MSAA off; the game turned it on by itself and the whole Frame restarted in a menu. |
|
||||
| Myst | Quest | ⚠️ Works with issues | Minor graphical glitches on some objects. |
|
||||
| Phantom: Covert Ops | Quest | ⚠️ Works with issues | DLC/store button crashes (no Meta store). |
|
||||
| Silhouette | Quest | ⚠️ Works with issues | Hand-tracking game; the Frame synthesizes hands from controllers, so it is janky. |
|
||||
| Time Stall | Quest | ⚠️ Works with issues | Both eyes distort during movement (unresolved). |
|
||||
| BONELAB | Quest | ❌ Doesn't run | Crashes while starting its graphics (Vulkan); no fix yet. |
|
||||
| Espire 1: VR Operative (Quest Edition) | Quest | ❌ Doesn't run | Mesa GL driver crash during texture upload. |
|
||||
| HITMAN 3 VR: Reloaded | Quest | ❌ Doesn't run | Vulkan driver crash (freedreno), even without Valve layers. |
|
||||
| Journey of the Gods | Quest | ❌ Doesn't run | 32-bit only; the Frame has no AArch32. |
|
||||
| Roblox | Quest | ❌ Doesn't run | Crashes on its first VR frame on the Frame. |
|
||||
| Shadow Point | Quest | ❌ Doesn't run | 32-bit only; the Frame has no AArch32. |
|
||||
| Sniper Elite VR | Quest | ❌ Doesn't run | GPU hang (zink: DEVICE LOST) even with MSAA off. |
|
||||
| Sports Scramble (Santa Cruz) | Quest | ❌ Doesn't run | 32-bit only; the Frame has no AArch32. |
|
||||
@@ -9,6 +9,7 @@ runtime, the OVRPort CLI and apksigner into its data folder (Settings → Tools
|
||||
| Windows 10/11 (x64) | `FramePort-windows-x64.zip` | `FramePort.exe` |
|
||||
| macOS (Apple Silicon) | `FramePort-macos-arm64.zip` | `FramePort.app` |
|
||||
| Linux (x64, GTK 3; Ubuntu 22.04 or newer) | `FramePort-linux-x64.tar.gz` | `FramePort/FramePort` |
|
||||
| Linux (ARM64, GTK 3; Ubuntu 22.04 or newer) | `FramePort-linux-arm64.tar.gz` | `FramePort/FramePort` |
|
||||
| Command line only (Python 3.11+) | `frameport-<version>-py3-none-any.whl` | `frameport --help` |
|
||||
|
||||
The command-line version installs from the wheel's release link with `uv tool install <link>` (or pipx / pip).
|
||||
@@ -22,16 +23,81 @@ start shows a warning:
|
||||
`FramePort-selfsigned.cer` (attached to each release) into *Trusted Root Certification Authorities* (Current User) to
|
||||
show FramePort as the publisher; the certificate can only sign code. Remove it with `certmgr.msc`.
|
||||
- **macOS:** right-click `FramePort.app` → **Open** → **Open** (once), or `xattr -dr com.apple.quarantine FramePort.app`.
|
||||
- **Linux:** `tar xzf FramePort-linux-x64.tar.gz && ./FramePort/FramePort`.
|
||||
- **Linux:** `tar xzf FramePort-linux-x64.tar.gz && ./FramePort/FramePort` (ARM64: `FramePort-linux-arm64.tar.gz`).
|
||||
|
||||
## Connecting the Steam Frame
|
||||
|
||||
1. On the Frame: Settings → System → Developer → turn on **Developer Mode**. The Frame and the computer must be on the
|
||||
same network.
|
||||
2. In FramePort open **Steam Frame**. A Frame in Developer Mode appears in the list.
|
||||
3. First time only: on the Frame switch to Desktop mode (Steam button → Power → Switch to Desktop), open Konsole and
|
||||
run the command FramePort shows. It enables SSH, authorises this computer and installs Valve's Android runtime
|
||||
(Lepton) if needed.
|
||||
The Frame and the computer must be on the same network.
|
||||
|
||||
1. In FramePort open **Steam Frame** and click **Show setup command**.
|
||||
2. First time only, on the Frame:
|
||||
1. Open the **SteamVR dashboard → Launch a program → Desktop**: the Linux desktop opens on a virtual screen.
|
||||
2. Open the app menu (bottom-left corner of that desktop) → **System → Konsole** (or search for Konsole).
|
||||
3. Type the command FramePort shows exactly as shown (on-screen keyboard or any USB/Bluetooth keyboard) and press
|
||||
**Enter**. It looks like `curl -fsS 192.168.1.20:8765/1a2b3c4d | bash`: your computer's address, then a
|
||||
one-time code.
|
||||
4. After a few seconds the desktop closes by itself (Steam restarts once); that's expected. If
|
||||
Steam asks to install **Lepton** (Valve's Android runtime), confirm it.
|
||||
|
||||
FramePort connects by itself within a minute. No password is needed. The command lets FramePort in and turns on
|
||||
**Developer Mode** (which includes SSH); everything it changes is listed in [FRAME_SETUP.md](FRAME_SETUP.md).
|
||||
3. Later starts: a Frame in Developer Mode appears in the list and FramePort connects to it automatically. (If you
|
||||
turn Developer Mode off in Settings → System → Developer, turn it on again there.)
|
||||
|
||||
**Without Konsole:** turn on Developer Mode yourself (Settings → System → Developer). The Frame then appears under
|
||||
**On your network**. On the Frame open Settings → Developer → **Pair new host**, then click **Connect** in FramePort
|
||||
and approve it on the Frame (Valve's own devkit pairing; it only sends this computer's key to the Frame). Install
|
||||
Lepton from the Steam Frame page afterwards if it's missing.
|
||||
|
||||
### Firewalls
|
||||
|
||||
If the setup command only says "timed out", a firewall on your computer blocks the Frame; the setup page
|
||||
says which after about 45 seconds. Details per system: [FRAME_SETUP.md](FRAME_SETUP.md#network-and-firewalls).
|
||||
|
||||
## Running FramePort on the Frame (experimental)
|
||||
|
||||
FramePort can run on the Steam Frame itself, without a PC: in **Desktop Mode**, download
|
||||
`FramePort-linux-arm64.tar.gz`, unpack it (`tar xzf FramePort-linux-arm64.tar.gz`) and start `FramePort/FramePort`.
|
||||
Turn on **Developer Mode** first (Steam → Settings → System); FramePort then manages "This Frame" directly, with
|
||||
no pairing. Games are added to the Steam library when you go back to **Gaming Mode** (Steam has to restart for it,
|
||||
which would end Desktop Mode). This is new: please report anything odd with **Report a problem**.
|
||||
|
||||
## Installing games
|
||||
|
||||
- **Install on Frame** on a game's page (or select several in the Library and install them together). Installs run
|
||||
one after another in the background; **Activity** shows the current one at the top.
|
||||
- **Update all** reinstalls every game whose build changed (e.g. after a FramePort update). Questions that need an
|
||||
answer (e.g. Oculus games that can't run on the Frame) are asked once, for all games.
|
||||
- If the Frame goes to sleep, turns off or leaves the Wi-Fi, the queue **waits** and continues once it's back; uploads
|
||||
pick up where they stopped. While installs run, FramePort keeps the Frame from going to sleep. Before a large batch
|
||||
it checks the Frame has enough free space.
|
||||
- Your own game files are never changed. The converted copy is temporary: it's removed once the game is on the Frame
|
||||
(Settings → Installing: keep them, or remove all now).
|
||||
- **Game settings…** (game menu or the Steam Frame page): sharpness, refresh rate, controllers, menus, 360° video and
|
||||
mixed-reality options in plain words, only those that matter for the game. Changes are kept with the game and,
|
||||
when it's installed, used the next time it starts.
|
||||
- Ordinary Android apps (no VR) are installed unchanged and shown as a flat window in the headset. Android's
|
||||
back/home/recents buttons are hidden by default (patch **Hide Android's navigation bar**).
|
||||
|
||||

|
||||
|
||||
Each game has **Game settings** in plain words (sharpness, refresh rate, controllers, menus, 360° video, mixed
|
||||
reality), showing only what matters for that game. Changes are kept with the game and reach the Frame right away.
|
||||
|
||||

|
||||
|
||||
## Typing on the Frame
|
||||
|
||||
- **Type on Frame** (Steam Frame page, a game's menu, or the keyboard icon on the sidebar's Frame card): while the
|
||||
window is open, this computer's keyboard works as a keyboard plugged into the Frame. Select a text field in the
|
||||
headset (in an app, Steam or the desktop) and type; Esc and shortcuts go to the Frame too. Paste longer text into
|
||||
the box to type it in one go (US keyboard layout). Click **Done** to disconnect.
|
||||
- **Steam's on-screen keyboard** opens for text fields of apps shown as a window (2D apps, and VR apps with
|
||||
**Show the app's Android window**). Steam lists that window as **Gamescope** (the Frame's display compositor);
|
||||
leave it open: it's what receives the typing, the VR view isn't affected.
|
||||
- **Unity apps whose text fields close at once** (a caret flashes, nothing can be typed): FramePort suggests
|
||||
**Make Unity text fields work** for them. The first time, it downloads Cpp2IL (a tool that finds the right spot in the
|
||||
game's code, ~17 MB). Games added before this version: open the game's menu → **Analyze again**, then reinstall.
|
||||
|
||||
## Updating
|
||||
|
||||
@@ -47,11 +113,12 @@ update log is `logs/update.log` in the data folder.
|
||||
Command line: `frameport update` (`--check` only checks, exit code 10 = update available; `--yes` doesn't ask).
|
||||
`FRAMEPORT_NO_UPDATE_CHECK=1` turns all checks off.
|
||||
|
||||
## Oculus Rift (PC VR) games
|
||||
## PC VR games
|
||||
|
||||
Scan a folder of Rift games (one folder per game) or use **Add games → Add one game folder…**. FramePort finds the
|
||||
game's program and asks when there is more than one candidate. **Already patched** on a game page installs a copy
|
||||
unchanged. FramePort uses an installed Revive, or downloads a portable copy.
|
||||
PC VR games are Windows VR games (OpenXR, SteamVR or Oculus). Scan a folder of them (one folder per game) or use
|
||||
**Add games → Add one game folder…**. FramePort finds the game's program and asks when there is more than one
|
||||
candidate. **Already patched** on a game page installs a copy unchanged. Oculus-only games need Revive: FramePort uses
|
||||
an installed Revive, or downloads a portable copy.
|
||||
|
||||
- **Play from this PC:** Windows with Steam and SteamVR. **Install on this PC** adds the game to Steam; stream it to the
|
||||
Frame with Steam Link. If a game can't keep up with the refresh rate, FramePort lowers the rate and enables motion
|
||||
@@ -60,21 +127,57 @@ unchanged. FramePort uses an installed Revive, or downloads a portable copy.
|
||||
on the game page.
|
||||
- Games that use the Oculus Platform SDK check the licence through the Oculus app, so they run on the PC only.
|
||||
|
||||
## Videos, documents and mods
|
||||
**Windows games without VR:** **Add games → Add one game folder…** with the game's folder (pick the program that
|
||||
starts it if asked). FramePort installs it on the Frame and Proton runs it as a window, like Steam's own Windows games;
|
||||
it shows up in the Frame's Steam library tagged "Windows game on Frame". Whether a game runs depends on Proton on ARM
|
||||
(x86 games run through emulation).
|
||||
|
||||
Steam Frame → **Send files** (or a game's menu → **Add videos & files…**) copies files to the Frame. **Videos**,
|
||||
**Downloads** and **Documents** appear inside every Quest game as `/sdcard/Movies`, `/sdcard/Download` and
|
||||
`/sdcard/Documents`. Apps find them by browsing folders; Android's media index doesn't work on the Frame. Command
|
||||
line: `frameport frame send <files> --to videos`.
|
||||
## Files on the Frame (videos, documents, mods, saves)
|
||||
|
||||
The **Files** tab manages files on the Frame over the same connection as installs; no other transfer app is needed.
|
||||
Pick a location, browse folders, and use **Upload files** / **Upload folder**, **New folder**, or the download, rename
|
||||
and delete buttons on each entry. Tick several entries (or the box above the list for all) to download or delete them
|
||||
together. In the downloaded app you can also drag files and folders from Explorer / Finder / your file manager onto
|
||||
the list to upload them into the open folder. Uploads and downloads run in the Activity panel, resume after an interruption and
|
||||
skip files that are already there.
|
||||
|
||||
- **Videos**, **Downloads** and **Documents** appear inside every Quest game as `/sdcard/Movies`, `/sdcard/Download`
|
||||
and `/sdcard/Documents`. Apps find files by browsing folders; Android's media index doesn't work on the Frame.
|
||||
- Under **Game storage**, each installed game has its own `/sdcard` (mods, saves). A game's menu → **Add videos and
|
||||
files…** opens it. Video players that list only their own folder (e.g. 4XVR's "Internal Storage" = `4XPlayer`) find
|
||||
videos uploaded into that folder.
|
||||
- **Home folder** shows everything in the Frame's home folder (hidden files with **Show hidden files**).
|
||||
|
||||
Command line: `frameport frame send <files> --dest videos` (`frameport frame storage` lists the destinations).
|
||||
|
||||
## Sharing a working game, reporting a problem
|
||||
|
||||
- **Share working config…** (game menu): opens a prefilled GitHub issue with the game's patches and settings. Accepted
|
||||
configs become built-in recipes.
|
||||
- **Report a problem…** (game menu, or Settings → Problems & feedback): saves a diagnostics zip to Documents (logs,
|
||||
configs become built-in recipes. Untested games ask on their page once they've been installed or tested: **It
|
||||
works**, **It has issues** or **It doesn't run**.
|
||||
- **Report a problem…** (game menu, or Settings → Problems and feedback): saves a diagnostics zip to Documents (logs,
|
||||
recipe, device details; IP addresses, user names, home folders and Steam ids replaced) and opens a prefilled GitHub
|
||||
issue to attach it to. Command line: `frameport diag report <game>`, `frameport share-recipe <game>`.
|
||||
|
||||
## Command line
|
||||
|
||||
Everything the app does is also a `frameport` command (in a source checkout: `uv run frameport`); `frameport --help`
|
||||
and `frameport <command> --help` describe every option. The main ones:
|
||||
|
||||
| Command | What it does |
|
||||
|---|---|
|
||||
| `scan <folder>` / `list` / `show <game>` | add games, list the library, show a game's analysis and patches |
|
||||
| `recipe <game> --enable/--disable <patch>` | change a game's patches (`patches` lists them all) |
|
||||
| `build <game>` / `install <game>` / `test <game>` | build, install on the Frame (`--to pc` for PC VR on this PC), launch test |
|
||||
| `frame discover` / `frame connect` / `frame info` | find, pair with and describe the Frame |
|
||||
| `frame send` / `frame storage` / `frame cleanup` | copy files to the Frame, show where they go, free space |
|
||||
| `tools status` / `tools install` | the tools FramePort downloads |
|
||||
| `diag report <game>` / `share-recipe <game>` | report a problem / share a working recipe |
|
||||
| `update` | update FramePort |
|
||||
|
||||
Exit codes: 0 done, 1 something failed, 2 wrong usage, 10 (`update --check`) a newer version exists. Errors are
|
||||
one line on stderr; `FRAMEPORT_DEBUG=1` shows the full traceback.
|
||||
|
||||
## Uninstalling
|
||||
|
||||
Settings → **Uninstall FramePort…** (or `frameport uninstall-app`) removes its data folder, the Steam shortcuts it
|
||||
|
||||
@@ -14,6 +14,7 @@ version is `catalog/triage.yaml` (used by `frameport test` / the Job screen); ke
|
||||
| Symptom | Cause | Fix |
|
||||
|---|---|---|
|
||||
| Every game suddenly fails to start: `crun: create keyring …: Disk quota exceeded`, `is not a running context` | rootless podman leaked a kernel keyring per launch; 200-key quota exhausted | `keyring = false` in `~/.config/containers/containers.conf` (FramePort agent does it), then reboot the Frame once |
|
||||
| A Unity app's text field shows a caret for a moment and loses focus; no keyboard appears (e.g. Stremio VR login) | Unity's TMP_InputField/InputField wait for Android's on-screen keyboard and close themselves without one (Lepton has none); headless VR apps also have no focused Android window, so no key press reaches them | `frame.unity_text_input` (Cpp2IL finds `TouchScreenKeyboardShouldBeUsed`/`isKeyboardUsingEvents`, rewritten to false/true) + `device.text_input_window` (lepton-show-flatscreen: Steam's keyboard and Type on Frame work) |
|
||||
| `APP_ACTIVITY is empty`, nothing starts | Manifest has category INFO only; Lepton needs LAUNCHER | `frame.launcher` (automatic) |
|
||||
| PC VR game on the Frame shows as a flat window / Revive: `Unable to load LibOVRRT DLL` / `LoaderInstance::CreateInstance chained CreateInstance call failed` | Frame SteamVR runtime rejects OpenXR apiVersion 1.1 (`XR_ERROR_API_VERSION_UNSUPPORTED`), which Proton 11's VR helper requests | `pcvr.xr_timefix` (Frame OpenXR layer, default on): retries xrCreateInstance as 1.0 |
|
||||
| Unreal PC VR game on the Frame runs as a flat window although OpenXR works (no `LogHMD` OVRPlugin lines; Unreal logs nothing when it skips the Oculus plugin) / launch.log: `FramePort oculushmd: could not create the OculusHMDConnected event` | UE's OculusHMD (and LibOVR's `ovr_Detect`) only start when the Windows event `OculusHMDConnected` exists and is signalled; on a PC the Oculus service creates it. Revive hooks `OpenEventW` for it, but that relies on Detours patching Wine's (ARM64EC) kernelbase | `pcvr.oculus_unreal` (default for Unreal Rift games; PC VR counterpart of overport's `patch_oculus_unreal`): launch.sh runs the injector through `fp_oculushmd.exe`, which provides the real event until the game exits |
|
||||
@@ -47,14 +48,24 @@ version is `catalog/triage.yaml` (used by `frameport test` / the Job screen); ke
|
||||
| Video stutters although fps is steady | video frame rate doesn't divide the refresh rate (30 fps at 72 Hz) | `adapter.refresh_rate` (e.g. 90 for 30 fps, 72 for 24 fps); `layer_debug` logs the offered rates and the app's own requests |
|
||||
| PC VR game judders/stutters although the GPU keeps up; vrcompositor.txt "Timed out. N total" high or frames dropped | the game misses the headset's refresh (e.g. 96 Hz = 10.4 ms; Stormland's slow frames take 10.7 ms) | `pcvr.steamvr_tuning` (default on): next Play sets SteamVR per-app `preferredRefreshRate` + `motionSmoothingOverride` via `fp_vrsettings.exe` |
|
||||
| Quest app keeps recentering / snapping the view when you turn your head; log shows session state 5→4→3→4→5 within a second | the Frame briefly takes focus; the app recenters on focus changes | unfixed: hiding the dips (debounce) made AC Nexus stay black, so it was removed |
|
||||
| Video player / app finds no local videos; MediaProvider "Requested path /home/steamos/... doesn't appear under ..." | Lepton's /sdcard is a symlink to a host path, so Android's media index rejects every file | send files with Frame → Send files (~/Videos = /sdcard/Movies) and browse folders in the app |
|
||||
| Video player / app finds no local videos; MediaProvider "Requested path /home/steamos/... doesn't appear under ..." | Lepton's /sdcard is a symlink to a host path, so Android's media index rejects every file | upload in the Files tab (Videos = /sdcard/Movies) and browse folders in the app |
|
||||
| Game (Unity, GLES) freezes, `zink: DEVICE LOST` | multisampled render-to-texture hangs the GPU | `frame.unity_no_msaa`; if it persists: unfixable → PC version |
|
||||
| Only the Android home screen shows; the log has Unity's VR device as `None` (e.g. Accounting+, Unity 2017) | Unity 2017–2018 built-in Oculus support starts VR only when `com.oculus.systemactivities` is installed; Lepton has no Meta system apps, so Unity falls back to non-VR | `frame.unity_oculus_check`: that package name in libunity.so → `android`, plus `native/ovrpshim` (libfp_ovrp.so): Unity 2017's legacy frame loop (`ovrp_Update2`/`ovrp_BeginFrame`) never calls `ovrp_WaitToBeginFrame`, so without the shim no `xrWaitFrame` happens, `CompositorOpenXR::Update … outside of frame bounds` floods the log and the dashboard freezes. With it: log `ovrp frame loop shim: waited for frame N`, ~71 fps. Accounting+ then stops at "press any button" although its OVRInput gets clean input (`INPUT_PROBE` in the patch logs connected controllers/buttons/input focus per call) — unresolved |
|
||||
| Own-engine game crashes in `libVkLayer_fossilize.so` (Fossilize's recording thread, e.g. Roblox) | same as Deadpool VR: uninitialised pointers in what Fossilize records | `frame.vk_sanitize` now also covers own-engine libraries that load `libvulkan.so` by name |
|
||||
| Crash right after the game gets focus, in `vrclient.so … UpdateActionStateInternal` / `sxr_xrSyncActions` (e.g. Myst) | a race in the Frame runtime's input code on the first sync after focus (not every launch) | adapter `sync_guard` (input syncs one at a time with event polling, paused 250 ms after FOCUSED) |
|
||||
| View jumps sideways / game pauses or freezes for a moment every few seconds (e.g. Blade & Sorcery, BattleGlide) | the Frame drops focus for ~0.5 s (FOCUSED→VISIBLE→SYNCHRONIZED); games pause or re-align the player (`OnVRPresence … Teleport`) | adapter `focus_hold` |
|
||||
| SDL / LÖVE app crashes at start: `NullPointerException … ClipboardManager.addPrimaryClipChangedListener` in `SDLClipboardHandler.<init>` (e.g. Dramatic Shape) | Lepton's Android has no clipboard service (`service check clipboard`: not found) | `frame.sdl_clipboard` (that call → nops in classes.dex, in place, `apk/dex.py`); reproduced and verified with LÖVE for Android 11.5 |
|
||||
| Controllers do nothing (e.g. stuck on a setup screen); log: `xrSuggestInteractionProfileBindings … XR_ERROR_PATH_UNSUPPORTED` | the game only suggests bindings for Meta's newer profiles (Touch Plus / Touch Pro); the Frame's Android runtime knows `oculus/touch_controller`, not those | adapter `profile_remap` (default on): the bindings are suggested again for Touch (log: `controller profile … -> oculus/touch_controller`) |
|
||||
| Unity game hangs or the whole Frame restarts (e.g. in a menu); log: `The current MSAA level is 0, but the recommended MSAA level is 4. Switching to the recommended level.` (e.g. Lucky's Tale) | Meta's OVRManager (`useRecommendedMSAALevel`) turns 4x MSAA on at runtime, past QualitySettings; multisampled render-to-texture on GLES/Zink hangs the GPU | `frame.unity_runtime_msaa_off` (Cpp2IL: `OVRDisplay.get_recommendedMSAALevel` → 0) |
|
||||
| Unity game: one eye shows only effects or grey, the other is fine (e.g. I Am Cat, Oculus XR Plugin on GLES) | the game's single-pass multiview rendering goes wrong for array slice 1 (the adapter submits both slices correctly) | `frame.unity_multipass` (Cpp2IL: `OculusSettings.GetStereoRenderingMode` → MultiPass); `swap_eyes=1` tells whether the game or the adapter is at fault |
|
||||
| Setup/intro loops every launch (Espire 2) | save folders created without write permission | launcher repairs permissions every 2 s (built in) |
|
||||
| VrApi bridge: never enters VR | Frame reaches FOCUSED later than Quest; tracking only when worn | bridge waits 30 s; test in the headset |
|
||||
|
||||
## Picture problems (headset on)
|
||||
| Symptom | Cause | Fix |
|
||||
|---|---|---|
|
||||
| 2D Android app: Steam says it's running but nothing shows | Lepton runs apps headless unless the app folder has `lepton-show-flatscreen` | FramePort adds it for apps without VR (agent v28+); reinstall apps installed before |
|
||||
| 2D Android app: back/home/recents buttons cover the app's own buttons | Android's navigation bar | patch `device.hide_navbar` (on by default for apps without VR) sets `qemu.hw.mainkeys=1`; reinstall to apply |
|
||||
| Black screen, audio works, GLES engine with direct VrApi | Mesa rejects Quest-style GLSL | `frame.gl_shim` (logs `GLShim: SHADER COMPILE FAILED` + source lines) |
|
||||
| Black screen, audio works, log `Unsupported VrApi layer type N` | bridge drops frames containing that layer | extend the bridge (cylinder=3 is converted to a quad already) |
|
||||
| Only some draws visible (e.g. controllers) + `glGetError 0x502` | multiview shaders used on single-view FBOs | GL shim `gl_hide_multiview=1` (default) |
|
||||
@@ -66,6 +77,12 @@ version is `catalog/triage.yaml` (used by `frameport test` / the Job screen); ke
|
||||
| MR game stuck waiting for room data (Demeter) | no Meta scene API | adapter `scene_emul=1` (+ `frame.meta_permissions`) |
|
||||
| Hand-tracking game janky (Silhouette) | Frame synthesizes hands from controllers | `controller_fix=0` passes hands through; not really fixable |
|
||||
| Eye distortion while moving (Arcsmith, Time Stall) | unknown (not eye swap, tracking, Valve layers, depth or pacing) | unresolved |
|
||||
| One eye grey / only effects (I Am Cat, Unity Oculus XR Plugin on GLES) | the game's multiview pass draws array slice 1 wrong on Zink | `frame.unity_multipass` (also rewrites the getter's inlined read in `OculusLoader.Initialize`; check for two `array=1` eye swapchains) |
|
||||
| View vibrates even when holding still after `frame.unity_multipass` (I Am Cat) | poses/times are consistent, but two passes on Zink make every frame one period late, and the game clamps its physics step to 10 ms | not fixed (scale 0.8 didn't help); next ideas: fix multiview instead, or the game's fixed timestep |
|
||||
| Game freezes / pauses for 1-2 s now and then, no flicker; only some games (Blade & Sorcery) | the headset's wear sensor flickers off while worn (SteamVR vrserver.txt `HMD off, stopping eye tracking` … `HMD on`), the Frame turns it into a focus loss and Quest games that pause on focus loss pause | adapter `focus_hold=1` + `focus_hold_ms=2500` per game; native games don't react, so it's per game |
|
||||
| Minor glitches on some objects (Myst, Unreal Vulkan) | unknown; not application space warp (turning it off changed nothing and ran worse) | unresolved |
|
||||
| Graphics crash in vkCreateInstance with pc == fault address, from the game's own Vulkan hooks (BONELAB `libSLZQuestNative`) | a pointer into memory freed with OVRPlugin's pre-init OpenXR instance; not the runtime (vrclient.so) or Fossilize being unloaded (keeping both loaded with RTLD_NODELETE didn't help) | unresolved |
|
||||
| Own-engine game crashes in `je_free` from its own library on the first frames (Roblox) | the game frees memory it doesn't own; not the Vulkan shim or the format fallback | unsupported |
|
||||
|
||||
## Debugging techniques that worked
|
||||
- A user's problem report: `frameport diag inspect <FramePort-diag-*.zip>` re-triages its launch log with the current
|
||||
@@ -75,6 +92,26 @@ version is `catalog/triage.yaml` (used by `frameport test` / the Job screen); ke
|
||||
- For GLES/GLAD engines, wrap `eglGetProcAddress` to see shader compile errors (build the shim with `-DGLSHIM_TRACE`
|
||||
for per-FBO draw counts and draw-call errors; the bridge has `-DOVP_GL_DIAG` for eye-image readback).
|
||||
- Anything visual needs one headset session per iteration — batch hypotheses into each build.
|
||||
- Headless launch tests never get focus: they prove startup, not play. Crashes right after FOCUSED (Myst), focus
|
||||
dips and judder only show up in a headset session: ask for one, then `frameport diag collect <pkg>` (it contains
|
||||
the headset sessions too, plus this boot's kernel log).
|
||||
- Which library a stale pointer belonged to: turn on the Android linker's log for one run by adding
|
||||
`debug.ld.app.<pkg>=dlopen` as an extra line of `LEPTON_GFXRECON_FP_PROPS` (first line `0`) in the game's
|
||||
launch.sh on the Frame (back it up, restore it after) and look for `dlclose: unloading "…"`.
|
||||
- Unity catches native crashes itself: no debuggerd backtrace in Lepton's logcat-crash.log, but a
|
||||
`tombstone_00` in the game's `Android/data/<pkg>/files/` with the memory map (map pc/lr/registers to libraries).
|
||||
- Focus losses: the game sees FOCUSED→VISIBLE→SYNCHRONIZED (OVRPlugin `[XR_SESSION]`, FrameBridge `focus_hold:`
|
||||
lines); the cause is on the host: `~/.local/share/Steam/logs/vrserver.txt` (`HMD off/on`, `entering standby`,
|
||||
`SystemButtonDown` in vrclient_vrcompositor.txt) and XRService (`[UserPresence]`, `IMUFallback`). Compare the times
|
||||
(Lepton logs UTC, host logs local time).
|
||||
- A Unity getter patch that changes nothing: the compiler may have inlined it (no `BL` to its address in
|
||||
libil2cpp.so) — patch the field read in the caller (`Il2cppReturnPatch.field_loads`).
|
||||
- Fixes found by users count: a reporter's shader capture (VR4) became the `vk_shader_fix` recipe data (match by size
|
||||
+ SHA-256, insert words); verify on the device that the log shows the module being fixed.
|
||||
- Don't install or test on the Frame while the owner is playing: adding a library entry restarts Steam (FramePort
|
||||
now skips the restart when the shortcut is unchanged and waits while a game runs), and a launch test starts a game.
|
||||
- Catalog YAML: a `: ` inside an unquoted value breaks the file and the loader skipped it silently (the game vanished
|
||||
from the list); `tests/test_catalog_files.py` now catches it.
|
||||
- Keep the known-good APK and roll back if a change regresses (`PATCHED/_known-good-*`).
|
||||
|
||||
## When it can't run on the Frame
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
# Writing style for FramePort's interface
|
||||
|
||||
Short rules so every screen, help text and doc sounds the same. Code style is enforced by `ruff`.
|
||||
|
||||
## Words
|
||||
- **Steam Frame** on first mention in a screen or document, **the Frame** after that. **Headset** only for the
|
||||
physical device you wear ("put the headset on").
|
||||
- **Quest game** for Meta Quest apps, **Android app** for ordinary Android apps, **PC VR game** for Windows VR games.
|
||||
Say Oculus or Rift only for games that use Oculus's own SDK.
|
||||
- **Patch** for anything in a game's patch list (never "fix" for the same thing). **Recipe** for a game's chosen
|
||||
patches and settings.
|
||||
- Tools by their names: OVRPort, Revive, Proton, Lepton, SteamVR.
|
||||
- **Install** (first time), **Update** (a newer build), **Reinstall** (the same build again); **Play** starts a game.
|
||||
|
||||
## Form
|
||||
- Buttons and headings in sentence case ("Add games", "Report a problem…"); one label per action everywhere.
|
||||
- "…" at the end of a label when the action asks for more input (a dialog, a file picker).
|
||||
- Sentences end with a period, including tooltips and help texts; labels don't.
|
||||
- "and", not "&", in text. An em dash (—) for asides, a middle dot (·) between short facts.
|
||||
- Sizes in GiB/MiB (`i18n.fmt_size`), dates as YYYY-MM-DD HH:MM (`i18n.fmt_datetime`).
|
||||
- US spelling (customize, analyze, color).
|
||||
- Plain, technical wording: say what happens ("Steam restarts once"), no marketing adjectives.
|
||||
|
||||
## Translations
|
||||
- Every text the GUI shows goes through `tr("…")` or `tr_n("…", "…", n)` (see `src/frameport/i18n.py`); use
|
||||
templates with `.format()`, never f-strings inside `tr()`, and never decide anything from a displayed text.
|
||||
- After changing texts run `python scripts/i18n_extract.py` (a test checks the template is current).
|
||||
- CLI output, logs, diagnostics, catalog notes and launch-test diagnoses stay English.
|
||||
|
After Width: | Height: | Size: 104 KiB |
|
Before Width: | Height: | Size: 108 KiB After Width: | Height: | Size: 103 KiB |
|
After Width: | Height: | Size: 84 KiB |
|
Before Width: | Height: | Size: 350 KiB After Width: | Height: | Size: 365 KiB |
|
Before Width: | Height: | Size: 758 KiB After Width: | Height: | Size: 917 KiB |
|
Before Width: | Height: | Size: 139 KiB After Width: | Height: | Size: 100 KiB |
|
After Width: | Height: | Size: 102 KiB |
@@ -76,9 +76,12 @@ static int no_equirect, no_equirect2, no_cylinder, no_cube;
|
||||
static int runtime_has_fb_passthrough, emulate_passthrough, alpha_blend_failed;
|
||||
static int controller_models; // serve Frame controller models via XR_FB_render_model (render_model.c)
|
||||
// Per-game settings, all off by default (session_fixes.c, layer_emul_gl.c).
|
||||
static int sync_guard; // xrSyncActions one at a time with xrPollEvent, paused briefly after focus returns
|
||||
static int profile_remap = 1; // Meta's newer controller profiles (rejected by the Frame) -> oculus/touch_controller
|
||||
static int layer_debug; // diagnostics: layers, swapchains, session states, spaces, aim/grip, refresh rates
|
||||
static int stable_local; // keep every LOCAL space the app creates on the session-start origin
|
||||
static int focus_hold; // hide brief focus dips once the session has been focused for a while
|
||||
static float focus_hold_ms = 1000; // longest focus dip focus_hold hides
|
||||
static float aim_pitch, aim_yaw, aim_forward; // aim pose correction (degrees, degrees, metres)
|
||||
static float refresh_rate; // requested display refresh rate (Hz), 0 = the app's choice
|
||||
static int equirect_emul; // show 360 layers as cube faces (GLES)
|
||||
@@ -115,8 +118,11 @@ static void read_settings(const char *path) {
|
||||
if (sscanf(line, "scene_depth=%f", &value) == 1 && value > 0.5f && value < 20.0f) scene_depth = value;
|
||||
if (sscanf(line, "controller_models=%f", &value) == 1) controller_models = value != 0;
|
||||
if (sscanf(line, "layer_debug=%f", &value) == 1) layer_debug = value != 0;
|
||||
if (sscanf(line, "profile_remap=%f", &value) == 1) profile_remap = value != 0;
|
||||
if (sscanf(line, "sync_guard=%f", &value) == 1) sync_guard = value != 0;
|
||||
if (sscanf(line, "stable_local=%f", &value) == 1) stable_local = value != 0;
|
||||
if (sscanf(line, "focus_hold=%f", &value) == 1) focus_hold = value != 0;
|
||||
if (sscanf(line, "focus_hold_ms=%f", &value) == 1 && value >= 100 && value <= 5000) focus_hold_ms = value;
|
||||
if (sscanf(line, "aim_pitch=%f", &value) == 1 && fabsf(value) <= 90) aim_pitch = value;
|
||||
if (sscanf(line, "aim_yaw=%f", &value) == 1 && fabsf(value) <= 90) aim_yaw = value;
|
||||
if (sscanf(line, "aim_forward=%f", &value) == 1 && fabsf(value) <= 0.5f) aim_forward = value;
|
||||
@@ -728,7 +734,13 @@ XRAPI_ATTR XrResult XRAPI_CALL xrPollEvent(XrInstance instance, XrEventDataBuffe
|
||||
pthread_mutex_unlock(&scene_lock);
|
||||
if (got) return XR_SUCCESS;
|
||||
}
|
||||
if (sync_guard) pthread_mutex_lock(&sync_lock);
|
||||
XrResult result = focus_hold && event ? focus_hold_poll(fn, instance, event) : fn(instance, event);
|
||||
if (sync_guard) {
|
||||
if (result == XR_SUCCESS && event && session_state_of(event) == XR_SESSION_STATE_FOCUSED)
|
||||
sync_resume_at = monotonic_ns() + SYNC_GUARD_PAUSE_NS;
|
||||
pthread_mutex_unlock(&sync_lock);
|
||||
}
|
||||
if (result == XR_SUCCESS && event && (layer_debug || stable_local)) {
|
||||
if (event->type == XR_TYPE_EVENT_DATA_SESSION_STATE_CHANGED && layer_debug)
|
||||
LOG("layer_debug: session state %d at %.3f", ((const XrEventDataSessionStateChanged *)event)->state,
|
||||
@@ -867,6 +879,12 @@ XRAPI_ATTR XrResult XRAPI_CALL xrEndFrame(XrSession session, const XrFrameEndInf
|
||||
if (elapsed >= 5.0) {
|
||||
LOG("pacing: %.1f fps, displayTime vs predicted: avg %.2f ms, max %.2f ms", frames / elapsed,
|
||||
drift_sum / (double)frames / 1e6, drift_max / 1e6);
|
||||
if (layer_debug)
|
||||
LOG("layer_debug: input: %d xrSyncActions (%d ok, last %d), %d bool reads, %d pressed",
|
||||
__atomic_exchange_n(&input_syncs, 0, __ATOMIC_RELAXED),
|
||||
__atomic_exchange_n(&input_sync_ok, 0, __ATOMIC_RELAXED), input_last_sync_result,
|
||||
__atomic_exchange_n(&input_bool_reads, 0, __ATOMIC_RELAXED),
|
||||
__atomic_exchange_n(&input_bool_true, 0, __ATOMIC_RELAXED));
|
||||
frames = 0; drift_sum = drift_max = 0;
|
||||
}
|
||||
}
|
||||
@@ -1079,6 +1097,18 @@ XRAPI_ATTR XrResult XRAPI_CALL xrGetCurrentInteractionProfile(XrSession session,
|
||||
(PFN_xrGetCurrentInteractionProfile)lookup(active_instance, "xrGetCurrentInteractionProfile");
|
||||
if (!fn) return XR_ERROR_FUNCTION_UNSUPPORTED;
|
||||
XrResult result = fn(session, user, state);
|
||||
if (layer_debug && active_instance) { // which device each hand has, as the runtime reports it
|
||||
PFN_xrPathToString str = (PFN_xrPathToString)lookup(active_instance, "xrPathToString");
|
||||
char who[XR_MAX_PATH_LENGTH] = "?", what[XR_MAX_PATH_LENGTH] = "(none)";
|
||||
uint32_t n = 0;
|
||||
if (str) {
|
||||
str(active_instance, user, sizeof(who), &n, who);
|
||||
if (XR_SUCCEEDED(result) && state && state->interactionProfile)
|
||||
str(active_instance, state->interactionProfile, sizeof(what), &n, what);
|
||||
}
|
||||
static int logged;
|
||||
if (logged++ < 40) LOG("layer_debug: interaction profile of %s: %s (result %d)", who, what, result);
|
||||
}
|
||||
if (!controller_fix || XR_FAILED(result) || !state || !state->interactionProfile || !active_instance)
|
||||
return result;
|
||||
PFN_xrPathToString to_string = (PFN_xrPathToString)lookup(active_instance, "xrPathToString");
|
||||
@@ -1211,8 +1241,11 @@ XRAPI_ATTR XrResult XRAPI_CALL xrGetInstanceProcAddr(XrInstance instance, const
|
||||
if (layer_debug || refresh_rate > 0) {
|
||||
HOOK_AS(xrRequestDisplayRefreshRateFB, hook_request_refresh_rate)
|
||||
}
|
||||
if (layer_debug || aim_correction_on()) {
|
||||
if (sync_guard || layer_debug) HOOK_AS(xrSyncActions, hook_xrSyncActions)
|
||||
if (layer_debug) HOOK_AS(xrGetActionStateBoolean, hook_xrGetActionStateBoolean)
|
||||
if (layer_debug || aim_correction_on() || profile_remap)
|
||||
HOOK_AS(xrSuggestInteractionProfileBindings, hook_xrSuggestInteractionProfileBindings)
|
||||
if (layer_debug || aim_correction_on()) {
|
||||
HOOK_AS(xrCreateActionSpace, hook_xrCreateActionSpace)
|
||||
}
|
||||
#undef HOOK_AS
|
||||
|
||||
@@ -95,9 +95,55 @@ static void debug_reference_space(XrSession session, const XrReferenceSpaceCreat
|
||||
LOG("layer_debug: that LOCAL space can't be located yet (no tracking)");
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------- sync_guard
|
||||
// The Frame's runtime crashed in xrSyncActions right after focus returned (SIGSEGV in vrclient.so
|
||||
// CVRInputLatest::UpdateActionStateInternal, Myst; a race inside the runtime, not every launch). sync_guard runs
|
||||
// xrSyncActions one at a time with xrPollEvent and skips it for a moment after FOCUSED arrives (XR_SESSION_NOT_FOCUSED
|
||||
// is a success code every app handles: no input for those few frames).
|
||||
#define SYNC_GUARD_PAUSE_NS 250000000ll
|
||||
static pthread_mutex_t sync_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
static int64_t sync_resume_at;
|
||||
|
||||
// layer_debug input counters, logged with the pacing line: were actions synced, did any button read as pressed?
|
||||
static int input_syncs, input_sync_ok, input_bool_reads, input_bool_true, input_last_sync_result;
|
||||
|
||||
static XRAPI_ATTR XrResult XRAPI_CALL hook_xrSyncActions(XrSession session, const XrActionsSyncInfo *info) {
|
||||
PFN_xrSyncActions fn = (PFN_xrSyncActions)lookup(active_instance, "xrSyncActions");
|
||||
if (!fn) return XR_ERROR_FUNCTION_UNSUPPORTED;
|
||||
if (!sync_guard) { // installed for layer_debug only: count
|
||||
XrResult r = fn(session, info);
|
||||
__atomic_add_fetch(&input_syncs, 1, __ATOMIC_RELAXED);
|
||||
if (r == XR_SUCCESS) __atomic_add_fetch(&input_sync_ok, 1, __ATOMIC_RELAXED);
|
||||
input_last_sync_result = r;
|
||||
return r;
|
||||
}
|
||||
pthread_mutex_lock(&sync_lock);
|
||||
int64_t wait = sync_resume_at - monotonic_ns();
|
||||
XrResult r = wait > 0 ? XR_SESSION_NOT_FOCUSED : fn(session, info);
|
||||
pthread_mutex_unlock(&sync_lock);
|
||||
static int logged;
|
||||
if (wait > 0 && logged++ < 5) LOG("sync_guard: input paused for %.0f ms after focus returned", wait / 1e6);
|
||||
return r;
|
||||
}
|
||||
|
||||
static XRAPI_ATTR XrResult XRAPI_CALL hook_xrGetActionStateBoolean(XrSession session, const XrActionStateGetInfo *info,
|
||||
XrActionStateBoolean *state) {
|
||||
PFN_xrGetActionStateBoolean fn = (PFN_xrGetActionStateBoolean)lookup(active_instance, "xrGetActionStateBoolean");
|
||||
if (!fn) return XR_ERROR_FUNCTION_UNSUPPORTED;
|
||||
XrResult r = fn(session, info, state);
|
||||
__atomic_add_fetch(&input_bool_reads, 1, __ATOMIC_RELAXED);
|
||||
if (r == XR_SUCCESS && state && state->isActive && state->currentState)
|
||||
__atomic_add_fetch(&input_bool_true, 1, __ATOMIC_RELAXED);
|
||||
return r;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------- focus_hold
|
||||
#define FOCUS_HOLD_MIN_FOCUSED_NS 3000000000ll // only after this long in FOCUSED (start-up transitions untouched)
|
||||
#define FOCUS_HOLD_MAX_DIP_NS 600000000ll // dips longer than this are delivered (late, in order)
|
||||
#define FOCUS_HOLD_MIN_FOCUSED_NS 1000000000ll // only after this long in FOCUSED (start-up transitions untouched;
|
||||
// 3 s let a 27 ms dip through in Blade & Sorcery)
|
||||
// dips longer than focus_hold_ms (setting, default 1000) are delivered (late, in order): taking the headset off or the
|
||||
// system menu must still pause the game. A longer limit is for headsets whose wear sensor flickers ("HMD off" for
|
||||
// 0.5-2 s while worn; Blade & Sorcery pauses on each)
|
||||
#define FOCUS_HOLD_MAX_DIP_NS ((int64_t)(focus_hold_ms * 1000000.0f))
|
||||
static struct {
|
||||
XrEventDataBuffer events[6];
|
||||
int count, holding, delivering;
|
||||
@@ -131,7 +177,7 @@ static XrResult focus_hold_poll(PFN_xrPollEvent fn, XrInstance instance, XrEvent
|
||||
if (result != XR_SUCCESS) {
|
||||
if (held.holding && now - held.since > FOCUS_HOLD_MAX_DIP_NS) {
|
||||
LOG("focus_hold: focus lost for > %lld ms, delivering %d state change(s)",
|
||||
FOCUS_HOLD_MAX_DIP_NS / 1000000, held.count);
|
||||
(long long)(FOCUS_HOLD_MAX_DIP_NS / 1000000), held.count);
|
||||
held.holding = 0; held.delivering = 1;
|
||||
continue;
|
||||
}
|
||||
@@ -195,20 +241,100 @@ static int pose_action_kind(XrAction action) { // 1 aim, 0 grip, -1 unknown
|
||||
return kind;
|
||||
}
|
||||
|
||||
// Meta's newer controller profiles, which the Frame's runtime doesn't know (it has oculus/touch_controller). An app
|
||||
// that suggests bindings only for these gets XR_ERROR_PATH_UNSUPPORTED and no input (e.g. a setup screen that can't be
|
||||
// passed); its bindings are suggested again for Touch, keeping the components Touch controllers have.
|
||||
static const char *const NEWER_TOUCH[] = {"/interaction_profiles/meta/touch_controller_plus",
|
||||
"/interaction_profiles/meta/touch_plus_controller",
|
||||
"/interaction_profiles/facebook/touch_controller_pro",
|
||||
"/interaction_profiles/meta/touch_pro_controller",
|
||||
"/interaction_profiles/meta/touch_controller_rift_cv1",
|
||||
"/interaction_profiles/meta/touch_controller_quest_1_rift_s",
|
||||
"/interaction_profiles/meta/touch_controller_quest_2"};
|
||||
static const char *const TOUCH_PROFILE = "/interaction_profiles/oculus/touch_controller";
|
||||
// oculus/touch_controller components (OpenXR spec), after /user/hand/<left|right>/
|
||||
static const char *const TOUCH_COMMON[] = {"input/squeeze/value", "input/trigger/value", "input/trigger/touch",
|
||||
"input/thumbstick", "input/thumbstick/x", "input/thumbstick/y", "input/thumbstick/click",
|
||||
"input/thumbstick/touch", "input/thumbrest/touch", "input/grip/pose", "input/aim/pose", "output/haptic"};
|
||||
static const char *const TOUCH_LEFT[] = {"input/x/click", "input/x/touch", "input/y/click", "input/y/touch",
|
||||
"input/menu/click"};
|
||||
static const char *const TOUCH_RIGHT[] = {"input/a/click", "input/a/touch", "input/b/click", "input/b/touch",
|
||||
"input/system/click"};
|
||||
static int app_suggested_touch;
|
||||
|
||||
static int in_list(const char *s, const char *const *list, size_t n) {
|
||||
for (size_t i = 0; i < n; ++i)
|
||||
if (!strcmp(s, list[i])) return 1;
|
||||
return 0;
|
||||
}
|
||||
#define IN(s, list) in_list(s, list, sizeof(list) / sizeof(*list))
|
||||
|
||||
// 1 if the binding path exists on oculus/touch_controller
|
||||
static int touch_has(const char *path) {
|
||||
const char *left = "/user/hand/left/", *right = "/user/hand/right/";
|
||||
if (!strncmp(path, left, strlen(left))) {
|
||||
path += strlen(left);
|
||||
return IN(path, TOUCH_COMMON) || IN(path, TOUCH_LEFT);
|
||||
}
|
||||
if (!strncmp(path, right, strlen(right))) {
|
||||
path += strlen(right);
|
||||
return IN(path, TOUCH_COMMON) || IN(path, TOUCH_RIGHT);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static XrResult remap_to_touch(XrInstance instance, PFN_xrSuggestInteractionProfileBindings fn,
|
||||
PFN_xrPathToString to_string, const XrInteractionProfileSuggestedBinding *suggested,
|
||||
const char *profile) {
|
||||
PFN_xrStringToPath to_path = (PFN_xrStringToPath)lookup(instance, "xrStringToPath");
|
||||
XrPath touch;
|
||||
if (!to_path || XR_FAILED(to_path(instance, TOUCH_PROFILE, &touch))) return XR_ERROR_PATH_UNSUPPORTED;
|
||||
uint32_t n = suggested->countSuggestedBindings, kept = 0;
|
||||
XrActionSuggestedBinding *b = calloc(n ? n : 1, sizeof(*b));
|
||||
if (!b) return XR_ERROR_OUT_OF_MEMORY;
|
||||
for (uint32_t i = 0; i < n; ++i) {
|
||||
char path[XR_MAX_PATH_LENGTH];
|
||||
uint32_t size = 0;
|
||||
if (XR_SUCCEEDED(to_string(instance, suggested->suggestedBindings[i].binding, sizeof(path), &size, path))
|
||||
&& touch_has(path))
|
||||
b[kept++] = suggested->suggestedBindings[i];
|
||||
}
|
||||
XrInteractionProfileSuggestedBinding copy = *suggested;
|
||||
copy.interactionProfile = touch;
|
||||
copy.countSuggestedBindings = kept;
|
||||
copy.suggestedBindings = b;
|
||||
XrResult r = kept ? fn(instance, ©) : XR_ERROR_PATH_UNSUPPORTED;
|
||||
free(b);
|
||||
LOG("controller profile %s -> oculus/touch_controller (%u bindings, %u dropped): %d", profile + 22, kept,
|
||||
n - kept, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
static XRAPI_ATTR XrResult XRAPI_CALL hook_xrSuggestInteractionProfileBindings(XrInstance instance,
|
||||
const XrInteractionProfileSuggestedBinding *suggested) {
|
||||
PFN_xrSuggestInteractionProfileBindings fn =
|
||||
(PFN_xrSuggestInteractionProfileBindings)lookup(instance, "xrSuggestInteractionProfileBindings");
|
||||
if (!fn) return XR_ERROR_FUNCTION_UNSUPPORTED;
|
||||
PFN_xrPathToString to_string = (PFN_xrPathToString)lookup(instance, "xrPathToString");
|
||||
if (suggested && to_string)
|
||||
if (suggested && to_string && (layer_debug || aim_correction_on()))
|
||||
for (uint32_t i = 0; i < suggested->countSuggestedBindings; ++i) {
|
||||
char path[XR_MAX_PATH_LENGTH];
|
||||
uint32_t size = 0;
|
||||
if (XR_SUCCEEDED(to_string(instance, suggested->suggestedBindings[i].binding, sizeof(path), &size, path)))
|
||||
note_pose_binding(suggested->suggestedBindings[i].action, path);
|
||||
}
|
||||
return fn(instance, suggested);
|
||||
XrResult r = fn(instance, suggested);
|
||||
if (!profile_remap || !suggested || !to_string) return r;
|
||||
char profile[XR_MAX_PATH_LENGTH] = {0};
|
||||
uint32_t size = 0;
|
||||
if (XR_FAILED(to_string(instance, suggested->interactionProfile, sizeof(profile), &size, profile))) return r;
|
||||
if (!strcmp(profile, TOUCH_PROFILE)) {
|
||||
if (XR_SUCCEEDED(r)) app_suggested_touch = 1; // the app's own Touch bindings win over a remap
|
||||
return r;
|
||||
}
|
||||
if (r != XR_ERROR_PATH_UNSUPPORTED || app_suggested_touch || !IN(profile, NEWER_TOUCH)) return r;
|
||||
XrResult remapped = remap_to_touch(instance, fn, to_string, suggested, profile);
|
||||
return XR_SUCCEEDED(remapped) ? XR_SUCCESS : r;
|
||||
}
|
||||
|
||||
static XRAPI_ATTR XrResult XRAPI_CALL hook_xrCreateActionSpace(XrSession session, const XrActionSpaceCreateInfo *info,
|
||||
|
||||
@@ -10,7 +10,7 @@ timefix OpenXR layer for Proton games (linux-arm64, glibc; the NDK's clang build
|
||||
OculusHMDConnected helper for Rift games under Proton (win-x64 PE; the NDK's clang + lld-link, no Windows SDK), and
|
||||
rewrites artifacts/SHA256SUMS. Run `frameport parity` afterwards to see which games change.
|
||||
|
||||
python native/build.py [--only adapter,bridge,compat,glshim,dex,xrlayer,oculushmd,xrshim,vkshim,vrsettings] [--ndk PATH]
|
||||
python native/build.py [--only adapter,bridge,compat,glshim,dex,xrlayer,oculushmd,xrshim,vkshim,ovrpshim,vrsettings] [--ndk PATH]
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
@@ -247,6 +247,14 @@ def build_vkshim(tc: Path):
|
||||
cwd=src)
|
||||
|
||||
|
||||
def build_ovrpshim(tc: Path):
|
||||
"""OVRPlugin frame-loop shim (see ovrpshim/ovrpshim.c) for Unity 2017-2018 built-in Oculus support."""
|
||||
src = HERE / "ovrpshim"
|
||||
run([exe(tc, "aarch64-linux-android29-clang"), "-shared", "-fPIC", "-O2", "-Wall", "-Wextra", "-Werror",
|
||||
"-fvisibility=hidden", "-Wl,-soname,libfp_ovrp.so", "-Wl,-z,max-page-size=16384", "ovrpshim.c", "-ldl",
|
||||
"-llog", "-o", ART / "arm64-v8a/libfp_ovrp.so"], cwd=src)
|
||||
|
||||
|
||||
def build_dex():
|
||||
javac = shutil.which("javac")
|
||||
if not javac:
|
||||
@@ -291,7 +299,7 @@ def write_sums():
|
||||
|
||||
def main():
|
||||
ap = argparse.ArgumentParser()
|
||||
ap.add_argument("--only", default="adapter,bridge,compat,glshim,dex,xrlayer,oculushmd,xrshim,vkshim,vrsettings")
|
||||
ap.add_argument("--only", default="adapter,bridge,compat,glshim,dex,xrlayer,oculushmd,xrshim,vkshim,ovrpshim,vrsettings")
|
||||
ap.add_argument("--ndk")
|
||||
args = ap.parse_args()
|
||||
parts = set(args.only.split(","))
|
||||
@@ -301,8 +309,9 @@ def main():
|
||||
steps = {"adapter": lambda: build_adapter(tc), "bridge": lambda: build_bridge(tc), "compat": lambda: build_compat(tc),
|
||||
"glshim": lambda: build_glshim(tc), "xrshim": lambda: build_xrshim(tc), "dex": build_dex, "xrlayer": lambda: build_xrlayer(tc),
|
||||
"oculushmd": lambda: build_oculushmd(tc), "vkshim": lambda: build_vkshim(tc),
|
||||
"ovrpshim": lambda: build_ovrpshim(tc),
|
||||
"vrsettings": lambda: build_vrsettings(tc)}
|
||||
for name in ("adapter", "bridge", "compat", "glshim", "xrshim", "vkshim", "dex", "xrlayer", "oculushmd", "vrsettings"):
|
||||
for name in ("adapter", "bridge", "compat", "glshim", "xrshim", "vkshim", "ovrpshim", "dex", "xrlayer", "oculushmd", "vrsettings"):
|
||||
if name in parts:
|
||||
log(f"build {name}")
|
||||
steps[name]()
|
||||
|
||||
@@ -0,0 +1,195 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// FramePort OVRPlugin frame-loop shim for Unity 2017-2018 built-in Oculus support.
|
||||
//
|
||||
// That Unity drives OVRPlugin with the legacy frame loop: ovrp_Update2(render step, frame index, ...) on the main
|
||||
// thread, then ovrp_BeginFrame / ovrp_EndFrame on the render thread. It never calls ovrp_WaitToBeginFrame, which
|
||||
// newer OVRPlugin builds (OVRPort's OpenXR OVRPlugin) need to call xrWaitFrame: no frame ever begins, OVRPlugin logs
|
||||
// "CompositorOpenXR::Update called for frame N outside of frame bounds" thousands of times a second and the Frame's
|
||||
// dashboard freezes (Accounting+, Unity 2017.4).
|
||||
//
|
||||
// FramePort renames the "ovrp_Update2" lookup in libunity.so to "fpov_Update2" (same length) and adds this library to
|
||||
// libOVRPlugin.so's DT_NEEDED, so Unity's dlsym on the plugin finds this function: it waits for the frame first (once
|
||||
// per frame index, render step only), then calls the real ovrp_Update2.
|
||||
#include <android/log.h>
|
||||
#include <dlfcn.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#define TAG "FrameBridge"
|
||||
#define EXPORT __attribute__((visibility("default")))
|
||||
#define LOG(...) __android_log_print(ANDROID_LOG_INFO, TAG, __VA_ARGS__)
|
||||
|
||||
typedef int (*PFN_Update2)(int step, int frame_index, double prediction_seconds);
|
||||
typedef int (*PFN_WaitToBeginFrame)(int frame_index);
|
||||
|
||||
static PFN_Update2 real_update2;
|
||||
static PFN_WaitToBeginFrame real_wait;
|
||||
static pthread_once_t once = PTHREAD_ONCE_INIT;
|
||||
|
||||
static void init(void) {
|
||||
void *ovrp = dlopen("libOVRPlugin.so", RTLD_NOW | RTLD_NOLOAD);
|
||||
if (!ovrp) ovrp = dlopen("libOVRPlugin.so", RTLD_NOW);
|
||||
if (ovrp) {
|
||||
real_update2 = (PFN_Update2)dlsym(ovrp, "ovrp_Update2");
|
||||
real_wait = (PFN_WaitToBeginFrame)dlsym(ovrp, "ovrp_WaitToBeginFrame");
|
||||
}
|
||||
LOG("ovrp frame loop shim: ovrp_Update2 %s, ovrp_WaitToBeginFrame %s", real_update2 ? "OK" : "MISSING",
|
||||
real_wait ? "OK" : "MISSING");
|
||||
}
|
||||
|
||||
#define STEP_RENDER (-1) // ovrpStep_Render
|
||||
|
||||
EXPORT int fpov_Update2(int step, int frame_index, double prediction_seconds) {
|
||||
pthread_once(&once, init);
|
||||
static int last_waited = -1, logged;
|
||||
if (step == STEP_RENDER && real_wait && frame_index != last_waited) {
|
||||
last_waited = frame_index;
|
||||
int r = real_wait(frame_index);
|
||||
if (logged++ < 3) LOG("ovrp frame loop shim: waited for frame %d: %d", frame_index, r);
|
||||
}
|
||||
return real_update2 ? real_update2(step, frame_index, prediction_seconds) : -1000; // ovrpFailure
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------- input diagnostics (pass-through)
|
||||
// The game's C# input (OVRInput) asks OVRPlugin which controllers are connected and for their button state. These
|
||||
// wrappers return exactly what OVRPlugin returns and log the connected mask and every change of the button bits, to
|
||||
// see whether presses reach the game (Accounting+ stuck at "press any button" while the runtime reports presses).
|
||||
typedef struct { unsigned int words[3]; } State; // the common start: ConnectedControllers, Buttons, Touches
|
||||
// ovrpControllerState2 is returned by value (through x8): the type must have its exact size, 64 bytes (4 uint32,
|
||||
// IndexTrigger[2], HandTrigger[2], Thumbstick[2] and Touchpad[2] as float pairs)
|
||||
typedef struct { unsigned int words[16]; } State2;
|
||||
_Static_assert(sizeof(State2) == 64, "ovrpControllerState2 is 64 bytes");
|
||||
typedef unsigned int (*PFN_GetConnected)(void);
|
||||
typedef int (*PFN_GetState4)(unsigned int mask, State *state); // (written by OVRPlugin; only the start is read)
|
||||
typedef State2 (*PFN_GetState2)(unsigned int mask);
|
||||
static PFN_GetConnected real_connected;
|
||||
static PFN_GetState4 real_state4;
|
||||
static PFN_GetState2 real_state2;
|
||||
static pthread_once_t input_once = PTHREAD_ONCE_INIT;
|
||||
|
||||
static void input_init(void) {
|
||||
void *ovrp = dlopen("libOVRPlugin.so", RTLD_NOW | RTLD_NOLOAD);
|
||||
if (!ovrp) return;
|
||||
real_connected = (PFN_GetConnected)dlsym(ovrp, "ovrp_GetConnectedControllers");
|
||||
real_state4 = (PFN_GetState4)dlsym(ovrp, "ovrp_GetControllerState4");
|
||||
real_state2 = (PFN_GetState2)dlsym(ovrp, "ovrp_GetControllerState2");
|
||||
}
|
||||
|
||||
// per requested controller mask (the game may ask for Touch, Remote, Gamepad... separately)
|
||||
static struct { unsigned int mask, connected, buttons; int seen; } masks[8];
|
||||
static int changes;
|
||||
|
||||
// Face buttons on the Frame's controllers can read as clicked while only touched (Accounting+: buttons == touches ==
|
||||
// A|B|X|Y held for seconds). A button held for more than STUCK_NS is reported released until it really lets go, so
|
||||
// real presses (short) still register as a change.
|
||||
#include <time.h>
|
||||
#define STUCK_NS 2000000000ll
|
||||
static long long held_since[32];
|
||||
static unsigned int suppressed;
|
||||
|
||||
static long long now_ns(void) {
|
||||
struct timespec t;
|
||||
clock_gettime(CLOCK_MONOTONIC, &t);
|
||||
return t.tv_sec * 1000000000ll + t.tv_nsec;
|
||||
}
|
||||
|
||||
static unsigned int unstick(unsigned int buttons) {
|
||||
long long now = now_ns();
|
||||
for (int b = 0; b < 32; b++) {
|
||||
unsigned int bit = 1u << b;
|
||||
if (!(buttons & bit)) {
|
||||
held_since[b] = 0;
|
||||
suppressed &= ~bit;
|
||||
continue;
|
||||
}
|
||||
if (!held_since[b]) held_since[b] = now;
|
||||
if (now - held_since[b] > STUCK_NS && !(suppressed & bit)) {
|
||||
suppressed |= bit;
|
||||
static int logged;
|
||||
if (logged++ < 20) LOG("ovrp input: button 0x%x held for > 2 s: reported released until let go", bit);
|
||||
}
|
||||
}
|
||||
return buttons & ~suppressed;
|
||||
}
|
||||
|
||||
static void note_state(const char *which, unsigned int mask, const State *s) {
|
||||
int i = 0;
|
||||
while (i < 8 && masks[i].seen && masks[i].mask != mask) i++;
|
||||
if (i == 8) return;
|
||||
if (!masks[i].seen || masks[i].buttons != s->words[1] || masks[i].connected != s->words[0]) {
|
||||
if (changes++ < 120)
|
||||
LOG("ovrp input: %s(mask 0x%x): connected 0x%x buttons 0x%x touches 0x%x%s", which, mask, s->words[0],
|
||||
s->words[1], s->words[2], masks[i].seen ? "" : " (first call with this mask)");
|
||||
masks[i].seen = 1;
|
||||
masks[i].mask = mask;
|
||||
masks[i].connected = s->words[0];
|
||||
masks[i].buttons = s->words[1];
|
||||
}
|
||||
}
|
||||
|
||||
EXPORT unsigned int fpov_GetConnectedControllers(void) {
|
||||
pthread_once(&input_once, input_init);
|
||||
unsigned int c = real_connected ? real_connected() : 0;
|
||||
static unsigned int last = 0xffffffffu;
|
||||
static int logged;
|
||||
if (c != last && logged++ < 20) LOG("ovrp input: connected controllers 0x%x", c);
|
||||
last = c;
|
||||
return c;
|
||||
}
|
||||
|
||||
EXPORT int fpov_GetControllerState4(unsigned int mask, State *state) {
|
||||
pthread_once(&input_once, input_init);
|
||||
int r = real_state4 ? real_state4(mask, state) : -1000;
|
||||
if (state) {
|
||||
note_state("State4", mask, state);
|
||||
state->words[1] = unstick(state->words[1]);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
EXPORT State2 fpov_GetControllerState2(unsigned int mask) {
|
||||
pthread_once(&input_once, input_init);
|
||||
State2 s = {{0}};
|
||||
if (real_state2) s = real_state2(mask);
|
||||
note_state("State2", mask, (const State *)&s);
|
||||
s.words[1] = unstick(s.words[1]);
|
||||
return s;
|
||||
}
|
||||
|
||||
// Unity's own input (libunity.so: Input.GetKey/anyKey on the Oculus device) reads ovrp_GetControllerState (v1,
|
||||
// returned by value, 48 bytes: 4 uint32, IndexTrigger[2], HandTrigger[2], Thumbstick[2]) and ovrp_GetControllerState2
|
||||
typedef struct { unsigned int words[12]; } State1;
|
||||
_Static_assert(sizeof(State1) == 48, "ovrpControllerState is 48 bytes");
|
||||
typedef State1 (*PFN_GetState1)(unsigned int mask);
|
||||
static PFN_GetState1 real_state1;
|
||||
|
||||
EXPORT State1 fpov_GetControllerState(unsigned int mask) {
|
||||
pthread_once(&input_once, input_init);
|
||||
if (!real_state1) {
|
||||
void *ovrp = dlopen("libOVRPlugin.so", RTLD_NOW | RTLD_NOLOAD);
|
||||
if (ovrp) real_state1 = (PFN_GetState1)dlsym(ovrp, "ovrp_GetControllerState");
|
||||
}
|
||||
State1 s = {{0}};
|
||||
if (real_state1) s = real_state1(mask);
|
||||
note_state("State1(unity)", mask, (const State *)&s);
|
||||
return s;
|
||||
}
|
||||
|
||||
// Oculus Utilities (1.3x) ignores every button unless OVRPlugin reports input focus; with Unity 2017's legacy frame
|
||||
// loop on OVRPort's OVRPlugin that may never be true. Report it as true (the session's own focus still pauses the game)
|
||||
// and log what OVRPlugin said.
|
||||
typedef int (*PFN_GetInputFocus)(int *has_focus);
|
||||
static PFN_GetInputFocus real_input_focus;
|
||||
|
||||
EXPORT int fpov_GetAppHasInputFocus(int *has_focus) {
|
||||
pthread_once(&input_once, input_init);
|
||||
if (!real_input_focus) {
|
||||
void *ovrp = dlopen("libOVRPlugin.so", RTLD_NOW | RTLD_NOLOAD);
|
||||
if (ovrp) real_input_focus = (PFN_GetInputFocus)dlsym(ovrp, "ovrp_GetAppHasInputFocus");
|
||||
}
|
||||
int value = 0, r = real_input_focus ? real_input_focus(&value) : -1000;
|
||||
static int last = -2, logged;
|
||||
if ((r < 0 ? -1 : value) != last && logged++ < 20) LOG("ovrp input: OVRPlugin input focus %d (result %d)", value, r);
|
||||
last = r < 0 ? -1 : value;
|
||||
if (has_focus) *has_focus = 1;
|
||||
return 0; // ovrpSuccess
|
||||
}
|
||||
@@ -8,6 +8,11 @@
|
||||
// at this shim (patches/frame/vk_sanitize.py). dlsym on the shim finds the functions below first and every other
|
||||
// symbol in its dependency, the real libvulkan.so. Valid pointers are kept; a pointer is dropped only when it isn't
|
||||
// readable memory or doesn't point at a structure type the parent may chain.
|
||||
//
|
||||
// Shader fixes (adapter setting vk_shader_fix, from a game's recipe): a SPIR-V module whose size and SHA-256 match is
|
||||
// copied with extra words inserted at a byte offset, e.g. stores that initialize locals a shader reads before writing
|
||||
// (an undefined loop counter hung the GPU in VR4's campaign). Every other module passes through unchanged.
|
||||
// Format: vk_shader_fix=<size>:<sha256 hex>:<byte offset>:<word>,<word>,...[;<next fix>]
|
||||
#define _GNU_SOURCE
|
||||
#include <vulkan/vulkan.h>
|
||||
#include <android/log.h>
|
||||
@@ -27,14 +32,162 @@ static void *real_vk;
|
||||
static PFN_vkGetInstanceProcAddr real_gipa;
|
||||
static PFN_vkGetDeviceProcAddr real_gdpa;
|
||||
static PFN_vkCreateRenderPass2 real_rp2_trampoline;
|
||||
static PFN_vkCreateShaderModule real_csm_trampoline;
|
||||
static pthread_once_t once = PTHREAD_ONCE_INIT;
|
||||
|
||||
// ---------------------------------------------------------------- shader fixes (settings)
|
||||
|
||||
#define MAX_FIXES 16
|
||||
#define MAX_WORDS 64
|
||||
static struct {
|
||||
size_t size, offset;
|
||||
uint8_t sha[32];
|
||||
uint32_t words[MAX_WORDS];
|
||||
int nwords;
|
||||
} fixes[MAX_FIXES];
|
||||
static int nfixes;
|
||||
|
||||
static int hexval(char c) {
|
||||
return c >= '0' && c <= '9' ? c - '0' : c >= 'a' && c <= 'f' ? c - 'a' + 10 : c >= 'A' && c <= 'F' ? c - 'A' + 10 : -1;
|
||||
}
|
||||
|
||||
static void parse_fixes(char *v) {
|
||||
for (char *save = NULL, *item = strtok_r(v, ";", &save); item && nfixes < MAX_FIXES; item = strtok_r(NULL, ";", &save)) {
|
||||
char *f[4] = {0}, *save2 = NULL;
|
||||
int n = 0;
|
||||
for (char *t = strtok_r(item, ":", &save2); t && n < 4; t = strtok_r(NULL, ":", &save2)) f[n++] = t;
|
||||
if (n != 4 || strlen(f[1]) != 64) continue;
|
||||
int ok = 1;
|
||||
for (int i = 0; i < 32 && ok; i++) {
|
||||
int hi = hexval(f[1][2 * i]), lo = hexval(f[1][2 * i + 1]);
|
||||
if (hi < 0 || lo < 0) ok = 0; else fixes[nfixes].sha[i] = (uint8_t)(hi << 4 | lo);
|
||||
}
|
||||
fixes[nfixes].size = strtoul(f[0], NULL, 0);
|
||||
fixes[nfixes].offset = strtoul(f[2], NULL, 0);
|
||||
int nw = 0;
|
||||
for (char *save3 = NULL, *w = strtok_r(f[3], ",", &save3); w && nw < MAX_WORDS; w = strtok_r(NULL, ",", &save3))
|
||||
fixes[nfixes].words[nw++] = (uint32_t)strtoul(w, NULL, 0);
|
||||
fixes[nfixes].nwords = nw;
|
||||
if (ok && nw && fixes[nfixes].size % 4 == 0 && fixes[nfixes].offset % 4 == 0 &&
|
||||
fixes[nfixes].offset >= 20 && fixes[nfixes].offset <= fixes[nfixes].size)
|
||||
nfixes++;
|
||||
}
|
||||
}
|
||||
|
||||
static void read_settings(const char *path) {
|
||||
FILE *f = fopen(path, "r");
|
||||
if (!f) return;
|
||||
char line[4096];
|
||||
while (fgets(line, sizeof line, f)) {
|
||||
line[strcspn(line, "\r\n")] = 0;
|
||||
if (!strncmp(line, "vk_shader_fix=", 14)) {
|
||||
nfixes = 0; // later sources override earlier ones (as for the adapter's settings)
|
||||
parse_fixes(line + 14);
|
||||
}
|
||||
}
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
static void read_all_settings(void) {
|
||||
char path[600];
|
||||
Dl_info info;
|
||||
if (dladdr((void *)read_all_settings, &info) && info.dli_fname) {
|
||||
const char *slash = strrchr(info.dli_fname, '/');
|
||||
if (slash && slash - info.dli_fname < 500) {
|
||||
snprintf(path, sizeof path, "%.*s/libframe_settings.so", (int)(slash - info.dli_fname), info.dli_fname);
|
||||
read_settings(path);
|
||||
}
|
||||
}
|
||||
char pkg[256] = {0};
|
||||
FILE *f = fopen("/proc/self/cmdline", "r");
|
||||
if (f) {
|
||||
size_t n = fread(pkg, 1, sizeof pkg - 1, f);
|
||||
pkg[n] = 0;
|
||||
fclose(f);
|
||||
}
|
||||
char *colon = strchr(pkg, ':');
|
||||
if (colon) *colon = 0;
|
||||
if (*pkg && !strchr(pkg, '/')) {
|
||||
snprintf(path, sizeof path, "/sdcard/Android/data/%s/files/framebridge.conf", pkg);
|
||||
read_settings(path);
|
||||
}
|
||||
const char *env = getenv("FRAMEBRIDGE_CONFIG");
|
||||
if (env && *env) read_settings(env);
|
||||
}
|
||||
|
||||
// SHA-256 (FIPS 180-4), only run for modules whose size matches a fix
|
||||
static const uint32_t K[64] = {
|
||||
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01,
|
||||
0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,
|
||||
0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147,
|
||||
0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
|
||||
0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08,
|
||||
0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
|
||||
0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2};
|
||||
#define ROR(x, n) (((x) >> (n)) | ((x) << (32 - (n))))
|
||||
|
||||
static void sha256_block(uint32_t h[8], const uint8_t *p) {
|
||||
uint32_t w[64];
|
||||
for (int i = 0; i < 16; i++) w[i] = (uint32_t)p[4 * i] << 24 | (uint32_t)p[4 * i + 1] << 16 | (uint32_t)p[4 * i + 2] << 8 | p[4 * i + 3];
|
||||
for (int i = 16; i < 64; i++) {
|
||||
uint32_t s0 = ROR(w[i - 15], 7) ^ ROR(w[i - 15], 18) ^ (w[i - 15] >> 3);
|
||||
uint32_t s1 = ROR(w[i - 2], 17) ^ ROR(w[i - 2], 19) ^ (w[i - 2] >> 10);
|
||||
w[i] = w[i - 16] + s0 + w[i - 7] + s1;
|
||||
}
|
||||
uint32_t a = h[0], b = h[1], c = h[2], d = h[3], e = h[4], f = h[5], g = h[6], hh = h[7];
|
||||
for (int i = 0; i < 64; i++) {
|
||||
uint32_t t1 = hh + (ROR(e, 6) ^ ROR(e, 11) ^ ROR(e, 25)) + ((e & f) ^ (~e & g)) + K[i] + w[i];
|
||||
uint32_t t2 = (ROR(a, 2) ^ ROR(a, 13) ^ ROR(a, 22)) + ((a & b) ^ (a & c) ^ (b & c));
|
||||
hh = g; g = f; f = e; e = d + t1; d = c; c = b; b = a; a = t1 + t2;
|
||||
}
|
||||
h[0] += a; h[1] += b; h[2] += c; h[3] += d; h[4] += e; h[5] += f; h[6] += g; h[7] += hh;
|
||||
}
|
||||
|
||||
static void sha256(const uint8_t *data, size_t len, uint8_t out[32]) {
|
||||
uint32_t h[8] = {0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19};
|
||||
size_t i = 0;
|
||||
for (; i + 64 <= len; i += 64) sha256_block(h, data + i);
|
||||
uint8_t tail[128] = {0};
|
||||
size_t rest = len - i;
|
||||
memcpy(tail, data + i, rest);
|
||||
tail[rest] = 0x80;
|
||||
size_t blocks = rest + 9 > 64 ? 2 : 1;
|
||||
uint64_t bits = (uint64_t)len * 8;
|
||||
for (int b = 0; b < 8; b++) tail[blocks * 64 - 1 - b] = (uint8_t)(bits >> (8 * b));
|
||||
for (size_t b = 0; b < blocks; b++) sha256_block(h, tail + 64 * b);
|
||||
for (int b = 0; b < 8; b++) {
|
||||
out[4 * b] = h[b] >> 24; out[4 * b + 1] = h[b] >> 16; out[4 * b + 2] = h[b] >> 8; out[4 * b + 3] = h[b];
|
||||
}
|
||||
}
|
||||
|
||||
// The fixed copy of `code` (caller frees) and its size, or NULL when no fix matches.
|
||||
static uint32_t *fixed_shader(const uint32_t *code, size_t size, size_t *out_size) {
|
||||
for (int i = 0; i < nfixes; i++) {
|
||||
if (fixes[i].size != size) continue;
|
||||
uint8_t digest[32];
|
||||
sha256((const uint8_t *)code, size, digest);
|
||||
if (memcmp(digest, fixes[i].sha, 32)) continue;
|
||||
size_t extra = (size_t)fixes[i].nwords * 4;
|
||||
uint32_t *copy = malloc(size + extra);
|
||||
if (!copy) return NULL;
|
||||
memcpy(copy, code, fixes[i].offset);
|
||||
memcpy((uint8_t *)copy + fixes[i].offset, fixes[i].words, extra);
|
||||
memcpy((uint8_t *)copy + fixes[i].offset + extra, (const uint8_t *)code + fixes[i].offset, size - fixes[i].offset);
|
||||
*out_size = size + extra;
|
||||
return copy;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void init(void) {
|
||||
read_all_settings();
|
||||
if (nfixes) LOG("vk shim: %d shader fix(es) configured", nfixes);
|
||||
real_vk = dlopen("libvulkan.so", RTLD_NOW | RTLD_LOCAL);
|
||||
if (real_vk) {
|
||||
real_gipa = (PFN_vkGetInstanceProcAddr)dlsym(real_vk, "vkGetInstanceProcAddr");
|
||||
real_gdpa = (PFN_vkGetDeviceProcAddr)dlsym(real_vk, "vkGetDeviceProcAddr");
|
||||
real_rp2_trampoline = (PFN_vkCreateRenderPass2)dlsym(real_vk, "vkCreateRenderPass2");
|
||||
real_csm_trampoline = (PFN_vkCreateShaderModule)dlsym(real_vk, "vkCreateShaderModule");
|
||||
}
|
||||
LOG("vk shim: libvulkan.so %s", real_gipa && real_gdpa ? "OK" : "MISSING");
|
||||
}
|
||||
@@ -203,17 +356,26 @@ static VkRenderPassCreateInfo2 clean_create_info(Arena *a, const VkRenderPassCre
|
||||
// ---------------------------------------------------------------- entry points
|
||||
|
||||
#define MAX_DEVICES 8
|
||||
static struct { VkDevice device; PFN_vkCreateRenderPass2 rp2, rp2khr; } devices[MAX_DEVICES];
|
||||
enum { FN_RP2, FN_RP2KHR, FN_CSM, FN_COUNT };
|
||||
static const char *const FN_NAMES[FN_COUNT] = {"vkCreateRenderPass2", "vkCreateRenderPass2KHR", "vkCreateShaderModule"};
|
||||
static struct { VkDevice device; PFN_vkVoidFunction fn[FN_COUNT]; } devices[MAX_DEVICES];
|
||||
static PFN_vkCreateRenderPass2 fallback_rp2khr; // from vkGetInstanceProcAddr
|
||||
static pthread_mutex_t dev_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
static PFN_vkCreateRenderPass2 real_for(VkDevice device, int khr) {
|
||||
PFN_vkCreateRenderPass2 fn = NULL;
|
||||
// The next implementation of a wrapped device function: the one vkGetDeviceProcAddr returned for this device, else
|
||||
// a fresh lookup, else the loader's trampoline.
|
||||
static PFN_vkVoidFunction device_fn(VkDevice device, int which) {
|
||||
PFN_vkVoidFunction fn = NULL;
|
||||
pthread_mutex_lock(&dev_lock);
|
||||
for (int i = 0; i < MAX_DEVICES; i++)
|
||||
if (devices[i].device == device) { fn = khr ? devices[i].rp2khr : devices[i].rp2; break; }
|
||||
if (devices[i].device == device) { fn = devices[i].fn[which]; break; }
|
||||
pthread_mutex_unlock(&dev_lock);
|
||||
if (!fn && real_gdpa) fn = (PFN_vkCreateRenderPass2)real_gdpa(device, khr ? "vkCreateRenderPass2KHR" : "vkCreateRenderPass2");
|
||||
if (!fn && real_gdpa) fn = real_gdpa(device, FN_NAMES[which]);
|
||||
return fn;
|
||||
}
|
||||
|
||||
static PFN_vkCreateRenderPass2 real_for(VkDevice device, int khr) {
|
||||
PFN_vkCreateRenderPass2 fn = (PFN_vkCreateRenderPass2)device_fn(device, khr ? FN_RP2KHR : FN_RP2);
|
||||
if (!fn) fn = khr ? fallback_rp2khr : real_rp2_trampoline;
|
||||
return fn;
|
||||
}
|
||||
@@ -246,10 +408,39 @@ static VKAPI_ATTR VkResult VKAPI_CALL create_render_pass2_khr(VkDevice device, c
|
||||
return create_render_pass2(device, ci, alloc, rp, 1);
|
||||
}
|
||||
|
||||
static int fixes_applied;
|
||||
|
||||
EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateShaderModule(VkDevice device, const VkShaderModuleCreateInfo *ci,
|
||||
const VkAllocationCallbacks *alloc, VkShaderModule *module) {
|
||||
pthread_once(&once, init);
|
||||
PFN_vkCreateShaderModule real = (PFN_vkCreateShaderModule)device_fn(device, FN_CSM);
|
||||
if (!real) real = real_csm_trampoline;
|
||||
if (!real) return VK_ERROR_INITIALIZATION_FAILED;
|
||||
size_t size = 0;
|
||||
uint32_t *code = nfixes && ci && ci->pCode ? fixed_shader(ci->pCode, ci->codeSize, &size) : NULL;
|
||||
if (!code) return real(device, ci, alloc, module);
|
||||
VkShaderModuleCreateInfo copy = *ci; // the caller's create info and code stay untouched
|
||||
copy.codeSize = size;
|
||||
copy.pCode = code;
|
||||
VkResult r = real(device, ©, alloc, module);
|
||||
free(code);
|
||||
if (fixes_applied++ < 20) LOG("vk shim: fixed shader module (%zu -> %zu bytes): %d", ci->codeSize, size, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
static int wrapped_index(const char *name) {
|
||||
for (int i = 0; i < FN_COUNT; i++)
|
||||
if (!strcmp(name, FN_NAMES[i])) return i;
|
||||
return -1;
|
||||
}
|
||||
|
||||
static PFN_vkVoidFunction wrap(const char *name) {
|
||||
if (!strcmp(name, "vkCreateRenderPass2")) return (PFN_vkVoidFunction)vkCreateRenderPass2;
|
||||
if (!strcmp(name, "vkCreateRenderPass2KHR")) return (PFN_vkVoidFunction)create_render_pass2_khr;
|
||||
return NULL;
|
||||
switch (wrapped_index(name)) {
|
||||
case FN_RP2: return (PFN_vkVoidFunction)vkCreateRenderPass2;
|
||||
case FN_RP2KHR: return (PFN_vkVoidFunction)create_render_pass2_khr;
|
||||
case FN_CSM: return nfixes ? (PFN_vkVoidFunction)vkCreateShaderModule : NULL; // nothing to fix: no detour
|
||||
default: return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetDeviceProcAddr(VkDevice device, const char *name) {
|
||||
@@ -258,7 +449,7 @@ EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetDeviceProcAddr(VkDevice dev
|
||||
PFN_vkVoidFunction fn = real_gdpa(device, name);
|
||||
PFN_vkVoidFunction w = fn ? wrap(name) : NULL;
|
||||
if (!w) return fn;
|
||||
int khr = name[strlen(name) - 1] == 'R';
|
||||
int which = wrapped_index(name);
|
||||
pthread_mutex_lock(&dev_lock);
|
||||
int slot = -1;
|
||||
for (int i = 0; i < MAX_DEVICES; i++) {
|
||||
@@ -267,7 +458,7 @@ EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetDeviceProcAddr(VkDevice dev
|
||||
}
|
||||
if (slot >= 0) {
|
||||
devices[slot].device = device;
|
||||
if (khr) devices[slot].rp2khr = (PFN_vkCreateRenderPass2)fn; else devices[slot].rp2 = (PFN_vkCreateRenderPass2)fn;
|
||||
devices[slot].fn[which] = fn;
|
||||
}
|
||||
pthread_mutex_unlock(&dev_lock);
|
||||
return w;
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
## Install
|
||||
|
||||
- **Windows:** unzip `FramePort-windows-x64.zip`, run `FramePort.exe` (warning → **More info → Run anyway**).
|
||||
- **macOS:** unzip `FramePort-macos-arm64.zip`, right-click `FramePort.app` → **Open**.
|
||||
- **Linux:** `tar xzf FramePort-linux-x64.tar.gz && ./FramePort/FramePort` (ARM64: `FramePort-linux-arm64.tar.gz`).
|
||||
|
||||
Full guide: [docs/INSTALL.md](https://github.com/spoopyghosty0/frameport/blob/main/docs/INSTALL.md) · checksums in
|
||||
`SHA256SUMS.txt`.
|
||||
@@ -1,13 +1,27 @@
|
||||
[project]
|
||||
name = "frameport"
|
||||
dynamic = ["version"]
|
||||
description = "Port Meta Quest standalone games to the Valve Steam Frame (Lepton): suggested patches, automated validation, one-click install."
|
||||
description = "Run Meta Quest, Android and PC VR games on the Valve Steam Frame: per-game patches, validation and one-click install."
|
||||
readme = "README.md"
|
||||
license = { text = "GPL-3.0-only" }
|
||||
license = "GPL-3.0-only"
|
||||
license-files = ["LICENSE", "THIRD_PARTY_NOTICES.md"]
|
||||
authors = [{ name = "spoopyghosty0" }]
|
||||
keywords = ["steam-frame", "vr", "openxr", "meta-quest", "android", "lepton", "proton", "revive"]
|
||||
classifiers = [
|
||||
"Development Status :: 4 - Beta",
|
||||
"Environment :: X11 Applications",
|
||||
"Intended Audience :: End Users/Desktop",
|
||||
"Operating System :: Microsoft :: Windows",
|
||||
"Operating System :: MacOS",
|
||||
"Operating System :: POSIX :: Linux",
|
||||
"Programming Language :: Python :: 3",
|
||||
"Topic :: Games/Entertainment",
|
||||
]
|
||||
requires-python = ">=3.11"
|
||||
dependencies = [
|
||||
"flet>=1.0",
|
||||
"flet-desktop>=1.0",
|
||||
"flet-dropzone>=0.4.0", # drag-and-drop uploads in the Files tab (packaged app only; Apache-2.0)
|
||||
"paramiko>=3.4",
|
||||
"zeroconf>=0.132",
|
||||
"psutil>=5.9",
|
||||
@@ -20,11 +34,16 @@ dependencies = [
|
||||
"pyaxmlparser>=0.3.31",
|
||||
]
|
||||
|
||||
[project.urls]
|
||||
Homepage = "https://github.com/spoopyghosty0/frameport"
|
||||
Issues = "https://github.com/spoopyghosty0/frameport/issues"
|
||||
Releases = "https://github.com/spoopyghosty0/frameport/releases"
|
||||
|
||||
[project.optional-dependencies]
|
||||
dev = ["pytest>=8", "flet-web>=1.0", "flet-cli>=1.0", "playwright>=1.40"]
|
||||
dev = ["pytest>=8", "pytest-timeout>=2.3", "ruff>=0.6", "flet-web>=1.0", "flet-cli>=1.0", "playwright>=1.40"]
|
||||
|
||||
[project.scripts]
|
||||
frameport = "frameport.cli:app"
|
||||
frameport = "frameport.cli:main"
|
||||
frameport-gui = "frameport.ui.app:main"
|
||||
|
||||
[build-system]
|
||||
@@ -45,8 +64,8 @@ packages = ["src/frameport"]
|
||||
|
||||
[tool.pytest.ini_options]
|
||||
testpaths = ["tests"]
|
||||
timeout = 120
|
||||
markers = [
|
||||
"device: needs a reachable Steam Frame (FRAMEPORT_FRAME=user@host)",
|
||||
"games: needs the local game dumps (FRAMEPORT_GAMES=<downloads dir>)",
|
||||
"native: compiles native code with the NDK from native/build.py (FRAMEPORT_NATIVE_TESTS=1; slow)",
|
||||
]
|
||||
@@ -59,3 +78,19 @@ company = "FramePort"
|
||||
[tool.flet.app]
|
||||
path = "src"
|
||||
module = "main"
|
||||
|
||||
[tool.ruff]
|
||||
line-length = 120
|
||||
target-version = "py311"
|
||||
extend-exclude = ["native", "src/frameport/_data"]
|
||||
|
||||
[tool.ruff.lint]
|
||||
select = ["E", "F", "W", "I", "B", "UP"]
|
||||
ignore = [
|
||||
"E731", # lambdas assigned to names: used for small Flet callbacks
|
||||
"B008", # function calls in defaults: Typer options
|
||||
"UP007", "UP045", # Optional[...] in Typer signatures (Typer reads the annotations)
|
||||
]
|
||||
|
||||
[tool.ruff.lint.isort]
|
||||
known-first-party = ["frameport"]
|
||||
@@ -21,7 +21,10 @@ from frameport.recommend.catalog import CatalogEntry, to_yaml # noqa: E402
|
||||
|
||||
PKG_RE = re.compile(r"^(rift\.[a-z0-9_]{1,80}|[A-Za-z][A-Za-z0-9_]*(\.[A-Za-z0-9_]+){1,8})$")
|
||||
STATUSES = {"works", "issues", "unsupported", "unknown"}
|
||||
LIST_FIELDS = {"overport_extra", "overport_remove", "alt_overport", "frame", "frame_remove", "pcvr", "pcvr_remove"}
|
||||
LIST_FIELDS = {"overport_extra", "overport_remove", "alt_overport", "frame", "frame_remove", "pcvr", "pcvr_remove",
|
||||
"device"}
|
||||
# FramePort's own patch ids must exist (OVRPort's are listed by its CLI at runtime, so not checked here)
|
||||
OWN_PATCH_FIELDS = ("frame", "frame_remove", "pcvr", "pcvr_remove", "device")
|
||||
DICT_FIELDS = {"adapter", "device_files", "lepton_env", "proton_env", "verified"}
|
||||
ID_RE = re.compile(r"^[A-Za-z0-9_.\-]{1,80}$")
|
||||
|
||||
@@ -64,6 +67,13 @@ def validate(d: dict) -> CatalogEntry:
|
||||
for k in LIST_FIELDS & set(d):
|
||||
if not isinstance(d[k], list) or not all(isinstance(x, str) and ID_RE.match(x) for x in d[k]):
|
||||
raise Invalid(f"{k} must be a list of patch ids")
|
||||
from frameport.patches import base
|
||||
|
||||
base.load_all()
|
||||
for k in OWN_PATCH_FIELDS:
|
||||
unknown_ids = [x for x in d.get(k) or [] if x not in base.REGISTRY]
|
||||
if unknown_ids:
|
||||
raise Invalid(f"{k}: unknown patch id(s) {', '.join(unknown_ids)}")
|
||||
for k in DICT_FIELDS & set(d):
|
||||
if not isinstance(d[k], dict):
|
||||
raise Invalid(f"{k} must be a mapping")
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
"""Write docs/GAMES.md: the tested games from the bundled catalog as a simple table to share.
|
||||
Run after catalog changes: python scripts/compat_list.py"""
|
||||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
sys.path.insert(0, str(ROOT / "src"))
|
||||
|
||||
from frameport.recommend import catalog # noqa: E402
|
||||
|
||||
STATUS = {"works": "✅ Works", "issues": "⚠️ Works with issues", "unsupported": "❌ Doesn't run"}
|
||||
ORDER = {"works": 0, "issues": 1, "unsupported": 2}
|
||||
ISSUES = "https://github.com/spoopyghosty0/frameport/issues/new?template="
|
||||
SHARE, REPORT = ISSUES + "working-config.yml", ISSUES + "bug-report.yml"
|
||||
|
||||
|
||||
def short(note: str) -> str:
|
||||
"""The note's first sentence, without technical asides."""
|
||||
first = re.split(r"(?<=[.!?])\s", " ".join((note or "").split()), maxsplit=1)[0]
|
||||
return first if len(first) <= 160 else first[:157].rstrip() + "…"
|
||||
|
||||
|
||||
def render() -> str:
|
||||
# the repo's own recipes only (a local user catalog would replace or hide entries)
|
||||
bundled = catalog._load_dir(catalog.catalog_dir() / "games", "bundled")
|
||||
entries = [e for e in bundled.values() if e.status in STATUS]
|
||||
entries.sort(key=lambda e: (ORDER[e.status], e.title.lower()))
|
||||
rows = ["| Game | Platform | Status | Notes |", "|---|---|---|---|"]
|
||||
for e in entries:
|
||||
platform = "PC VR" if e.kind == "rift" else "Quest"
|
||||
note = "" if e.status == "works" else short(e.notes).replace("|", "/")
|
||||
rows.append(f"| {e.title} | {platform} | {STATUS[e.status]} | {note} |")
|
||||
return ("# Tested games\n\n"
|
||||
"Games tested on the Steam Frame with FramePort's recipes. Games not listed here may work too: FramePort "
|
||||
"suggests patches for them, and a working config can be shared from the app (**Share working config…**).\n"
|
||||
f"Tested a game? [Share a working config]({SHARE}) or [report a problem]({REPORT}) (in the app: the game's "
|
||||
"**…** menu does both and fills in the details).\n"
|
||||
"Generated from [catalog/games](../catalog/games) by `scripts/compat_list.py`.\n\n"
|
||||
+ "\n".join(rows) + "\n")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
out = ROOT / "docs" / "GAMES.md"
|
||||
out.write_text(render(), encoding="utf-8")
|
||||
print(f"wrote {out}")
|
||||
@@ -23,7 +23,8 @@ def signature(recipe) -> dict:
|
||||
pats = recipe.patches
|
||||
return {
|
||||
"overport": sorted(p for p in pats if base.get(p).category == "overport" and not base.get(p).default_on),
|
||||
"overport_removed": sorted(p for p in (x.id for x in base.all_patches() if x.category == "overport" and x.default_on)
|
||||
"overport_removed": sorted(p for p in (x.id for x in base.all_patches()
|
||||
if x.category == "overport" and x.default_on)
|
||||
if p not in pats),
|
||||
"frame": sorted(p for p in pats if base.get(p).category == "frame" and not base.get(p).default_on),
|
||||
"adapter": {p.split(".", 1)[1]: v.get("value") for p, v in sorted(pats.items()) if p.startswith("adapter.")},
|
||||
@@ -47,7 +48,8 @@ def main() -> int:
|
||||
if not catalog.lookup(a.package):
|
||||
continue
|
||||
want = signature(engine.suggest(a, use_catalog=True))
|
||||
want["status_unsupported"] = catalog.lookup(a.package).status == "unsupported" and "32-bit" in catalog.lookup(a.package).notes
|
||||
want["status_unsupported"] = (catalog.lookup(a.package).status == "unsupported"
|
||||
and "32-bit" in catalog.lookup(a.package).notes)
|
||||
got = signature(engine.suggest(a, use_catalog=False))
|
||||
diffs = {k: (want[k], got[k]) for k in want if want[k] != got[k]}
|
||||
total += len(want)
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Collect every translatable text into src/frameport/locales/template.json (see src/frameport/i18n.py).
|
||||
|
||||
python scripts/i18n_extract.py # rewrite the template
|
||||
python scripts/i18n_extract.py --check # exit 1 if the template is out of date (CI / tests)
|
||||
|
||||
Sources: tr("…") and tr_n("…", "…", n) calls in src/frameport (literal arguments), the GUI help texts, and every
|
||||
patch's title and description. A translation file (locales/<language>.json) copies the template and fills in the
|
||||
values: a string for tr() texts, a list [one, other] for tr_n() texts.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import ast
|
||||
import json
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
SRC = ROOT / "src" / "frameport"
|
||||
TEMPLATE = SRC / "locales" / "template.json"
|
||||
sys.path.insert(0, str(ROOT / "src"))
|
||||
|
||||
|
||||
def from_code() -> tuple[dict, list[str]]:
|
||||
"""(texts, problems): tr()/tr_n() literals, and calls whose text isn't a literal (can't be extracted)."""
|
||||
texts: dict = {}
|
||||
problems = []
|
||||
for path in sorted(SRC.rglob("*.py")):
|
||||
if path.name == "i18n.py" and path.parent == SRC:
|
||||
continue
|
||||
tree = ast.parse(path.read_text(encoding="utf-8"))
|
||||
for node in ast.walk(tree):
|
||||
if not (isinstance(node, ast.Call) and isinstance(node.func, ast.Name) and node.func.id in ("tr", "tr_n")):
|
||||
continue
|
||||
args = node.args[:1] if node.func.id == "tr" else node.args[:2]
|
||||
if all(isinstance(a, ast.Constant) and isinstance(a.value, str) for a in args) and args:
|
||||
if node.func.id == "tr":
|
||||
texts.setdefault(args[0].value, "")
|
||||
else:
|
||||
texts[args[0].value] = ["", ""]
|
||||
elif any(isinstance(a, ast.JoinedStr) for a in args):
|
||||
problems.append(f"{path.relative_to(ROOT)}:{node.lineno}: f-string inside {node.func.id}() "
|
||||
"(use a template and .format())")
|
||||
return texts, problems
|
||||
|
||||
|
||||
def from_data() -> dict:
|
||||
"""Help texts and patch titles/descriptions (defined as data, translated where they're shown)."""
|
||||
from frameport.patches import base
|
||||
from frameport.patches.settings import GROUPS, UI
|
||||
from frameport.ui.help import HELP
|
||||
|
||||
texts = {dict.__getitem__(HELP, k): "" for k in HELP}
|
||||
for p in base.all_patches():
|
||||
for t in (p.title, p.description, p.summary):
|
||||
if t:
|
||||
texts[t] = ""
|
||||
for _, title in GROUPS: # the Game settings dialog
|
||||
texts[title] = ""
|
||||
for ui in UI.values():
|
||||
for t in (ui.get("label"), ui.get("help")):
|
||||
if t:
|
||||
texts[t] = ""
|
||||
if ui["control"][0] == "choice":
|
||||
for _, label in ui["control"][1]:
|
||||
if any(c.isalpha() for c in label):
|
||||
texts[label] = ""
|
||||
return texts
|
||||
|
||||
|
||||
def build() -> tuple[dict, list[str]]:
|
||||
code, problems = from_code()
|
||||
texts = {**from_data(), **code}
|
||||
return dict(sorted(texts.items(), key=lambda kv: kv[0].lower())), problems
|
||||
|
||||
|
||||
def main() -> int:
|
||||
ap = argparse.ArgumentParser()
|
||||
ap.add_argument("--check", action="store_true", help="only check that the template is up to date")
|
||||
args = ap.parse_args()
|
||||
texts, problems = build()
|
||||
for p in problems:
|
||||
print(p, file=sys.stderr)
|
||||
text = json.dumps(texts, ensure_ascii=False, indent=1) + "\n"
|
||||
if args.check:
|
||||
current = TEMPLATE.read_text(encoding="utf-8") if TEMPLATE.exists() else ""
|
||||
if current != text:
|
||||
print("locales/template.json is out of date: run python scripts/i18n_extract.py", file=sys.stderr)
|
||||
return 1
|
||||
return 1 if problems else 0
|
||||
TEMPLATE.parent.mkdir(parents=True, exist_ok=True)
|
||||
TEMPLATE.write_text(text, encoding="utf-8")
|
||||
print(f"{len(texts)} texts -> {TEMPLATE.relative_to(ROOT)}")
|
||||
return 1 if problems else 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
@@ -40,9 +40,19 @@ def stage_data():
|
||||
shutil.rmtree(DATA, ignore_errors=True)
|
||||
for name in ("catalog", "artifacts", "agent", "bootstrap"):
|
||||
shutil.copytree(ROOT / name, DATA / name)
|
||||
# the Frame agent is uploaded as source; `flet build` turns every .py into .pyc (issue #2): keep a non-.py copy
|
||||
shutil.copy2(ROOT / "agent/frameport_agent.py", DATA / "agent/frameport_agent.py.txt")
|
||||
print(f"staged data in {DATA}")
|
||||
|
||||
|
||||
def check_bundle(out: Path) -> None:
|
||||
"""The finished bundle must contain the agent's source (the app uploads it to the Frame)."""
|
||||
found = [p for p in out.rglob("frameport_agent.py*") if p.suffix != ".pyc"]
|
||||
if not found:
|
||||
raise SystemExit(f"{out}: the Frame agent's source is missing from the bundle (only compiled?)")
|
||||
print("agent source in bundle:", ", ".join(str(p.relative_to(out)) for p in found))
|
||||
|
||||
|
||||
def main() -> int:
|
||||
ap = argparse.ArgumentParser()
|
||||
ap.add_argument("--pyinstaller", action="store_true")
|
||||
@@ -53,8 +63,15 @@ def main() -> int:
|
||||
stage_data()
|
||||
try:
|
||||
if args.pyinstaller:
|
||||
sep = ";" if TARGET == "windows" else ":"
|
||||
# --yes: a failed flet build's folder doesn't stop it
|
||||
cmd = ["flet", "pack", str(ROOT / "src/main.py"), "--name", "FramePort", "--product-name", "FramePort",
|
||||
"--add-data", f"{DATA}{';' if TARGET == 'windows' else ':'}frameport/_data", "--distpath", str(ROOT / "dist")]
|
||||
"--add-data", f"{DATA}{sep}frameport/_data",
|
||||
# translations (data files PyInstaller doesn't pick up from the imports)
|
||||
"--add-data", f"{ROOT / 'src/frameport/locales'}{sep}frameport/locales",
|
||||
"--distpath", str(ROOT / "dist"), "--yes"]
|
||||
if TARGET == "linux":
|
||||
cmd.append("--onedir") # a folder: the bundle check sees the agent source, the archive the app
|
||||
else:
|
||||
# --yes: install the Flutter SDK etc. without prompting; --no-rich-output: plain logs (CI, Windows consoles)
|
||||
cmd = ["flet", "build", TARGET, str(ROOT), "--project", "FramePort", "--product", "FramePort",
|
||||
@@ -62,7 +79,10 @@ def main() -> int:
|
||||
if TARGET == "macos": # flet's default bundled Python lacks prebuilt cryptography wheels for both Mac archs
|
||||
cmd += ["--python-version", "3.12", "--arch", "arm64"] # Apple Silicon; x86_64 cross-build fails
|
||||
print(" ".join(cmd))
|
||||
return subprocess.call(cmd, cwd=ROOT)
|
||||
rc = subprocess.call(cmd, cwd=ROOT)
|
||||
if rc == 0:
|
||||
check_bundle(ROOT / "dist" if args.pyinstaller else ROOT / "dist" / TARGET)
|
||||
return rc
|
||||
finally:
|
||||
if not args.keep_data:
|
||||
shutil.rmtree(DATA, ignore_errors=True)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Make a screenshot-safe copy of a FramePort data folder (for docs/images):
|
||||
|
||||
python scripts/scrub_library.py <data dir> <new dir> [--sort size]
|
||||
python scripts/scrub_library.py <data dir> <new dir> [--sort size] [--status works,issues]
|
||||
|
||||
Copies library.json + artwork/ only (no Frame pairing, SSH key, tools, logs or builds). In the copy every game's
|
||||
folder name becomes its store title, every local path becomes D:/Games/<Quest|PC VR>/<title>/..., settings other than
|
||||
@@ -66,14 +66,19 @@ def main() -> int:
|
||||
ap.add_argument("src", type=Path)
|
||||
ap.add_argument("dest", type=Path)
|
||||
ap.add_argument("--sort", default="size", choices=["name", "recent", "played", "size", "status"])
|
||||
ap.add_argument("--status", default="", help="keep only games with these recipe statuses, e.g. works,issues")
|
||||
args = ap.parse_args()
|
||||
lib = json.loads((args.src / "library.json").read_text())
|
||||
games = {pkg: scrub_game(g) for pkg, g in lib.get("games", {}).items()}
|
||||
keep = {x for x in args.status.split(",") if x}
|
||||
games = {pkg: scrub_game(g) for pkg, g in lib.get("games", {}).items()
|
||||
if not keep or (g.get("recipe") or {}).get("status", "unknown") in keep}
|
||||
view = {**(lib.get("settings", {}).get("ui.library") or {}), "sort": args.sort, "platform": "all",
|
||||
"where": "all", "status": "all", "tags": []}
|
||||
out = {"games": games, "settings": {"ui.library": view, "migrations": lib.get("settings", {}).get("migrations", [])}}
|
||||
migrations = lib.get("settings", {}).get("migrations", [])
|
||||
out = {"games": games, "settings": {"ui.library": view, "migrations": migrations}}
|
||||
text = json.dumps(out, indent=1)
|
||||
leftovers = [o for o in re.findall(r'"((?:/|[A-Za-z]:\\\\)[^"]*)"', text) if not o.startswith(("D:/Games/",) + DEVICE)]
|
||||
leftovers = [o for o in re.findall(r'"((?:/|[A-Za-z]:\\\\)[^"]*)"', text)
|
||||
if not o.startswith(("D:/Games/",) + DEVICE)]
|
||||
if leftovers:
|
||||
print("not scrubbed:", leftovers[:10], file=sys.stderr)
|
||||
return 1
|
||||
|
||||
@@ -25,6 +25,51 @@ PORT = 8557
|
||||
ERRORS: list[str] = []
|
||||
|
||||
|
||||
class FakeFS:
|
||||
"""--fake-frame's file system for the Files tab: a temp folder with sample files, served like SFTP."""
|
||||
|
||||
def __init__(self):
|
||||
import tempfile
|
||||
|
||||
self.home = tempfile.mkdtemp(prefix="fp-fake-frame-")
|
||||
samples = {"Videos": ["Earth from orbit (360).mp4", "Mars landing (VR180).mkv", "Concert 8K 3D.mp4"],
|
||||
"Downloads": ["Mods/", "readme.txt"], "Documents": ["Saves/", "Notes.pdf"]}
|
||||
sizes = {".mp4": 2_400_000_000, ".mkv": 1_100_000_000}
|
||||
for folder, names in samples.items():
|
||||
base = os.path.join(self.home, folder)
|
||||
os.makedirs(os.path.join(base, "Trips"), exist_ok=True)
|
||||
for n in names:
|
||||
if n.endswith("/"):
|
||||
os.makedirs(os.path.join(base, n), exist_ok=True)
|
||||
else:
|
||||
with open(os.path.join(base, n), "wb") as f:
|
||||
f.truncate(sizes.get(os.path.splitext(n)[1], 48_000)) # sparse: no real disk use
|
||||
|
||||
def agent(self, command, **args):
|
||||
if command == "storage_targets":
|
||||
return {"targets": [{"id": n.lower(), "path": os.path.join(self.home, n), "android": a, "shared": True}
|
||||
for n, a in (("Videos", "/sdcard/Movies"), ("Downloads", "/sdcard/Download"),
|
||||
("Documents", "/sdcard/Documents"))]}
|
||||
raise RuntimeError(f"fake Frame: {command} not available")
|
||||
|
||||
@property
|
||||
def sftp(self):
|
||||
import paramiko
|
||||
|
||||
class SFTP:
|
||||
def listdir_attr(self, path):
|
||||
out = []
|
||||
for name in sorted(os.listdir(path)):
|
||||
a = paramiko.SFTPAttributes.from_stat(os.lstat(os.path.join(path, name)))
|
||||
a.filename = name
|
||||
out.append(a)
|
||||
return out
|
||||
|
||||
def stat(self, path):
|
||||
return paramiko.SFTPAttributes.from_stat(os.stat(path))
|
||||
return SFTP()
|
||||
|
||||
|
||||
class FakeTarget:
|
||||
"""--fake-frame: a pretend Steam Frame with the library's working Quest builds installed (no network, no device),
|
||||
for documentation screenshots."""
|
||||
@@ -33,6 +78,7 @@ class FakeTarget:
|
||||
from frameport.frame.connection import parse_target
|
||||
|
||||
self.label = "steamframe"
|
||||
self.frame = FakeFS()
|
||||
self.target = parse_target("steamos@steamframe.local")
|
||||
works = [g for g in library.games() if g.get("kind") != "rift" and (g.get("build") or {}).get("sha256")
|
||||
and (g.get("recipe") or {}).get("status") in ("works", "issues")]
|
||||
@@ -54,6 +100,38 @@ class FakeTarget:
|
||||
pass
|
||||
|
||||
|
||||
class FakeKeyboardSession:
|
||||
"""--fake-frame: Type on Frame connects at once (nothing is sent anywhere)."""
|
||||
|
||||
def __init__(self, frame):
|
||||
self.closed = False
|
||||
|
||||
def key(self, name, action="down"):
|
||||
return True
|
||||
|
||||
def text(self, text):
|
||||
return ""
|
||||
|
||||
def close(self):
|
||||
self.closed = True
|
||||
|
||||
|
||||
def open_type_dialog(app: FramePortApp) -> None:
|
||||
"""Type on Frame over the Steam Frame page, with one key 'pressed' so the screenshot shows it working."""
|
||||
from types import SimpleNamespace
|
||||
|
||||
app.navigate(1)
|
||||
time.sleep(1.5)
|
||||
app.type_on_frame()
|
||||
time.sleep(1.5)
|
||||
dialog = [d for d in app.page._dialogs.controls if d.open][-1]
|
||||
listener = dialog.content.controls[1]
|
||||
listener.on_key_down(SimpleNamespace(key="Enter"))
|
||||
|
||||
|
||||
STEP_SECONDS = 4 # per screen (the screenshot is taken ~3 s in)
|
||||
|
||||
|
||||
def driver(app: FramePortApp, steps: list[tuple[str, callable]], ready: threading.Event, done_step: list):
|
||||
for name, action in steps:
|
||||
try:
|
||||
@@ -62,7 +140,7 @@ def driver(app: FramePortApp, steps: list[tuple[str, callable]], ready: threadin
|
||||
ERRORS.append(f"{name}: {traceback.format_exc()}")
|
||||
done_step.append(name)
|
||||
ready.set()
|
||||
time.sleep(4)
|
||||
time.sleep(STEP_SECONDS)
|
||||
|
||||
|
||||
def main() -> int:
|
||||
@@ -75,15 +153,23 @@ def main() -> int:
|
||||
ap.add_argument("--viewport", default="1280x820", help="browser size, e.g. 2560x1440")
|
||||
ap.add_argument("--update", action="store_true", help="pretend a new FramePort release exists (update UI)")
|
||||
ap.add_argument("--fake-frame", action="store_true", help="pretend a Steam Frame is connected (no device needed)")
|
||||
ap.add_argument("--hover", default=None, help="x,y: move the mouse there before the Library screenshot")
|
||||
ap.add_argument("--install-questions", nargs="+", metavar="PKG", default=None,
|
||||
help="open the install questions for these games, then click each dialog's main button twice "
|
||||
"(a double click must not duplicate dialogs); nothing is installed")
|
||||
ap.add_argument("--docs", action="store_true", help="only the screens used in the docs (Library, --game, Frame)")
|
||||
args = ap.parse_args()
|
||||
global STEP_SECONDS
|
||||
if args.hover:
|
||||
STEP_SECONDS = 7
|
||||
from frameport.ui import theme
|
||||
|
||||
theme.set_scale(args.scale)
|
||||
vw, vh = (int(x) for x in args.viewport.split("x"))
|
||||
args.out.mkdir(parents=True, exist_ok=True)
|
||||
game = args.game or (library.games()[0]["package"] if library.games() else None)
|
||||
steps = [("library", lambda a: a.navigate(0)), ("frame", lambda a: a.navigate(1)), ("tools", lambda a: a.navigate(2))]
|
||||
steps = [("library", lambda a: a.navigate(0)), ("frame", lambda a: a.navigate(1)),
|
||||
("files", lambda a: a.go("files")), ("tools", lambda a: a.go("settings"))]
|
||||
if game:
|
||||
steps.insert(1, ("game", lambda a: a.open_game(game)))
|
||||
steps.insert(2, ("game-customize", lambda a: a.open_game(game, advanced=True)))
|
||||
@@ -95,8 +181,31 @@ def main() -> int:
|
||||
if args.docs:
|
||||
steps = [("library", lambda a: a.navigate(0))]
|
||||
if game:
|
||||
steps += [("game", lambda a: a.open_game(game)), ("game-customize", lambda a: a.open_game(game, advanced=True))]
|
||||
steps += [("game", lambda a: a.open_game(game)),
|
||||
("game-customize", lambda a: a.open_game(game, advanced=True))]
|
||||
steps.append(("frame", lambda a: a.navigate(1)))
|
||||
steps.append(("files", lambda a: a.go("files")))
|
||||
steps.append(("files-select", lambda a: [a.files_view._toggle(e.path, True)
|
||||
for e in a.files_view.entries[1:3]]))
|
||||
steps.append(("type-on-frame", open_type_dialog))
|
||||
if args.install_questions:
|
||||
queued: list[str] = []
|
||||
|
||||
def open_questions(a):
|
||||
a._submit_install = lambda p, to: queued.append(p)
|
||||
a.install_many(args.install_questions, "frame")
|
||||
|
||||
def double_click(a):
|
||||
dialogs = [d for d in a.page._dialogs.controls if d.open]
|
||||
print(f"open dialogs: {len(dialogs)}", flush=True)
|
||||
button = dialogs[-1].actions[-1]
|
||||
button.on_click(None)
|
||||
button.on_click(None)
|
||||
|
||||
def report(a):
|
||||
print(f"open dialogs: {len([d for d in a.page._dialogs.controls if d.open])}, queued: {queued}", flush=True)
|
||||
steps = [("library", lambda a: a.navigate(0)), ("questions", open_questions),
|
||||
("after-1st-double", double_click), ("after-2nd-double", double_click), ("end", report)]
|
||||
if args.update:
|
||||
from frameport import updates
|
||||
|
||||
@@ -105,7 +214,7 @@ def main() -> int:
|
||||
notes="## What's new\n- Self-update test release\n- **Bold** and `code` in notes")
|
||||
steps += [("update-banner", lambda a: (a.updater._set(fake), a.navigate(0))),
|
||||
("update-dialog", lambda a: a.updater.show_dialog()),
|
||||
("update-settings", lambda a: (a.page.pop_dialog(), a.navigate(2)))]
|
||||
("update-settings", lambda a: (a.page.pop_dialog(), a.go("settings")))]
|
||||
if args.frame:
|
||||
from frameport.frame.connection import parse_target
|
||||
|
||||
@@ -130,6 +239,13 @@ def main() -> int:
|
||||
steps.append(("launch-test-job", job))
|
||||
ready, done = threading.Event(), []
|
||||
|
||||
if args.fake_frame: # never reach a real Frame (start-up auto-connect, discovery, the 30 s poll)
|
||||
from frameport.frame import keyboard
|
||||
|
||||
keyboard.KeyboardSession = FakeKeyboardSession
|
||||
FramePortApp.connect = lambda self, *a, **k: None
|
||||
FramePortApp.refresh_frame = lambda self, *a, **k: None
|
||||
|
||||
def app_main(page: ft.Page):
|
||||
try:
|
||||
app = FramePortApp(page)
|
||||
@@ -155,8 +271,13 @@ def main() -> int:
|
||||
while len(done) < len(steps) and time.time() < deadline:
|
||||
if ready.wait(1):
|
||||
ready.clear()
|
||||
name = done[-1]
|
||||
time.sleep(3) # let Flutter paint
|
||||
page.screenshot(path=str(args.out / f"{shot:02d}-{done[-1]}.png"))
|
||||
if args.hover and name == "library":
|
||||
hx, hy = (float(v) for v in args.hover.split(","))
|
||||
page.mouse.move(hx, hy)
|
||||
time.sleep(1.5)
|
||||
page.screenshot(path=str(args.out / f"{shot:02d}-{name}.png"))
|
||||
shot += 1
|
||||
browser.close()
|
||||
except Exception: # noqa: BLE001
|
||||
|
||||
@@ -44,7 +44,8 @@ def main() -> int:
|
||||
nested = sub / "new-version.txt" # files in existing subfolders must be replaced too (Windows merges folders)
|
||||
nested.write_text("new")
|
||||
if platform == "win32" and os.environ.get("HAS_CERT") == "true":
|
||||
a, b = updates._signer_thumbprint(installed / "FramePort.exe"), updates._signer_thumbprint(new / "FramePort.exe")
|
||||
a = updates._signer_thumbprint(installed / "FramePort.exe")
|
||||
b = updates._signer_thumbprint(new / "FramePort.exe")
|
||||
print(f"signer thumbprints: installed {a} new {b}")
|
||||
assert a and a == b, "signature check failed"
|
||||
# the same launch as the app (detached; apply() checks the script started), then wait for it to finish
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
# The FramePort version: the single source (pyproject reads it via hatch; CI checks a release tag matches it).
|
||||
__version__ = "0.3.3"
|
||||
__version__ = "0.7.0"
|
||||
@@ -13,6 +13,7 @@ from . import elf
|
||||
logging.getLogger("pyaxmlparser").setLevel(logging.ERROR)
|
||||
|
||||
UNITY_GGM = "assets/bin/Data/globalgamemanagers"
|
||||
IL2CPP_METADATA = "assets/bin/Data/Managed/Metadata/global-metadata.dat"
|
||||
|
||||
|
||||
def _read_manifest_info(path: Path) -> tuple[str, str, str, str | None]:
|
||||
@@ -56,6 +57,29 @@ def _features(manifest: bytes) -> dict[str, bool]:
|
||||
return out
|
||||
|
||||
|
||||
def vr_kind(libs: set[str], manifest_strings: list[str]) -> str:
|
||||
"""What kind of Android app this is, for choosing how to port it:
|
||||
quest Meta Quest app (VrApi / OVRPlugin / Meta's OpenXR loader + Oculus manifest entries): OVRPort
|
||||
openxr another headset's OpenXR app (Pico, Khronos loader): OVRPort's loader + the Frame adapter
|
||||
android_xr Android XR (Jetpack XR / spatial) app: needs system services Lepton doesn't have
|
||||
pico_sdk Pico's pre-OpenXR SDK, wave: HTC Vive Wave SDK: no OpenXR path, can't run
|
||||
none an ordinary (2D) Android app or game: installed without the VR translation"""
|
||||
text = " ".join(manifest_strings)
|
||||
meta = (libs & {"libvrapi.so", "libOVRPlugin.so", "libovrplatformloader.so"}
|
||||
or "com.oculus." in text or "oculus.software." in text or "horizonos." in text)
|
||||
if meta:
|
||||
return "quest"
|
||||
if any(lib.startswith("libwvr") for lib in libs) or "com.htc.vr" in text:
|
||||
return "wave"
|
||||
if "libopenxr_loader.so" in libs or "org.khronos.openxr" in text:
|
||||
return "openxr"
|
||||
if libs & {"libPvr_UnitySDK.so", "libpxr_api.so", "libPxr_api.so", "libPvrSDK.so"} or "pvr.app.type" in text:
|
||||
return "pico_sdk"
|
||||
if "android.software.xr" in text or "androidx.xr" in text or "com.google.android.xr" in text:
|
||||
return "android_xr"
|
||||
return "none"
|
||||
|
||||
|
||||
# OpenXR composition-layer extensions the Frame runtime lacks (see docs/FRAME_RUNTIME.md).
|
||||
LAYER_EXTENSIONS = ("XR_KHR_composition_layer_cylinder", "XR_KHR_composition_layer_equirect",
|
||||
"XR_KHR_composition_layer_equirect2", "XR_KHR_composition_layer_cube")
|
||||
@@ -69,6 +93,9 @@ def analyze(path: Path, deep: bool = True, data_bytes: int | None = None) -> Ana
|
||||
abi = next((a for a in ("arm64-v8a", "armeabi-v7a") if a in abis), None)
|
||||
prefix = f"lib/{abi}/" if abi else None
|
||||
libs = sorted(n[len(prefix):] for n in names if prefix and n.startswith(prefix) and n.endswith(".so"))
|
||||
# SDL's Java side (SDL2 / LÖVE apps): crashes in Lepton without a clipboard service (frame.sdl_clipboard)
|
||||
sdl_java = any(b"Lorg/libsdl/app/SDLClipboardHandler;" in z.read(n) for n in names
|
||||
if n.startswith("classes") and n.endswith(".dex"))
|
||||
manifest = z.read("AndroidManifest.xml")
|
||||
lib_bytes = {}
|
||||
if deep and prefix:
|
||||
@@ -80,8 +107,10 @@ def analyze(path: Path, deep: bool = True, data_bytes: int | None = None) -> Ana
|
||||
lib_bytes[lib] = z.read(info)
|
||||
engine_lib = next((prefix + n for n in ("libUE4.so", "libUnreal.so") if prefix and prefix + n in names), None)
|
||||
unreal_version = _unreal_version(z, engine_lib) if deep and engine_lib else None
|
||||
boot = z.read("assets/bin/Data/boot.config").decode("utf-8", "replace") if "assets/bin/Data/boot.config" in names else ""
|
||||
boot = (z.read("assets/bin/Data/boot.config").decode("utf-8", "replace")
|
||||
if "assets/bin/Data/boot.config" in names else "")
|
||||
ggm = z.read(UNITY_GGM) if deep and UNITY_GGM in names else None
|
||||
il2cpp_meta = z.read(IL2CPP_METADATA) if deep and IL2CPP_METADATA in names and "libil2cpp.so" in libs else None
|
||||
|
||||
package, version, label, activity = _read_manifest_info(path)
|
||||
libset = set(libs)
|
||||
@@ -113,7 +142,8 @@ def analyze(path: Path, deep: bool = True, data_bytes: int | None = None) -> Ana
|
||||
oculus_os_refs.append(name)
|
||||
if name != "libOVRPlugin.so": # OVRPlugin lists every layer extension; only the game's own requests count
|
||||
layer_exts |= {ext for ext in LAYER_EXTENSIONS if ext.encode() + b"\0" in data}
|
||||
if name not in ("libvrapi.so", "libOVRPlugin.so") and b"GLAD_GL_" in data and "eglGetProcAddress" in elf.dyn_symbols(data, False):
|
||||
if (name not in ("libvrapi.so", "libOVRPlugin.so") and b"GLAD_GL_" in data
|
||||
and "eglGetProcAddress" in elf.dyn_symbols(data, False)):
|
||||
uses_glad = True
|
||||
|
||||
msaa_levels = 0
|
||||
@@ -126,6 +156,7 @@ def analyze(path: Path, deep: bool = True, data_bytes: int | None = None) -> Ana
|
||||
msaa_levels = 0
|
||||
|
||||
cats = axml.categories(manifest)
|
||||
manifest_strings = axml.Axml(manifest).strings()
|
||||
features = _features(manifest)
|
||||
used_perms, _ = axml.used_and_declared_permissions(manifest)
|
||||
return Analysis(
|
||||
@@ -151,17 +182,59 @@ def analyze(path: Path, deep: bool = True, data_bytes: int | None = None) -> Ana
|
||||
"missing_ovr_symbols": sorted(missing_ovr_symbols(lib_bytes)), "size": path.stat().st_size,
|
||||
"data_bytes": data_bytes or 0,
|
||||
"features": features,
|
||||
"meta_permissions_used": sorted(p for p in used_perms if p.startswith(("com.oculus.permission.", "horizonos."))),
|
||||
"meta_permissions_used": sorted(p for p in used_perms
|
||||
if p.startswith(("com.oculus.permission.", "horizonos."))),
|
||||
# mixed-reality-only: passthrough required and no guardian (Meta's BOUNDARYLESS_APP)
|
||||
"mr_only": features.get("com.oculus.feature.PASSTHROUGH", False) and "com.oculus.feature.BOUNDARYLESS_APP" in features,
|
||||
"mr_only": (features.get("com.oculus.feature.PASSTHROUGH", False)
|
||||
and "com.oculus.feature.BOUNDARYLESS_APP" in features),
|
||||
"hand_tracking_only": features.get("oculus.software.handtracking", False),
|
||||
"unreal_version": unreal_version,
|
||||
"oculus_os_refs": sorted(oculus_os_refs),
|
||||
"xr_layer_exts": sorted(layer_exts), # composition-layer extensions the game's own libraries request
|
||||
"vr_kind": vr_kind(libset, manifest_strings),
|
||||
# the base of a split APK set (Play "app bundle" installs): the code/libraries live in split APKs
|
||||
"split_apk": bool({"isSplitRequired", "requiredSplitTypes"} & set(manifest_strings)),
|
||||
# Unity (IL2CPP) text fields: they close at once on the Frame (frame.unity_text_input)
|
||||
"text_fields": unity_text_fields(il2cpp_meta) if il2cpp_meta else [],
|
||||
# Meta's OVRManager raises MSAA at runtime (frame.unity_runtime_msaa_off); Oculus XR Plugin (multiview)
|
||||
"ovr_runtime_msaa": bool(il2cpp_meta) and b"\0useRecommendedMSAALevel\0" in il2cpp_meta,
|
||||
"sdl_java": sdl_java,
|
||||
"oculus_xr_plugin": bool(il2cpp_meta) and b"\0m_StereoRenderingModeAndroid\0" in il2cpp_meta,
|
||||
# Unity's built-in Oculus support checks for Meta's system apps before VR (frame.unity_oculus_check)
|
||||
"unity_oculus_check": b"\0com.oculus.systemactivities\0" in lib_bytes.get("libunity.so", b""),
|
||||
"unity_version": unity_version(ggm, lib_bytes.get("libunity.so")) if engine == "Unity" else None,
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
def unity_text_fields(metadata: bytes) -> list[str]:
|
||||
"""The Unity text field classes an IL2CPP game contains (names from its global-metadata.dat string table)."""
|
||||
out = []
|
||||
if b"\0TMP_InputField\0" in metadata:
|
||||
out.append("TMP_InputField")
|
||||
if b"\0InputField\0" in metadata and b"\0UnityEngine.UI\0" in metadata: # not the tail of TMP_InputField
|
||||
out.append("InputField")
|
||||
return out
|
||||
|
||||
|
||||
UNITY_VERSION = re.compile(rb"(?<![\d.])(\d{4}\.\d+\.\d+[abfpx]\d+)")
|
||||
|
||||
|
||||
def unity_version(ggm: bytes | None = None, libunity: bytes | None = None) -> str | None:
|
||||
"""Unity version (e.g. 6000.2.7f2): from the header of globalgamemanagers, else the version string libunity.so
|
||||
repeats most (games packed into data.unity3d have no loose globalgamemanagers)."""
|
||||
m = UNITY_VERSION.search(ggm[:512]) if ggm else None
|
||||
if m:
|
||||
return m.group(1).decode()
|
||||
if libunity:
|
||||
from collections import Counter
|
||||
|
||||
found = Counter(x.group(1) for x in UNITY_VERSION.finditer(libunity))
|
||||
if found:
|
||||
return found.most_common(1)[0][0].decode()
|
||||
return None
|
||||
|
||||
|
||||
def _uses_feature(manifest: bytes, feature: str) -> bool:
|
||||
x = axml.Axml(manifest)
|
||||
return any(el.name == "uses-feature" and (x.attr_str(el, "name") or "").startswith(feature) for el in x.elements())
|
||||
@@ -173,12 +246,14 @@ def missing_ovr_symbols(lib_bytes: dict[str, bytes]) -> set[str]:
|
||||
if not loader or not elf.is_elf(loader):
|
||||
return set()
|
||||
exported = set(elf.dyn_symbols(loader, True))
|
||||
linked = set(elf.needed(loader))
|
||||
for extra in ("libovrplatformcompat.so", "libovrstubs.so"):
|
||||
if extra in lib_bytes:
|
||||
if extra in lib_bytes and extra in linked: # only counts when the loader loads it (a lone file doesn't help)
|
||||
exported |= elf.dyn_symbols(lib_bytes[extra], True)
|
||||
wanted = set()
|
||||
for name, data in lib_bytes.items():
|
||||
if name.startswith(("libovrplatformloader", "libopenxr_loader", "libframe_settings", "libfrda")) or not elf.is_elf(data):
|
||||
if (name.startswith(("libovrplatformloader", "libopenxr_loader", "libframe_settings", "libfrda"))
|
||||
or not elf.is_elf(data)):
|
||||
continue
|
||||
wanted |= {s for s in elf.dyn_symbols(data, False) if s.startswith(("ovr_", "ovrMessageType_"))}
|
||||
return wanted - exported
|
||||
@@ -219,7 +219,7 @@ def add_needed(data: bytes, library: str) -> bytes:
|
||||
table[note_i] = new_load
|
||||
# PT_LOAD entries must stay sorted by vaddr (bionic); the new one has the highest vaddr.
|
||||
load_slots = [i for i, p in enumerate(table) if p["type"] == PT_LOAD]
|
||||
for i, p in zip(load_slots, sorted((table[i] for i in load_slots), key=lambda p: p["vaddr"])):
|
||||
for i, p in zip(load_slots, sorted((table[i] for i in load_slots), key=lambda p: p["vaddr"]), strict=True):
|
||||
table[i] = p
|
||||
|
||||
buf += b"\0" * (file_end - len(buf))
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
"""Find methods in an IL2CPP Unity game: Cpp2IL lists every method with its address ([Address(... Offset = "0x...")]
|
||||
in its "diffable C#" output with the attribute injector). Offset is the method's position in the libil2cpp.so FILE
|
||||
(not the virtual address: those differ, e.g. by 0x4000 in Stremio VR's library), which is what a byte patch needs.
|
||||
|
||||
Results are cached per game build (its global-metadata.dat), so a rebuild of the same game doesn't run Cpp2IL again,
|
||||
and neither does the next patch of the same build (an earlier one has already changed libil2cpp.so's bytes, never its
|
||||
layout)."""
|
||||
from __future__ import annotations
|
||||
|
||||
import hashlib
|
||||
import json
|
||||
import re
|
||||
import subprocess
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
|
||||
from ..core.cache import cache_dir
|
||||
|
||||
_ADDRESS = re.compile(r'Offset = "0x([0-9A-Fa-f]+)", Length = "0x([0-9A-Fa-f]+)"')
|
||||
|
||||
|
||||
def parse_methods(cs_text: str, names: list[str]) -> dict[str, tuple[int, int]]:
|
||||
"""{method name: (file offset, length)} for the named methods of one Cpp2IL diffable-C# class file. A name
|
||||
"field:<f>" gives the instance field's offset instead: (offset, 0)."""
|
||||
lines = cs_text.splitlines()
|
||||
found: dict[str, tuple[int, int]] = {}
|
||||
for name in [n for n in names if n.startswith("field:")]:
|
||||
m = re.search(rf"\s{re.escape(name[6:])};\s*//Field offset: 0x([0-9A-Fa-f]+)", cs_text)
|
||||
if m:
|
||||
found[name] = (int(m.group(1), 16), 0)
|
||||
names = [n for n in names if not n.startswith("field:")]
|
||||
for i, line in enumerate(lines):
|
||||
for name in names:
|
||||
if name in found or not re.search(rf"\s{re.escape(name)}\s*\(", line) or "Token" in line:
|
||||
continue
|
||||
for back in range(i - 1, max(i - 4, -1), -1):
|
||||
m = _ADDRESS.search(lines[back])
|
||||
if m:
|
||||
found[name] = (int(m.group(1), 16), int(m.group(2), 16))
|
||||
break
|
||||
return found
|
||||
|
||||
|
||||
def _last_error(output: str) -> str:
|
||||
"""The exception line of Cpp2IL's output (its stack trace isn't useful to a user)."""
|
||||
lines = [ln.strip() for ln in output.splitlines() if ln.strip()]
|
||||
msg = next((ln for ln in reversed(lines) if "Exception" in ln and not ln.startswith("at ")), None)
|
||||
return (msg or (lines[-1] if lines else "no output"))[:300]
|
||||
|
||||
|
||||
def _plain_version(version: str) -> str:
|
||||
"""6000.2.7f2 -> 6000.2.7 (what Cpp2IL's --force-unity-version takes)."""
|
||||
m = re.match(r"\d+\.\d+\.\d+", version)
|
||||
return m.group(0) if m else version
|
||||
|
||||
|
||||
def _cache_file(lib: bytes, metadata: bytes) -> Path:
|
||||
key = hashlib.sha256(metadata + len(lib).to_bytes(8, "little")).hexdigest()[:32]
|
||||
return cache_dir() / "il2cpp" / (key + ".json")
|
||||
|
||||
|
||||
def find_methods(lib: bytes, metadata: bytes, unity_version: str, wanted: dict[str, list[str]],
|
||||
cpp2il: Path | None = None, timeout: float = 900) -> dict[str, dict[str, tuple[int, int]]]:
|
||||
"""wanted: {class file (relative to Cpp2IL's DiffableCs folder, e.g. "Unity.TextMeshPro/TMPro/TMP_InputField.cs"):
|
||||
[method names]} -> {class file: {method: (file offset, length)}}; classes or methods not in the game are left
|
||||
out."""
|
||||
cache_file = _cache_file(lib, metadata)
|
||||
try:
|
||||
cached = json.loads(cache_file.read_text())
|
||||
if cached.get("error"): # Cpp2IL can't read this build (e.g. an old Unity): don't run it again per patch
|
||||
raise RuntimeError(cached["error"])
|
||||
if all(cls in cached.get("classes", {}) or cls in cached.get("missing", []) for cls in wanted):
|
||||
return {cls: {m: tuple(v) for m, v in cached["classes"][cls].items() if m in names}
|
||||
for cls, names in wanted.items() if cls in cached.get("classes", {})}
|
||||
except (OSError, ValueError, KeyError):
|
||||
pass
|
||||
if cpp2il is None:
|
||||
from ..tools import cpp2il as tool
|
||||
|
||||
cpp2il = tool.ensure()
|
||||
with tempfile.TemporaryDirectory(prefix="frameport-il2cpp-") as tmp:
|
||||
t = Path(tmp)
|
||||
(t / "libil2cpp.so").write_bytes(lib)
|
||||
(t / "global-metadata.dat").write_bytes(metadata)
|
||||
proc = subprocess.run([str(cpp2il), "--force-binary-path", str(t / "libil2cpp.so"),
|
||||
"--force-metadata-path", str(t / "global-metadata.dat"),
|
||||
"--force-unity-version", _plain_version(unity_version),
|
||||
"--use-processor", "attributeinjector", "--output-as", "diffable-cs",
|
||||
"--output-to", str(t / "out")], capture_output=True, text=True, errors="replace",
|
||||
timeout=timeout, cwd=tmp)
|
||||
root = t / "out" / "DiffableCs"
|
||||
if not root.is_dir():
|
||||
error = "Cpp2IL couldn't read this game's code: " + _last_error(proc.stdout + proc.stderr)
|
||||
cache_file.parent.mkdir(parents=True, exist_ok=True)
|
||||
cache_file.write_text(json.dumps({"unity_version": unity_version, "error": error}))
|
||||
raise RuntimeError(error)
|
||||
out, missing = {}, []
|
||||
for cls, names in wanted.items():
|
||||
f = root / cls
|
||||
if f.exists():
|
||||
out[cls] = parse_methods(f.read_text(encoding="utf-8", errors="replace"), names)
|
||||
else:
|
||||
missing.append(cls)
|
||||
cache_file.parent.mkdir(parents=True, exist_ok=True)
|
||||
cache_file.write_text(json.dumps({"unity_version": unity_version, "missing": missing,
|
||||
"classes": {c: {m: list(v) for m, v in ms.items()} for c, ms in out.items()}}))
|
||||
return out
|
||||
@@ -40,7 +40,8 @@ PLATFORM_DLLS = ("libovrplatform64_1.dll", "libovrplatform32_1.dll")
|
||||
PLATFORM_WRAPPERS = ("pnsovr.dll",)
|
||||
GRAPHICS = (("d3d12.dll", "D3D12"), ("d3d11.dll", "D3D11"), ("vulkan-1.dll", "Vulkan"), ("opengl32.dll", "OpenGL"))
|
||||
AMBIGUITY = 15 # a runner-up within this many points means "ask the user"
|
||||
# repacks start their bundled Revive through a proxy DLL next to the exe (Windows loads DLLs from the exe's folder first)
|
||||
# repacks start their bundled Revive through a proxy DLL next to the exe (Windows loads DLLs from the exe's folder
|
||||
# first)
|
||||
LOADER_DLLS = ("xinput1_3.dll", "xinput1_4.dll", "xinput9_1_0.dll", "dinput8.dll", "version.dll", "winmm.dll")
|
||||
REVIVE_DLLS = ("librevive64.dll", "librevive32.dll", "librevivexr64.dll", "librevivexr32.dll")
|
||||
|
||||
@@ -267,18 +268,22 @@ def candidates(tree: Tree) -> list[Path]:
|
||||
|
||||
|
||||
# ------------------------------------------------------------------------------------------ naming
|
||||
_TAG_WORDS = r"(?:ARMGDDN|VRP|JF|FFA|Repacks?|Shipping|GOG|CODEX|PLAZA|FitGirl|DODI|ElAmigos|Oculus|Rift|PCVR)"
|
||||
# words that describe a build rather than the game (neutral; release tags are removed by their form, not by name)
|
||||
_BUILD_WORDS = r"(?:Shipping|GOG|Oculus|Rift|PCVR|Repacks?|Release)"
|
||||
# a release tag at the end: " -TAG", " -TAG v76", " -[TAG Repacks]" (a space before the dash and none after it, so
|
||||
# subtitles like " - Episode II" and hyphenated words like "Rick-ality" stay)
|
||||
_TRAILING_TAG = r"\s-(?=[\[A-Za-z0-9])(?:\[[^\]]*\]|[A-Za-z0-9]{2,12}\b)(?:\s+v\d+)?.*$"
|
||||
|
||||
|
||||
def clean_title(name: str) -> str:
|
||||
"""'Asgards Wrath v1.6.0 -ARMGDDN' -> 'Asgards Wrath'; 'Arktika 1 (v1.0.0.7) -VRP' -> 'Arktika 1';
|
||||
"""'Asgards Wrath v1.6.0 -TAG' -> 'Asgards Wrath'; 'Arktika 1 (v1.0.0.7) -TAG' -> 'Arktika 1';
|
||||
'Vader Immortal - Episode II v2.0.2+236948 Shipping' -> 'Vader Immortal - Episode II'."""
|
||||
t = re.sub(r"\[[^\]]*\]", " ", name) # [FFA Repacks]
|
||||
t = re.sub(r"\((?:[^)]*\d[^)]*|[^)]*" + _TAG_WORDS + r"[^)]*)\)", " ", t, flags=re.I) # (v1.0.0.7)
|
||||
t = re.sub(r"\s-\s*" + _TAG_WORDS + r"\b.*$", " ", t, flags=re.I) # -ARMGDDN, -VRP v76
|
||||
t = re.sub(_TRAILING_TAG, " ", name)
|
||||
t = re.sub(r"\[[^\]]*\]", " ", t) # [TAG Repacks]
|
||||
t = re.sub(r"\((?:[^)]*\d[^)]*|[^)]*\b" + _BUILD_WORDS + r"\b[^)]*)\)", " ", t, flags=re.I) # (v1.0.0.7)
|
||||
t = re.sub(r"\bv\d[\w.+\-]*", " ", t, flags=re.I) # v1.6.0, v008, v2.0.2+236948
|
||||
t = re.sub(r"(?<![\w.])\d+(?:\.\d+){2,}[\w+\-]*", " ", t) # 4.15.20, 21.11.08.358012
|
||||
t = re.sub(r"\b" + _TAG_WORDS + r"\b", " ", t, flags=re.I)
|
||||
t = re.sub(r"\b" + _BUILD_WORDS + r"\b", " ", t, flags=re.I)
|
||||
t = re.sub(r"[_]+", " ", t)
|
||||
t = re.sub(r"\s+", " ", t).strip(" -_.")
|
||||
return t or name.strip()
|
||||
@@ -356,13 +361,6 @@ def is_ambiguous(ranked: list[dict]) -> bool:
|
||||
return len(ranked) > 1 and ranked[0]["score"] < 1000 and ranked[1]["score"] >= ranked[0]["score"] - AMBIGUITY
|
||||
|
||||
|
||||
def find_exe(folder: Path) -> Path | None:
|
||||
"""The best program to start the game (used by callers that only need one)."""
|
||||
tree = walk(folder)
|
||||
ranked = rank_exes(folder, candidates(tree), tree.manifest)
|
||||
return Path(folder) / ranked[0]["path"] if ranked else None
|
||||
|
||||
|
||||
# ------------------------------------------------------------------------------------------ analysis
|
||||
def fingerprint(folder: Path, exe_rel: str) -> str:
|
||||
p = Path(folder) / exe_rel
|
||||
@@ -432,8 +430,9 @@ def analyze(folder: Path, exe: str | None = None, tree: Tree | None = None) -> A
|
||||
platform_imports |= set(sub.imports + sub.delay_imports)
|
||||
except (PEError, OSError, struct.error):
|
||||
pass
|
||||
platform_sdk = any(n in names for n in PLATFORM_DLLS + PLATFORM_WRAPPERS) or bool(platform_imports & set(PLATFORM_DLLS)) or \
|
||||
b"ovr_PlatformInitializeWindows" in blob or b"ovr_Entitlement_GetIsViewerEntitled" in blob
|
||||
platform_sdk = (any(n in names for n in PLATFORM_DLLS + PLATFORM_WRAPPERS)
|
||||
or bool(platform_imports & set(PLATFORM_DLLS))
|
||||
or b"ovr_PlatformInitializeWindows" in blob or b"ovr_Entitlement_GetIsViewerEntitled" in blob)
|
||||
# how to start it with VR on SteamVR / the Frame (see launch_mode())
|
||||
try:
|
||||
exe_dir = {p.name.lower() for p in exe_path.parent.iterdir()}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"""Generate a tiny Android shared library whose exported functions all `return 0` (no compiler needed).
|
||||
|
||||
Used for Meta platform functions (ovr_*) that overport's platform loader lacks: without them the game fails with
|
||||
Used for Meta platform functions (ovr_*) that OVRPort's platform loader lacks: without them the game fails with
|
||||
UnsatisfiedLinkError / dlopen errors. The layout follows what bionic requires: section headers present (.dynsym,
|
||||
.dynstr, .hash, .text, .dynamic, .shstrtab), PT_LOAD segments 16 KiB aligned, PT_DYNAMIC matching the .dynamic
|
||||
section, DT_HASH, DT_SONAME and PT_GNU_STACK non-executable.
|
||||
|
||||
@@ -6,8 +6,8 @@ file stays byte-identical, which keeps diffs against known-good builds meaningfu
|
||||
from __future__ import annotations
|
||||
|
||||
import struct
|
||||
from collections.abc import Iterator
|
||||
from dataclasses import dataclass
|
||||
from typing import Iterator
|
||||
|
||||
RES_XML = 0x0003
|
||||
RES_STRING_POOL = 0x0001
|
||||
@@ -252,7 +252,8 @@ def define_meta_permissions(manifest: bytes) -> tuple[bytes, list[str]] | None:
|
||||
start = struct.pack("<HHIII", RES_XML_START_ELEMENT, 16, 56, 0, 0xFFFFFFFF)
|
||||
start += struct.pack("<IIHHHHHH", 0xFFFFFFFF, perm_el, 20, 20, 1, 0, 0, 0)
|
||||
start += struct.pack("<IIIHBBI", android_ns, name_attr, value, 8, 0, TYPE_STRING, value)
|
||||
end = struct.pack("<HHIII", RES_XML_END_ELEMENT, 16, 24, 0, 0xFFFFFFFF) + struct.pack("<II", 0xFFFFFFFF, perm_el)
|
||||
end = (struct.pack("<HHIII", RES_XML_END_ELEMENT, 16, 24, 0, 0xFFFFFFFF)
|
||||
+ struct.pack("<II", 0xFFFFFFFF, perm_el))
|
||||
chunks += start + end
|
||||
manifest_el = next(el for el in x.elements() if el.name == "manifest")
|
||||
insert_at = manifest_el.offset + manifest_el.size
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
"""Minimal in-place dex edits: find one method's bytecode and turn a call in it into no-ops (same length), then fix the
|
||||
header's SHA-1 signature and Adler-32 checksum. Nothing moves, so the rest of classes.dex stays byte-identical (no
|
||||
smali round trip)."""
|
||||
from __future__ import annotations
|
||||
|
||||
import hashlib
|
||||
import struct
|
||||
import zlib
|
||||
|
||||
INVOKE_VIRTUAL, INVOKE_VIRTUAL_RANGE = 0x6E, 0x74 # 35c / 3rc: 3 code units, method index in the second
|
||||
|
||||
|
||||
def _uleb(data: bytes, pos: int) -> tuple[int, int]:
|
||||
value = shift = 0
|
||||
while True:
|
||||
b = data[pos]
|
||||
pos += 1
|
||||
value |= (b & 0x7F) << shift
|
||||
if not b & 0x80:
|
||||
return value, pos
|
||||
shift += 7
|
||||
|
||||
|
||||
class Dex:
|
||||
def __init__(self, data: bytes):
|
||||
if data[:4] != b"dex\n":
|
||||
raise ValueError("not a dex file")
|
||||
self.data = bytearray(data)
|
||||
h = struct.unpack_from("<8I", data, 56) # string_ids size/off, type_ids, proto_ids, field_ids
|
||||
self.strings_n, self.strings_off, self.types_n, self.types_off = h[0], h[1], h[2], h[3]
|
||||
self.methods_n, self.methods_off, self.classes_n, self.classes_off = struct.unpack_from("<4I", data, 88)
|
||||
|
||||
def string(self, idx: int) -> str:
|
||||
off = struct.unpack_from("<I", self.data, self.strings_off + 4 * idx)[0]
|
||||
_n, pos = _uleb(self.data, off)
|
||||
end = self.data.index(0, pos)
|
||||
return bytes(self.data[pos:end]).decode("utf-8", "replace")
|
||||
|
||||
def type_name(self, idx: int) -> str:
|
||||
return self.string(struct.unpack_from("<I", self.data, self.types_off + 4 * idx)[0])
|
||||
|
||||
def method(self, idx: int) -> tuple[str, str]:
|
||||
cls, _proto, name = struct.unpack_from("<HHI", self.data, self.methods_off + 8 * idx)
|
||||
return self.type_name(cls), self.string(name)
|
||||
|
||||
def method_index(self, cls: str, name: str) -> list[int]:
|
||||
return [i for i in range(self.methods_n) if self.method(i) == (cls, name)]
|
||||
|
||||
def code_items(self, cls: str, name: str) -> list[int]:
|
||||
"""Offsets of the code items of the methods `name` in class `cls` (direct and virtual)."""
|
||||
out = []
|
||||
for c in range(self.classes_n):
|
||||
base = self.classes_off + 32 * c
|
||||
if self.type_name(struct.unpack_from("<I", self.data, base)[0]) != cls:
|
||||
continue
|
||||
class_data = struct.unpack_from("<I", self.data, base + 24)[0]
|
||||
if not class_data:
|
||||
continue
|
||||
pos = class_data
|
||||
sf, pos = _uleb(self.data, pos)
|
||||
inf, pos = _uleb(self.data, pos)
|
||||
dm, pos = _uleb(self.data, pos)
|
||||
vm, pos = _uleb(self.data, pos)
|
||||
for _ in range(sf + inf):
|
||||
_, pos = _uleb(self.data, pos)
|
||||
_, pos = _uleb(self.data, pos)
|
||||
for count in (dm, vm):
|
||||
idx = 0
|
||||
for _ in range(count):
|
||||
diff, pos = _uleb(self.data, pos)
|
||||
_, pos = _uleb(self.data, pos)
|
||||
code, pos = _uleb(self.data, pos)
|
||||
idx += diff
|
||||
if code and self.method(idx)[1] == name:
|
||||
out.append(code)
|
||||
return out
|
||||
|
||||
def nop_calls(self, code_off: int, targets: set[int]) -> int:
|
||||
"""Replace invoke-virtual(/range) calls of any method index in `targets` inside one code item with nops."""
|
||||
insns_n = struct.unpack_from("<I", self.data, code_off + 12)[0]
|
||||
start = code_off + 16
|
||||
units = struct.unpack_from(f"<{insns_n}H", self.data, start)
|
||||
done = 0
|
||||
for i in range(insns_n - 2):
|
||||
if units[i] & 0xFF in (INVOKE_VIRTUAL, INVOKE_VIRTUAL_RANGE) and units[i + 1] in targets:
|
||||
struct.pack_into("<3H", self.data, start + 2 * i, 0, 0, 0)
|
||||
done += 1
|
||||
return done
|
||||
|
||||
def finish(self) -> bytes:
|
||||
self.data[12:32] = hashlib.sha1(bytes(self.data[32:])).digest()
|
||||
struct.pack_into("<I", self.data, 8, zlib.adler32(bytes(self.data[12:])) & 0xFFFFFFFF)
|
||||
return bytes(self.data)
|
||||
@@ -1,6 +1,6 @@
|
||||
"""Signing (apksigner via the managed JRE) and alignment checks.
|
||||
|
||||
overport creates one keystore per package (password "password", alias "key"). The same key must sign every later
|
||||
OVRPort creates one keystore per package (password "password", alias "key"). The same key must sign every later
|
||||
build of that package, or Android refuses the update and saves are lost on reinstall.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
@@ -24,11 +24,30 @@ def _apksigner() -> str:
|
||||
return str(jar)
|
||||
|
||||
|
||||
def ensure_keystore(package: str) -> Path:
|
||||
"""The package's signing key. OVRPort creates it on its first patch; apps built without OVRPort (ordinary
|
||||
Android apps) get one made here with the same layout (password "password", alias "key")."""
|
||||
ks = overport_tool.keystore(package)
|
||||
if ks.exists():
|
||||
return ks
|
||||
java = toolchain.java_path()
|
||||
keytool = java.with_name("keytool.exe" if java and java.name.endswith(".exe") else "keytool") if java else None
|
||||
if not keytool or not keytool.exists():
|
||||
raise RuntimeError(f"no signing key for {package} and no keytool to create one (run `frameport tools install`)")
|
||||
import subprocess
|
||||
|
||||
p = subprocess.run([str(keytool), "-genkeypair", "-keystore", str(ks), "-storetype", "JKS", "-storepass", KS_PASS,
|
||||
"-keypass", KS_PASS, "-alias", KS_ALIAS, "-keyalg", "RSA", "-keysize", "2048",
|
||||
"-validity", "10000", "-dname", f"CN={package}, O=FramePort"],
|
||||
capture_output=True, text=True, timeout=120)
|
||||
if p.returncode or not ks.exists():
|
||||
raise RuntimeError("couldn't create a signing key: " + (p.stdout + p.stderr)[-500:])
|
||||
return ks
|
||||
|
||||
|
||||
def sign(unsigned: Path, final: Path, package: str) -> None:
|
||||
"""Align (4 bytes; .so to 16 KiB pages) and sign v1+v2+v3. apksigner performs the alignment itself."""
|
||||
ks = overport_tool.keystore(package)
|
||||
if not ks.exists():
|
||||
raise RuntimeError(f"no signing key for {package} at {ks} (overport creates it on first patch)")
|
||||
ks = ensure_keystore(package)
|
||||
final.unlink(missing_ok=True)
|
||||
p = toolchain.run_java([
|
||||
"-jar", _apksigner(), "sign", "--ks", str(ks), "--ks-pass", f"pass:{KS_PASS}", "--ks-key-alias", KS_ALIAS,
|
||||
@@ -55,7 +74,8 @@ def cert_digest(apk: Path) -> str | None:
|
||||
|
||||
|
||||
def alignment_problems(apk: Path) -> list[str]:
|
||||
"""Stored entries must be 4-byte aligned; stored .so files page (16 KiB) aligned (what zipalign -c -P 16 4 checks)."""
|
||||
"""Stored entries must be 4-byte aligned; stored .so files page (16 KiB) aligned (what zipalign -c -P 16 4
|
||||
checks)."""
|
||||
bad = []
|
||||
with open(apk, "rb") as f, zipfile.ZipFile(apk) as z:
|
||||
for info in z.infolist():
|
||||
|
||||
@@ -18,7 +18,8 @@ class ApkWorkspace:
|
||||
self.add: dict[str, bytes] = {}
|
||||
self.rename: dict[str, str] = {} # old name -> new name (content unchanged unless replaced)
|
||||
self.remove: set[str] = set()
|
||||
abi = next((a for a in ("arm64-v8a", "armeabi-v7a") if any(n.startswith(f"lib/{a}/") for n in self.infos)), None)
|
||||
abi = next((a for a in ("arm64-v8a", "armeabi-v7a")
|
||||
if any(n.startswith(f"lib/{a}/") for n in self.infos)), None)
|
||||
self.abi = abi
|
||||
self.libdir = f"lib/{abi}/" if abi else ""
|
||||
|
||||
@@ -89,7 +90,8 @@ class ApkWorkspace:
|
||||
if name in self.replace:
|
||||
dst.writestr(zi, self.replace[name])
|
||||
else:
|
||||
with self._zip.open(info) as fin, dst.open(zi, "w", force_zip64=info.file_size > 0x7FFFFFFF) as fout:
|
||||
with (self._zip.open(info) as fin,
|
||||
dst.open(zi, "w", force_zip64=info.file_size > 0x7FFFFFFF) as fout):
|
||||
shutil.copyfileobj(fin, fout, 1 << 22)
|
||||
for name, data in self.add.items():
|
||||
zi = zipfile.ZipInfo(name, date_time=(2020, 1, 1, 0, 0, 0))
|
||||
|
||||
@@ -61,6 +61,8 @@ def fetch_details(entry: dict, screenshots: bool = True) -> dict:
|
||||
"""Collect details for a library entry (doesn't store them; see pipeline.fetch_details)."""
|
||||
title = entry.get("title") or entry["package"]
|
||||
out: dict = {"sources": [], "fetched": time.time()}
|
||||
if ((entry.get("analysis") or {}).get("extra") or {}).get("vr_kind") == "none":
|
||||
return out # an Android app without VR isn't on a VR store; a title match would be another product
|
||||
try:
|
||||
app = oculusdb_app(entry)
|
||||
except Exception: # noqa: BLE001 - offline
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"""Store artwork for the Steam library (portrait/landscape/hero/logo/icon).
|
||||
|
||||
Fetched live from overport's image service (Meta store art by package name), cached per package. Falls back to
|
||||
Fetched live from OVRPort's image service (Meta store art by package name), cached per package. Falls back to
|
||||
the APK's launcher icon when the store has nothing (e.g. sideload-only titles).
|
||||
"""
|
||||
from __future__ import annotations
|
||||
@@ -20,7 +20,9 @@ KINDS = {
|
||||
"APP_IMG_LOGO_TRANSPARENT": "logo",
|
||||
"APP_IMG_ICON": "icon",
|
||||
}
|
||||
EXTRA_KINDS = ("square",) # OculusDB's square cover (Rift games)
|
||||
# OculusDB's square cover (Rift games); FramePort's own cover/banner (no store art)
|
||||
EXTRA_KINDS = ("square", "cover", "banner")
|
||||
PICKED = ".picked" # marker: the art in this folder was chosen by the user (Find artwork); automatic fetches skip it
|
||||
|
||||
|
||||
def artwork_dir(package: str) -> Path:
|
||||
@@ -36,12 +38,18 @@ def _ext(data: bytes) -> str:
|
||||
def fetch(package: str, apk: Path | None = None, refresh: bool = False,
|
||||
lookup: str | None = None) -> tuple[Path, str | None]:
|
||||
"""Returns (folder with <kind>.<ext> files, store display name or None). `lookup` is the package whose store art
|
||||
to use (a Rift game borrows its Quest version's art); Rift ids without one have no store art."""
|
||||
to use (a Rift game borrows its Quest version's art); Rift ids without one have no store art.
|
||||
Without `refresh` it only fills in missing kinds and never touches art the user picked (PICKED marker): a pick
|
||||
often lacks a kind (Steam has no icon, OculusDB only a square cover), and re-fetching the store art for that
|
||||
replaced the pick at the next install."""
|
||||
out = artwork_dir(package)
|
||||
if refresh:
|
||||
(out / PICKED).unlink(missing_ok=True)
|
||||
have = {p.stem for p in out.iterdir()}
|
||||
title = None
|
||||
lookup = lookup or (None if package.startswith("rift.") else package)
|
||||
if lookup and (refresh or not {"portrait", "landscape", "hero", "icon"} <= have):
|
||||
picked = (out / PICKED).exists()
|
||||
if lookup and not picked and (refresh or not {"portrait", "landscape", "hero", "icon"} <= have):
|
||||
try:
|
||||
data = cache.http_get(API.format(package=lookup), timeout=30).json()
|
||||
except Exception:
|
||||
@@ -52,6 +60,8 @@ def fetch(package: str, apk: Path | None = None, refresh: bool = False,
|
||||
kind = KINDS.get(img.get("image_type"))
|
||||
if not kind:
|
||||
continue
|
||||
if not refresh and kind in have:
|
||||
continue # keep what's there; only fill gaps
|
||||
raw = base64.b64decode(img["uri"])
|
||||
for old in out.glob(f"{kind}.*"):
|
||||
old.unlink()
|
||||
@@ -67,21 +77,43 @@ def fetch(package: str, apk: Path | None = None, refresh: bool = False,
|
||||
return out, title
|
||||
|
||||
|
||||
def apk_icon(apk: Path) -> bytes | None:
|
||||
"""Largest PNG launcher icon inside the APK (mipmap/drawable)."""
|
||||
def apk_icon(apk: Path | str | None) -> bytes | None:
|
||||
"""The app's launcher icon from the APK as PNG bytes: the icon the manifest names (pyaxmlparser), else the
|
||||
largest ic_launcher bitmap. None for vector/adaptive-only icons (no bitmap to use)."""
|
||||
if not apk or not Path(apk).is_file():
|
||||
return None
|
||||
import io
|
||||
|
||||
from PIL import Image
|
||||
|
||||
dens = ("xxxhdpi", "xxhdpi", "xhdpi", "hdpi", "mdpi")
|
||||
try:
|
||||
with zipfile.ZipFile(apk) as z:
|
||||
cands = [i for i in z.infolist() if i.filename.startswith("res/") and "ic_launcher" in i.filename
|
||||
and i.filename.endswith((".png", ".webp"))]
|
||||
if not cands:
|
||||
cands = [i for i in z.infolist() if i.filename.startswith("res/mipmap") and i.filename.endswith(".png")]
|
||||
if not cands:
|
||||
return None
|
||||
best = max(cands, key=lambda i: i.file_size)
|
||||
data = z.read(best)
|
||||
return data if data[:4] == b"\x89PNG" else None
|
||||
except (zipfile.BadZipFile, OSError):
|
||||
listed = set(z.namelist())
|
||||
names = []
|
||||
try:
|
||||
from pyaxmlparser import APK
|
||||
|
||||
named = APK(str(apk)).get_app_icon()
|
||||
if named:
|
||||
names.append(named)
|
||||
except Exception: # noqa: BLE001 - unreadable resources: fall back to the usual file names
|
||||
pass
|
||||
names += sorted((n for n in listed if n.startswith("res/") and "ic_launcher" in n
|
||||
and n.endswith((".png", ".webp")) and "foreground" not in n and "background" not in n),
|
||||
key=lambda n: next((i for i, d in enumerate(dens) if d in n), len(dens)))
|
||||
for n in names:
|
||||
if n not in listed or not n.endswith((".png", ".webp")):
|
||||
continue
|
||||
with Image.open(io.BytesIO(z.read(n))) as im:
|
||||
if im.width < 48:
|
||||
continue
|
||||
out = io.BytesIO()
|
||||
im.convert("RGBA").save(out, "PNG")
|
||||
return out.getvalue()
|
||||
except (zipfile.BadZipFile, OSError, ValueError):
|
||||
return None
|
||||
return None
|
||||
|
||||
|
||||
def files(package: str) -> list[Path]:
|
||||
|
||||
@@ -139,10 +139,18 @@ def has_art(package: str) -> bool:
|
||||
|
||||
|
||||
def fetch_rift(package: str, title: str, canonical: str | None = None, quest_package: str | None = None,
|
||||
exe: Path | None = None) -> dict:
|
||||
"""Find and store artwork for a Rift game. Returns what was found: {source, quest_package, oculus_app_id,
|
||||
canonical_name, steam_appid} (only the keys that apply)."""
|
||||
exe: Path | None = None, oculus: bool = True) -> dict:
|
||||
"""Find and store artwork for a PC VR game. Returns what was found: {source, quest_package, oculus_app_id,
|
||||
canonical_name, steam_appid} (only the keys that apply). oculus=False (no Oculus code: a SteamVR/OpenXR game):
|
||||
Steam is asked first, the Oculus store only if Steam has nothing."""
|
||||
found: dict = {}
|
||||
if not oculus:
|
||||
try:
|
||||
st = match_steam(title)
|
||||
except Exception: # noqa: BLE001 - offline
|
||||
st = None
|
||||
if st and apply_steam(package, st["id"]):
|
||||
return {"steam_appid": st["id"], "source": "steam"}
|
||||
app = None
|
||||
try:
|
||||
app = match_rift(title, canonical)
|
||||
@@ -219,9 +227,15 @@ def apply_choice(package: str, choice: dict) -> bool:
|
||||
if choice["source"] == "Steam":
|
||||
apply_steam(tmp, choice["id"])
|
||||
elif choice.get("package"):
|
||||
# the picture the picker showed (OculusDB) is the cover; the store service by package adds the logo
|
||||
# and icon. Its covers can differ from the picked picture (e.g. a "dogfooding" placeholder), so they're
|
||||
# dropped when the picked picture arrived: the Steam shapes are composed from it instead.
|
||||
picked = apply_oculusdb(tmp, choice["app"]) if choice.get("app") else False
|
||||
fetch.fetch(tmp, lookup=choice["package"], refresh=True)
|
||||
if not has_art(tmp):
|
||||
apply_oculusdb(tmp, choice["app"])
|
||||
if picked:
|
||||
for f in stage.iterdir():
|
||||
if f.stem in ("portrait", "landscape", "hero"):
|
||||
f.unlink()
|
||||
else:
|
||||
apply_oculusdb(tmp, choice["app"])
|
||||
if not has_art(tmp):
|
||||
@@ -233,6 +247,7 @@ def apply_choice(package: str, choice: dict) -> bool:
|
||||
for f in stage.iterdir():
|
||||
if f.is_file() and f.stem in ART_STEMS:
|
||||
f.replace(d / f.name)
|
||||
(d / fetch.PICKED).write_text(choice.get("source", ""), encoding="utf-8") # keep it through installs
|
||||
return True
|
||||
finally:
|
||||
shutil.rmtree(stage, ignore_errors=True)
|
||||
@@ -4,6 +4,8 @@ Steam wants: portrait 600×900 (library grid), landscape 920×430 (recent/horizo
|
||||
logo (transparent, drawn on the hero) and an icon. Store art rarely covers all of them — Rift games from OculusDB only
|
||||
have a square cover — so missing shapes are composed: the best source image, fitted and centred over a blurred,
|
||||
darkened copy of itself (or a screenshot, for the hero). Results are cached in artwork/<pkg>/steam/.
|
||||
A game without any artwork (e.g. an Android app that isn't on a VR store) gets a placeholder set: its name on a
|
||||
coloured background, with the APK's own launcher icon when it has a bitmap one.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
@@ -65,15 +67,20 @@ def _ratio_ok(src: Path, size) -> bool:
|
||||
return abs(r - target) / target < 0.18
|
||||
|
||||
|
||||
def steam_set(package: str) -> dict[str, Path]:
|
||||
"""{portrait, landscape, hero, logo?, icon?} files ready for Steam (created once per source change)."""
|
||||
def steam_set(package: str, title: str = "", apk: str | Path | None = None) -> dict[str, Path]:
|
||||
"""{portrait, landscape, hero, logo?, icon?} files ready for Steam (created once per source change). Without any
|
||||
artwork: a placeholder set showing `title` (+ the launcher icon from `apk`), or {} without a title."""
|
||||
src = _sources(package)
|
||||
if not src:
|
||||
if not src and not title:
|
||||
return {}
|
||||
title = title or package
|
||||
out_dir = fetch.artwork_dir(package) / "steam"
|
||||
out_dir.mkdir(exist_ok=True)
|
||||
key = hashlib.sha1("|".join(f"{k}:{p.stat().st_size}:{p.stat().st_mtime_ns}" for k, p in sorted(src.items()))
|
||||
.encode()).hexdigest()[:8]
|
||||
out_dir.mkdir(parents=True, exist_ok=True)
|
||||
placeholder = not (set(src) - {"icon"}) # no store art (at most the APK's icon): the name on a coloured tile
|
||||
parts = [f"{k}:{p.stat().st_size}:{p.stat().st_mtime_ns}" for k, p in sorted(src.items())]
|
||||
if placeholder:
|
||||
parts.append(f"placeholder:{PLACEHOLDER_VERSION}:{title}:{apk or ''}")
|
||||
key = hashlib.sha1("|".join(parts).encode()).hexdigest()[:8]
|
||||
stamp = out_dir / f".{key}"
|
||||
result: dict[str, Path] = {}
|
||||
if stamp.exists():
|
||||
@@ -83,6 +90,10 @@ def steam_set(package: str) -> dict[str, Path]:
|
||||
return result
|
||||
for p in out_dir.iterdir():
|
||||
p.unlink()
|
||||
if placeholder:
|
||||
result = _placeholder(out_dir, title, src.get("icon"), apk)
|
||||
stamp.write_text("")
|
||||
return result
|
||||
for kind, size in SIZES.items():
|
||||
choice = next((k for k in PREFER[kind] if k in src), None)
|
||||
if not choice:
|
||||
@@ -115,15 +126,196 @@ def steam_set(package: str) -> dict[str, Path]:
|
||||
return result
|
||||
|
||||
|
||||
PLACEHOLDER_VERSION = 2
|
||||
|
||||
|
||||
STORE_KINDS = {"portrait", "square", "landscape", "hero"}
|
||||
|
||||
|
||||
def ensure_cover(package: str) -> Path | None:
|
||||
"""A cover for FramePort's own library when a game has no store art (e.g. a 2D Android app): the same name +
|
||||
APK icon design as the Steam placeholder, saved as artwork/<pkg>/cover.jpg. None when store art exists."""
|
||||
from ..core import library
|
||||
|
||||
d = fetch.artwork_dir(package)
|
||||
if {p.stem for p in fetch.files(package)} & STORE_KINDS:
|
||||
return None
|
||||
g = library.game(package) or {}
|
||||
if not any(d.glob("icon.*")): # the icon also shows in lists (Frame page)
|
||||
icon = fetch.apk_icon(g.get("apk"))
|
||||
if icon:
|
||||
(d / "icon.png").write_bytes(icon)
|
||||
# icon-only (the card and the game page show the name anyway): a tall cover for cards, a wide banner for the page
|
||||
title = g.get("title") or package
|
||||
cover, banner = d / "cover.jpg", d / "banner.jpg"
|
||||
stamp = d / ".cover"
|
||||
key = f"{PLACEHOLDER_VERSION}:{title}:{next((p.stat().st_size for p in d.glob('icon.*')), 0)}"
|
||||
if cover.exists() and banner.exists() and stamp.exists() and stamp.read_text(encoding="utf-8") == key:
|
||||
return cover
|
||||
icon = _load_icon(next(iter(sorted(d.glob("icon.*"))), None), g.get("apk"))
|
||||
background = _background_for(title)
|
||||
# cover: icon a bit above the middle (the card's title sits at the bottom); banner: icon on the right (the game
|
||||
# page draws the title on the left)
|
||||
for path, size, side, centre in ((cover, (600, 900), 300, (0.5, 0.4)), (banner, (1600, 600), 320, (0.75, 0.5))):
|
||||
im = background(size)
|
||||
if icon is not None:
|
||||
ic = icon.resize((side, side))
|
||||
im.paste(ic, (round(size[0] * centre[0] - side / 2), round(size[1] * centre[1] - side / 2)), ic)
|
||||
im.save(path, "JPEG", quality=90, optimize=True)
|
||||
stamp.write_text(key, encoding="utf-8")
|
||||
return cover
|
||||
|
||||
|
||||
def steam_set_for(package: str) -> dict[str, Path]:
|
||||
"""steam_set() with the library entry's title and APK, so a game without artwork gets a placeholder."""
|
||||
from ..core import library
|
||||
|
||||
g = library.game(package) or {}
|
||||
return steam_set(package, title=g.get("title") or package, apk=g.get("apk"))
|
||||
|
||||
|
||||
def _apk_icon(apk: str | Path | None):
|
||||
"""The APK's launcher icon as a PIL image, or None (see fetch.apk_icon)."""
|
||||
import io
|
||||
|
||||
from PIL import Image
|
||||
|
||||
data = fetch.apk_icon(apk)
|
||||
if not data:
|
||||
return None
|
||||
with Image.open(io.BytesIO(data)) as im:
|
||||
return im.convert("RGBA")
|
||||
|
||||
|
||||
def _font(size: int):
|
||||
from PIL import ImageFont
|
||||
|
||||
try:
|
||||
return ImageFont.load_default(size=size) # Pillow's bundled scalable font (needs FreeType)
|
||||
except Exception: # noqa: BLE001
|
||||
return ImageFont.load_default()
|
||||
|
||||
|
||||
def _wrap(draw, text: str, font, width: int) -> list[str]:
|
||||
lines: list[str] = []
|
||||
for word in text.split():
|
||||
if lines and draw.textlength(f"{lines[-1]} {word}", font=font) <= width:
|
||||
lines[-1] += f" {word}"
|
||||
else:
|
||||
lines.append(word)
|
||||
return lines or [text]
|
||||
|
||||
|
||||
def _title_block(draw, text: str, box: tuple[int, int, int, int], max_size: int, fill) -> None:
|
||||
"""Draw `text` centred in box (x0, y0, x1, y1), as large as fits (wrapped, at most 3 lines)."""
|
||||
x0, y0, x1, y1 = box
|
||||
size = max_size
|
||||
while True:
|
||||
font = _font(size)
|
||||
lines = _wrap(draw, text, font, x1 - x0)
|
||||
line_h = round(size * 1.2)
|
||||
too_wide = any(draw.textlength(line, font=font) > x1 - x0 for line in lines)
|
||||
if size <= 14 or (len(lines) <= 3 and not too_wide and line_h * len(lines) <= y1 - y0):
|
||||
break
|
||||
size = round(size * 0.9)
|
||||
top = y0 + (y1 - y0 - line_h * len(lines)) // 2
|
||||
for i, line in enumerate(lines):
|
||||
w = draw.textlength(line, font=font)
|
||||
draw.text((x0 + (x1 - x0 - w) / 2, top + i * line_h), line, font=font, fill=fill)
|
||||
|
||||
|
||||
def _background_for(title: str):
|
||||
"""A vertical gradient in a colour picked from the title: background(size) -> PIL image."""
|
||||
import colorsys
|
||||
|
||||
from PIL import Image
|
||||
|
||||
hue = int(hashlib.sha1(title.encode()).hexdigest()[:4], 16) / 0xFFFF
|
||||
top = tuple(round(c * 255) for c in colorsys.hls_to_rgb(hue, 0.30, 0.45))
|
||||
bottom = tuple(round(c * 255) for c in colorsys.hls_to_rgb(hue, 0.10, 0.40))
|
||||
|
||||
def background(size):
|
||||
mask = Image.linear_gradient("L").resize(size) # 0 at the top → 255 at the bottom
|
||||
return Image.composite(Image.new("RGB", size, bottom), Image.new("RGB", size, top), mask)
|
||||
return background
|
||||
|
||||
|
||||
def _load_icon(icon_file: Path | None, apk):
|
||||
from PIL import Image
|
||||
|
||||
if icon_file:
|
||||
try:
|
||||
with Image.open(icon_file) as im:
|
||||
return im.convert("RGBA")
|
||||
except Exception: # noqa: BLE001
|
||||
pass
|
||||
return _apk_icon(apk)
|
||||
|
||||
|
||||
def _placeholder(out_dir: Path, title: str, icon_file: Path | None, apk) -> dict[str, Path]:
|
||||
"""Name-on-colour art (portrait, landscape, hero, logo, icon), the hue picked from the title."""
|
||||
from PIL import Image, ImageDraw
|
||||
|
||||
icon = _load_icon(icon_file, apk)
|
||||
background = _background_for(title)
|
||||
|
||||
result: dict[str, Path] = {}
|
||||
for kind, (w, h) in SIZES.items():
|
||||
im = background((w, h))
|
||||
draw = ImageDraw.Draw(im)
|
||||
if kind != "hero": # Steam draws the logo (the name) over the hero
|
||||
text_box = (w // 10, h // 10, w - w // 10, h - h // 10)
|
||||
if icon is not None:
|
||||
side = min(w, h) // 3
|
||||
ic = icon.resize((side, side), Image.LANCZOS)
|
||||
if kind == "portrait":
|
||||
im.paste(ic, ((w - side) // 2, h // 4 - side // 4), ic)
|
||||
text_box = (w // 10, h // 4 + side, w - w // 10, h - h // 10)
|
||||
else:
|
||||
im.paste(ic, (w // 10, (h - side) // 2), ic)
|
||||
text_box = (w // 10 + side + w // 20, h // 10, w - w // 12, h - h // 10)
|
||||
_title_block(draw, title, text_box, h // 7 if kind == "portrait" else h // 5, (255, 255, 255))
|
||||
path = out_dir / f"{kind}.jpg"
|
||||
im.save(path, "JPEG", quality=90, optimize=True)
|
||||
result[kind] = path
|
||||
logo = Image.new("RGBA", (1200, 400), (0, 0, 0, 0))
|
||||
_title_block(ImageDraw.Draw(logo), title, (20, 20, 1180, 380), 150, (255, 255, 255, 255))
|
||||
logo = logo.crop(logo.getbbox() or (0, 0, 1200, 400))
|
||||
result["logo"] = out_dir / "logo.png"
|
||||
logo.save(result["logo"], "PNG")
|
||||
ic = background((256, 256))
|
||||
if icon is not None:
|
||||
inner = icon.resize((216, 216), Image.LANCZOS)
|
||||
ic.paste(inner, (20, 20), inner)
|
||||
else:
|
||||
_title_block(ImageDraw.Draw(ic), title[:2].upper() if len(title) > 3 else title, (24, 24, 232, 232), 140,
|
||||
(255, 255, 255))
|
||||
result["icon"] = out_dir / "icon.png"
|
||||
ic.save(result["icon"], "PNG")
|
||||
return result
|
||||
|
||||
|
||||
def original_platform(entry: dict) -> str:
|
||||
return "Oculus Rift" if entry.get("kind") == "rift" else "Meta Quest"
|
||||
"""What the game was made for (a Steam tag)."""
|
||||
extra = (entry.get("analysis") or {}).get("extra") or {}
|
||||
if entry.get("kind") == "rift":
|
||||
if extra.get("flat"):
|
||||
return "Windows"
|
||||
return "Oculus Rift" if extra.get("needs_revive") else "PC VR"
|
||||
kind = extra.get("vr_kind") or "quest"
|
||||
return {"quest": "Meta Quest", "none": "Android"}.get(kind, "Android VR")
|
||||
|
||||
|
||||
def steam_tags(entry: dict, where: str = "frame") -> list[str]:
|
||||
"""Tags for the Steam shortcut (Steam can group them into collections): how it runs, the game's original platform,
|
||||
genres and the user's own tags."""
|
||||
runs = ("PC VR on Frame" if entry.get("kind") == "rift" else "Quest on Frame") if where == "frame" else \
|
||||
"Rift via Revive"
|
||||
from ..targets.pc_revive import TAG
|
||||
|
||||
kind = ((entry.get("analysis") or {}).get("extra") or {}).get("vr_kind") or "quest"
|
||||
flat = bool(((entry.get("analysis") or {}).get("extra") or {}).get("flat"))
|
||||
runs = TAG if where != "frame" else ("Windows game on Frame" if flat else "PC VR on Frame") \
|
||||
if entry.get("kind") == "rift" else \
|
||||
"Quest on Frame" if kind == "quest" else "Android on Frame"
|
||||
base = [runs, original_platform(entry)]
|
||||
genres = ((entry.get("details") or {}).get("genres") or [])[:4]
|
||||
return list(dict.fromkeys(base + genres + list(entry.get("tags") or [])))
|
||||
@@ -12,7 +12,8 @@ from pathlib import Path
|
||||
from ..core.paths import user_data_dir
|
||||
from . import fetch
|
||||
|
||||
WIDTHS = {"portrait": 400, "square": 400, "landscape": 1280, "hero": 1280, "icon": 96, "logo": 600}
|
||||
WIDTHS = {"portrait": 400, "square": 400, "cover": 400, "banner": 1280, "landscape": 1280, "hero": 1280, "icon": 96,
|
||||
"logo": 600}
|
||||
_locks: dict[str, threading.Lock] = {}
|
||||
_guard = threading.Lock()
|
||||
|
||||
@@ -62,16 +63,43 @@ def pick(package: str, kinds: tuple[str, ...]) -> Path | None:
|
||||
return next((files[k] for k in kinds if k in files), None)
|
||||
|
||||
|
||||
def url(package: str, kinds: tuple[str, ...], width: int | None = None) -> str | None:
|
||||
"""Asset URL (for ft.Image / DecorationImage src) of the first available kind, as a thumbnail."""
|
||||
def url(package: str, kinds: tuple[str, ...], width: int | None = None, wait: bool = True) -> str | None:
|
||||
"""Asset URL (for ft.Image / DecorationImage src) of the first available kind, as a thumbnail. wait=False (render
|
||||
paths): if the thumbnail doesn't exist yet it is made in the background and the original is used meanwhile."""
|
||||
src = pick(package, kinds)
|
||||
if not src:
|
||||
return None
|
||||
t = thumb(src, width or WIDTHS.get(src.stem, 600), src.stem)
|
||||
return asset_url(t)
|
||||
width = width or WIDTHS.get(src.stem, 600)
|
||||
if not wait:
|
||||
ready = ready_thumb(src, width, src.stem)
|
||||
if ready is None:
|
||||
threading.Thread(target=thumb, args=(src, width, src.stem), daemon=True).start()
|
||||
return asset_url(src)
|
||||
return asset_url(ready)
|
||||
return asset_url(thumb(src, width, src.stem))
|
||||
|
||||
|
||||
def ready_thumb(path: Path, width: int, kind: str | None = None) -> Path | None:
|
||||
"""The thumbnail if it already exists (no image work)."""
|
||||
kind = kind or path.stem
|
||||
out = path.parent / f"t_{kind}_{width}_{_digest(path)}{'.png' if kind == 'logo' else '.jpg'}"
|
||||
return out if out.exists() else None
|
||||
|
||||
|
||||
_FILE_PATHS = False
|
||||
|
||||
|
||||
def use_file_paths(on: bool = True) -> None:
|
||||
"""Images by absolute file path: a packaged app (flet build) serves relative image paths from its own bundled
|
||||
assets, not from assets_dir, so artwork by URL stayed blank there (GitHub issue 16; the reporter confirmed file
|
||||
paths work in the Windows app). Source runs and the web view (ui_smoke) keep URLs."""
|
||||
global _FILE_PATHS
|
||||
_FILE_PATHS = on
|
||||
|
||||
|
||||
def asset_url(path: Path) -> str:
|
||||
if _FILE_PATHS:
|
||||
return str(path.resolve())
|
||||
return "/" + path.relative_to(user_data_dir()).as_posix()
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""Build stage: overport → Frame fixes (apk-stage patches) → sign → static validation."""
|
||||
"""Build stage: OVRPort → Frame fixes (apk-stage patches) → sign → static validation."""
|
||||
from __future__ import annotations
|
||||
|
||||
import hashlib
|
||||
@@ -25,7 +25,7 @@ def sha256(path: Path) -> str:
|
||||
|
||||
|
||||
def overport_ids(recipe: Recipe, alt: bool = False) -> list[str]:
|
||||
"""overport defaults (overport's order) first, then extras in recipe order, then the alt-build extras."""
|
||||
"""OVRPort defaults (OVRPort's order) first, then extras in recipe order, then the alt-build extras."""
|
||||
chosen = [pid for pid in recipe.patches if base.get(pid).category == "overport"]
|
||||
order = [pid for pid, *_ in OVERPORT_PATCHES]
|
||||
defaults = [pid for pid in order if pid in chosen and base.get(pid).default_on]
|
||||
@@ -64,14 +64,28 @@ def build(source: SourceGame, analysis: Analysis, recipe: Recipe, outdir: Path,
|
||||
shutil.rmtree(work, ignore_errors=True)
|
||||
work.mkdir(parents=True)
|
||||
outdir.mkdir(parents=True, exist_ok=True)
|
||||
variants = [("primary", False)] + ([("alt", True)] if recipe.alt_patches else [])
|
||||
# an APK that is already an OVRPort/FramePort build (e.g. a copy from an earlier FramePort) isn't converted again
|
||||
# for the normal build: a second conversion replaces OVRPort's platform loader and drops what the first build
|
||||
# linked to it (Wallace & Gromit / Espire 2 then crashed with "cannot locate symbol ovr_..."). Only the Steam
|
||||
# Frame patches are applied on top. Its alternate build is the copy saved next to it, or (no copy) one more
|
||||
# OVRPort run for the alternate patches; the stand-ins patch relinks what that drops.
|
||||
converted = recipe.overport and analysis.is_overport_output
|
||||
variants = [("primary", False)] + ([("alt", True)] if recipe.alt_patches and recipe.overport else [])
|
||||
alt_copy = Path(source.apk).with_name(f"{pkg}.alt-noforcequit.apk")
|
||||
results = {}
|
||||
all_checks, applied = [], []
|
||||
try:
|
||||
for variant, alt in variants:
|
||||
reporter.stage(f"overport ({variant})")
|
||||
ids = overport_ids(recipe, alt)
|
||||
patched = overport_tool.patch(source.apk, work, f"{pkg}.{variant}.overport.apk", ids, reporter)
|
||||
input_apk = alt_copy if converted and alt and alt_copy.exists() else Path(source.apk)
|
||||
if recipe.overport and (not converted or alt and input_apk == Path(source.apk)):
|
||||
reporter.stage(f"OVRPort ({variant})")
|
||||
ids = overport_ids(recipe, alt)
|
||||
patched = overport_tool.patch(source.apk, work, f"{pkg}.{variant}.overport.apk", ids, reporter)
|
||||
else: # an ordinary Android app, or an already converted build: only the Frame patches it needs
|
||||
if recipe.overport:
|
||||
reporter.log(f"{input_apk.name} is already converted: applying only the Steam Frame patches")
|
||||
patched = work / f"{pkg}.{variant}.original.apk"
|
||||
shutil.copyfile(input_apk, patched)
|
||||
reporter.stage(f"Frame fixes ({variant})")
|
||||
unsigned = work / f"{pkg}.{variant}.unsigned.apk"
|
||||
applied, checks = apply_frame_fixes(patched, unsigned, analysis, recipe, reporter)
|
||||
@@ -81,7 +95,7 @@ def build(source: SourceGame, analysis: Analysis, recipe: Recipe, outdir: Path,
|
||||
sign.sign(unsigned, final, pkg)
|
||||
unsigned.unlink(missing_ok=True)
|
||||
reporter.stage(f"validate ({variant})")
|
||||
checks += check_apk(final, pkg)
|
||||
checks += check_apk(final, pkg, expect_adapter=recipe.overport)
|
||||
for c in checks:
|
||||
reporter.check(c["name"], c["ok"], c["detail"])
|
||||
results[variant] = final
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
"""FramePort command line. Same operations as the GUI (for automation and headless use).
|
||||
Exit codes: 0 done, 1 something failed, 2 wrong usage, 10 (`update --check`) a newer version exists.
|
||||
Errors are one line on stderr; FRAMEPORT_DEBUG=1 shows the traceback.
|
||||
|
||||
frameport tools install # portable Java + overport + apksigner
|
||||
frameport tools install # portable Java + OVRPort + apksigner
|
||||
frameport scan "<folder with game dumps>" # analyze + suggest recipes
|
||||
frameport list | show <pkg> | patches
|
||||
frameport recipe <pkg> --enable frame.nodebug --set scale=1.2
|
||||
@@ -8,8 +10,9 @@
|
||||
frameport frame discover | pair | info --frame steamos@frame.local
|
||||
frameport install <pkg> --frame steamos@frame.local [--apk-only]
|
||||
frameport test <pkg> --frame ... # headless launch + triage
|
||||
frameport frame proton [--install] # Proton on the Frame, for Oculus Rift (PC VR) games
|
||||
frameport install rift.<game> --to pc|frame # Rift games: this PC (Revive + Steam) or the Frame (Proton)
|
||||
frameport frame send <files> --dest videos # copy files to the Frame (where every game sees them)
|
||||
frameport frame proton [--install] # Proton on the Frame, for PC VR games
|
||||
frameport install rift.<game> --to pc|frame # PC VR games: this PC (Steam) or the Frame (Proton)
|
||||
frameport pc info # Windows Steam / SteamVR / Revive on this PC
|
||||
frameport parity --known-good <PATCHED dir> # rebuild everything and diff against known-good APKs
|
||||
frameport diag collect <pkg>|--all [--no-frame] # redacted diagnostics zip (attach it to a GitHub issue)
|
||||
@@ -31,10 +34,17 @@ from .core import library
|
||||
from .core.events import printing_reporter
|
||||
from .patches import base
|
||||
|
||||
app = typer.Typer(add_completion=False, no_args_is_help=True, help="Port Meta Quest games to the Steam Frame.")
|
||||
FRAME_HELP = "the Frame as user@host (default: the paired Frame)"
|
||||
ALL_HELP = "every game in the library"
|
||||
JSON_HELP = "print JSON"
|
||||
|
||||
app = typer.Typer(add_completion=False, no_args_is_help=True,
|
||||
help="Run Meta Quest, Android and PC VR games on the Steam Frame.",
|
||||
epilog="Exit codes: 0 done, 1 something failed, 2 wrong usage, 10 (update --check) a newer version "
|
||||
"exists. The GUI is frameport-gui.")
|
||||
tools_app = typer.Typer(help="Manage the portable toolchain.")
|
||||
frame_app = typer.Typer(help="Find and connect to a Steam Frame.")
|
||||
pc_app = typer.Typer(help="This PC as a target for Oculus Rift (PC VR) games via Revive.")
|
||||
pc_app = typer.Typer(help="This PC as a target for PC VR games (Steam and SteamVR; Revive for Oculus games).")
|
||||
diag_app = typer.Typer(help="Diagnostics bundles and problem reports.")
|
||||
app.add_typer(tools_app, name="tools")
|
||||
app.add_typer(frame_app, name="frame")
|
||||
@@ -126,7 +136,7 @@ def update_cmd(check: bool = typer.Option(False, "--check", help="Only say wheth
|
||||
return
|
||||
for cmd in cmds:
|
||||
typer.echo("$ " + " ".join(cmd))
|
||||
if subprocess.call(cmd):
|
||||
if subprocess.call(cmd, timeout=updates.UPGRADE_TIMEOUT, env=updates.upgrade_env()):
|
||||
typer.echo("Update failed.", err=True)
|
||||
raise typer.Exit(1)
|
||||
typer.echo(f"Updated to FramePort {up.version}.")
|
||||
@@ -157,27 +167,34 @@ def _pkgs(package: Optional[str], all_: bool) -> list[str]:
|
||||
return [g["package"] for g in library.games()]
|
||||
if not package:
|
||||
raise typer.BadParameter("give a package or --all")
|
||||
matches = [g["package"] for g in library.games() if package.lower() in (g["package"] + " " + (g.get("title") or "")).lower()]
|
||||
matches = [g["package"] for g in library.games()
|
||||
if package.lower() in (g["package"] + " " + (g.get("title") or "")).lower()]
|
||||
if package in [g["package"] for g in library.games()]:
|
||||
return [package]
|
||||
if len(matches) != 1:
|
||||
raise typer.BadParameter(f"{package!r} matches {len(matches)} games: {matches[:5]}")
|
||||
if not matches:
|
||||
raise typer.BadParameter(f"no game in the library matches {package!r} (see frameport list)")
|
||||
raise typer.BadParameter(f"{package!r} matches {len(matches)} games: {', '.join(matches[:5])}"
|
||||
+ (" …" if len(matches) > 5 else ""))
|
||||
return matches
|
||||
|
||||
|
||||
# ------------------------------------------------------------------------------------------ tools
|
||||
@tools_app.command("status")
|
||||
def tools_status(check_latest: bool = typer.Option(False, "--latest", help="also look up the newest versions")):
|
||||
"""Which tools FramePort has (Java runtime, OVRPort, apksigner, Revive)."""
|
||||
from .tools import toolchain
|
||||
|
||||
for s in toolchain.status(check_latest):
|
||||
latest = f" (latest {s.latest})" if s.latest else ""
|
||||
typer.echo(f"{s.name:10} {'installed' if s.installed else 'missing':9} {s.version or '-'}{latest} {s.path or ''}")
|
||||
state = "installed" if s.installed else "missing"
|
||||
typer.echo(f"{s.name:10} {state:9} {s.version or '-'}{latest} {s.path or ''}")
|
||||
|
||||
|
||||
@tools_app.command("install")
|
||||
def tools_install(update: bool = typer.Option(False, help="update to the newest versions"),
|
||||
revive: bool = typer.Option(False, help="also install Revive (for Oculus Rift games)")):
|
||||
revive: bool = typer.Option(False, help="also install Revive (for Oculus PC games)")):
|
||||
"""Download the tools FramePort needs into its own folder (nothing is installed system-wide)."""
|
||||
from .tools import overport as ov
|
||||
from .tools import toolchain
|
||||
|
||||
@@ -189,11 +206,11 @@ def tools_install(update: bool = typer.Option(False, help="update to the newest
|
||||
|
||||
added = op.refresh(ov.list_patches)
|
||||
if added:
|
||||
typer.echo("new overport patches: " + ", ".join(added))
|
||||
typer.echo("new OVRPort patches: " + ", ".join(added))
|
||||
|
||||
|
||||
@tools_app.command("import-keys")
|
||||
def tools_import_keys(dirs: list[Path]):
|
||||
def tools_import_keys(dirs: list[Path] = typer.Argument(..., help="folders with <package>.keystore files")):
|
||||
"""Import existing per-package signing keystores (keeps updates installable over existing installs)."""
|
||||
from .tools import overport as ov
|
||||
|
||||
@@ -202,7 +219,7 @@ def tools_import_keys(dirs: list[Path]):
|
||||
|
||||
# ------------------------------------------------------------------------------------------ library
|
||||
@app.command()
|
||||
def scan(path: Path):
|
||||
def scan(path: Path = typer.Argument(..., help="a folder with game backups (APKs or PC VR game folders), or an APK")):
|
||||
"""Find games under PATH, analyze them and suggest patches."""
|
||||
rep = printing_reporter(verbose=False)
|
||||
for g in pipeline.add_path(path, rep):
|
||||
@@ -212,6 +229,7 @@ def scan(path: Path):
|
||||
|
||||
@app.command("list")
|
||||
def list_games():
|
||||
"""The games in the library."""
|
||||
for g in library.games():
|
||||
a = g["analysis"]
|
||||
built = "built" if g.get("build", {}).get("ok") else ("build-failed" if g.get("build") else "")
|
||||
@@ -220,8 +238,9 @@ def list_games():
|
||||
|
||||
|
||||
@app.command()
|
||||
def show(package: str, as_json: bool = typer.Option(False, "--json"),
|
||||
def show(package: str, as_json: bool = typer.Option(False, "--json", help=JSON_HELP),
|
||||
all_: bool = typer.Option(False, "--all", help="also list patches that don't apply to this game")):
|
||||
"""A game's analysis and recipe (its patches, with the reason for each)."""
|
||||
[pkg] = _pkgs(package, False)
|
||||
g = library.game(pkg)
|
||||
if as_json:
|
||||
@@ -242,7 +261,8 @@ def show(package: str, as_json: bool = typer.Option(False, "--json"),
|
||||
if hidden and not all_:
|
||||
typer.echo(f" ({len(hidden)} patches hidden as not relevant for this game; --all to list them)")
|
||||
if r.get("alt_patches"):
|
||||
typer.echo(f" alternate build adds: {', '.join(r['alt_patches'])} (installed: {'alt' if r['use_alt'] else 'primary'})")
|
||||
which = "alt" if r["use_alt"] else "primary"
|
||||
typer.echo(f" alternate build adds: {', '.join(r['alt_patches'])} (installed: {which})")
|
||||
|
||||
|
||||
@app.command()
|
||||
@@ -254,11 +274,13 @@ def patches():
|
||||
|
||||
|
||||
@app.command()
|
||||
def recipe(package: str, enable: list[str] = typer.Option([], "--enable"), disable: list[str] = typer.Option([], "--disable"),
|
||||
def recipe(package: str, enable: list[str] = typer.Option([], "--enable", help="patch id to turn on (repeatable)"),
|
||||
disable: list[str] = typer.Option([], "--disable", help="patch id to turn off (repeatable)"),
|
||||
set_: list[str] = typer.Option([], "--set", help="adapter setting key=value"),
|
||||
use_alt: Optional[bool] = typer.Option(None, "--use-alt/--no-alt"), reset: bool = False,
|
||||
use_alt: Optional[bool] = typer.Option(None, "--use-alt/--no-alt", help="install the alternate build"),
|
||||
reset: bool = typer.Option(False, help="start again from the suggested recipe"),
|
||||
as_is: Optional[bool] = typer.Option(None, "--as-is/--patch", help="install unchanged (already patched)"),
|
||||
exe: Optional[str] = typer.Option(None, help="Rift games: the program that starts the game (relative)")):
|
||||
exe: Optional[str] = typer.Option(None, help="PC VR games: the program that starts the game (relative)")):
|
||||
"""Change a game's patch selection."""
|
||||
[pkg] = _pkgs(package, False)
|
||||
r = pipeline.reset_recipe(pkg) if reset else library.recipe_from_dict(library.game(pkg)["recipe"])
|
||||
@@ -287,8 +309,9 @@ def recipe(package: str, enable: list[str] = typer.Option([], "--enable"), disab
|
||||
|
||||
# ------------------------------------------------------------------------------------------ build / install / test
|
||||
@app.command()
|
||||
def build(package: Optional[str] = typer.Argument(None), all_: bool = typer.Option(False, "--all"),
|
||||
outdir: Optional[Path] = None, verbose: bool = False):
|
||||
def build(package: Optional[str] = typer.Argument(None), all_: bool = typer.Option(False, "--all", help=ALL_HELP),
|
||||
outdir: Optional[Path] = typer.Option(None, help="where to write the APKs (default: FramePort's data)"),
|
||||
verbose: bool = typer.Option(False, help="print every step")):
|
||||
"""Patch and sign (primary + alternate build when the recipe has one)."""
|
||||
failed = []
|
||||
for pkg in _pkgs(package, all_):
|
||||
@@ -299,19 +322,21 @@ def build(package: Optional[str] = typer.Argument(None), all_: bool = typer.Opti
|
||||
if not info["ok"]:
|
||||
failed.append(pkg)
|
||||
except Exception as exc: # noqa: BLE001
|
||||
typer.echo(f"{pkg}: FAILED {exc}")
|
||||
typer.echo(f"{pkg}: FAILED {exc}", err=True)
|
||||
failed.append(pkg)
|
||||
raise typer.Exit(1 if failed else 0)
|
||||
|
||||
|
||||
@app.command()
|
||||
def install(package: Optional[str] = typer.Argument(None), all_: bool = typer.Option(False, "--all"),
|
||||
frame: Optional[str] = typer.Option(None, help="steamos@host"), password: Optional[str] = None,
|
||||
def install(package: Optional[str] = typer.Argument(None), all_: bool = typer.Option(False, "--all", help=ALL_HELP),
|
||||
frame: Optional[str] = typer.Option(None, help=FRAME_HELP),
|
||||
password: Optional[str] = typer.Option(None, help="the Frame's password (first connection only)"),
|
||||
apk_only: bool = typer.Option(False, help="reuse game data already on the Frame"),
|
||||
no_library: bool = typer.Option(False, help="don't add to the Steam library now"),
|
||||
to: str = typer.Option("frame", help="frame, or pc (Oculus Rift games only: run on this PC via Revive)"),
|
||||
to: str = typer.Option("frame", help="frame, or pc (PC VR games only: install on this PC)"),
|
||||
apk: Optional[Path] = typer.Option(None, help="install this APK instead of the last build (one game; e.g. "
|
||||
"a test build signed with the game's key)")):
|
||||
"""Install games on the Frame (or PC VR games on this PC) and add them to the Steam library."""
|
||||
target = _target(frame, password, to)
|
||||
pkgs = _pkgs(package, all_)
|
||||
if apk and len(pkgs) != 1:
|
||||
@@ -323,15 +348,16 @@ def install(package: Optional[str] = typer.Argument(None), all_: bool = typer.Op
|
||||
|
||||
|
||||
@app.command()
|
||||
def test(package: Optional[str] = typer.Argument(None), all_: bool = typer.Option(False, "--all"),
|
||||
frame: Optional[str] = None, seconds: int = 45,
|
||||
to: str = typer.Option("frame", help="frame, or pc (Rift games installed on this PC)")):
|
||||
def test(package: Optional[str] = typer.Argument(None), all_: bool = typer.Option(False, "--all", help=ALL_HELP),
|
||||
frame: Optional[str] = typer.Option(None, help=FRAME_HELP),
|
||||
seconds: int = typer.Option(45, help="how long the game runs before it's stopped"),
|
||||
to: str = typer.Option("frame", help="frame, or pc (PC VR games installed on this PC)")):
|
||||
"""Headless launch on the Frame (or this PC) + log triage."""
|
||||
target = _target(frame, to=to)
|
||||
installed = {g["package"] for g in target.installed()}
|
||||
for pkg in _pkgs(package, all_):
|
||||
if pkg not in installed:
|
||||
typer.echo(f"{pkg}: not installed on {target.label}")
|
||||
typer.echo(f"{pkg}: not installed on {target.label}", err=True)
|
||||
continue
|
||||
s = pipeline.test_game(pkg, target, printing_reporter(False), seconds)
|
||||
typer.echo(f"{pkg}: {s['state']} ({s['verdict']}) furthest: {s['milestone']}"
|
||||
@@ -339,18 +365,21 @@ def test(package: Optional[str] = typer.Argument(None), all_: bool = typer.Optio
|
||||
|
||||
|
||||
@app.command()
|
||||
def triage(logfile: Path, package: Optional[str] = None):
|
||||
def triage(logfile: Path = typer.Argument(..., help="a launch.log"),
|
||||
package: Optional[str] = typer.Option(None, help="the game's package (keeps only its log lines)")):
|
||||
"""Classify a launch.log offline."""
|
||||
from .validate.triage import triage as run_triage
|
||||
|
||||
r = run_triage(logfile.read_text(errors="replace"), "UNKNOWN", package)
|
||||
typer.echo(f"furthest milestone: {r.milestone}; fps {r.fps}")
|
||||
for f in r.findings:
|
||||
typer.echo(f" {f.severity:7} {f.id}: {f.diagnosis}\n {f.evidence[:200]}\n suggest: {f.suggest}")
|
||||
typer.echo(f" {f.severity:7} {f.id}: {f.diagnosis}\n {f.evidence[:200]}\n"
|
||||
f" suggest: {f.suggest}")
|
||||
|
||||
|
||||
@app.command()
|
||||
def settings(package: str, values: list[str], frame: Optional[str] = None):
|
||||
def settings(package: str, values: list[str] = typer.Argument(..., help="key=value pairs"),
|
||||
frame: Optional[str] = typer.Option(None, help=FRAME_HELP)):
|
||||
"""Change FrameBridge settings of an installed game (no re-patching), e.g. scale=1.2."""
|
||||
target = _target(frame)
|
||||
kv = dict(v.split("=", 1) for v in values)
|
||||
@@ -359,7 +388,8 @@ def settings(package: str, values: list[str], frame: Optional[str] = None):
|
||||
|
||||
# ------------------------------------------------------------------------------------------ frame
|
||||
@frame_app.command("discover")
|
||||
def frame_discover(seconds: float = 4.0):
|
||||
def frame_discover(seconds: float = typer.Option(4.0, help="how long to listen")):
|
||||
"""Find Steam Frames (in Developer Mode) on the local network."""
|
||||
from .frame.discovery import browse
|
||||
|
||||
for f in browse(seconds):
|
||||
@@ -367,7 +397,7 @@ def frame_discover(seconds: float = 4.0):
|
||||
|
||||
|
||||
@frame_app.command("pair")
|
||||
def frame_pair(timeout: float = 600):
|
||||
def frame_pair(timeout: float = typer.Option(600, help="seconds to wait for the Frame")):
|
||||
"""Serve the one-line bootstrap for the Frame and wait until it reports back."""
|
||||
import time
|
||||
|
||||
@@ -375,7 +405,8 @@ def frame_pair(timeout: float = 600):
|
||||
from .frame.pairing import PairingServer
|
||||
|
||||
srv = PairingServer().start()
|
||||
typer.echo("On the Frame, open Desktop Mode → Konsole and run:\n\n " + srv.one_liner + "\n")
|
||||
typer.echo("On the Frame, open the SteamVR dashboard → Launch a program → Desktop, then System → Konsole, and "
|
||||
"run:\n\n " + srv.one_liner + "\n")
|
||||
end = time.time() + timeout
|
||||
while time.time() < end and not srv.paired:
|
||||
time.sleep(1)
|
||||
@@ -389,7 +420,8 @@ def frame_pair(timeout: float = 600):
|
||||
|
||||
|
||||
@frame_app.command("connect")
|
||||
def frame_connect(address: str, password: Optional[str] = typer.Option(None, prompt=False)):
|
||||
def frame_connect(address: str = typer.Argument(..., help="steamos@<host or IP>"),
|
||||
password: Optional[str] = typer.Option(None, prompt=False, help="the Frame's password (once)")):
|
||||
"""Connect with SSH (password once), install FramePort's key and remember the Frame."""
|
||||
from .frame.connection import Frame, parse_target, save_target
|
||||
|
||||
@@ -399,12 +431,15 @@ def frame_connect(address: str, password: Optional[str] = typer.Option(None, pro
|
||||
info = f.agent("info")
|
||||
t.name = info["hostname"]
|
||||
save_target(t)
|
||||
typer.echo(json.dumps({k: info[k] for k in ("hostname", "os", "os_version", "lepton", "steam_users", "free_bytes")}, indent=1))
|
||||
keys = ("hostname", "os", "os_version", "lepton", "steam_users", "free_bytes")
|
||||
typer.echo(json.dumps({k: info[k] for k in keys}, indent=1))
|
||||
|
||||
|
||||
@frame_app.command("cleanup")
|
||||
def frame_cleanup(frame: Optional[str] = None, keep_rollback: bool = typer.Option(False, help="keep previous-game.apk copies"),
|
||||
path: list[str] = typer.Option([], help="extra folder under the Frame's home to delete, e.g. ~/PATCHED")):
|
||||
def frame_cleanup(frame: Optional[str] = typer.Option(None, help=FRAME_HELP),
|
||||
keep_rollback: bool = typer.Option(False, help="keep previous-game.apk copies"),
|
||||
path: list[str] = typer.Option([], help="extra folder under the Frame's home to delete, "
|
||||
"e.g. ~/PATCHED")):
|
||||
"""Free space on the Frame: rollback APKs from reinstalls, leftover uploads, optional extra folders."""
|
||||
r = _target(frame).frame.agent("cleanup", rollback=not keep_rollback, paths=path)
|
||||
typer.echo(f"removed {len(r['removed'])} item(s), freed {r['freed_bytes'] / 2**30:.1f} GiB")
|
||||
@@ -412,12 +447,13 @@ def frame_cleanup(frame: Optional[str] = None, keep_rollback: bool = typer.Optio
|
||||
|
||||
@frame_app.command("send")
|
||||
def frame_send(paths: list[Path] = typer.Argument(..., help="files or folders to send"),
|
||||
to: str = typer.Option("videos", help="destination: videos, downloads, documents, app, app-files"),
|
||||
game: Optional[str] = typer.Option(None, help="package of the game, for --to app / app-files"),
|
||||
to: str = typer.Option("videos", "--dest", "--to",
|
||||
help="destination: videos, downloads, documents, app, app-files"),
|
||||
game: Optional[str] = typer.Option(None, help="package of the game, for --dest app / app-files"),
|
||||
folder: str = typer.Option("", help="sub-folder inside the destination"),
|
||||
app: Optional[str] = typer.Option(None, help="package of a player: also add the files to its own folder "
|
||||
"(e.g. 4XVR lists /sdcard/4XPlayer, not Movies)"),
|
||||
frame: Optional[str] = None):
|
||||
frame: Optional[str] = typer.Option(None, help=FRAME_HELP)):
|
||||
"""Send files to apps on the Frame. videos/downloads/documents are shared by every Quest game (they appear as
|
||||
/sdcard/Movies, /sdcard/Download, /sdcard/Documents); app/app-files are one game's own storage. Apps find the
|
||||
files by browsing folders (Android's media index doesn't work in Lepton)."""
|
||||
@@ -429,7 +465,8 @@ def frame_send(paths: list[Path] = typer.Argument(..., help="files or folders to
|
||||
|
||||
|
||||
@frame_app.command("storage")
|
||||
def frame_storage(game: Optional[str] = None, frame: Optional[str] = None):
|
||||
def frame_storage(game: Optional[str] = typer.Option(None, help="also show this game's own storage"),
|
||||
frame: Optional[str] = typer.Option(None, help=FRAME_HELP)):
|
||||
"""Where files for Lepton apps go on the Frame (and where the apps see them)."""
|
||||
from .install import files
|
||||
|
||||
@@ -438,19 +475,20 @@ def frame_storage(game: Optional[str] = None, frame: Optional[str] = None):
|
||||
|
||||
|
||||
@frame_app.command("info")
|
||||
def frame_info(frame: Optional[str] = None):
|
||||
def frame_info(frame: Optional[str] = typer.Option(None, help=FRAME_HELP)):
|
||||
"""The Frame's SteamOS build, runtimes, storage and installed games (JSON)."""
|
||||
typer.echo(json.dumps(_target(frame).describe(), indent=1, default=str))
|
||||
|
||||
|
||||
@frame_app.command("controller-models")
|
||||
def frame_controller_models(frame: Optional[str] = None,
|
||||
def frame_controller_models(frame: Optional[str] = typer.Option(None, help=FRAME_HELP),
|
||||
convert: bool = typer.Option(False, help="also convert them (cached on the Frame)")):
|
||||
"""SteamVR render models on the Frame and which ones serve as Steam Frame controller models (controller_models)."""
|
||||
typer.echo(json.dumps(_target(frame).frame.agent("controller_models", convert=convert), indent=1))
|
||||
|
||||
|
||||
@frame_app.command("proton")
|
||||
def frame_proton(frame: Optional[str] = None,
|
||||
def frame_proton(frame: Optional[str] = typer.Option(None, help=FRAME_HELP),
|
||||
install_: bool = typer.Option(False, "--install", help="install it (Steam on the Frame restarts once "
|
||||
"and downloads it; waits until done)"),
|
||||
in_headset: bool = typer.Option(False, help="with --install: only ask Steam (confirm in the headset)"),
|
||||
@@ -484,6 +522,7 @@ def frame_proton(frame: Optional[str] = None,
|
||||
# ------------------------------------------------------------------------------------------ pc (Revive)
|
||||
@pc_app.command("info")
|
||||
def pc_info():
|
||||
"""Steam, SteamVR and Revive on this PC (JSON)."""
|
||||
typer.echo(json.dumps(_target(None, to="pc").describe(), indent=1, default=str))
|
||||
|
||||
|
||||
@@ -500,8 +539,10 @@ def pc_install_revive():
|
||||
@app.command()
|
||||
def parity(known_good: Path = typer.Option(..., help="folder of known-good game folders (PATCHED layout)"),
|
||||
sources: Path = typer.Option(..., help="folder with the original game dumps"),
|
||||
outdir: Path = typer.Option(Path("parity-out")), only: list[str] = typer.Option([]),
|
||||
report: Path = typer.Option(Path("parity-report.md")), keep: bool = False):
|
||||
outdir: Path = typer.Option(Path("parity-out"), help="where the rebuilt APKs go"),
|
||||
only: list[str] = typer.Option([], help="only games whose folder contains this (repeatable)"),
|
||||
report: Path = typer.Option(Path("parity-report.md"), help="the report to write"),
|
||||
keep: bool = typer.Option(False, help="keep work files")):
|
||||
"""Rebuild every catalog game from its source dump and compare with the known-good APKs."""
|
||||
from .parity import run_parity
|
||||
|
||||
@@ -510,7 +551,7 @@ def parity(known_good: Path = typer.Option(..., help="folder of known-good game
|
||||
|
||||
|
||||
@app.command()
|
||||
def report(out: Path = typer.Option(Path("REPORT.md"))):
|
||||
def report(out: Path = typer.Option(Path("REPORT.md"), help="the file to write")):
|
||||
"""Write a status report of every catalog game (markdown)."""
|
||||
from .report import write
|
||||
|
||||
@@ -518,10 +559,13 @@ def report(out: Path = typer.Option(Path("REPORT.md"))):
|
||||
|
||||
|
||||
@app.command("parity-device")
|
||||
def parity_device(results: Path = typer.Option(Path("parity-out/parity.json")), frame: Optional[str] = None,
|
||||
def parity_device(results: Path = typer.Option(Path("parity-out/parity.json"), help="parity.json from `parity`"),
|
||||
frame: Optional[str] = typer.Option(None, help=FRAME_HELP),
|
||||
baseline: Optional[Path] = typer.Option(None, help="baseline launch.txt from before the change"),
|
||||
report: Path = typer.Option(Path("parity-device-report.md")), only: list[str] = typer.Option([]),
|
||||
seconds: int = 45, test_only: bool = typer.Option(False, help="only re-run the launch tests")):
|
||||
report: Path = typer.Option(Path("parity-device-report.md"), help="the report to write"),
|
||||
only: list[str] = typer.Option([], help="only these games (repeatable)"),
|
||||
seconds: int = typer.Option(45, help="launch test length"),
|
||||
test_only: bool = typer.Option(False, help="only re-run the launch tests")):
|
||||
"""Install the APKs rebuilt by `parity` on the Frame (APK only) and compare headless launches with a baseline."""
|
||||
from .parity import install_and_test
|
||||
|
||||
@@ -562,7 +606,7 @@ def _diag_target(no_frame: bool, frame: Optional[str], to: str):
|
||||
try:
|
||||
return _target(frame, to=to)
|
||||
except Exception as exc: # noqa: BLE001 (offline Frame: PC-side data only)
|
||||
typer.echo(f"({to} not reachable: {exc}; collecting the PC side only)")
|
||||
typer.echo(f"({to} not reachable: {exc}; collecting the PC side only)", err=True)
|
||||
return None
|
||||
|
||||
|
||||
@@ -571,12 +615,13 @@ def _open(url: str, browser: bool) -> None:
|
||||
|
||||
typer.echo(url)
|
||||
if browser and not winhost.open_url(url):
|
||||
typer.echo("(couldn't open a browser: open the link above)")
|
||||
typer.echo("(couldn't open a browser: open the link above)", err=True)
|
||||
|
||||
|
||||
@diag_app.command("collect")
|
||||
def diag_collect(package: Optional[str] = typer.Argument(None, help="a game (omit for app-wide logs only)"),
|
||||
all_: bool = typer.Option(False, "--all"), frame: Optional[str] = None,
|
||||
all_: bool = typer.Option(False, "--all", help=ALL_HELP),
|
||||
frame: Optional[str] = typer.Option(None, help=FRAME_HELP),
|
||||
no_frame: bool = typer.Option(False, "--no-frame", help="don't contact the Frame"),
|
||||
to: str = typer.Option("frame", help="where the game is installed: frame or pc"),
|
||||
out: Optional[Path] = typer.Option(None, help="folder or .zip path (default: Documents)")):
|
||||
@@ -587,7 +632,8 @@ def diag_collect(package: Optional[str] = typer.Argument(None, help="a game (omi
|
||||
|
||||
|
||||
@diag_app.command("inspect")
|
||||
def diag_inspect(bundle: Path, as_json: bool = typer.Option(False, "--json")):
|
||||
def diag_inspect(bundle: Path = typer.Argument(..., help="a diagnostics zip"),
|
||||
as_json: bool = typer.Option(False, "--json", help=JSON_HELP)):
|
||||
"""Summarize a diagnostics zip and re-triage its launch logs with this version's signatures."""
|
||||
from .diag import bundle as b
|
||||
|
||||
@@ -616,10 +662,13 @@ def diag_inspect(bundle: Path, as_json: bool = typer.Option(False, "--json")):
|
||||
|
||||
|
||||
@diag_app.command("report")
|
||||
def diag_report(package: Optional[str] = typer.Argument(None), description: str = typer.Option("", "--text"),
|
||||
frame: Optional[str] = None, no_frame: bool = typer.Option(False, "--no-frame"),
|
||||
to: str = typer.Option("frame"), out: Optional[Path] = None,
|
||||
browser: bool = typer.Option(True, "--browser/--no-browser")):
|
||||
def diag_report(package: Optional[str] = typer.Argument(None, help="the game (omit for an app problem)"),
|
||||
description: str = typer.Option("", "--message", "--text", help="what went wrong"),
|
||||
frame: Optional[str] = typer.Option(None, help=FRAME_HELP),
|
||||
no_frame: bool = typer.Option(False, "--no-frame", help="don't contact the Frame"),
|
||||
to: str = typer.Option("frame", help="where the game is installed: frame or pc"),
|
||||
out: Optional[Path] = typer.Option(None, help="folder or .zip path (default: Documents)"),
|
||||
browser: bool = typer.Option(True, "--browser/--no-browser", help="open the issue in a browser")):
|
||||
"""Collect a diagnostics zip and open a prefilled GitHub problem report (attach the zip there)."""
|
||||
from .core import winhost
|
||||
|
||||
@@ -642,7 +691,7 @@ def diag_report(package: Optional[str] = typer.Argument(None), description: str
|
||||
def share_recipe(package: str, status: str = typer.Option("works", help="works or issues"),
|
||||
notes: str = typer.Option("", help="what you checked in the headset, known issues"),
|
||||
frame: Optional[str] = typer.Option(None, help="include the Frame's SteamOS build"),
|
||||
browser: bool = typer.Option(True, "--browser/--no-browser")):
|
||||
browser: bool = typer.Option(True, "--browser/--no-browser", help="open the issue in a browser")):
|
||||
"""Submit a working configuration: saves it as a known-good recipe and opens a prefilled GitHub issue."""
|
||||
if status not in ("works", "issues"):
|
||||
raise typer.BadParameter("--status must be works or issues")
|
||||
@@ -653,9 +702,29 @@ def share_recipe(package: str, status: str = typer.Option("works", help="works o
|
||||
_open(pipeline.share_working_config(pkg, status, notes, info), browser)
|
||||
|
||||
|
||||
def main(): # pragma: no cover
|
||||
app()
|
||||
def main() -> None:
|
||||
"""Entry point: errors end in one line on stderr and exit code 1 (FRAMEPORT_DEBUG=1 shows the traceback)."""
|
||||
import os
|
||||
|
||||
try:
|
||||
app()
|
||||
except KeyboardInterrupt:
|
||||
typer.echo("Cancelled.", err=True)
|
||||
sys.exit(130)
|
||||
except Exception as exc: # noqa: BLE001
|
||||
if os.environ.get("FRAMEPORT_DEBUG"):
|
||||
raise
|
||||
typer.echo(f"Error: {_describe(exc)}", err=True)
|
||||
typer.echo("(set FRAMEPORT_DEBUG=1 to see the traceback)", err=True)
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def _describe(exc: BaseException) -> str:
|
||||
"""A readable one-line reason (shared with the GUI: frameport.errors)."""
|
||||
from .errors import explain
|
||||
|
||||
return explain(exc)
|
||||
|
||||
|
||||
if __name__ == "__main__": # pragma: no cover
|
||||
sys.exit(app())
|
||||
main()
|
||||
@@ -32,7 +32,9 @@ def app_log_path() -> Path:
|
||||
|
||||
def setup(component: str = "app") -> None:
|
||||
"""Log to <data>/logs/app.log (2 MB × 3). Safe to call more than once; also records uncaught exceptions."""
|
||||
if any(getattr(h, "_frameport", False) for h in log.handlers):
|
||||
from .paths import removed
|
||||
|
||||
if removed() or any(getattr(h, "_frameport", False) for h in log.handlers):
|
||||
return
|
||||
try:
|
||||
handler = logging.handlers.RotatingFileHandler(app_log_path(), maxBytes=2 << 20, backupCount=3,
|
||||
@@ -58,8 +60,19 @@ def _version() -> str:
|
||||
return __version__
|
||||
|
||||
|
||||
def shutdown() -> None:
|
||||
"""Close the log file (uninstall: an open file can't be deleted on Windows)."""
|
||||
for h in [h for h in log.handlers if getattr(h, "_frameport", False)]:
|
||||
log.removeHandler(h)
|
||||
h.close()
|
||||
|
||||
|
||||
def save_job_log(kind: str, package: str | None, state: str, text: str) -> Path | None:
|
||||
"""Keep a finished job's log (the GUI only holds it in memory); the last KEEP_JOB_LOGS are kept."""
|
||||
from .paths import removed
|
||||
|
||||
if removed():
|
||||
return None
|
||||
try:
|
||||
d = jobs_dir()
|
||||
name = re.sub(r"[^A-Za-z0-9._-]+", "_", f"{kind}-{package or 'app'}-{state}")[:120]
|
||||
|
||||
@@ -11,9 +11,8 @@ from pathlib import Path
|
||||
|
||||
import requests
|
||||
|
||||
from .paths import user_data_dir
|
||||
|
||||
from .. import REPO_URL, __version__
|
||||
from .paths import user_data_dir, write_atomic
|
||||
|
||||
USER_AGENT = f"FramePort/{__version__} (+{REPO_URL})"
|
||||
_session = requests.Session()
|
||||
@@ -38,7 +37,7 @@ def cached_text(name: str, url: str, max_age: float = 86400, fallback: str | Non
|
||||
if not fresh:
|
||||
try:
|
||||
text = http_get(url).text
|
||||
path.write_text(text, encoding="utf-8")
|
||||
write_atomic(path, text)
|
||||
return text
|
||||
except Exception:
|
||||
pass
|
||||
@@ -57,7 +56,8 @@ def cached_json(name: str, url: str, max_age: float = 86400, fallback=None):
|
||||
return fallback
|
||||
|
||||
|
||||
def download(url: str, dest: Path, progress=None, expected_sha256: str | None = None, expected_sha1: str | None = None) -> Path:
|
||||
def download(url: str, dest: Path, progress=None, expected_sha256: str | None = None,
|
||||
expected_sha1: str | None = None) -> Path:
|
||||
"""Stream url to dest (atomic), verifying a checksum when given."""
|
||||
import hashlib
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@ from __future__ import annotations
|
||||
|
||||
import threading
|
||||
import time
|
||||
from collections.abc import Callable
|
||||
from dataclasses import dataclass, field
|
||||
from typing import Callable
|
||||
|
||||
|
||||
@dataclass
|
||||
|
||||
@@ -4,13 +4,18 @@ from __future__ import annotations
|
||||
import json
|
||||
import threading
|
||||
import time
|
||||
from collections.abc import Callable, Iterator
|
||||
from contextlib import contextmanager
|
||||
from dataclasses import asdict
|
||||
from pathlib import Path
|
||||
|
||||
from .models import Analysis, Recipe
|
||||
from .paths import user_data_dir
|
||||
from .paths import user_data_dir, write_atomic
|
||||
|
||||
_lock = threading.Lock()
|
||||
# One lock for every read-modify-write of library.json: jobs, the poll thread and the UI all change it, and a change
|
||||
# made between another thread's load() and save() would be lost. Re-entrant so edit() can call load()/save().
|
||||
_lock = threading.RLock()
|
||||
_last_retry = 0.0 # when migrations waiting for a game folder were last retried
|
||||
|
||||
|
||||
def _path() -> Path:
|
||||
@@ -18,13 +23,52 @@ def _path() -> Path:
|
||||
|
||||
|
||||
def load() -> dict:
|
||||
try:
|
||||
data = json.loads(_path().read_text(encoding="utf-8"))
|
||||
except (OSError, ValueError):
|
||||
return {"games": {}, "settings": {}}
|
||||
if _migrate(data):
|
||||
with _lock:
|
||||
try:
|
||||
data = json.loads(_path().read_text(encoding="utf-8"))
|
||||
except (OSError, ValueError):
|
||||
return {"games": {}, "settings": {}}
|
||||
if _migrate(data) | _follow_catalog(data):
|
||||
save(data)
|
||||
return data
|
||||
|
||||
|
||||
@contextmanager
|
||||
def edit() -> Iterator[dict]:
|
||||
"""A read-modify-write of the whole library as one step: `with edit() as data: ...` (saved on exit)."""
|
||||
with _lock:
|
||||
data = load()
|
||||
yield data
|
||||
save(data)
|
||||
return data
|
||||
|
||||
|
||||
REFRESH_ON_UPDATE = True # (tests switch it off: their hand-made libraries have no version marker)
|
||||
|
||||
|
||||
def _follow_catalog(data: dict) -> bool:
|
||||
"""Recipes FramePort derived (not ones the user edited) stay current: when their catalog entry is new or changed,
|
||||
and once after every app update (new automatic fixes and suggestions in FramePort's code), the game's recipe is
|
||||
derived again; a changed recipe shows Update on Frame."""
|
||||
from .. import __version__
|
||||
from ..recommend import catalog, engine
|
||||
|
||||
settings = data.setdefault("settings", {})
|
||||
app_updated = REFRESH_ON_UPDATE and settings.get("recipes.app_version") != __version__
|
||||
changed = app_updated
|
||||
settings["recipes.app_version"] = __version__
|
||||
for pkg, g in (data.get("games") or {}).items():
|
||||
r, a = g.get("recipe"), g.get("analysis")
|
||||
if not isinstance(r, dict) or not isinstance(a, dict) or r.get("source") == "user":
|
||||
continue
|
||||
entry = catalog.lookup(pkg)
|
||||
if not app_updated and (entry is None or r.get("catalog_rev") == entry.rev()):
|
||||
continue
|
||||
try:
|
||||
g["recipe"] = recipe_to_dict(engine.suggest(analysis_from_dict(a)))
|
||||
except Exception: # noqa: BLE001 - a malformed entry keeps its recipe
|
||||
continue
|
||||
changed = True
|
||||
return changed
|
||||
|
||||
|
||||
def _migrate(data: dict) -> bool:
|
||||
@@ -60,7 +104,8 @@ def _migrate(data: dict) -> bool:
|
||||
and not extra.get("openxr_native")):
|
||||
r.setdefault("patches", {}).setdefault("pcvr.oculus_unreal", {})
|
||||
r.setdefault("reasons", {}).setdefault(
|
||||
"pcvr.oculus_unreal", "Unreal game: its Oculus plugin checks for the Oculus service before it starts VR.")
|
||||
"pcvr.oculus_unreal",
|
||||
"Unreal game: its Oculus plugin checks for the Oculus service before it starts VR.")
|
||||
done.append("oculus_unreal")
|
||||
changed = True
|
||||
if "rift_revive_correct" not in done:
|
||||
@@ -68,7 +113,7 @@ def _migrate(data: dict) -> bool:
|
||||
# VR; OpenXR/SteamVR-native and catalog games keep their own settings). The dump is never modified (as_is).
|
||||
from ..recommend import engine
|
||||
|
||||
for pkg, g in (data.get("games") or {}).items():
|
||||
for g in (data.get("games") or {}).values():
|
||||
a = g.get("analysis") or {}
|
||||
if not (isinstance(g.get("recipe"), dict) and (a.get("extra") or {}).get("kind") == "rift"):
|
||||
continue
|
||||
@@ -85,7 +130,7 @@ def _migrate(data: dict) -> bool:
|
||||
from ..analysis import rift
|
||||
from ..recommend import engine
|
||||
|
||||
for pkg, g in (data.get("games") or {}).items():
|
||||
for g in (data.get("games") or {}).values():
|
||||
a = g.get("analysis") or {}
|
||||
if not (isinstance(g.get("recipe"), dict) and (a.get("extra") or {}).get("kind") == "rift"):
|
||||
continue
|
||||
@@ -118,24 +163,25 @@ def _migrate(data: dict) -> bool:
|
||||
# Rift games get a launch mode from their files (repack with bundled Revive → run directly; SteamVR/OpenXR-
|
||||
# capable → run directly with arguments; Oculus-only → FramePort's Revive). Re-analyze (keeping the chosen
|
||||
# exe) and re-derive the recipe; a repack launched through a second Revive failed (e.g. its entitlement check).
|
||||
from ..analysis import rift
|
||||
from ..recommend import engine
|
||||
|
||||
waiting = []
|
||||
for pkg, g in (data.get("games") or {}).items():
|
||||
a = g.get("analysis") or {}
|
||||
if not (isinstance(g.get("recipe"), dict) and (a.get("extra") or {}).get("kind") == "rift"):
|
||||
continue
|
||||
gd = g.get("game_dir") or (a.get("extra") or {}).get("folder")
|
||||
try:
|
||||
if not (gd and Path(gd).is_dir()):
|
||||
continue
|
||||
an = rift.analyze(Path(gd), exe=g.get("exe") or (a.get("extra") or {}).get("exe"))
|
||||
g["analysis"] = asdict(an)
|
||||
g["recipe"] = recipe_to_dict(engine.suggest(an))
|
||||
except Exception: # noqa: BLE001
|
||||
continue
|
||||
if not _rift_launch_mode(g):
|
||||
waiting.append(pkg) # game folder not reachable now (e.g. a drive not connected): retried later
|
||||
if waiting:
|
||||
data["settings"].setdefault("migrations_waiting", {})["rift_launch_modes"] = waiting
|
||||
done.append("rift_launch_modes")
|
||||
changed = True
|
||||
global _last_retry
|
||||
waiting = (data["settings"].get("migrations_waiting") or {}).get("rift_launch_modes") or []
|
||||
if waiting and time.time() - _last_retry > 600: # games skipped because their folder wasn't there (checked
|
||||
_last_retry = time.time() # every 10 min: load() runs often, a missing drive is slow)
|
||||
still = [p for p in waiting if p in data.get("games", {}) and not _rift_launch_mode(data["games"][p])]
|
||||
if still != waiting:
|
||||
data["settings"]["migrations_waiting"]["rift_launch_modes"] = still
|
||||
changed = True
|
||||
if "quest_binary_fixes_v2" not in done:
|
||||
# Quest recipes gain the default-on binary fixes: the swapchain size guard (every overport build) and the
|
||||
# Vulkan shim (Unreal)
|
||||
@@ -156,6 +202,16 @@ def _migrate(data: dict) -> bool:
|
||||
r.setdefault("reasons", {}).setdefault(pid, s.reason)
|
||||
done.append("quest_binary_fixes_v2")
|
||||
changed = True
|
||||
if "flat_hide_navbar" not in done:
|
||||
# Android apps without VR gain the default-on "Hide Android's navigation bar" patch
|
||||
for g in (data.get("games") or {}).values():
|
||||
a, r = g.get("analysis") or {}, g.get("recipe")
|
||||
if isinstance(r, dict) and (a.get("extra") or {}).get("vr_kind") == "none":
|
||||
r.setdefault("patches", {}).setdefault("device.hide_navbar", {})
|
||||
r.setdefault("reasons", {}).setdefault(
|
||||
"device.hide_navbar", "2D app: Android's navigation buttons would cover the app's own controls.")
|
||||
done.append("flat_hide_navbar")
|
||||
changed = True
|
||||
if "rift_steamvr_tuning" not in done:
|
||||
# PC VR recipes gain automatic SteamVR performance settings (refresh rate / motion smoothing on frame drops)
|
||||
for g in (data.get("games") or {}).values():
|
||||
@@ -169,18 +225,42 @@ def _migrate(data: dict) -> bool:
|
||||
return changed
|
||||
|
||||
|
||||
def _rift_launch_mode(g: dict) -> bool:
|
||||
"""Re-analyze a Rift game (keeping the chosen exe) and re-derive its recipe. False if its folder isn't there."""
|
||||
from ..analysis import rift
|
||||
from ..recommend import engine
|
||||
|
||||
a = g.get("analysis") or {}
|
||||
gd = g.get("game_dir") or (a.get("extra") or {}).get("folder")
|
||||
if not (gd and Path(gd).is_dir()):
|
||||
return False
|
||||
try:
|
||||
an = rift.analyze(Path(gd), exe=g.get("exe") or (a.get("extra") or {}).get("exe"))
|
||||
g["analysis"] = asdict(an)
|
||||
g["recipe"] = recipe_to_dict(engine.suggest(an))
|
||||
except Exception: # noqa: BLE001 - an unreadable game keeps its recipe
|
||||
pass
|
||||
return True
|
||||
|
||||
|
||||
def save(data: dict) -> None:
|
||||
with _lock:
|
||||
tmp = _path().with_suffix(".tmp")
|
||||
tmp.write_text(json.dumps(data, indent=1, default=str), encoding="utf-8")
|
||||
tmp.replace(_path())
|
||||
write_atomic(_path(), json.dumps(data, indent=1, default=str))
|
||||
|
||||
|
||||
def upsert_game(package: str, **fields) -> dict:
|
||||
data = load()
|
||||
entry = data["games"].setdefault(package, {"package": package, "added": time.time()})
|
||||
entry.update(fields)
|
||||
save(data)
|
||||
with edit() as data:
|
||||
entry = data["games"].setdefault(package, {"package": package, "added": time.time()})
|
||||
entry.update(fields)
|
||||
return entry
|
||||
|
||||
|
||||
def update_game(package: str, fn: Callable[[dict], None]) -> dict | None:
|
||||
"""Change one game's entry in place, atomically (fn mutates the entry). None if the game isn't there."""
|
||||
with edit() as data:
|
||||
entry = data["games"].get(package)
|
||||
if entry is not None:
|
||||
fn(entry)
|
||||
return entry
|
||||
|
||||
|
||||
@@ -193,9 +273,8 @@ def games() -> list[dict]:
|
||||
|
||||
|
||||
def remove_game(package: str) -> None:
|
||||
data = load()
|
||||
data["games"].pop(package, None)
|
||||
save(data)
|
||||
with edit() as data:
|
||||
data["games"].pop(package, None)
|
||||
|
||||
|
||||
def setting(key: str, default=None):
|
||||
@@ -203,9 +282,16 @@ def setting(key: str, default=None):
|
||||
|
||||
|
||||
def set_setting(key: str, value) -> None:
|
||||
data = load()
|
||||
data.setdefault("settings", {})[key] = value
|
||||
save(data)
|
||||
with edit() as data:
|
||||
data.setdefault("settings", {})[key] = value
|
||||
|
||||
|
||||
def update_setting(key: str, fn: Callable, default=None):
|
||||
"""Set a setting from its current value, atomically: value = fn(current or default). Returns the new value."""
|
||||
with edit() as data:
|
||||
settings = data.setdefault("settings", {})
|
||||
settings[key] = value = fn(settings.get(key, default))
|
||||
return value
|
||||
|
||||
|
||||
def recipe_to_dict(r: Recipe) -> dict:
|
||||
@@ -228,5 +314,6 @@ def analysis_from_dict(d: dict) -> Analysis:
|
||||
elif f.default is not dataclasses.MISSING or f.default_factory is not dataclasses.MISSING: # type: ignore[misc]
|
||||
continue # let the dataclass default apply
|
||||
else:
|
||||
kwargs[f.name] = "" if f.type == "str" else [] if "list" in str(f.type) else 0 if f.type == "int" else False if f.type == "bool" else None
|
||||
kwargs[f.name] = ("" if f.type == "str" else [] if "list" in str(f.type) else
|
||||
0 if f.type == "int" else False if f.type == "bool" else None)
|
||||
return Analysis(**kwargs)
|
||||
@@ -53,6 +53,16 @@ class Analysis:
|
||||
def only_32bit(self) -> bool:
|
||||
return "arm64-v8a" not in self.abis and "armeabi-v7a" in self.abis
|
||||
|
||||
@property
|
||||
def no_arm64(self) -> bool:
|
||||
"""Native code, but none the Frame can run (32-bit ARM or x86 only)."""
|
||||
return bool(self.abis) and "arm64-v8a" not in self.abis
|
||||
|
||||
@property
|
||||
def vr_kind(self) -> str:
|
||||
"""See analysis.detect.vr_kind (entries analysed before it existed were all Quest games)."""
|
||||
return (self.extra or {}).get("vr_kind") or "quest"
|
||||
|
||||
def to_dict(self) -> dict:
|
||||
return asdict(self)
|
||||
|
||||
@@ -70,7 +80,9 @@ class Recipe:
|
||||
notes: str = ""
|
||||
source: str = "heuristics" # catalog | heuristics | user
|
||||
as_is: bool = False # install the game unchanged (already patched): no overport / Frame fixes / Revive
|
||||
overport: bool = True # False: an ordinary Android app: no VR translation (overport) and no FrameBridge adapter
|
||||
reasons: dict[str, str] = field(default_factory=dict) # patch id -> why it was suggested
|
||||
catalog_rev: str = "" # CatalogEntry.rev() it was derived from: a changed catalog entry re-derives the recipe
|
||||
|
||||
def enabled(self, patch_id: str) -> bool:
|
||||
return patch_id in self.patches
|
||||
|
||||
@@ -3,6 +3,7 @@ from __future__ import annotations
|
||||
|
||||
import os
|
||||
import sys
|
||||
import threading
|
||||
from pathlib import Path
|
||||
|
||||
_PKG = Path(__file__).resolve().parent.parent
|
||||
@@ -23,10 +24,27 @@ def agent_dir() -> Path:
|
||||
return DATA_ROOT / "agent"
|
||||
|
||||
|
||||
AGENT_SOURCE_COPY = "frameport_agent.py.txt" # scripts/package.py stages this next to the .py
|
||||
|
||||
|
||||
def agent_file() -> Path:
|
||||
"""The Frame agent's source (uploaded to the Frame and run there with python3). `flet build` compiles every .py
|
||||
of the app to .pyc and drops the source, bundled data included (issue #2: no connection from the release
|
||||
bundles), so bundles also carry a copy under a non-.py name."""
|
||||
path = agent_dir() / "frameport_agent.py"
|
||||
return path if path.exists() else agent_dir() / AGENT_SOURCE_COPY
|
||||
|
||||
|
||||
def bootstrap_dir() -> Path:
|
||||
return DATA_ROOT / "bootstrap"
|
||||
|
||||
|
||||
def _on_frame() -> bool:
|
||||
from ..frame.local import on_frame
|
||||
|
||||
return on_frame()
|
||||
|
||||
|
||||
def user_data_dir() -> Path:
|
||||
"""Tools, keystores, work dirs and settings. Override with FRAMEPORT_HOME."""
|
||||
if os.environ.get("FRAMEPORT_HOME"):
|
||||
@@ -36,19 +54,31 @@ def user_data_dir() -> Path:
|
||||
elif sys.platform == "darwin":
|
||||
base = Path.home() / "Library/Application Support/FramePort"
|
||||
else:
|
||||
base = Path(os.environ.get("XDG_DATA_HOME", Path.home() / ".local/share")) / "frameport"
|
||||
base.mkdir(parents=True, exist_ok=True)
|
||||
# on the Frame itself ~/.local/share/frameport is the agent's folder (and its purge removes it): the app's own
|
||||
# data (library, tools, game signing keys) lives next to it
|
||||
name = "frameport-app" if _on_frame() else "frameport"
|
||||
base = Path(os.environ.get("XDG_DATA_HOME", Path.home() / ".local/share")) / name
|
||||
if not _removed.is_set():
|
||||
base.mkdir(parents=True, exist_ok=True)
|
||||
return base
|
||||
|
||||
|
||||
_removed = threading.Event()
|
||||
|
||||
|
||||
def mark_removed() -> None:
|
||||
"""FramePort is being uninstalled: from now on nothing may (re)create files in the data folder."""
|
||||
_removed.set()
|
||||
|
||||
|
||||
def removed() -> bool:
|
||||
return _removed.is_set()
|
||||
|
||||
|
||||
def tools_dir() -> Path:
|
||||
return _sub("tools")
|
||||
|
||||
|
||||
def keystore_dir() -> Path:
|
||||
return _sub("keystores")
|
||||
|
||||
|
||||
def work_dir() -> Path:
|
||||
return _sub("work")
|
||||
|
||||
@@ -65,3 +95,13 @@ def _sub(name: str) -> Path:
|
||||
path = user_data_dir() / name
|
||||
path.mkdir(parents=True, exist_ok=True)
|
||||
return path
|
||||
|
||||
|
||||
def write_atomic(path: Path, text: str) -> None:
|
||||
"""Replace a file in one step: a reader never sees it half written, and a crash leaves the old one."""
|
||||
path = Path(path)
|
||||
if removed():
|
||||
return
|
||||
tmp = path.with_name(f".{path.name}.{os.getpid()}.{threading.get_ident()}.tmp")
|
||||
tmp.write_text(text, encoding="utf-8")
|
||||
tmp.replace(path)
|
||||
@@ -190,7 +190,7 @@ def vrsettings(root: Path, ops: list[tuple[str, str, str, str, str | None]]) ->
|
||||
for op, section, key, kind, value in ops:
|
||||
args += [op, section, key, kind] + ([value] if op == "set" else [])
|
||||
p = subprocess.run(args, capture_output=True, text=True, timeout=60, **winhost._no_window())
|
||||
return [l.strip() for l in (p.stdout or "").splitlines() if l.strip()]
|
||||
return [ln.strip() for ln in (p.stdout or "").splitlines() if ln.strip()]
|
||||
|
||||
|
||||
def apply(root: Path, app_key: str, refresh: float | None, smoothing: int | None) -> list[str]:
|
||||
|
||||
@@ -62,7 +62,10 @@ def to_windows(path: Path | str) -> str:
|
||||
m = re.match(r"^/mnt/([a-zA-Z])(/.*)?$", p)
|
||||
if m:
|
||||
return f"{m[1].upper()}:" + (m[2] or "/").replace("/", "\\")
|
||||
r = subprocess.run(["wslpath", "-w", p], capture_output=True, text=True)
|
||||
try:
|
||||
r = subprocess.run(["wslpath", "-w", p], capture_output=True, text=True, timeout=15)
|
||||
except (OSError, subprocess.SubprocessError) as exc:
|
||||
raise ValueError(f"{p} is not reachable from Windows ({exc})") from None
|
||||
if r.returncode:
|
||||
raise ValueError(f"{p} is not reachable from Windows")
|
||||
return r.stdout.strip()
|
||||
@@ -75,7 +78,12 @@ def to_local(winpath: str) -> Path:
|
||||
m = re.match(r"^([a-zA-Z]):[\\/](.*)$", winpath.strip())
|
||||
if m:
|
||||
return Path(f"/mnt/{m[1].lower()}") / m[2].replace("\\", "/")
|
||||
r = subprocess.run(["wslpath", "-u", winpath], capture_output=True, text=True)
|
||||
try:
|
||||
r = subprocess.run(["wslpath", "-u", winpath], capture_output=True, text=True, timeout=15)
|
||||
except (OSError, subprocess.SubprocessError) as exc:
|
||||
raise ValueError(f"can't map {winpath} to a local path ({exc})") from None
|
||||
if r.returncode or not r.stdout.strip(): # never Path("") (= the current folder)
|
||||
raise ValueError(f"can't map {winpath} to a local path")
|
||||
return Path(r.stdout.strip())
|
||||
|
||||
|
||||
@@ -115,7 +123,12 @@ def env_path(name: str) -> Path | None:
|
||||
except (OSError, subprocess.TimeoutExpired):
|
||||
return None
|
||||
v = r.stdout.strip().splitlines()[-1] if r.stdout.strip() else ""
|
||||
return to_local(v) if v and "%" not in v else None
|
||||
if not v or "%" in v:
|
||||
return None
|
||||
try:
|
||||
return to_local(v)
|
||||
except ValueError:
|
||||
return None
|
||||
|
||||
|
||||
# ------------------------------------------------------------------------------------------ Steam
|
||||
@@ -274,3 +287,93 @@ def oculus_platform_dir() -> Path | None:
|
||||
if (d / "LibOVRPlatform64_1.dll").is_file():
|
||||
return d
|
||||
return None
|
||||
|
||||
|
||||
# ------------------------------------------------------------------------------------------ firewall (pairing)
|
||||
WSL_VM_CREATOR = "{40E0AC32-46A5-438A-A0B2-2B479E8F2E90}" # Hyper-V firewall id of WSL's VM
|
||||
|
||||
|
||||
def powershell(command: str, timeout: float = 30) -> subprocess.CompletedProcess:
|
||||
"""Run Windows PowerShell 5.1 (from Windows or WSL). PSModulePath is dropped: inherited from PowerShell 7 it keeps
|
||||
5.1 from loading its own modules (see updates._powershell)."""
|
||||
if is_windows():
|
||||
exe = str(Path(os.environ.get("SystemRoot", r"C:\Windows")) / "System32/WindowsPowerShell/v1.0/powershell.exe")
|
||||
cwd = None
|
||||
else:
|
||||
exe = system32("WindowsPowerShell/v1.0/powershell.exe")
|
||||
cwd = "/mnt/c" if Path("/mnt/c").is_dir() else None # a \\wsl$ working dir makes Windows programs complain
|
||||
env = {k: v for k, v in os.environ.items() if k.upper() != "PSMODULEPATH"}
|
||||
return subprocess.run([exe, "-NoProfile", "-NonInteractive", "-Command", command], capture_output=True, text=True,
|
||||
errors="replace", timeout=timeout, cwd=cwd, env=env, **_no_window())
|
||||
|
||||
|
||||
def wsl_networking_mode() -> str | None:
|
||||
""""mirrored" or "nat" (WSL's default, where nothing on the network can reach WSL at all); None if unknown."""
|
||||
if not is_wsl():
|
||||
return None
|
||||
try:
|
||||
out = subprocess.run(["wslinfo", "--networking-mode"], capture_output=True, text=True, timeout=10).stdout
|
||||
if out.strip():
|
||||
return out.strip().lower()
|
||||
except (OSError, subprocess.SubprocessError):
|
||||
pass
|
||||
return None
|
||||
|
||||
|
||||
def wsl_inbound_blocked(rule: str) -> bool:
|
||||
"""WSL with mirrored networking: Windows' Hyper-V firewall blocks connections from the network to WSL by default
|
||||
(no "Allow access?" prompt as for Windows programs), so a Frame's request to our pairing server just times out.
|
||||
True when that block is on and our allow rule `rule` isn't there."""
|
||||
if not is_wsl():
|
||||
return False
|
||||
try:
|
||||
out = powershell(
|
||||
f"$s = Get-NetFirewallHyperVVMSetting -PolicyStore ActiveStore -Name '{WSL_VM_CREATOR}';"
|
||||
f"$r = Get-NetFirewallHyperVRule -PolicyStore ActiveStore -Name '{rule}' -ErrorAction SilentlyContinue;"
|
||||
"\"$($s.Enabled) $($s.DefaultInboundAction) $([bool]$r)\"").stdout.split()
|
||||
except (OSError, subprocess.SubprocessError):
|
||||
return False
|
||||
return out[:3] == ["True", "Block", "False"]
|
||||
|
||||
|
||||
def open_wsl_inbound(rule: str, title: str, ports: str, flag: Path, minutes: int = 35) -> bool:
|
||||
"""Let the network reach WSL on TCP `ports` only while `flag` exists (at most `minutes`): one admin prompt (UAC)
|
||||
starts a hidden elevated PowerShell that adds a Hyper-V firewall rule, waits, and removes the rule again (only if
|
||||
it added it). Returns True once the rule is in place."""
|
||||
import base64
|
||||
|
||||
script = f"""
|
||||
$name = '{rule}'
|
||||
$added = $false
|
||||
if (-not (Get-NetFirewallHyperVRule -PolicyStore ActiveStore -Name $name -ErrorAction SilentlyContinue)) {{
|
||||
New-NetFirewallHyperVRule -Name $name -DisplayName '{title}' -Direction Inbound -VMCreatorId '{WSL_VM_CREATOR}' `
|
||||
-Protocol TCP -LocalPorts {ports} -Action Allow | Out-Null
|
||||
$added = $true
|
||||
}}
|
||||
$end = (Get-Date).AddMinutes({minutes})
|
||||
while ((Test-Path -LiteralPath '{to_windows(flag)}') -and ((Get-Date) -lt $end)) {{ Start-Sleep -Seconds 2 }}
|
||||
if ($added) {{ Remove-NetFirewallHyperVRule -Name $name -ErrorAction SilentlyContinue }}
|
||||
"""
|
||||
encoded = base64.b64encode(script.encode("utf-16-le")).decode()
|
||||
try:
|
||||
powershell("Start-Process powershell -Verb RunAs -WindowStyle Hidden "
|
||||
f"-ArgumentList '-NoProfile','-NonInteractive','-EncodedCommand','{encoded}'", timeout=300)
|
||||
except (OSError, subprocess.SubprocessError):
|
||||
return False
|
||||
for _ in range(20): # the elevated script needs a moment to add the rule
|
||||
if not wsl_inbound_blocked(rule):
|
||||
return True
|
||||
time.sleep(1)
|
||||
return False
|
||||
|
||||
|
||||
def network_category(ip: str) -> str | None:
|
||||
"""Windows: the firewall profile of the network that has `ip` ("Public", "Private", "DomainAuthenticated")."""
|
||||
if not is_windows():
|
||||
return None
|
||||
try:
|
||||
out = powershell(f"(Get-NetConnectionProfile -InterfaceIndex (Get-NetIPAddress -IPAddress '{ip}' "
|
||||
"-ErrorAction Stop).InterfaceIndex).NetworkCategory").stdout.strip()
|
||||
except (OSError, subprocess.SubprocessError):
|
||||
return None
|
||||
return out or None
|
||||
@@ -22,7 +22,7 @@ MAX_TOTAL = 24 << 20 # GitHub's attachment limit is 25 MB
|
||||
ENTRY_DROP = ("details", "art_source", "artwork", "art") # store metadata: public, big, no debug value
|
||||
ELF_SYMBOL_PREFIXES = ("ovr", "xr", "vrapi_", "OVR", "Java_", "JNI_", "eglGetProcAddress", "gl")
|
||||
|
||||
README = """# FramePort diagnostics bundle
|
||||
README = ("""# FramePort diagnostics bundle
|
||||
|
||||
Created by FramePort {version} on {created}. Personal data was replaced by placeholders such as `<ip>`, `<home>`,
|
||||
`<user>`, `<data>` (FramePort's data folder), `<frame>` and `<steam-id>` (counts in manifest.json → redactions).
|
||||
@@ -32,20 +32,22 @@ Created by FramePort {version} on {created}. Personal data was replaced by place
|
||||
| manifest.json | app / agent / tool versions, OS, which games are included, warnings |
|
||||
| app/app.log, app/jobs/*.log | the app's log and recent GUI job logs (build, install, launch test, ...) |
|
||||
| app/settings.json | library settings and catalog sources |
|
||||
| frame/info.json, frame/host.json | the Frame: SteamOS build, Lepton/Proton, OpenXR runtime + layers, podman, kernel keys |
|
||||
| frame/info.json, frame/host.json | the Frame: SteamOS build, Lepton/Proton, OpenXR runtime + layers, podman, kernel"""
|
||||
""" keys |
|
||||
| games/<pkg>/entry.json | the library entry: analysis, recipe, build checks, installs, last launch test |
|
||||
| games/<pkg>/recipe.yaml | the recipe in catalog form (catalog/games/<pkg>.yaml) |
|
||||
| games/<pkg>/triage.json | the newest launch log re-triaged with the triage signatures of this app version |
|
||||
| games/<pkg>/package/ | stand-in for the game files: file list, AndroidManifest.xml, ELF imports/exports / PE imports |
|
||||
| games/<pkg>/logs/ | launch-test logs saved on the PC |
|
||||
| games/<pkg>/target/ | from the Frame (or PC): launch.sh, settings.conf, deployment.json, launch/logcat/Proton/game logs, file list |
|
||||
| games/<pkg>/target/ | from the Frame (or PC): launch.sh, settings.conf, deployment.json, launch/logcat/Proton/game"""
|
||||
""" logs, file list |
|
||||
|
||||
## Debugging from this bundle
|
||||
1. `frameport diag inspect <this zip>` re-runs triage with the current signatures (catalog/triage.yaml).
|
||||
2. Look up symptoms in docs/PLAYBOOK.md; runtime facts are in docs/FRAME_RUNTIME.md.
|
||||
3. Compare `recipe.yaml` with `catalog/games/` recipes of games using the same engine / XR API (entry.json → analysis).
|
||||
4. Headless launch tests can't show the picture: "RUNNING" only proves startup (see FRAME_RUNTIME.md).
|
||||
"""
|
||||
""")
|
||||
|
||||
|
||||
def _tail(text: str, limit: int = MAX_LOG) -> str:
|
||||
@@ -100,7 +102,8 @@ class _Writer:
|
||||
if not logs:
|
||||
break
|
||||
n = logs[0]
|
||||
self.files[n] = b"[... cut to fit the 25 MB attachment limit ...]\n" + self.files[n][-(len(self.files[n]) // 4):]
|
||||
tail = self.files[n][-(len(self.files[n]) // 4):]
|
||||
self.files[n] = b"[... cut to fit the 25 MB attachment limit ...]\n" + tail
|
||||
self.warnings.append(f"{n} was cut to fit the size limit")
|
||||
size = zipped()
|
||||
|
||||
@@ -135,7 +138,8 @@ def env_info(target_info: dict | None = None) -> dict:
|
||||
proton = target_info.get("proton") or {}
|
||||
if isinstance(proton, dict):
|
||||
ready = proton.get("ready")
|
||||
out["frame"]["proton"] = ready.get("display_name") or ready.get("name") if isinstance(ready, dict) else ready
|
||||
out["frame"]["proton"] = (ready.get("display_name") or ready.get("name")
|
||||
if isinstance(ready, dict) else ready)
|
||||
return out
|
||||
|
||||
|
||||
@@ -188,13 +192,13 @@ def package_listing(g: dict) -> dict[str, object]:
|
||||
|
||||
|
||||
def _elf_summary(z: zipfile.ZipFile, info: zipfile.ZipInfo) -> dict:
|
||||
import shutil
|
||||
import tempfile
|
||||
|
||||
from elftools.elf.dynamic import DynamicSection
|
||||
from elftools.elf.elffile import ELFFile
|
||||
from elftools.elf.sections import SymbolTableSection
|
||||
|
||||
import shutil
|
||||
import tempfile
|
||||
|
||||
try:
|
||||
with contextlib.ExitStack() as stack:
|
||||
f = stack.enter_context(z.open(info))
|
||||
@@ -370,7 +374,8 @@ def collect(packages: list[str] | None, target=None, reporter: Reporter | None =
|
||||
tag = packages[0] if packages and len(packages) == 1 else ("games" if packages else "app")
|
||||
dest = dest / f"FramePort-diag-{tag}-{time.strftime('%Y%m%d-%H%M%S')}.zip"
|
||||
with zipfile.ZipFile(dest, "w", zipfile.ZIP_DEFLATED) as z:
|
||||
for name in ["README.md", "manifest.json"] + sorted(n for n in w.files if n not in ("README.md", "manifest.json")):
|
||||
rest = sorted(n for n in w.files if n not in ("README.md", "manifest.json"))
|
||||
for name in ["README.md", "manifest.json"] + rest:
|
||||
z.writestr(name, w.files[name])
|
||||
reporter.check("Diagnostics bundle", True, f"{dest.name} ({dest.stat().st_size / 2**20:.1f} MB)")
|
||||
applog.log.info("diagnostics bundle %s", dest)
|
||||
|
||||
@@ -8,9 +8,9 @@ from __future__ import annotations
|
||||
|
||||
from urllib.parse import urlencode
|
||||
|
||||
from .. import REPO_URL as REPO
|
||||
from . import redact
|
||||
|
||||
from .. import REPO_URL as REPO
|
||||
MAX_URL = 7500
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
"""Plain explanations for the failures users actually meet (GUI and CLI share them).
|
||||
|
||||
`explain(exc)` turns an exception into one sentence that says what happened and what to do; anything it doesn't
|
||||
recognise keeps its own message. `is_connection_error(exc)` tells whether the Frame dropped off the network (the
|
||||
install queue then waits for it instead of failing every remaining job).
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import errno
|
||||
import zipfile
|
||||
|
||||
from .i18n import tr
|
||||
|
||||
|
||||
def _paramiko():
|
||||
try:
|
||||
import paramiko
|
||||
from paramiko.ssh_exception import NoValidConnectionsError
|
||||
return paramiko, NoValidConnectionsError
|
||||
except ImportError: # pragma: no cover - paramiko is a dependency
|
||||
return None, None
|
||||
|
||||
|
||||
def is_connection_error(exc: BaseException) -> bool:
|
||||
"""The Frame can't be reached (off, asleep, out of Wi-Fi), as opposed to a command that failed on it."""
|
||||
paramiko, no_valid = _paramiko()
|
||||
if no_valid and isinstance(exc, no_valid):
|
||||
return True
|
||||
if isinstance(exc, (TimeoutError, EOFError, ConnectionResetError, ConnectionAbortedError,
|
||||
ConnectionRefusedError, BrokenPipeError)):
|
||||
return True
|
||||
if paramiko and isinstance(exc, paramiko.SSHException) and not isinstance(exc, paramiko.AuthenticationException):
|
||||
msg = str(exc).lower()
|
||||
return any(s in msg for s in ("not active", "unable to connect", "error reading ssh protocol banner",
|
||||
"connection reset", "timed out", "socket is closed"))
|
||||
if isinstance(exc, OSError) and exc.errno in (errno.EHOSTUNREACH, errno.ENETUNREACH, errno.ECONNRESET,
|
||||
errno.ETIMEDOUT, errno.ECONNREFUSED, errno.EPIPE):
|
||||
return True
|
||||
return isinstance(exc, ConnectionError) and "authentication" not in str(exc).lower()
|
||||
|
||||
|
||||
def explain(exc: BaseException) -> str:
|
||||
"""One sentence for the user: what went wrong and what to do (else the exception's own message)."""
|
||||
paramiko, _ = _paramiko()
|
||||
msg = " ".join(str(exc).split()).removeprefix("[Errno None] ")
|
||||
low = msg.lower()
|
||||
if paramiko and isinstance(exc, paramiko.ChannelException):
|
||||
return tr("The connection to the Frame is busy. Try again in a moment.")
|
||||
if "authentication failed" in low or "no authentication methods available" in low:
|
||||
if "password was refused" in low:
|
||||
return tr("The Frame refused that password. Check it, or run the first-time setup instead: Steam Frame → "
|
||||
"Show setup command.")
|
||||
return tr("This Frame isn't set up for FramePort yet. Run the first-time setup: Steam Frame → Show setup "
|
||||
"command.")
|
||||
if is_connection_error(exc):
|
||||
return tr("Can't reach your Frame. Make sure it's on, awake and on the same network, then try again.")
|
||||
if isinstance(exc, OSError) and exc.errno == errno.ENOSPC:
|
||||
return tr("This PC's disk is full. Free some space and try again.")
|
||||
if "not enough space on the frame" in low:
|
||||
return tr("Not enough space on the Frame ({detail}). Remove games you don't play or use Free up space on "
|
||||
"the Steam Frame page.").format(detail=msg.split(":", 1)[-1].strip())
|
||||
if "is running on the frame" in low or low in ("the game is running", "the game is already running") or \
|
||||
"a frameport game is running" in low:
|
||||
return tr("A game is running on the Frame. Close it in the headset first, then try again.")
|
||||
if "steam did not close" in low or "steam isn't running" in low:
|
||||
return tr("Steam on the Frame isn't responding. Restart the Frame (or its Steam) and try again.")
|
||||
if isinstance(exc, zipfile.BadZipFile) or (isinstance(exc, KeyError) and "androidmanifest" in low):
|
||||
return tr("The APK file is damaged or incomplete. Get the game again and rescan the folder.")
|
||||
if "checksum mismatch" in low:
|
||||
return tr("The upload to the Frame was damaged on the way. Try again (a cable or the Frame's hotspot is "
|
||||
"more reliable than a busy Wi-Fi).")
|
||||
if msg:
|
||||
return msg
|
||||
return type(exc).__name__
|
||||
@@ -1,12 +1,15 @@
|
||||
"""SSH connection to a Steam Frame and the remote agent protocol.
|
||||
|
||||
Authentication: FramePort's own key (<user data>/ssh/id_ed25519, installed by the bootstrap script) first, then
|
||||
the user's SSH agent/keys, then a password if given.
|
||||
Authentication: FramePort's own keys first (<user data>/ssh/id_ed25519, installed by the bootstrap script, and
|
||||
id_rsa, registered through Valve's devkit pairing, which only takes RSA keys), then the user's SSH agent/keys, then a
|
||||
password if given.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import contextlib
|
||||
import hashlib
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
import posixpath
|
||||
import re
|
||||
@@ -18,11 +21,32 @@ from pathlib import Path
|
||||
|
||||
import paramiko
|
||||
|
||||
from ..core.paths import agent_dir, ssh_dir, user_data_dir
|
||||
from ..core.paths import agent_file, ssh_dir, user_data_dir, write_atomic
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
REMOTE_AGENT_DIR = ".local/share/frameport/agent"
|
||||
|
||||
|
||||
class FrameNotPaired(ConnectionError):
|
||||
"""SSH works but none of FramePort's ways in was accepted: the Frame hasn't run the first-time setup (or the
|
||||
password was wrong). The message keeps "authentication failed" for older callers."""
|
||||
|
||||
def __init__(self, tried_password: bool, details: list[str]):
|
||||
self.tried_password = tried_password
|
||||
self.details = details
|
||||
reason = ("the password was refused" if tried_password
|
||||
else "this Frame doesn't know FramePort yet")
|
||||
super().__init__(f"SSH authentication failed: {reason}. Run the first-time setup on the Frame (Steam Frame → "
|
||||
"Show setup command)." + (f" ({'; '.join(details)})" if details else ""))
|
||||
|
||||
|
||||
def _no_auth_methods(exc: BaseException) -> bool:
|
||||
"""paramiko ends a key/agent attempt that had nothing to offer (no SSH keys on this PC, no agent) with a plain
|
||||
SSHException, not an AuthenticationException: it's a failed login all the same, not a network problem."""
|
||||
return isinstance(exc, paramiko.SSHException) and "no authentication methods available" in str(exc).lower()
|
||||
|
||||
|
||||
def app_key() -> paramiko.Ed25519Key:
|
||||
path = ssh_dir() / "id_ed25519"
|
||||
if not path.exists():
|
||||
@@ -30,12 +54,11 @@ def app_key() -> paramiko.Ed25519Key:
|
||||
from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PrivateKey
|
||||
|
||||
key = Ed25519PrivateKey.generate()
|
||||
path.write_bytes(key.private_bytes(serialization.Encoding.PEM, serialization.PrivateFormat.OpenSSH,
|
||||
serialization.NoEncryption()))
|
||||
try:
|
||||
os.chmod(path, 0o600)
|
||||
except OSError:
|
||||
pass
|
||||
data = key.private_bytes(serialization.Encoding.PEM, serialization.PrivateFormat.OpenSSH,
|
||||
serialization.NoEncryption())
|
||||
fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_EXCL, 0o600) # private from the first byte
|
||||
with os.fdopen(fd, "wb") as f:
|
||||
f.write(data)
|
||||
pub = key.public_key().public_bytes(serialization.Encoding.OpenSSH, serialization.PublicFormat.OpenSSH)
|
||||
(ssh_dir() / "id_ed25519.pub").write_text(pub.decode() + " frameport\n")
|
||||
return paramiko.Ed25519Key.from_private_key_file(str(path))
|
||||
@@ -46,6 +69,37 @@ def app_public_key() -> str:
|
||||
return (ssh_dir() / "id_ed25519.pub").read_text().strip()
|
||||
|
||||
|
||||
def devkit_key() -> paramiko.RSAKey:
|
||||
"""FramePort's RSA key for Valve's devkit pairing (frame/devkit.py): its service accepts only ssh-rsa keys."""
|
||||
path = ssh_dir() / "id_rsa"
|
||||
if not path.exists():
|
||||
from cryptography.hazmat.primitives import serialization
|
||||
from cryptography.hazmat.primitives.asymmetric import rsa
|
||||
|
||||
key = rsa.generate_private_key(public_exponent=65537, key_size=3072)
|
||||
data = key.private_bytes(serialization.Encoding.PEM, serialization.PrivateFormat.OpenSSH,
|
||||
serialization.NoEncryption())
|
||||
fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_EXCL, 0o600)
|
||||
with os.fdopen(fd, "wb") as f:
|
||||
f.write(data)
|
||||
pub = key.public_key().public_bytes(serialization.Encoding.OpenSSH, serialization.PublicFormat.OpenSSH)
|
||||
(ssh_dir() / "id_rsa.pub").write_text(pub.decode() + " frameport\n")
|
||||
return paramiko.RSAKey.from_private_key_file(str(path))
|
||||
|
||||
|
||||
def devkit_public_key() -> str:
|
||||
devkit_key()
|
||||
return (ssh_dir() / "id_rsa.pub").read_text().strip()
|
||||
|
||||
|
||||
def app_keys() -> list[paramiko.PKey]:
|
||||
"""The keys FramePort logs in with: the Ed25519 key, plus the RSA key once devkit pairing created it."""
|
||||
keys: list[paramiko.PKey] = [app_key()]
|
||||
if (ssh_dir() / "id_rsa").exists():
|
||||
keys.append(devkit_key())
|
||||
return keys
|
||||
|
||||
|
||||
@dataclass
|
||||
class FrameTarget:
|
||||
host: str
|
||||
@@ -58,18 +112,93 @@ class FrameTarget:
|
||||
return self.name or self.host
|
||||
|
||||
|
||||
_saved_cache: tuple[float, list] = (-1.0, [])
|
||||
|
||||
|
||||
def saved_targets() -> list[FrameTarget]:
|
||||
"""The remembered Frames (read again only when frames.json changed: the sidebar asks several times a second).
|
||||
FramePort running on a Frame remembers that Frame itself (127.0.0.1) the first time."""
|
||||
if not (user_data_dir() / "frames.json").exists():
|
||||
return _local_frame()
|
||||
return _read_saved()
|
||||
|
||||
|
||||
def _read_saved() -> list[FrameTarget]:
|
||||
global _saved_cache
|
||||
path = user_data_dir() / "frames.json"
|
||||
try:
|
||||
return [FrameTarget(**d) for d in json.loads(path.read_text())]
|
||||
except (OSError, ValueError, TypeError):
|
||||
mtime = path.stat().st_mtime
|
||||
except OSError:
|
||||
return []
|
||||
if mtime != _saved_cache[0]:
|
||||
try:
|
||||
_saved_cache = (mtime, [d for d in json.loads(path.read_text()) if isinstance(d, dict)])
|
||||
except (OSError, ValueError):
|
||||
return []
|
||||
try:
|
||||
return [FrameTarget(**d) for d in _saved_cache[1]]
|
||||
except TypeError:
|
||||
return []
|
||||
|
||||
|
||||
def is_unreachable(exc: BaseException) -> bool:
|
||||
"""The Frame isn't there at all (asleep, off the network): retrying an upload at once won't help."""
|
||||
return isinstance(exc, (ConnectionRefusedError, TimeoutError, paramiko.ssh_exception.NoValidConnectionsError))
|
||||
|
||||
|
||||
def _local_frame() -> list[FrameTarget]:
|
||||
"""On a Frame with nothing remembered yet: this Frame, with FramePort's key authorized for the local user."""
|
||||
from . import local
|
||||
|
||||
if not local.on_frame():
|
||||
return []
|
||||
try:
|
||||
local.authorize_self(app_public_key())
|
||||
except OSError:
|
||||
pass
|
||||
target = FrameTarget("127.0.0.1", local.local_user(), 22, local.LOCAL_NAME)
|
||||
save_target(target)
|
||||
return [target]
|
||||
|
||||
|
||||
def replace_target(old_host: str, target: FrameTarget) -> None:
|
||||
"""The remembered Frame at old_host is now at target.host (same device: its SSH host key matched)."""
|
||||
items = [FrameTarget(target.host, t.user, t.port, t.name) if t.host == old_host else t for t in _read_saved()]
|
||||
if target.host not in [t.host for t in items]:
|
||||
items.insert(0, target)
|
||||
seen, out = set(), []
|
||||
for t in items:
|
||||
if t.host not in seen:
|
||||
seen.add(t.host)
|
||||
out.append(t)
|
||||
write_atomic(user_data_dir() / "frames.json", json.dumps([t.__dict__ for t in out], indent=2))
|
||||
|
||||
|
||||
def server_key(host: str, port: int = 22, timeout: float = 5) -> paramiko.PKey | None:
|
||||
"""The SSH host key a device presents (no login)."""
|
||||
import socket
|
||||
|
||||
try:
|
||||
sock = socket.create_connection((host, port), timeout=timeout)
|
||||
except OSError:
|
||||
return None
|
||||
transport = paramiko.Transport(sock)
|
||||
try:
|
||||
transport.start_client(timeout=timeout)
|
||||
return transport.get_remote_server_key()
|
||||
except (OSError, paramiko.SSHException, EOFError):
|
||||
return None
|
||||
finally:
|
||||
transport.close()
|
||||
|
||||
|
||||
_last_relocate = -1e9
|
||||
|
||||
|
||||
def save_target(target: FrameTarget) -> None:
|
||||
items = [t for t in saved_targets() if t.host != target.host]
|
||||
items = [t for t in _read_saved() if t.host != target.host]
|
||||
items.insert(0, target)
|
||||
(user_data_dir() / "frames.json").write_text(json.dumps([t.__dict__ for t in items], indent=2))
|
||||
write_atomic(user_data_dir() / "frames.json", json.dumps([t.__dict__ for t in items], indent=2))
|
||||
|
||||
|
||||
# direct links to the Frame, fastest first (interface → what it is)
|
||||
@@ -79,51 +208,221 @@ FAST_LINKS = {"usb0": "USB cable", "wlanap": "the Frame's own Wi-Fi hotspot"}
|
||||
def bundled_agent_version() -> int | None:
|
||||
"""AGENT_VERSION of the agent this app ships (it's uploaded to the Frame whenever it differs)."""
|
||||
try:
|
||||
m = re.search(r"^AGENT_VERSION = (\d+)", (agent_dir() / "frameport_agent.py").read_text(), re.M)
|
||||
m = re.search(r"^AGENT_VERSION = (\d+)", agent_file().read_text(), re.M)
|
||||
return int(m.group(1)) if m else None
|
||||
except OSError:
|
||||
return None
|
||||
|
||||
|
||||
RUN_TIMEOUT = 120 # seconds: default bound for one remote command's output
|
||||
|
||||
|
||||
NOT_IN_LIBRARY = "not in the Frame's Steam library" # agent cmd_launch's error when the shortcut is missing
|
||||
|
||||
|
||||
class AgentFailed(RuntimeError):
|
||||
pass
|
||||
|
||||
|
||||
SFTP_CHANNELS = 3 # OpenSSH allows 10 channels per connection (MaxSessions): leave room for commands
|
||||
|
||||
|
||||
class SftpPool:
|
||||
"""A few SFTP channels shared by all threads, lent out per operation (or while a remote file is open).
|
||||
paramiko's SFTPClient must not be used by two threads at once; one channel per thread was kept open for good and
|
||||
long-lived GUI worker threads ran the connection out of channels ("ChannelException(2, 'Connect failed')").
|
||||
A thread that already holds a channel reuses it for nested calls (no deadlock)."""
|
||||
|
||||
def __init__(self, open_channel, size: int = SFTP_CHANNELS):
|
||||
self._open, self.size = open_channel, size
|
||||
self._free: list = []
|
||||
self._all: list = []
|
||||
self._cv = threading.Condition()
|
||||
self._local = threading.local()
|
||||
|
||||
@contextlib.contextmanager
|
||||
def lease(self):
|
||||
loc = self._local
|
||||
if getattr(loc, "depth", 0):
|
||||
loc.depth += 1
|
||||
try:
|
||||
yield loc.client
|
||||
finally:
|
||||
loc.depth -= 1
|
||||
return
|
||||
with self._cv:
|
||||
while True:
|
||||
while self._free:
|
||||
client = self._free.pop()
|
||||
if not client.sock.closed:
|
||||
break
|
||||
self._all.remove(client)
|
||||
else:
|
||||
client = None
|
||||
if client is not None or len(self._all) < self.size:
|
||||
break
|
||||
self._cv.wait()
|
||||
if client is None:
|
||||
client = self._open()
|
||||
self._all.append(client)
|
||||
loc.client, loc.depth = client, 1
|
||||
try:
|
||||
yield client
|
||||
finally:
|
||||
loc.client, loc.depth = None, 0
|
||||
with self._cv:
|
||||
self._free.append(client)
|
||||
self._cv.notify()
|
||||
|
||||
def close(self) -> None:
|
||||
with self._cv:
|
||||
clients, self._all, self._free = self._all, [], []
|
||||
self._cv.notify_all()
|
||||
for c in clients:
|
||||
try:
|
||||
c.close()
|
||||
except Exception: # noqa: BLE001 - closing anyway
|
||||
pass
|
||||
|
||||
|
||||
class _LeasedFile:
|
||||
"""A remote file that holds its SFTP channel until it's closed."""
|
||||
|
||||
def __init__(self, f, lease):
|
||||
self._f, self._lease = f, lease
|
||||
|
||||
def __getattr__(self, name):
|
||||
return getattr(self._f, name)
|
||||
|
||||
def __iter__(self):
|
||||
return iter(self._f)
|
||||
|
||||
def __enter__(self):
|
||||
return self
|
||||
|
||||
def __exit__(self, *exc):
|
||||
self.close()
|
||||
|
||||
def close(self) -> None:
|
||||
if self._lease is not None:
|
||||
lease, self._lease = self._lease, None
|
||||
try:
|
||||
self._f.close()
|
||||
finally:
|
||||
lease.__exit__(None, None, None)
|
||||
|
||||
|
||||
class SftpProxy:
|
||||
"""frame.sftp: looks like a paramiko SFTPClient; each call borrows a channel from the pool."""
|
||||
|
||||
def __init__(self, pool: SftpPool):
|
||||
self._pool = pool
|
||||
|
||||
def open(self, *args, **kwargs):
|
||||
lease = self._pool.lease()
|
||||
client = lease.__enter__()
|
||||
try:
|
||||
f = client.open(*args, **kwargs)
|
||||
except BaseException:
|
||||
lease.__exit__(None, None, None)
|
||||
raise
|
||||
return _LeasedFile(f, lease)
|
||||
|
||||
def __getattr__(self, name):
|
||||
def call(*args, **kwargs):
|
||||
with self._pool.lease() as client:
|
||||
return getattr(client, name)(*args, **kwargs)
|
||||
return call
|
||||
|
||||
|
||||
@dataclass
|
||||
class Frame:
|
||||
target: FrameTarget
|
||||
password: str | None = None
|
||||
client: paramiko.SSHClient | None = None
|
||||
_sftp: paramiko.SFTPClient | None = None
|
||||
_pool: SftpPool | None = None # SFTP channels shared by all threads (see sftp)
|
||||
_lock: threading.Lock = field(default_factory=threading.Lock)
|
||||
_agent_digest: str = "" # the agent version known to be on the Frame (checked once per connection)
|
||||
home: str = ""
|
||||
|
||||
# ------------------------------------------------------------------ connect
|
||||
def connect(self, timeout: float = 10) -> "Frame":
|
||||
client = paramiko.SSHClient()
|
||||
def connect(self, timeout: float = 10) -> Frame:
|
||||
try:
|
||||
return self._connect(timeout)
|
||||
except OSError:
|
||||
if self.target.host in ("127.0.0.1", "localhost"): # FramePort on the Frame itself: sshd isn't running
|
||||
raise ConnectionError("FramePort runs on this Frame but can't reach it over SSH: turn on Developer "
|
||||
"Mode (Steam → Settings → System → Developer Mode), then try again") from None
|
||||
moved = self.relocate() # the router gave the Frame a new address (it's remembered by address)
|
||||
if not moved:
|
||||
raise
|
||||
log.info("Frame moved from %s to %s", self.target.host, moved)
|
||||
old, self.target.host = self.target.host, moved
|
||||
self._connect(timeout)
|
||||
replace_target(old, self.target)
|
||||
return self
|
||||
|
||||
def relocate(self) -> str | None:
|
||||
"""The Frame's new address when it no longer answers at the remembered one: a device on the network whose
|
||||
SSH host key is the one this PC saw at the old address (checked before logging in). At most once a minute (the
|
||||
GUI retries every few seconds while a Frame sleeps)."""
|
||||
global _last_relocate
|
||||
if time.monotonic() - _last_relocate < 60 or self.target.host not in [t.host for t in saved_targets()]:
|
||||
return None
|
||||
_last_relocate = time.monotonic()
|
||||
hk = paramiko.HostKeys()
|
||||
try:
|
||||
hk.load(str(ssh_dir() / "known_hosts"))
|
||||
except OSError:
|
||||
return None
|
||||
known = hk.lookup(self.target.host if self.target.port == 22 else f"[{self.target.host}]:{self.target.port}")
|
||||
if not known:
|
||||
return None
|
||||
from .discovery import browse
|
||||
|
||||
for f in browse(seconds=3.0):
|
||||
if f.host == self.target.host or f.port != self.target.port:
|
||||
continue
|
||||
key = server_key(f.host, f.port)
|
||||
if key is not None and known.get(key.get_name()) == key:
|
||||
return f.host
|
||||
return None
|
||||
|
||||
def _connect(self, timeout: float) -> Frame:
|
||||
known = ssh_dir() / "known_hosts"
|
||||
known.touch(exist_ok=True)
|
||||
client.load_host_keys(str(known))
|
||||
client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) # trust on first use (pairing)
|
||||
kwargs = dict(hostname=self.target.host, port=self.target.port, username=self.target.user, timeout=timeout,
|
||||
banner_timeout=timeout, auth_timeout=timeout)
|
||||
errors = []
|
||||
for attempt in ("app_key", "agent", "password"):
|
||||
attempts = [("app_key", k) for k in app_keys()] + [("agent", None), ("password", None)]
|
||||
for attempt, pkey in attempts:
|
||||
if attempt == "password" and not self.password:
|
||||
continue
|
||||
client = paramiko.SSHClient() # a fresh client per attempt: a failed one keeps its transport otherwise
|
||||
client.load_host_keys(str(known))
|
||||
client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) # trust on first use (pairing)
|
||||
try:
|
||||
if attempt == "app_key":
|
||||
client.connect(pkey=app_key(), allow_agent=False, look_for_keys=False, **kwargs)
|
||||
client.connect(pkey=pkey, allow_agent=False, look_for_keys=False, **kwargs)
|
||||
elif attempt == "agent":
|
||||
client.connect(allow_agent=True, look_for_keys=True, **kwargs)
|
||||
elif self.password:
|
||||
client.connect(password=self.password, allow_agent=False, look_for_keys=False, **kwargs)
|
||||
else:
|
||||
continue
|
||||
client.connect(password=self.password, allow_agent=False, look_for_keys=False, **kwargs)
|
||||
break
|
||||
except paramiko.AuthenticationException as exc:
|
||||
client.close()
|
||||
errors.append(f"{attempt}: {exc}")
|
||||
except paramiko.SSHException as exc:
|
||||
client.close()
|
||||
if not _no_auth_methods(exc):
|
||||
raise
|
||||
# (Reddit, 2026-10-03: this ended the loop before the password was tried)
|
||||
errors.append(f"{attempt}: {exc}")
|
||||
except BaseException:
|
||||
client.close()
|
||||
raise
|
||||
else:
|
||||
raise ConnectionError("SSH authentication failed (" + "; ".join(errors) + "). Run the FramePort "
|
||||
"bootstrap on the Frame or enter the steamos password.")
|
||||
raise FrameNotPaired(bool(self.password), errors)
|
||||
client.save_host_keys(str(known))
|
||||
transport = client.get_transport()
|
||||
transport.set_keepalive(15)
|
||||
@@ -136,13 +435,15 @@ class Frame:
|
||||
out = self.run("ip -4 -o addr show up 2>/dev/null")[1]
|
||||
return re.findall(r"^\d+:\s+(\S+)\s+inet\s+([\d.]+)/", out, re.M)
|
||||
|
||||
def fast_link(self, timeout: float = 1.5) -> tuple["Frame", str]:
|
||||
def fast_link(self, timeout: float = 1.5) -> tuple[Frame, str]:
|
||||
"""A second connection over the fastest direct link, for bulk uploads: the USB cable (usb0) or the Frame's own
|
||||
hotspot (wlanap; the PC joins it with a Wi-Fi adapter, e.g. Valve's USB dongle) — several times faster than
|
||||
both going through the home router (measured 83-97 vs 15-18 MB/s). Used only if this PC can reach it and it
|
||||
presents the same SSH host key as this connection. Returns (frame, link name); (self, "") if none."""
|
||||
import socket
|
||||
|
||||
if self.target.host in ("127.0.0.1", "localhost"): # FramePort on the Frame itself: nothing is faster
|
||||
return self, ""
|
||||
key = self.client.get_transport().get_remote_server_key()
|
||||
for iface in FAST_LINKS:
|
||||
for name, ip in self.addresses():
|
||||
@@ -161,19 +462,32 @@ class Frame:
|
||||
return self, ""
|
||||
|
||||
def close(self) -> None:
|
||||
if self._sftp:
|
||||
self._sftp.close()
|
||||
with self._lock:
|
||||
pool, self._pool = self._pool, None
|
||||
if pool:
|
||||
pool.close()
|
||||
if self.client:
|
||||
self.client.close()
|
||||
self.client = self._sftp = None
|
||||
self.client = None
|
||||
self._agent_digest = ""
|
||||
|
||||
def alive(self) -> bool:
|
||||
"""The SSH connection itself still works (a failed agent command doesn't mean the Frame is gone)."""
|
||||
transport = self.client.get_transport() if self.client else None
|
||||
return bool(transport and transport.is_active())
|
||||
|
||||
@property
|
||||
def sftp(self) -> paramiko.SFTPClient:
|
||||
if self._sftp is None:
|
||||
self._sftp = self.client.open_sftp()
|
||||
return self._sftp
|
||||
def sftp(self) -> SftpProxy:
|
||||
"""SFTP for any thread (see SftpPool): the same calls as paramiko's SFTPClient."""
|
||||
with self._lock:
|
||||
if self._pool is None:
|
||||
self._pool = SftpPool(lambda: self.client.open_sftp())
|
||||
return SftpProxy(self._pool)
|
||||
|
||||
def run(self, command: str, stdin: str | None = None, timeout: float | None = None) -> tuple[int, str, str]:
|
||||
def run(self, command: str, stdin: str | None = None,
|
||||
timeout: float | None = RUN_TIMEOUT) -> tuple[int, str, str]:
|
||||
"""Run a shell command. `timeout` (s) bounds waiting for output, so a dead link can't hang the caller;
|
||||
None only for commands that legitimately run long (installs, launch tests)."""
|
||||
chan_in, out, err = self.client.exec_command(command, timeout=timeout)
|
||||
if stdin is not None:
|
||||
chan_in.write(stdin)
|
||||
@@ -191,23 +505,30 @@ class Frame:
|
||||
|
||||
# ------------------------------------------------------------------ agent
|
||||
def ensure_agent(self) -> str:
|
||||
local = agent_dir() / "frameport_agent.py"
|
||||
local = agent_file()
|
||||
text = local.read_bytes()
|
||||
digest = hashlib.sha256(text).hexdigest()[:16]
|
||||
remote_dir = posixpath.join(self.home, REMOTE_AGENT_DIR)
|
||||
remote = posixpath.join(remote_dir, "frameport_agent.py")
|
||||
if self._agent_digest == digest:
|
||||
return remote
|
||||
code, out, _ = self.run(f"sha256sum {sh_quote(remote)} 2>/dev/null | cut -c1-16")
|
||||
if out.strip() != digest:
|
||||
self.run(f"mkdir -p {sh_quote(remote_dir)}")
|
||||
with self.sftp.open(remote + ".tmp", "wb") as f:
|
||||
tmp = f"{remote}.{os.getpid()}.{threading.get_ident()}.tmp" # two threads never share a temp file
|
||||
with self.sftp.open(tmp, "wb") as f:
|
||||
f.write(text)
|
||||
self.run(f"mv {sh_quote(remote + '.tmp')} {sh_quote(remote)} && chmod 755 {sh_quote(remote)}")
|
||||
code, _, err = self.run(f"mv {sh_quote(tmp)} {sh_quote(remote)} && chmod 755 {sh_quote(remote)}")
|
||||
if code:
|
||||
raise AgentFailed(f"couldn't install the FramePort agent on the Frame: {err.strip()[-300:]}")
|
||||
self._agent_digest = digest
|
||||
return remote
|
||||
|
||||
def agent(self, command: str, timeout: float | None = 600, **args):
|
||||
remote = self.ensure_agent()
|
||||
def agent(self, command: str, timeout: float | None = 600, ensure: bool = True, **args):
|
||||
"""Run an agent command. ensure=False uses the agent already on the Frame (never re-uploads it)."""
|
||||
remote = self.ensure_agent() if ensure else posixpath.join(self.home, REMOTE_AGENT_DIR, "frameport_agent.py")
|
||||
code, out, err = self.run(f"python3 {sh_quote(remote)} {command}", stdin=json.dumps(args), timeout=timeout)
|
||||
line = next((l for l in reversed(out.splitlines()) if l.startswith("{")), "")
|
||||
line = next((ln for ln in reversed(out.splitlines()) if ln.startswith("{")), "")
|
||||
try:
|
||||
reply = json.loads(line)
|
||||
except ValueError:
|
||||
@@ -223,10 +544,24 @@ class Frame:
|
||||
if dirs:
|
||||
self.run("xargs -0 mkdir -p", stdin="\0".join(dirs))
|
||||
|
||||
def put(self, local: Path, remote: str, progress=None, resume: bool = True, mkdir: bool = True) -> None:
|
||||
def put(self, local: Path, remote: str, progress=None, resume: bool = True, mkdir: bool = True,
|
||||
attempts: int = 3) -> None:
|
||||
"""Upload with resume: data goes to <remote>.part, appended from the existing size, then renamed. progress may
|
||||
raise (e.g. Cancelled): the .part stays and the next put continues from there."""
|
||||
local = Path(local)
|
||||
raise (e.g. Cancelled): the .part stays and the next put continues from there. A failed transfer is resumed
|
||||
up to `attempts` times (Windows: an occasional OSError [Errno 22] mid-upload that the next try got past)."""
|
||||
for attempt in range(attempts):
|
||||
try:
|
||||
return self._put(Path(local), remote, progress, resume, mkdir)
|
||||
except OSError as exc:
|
||||
if attempt == attempts - 1 or is_unreachable(exc):
|
||||
raise
|
||||
log.warning("upload of %s failed (%s), resuming", Path(local).name, exc)
|
||||
time.sleep(2)
|
||||
if not self.alive():
|
||||
self.close()
|
||||
self.connect()
|
||||
|
||||
def _put(self, local: Path, remote: str, progress, resume: bool, mkdir: bool) -> None:
|
||||
size = local.stat().st_size
|
||||
part = remote + ".part"
|
||||
if mkdir:
|
||||
@@ -303,15 +638,6 @@ def sh_quote(s: str) -> str:
|
||||
return "'" + s.replace("'", "'\"'\"'") + "'"
|
||||
|
||||
|
||||
def wait_for(predicate, timeout: float, interval: float = 2.0) -> bool:
|
||||
end = time.time() + timeout
|
||||
while time.time() < end:
|
||||
if predicate():
|
||||
return True
|
||||
time.sleep(interval)
|
||||
return False
|
||||
|
||||
|
||||
def parse_target(text: str) -> FrameTarget:
|
||||
m = re.fullmatch(r"(?:(?P<user>[^@]+)@)?(?P<host>[^:]+)(?::(?P<port>\d+))?", text.strip())
|
||||
if not m:
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
"""Valve's devkit pairing: with Developer Mode on, the Frame's steamos-devkit-service (TCP 32000) accepts an SSH public
|
||||
key at POST /register while Steam is in pairing mode (Settings → Developer → Pair new host; otherwise it refuses at
|
||||
once), asks in Steam to approve it, and Valve's root hook installs the key for the steamos user and enables sshd.
|
||||
Every connection goes from the PC to the Frame, so no firewall on the PC is involved: the fallback when the Frame
|
||||
can't reach FramePort's setup server. The service only accepts ssh-rsa keys
|
||||
(connection.devkit_key)."""
|
||||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
import urllib.error
|
||||
import urllib.request
|
||||
|
||||
from .connection import devkit_public_key
|
||||
|
||||
PORT = 32000
|
||||
APPROVE_TIMEOUT = 30 # Valve's approve hook waits this long for the answer in the headset
|
||||
|
||||
|
||||
class PairingRefused(RuntimeError): # not a ConnectionError: the Frame is reachable, explain() keeps the message
|
||||
pass
|
||||
|
||||
|
||||
def available(host: str, timeout: float = 5) -> bool:
|
||||
try:
|
||||
with urllib.request.urlopen(f"http://{host}:{PORT}/login-name", timeout=timeout) as r:
|
||||
return r.status == 200
|
||||
except OSError:
|
||||
return False
|
||||
|
||||
|
||||
def register(host: str) -> None:
|
||||
"""Send FramePort's RSA key; returns once it was approved in the headset and installed, raises PairingRefused."""
|
||||
req = urllib.request.Request(f"http://{host}:{PORT}/register", data=devkit_public_key().encode(), method="POST")
|
||||
try:
|
||||
with urllib.request.urlopen(req, timeout=APPROVE_TIMEOUT + 30) as r:
|
||||
body = r.read().decode("utf-8", "replace")
|
||||
except urllib.error.HTTPError as exc:
|
||||
body = exc.read().decode("utf-8", "replace") # Valve's service mixes the hook's log lines into it
|
||||
m = re.search(r'"error":\s*"([^"]*)"', body)
|
||||
msg = (m.group(1) if m else (body.strip() or str(exc))).replace("\\n", " ").strip()
|
||||
if "pairing mode" in msg.lower(): # Steam takes requests only while "Pair new host" is open
|
||||
msg = "on the Frame open Settings → Developer → Pair new host first, then click Connect again"
|
||||
elif "timeout" in msg.lower():
|
||||
msg = f"it wasn't approved in the headset within {APPROVE_TIMEOUT} seconds"
|
||||
elif "steam is not running" in msg.lower():
|
||||
msg = "Steam isn't running on the Frame"
|
||||
raise PairingRefused(f"The Frame didn't pair: {msg}") from None
|
||||
except OSError as exc:
|
||||
raise PairingRefused(f"Couldn't reach the Frame's pairing service (Developer Mode on?): {exc}") from None
|
||||
if "Registered" not in body:
|
||||
raise PairingRefused(f"The Frame didn't pair: {body.strip()}")
|
||||
@@ -65,7 +65,8 @@ def _mdns(seconds: float) -> dict[str, Found]:
|
||||
info = zc.get_service_info(type_, name, timeout=2000)
|
||||
if not info:
|
||||
return
|
||||
props = {k.decode(): (v.decode() if isinstance(v, bytes) else v) for k, v in (info.properties or {}).items()}
|
||||
props = {k.decode(): (v.decode() if isinstance(v, bytes) else v)
|
||||
for k, v in (info.properties or {}).items()}
|
||||
dev = (info.server or name).split(".")[0]
|
||||
f = found.setdefault(dev, Found(dev, "", source="devkit" if "devkit" in type_ else "frameport"))
|
||||
if "frameport" in type_:
|
||||
@@ -107,7 +108,8 @@ def local_subnets() -> list[ipaddress.IPv4Network]:
|
||||
nets = set()
|
||||
stats = psutil.net_if_stats()
|
||||
for nic, addrs in psutil.net_if_addrs().items():
|
||||
if not stats.get(nic) or not stats[nic].isup or any(v in nic.lower() for v in ("vethernet", "docker", "virbr", "vmnet", "wsl")):
|
||||
virtual = any(v in nic.lower() for v in ("vethernet", "docker", "virbr", "vmnet", "wsl"))
|
||||
if not stats.get(nic) or not stats[nic].isup or virtual:
|
||||
continue
|
||||
for a in addrs:
|
||||
if a.family == socket.AF_INET and not a.address.startswith(("127.", "169.254.", "172.")):
|
||||
@@ -119,7 +121,8 @@ def _scan(nets: list[ipaddress.IPv4Network], skip: set[str]) -> list[str]:
|
||||
own = local_addresses()
|
||||
hosts = [str(h) for n in nets for h in n.hosts() if str(h) not in skip and str(h) not in own]
|
||||
with ThreadPoolExecutor(128) as pool:
|
||||
return [h for h, ok in zip(hosts, pool.map(lambda h: ssh_open(h, timeout=0.4), hosts)) if ok and h not in own]
|
||||
results = pool.map(lambda h: ssh_open(h, timeout=0.4), hosts)
|
||||
return [h for h, ok in zip(hosts, results, strict=True) if ok and h not in own]
|
||||
|
||||
|
||||
def browse(seconds: float = 4.0, scan: bool = True) -> list[Found]:
|
||||
@@ -136,7 +139,7 @@ def browse(seconds: float = 4.0, scan: bool = True) -> list[Found]:
|
||||
with ThreadPoolExecutor(32) as pool:
|
||||
for f in devices.values():
|
||||
cands = list(dict.fromkeys(f.addresses))
|
||||
ok = [a for a, up in zip(cands, pool.map(ssh_open, cands)) if up]
|
||||
ok = [a for a, up in zip(cands, pool.map(ssh_open, cands), strict=True) if up]
|
||||
ips = []
|
||||
for a in ok:
|
||||
try:
|
||||
@@ -153,13 +156,6 @@ def browse(seconds: float = 4.0, scan: bool = True) -> list[Found]:
|
||||
return sorted(out, key=lambda f: (rank.get(f.source, 9), f.name, link_label(f.host) != "network", f.host))
|
||||
|
||||
|
||||
def resolve_hostname(name: str = "frame.local") -> str | None:
|
||||
try:
|
||||
return socket.gethostbyname(name)
|
||||
except OSError:
|
||||
return None
|
||||
|
||||
|
||||
def local_ip_towards(host: str = "8.8.8.8") -> str:
|
||||
"""The PC's address on the route towards host (used in the bootstrap one-liner)."""
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
||||
|
||||