jaydenmilne / steamsync

Tool to automatically add games from the Epic Games Launcher to Steam
GNU Affero General Public License v3.0
157 stars 17 forks source link

Downloaded art no longer displays in Steam #37

Closed idbrii closed 6 months ago

idbrii commented 10 months ago

Awhile ago, I had a Steam client update and then downloaded art no longer displayed in Steam (all downloaded art suddenly disappeared and new art also doesn't appear). I assumed it was a steam bug, but at this point it doesn't seem like they're changing back. It worked for a long time before (even in the new Big Picture), but now it doesn't.

I also tried BoilR and it does work. Looks like steamsync is not using the correct ids. For TMNT Shredder's Revenge on Xbox:

steamsync:

boilr:

So it looks like the naming scheme is the same, but the number is wrong.

Epic games have the same problem. For Adios:

steamsync:

boilr:

So I guess Valve changed the algorithm to generate the numeric id for shortcuts?

I looked a bit in Boilr's revision history but didn't see an obvious commit fix. Probably need to dig into their code to figure it out.

Using desktop and new Big Picture in Steam Version 1690583737.

bahaa32 commented 7 months ago

Spent some time digging into the code, the id generation algorithm appears to be the same (BoilR is using a library to calculate it, this is the code doing it: https://docs.rs/steam_shortcuts_util/latest/src/steam_shortcuts_util/app_id_generator.rs.html#9-11 )

My python dev setup happened to break today so I'm unable to do any debugging but I might be able to take a deeper look into it in a few weeks.

idbrii commented 6 months ago

@bahaa32 Thanks for the investigation! That looks like the same logic we're currently using:

https://github.com/jaydenmilne/steamsync/blob/031f1e6b4fabaad383b02901857f7c762b0a259f/steamsync/steamsync/steameditor.py#L366-L375

That code is from 2021 and definitely used to work, so either something changed about the data we're passing in or that's no longer the correct algorithm.

idbrii commented 6 months ago

Ah, the ids are now stored in the shortcuts file:

import pprint
from pathlib import Path
import ctypes
import vdf

fpath = Path("C:/apps/steam/userdata/32354297/config/shortcuts.vdf")
with fpath.open("rb") as f:
    cfg = vdf.binary_load(f)
    deathsdoor = cfg['shortcuts']['45']
    pprint.pprint(deathsdoor)
    appid = deathsdoor['appid']
    unsigned = ctypes.c_ulong(appid)
    print(f"The appid as unsigned: {unsigned.value}")

Running that prints the entry for Death's Door:

|| {'AllowDesktopConfig': 1,
||  'AllowOverlay': 1,
||  'Devkit': 0,
||  'DevkitGameID': '',
||  'DevkitOverrideAppID': 0,
||  'Exe': 'C:/WINDOWS/explorer.exe',
||  'FlatpakAppID': '',
||  'IsHidden': 0,
||  'LastPlayTime': 0,
||  'LaunchOptions': 'shell:appsFolder\\DevolverDigital.DeathsDoorWin10_6kzv4j18v0c96!Game',
||  'ShortcutPath': '',
||  'StartDir': 'C:\\',
||  'appid': -968219748,
||  'appname': "Death's Door Win10",
||  'icon': 'C:\\Program '
||          'Files\\WindowsApps\\DevolverDigital.DeathsDoorWin10_1.0.6.0_x64__6kzv4j18v0c96\\Square44x44Logo.png',
||  'openvr': 0,
||  'tags': {'0': 'steamsync', '1': 'xbox'}}
|| The appid as unsigned: 3326747548

When I add a grid image for Death's Door with BoilR it creates 3326747548p.jpg, which matches the unsigned appid.

Looking at BoilR's source was the right direction, but I ran into shortcuts_parser.rs which had appid and made me realize I should look at the shortcuts.vdf file!

idbrii commented 6 months ago

@bahaa32 Can you give https://github.com/jaydenmilne/steamsync/pull/39 a try?

If you clone steamsync, you can run your local version with poetry:

pip install poetry
pushd C:\code\steamsync\steamsync
poetry install
poetry run steamsync --replace-existing --remove-missing --all --download-art

(I'm new to poetry, so hopefully those are all the necessary commands.)