0e4ef622 / wine-discord-ipc-bridge

Enable games running under wine to use Discord Rich Presence
MIT License
393 stars 28 forks source link

Proton issue #17

Closed GitMuslim closed 1 year ago

GitMuslim commented 3 years ago

rpc doesn't work

i added /home/(myusername)/wine-discord-ipc-bridge/winediscordipcbridge-steam.sh to launch options in steam i also edited BRIDGE to /home/(myusername)/wine-discord-ipc-bridge/winediscordipcbridge.exe

but nothing works :confused:

it only works if i run it as a normal wine app

jannis3005 commented 3 years ago

winediscordipcbridge-steam.sh: line 13: runtimecmd: bad array subscript

this is the issue from log. i guess that is the problem

davidpuzey commented 3 years ago

I had this issue, I changed line 13 to if [ ${#runtimecmd[@]} -ne 0 -a "${runtimecmd[-1]}" == "--" ]; then and it worked like a charm ... I also didn't edit BRIDGE, that worked fine with the dirname ${BASH_SOURCE[0]} I might submit a pull request at some point, though if someone else gets to it first that's cool.

davidpuzey commented 3 years ago

After playing around a little more I'm not convinced that fix will solve @ITZProGamerDieYT issue. It certainly gets rid of the log warning and I was seeing Discord report the game correctly, however I have since seen the game not being reported correctly, if I close and reopen Steam it usually sorts it out (I've tried it with and without my suggested fix and it does the same thing). Sorry for any false hope.

@ITZProGamerDieYT I have a few question, just to double check:

  1. Is the problem that the game starts but doesn't report correctly or that the game doesn't start at all?
  2. Does the winediscordipcbridge-steam.sh script have execute permissions?
  3. Is the game 'Launch Options' /home/<username>/wine-discord-ipc-bridge/winediscordipcbridge-steam.sh or /home/<username>/wine-discord-ipc-bridge/winediscordipcbridge-steam.sh %command%?
GitMuslim commented 3 years ago
  1. the game starts but it doesn't start rpc
  2. yes
  3. %command%
GitMuslim commented 3 years ago

edit: the game doesn't startup

aidalgol commented 2 years ago

I think I am having the same issue. I get the same line 13: runtimecmd: bad array subscript error, and the game starts correctly, but Discord is not detecting the game. I tried changing line 13 in the wrapper script to

if [ ${#runtimecmd[@]} -ne 0 -a "${runtimecmd[-1]}" == "--" ]; then

and still got the same error.

I am running the game Deep Rock Galactic via Proton-6.20-GE-1. I am also running on ZFS, if that makes a difference.

Steam console output from launching the game with the `-x` option added to the script's shbang line. ``` GameAction [AppID 548430, ActionID 1] : LaunchApp changed task to ShowLaunchOption with "" GameAction [AppID 548430, ActionID 1] : LaunchApp waiting for user response to ShowLaunchOption "" GameAction [AppID 548430, ActionID 1] : LaunchApp continues with user response "0" GameAction [AppID 548430, ActionID 1] : LaunchApp changed task to ProcessingInstallScript with "" wineserver: using server-side synchronization. GameAction [AppID 548430, ActionID 1] : LaunchApp changed task to SynchronizingCloud with "" GameAction [AppID 548430, ActionID 1] : LaunchApp changed task to SiteLicenseSeatCheckout with "" GameAction [AppID 548430, ActionID 1] : LaunchApp changed task to CreatingProcess with "" GameAction [AppID 548430, ActionID 1] : LaunchApp waiting for user response to CreatingProcess "" GameAction [AppID 548430, ActionID 1] : LaunchApp continues with user response "CreatingProcess" Opted-in Controller Mask for AppId 548430: 0 /bin/sh\0-c\0/home/aidan/.steam/root/compatibilitytools.d/winediscordipcbridge-steam.sh /home/aidan/.steam/debian-installation/ubuntu12_32/reaper SteamLaunch AppId=548430 -- '/extrapool/aidan/steam/steamapps/common/SteamLinuxRuntime_soldier'/_v2-entry-point --verb=waitforexitandrun -- '/home/aidan/.steam/debian-installation/compatibilitytools.d/Proton-6.20-GE-1'/proton waitforexitandrun '/extrapool/aidan/steam/steamapps/common/Deep Rock Galactic/FSD.exe' -nohmd\0 Game process added : AppID 548430 "/home/aidan/.steam/root/compatibilitytools.d/winediscordipcbridge-steam.sh /home/aidan/.steam/debian-installation/ubuntu12_32/reaper SteamLaunch AppId=548430 -- '/extrapool/aidan/steam/steamapps/common/SteamLinuxRuntime_soldier'/_v2-entry-point --verb=waitforexitandrun -- '/home/aidan/.steam/debian-installation/compatibilitytools.d/Proton-6.20-GE-1'/proton waitforexitandrun '/extrapool/aidan/steam/steamapps/common/Deep Rock Galactic/FSD.exe' -nohmd", ProcID 3718811, IP 0.0.0.0:0 ERROR: ld.so: object '/home/aidan/.steam/debian-installation/ubuntu12_32/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored. ERROR: ld.so: object '/home/aidan/.steam/debian-installation/ubuntu12_32/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored. ++ dirname /home/aidan/.steam/root/compatibilitytools.d/winediscordipcbridge-steam.sh ERROR: ld.so: object '/home/aidan/.steam/debian-installation/ubuntu12_32/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored. + BRIDGE=/home/aidan/.steam/root/compatibilitytools.d/winediscordipcbridge.exe + DELAY=5 + runtimecmd=() + protoncmd=() + for arg in "$@" /home/aidan/.steam/root/compatibilitytools.d/winediscordipcbridge-steam.sh: line 13: runtimecmd: bad array subscript + '[' '' == -- ']' + runtimecmd+=("$arg") + for arg in "$@" + '[' /home/aidan/.steam/debian-installation/ubuntu12_32/reaper == -- ']' + runtimecmd+=("$arg") + for arg in "$@" + '[' SteamLaunch == -- ']' + runtimecmd+=("$arg") + for arg in "$@" + '[' AppId=548430 == -- ']' + runtimecmd+=("$arg") + for arg in "$@" + '[' -- == -- ']' + protoncmd+=("$arg") + for arg in "$@" + '[' -- == -- ']' + protoncmd+=("$arg") + for arg in "$@" + '[' -- == -- ']' + protoncmd+=("$arg") + for arg in "$@" + '[' -- == -- ']' + protoncmd+=("$arg") + for arg in "$@" + '[' -- == -- ']' + protoncmd+=("$arg") + for arg in "$@" + '[' -- == -- ']' + protoncmd+=("$arg") + for arg in "$@" + '[' -- == -- ']' + protoncmd+=("$arg") + gamecmd=("${protoncmd[@]:2}") + protoncmd=("${protoncmd[@]:0:2}") + '[' -z /extrapool/aidan/steam/steamapps/common/SteamLinuxRuntime_soldier/_v2-entry-point ']' + sleep 5 + /extrapool/aidan/steam/steamapps/common/SteamLinuxRuntime_soldier/_v2-entry-point --verb=waitforexitandrun /home/aidan/.steam/root/compatibilitytools.d/winediscordipcbridge.exe ERROR: ld.so: object '/home/aidan/.steam/debian-installation/ubuntu12_32/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored. ERROR: ld.so: object '/home/aidan/.steam/debian-installation/ubuntu12_32/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored. ERROR: ld.so: object '/home/aidan/.steam/debian-installation/ubuntu12_32/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored. ERROR: ld.so: object '/home/aidan/.steam/debian-installation/ubuntu12_32/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored. pid 3718819 != 3718815, skipping destruction (fork without exec?) GameAction [AppID 548430, ActionID 1] : LaunchApp changed task to WaitingGameWindow with "" GameAction [AppID 548430, ActionID 1] : LaunchApp changed task to Completed with "" pressure-vessel-adverb[3719082]: E: Failed to execute child process "/home/aidan/.steam/root/compatibilitytools.d/winediscordipcbridge.exe" (No such file or directory) + /extrapool/aidan/steam/steamapps/common/SteamLinuxRuntime_soldier/_v2-entry-point --verb=run -- /home/aidan/.steam/debian-installation/compatibilitytools.d/Proton-6.20-GE-1/proton waitforexitandrun '/extrapool/aidan/steam/steamapps/common/Deep Rock Galactic/FSD.exe' -nohmd ERROR: ld.so: object '/home/aidan/.steam/debian-installation/ubuntu12_32/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored. ERROR: ld.so: object '/home/aidan/.steam/debian-installation/ubuntu12_32/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored. ERROR: ld.so: object '/home/aidan/.steam/debian-installation/ubuntu12_32/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored. pid 3719763 != 3719760, skipping destruction (fork without exec?) ProtonFixes[3720042] INFO: Running protonfixes ProtonFixes[3720042] INFO: Running checks ProtonFixes[3720042] INFO: All checks successful ProtonFixes[3720042] INFO: Using global defaults for "Deep Rock Galactic" (548430) ProtonFixes[3720042] INFO: No protonfix found for "Deep Rock Galactic" (548430) esync: up and running. Game process updated : AppID 548430 "/home/aidan/.steam/root/compatibilitytools.d/winediscordipcbridge-steam.sh /home/aidan/.steam/debian-installation/ubuntu12_32/reaper SteamLaunch AppId=548430 -- '/extrapool/aidan/steam/steamapps/common/SteamLinuxRuntime_soldier'/_v2-entry-point --verb=waitforexitandrun -- '/home/aidan/.steam/debian-installation/compatibilitytools.d/Proton-6.20-GE-1'/proton waitforexitandrun '/extrapool/aidan/steam/steamapps/common/Deep Rock Galactic/FSD.exe' -nohmd", ProcID 3721038, IP 0.0.0.0:0 Setting breakpad minidump AppID = 548430 Steam_SetMinidumpSteamID: Caching Steam ID: 76561198045182877 [API loaded no] Game process updated : AppID 548430 "/home/aidan/.steam/root/compatibilitytools.d/winediscordipcbridge-steam.sh /home/aidan/.steam/debian-installation/ubuntu12_32/reaper SteamLaunch AppId=548430 -- '/extrapool/aidan/steam/steamapps/common/SteamLinuxRuntime_soldier'/_v2-entry-point --verb=waitforexitandrun -- '/home/aidan/.steam/debian-installation/compatibilitytools.d/Proton-6.20-GE-1'/proton waitforexitandrun '/extrapool/aidan/steam/steamapps/common/Deep Rock Galactic/FSD.exe' -nohmd", ProcID 3721044, IP 0.0.0.0:0 Fossilize INFO: Overriding serialization path: "/extrapool/aidan/steam/steamapps/shadercache/548430/fozpipelinesv6/steamapprun_pipeline_cache". Installing breakpad exception handler for appid(gameoverlayui)/version(20211013194715) Installing breakpad exception handler for appid(gameoverlayui)/version(1.0) Installing breakpad exception handler for appid(gameoverlayui)/version(1.0) Installing breakpad exception handler for appid(gameoverlayui)/version(1.0) Fossilize INFO: Overriding serialization path: "/extrapool/aidan/steam/steamapps/shadercache/548430/fozpipelinesv6/steamapprun_pipeline_cache". wine: Unhandled page fault on write access to 0000000000000008 at address 000000007BC5F90C (thread 044c), starting debugger... 0x16696f0:2: Async thread=0x14a6390 0x17c9d80:2: I/O status block 0x17206a0:1: Fd unix_fd=12298 user=0x17204f0 options=00000000 0x17204f0:2: Socket fd=0x17206a0, state=3, mask=0, pending=44, reported=44 0x16d6c20:1: esync fd=9873 0x14a6390:1: Thread id=03c8 unix pid=3721044 unix tid=3721217 state=1 0x13fb820:1: Token id=0.1017 primary=1 impersonation level=-1 0x13fb590:1: Process id=0120 handles=(nil) pid 3720046 != 3720045, skipping destruction (fork without exec?) ```
alwilson commented 2 years ago

I did some experiments tonight and found that I could get the bridge running alongside a game, Deep Rock Galactic, but I found that the bridge would die as the game came up. I added some debug to the bridge and found that it couldn't find /run/user/{userid}/discord-ipc-0 when calling connect(2). It turns out that steam now runs games in containers that don't get access to that path by default, but there are env var overrides so that it can. See: https://github.com/ValveSoftware/steam-runtime/blob/master/doc/steamlinuxruntime-known-issues.md#sharing-directories-with-the-container

By adding PRESSURE_VESSEL_FILESYSTEMS_RW="/run/user/{userid}" %command% to the launch options that path is opened for read/write. Not sure if it needs that or RO / read-only, but I assume the socket needs to be written to.

Right now I have local changes to proton to just start the bridge before any game rather than use the script. I'd rather use the script than having local edits on proton, but I need to sit down and look at how bash is parsing all that. I had a hardcoded example that would have worked with this change, but I scraped it. Hopefully this helps you all! Discord showed Deep Rock Galactic connect and I could see updates to it in game. The join group button light up green on Discord, but I'll have to try it tomorrow.

alwilson commented 2 years ago

I messed around with the bash script and something about running the bridge in a separate call to proton causes the game to pause or stall. Nothing seemed to get both running correctly. I noticed that the fix I added to the proton version I was using, Proton-6.20-GE-1, already existed in the form of PROTON_REMOTE_DEBUG_CMD. This had a typo in Proton-6.20-GE-1 where it tries to reference "wine54" rather than "wine64" and fails. Looks like this is fixed in Proton-6.21-GE-2 and I assume it works in Proton-6.3. https://github.com/GloriousEggroll/proton-ge-custom/blob/d5090ed5d6f99ed0f534326ed49df877358b8503/proton#L1435

Now I'm using PRESSURE_VESSEL_FILESYSTEMS_RW and PROTON_REMOTE_DEBUG_CMD in my launch options and the time seems to work fine for Deep Rock Galactic. This bridge is kind of like a debugger, right? It kind of fits. :smile: Here's my current launch options, adding in the executable path and your user_id as needed. I believe most distro/systems have the first user as 1000 for the uid / user_id. PROTON_REMOTE_DEBUG_CMD=/path/to/winediscordipcbridge.exe PRESSURE_VESSEL_FILESYSTEMS_RW="/run/user/{user_id}" %command%

0e4ef622 commented 2 years ago

Nice! That's hilarious, that specifying the bridge as a debug command works. Feel free to make a pull request updating the proton script or just adding what you've found to the README.

GitMuslim commented 2 years ago

Gonna check that tommorow

Frontrider commented 2 years ago

PROTON_REMOTE_DEBUG_CMD=/path/to/winediscordipcbridge.exe PRESSURE_VESSEL_FILESYSTEMS_RW="/run/user/1000" %command%

This makes the miner's union show up, and the game opens a browser to log into discord, but the discord app still won't see the game.

the OS is manjaro, and the game is DRG.

Frontrider commented 2 years ago

Found it. Installed discord via snap, and the socket is in a different folder. Line 239 updated to, so it includes snap

snprintf(addr.sun_path, sizeof(addr.sun_path), "%s/snap.discord/discord-ipc-%d", temp_path, pipeNum);

aidalgol commented 2 years ago

Line 239 updated to, so it includes snap

Line 239 of what?

Frontrider commented 2 years ago

oh sorry, the main.c.

Frontrider commented 2 years ago

look into /run/user/{user_id}/ and look for the discord-ipc file. Could be an argument instead of a hardcoded string

GitMuslim commented 2 years ago

doesnt work lol

Lucki commented 2 years ago

Nice! That's hilarious, that specifying the bridge as a debug command works. Feel free to make a pull request updating the proton script or just adding what you've found to the README.

Probably a bit late but at truckersmp-cli we've solved the problem with a helper script which starts everything from inside the container. While it's not possible to add processes (besides that debug command) to the container you're free to start as many as you like from inside. But this certainly needs preparation and isn't a "just start and it works solution" for existing games.

DieuDeGlace commented 2 years ago

Found it. Installed discord via snap, and the socket is in a different folder. Line 239 updated to, so it includes snap

snprintf(addr.sun_path, sizeof(addr.sun_path), "%s/snap.discord/discord-ipc-%d", temp_path, pipeNum);

this unfortunately didnt work for me. what else do i have to change in order to get it to function? I unfortunately dont get what i need to do. it showed something like pressure_wrapper as the game im playing but then didnt do anything else

Frontrider commented 2 years ago

It also stopped working for me as well.

0e4ef622 commented 2 years ago

The proton script also needs to be aware of where the IPC socket is.

0e4ef622 commented 2 years ago

I updated the script and main.c to add the snap paths, let me know if it works or not. It works for me on Arch, although I haven't tried with steam running from snap.

DieuDeGlace commented 2 years ago

still nothing on my end, but i could be approaching this wrong. is there a way you can make a new read me documenting how one would set all this up? perhaps im reading things wrong (likely scenario) but its kinda hard to follow what i gotta do when there are two different things for proton games.

0e4ef622 commented 2 years ago

is there a way you can make a new read me documenting how one would set all this up?

Let's discuss in #27.