diff --git a/3rdparty/discord-rpc/include/discord_register.h b/3rdparty/discord-rpc/include/discord_register.h index 4eb3c3caf..0021b6bbe 100644 --- a/3rdparty/discord-rpc/include/discord_register.h +++ b/3rdparty/discord-rpc/include/discord_register.h @@ -4,8 +4,8 @@ extern "C" { #endif -void Discord_Register(const char* applicationId, const char* command); -void Discord_RegisterSteamGame(const char* applicationId, const char* steamId); +void Discord_Register(const char *applicationId, const char *command); +void Discord_RegisterSteamGame(const char *applicationId, const char *steamId); #ifdef __cplusplus } diff --git a/3rdparty/discord-rpc/include/discord_rpc.h b/3rdparty/discord-rpc/include/discord_rpc.h index eaadbeff5..ce06704a0 100644 --- a/3rdparty/discord-rpc/include/discord_rpc.h +++ b/3rdparty/discord-rpc/include/discord_rpc.h @@ -12,63 +12,63 @@ extern "C" { #endif typedef struct DiscordRichPresence { - int type; - const char* name; /* max 128 bytes */ - const char* state; /* max 128 bytes */ - const char* details; /* max 128 bytes */ - int64_t startTimestamp; - int64_t endTimestamp; - const char* largeImageKey; /* max 32 bytes */ - const char* largeImageText; /* max 128 bytes */ - const char* smallImageKey; /* max 32 bytes */ - const char* smallImageText; /* max 128 bytes */ - const char* partyId; /* max 128 bytes */ - int partySize; - int partyMax; - int partyPrivacy; - const char* matchSecret; /* max 128 bytes */ - const char* joinSecret; /* max 128 bytes */ - const char* spectateSecret; /* max 128 bytes */ - int8_t instance; + int type; + const char *name; /* max 128 bytes */ + const char *state; /* max 128 bytes */ + const char *details; /* max 128 bytes */ + int64_t startTimestamp; + int64_t endTimestamp; + const char *largeImageKey; /* max 32 bytes */ + const char *largeImageText; /* max 128 bytes */ + const char *smallImageKey; /* max 32 bytes */ + const char *smallImageText; /* max 128 bytes */ + const char *partyId; /* max 128 bytes */ + int partySize; + int partyMax; + int partyPrivacy; + const char *matchSecret; /* max 128 bytes */ + const char *joinSecret; /* max 128 bytes */ + const char *spectateSecret; /* max 128 bytes */ + int8_t instance; } DiscordRichPresence; typedef struct DiscordUser { - const char* userId; - const char* username; - const char* discriminator; - const char* avatar; + const char *userId; + const char *username; + const char *discriminator; + const char *avatar; } DiscordUser; typedef struct DiscordEventHandlers { - void (*ready)(const DiscordUser* request); - void (*disconnected)(int errorCode, const char* message); - void (*errored)(int errorCode, const char* message); - void (*joinGame)(const char* joinSecret); - void (*spectateGame)(const char* spectateSecret); - void (*joinRequest)(const DiscordUser* request); + void (*ready)(const DiscordUser *request); + void (*disconnected)(int errorCode, const char *message); + void (*errored)(int errorCode, const char *message); + void (*joinGame)(const char *joinSecret); + void (*spectateGame)(const char *spectateSecret); + void (*joinRequest)(const DiscordUser *request); } DiscordEventHandlers; -#define DISCORD_REPLY_NO 0 -#define DISCORD_REPLY_YES 1 -#define DISCORD_REPLY_IGNORE 2 +#define DISCORD_REPLY_NO 0 +#define DISCORD_REPLY_YES 1 +#define DISCORD_REPLY_IGNORE 2 #define DISCORD_PARTY_PRIVATE 0 -#define DISCORD_PARTY_PUBLIC 1 +#define DISCORD_PARTY_PUBLIC 1 -void Discord_Initialize(const char* applicationId, - DiscordEventHandlers* handlers, - int autoRegister, - const char* optionalSteamId); +void Discord_Initialize(const char *applicationId, + DiscordEventHandlers *handlers, + int autoRegister, + const char *optionalSteamId); void Discord_Shutdown(void); /* checks for incoming messages, dispatches callbacks */ void Discord_RunCallbacks(void); -void Discord_UpdatePresence(const DiscordRichPresence* presence); +void Discord_UpdatePresence(const DiscordRichPresence *presence); void Discord_ClearPresence(void); -void Discord_Respond(const char* userid, /* DISCORD_REPLY_ */ int reply); +void Discord_Respond(const char *userid, /* DISCORD_REPLY_ */ int reply); -void Discord_UpdateHandlers(DiscordEventHandlers* handlers); +void Discord_UpdateHandlers(DiscordEventHandlers *handlers); #ifdef __cplusplus } /* extern "C" */ diff --git a/3rdparty/discord-rpc/src/backoff.h b/3rdparty/discord-rpc/src/backoff.h index 2775b8809..26f418175 100644 --- a/3rdparty/discord-rpc/src/backoff.h +++ b/3rdparty/discord-rpc/src/backoff.h @@ -8,37 +8,30 @@ namespace discord_rpc { struct Backoff { - int64_t minAmount; - int64_t maxAmount; - int64_t current; - int fails; - std::mt19937_64 randGenerator; - std::uniform_real_distribution<> randDistribution; + int64_t minAmount; + int64_t maxAmount; + int64_t current; + int fails; + std::mt19937_64 randGenerator; + std::uniform_real_distribution<> randDistribution; - double rand01() { return randDistribution(randGenerator); } + double rand01() { return randDistribution(randGenerator); } - Backoff(int64_t min, int64_t max) - : minAmount(min) - , maxAmount(max) - , current(min) - , fails(0) - , randGenerator(static_cast(time(0))) - { - } + Backoff(int64_t min, int64_t max) + : minAmount(min), maxAmount(max), current(min), fails(0), randGenerator(static_cast(time(0))) { + } - void reset() - { - fails = 0; - current = minAmount; - } + void reset() { + fails = 0; + current = minAmount; + } - int64_t nextDelay() - { - ++fails; - int64_t delay = static_cast(static_cast(current) * 2.0 * rand01()); - current = std::min(current + delay, maxAmount); - return current; - } + int64_t nextDelay() { + ++fails; + int64_t delay = static_cast(static_cast(current) * 2.0 * rand01()); + current = std::min(current + delay, maxAmount); + return current; + } }; } // namespace discord_rpc diff --git a/3rdparty/discord-rpc/src/connection.h b/3rdparty/discord-rpc/src/connection.h index 597517bbb..153a498bc 100644 --- a/3rdparty/discord-rpc/src/connection.h +++ b/3rdparty/discord-rpc/src/connection.h @@ -19,4 +19,4 @@ struct BaseConnection { bool Read(void *data, size_t length); }; -} // namespace discord_rpc +} // namespace discord_rpc diff --git a/3rdparty/discord-rpc/src/connection_unix.cpp b/3rdparty/discord-rpc/src/connection_unix.cpp index f52249716..ff65cd632 100644 --- a/3rdparty/discord-rpc/src/connection_unix.cpp +++ b/3rdparty/discord-rpc/src/connection_unix.cpp @@ -118,5 +118,4 @@ bool BaseConnection::Read(void *data, size_t length) { return static_cast(res) == length; } -} // namespace discord_rpc - +} // namespace discord_rpc diff --git a/3rdparty/discord-rpc/src/connection_win.cpp b/3rdparty/discord-rpc/src/connection_win.cpp index a626f100c..3d6e4f915 100644 --- a/3rdparty/discord-rpc/src/connection_win.cpp +++ b/3rdparty/discord-rpc/src/connection_win.cpp @@ -123,4 +123,3 @@ bool BaseConnection::Read(void *data, size_t length) { } } // namespace discord_rpc - diff --git a/3rdparty/discord-rpc/src/discord_register_linux.cpp b/3rdparty/discord-rpc/src/discord_register_linux.cpp index 5e011a1ee..ef77f943d 100644 --- a/3rdparty/discord-rpc/src/discord_register_linux.cpp +++ b/3rdparty/discord-rpc/src/discord_register_linux.cpp @@ -44,12 +44,12 @@ extern "C" void Discord_Register(const char *applicationId, const char *command) } constexpr char desktopFileFormat[] = "[Desktop Entry]\n" - "Name=Game %s\n" - "Exec=%s %%u\n" // note: it really wants that %u in there - "Type=Application\n" - "NoDisplay=true\n" - "Categories=Discord;Games;\n" - "MimeType=x-scheme-handler/discord-%s;\n"; + "Name=Game %s\n" + "Exec=%s %%u\n" // note: it really wants that %u in there + "Type=Application\n" + "NoDisplay=true\n" + "Categories=Discord;Games;\n" + "MimeType=x-scheme-handler/discord-%s;\n"; char desktopFile[2048]; int fileLen = snprintf( desktopFile, sizeof(desktopFile), desktopFileFormat, applicationId, command, applicationId); @@ -101,4 +101,3 @@ extern "C" void Discord_RegisterSteamGame(const char *applicationId, sprintf(command, "xdg-open steam://rungameid/%s", steamId); Discord_Register(applicationId, command); } - diff --git a/3rdparty/discord-rpc/src/discord_register_osx.m b/3rdparty/discord-rpc/src/discord_register_osx.m index d71010286..4fbbbd179 100644 --- a/3rdparty/discord-rpc/src/discord_register_osx.m +++ b/3rdparty/discord-rpc/src/discord_register_osx.m @@ -5,7 +5,7 @@ #include "discord_register.h" -static void RegisterCommand(const char* applicationId, const char* command) +static void RegisterCommand(const char *applicationId, const char *command) { // There does not appear to be a way to register arbitrary commands on OSX, so instead we'll save the command // to a file in the Discord config path, and when it is needed, Discord can try to load the file there, open @@ -29,7 +29,7 @@ static void RegisterCommand(const char* applicationId, const char* command) [jsonBuffer writeToFile:path atomically:NO encoding:NSUTF8StringEncoding error:nil]; } -static void RegisterURL(const char* applicationId) +static void RegisterURL(const char *applicationId) { char url[256]; snprintf(url, sizeof(url), "discord-%s", applicationId); @@ -59,7 +59,7 @@ static void RegisterURL(const char* applicationId) } } -void Discord_Register(const char* applicationId, const char* command) +void Discord_Register(const char *applicationId, const char *command) { if (command) { RegisterCommand(applicationId, command); @@ -72,7 +72,7 @@ void Discord_Register(const char* applicationId, const char* command) } } -void Discord_RegisterSteamGame(const char* applicationId, const char* steamId) +void Discord_RegisterSteamGame(const char *applicationId, const char *steamId) { char command[256]; snprintf(command, 256, "steam://rungameid/%s", steamId); diff --git a/3rdparty/discord-rpc/src/discord_register_win.cpp b/3rdparty/discord-rpc/src/discord_register_win.cpp index 4b33038c8..dba4ec162 100644 --- a/3rdparty/discord-rpc/src/discord_register_win.cpp +++ b/3rdparty/discord-rpc/src/discord_register_win.cpp @@ -180,4 +180,3 @@ extern "C" void Discord_RegisterSteamGame(const char *applicationId, Discord_RegisterW(appId, command); } - diff --git a/3rdparty/discord-rpc/src/discord_rpc.cpp b/3rdparty/discord-rpc/src/discord_rpc.cpp index a27d64c83..e19ce4687 100644 --- a/3rdparty/discord-rpc/src/discord_rpc.cpp +++ b/3rdparty/discord-rpc/src/discord_rpc.cpp @@ -346,8 +346,7 @@ extern "C" void Discord_Shutdown(void) { extern "C" void Discord_UpdatePresence(const DiscordRichPresence *presence) { { std::lock_guard guard(PresenceMutex); - QueuedPresence.length = JsonWriteRichPresenceObj( - QueuedPresence.buffer, sizeof(QueuedPresence.buffer), Nonce++, Pid, presence); + QueuedPresence.length = JsonWriteRichPresenceObj(QueuedPresence.buffer, sizeof(QueuedPresence.buffer), Nonce++, Pid, presence); UpdatePresence.exchange(true); } SignalIOActivity(); @@ -476,4 +475,3 @@ extern "C" void Discord_UpdateHandlers(DiscordEventHandlers *newHandlers) { } } // namespace discord_rpc - diff --git a/3rdparty/discord-rpc/src/msg_queue.h b/3rdparty/discord-rpc/src/msg_queue.h index 47d9275d5..9420c96ea 100644 --- a/3rdparty/discord-rpc/src/msg_queue.h +++ b/3rdparty/discord-rpc/src/msg_queue.h @@ -7,34 +7,32 @@ namespace discord_rpc { -template +template class MsgQueue { - ElementType queue_[QueueSize]; - std::atomic_uint nextAdd_{0}; - std::atomic_uint nextSend_{0}; - std::atomic_uint pendingSends_{0}; + ElementType queue_[QueueSize]; + std::atomic_uint nextAdd_ { 0 }; + std::atomic_uint nextSend_ { 0 }; + std::atomic_uint pendingSends_ { 0 }; -public: - MsgQueue() {} + public: + MsgQueue() {} - ElementType* GetNextAddMessage() - { - // if we are falling behind, bail - if (pendingSends_.load() >= QueueSize) { - return nullptr; - } - auto index = (nextAdd_++) % QueueSize; - return &queue_[index]; + ElementType *GetNextAddMessage() { + // if we are falling behind, bail + if (pendingSends_.load() >= QueueSize) { + return nullptr; } - void CommitAdd() { ++pendingSends_; } + auto index = (nextAdd_++) % QueueSize; + return &queue_[index]; + } + void CommitAdd() { ++pendingSends_; } - bool HavePendingSends() const { return pendingSends_.load() != 0; } - ElementType* GetNextSendMessage() - { - auto index = (nextSend_++) % QueueSize; - return &queue_[index]; - } - void CommitSend() { --pendingSends_; } + bool HavePendingSends() const { return pendingSends_.load() != 0; } + ElementType *GetNextSendMessage() { + auto index = (nextSend_++) % QueueSize; + return &queue_[index]; + } + void CommitSend() { --pendingSends_; } }; } // namespace discord_rpc diff --git a/3rdparty/discord-rpc/src/rpc_connection.cpp b/3rdparty/discord-rpc/src/rpc_connection.cpp index 41203d585..3789bf49f 100644 --- a/3rdparty/discord-rpc/src/rpc_connection.cpp +++ b/3rdparty/discord-rpc/src/rpc_connection.cpp @@ -130,4 +130,3 @@ bool RpcConnection::Read(JsonDocument &message) { } } // namespace discord_rpc - diff --git a/3rdparty/discord-rpc/src/rpc_connection.h b/3rdparty/discord-rpc/src/rpc_connection.h index d110e86a1..4ca58049c 100644 --- a/3rdparty/discord-rpc/src/rpc_connection.h +++ b/3rdparty/discord-rpc/src/rpc_connection.h @@ -61,4 +61,3 @@ struct RpcConnection { }; } // namespace discord_rpc - diff --git a/3rdparty/discord-rpc/src/serialization.cpp b/3rdparty/discord-rpc/src/serialization.cpp index 4ce67dc45..49c06985e 100644 --- a/3rdparty/discord-rpc/src/serialization.cpp +++ b/3rdparty/discord-rpc/src/serialization.cpp @@ -246,4 +246,3 @@ size_t JsonWriteJoinReply(char *dest, size_t maxLen, const char *userId, int rep } } // namespace discord_rpc -