Add dependencies locally
This commit is contained in:
78
deps/discord-rpc/examples/unrealstatus/.gitignore
vendored
Normal file
78
deps/discord-rpc/examples/unrealstatus/.gitignore
vendored
Normal file
@ -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
|
0
deps/discord-rpc/examples/unrealstatus/Config/DefaultEditor.ini
vendored
Normal file
0
deps/discord-rpc/examples/unrealstatus/Config/DefaultEditor.ini
vendored
Normal file
54
deps/discord-rpc/examples/unrealstatus/Config/DefaultEngine.ini
vendored
Normal file
54
deps/discord-rpc/examples/unrealstatus/Config/DefaultEngine.ini
vendored
Normal file
@ -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
|
||||
|
7
deps/discord-rpc/examples/unrealstatus/Config/DefaultGame.ini
vendored
Normal file
7
deps/discord-rpc/examples/unrealstatus/Config/DefaultGame.ini
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
[/Script/EngineSettings.GeneralProjectSettings]
|
||||
ProjectID=E5977A24492699DF20B8ADBF736AF6C6
|
||||
ProjectName=Discord RPC Example
|
||||
CompanyName=Discord Inc.
|
||||
Homepage="https://discordapp.com/"
|
||||
CopyrightNotice=
|
||||
|
BIN
deps/discord-rpc/examples/unrealstatus/Content/MainScreenBP.uasset
vendored
Normal file
BIN
deps/discord-rpc/examples/unrealstatus/Content/MainScreenBP.uasset
vendored
Normal file
Binary file not shown.
BIN
deps/discord-rpc/examples/unrealstatus/Content/MouseGameModeBP.uasset
vendored
Normal file
BIN
deps/discord-rpc/examples/unrealstatus/Content/MouseGameModeBP.uasset
vendored
Normal file
Binary file not shown.
BIN
deps/discord-rpc/examples/unrealstatus/Content/MousePlayerControllerBP.uasset
vendored
Normal file
BIN
deps/discord-rpc/examples/unrealstatus/Content/MousePlayerControllerBP.uasset
vendored
Normal file
Binary file not shown.
BIN
deps/discord-rpc/examples/unrealstatus/Content/ShowTheUILevel.umap
vendored
Normal file
BIN
deps/discord-rpc/examples/unrealstatus/Content/ShowTheUILevel.umap
vendored
Normal file
Binary file not shown.
29
deps/discord-rpc/examples/unrealstatus/Plugins/discordrpc/DiscordRpc.uplugin
vendored
Normal file
29
deps/discord-rpc/examples/unrealstatus/Plugins/discordrpc/DiscordRpc.uplugin
vendored
Normal file
@ -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"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
BIN
deps/discord-rpc/examples/unrealstatus/Plugins/discordrpc/Resources/Icon128.png
vendored
Normal file
BIN
deps/discord-rpc/examples/unrealstatus/Plugins/discordrpc/Resources/Icon128.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.6 KiB |
BIN
deps/discord-rpc/examples/unrealstatus/Plugins/discordrpc/Resources/discord.png
vendored
Normal file
BIN
deps/discord-rpc/examples/unrealstatus/Plugins/discordrpc/Resources/discord.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.6 KiB |
57
deps/discord-rpc/examples/unrealstatus/Plugins/discordrpc/Source/DiscordRpc/DiscordRpc.Build.cs
vendored
Normal file
57
deps/discord-rpc/examples/unrealstatus/Plugins/discordrpc/Source/DiscordRpc/DiscordRpc.Build.cs
vendored
Normal file
@ -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"));
|
||||
}
|
||||
}
|
@ -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)
|
@ -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);
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
#include "Core.h"
|
||||
#include "DiscordRpc.h"
|
20
deps/discord-rpc/examples/unrealstatus/Plugins/discordrpc/Source/DiscordRpc/Public/DiscordRpc.h
vendored
Normal file
20
deps/discord-rpc/examples/unrealstatus/Plugins/discordrpc/Source/DiscordRpc/Public/DiscordRpc.h
vendored
Normal file
@ -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);
|
||||
};
|
@ -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;
|
||||
};
|
@ -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")));
|
||||
}
|
||||
}
|
||||
}
|
14
deps/discord-rpc/examples/unrealstatus/Source/unrealstatus.Target.cs
vendored
Normal file
14
deps/discord-rpc/examples/unrealstatus/Source/unrealstatus.Target.cs
vendored
Normal file
@ -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" } );
|
||||
}
|
||||
}
|
23
deps/discord-rpc/examples/unrealstatus/Source/unrealstatus/unrealstatus.Build.cs
vendored
Normal file
23
deps/discord-rpc/examples/unrealstatus/Source/unrealstatus/unrealstatus.Build.cs
vendored
Normal file
@ -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
|
||||
}
|
||||
}
|
6
deps/discord-rpc/examples/unrealstatus/Source/unrealstatus/unrealstatus.cpp
vendored
Normal file
6
deps/discord-rpc/examples/unrealstatus/Source/unrealstatus/unrealstatus.cpp
vendored
Normal file
@ -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");
|
5
deps/discord-rpc/examples/unrealstatus/Source/unrealstatus/unrealstatus.h
vendored
Normal file
5
deps/discord-rpc/examples/unrealstatus/Source/unrealstatus/unrealstatus.h
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
3
deps/discord-rpc/examples/unrealstatus/Source/unrealstatus/unrealstatusGameModeBase.cpp
vendored
Normal file
3
deps/discord-rpc/examples/unrealstatus/Source/unrealstatus/unrealstatusGameModeBase.cpp
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#include "unrealstatusGameModeBase.h"
|
15
deps/discord-rpc/examples/unrealstatus/Source/unrealstatus/unrealstatusGameModeBase.h
vendored
Normal file
15
deps/discord-rpc/examples/unrealstatus/Source/unrealstatus/unrealstatusGameModeBase.h
vendored
Normal file
@ -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()
|
||||
};
|
14
deps/discord-rpc/examples/unrealstatus/Source/unrealstatusEditor.Target.cs
vendored
Normal file
14
deps/discord-rpc/examples/unrealstatus/Source/unrealstatusEditor.Target.cs
vendored
Normal file
@ -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" } );
|
||||
}
|
||||
}
|
19
deps/discord-rpc/examples/unrealstatus/unrealstatus.uproject
vendored
Normal file
19
deps/discord-rpc/examples/unrealstatus/unrealstatus.uproject
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"FileVersion": 3,
|
||||
"EngineAssociation": "4.18",
|
||||
"Category": "",
|
||||
"Description": "",
|
||||
"Modules": [
|
||||
{
|
||||
"Name": "unrealstatus",
|
||||
"Type": "Runtime",
|
||||
"LoadingPhase": "Default"
|
||||
}
|
||||
],
|
||||
"TargetPlatforms": [
|
||||
"LinuxNoEditor",
|
||||
"MacNoEditor",
|
||||
"WindowsNoEditor",
|
||||
"AllDesktop"
|
||||
]
|
||||
}
|
Reference in New Issue
Block a user