Games: revamped add games feature (#492)

Adding and managing your own (non-Steam) games moves out of the Steam
settings into the Games tab, and works like Steam's own non-Steam
Properties.

- A + beside "Games N" opens a compact in-app picker: the storage first,
  then that storage's root, every folder, .exe files only. Picking an exe
  adds the game with its name, art, Custom badge and Steam shortcut.
- "Add all games in this folder" adds every game folder inside at once.
  A summary opens immediately and fills in as each game is found, with a
  "?" where the exe was a close call and a red X to remove a game.
- An edit button on each Custom game opens its editor: Name, Target
  (ranked exes, Other exe…), Start in, Launch options, the four pieces of
  art with thumbnails, and Remove. Edits go through the same Steam
  shortcut, so the appid never changes and nothing duplicates.
- Art chooser per piece: images in the game folder, Steam's official art,
  SteamGridDB alternatives, your own image, or back to automatic.
- Finding the exe: up to five folders deep, every exe scored (name match,
  Unreal -Shipping builds, bin folders and size up; launchers, crash
  reporters, installers, redistributables and depth down).
- Real titles from the game's files (Steam manifest, GOG info, the exe's
  version info), keeping the folder's spacing when both spell the same
  title, underscores read as spaces.
- Art: the exact Steam appid when the game names one, strict name
  matches otherwise, Steam's hashed asset paths for newer games,
  SteamGridDB as a fallback (built-in key from the SGDB_API_KEY secret,
  optional own key in Setup, sealed with the Keystore), and a cover made
  from the exe's icon when nothing else has one.
- Removing a game is instant and keeps its files; adding it again brings
  it back. Steam's shortcut list is rewritten once, in the background.
- The Games section is gone from Steam settings; folders added before
  keep listing their games. Artwork switch and SteamGridDB key are in
  Setup.
This commit is contained in:
The412Banner authored and GitHub committed 2026-10-09 19:50:03 -04:00
1 parent e0a7ce4f88
commit a5fd64f9f2
45 files changed
+4175 -295

No files matched your search

+77
View File
@@ -0,0 +1,77 @@
# Added games
Windows games the user adds to DroidDeck's Games tab, each a non-Steam shortcut in the
Steam client that runs under `droiddeck-proton-arm64`. They show with the Custom chip.
## Adding
- **+ beside "Games N"** opens the in-app picker (`ExePickerDialog`, never Android's
system picker): the storage rows (Internal storage, each card, free space), then the
chosen storage from its root: every folder A-Z (dot-folders hidden, unreadable ones
greyed), `.exe` files only. The dialog keeps the width it opened with; long names are cut
short; it grows to 70% of the screen and scrolls. Red X closes; B / Back goes up a
folder, then closes.
- **Picking an exe** (`AddedGames.addExe`): the game it already is gets selected; an exe in
a listed game's folder becomes that game's target; otherwise the exe's folder becomes a
game (`files/added-exes.json`), registered at once (the listing the shortcuts writer
reads, and a running client over DevTools) and selected. A path the session cannot see
(internal storage maps to `/root/Storage`; cards only through Games folders, the Steam
library and store roots) is refused with one line.
- **"Add all games in this folder"** (top row of a folder with subfolders,
`AddedGames.addFolder`): each subfolder with an exe becomes a game with
`GameExePicker`'s best exe, kept as an entry of its own (not a Games folder); subfolders
already listed are counted, not added. A summary follows: games added, how many were
there already, one row per game (cover, name, exe, "?" when unsure); a row opens that
game's editor, straight on Target when unsure, with back to the summary.
- Games folders added before this (Steam settings had a Games section) keep listing their
games; there is no place to add a new one.
## Exe and name
`GameExePicker` walks up to five folders down (nearest first, 400 entries, no symlinks,
past installer / redistributable / extras folders), drops junk exe names and scores the
rest (named after the folder, Unreal `-Shipping` and `Binaries/Win64`, `bin/`, launchers
and junk lower, deeper lower, bigger higher). Best under 60, or a runner-up within 15:
uncertain, shown as "?". `GameIdentifier` / `PeVersionInfo` give the title (Steam
manifest by installdir, GOG info, the exe's version resource), else the folder name. The
shortcut appid is stored per folder at the first scan and never changes after.
## Editor
The ✎ on a Custom game's page (`AddedGameEditor`) mirrors Steam's Properties for a
non-Steam game: Name, Target (ranked exes, "?", Other exe… opening the picker in the
game's folder), Start in (automatic = the exe's folder), Launch options, Artwork (Cover,
Background, Logo, Icon, each with its thumbnail and source), and Remove (two presses; the
files stay; adding it again brings it back). `AddedGameEdits` writes each change through
the same shortcut: the listing (`name`, `exe`, `dir`, `launch`, `art`, the stored `appid`)
and, with a client running, `SetShortcutName` / `Exe` / `StartDir` / `LaunchOptions` and
`SetCustomArtworkForApp` / `SetShortcutIcon` on that appid. A new target updates the
existing shortcut; there is never a second one.
The shortcuts writer (`droiddeck-steam-shortcuts`) keeps what the user set in Steam: a
field follows the app only while Steam still has what the app last asked for. It records
Steam's AppName, Exe, StartDir and LaunchOptions in `.droiddeck-shortcuts.json`; a scan
takes a Steam-side edit over as the app's own once (`AddedGames.adoptSteamEdits`), so one
value holds on both sides.
## Art
Automatic: the game folder's own images, then Steam (the appid the files name, else a
store search whose result has the same name), then SteamGridDB, then the exe's icon. The
art chooser (an Artwork row) shows the game folder's images, Steam's official piece and
SteamGridDB's best few (fetched when it opens); a tap applies one, "Pick image…" takes a
file through the same picker (png, jpg, jpeg, webp, ico), "Reset to automatic" drops the
choice. A choice is a copy in `files/added-art/<appid>/chosen-<slot>.<ext>`, its source in
the preferences.
Setup › Launcher › Games holds the Artwork switch (automatic fetching) and the
SteamGridDB API key: the user's own, sealed with `CredentialCipher`, wins over the build's
(`BuildConfig.SGDB_API_KEY` from the `SGDB_API_KEY` secret); with neither, SteamGridDB is
skipped.
## Tests
`AddedExesTest`, `AddedGameEditsTest` (bulk add and skip, edits to the listing on a stable
appid, Steam-side read-back, art choice and reset), `AddedGamesCandidatesTest`,
`AddedGameArtLookupTest` (key precedence), `GameIdentifierTest`, `PickListingTest`, and
`tools/tests/test_steam_shortcuts.py` for the writer.
+26
View File
@@ -7,6 +7,32 @@ the timeline, then lessons and backlog. Companion to the README (what the app *d
---
## 2026-10-09 - `feat/games-add-edit`: add games from the Games tab, edit them like Steam's Properties
- **Steam ⚙ settings:** the Games section is gone (it was a feature, not a setting). Games
folders added before keep listing their games.
- **+ beside "Games N":** a compact in-app picker (storage step, then the storage root; every
folder A-Z, unreadable ones greyed; `.exe` only; width fixed at opening; red X; B goes up).
Picking an exe adds the game (name from `GameIdentifier`, art, Custom chip, Steam shortcut via
the listing and the running client, Start in = exe folder) and selects it; an exe in a listed
game switches its target; the same exe again selects it; a path the session cannot see is
refused. Internal storage anywhere now maps to `/root/Storage`.
- **"Add all games in this folder":** each subfolder with its best exe (`GameExePicker`, depth
5, "?" when unsure), listed ones skipped, then a summary (added, already there, rows that open
the editor with back to the summary).
- **✎ editor** on a Custom game: Name, Target (ranked, "?", Other exe…), Start in, Launch
options, Artwork (Cover, Background, Logo, Icon with thumbnails and sources; chooser with the
game folder, Steam and SteamGridDB; Pick image…; Reset to automatic), Remove (two presses, files
kept). Every edit goes through the same shortcut on its stored appid (listing + live DevTools);
the writer keeps Steam-side edits and records them, and the app takes them over once.
- **Setup:** Artwork switch and SteamGridDB API key (user key sealed with the Keystore, wins over
`BuildConfig.SGDB_API_KEY` from the `SGDB_API_KEY` secret).
- Brought over from `feat/added-games-remove` (not merged): `GameExePicker`, `GameIdentifier` +
`PeVersionInfo`, the art and SteamGridDB work, the build secret, the + and the picker.
- Docs: `docs/development/added-games.md`. Tests: `AddedExesTest`, `AddedGameEditsTest`,
`AddedGamesCandidatesTest`, `AddedGameArtLookupTest`, `GameIdentifierTest`, `PickListingTest`,
`AddedGamesRemoveTest`, `test_steam_shortcuts.py`. Not yet on a device.
## 2026-10-09 - `feat/store-credentials-keystore`: store sign-ins sealed with the Android Keystore
- **What:** `filesDir/stores/<store>/credentials.json` (GOG, Epic, Amazon: tokens, ids, names,