Skip to content
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

Reaper: Respect reaper toggle for Proton games #820

Merged
merged 2 commits into from
Jun 3, 2023
Merged

Conversation

sonic2kk
Copy link
Owner

@sonic2kk sonic2kk commented Jun 3, 2023

Fixes #814. Second attempt at #815, which was closed because the only changes needed were to the langfiles and to kill reaper if it is started before the game. Native Linux games work as expected with Reaper, since we can correctly parse reaper out of %command% (since native games use steamtinkerlaunch %command%, Reaper is started after the game as part of %command%).

Description below is copied from #815 and modified slightly to include updated information about native Linux games.

Background

When using a forked custom command, this will successfully fork into the background and outlive the game and STL process. If STL or the game is closed, the custom command will stay open. However, Steam will still see the forked command as a child process of the game. If you press the "Close" button from Steam while a game is running, it will close the forked command with it.

This is because Steam uses reaper when a game is launched to track processes related to a game and clean them up on game close. This was likely done to better clean up game processes on Steam Deck in particular. In the past, this reaper command was launched separately and could be toggled on/off with SteamTinkerLaunch. Now the behaviour is entirely different and reaper is launched on each game launch.

An important distinction to make here is that reaper is only launched after (or with) %command%. Any processes that go before this are not subject to reaper, as shown in #814. So any processes started and forked into the background in the Steam launch options and before %command% will be unaffected by reaper.

Overview

As a result, the reaper toggle currently works for native games. The start command with Reaper for native games is like ~/.local/share/Steam/ubuntu12_32/reaper SteamLaunch AppID=<appid> <game_launch_stuff>. So we don't need to do anything extra here, we just add some logic to kill Reaper if it is started before a game, which only applies to Proton games (i.e. using compatibility tool).

This PR changes the functionality of the reaper toggle in STL with Proton games. Instead of checking if reaper is disabled and attempting to fetch and run reaper with the SLR, we remove that unnecessary logic now and instead we kill reaper if USEREAPER is 0 and if the process is running. This results in reaper being killed before game launch (though it will launch with STL, but this doesn't matter anyway).

Behaviour for native games is unaffected.

@sonic2kk
Copy link
Owner Author

sonic2kk commented Jun 3, 2023

Shellcheck looks good. Version is bumped. Ready to merge.

@sonic2kk sonic2kk merged commit f3ecd54 into master Jun 3, 2023
@sonic2kk sonic2kk deleted the reaper-kill-2 branch June 3, 2023 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Launching app that is allowed to outlive the game
1 participant