Tabs/Spaces consistency.
This commit is contained in:
parent
c39db5baa7
commit
31e760390d
@ -19,11 +19,11 @@
|
|||||||
"Type": "Runtime",
|
"Type": "Runtime",
|
||||||
"LoadingPhase": "PreDefault",
|
"LoadingPhase": "PreDefault",
|
||||||
"WhitelistPlatforms" :
|
"WhitelistPlatforms" :
|
||||||
[
|
[
|
||||||
"Win64",
|
"Win64",
|
||||||
"Linux",
|
"Linux",
|
||||||
"Mac"
|
"Mac"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
@ -47,8 +47,8 @@ public class DiscordRpc : ModuleRules
|
|||||||
DynamicallyLoadedModuleNames.AddRange(
|
DynamicallyLoadedModuleNames.AddRange(
|
||||||
new string[]
|
new string[]
|
||||||
{
|
{
|
||||||
// ... add any modules that your module loads dynamically here ...
|
// ... add any modules that your module loads dynamically here ...
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
string BaseDirectory = Path.GetFullPath(Path.Combine(ModuleDirectory, "..", "..", "Source", "ThirdParty", "DiscordRpcLibrary"));
|
string BaseDirectory = Path.GetFullPath(Path.Combine(ModuleDirectory, "..", "..", "Source", "ThirdParty", "DiscordRpcLibrary"));
|
||||||
|
@ -12,21 +12,21 @@ void FDiscordRpcModule::StartupModule()
|
|||||||
#if defined(DISCORD_DYNAMIC_LIB)
|
#if defined(DISCORD_DYNAMIC_LIB)
|
||||||
// Get the base directory of this plugin
|
// Get the base directory of this plugin
|
||||||
FString BaseDir = IPluginManager::Get().FindPlugin("DiscordRpc")->GetBaseDir();
|
FString BaseDir = IPluginManager::Get().FindPlugin("DiscordRpc")->GetBaseDir();
|
||||||
const FString SDKDir = FPaths::Combine(*BaseDir, TEXT("Source"), TEXT("ThirdParty"), TEXT("DiscordRpcLibrary"));
|
const FString SDKDir = FPaths::Combine(*BaseDir, TEXT("Source"), TEXT("ThirdParty"), TEXT("DiscordRpcLibrary"));
|
||||||
#if PLATFORM_WINDOWS
|
#if PLATFORM_WINDOWS
|
||||||
const FString LibName = TEXT("discord-rpc");
|
const FString LibName = TEXT("discord-rpc");
|
||||||
const FString LibDir = FPaths::Combine(*SDKDir, TEXT("Win64"));
|
const FString LibDir = FPaths::Combine(*SDKDir, TEXT("Win64"));
|
||||||
if (!LoadDependency(LibDir, LibName, DiscordRpcLibraryHandle)) {
|
if (!LoadDependency(LibDir, LibName, DiscordRpcLibraryHandle)) {
|
||||||
FMessageDialog::Open(EAppMsgType::Ok, LOCTEXT(LOCTEXT_NAMESPACE, "Failed to load DiscordRpc plugin. Plug-in will not be functional."));
|
FMessageDialog::Open(EAppMsgType::Ok, LOCTEXT(LOCTEXT_NAMESPACE, "Failed to load DiscordRpc plugin. Plug-in will not be functional."));
|
||||||
FreeDependency(DiscordRpcLibraryHandle);
|
FreeDependency(DiscordRpcLibraryHandle);
|
||||||
}
|
}
|
||||||
#elif PLATFORM_MAC
|
#elif PLATFORM_MAC
|
||||||
const FString LibName = TEXT("libdiscord-rpc");
|
const FString LibName = TEXT("libdiscord-rpc");
|
||||||
const FString LibDir = FPaths::Combine(*SDKDir, TEXT("Mac"));
|
const FString LibDir = FPaths::Combine(*SDKDir, TEXT("Mac"));
|
||||||
if (!LoadDependency(LibDir, LibName, DiscordRpcLibraryHandle)) {
|
if (!LoadDependency(LibDir, LibName, DiscordRpcLibraryHandle)) {
|
||||||
FMessageDialog::Open(EAppMsgType::Ok, LOCTEXT(LOCTEXT_NAMESPACE, "Failed to load DiscordRpc plugin. Plug-in will not be functional."));
|
FMessageDialog::Open(EAppMsgType::Ok, LOCTEXT(LOCTEXT_NAMESPACE, "Failed to load DiscordRpc plugin. Plug-in will not be functional."));
|
||||||
FreeDependency(DiscordRpcLibraryHandle);
|
FreeDependency(DiscordRpcLibraryHandle);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
@ -37,33 +37,33 @@ void FDiscordRpcModule::ShutdownModule()
|
|||||||
// Free the dll handle
|
// Free the dll handle
|
||||||
#if !PLATFORM_LINUX
|
#if !PLATFORM_LINUX
|
||||||
#if defined(DISCORD_DYNAMIC_LIB)
|
#if defined(DISCORD_DYNAMIC_LIB)
|
||||||
FreeDependency(DiscordRpcLibraryHandle);
|
FreeDependency(DiscordRpcLibraryHandle);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FDiscordRpcModule::LoadDependency(const FString& Dir, const FString& Name, void*& Handle)
|
bool FDiscordRpcModule::LoadDependency(const FString& Dir, const FString& Name, void*& Handle)
|
||||||
{
|
{
|
||||||
FString Lib = Name + TEXT(".") + FPlatformProcess::GetModuleExtension();
|
FString Lib = Name + TEXT(".") + FPlatformProcess::GetModuleExtension();
|
||||||
FString Path = Dir.IsEmpty() ? *Lib : FPaths::Combine(*Dir, *Lib);
|
FString Path = Dir.IsEmpty() ? *Lib : FPaths::Combine(*Dir, *Lib);
|
||||||
|
|
||||||
Handle = FPlatformProcess::GetDllHandle(*Path);
|
Handle = FPlatformProcess::GetDllHandle(*Path);
|
||||||
|
|
||||||
if (Handle == nullptr)
|
if (Handle == nullptr)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FDiscordRpcModule::FreeDependency(void*& Handle)
|
void FDiscordRpcModule::FreeDependency(void*& Handle)
|
||||||
{
|
{
|
||||||
if (Handle != nullptr)
|
if (Handle != nullptr)
|
||||||
{
|
{
|
||||||
FPlatformProcess::FreeDllHandle(Handle);
|
FPlatformProcess::FreeDllHandle(Handle);
|
||||||
Handle = nullptr;
|
Handle = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef LOCTEXT_NAMESPACE
|
#undef LOCTEXT_NAMESPACE
|
||||||
|
@ -66,8 +66,8 @@ static void JoinRequestHandler(const DiscordJoinRequest* request)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void UDiscordRpc::Initialize(const FString& applicationId,
|
void UDiscordRpc::Initialize(const FString& applicationId,
|
||||||
bool autoRegister,
|
bool autoRegister,
|
||||||
const FString& optionalSteamId)
|
const FString& optionalSteamId)
|
||||||
{
|
{
|
||||||
self = this;
|
self = this;
|
||||||
IsConnected = false;
|
IsConnected = false;
|
||||||
@ -87,7 +87,7 @@ void UDiscordRpc::Initialize(const FString& applicationId,
|
|||||||
auto appId = StringCast<ANSICHAR>(*applicationId);
|
auto appId = StringCast<ANSICHAR>(*applicationId);
|
||||||
auto steamId = StringCast<ANSICHAR>(*optionalSteamId);
|
auto steamId = StringCast<ANSICHAR>(*optionalSteamId);
|
||||||
Discord_Initialize(
|
Discord_Initialize(
|
||||||
(const char*)appId.Get(), &handlers, autoRegister, (const char*)steamId.Get());
|
(const char*)appId.Get(), &handlers, autoRegister, (const char*)steamId.Get());
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDiscordRpc::Shutdown()
|
void UDiscordRpc::Shutdown()
|
||||||
|
@ -14,7 +14,7 @@ private:
|
|||||||
/** Handle to the test dll we will load */
|
/** Handle to the test dll we will load */
|
||||||
void* DiscordRpcLibraryHandle;
|
void* DiscordRpcLibraryHandle;
|
||||||
|
|
||||||
/** StartupModule is covered with defines, these functions are the place to put breakpoints */
|
/** 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 bool LoadDependency(const FString& Dir, const FString& Name, void*& Handle);
|
||||||
static void FreeDependency(void*& Handle);
|
static void FreeDependency(void*& Handle);
|
||||||
};
|
};
|
Loading…
x
Reference in New Issue
Block a user