fix: find the signed-in Steam account when loginusers.vdf has no MostRecent

droiddeck-steam-shortcuts and AddedGames.accountConfig took the account
marked "MostRecent" in loginusers.vdf, else the only userdata folder.
The arm64 client here writes no MostRecent, so with two accounts in one
install nothing was picked: no added or store game reached
shortcuts.vdf ("no signed-in account yet; nothing written") and Steam
answered their launch with "App configuration unavailable".

Without MostRecent, take the account marked AutoLogin, then the one with
the latest timestamp. Both sides use the same order so the app reads the
config the guest script writes.
This commit is contained in:
Nikolay Nadorichev authored and MaxsTechReview committed 2026-10-24 01:42:20 -04:00
1 parent 473ac666b3
commit 8c86b718a0
4 files changed
+86 -7

No files matched your search

@@ -16,15 +16,20 @@ TAG = "droiddeck-app"
def account_dir(steam_root):
"""The most recent account's userdata folder, else the only one that is not 0."""
"""The signed-in account's userdata folder, else the only one that is not 0. Clients that do not
write MostRecent still mark that account AutoLogin; the latest timestamp breaks the remaining ties."""
users = os.path.join(steam_root, "config", "loginusers.vdf")
recent = None
recent, best = None, None
try:
with open(users, encoding="utf-8", errors="replace") as f:
text = f.read()
for block in re.finditer(r'"(\d{5,})"\s*\{([^}]*)\}', text):
if re.search(r'"MostRecent"\s*"1"', block.group(2)):
recent = int(block.group(1))
stamp = re.search(r'"timestamp"\s*"(\d+)"', block.group(2))
rank = (bool(re.search(r'"MostRecent"\s*"1"', block.group(2))),
bool(re.search(r'"AutoLogin"\s*"1"', block.group(2))),
int(stamp.group(1)) if stamp else 0)
if any(rank) and (best is None or rank >= best):
recent, best = int(block.group(1)), rank
except OSError:
pass
userdata = os.path.join(steam_root, "userdata")