mirror of
https://github.com/yuzu-emu/discord-rpc
synced 2024-11-26 03:07:41 +00:00
Update presence
This commit is contained in:
parent
6dc12b82c6
commit
4dcb4afd2e
4 changed files with 88 additions and 0 deletions
Binary file not shown.
Binary file not shown.
|
@ -81,3 +81,46 @@ void UDiscordRpc::RunCallbacks()
|
|||
{
|
||||
Discord_RunCallbacks();
|
||||
}
|
||||
|
||||
void UDiscordRpc::UpdatePresence()
|
||||
{
|
||||
DiscordRichPresence rp{};
|
||||
|
||||
auto state = StringCast<ANSICHAR>(*RichPresence.state);
|
||||
rp.state = state.Get();
|
||||
|
||||
auto details = StringCast<ANSICHAR>(*RichPresence.details);
|
||||
rp.details = details.Get();
|
||||
|
||||
auto largeImageKey = StringCast<ANSICHAR>(*RichPresence.largeImageKey);
|
||||
rp.largeImageKey = largeImageKey.Get();
|
||||
|
||||
auto largeImageText = StringCast<ANSICHAR>(*RichPresence.largeImageText);
|
||||
rp.largeImageText = largeImageText.Get();
|
||||
|
||||
auto smallImageKey = StringCast<ANSICHAR>(*RichPresence.smallImageKey);
|
||||
rp.smallImageKey = smallImageKey.Get();
|
||||
|
||||
auto smallImageText = StringCast<ANSICHAR>(*RichPresence.smallImageText);
|
||||
rp.smallImageText = smallImageText.Get();
|
||||
|
||||
auto partyId = StringCast<ANSICHAR>(*RichPresence.partyId);
|
||||
rp.partyId = partyId.Get();
|
||||
|
||||
auto matchSecret = StringCast<ANSICHAR>(*RichPresence.matchSecret);
|
||||
rp.matchSecret = matchSecret.Get();
|
||||
|
||||
auto joinSecret = StringCast<ANSICHAR>(*RichPresence.joinSecret);
|
||||
rp.joinSecret = joinSecret.Get();
|
||||
|
||||
auto spectateSecret = StringCast<ANSICHAR>(*RichPresence.spectateSecret);
|
||||
rp.spectateSecret = spectateSecret.Get();
|
||||
|
||||
rp.startTimestamp = RichPresence.startTimestamp;
|
||||
rp.endTimestamp = RichPresence.endTimestamp;
|
||||
rp.partySize = RichPresence.partySize;
|
||||
rp.partyMax = RichPresence.partyMax;
|
||||
rp.instance = RichPresence.instance;
|
||||
|
||||
Discord_UpdatePresence(&rp);
|
||||
}
|
||||
|
|
|
@ -14,6 +14,46 @@ DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FDiscordErrored, int, errorCode, co
|
|||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FDiscordJoin, const FString&, joinSecret);
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FDiscordSpectate, const FString&, spectateSecret);
|
||||
|
||||
/**
|
||||
* Rich presence data
|
||||
*/
|
||||
USTRUCT(BlueprintType)
|
||||
struct FDiscordRichPresence {
|
||||
GENERATED_USTRUCT_BODY()
|
||||
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
FString state;
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
FString details;
|
||||
// todo, timestamps are 64bit, does that even matter?
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
int startTimestamp;
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
int endTimestamp;
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
FString largeImageKey;
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
FString largeImageText;
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
FString smallImageKey;
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
FString smallImageText;
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
FString partyId;
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
int partySize;
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
int partyMax;
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
FString matchSecret;
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
FString joinSecret;
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
FString spectateSecret;
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
bool instance;
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
@ -33,6 +73,9 @@ public:
|
|||
UFUNCTION(BlueprintCallable, meta = (DisplayName = "Check for callbacks", Keywords = "Discord rpc"), Category = "Discord")
|
||||
void RunCallbacks();
|
||||
|
||||
UFUNCTION(BlueprintCallable, meta = (DisplayName = "Send presence", Keywords = "Discord rpc"), Category = "Discord")
|
||||
void UpdatePresence();
|
||||
|
||||
UPROPERTY(BlueprintReadOnly, meta = (DisplayName = "Is Discord connected", Keywords = "Discord rpc"), Category = "Discord")
|
||||
bool IsConnected;
|
||||
|
||||
|
@ -51,4 +94,6 @@ public:
|
|||
UPROPERTY(BlueprintAssignable, meta = (DisplayName = "When Discord user presses spectate", Keywords = "Discord rpc"), Category = "Discord")
|
||||
FDiscordSpectate OnSpectate;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, meta = (DisplayName = "Rich presence info", Keywords = "Discord rpc"), Category = "Discord")
|
||||
FDiscordRichPresence RichPresence;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue