-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed code execution cannot proceed error message for packaged builds.
- Loading branch information
1 parent
e1d647f
commit 83b4923
Showing
9 changed files
with
153 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 64 additions & 3 deletions
67
GameLiftClientSDK/Source/AWSCore/Private/AWSCoreModule.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,75 @@ | ||
#include "AWSCoreModulePrivatePCH.h" | ||
#include "AWSCoreModule.h" | ||
#include "GameLiftClientSDK/Public/GameLiftClientGlobals.h" | ||
#include "IPluginManager.h" | ||
|
||
void AWSCoreModuleImpl::StartupModule() | ||
#define LOCTEXT_NAMESPACE "FAWSCoreModule" | ||
|
||
void* FAWSCoreModule::AWSCoreLibraryHandle = nullptr; | ||
|
||
void FAWSCoreModule::StartupModule() | ||
{ | ||
#if PLATFORM_WINDOWS && PLATFORM_64BITS | ||
LOG_NORMAL("Starting AWSCore Module..."); | ||
|
||
const FString BaseDir = IPluginManager::Get().FindPlugin("GameLiftClientSDK")->GetBaseDir(); | ||
LOG_NORMAL(FString::Printf(TEXT("Base directory is %s"), *BaseDir)); | ||
|
||
const FString ThirdPartyDir = FPaths::Combine(*BaseDir, TEXT("ThirdParty"), TEXT("GameLiftClientSDK"), TEXT("Win64")); | ||
LOG_NORMAL(FString::Printf(TEXT("ThirdParty directory is %s"), *ThirdPartyDir)); | ||
|
||
static const FString CoreDLLName = "aws-cpp-sdk-core"; | ||
const bool bDependencyLoaded = LoadDependency(ThirdPartyDir, CoreDLLName, AWSCoreLibraryHandle); | ||
if (bDependencyLoaded == false) | ||
{ | ||
FFormatNamedArguments Arguments; | ||
Arguments.Add(TEXT("Name"), FText::FromString(CoreDLLName)); | ||
FMessageDialog::Open(EAppMsgType::Ok, FText::Format(LOCTEXT("LoadDependencyError", "Failed to load {Name}. Plugin will not be functional"), Arguments)); | ||
FreeDependency(AWSCoreLibraryHandle); | ||
return; | ||
} | ||
|
||
Aws::InitAPI(options); | ||
LOG_NORMAL("Aws::InitAPI called."); | ||
#endif | ||
} | ||
|
||
void AWSCoreModuleImpl::ShutdownModule() | ||
void FAWSCoreModule::ShutdownModule() | ||
{ | ||
Aws::ShutdownAPI(options); | ||
LOG_NORMAL("Aws::ShutdownAPI called."); | ||
FreeDependency(AWSCoreLibraryHandle); | ||
LOG_NORMAL("Shutting down AWSCore Module..."); | ||
} | ||
|
||
IMPLEMENT_MODULE(AWSCoreModuleImpl, AWSCore); | ||
bool FAWSCoreModule::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) | ||
{ | ||
LOG_ERROR(FString::Printf(TEXT("Dependency %s failed to load in directory %s"), *Lib, *Dir)); | ||
return false; | ||
} | ||
|
||
LOG_NORMAL(FString::Printf(TEXT("Dependency %s successfully loaded from directory %s"), *Lib, *Dir)); | ||
return true; | ||
} | ||
|
||
void FAWSCoreModule::FreeDependency(void*& Handle) | ||
{ | ||
#if !PLATFORM_LINUX | ||
if (Handle != nullptr) | ||
{ | ||
FPlatformProcess::FreeDllHandle(Handle); | ||
Handle = nullptr; | ||
} | ||
#endif | ||
} | ||
|
||
#undef LOCTEXT_NAMESPACE | ||
|
||
IMPLEMENT_MODULE(FAWSCoreModule, AWSCore); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 60 additions & 3 deletions
63
GameLiftClientSDK/Source/CognitoIdentity/Private/CognitoIdentityModule.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,69 @@ | ||
#include "CognitoIdentityModulePrivatePCH.h" | ||
#include "CognitoIdentityModule.h" | ||
#include "GameLiftClientSDK/Public/GameLiftClientGlobals.h" | ||
#include "IPluginManager.h" | ||
|
||
void CognitoIdentityModuleImpl::StartupModule() | ||
#define LOCTEXT_NAMESPACE "FCognitoIdentityModule" | ||
|
||
void* FCognitoIdentityModule::CognitoIdentityLibraryHandle = nullptr; | ||
|
||
void FCognitoIdentityModule::StartupModule() | ||
{ | ||
#if PLATFORM_WINDOWS && PLATFORM_64BITS | ||
LOG_NORMAL("Starting CognitoIdentity Module..."); | ||
|
||
const FString BaseDir = IPluginManager::Get().FindPlugin("GameLiftClientSDK")->GetBaseDir(); | ||
LOG_NORMAL(FString::Printf(TEXT("Base directory is %s"), *BaseDir)); | ||
|
||
const FString ThirdPartyDir = FPaths::Combine(*BaseDir, TEXT("ThirdParty"), TEXT("GameLiftClientSDK"), TEXT("Win64")); | ||
LOG_NORMAL(FString::Printf(TEXT("ThirdParty directory is %s"), *ThirdPartyDir)); | ||
|
||
static const FString CognitoIdentityDLLName = "aws-cpp-sdk-cognito-identity"; | ||
const bool bDependencyLoaded = LoadDependency(ThirdPartyDir, CognitoIdentityDLLName, CognitoIdentityLibraryHandle); | ||
if (bDependencyLoaded == false) | ||
{ | ||
FFormatNamedArguments Arguments; | ||
Arguments.Add(TEXT("Name"), FText::FromString(CognitoIdentityDLLName)); | ||
FMessageDialog::Open(EAppMsgType::Ok, FText::Format(LOCTEXT("LoadDependencyError", "Failed to load {Name}. Plugin will not be functional"), Arguments)); | ||
FreeDependency(CognitoIdentityLibraryHandle); | ||
} | ||
#endif | ||
} | ||
|
||
void CognitoIdentityModuleImpl::ShutdownModule() | ||
void FCognitoIdentityModule::ShutdownModule() | ||
{ | ||
FreeDependency(CognitoIdentityLibraryHandle); | ||
LOG_NORMAL("Shutting down CognitoIdentity Module..."); | ||
} | ||
|
||
IMPLEMENT_MODULE(CognitoIdentityModuleImpl, CognitoIdentity); | ||
bool FCognitoIdentityModule::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) | ||
{ | ||
LOG_ERROR(FString::Printf(TEXT("Dependency %s failed to load in directory %s"), *Lib, *Dir)); | ||
return false; | ||
} | ||
|
||
LOG_NORMAL(FString::Printf(TEXT("Dependency %s successfully loaded from directory %s"), *Lib, *Dir)); | ||
return true; | ||
} | ||
|
||
void FCognitoIdentityModule::FreeDependency(void*& Handle) | ||
{ | ||
#if !PLATFORM_LINUX | ||
if (Handle != nullptr) | ||
{ | ||
FPlatformProcess::FreeDllHandle(Handle); | ||
Handle = nullptr; | ||
} | ||
#endif | ||
} | ||
|
||
#undef LOCTEXT_NAMESPACE | ||
|
||
IMPLEMENT_MODULE(FCognitoIdentityModule, CognitoIdentity); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters