aboutsummaryrefslogtreecommitdiff
path: root/externals/discord-rpc/examples/unrealstatus
diff options
context:
space:
mode:
authorDawid Potocki <dawid@dawidpotocki.com>2024-03-05 14:09:27 +1300
committerDawid Potocki <dawid@dawidpotocki.com>2024-03-05 20:34:15 +1300
commit063e15900bda8453fb0fc6751e78d064501ccbae (patch)
treea4cd5f01dbca33a262333aff10e1e035217a30c8 /externals/discord-rpc/examples/unrealstatus
parent537296095ab24eddcb196b5ef98004f91de9c8c2 (diff)
Replace broken submodules with vendored source codeHEADpatched
Diffstat (limited to 'externals/discord-rpc/examples/unrealstatus')
-rw-r--r--externals/discord-rpc/examples/unrealstatus/.gitignore78
-rw-r--r--externals/discord-rpc/examples/unrealstatus/Config/DefaultEditor.ini0
-rw-r--r--externals/discord-rpc/examples/unrealstatus/Config/DefaultEngine.ini54
-rw-r--r--externals/discord-rpc/examples/unrealstatus/Config/DefaultGame.ini7
-rw-r--r--externals/discord-rpc/examples/unrealstatus/Content/MainScreenBP.uassetbin0 -> 50332 bytes
-rw-r--r--externals/discord-rpc/examples/unrealstatus/Content/MouseGameModeBP.uassetbin0 -> 17950 bytes
-rw-r--r--externals/discord-rpc/examples/unrealstatus/Content/MousePlayerControllerBP.uassetbin0 -> 16981 bytes
-rw-r--r--externals/discord-rpc/examples/unrealstatus/Content/ShowTheUILevel.umapbin0 -> 806708 bytes
-rw-r--r--externals/discord-rpc/examples/unrealstatus/Plugins/discordrpc/DiscordRpc.uplugin29
-rw-r--r--externals/discord-rpc/examples/unrealstatus/Plugins/discordrpc/Resources/Icon128.pngbin0 -> 9834 bytes
-rw-r--r--externals/discord-rpc/examples/unrealstatus/Plugins/discordrpc/Resources/discord.pngbin0 -> 9834 bytes
-rw-r--r--externals/discord-rpc/examples/unrealstatus/Plugins/discordrpc/Source/DiscordRpc/DiscordRpc.Build.cs57
-rw-r--r--externals/discord-rpc/examples/unrealstatus/Plugins/discordrpc/Source/DiscordRpc/Private/DiscordRpc.cpp76
-rw-r--r--externals/discord-rpc/examples/unrealstatus/Plugins/discordrpc/Source/DiscordRpc/Private/DiscordRpcBlueprint.cpp172
-rw-r--r--externals/discord-rpc/examples/unrealstatus/Plugins/discordrpc/Source/DiscordRpc/Private/DiscordRpcPrivatePCH.h2
-rw-r--r--externals/discord-rpc/examples/unrealstatus/Plugins/discordrpc/Source/DiscordRpc/Public/DiscordRpc.h20
-rw-r--r--externals/discord-rpc/examples/unrealstatus/Plugins/discordrpc/Source/DiscordRpc/Public/DiscordRpcBlueprint.h181
-rw-r--r--externals/discord-rpc/examples/unrealstatus/Plugins/discordrpc/Source/ThirdParty/DiscordRpcLibrary/DiscordRpcLibrary.Build.cs59
-rw-r--r--externals/discord-rpc/examples/unrealstatus/Source/unrealstatus.Target.cs14
-rw-r--r--externals/discord-rpc/examples/unrealstatus/Source/unrealstatus/unrealstatus.Build.cs23
-rw-r--r--externals/discord-rpc/examples/unrealstatus/Source/unrealstatus/unrealstatus.cpp6
-rw-r--r--externals/discord-rpc/examples/unrealstatus/Source/unrealstatus/unrealstatus.h5
-rw-r--r--externals/discord-rpc/examples/unrealstatus/Source/unrealstatus/unrealstatusGameModeBase.cpp3
-rw-r--r--externals/discord-rpc/examples/unrealstatus/Source/unrealstatus/unrealstatusGameModeBase.h15
-rw-r--r--externals/discord-rpc/examples/unrealstatus/Source/unrealstatusEditor.Target.cs14
-rw-r--r--externals/discord-rpc/examples/unrealstatus/unrealstatus.uproject19
26 files changed, 834 insertions, 0 deletions
diff --git a/externals/discord-rpc/examples/unrealstatus/.gitignore b/externals/discord-rpc/examples/unrealstatus/.gitignore
new file mode 100644
index 0000000000..bd472d50ae
--- /dev/null
+++ b/externals/discord-rpc/examples/unrealstatus/.gitignore
@@ -0,0 +1,78 @@
+# Visual Studio 2015 user specific files
+.vs/
+
+# Visual Studio 2015 database file
+*.VC.db
+
+# Compiled Object files
+*.slo
+*.lo
+*.o
+*.obj
+
+# Precompiled Headers
+*.gch
+*.pch
+
+# Compiled Dynamic libraries
+*.so
+*.dylib
+*.dll
+
+# Fortran module files
+*.mod
+
+# Compiled Static libraries
+*.lai
+*.la
+*.a
+*.lib
+
+# Executables
+*.exe
+*.out
+*.app
+*.ipa
+
+# These project files can be generated by the engine
+*.xcodeproj
+*.xcworkspace
+*.sln
+*.suo
+*.opensdf
+*.sdf
+*.VC.db
+*.VC.opendb
+
+# Precompiled Assets
+SourceArt/**/*.png
+SourceArt/**/*.tga
+
+# Binary Files
+Binaries/
+
+# Builds
+Build/*
+
+# Whitelist PakBlacklist-<BuildConfiguration>.txt files
+!Build/*/
+Build/*/**
+!Build/*/PakBlacklist*.txt
+
+# Don't ignore icon files in Build
+!Build/**/*.ico
+
+# Built data for maps
+*_BuiltData.uasset
+
+# Configuration files generated by the Editor
+Saved/*
+
+# Compiled source files for the engine to use
+Intermediate/
+
+# Cache files for the editor to use
+DerivedDataCache/
+
+# Library headers must be copied automatically by the build script (build.py unreal)
+Plugins/DiscordRpc/Source/ThirdParty/DiscordRpcLibrary/Include
diff --git a/externals/discord-rpc/examples/unrealstatus/Config/DefaultEditor.ini b/externals/discord-rpc/examples/unrealstatus/Config/DefaultEditor.ini
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/externals/discord-rpc/examples/unrealstatus/Config/DefaultEditor.ini
diff --git a/externals/discord-rpc/examples/unrealstatus/Config/DefaultEngine.ini b/externals/discord-rpc/examples/unrealstatus/Config/DefaultEngine.ini
new file mode 100644
index 0000000000..84c38f3531
--- /dev/null
+++ b/externals/discord-rpc/examples/unrealstatus/Config/DefaultEngine.ini
@@ -0,0 +1,54 @@
+[URL]
+
+[/Script/HardwareTargeting.HardwareTargetingSettings]
+TargetedHardwareClass=Desktop
+AppliedTargetedHardwareClass=Desktop
+DefaultGraphicsPerformance=Maximum
+AppliedDefaultGraphicsPerformance=Maximum
+
+[/Script/Engine.EndUserSettings]
+bSendAnonymousUsageDataToEpic=False
+
+[/Script/Engine.PhysicsSettings]
+DefaultGravityZ=-980.000000
+DefaultTerminalVelocity=4000.000000
+DefaultFluidFriction=0.300000
+SimulateScratchMemorySize=262144
+RagdollAggregateThreshold=4
+TriangleMeshTriangleMinAreaThreshold=5.000000
+bEnableAsyncScene=False
+bEnableShapeSharing=False
+bEnablePCM=False
+bEnableStabilization=False
+bWarnMissingLocks=True
+bEnable2DPhysics=False
+LockedAxis=Invalid
+DefaultDegreesOfFreedom=Full3D
+BounceThresholdVelocity=200.000000
+FrictionCombineMode=Average
+RestitutionCombineMode=Average
+MaxAngularVelocity=3600.000000
+MaxDepenetrationVelocity=0.000000
+ContactOffsetMultiplier=0.010000
+MinContactOffset=0.000100
+MaxContactOffset=1.000000
+bSimulateSkeletalMeshOnDedicatedServer=True
+DefaultShapeComplexity=CTF_UseSimpleAndComplex
+bDefaultHasComplexCollision=True
+bSuppressFaceRemapTable=False
+bSupportUVFromHitResults=False
+bDisableActiveActors=False
+bDisableCCD=False
+MaxPhysicsDeltaTime=0.033333
+bSubstepping=False
+bSubsteppingAsync=False
+MaxSubstepDeltaTime=0.016667
+MaxSubsteps=6
+SyncSceneSmoothingFactor=0.000000
+AsyncSceneSmoothingFactor=0.990000
+InitialAverageFrameRate=0.016667
+
+[/Script/EngineSettings.GameMapsSettings]
+EditorStartupMap=/Game/ShowTheUILevel.ShowTheUILevel
+GameDefaultMap=/Game/ShowTheUILevel.ShowTheUILevel
+
diff --git a/externals/discord-rpc/examples/unrealstatus/Config/DefaultGame.ini b/externals/discord-rpc/examples/unrealstatus/Config/DefaultGame.ini
new file mode 100644
index 0000000000..7b5e2dc2f6
--- /dev/null
+++ b/externals/discord-rpc/examples/unrealstatus/Config/DefaultGame.ini
@@ -0,0 +1,7 @@
+[/Script/EngineSettings.GeneralProjectSettings]
+ProjectID=E5977A24492699DF20B8ADBF736AF6C6
+ProjectName=Discord RPC Example
+CompanyName=Discord Inc.
+Homepage="https://discordapp.com/"
+CopyrightNotice=
+
diff --git a/externals/discord-rpc/examples/unrealstatus/Content/MainScreenBP.uasset b/externals/discord-rpc/examples/unrealstatus/Content/MainScreenBP.uasset
new file mode 100644
index 0000000000..e903b53830
--- /dev/null
+++ b/externals/discord-rpc/examples/unrealstatus/Content/MainScreenBP.uasset
Binary files differ
diff --git a/externals/discord-rpc/examples/unrealstatus/Content/MouseGameModeBP.uasset b/externals/discord-rpc/examples/unrealstatus/Content/MouseGameModeBP.uasset
new file mode 100644
index 0000000000..410af19a9c
--- /dev/null
+++ b/externals/discord-rpc/examples/unrealstatus/Content/MouseGameModeBP.uasset
Binary files differ
diff --git a/externals/discord-rpc/examples/unrealstatus/Content/MousePlayerControllerBP.uasset b/externals/discord-rpc/examples/unrealstatus/Content/MousePlayerControllerBP.uasset
new file mode 100644
index 0000000000..0aaf50ba76
--- /dev/null
+++ b/externals/discord-rpc/examples/unrealstatus/Content/MousePlayerControllerBP.uasset
Binary files differ
diff --git a/externals/discord-rpc/examples/unrealstatus/Content/ShowTheUILevel.umap b/externals/discord-rpc/examples/unrealstatus/Content/ShowTheUILevel.umap
new file mode 100644
index 0000000000..bc0e5b7c48
--- /dev/null
+++ b/externals/discord-rpc/examples/unrealstatus/Content/ShowTheUILevel.umap
Binary files differ
diff --git a/externals/discord-rpc/examples/unrealstatus/Plugins/discordrpc/DiscordRpc.uplugin b/externals/discord-rpc/examples/unrealstatus/Plugins/discordrpc/DiscordRpc.uplugin
new file mode 100644
index 0000000000..309df129cf
--- /dev/null
+++ b/externals/discord-rpc/examples/unrealstatus/Plugins/discordrpc/DiscordRpc.uplugin
@@ -0,0 +1,29 @@
+{
+ "FileVersion": 3,
+ "Version": 1,
+ "VersionName": "1.0",
+ "FriendlyName": "Discord RPC",
+ "Description": "Wrap the Discord RPC library.",
+ "Category": "Messaging",
+ "CreatedBy": "Chris Marsh <chris@discordapp.com>",
+ "CreatedByURL": "https://discordapp.com/",
+ "DocsURL": "",
+ "MarketplaceURL": "",
+ "SupportURL": "",
+ "CanContainContent": true,
+ "IsBetaVersion": true,
+ "Installed": false,
+ "Modules": [
+ {
+ "Name": "DiscordRpc",
+ "Type": "Runtime",
+ "LoadingPhase": "PreDefault",
+ "WhitelistPlatforms" :
+ [
+ "Win64",
+ "Linux",
+ "Mac"
+ ]
+ }
+ ]
+} \ No newline at end of file
diff --git a/externals/discord-rpc/examples/unrealstatus/Plugins/discordrpc/Resources/Icon128.png b/externals/discord-rpc/examples/unrealstatus/Plugins/discordrpc/Resources/Icon128.png
new file mode 100644
index 0000000000..8b7f8e1c6a
--- /dev/null
+++ b/externals/discord-rpc/examples/unrealstatus/Plugins/discordrpc/Resources/Icon128.png
Binary files differ
diff --git a/externals/discord-rpc/examples/unrealstatus/Plugins/discordrpc/Resources/discord.png b/externals/discord-rpc/examples/unrealstatus/Plugins/discordrpc/Resources/discord.png
new file mode 100644
index 0000000000..8b7f8e1c6a
--- /dev/null
+++ b/externals/discord-rpc/examples/unrealstatus/Plugins/discordrpc/Resources/discord.png
Binary files differ
diff --git a/externals/discord-rpc/examples/unrealstatus/Plugins/discordrpc/Source/DiscordRpc/DiscordRpc.Build.cs b/externals/discord-rpc/examples/unrealstatus/Plugins/discordrpc/Source/DiscordRpc/DiscordRpc.Build.cs
new file mode 100644
index 0000000000..4b06325520
--- /dev/null
+++ b/externals/discord-rpc/examples/unrealstatus/Plugins/discordrpc/Source/DiscordRpc/DiscordRpc.Build.cs
@@ -0,0 +1,57 @@
+// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
+
+using UnrealBuildTool;
+using System.IO;
+
+public class DiscordRpc : ModuleRules
+{
+#if WITH_FORWARDED_MODULE_RULES_CTOR
+ public DiscordRpc(ReadOnlyTargetRules Target) : base(Target)
+#else
+ public DiscordRpc(TargetInfo Target)
+#endif
+ {
+ Definitions.Add("DISCORD_DYNAMIC_LIB=1");
+
+ PublicIncludePaths.AddRange(
+ new string[] {
+ "DiscordRpc/Public"
+ }
+ );
+
+ PrivateIncludePaths.AddRange(
+ new string[] {
+ "DiscordRpc/Private"
+ }
+ );
+
+ PublicDependencyModuleNames.AddRange(
+ new string[]
+ {
+ "Core",
+ "DiscordRpcLibrary"
+ }
+ );
+
+ PrivateDependencyModuleNames.AddRange(
+ new string[]
+ {
+ "CoreUObject",
+ "Engine",
+ "Slate",
+ "SlateCore",
+ "Projects"
+ }
+ );
+
+ DynamicallyLoadedModuleNames.AddRange(
+ new string[]
+ {
+ // ... add any modules that your module loads dynamically here ...
+ }
+ );
+
+ string BaseDirectory = Path.GetFullPath(Path.Combine(ModuleDirectory, "..", "..", "Source", "ThirdParty", "DiscordRpcLibrary"));
+ PublicIncludePaths.Add(Path.Combine(BaseDirectory, "Include"));
+ }
+} \ No newline at end of file
diff --git a/externals/discord-rpc/examples/unrealstatus/Plugins/discordrpc/Source/DiscordRpc/Private/DiscordRpc.cpp b/externals/discord-rpc/examples/unrealstatus/Plugins/discordrpc/Source/DiscordRpc/Private/DiscordRpc.cpp
new file mode 100644
index 0000000000..d539dab034
--- /dev/null
+++ b/externals/discord-rpc/examples/unrealstatus/Plugins/discordrpc/Source/DiscordRpc/Private/DiscordRpc.cpp
@@ -0,0 +1,76 @@
+// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
+
+#include "DiscordRpcPrivatePCH.h"
+#include "IPluginManager.h"
+#include "ModuleManager.h"
+
+#define LOCTEXT_NAMESPACE "FDiscordRpcModule"
+
+void FDiscordRpcModule::StartupModule()
+{
+#if !PLATFORM_LINUX
+#if defined(DISCORD_DYNAMIC_LIB)
+ // Get the base directory of this plugin
+ FString BaseDir = IPluginManager::Get().FindPlugin("DiscordRpc")->GetBaseDir();
+ const FString SDKDir =
+ FPaths::Combine(*BaseDir, TEXT("Source"), TEXT("ThirdParty"), TEXT("DiscordRpcLibrary"));
+#if PLATFORM_WINDOWS
+ const FString LibName = TEXT("discord-rpc");
+ const FString LibDir = FPaths::Combine(*SDKDir, TEXT("Win64"));
+ if (!LoadDependency(LibDir, LibName, DiscordRpcLibraryHandle)) {
+ FMessageDialog::Open(
+ EAppMsgType::Ok,
+ LOCTEXT(LOCTEXT_NAMESPACE,
+ "Failed to load DiscordRpc plugin. Plug-in will not be functional."));
+ FreeDependency(DiscordRpcLibraryHandle);
+ }
+#elif PLATFORM_MAC
+ const FString LibName = TEXT("libdiscord-rpc");
+ const FString LibDir = FPaths::Combine(*SDKDir, TEXT("Mac"));
+ if (!LoadDependency(LibDir, LibName, DiscordRpcLibraryHandle)) {
+ FMessageDialog::Open(
+ EAppMsgType::Ok,
+ LOCTEXT(LOCTEXT_NAMESPACE,
+ "Failed to load DiscordRpc plugin. Plug-in will not be functional."));
+ FreeDependency(DiscordRpcLibraryHandle);
+ }
+#endif
+#endif
+#endif
+}
+
+void FDiscordRpcModule::ShutdownModule()
+{
+ // Free the dll handle
+#if !PLATFORM_LINUX
+#if defined(DISCORD_DYNAMIC_LIB)
+ FreeDependency(DiscordRpcLibraryHandle);
+#endif
+#endif
+}
+
+bool FDiscordRpcModule::LoadDependency(const FString& Dir, const FString& Name, void*& Handle)
+{
+ FString Lib = Name + TEXT(".") + FPlatformProcess::GetModuleExtension();
+ FString Path = Dir.IsEmpty() ? *Lib : FPaths::Combine(*Dir, *Lib);
+
+ Handle = FPlatformProcess::GetDllHandle(*Path);
+
+ if (Handle == nullptr) {
+ return false;
+ }
+
+ return true;
+}
+
+void FDiscordRpcModule::FreeDependency(void*& Handle)
+{
+ if (Handle != nullptr) {
+ FPlatformProcess::FreeDllHandle(Handle);
+ Handle = nullptr;
+ }
+}
+
+#undef LOCTEXT_NAMESPACE
+
+IMPLEMENT_MODULE(FDiscordRpcModule, DiscordRpc) \ No newline at end of file
diff --git a/externals/discord-rpc/examples/unrealstatus/Plugins/discordrpc/Source/DiscordRpc/Private/DiscordRpcBlueprint.cpp b/externals/discord-rpc/examples/unrealstatus/Plugins/discordrpc/Source/DiscordRpc/Private/DiscordRpcBlueprint.cpp
new file mode 100644
index 0000000000..8925d8e41a
--- /dev/null
+++ b/externals/discord-rpc/examples/unrealstatus/Plugins/discordrpc/Source/DiscordRpc/Private/DiscordRpcBlueprint.cpp
@@ -0,0 +1,172 @@
+#include "DiscordRpcPrivatePCH.h"
+#include "DiscordRpcBlueprint.h"
+#include "discord_rpc.h"
+
+DEFINE_LOG_CATEGORY(Discord)
+
+static UDiscordRpc* self = nullptr;
+
+static void ReadyHandler(const DiscordUser* connectedUser)
+{
+ FDiscordUserData ud;
+ ud.userId = ANSI_TO_TCHAR(connectedUser->userId);
+ ud.username = ANSI_TO_TCHAR(connectedUser->username);
+ ud.discriminator = ANSI_TO_TCHAR(connectedUser->discriminator);
+ ud.avatar = ANSI_TO_TCHAR(connectedUser->avatar);
+ UE_LOG(Discord,
+ Log,
+ TEXT("Discord connected to %s - %s#%s"),
+ *ud.userId,
+ *ud.username,
+ *ud.discriminator);
+ if (self) {
+ self->IsConnected = true;
+ self->OnConnected.Broadcast(ud);
+ }
+}
+
+static void DisconnectHandler(int errorCode, const char* message)
+{
+ auto msg = FString(message);
+ UE_LOG(Discord, Log, TEXT("Discord disconnected (%d): %s"), errorCode, *msg);
+ if (self) {
+ self->IsConnected = false;
+ self->OnDisconnected.Broadcast(errorCode, msg);
+ }
+}
+
+static void ErroredHandler(int errorCode, const char* message)
+{
+ auto msg = FString(message);
+ UE_LOG(Discord, Log, TEXT("Discord error (%d): %s"), errorCode, *msg);
+ if (self) {
+ self->OnErrored.Broadcast(errorCode, msg);
+ }
+}
+
+static void JoinGameHandler(const char* joinSecret)
+{
+ auto secret = FString(joinSecret);
+ UE_LOG(Discord, Log, TEXT("Discord join %s"), *secret);
+ if (self) {
+ self->OnJoin.Broadcast(secret);
+ }
+}
+
+static void SpectateGameHandler(const char* spectateSecret)
+{
+ auto secret = FString(spectateSecret);
+ UE_LOG(Discord, Log, TEXT("Discord spectate %s"), *secret);
+ if (self) {
+ self->OnSpectate.Broadcast(secret);
+ }
+}
+
+static void JoinRequestHandler(const DiscordUser* request)
+{
+ FDiscordUserData ud;
+ ud.userId = ANSI_TO_TCHAR(request->userId);
+ ud.username = ANSI_TO_TCHAR(request->username);
+ ud.discriminator = ANSI_TO_TCHAR(request->discriminator);
+ ud.avatar = ANSI_TO_TCHAR(request->avatar);
+ UE_LOG(Discord,
+ Log,
+ TEXT("Discord join request from %s - %s#%s"),
+ *ud.userId,
+ *ud.username,
+ *ud.discriminator);
+ if (self) {
+ self->OnJoinRequest.Broadcast(ud);
+ }
+}
+
+void UDiscordRpc::Initialize(const FString& applicationId,
+ bool autoRegister,
+ const FString& optionalSteamId)
+{
+ self = this;
+ IsConnected = false;
+ DiscordEventHandlers handlers{};
+ handlers.ready = ReadyHandler;
+ handlers.disconnected = DisconnectHandler;
+ handlers.errored = ErroredHandler;
+ if (OnJoin.IsBound()) {
+ handlers.joinGame = JoinGameHandler;
+ }
+ if (OnSpectate.IsBound()) {
+ handlers.spectateGame = SpectateGameHandler;
+ }
+ if (OnJoinRequest.IsBound()) {
+ handlers.joinRequest = JoinRequestHandler;
+ }
+ auto appId = StringCast<ANSICHAR>(*applicationId);
+ auto steamId = StringCast<ANSICHAR>(*optionalSteamId);
+ Discord_Initialize(
+ (const char*)appId.Get(), &handlers, autoRegister, (const char*)steamId.Get());
+}
+
+void UDiscordRpc::Shutdown()
+{
+ Discord_Shutdown();
+ self = nullptr;
+}
+
+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.partyPrivacy = (int)RichPresence.partyPrivacy;
+ rp.instance = RichPresence.instance;
+
+ Discord_UpdatePresence(&rp);
+}
+
+void UDiscordRpc::ClearPresence()
+{
+ Discord_ClearPresence();
+}
+
+void UDiscordRpc::Respond(const FString& userId, int reply)
+{
+ UE_LOG(Discord, Log, TEXT("Responding %d to join request from %s"), reply, *userId);
+ FTCHARToUTF8 utf8_userid(*userId);
+ Discord_Respond(utf8_userid.Get(), reply);
+}
diff --git a/externals/discord-rpc/examples/unrealstatus/Plugins/discordrpc/Source/DiscordRpc/Private/DiscordRpcPrivatePCH.h b/externals/discord-rpc/examples/unrealstatus/Plugins/discordrpc/Source/DiscordRpc/Private/DiscordRpcPrivatePCH.h
new file mode 100644
index 0000000000..0c66aba443
--- /dev/null
+++ b/externals/discord-rpc/examples/unrealstatus/Plugins/discordrpc/Source/DiscordRpc/Private/DiscordRpcPrivatePCH.h
@@ -0,0 +1,2 @@
+#include "Core.h"
+#include "DiscordRpc.h" \ No newline at end of file
diff --git a/externals/discord-rpc/examples/unrealstatus/Plugins/discordrpc/Source/DiscordRpc/Public/DiscordRpc.h b/externals/discord-rpc/examples/unrealstatus/Plugins/discordrpc/Source/DiscordRpc/Public/DiscordRpc.h
new file mode 100644
index 0000000000..727833b091
--- /dev/null
+++ b/externals/discord-rpc/examples/unrealstatus/Plugins/discordrpc/Source/DiscordRpc/Public/DiscordRpc.h
@@ -0,0 +1,20 @@
+// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "ModuleManager.h"
+
+class FDiscordRpcModule : public IModuleInterface {
+public:
+ /** IModuleInterface implementation */
+ virtual void StartupModule() override;
+ virtual void ShutdownModule() override;
+
+private:
+ /** Handle to the test dll we will load */
+ void* DiscordRpcLibraryHandle;
+
+ /** StartupModule is covered with defines, these functions are the place to put breakpoints */
+ static bool LoadDependency(const FString& Dir, const FString& Name, void*& Handle);
+ static void FreeDependency(void*& Handle);
+}; \ No newline at end of file
diff --git a/externals/discord-rpc/examples/unrealstatus/Plugins/discordrpc/Source/DiscordRpc/Public/DiscordRpcBlueprint.h b/externals/discord-rpc/examples/unrealstatus/Plugins/discordrpc/Source/DiscordRpc/Public/DiscordRpcBlueprint.h
new file mode 100644
index 0000000000..409eee0d9d
--- /dev/null
+++ b/externals/discord-rpc/examples/unrealstatus/Plugins/discordrpc/Source/DiscordRpc/Public/DiscordRpcBlueprint.h
@@ -0,0 +1,181 @@
+#pragma once
+
+#include "CoreMinimal.h"
+#include "Engine.h"
+#include "DiscordRpcBlueprint.generated.h"
+
+// unreal's header tool hates clang-format
+// clang-format off
+
+/**
+* Ask to join callback data
+*/
+USTRUCT(BlueprintType)
+struct FDiscordUserData {
+ GENERATED_USTRUCT_BODY()
+
+ UPROPERTY(BlueprintReadOnly)
+ FString userId;
+ UPROPERTY(BlueprintReadOnly)
+ FString username;
+ UPROPERTY(BlueprintReadOnly)
+ FString discriminator;
+ UPROPERTY(BlueprintReadOnly)
+ FString avatar;
+};
+
+/**
+* Valid response codes for Respond function
+*/
+UENUM(BlueprintType)
+enum class EDiscordJoinResponseCodes : uint8
+{
+ DISCORD_REPLY_NO UMETA(DisplayName="No"),
+ DISCORD_REPLY_YES UMETA(DisplayName="Yes"),
+ DISCORD_REPLY_IGNORE UMETA(DisplayName="Ignore")
+};
+
+/**
+* Valid party privacy values
+*/
+UENUM(BlueprintType)
+enum class EDiscordPartyPrivacy: uint8
+{
+ DISCORD_PARTY_PRIVATE UMETA(DisplayName="Private"),
+ DISCORD_PARTY_PUBLIC UMETA(DisplayName="Public")
+};
+
+DECLARE_LOG_CATEGORY_EXTERN(Discord, Log, All);
+
+DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FDiscordConnected, const FDiscordUserData&, joinRequest);
+DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FDiscordDisconnected, int, errorCode, const FString&, errorMessage);
+DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FDiscordErrored, int, errorCode, const FString&, errorMessage);
+DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FDiscordJoin, const FString&, joinSecret);
+DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FDiscordSpectate, const FString&, spectateSecret);
+DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FDiscordJoinRequest, const FDiscordUserData&, joinRequest);
+
+// clang-format on
+
+/**
+ * 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)
+ EDiscordPartyPrivacy partyPrivacy;
+ UPROPERTY(BlueprintReadWrite)
+ FString matchSecret;
+ UPROPERTY(BlueprintReadWrite)
+ FString joinSecret;
+ UPROPERTY(BlueprintReadWrite)
+ FString spectateSecret;
+ UPROPERTY(BlueprintReadWrite)
+ bool instance;
+};
+
+/**
+ *
+ */
+UCLASS(BlueprintType, meta = (DisplayName = "Discord RPC"), Category = "Discord")
+class DISCORDRPC_API UDiscordRpc : public UObject {
+ GENERATED_BODY()
+
+public:
+ UFUNCTION(BlueprintCallable,
+ meta = (DisplayName = "Initialize connection", Keywords = "Discord rpc"),
+ Category = "Discord")
+ void Initialize(const FString& applicationId,
+ bool autoRegister,
+ const FString& optionalSteamId);
+
+ UFUNCTION(BlueprintCallable,
+ meta = (DisplayName = "Shut down connection", Keywords = "Discord rpc"),
+ Category = "Discord")
+ void Shutdown();
+
+ 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();
+
+ UFUNCTION(BlueprintCallable,
+ meta = (DisplayName = "Clear presence", Keywords = "Discord rpc"),
+ Category = "Discord")
+ void ClearPresence();
+
+ UFUNCTION(BlueprintCallable,
+ meta = (DisplayName = "Respond to join request", Keywords = "Discord rpc"),
+ Category = "Discord")
+ void Respond(const FString& userId, int reply);
+
+ UPROPERTY(BlueprintReadOnly,
+ meta = (DisplayName = "Is Discord connected", Keywords = "Discord rpc"),
+ Category = "Discord")
+ bool IsConnected;
+
+ UPROPERTY(BlueprintAssignable,
+ meta = (DisplayName = "On connection", Keywords = "Discord rpc"),
+ Category = "Discord")
+ FDiscordConnected OnConnected;
+
+ UPROPERTY(BlueprintAssignable,
+ meta = (DisplayName = "On disconnection", Keywords = "Discord rpc"),
+ Category = "Discord")
+ FDiscordDisconnected OnDisconnected;
+
+ UPROPERTY(BlueprintAssignable,
+ meta = (DisplayName = "On error message", Keywords = "Discord rpc"),
+ Category = "Discord")
+ FDiscordErrored OnErrored;
+
+ UPROPERTY(BlueprintAssignable,
+ meta = (DisplayName = "When Discord user presses join", Keywords = "Discord rpc"),
+ Category = "Discord")
+ FDiscordJoin OnJoin;
+
+ UPROPERTY(BlueprintAssignable,
+ meta = (DisplayName = "When Discord user presses spectate", Keywords = "Discord rpc"),
+ Category = "Discord")
+ FDiscordSpectate OnSpectate;
+
+ UPROPERTY(BlueprintAssignable,
+ meta = (DisplayName = "When Discord another user sends a join request",
+ Keywords = "Discord rpc"),
+ Category = "Discord")
+ FDiscordJoinRequest OnJoinRequest;
+
+ UPROPERTY(BlueprintReadWrite,
+ meta = (DisplayName = "Rich presence info", Keywords = "Discord rpc"),
+ Category = "Discord")
+ FDiscordRichPresence RichPresence;
+};
diff --git a/externals/discord-rpc/examples/unrealstatus/Plugins/discordrpc/Source/ThirdParty/DiscordRpcLibrary/DiscordRpcLibrary.Build.cs b/externals/discord-rpc/examples/unrealstatus/Plugins/discordrpc/Source/ThirdParty/DiscordRpcLibrary/DiscordRpcLibrary.Build.cs
new file mode 100644
index 0000000000..ba8d83499f
--- /dev/null
+++ b/externals/discord-rpc/examples/unrealstatus/Plugins/discordrpc/Source/ThirdParty/DiscordRpcLibrary/DiscordRpcLibrary.Build.cs
@@ -0,0 +1,59 @@
+// Fill out your copyright notice in the Description page of Project Settings.
+
+using System.IO;
+using UnrealBuildTool;
+
+public class DiscordRpcLibrary : ModuleRules
+{
+#if WITH_FORWARDED_MODULE_RULES_CTOR
+ public DiscordRpcLibrary(ReadOnlyTargetRules Target) : base(Target)
+#else
+ public DiscordRpcLibrary(TargetInfo Target)
+#endif
+ {
+ Type = ModuleType.External;
+ Definitions.Add("DISCORD_DYNAMIC_LIB=1");
+
+ string BaseDirectory = Path.GetFullPath(Path.Combine(ModuleDirectory, "..", "..", "ThirdParty", "DiscordRpcLibrary"));
+
+ if (Target.Platform == UnrealTargetPlatform.Win64)
+ {
+ string lib = Path.Combine(BaseDirectory, "Win64");
+
+ // Include headers
+ PublicIncludePaths.Add(Path.Combine(BaseDirectory, "Include"));
+
+ // Add the import library
+ PublicLibraryPaths.Add(lib);
+ PublicAdditionalLibraries.Add(Path.Combine(lib, "discord-rpc.lib"));
+
+ // Dynamic
+ RuntimeDependencies.Add(new RuntimeDependency(Path.Combine(lib, "discord-rpc.dll")));
+ PublicDelayLoadDLLs.Add("discord-rpc.dll");
+ }
+ else if (Target.Platform == UnrealTargetPlatform.Linux)
+ {
+ string lib = Path.Combine(BaseDirectory, "Linux", "x86_64-unknown-linux-gnu");
+
+ // Include headers
+ PublicIncludePaths.Add(Path.Combine(BaseDirectory, "Include"));
+
+ // Add the import library
+ PublicLibraryPaths.Add(lib);
+ PublicAdditionalLibraries.Add(Path.Combine(lib, "libdiscord-rpc.so"));
+ RuntimeDependencies.Add(new RuntimeDependency(Path.Combine(lib, "libdiscord-rpc.so")));
+ }
+ else if (Target.Platform == UnrealTargetPlatform.Mac)
+ {
+ string lib = Path.Combine(BaseDirectory, "Mac");
+
+ // Include headers
+ PublicIncludePaths.Add(Path.Combine(BaseDirectory, "Include"));
+
+ // Add the import library
+ PublicLibraryPaths.Add(lib);
+ PublicAdditionalLibraries.Add(Path.Combine(lib, "libdiscord-rpc.dylib"));
+ RuntimeDependencies.Add(new RuntimeDependency(Path.Combine(lib, "libdiscord-rpc.dylib")));
+ }
+ }
+} \ No newline at end of file
diff --git a/externals/discord-rpc/examples/unrealstatus/Source/unrealstatus.Target.cs b/externals/discord-rpc/examples/unrealstatus/Source/unrealstatus.Target.cs
new file mode 100644
index 0000000000..0c7c3c8889
--- /dev/null
+++ b/externals/discord-rpc/examples/unrealstatus/Source/unrealstatus.Target.cs
@@ -0,0 +1,14 @@
+// Fill out your copyright notice in the Description page of Project Settings.
+
+using UnrealBuildTool;
+using System.Collections.Generic;
+
+public class unrealstatusTarget : TargetRules
+{
+ public unrealstatusTarget(TargetInfo Target) : base(Target)
+ {
+ Type = TargetType.Game;
+
+ ExtraModuleNames.AddRange( new string[] { "unrealstatus" } );
+ }
+}
diff --git a/externals/discord-rpc/examples/unrealstatus/Source/unrealstatus/unrealstatus.Build.cs b/externals/discord-rpc/examples/unrealstatus/Source/unrealstatus/unrealstatus.Build.cs
new file mode 100644
index 0000000000..9560370eb0
--- /dev/null
+++ b/externals/discord-rpc/examples/unrealstatus/Source/unrealstatus/unrealstatus.Build.cs
@@ -0,0 +1,23 @@
+// Fill out your copyright notice in the Description page of Project Settings.
+
+using UnrealBuildTool;
+
+public class unrealstatus : ModuleRules
+{
+ public unrealstatus(ReadOnlyTargetRules Target) : base(Target)
+ {
+ PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
+
+ PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore" });
+
+ PrivateDependencyModuleNames.AddRange(new string[] { });
+
+ // Uncomment if you are using Slate UI
+ // PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });
+
+ // Uncomment if you are using online features
+ // PrivateDependencyModuleNames.Add("OnlineSubsystem");
+
+ // To include OnlineSubsystemSteam, add it to the plugins section in your uproject file with the Enabled attribute set to true
+ }
+}
diff --git a/externals/discord-rpc/examples/unrealstatus/Source/unrealstatus/unrealstatus.cpp b/externals/discord-rpc/examples/unrealstatus/Source/unrealstatus/unrealstatus.cpp
new file mode 100644
index 0000000000..9dd5388652
--- /dev/null
+++ b/externals/discord-rpc/examples/unrealstatus/Source/unrealstatus/unrealstatus.cpp
@@ -0,0 +1,6 @@
+// Fill out your copyright notice in the Description page of Project Settings.
+
+#include "unrealstatus.h"
+#include "Modules/ModuleManager.h"
+
+IMPLEMENT_PRIMARY_GAME_MODULE(FDefaultGameModuleImpl, unrealstatus, "unrealstatus");
diff --git a/externals/discord-rpc/examples/unrealstatus/Source/unrealstatus/unrealstatus.h b/externals/discord-rpc/examples/unrealstatus/Source/unrealstatus/unrealstatus.h
new file mode 100644
index 0000000000..73407dd15a
--- /dev/null
+++ b/externals/discord-rpc/examples/unrealstatus/Source/unrealstatus/unrealstatus.h
@@ -0,0 +1,5 @@
+// Fill out your copyright notice in the Description page of Project Settings.
+
+#pragma once
+
+#include "CoreMinimal.h"
diff --git a/externals/discord-rpc/examples/unrealstatus/Source/unrealstatus/unrealstatusGameModeBase.cpp b/externals/discord-rpc/examples/unrealstatus/Source/unrealstatus/unrealstatusGameModeBase.cpp
new file mode 100644
index 0000000000..1af30948cd
--- /dev/null
+++ b/externals/discord-rpc/examples/unrealstatus/Source/unrealstatus/unrealstatusGameModeBase.cpp
@@ -0,0 +1,3 @@
+// Fill out your copyright notice in the Description page of Project Settings.
+
+#include "unrealstatusGameModeBase.h"
diff --git a/externals/discord-rpc/examples/unrealstatus/Source/unrealstatus/unrealstatusGameModeBase.h b/externals/discord-rpc/examples/unrealstatus/Source/unrealstatus/unrealstatusGameModeBase.h
new file mode 100644
index 0000000000..8dd9bd4740
--- /dev/null
+++ b/externals/discord-rpc/examples/unrealstatus/Source/unrealstatus/unrealstatusGameModeBase.h
@@ -0,0 +1,15 @@
+// Fill out your copyright notice in the Description page of Project Settings.
+
+#pragma once
+
+#include "CoreMinimal.h"
+#include "GameFramework/GameModeBase.h"
+#include "unrealstatusGameModeBase.generated.h"
+
+/**
+ *
+ */
+UCLASS()
+class UNREALSTATUS_API AunrealstatusGameModeBase : public AGameModeBase {
+ GENERATED_BODY()
+};
diff --git a/externals/discord-rpc/examples/unrealstatus/Source/unrealstatusEditor.Target.cs b/externals/discord-rpc/examples/unrealstatus/Source/unrealstatusEditor.Target.cs
new file mode 100644
index 0000000000..2e8ad02286
--- /dev/null
+++ b/externals/discord-rpc/examples/unrealstatus/Source/unrealstatusEditor.Target.cs
@@ -0,0 +1,14 @@
+// Fill out your copyright notice in the Description page of Project Settings.
+
+using UnrealBuildTool;
+using System.Collections.Generic;
+
+public class unrealstatusEditorTarget : TargetRules
+{
+ public unrealstatusEditorTarget(TargetInfo Target) : base(Target)
+ {
+ Type = TargetType.Editor;
+
+ ExtraModuleNames.AddRange( new string[] { "unrealstatus" } );
+ }
+}
diff --git a/externals/discord-rpc/examples/unrealstatus/unrealstatus.uproject b/externals/discord-rpc/examples/unrealstatus/unrealstatus.uproject
new file mode 100644
index 0000000000..8a4a40b4e2
--- /dev/null
+++ b/externals/discord-rpc/examples/unrealstatus/unrealstatus.uproject
@@ -0,0 +1,19 @@
+{
+ "FileVersion": 3,
+ "EngineAssociation": "4.18",
+ "Category": "",
+ "Description": "",
+ "Modules": [
+ {
+ "Name": "unrealstatus",
+ "Type": "Runtime",
+ "LoadingPhase": "Default"
+ }
+ ],
+ "TargetPlatforms": [
+ "LinuxNoEditor",
+ "MacNoEditor",
+ "WindowsNoEditor",
+ "AllDesktop"
+ ]
+} \ No newline at end of file