Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Further improve steam shortcut creation #368

Closed
wants to merge 10 commits into from
Closed

Conversation

Lucki
Copy link
Contributor

@Lucki Lucki commented Apr 19, 2020

  • Search if shortcut already exists and update values gamehub handles
  • Only set values we're handling to not overwrite custom usersettings
  • Correctly set the icon and the horizontal grid image if available and overwrite existing images so updated graphics also update in the steam library
  • Stop caring about tags (see below)

Tags seem to be entirely replaced by collections. Unfortunately I haven't found a way to create them and assign the games to them.
It's possible to see them through the inbuild chrome browser by starting with steam -dev and accessing the browsers console with F12. They're located in the local storage.
The files representing that in the file system are located at $XDG_DATA_HOME/Steam/config/htmlcache/Local Storage/leveldb/.

References:

- Search if shortcut already exists
- Only set values we're caring about
- Append non existent tags
- Correctly set the icon and the horizontal grid image
They're replaced by collections.
@tkashkin
Copy link
Owner

tkashkin commented Apr 20, 2020

Tags seem to be entirely replaced by collections. Unfortunately I haven't found a way to create them and assign the games to them.

Looks like SteamGridDB Manager can create categories for new library.
doZennn/steam-categories may also be useful.

@Lucki
Copy link
Contributor Author

Lucki commented Apr 20, 2020

Great find! I'll try around with it.

@Lucki Lucki marked this pull request as draft April 26, 2020 17:16
@Lucki
Copy link
Contributor Author

Lucki commented Apr 26, 2020

Adding and updating games to steams collection is working now.

grafik

Still a few things left, what do you think:

  • I've heard tags in the shortcut file are still being used in the BigPicture mode. Should I add them back?
  • There's currently nothing in the UI telling you that you can't create a shortcut while steam is running. Do you know a good way to do so? Simply disabling the button with an explaining tooltip maybe?
  • We could enhance this even further and import collections which are set in steam. They're either in localconfig.vdf or in the leveldb listed as added but we can only get the associated name from the leveldb which means steam has to be closed to do the import. Do you think that's something good to add?
  • Maybe creating and updating shortcuts over a selection of games is a good addition?
  • Meson is only able to find the leveldb dependency when cmake is installed.

@tkashkin
Copy link
Owner

I've heard tags in the shortcut file are still being used in the BigPicture mode. Should I add them back?

Yes. They are likely still being used in Big Picture and old library, there's probably some other legacy code that may use them.


There's currently nothing in the UI telling you that you can't create a shortcut while steam is running. Do you know a good way to do so? Simply disabling the button with an explaining tooltip maybe?

We could enhance this even further and import collections which are set in steam.

Maybe creating and updating shortcuts over a selection of games is a good addition?

Currently GOG tags are imported if option is enabled. I think tags import and export functionality should be abstracted and be implementable for sources.
We should introduce interfaces for common features for sources to implement (see Traits for games in refactoring branch).


Also it would be nice for GameHub to backup any Steam configs it changes to not accidentally remove existing shortcuts and categories.

@Lucki
Copy link
Contributor Author

Lucki commented Apr 27, 2020

I think tags import and export functionality should be abstracted and be implementable for sources.

Ok, that doesn't belong in this PR.


Also it would be nice for GameHub to backup any Steam configs it changes to not accidentally remove existing shortcuts and categories.

I've added copying the database before writing into it.

@Lucki Lucki marked this pull request as ready for review April 27, 2020 14:39
@tkashkin
Copy link
Owner

Great work. I'll test it later.
I'll probably merge this PR into refactoring branch some time in the future.

Do you have any ideas how tags sync should work? (UI discussion for this should probably be in #304)

@Lucki
Copy link
Contributor Author

Lucki commented Apr 28, 2020

Resolved some remaining issues I've found.


Do you have any ideas how tags sync should work?

Two possibilities:

  1. Periodically automatic
    When going with this we have to make sure steam isn't running while doing so. And we have it possible never happen without the user knowing why.
  2. On users button press
    When going with this we can tell the user why his tags aren't synced and he should close steam first. This also somewhat screams for a "sync all" option. Including creating shortcuts.

IMHO is option 2 the better option (at least for steam). The leveldb database should only be used by one program at a time and on a button press or something similar we can tell the user why it's currently not possible.

From the technical side we can just read the leveldb entries. A random id is assigned with a name, an array of added games and an array of removed (hidden from this collection) games. We could query an appid to get all collections the game is assigned to and add them to our database and expose the imported tag like it's already done with gog. When adding games to it we're writing into the localconfig.vdf for added games. Not sure if we should remove games by adding them to the removed array in the vdf or remove them from the added array in the leveldb. Probably better to add them to the removed array in the vdf since doZenn mentioned:

Adding to the htmlcache directly caused problems with categories randomly disappearing when you restart Steam, it only happened sometimes.

Comment on lines +766 to 770
public static string generate_new_appid(string exe, string name)
{
// https://github.com/boppreh/steamgrid/blob/master/games.go#L120
return (crc32(0, (exe + name).data) | 0x80000000).to_string();
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is now replaced by a 4 byte little endian "appid" in the shortcut.vdf.

BigPicture is still using this tho. ((crc32(taget+name)|0x80000000)<<32|0x02000000)


game_node.add_node(new BinaryVDF.StringNode.node("AppName", game.name));
game_node.add_node(new BinaryVDF.StringNode.node("appname", game.name));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to test if intentionally not setting "appid" here makes steam use the old format as "appid". (target+name…)

If it has that effect: good, we can predict the artwork name.
If not: new appid generation is currently unknown so we can't create shortcuts and set the artwork in one go.

@tkashkin tkashkin deleted the branch tkashkin:dev September 1, 2021 18:40
@tkashkin tkashkin closed this Sep 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants