all repos — mgba @ f6755a6e1b7b0cf2b944cd8ca842746f11d6bf82

mGBA Game Boy Advance Emulator

src/third-party/discord-rpc/include/discord_rpc.h (view raw)

 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
23extern "C" {
24#endif
25
26typedef struct DiscordRichPresence {
27    const char* state;   /* max 128 bytes */
28    const char* details; /* max 128 bytes */
29    int64_t startTimestamp;
30    int64_t endTimestamp;
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 */
41    int8_t instance;
42} DiscordRichPresence;
43
44typedef struct DiscordUser {
45    const char* userId;
46    const char* username;
47    const char* discriminator;
48    const char* avatar;
49} DiscordUser;
50
51typedef 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);
58} DiscordEventHandlers;
59
60#define DISCORD_REPLY_NO 0
61#define DISCORD_REPLY_YES 1
62#define DISCORD_REPLY_IGNORE 2
63
64DISCORD_EXPORT void Discord_Initialize(const char* applicationId,
65                                       DiscordEventHandlers* handlers,
66                                       int autoRegister,
67                                       const char* optionalSteamId);
68DISCORD_EXPORT void Discord_Shutdown(void);
69
70/* checks for incoming messages, dispatches callbacks */
71DISCORD_EXPORT void Discord_RunCallbacks(void);
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
75DISCORD_EXPORT void Discord_UpdateConnection(void);
76#endif
77
78DISCORD_EXPORT void Discord_UpdatePresence(const DiscordRichPresence* presence);
79DISCORD_EXPORT void Discord_ClearPresence(void);
80
81DISCORD_EXPORT void Discord_Respond(const char* userid, /* DISCORD_REPLY_ */ int reply);
82
83DISCORD_EXPORT void Discord_UpdateHandlers(DiscordEventHandlers* handlers);
84
85#ifdef __cplusplus
86} /* extern "C" */
87#endif