07th-mod / python-patcher

Mod Installer for the Higurashi and Umineko Games
158 stars 12 forks source link

Add non-steam game to steam when installing console arcs #11

Open drojf opened 5 years ago

drojf commented 5 years ago

About the console arcs install I asked about in #higurashi I had a look into it and Non-Steam Game shortcuts are saved in a shortcuts.vdf file, this file is saved in Steam\userdata[STEAMID]\config\ I've tried opening in N++ but it has a lot of characters that don't display correctly,I have found these pages about editing it https://www.npmjs.com/package/steam-shortcut-editor

https://developer.valvesoftware.com/wiki/Notepad%2B%2B_VDF_languages https://www.reddit.com/r/Steam/comments/98zn98/releasedocumentation_steam_shortcut_manager_a/

https://github.com/CorporalQuesadilla/Steam-Shortcut-Manager

I've used GLoSC to set up some games with my Steam Controller, and it adds the shortcut automatically and then restarts Steam which reloads the shortcuts.vdf file

I don't know how it could be implemented in the installer, but I imagine that something like this would work to have a Console Arcs shortcut automatically added to Steam after install and I hope that something here might help with it

Link to python vdf library (only supports v1): https://github.com/ValvePython/vdf

andOlga commented 5 years ago

Here's a brief description of the shortcuts.vdf format. It's more or less a weird binary JSON representation. There are only three data types involved: object, int and string (there are no arrays -- those are simply objects with numeric strings as keys). Here is how you parse:

This should be relatively easy to write a parser for but my Python knowledge is pretty much completely gone at this point, so I won't try myself. Hopefully this helps a little.

Oh, also, here's what a file with a single shortcut would look like in a standard JSON representation (mostly to see what keys/key types there are):

{
    "shortcuts": {
        "0": {
            "AppName": "Name of the game here",
            "Exe": "\"C:\\Program Files\\...\"",
            "StartDir": "\"C:\\Program Files\\...\\\"",
            "icon": "",
            "ShortcutPath": "",
            "LaunchOptions": "",
            "IsHidden": 0,
            "AllowDesktopConfig": 0,
            "AllowOverlay": 0,
            "OpenVR": 0,
            "Devkit": 0,
            "DevkitGameID": 0,
            "LastPlayTime": 0,
            "tags": {}
        }
    }
}

Note that paths are, bizzarely, enclosed in double quotes within the actual string itself.

drojf commented 4 years ago

There was some discussion on how to determine the game ID for a non-steam game so that we could include a custom header image/logo for the non-steam game.

Adam pointed out that another project, Ice, has code to generate the ID from the game name/filename combo here: https://github.com/scottrice/Ice/blob/7130b54c8d2fa7d0e2c0994ca1f2aa3fb2a27ba9/ice/steam_grid.py#L49

with this we can place the files at <ID>.json, <ID>_hero.jpg and <ID>_logo.jpg files in the userdata\<USER_ID>\config\grid folder and it should work just fine

andOlga commented 1 year ago

I would like to point out that Valve recently broke/changed the way appIDs are generated for non-Steam games, which broke one of my other programs (see andolga/steam-thcrap#3). I have spent around 8 hours attempting to fix it, but eventually just gave up on it, couldn't find a way to get it to work again. Meaning, this part of the feature may no longer be feasible.

drojf commented 1 year ago

Oof, thanks for letting me know