FGenericPlatformMisc

Generic implementation for most platforms

Windows
MacOS
Linux

Inheritance Hierarchy

FGenericPlatformMisc

FHoloLensMisc

FUnixPlatformMisc

References

Module

Core

Header

/Engine/Source/Runtime/Core/Public/GenericPlatform/GenericPlatformMisc.h

Include

#include "GenericPlatform/GenericPlatformMisc.h"

Syntax

struct FGenericPlatformMisc

Remarks

Generic implementation for most platforms

Functions

Name Description

Public function Static

void

 

AddAdditionalRootDirectory

(
    const FString& RootDir
)

Add an additional root directory

Public function Static

bool

 

AllowAudioThread()

Checks if platform wants to allow an audio thread on current device (note: does not imply it will, only if okay given other criteria met)

Public function Static

bool

 

AllowLocalCaching()

Public function Static

bool

 

AllowThreadHeartBeat()

Checks if platform wants to allow the thread heartbeat hang detection

Public function Static

void

 

BeginNamedEvent

(
    const FColor& Color,
    const ANSICHAR* Text
)

Platform specific function for adding a named event that can be viewed in external tool

Public function Static

void

 

BeginNamedEvent

(
    const FColor& Color,
    const TCHAR* Text
)

Platform specific function for adding a named event that can be viewed in external tool

Public function Static

void

 

BeginNamedEventFrame()

Indicates the start of a frame for named events

Public function Static

void

 

BeginProfilerColor

(
    const FColor& Color
)

Profiler color stack - this overrides the color for named events with undefined colors (e.g stat namedevents)

Public function Static

void

 

CacheLaunchDir()

Function to store the current working directory for use with LaunchDir()

Public function Static

void

 

ChooseHDRDeviceAndColorGamut

(
    uint32 DeviceId,
    uint32 DisplayNitLevel,
    int32& OutputDevice,
    int32& ColorGamut
)

Public function Static

FString

 

CloudDir()

Return the CloudDir. CloudDir can be per-user.

Public function Static

bool

 

CommandLineCommands()

Handles Game Explorer, Firewall and FirstInstall commands, typically from the installer

Public function Static

void

 

CreateGuid

(
    FGuid& Result
)

Create a new globally unique identifier.

Public function Static

void

 

CustomNamedStat

(
    const ANSICHAR* Text,
    float Value,
    const ANSICHAR* Graph,
    const ANSICHAR* Unit
)

Public function Static

void

 

CustomNamedStat

(
    const TCHAR* Text,
    float Value,
    const TCHAR* Graph,
    const TCHAR* Unit
)

Platform specific function for adding a named custom stat that can be viewed in external tool

Public function Static

bool

 

DeleteStoredValue

(
    const FString& InStoreId,
    const FString& InSectionName,
    const FString& InKeyName
)

Deletes value for the given section and key in the platform specific key->value store Note: The key->value store is user-specific, but may be used to share data between different applications for the same user

Public function Static

bool

 

DesktopTouchScreen()

Public function Static

void

 

EndNamedEvent()

Platform specific function for closing a named event that can be viewed in external tool

Public function Static

void

 

EndProfilerColor()

Public function Static

const TCHAR ...

 

EngineDir()

Get the engine directory

Public function Static

bool

 

Exec

(
    UWorld* InWorld,
    const TCHAR* Cmd,
    FOutputDevice& Out
)

Platform-specific Exec function

Public function Static

bool

 

Expand16BitIndicesTo32BitOnLoad()

Public function Static

bool

 

FileExistsInPlatformPackage

(
    const FString& RelativePath
)

Public function Static

bool

 

FullscreenSameAsWindowedFullscreen()

Public function Static

const TCHAR ...

 

GamePersistentDownloadDir()

Return the GamePersistentDownloadDir.

Public function Static

TArray< FStr...

 

GetAdditionalRootDirectories()

Get additional directories which can be considered as root directories

Public function Static

TArray< FCus...

 

GetAllLanguageChunks()

Public function Static

TArray< FCus...

 

GetAllOnDemandChunks()

Public function Static

int

 

GetBatteryLevel()

Gets the current battery level.

Public function Static

float

 

GetBrightness()

Public function Static

int32

 

GetChunkIDFromPakchunkIndex

(
    int32 PakchunkIndex
)

Public function Static

EConvertible...

 

GetConvertibleLaptopMode()

Gets the current mode of convertible laptops, i.e. Laptop or Tablet.

Public function Static

FString

 

GetCPUBrand()

Uses cpuid instruction to get the CPU brand string

Public function Static

FString

 

GetCPUChipset()

Returns the CPU chipset if known

Public function Static

uint32

 

GetCPUInfo()

On x86(-64) platforms, uses cpuid instruction to get the CPU signature

Public function Static

FString

 

GetCPUVendor()

Uses cpuid instruction to get the vendor string

Public function Static

TArray< FCus...

 

GetCustomChunksByType

(
    ECustomChunkType DesiredChunkType
)

Public function Static

const TCHAR ...

 

GetDefaultDeviceProfileName()

Gets the default profile name. Used if there is no device profile specified

Public function Static

FString

 

GetDefaultLanguage()

Get the default language (for localization) used by this platform.

Public function Static

FString

 

GetDefaultLocale()

Get the default locale (for internationalization) used by this platform.

Public function Static

const TCHAR ...

 

GetDefaultPathSeparator()

Public function Static

FString

 

GetDeviceId()

Returns a unique string for device identification.

Public function Static

FString

 

GetDeviceMakeAndModel()

Public function Static

EDeviceScree...

 

GetDeviceOrientation()

Returns the orientation of the device: e.g. Portrait, LandscapeRight.

Public function Static

float

 

GetDeviceTemperatureLevel()

Returns the current device temperature level.

Public function Static

int32

 

GetDeviceVolume()

Returns the device volume if the device is capable of returning that information.

Public function Static

bool

 

GetDiskTotalAndFreeSpace

(
    const FString& InPath,
    uint64& TotalNumberOfBytes,
    uint64& NumberOfFreeBytes
)

Retrieves information about the total number of bytes and number of free bytes for the specified disk path.

Public function Static

const TCHAR ...

 

GetEngineMode()

Get a string description of the mode the engine was running in.

Public function Static

FString

 

GetEnvironmentVariable

(
    const TCHAR* VariableName
)

Retrieve a environment variable from the system

Public function Static

FString

 

GetEpicAccountId()

Get the Epic account ID for the user who last used the Launcher.

Public function Static

FText

 

GetFileManagerName()

Public function Static

FGPUDriverIn...

 

GetGPUDriverInfo

(
    const FString& DeviceDescription
)

Public function Static

uint32

 

GetLastError()

Public function Static

FString

 

GetLocalCurrencyCode()

Returns the currency code associated with the device's locale

Public function Static

FString

 

GetLocalCurrencySymbol()

Returns the currency symbol associated with the device's locale

Public function Static

FString

 

GetLoginId()

Returns a unique string associated with the login account of the current machine.

Public function Static

int32

 

GetMaxPathLength()

Returns the maximum length of a path

Public function Static

ENetworkConn...

 

GetNetworkConnectionType()

Returns whether WiFi connection is currently active

Public function Static

const TCHAR ...

 

GetNullRHIShaderFormat()

Determines the shader format for the platform

Public function Static

FString

 

GetOperatingSystemId()

Gets a globally unique ID the represents a particular operating system install.

Public function Static

FString

 

GetOSVersion()

Gets a string representing the numeric OS version (as opposed to a translated OS version that GetOSVersions returns).

Public function Static

void

 

GetOSVersions

(
    FString& out_OSVersionLabel,
    FString& out_OSSubVersionLabel
)

Gets the OS Version and OS Subversion.

Public function Static

int32

 

GetPakchunkIndexFromPakFile

(
    const FString& InFilename
)

Public function Static

const TCHAR ...

 

GetPathVarDelimiter()

Return the delimiter between paths in the PATH environment variable.

Public function Static

IPlatformChu...

 

GetPlatformChunkInstall()

Returns the platform specific chunk based install interface

Public function Static

IPlatformCom...

 

GetPlatformCompression()

Returns the platform specific compression interface

Public function Static

const TCHAR ...

 

GetPlatformFeaturesModuleName()

Return the name of the platform features module.

Public function Static

bool

 

GetPlatformScreenWarnings

(
    TArray< FText >& PlatformScreenWar...
)

Returns any platform specific warning messages we want printed on screen

Public function Static

FAsyncIOSyst...

 

GetPlatformSpecificAsyncIOSystem()

Return the platform specific async IO system, or nullptr if the standard one should be used.

Public function Static

TArray< FStr...

 

GetPreferredLanguages()

Returns an array of the user's preferred languages in order of preference

Public function Static

FString

 

GetPrimaryGPUBrand()

Public function Static

bool

 

GetSHA256Signature

(
    const void* Data,
    uint32 ByteSize,
    FSHA256Signature& OutSignature
)

Generates the SHA256 signature of the given data.

Public function Static

bool

 

GetStoredValue

(
    const FString& InStoreId,
    const FString& InSectionName,
    const FString& InKeyName,
    FString& OutValue
)

Get the value for the given section and key from the platform specific key->value store Note: The key->value store is user-specific, but may be used to share data between different applications for the same user

Public function Static

const TCHAR ...

 

GetSystemErrorMessage

(
    TCHAR* OutBuffer,
    int32 BufferCount,
    int32 Error
)

Returns the last system error code in string form.

Public function Static

TArray< uint...

 

GetSystemFontBytes()

Public function Static

FString

 

GetTimeZoneId()

Get the timezone identifier for this platform, or an empty string if the default timezone calculation will work.

Public function Static

const TCHAR ...

 

GetUBTPlatform()

Public function Static

const TCHAR ...

 

GetUBTTarget()

Public function Static

const TCHAR ...

 

GetUBTTargetName()

Public function Static

FString

 

GetUniqueAdvertisingId()

Returns a unique string for advertising identification

Public function Static

bool

 

GetUseVirtualJoysticks()

Returns whether the platform wants to use a touch screen for virtual joysticks.

Public function Static

void

 

GetValidTargetPlatforms

(
    TArray< FString >& TargetPlatformN...
)

Return an ordered list of target platforms this runtime can support (ie Android_DXT, Android would mean that it prefers Android_DXT, but can use Android as well)

Public function Static

bool

 

GetVolumeButtonsHandledBySystem()

Returns whether the volume buttons are handled by the system

Public function Static

bool

 

HasActiveWiFiConnection()

Returns whether WiFi connection is currently active

Public function Static

bool

 

HasMemoryWarningHandler()

Determines if a warning handler has been set

Public function Static

bool

 

HasNonoptionalCPUFeatures()

Public function Static

bool

 

HasPlatformFeature

(
    const TCHAR* FeatureName
)

Returns whether the given platform feature is currently available (for instance, Metal is only available in IOS8 and with A7 devices)

Public function Static

bool

 

HasProjectPersistentDownloadDir()

Return true if the PersistentDownloadDir is available.

Public function Static

bool

 

HasSeparateChannelForDebugOutput()

Whether the platform has a separate debug channel to stdout (eg. OutputDebugString on Windows).

Public function Static

bool

 

HasVariableHardware()

Returns whether the platform has variable hardware (configurable/upgradeable system).

Public function Static

void

 

HidePlatformStartupScreen()

Public function Static

void

 

InitTaggedStorage

(
    uint32 NumTags
)

Platform specific function for initializing storage of tagged memory buffers

Public function Static

bool

 

Is64bitOperatingSystem()

Detects whether we're running in a 64-bit operating system.

Public function Static

bool

 

IsDebuggerPresent()

Return true if a debugger is present

Public function Static

bool

 

IsEnsureAllowed()

Allows disabling ensure()s without rebuilding the binary, by either a commandline switch or a hotfix.

Public function Static

bool

 

IsInLowPowerMode()

Public function Static

bool

 

IsLocalPrintThreadSafe()

Whether LocalPrint can be called from any thread without overlapping

Public function Static

bool

 

IsPackagedForDistribution()

Public function Static

bool

 

IsRegisteredForRemoteNotifications()

Returns whether or not the device has been registered to receive remote notifications.

Public function Static

bool

 

IsRemoteSession()

Check to see if the platform is being viewed remotely.

Public function Static

bool

 

IsRunningOnBattery()

Returns whether the platform is running on battery power or not.

Public function Static

bool

 

IsStandaloneStereoOnlyDevice()

Returns whether this is a 'stereo only' platform.

Public function Static

bool

 

IsValidAbsolutePathFormat

(
    const FString& Path
)

Checks structure of the path against platform formatting requirements

Public function Static

const TCHAR ...

 

LaunchDir()

Get the directory the application was launched from (useful for commandline utilities)

Public function Static

FString

 

LoadTextFileFromPlatformPackage

(
    const FString& RelativePath
)

Loads a text file relative to the package root on platforms that distribute apps in package formats.

Public function Static

void

 

LocalPrint

(
    const TCHAR* Str
)

Prints string to the default output

Public function Static

void

 

LowLevelOutputDebugString

(
    const TCHAR* Message
)

Sends a message to a remote tool, and debugger consoles

Public function Static

void

 

LowLevelOutputDebugStringf

(
    const TCHAR* Format,
    ...
)

Sends a message to a remote tool, and debugger consoles

Public function Static

void

 

MemoryBarrier()

Enforces strict memory load/store ordering across the memory barrier call.

Public function Static

EAppReturnTy...

 

MessageBoxExt

(
    EAppMsgType::Type MsgType,
    const TCHAR* Text,
    const TCHAR* Caption
)

Show a message box if possible, otherwise print a message and return the default

Public function Static

bool

 

NeedsNonoptionalCPUFeaturesCheck()

Public function Static

void

 

NormalizePath

(
    FString& InPath
)

Platform-specific normalization of path E.g.

Public function Static

int32

 

NumberOfCores()

Return the number of hardware CPU cores

Public function Static

int32

 

NumberOfCoresIncludingHyperthreads()

Return the number of logical CPU cores

Public function Static

int32

 

NumberOfIOWorkerThreadsToSpawn()

Return the number of worker threads we should spawn to service IO, NOT based on number of cores

Public function Static

int32

 

NumberOfWorkerThreadsToSpawn()

Return the number of worker threads we should spawn, based on number of cores

Public function Static

bool

 

OsExecute

(
    const TCHAR* CommandType,
    const TCHAR* Command,
    const TCHAR* CommandLine
)

Has the OS execute a command and path pair (such as launch a browser)

Public function Static

void

 

ParseChunkIdPakchunkIndexMapping

(
    TArray< FString > ChunkIndexRedirec...,
    TMap< int32, int32 >& OutMapping
)

Public function Static

void

 

PlatformHandleSplashScreen

(
    bool ShowSplashScreen
)

Called to dismiss splash screen

Public function Static

void

 

PlatformInit()

Public function Static

void

 

PlatformPreInit()

Called during appInit() after cmd line setup

Public function Static

void

 

PlatformTearDown()

Called during AppExit(). Log, Config still exist at this point, but not much else does.

Public function Static

void

 

Prefetch

(
    void const* x,
    int32 offset
)

Platform-specific instruction prefetch

Public function Static

void

 

PrefetchBlock

(
    const void* InPtr,
    int32 NumBytes
)

Public function Static

void

 

PrepareMobileHaptics

(
    EMobileHapticsType Type
)

For mobile devices, this will crank up a haptic engine for the specified type to be played later with TriggerMobileHaptics If this is called again before Release, it will switch to this type

Public function Static

const TCHAR ...

 

ProjectDir()

Return the project directory

Public function Static

void

 

PromptForRemoteDebugging

(
    bool bIsEnsure
)

Public function Static

void

 

PumpMessagesForSlowTask()

Public function Static

void

 

PumpMessagesOutsideMainLoop()

Public function Static

void

 

RaiseException

(
    uint32 ExceptionCode
)

Public function Static

void

 

RegisterForRemoteNotifications()

Requests permission to send remote notifications to the user's device.

Public function Static

void

 

ReleaseMobileHaptics()

For mobile devices, this will shutdown the haptics, allowing system to put it to reset as needed

Public function Static

bool

 

RequestDeviceCheckToken

(
    TFunction< void< uint8...,
    TFunction< void&, co...
)

Public function Static

void

 

RequestExit

(
    bool Force
)

Requests application exit.

Public function Static

void

 

RequestExitWithStatus

(
    bool Force,
    uint8 ReturnCode
)

Requests application exit with a specified return code.

Public function Static

void

 

ResetBrightness()

Public function Static

bool

 

RestartApplication()

Requests application to restart

Public function Static

const TCHAR ...

 

RootDir()

Get the application root directory.

Public function Static

void

 

SetBrightness

(
    float bBright
)

Public function Static

void

 

SetCrashHandler

(
    void...
)

Installs handler for the unexpected (due to error) termination of the program, including, but not limited to, crashes.

Public function Static

void

 

SetEnvironmentVar

(
    const TCHAR* VariableName,
    const TCHAR* Value
)

Sets an environment variable to the local process's environment

Public function Static

bool

 

SetEpicAccountId

(
    const FString& AccountId
)

Set the Epic account ID for the user who last used the Launcher

Public function Static

void

 

SetGracefulTerminationHandler()

Set/restore the Console Interrupt (Control-C, Control-Break, Close) handler.

Public function Static

void

 

SetLastError

(
    uint32 ErrorCode
)

Public function Static

void

 

SetMemoryWarningHandler

(
    void...
)

Set a handler to be called when there is a memory warning from the OS

Public function Static

void

 

SetOverrideProjectDir

(
    const FString& InOverrideDir
)

Allows a game/program/etc to control the game directory in a special place (for instance, monolithic programs that don't have .uprojects)

Public function Static

void

 

SetShouldPromptForRemoteDebugging

(
    bool bInShouldPrompt
)

Public function Static

void

 

SetShouldPromptForRemoteDebugOnEnsure

(
    bool bInShouldPrompt
)

Public function Static

bool

 

SetStoredValue

(
    const FString& InStoreId,
    const FString& InSectionName,
    const FString& InKeyName,
    const FString& InValue
)

Set the value for the given section and key in the platform specific key->value store Note: The key->value store is user-specific, but may be used to share data between different applications for the same user

Public function Static

bool

 

SetStoredValues

(
    const FString& InStoreId,
    const FString& InSectionName,
    const TMap< FString, FString >& In...
)

Set the value for the given section and key in the platform specific key->value store Note: The key->value store is user-specific, but may be used to share data between different applications for the same user

Public function Static

void

 

SetUBTTargetName

(
    const TCHAR* InTargetName
)

Public function Static

void

 

SetUTF8Output()

Sets the default output to UTF8

Public function Static

void

 

SetVolumeButtonsHandledBySystem

(
    bool enabled
)

Set whether the volume buttons are handled by the system

Public function Static

void

 

ShareURL

(
    const FString& URL,
    const FText& Description,
    int32 LocationHintX,
    int32 LocationHintY
)

Perform a mobile-style sharing of a URL. Will use native UI to display sharing target

Public function Static

bool

 

ShouldDisablePluginAtRuntime

(
    const FString& PluginName
)

Allows platform at runtime to disable unsupported plugins

Public function Static

bool

 

ShouldDisplayTouchInterfaceOnFakingTouchEvents()

Public function Static

void

 

ShutdownTaggedStorage()

Platform specific function for freeing storage of tagged memory buffers

Public function Static

void

 

SubmitErrorReport

(
    const TCHAR* InErrorHist,
    EErrorReportMode::Type InMode
)

#CrashReport: 2015-02-24 Remove

Public function Static

bool

 

SupportsBrightness()

Public function Static

bool

 

SupportsDeviceCheckToken()

Public function Static

bool

 

SupportsForceTouchInput()

Public function Static

bool

 

SupportsFullCrashDumps()

Platform can generate a full-memory crashdump during crash handling.

Public function Static

bool

 

SupportsLocalCaching()

Public function Static

bool

 

SupportsMessaging()

Public function Static

bool

 

SupportsTouchInput()

Public function Static

void

 

TagBuffer

(
    const char* Label,
    uint32 Category,
    const void* Buffer,
    size_t BufferSize
)

Platform specific function for tagging a memory buffer with a label.

Public function Static

void

 

TearDown()

Frees any memory retained by FGenericPlatformMisc.

Public function Static

void

 

TickHotfixables()

Ticks values that can be hotfixable in the config.

Public function Static

void

 

TriggerMobileHaptics()

For mobile devices, this will kick the haptic type that was set in PrepareMobileHaptics.

Public function Static

void

 

UnregisterForRemoteNotifications()

Requests unregistering from receiving remote notifications on the user's device.

Public function Static

void

 

UpdateHotfixableEnsureSettings()

Updates hotfixable ensure settings from config and commandline (config takes priority).

Public function Static

bool

 

UseHDRByDefault()

Public function Static

bool

 

UseRenderThread()

Checks if platform wants to use a rendering thread on current device

Classes

Name

Description

Public struct

FStaticData

Constants

Name

Description

bPromptForRemoteDebugOnEnsure

Whether the user should be prompted to allow for a remote debugger to be attached on an ensure

bShouldPromptForRemoteDebugging

Whether the user should be prompted to allow for a remote debugger to be attached

Deprecated Functions

Name Description

Public function Static

void

 

ClipboardCopy

(
    const TCHAR* Str
)

FPlatformMisc::ClipboardCopy() has been superseded by FPlatformApplicationMisc::ClipboardCopy()

Public function Static

void

 

ClipboardPaste

(
    FString& Dest
)

FPlatformMisc::ClipboardPaste() has been superseded by FPlatformApplicationMisc::ClipboardPaste()

Public function Static

void

 

DebugBreak()

FPlatformMisc::DebugBreak is deprecated. Use the UE_DEBUG_BREAK() macro instead.

Public function Static

void

 

GetEnvironmentVariable

(
    const TCHAR* VariableName,
    TCHAR* Result,
    int32 ResultLength
)

void FPlatformMisc::GetEnvironmentVariable(Name, Result, Length) is deprecated. Use FString FPlatformMisc::GetEnvironmentVariable(Name) instead.

Public function Static

FString

 

GetHashedMacAddressString()

GetHasedMacAddressString is deprecated. It is not reliable on all platforms

Public function Static

TArray< uint...

 

GetMacAddress()

GetMacAddress is deprecated. It is not reliable on all platforms

Public function Static

FString

 

GetMacAddressString()

GetMacAddressString is deprecated. It is not reliable on all platforms

Public function Static

FGuid

 

GetMachineId()

GetMachineId is deprecated. Use GetLoginId instead.

Public function Static

FString

 

GetUniqueDeviceId()

GetUniqueDeviceId is deprecated. Use GetDeviceId instead.

Public function Static

void

 

SetOverrideGameDir

(
    const FString& InOverrideDir
)

FPaths::SetOverrideGameDir() has been superseded by FPaths::SetOverrideProjectDir().

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss