void FOnlineSubsystemSteamModule::LoadSteamModules() { UE_LOG_ONLINE(Display, TEXT("Loading Steam SDK %s"), STEAM_SDK_VER); #if PLATFORM_WINDOWS #if PLATFORM_64BITS FString RootSteamPath = GetSteamModulePath(); FPlatformProcess::PushDllDirectory(*RootSteamPath); SteamDLLHandle = FPlatformProcess::GetDllHandle(*(RootSteamPath + "steam_api64.dll")); #if 0 //64 bit not supported well at present, use Steam Client dlls // Load the Steam dedicated server dlls (assumes no Steam Client running) if (IsRunningDedicatedServer()) { SteamServerDLLHandle = FPlatformProcess::GetDllHandle(*(RootSteamPath + "steamclient64.dll")); } #endif FPlatformProcess::PopDllDirectory(*RootSteamPath); #else //PLATFORM_64BITS FString RootSteamPath = GetSteamModulePath(); FPlatformProcess::PushDllDirectory(*RootSteamPath); SteamDLLHandle = FPlatformProcess::GetDllHandle(*(RootSteamPath + "steam_api.dll")); if (IsRunningDedicatedServer()) { SteamServerDLLHandle = FPlatformProcess::GetDllHandle(*(RootSteamPath + "steamclient.dll")); } FPlatformProcess::PopDllDirectory(*RootSteamPath); #endif //PLATFORM_64BITS #elif PLATFORM_MAC SteamDLLHandle = FPlatformProcess::GetDllHandle(TEXT("libsteam_api.dylib")); #endif //PLATFORM_WINDOWS }
void FOnlineSubsystemSteamModule::LoadSteamModules() { UE_LOG_ONLINE(Display, TEXT("Loading Steam SDK %s"), STEAM_SDK_VER); #if PLATFORM_WINDOWS #if PLATFORM_64BITS FString RootSteamPath = GetSteamModulePath(); FPlatformProcess::PushDllDirectory(*RootSteamPath); SteamDLLHandle = FPlatformProcess::GetDllHandle(*(RootSteamPath + "steam_api64.dll")); #if 0 //64 bit not supported well at present, use Steam Client dlls // [RCL] 2015-02-09 the above comment ("64 bit not supported well...") is from (early) 2012, things might have changed // Load the Steam dedicated server dlls (assumes no Steam Client running) if (IsRunningDedicatedServer()) { SteamServerDLLHandle = FPlatformProcess::GetDllHandle(*(RootSteamPath + "steamclient64.dll")); } #endif FPlatformProcess::PopDllDirectory(*RootSteamPath); #else //PLATFORM_64BITS FString RootSteamPath = GetSteamModulePath(); FPlatformProcess::PushDllDirectory(*RootSteamPath); SteamDLLHandle = FPlatformProcess::GetDllHandle(*(RootSteamPath + "steam_api.dll")); if (IsRunningDedicatedServer()) { SteamServerDLLHandle = FPlatformProcess::GetDllHandle(*(RootSteamPath + "steamclient.dll")); } FPlatformProcess::PopDllDirectory(*RootSteamPath); #endif //PLATFORM_64BITS #elif PLATFORM_MAC SteamDLLHandle = FPlatformProcess::GetDllHandle(TEXT("libsteam_api.dylib")); #elif PLATFORM_LINUX #if LOADING_STEAM_LIBRARIES_DYNAMICALLY UE_LOG_ONLINE(Log, TEXT("Loading system libsteam_api.so.")); SteamDLLHandle = FPlatformProcess::GetDllHandle(TEXT("libsteam_api.so")); if (SteamDLLHandle == nullptr) { // try bundled one UE_LOG_ONLINE(Log, TEXT("Could not find system one, loading bundled libsteam_api.so.")); FString RootSteamPath = FPaths::EngineDir() / FString::Printf(TEXT("Binaries/ThirdParty/Steamworks/%s/Linux/"), STEAM_SDK_VER); SteamDLLHandle = FPlatformProcess::GetDllHandle(*(RootSteamPath + "libsteam_api.so")); } #else UE_LOG_ONLINE(Log, TEXT("libsteam_api.so is linked explicitly and should be already loaded.")); #endif // LOADING_STEAM_LIBRARIES_DYNAMICALLY #endif //PLATFORM_WINDOWS }
void FOnlineSubsystemSteamModule::StartupModule() { bool bSuccess = false; // Load the Steam modules before first call to API LoadSteamModules(); if (AreSteamDllsLoaded()) { // Create and register our singleton factory with the main online subsystem for easy access SteamFactory = new FOnlineFactorySteam(); FOnlineSubsystemModule& OSS = FModuleManager::GetModuleChecked<FOnlineSubsystemModule>("OnlineSubsystem"); OSS.RegisterPlatformService(STEAM_SUBSYSTEM, SteamFactory); bSuccess = true; } else { UE_LOG_ONLINE(Warning, TEXT("Steam SDK %s libraries not present at %s or failed to load!"), STEAM_SDK_VER, *GetSteamModulePath()); } if (!bSuccess) { UnloadSteamModules(); } }