Closed relma2 closed 5 months ago
I fetched the log file for one of the games and it looks like this:
Running as service
Starting service
Service started
Pipe \\.\pipe\discord-ipc-0(0x7c) created
Waiting for pipe connection
Pipe connected
Socket 21 created
Connecting to socket
Allocated 4096 bytes at 0x20000
IPC directory: /run/user/1000
Connecting to /run/user/1000/discord-ipc-0
Connected to Discord
Created in thread 0x80
Created out thread 0x84
Waiting for threads to exit
In thread started using fd 21 and pipe 0x7c
Out thread started using fd 21 and pipe 0x7c
Writing 49 bytes to unix pipe: "
So, I think the bridge.exe is recognizing and connecting the pipes, and writing data to it.
Hmm, I tested Hades, and it works without any issues.
Steam launch options: /home/enderice2/rpc-bridge/build/bridge.sh %command%
From your log, it should work. Do you by any chance use multiple Discord clients?
Regarding the link to UnityNamedPipe.cs:219, that code is intended for native builds of the game.
I'm using the Vesktop discord client on flatpak -- in order to attempt to get that working, I edited the build.sh script to add Vesktop to the list of IPC_PATHS, like this:
IPC_PATHS="$TEMP_PATH /run/user/$UID $TEMP_PATH/snap.discord $TEMP_PATH/app/com.discordapp.Discord $TEMP_PATH/app/dev.vencord.Vesktop"
I also made sure Vesktop recognized and had access to the discord rpc pipe, as outlined here, but its not working
What discord client are you using, and is it on flatpak?
I think I figured something out -- your script assumes there is a socket called "$discord_ipc"/discord-ipc-0
in the filesystem (and that the file size is nonzero), whereas in Vesktop, that socket is located at /run/user/$UID/.flatpak/dev.vencord.Vesktop/xdg-run/discord-ipc-0
. So, in the IPC_PATHS, I must add $TEMP_PATH/.flatpak/dev.vencord.Vesktop/xdg-run/
Also, the file size of the sockets is 0B. So I changed the if statement to if [ -F "$discord_ipc"/discord-ipc-0 ]; then ...
Neither of these things worked
I'm using the Vesktop discord client on flatpak
I tested with Vesktop from flathub and only send-presence.exe shows the rich presence.
It seems that arRPC might be the issue. Sends 0x45 (Capital E) instead of 0x7F and the content different. This issue is not related to this project.
What discord client are you using, and is it on flatpak?
I'm using the deb package from discord.com.
Try this build.zip and let me know if it works. It’s possible there’s an issue on my system.
Your build.zip did not work on my end.
So if this is an issue with the implementation of arRPC, what needs to be fixed?
Ok, so I ran the arRPC server on my machine, and the arRPC server detects the game being run and displays it in my Vesktop Discord! However, the "Location" of the Discord RPC programmed in does not show up -- like its supposed to say "In
Your build.zip did not work on my end.
The logs are similar to the image I sent above?
So if this is an issue with the implementation of arRPC, what needs to be fixed?
Probably, this project only reads and writes data between games and Discord.
Ok, so I ran the arRPC server on my machine, and the arRPC server detects the game being run and displays it in my Vesktop Discord! However, the "Location" of the Discord RPC programmed in does not show up -- like its supposed to say "In
"
So it shows the game, but the content of the rich presence is missing?
The logs are similar to the image I sent above? The log file looks like this:
Running as service Starting service Service started Pipe \\.\pipe\discord-ipc-0(0x7c) created Waiting for pipe connection Pipe connected Socket 21 created Connecting to socket Allocated 4096 bytes at 0x20000 IPC directory: /run/user/1000 Connecting to /run/user/1000/discord-ipc-0 Connected to Discord Created in thread 0x80 Created out thread 0x84 Waiting for threads to exit In thread started using fd 21 and pipe 0x7c Out thread started using fd 21 and pipe 0x7c Writing 49 bytes to unix pipe: "
The output does not display which bytes are being displayed to the unix pipe
So it shows the game, but the content of the rich presence is missing?
That's correct.
Why can't you accept 0x45? Why does only 0x7F work?
Why can't you accept 0x45? Why does only 0x7F work?
It's not about the bridge, probably the game doesn't work with what arRPC responds.
The output does not display which bytes are being displayed to the unix pipe
Oh, I think this exhausts the stack or something? Probably the thread stops because of this. https://github.com/EnderIce2/rpc-bridge/blob/08feef776b8b8e29e082e568bf631d1cd2684b9f/bridge.c#L436 https://github.com/EnderIce2/rpc-bridge/blob/08feef776b8b8e29e082e568bf631d1cd2684b9f/bridge.c#L455-L458
I changed the local variable to use malloc() instead in this build.zip.
your new build.zip doesn't output a log file at all when running via Steam.
EDIT: This is only for one game which is behaving weirdly. Hades does output log files
Also I lied about the bytes not being in the log file - turns out my text editor stops displaying characters once it encounters a weird character. Opening it with an editor like vim reveals the contents of the data sent over the pipe.
So I have the following three log files for Hades -
official.bridge.log vesktop-aur.bridge.log vesktop-flatpak.bridge.log
official.bridge.log is the logfile with the official discord client (non-flatpak). It works flawlessly. vesktop-aur.bridge.log is with the AURversion of Vesktop (non-flatpak). It also works. vesktop-flatpak.bridge.log is with the Vesktop flatpak. As you can see, the first two log files succesfully connect to /run/user/1000/discord-ipc-0 socket. The latter tries the three sockets discordUnixPipes
in bridge.c
. All three sockets fail, leading to a "socket failed with -2" error. I added a fourth socket to discordUnixPipes
, the "/.flatpak/dev.vencord.Vesktop/xdg-run/discord-ipc-0"
, but that socket also fails with the Vesktop flatpak.
I inspected the /run/user/1000/.flatpak/dev.vencord.Vesktop/xdg-run/discord-ipc-0
, aand there doesen't seem to be anything wrong with it. It is a socket when the Vesktop flatpak is running.
The vesktop-flatpak.bridge.log is an older version where it doesn't search in .flatpak/dev.vencord.Vesktop/xdg-run/
Try to download the latest artifact https://github.com/EnderIce2/rpc-bridge/actions/runs/9331815353 and let me know if it works. If it fails, try to delete /run/user/1000/discord-ipc-0 when using Vesktop Flatpak.
It fails. There is no /run/user/1000/discord-ipc-0 when using Vesktop Flatpak. Here is the log file:
NO /run/user/1000/discord-ipc-0: vesktop-with-exhaustive-probing.bridge.log
With a SYMLINK from ln -sf $XDG_RUNTIME_DIR/{.flatpak/dev.vencord.Vesktop/xdg-run,}/discord-ipc-0
: vesktop-with-probe-symlinked.bridge.log
In the former, the probe connects to the flatpak socket with "error: 0", then writes 48 bytes to the socket, and in the latter, connects to the /run/user/1000 socket (which is actually the flatpak socket symlinked)
Here is a log file with a WORKING game on Vesktop called Vivid/Stasis: vividstasis-working.bridge.log
It has the same inconsistent header as in the Unity game Hades, but the game does not quit sending data over the pipe because of that. Vivid stasis is written in a different game engine, so its likely its implementation of discord-rpc does not care about wrong headers.
I suspect that the true issue may be with Unity's implementation of discord rpc, but even if they fix it, the older games that still use the broken implementation won't be accesible
I suspect that the true issue may be with Unity's implementation of discord rpc, but even if they fix it, the older games that still use the broken implementation won't be accesible
I can confirm that only some games work, (like vivid/stasis) but Hades, Content Warning, Among Us & Lethal Company (modded) not.
I think vivid/stasis worked because it uses NekoPresence instead.
I tried following your instructions for a couple of Unity games I own on Steam, Hades and Back to the Dawn (with a mod to support discord rpc). It didn't work, likely because the name of the pipes being connected is wrong. I'm looking at the file https://github.com/Lachee/discord-rpc-csharp/blob/master/Unity%20Example/Assets/Discord%20RPC/Scripts/Control/UnityNamedPipe.cs#L219 and I think the pipe name is supposed to be "snap.discord/discord-ipc-", where is the number of the pipe, usually 0.