mirror of
https://github.com/EnderIce2/rpc-bridge.git
synced 2025-05-25 14:04:37 +00:00
Print version on program start
This commit is contained in:
parent
7363ee64d5
commit
ccf09806c9
5
.vscode/c_cpp_properties.json
vendored
5
.vscode/c_cpp_properties.json
vendored
@ -5,7 +5,10 @@
|
||||
"includePath": [
|
||||
"${workspaceFolder}/**"
|
||||
],
|
||||
"defines": [],
|
||||
"defines": [
|
||||
"GIT_COMMIT",
|
||||
"GIT_BRANCH"
|
||||
],
|
||||
"cStandard": "c17",
|
||||
"cppStandard": "gnu++17",
|
||||
"intelliSenseMode": "windows-gcc-x64"
|
||||
|
5
Makefile
5
Makefile
@ -1,7 +1,10 @@
|
||||
C_SOURCES = $(shell find ./ -type f -name '*.c')
|
||||
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
|
||||
|
||||
# DBGFLAGS = -Wl,--export-all-symbols -g -O0 -ggdb3 -Wall
|
||||
|
13
gui.c
13
gui.c
@ -191,11 +191,14 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
case IDM_HELP_ABOUT:
|
||||
{
|
||||
char msg[256];
|
||||
sprintf(msg, "rpc-bridge v%s\n\n"
|
||||
"Simple bridge that allows you to use Discord Rich Presence with Wine games/software.\n\n"
|
||||
"Created by EnderIce2\n\n"
|
||||
"Licensed under the MIT License",
|
||||
VER_VERSION_STR);
|
||||
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"
|
||||
"Created by EnderIce2\n\n"
|
||||
"Licensed under the MIT License",
|
||||
VER_VERSION_STR, GIT_BRANCH, GIT_COMMIT);
|
||||
MessageBox(NULL, msg, "About", MB_OK);
|
||||
break;
|
||||
}
|
||||
|
61
main.c
61
main.c
@ -273,38 +273,38 @@ void HandleArguments(int argc, char *argv[])
|
||||
}
|
||||
else if (strcmp(argv[1], "--version") == 0)
|
||||
{
|
||||
printf("%s\n", VER_VERSION_STR);
|
||||
/* Already shows the version */
|
||||
ExitProcess(0);
|
||||
}
|
||||
else if (strcmp(argv[1], "--help") == 0)
|
||||
{
|
||||
printf("Usage:\n"
|
||||
" %s [args]\n"
|
||||
"\n"
|
||||
"Arguments:\n"
|
||||
" --help Show this help\n"
|
||||
"\n"
|
||||
" --version Show version\n"
|
||||
"\n"
|
||||
" --install Install service\n"
|
||||
" This will copy the binary to C:\\windows\\bridge.exe and register it as a service\n"
|
||||
"\n"
|
||||
" --uninstall Uninstall service\n"
|
||||
" This will remove the service and delete C:\\windows\\bridge.exe\n"
|
||||
"\n"
|
||||
" --steam Reserved for Steam\n"
|
||||
" This will start the service and exit (used with bridge.sh)\n"
|
||||
"\n"
|
||||
" --no-service Do not run as service\n"
|
||||
" (only for --steam)\n"
|
||||
"\n"
|
||||
" --service Reserved for service\n"
|
||||
"\n"
|
||||
" --rpc <dir> Set RPC_PATH environment variable\n"
|
||||
" This is used to specify the directory where 'discord-ipc-0' is located\n"
|
||||
"\n"
|
||||
"Note: If no arguments are provided, the GUI will be shown instead\n",
|
||||
argv[0]);
|
||||
print("Usage:\n"
|
||||
" %s [args]\n"
|
||||
"\n"
|
||||
"Arguments:\n"
|
||||
" --help Show this help\n"
|
||||
"\n"
|
||||
" --version Show version\n"
|
||||
"\n"
|
||||
" --install Install service\n"
|
||||
" This will copy the binary to C:\\windows\\bridge.exe and register it as a service\n"
|
||||
"\n"
|
||||
" --uninstall Uninstall service\n"
|
||||
" This will remove the service and delete C:\\windows\\bridge.exe\n"
|
||||
"\n"
|
||||
" --steam Reserved for Steam\n"
|
||||
" This will start the service and exit (used with bridge.sh)\n"
|
||||
"\n"
|
||||
" --no-service Do not run as service\n"
|
||||
" (only for --steam)\n"
|
||||
"\n"
|
||||
" --service Reserved for service\n"
|
||||
"\n"
|
||||
" --rpc <dir> Set RPC_PATH environment variable\n"
|
||||
" This is used to specify the directory where 'discord-ipc-0' is located\n"
|
||||
"\n"
|
||||
"Note: If no arguments are provided, the GUI will be shown instead\n",
|
||||
argv[0]);
|
||||
ExitProcess(0);
|
||||
}
|
||||
}
|
||||
@ -316,11 +316,12 @@ int main(int argc, char *argv[])
|
||||
g_logFile = fopen(logFilePath, "w");
|
||||
if (g_logFile == NULL)
|
||||
{
|
||||
printf("Failed to open logs file: %ld\n",
|
||||
GetLastError());
|
||||
MessageBox(NULL, "Failed to open logs file", "Error", MB_OK | MB_ICONERROR);
|
||||
printf("Failed to open logs file: %ld\n", GetLastError());
|
||||
ExitProcess(1);
|
||||
}
|
||||
|
||||
print("rpc-bridge v%s %s-%s\n", VER_VERSION_STR, GIT_BRANCH, GIT_COMMIT);
|
||||
if (argc > 1)
|
||||
HandleArguments(argc, argv);
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user