// Copyright Epic Games, Inc. All Rights Reserved. #include "CoreMinimal.h" #include "ISettingsModule.h" #include "Interfaces/ITargetPlatformControlsModule.h" #include "Interfaces/ITargetPlatformSettingsModule.h" #include "GenericWindowsTargetPlatformControls.h" #include "Modules/ModuleManager.h" #include "UObject/Package.h" #include "UObject/WeakObjectPtr.h" #if WITH_ENGINE #include "CookedEditorTargetPlatformControls.h" #endif #include "IWindowsTargetPlatformSettingsModule.h" #define LOCTEXT_NAMESPACE "FWindowsTargetPlatformControlsModule" /** * Implements the Windows target platform module. */ class FWindowsTargetPlatformControlsModule : public ITargetPlatformControlsModule { public: /** Destructor. */ ~FWindowsTargetPlatformControlsModule( ) { } public: virtual void GetTargetPlatformControls(TArray& TargetPlatforms, FName& PlatformSettingsModuleName) { TMap PlatformNameToPlatformSettings; IWindowsTargetPlatformSettingsModule* ModuleSettings = FModuleManager::GetModulePtr(PlatformSettingsModuleName); if (ModuleSettings != nullptr) { TMap OutMap; ModuleSettings->GetPlatformSettingsMaps(OutMap); ITargetPlatformControls* GameTP = new TGenericWindowsTargetPlatformControls>(OutMap[FWindowsPlatformProperties::PlatformName()]); ITargetPlatformControls* EditorTP = new TGenericWindowsTargetPlatformControls>(OutMap[FWindowsPlatformProperties::PlatformName()]); ITargetPlatformControls* ServerTP = new TGenericWindowsTargetPlatformControls>(OutMap[FWindowsPlatformProperties::PlatformName()]); ITargetPlatformControls* ClientTP = new TGenericWindowsTargetPlatformControls>(OutMap[FWindowsPlatformProperties::PlatformName()]); TargetPlatforms.Add(GameTP); TargetPlatforms.Add(EditorTP); TargetPlatforms.Add(ServerTP); TargetPlatforms.Add(ClientTP); #if WITH_ENGINE // currently this TP requires the engine for allowing GameDelegates usage bool bSupportCookedEditor; if (GConfig->GetBool(TEXT("CookedEditorSettings"), TEXT("bSupportCookedEditor"), bSupportCookedEditor, GGameIni) && bSupportCookedEditor) { ITargetPlatformControls* CookedEditorTP = new TCookedEditorTargetPlatformControls(ModuleSettings->GetCookedEditorPlatformSettings()); ITargetPlatformControls* CookedCookerTP = new TCookedCookerTargetPlatformControls(ModuleSettings->GetCookedCookerPlatformSettings()); TargetPlatforms.Add(CookedEditorTP); TargetPlatforms.Add(CookedCookerTP); } #endif } } public: }; #undef LOCTEXT_NAMESPACE IMPLEMENT_MODULE(FWindowsTargetPlatformControlsModule, WindowsTargetPlatformControls);