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

@@ -97,7 +97,7 @@ def write(obj):
return bytes(out)
def shortcut(game, launch_options=""):
def shortcut(game, launch_options=None):
appid = int(game["appid"]) & 0xFFFFFFFF
return {
"appid": struct.unpack("<i", struct.pack("<I", appid))[0],
@@ -106,7 +106,7 @@ def shortcut(game, launch_options=""):
"StartDir": '"%s"' % game["dir"],
"icon": (game.get("art") or {}).get("icon", "") or "",
"ShortcutPath": "",
"LaunchOptions": launch_options,
"LaunchOptions": launch_options if launch_options is not None else (game.get("launch") or ""),
"IsHidden": 0,
"AllowDesktopConfig": 1,
"AllowOverlay": 1,
@@ -122,7 +122,10 @@ def shortcut(game, launch_options=""):
RECORD = ".droiddeck-shortcuts.json"
AWAY_LIMIT = 256
FIELDS = ("AppName", "Exe", "StartDir", "icon")
FIELDS = ("AppName", "Exe", "StartDir", "icon", "LaunchOptions")
# What the app may change after the shortcut exists. Each follows the app only while Steam still
# has what the app last asked for; a value the user set in Steam's Properties stays.
FOLLOWED = ("StartDir", "LaunchOptions")
def unquoted(value):
@@ -161,6 +164,14 @@ def merge(fresh, current, state, seen):
for field in ("AppName", "icon"):
if current.get(field) == base.get(field):
entry[field] = fresh[field]
# Start in and launch options the app sets: only once there is a record of what it asked for
# before (a first run keeps whatever the shortcut already had), and an older record that did
# not keep launch options means the app asked for none.
if isinstance(state.get("app"), dict):
for field in FOLLOWED:
was = base.get(field, "" if field == "LaunchOptions" else current.get(field))
if fresh[field] != was and current.get(field) == was:
entry[field] = fresh[field]
tags = dict(current["tags"]) if isinstance(current.get("tags"), dict) else {}
if TAG not in tags.values():
slot = 0
@@ -215,7 +226,7 @@ def reconcile(existing, wanted, seen, record):
entry = ours[index]
state[str(appid & 0xFFFFFFFF)] = {
"app": {field: wanted[appid][field] for field in FIELDS},
"steam": {"Exe": entry.get("Exe", ""), "StartDir": entry.get("StartDir", "")},
"steam": {field: entry.get(field, "") for field in ("AppName", "Exe", "StartDir", "LaunchOptions")},
"rev": rev,
}
return kept, ours, {"games": state, "away": away}