Skip to content
This repository was archived by the owner on May 25, 2025. It is now read-only.

Commit ae29bf9

Browse files
committed
Add SDK files for version 3.2.0
1 parent 53ead6e commit ae29bf9

22 files changed

+824
-685
lines changed

c/discord_game_sdk.h

Lines changed: 188 additions & 169 deletions
Large diffs are not rendered by default.

cpp/achievement_manager.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ namespace discord {
1313

1414
class AchievementEvents final {
1515
public:
16-
static void OnUserAchievementUpdate(void* callbackData, DiscordUserAchievement* userAchievement)
16+
static void DISCORD_CALLBACK OnUserAchievementUpdate(void* callbackData,
17+
DiscordUserAchievement* userAchievement)
1718
{
1819
auto* core = reinterpret_cast<Core*>(callbackData);
1920
if (!core) {

cpp/activity_manager.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace discord {
1313

1414
class ActivityEvents final {
1515
public:
16-
static void OnActivityJoin(void* callbackData, char const* secret)
16+
static void DISCORD_CALLBACK OnActivityJoin(void* callbackData, char const* secret)
1717
{
1818
auto* core = reinterpret_cast<Core*>(callbackData);
1919
if (!core) {
@@ -24,7 +24,7 @@ class ActivityEvents final {
2424
module.OnActivityJoin(static_cast<const char*>(secret));
2525
}
2626

27-
static void OnActivitySpectate(void* callbackData, char const* secret)
27+
static void DISCORD_CALLBACK OnActivitySpectate(void* callbackData, char const* secret)
2828
{
2929
auto* core = reinterpret_cast<Core*>(callbackData);
3030
if (!core) {
@@ -35,7 +35,7 @@ class ActivityEvents final {
3535
module.OnActivitySpectate(static_cast<const char*>(secret));
3636
}
3737

38-
static void OnActivityJoinRequest(void* callbackData, DiscordUser* user)
38+
static void DISCORD_CALLBACK OnActivityJoinRequest(void* callbackData, DiscordUser* user)
3939
{
4040
auto* core = reinterpret_cast<Core*>(callbackData);
4141
if (!core) {
@@ -46,10 +46,10 @@ class ActivityEvents final {
4646
module.OnActivityJoinRequest(*reinterpret_cast<User const*>(user));
4747
}
4848

49-
static void OnActivityInvite(void* callbackData,
50-
EDiscordActivityActionType type,
51-
DiscordUser* user,
52-
DiscordActivity* activity)
49+
static void DISCORD_CALLBACK OnActivityInvite(void* callbackData,
50+
EDiscordActivityActionType type,
51+
DiscordUser* user,
52+
DiscordActivity* activity)
5353
{
5454
auto* core = reinterpret_cast<Core*>(callbackData);
5555
if (!core) {

cpp/ffi.h

Lines changed: 546 additions & 469 deletions
Large diffs are not rendered by default.

cpp/lobby_manager.cpp

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace discord {
1313

1414
class LobbyEvents final {
1515
public:
16-
static void OnLobbyUpdate(void* callbackData, int64_t lobbyId)
16+
static void DISCORD_CALLBACK OnLobbyUpdate(void* callbackData, int64_t lobbyId)
1717
{
1818
auto* core = reinterpret_cast<Core*>(callbackData);
1919
if (!core) {
@@ -24,7 +24,7 @@ class LobbyEvents final {
2424
module.OnLobbyUpdate(lobbyId);
2525
}
2626

27-
static void OnLobbyDelete(void* callbackData, int64_t lobbyId, uint32_t reason)
27+
static void DISCORD_CALLBACK OnLobbyDelete(void* callbackData, int64_t lobbyId, uint32_t reason)
2828
{
2929
auto* core = reinterpret_cast<Core*>(callbackData);
3030
if (!core) {
@@ -35,7 +35,9 @@ class LobbyEvents final {
3535
module.OnLobbyDelete(lobbyId, reason);
3636
}
3737

38-
static void OnMemberConnect(void* callbackData, int64_t lobbyId, int64_t userId)
38+
static void DISCORD_CALLBACK OnMemberConnect(void* callbackData,
39+
int64_t lobbyId,
40+
int64_t userId)
3941
{
4042
auto* core = reinterpret_cast<Core*>(callbackData);
4143
if (!core) {
@@ -46,7 +48,7 @@ class LobbyEvents final {
4648
module.OnMemberConnect(lobbyId, userId);
4749
}
4850

49-
static void OnMemberUpdate(void* callbackData, int64_t lobbyId, int64_t userId)
51+
static void DISCORD_CALLBACK OnMemberUpdate(void* callbackData, int64_t lobbyId, int64_t userId)
5052
{
5153
auto* core = reinterpret_cast<Core*>(callbackData);
5254
if (!core) {
@@ -57,7 +59,9 @@ class LobbyEvents final {
5759
module.OnMemberUpdate(lobbyId, userId);
5860
}
5961

60-
static void OnMemberDisconnect(void* callbackData, int64_t lobbyId, int64_t userId)
62+
static void DISCORD_CALLBACK OnMemberDisconnect(void* callbackData,
63+
int64_t lobbyId,
64+
int64_t userId)
6165
{
6266
auto* core = reinterpret_cast<Core*>(callbackData);
6367
if (!core) {
@@ -68,11 +72,11 @@ class LobbyEvents final {
6872
module.OnMemberDisconnect(lobbyId, userId);
6973
}
7074

71-
static void OnLobbyMessage(void* callbackData,
72-
int64_t lobbyId,
73-
int64_t userId,
74-
uint8_t* data,
75-
uint32_t dataLength)
75+
static void DISCORD_CALLBACK OnLobbyMessage(void* callbackData,
76+
int64_t lobbyId,
77+
int64_t userId,
78+
uint8_t* data,
79+
uint32_t dataLength)
7680
{
7781
auto* core = reinterpret_cast<Core*>(callbackData);
7882
if (!core) {
@@ -83,7 +87,10 @@ class LobbyEvents final {
8387
module.OnLobbyMessage(lobbyId, userId, data, dataLength);
8488
}
8589

86-
static void OnSpeaking(void* callbackData, int64_t lobbyId, int64_t userId, bool speaking)
90+
static void DISCORD_CALLBACK OnSpeaking(void* callbackData,
91+
int64_t lobbyId,
92+
int64_t userId,
93+
bool speaking)
8794
{
8895
auto* core = reinterpret_cast<Core*>(callbackData);
8996
if (!core) {
@@ -94,12 +101,12 @@ class LobbyEvents final {
94101
module.OnSpeaking(lobbyId, userId, (speaking != 0));
95102
}
96103

97-
static void OnNetworkMessage(void* callbackData,
98-
int64_t lobbyId,
99-
int64_t userId,
100-
uint8_t channelId,
101-
uint8_t* data,
102-
uint32_t dataLength)
104+
static void DISCORD_CALLBACK OnNetworkMessage(void* callbackData,
105+
int64_t lobbyId,
106+
int64_t userId,
107+
uint8_t channelId,
108+
uint8_t* data,
109+
uint32_t dataLength)
103110
{
104111
auto* core = reinterpret_cast<Core*>(callbackData);
105112
if (!core) {

cpp/network_manager.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ namespace discord {
1313

1414
class NetworkEvents final {
1515
public:
16-
static void OnMessage(void* callbackData,
17-
DiscordNetworkPeerId peerId,
18-
DiscordNetworkChannelId channelId,
19-
uint8_t* data,
20-
uint32_t dataLength)
16+
static void DISCORD_CALLBACK OnMessage(void* callbackData,
17+
DiscordNetworkPeerId peerId,
18+
DiscordNetworkChannelId channelId,
19+
uint8_t* data,
20+
uint32_t dataLength)
2121
{
2222
auto* core = reinterpret_cast<Core*>(callbackData);
2323
if (!core) {
@@ -28,7 +28,7 @@ class NetworkEvents final {
2828
module.OnMessage(peerId, channelId, data, dataLength);
2929
}
3030

31-
static void OnRouteUpdate(void* callbackData, char const* routeData)
31+
static void DISCORD_CALLBACK OnRouteUpdate(void* callbackData, char const* routeData)
3232
{
3333
auto* core = reinterpret_cast<Core*>(callbackData);
3434
if (!core) {

cpp/overlay_manager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace discord {
1313

1414
class OverlayEvents final {
1515
public:
16-
static void OnToggle(void* callbackData, bool locked)
16+
static void DISCORD_CALLBACK OnToggle(void* callbackData, bool locked)
1717
{
1818
auto* core = reinterpret_cast<Core*>(callbackData);
1919
if (!core) {

cpp/relationship_manager.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace discord {
1313

1414
class RelationshipEvents final {
1515
public:
16-
static void OnRefresh(void* callbackData)
16+
static void DISCORD_CALLBACK OnRefresh(void* callbackData)
1717
{
1818
auto* core = reinterpret_cast<Core*>(callbackData);
1919
if (!core) {
@@ -24,7 +24,8 @@ class RelationshipEvents final {
2424
module.OnRefresh();
2525
}
2626

27-
static void OnRelationshipUpdate(void* callbackData, DiscordRelationship* relationship)
27+
static void DISCORD_CALLBACK OnRelationshipUpdate(void* callbackData,
28+
DiscordRelationship* relationship)
2829
{
2930
auto* core = reinterpret_cast<Core*>(callbackData);
3031
if (!core) {

cpp/store_manager.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ namespace discord {
1313

1414
class StoreEvents final {
1515
public:
16-
static void OnEntitlementCreate(void* callbackData, DiscordEntitlement* entitlement)
16+
static void DISCORD_CALLBACK OnEntitlementCreate(void* callbackData,
17+
DiscordEntitlement* entitlement)
1718
{
1819
auto* core = reinterpret_cast<Core*>(callbackData);
1920
if (!core) {
@@ -24,7 +25,8 @@ class StoreEvents final {
2425
module.OnEntitlementCreate(*reinterpret_cast<Entitlement const*>(entitlement));
2526
}
2627

27-
static void OnEntitlementDelete(void* callbackData, DiscordEntitlement* entitlement)
28+
static void DISCORD_CALLBACK OnEntitlementDelete(void* callbackData,
29+
DiscordEntitlement* entitlement)
2830
{
2931
auto* core = reinterpret_cast<Core*>(callbackData);
3032
if (!core) {

cpp/types.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,16 @@ bool Activity::GetInstance() const
395395
return internal_.instance != 0;
396396
}
397397

398+
void Activity::SetSupportedPlatforms(std::uint32_t supportedPlatforms)
399+
{
400+
internal_.supported_platforms = supportedPlatforms;
401+
}
402+
403+
std::uint32_t Activity::GetSupportedPlatforms() const
404+
{
405+
return internal_.supported_platforms;
406+
}
407+
398408
void Presence::SetStatus(Status status)
399409
{
400410
internal_.status = static_cast<EDiscordStatus>(status);

0 commit comments

Comments
 (0)