misc: Fix commands being interpreted as game launch if command included steamapps/common
#1125
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
If commands to SteamTinkerLaunch include
steamapps/common
, we incorrectly interpret this as an attempted game launch. This is because SteamTinkerLaunch assumes if a path contains the path to a Steam game that it should be a game launch. An incoming start command might look like this from Proton:waitforexitandrun "/home/gaben/.local/share/Steam/steamapps/common/Half-Life 3/hl3.exe
. So to detect game launches, SteamTinkerLaunch looks forsteamapps/common
usinggrep -q "$SAC"
(whereSA="steamapps"; SAC="$SA/common"
).For native Linux games, because they can be launched with and without a Steam Linux Runtime - not to mention Proton games can use whacky incoming things for things like
link2ea
, Ubisoft, etc - there is no way I can think of currently to know when the incoming command to SteamTinkerLaunch is a game launch, and when it is a command, other than to hardcode cases where an incoming command may reasonably containsteamapps/common
.One-Time Run suffers quite badly from this bug, where the
--exe
path may contain a steamapps path. The following command would fail:steamtinkerlaunch otr --exe="/home/gaben/.local/share/Steam/steamapps/common/Half-Life 3/hl3.exe" --proton="GE-Proton9-7"
-- It fails because the path containssteamapps/common
.Commands which can include
"steamapps/common"
will fail because SteamTinkerLaunch interprets them as game launches even if they are not, because this is the most straightforward way to detect game launches.This PR fixes the issue by introducing a check on the first incoming argument (the actual command, for example with
steamtinkerlaunch otr
,$1
isotr
) to see if it contains a hardcoded list ofgrep
values. For now, we only check forotr
. The reason we only check on$1
is because we only care to check if the first command is a known SteamTinkerLaunch command; we wouldn't want to exclude commands containingotr
anywhere from being ran as game processes, we only want to skip launching as a game process if the incoming command's first parameter is a known command that is NOT a game process, i.e. a command defined by SteamTinkerLaunch.steamtinkerlaunch otr blah blah
will never come from anywhere except someone wanting to run theotr
command, butsteamtinkerlaunch waitforexitandrun /run/media/gaben/otr/
could conceivably be a path, so we don't account for those kinds of cases.In other words:
master
,steamtinkerlaunch otr --exe="steamapps/common"
would incorrectly detect this as a game start process from Steam.$1
isotr
(oronetimerun
), we skip this command from being interpreted as a game launch and pass directly tocommandline "$@"
to run this command.There is no reason why all custom commands shouldn't be exluded, other than it would take time to add them all, and most won't encounter this issue.
I did some testing with Proton games and native Linux games and it seems to work fine.
TODO: