RetroArch
discord_rpc.h
Go to the documentation of this file.
1 #pragma once
2 #include <stdint.h>
3 
4 // clang-format off
5 
6 #if defined(DISCORD_DYNAMIC_LIB)
7 # if defined(_WIN32)
8 # if defined(DISCORD_BUILDING_SDK)
9 # define DISCORD_EXPORT __declspec(dllexport)
10 # else
11 # define DISCORD_EXPORT __declspec(dllimport)
12 # endif
13 # else
14 # define DISCORD_EXPORT __attribute__((visibility("default")))
15 # endif
16 #else
17 # define DISCORD_EXPORT
18 #endif
19 
20 // clang-format on
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 typedef struct DiscordRichPresence {
27  const char* state; /* max 128 bytes */
28  const char* details; /* max 128 bytes */
31  const char* largeImageKey; /* max 32 bytes */
32  const char* largeImageText; /* max 128 bytes */
33  const char* smallImageKey; /* max 32 bytes */
34  const char* smallImageText; /* max 128 bytes */
35  const char* partyId; /* max 128 bytes */
36  int partySize;
37  int partyMax;
38  const char* matchSecret; /* max 128 bytes */
39  const char* joinSecret; /* max 128 bytes */
40  const char* spectateSecret; /* max 128 bytes */
43 
44 typedef struct DiscordUser {
45  const char* userId;
46  const char* username;
47  const char* discriminator;
48  const char* avatar;
49 } DiscordUser;
50 
51 typedef struct DiscordEventHandlers {
52  void (*ready)(const DiscordUser* request);
53  void (*disconnected)(int errorCode, const char* message);
54  void (*errored)(int errorCode, const char* message);
55  void (*joinGame)(const char* joinSecret);
56  void (*spectateGame)(const char* spectateSecret);
57  void (*joinRequest)(const DiscordUser* request);
59 
60 #define DISCORD_REPLY_NO 0
61 #define DISCORD_REPLY_YES 1
62 #define DISCORD_REPLY_IGNORE 2
63 
64 DISCORD_EXPORT void Discord_Initialize(const char* applicationId,
65  DiscordEventHandlers* handlers,
66  int autoRegister,
67  const char* optionalSteamId);
69 
70 /* checks for incoming messages, dispatches callbacks */
72 
73 /* If you disable the lib starting its own io thread, you'll need to call this from your own */
74 #ifdef DISCORD_DISABLE_IO_THREAD
76 #endif
77 
80 
81 DISCORD_EXPORT void Discord_Respond(const char* userid, /* DISCORD_REPLY_ */ int reply);
82 
84 
85 #ifdef __cplusplus
86 } /* extern "C" */
87 #endif
DISCORD_EXPORT void Discord_Initialize(const char *applicationId, DiscordEventHandlers *handlers, int autoRegister, const char *optionalSteamId)
Definition: discord_rpc.cpp:271
int64_t endTimestamp
Definition: discord_rpc.h:30
const char * username
Definition: discord_rpc.h:46
void(* spectateGame)(const char *spectateSecret)
Definition: discord_rpc.h:56
Definition: discord_rpc.h:44
const char * matchSecret
Definition: discord_rpc.h:38
void(* disconnected)(int errorCode, const char *message)
Definition: discord_rpc.h:53
void(* joinGame)(const char *joinSecret)
Definition: discord_rpc.h:55
DISCORD_EXPORT void Discord_ClearPresence(void)
Definition: discord_rpc.cpp:375
const char * state
Definition: discord_rpc.h:27
DISCORD_EXPORT void Discord_Respond(const char *userid, int reply)
Definition: discord_rpc.cpp:380
static void Discord_UpdateConnection(void)
Definition: discord_rpc.cpp:132
typedef void(__stdcall *PFN_DESTRUCTION_CALLBACK)(void *pData)
DISCORD_EXPORT void Discord_Shutdown(void)
Definition: discord_rpc.cpp:348
void(* ready)(const DiscordUser *request)
Definition: discord_rpc.h:52
int partyMax
Definition: discord_rpc.h:37
struct DiscordEventHandlers DiscordEventHandlers
DISCORD_EXPORT void Discord_RunCallbacks(void)
Definition: discord_rpc.cpp:395
const char * discriminator
Definition: discord_rpc.h:47
const char * smallImageKey
Definition: discord_rpc.h:33
const char * userId
Definition: discord_rpc.h:45
void(* joinRequest)(const DiscordUser *request)
Definition: discord_rpc.h:57
const char * avatar
Definition: discord_rpc.h:48
struct DiscordUser DiscordUser
const char * largeImageText
Definition: discord_rpc.h:32
GLenum GLuint GLenum GLsizei const GLchar * message
Definition: glext.h:6233
const char * details
Definition: discord_rpc.h:28
struct DiscordRichPresence DiscordRichPresence
const char * largeImageKey
Definition: discord_rpc.h:31
int partySize
Definition: discord_rpc.h:36
DISCORD_EXPORT void Discord_UpdateHandlers(DiscordEventHandlers *handlers)
Definition: discord_rpc.cpp:474
int8_t instance
Definition: discord_rpc.h:41
void(* errored)(int errorCode, const char *message)
Definition: discord_rpc.h:54
const char * smallImageText
Definition: discord_rpc.h:34
Definition: discord_rpc.h:26
const char * joinSecret
Definition: discord_rpc.h:39
signed __int64 int64_t
Definition: stdint.h:135
DISCORD_EXPORT void Discord_UpdatePresence(const DiscordRichPresence *presence)
Definition: discord_rpc.cpp:365
int64_t startTimestamp
Definition: discord_rpc.h:29
#define DISCORD_EXPORT
Definition: discord_rpc.h:17
Definition: discord_rpc.h:51
const char * partyId
Definition: discord_rpc.h:35
signed char int8_t
Definition: stdint.h:121
const char * spectateSecret
Definition: discord_rpc.h:40