tactikauan / thcrap-steam-proton-wrapper

A wrapper script for launching the official Touhou games on Steam with patches through Proton on GNU/Linux.
The Unlicense
38 stars 6 forks source link

Add thprac support #9

Closed Bai-Chiang closed 5 months ago

Bai-Chiang commented 6 months ago

It will launch the game first then wait 5sec launch thprac with the same WINEPREFIX, so thprac would detect running game and automatically attach to it.

I used suggest command from this comment https://github.com/touhouworldcup/thprac/issues/129#issuecomment-1475398643 and some @redirectto scripts https://github.com/redirectto/thprac-steam-proton-wrapper

I tested with native Steam installation (on Steam Deck) and flatpak version of Steam.

tactikauan commented 6 months ago

Hi. Thanks for the PR. It wold be great if we could automatically install thprac like we already do with thcrap, so the user doesn't have to specify the path to the executable. There doesn't appear to be a single download link available to the latest version, but this should do the trick:

VERSION=$(curl -si https://github.com/touhouworldcup/thprac/releases/latest | grep location: | sed 's@.*/@@' | tr -d '[:space:]')
curl -L -f -O "https://github.com/touhouworldcup/thprac/releases/download/$VERSION/thprac.$VERSION.exe" --output-dir "$THPRAC_FOLDER"

Tough, if you prefer, I can merge this as-is and implement that at a later point.

redirectto commented 6 months ago

I'm glad you are taking a look at my script, the main flaw I have with it is that I cannot make it work properly with non-steam games, aside from running thcrap on the same folder as the games. Aside from the flag that lauches thprac (-p), I added two flags, one to launch custom.exe (-k) and a second one to disable thcrap (-d). I also added dectection to Uwabami Breakers (alcostg) I tried the command @Bai-Chiang posted to see if it works with non-steam games but it doesn't, still I'll take it into account when making scripts that launch multiple apps on the same prefix.

Bai-Chiang commented 5 months ago

Okay, I didn't know that. Does "($TH_REGEX|custom\.exe)" works?

On March 24, 2024 8:27:12 AM EDT, Kauan Decarli @.***> wrote:

@tactikauan commented on this pull request.

Get PID while ensuring only the actual Touhou executable is chosen

while [ -z "$TH_PID" ]; do # Loop until a matching process is found

  • TH_PID=$(grep -Er "$TH_REGEX" /proc//stat | sed "s/.:([0-9]+).*/\1/")
  • TH_PID=$(grep -Er "($TH_REGEX.exe|custom.exe)" /proc//stat | sed "s/.:([0-9]+).*/\1/")

This will not work for EoSD because the executable name in /proc/[pid]/stat is limited to 15 bytes, and 東方紅魔郷.exe is 19 bytes, so it gets truncated to just 東方紅魔郷.

-- Reply to this email directly or view it on GitHub: https://github.com/tactikauan/thcrap-steam-proton-wrapper/pull/9#pullrequestreview-1956539164 You are receiving this because you were mentioned.

Message ID: @.***>

tactikauan commented 5 months ago

Other than the comment above looks good. I think it's a good idea to reduce the number of commits for better readability. Suggestion:

Also, please add @redirectto as a co-author to the relevant commit(s).

Bai-Chiang commented 5 months ago

Added @redirectto to co-author, the only new commit is https://github.com/tactikauan/thcrap-steam-proton-wrapper/pull/9/commits/e041601d8d6ae4b34ea2d273c71826b0c5133dc4

tactikauan commented 5 months ago

Thanks. I squashed and reorganized some commits for a cleaner history.