fix(linux): find Windows programs running under Wine - #12
Open
ayozetr wants to merge 1 commit into
Open
Conversation
find_processes could not see a Proton-run game at all, so "is the user
playing?" was permanently false on Linux and any check that looks for the
game by name silently found nothing.
Neither of its two lookups can work for a Wine process: /proc/<pid>/exe
resolves to the Wine preloader rather than the program, and comm holds
whatever the program named its main thread, capped at 15 bytes — ARC Raiders
reports "GameThread". Match argv[0] from /proc/<pid>/cmdline as well, where
the Windows path survives intact:
S:\common\Arc Raiders\PioneerGame\Binaries\Win64\PioneerGame.exe
Splitting that needs a basename helper that understands backslashes, since
Path::file_name sees the whole Windows path as one component on Linux.
names_match now drops a trailing .exe from both sides instead of only the
query, so the Wine-hosted steam.exe matches the same "steam.exe" query that
native Steam's comm of "steam" matches, and it lowercases before stripping
because strip_suffix is case-sensitive and a .EXE spelling kept its suffix.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
find_processescannot see a Proton-run game at all, sogame_runningis permanently false on Linux and every check that looks for the game by name silently finds nothing.Neither of its two lookups can work for a Wine process:
/proc/<pid>/exeresolves to the Wine preloader, not the program.commholds whatever the program named its main thread, capped at 15 bytes. ARC Raiders reportsGameThread.Observed on a running game:
So this also matches
argv[0]from/proc/<pid>/cmdline, where the Windows path survives intact. Splitting that needs a basename helper that understands backslashes, sincePath::file_namesees the whole Windows path as a single component on Linux.names_matchnow drops a trailing.exefrom both sides rather than only the query, so the Wine-hostedsteam.exematches the same query that native Steam'scommofsteammatches. It also lowercases before stripping, becausestrip_suffixis case-sensitive and a.EXEspelling kept its suffix — a test caught that one.Context in #8.
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.