Steam Owned Games Importing (#62)

* Add ownership-aware Steam game folder imports

* Fix Steam title lookup and installed game manifests

---------

Co-authored-by: MaxsTechReview <6025299+maxjivi05@users.noreply.github.com>
This commit is contained in:
MaxsTechReviewandMaxsTechReview authored and GitHub committed 2026-09-28 18:13:08 -04:00
1 parent 221644e8be
commit d8d375cb9a
12 files changed
+612 -41

No files matched your search

+62
View File
@@ -0,0 +1,62 @@
# Steam game imports
Second Library still registers the selected Steam library. It now also scans Windows
executables in its immediate game subfolders and `steamapps/common`, using the same
importer as Added Games. Existing Steam manifests are preserved.
`bannerlator-steam-games watch` runs beside the client. It identifies a game by an
existing manifest's install directory, a `steam_appid.txt` beside the game or selected
executable, or a unique normalized title from Steam's store search with an explicit
country. Matching also accepts the terminal Windows Edition and INTERGRADE suffixes;
multiple matches still remain unresolved. Artwork's fuzzy matching is deliberately not
used for identity. Ambiguous or unresolved titles remain non-Steam games.
Ownership comes from the running native ARM64 client's `BIsSubscribedApp`, through
versioned SteamClient020 / SteamUser021 / STEAMAPPS_INTERFACE_VERSION008 interfaces. The
helper gets the account from that connection, not from a public profile. No API key,
password, profile visibility change, or CEF debugging port is needed. Each probe runs in
a bounded subprocess so library failures cannot crash the importer or client.
The resulting snapshot is stored under that account's `userdata/<id>/config` and
refreshed every 30 seconds while logged in. Title lookups retry every five minutes and
when the source changes, so an early network failure does not end the watcher. Changed
status and probe failures are written to the session log. Startup and post-exit import
use the last successful snapshot for the selected account. A newly identified title
therefore starts as a shortcut and becomes a Steam entry after Steam exits and starts
again. An unavailable client or offline first launch falls back to shortcuts; existing
snapshots remain usable offline. Steam still enforces the current license at launch.
For a confirmed game without a manifest, the importer links the source folder into the
internal Steam library and writes an installed manifest with `Universe=1` and
`StateFlags=4`. Steam ignores manifests without the universe field. This registers
existing files; it does not assert a verified build ID or depot manifest. Steam can
still require verification, updates or redistributables. Steam updates and uninstall
operate on the linked game files, so imported folders must be writable. Existing Steam
manifests and directories are preserved. Only the exact minimal manifests generated by
the earlier importer are migrated, with the matching source symlink still present. If
registration fails, the game remains a shortcut. Once Steam takes over an install,
manage it in Steam; forgetting an Added Games folder only removes its shortcuts.
The account's `.droiddeck-routes.json` maps shortcut IDs to real Steam app IDs so the
Android launcher uses the same title and Proton prefix as Steam. Other accounts do not
inherit those routes. Managed shortcuts are replaced; user-created shortcuts and
unreadable shortcut files are preserved. Both routes use the existing ARM64 Proton
registration.
## Validation
Run `python3 -m unittest discover -s tools/tests -p 'test_*.py'` and Android unit tests.
Tests cover identity and edition matching, network recovery, account isolation,
owned/unowned/unknown routing, legacy manifest migration, manifest preservation,
filesystem collisions, shortcut preservation, and the versioned IPC call/cleanup
contract. On 2026-09-28, the ARM64 Steam client (1790545198) confirmed ownership and
installed status through ISteamApps for Final Fantasy VII Rebirth (2909400), Final
Fantasy VII Remake Intergrade (1462040), and Final Fantasy XV (637650), with all three
install paths resolving to the original second-library folders. The old managed
shortcuts were removed. This verifies library registration, not complete game launches.
Unowned fallback and account isolation are covered by automated tests.
References: [Steam Apps
API](https://partner.steamgames.com/doc/api/ISteamApps#BIsSubscribedApp), [Valve's
versioned interfaces](https://github.com/ValveSoftware/Proton/tree/proton_11.0/lsteamcli
ent/steamworks_sdk_154).