17 Commits

Author SHA1 Message Date
9d2440f616 Update LICENSE
Some checks failed
Build and Deploy docs / deploy (push) Failing after 12m12s
Build and Deploy docs / build (push) Failing after 6m5s
2025-01-04 06:55:43 +02:00
51cbb666f9 Update build-deploy.yml
Some checks failed
Build and Deploy docs / build (push) Failing after 4m46s
Build and Deploy docs / deploy (push) Failing after 48s
2024-12-30 00:27:21 +02:00
1deccc5a63 Update CODE_OF_CONDUCT.md
Some checks failed
Build and Deploy docs / build (push) Failing after 28s
Build and Deploy docs / deploy (push) Failing after 34s
2024-12-11 05:54:45 +02:00
3412c3c011 Update issue templates
Some checks failed
Build and Deploy docs / build (push) Has been cancelled
Build and Deploy docs / deploy (push) Has been cancelled
2024-10-30 16:52:46 +02:00
c15c4df29e Create CODE_OF_CONDUCT.md 2024-10-30 16:39:46 +02:00
3a0b9ddb2a Ensure log file is properly closed
Some checks are pending
Build and Deploy docs / build (push) Waiting to run
Build and Deploy docs / deploy (push) Waiting to run
* Closing the log before service starts prevents log file to be corrupted (like in #7)
2024-10-30 01:08:12 +02:00
8786efd144 Fix formatting and add game links 2024-06-02 17:52:52 +03:00
2024de9408 Add "Known Issues" section
* Using Vesktop may cause issues with some games #4
2024-06-02 17:45:48 +03:00
e8926edb41 Add more screenshots
* Content Warning
* Hades
* Lethal Company
* vivid/stasis
2024-06-02 17:41:16 +03:00
9f1a9de3d7 Update actions/checkout and actions/upload-artifact to v4 2024-06-01 19:57:30 +03:00
ccf09806c9 Print version on program start 2024-06-01 19:39:39 +03:00
7363ee64d5 Update bridge.manifest with correct assembly name 2024-06-01 19:35:01 +03:00
a3023e349e Update gui.png 2024-06-01 02:56:12 +03:00
39966d7149 Update Discord socket search
* Test multiple instances
* Add support for Discord Canary (Snap)
* Add support for Vesktop (Flatpak)
2024-06-01 01:37:40 +03:00
a8904bf3f1 Update version 2024-06-01 00:57:06 +03:00
08feef776b Update version 2024-05-31 01:18:38 +03:00
8545467a85 Add .elf file to .gitignore 2024-05-30 05:33:28 +03:00
20 changed files with 311 additions and 90 deletions

31
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@ -0,0 +1,31 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: EnderIce2
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Log File**
Located in `/path/to/prefix/drive_c/windows/logs/bridge.log`
**Device (please complete the following information):**
- OS: [e.g. SteamOS, Ubuntu, macOS]
- Version [e.g. 22.04]
**Additional context**
Add any other context about the problem here.

View File

@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: EnderIce2
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

View File

@ -13,13 +13,13 @@ jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: dependencies - name: dependencies
run: sudo apt-get update && sudo apt-get install gcc-mingw-w64 make run: sudo apt update && sudo apt -y install gcc-mingw-w64 make
- name: make - name: make
run: make run: make
- name: artifact - name: artifact
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v4
with: with:
name: bridge name: bridge
path: build path: build

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
*.o *.o
*.exe *.exe
*.res *.res
*.elf

View File

@ -5,7 +5,10 @@
"includePath": [ "includePath": [
"${workspaceFolder}/**" "${workspaceFolder}/**"
], ],
"defines": [], "defines": [
"GIT_COMMIT",
"GIT_BRANCH"
],
"cStandard": "c17", "cStandard": "c17",
"cppStandard": "gnu++17", "cppStandard": "gnu++17",
"intelliSenseMode": "windows-gcc-x64" "intelliSenseMode": "windows-gcc-x64"

128
CODE_OF_CONDUCT.md Normal file
View File

@ -0,0 +1,128 @@
# Contributor Covenant Code of Conduct
## Our Pledge
We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.
We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.
## Our Standards
Examples of behavior that contributes to a positive environment for our
community include:
* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
overall community
Examples of unacceptable behavior include:
* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Enforcement Responsibilities
Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.
Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.
## Scope
This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
enderice2@protonmail.com.
All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the
reporter of any incident.
## Enforcement Guidelines
Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:
### 1. Correction
**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.
**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.
### 2. Warning
**Community Impact**: A violation through a single incident or series
of actions.
**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.
### 3. Temporary Ban
**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.
**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.
### 4. Permanent Ban
**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.
**Consequence**: A permanent ban from any sort of public interaction within
the community.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.

View File

@ -1,4 +1,4 @@
Copyright (c) 2024 EnderIce2 Copyright (c) 2025 EnderIce2
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -1,7 +1,10 @@
C_SOURCES = $(shell find ./ -type f -name '*.c') C_SOURCES = $(shell find ./ -type f -name '*.c')
C_OBJECTS = $(C_SOURCES:.c=.o) C_OBJECTS = $(C_SOURCES:.c=.o)
CFLAGS = -std=c17 -Wno-int-conversion GIT_COMMIT = $(shell git rev-parse --short HEAD)
GIT_BRANCH = $(shell git rev-parse --abbrev-ref HEAD)
CFLAGS = -std=c17 -Wno-int-conversion -DGIT_COMMIT='"$(GIT_COMMIT)"' -DGIT_BRANCH='"$(GIT_BRANCH)"'
LFLAGS = -lgdi32 LFLAGS = -lgdi32
# DBGFLAGS = -Wl,--export-all-symbols -g -O0 -ggdb3 -Wall # DBGFLAGS = -Wl,--export-all-symbols -g -O0 -ggdb3 -Wall

View File

@ -282,25 +282,28 @@ void ConnectToSocket(int fd)
print("IPC directory: %s\n", runtime); print("IPC directory: %s\n", runtime);
/* TODO: check for multiple discord instances and create a pipe for each */ /* TODO: check for multiple discord instances and create a pipe for each */
const char *discordUnixPipes[] = { const char *discordUnixSockets[] = {
"/discord-ipc-0", "%s/discord-ipc-%d",
"/snap.discord/discord-ipc-0", "%s/app/com.discordapp.Discord/discord-ipc-%d",
"/app/com.discordapp.Discord/discord-ipc-0", "%s/.flatpak/dev.vencord.Vesktop/xdg-run/discord-ipc-%d",
"%s/snap.discord/discord-ipc-%d",
"%s/snap.discord-canary/discord-ipc-%d",
}; };
struct sockaddr_un socketAddr; struct sockaddr_un socketAddr;
socketAddr.sun_family = AF_UNIX; socketAddr.sun_family = AF_UNIX;
char *pipePath = NULL;
int sockRet = -1;
for (int i = 0; i < sizeof(discordUnixPipes) / sizeof(discordUnixPipes[0]); i++) int sockRet = 0;
for (int i = 0; i < sizeof(discordUnixSockets) / sizeof(discordUnixSockets[0]); i++)
{ {
pipePath = malloc(strlen(runtime) + strlen(discordUnixPipes[i]) + 1); size_t pipePathLen = strlen(runtime) + strlen(discordUnixSockets[i]) + 1;
strcpy(pipePath, runtime); char *pipePath = malloc(pipePathLen);
strcat(pipePath, discordUnixPipes[i]);
strcpy_s(socketAddr.sun_path, sizeof(socketAddr.sun_path), pipePath);
print("Connecting to %s\n", pipePath); for (int j = 0; j < 16; j++)
{
snprintf(pipePath, pipePathLen, discordUnixSockets[i], runtime, j);
strcpy_s(socketAddr.sun_path, sizeof(socketAddr.sun_path), pipePath);
print("Probing %s\n", pipePath);
if (IsLinux) if (IsLinux)
{ {
@ -314,11 +317,20 @@ void ConnectToSocket(int fd)
else else
sockRet = sys_connect(fd, (caddr_t)&socketAddr, sizeof(socketAddr)); sockRet = sys_connect(fd, (caddr_t)&socketAddr, sizeof(socketAddr));
free(pipePath); print(" error: %d\n", sockRet);
if (sockRet >= 0) if (sockRet >= 0)
break; break;
} }
if (sockRet >= 0)
{
print("Connecting to %s\n", pipePath);
free(pipePath);
break;
}
free(pipePath);
}
if (sockRet < 0) if (sockRet < 0)
{ {
print("socketcall failed for: %d\n", sockRet); print("socketcall failed for: %d\n", sockRet);

View File

@ -3,7 +3,7 @@
<assemblyIdentity <assemblyIdentity
version="1.0.0.0" version="1.0.0.0"
processorArchitecture="amd64" processorArchitecture="amd64"
name="EnderIce2.rpc-bridge" name="com.enderice2.rpc-bridge"
type="win32" type="win32"
/> />
<description>Simple bridge that allows you to use Discord Rich Presence with Wine games/software.</description> <description>Simple bridge that allows you to use Discord Rich Presence with Wine games/software.</description>

View File

@ -21,10 +21,10 @@ TEMP_PATH="$XDG_RUNTIME_DIR"
TEMP_PATH=${TEMP_PATH:-"$TMPDIR"} TEMP_PATH=${TEMP_PATH:-"$TMPDIR"}
VESSEL_PATH="$BRIDGE_PATH" VESSEL_PATH="$BRIDGE_PATH"
IPC_PATHS="$TEMP_PATH /run/user/$UID $TEMP_PATH/snap.discord $TEMP_PATH/app/com.discordapp.Discord" IPC_PATHS="$TEMP_PATH /run/user/$UID $TEMP_PATH/app/com.discordapp.Discord $TEMP_PATH/.flatpak/dev.vencord.Vesktop/xdg-run $TEMP_PATH/snap.discord $TEMP_PATH/snap.discord-canary"
for discord_ipc in $IPC_PATHS; do for discord_ipc in $IPC_PATHS; do
if [ -S "$discord_ipc"/discord-ipc-0 ]; then if [ -S "$discord_ipc"/discord-ipc-? ]; then
VESSEL_PATH="$BRIDGE_PATH:$(echo "$discord_ipc"/discord-ipc-0)" VESSEL_PATH="$BRIDGE_PATH:$(echo "$discord_ipc"/discord-ipc-?)"
break break
fi fi
done done

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 11 KiB

BIN
docs/assets/hades.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 551 KiB

BIN
docs/assets/vividstasis.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 945 KiB

View File

@ -20,11 +20,32 @@ For v1.0, see [the original README](https://github.com/EnderIce2/rpc-bridge/blob
--- ---
## Known Issues
- If you use **Vesktop**
Some games may not show up in Discord. This is because Vesktop uses arRPC, which it doesn't work with some games [#4](https://github.com/EnderIce2/rpc-bridge/issues/4#issuecomment-2143549407). This is not an issue with the bridge.
---
## Examples ## Examples
![lol](assets/lutris_lol.png "League Of Legends running under Wine using Lutris"){ width="600" } [**League Of Legends**](https://www.leagueoflegends.com/en-us/) running under Wine using Lutris
![image](assets/lutris_lol.png){ width="600" }
![among us](assets/steam_amongus.png "Among Us on Steam"){ width="600" } [**Among Us**](https://store.steampowered.com/app/945360/Among_Us/) on Steam
![image](assets/steam_amongus.png){ width="600" }
[**Content Warning**](https://store.steampowered.com/app/2881650/Content_Warning/) on Steam
![image](assets/contentwarning.png){ width="600" }
[**Hades**](https://store.steampowered.com/app/1145360/Hades/) on Steam
![image](assets/hades.png){ width="600" }
[**Lethal Company**](https://store.steampowered.com/app/1966720/Lethal_Company/) ([modded](https://thunderstore.io/c/lethal-company/p/mrov/LethalRichPresence/)) on Steam
![image](assets/lethalcompany.png){ width="600" }
[**vivid/stasis**](https://store.steampowered.com/app/2093940/vividstasis/) on Steam
![image](assets/vividstasis.png){ width="600" }
## Credits ## Credits

7
gui.c
View File

@ -191,11 +191,14 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
case IDM_HELP_ABOUT: case IDM_HELP_ABOUT:
{ {
char msg[256]; char msg[256];
sprintf(msg, "rpc-bridge v%s\n\n" snprintf(msg, sizeof(msg),
"rpc-bridge v%s\n"
" branch: %s\n"
" commit: %s\n\n"
"Simple bridge that allows you to use Discord Rich Presence with Wine games/software.\n\n" "Simple bridge that allows you to use Discord Rich Presence with Wine games/software.\n\n"
"Created by EnderIce2\n\n" "Created by EnderIce2\n\n"
"Licensed under the MIT License", "Licensed under the MIT License",
VER_VERSION_STR); VER_VERSION_STR, GIT_BRANCH, GIT_COMMIT);
MessageBox(NULL, msg, "About", MB_OK); MessageBox(NULL, msg, "About", MB_OK);
break; break;
} }

29
main.c
View File

@ -221,29 +221,27 @@ void HandleArguments(int argc, char *argv[])
HeapFree(GetProcessHeap(), 0, asciiPath); HeapFree(GetProcessHeap(), 0, asciiPath);
} }
print("(Steam) Starting service...\n"); print("(Steam) Starting service and then exiting...\n");
if (StartService(schService, 0, NULL) == FALSE) fclose(g_logFile);
if (StartService(schService, 0, NULL) != FALSE)
{ {
if (GetLastError() == ERROR_SERVICE_ALREADY_RUNNING) CloseServiceHandle(schService);
CloseServiceHandle(hSCManager);
ExitProcess(0);
}
else if (GetLastError() == ERROR_SERVICE_ALREADY_RUNNING)
{ {
print("(Steam) Service is already running\n");
CloseServiceHandle(schService); CloseServiceHandle(schService);
CloseServiceHandle(hSCManager); CloseServiceHandle(hSCManager);
ExitProcess(0); ExitProcess(0);
} }
print("StartService: %s\n", GetErrorMessage());
MessageBox(NULL, GetErrorMessage(), MessageBox(NULL, GetErrorMessage(),
"StartService", "StartService",
MB_OK | MB_ICONSTOP); MB_OK | MB_ICONSTOP);
ExitProcess(1); ExitProcess(1);
} }
print("(Steam) Service started successfully, exiting...\n");
CloseServiceHandle(schService);
CloseServiceHandle(hSCManager);
ExitProcess(0);
}
else if (strcmp(argv[1], "--install") == 0) else if (strcmp(argv[1], "--install") == 0)
{ {
char filename[MAX_PATH]; char filename[MAX_PATH];
@ -273,12 +271,12 @@ void HandleArguments(int argc, char *argv[])
} }
else if (strcmp(argv[1], "--version") == 0) else if (strcmp(argv[1], "--version") == 0)
{ {
printf("%s\n", VER_VERSION_STR); /* Already shows the version */
ExitProcess(0); ExitProcess(0);
} }
else if (strcmp(argv[1], "--help") == 0) else if (strcmp(argv[1], "--help") == 0)
{ {
printf("Usage:\n" print("Usage:\n"
" %s [args]\n" " %s [args]\n"
"\n" "\n"
"Arguments:\n" "Arguments:\n"
@ -316,11 +314,12 @@ int main(int argc, char *argv[])
g_logFile = fopen(logFilePath, "w"); g_logFile = fopen(logFilePath, "w");
if (g_logFile == NULL) if (g_logFile == NULL)
{ {
printf("Failed to open logs file: %ld\n", MessageBox(NULL, "Failed to open logs file", "Error", MB_OK | MB_ICONERROR);
GetLastError()); printf("Failed to open logs file: %ld\n", GetLastError());
ExitProcess(1); ExitProcess(1);
} }
print("rpc-bridge v%s %s-%s\n", VER_VERSION_STR, GIT_BRANCH, GIT_COMMIT);
if (argc > 1) if (argc > 1)
HandleArguments(argc, argv); HandleArguments(argc, argv);
else else

View File

@ -5,5 +5,5 @@
#define IDM_HELP_ABOUT 40003 #define IDM_HELP_ABOUT 40003
#define IDM_VIEW_LOG 40004 #define IDM_VIEW_LOG 40004
#define VER_VERSION 1, 1, 0, 0 #define VER_VERSION 1, 3, 0, 0
#define VER_VERSION_STR "1.1\0" #define VER_VERSION_STR "1.3\0"