Steam x86-64 client: menus come up, sign-in stays put, games listed once (#1096)

* Steam x86-64 client: menus come up, sign-in stays put, games listed once

Switching the Steam client from arm64 to x86-64 left the client on a blank
screen behind "Downloading the Steam client update 100%", and each switch
signed one of the clients out.

- The x86-64 client is Valve's steamrt64 platform, but it was installed and
  synced from the ubuntu12 manifest, which lags it (1792108788 against
  1792192922). The client was therefore never the arm64 client's build, the
  arm64 web helper was never used, and the client then updated itself in
  place after the helper had been chosen. Install, sync and the build check
  now read the steamrt64 manifest.
- The x86 web helper's GPU process loads libpci, which exits when
  /sys/bus/pci/devices lists a device whose files the app may not read (a
  RedMagic's PCIe root ports). Every GPU process exited with status 1, even
  in software, until Chromium gave up and the menus stayed blank. An empty
  folder is bound over /sys/bus/pci/devices on such devices.
- Steam refuses one client's login token from the other ("Invalid
  Password" for a token the arm64 client signed in with minutes before), so
  copying the newer token at every start signed the other client out. Each
  client now keeps its own token; a client with no accounts only gets the
  other's account list.
- Games could be listed twice: an added game whose folder a Steam import
  already covers is now shown as that Steam game only, a client switch
  drops the old client's imported entries, an import stays one when its
  ownership cannot be confirmed instead of gaining a shortcut beside it,
  and only the client's own library folders count as an install.

* Steam x86-64 client: share the arm64 sign-in again

The x86-64 client refused the arm64 client's login token because it did
not know the account's SteamID: it takes it from Accounts in
config/config.vdf, which this script creates without one. It logged on as
[U:1:0] with a valid token, Steam answered "Invalid Password", and the
client dropped the token and AutoLoginUser, so every switch asked for the
password.

The newer sign-in is copied between the clients again, each start adds
the accounts either client knows to the other's config.vdf, and an
AutoLoginUser or RememberPassword one client lacks is filled in. Device:
the x86 client signs in with the arm64 token on a fresh install and on an
install left signed out, and the arm64 client stays signed in.
This commit is contained in:
MaxsTechReview authored and GitHub committed 2026-10-18 20:38:48 -04:00
1 parent 2016a363f2
commit a105e4e49c
10 files changed
+278 -45

No files matched your search

@@ -291,7 +291,7 @@ def libraries(steam_root):
except OSError:
text = ""
paths = [path.replace("\\\\", "\\") for path in re.findall(r'"path"\s+"((?:[^"\\]|\\.)*)"', text)]
return list(dict.fromkeys([Path(steam_root), Path(LIBRARY)] + [Path(path) for path in paths]))
return list(dict.fromkeys([Path(steam_root)] + [Path(path) for path in paths]))
def ours(manifest, appid):
@@ -311,6 +311,16 @@ def unpark(steamapps):
os.replace(manifest, live)
def seeded(steamapps, game, appid):
target = steamapps / "common" / f"DroidDeck-{appid}"
manifest = steamapps / f"appmanifest_{appid}.acf"
try:
return (target.is_symlink() and target.is_dir() and manifest.is_file() and ours(manifest, appid)
and os.readlink(target) in (game.get("folder", ""), legacy_path(game.get("folder", ""))))
except OSError:
return False
def park(steamapps):
for target in sorted((steamapps / "common").glob("DroidDeck-*")):
appid = target.name.removeprefix("DroidDeck-")
@@ -428,6 +438,9 @@ def route(steam_root, acct, games):
continue
except OSError as error:
print(f"droiddeck-steam-games: import unavailable ({error})")
elif isinstance(appid, int) and 0 < appid < 0x80000000 and seeded(steamapps, game, appid):
routes[str(game["appid"])] = appid
continue
shortcuts.append(game)
try:
park(steamapps)
@@ -8,7 +8,7 @@ ROOTFS_SHA256=2854b06d3ff1b8f6e526135bfb6dd5b7b30ab3ab73e79ae933a3d9fed959a178
CDN=https://client-update.fastly.steamstatic.com
# Must match the -clientbeta droiddeck-session starts this client with (steam_channel).
X64_CHANNEL=steamdeck_publicbeta
MANIFEST=steam_client_${X64_CHANNEL}_ubuntu12
MANIFEST=steam_client_${X64_CHANNEL}_steamrt64
REAL_HOME=${HOME:-/root}
X64_HOME=${BL_X64_HOME:-$REAL_HOME/.droiddeck-x64}
@@ -37,17 +37,17 @@ x64_client_parts() {
/^\t"/ && NF >= 3 && $4 == "" { block = $2 }
$2 == "file" { file[block] = $4 }
$2 == "sha2" { sha[block] = $4 }
END { for (b in file) if (b ~ /_all$/ || b ~ /_ubuntu12$/) print b, file[b], sha[b] }
END { for (b in file) if (b ~ /_all$/ || b ~ /_steamrt64$/) print b, file[b], sha[b] }
' "$1" | sort
}
x64_sync_client() {
local chan cur version work total i block file sum old
chan=$(cat "$STEAM_X64/package/beta" 2>/dev/null || echo "$X64_CHANNEL")
old=$STEAM_X64/package/steam_client_${chan}_ubuntu12.manifest
old=$STEAM_X64/package/steam_client_${chan}_steamrt64.manifest
cur=$(awk -F'"' '$2 == "version" { print $4; exit }' "$old" 2>/dev/null || true)
work=$(mktemp -d)
if ! curl -fsSL "$CDN/steam_client_${chan}_ubuntu12" -o "$work/manifest"; then
if ! curl -fsSL "$CDN/steam_client_${chan}_steamrt64" -o "$work/manifest"; then
rm -rf "$work"; return 0
fi
version=$(awk -F'"' '$2 == "version" { print $4; exit }' "$work/manifest")
@@ -471,7 +471,7 @@ if [ ! -x "$STEAM_X64/steamrt64/steam" ] || [ ! -f "$STEAM_X64/package/droiddeck
/^\t"/ && NF >= 3 && $4 == "" { block = $2 }
$2 == "file" { file[block] = $4 }
$2 == "sha2" { sha[block] = $4 }
END { for (b in file) if (b ~ /_all$/ || b ~ /_ubuntu12$/) print b, file[b], sha[b] }
END { for (b in file) if (b ~ /_all$/ || b ~ /_steamrt64$/) print b, file[b], sha[b] }
' "$work/manifest" | sort > "$work/parts"
[ -s "$work/parts" ] || { step "no client components in $MANIFEST"; exit 1; }
mkdir -p "$STEAM_X64/package"
@@ -910,7 +910,7 @@ x64_exec() {
[ -x "$ARM_STEAM/steamrtarm64/steamwebhelper" ]; then
local chan x86_build arm_build
chan=$(cat "$STEAM_X64/package/beta" 2>/dev/null || echo "$X64_CHANNEL")
x86_build=$(awk -F'"' '$2 == "version" { print $4; exit }' "$STEAM_X64/package/steam_client_${chan}_ubuntu12.manifest" 2>/dev/null || true)
x86_build=$(awk -F'"' '$2 == "version" { print $4; exit }' "$STEAM_X64/package/steam_client_${chan}_steamrt64.manifest" 2>/dev/null || true)
arm_build=$(awk -F'"' '$2 == "version" { print $4; exit }' "$ARM_STEAM/package/steam_client_${chan}_linuxarm64.manifest" 2>/dev/null || true)
if [ -n "$x86_build" ] && [ "$x86_build" = "$arm_build" ]; then
export BL_X64_ARM_WEBHELPER=/usr/local/bin/droiddeck-x64-arm-webhelper
@@ -937,7 +937,7 @@ x64_exec() {
touch "$STEAM_X64/logs/bootstrap_log.txt"
( tail -n0 -F --pid=$$ "$STEAM_X64/logs/bootstrap_log.txt" 2>/dev/null |
grep --line-buffered -oE 'Downloading update \([0-9,]+ of [0-9,]+ KB\)' | sed -u 's/,//g' >&2 ) &
echo "== x86-64 client: ubuntu12 $(x64_manifest_version ubuntu12), steamrt64 $(x64_manifest_version steamrt64) (the client may update itself)" >&2
echo "== x86-64 client: steamrt64 $(x64_manifest_version steamrt64) (the client may update itself)" >&2
x64_webhelper_gpu && { x64_gpu_watch >&2 & }
exec "${BL_FEX:-/usr/local/bin/FEX}" "$STEAM_X64/steamrt64/steam" "$@"
}
@@ -952,6 +952,76 @@ arm, x64, arm_reg, x64_reg = sys.argv[1:5]
FILES = ("config/loginusers.vdf", "local.vdf")
def read(path):
try:
return open(path, encoding="utf-8", errors="surrogateescape").read()
except OSError:
return None
def write(path, text):
open(path, "w", encoding="utf-8", errors="surrogateescape").write(text)
def block(text, name):
m = re.search(r'"%s"\s*\{' % name, text)
if not m:
return None
depth, k = 1, m.end()
while depth and k < len(text):
depth += text[k] == "{"
depth -= text[k] == "}"
k += 1
return m, k
def accounts(root):
text = read(os.path.join(root, "config/config.vdf")) or ""
found = block(text, "Accounts")
if not found:
return {}
return dict(re.findall(r'"([^"]+)"\s*\{\s*"SteamID"\s*"(\d+)"', text[found[0].end():found[1]]))
def add_accounts(root, wanted):
path = os.path.join(root, "config/config.vdf")
text = read(path)
if text is None:
return
have = accounts(root)
missing = {name: sid for name, sid in wanted.items() if name not in have}
if not missing:
return
entries = "".join('\n\t\t\t\t\t"%s"\n\t\t\t\t\t{\n\t\t\t\t\t\t"SteamID"\t\t"%s"\n\t\t\t\t\t}' % item for item in missing.items())
found = block(text, "Accounts")
if found:
text = text[:found[0].end()] + entries + text[found[0].end():]
else:
steam = re.search(r'"Valve"\s*\{\s*"Steam"\s*\{', text)
if not steam:
return
text = text[:steam.end()] + '\n\t\t\t\t"Accounts"\n\t\t\t\t{' + entries + '\n\t\t\t\t}' + text[steam.end():]
write(path, text)
def set_keys(src_reg, dst_reg, force):
st, dt = read(src_reg), read(dst_reg)
if st is None or dt is None:
return
for key in ("AutoLoginUser", "RememberPassword"):
v = re.search(r'"%s"\s*"([^"]*)"' % key, st)
if not v:
continue
if re.search(r'"%s"\s*"' % key, dt):
if force:
dt = re.sub(r'("%s"\s*")[^"]*(")' % key, lambda m: m.group(1) + v.group(1) + m.group(2), dt, count=1)
continue
hkcu = re.search(r'"HKCU"\s*\{\s*"Software"\s*\{\s*"Valve"\s*\{\s*"Steam"\s*\{\n', dt)
if hkcu:
dt = dt[:hkcu.end()] + '\t\t\t\t\t"%s"\t\t"%s"\n' % (key, v.group(1)) + dt[hkcu.end():]
write(dst_reg, dt)
def stamp(root):
if not all(os.path.isfile(os.path.join(root, f)) for f in FILES):
return None
@@ -963,31 +1033,26 @@ def stamp(root):
a, x = stamp(arm), stamp(x64)
if a is None and x is None:
sys.exit(0)
if a is not None and x is not None and abs(a - x) < 1:
sys.exit(0)
if x is None or (a is not None and a > x):
src, dst, sreg, dreg, who = arm, x64, arm_reg, x64_reg, "arm64"
else:
src, dst, sreg, dreg, who = x64, arm, x64_reg, arm_reg, "x86-64"
for f in FILES:
os.makedirs(os.path.dirname(os.path.join(dst, f)), exist_ok=True)
# copy2 keeps the time stamp, so both match until one client signs in again.
shutil.copy2(os.path.join(src, f), os.path.join(dst, f))
if os.path.isfile(sreg):
st = open(sreg, encoding="utf-8", errors="surrogateescape").read()
if not os.path.isfile(dreg):
os.makedirs(os.path.dirname(dreg), exist_ok=True)
shutil.copy2(sreg, dreg)
if a is not None or x is not None:
if x is None or (a is not None and a > x):
src, dst, sreg, dreg, who = arm, x64, arm_reg, x64_reg, "arm64"
else:
dt = open(dreg, encoding="utf-8", errors="surrogateescape").read()
for key in ("AutoLoginUser", "RememberPassword"):
v = re.search(r'"%s"\s*"([^"]*)"' % key, st)
if v and re.search(r'"%s"\s*"' % key, dt):
dt = re.sub(r'("%s"\s*")[^"]*(")' % key, lambda m: m.group(1) + v.group(1) + m.group(2), dt, count=1)
open(dreg, "w", encoding="utf-8", errors="surrogateescape").write(dt)
print("droiddeck-steam-x64: sign-in shared from the %s client (the newer one)" % who)
src, dst, sreg, dreg, who = x64, arm, x64_reg, arm_reg, "x86-64"
copy = a is None or x is None or abs(a - x) >= 1
if copy:
for f in FILES:
os.makedirs(os.path.dirname(os.path.join(dst, f)), exist_ok=True)
# copy2 keeps the time stamp, so both match until one client signs in again.
shutil.copy2(os.path.join(src, f), os.path.join(dst, f))
if os.path.isfile(sreg) and not os.path.isfile(dreg):
os.makedirs(os.path.dirname(dreg), exist_ok=True)
shutil.copy2(sreg, dreg)
set_keys(sreg, dreg, copy)
set_keys(dreg, sreg, False)
add_accounts(dst, accounts(src))
add_accounts(src, accounts(dst))
if copy:
print("droiddeck-steam-x64: sign-in shared from the %s client (the newer one)" % who)
PY
}
+18
View File
@@ -311,6 +311,24 @@ class ImportsTest(unittest.TestCase):
self.assertFalse((self.steam / 'steamapps/appmanifest_42.acf').exists())
self.assertFalse(os.path.lexists(self.steam / 'steamapps/common/DroidDeck-42'))
def test_imported_game_stays_imported_when_ownership_is_unconfirmed(self):
self.snapshot()
imports.route(self.steam, self.acct, [self.game])
for owned, account in [(False, '123'), (True, '456')]:
self.snapshot(owned, account)
self.assertEqual(([], {str(self.game['appid']): 42}), imports.route(self.steam, self.acct, [self.game]))
self.assertTrue((self.steam / 'steamapps/appmanifest_42.acf').is_file())
def test_unlisted_card_library_is_not_another_clients_install(self):
card = self.root / 'card'
(card / 'steamapps').mkdir(parents=True)
(card / 'steamapps/appmanifest_42.acf').write_text('the other client installed it here')
self.snapshot()
with patch.object(imports, 'LIBRARY', str(card)):
self.assertEqual(([], {str(self.game['appid']): 42}), imports.route(self.steam, self.acct, [self.game]))
self.assertTrue((self.steam / 'steamapps/appmanifest_42.acf').is_file())
self.assertEqual(self.folder, (self.steam / 'steamapps/common/DroidDeck-42').resolve())
def test_replaced_game_does_not_inherit_cached_ownership(self):
self.snapshot()
self.exe.write_bytes(b'a different game')
+78
View File
@@ -0,0 +1,78 @@
from pathlib import Path
import os
import subprocess
import tempfile
import unittest
SCRIPT = Path(__file__).resolve().parents[1] / 'linuxfs/overlay/usr/local/bin/droiddeck-steam-x64'
REGISTRY = ('"Registry"\n{\n\t"HKCU"\n\t{\n\t\t"Software"\n\t\t{\n\t\t\t"Valve"\n\t\t\t{\n\t\t\t\t"Steam"\n\t\t\t\t{\n'
'\t\t\t\t\t"language"\t\t"english"\n%s\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n')
CONFIG = ('"InstallConfigStore"\n{\n\t"Software"\n\t{\n\t\t"Valve"\n\t\t{\n\t\t\t"Steam"\n\t\t\t{\n%s'
'\t\t\t\t"CompatToolMapping"\n\t\t\t\t{\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n')
ACCOUNTS = ('\t\t\t\t"Accounts"\n\t\t\t\t{\n\t\t\t\t\t"someone"\n\t\t\t\t\t{\n'
'\t\t\t\t\t\t"SteamID"\t\t"76561198000000001"\n\t\t\t\t\t}\n\t\t\t\t}\n')
def local(token):
entry = '\t\t"abc1"\t\t"%s"\n' % token if token else ''
return '"MachineUserConfigStore"\n{\n\t"ConnectCache"\n\t{\n%s\t}\n}\n' % entry
class X64SignInTest(unittest.TestCase):
def setUp(self):
self.temp = tempfile.TemporaryDirectory()
self.addCleanup(self.temp.cleanup)
self.home = Path(self.temp.name)
self.arm = self.home / '.local/share/Steam'
self.x64 = self.home / '.droiddeck-x64/.local/share/Steam'
for root in (self.arm, self.x64):
(root / 'config').mkdir(parents=True)
(self.home / '.steam').mkdir()
(self.home / '.droiddeck-x64/.steam').mkdir(parents=True)
self.write(self.arm / 'local.vdf', local('00ff'))
self.write(self.arm / 'config/loginusers.vdf', '"users"\n{\n}\n')
self.write(self.arm / 'config/config.vdf', CONFIG % ACCOUNTS)
self.write(self.home / '.steam/registry.vdf', REGISTRY % '\t\t\t\t\t"AutoLoginUser"\t\t"someone"\n')
self.write(self.x64 / 'local.vdf', local(None))
self.write(self.x64 / 'config/loginusers.vdf', '"users"\n{\n}\n')
self.write(self.x64 / 'config/config.vdf', CONFIG % '')
self.write(self.home / '.droiddeck-x64/.steam/registry.vdf', REGISTRY % '')
def write(self, path, text):
path.write_text(text)
def sync(self):
env = dict(os.environ, HOME=str(self.home))
env.pop('XDG_DATA_HOME', None)
env.pop('BL_X64_HOME', None)
return subprocess.run(['bash', str(SCRIPT), '--sync-login'], env=env, capture_output=True, text=True, check=True)
def test_a_refused_x64_sign_in_gets_the_token_account_and_auto_login(self):
self.assertIn('sign-in shared from the arm64 client', self.sync().stdout)
self.assertEqual(local('00ff'), (self.x64 / 'local.vdf').read_text())
self.assertIn('"SteamID"\t\t"76561198000000001"', (self.x64 / 'config/config.vdf').read_text())
self.assertIn('"AutoLoginUser"\t\t"someone"', (self.home / '.droiddeck-x64/.steam/registry.vdf').read_text())
def test_an_earlier_copy_still_gains_the_account_and_nothing_repeats(self):
self.sync()
self.write(self.x64 / 'config/config.vdf', CONFIG % '')
self.write(self.home / '.droiddeck-x64/.steam/registry.vdf', REGISTRY % '')
self.assertNotIn('sign-in shared', self.sync().stdout)
self.assertIn('"76561198000000001"', (self.x64 / 'config/config.vdf').read_text())
self.assertIn('"AutoLoginUser"', (self.home / '.droiddeck-x64/.steam/registry.vdf').read_text())
self.sync()
for root in (self.arm, self.x64):
self.assertEqual(1, (root / 'config/config.vdf').read_text().count('"SteamID"'))
self.assertEqual(1, (self.home / '.droiddeck-x64/.steam/registry.vdf').read_text().count('AutoLoginUser'))
def test_a_newer_x64_sign_in_moves_to_arm64(self):
self.write(self.x64 / 'local.vdf', local('11ee'))
os.utime(self.arm / 'local.vdf', (1, 1))
self.assertIn('from the x86-64 client', self.sync().stdout)
self.assertEqual(local('11ee'), (self.arm / 'local.vdf').read_text())
if __name__ == '__main__':
unittest.main()