-
Notifications
You must be signed in to change notification settings - Fork 73
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
Add Non-Steam Game: Add Option To Select Compatibility Tool #908
Conversation
Testing looks ok on my deck:
I didn't see anything in the help text though, and when I'm passing them command line looks like the convention was for double dashes? |
Woohoo, good signs all around!
You're right, I forgot to update the help text. I usually do that at the end and I actually would have forgotten had you not brought this up.
If you're referring to the arguments, you can use steamtinkerlaunch/steamtinkerlaunch Line 22466 in 0ee7690
This is fairly standard with a lot of STL commands including steamtinkerlaunch/steamtinkerlaunch Lines 20584 to 20604 in 0ee7690
If there's anything that needs clarified or that needs changing for this specific command let me know :-) Since this appears to work, the rest of the features here will be quality-of-life stuff to do with mapping and displaying the Proton versions using their tool names, and doing this for all compatibility tools that SteamTinkerLaunch knows about (everything in its I think as well, I will change the dropdown on the UI to be a combobox entry field. This way it still has a dropdown, but the user can enter their own tools if there is one SteamTinkerLaunch simply doesn't know about, or if they want to select a non-Proton compatibility tool such as Luxtorpeda (or related projects) or others like this. On this note, I should also remember to add the native Steam Linux Runtime as a compatibility tool that a user can select as well as SteamTinkerLaunch. It's not for this PR but I have a sneaking suspicion that the Steam launch options may not always get applied properly, I'll have to investigate that later on. Mostly writing this so I don't forget to investigate 😅 |
Had a quick look into how Steam stores internal names. Third-party tools use Now for the, well, not very happy part: Valve Proton versions (Proton 7/8/Experimental/Hotfix/etc, even Steam Linux Runtime 1.0 Scout (or the native Steam Linux Runtime)) have their internal names stored in the This presents a little bit of a problem, because now I may have to figure out how to parse the appinfo file with Bash, but worst-case I'll just skip Valve Proton versions for now and address that in a separate PR. Another option, which is a bit hacky, is to simply grep for every string like Option 3 might be a contender, we'll see. Differentiating between what's a Valve Proton version and what's everything else might be tricky, but we could probably make a good guess based on the directory structure and which files are and aren't in the Proton folder. So we could get all the known Proton versions from the
This guess approach is probably the most straightforward. |
We can now get the Internal name for Proton versions, including Valve Proton versions, in I went with the approach described earlier. Basically: check We'll have to do this in |
Something that just occurred to me, is that the SteamTinkerLaunch Proton list includes SteamTinkerLaunch Proton versions, as in ones not available to Steam. Attempting to set these as compatibility tools will not work, we need to limit the compatibility tool selection to only those available to Steam. This should be straightforward enough to do, we can skip one that have the SteamTinkerLaunch path in their ProtonCSV entry. |
…rnal name if passed on commandline
Latest commit added some logic to generate a list of valid, Steam-accessible compatibility tools on the dropdown on the Add Non-Steam Game menu. Now the menu is displaying a more familiar list of available Proton versions. We also include the Steam Linux Runtime and Proton-stl here. These can be selected, and when sent to Really now there are just three bits of outstanding work:
|
Added logic to back up the Also changed the dropdown to be a combobox entry field, so now custom tool names can be entered if the user knows what they're doing (such as entering Langfiles still need updating, but after that I think the main thing left for this PR is testing. I'll do a good amount before merging. The core pieces for this PR are in place now:
Most of the work for this was very general implementation of text VDF interaction and fetching the internal name of a compatibility too. After that, it was a case of wiring that up to the new UI. Both could be generally useful, and in future I may write out the Internal name to the ProtonCSV file so we have it in case it's useful for other purposes, but for now it's not necessary :-) This PR should be mostly functional now, there may be problems/edge cases that I haven't accounted for yet that I'll try catch out and fix :-) |
Just tested and found out that if you add the shortcut with Steam opened and select a compatibility tool, when you close Steam it will remove that updated It would be a good idea to add this to the notes on the |
regarding the backup solution, maybe for another ticket but if something does actually go wrong users may have overwritten their vdf several times over already. Theres also no restore previous config button, which could be useful in a disaster situation. something to think about for later maybe.. |
Indeed, it was something I was worried about. I thought I wrote it in a comment but perhaps I didn't. I agree though, a way to restore the original VDF before STL ever wrote out to it would be very useful. |
oh this is super helpful info. I was wondering why we had to set this manually sometimes |
Yeah, this information doesn't seem to be too readily available. A lot of it is just me figuring stuff out as I go. I'm hoping to update the Add Non-Steam Game Wiki Page to include the findings and changes in behaviour over the last while, for users and for anyone who might stumble across it with the same questions I had. It may even get referenced in other resources in future and help even more people :-) It happened with the GameScope wiki page which was referenced heavily on the Arch Linux wiki. |
One potential addition I thought of was a "default" option, which when selected will set the game to use the default Steam compatibility tool, the one set in the Steam Settings under "Compatibility": In my case above, it would return This is stored in |
are they gauranteed to be windows games? could they be linux based non-steam games? are there cases where they select default and using proton somehow breaks their game? Or is it an edge case that almost no one will see anyway since theyre using stl? |
You can add any executable or really any file you want as the Non-Steam Game executable. Users don't have to select a compatibility tool if they don't want to, if they don't select one Steam will try to launch the executable like if the user double-clicked on it. If the user has Wine on their system and the system recognises that launching a Windows executable should be managed with Wine, then Steam will run the game with system Wine. This is default Steam behaviour as well, then you add a Non-Steam Game from the Steam Client, by default, no compatibility tool is used at all. If the user were to select a Linux executable/script here, and then select a compatibility tool, it would try to launch that program with the compatibility tool. It would work the same as if a user added a game manually, then went to Properties -> Compatibility -> Force the use of a Steam Play Compatibility Tool. In fact, modifying the
Absolutely, though the global tool need not be Proton. It could just as easily be Luxtorpeda, SteamTinkerLaunch, or any other compatibility tool. For the SteamTinkerLaunch Add Non-Steam Game GUI, the default option will still be On the Steam Client this does not happen at all with Non-Steam Games, they will always default to no compatibility tool and you have to enable it yourself. I think it could be useful to have the option to use the same default tool that Steam uses for non-native games :-) |
Implemented the logic for the above feature. The compatibility tool name |
In my testing this appears to work, writing out to the If no other issues crop up I will merge this tomorrow I think. |
any chance at a release after this merge? when does that usually happen |
There's no hard-and-fast release schedule, I have only made two releases since taking over: "v12.0 - Still Alive" back on December 2022, and "v12.12 - Gate of Steiner". Releases happen whenever there are enough of what I would consider "useful changes", along with when I have a name picked out, and when I feel like making a new release. For the last point it is just when I feel like it, but one major thing that plays into it is how much capacity I have to deal with a potential influx of new issues. There's no ETA or even much desire on my end for a new release just yet, but there are some things I would like to implement and/or investigate implementing before the next release. Right now broadly speaking I have these in mind to at least make an attempt at adding:
That's a rough set of features I have in mind to implement before the next release. I've considered making an issue about it, but I don't really want to "commit" to adding these. Really, a next release will come when I feel like I've "done enough" to justify a new release. |
ShellCheck is still green on this, so I'll bump the version and merge momentarily 👍 Thank you a ton @trentondyck for all of your help with suggestions, testing, and review (and patience, some of these Non-Steam Game improvements have been over a year in the making!). Appropriate credit will be given in the changelog :-) |
Implements #905.
Overview
This PR adds the option on the Add Non-Steam Game GUI to select a compatibility tool known to SteamTinkerLaunch via a dropdown menu populated with compatibility tools. This then gets written out to the
config.vdf
. if this file exists.Right now, the list of tools is hardcoded, but this will be changed to display the Proton versions just like how the Proton version dropdowns across STL work (Main Menu, Game Menu, Vortex Proton, MO2 Proton). Then, some mapping logic will be done to map/fetch the internal name of the selected compatibility tool, since we can get the path from the compatibility tool name, then build the path to the
compatibilitytool.vdf
where we can extract the internal name. If, for some reason, this file is missing or we otherwise can't get the internal name, we can default to the name of the Proton version. Some tools do actually simply use this as their internal name, such as GE-Proton.If no compatibility tool is passed from the commandline or selected on the UI, the
config.vdf
file is not touched.Implementation
How Steam Stores Compatibility Tools in Use
Steam stores information about which game uses which compatibility tool in its
~/.local/share/Steam/config/config.vdf
file, under aCompatToolMapping
section. This section contains a list of blocks named after a game AppID.Unlike with
shortcuts.vdf
and some others (appinfo.vdf
I believe is the other one), this is a text-based VDF format, which Valve also re-use for things like their.acf
files stored in library folders. This format is defined by Valve and pretty much only used with the Steam Client and I believe the Source engine.Here's an example snippet of this section and some entries taken from my own
config.vdf
:The
"0"
entry is the default global compatibility tool enforced by the user.To set a compatibility tool for a given game, you must locate its AppID under
CompatToolMapping
, and then change the value of thename
field to the internal name of the compatibility tool, such asproton_7
orProton-stl
.Compatibility Tool Internal Names
A compatibility tool's internal name is a required field defined in a tool's
compatibilitytool.vdf
file. Thisi s Here is a snippet of how SteamTinkerLaunch'scompatibilitytool.vdf
file looks:Due to the structure of this file, we can guarantee that the internal tool name will always be present, as it is required to set the entries inside of it, which are required for the compatibility tool to function (namely the
from_oslist
andto_oslist
fields).Manipulating VDF Files in Bash
The next step once you have a game's AppID and the internal name of the compatibility tool you want to set for use with it, you have to actually write out that block. For Non-Steam Games, we do now have the AppID and we're able to use this to set the game artwork. But we have no way of interacting with the VDF files to get the existing data or do any kind of manipulation.
To accomplish this, we needed a fleet of functions to interact with text-based VDF files, such as the
config.vdf
. As part of research into implementing the feature request for this PR, I generically wrote some utility methods over atsonic2kk/blush
to accomplish this. The code was re-used for this PR.The functions essentially boil down to extracting various parts of the text-based VDF file, and helper methods to go along with them. Then we have
createVdfEntry
, which is used for actually writing out the VDF entry and brings them all together. We can essentially then pass in the inforamtion we want to set for a VDF entry, tell the function whether we want it at the top of the bottom of the block, and write it out. A Bash array like( "name!${NOSTCOMPATTOOL}" "config!" "priority!250" )
gets turned into this snippet:These VDF functions work based on grepping for block patterns, primarily relying on tabs. I checked my PC, Steam Deck, and a family member's PC to check that the VDF indentations were consistent, but that doesn't mean this is always the case. ProtonUp-Qt has encountered scenarios where the
config.vdf
keys casing was not consistent. Lots of testing will be needed to ensure this works as expected!Remaining Work
Right now, only the basic skeleton UI and logic is in place. However, this is enough to select SteamTinkerLaunch. Proton 7, and Proton 8 as compatibility tools, as these are hardcoded. There is also logic to convert
$NON
into an empty string so it will be skipped. Commandline usage is also introduced since this is how the GUI function is orchestrated as well, meaning if you know the internal of a compatibility tool ahead of time, you can simply enter this internal name and it will get written out toconfig.vdf
as expected.There is plenty of remaining work though. There is no logic for mapping Proton names to their internal tool names, and thus the UI only displays a list of hardcoded compatibility tools. There needs to be logic for populating the compatibility tool dropdown with all Proton versions known to SteamTinkerLaunch (with STL added as well, since we don't normally list ourselves as a compatibility tool for obvious reasons 😉). We will need logic on the commandline side to default to the passed argument, since if it doesn't exist in our Proton list we should just assume the user knows what they are doing. If a non-existent compatibility tool is chosen, Steam won't let a user launch a game and it will simply show "Available on: <OS icon(s)>" instead of a play button, until a user forces a different compatibility tool. This is also what happens when you force a compatibility tool (such as GE-Proton), then remove that compatibility tool, from the Steam Client's perspective in this scenario, a removed and non-existent compatibility tool are the same. We should also add more code failsafes such as backing up the
config.vdf
, just in case anything goes wrong (such as a format change that no one catches, then a user tries to add a Non-Steam Game, write out and borks theirconfig.vdf
) Finally, we also need more logging around the VDF functions. Since this isn't present over on the Blush repositoryThis PR is in good shape right now with hopefully no massive bugs. If anyone wants to test this, please back up your
config.vdf
file!!!TODO:
compatibilitytool.vdf
file and/or internal name for some reason (works for some tools such as GE-Proton)-ct
flag, if we can't find a corresponding Proton version in our CSV file, assume the user knows something we don't and allow this name as-isconfig.vdf
file before writing out to it