Closed zDEFz closed 1 year ago
Hi!
If I understand your question correctly, you have a command to add your non-steam games with SteamTinkerLaunch and default them all to use Proton as a compatibility tool. Steam as far as I know does not have an "always use Proton flag", just an option to force a specific compatibility tool, which could be Proton, STL, Luxtorpeda, Steam-Play-None, or any custom compatibility tool.
As far as I know, forcing a compatibility tool automatically when adding a Non-Steam Game isn't possible at the moment in SteamTinkerLaunch. Previously I had actually looked into how to set game artwork for Non-Steam games which involved a similar idea, and I came up short. For now you'll have to manually set Proton as the compatibility tool for each game.
I had a look on the Non-Steam Game wiki page, and I couldn't find mention of what you were talking about. I think though from the path provided that this is about setting the version of Proton for SteamTinkerLaunch to use, not Steam itself. And I believe this refers to a global default that SteamTinkerLaunch can set.
In short, it isn't possible to tell added Non-Steam Games to use X compatibility tool, and I am not sure if/when this will be added. If you're interested, I have a short explanation below, otherwise I guess this answers your question :-)
The theory behind how STL would do this is by modifying a Steam file at ~/.local/share/Steam/config/config.vdf
, which stores information about which compatibility tool is in use by which game, based on AppID, under a CompatToolMap
key. An example would look something like this for a given game (keep in mind each installed game has its own entry like this, this is just one example):
"3187211279"
{
"name" "Proton-5.8-GE-2-MF"
"config" ""
"priority" "250"
}
This means the item in the Steam library with AppID 3187211279
is using the compatibility tool with the name Proton-5.8-GE-2-MF
. Not sure what config
or priority
refer to, usually config
is blank and priority
is 250
though from what I've seen.
So when a Non-Steam Game is added to Steam, STL would need to update this config.vdf
file an insert/modify an entry with the AppID for the added Non-Steam Game, and set the name to a given Proton version (it could be in a dropdown on the GUI menu, and a simple parameter for the command line option). If a game has an AppID of 12345
, it would create/update something like this:
"12345"
{
"name" "Proton-Very-Cool-Version"
"config" ""
"priority" "250"
}
This would be very straightforward, but the issue is with how Steam generates Non-Steam AppIDs. It uses a CRC algorithm to do so, which Frostworx (the original creator of STL) tried to replicate, and which I also tried to replicate (#576, see also some lengthy research by me in #550). In the end, I found out how Steam is meant to be generating these AppIDs, but I was unable to replicate it.
Recently I was also involved in some discussion on Non-Steam games in ProtonUp-Qt, where the creator DavidoTek did some investigation of their own. They attempted to replicate it in Python and were unable to, but they were able to replicate an example in the Go programming language. See this comment by them for some background on what they were able to find out about parsing the components needed to generate the AppID from the shortcuts.vdf
file. There is also some discussion in the PR and some of the examples linked to on generating Non-Steam AppIDs, which may be an interesting read if you're curious.
In short, if we figure out a way to generate the AppIDs for Non-Steam Games, we could implement this feature. But for now it is not really a priority. Sorry about that, but hopefully this answers your question!
For us it was a priority, here's a way to do that via bash/python on the deck (In this case for Horizon XI, i.e.):
add_non_steam_game(){
app_name="Horizon XI"
/home/deck/horizon-xi/stl/steamtinkerlaunch addnonsteamgame --appname="${app_name}" --exepath=/home/deck/horizon-xi/lib/net45/HorizonXI-Launcher.exe --startdir=/home/deck/horizon-xi/lib/net45/
shortcuts_vdf=$(find /home/deck/.local/share/Steam/ -name "shortcuts.vdf" -type f)
app_id=$(python -c "import vdf; d=vdf.binary_loads(open('${shortcuts_vdf}', 'rb').read()); items = list(d['shortcuts'].values()); print([i for i in items if i['appname'] in ['${app_name}']][0]['appid']+2**32);")
config_vdf=/home/deck/.local/share/Steam/config/config.vdf
python -c "import vdf; d=vdf.load(open('${config_vdf}')); ctm = d['InstallConfigStore']['Software']['Valve']['Steam']['CompatToolMapping']; ctm['${app_id}']={ 'name': 'GE-Proton7-42', 'config': '', 'priority': '250' }; vdf.dump(d, open('/home/deck/horizon-xi/config.vdf','w'), pretty=True);"
cp -f /home/deck/horizon-xi/config.vdf $config_vdf
}
Source code for the project available at https://github.com/trentondyck/horizon_scripts for any interested--I do a few more things there like installing the requirements and whatnot.
@trentondyck I tried to adapt it so it can be used in for everything. But steamtinkerlaunch tells me
Please enter non-steam-game appname
th11
Please enter the exe path
/stor/games/Touhou Project/(TH11) Touhou Chireiden ~ Subterranean Animism/custom_e.exe
find: ‘/stor/SteamLibrary/steamapps’: No such file or directory
ln -s /mnt/sshfsmounts/SteamLibrary /stor/SteamLibrary
good enough for now. Currently reading over the horizon script and making a generic one. Left out the start path, so it would default to its parent dir.
Now that is weird - I satisfy everything but proton would just not be forced on.
#!/bin/bash
function add_non_steam_game(){
whoami=$(whoami)
echo "Please enter non-steam-game appname"
read -r app_name;
echo "Please enter the exe path"
read -r exe_path;
app_config_folder=/home/$whoami/$app_name/
mkdir -p "$app_config_folder"
/usr/bin/steamtinkerlaunch addnonsteamgame --appname="${app_name}" --exepath="${exe_path}"
shortcuts_vdf=$(find /home/"$whoami"/.local/share/Steam/ -name "shortcuts.vdf" -type f)
app_id=$(python -c "import vdf; d=vdf.binary_loads(open('${shortcuts_vdf}', 'rb').read()); items = list(d['shortcuts'].values()); print([i for i in items if i['appname'] in ['${app_name}']][0]['appid']+2**32);")
config_vdf=/home/$whoami/.local/share/Steam/config/config.vdf
python -c "import vdf; d=vdf.load(open('${config_vdf}')); ctm = d['InstallConfigStore']['Software']['Valve']['Steam']['CompatToolMapping']; ctm['${app_id}']={ 'name': 'GE-Proton7-42', 'config': '', 'priority': '250' }; vdf.dump(d, open('$app_config_folder/config.vdf','w'), pretty=True);"
cp -f "$app_config_folder"/config.vdf "$config_vdf"
# Restart steam
killall steam
sleep 10
(steam &>/dev/null) &
echo "Successfully added nonsteam game"
}
Thanks for testing that @zDEFz updated the script, it wasn't writing to the config.vdf for some reason. wrote to a local file instead then forced overwrite (updated answer above). Also had to re-start steam I think
Thanks for testing that @zDEFz updated the script, it wasn't writing to the config.vdf for some reason. wrote to a local file instead then forced overwrite (updated answer above). Also had to re-start steam I think
I edited above script, but honestly the new config_vdf
should be made as a temporary file rather than create a new directory. Anyhow, it does not make a difference writing into a new file and then overwriting the original config_vdf
. The Proton setting is still not checked in steam.
Can you check on it?
your cp command sucks for some reason.
#cp -f "$app_config_folder"/config.vdf "$config_vdf"
cp -f $app_config_folder/config.vdf $config_vdf
did the trick for me
your cp command sucks for some reason.
#cp -f "$app_config_folder"/config.vdf "$config_vdf" cp -f $app_config_folder/config.vdf $config_vdf
did the trick for me
Did not help. And it is worse objectively if you do that! Not using the " "
does mean you do not prevent globbing and word splitting. Anyways, the issue is that "Force the use of a specific Steam Play compatibility tool" is not checked by default, even after your recommendation.
works for me, please include "echo $app_id" in your script, check your file in $app_config_folder/config.vdf - make sure it contains the app_id in question. then verify it's actually copied to $config_vdf. by the way I'm running on a steam deck I don't know what your set up is. but maybe you need a sudo, I don't know.
works for me, please include "echo $app_id" in your script, check your file in $app_config_folder/config.vdf - make sure it contains the app_id in question. then verify it's actually copied to $config_vdf. by the way I'm running on a steam deck I don't know what your set up is. but maybe you need a sudo, I don't know.
I'm running a generic archlinux installation. The idea is to create a script usable for everybody! Not just one game, not just steam deck. And there is not much required to get it done anymore. Thank you so much!
And found the issue: The chosen Proton version was not available at the system. I will have to write something that lets the user choose. For now, working:
#!/bin/bash
function add_non_steam_game(){
whoami=$(whoami)
echo "Please enter non-steam-game appname"
read -r app_name;
echo "Please enter the exe path"
read -r exe_path;
app_config_folder=/home/$whoami/$app_name/
mkdir -p "$app_config_folder"
proton_ver="Proton-GE"
/usr/bin/steamtinkerlaunch addnonsteamgame --appname="${app_name}" --exepath="${exe_path}"
shortcuts_vdf=$(find /home/"$whoami"/.local/share/Steam/ -name "shortcuts.vdf" -type f)
app_id=$(python -c "import vdf; d=vdf.binary_loads(open('${shortcuts_vdf}', 'rb').read()); items = list(d['shortcuts'].values()); print([i for i in items if i['appname'] in ['${app_name}']][0]['appid']+2**32);")
config_vdf=/home/$whoami/.local/share/Steam/config/config.vdf
python -c "import vdf; d=vdf.load(open('${config_vdf}')); ctm = d['InstallConfigStore']['Software']['Valve']['Steam']['CompatToolMapping']; ctm['${app_id}']={ 'name': '${proton_ver}', 'config': '', 'priority': '250' }; vdf.dump(d, open('$app_config_folder/config.vdf','w'), pretty=True);"
cp -f "$app_config_folder"/config.vdf "$config_vdf"
#cp -f $app_config_folder/config.vdf $config_vdf
# Restart steam
killall steam
sleep 10
(steam &>/dev/null) &
echo "Successfully added nonsteam game with the app_id of $app_id"
}
@sonic2kk now that we have a script working evidently, can we make use of https://github.com/sonic2kk/steamtinkerlaunch/wiki/Proton-Versions and basically just pass the proton version? I mean, the issue with the app id is no more. Above is a proof of concept. I have chosen the name of the proton version by what steam tells me.
Did not see this (responding to a closed issue won't be seen by me in 95% of cases, thanks for opening new issue about this).
Good discussion here, nice to see some actual technical minded users using STL for a change!
System Information
Issue Description
I want to add my non steamgames from a list, but they are all windows so I want that any installed proton version is taken for running. The annoying way would be... right click game in steam -> properties -> compatibility -> Force the use [...] -> Proton
So I have prepared
while read -r f; do steamtinkerlaunch addnonsteamgame -ep="$(realpath "$f")"; done < tmp.txt
And it adds the steamgames. I read something in the wiki that if you addPROTON*
to~/.config/steamtinkerlaunch/gamecfgs/customvars/global-custom-vars.conf
that then every new added game is launched via Proton. But I probably misunderstood.What do I need to toggle the option for launching by default all these programs with proton? I already checked the setting in Steam itself under SteamPlay to use Proton when applicable.