Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
7dc663a170 | |||
f872b4e49c | |||
ca5d70a5f9 | |||
ee9c504d1c | |||
127eadcb89 | |||
a7808a20ed |
@ -24,6 +24,8 @@ function.
|
|||||||
Download a release package, extract it, add `/include` to your compile includes, `/lib` to your
|
Download a release package, extract it, add `/include` to your compile includes, `/lib` to your
|
||||||
linker paths, and link with `discord-rpc`.
|
linker paths, and link with `discord-rpc`.
|
||||||
|
|
||||||
|
Note that the release packages were compiled using Visual Studio 2015, so the [Visual C++ Redistributable for VS2015](https://www.microsoft.com/en-us/download/details.aspx?id=48145) will be a requirement for your game. If you wish to avoid this dependency, you should compile the libraries yourself using whatever dependencies are already in your game.
|
||||||
|
|
||||||
### From repo
|
### From repo
|
||||||
|
|
||||||
There's a [CMake](https://cmake.org/download/) file that should be able to generate the lib for
|
There's a [CMake](https://cmake.org/download/) file that should be able to generate the lib for
|
||||||
|
@ -56,7 +56,9 @@ Below is a full example of a `SET_ACTIVITY` command. Field restrictions like siz
|
|||||||
|
|
||||||
## New RPC Events
|
## New RPC Events
|
||||||
|
|
||||||
The two new RPC events for Rich Presence power the ability to join and spectate your friends' games. First is the `GAME_JOIN` event:
|
The three new RPC events for Rich Presence power the ability to join and spectate your friends' games.
|
||||||
|
|
||||||
|
First is the `ACTIVITY_JOIN` event:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
@ -64,11 +66,11 @@ The two new RPC events for Rich Presence power the ability to join and spectate
|
|||||||
"data": {
|
"data": {
|
||||||
"secret": "025ed05c71f639de8bfaa0d679d7c94b2fdce12f"
|
"secret": "025ed05c71f639de8bfaa0d679d7c94b2fdce12f"
|
||||||
},
|
},
|
||||||
"evnt": "GAME_JOIN"
|
"evnt": "ACTIVITY_JOIN"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
And second is the `GAME_SPECTATE` event:
|
Second is the `ACTIVITY_SPECTATE` event:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
@ -76,7 +78,25 @@ And second is the `GAME_SPECTATE` event:
|
|||||||
"data": {
|
"data": {
|
||||||
"secret": "e7eb30d2ee025ed05c71ea495f770b76454ee4e0"
|
"secret": "e7eb30d2ee025ed05c71ea495f770b76454ee4e0"
|
||||||
},
|
},
|
||||||
"evnt": "GAME_SPECTATE"
|
"evnt": "ACTIVITY_SPECTATE"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
And third is the `ACTIVITY_JOIN_REQUEST` event:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"cmd": "DISPATCH",
|
||||||
|
"data": {
|
||||||
|
"user": {
|
||||||
|
"id": "53908232506183680",
|
||||||
|
"username": "Mason",
|
||||||
|
"discriminator": "1337",
|
||||||
|
"avatar": "a_bab14f271d565501444b2ca3be944b25"
|
||||||
|
},
|
||||||
|
"secret": "e459ca99273f59909dd16ed97865f3ad"
|
||||||
|
},
|
||||||
|
"evnt": "ACTIVITY_JOIN_REQUEST"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -85,7 +105,7 @@ In order to receive these events, you need to [subscribe](https://discordapp.com
|
|||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"nonce": "be9a6de3-31d0-4767-a8e9-4818c5690015",
|
"nonce": "be9a6de3-31d0-4767-a8e9-4818c5690015",
|
||||||
"evt": "GAME_JOIN",
|
"evt": "ACTIVITY_JOIN",
|
||||||
"cmd": "SUBSCRIBE"
|
"cmd": "SUBSCRIBE"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@ -93,7 +113,15 @@ In order to receive these events, you need to [subscribe](https://discordapp.com
|
|||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"nonce": "ae9qdde3-31d0-8989-a8e9-dnakwy174he",
|
"nonce": "ae9qdde3-31d0-8989-a8e9-dnakwy174he",
|
||||||
"evt": "GAME_SPECTATE",
|
"evt": "ACTIVITY_SPECTATE",
|
||||||
|
"cmd": "SUBSCRIBE"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"nonce": "5dc0c062-98c6-47a0-8922-bbb52e9d6afa",
|
||||||
|
"evt": "ACTIVITY_JOIN_REQUEST",
|
||||||
"cmd": "SUBSCRIBE"
|
"cmd": "SUBSCRIBE"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
Binary file not shown.
@ -30,6 +30,7 @@ if(WIN32)
|
|||||||
set(BASE_RPC_SRC ${BASE_RPC_SRC} connection_win.cpp discord_register_win.cpp)
|
set(BASE_RPC_SRC ${BASE_RPC_SRC} connection_win.cpp discord_register_win.cpp)
|
||||||
add_library(discord-rpc ${RPC_LIBRARY_TYPE} ${BASE_RPC_SRC})
|
add_library(discord-rpc ${RPC_LIBRARY_TYPE} ${BASE_RPC_SRC})
|
||||||
target_compile_options(discord-rpc PRIVATE /EHsc
|
target_compile_options(discord-rpc PRIVATE /EHsc
|
||||||
|
/MT
|
||||||
/Wall
|
/Wall
|
||||||
/wd4100 # unreferenced formal parameter
|
/wd4100 # unreferenced formal parameter
|
||||||
/wd4514 # unreferenced inline
|
/wd4514 # unreferenced inline
|
||||||
@ -60,7 +61,10 @@ if(UNIX)
|
|||||||
target_link_libraries(discord-rpc PUBLIC pthread)
|
target_link_libraries(discord-rpc PUBLIC pthread)
|
||||||
target_compile_options(discord-rpc PRIVATE
|
target_compile_options(discord-rpc PRIVATE
|
||||||
-g
|
-g
|
||||||
-Weverything
|
-Wall
|
||||||
|
-Wextra
|
||||||
|
-Wpedantic
|
||||||
|
-Werror
|
||||||
-Wno-unknown-pragmas # pragma push thing doesn't work on clang
|
-Wno-unknown-pragmas # pragma push thing doesn't work on clang
|
||||||
-Wno-old-style-cast # it's fine
|
-Wno-old-style-cast # it's fine
|
||||||
-Wno-c++98-compat # that was almost 2 decades ago
|
-Wno-c++98-compat # that was almost 2 decades ago
|
||||||
|
@ -33,9 +33,15 @@ struct QueuedMessage {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct JoinRequest {
|
struct JoinRequest {
|
||||||
char userId[24];
|
// snowflake (64bit int), turned into a ascii decimal string, at most 20 chars +1 null
|
||||||
char username[48];
|
// terminator = 21
|
||||||
char avatar[128];
|
char userId[22];
|
||||||
|
// 32 unicode glyphs is max name size => 4 bytes per glyph in the worst case, +1 for null
|
||||||
|
// terminator = 129
|
||||||
|
char username[130];
|
||||||
|
// optional 'a_' + md5 hex digest (32 bytes) + null terminator = 35
|
||||||
|
char avatar[36];
|
||||||
|
// +1 on each because: it's even / I'm paranoid
|
||||||
};
|
};
|
||||||
|
|
||||||
static RpcConnection* Connection{nullptr};
|
static RpcConnection* Connection{nullptr};
|
||||||
|
Reference in New Issue
Block a user