2017-07-20 21:24:18 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
// if only there was a standard library function for this
|
|
|
|
template<size_t Len>
|
|
|
|
inline size_t StringCopy(char (&dest)[Len], const char* src) {
|
|
|
|
if (!dest || !src || !Len) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
size_t copied;
|
|
|
|
char* out = dest;
|
|
|
|
for (copied = 1; *src && copied < Len; ++copied) {
|
|
|
|
*out++ = *src++;
|
|
|
|
}
|
|
|
|
*out = 0;
|
|
|
|
return copied - 1;
|
|
|
|
}
|
|
|
|
|
2017-07-20 22:59:32 +01:00
|
|
|
size_t JsonWriteHandshakeObj(char* dest, size_t maxLen, int version, const char* applicationId);
|
|
|
|
|
2017-07-20 23:59:15 +01:00
|
|
|
// Commands
|
2017-07-20 21:24:18 +01:00
|
|
|
struct DiscordRichPresence;
|
2017-07-20 23:08:34 +01:00
|
|
|
size_t JsonWriteRichPresenceObj(char* dest, size_t maxLen, int nonce, int pid, const DiscordRichPresence* presence);
|
2017-07-21 23:42:59 +01:00
|
|
|
size_t JsonWriteSubscribeCommand(char* dest, size_t maxLen, int nonce, const char* evtName);
|