mirror of
https://github.com/yuzu-emu/discord-rpc
synced 2024-11-26 03:07:41 +00:00
autoformat missed these before?
This commit is contained in:
parent
4cf8ca5670
commit
8bceae0a3a
7 changed files with 79 additions and 58 deletions
|
@ -9,35 +9,40 @@
|
|||
|
||||
void FdiscordrpcModule::StartupModule()
|
||||
{
|
||||
// This code will execute after your module is loaded into memory; the exact timing is specified in the .uplugin file per-module
|
||||
// This code will execute after your module is loaded into memory; the exact timing is specified
|
||||
// in the .uplugin file per-module
|
||||
|
||||
// Get the base directory of this plugin
|
||||
FString BaseDir = IPluginManager::Get().FindPlugin("discordrpc")->GetBaseDir();
|
||||
// Get the base directory of this plugin
|
||||
FString BaseDir = IPluginManager::Get().FindPlugin("discordrpc")->GetBaseDir();
|
||||
|
||||
// Add on the relative location of the third party dll and load it
|
||||
FString LibraryPath;
|
||||
// Add on the relative location of the third party dll and load it
|
||||
FString LibraryPath;
|
||||
#if PLATFORM_WINDOWS
|
||||
LibraryPath = FPaths::Combine(*BaseDir, TEXT("Binaries/ThirdParty/discordrpcLibrary/Win64/discord-rpc.dll"));
|
||||
LibraryPath = FPaths::Combine(
|
||||
*BaseDir, TEXT("Binaries/ThirdParty/discordrpcLibrary/Win64/discord-rpc.dll"));
|
||||
#elif PLATFORM_MAC
|
||||
LibraryPath = FPaths::Combine(*BaseDir, TEXT("Source/ThirdParty/discordrpcLibrary/Mac/Release/libdiscord-rpc.dylib"));
|
||||
LibraryPath = FPaths::Combine(
|
||||
*BaseDir, TEXT("Source/ThirdParty/discordrpcLibrary/Mac/Release/libdiscord-rpc.dylib"));
|
||||
#endif // PLATFORM_WINDOWS
|
||||
|
||||
DiscordLibraryHandle = !LibraryPath.IsEmpty() ? FPlatformProcess::GetDllHandle(*LibraryPath) : nullptr;
|
||||
DiscordLibraryHandle =
|
||||
!LibraryPath.IsEmpty() ? FPlatformProcess::GetDllHandle(*LibraryPath) : nullptr;
|
||||
|
||||
if (!DiscordLibraryHandle)
|
||||
{
|
||||
FMessageDialog::Open(EAppMsgType::Ok, LOCTEXT("ThirdPartyLibraryError", "Failed to load discord-rpc library"));
|
||||
}
|
||||
if (!DiscordLibraryHandle) {
|
||||
FMessageDialog::Open(
|
||||
EAppMsgType::Ok, LOCTEXT("ThirdPartyLibraryError", "Failed to load discord-rpc library"));
|
||||
}
|
||||
}
|
||||
|
||||
void FdiscordrpcModule::ShutdownModule()
|
||||
{
|
||||
// This function may be called during shutdown to clean up your module. For modules that support dynamic reloading,
|
||||
// we call this function before unloading the module.
|
||||
// This function may be called during shutdown to clean up your module. For modules that
|
||||
// support dynamic reloading,
|
||||
// we call this function before unloading the module.
|
||||
|
||||
// Free the dll handle
|
||||
FPlatformProcess::FreeDllHandle(DiscordLibraryHandle);
|
||||
DiscordLibraryHandle = nullptr;
|
||||
// Free the dll handle
|
||||
FPlatformProcess::FreeDllHandle(DiscordLibraryHandle);
|
||||
DiscordLibraryHandle = nullptr;
|
||||
}
|
||||
|
||||
#undef LOCTEXT_NAMESPACE
|
||||
|
|
|
@ -9,8 +9,16 @@
|
|||
DECLARE_LOG_CATEGORY_EXTERN(Discord, Log, All);
|
||||
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FDiscordConnected);
|
||||
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_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);
|
||||
|
||||
|
@ -58,42 +66,62 @@ struct FDiscordRichPresence {
|
|||
*
|
||||
*/
|
||||
UCLASS(BlueprintType, meta = (DisplayName = "Discord RPC"), Category = "Discord")
|
||||
class DISCORDRPC_API UDiscordRpc : public UObject
|
||||
{
|
||||
class DISCORDRPC_API UDiscordRpc : public UObject {
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
|
||||
UFUNCTION(BlueprintCallable, meta = (DisplayName = "Initialize connection", Keywords = "Discord rpc"), Category = "Discord")
|
||||
UFUNCTION(BlueprintCallable,
|
||||
meta = (DisplayName = "Initialize connection", Keywords = "Discord rpc"),
|
||||
Category = "Discord")
|
||||
void Initialize(const FString& applicationId, bool autoRegister);
|
||||
|
||||
UFUNCTION(BlueprintCallable, meta = (DisplayName = "Shut down connection", Keywords = "Discord rpc"), Category = "Discord")
|
||||
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")
|
||||
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")
|
||||
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")
|
||||
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")
|
||||
UPROPERTY(BlueprintAssignable,
|
||||
meta = (DisplayName = "On connection", Keywords = "Discord rpc"),
|
||||
Category = "Discord")
|
||||
FDiscordConnected OnConnected;
|
||||
|
||||
UPROPERTY(BlueprintAssignable, meta = (DisplayName = "On disconnection", Keywords = "Discord rpc"), Category = "Discord")
|
||||
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")
|
||||
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")
|
||||
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")
|
||||
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")
|
||||
UPROPERTY(BlueprintReadWrite,
|
||||
meta = (DisplayName = "Rich presence info", Keywords = "Discord rpc"),
|
||||
Category = "Discord")
|
||||
FDiscordRichPresence RichPresence;
|
||||
};
|
||||
|
|
|
@ -4,15 +4,13 @@
|
|||
|
||||
#include "ModuleManager.h"
|
||||
|
||||
class FdiscordrpcModule : public IModuleInterface
|
||||
{
|
||||
class FdiscordrpcModule : public IModuleInterface {
|
||||
public:
|
||||
|
||||
/** IModuleInterface implementation */
|
||||
virtual void StartupModule() override;
|
||||
virtual void ShutdownModule() override;
|
||||
/** IModuleInterface implementation */
|
||||
virtual void StartupModule() override;
|
||||
virtual void ShutdownModule() override;
|
||||
|
||||
private:
|
||||
/** Handle to the test dll we will load */
|
||||
void* DiscordLibraryHandle;
|
||||
/** Handle to the test dll we will load */
|
||||
void* DiscordLibraryHandle;
|
||||
};
|
|
@ -3,4 +3,4 @@
|
|||
#include "unrealstatus.h"
|
||||
#include "Modules/ModuleManager.h"
|
||||
|
||||
IMPLEMENT_PRIMARY_GAME_MODULE( FDefaultGameModuleImpl, unrealstatus, "unrealstatus" );
|
||||
IMPLEMENT_PRIMARY_GAME_MODULE(FDefaultGameModuleImpl, unrealstatus, "unrealstatus");
|
||||
|
|
|
@ -3,4 +3,3 @@
|
|||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#include "unrealstatusGameModeBase.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -10,11 +10,6 @@
|
|||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class UNREALSTATUS_API AunrealstatusGameModeBase : public AGameModeBase
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
|
||||
|
||||
|
||||
class UNREALSTATUS_API AunrealstatusGameModeBase : public AGameModeBase {
|
||||
GENERATED_BODY()
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue