Skip to content
This repository has been archived by the owner on May 10, 2023. It is now read-only.

Commit

Permalink
Merge pull request #40 from modio/bugfix_loaddll
Browse files Browse the repository at this point in the history
Fixed crash when using the plugin in BP-only mode
  • Loading branch information
MarkusRannare authored Nov 16, 2020
2 parents 46d7aa1 + 6330156 commit 6cd74c4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions Source/modio/Private/ModioModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,9 @@ void FModioModule::StartupModule()
// Load the DLL on windows
#if PLATFORM_WINDOWS
FString DllPath = IPluginManager::Get().FindPlugin("Modio")->GetBaseDir();
DllPath.Append("/Source/ThirdParty/mod.io-sdk/bin/win64/modio.dll");
DllPath.Append("/Source/ThirdParty/mod.io-sdk/bin/msvc/x64/modio.dll");
DLLHandle = FPlatformProcess::GetDllHandle(*DllPath);
check(DLLHandle); // This should only happen in our testing environment the path the dll has changed
#endif

const UModioSettings *Settings = GetDefault<UModioSettings>();
Expand Down Expand Up @@ -113,7 +114,7 @@ void FModioModule::ShutdownModule()
}

#if PLATFORM_WINDOWS
if (DLLHandle != NULL)
if (DLLHandle != nullptr)
{
FPlatformProcess::FreeDllHandle(DLLHandle);
}
Expand Down Expand Up @@ -144,7 +145,6 @@ bool FModioModule::HandleSettingsSaved()
Settings->SaveConfig();
}

UE_LOG(LogTemp, Log, TEXT("Settings->bIsLiveEnvironment = %s"), Settings->bIsLiveEnvironment ? TEXT("TRUE") : TEXT("FALSE") );
ModioImp = FModioSubsystem::Create(Settings->RootDirectory, Settings->bRootDirectoryIsInUserSettingsDirectory, Settings->GameId, Settings->ApiKey, Settings->bIsLiveEnvironment, Settings->bInstallOnModDownload, Settings->bRetrieveModsFromOtherGames, Settings->bEnablePolling);

return true;
Expand Down
2 changes: 1 addition & 1 deletion Source/modio/Public/ModioModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ class FModioModule : public IModuleInterface

FModioSubsystemPtr ModioImp;
#if PLATFORM_WINDOWS
void* DLLHandle;
void* DLLHandle = nullptr;
#endif
};

0 comments on commit 6cd74c4

Please sign in to comment.