JosefNemec / Playnite

Video game library manager with support for wide range of 3rd party libraries and game emulation support, providing one unified interface for your games.
https://playnite.link
MIT License
9.18k stars 495 forks source link

Steam input / overlay support for all games? #760

Open strontiummuffin opened 6 years ago

strontiummuffin commented 6 years ago

would it be possible to have the option to launch a non steam games as a steam shortcut? or export database to steam in the tools? I'd want this so you can use steam input as its great for emulator games etc and controller support, Programs like ICE allow you to add emulator games to steam so I don't see why playnite couldn't do the same thing!

strontiummuffin commented 6 years ago

Edit: i found another potentially helpful way to add this, you can create desktop shortcuts of non steam games by right clicking them so once the playnite data can be imported into steam you can launch it via playnite and thus steam with a url like this steam://rungameid/13099452113107288064 that was for an animal crossing rom as an example.

JosefNemec commented 6 years ago

Depends on how hard is to export games to Steam (I doubt they have API for it). Can you find out where Steam stores data about games you add to it manually?

By6r9 commented 6 years ago

In shortcuts.vdf I bought Steam controller recently and looked if there is easy way to connect Steam and Playnite. Main problem is that after adding emulator to Steam, you can't easily pass arguments to it. For each exported game you need: -add emulator -add launch parameters, for emulator and path to rom file -change name of the shortcut -generate shortcut link and add it to Playnite

Good news, someone wrote detailed documentation how to do it: https://github.com/CorporalQuesadilla/Steam-Shortcut-Manager/wiki/Steam-Shortcuts-Documentation

with python implentation: https://github.com/CorporalQuesadilla/Steam-Shortcut-Manager/blob/master/shortcuts.py (but I see that there is an opened issue about it not working...)

JosefNemec commented 6 years ago

We may do it using different approach, create some launcher executable. You would import that one to Steam, and run all Playnite games though it.

In practice:

I'm not sure if it's going to work, mainly if Steam is clever enough to hook itself to a child process (the game itself) of launcher executable. The advantage is that we would not have to mess around with configuration of Steam shortcut (other then importing the launcher once) and we will be able to launch whatever we want (including additional scripts and stuff).

By6r9 commented 6 years ago

I'm not sure if simple launcher will work, because Steam Controller needs Steam Overlay to work, so child process would need to inherit it. GloSC - https://github.com/Alia5/GloSC is the only other solution I could find, but it still adds shortcuts, and then creates 'a transparent, borderless window' for them. I would use it if I could add shortcuts from command line instead of its GUI.

Details from its author: https://behind.flatspot.pictures/third-party-steam-controller-software-part2-my-take-on-it/

Oh, and 'one shortcut for all emulators' won't work, because Steam Controller configuration/button mappings are per shortcut/game and everything would need to use that one configuration.

psychonic commented 5 years ago

@JosefNemec if you did want to go the route of just importing the non-Steam game shortcuts from Steam as-is, it wouldn't be much effort beyond the changes in #769. Shortcuts are handled very similarly to mods. Instead of folder path in the registry, the shortcuts.vdf filed mentioned above is used. It is just a binary KV file that can be read by the existing KeyValue class from SteamKit.

I'd be happy to take a closer look at implementing.

JosefNemec commented 5 years ago

Problem is not importing shortcuts from Steam, but doing it the opposite way. Creating shortcut in Steam and then running Playnite game via Steam. I would personally like to see this implemented as a plugin once we add ability to overwrite Play action (when starting game) into the API.

bburky commented 5 years ago

I have a mostly working implementation of an extension to automatically create non-Steam shortcuts to games in Playnite. It automatically creates or updates non-Steam shortcuts and updates the game in Playnite to use it.

It's not quite perfect yet, see the TODOs, and it hasn't been tested much. I think it should work correctly on any game with a "Executable" or "URL" GameAction in Playnite.

https://github.com/bburky/playnite-non-steam-shortcuts

darklinkpower commented 4 years ago

I just found this tool that has a pretty clever solution. It basically runs a transparent window through steam and that way you can always have the overlay and steam input and in any app, perhaps a similar approach to this could be used? You can read more on it's Github page

https://alia5.github.io/GloSC/ https://github.com/Alia5/GloSC

smaTc commented 4 years ago

@darklinkpower told me that the tool I just started developing might help here. Feel free to check it out. Remote Play Detached

JosefNemec commented 4 years ago

Thanks, I'll check it out. From the quick read I did, it looks like it works similar to what I proposed in one of my previous comments. I'll keep it in mind and do more research when it comes to implementing this.

JosefNemec commented 4 years ago

I forgot to mention that there's a workaround you could use until this is properly implemented. Start Playnite from Steam (add it first as non-Steam game) and then launch games from that Playnite instance.

It works for most games from what I tried. Of course it has some disadvantages, like Steam showing that you are always in "Playnite" game and you can't create Steam input profiles for each game separately since you always only play "Playnite" game.

ferrazpedro commented 4 years ago

An user of launchbox made an plugin to it to do something pretty similar to what you guys are trying to do. Maybe it can help? https://github.com/lahma69/SteamLauncher

FanderWasTaken commented 3 years ago

I was trying to figure out how to do that too. I used Steam ROM Manager. Not the best solution, but overlay and stuff works, but only if anticheat is allowing that. I have SRM setup that adds the same shortcut for all of my installed games: "C:\Users\Fander\AppData\Local\Playnite\Playnite.DesktopApp.exe" --startfullscreen --hidesplashscreen --nolibupdate. This way Steam hooks into the process of Playnite and any other that Playnite starts. I also use ShortcutSync extension to automatically add shortcuts to all of my installed games to one folder, so SRM could use that for naming Steam shortcuts it creates. Also I use NirCmd to autokill Playnite after I exit out of a game with this post game command: nircmd cmdwait 4000 killprocess Playnite.DesktopApp.exe

This setup is hacky as hell, but this is the best I could come up with with no knowledge of how to code :(

Here's SRM Parser profile, if anyone's interested:

# Parser type
····Selected: Glob
# Configuration title
····Windows - Playnite
# Steam category
····
# Executable
····
····[ ]: Follow .lnk to destination (Windows only)
····[x]: Append arguments to executable
# Command line arguments
····
# Executable modifier
····"C:\Users\Fander\AppData\Local\Playnite\Playnite.DesktopApp.exe" --startfullscreen --hidesplashscreen --nolibupdate
# ROMs directory
····C:\Users\Fander\Shortcuts
# Steam directory
····C:\Program Files (x86)\Steam
# "Start In" directory
····
# User accounts
····
····[x]: Skip found accounts with missing data directories
····[x]: Use account credentials
# User's glob
····${title}@(.lnk|.LNK)
# User's glob-regex
····null
# Title from custom variable
····
····[ ]: Case-insensitive variables
····[ ]: Skip file if variable was not found
····[ ]: Enable Title from Custom Variable
# Title modifier
····${fuzzyTitle} 
# Fuzzy matching
····[x]: Use fuzzy matching
····[x]: Replace diacritic characters
····[x]: Aggressive matching
····[x]: Remove (...) and [...] brackets
# Online image query
····${${fuzzyTitle}}
# Image pool
····${fuzzyTitle}
# Image providers
····Selected: SteamGridDB
# Default image
····
# Default tall image
····
# Default hero image
····
# Default logo image
····
# Local images
····
# Local tall images
····
# Local hero images
····
# Local logo images
····
# Local icons
····C:/Users/Fander/Icons/pc.png
····[ ]: Disable current parser
····[x]: Show advanced options

P.S. idk if I'm being helpful or not, so feel free to delete this if needed.

KittyCalia commented 8 months ago

I do a similar thing to add the shortcuts to Steam using Steam ROM Manager. I export a CSV file using the Library Exporter Advanced addon and then using a CSV to JSON converter, create a JSON file that SRM can parse using the Manual parser. The JSON file needs to be formatted this way:

[
  {
     "title":"game1",
     "target":"playnite folder/Playnite.DesktopApp.exe",
     "startIn":"playnite folder",
     "launchOptions":"--hidesplashscreen --start game1 playnite ID"
  },
  {
     "title":"game2",
     "target":"playnite folder/Playnite.DesktopApp.exe",
     "startIn":"playnite folder/Playnite.DesktopApp.exe",
     "launchOptions":"--hidesplashscreen --start game2 playnite ID"
  }, 
]

And the SRM Parser Profile:

# Parser type
····Selected: Manual
# Configuration title
····Playnite Shortcuts
# Steam directory
····C:\Program Files (x86)\Steam
# User accounts
····${steamuser}
# Steam category
····${Playnite}
# ROMs directory
····
# Executable
····
····[ ]: Follow .lnk or .desktop to destination (Windows and Linux only)
····[x]: Append arguments to executable
# Command line arguments
····
# Executable modifier
····"${exePath}"
# "Start In" directory
····
# User's glob
····null
# User's glob-regex
····null
# Manifests Directory
····json_folder
# Amazon Games Path Override
····null
····[ ]: Launch games via Amazon Games
# Epic Manifests Directory Override
····null
····[ ]: Launch games via Epic for online services
# Legendary installed.json Path Override
····null
# Galaxy Path Override
····null
····[ ]: Launch games via GOG Galaxy
# itch.io AppData Directory Override
····null
# Windows-on-Linux Install Drive Redirect
····null
····[ ]: Find artwork for games only (no tools)
····[ ]: Find artwork for installed titles only
····[ ]: Find artwork for unofficial source mods
# Ubisoft Directory Override
····null
····[ ]: Launch games via UPlay for online services
# XboxGames Directory Override
····null
····[ ]: Launch game as UWP instead of launcher helper
# EA Games Directory Override
····null
····[ ]: Launch games via EA Desktop
# Title from custom variable
····
····[ ]: Case-insensitive variables
····[ ]: Skip file if variable was not found
····[ ]: Enable Title from Custom Variable
# Title modifier
····${Title}
# Fuzzy matching
····[x]: Replace diacritic characters
····[x]: Aggressive matching
····[x]: Remove (...) and [...] brackets
# PS4 Template
····Selected: null
# PS5 Template
····Selected: null
# Xbox 360 Template
····Selected: null
# Xbox One Template
····Selected: null
# Switch Joy-Con (Left) Template
····Selected: null
# Switch Joy-Con (Right) Template
····Selected: null
# Switch Pro Template
····Selected: null
# Steam Deck Template
····Selected: null
# Image providers
····Selected: SteamGridDB
····[ ]: Allow NSFW artwork
····[ ]: Allow joke artwork
# Allowed grid styles
····Selected: 
# Allowed hero styles
····Selected: 
# Allowed logo styles
····Selected: 
# Allowed icon styles
····Selected: 
# Allowed animation types
····Selected: static
# Online image query
····${${fuzzyTitle}}
# Image pool
····${fuzzyTitle}
# Fallback portrait
····
# Fallback banner
····
# Fallback hero
····
# Fallback logo
····
# Fallback icon
····
# Local portraits glob
····
# Local banners glob
····
# Local heroes glob
····
# Local logos glob
····
# Local icons glob
····

It works pretty well and Steam hooks to Playnite if it's closed before launching the shortcut. Works with Steam Link too, except UWP games but for those I create a GlosSI entry and add it to the launch option of Playnite.

Hope this helps anyone! ^^

cuesta4 commented 4 days ago

Any updates on this? I think it's the only thing interfering with a truly great PC gaming experience.