Compare commits

..
8 changed files with 527 additions and 193 deletions

No files matched your search

@@ -0,0 +1,137 @@
# Bottom screen: companion API for PC games
Part of the [bottom screen research](bottom-screen.md). Researched 2026-11-26 against `main` at `d788afc12`. Not implemented.
Let games and mods running in the Linux and Proton session drive pages on DroidDeck's bottom screen: live state (health, money, map position, inventory, quests) and touch commands back into the game.
## Use cases
- **RPGs**: a Pip-Boy for Fallout 4, inventory and quests for Skyrim and Fallout: New Vegas, equipment swaps by touch.
- **Sims and management**: Stardew Valley's day, bag, bundles and calendar; RimWorld colonists and alerts; Project Zomboid's status.
- **Open world**: GTA's radio, weapons, wanted level and GPS-to-blip.
- **Racing and flight**: the telemetry dashboards DroidDeck already has.
- **Speedrunning**: LiveSplit splits for any game with an auto-splitter.
## Companions people already use
Several Thor companions already run against PC games in Wine, and two document DroidDeck as a supported launcher. Each is a separate Android app paired with a game-side mod that serves state on loopback.
| Companion | Game-side piece | Transport |
| --- | --- | --- |
| [Thor Pip-Boy](https://github.com/harmssi/thor-pipboy) (Fallout 4, **targets DroidDeck**) | F4SE plugin | WebSocket on `127.0.0.1:8767`, protocol copied from SkyrimWebSocket; commands `toggle`, `equip`, `use`, `radio`; raw access to the game's Pip-Boy data |
| [Grand Theft Companion](https://github.com/BrianJr03/GrandTheftCompanion) (GTA IV and V, **documents DroidDeck setup**) | `.asi` via Ultimate ASI Loader (IV) or ScriptHookV (V); needs `WINEDLLOVERRIDES=dinput8=n,b` in Steam launch options | JSON on `127.0.0.1:47801` at 20 Hz with a hello frame; radio, weapon, GPS and cheat commands. Its map page is a crop of the minimap |
| [AYN Thor dual-screen mods](https://github.com/JoeCorrell/AYN-Thor-Dualscreen-Mods) (Stardew Valley, for WEMU) | SMAPI mod | Hand-written RFC 6455 WebSocket on `127.0.0.1:7786` (".NET's WebSocket server wraps Windows components Wine does not implement"). No auth. Replays the latest message of each kind on connect, computes nothing without a client, hides the game HUD while one is attached. Sprites sent once as base64 PNG with nine-patch insets. Commands: `select_slot`, `move_item`, `eat_slot`, `sort_bag`, `shift_toolbar`, `craft_recipe` and others. Optional UDP beacon on 7787. The [Barry client](https://github.com/project-barry/stardew-dual-screen/blob/main/docs/protocol.md) documents the schema and ships a mock server |
| [SkyrimWebSocket](https://github.com/andreyvelsk/SkyrimWebSocket) + SkyrimWebMonitor | SKSE plugin | WebSocket on `127.0.0.1:8765`. Client-driven `subscribe` with frequency, send-on-change and aliased fields; `query`, `heartbeat`, `command` → `commandResult` ([protocol](https://github.com/andreyvelsk/SkyrimWebSocket/blob/main/PROTOCOL.md)). Client is a web app |
| [SkyrimSE-DualScreen](https://github.com/Plus-Cloud/SkyrimSE-DualScreen) | `SkyrimAYN.dll` | A 384 KiB memory-mapped file with a seqlock header ([layout](https://github.com/Plus-Cloud/SkyrimSE-DualScreen/blob/main/native/shared-memory.md)). Only works with its own bundled Wine |
| FNVDS (Fallout: New Vegas) | xNVSE plugin | TCP on `127.0.0.1:47888` |
| FFXII Companion | LUA Script Loader script reading memory, gated on the game build | JSON files in shared storage; commands as request files |
| [ZomboidDS](https://github.com/Space001000/ZomboidDS) (Project Zomboid on a Java port) | Lua and Java mod | WebSocket `ws://127.0.0.1:7786/ws` (**the same port as the Stardew mod**), envelope `{v,type,seq,data}`, hello first, full-state topics replayed on connect, `command_result`, `capabilities[]`, icons over HTTP ([protocol](https://github.com/Space001000/ZomboidDS/blob/main/protocol/PROTOCOL.md)) |
Lessons:
- Every project invents its own port and schema; two already collide on 7786.
- Each needs its own Android app on the bottom screen. Thor Pip-Boy warns that bringing it to the front "lowers DroidDeck's priority and could get the game killed" while Fallout 4 is loading. Pages drawn inside DroidDeck's own bottom-screen Presentation avoid that.
- The good protocols share a shape: hello with capabilities, complete state per topic replayed on connect, commands with ids and results, assets sent once and cached.
- Mods should do no work while nobody is watching (the Stardew mod and SkyrimWebSocket both do this).
## Game-side APIs a companion could consume
| Source | Protocol | Works in Proton on ARM? |
| --- | --- | --- |
| SKSE, F4SE, xNVSE plugins | Any socket from a Windows DLL | Yes, proven by the companions above |
| ScriptHookV / ASI plugins | Any socket | Yes, proven |
| [RIMAPI](https://github.com/IlyaChichkov/RIMAPI) (RimWorld) | REST and SSE on `localhost:8765`, 120+ endpoints, extensible by other mods | Likely (Unity, Mono) |
| [Hollow Knight tracker](https://github.com/kingkiller39/HollowKnightRandomizerTracker2.8) | WebSocket on `localhost:11420` | Likely |
| [Ficsit Remote Monitoring](https://docs.ficsit.app/ficsitremotemonitoring/latest/webserver.html) (Satisfactory) | HTTP and WebSocket on 8080 | The game is heavy for ARM |
| [Valheim WebMap](https://github.com/kylepaulsen/ValheimWebMap) | BepInEx, HTTP and WebSocket on 3000 | Server-side mod |
| Cyberpunk 2077 | CET plus RedSocket, used by [Crowd Control](https://crowdcontrol.live/guides/cyberpunk2077/) | Unknown; heavy |
| Fallout 4 Pip-Boy app protocol | UDP 28000 discovery, binary stream on TCP 27000 ([reverse-engineered](https://github.com/luckydonald/JavaPipBoyServer/blob/master/PROTOCOL.md)) | Broken in the current game build per Thor Pip-Boy |
| CS2 / Dota 2 Game State Integration | The game POSTs JSON to a URI declared in a cfg file | Protocol is a good model; the games are unrealistic on ARM |
| ETS2 / ATS telemetry SDK | Shared memory; needs an in-Wine relay such as [Funbit's server](https://github.com/Funbit/ets2-telemetry-server) | With a relay |
| [LiveSplit server](https://github.com/LiveSplit/LiveSplit.Server) | Text commands on TCP 16834 | Yes |
| Discord Rich Presence | Named pipe `\\.\pipe\discord-ipc-0` with JSON frames | A Wine-side pipe sink would give presence data for any game that integrates Discord |
| Racing UDP, War Thunder, Elite Dangerous | Already consumed by DroidDeck (below) | Yes |
Generic memory readers that publish JSON are another model: [tosu](https://github.com/KotRikD/tosu) serves osu! state on a WebSocket, and LiveSplit's ASL and [WASM auto-splitters](https://github.com/alexknauth/hollowknight-autosplit-wasm) are per-game pointer descriptions that a Rust runtime (livesplit-core) evaluates.
## What DroidDeck already has
Paths are under [`app/src/main/java/com/droiddeck/launcher/`](../../app/src/main/java/com/droiddeck/launcher/).
- **Shared loopback.** proot creates no network namespace and the bwrap shim ignores `--unshare-net`, so the guest's `127.0.0.1` is the app's `127.0.0.1` ([`core/NetworkReport.kt`](../../app/src/main/java/com/droiddeck/launcher/core/NetworkReport.kt), `tools/linuxfs/overlay/usr/local/bin/droiddeck-bwrap`). A Windows game in Proton can connect to a socket the app opens, and the app can connect to a socket a mod opens.
- **Telemetry template.** [`session/GameTelemetry.kt`](../../app/src/main/java/com/droiddeck/launcher/session/GameTelemetry.kt) parses Codemasters (UDP 20777), Forza (5300) and OutGauge (4444) packets, War Thunder's `http://127.0.0.1:8111/state` and Elite Dangerous's `Status.json` read straight from the Proton prefix. [`ui/BottomTelemetryPage.kt`](../../app/src/main/java/com/droiddeck/launcher/ui/BottomTelemetryPage.kt) runs one listener per source, marks data stale after 3 s, reports busy ports and unknown formats, and draws dashboards. [`session/TelemetryOutput.kt`](../../app/src/main/java/com/droiddeck/launcher/session/TelemetryOutput.kt) edits a game's config in its prefix (with a backup) to turn telemetry on. This is the first version of the companion API: built-in adapters for known games.
- **Agent channel.** `droiddeck-agent` in the guest and [`agent/AgentGuest.kt`](../../app/src/main/java/com/droiddeck/launcher/agent/AgentGuest.kt) talk through request and response files in a shared directory, plus watched state files (`focus.json` and others). `steamEval` reaches Steam's UI over the DevTools port.
- **Installing mods.** [`session/WinComponents.kt`](../../app/src/main/java/com/droiddeck/launcher/session/WinComponents.kt) installs per-game components from the [DroidDeck-Components](https://github.com/Droid-Deck/DroidDeck-Components) catalog: download, extract, copy DLLs and files, DLL overrides, registration. That is exactly what SKSE, F4SE, ScriptHookV, ASI Loader and BepInEx need. Per-game environment overrides ([`session/GameEnvironmentStore.kt`](../../app/src/main/java/com/droiddeck/launcher/session/GameEnvironmentStore.kt)) reach the game through the `steam-compatibility` wrapper, including `WINEDLLOVERRIDES`. There is no SMAPI or BepInEx installer yet.
- **A second guest on the bottom screen.** The bottom KDE desktop is a second compositor in its own process with its own `/run/droiddeck`, so the main guest cannot see its Wayland socket. A debug-gated run queue in [`droiddeck-desktop`](../../tools/linuxfs/desktop/droiddeck-desktop) runs scripts there with `WAYLAND_DISPLAY=wayland-1 DISPLAY=:1`, which is a seed for a "run on bottom" command.
## Proposed design
### Phase 1: adapters for existing companions
DroidDeck connects as a client to the servers mods already open and draws their pages natively in the bottom-screen Presentation:
- Stardew (port 7786, WEMU protocol), Skyrim and Fallout 4 (SkyrimWebSocket protocol on 8765 and Thor Pip-Boy on 8767), GTA (47801), RIMAPI, the Hollow Knight tracker, LiveSplit.
- Probe only the ports known for the focused app id, so a busy port never confuses two games.
- Offer the mod itself through the components catalog, so setup is one toggle in the game's settings.
This gives working showcases without writing any mods, and a reason to define the shared state model first.
### Phase 2: DroidDeck's own protocol
For new mods, DroidDeck is the server and mods are clients:
- **Transport.** WebSocket at `ws://127.0.0.1:<port>/companion/v1`, and newline-delimited JSON over raw TCP on the same port (detected from the first bytes). Clients are trivial under Wine; servers inside Wine are not (the Stardew mod had to hand-write one). Several mods or games can attach at once.
- **Discovery.** DroidDeck sets `DROIDDECK_COMPANION_URL`, `DROIDDECK_COMPANION_TOKEN` (random per launch) and `DROIDDECK_APPID` in the game's environment through the existing game-environment path, and writes the same values to a known file in the prefix for processes that lose the environment.
- **Security.** Any Android app can reach loopback, so the token is required in `hello` within about 2 s or the connection closes. No remote bind. Commands that change the game need a per-mod user toggle. Limits on frame and asset sizes.
- **Envelope.** `{"v":1,"type":…,"seq":n,…}`.
| Direction | Message | Purpose |
| --- | --- | --- |
| game → DroidDeck | `hello{token, game{appid, build}, mod{id, version}, capabilities[]}` | Identify and authenticate |
| | `declare{states{key: {type, unit, min, max}}}` | Describe the state keys the mod publishes |
| | `state{topic, data}` | Complete value of a topic, never a diff; DroidDeck keeps the latest and replays it when a page opens |
| | `asset{id: sha256, mime, nine_patch, filter}` + binary frame | Art sent once and cached across sessions by content hash |
| | `event{toast \| haptic \| sound}` | Notifications |
| | `result{id, ok, error}` | Command outcome |
| DroidDeck → game | `welcome{session, screen{w, h}}` | Accept the connection |
| | `visibility{visible, topics[], hz}` | Tell the mod what is on screen so it computes nothing else |
| | `command{id, name, args}` | Touch actions |
| | `input{button}` | Pass L/R or similar when a page claims them |
| | `ping` | Liveness |
A small C header and a C# client file would let SKSE, F4SE, ASI and BepInEx/SMAPI authors adopt it in an afternoon.
### Phase 3: pages
- **Declarative pages** in a `.ddpage` zip (`manifest.json` plus assets), modelled on Eden Duo's [package format](https://github.com/igawa6/eden-duo-companions/blob/main/docs/PACKAGE_FORMAT.md) but drawn with DroidDeck's own components:
- `pages[]` of widgets (`label`, `value`, `bar`, `grid`, `list`, `image`, `map`, `button`) bound to state keys, with `repeat` over arrays;
- actions `command`, `page` and `input` on tap, hold and swipe;
- a settings page backed by the mod's options;
- host values (`@device.*`, `@perf.*`) so pages can mix game and device data.
- **Normalized core keys**, the lesson from SimHub, whose dashboards work across many games because readers map them onto one property tree: `player.health`, `player.money`, `location.name`, `map.{x,y,heading}`, `inventory[]`, `quests[]`, `game.time`. A generic RPG page then works for any mod that provides them.
- **WebView escape hatch** for richer pages, in the style of EmuLnk's [theme API](https://github.com/EmuLnk/emulnk-repo/wiki/Theme-API): `window.droiddeck.onState` and `.send`. This also hosts existing web clients like SkyrimWebMonitor unchanged.
- Pages ship inside the mod, or from a catalog repository like the components catalog.
### Phase 4: run on bottom
A `droiddeck-run-bottom -- <cmd>` command, like Armada's `armada-run-bottom`, that opens a guest program on the bottom screen with touch. Kanto Gear's separate-window mode and second-monitor mods would then work as they are. Unity games could render to `Display.displays[1]` (the Silksong Android approach) if the bottom panel is exposed as a second output to the guest. Builds on the bottom desktop's run queue, or on binding its runtime directory into the main guest.
### Phase 5: memory profiles (only if demand)
Per-game JSON pointer profiles, gated on the Steam build id, evaluated on the Android side against the game process, in the style of Eden Duo or LiveSplit's auto-splitters. Strict version gating with a "needs build X" page, as Eden Duo does. Highest maintenance cost; only for popular games without mod support.
## Open questions
- Whether a single port and token for every game is enough, or each session gets its own port.
- How pages and mods are versioned together, and what happens when a mod is newer than the page.
- Which component installs belong in the catalog (SKSE, F4SE, ScriptHookV, ASI Loader, SMAPI, BepInEx) and how they interact with Steam updates of the game.
- Asking the authors of Thor Pip-Boy, Grand Theft Companion and the Stardew mod whether they would also speak DroidDeck's protocol.
- Touch commands that change game state while the game is paused or loading.
## Milestones
1. Stardew adapter (port 7786) with a native page, and the SMAPI mod offered through components.
2. Skyrim and Fallout 4 adapters (SkyrimWebSocket protocol), GTA adapter.
3. DroidDeck protocol server, C and C# clients, `.ddpage` renderer, normalized keys.
4. Run on bottom.
5. Memory profiles.
+118
View File
@@ -0,0 +1,118 @@
# Bottom screen: guides tab
Part of the [bottom screen research](bottom-screen.md). Researched 2026-11-26 against `main` at `d788afc12`. Not implemented.
A dashboard tab that follows the running game and shows its guides, achievements, maps and fixes, reopens where the user left off, and saves pages for offline use.
## Use cases
- Stuck on a puzzle or boss: the walkthrough for this game is already open on the bottom screen at the last section read.
- Achievement hunting: a checklist of locked achievements with missable ones flagged, spoilers blurred until tapped.
- Collectibles: a map image pinned with pan and zoom, markers saved per map.
- Fixes: PCGamingWiki and ProtonDB notes for the game when it misbehaves.
- Offline play on a plane with guides saved earlier.
## Prior art
| Project | Matching | Offline | Reader and extras | Complaints and requests |
| --- | --- | --- | --- | --- |
| [Game Twin](https://github.com/alpha-minus/game-twin) (GPL-3, 157★) | Bundled catalogs (GameFAQs, StrategyWiki, VGMaps, Steam guides) rebuilt offline; Jaccard title match at 0.6 with a sequel guard (numbers must match); hand-mapped series sites (Zelda Dungeon, Bulbapedia); site search URLs for the rest | `WebView.saveWebArchive` after forcing lazy images to load; MHT split into HTML and assets served via `shouldInterceptRequest`; scripts stripped; OkHttp with WebView cookies for side downloads. Also imports PDF, TXT, EPUB | Reading mode with per-host cleanup, auto table of contents, find, bookmarks. Resume by the text at the top of the viewport plus its occurrence, so it survives reflow. Maps with markers, checklists, RetroAchievements and Steam achievements, folder sync, optional Gemini with a screenshot | Battery and fan noise from live pages left running ([#12](https://github.com/alpha-minus/game-twin/issues/12), [#24](https://github.com/alpha-minus/game-twin/issues/24)); saved guides unreadable in dark mode ([#9](https://github.com/alpha-minus/game-twin/issues/9)); cookie banners ([#2](https://github.com/alpha-minus/game-twin/issues/2)); requests for notes ([#28](https://github.com/alpha-minus/game-twin/issues/28)) and a visible capture indicator for AI ([#22](https://github.com/alpha-minus/game-twin/issues/22)) |
| [Pixel Guide](https://github.com/rexmont/Pixel-Guide-Android) (closed source) | Manual | TXT, single-file HTML, multi-page Neoseeker | ASCII reflow with auto table of contents, per-guide font, resume, find, controller scrolling, 14 themes, manuals, translation, AI | Ads in saved pages ([#46](https://github.com/rexmont/Pixel-Guide-Android/issues/46)), very large guides fail ([#58](https://github.com/rexmont/Pixel-Guide-Android/issues/58)); requests for stick scrolling ([#35](https://github.com/rexmont/Pixel-Guide-Android/issues/35)), prev/next ([#27](https://github.com/rexmont/Pixel-Guide-Android/issues/27)), checklists ([#44](https://github.com/rexmont/Pixel-Guide-Android/issues/44)), remembering the game association ([#20](https://github.com/rexmont/Pixel-Guide-Android/issues/20)) |
| [WalkThor](https://github.com/nerf-herder-29/WalkThor) (MIT) | Fuzzy match of ROM name to local files | Local PDF and TXT only | Position stored as a character offset; 80-column pages for ASCII tables; L1/R1 page turns. Bottom window is non-focusable while a game runs because taking focus "can halve its frame rate" | n/a |
| Steam Deck overlay Guides (SteamOS 3.3) | Exact app id | No | Favourites and popular guides; later fixes for oversized images and spoiler tags. Gone from the desktop overlay, where the 2023 overlay instead added pinned windows and Game Notes ([PC Gamer](https://pcgamer.com/new-steam-feature-lets-you-pin-windows-over-games-including-guides-notes-and-web-pages)) | n/a |
DroidDeck's advantage: we know the exact Steam app id of the focused game, so we need no title matching for Steam games.
## Sources
| Source | Access | Terms | Use |
| --- | --- | --- | --- |
| **Steam Community guides** | Listing: `steamcommunity.com/app/<appid>/guides/?browsefilter=toprated\|trend&requiredtags[]=Walkthroughs`. API: `IPublishedFileService/QueryFiles` with `filetype=11` needs a key or the signed-in user's token. Guide pages (`sharedfiles/filedetails/?id=`) are server-rendered; sections are `div.subSection` with numeric ids | Authors own their guides under the Steam Subscriber Agreement. Cache per user, never redistribute | First source. Native section reader with stable anchors for chapter jumps and resume |
| **Steam achievements** | `IPlayerService/GetGameAchievements/v1/?appid=&language=` needs no key and returns names, icons, the hidden flag, global unlock percentage, and descriptions even for hidden achievements (checked on Elden Ring, Hollow Knight, Baldur's Gate 3). It is undocumented. `GetGlobalAchievementPercentagesForApp` also needs no key. The player's unlocks should come from the local client (`SteamClient.Apps` through CDP, or the client's stats cache); not yet tested | Valve | Achievement checklist with spoiler blur and difficulty from unlock % |
| **Wikidata** | SPARQL by Steam app id (P1733), or Epic (P6278) or GOG (P2725) id, returns the Fandom wiki (P4073), PCGamingWiki (P6337), GameFAQs (P4769), IGN (P5385), HowLongToBeat (P2816) and speedrun.com ids | CC0 | Crosswalk from the running game to every other site, including non-Steam games |
| **StrategyWiki** | MediaWiki API | CC BY-SA 4.0 | Full offline caching allowed |
| **Fandom wikis** | MediaWiki `api.php` per wiki | CC BY-SA (media excluded) | Per-game wiki pages, found through Wikidata |
| **PCGamingWiki** | `pcgamingwiki.com/api/appid.php?appid=` redirects to the page; MediaWiki API (anonymous Cargo queries are refused now) | CC BY-NC-SA 3.0 | Fixes and settings, in a "Fixes" section |
| **ProtonDB** | `protondb.com/api/v1/reports/summaries/<appid>.json`, no key | ProtonDB | A tier badge next to fixes |
| **GameFAQs, Neoseeker, IGN** | No API. GameFAQs terms forbid unauthorized scraping; its robots signals allow reference use but not AI training | Authors' copyright; Ziff Davis bans automated retrieval including AI use without permission | Browse in a WebView; save a page only when the user asks; never prefetch or send to AI |
| **VGMaps, Map Genie** | Images; Map Genie is an interactive site (Ziff Davis) | Maps belong to the games' owners; Map Genie bans automated retrieval | Save VGMaps images on request into the map viewer; Map Genie only as a live WebView |
| **YouTube** | Search URL (free) or Data API (100 quota units per search) | YouTube | Search link and embedded player, no downloads |
| **HowLongToBeat, TrueSteamAchievements** | No stable API ([unofficial library breaks often](https://github.com/ScrappyCocco/HowLongToBeat-PythonAPI/issues)) | Ziff Davis / site owners | Links only |
Recommended order for the tab: Steam guides → achievements → StrategyWiki or the game's Fandom wiki (via Wikidata) → PCGamingWiki and ProtonDB → curated series sites → GameFAQs, Neoseeker and IGN in a WebView → maps → YouTube.
## What DroidDeck already has
Paths are under [`app/src/main/java/com/droiddeck/launcher/`](../../app/src/main/java/com/droiddeck/launcher/).
- **Game identity.** `AgentGuest.activeSteamAppId` from gamescope focus (ignoring the Steam client, 769), passed to bottom pages as `runningGame`. Non-Steam store games are Steam shortcuts; `resolveAchievementsInFront` already maps the focused id to the store and store id through the library cache.
- **WebView base.** [`ui/BottomChatPage.kt`](../../app/src/main/java/com/droiddeck/launcher/ui/BottomChatPage.kt) loads Steam Community with a host allow-list, desktop user agent, fit-to-screen CSS and crash recovery. [`session/SteamWebLogin.kt`](../../app/src/main/java/com/droiddeck/launcher/session/SteamWebLogin.kt) imports the Steam client's own `steamcommunity.com` cookies, so guides load signed in without another login.
- **Achievements.** [`stores/StoreAchievements.kt`](../../app/src/main/java/com/droiddeck/launcher/stores/StoreAchievements.kt) is a provider base with a per-game cache; GOG and Epic implement it. [`ui/StoreAchievementsUi.kt`](../../app/src/main/java/com/droiddeck/launcher/ui/StoreAchievementsUi.kt) has the rows, tab and session panel. A Steam provider plugs in as source `steam`.
- **Per-game storage.** `SessionPrefs` already keys settings by game (for example `fpsLimit.game.<id>`); the guide workspace fits the same pattern.
- **Game frame without MediaProjection.** `SessionActivity.copyGameFrame` and `AgentAttachments.gameFrame` capture the game image directly, which an optional AI helper could use with no capture permission.
- **Controller.** The dashboard forwards controller input to the game and has no D-pad focus today. The docked session menu has focus handling (`SecondScreenPresentation.dispatchMenuKey`, the `dockedMenuController` setting) and is the pattern to follow.
## Design
**Workspace per game.** One workspace per Steam app id (or store key): open guide, section, text anchor, recent searches, pinned maps, checklist ticks. Restored when the game gains focus. Cleared with the game profile.
**Home of the tab** for the running game:
1. Continue: the last guide at the last section.
2. Steam guides, top rated and trending, filterable by tag (Walkthroughs, Achievements, Secrets, Maps).
3. Achievements: locked first, missable flagged, hidden descriptions blurred.
4. Wiki: StrategyWiki or Fandom, from Wikidata.
5. Fixes: PCGamingWiki and the ProtonDB tier.
6. Saved: offline pages and maps for this game.
7. Search the web: GameFAQs, Neoseeker, IGN and YouTube with the game name prefilled.
**Reader.**
- Steam guides and MediaWiki pages are rendered natively from their HTML (sections, images, spoilers), not as a full web page: smaller, dark by default, and reflowed for the panel.
- Other sites open in a WebView with cleanup CSS, forced dark mode and a cookie-banner dismiss.
- Resume by text anchor (Game Twin's approach), falling back to scroll ratio.
- Table of contents from Steam section ids or the MediaWiki outline; find in page.
- Spoiler-safe by default: Steam `[spoiler]` spans and hidden achievements blurred until tapped.
**Offline.**
- Steam guides and wiki pages: save the parsed HTML and images per user.
- Other sites: MHT saved on request, with scripts stripped.
- Saved pages are listed per game and work without network.
**Controller.**
- The guide never takes focus or priority from the game (WalkThor's lesson).
- A dedicated chord or the docked-menu controller mode gives it the pad: right stick scrolls, L1/R1 change section, D-pad moves through links and the contents, B returns the pad to the game.
- Touch always works.
**Battery.** Pause or destroy WebViews when the tab is not visible; the top complaint about Game Twin is a live page draining the battery behind the game.
## Progress-aware help (later)
Signals we can use without reading game memory:
- Steam achievement unlocks with timestamps, matched to guide section titles.
- Steam rich presence (`steam_display`) and, for games that report it, [Steam Timeline](https://partner.steamgames.com/doc/api/ISteamTimeline) game phases and tooltips. Whether the client exposes these to CDP needs checking.
An optional AI helper ("Where am I, what next?") would send the game frame plus those signals. Rules from Game Twin's feedback and the criticism of Xbox Gaming Copilot ([Tom's Hardware](https://www.tomshardware.com/video-games/pc-gaming/microsoft-says-gaming-copilot-uses-screenshots-to-understand-in-game-events-not-for-training-ai-models-optional-feature-can-be-turned-off-but-not-easily-uninstalled)):
- opt-in, user's own key;
- one frame per question, with a visible indicator;
- crop out notifications and overlays;
- never send cached text from sources that forbid AI use.
## Open questions
- The most reliable way to read the player's Steam unlocks locally (CDP versus the client's stats cache).
- Whether Steam guide listings load reliably without the web API key, using the signed-in cookies.
- How much of a Steam guide's formatting (tables, embedded video) the native reader must support.
- Where the tab lives in swapped mode (it follows the panel to the top screen).
## Milestones
1. Steam guides list and WebView reader for the running app id, with a per-game last page.
2. Steam achievements provider and checklist with spoiler blur.
3. Native section reader, offline saving and the controller mode.
4. Wikidata crosswalk, wiki and fixes sections, maps viewer.
5. Progress-aware suggestions and the optional AI helper.
@@ -0,0 +1,107 @@
# Bottom screen: region mirror
Part of the [bottom screen research](bottom-screen.md). Researched 2026-11-26 against `main` at `d788afc12`. Not implemented.
Show live crops of the game image (minimap, HUD, ability bar, dialogue box) scaled up on the bottom screen, and optionally remove them from the top screen. Regions are saved per game.
## Use cases
- **Minimaps** in open-world and action games (GTA, Monster Hunter, The Witcher, Elden Ring's compass): bigger on the bottom, gone from the top.
- **MMO and ARPG bars**: ability, health and buff bars moved off a crowded 6" screen. Megingiard users asked for 90° rotation for a Guild Wars 2 ability bar and for very thin crops for visual-novel text.
- **Racing**: rear-view mirror or track map on the bottom while the top shows only the road.
- **Strategy**: the minimap of an RTS or a city builder, where it is the main navigation tool.
- **Clean top screen**: hide every HUD element on top and keep them all on the bottom.
## Prior art
| Project | Capture | Notes |
| --- | --- | --- |
| [Megingiard](https://github.com/stormpanda/megingiard) (Thor) | A privileged shell helper creates a mirror display (hidden `SurfaceControl.createDisplay` on API 33; `AUTO_MIRROR` virtual display through `mirrorSurface` on API 34+), then SurfaceTexture → GLES → TextureView. Falls back to MediaProjection with a consent prompt on every start | Up to 10 cutouts. Crop box edited on the top screen, placement on the bottom. Edge handles, 1 px gamepad steps, snap guides, aspect lock (free, source-locked, destination-locked), rotation and flips, pinch zoom, circle shape, edge blending, temporal smoothing. Variance masks cut moving background out of HUD art. "Visual anchors" (a 256-point colour signature checked at 60 Hz) switch layout or freeze cutouts when a menu covers the HUD. FPS cap 10–120. Complaints: black mirror, consent prompts, helper pairing, DRM blanking ([docs](https://github.com/stormpanda/megingiard/tree/main/docs/features/mirror)) |
| [Heimdall](https://github.com/mastercook777/Heimdall-AYN-Thor-Assistant) (Thor) | MediaProjection into one virtual display, fanned out on the GPU: one EGL surface per "Portal", crop in the texture matrix | Two Portals. Per-Portal zoom, shape, fps, and an "Interactive" mode that sends one-finger touch back to the region. Curated [community profiles](https://github.com/mastercook777/heimdall-community-profiles) keyed by app, checked by SHA-256 |
| [WalkThor](https://github.com/nerf-herder-29/WalkThor) (Thor) | MediaProjection at half resolution into an `ImageReader`, drawn with Compose | Four regions per game stored as fractions of the screen and keyed by game title. Pick box keeps the bottom screen's aspect by default. About 30 fps. Its bottom window is non-focusable so the game keeps top-app priority |
| [OnTopReplica](https://github.com/LorenzCK/OnTopReplica) (Windows) | DWM thumbnails (`DwmRegisterThumbnail` with source and destination rectangles): a crop done by the compositor, with no copy | The usual way to put an MMO minimap on a second monitor. SteamDeckHQ's [AYANEO Flip DS review](https://steamdeckhq.com/news/ayaneo-flip-ds-review/) used it for a Monster Hunter: World minimap on the bottom screen |
| [wl-mirror](https://github.com/Ferdi265/wl-mirror) (Linux) | wlr-screencopy or dmabuf export with `--region` | Scaling modes fit, cover, exact, linear and nearest, plus freeze |
| gamescope PipeWire stream | An extra composite pass of the whole output, used by Steam for recording | Full output only, no regions. Still a precedent for a second output rendered inside the compositor |
None of the Android tools can hide the region on the top screen: they capture the final display output, so any mask they drew would be captured too. Each also adds at least one composition cycle of latency and needs MediaProjection or a privileged helper.
## Why DroidDeck can do better
The game is composited by our own Wayland compositor in the app process. We have the game image as a Vulkan image before it reaches the display, so we can:
- crop without screen capture, a consent prompt or a privileged helper;
- avoid the extra SurfaceFlinger round trip;
- mask the region on the top screen in the same pass;
- know the game's own resolution and our letterbox or stretch transform, so regions can be stored in game coordinates.
## Current pipeline
Paths are under [`app/src/main/cpp/waylandcomp/src/`](../../app/src/main/cpp/waylandcomp/src/).
- gamescope runs nested in our compositor with its Wayland backend (`tools/linuxfs/overlay/usr/local/bin/droiddeck-session`). Client buffers arrive as dma-bufs or AHardwareBuffers and are imported as `VkImage`s ([`vk_present.c`](../../app/src/main/cpp/waylandcomp/src/vk_present.c)).
- `render_scene()` in [`compositor.c`](../../app/src/main/cpp/waylandcomp/src/compositor.c) builds a draw list; `vkp_render()` composites it, runs the effects chain ([`effects_chain.c`](../../app/src/main/cpp/waylandcomp/src/effects_chain.c): FSR, NIS, SGSR, CAS, CRT and others) and blits into one swapchain on one `ANativeWindow`.
- There is exactly one output window. Swapping the game to the bottom screen ([`BottomGameScreen.kt`](../../app/src/main/java/com/droiddeck/launcher/ui/BottomGameScreen.kt), `SessionActivity.putGameOnBottom`) re-targets that window to the Presentation's `SurfaceView`; it does not feed two surfaces.
- A gated zero-copy path ([`sc_layer.c`](../../app/src/main/cpp/waylandcomp/src/sc_layer.c), [`ZERO_COPY_SPIKE.md`](../../app/src/main/cpp/waylandcomp/ZERO_COPY_SPIKE.md)) posts the game's AHardwareBuffer straight to an `ASurfaceControl` child layer, with no composited image.
- `update_map()` holds the scene-to-output transform for each scale mode (letterbox, fit, stretch, fill, integer); `vkp_output_to_scene` and `vkp_scene_to_output` convert between them. `vkp_blit_image()` already blits into AHB-backed images.
- Screenshots use `PixelCopy` on the active `SurfaceView` (`SessionActivity.copyGameFrame`).
- The bottom-screen Presentation ([`SecondScreenPresentation.kt`](../../app/src/main/java/com/droiddeck/launcher/ui/SecondScreenPresentation.kt)) lives in the same process as the compositor, so a new JNI call can hand it a surface. The bottom KDE desktop runs a second compositor in another process and cannot share images without AHB IPC.
## Technical options
### A. Second output from the compositor (recommended first)
Add a second, optional output to `vk_present`: its own `ANativeWindow` and swapchain, fed by a `nativeSetMirrorSurface` JNI call from a `SurfaceView` in the bottom Presentation.
- After compositing the top frame, blit each region's source rectangle from the scene image into the mirror swapchain image with `vkCmdBlitImage` (or a small shader pass), and present it.
- The copy is small: a 1240×1080 target at 60 Hz is about 0.3 GB/s against roughly 60 GB/s of memory bandwidth on the Thor's SoC (an estimate, not measured). The real costs are an extra queue submit competing with a GPU-bound game, and pacing a second display.
- A shader pass makes nearest or integer scaling (pixel-art HUDs), masks, circles, rounded corners and colour keys possible. An existing upscaler (FSR EASU or SGSR) could scale a small minimap cleanly.
- The mirror runs at its own rate (default 30 fps, options 15 and 60) and skips frames when the bottom panel is behind.
- The top pass can fill, blur or dim the same rectangles to hide them.
### B. Zero-copy layers
Composite the top frame into compositor-owned AHardwareBuffers, then attach the same buffer to one `ASurfaceControl` child per region under the bottom `SurfaceView`, with `setCrop`, `setPosition`, `setScale` and `setBufferTransform`.
- The NDK documents that each layer holding a buffer counts as its own reference, and that all of them must be released before the buffer is reused ([`surface_control.h`](https://cs.android.com/android/platform/superproject/main/+/main:frameworks/native/include/android/surface_control.h)).
- On API 33 (the Thor) the NDK `setBuffer` has no per-buffer release callback; release comes as a per-surface fence in the completion callback. All region fences must be merged before reuse, and the pool needs one or two extra buffers because the 60 Hz bottom panel holds buffers longer than the 120 Hz top panel.
- Avoid the Java `Transaction.setBuffer` release callback here: callbacks are keyed by buffer and per-layer frame number, so two layers showing the same buffer can collide. This is inferred from AOSP source, not tested.
- `ASurfaceControl_fromJava` needs API 34; on API 33 parent through `ASurfaceControl_createFromWindow` on the bottom `SurfaceView`'s window.
- Scaling is done by the display hardware with a fixed vendor filter (no nearest neighbour), and the number of hardware planes is limited. If they run out, SurfaceFlinger composites on the GPU instead, which still works.
- This only makes sense once the top screen itself is presented through AHB layers. Option A first.
### C. PixelCopy prototype
Crop a `PixelCopy` of the top `SurfaceView` at 5–10 fps into a bitmap. Useful for testing the editor UX and region presets quickly, but too slow for a real minimap, and it probably returns nothing when the zero-copy path puts the game on a child layer.
## Coordinates and presets
- Store rectangles in game-surface coordinates (gamescope's output, `DD_WIDTH`×`DD_HEIGHT`), not display pixels, so they survive changes to scale mode, FSR and output size. The compositor converts them each frame.
- Fractions of the screen alone break when the aspect ratio changes, because engines anchor HUD widgets to corners and scale by height or DPI ([Unreal anchors](https://dev.epicgames.com/documentation/en-us/unreal-engine/umg-anchors-in-unreal-engine-ui)). Store an anchor (one of nine corners, edges or centre), an offset and a size in units of the game's height.
- Key presets by Steam app id, aspect bucket (16:9, 16:10, 4:3, other) and an optional UI-scale tag set by the user.
- Later: a community preset catalog keyed by app id, curated and hashed like Heimdall's, offered as "Suggested regions" for the running game.
## UX
- **Editing on both screens.** The top screen shows the frozen frame with a crop box: edge and corner handles, D-pad nudge by 1 px and shoulder buttons by 10. The bottom screen shows placement with snap guides, aspect lock, rotation, flip, filter (smooth or sharp) and shape.
- **Limits.** Up to four regions per game. Long-press freezes a region; tap opens its options.
- **Hide on top.** Per region: off, fill, blur or dim.
- **Auto-hide.** Later, Megingiard-style colour anchors that hide or freeze regions when a menu covers the HUD.
- **Place in the panel system.** A new "Mirror" bottom-screen mode next to the dashboard and control modes, remembered per game (see per-game panel memory in the overview). Regions can also be shown in a corner of the dashboard.
- **Swapped mode.** With the game on the bottom screen, the mirror output goes to the top screen.
- Reuse DroidDeck's own settings components; no generic dialogs.
## Open questions
- Pacing and fencing of a second swapchain on a different display without stalling the top present.
- Interaction with glasses output, which already re-targets the single window.
- Whether regions apply before or after effects (a CRT shader on a minimap is probably unwanted).
- Battery and thermal cost, measured on the Thor and Duo with a GPU-bound game.
- Touch forwarding into a region (Heimdall's "Interactive"), mapped back to game coordinates.
## Milestones
1. PixelCopy prototype of the editor and per-game storage.
2. Second output in `vk_present` with one region and smooth scaling.
3. Multiple regions, shader filters, hide on top.
4. Presets keyed by aspect, suggested regions, anchors.
5. Zero-copy layers once the top screen uses AHB presentation.
+153
View File
@@ -0,0 +1,153 @@
# Bottom screen: research and proposals
Researched 2026-11-26 against `main` at `d788afc12` (0.7.11). Implementation is not scheduled yet. This document records what other dual-screen Android projects put on the second screen, how they get their data, where DroidDeck stands, and the features we want to build. Three proposals have their own documents: [region mirror](bottom-screen-region-mirror.md), [guides tab](bottom-screen-guides.md) and [companion API](bottom-screen-companion-api.md).
The starting point was WULFF DEN's survey video [Dual screen Android apps are getting crazy](https://youtu.be/dAiuG2A-wkc) (2026-11-26). It covers the AYN Thor and Retroid Pocket Duo, and most of its apps come from the [GAFT list](https://andreyvelsk.github.io/GAFT) of Thor apps.
## DroidDeck in the video
DroidDeck appears from 17:47 to 18:30 on a Thor: the Steam gamepad UI on top, our bottom panel below.
- Shown: the mode picker (DroidDeck menu, Keyboard + trackpad, Terminal, Deck grips + trackpads, Profile controls, Dashboard), the controller page of the docked menu, and the Dashboard's In-game stats card with FPS, 1%/0.1%/0.01% lows and a frame-time graph while Ball x Pit runs.
- Verdict: it fills the bottom screen "with useful things like a keyboard and a trackpad" or game information, and makes the device feel "a lot more like having a dual screen Steam Deck".
- Problem: it "froze on install a handful of times" and needed three device restarts. The build was probably 0.7.1 or earlier. Two first-run hang fixes landed later: #3070 (FEX/AppImage extraction deadlock in the clock-pause preload) and #3212 (first-run setup crashing in the background). Whether they cover this report is unconfirmed; slow exFAT preallocation on the Thor's SD card ([thor-sd-storage-investigation.md](thor-sd-storage-investigation.md)) can also look like a freeze.
- Problem: with no game running, the stats card reads "59.6 fps · Steam Client ARM". It measures the Steam client itself, which tells the user nothing.
## What other projects do
### System companions and utilities
| Project | Bottom screen | Data source |
| --- | --- | --- |
| [ArmadaLive](https://github.com/FabianZettl/armadalive) (Armada OS, SteamOS-like Linux on the Thor) | Follows the top screen: logo, background, info, PDF manual, cheats and play time of the current game. Launcher with user and smart folders (recent, favourites, per system), random pick, Add to Steam. System page with FPS and a 60/120 Hz switch, rearrangeable quick-setting tiles (power profile, fan curve, stick LEDs, per-screen brightness, screen off), gauges. Rules (power profile, FPS limit, emulator resolution per game, per system, idle, or base). Tuning (governor, GPU limits, fan curve editor) that reverts after 15 s unless kept. Graphs, task manager, play-time history, trackpads, back buttons as a second controller. Dims after 10 s; hold Start+Select to close a game; AYN button shows or hides it, hold turns the screen off. 55 themes, first-run permission walkthrough, health check, verified self-update | ES-DE custom event scripts writing a state file, emulator process scan matched to ROMs, gamescope focus and stats pipe, the Big Picture selection read over Steam's CEF debug port, ES-DE scraped media and Steam's library cache |
| [Armada OS](https://github.com/armada-os/armada) | Little in game mode: the bottom screen sleeps with the top. An experimental Plasma Mobile session, and `armada-run-bottom -- <cmd>` to run single apps on a second gamescope on the bottom panel | n/a |
| [Thor Command Panel](https://github.com/BrianJr03/command-panel) | Replaces the stock dual-screen assistant: screen modes with real blanking, per-screen brightness and volume, 60/120 Hz with FPS, tiles, telemetry, themes, drag-to-arrange cards, replay buffer of either or both screens, full gamepad navigation | System APIs |
| [Better Dual Screen Assistant](https://github.com/stormpanda/better-dual-screen-assistant) (Thor and Duo) | One-tap swap of the foreground apps between screens, linked brightness and volume, FPS from real frame delivery, paged tiles switched with L1/R1, recording, touch lock, mouse mode, key mapper, works before unlock | System APIs |
| [Wayfinder](https://github.com/Thor-Wayfinder/thor-wayfinder) | Move or swap live apps between screens, button combos with a cheat sheet, per-app profiles (screen, performance, fan, refresh rate, lights, controls), keyboard and trackpad on the other screen | System APIs |
| [Megingiard](https://github.com/stormpanda/megingiard) | Mirrors up to 10 cropped regions of the top screen (minimap, HUD) with pinch zoom; per-app macro pads; split keyboard on text focus; trackpad | Screen capture |
| [WalkThor](https://github.com/nerf-herder-29/WalkThor) | Now Playing art, the guide at your last page, up to 4 mirrored top-screen regions remembered per game, console-style face-button labels, FPS graph, learned per-game battery runtime, offline captions of game audio. Hands focus back to the game | Cocoon and ES-DE log files, screen capture |
| [Heimdall](https://github.com/mastercook777/Heimdall-AYN-Thor-Assistant) | Per-game module grid, macros, precision aim, virtual mouse and stick, "portals" (live top-screen regions), OCR translation | Screen capture |
| [ThorSport](https://github.com/CHINW3/ThorSport) | Live scoreboards for 15 leagues, bottom-only mode so a game can run on top, spoiler delay synced to a stream | Sports APIs |
| AYANEO Flip DS (Windows, AYASpace) | Performance stats, quick settings, app shortcuts, moving any window between screens | Windows |
### Guides
| Project | Bottom screen | Data source |
| --- | --- | --- |
| [Game Twin](https://github.com/alpha-minus/game-twin) | Per-game vault of guides (GameFAQs, StrategyWiki, IGN) saved offline, VGMaps maps with markers, RetroAchievements and Steam achievements including missables, checklists. Switches workspace with the game and reopens where you left off. Optional Gemini help with a screenshot of the top screen | Polls Cocoon `launch_debug.log`, ES-DE `es_log.txt`, RetroArch `content_history.lpl`, and the Steam Web API for recently played |
| [Pixel Guide](https://github.com/rexmont/Pixel-Guide-Android) | Offline guides, maps, manuals, RetroAchievements, AI help | Games are added by hand |
### Game companions
| Project | Bottom screen | How it gets live state |
| --- | --- | --- |
| [Eden Duo](https://github.com/igawa6/eden-duo) (Switch) | Interactive per-game pages (Stats, Map, Tasks); can use items and change equipment | Per-game `.dsmod.zip` packages from a [catalog repo](https://github.com/igawa6/eden-duo-companions): `package.json` with build IDs and per-ABI native modules, a declarative UI manifest (pages, widgets, actions, `poll_hz`, art loaded from the game's own romfs), and pointer chains per build. A small C ABI gives modules `read_memory`/`write_memory`/`publish_*`. Unity IL2CPP members are resolved by name. Unknown builds show a "needs version X" page |
| [GBA DS](https://github.com/kyannon/gba-ds) | Map or HUD for 77 GBA games. Per-game screen sizing, placement, generated overlays and per-screen brightness | A second silent emulator instance receives the live state, opens the map and captures it, confirmed by RAM flags and pixel probes. Some games render twice, with and without the HUD |
| [WiiDS](https://github.com/Maddex712/WiiDS) | Course maps, standings, a rotating Galaxy planet with a touch cursor | Native recompilations, so state is in-process |
| [Silksong Android](https://github.com/jakobkhansen/SilksongAndroid) | Interactive map, inventory and pause menu that look like part of the game | C# patches compiled on-device against the game's assemblies, drawn by a Unity camera on `Display.displays[1]`. Downloads the Linux depot with JavaSteam and syncs Steam Cloud saves |
| [AYN Thor dual-screen mods](https://github.com/JoeCorrell/AYN-Thor-Dualscreen-Mods) (Stardew Valley) | Today, Map, Farm, Journal, Bundles, Calendar; touch actions | A SMAPI mod inside a Steam container serves a WebSocket on `127.0.0.1:7786`; a separate APK draws the pages. A [second client](https://github.com/project-barry/stardew-dual-screen) speaks the same protocol |
| [ShulkDS](https://github.com/NaiSenshin/ShulkDS) (Minecraft Java) | Minimap, touch inventory, options | Its own client reimplementation |
| [TotK Native](https://github.com/AurelioB/totk-android) | Touch equip and eat actions | Guarded reads of native memory into a JSON snapshot polled by a Java UI |
| [Kanto Gear](https://github.com/AverageConsumer/kanto-gear) ([Gen 1 recomp](https://github.com/bryanthaboi/gen1recomp)) | Companion panel, as a combined window, a separate process, or a phone/browser over Wi-Fi | In-process; [KantoGearBottom](https://github.com/venatrix-ritz/KantoGearBottom) puts the separate window on Armada's bottom gamescope |
| [EmuLnk](https://github.com/EmuLnk/emulnk) | HTML/JS dashboards per game that can also write memory or run macros | Emulator forks send memory over UDP; profiles are JSON memory points from a [content repo](https://github.com/EmuLnk/emulnk-repo) |
Other GAFT companions: Thor Pip-Boy, FNVDS, Grand Theft Companion, FFXII, Terraria, ZomboidDS, Skyrim, Delphis (live Dolphin button guide), PokeMMO Companion, Thor-SpeedrunSplits, DrillPod.
### Patterns that recur
- The bottom screen follows the game on top without the user telling it which game.
- Everything is remembered per game: panel, guide page, mirrored regions, power and FPS rules, control profiles.
- One hardware button shows or hides the panel; holding it switches the bottom screen fully off, not just black.
- Per-screen brightness, a 60/120 Hz switch and an honest FPS readout.
- Live crops of the minimap or HUD.
- Auto-dim of an idle OLED panel.
- The panel never takes focus or priority from the game.
## DroidDeck today
Paths are under [`app/src/main/java/com/droiddeck/launcher/`](../../app/src/main/java/com/droiddeck/launcher/).
**Panels.** [`input/SecondScreenMode.kt`](../../app/src/main/java/com/droiddeck/launcher/input/SecondScreenMode.kt) lists the modes: menu, keyboard + trackpad, terminal, Deck grips + trackpads, profile controls, dashboard and the KDE desktop. [`ui/SecondScreenPresentation.kt`](../../app/src/main/java/com/droiddeck/launcher/ui/SecondScreenPresentation.kt) hosts them in a `Presentation`, with the bar in [`ui/BottomScreenBar.kt`](../../app/src/main/java/com/droiddeck/launcher/ui/BottomScreenBar.kt). The last mode is remembered once for game sessions and once for desktop sessions (`SessionPrefs.secondScreenPanel`), not per game. Outside a session the launcher shows [`ui/DualScreenPanel.kt`](../../app/src/main/java/com/droiddeck/launcher/ui/DualScreenPanel.kt).
**Dashboard.** [`ui/BottomDashboard.kt`](../../app/src/main/java/com/droiddeck/launcher/ui/BottomDashboard.kt) has In-game stats, Downloads, Screenshots and Chat & voice. The tab is remembered per session and jumps to stats when a game starts. A strip of metrics ([`ui/BottomStrip.kt`](../../app/src/main/java/com/droiddeck/launcher/ui/BottomStrip.kt)) can sit on the other tabs.
**Displays.** [`input/DualScreen.kt`](../../app/src/main/java/com/droiddeck/launcher/input/DualScreen.kt) finds built-in presentation displays with their own touch panel. Sessions support Auto, On, Swapped (game on the bottom, [`ui/BottomGameScreen.kt`](../../app/src/main/java/com/droiddeck/launcher/ui/BottomGameScreen.kt)) and Off. The game is rendered by our compositor into a `SurfaceView` we own, not by a separate activity. [`input/BottomScreenGuests.kt`](../../app/src/main/java/com/droiddeck/launcher/input/BottomScreenGuests.kt) yields the screen when another app takes it.
**Data already available.**
- Frame times from gamescope's ring buffer ([`hud/GameFrames.kt`](../../app/src/main/java/com/droiddeck/launcher/hud/GameFrames.kt)), with lows, graph, focused app and refresh rate.
- Device metrics ([`hud/HudMetrics.java`](../../app/src/main/java/com/droiddeck/launcher/hud/HudMetrics.java)): CPU/GPU load, clocks and temperatures, RAM, VRAM, network, battery with a runtime estimate, fan.
- Game telemetry ([`session/GameTelemetry.kt`](../../app/src/main/java/com/droiddeck/launcher/session/GameTelemetry.kt)): racing UDP, War Thunder over local HTTP, Elite Dangerous status file.
- Steam downloads from app manifests and `content_log.txt`, screenshots from DroidDeck and Steam, Steam chat in a WebView with the web-login cookies.
- `AgentGuest.steamEval` runs `SteamClient.*` in Steam's UI. Only offline mode and live shortcuts use it today.
- Per-game profiles ([`session/SelectedGameProfile.kt`](../../app/src/main/java/com/droiddeck/launcher/session/SelectedGameProfile.kt)) that follow the game Steam has focused (`GameProfileFollowState`).
**Gaps.**
- The panel does not follow the game: no per-game mode, tab or control layout.
- With no game running, the stats card measures the Steam client.
- No Steam achievements, friends or notifications on the bottom screen. Achievements exist only for Epic, GOG and EA. The 0.7.0 notes mention a notifications page that no longer exists.
- No way to switch the bottom panel fully off or dim it when idle.
- [`settings-map.md`](../settings-map.md) lists only "Dual screen launcher". Dual screen sessions, Show the game on, Bottom screen controls in games, Bottom screen HUD, Strip on every tab and Physical controls can use bottom screen are missing.
DroidDeck already has more on the bottom screen than any other project that runs PC games. What it lacks is context: it does not react to what is on top.
## Proposals
Ordered by value for effort. Each is independent unless noted.
### 1. Idle home page
When no game is focused, replace the Steam-client FPS card with a page about the game highlighted in Steam: art, play time, last played, achievement progress, and Play / Stream buttons. Add downloads in progress and friends online.
- Source: the Big Picture selection and app details through `steamEval`, as ArmadaLive does over the CEF port. Art from the existing `SteamGameArt`.
- Open question: which `SteamClient` call or store gives the focused library item most reliably across client updates. ArmadaLive lists this as fragile; we need a fallback to the most recent game.
### 2. Per-game panel memory
Remember the bottom mode, dashboard tab and control layout per Steam app id, and restore them when that game gains focus. Fall back to today's global choice.
- Source: the focus already tracked for `GameProfileFollowState`. Store next to the game profile so Reset clears it.
- Applies to swapped mode too, where the panel is on the top screen.
### 3. Steam achievements and notifications
An achievements page for the running game (progress, recent unlocks, locked list with hidden descriptions behind a tap) and a notifications page (friends, invites, downloads finished).
- Source: `steamEval` against Steam's UI stores; the Steam Web API as a fallback for achievements when the client is offline.
- Matches the existing Epic, GOG and EA achievement readers so all stores look the same.
### 4. Quick tiles and per-game rules
Rearrangeable tiles on the dashboard: FPS limit, 60/120 Hz, per-screen brightness, frame generation, screen effects, screenshot, swap screens, bottom screen off. A "Keep for this game" action saves the value into the game profile; settings that can make the device unusable revert after 15 s unless confirmed.
- Most of these are already per-game somewhere (frame generation, screen effects, FPS limit for non-Steam games). This exposes them where the user is looking during play.
### 5. Bottom screen off and auto-dim
- A real off state for the bottom panel during a game (the backlight off, not a black Presentation), toggled from the bar or a button hold.
- Dim after a period without touch, wake on touch. Off by default for the trackpad and keyboard modes.
- Investigate which hardware buttons we can claim on the Thor and Duo without fighting the stock assistant.
### 6. Region mirror from our compositor
Crop rectangles of the game image (minimap, HUD, ability bars) onto the bottom screen, saved per game, optionally hidden on the top screen. Other Thor tools need MediaProjection or a privileged helper and cannot hide the original; our compositor has the game image before display, so it can do both with no permission prompt. Recommended path: a second output in `vk_present` that blits region sub-rectangles, with zero-copy layers later.
Details: [bottom-screen-region-mirror.md](bottom-screen-region-mirror.md).
### 7. Guides tab
A per-game tab with Steam Community guides for the exact app id, Steam achievements as a spoiler-safe checklist, the game's wiki and fixes (found through Wikidata), saved pages for offline use, and a workspace that reopens at the last section. It must never take focus from the game, and pauses pages it is not showing.
Details: [bottom-screen-guides.md](bottom-screen-guides.md).
### 8. Companion API for PC games
Let mods running in Proton drive native bottom-screen pages over loopback. Thor Pip-Boy (Fallout 4) and Grand Theft Companion (GTA) already run against DroidDeck as separate apps, and the Stardew, Skyrim and RimWorld ecosystems have servers we can adapt to. Plan: adapters for those first, then DroidDeck's own token-authenticated protocol with declarative pages and normalized state keys, then "run on bottom", then memory profiles only if needed. The existing racing, War Thunder and Elite Dangerous telemetry is the first set of built-in adapters.
Details: [bottom-screen-companion-api.md](bottom-screen-companion-api.md).
## Related fixes
- Add the missing dual-screen settings to `SettingsIndex` and regenerate [`settings-map.md`](../settings-map.md).
- Reproduce a first install on a Thor from a clean state, including with Steam on the SD card, against 0.7.11 to confirm the reported freeze is gone.
-11
View File
@@ -93,7 +93,6 @@ static char **prepare_ddnatv_env(char *const envp[], const char *real_exe, const
// are compared (this was 13 strncmp() calls for each of the 30 or so variables)
int has_nt = 0;
int has_binds = 0;
int has_binds_kernel = 0;
int has_hostname = 0;
int has_link_root = 0;
int has_exec_loader = 0;
@@ -122,7 +121,6 @@ static char **prepare_ddnatv_env(char *const envp[], const char *real_exe, const
if (strncmp(e, "DDNATV_ROOT=", 12) == 0) has_root = 1;
else if (strncmp(e, "DDNATV_NT=", 10) == 0) has_nt = 1;
else if (strncmp(e, "DDNATV_BINDS=", 13) == 0) has_binds = 1;
else if (strncmp(e, "DDNATV_BINDS_KERNEL=", 20) == 0) has_binds_kernel = 1;
else if (strncmp(e, "DDNATV_PRELOAD=", 15) == 0) has_preload_list = 1;
else if (strncmp(e, "DDNATV_HOSTNAME=", 16) == 0) has_hostname = 1;
else if (strncmp(e, "DDNATV_LINK_ROOT=", 17) == 0) has_link_root = 1;
@@ -257,15 +255,6 @@ static char **prepare_ddnatv_env(char *const envp[], const char *real_exe, const
new_env[dst++] = str;
}
}
if (!has_binds_kernel && g_binds_kernel) {
size_t kernel_len = strlen(g_binds_kernel);
char *kernel = malloc(20 + kernel_len + 1);
if (kernel) {
memcpy(kernel, "DDNATV_BINDS_KERNEL=", 20);
memcpy(kernel + 20, g_binds_kernel, kernel_len + 1);
new_env[dst++] = kernel;
}
}
// This process looked for the ARM translator's files and found none: the programs it starts
// need not look again (it takes a look at /proc/self/fd in each of them, see privileged.c)
if (!has_nt && g_no_translator) {
+9 -91
View File
@@ -14,36 +14,15 @@ static size_t g_ddnatv_root_len = 0;
// The path the kernel reports for [path] (/proc/self/fd, getcwd(), realpath()): for a targetSdk 30+
// app, Android's own /data/user/0 is a link to /data/data, so the app's paths are not what the kernel
// gives back for them. Into out, or path itself when it cannot be resolved; returns out's length.
static char *(*libc_realpath)(const char *, char *) = NULL;
static long (*libc_syscall)(long, ...) = NULL;
static void ddnatv_resolve_libc(void) {
static size_t ddnatv_kernel_path(const char *path, size_t len, char *out, size_t outsz) {
static char *(*libc_realpath)(const char *, char *) = NULL;
if (!libc_realpath) libc_realpath = (char *(*)(const char *, char *))dlsym(RTLD_NEXT, "realpath");
if (!libc_syscall) libc_syscall = (long (*)(long, ...))dlsym(RTLD_NEXT, "syscall");
}
static size_t ddnatv_resolve_path(const char *path, size_t len, char *out, size_t outsz, int *found) {
ddnatv_resolve_libc();
char given[PATH_MAX];
if (len >= sizeof(given)) len = sizeof(given) - 1;
memcpy(given, path, len);
given[len] = '\0';
char resolved[PATH_MAX];
const char *use = given;
int fd = libc_syscall && given[0] == '/' && strncmp(given, "/proc/", 6) != 0
? (int)libc_syscall(SYS_openat, AT_FDCWD, given, O_PATH | O_CLOEXEC) : -1;
if (fd >= 0) {
char link[32];
snprintf(link, sizeof(link), "/proc/self/fd/%d", fd);
ssize_t n = libc_syscall(SYS_readlinkat, AT_FDCWD, link, resolved, sizeof(resolved) - 1);
libc_syscall(SYS_close, fd);
if (n > 0 && resolved[0] == '/') {
resolved[n] = '\0';
use = resolved;
}
}
if (use == given && libc_realpath && libc_realpath(given, resolved)) use = resolved;
if (found) *found = use != given;
const char *use = (libc_realpath && libc_realpath(given, resolved)) ? resolved : given;
size_t n = strlen(use);
if (n >= outsz) n = outsz - 1;
memcpy(out, use, n);
@@ -51,10 +30,6 @@ static size_t ddnatv_resolve_path(const char *path, size_t len, char *out, size_
return n;
}
static size_t ddnatv_kernel_path(const char *path, size_t len, char *out, size_t outsz) {
return ddnatv_resolve_path(path, len, out, outsz, NULL);
}
static void ddnatv_set_root(const char *root, size_t len) {
if (!root) len = 0;
if (len > 0) len = ddnatv_kernel_path(root, len, g_ddnatv_root, sizeof(g_ddnatv_root));
@@ -70,14 +45,12 @@ struct ddnatv_bind {
size_t src_len, dst_len;
int identity;
int links;
int resolved;
int order; // position in DDNATV_BINDS: the earlier of two mounts of one folder is its guest path
};
// as many as the session has: a fixed table dropped what came after its 128th entry
static struct ddnatv_bind *g_binds = NULL;
static int g_nbinds = 0;
static char *g_binds_raw = NULL;
static char *g_binds_kernel = NULL;
// The session's host name (DDNATV_HOSTNAME), what proot put in uname(): Android's kernel says "localhost"
static char g_hostname[65];
// A Flatpak sandbox's: the session's rootfs (DDNATV_LINK_ROOT), whose hook stored absolute guest
@@ -91,18 +64,7 @@ static int ddnatv_bind_longer_first(const void *a, const void *b) {
return (y->dst_len > x->dst_len) - (y->dst_len < x->dst_len);
}
static size_t ddnatv_append(char *out, size_t outsz, size_t used, const char *s, size_t len);
static uint64_t ddnatv_hash(const char *s) {
uint64_t h = 1469598103934665603ULL;
for (; *s; s++) {
h ^= (unsigned char)*s;
h *= 1099511628211ULL;
}
return h;
}
static void ddnatv_load_binds(const char *spec, const char *known) {
static void ddnatv_load_binds(const char *spec) {
if (!spec || !spec[0]) return;
char *raw = strdup(spec);
char *copy = strdup(spec);
@@ -111,47 +73,18 @@ static void ddnatv_load_binds(const char *spec, const char *known) {
size_t count = 1;
for (const char *c = spec; *c; c++) count += *c == '|';
g_binds = calloc(count, sizeof(*g_binds));
const char **given = calloc(count, sizeof(*given));
if (!g_binds || !given) { free(g_binds); g_binds = NULL; free(given); free(raw); free(copy); return; }
char hash[17];
snprintf(hash, sizeof(hash), "%016llx", (unsigned long long)ddnatv_hash(spec));
char *cache = known && strncmp(known, hash, 16) == 0 && known[16] == '|' ? strdup(known + 17) : NULL;
char *next = cache;
if (!g_binds) { free(raw); free(copy); return; }
for (char *entry = strtok_r(copy, "|", &save); entry && (size_t)g_nbinds < count; entry = strtok_r(NULL, "|", &save)) {
char *colon = strchr(entry, ':');
const char *src = entry;
const char *dst = colon ? colon + 1 : entry;
if (colon) *colon = '\0';
if (src[0] != '/' || dst[0] != '/' || strcmp(dst, "/") == 0) continue;
char *cached = next;
if (next) {
char *bar = strchr(next, '|');
if (bar) *bar = '\0';
next = bar ? bar + 1 : NULL;
}
int index = g_nbinds++;
struct ddnatv_bind *b = &g_binds[index];
given[index] = src;
struct ddnatv_bind *b = &g_binds[g_nbinds++];
char kernel_src[PATH_MAX];
if (strcmp(src, dst) != 0) {
if (cached && cached[0] == '/') {
src = cached;
b->resolved = 1;
} else {
for (int j = 0; j < index && !b->resolved; j++) {
if (g_binds[j].resolved && strcmp(given[j], src) == 0) {
src = g_binds[j].src;
b->resolved = 1;
}
}
if (!b->resolved) {
ddnatv_resolve_path(src, strlen(src), kernel_src, sizeof(kernel_src), &b->resolved);
const char *lead = src;
while (lead[0] == '/' && lead[1] == '/') lead++;
if (strncmp(lead, "/proc/", 6) == 0 || strchr(kernel_src, '|')) b->resolved = 0;
if (strncmp(kernel_src, "/proc/", 6) != 0 || kernel_src[6] < '0' || kernel_src[6] > '9') src = kernel_src;
}
}
ddnatv_kernel_path(src, strlen(src), kernel_src, sizeof(kernel_src));
if (strncmp(kernel_src, "/proc/", 6) != 0 || kernel_src[6] < '0' || kernel_src[6] > '9') src = kernel_src;
}
b->src = strdup(src);
b->dst = strdup(dst);
@@ -160,23 +93,8 @@ static void ddnatv_load_binds(const char *spec, const char *known) {
while (b->dst_len > 1 && b->dst[b->dst_len - 1] == '/') b->dst[--b->dst_len] = '\0';
while (b->src_len > 1 && b->src[b->src_len - 1] == '/') b->src[--b->src_len] = '\0';
b->identity = strcmp(b->src, b->dst) == 0;
b->order = index;
b->order = g_nbinds - 1;
}
size_t size = 17;
for (int i = 0; i < g_nbinds; i++) size += 1 + (g_binds[i].resolved ? g_binds[i].src_len : 0);
long page = sysconf(_SC_PAGESIZE);
char *table = size + 21 <= (size_t)(page > 0 ? page : 4096) * 32 ? malloc(size + 1) : NULL;
if (table) {
size_t used = ddnatv_append(table, size + 1, 0, hash, 16);
for (int i = 0; i < g_nbinds; i++) {
used = ddnatv_append(table, size + 1, used, "|", 1);
if (g_binds[i].resolved) used = ddnatv_append(table, size + 1, used, g_binds[i].src, g_binds[i].src_len);
}
if (!known || strcmp(known, table) != 0) setenv("DDNATV_BINDS_KERNEL", table, 1);
g_binds_kernel = table;
}
free(cache);
free(given);
free(copy);
qsort(g_binds, (size_t)g_nbinds, sizeof(g_binds[0]), ddnatv_bind_longer_first);
g_binds_raw = raw;
+1 -2
View File
@@ -36,7 +36,7 @@ static void init_ddnatv_hook(void) {
}
}
}
ddnatv_load_binds(getenv("DDNATV_BINDS"), getenv("DDNATV_BINDS_KERNEL"));
ddnatv_load_binds(getenv("DDNATV_BINDS"));
const char *mount_table = getenv("DDNATV_MOUNTINFO");
if (mount_table && mount_table[0] == '/' && strlen(mount_table) < sizeof(g_mount_table))
ddnatv_copy_cstr(g_mount_table, sizeof(g_mount_table), mount_table);
@@ -228,7 +228,6 @@ static void adopt_forwarded_fds(void) {
__attribute__((constructor(103))) static void init_ddnatv_hook_early(int argc, char **argv) {
adopt_forwarded_fds();
ddnatv_resolve_libc();
init_ddnatv_hook();
compact_loader_args(argc, argv);
// The kernel names the process after what it executed, the rootfs ld.so: process monitors, and
+2 -89
View File
@@ -42,27 +42,6 @@ int main(int argc, char **argv) {
if (fd >= 0) close(fd);
continue;
}
if (strncmp(argv[i], "exec-without:", 13) == 0) {
extern char **environ;
char *program = strchr(argv[i] + 13, '=');
if (!program) continue;
size_t n = 0, len = (size_t)(program++ - (argv[i] + 13));
while (environ[n]) n++;
char **env = calloc(n + 1, sizeof(char *));
size_t used = 0;
for (size_t k = 0; k < n; k++)
if (strncmp(environ[k], argv[i] + 13, len) != 0 || environ[k][len] != '=') env[used++] = environ[k];
char *args[] = {program, "env:DDNATV_BINDS_KERNEL", NULL};
fflush(stdout);
pid_t pid = fork();
if (pid == 0) {
execve(program, args, env);
_exit(127);
}
waitpid(pid, NULL, 0);
free(env);
continue;
}
if (strncmp(argv[i], "fork:", 5) == 0) {
fflush(stdout);
pid_t pid = fork();
@@ -184,8 +163,6 @@ class NativeHookMountTest(unittest.TestCase):
(cls.links / "real/sub/deeper/more/leaf.txt").write_text("leaf")
os.symlink("real", cls.links / "dir")
os.symlink(str(cls.links / "real"), cls.links / "hostdir")
(cls.links / "real|data").mkdir()
os.symlink(str(cls.links / "real|data"), cls.links / "barlink")
os.symlink("/etc/hostname", cls.links / "guest")
os.symlink("real/sub/file.txt", cls.links / "file")
os.symlink("/mnt/links/real", cls.links / "real/up")
@@ -201,12 +178,10 @@ class NativeHookMountTest(unittest.TestCase):
def tearDownClass(cls):
cls.tmp.cleanup()
def run_probe(self, *args, binds=None, mounts=None, syscalls=False, table=None):
def run_probe(self, *args, binds=None, mounts=None, syscalls=False):
if binds is None:
binds = f"{self.library}:/mnt/library|{self.private}:/mnt/private|{self.eqlen_src}:{self.eqlen_dst}"
hook_env = {"DDNATV_ROOT": str(self.root), "DDNATV_BINDS": binds, "LD_PRELOAD": str(self.hook)}
if table is not None:
hook_env["DDNATV_BINDS_KERNEL"] = table
if mounts is not None:
table = Path(self.tmp.name) / f"mountinfo-{len(list(Path(self.tmp.name).glob('mountinfo-*')))}"
table.write_text("".join(f"{i + 20} 1 0:{i + 40} / {point} rw - {kind} {source} rw\n"
@@ -220,7 +195,7 @@ class NativeHookMountTest(unittest.TestCase):
if syscalls and not shutil.which("strace"):
self.skipTest("no strace")
if syscalls:
cmd = ["strace", "-f", "-qq", "-e", "trace=openat,readlinkat,newfstatat,fstatat64,statx"]
cmd = ["strace", "-f", "-qq", "-e", "trace=readlinkat,newfstatat,fstatat64,statx"]
cmd += [arg for key, value in hook_env.items() for arg in ("-E", f"{key}={value}")]
else:
cmd = []
@@ -231,68 +206,6 @@ class NativeHookMountTest(unittest.TestCase):
result = {line.split("\t")[0]: line.split("\t")[1:] for line in out.stdout.splitlines()}
return (result, out.stderr) if syscalls else result
def bind_table(self, binds, *sources):
h = 1469598103934665603
for byte in binds.encode():
h = ((h ^ byte) * 1099511628211) & 0xFFFFFFFFFFFFFFFF
return "%016x" % h + "".join("|" + source for source in sources)
def test_a_bind_source_through_a_link_is_resolved_once_and_handed_to_children(self):
binds = f"{self.links}/hostdir:/mnt/viahost|{self.links}/hostdir:/mnt/again|/dev:/dev"
out, log = self.run_probe("cd:/mnt/viahost/sub/", "env:DDNATV_BINDS_KERNEL", binds=binds, syscalls=True)
self.assertEqual(["/mnt/viahost/sub"], out["cd:/mnt/viahost/sub/"])
real = os.path.realpath(self.links / "real")
self.assertEqual([self.bind_table(binds, real, real, "")], out["env:DDNATV_BINDS_KERNEL"])
self.assertEqual(1, log.count(f'"{self.links}/hostdir"'))
def test_a_child_given_the_bind_spec_without_its_table_gets_the_table(self):
binds = f"{self.links}/hostdir:/mnt/viahost"
child = self.root / "child-probe"
subprocess.run([self.cc, "-static", "-O1", "-o", str(child), str(self.probe) + ".c"], check=True)
try:
subprocess.run([str(child)], capture_output=True, timeout=60)
except OSError:
self.skipTest("the host cannot start the probe's architecture directly")
out =self.run_probe("exec-without:DDNATV_BINDS_KERNEL=/child-probe", binds=binds)
self.assertEqual([self.bind_table(binds, os.path.realpath(self.links / "real"))], out["env:DDNATV_BINDS_KERNEL"])
def test_process_specific_bind_sources_are_not_handed_to_children(self):
binds = "/proc/self/fd/0:/dev/stdin|/proc/self/fd:/dev/fd|//proc/self/fd/0:/mnt/input"
out = self.run_probe("env:DDNATV_BINDS_KERNEL", binds=binds)
self.assertEqual([self.bind_table(binds, "", "", "")], out["env:DDNATV_BINDS_KERNEL"])
def test_a_bind_source_whose_real_place_holds_the_separator_is_not_handed_to_children(self):
binds = f"{self.links}/barlink:/mnt/bar"
out = self.run_probe("cd:/mnt/bar/", "env:DDNATV_BINDS_KERNEL", binds=binds)
self.assertEqual(["/mnt/bar"], out["cd:/mnt/bar/"])
self.assertEqual([self.bind_table(binds, "")], out["env:DDNATV_BINDS_KERNEL"])
def test_a_bind_table_too_long_for_the_environment_is_not_handed_to_children(self):
far = self.links.joinpath(*["f" * 200] * 9)
far.mkdir(parents=True, exist_ok=True)
(far / "marker").write_text("far")
if not (self.links / "farlink").is_symlink():
os.symlink(str(far), self.links / "farlink")
binds = "|".join(f"{self.links}/farlink:/mnt/far{n}" for n in range(80))
out = self.run_probe("ls:/mnt/far79", "env:DDNATV_BINDS_KERNEL", binds=binds)
self.assertEqual(["marker"], out["ls:/mnt/far79"])
self.assertEqual(["-"], out["env:DDNATV_BINDS_KERNEL"])
def test_a_handed_down_bind_table_is_used_without_looking_the_sources_up(self):
binds = f"{self.links}/hostdir:/mnt/viahost"
real = os.path.realpath(self.links / "real")
table = self.bind_table(binds, real)
out, log = self.run_probe("cd:/mnt/viahost/sub/", binds=binds, table=table, syscalls=True)
self.assertEqual(["/mnt/viahost/sub"], out["cd:/mnt/viahost/sub/"])
self.assertNotIn(f"{self.links}/hostdir", log)
def test_a_bind_table_for_other_binds_is_ignored(self):
binds = f"{self.links}/hostdir:/mnt/viahost"
stale = self.bind_table(f"{self.library}:/mnt/viahost", str(self.library))
out = self.run_probe("cd:/mnt/viahost/sub/", "env:DDNATV_BINDS_KERNEL", binds=binds, table=stale)
self.assertEqual(["/mnt/viahost/sub"], out["cd:/mnt/viahost/sub/"])
self.assertEqual([self.bind_table(binds, os.path.realpath(self.links / "real"))], out["env:DDNATV_BINDS_KERNEL"])
def readlinks_of(self, log, host):
return [line for line in log.splitlines()
if (m := re.search(r'readlinkat\([^,"]*,\s*"([^"]*)"', line)) and m.group(1) == host]