GithubHelp home page GithubHelp logo

0e4ef622 / wine-discord-ipc-bridge Goto Github PK

View Code? Open in Web Editor NEW
371.0 9.0 27.0 153 KB

Enable games running under wine to use Discord Rich Presence

License: MIT License

C 89.79% Shell 9.43% Makefile 0.78%
wine discord rich-presence discord-rpc

wine-discord-ipc-bridge's Introduction

Wine Discord IPC Bridge

This program enables other programs which are running under Wine to send Rich Presence data to a Linux Discord client.

This is mainly a proof-of-concept, demonstrating that this is possible, the code itself is a mish-mash of copy-paste from Microsoft docs and linux-discord-rpc.dll.

The way it works is simply by bridging the gap between Windows named pipes (\\.\pipe\discord-ipc-0) and Unix domain sockets (/run/user/{userid}/discord-ipc-0).

Compiling

i686-w64-mingw32-gcc -masm=intel main.c -o winediscordipcbridge

Usage (Wine)

Start the bridge first, wait for it to start listening to the pipe, and then launch your program/game. The two programs need to be running under the same wineprefix.

Usage (Steam Proton)

  1. Download winediscordipcbridge-steam.sh and place it in the same directory as winediscordipcbridge.exe. Use chmod +x to make it executable if necessary.

  2. In the game's settings on Steam, edit "Launch Options" to /path/to/winediscordipcbridge-steam.sh %command%. You will have to do this for every game that supports Rich Presence.

This currently starts the bridge in the background to act as a 'debugger' before the game starts and opens up the folder the Linux Discord socket lives in to be read/write. This worked for Deep Rock Galactic, hopefully the timing of the bridge works correctly for other games.

The bridge should automatically stop once the connecting program terminates, although it'll keep running if nothing ever connects.

I've personally tested this with osu! on both 32-bit and 64-bit wineprefixes, and Muse Dash using the script to launch from Steam with Proton Experimental.

https://github.com/truckersmp-cli/truckersmp-cli also reported success.

wine-discord-ipc-bridge's People

Contributors

0e4ef622 avatar alwilson avatar aravance avatar cobaltspace avatar cynojien avatar hagabaka avatar kakurasan avatar megasaturnv avatar sammcheese avatar xenhat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wine-discord-ipc-bridge's Issues

Need help using this with Steam Play

I saw your comment on Proton's Discord support issue and wanted to try it. The README says the bridge and the game need to be run under the same prefix. So I ran the bridge like

WINEPREFIX="$HOME/.local/share/Steam/steamapps/compatdata/$APPID/pfx" \
"$HOME/.local/share/Steam/steamapps/common/Proton 5.0/dist/bin/wine64" \
/path/to/winediscordipcbridge.exe

And it outputs

wineserver: using server-side synchronization.
Pipe Server: Main thread awaiting client connection on \\.\pipe\discord-ipc-0

However when I try to run the game in Steam, it stays stuck at "running", until I terminate the bridge program, and then the game will run.

I also tried running the bridge in Steam by editing launch options, but it fails right away with

err:ntdll:load_unix_cptable failed to load $HOME/.local/share/Steam/steamapps/common/Proton 5.0/dist/bin/../share/wine/nls/c_20127.nls
ERROR: ld.so: object '$HOME/.local/share/Steam/ubuntu12_32/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored.
wineserver: using server-side synchronization.
wine client error:0: version mismatch 621/604.
Your wine binary was not upgraded correctly,
or you have an older one somewhere in your PATH.
Or maybe the wrong wineserver is still running?

Can't use it with proton

I am trying to make the script work on proton, I followed the instruction in the .sh as in:
"# Set the game's launch options to: /path/to/this-script.sh %command%"
But when I do this steam opens the script and the game don't launch. I imagine that it's because the command changes what will be launched and then it stops there. Thus, it would be needed a script that would also launch the game somehow, maybe we could just make a copy for each game? It's not the best solution but it's something

Prevents Deep Rock Galactic from running

Using this prevents DRG from opening.
I'm running Manjaro KDE

/bin/sh\0-c\0/home/noah/Other/wine-discord-ipc-bridge/winediscordipcbridge-steam.sh /home/noah/.local/share/Steam/ubuntu12_32/reaper SteamLaunch AppId=548430 -- '/home/noah/3TB/SteamLibrary/steamapps/common/SteamLinuxRuntime_soldier'/_v2-entry-point --verb=waitforexitandrun -- '/home/noah/.local/share/Steam/compatibilitytools.d/Proton-6.21-GE-2'/proton waitforexitandrun '/home/noah/.local/share/Steam/steamapps/common/Deep Rock Galactic/FSD.exe' -nohmd\0 Game process added : AppID 548430 "/home/noah/Other/wine-discord-ipc-bridge/winediscordipcbridge-steam.sh /home/noah/.local/share/Steam/ubuntu12_32/reaper SteamLaunch AppId=548430 -- '/home/noah/3TB/SteamLibrary/steamapps/common/SteamLinuxRuntime_soldier'/_v2-entry-point --verb=waitforexitandrun -- '/home/noah/.local/share/Steam/compatibilitytools.d/Proton-6.21-GE-2'/proton waitforexitandrun '/home/noah/.local/share/Steam/steamapps/common/Deep Rock Galactic/FSD.exe' -nohmd", ProcID 34841, IP 0.0.0.0:0 chdir /home/noah/.local/share/Steam/steamapps/common/Deep Rock Galactic ERROR: ld.so: object '/home/noah/.local/share/Steam/ubuntu12_32/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored. GameAction [AppID 548430, ActionID 3] : LaunchApp changed task to WaitingGameWindow with "" ERROR: ld.so: object '/home/noah/.local/share/Steam/ubuntu12_32/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored. ERROR: ld.so: object '/home/noah/.local/share/Steam/ubuntu12_32/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored. GameAction [AppID 548430, ActionID 3] : LaunchApp changed task to Completed with "" ERROR: ld.so: object '/home/noah/.local/share/Steam/ubuntu12_64/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS64): ignored. ERROR: ld.so: object '/home/noah/.local/share/Steam/ubuntu12_32/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored. ERROR: ld.so: object '/home/noah/.local/share/Steam/ubuntu12_32/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored. ERROR: ld.so: object '/home/noah/.local/share/Steam/ubuntu12_32/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored. pid 34847 != 34844, skipping destruction (fork without exec?) bwrap: Can't make symlink at /run/user/1000/pulse: File exists Game process removed: AppID 548430 "/home/noah/Other/wine-discord-ipc-bridge/winediscordipcbridge-steam.sh /home/noah/.local/share/Steam/ubuntu12_32/reaper SteamLaunch AppId=548430 -- '/home/noah/3TB/SteamLibrary/steamapps/common/SteamLinuxRuntime_soldier'/_v2-entry-point --verb=waitforexitandrun -- '/home/noah/.local/share/Steam/compatibilitytools.d/Proton-6.21-GE-2'/proton waitforexitandrun '/home/noah/.local/share/Steam/steamapps/common/Deep Rock Galactic/FSD.exe' -nohmd", ProcID 34841 Uploaded AppInterfaceStats to Steam No cached sticky mapping in ActivateActionSet.No cached sticky mapping in ActivateActionSet.

Doesn't work with PDRPC

Running wine-discord-ipc-bridge with Project Diva Megamix+ (with the PDRPC mod) doesn't pass the rpc status to Discord
PDRPC doesn't detect Discord

[PDRPC]: Waiting for Discord...

My launch options: WINEDLLOVERRIDES='dinput8.dll=n,b' gamemoderun mangohud /home/e404nnf/wine-discord-ipc-bridge/winediscordipcbridge-steam.sh %command%

osu! with wine-discord-ipc-bridge

Hi

I've just recently made file with wineprefix set on the same one as for osu! (installed via PlayOnLinux).
Launched executable for ipc bridge closes after launching osu!, but no Rich Presence is passed to Discord.

What should I do?

Doesn't work with Satisfactory

Using the command /home/jonah/Games/Steam/wine-discord-ipc-bridge/winediscordipcbridge-steam.sh %command% works for Deep Rock Galactic, but when playing Satisfactory, Discord detects nothing.
My system monitor shows that winediscordipcbridge.exe is running, and it does not stop when I close the game, indicating that no connection has been made.

I unfortunately can't figure out how to get the logs from the bridge.

Using Proton Experimental and wine-discord-ipc version 0.0.2.

Steam Proton integration?

Is it possible to do something like a GameMode (library), which could be specified in the launch parameters of the steam game, like wdib% command%?

UPD: ok, im find script
Or ask to join function does not apply to this ?

Issues with LoL and Lutris on Arch Linux

I really hope i'm doing something wrong, but i have a wine prefix in ~/Games/league-of-legends that's using lutris-ge-lol 8.7.1
Now, what i did first is set it up to be launched as a pre-launch script, that didn't work.
So i tried manuually, i opened up my shell and typed WINEPREFIX=/home/zerokun265/Games/league-of-legends, then i typed /path/to/lutris-ge-lol8.7.1/bin/wine /home/zerokun265/Games/league-of-legends/winediscordipcbridge.exe and this was the output i got before launching league

wineserver: using server-side synchronization.
002c:fixme:winediag:LdrInitializeThunk wine-staging 8.7 is a testing version containing experimental patches.
002c:fixme:winediag:LdrInitializeThunk Please mention your exact version when filing bug reports on winehq.org.
007c:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005
007c:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005
007c:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005
007c:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005
Pipe Server: Main thread awaiting client connection on \\.\pipe\discord-ipc-0

then i launched league but nothing new got printed and as expected, game was shown to be played but no rich presence

Then after that i tried opening the wine console from lutris, closed league, then typed winediscordipcbridge.exe and got this output

Pipe Server: Main thread awaiting client connection on \\.\pipe\discord-ipc-0

Then i launched league of legends from lutris and once the game loaded i got this output

Client connected
Attempting to connect to (run(user/1000/discord-ipc-0
Connected succesfully
48 bytes W->1
365 bytes 1->W
61 bytes W->1
61 bytes W->1
65 bytes 1->W
61 bytes 1->W

And once again it sayd playing League of Legends with the icon but no rich presence

Am i doing something wrong here or what?

Proton: Failed to execute child process "winediscordipcbridge.exe" (No such file or directory)

I've cloned the repo, compiled the .exe with make and changed the run command on Steam to run the .sh

When trying to run, the bridge doesn't start, in the logs there's
pressure-vessel-adverb[93355]: E: Failed to execute child process "/home/geck0/app/wine-discord-ipc-bridge/winediscordipcbridge.exe" (No such file or directory)
Which means proton is running the script, but for some reason not finding/able to run the actual .exe

I've checked and rechecked the paths and tried absolute paths multiple times, but it doesn't work.

If I put "${protoncmd[@]//run}" dir "path/to/wine-discord-ipc-bridge/" in the script, on the logs it lists the contents of the folder.
Or if I point BRIDGE to some arbitrary bash script, it will execute the script (though if I try to run the .exe from it, it still says 'not found').
So Proton can see the files, but is giving the 'No such file or directory' specifically when trying to run the .exe

I don't know if it's some specific thing with Proton, that doesn't allow it to run external exes anymore or whatever. Tried a bunch of things for about tow hours, but nothing.

The game itself is still starting fine, but not the bridge.

Using Proton-6.16-GE-1

can't get it to work

initially I tired running the .exe and then running the game, it didn't do anything to my disocrd even though the .exe did recognise the game was running (I can no longer replicate it)

after I tried using the script in the github and (after my dubass figured out i had to add an argument like wine) i got an error

./winediscordipcbridge-steam.sh: line 18: runtimecmd: bad array subscript
0104:fixme:font:get_name_record_codepage encoding 20 not handled, platform 1.
0104:fixme:font:get_name_record_codepage encoding 20 not handled, platform 1.
0104:fixme:font:get_name_record_codepage encoding 20 not handled, platform 1.
Pipe Server: Main thread awaiting client connection on \.\pipe\discord-ipc-0
CreateNamedPipe failed, GLE=231.
Usage: wine PROGRAM [ARGUMENTS...] Run the specified program
wine --help Display this help and exit
wine --version Output version information and exit

OS: Fedora 33 linux 5.11 kernel

Option to keep running and listen to more than one Discord connection at a time.

I think it's a little irritating how this will only listen to one RPC connection and the program will close when that ends.
This would also fix games like Toontown: Corporate Clash not being compatible because the game seems to create an RPC connection, immediately end it and subsequently create another on launch, making it impossible to use this with it because the first brief connection causes the .exe to close itself.

If this change is implemented it should be optional because the current way it works is the best way to handle Steam games, but for stuff I run under standalone Wine it's a chore to keep track of. For my two wine prefixes I'd rather have the .exes just sit in the background and listen for connections at all times.

How to set it to run in a specific wine prefix?

I installed osu with lutris in /home/user/Games/osu
but wine discord ipc bridge is running in /home/user/.wine
So wine discord ipc bridge can't detect osu running (of course)
Is there any way to set wine discord ipc bridge to run in the osu wine prefix instead of the default wine prefix?
Or I must install osu in the default wine prefix?

Steam game won't launch

Trying to use it with Proton for some games

Followed the instruction and put the path/to/winediscordipcbridge-steam.sh %command%, and had BRIDGE=path/to/winediscordipcbridge.exe in the .sh, with both being absolute paths

The game will simply not launch, it will say that it's running for a few seconds then close

When seeing trough the logs (running steam trough terminal), this is something appeared that I think could relate:
pressure-vessel-adverb[955239]: Failed to execute child process "run" (No such file or directory)

Add reconnection logic

Currently if I refresh/restart Discord, I have to also restart any games using the bridge since it doesn't check if the unix socket has been destroyed and recreated.

I need help

Hello thanks for this script but I'm very newestly and I need help. I trying install TruckersMP Launcher I installed and I start launcher but ''Pipe Server: Main thread awaiting client connection on \.\pipe\discord-ipc-0'' error coming. I see your script but I'm newestly and I didn't how to use this script. Can you help me? I use Linux Mint 20 Cinnamon.

Missing license

This project is missing a license which makes it clear what usage is allowed and forbidden.

Also you've mentioned that you want to include this in wine: Is there a ticket I can follow?

could not load main init error

I am attempting to get this to work with a game on steam, using proton, and setting the properties to have the lines posted (edited userid and file path) and i keep having a failed game throwing a could not load main init. I dont know what i'm even supposed to do as instructions seem kinda unclear to me or just dont seem to work at all. I am new to linux, and I am currently running EndeavourOS.

Arch Deep Rock Galactic bwrap pulse error

Distribution: Arch
Kernel: 5.15.12-zen1-1-zen
Game: Deep Rock Galactic
DE: KDE Plasma 5.23
Proton: 6.3-8
Proton command: /opt/wine-discord-ipc-bridge/winediscordipcbridge-steam.sh %command%

DRG fails to launch entirely.

Excerpt from execution output:

bwrap: Can't make symlink at /run/user/1000/pulse: File exists
Game process removed: AppID 548430 "/opt/wine-discord-ipc-bridge/winediscordipcbridge-steam.sh /home/aravance/.local/share/Steam/ubuntu12_32/reaper SteamLaunch AppId=548430 -- '/games/Steam/steamapps/common/SteamLinuxRuntime_soldier'/_v2-entry-point --verb=waitforexitandrun -- '/games/Steam/steamapps/common/Proton 6.3'/proton waitforexitandrun  '/games/Steam/steamapps/common/Deep Rock Galactic/FSD.exe' -nohmd", ProcID 13911 
~ > $ pactl info
Server String: /run/user/1000/pulse/native
Library Protocol Version: 35
Server Protocol Version: 35
Is Local: yes
Client Index: 81
Tile Size: 65472
User Name: aravance
Host Name: <REDACTED>
Server Name: PulseAudio (on PipeWire 0.3.42)
Server Version: 15.0.0
Default Sample Specification: float32le 2ch 48000Hz
Default Channel Map: front-left,front-right
Default Sink: alsa_output.usb-SteelSeries_Arctis_Pro_Wireless-00.stereo-game
Default Source: alsa_input.usb-SteelSeries_Arctis_Pro_Wireless-00.mono-chat
Cookie: 2963:c0ac

I'm wondering if this has something to do with the pipewire-pulse setup conflicting with the bwrap containerization configs. The pid file in that pulse directory points to the pipewire-pulse process. I've attempted it with pulseaudio instead, but it behaves similarly.

Doesn't work with VRChat

I'm not sure if this is a VRChat issue or an issue with this IPC bridge but I've mentioned it both under the Proton/VRChat discussion on GitHub (ValveSoftware/Proton#1199 (comment)) and here. It's a good possibility that VRChat will disable its Discord rich presence when loading in Proton, similar to how they disabled AVPro players

Not working with subnautica below zero

Well i have no idea if this will go anywhere but here it goes, currently i have the program being launched with PROTON_REMOTE_DEBUG_CMD=$HOME/bin/wine-discord-ipc-bridge/winediscordipcbridge.exe PRESSURE_VESSEL_FILESYSTEMS_RW="/run/user/1000" PROTON_LOG=1 %command%, tested with proton GE 6.21-2, proton 6.3-8, and proton 5.13-6, none worked, though the last 2 had this appear https://i.imgur.com/0WA9Xlk.png, which isn't RPC but might mean something, i also made my own small program to test that it wasn't an issue with the executable https://gist.github.com/NepNep21/d604abeb7e4c90a04e37f697d6f6fa11 and as i thought, that worked fine, meaning this is an issue with either the game, or how the program is being launched, after checking the proton log i can see that the program is started with the first 2 proton versions mentioned, but not the last, which is confirmed by the fact i had to manually stop the game on steam with those same 2 versions (since the game never connected to allow the program to automatically stop)

Proton issue

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 ๐Ÿ˜•

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.