os_get_info
This function returns a DS Map with detailed information about the OS that the game is running on. The exact information returned will depend on the OS and the device, so it is recommended that you test this function on all platforms that you wish to target and output the returned values using a function like show_debug_message(). Note that the DS map is not automatically cleared from memory and you should use the ds_map_destroy() function when you no longer need it.
Below you can find some details on the extra data that will be made available to the DS map specific to the following platforms, and it should be noted that on all platforms except HTML5 the map will have the key "is64bit" which will either be true or false depending on whether the runner is running in 64-bit mode or not.
WindowsWindows
On Windows, you will get some extra data from DX11 with the following keys available in the DS map (useful for extensions):
- udid: An identifier that is unique to the machine
- video_d3d11_device: pointer to the DX11 device
- video_d3d11_context: pointer to the DX11 context
- video_d3d11_swapchain: pointer to the DX11 swapchain
- video_adapter_vendorid: string with the adapter's vendor id
- video_adapter_deviceid: string with the adapter's device id
- video_adapter_subsysid: string with the adapter's sub system id
- video_adapter_revision: string with the adapter's revision number
- video_adapter_description: string with the video adapter's description
- video_adapter_dedicatedvideomemory: string with the size of the video memory
- video_adapter_dedicatedsystemmemory: string with the size of the system memory (used by DX11 adapter)
- video_adapter_sharedsystemmemory: string with the size of the shared system memory
macOSmacOS
The function returns some limited OpenGL information on macOS:
- udid: An identifier that is unique to the machine
- gl_vendor_string: GL_VENDOR from OpenGL, example - "Intel Inc."
- gl_version_string: GL_VERSION from OpenGL, example - "2.1 INTEL-16.2.16"
- gl_renderer_string: GL_RENDERER from OpenGL, example - "Intel(R) Iris(TM) Graphics 6100"
UbuntuUbuntu
This contains the same information as on macOS.
AndroidAndroid
On the Android platform you will get some extra data from various different APIs with the following keys available in the DS map:
- android_tv: this will return true if the device is detected as being an Android TV device, or false otherwise
- GL_VERSION: the version of OpenGL as reported by the driver
- GL_VENDOR: the vendor of OpenGL as reported by the driver
- GL_RENDERER: the renderer of OpenGL as reported by the driver
- GL_EXTENSIONS: the extensions of OpenGL that are available as reported by the driver
- GL_SHADING_LANGUAGE_VERSION: the version of the GLSL that is supported by this OpenGL driver
- GL_MAX_TEXTURE_SIZE: the maximum texture size supported by this OpenGL driver
- SDK_INT: value of android.os.Build.VERSION.SDK_INT (see note below)
- RELEASE: value of android.os.Build.VERSION.RELEASE
- MODEL: value of android.os.Build.MODEL
- DEVICE: value of android.os.Build.DEVICE
- MANUFACTURER: value of android.os.Build.MANUFACTURER
- CPU_ABI: value of android.os.Build.CPU_ABI
- CPU_ABI2: value of android.os.Build.CPU_ABI2
- BOOTLOADER: value of android.os.Build.BOOTLOADER
- BOARD: value of android.os.Build.BOARD
- VERSION: value of os.version from the Android System.getProperty method.
- REGION: values of user.region from the Android System.getProperty method
- VERSION_NAME: value of this package's versionName - see here for more information.
- PHYSICAL_KEYBOARD: if we think a physical keyboard is available then the string "TRUE" otherwise "FALSE"
NOTE For information on any android.os.Build variables, see the Android Developer documentation.
iOS & tvOSiOS & tvOS
Here are the keys returned on iOS and tvOS (for detailed information, please refer to the Apple Developer documentation):
- name: string as reported by [[UIDevice currentDevice] name]
- systemName: string as reported by [[UIDevice currentDevice] systemName]
- systemVersion: string as reported by [[UIDevice currentDevice] systemVersion]
- model: string as reported by [[UIDevice currentDevice] model]
- localisedModel: string as reported by [[UIDevice currentDevice] localizedModel]
- uiIdiom: string as reported by [[UIDevice currentDevice] userInterfaceIdiom]
- platform: hw.machine string gathered from sysctlbyname
- hwModel: hw.model string gathered from sysctlbyname
- freeDiskSpace: The free disk space
- totalDiskSpace: The total disk space
- cpuFrequency: The CPU's frequency
- busFrequency: The bus frequency
- cpuCount: The CPU count
- totalMemory: The total memory of the device
- userMemory: The user memory
- maxSocketBufferSize: The max socket buffer size
- Additional keys containing OpenGL graphics info
GX.gamesGX.games
The following extra keys will be included in the DS Map for GX.games:
- mobile: This will be 1.0 if the game is running on a mobile browser, and 0.0 if it's not.
HTML5HTML5
Nintendo SwitchNintendo Switch
PlayStation 4PlayStation 4
Please refer to the PS4 documentation for information on the functions referenced here.
The function returns the following keys on a PlayStation 4 console:
- display_safe_area_ratio: A floating point value as returned by sceSystemServiceGetDisplaySafeAreaInfo().
- is_neo_mode: This will be 1 if the game is running on a Neo (PS4 Pro) and 0 if it's running on a regular PS4.
- enter_button_assign: An integer value as returned by sceSystemServiceParamGetInt(SCE_SYSTEM_SERVICE_PARAM_ID_ENTER_BUTTON_ASSIGN, &enterassign); a value of 0 means the Circle button is used as "assign" and 1 means the X button is used instead.
PlayStation 5PlayStation 5
The function returns the following keys on a PlayStation 5 console:
- display_safe_area_ratio: Same as PS4 (see above).
- display_resolution: "HD", "4K" or "unknown"
- display_dynamic_range: "HDR", "SDR" or "unknown"
- display_refresh_rate: "120Hz", "60Hz" or "Unknown"
Xbox One & Series X/SXbox One & Series X/S
The info returned on Xbox One and Xbox Series X/S is mostly the same as Windows, however the video_adapter_* and udid keys are 0 (except for video_adapter_description which is an empty string ""). It also does not have the video_d3d11_swapchain key and the video_d3d11_* keys have been replaced by video_d3d12_*.
Here are some keys that this platform returns in addition to the ones listed under Windows:
- video_d3d12_cmdqueue: Points to the DX12 command queue
- video_d3d12_cmdlist: Points to the DX12 command list
- video_d3d12_currentrt: Points to the current DX12 render target
- device_type: Contains a constant value that represents the device type. These constants map directly to values returned by the XSystemGetDeviceType() function.
This will be one of the following constants: device_gdk_unknown, device_gdk_xboxone, device_gdk_xboxones, device_gdk_xboxonex, device_gdk_xboxonexdevkit, device_gdk_xboxseriess, device_gdk_xboxseriesx, device_gdk_xboxseriesdevkit.
Syntax:
os_get_info()
Returns:
DS Map
Example:
if (os_type == os_android)
{
var _info = os_get_info();
if (_info[? "android_tv"])
{
global.android_tv = true;
}
}
The above code checks if the current OS is Android, gets the OS info and reads the returned map to check if the game is running on an Android TV; in that case it sets the custom variable global.android_tv to true.