Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
DataDrivenPlatformInfoRegistry.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "Containers/Array.h"
6#include "Containers/Map.h"
7#include "Containers/UnrealString.h"
8#include "CoreTypes.h"
9#include "HAL/PlatformCrt.h"
10#include "Internationalization/Text.h"
11#include "Misc/Guid.h"
12#include "UObject/NameTypes.h"
13#include "UObject/UnrealNames.h"
14
15class FConfigFile;
16
17#define DDPI_HAS_EXTENDED_PLATFORMINFO_DATA (WITH_EDITOR || IS_PROGRAM)
18
20{
21 /** Only return "real" platforms (no groups or fake platforms) */
23
24 /** All known platforms/groups/etc that have a DDPI.ini file */
26};
27
29
30
31/** Available icon sizes (see FPlatformIconPaths) */
32enum class EPlatformIconSize : uint8
33{
34 /** Normal sized icon (24x24) */
35 Normal,
36
37 /** Large sized icon (64x64) */
38 Large,
39
40 /** Extra large sized icon (128x128) */
41 XLarge,
42};
43
44
45
46// enum class EPlatformSDKStatus : uint8
47// {
48// /** SDK status is unknown */
49// Unknown,
50//
51// /** SDK is installed */
52// Installed,
53//
54// /** SDK is not installed */
55// NotInstalled,
56// };
57
58/** Information about where to find the platform icons (for use by FAppStyle) */
59struct FPlatformIconPaths
60{
61 FPlatformIconPaths()
62 {
63 }
64
65 FPlatformIconPaths(const FString& InIconPath)
66 : NormalPath(InIconPath)
67 , LargePath(InIconPath)
68 , XLargePath(InIconPath)
69 {
70 }
71
72 FPlatformIconPaths(const FString& InNormalPath, const FString& InLargePath)
73 : NormalPath(InNormalPath)
74 , LargePath(InLargePath)
75 , XLargePath(InLargePath)
76 {
77 }
78
79 FPlatformIconPaths(const FString& InNormalPath, const FString& InLargePath, const FString& InXLargePath)
80 : NormalPath(InNormalPath)
81 , LargePath(InLargePath)
82 , XLargePath(InXLargePath)
83 {
84 }
85
86 FName NormalStyleName;
87 FString NormalPath;
88
89 FName LargeStyleName;
90 FString LargePath;
91
92 FName XLargeStyleName;
93 FString XLargePath;
94};
95
96
97/** Information for feature level menu item added by this platform */
98struct FPreviewPlatformMenuItem
99{
100 FName PlatformName;
101 FName ShaderFormat;
102 FName ShaderPlatformToPreview;
103 FName PreviewShaderPlatformName;
104 FString ActiveIconPath;
105 FName ActiveIconName;
106 FString InactiveIconPath;
107 FName InactiveIconName;
108 FText OptionalFriendlyNameOverride;
109 FText MenuTooltip;
110 FText IconText;
111 FName DeviceProfileName;
112};
113
114#endif
115
116
117// Information about a platform loaded from disk
119{
120 // copy of the platform name, same as the Key into GetAllPlatformInfos()
122
123 // cached list of ini parents
125
126 // is this platform confidential
127 bool bIsConfidential = false;
128
129 // some platforms are here just for IniParentChain needs and are not concrete platforms
130 bool bIsFakePlatform = false;
131
132 // the name of the ini section to use to load target platform settings (used at runtime and cooktime)
134
135 // list of additional restricted folders
137
138 // GUID to represent this platform forever
140
141 // MemoryFreezing information, matches FPlatformTypeLayoutParameters - defaults are clang, noneditor
142 uint32 Freezing_MaxFieldAlignment = 0xffffffff;
143 bool Freezing_b32Bit = false;
146
147 // True if this platform has a non-generic gamepad specifically associated with it
149
150 // True if this platform handles input via standard keyboard layout by default, translates to PC platform
152
153 // Input-related settings
157 bool bSupportsGamepad = true;
159 bool bSupportsTouch = false;
160
161 // the compression format that this platform wants; overrides game unless bForceUseProjectCompressionFormat
163
164 // NOTE: add more settings here (and read them in in the LoadDDPIIniSettings() function in the .cpp)
165
166
168
169public:
170
171
172 // setting moved from PlatformInfo::FTargetPlatformInfo
173
174
175 /** Information about where to find the platform icons (for use by FAppStyle) */
176 FPlatformIconPaths IconPaths;
177
178 /** Path under CarefullyRedist for the SDK. FString so case sensitive platforms don't get messed up by a pre-existing FName of a different casing. */
179 FString AutoSDKPath;
180
181 /** Tutorial path for tutorial to install SDK */
182 FString SDKTutorial;
183
184 /** An identifier to group similar platforms together, such as "Mobile" and "Console". Used for Per-Platform Override Properties. */
185 FName PlatformGroupName;
186
187 /** Submenu name to group similar platforms together in menus, such as "Linux" and "LinuxArm64". */
188 FName PlatformSubMenu;
189
190 /** An identifier that corresponds to UBT's UnrealTargetPlatform enum (and by proxy, FGenericPlatformMisc::GetUBTPlatform()), as well as the directory Binaries are placed under */
191 FName UBTPlatformName;
192 FString UBTPlatformString;
193
194 /** Whether or not the platform can use Crash Reporter */
195 bool bCanUseCrashReporter;
196
197 /** Enabled for use */
198 bool bEnabledForUse;
199
200 /** Whether code projects for this platform require the host platform compiler to be installed. Host platforms typically have a SDK status of valid, but they can't necessarily build. */
201 bool bUsesHostCompiler;
202
203 /** Whether UAT closes immediately after launching on this platform, or if it sticks around to read output from the running process */
204 bool bUATClosesAfterLaunch;
205
206 /** Whether or not this editor/program has compiled in support for this platform (by looking for TargetPlatform style DLLs, without loading them) */
207 bool bHasCompiledTargetSupport;
208
209
210
211 /** Get the icon name (for FAppStyle) used by the given icon type for this platform */
212 FName GetIconStyleName(const EPlatformIconSize InIconSize) const
213 {
214 switch (InIconSize)
215 {
216 case EPlatformIconSize::Normal:
217 return IconPaths.NormalStyleName;
218 case EPlatformIconSize::Large:
219 return IconPaths.LargeStyleName;
220 case EPlatformIconSize::XLarge:
221 return IconPaths.XLargeStyleName;
222 default:
223 break;
224 }
225 return NAME_None;
226 }
227
228 /** Get the path to the icon on disk (for FAppStyle) for the given icon type for this platform */
229 const FString& GetIconPath(const EPlatformIconSize InIconSize) const
230 {
231 switch (InIconSize)
232 {
233 case EPlatformIconSize::Normal:
234 return IconPaths.NormalPath;
235 case EPlatformIconSize::Large:
236 return IconPaths.LargePath;
237 case EPlatformIconSize::XLarge:
238 return IconPaths.XLargePath;
239 default:
240 break;
241 }
242 static const FString EmptyString = TEXT("");
243 return EmptyString;
244 }
245
246private:
248
249#endif
250};
251
252
254{
255
256 /**
257 * Get the global set of data driven platform information
258 */
260
261 /**
262 * Gets a set of platform names based on GetAllPlatformInfos, their AdditionalRestrictedFolders, and possibly filtered based on what editor has support compiled for
263 * This is not necessarily the same as IniParents, although there is overlap - IniParents come from chaining DDPIs, so those will be in GetAllPlatformInfos already to be checked
264 */
266
267 /**
268 * Get the data driven platform info for a given platform. If the platform doesn't have any on disk,
269 * this will return a default constructed FConfigDataDrivenPlatformInfo
270 */
271 static const FDataDrivenPlatformInfo& GetPlatformInfo(const FString& PlatformName);
272 static const FDataDrivenPlatformInfo& GetPlatformInfo(FName PlatformName);
273 static const FDataDrivenPlatformInfo& GetPlatformInfo(const char* PlatformName);
274
275
276 /**
277 * Get sorted platorm infos or names. PlatformType is used to choose between true platforms and platform groups (or other fake platforms)
278 */
281
282 UE_DEPRECATED(5.1, "Use GetSoprtedPlatformNames that takes a PlatformType parameter")
284 {
285 return GetSortedPlatformNames(EPlatformInfoType::AllPlatformInfos);
286 }
287 UE_DEPRECATED(5.1, "Use GetSortedPlatformInfos that takes a PlatformType parameter")
289 {
290 return GetSortedPlatformInfos(EPlatformInfoType::AllPlatformInfos);
291 }
292
293 /**
294 * Gets a list of all known confidential platforms (note these are just the platforms you have access to, so, for example PS4 won't be
295 * returned if you are not a PS4 licensee)
296 */
298
299 /**
300 * Returns the number of discovered ini files that can be loaded with LoadDataDrivenIniFile
301 */
303
304 /**
305 * Load the given ini file, and
306 */
307 static bool LoadDataDrivenIniFile(int32 Index, FConfigFile& IniFile, FString& PlatformName);
308
309
311 /**
312 * Checks for the existence of compiled modules for a given (usually another, target, platform)
313 * Since there are different types of platform names, it is necessary pass in the type of name
314 */
315 enum class EPlatformNameType
316 {
317 // for instance Win64
318 UBT,
319 // for instance Windows
320 Ini,
321 // for instance WindowsClient
322 TargetPlatform,
323 };
324 static bool HasCompiledSupportForPlatform(FName PlatformName, EPlatformNameType PlatformNameType);
325
326 /**
327 * Wipes out cached device status for all devices in a platform (or all platforms if PlatformName is empty)
328 */
329 static void ClearDeviceStatus(FName PlatformName);
330
331 static FDataDrivenPlatformInfo& DeviceIdToInfo(FString DeviceId, FString* OutDeviceName = nullptr);
332
333 /**
334 * Retrieve the full list of all known preview platforms from all DDPIs
335 */
336 static const TArray<struct FPreviewPlatformMenuItem>& GetAllPreviewPlatformMenuItems();
337
338 /** Option to hide a platform from the user interface at runtime */
339 static bool IsPlatformHiddenFromUI(FName PlatformName);
340 static void SetPlatformHiddenFromUI(FName PlatformName);
341
342private:
343 /**
344 * Get a modifiable DDPI object, for Turnkey to update it's info
345 */
346 friend class FTurkeySupportModule;
347 static FDataDrivenPlatformInfo& GetMutablePlatformInfo(FName PlatformName);
348 static TMap<FName, FDataDrivenPlatformInfo>& GetMutablePlatformInfos();
349
350#endif
351
352};
#define WITH_EDITOR
Definition Build.h:7
#define IS_PROGRAM
Definition Build.h:6
#define UE_DEPRECATED(Version, Message)
#define DDPI_HAS_EXTENDED_PLATFORMINFO_DATA
EPlatformInfoType
Definition Enums.h:13741
#define TEXT(x)
Definition Platform.h:1108
Definition Text.h:357
static const FDataDrivenPlatformInfo & GetPlatformInfo(const FString &PlatformName)
static int32 GetNumDataDrivenIniFiles()
static const FDataDrivenPlatformInfo & GetPlatformInfo(const char *PlatformName)
static bool LoadDataDrivenIniFile(int32 Index, FConfigFile &IniFile, FString &PlatformName)
static const TArray< const FDataDrivenPlatformInfo * > & GetSortedPlatformInfos()
static const TArray< FName > GetSortedPlatformNames()
static const TArray< FName > & GetConfidentialPlatforms()
static const TArray< const FDataDrivenPlatformInfo * > & GetSortedPlatformInfos(EPlatformInfoType PlatformType)
static const TArray< FName > GetSortedPlatformNames(EPlatformInfoType PlatformType)
static const TMap< FName, FDataDrivenPlatformInfo > & GetAllPlatformInfos()
static const TArray< FString > & GetValidPlatformDirectoryNames()
static const FDataDrivenPlatformInfo & GetPlatformInfo(FName PlatformName)
Definition Guid.h:108