-
-
Notifications
You must be signed in to change notification settings - Fork 120
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
Bug: Steam games relaunches the frontend while launching game #442
Comments
Yes, unfortunately there's no way to detect when the game launched by Steam starts on closes -- frontends can only access Steam itself and ask it to launch the game. When Steam is already open this completes instantly, causing the issue you've seen. Sadly starting from a closed-Steam state won't entirely solve the problem, because Steam keeps running after a game closes, meaning you can't properly return to Pegasus either. These issues have been reported to Valve already (eg. |
That's a bummer since the Steam integration in Pegasus is extremely good except for this one issue Since it looks like Valve won't be fixing it on their end anytime soon I started looking into some other way of launching steam games reliably, there was a workaround posted in the the issue you referred to by Github user ejthill which I liked the sound of so I adapted it a little and made a very quick & simple proof-of-concept (Windows only) Basically what this launcher does is:
I would be willing to look into implementing something like this (ofcourse way more robust and cross-platform) directly into the frontend, or alternatively add some optional configuration option that lets the user configure what command is used to launch steam games if either of those sounds like a good idea to you? |
Yes I've seen these workarounds, but I had some issues:
I was also thinking about another approach, that we should check the process tree and see if Steam has any non-built-in child processes running. In theory that should be reliable, but it also have most of the same problems as above. Another idea, perhaps a Steam wrapper script could be set, which Pegasus would call instead of the Steam binary. One could set it to a script like the one you linked, but if that itself has bugs, there might be no way to return to the frontend. I'm also not sure if it'd work on macOS as things are launched differently there. Now these are only how I see things at the moment. However if you have a better idea or a working implementation I'd be always happy to take a look on it. |
After reading your reply and looking at it a little closer, it's safe to say I underestimated the complexity of the task 😅 But yes, the idea of letting the user set their own Steam wrapper script sounds like the best way forward, I'll try my hand at implementing it and submitting a PR and you can decide if it makes sense to merge or not 🙂 |
@PaddyCo apologies for the ping, but I'm hitting this issue now and was wondering if you had a binary built anywhere for your launcher? Cheers, thanks! |
As this is still a problem, how about that: If one starts a steam game, the video stops playing as long as no other game gets selected. This would easily work on all platforms. |
Yes, that might work for now. |
+1 to the @ToxicCrack idea. I finally got around to configuring Pegasus on my gaming VM, and this issue makes Stream integration effectively unusable, since Pegasus does a great job finding videos for everything! |
I fixed this issue by writing this launcher for steam. Instructions are in the zip file. You can add individual games and it will launch them, monitor them to allow Pegasus to go back to fullscreen when you are finished with the game. This works whether Steam is open or not. DJ. |
I also have a working Battle.net system too. I'll upload that when I have made the code look prettier. |
Hi DJ, Tried your launcher but received some errors even after using the correct version of the .net framework. In general, the issue remains - I can still hear the video for the Steam game playing in the background after launch. |
nice post like it |
Not sure if you're in the right place here, or an AI bot mass replying to tickets, but this has nothing to do with what you are describing. |
i just found a slight workaround, use the launch line in some metadata file: metal.bat: it just lauches the steam game and kill pegasus process, so you need to relauches pegasus manually when needed. |
Is there a fix for this on macOS? |
I might have found a workaround, atleast on Linux, not sure if Windows or MacOS have it. Steam starts a process called |
It's within the |
I just tried with a Windows VM, seems like No clue on MacOS, someone would need to test it there. EDIT: Just found out that Steam creates a registry on Windows, inside As such, if said item has a value of 0, or it doesn't exist, it means that the game was closed, or there was no game running to begin with. It does work. Tested on a Windows 10 VM. |
It seems like both options could be plausible solutions, though I am unsure of the Windows one, since I don't know how to read the registry on a program, or if it's even possible. As for Linux, it's just a matter of tracking if the As for MacOS, someone would need to test if TL;DR: I highly doubt there's a way to detect it on all three at once. |
@mmatyas Looking at the code, it seems like the registry read that I have mentioned above might be viable, after seeing that there's seems to be a registry item being read already in the backend code. As for Linux, it might be of interest to find the PID of For MacOS, I don't have a machine that I could use to test, so I can't say about how to fix it there. |
This works. However the funny thing is that (at least with the game i tested) the PID for
This is not ideal since now where dealing with two arbitrary times, and it also doesn't work if
The problem now is that (for some reason) it has to Edit: Ended up just doing this:
This should give |
I have done some testing, but it didn't happen for me, so it might be related to anticheats/DRM or launchers. (For context, I tried Celeste and Vampire Survivors, both kept the However, I also found a theoretical shortcoming of this solution: Opening Pegasus on Steam would make Pegasus think a game is running. Technically you could detect if Pegasus was opened from Steam, by detecting if |
Also the timing would be off, since you have to wait for Steam to load, if it isn't already open. (EDIT: This is even worse taking into consideration automatic updates) Either way, not much else that can be done. Previously Linux also had |
If it were to be implemented into Pegasus, it would have to:
Might be possible, but I am uncertain. Either way, this is just the Linux solution, and while Windows has |
From what I've seen from the logs of running the As for step 2, Steam uses a process called The rest of the steps should be easier, the problem's with the steps 1 and 2. EDIT: Technically you are able to brute force both of the steps, by having a while loop that checks if |
Yeah. I'm on the same track.
But in cases where
Btw. I used |
I found it to be more efficient to use #!/bin/bash
steam steam://rungameid/<Insert ID here>
until pgrep "^reaper$" > /dev/null
do
sleep 1
done
waitpid $(pgrep "^reaper$") |
This is still scuffed, granted. There can be another process called EDIT: This might get fixed if the script filtered out |
Found out that doing Combined with filtering the already running |
I might have found a solution, at least for Linux.
I haven't tried this with other games, but I don't see why it wouldn't work. |
The solution I was trying failed when Steam wasn't open, unsure why, here it is incase someone wants to debug it: #!/bin/bash
if pgrep -P $(pgrep "^steam$") "^reaper$"; then
exclude=$(pgrep -P $(pgrep "^steam$") "^reaper$")
else
exclude="none"
fi
steam steam://rungameid/504230 &
until pgrep -P $(pgrep "^steam$") "^reaper$" | grep -v "$exclude"
do
sleep 1
done
waitpid $(pgrep -P $(pgrep "^steam$") "^reaper$" | grep -v "$exclude") |
Probably. |
The objective of that is to filter currently running |
Anyways:
This works with other games, but can be simplified to: #!/bin/bash
id="2231450"
steam steam://rungameid/"$id"
tail -f -n 0 "$HOME/.local/share/Steam/logs/content_log.txt" | grep -q "Remove ${id} from running list" Since the tail keeps checking the log, and |
Anyways, found the fix for my solution: #!/bin/bash
if pgrep "^reaper$"; then
exclude=$(pgrep "^reaper$")
else
exclude="none"
fi
steam steam://rungameid/504230 &
until pgrep "^steam$" > /dev/null && pgrep -P $(pgrep "^steam$") "^reaper$" | grep -v -q "$exclude"
do
sleep 1
done
waitpid $(pgrep -P $(pgrep "^steam$") "^reaper$" | grep -v "$exclude") |
However yours should be easier to implement into the code, since it's just watching a file for a specific string, compared to watching processes. |
Judging by the structure of the code, it might be hard to specify commands specifically for Steam. Might work if some sort of special attribute was added here, so that the function that runs the games can differentiate between normal games and Steam games. In that way the fix could be implemented, though I am unsure, as I don't have that much experience. |
BTW, this works on Windows too, just checked with a VM, the log exists. |
The logs should be located in these locations:
Source: Steam Cloud FAQ As for the Steam Flatpak, it's |
Yeah. I wouldn't know how to implement it in the actual pegasus source code.
Then for every game i create a
And then in the Pegasus
|
That is a way to do it, though in order to close this issue, it would need to be added into mainstream. That or Valve would have to add a way to start a Steam game without keeping the client open. |
Right. I might take a look at the source code tomorrow and see if i figure something out. |
I'll see if I find something. |
Beyond the Steam game declaration and the launcher of the commands, I've also found the declaration of the game class, along side it's header |
I give up at trying to understanding the code, not good enough at C++ Anyway if someone picks this up, to summarize: We figured out you can check if steam has closed the game by monitoring the log This should be enough as we can just keep a dummy processes running from when pegasus launches the game until the log prints the line.
|
When I start a game from Steam through the frontend (default settings) it seems to trigger the exit game event while the game is still launching, causing some issues like the frontend running in the background (with videos still playing etc)
I think the reason is probably because when running steam.exe with the
steam://rungameid/XXXXX
parameter it simply returns exit code 0 once it has finished launching the game, which makes the frontend think the game has exited?Here are the relevant lines from my lastrun.log:
Same problem on two different computers (Both running Windows 10) with all games I've tested so far
The text was updated successfully, but these errors were encountered: