bHasDedicatedGamepad

bHasDedicatedGamepad

#Overview

name: bHasDedicatedGamepad

The value of this variable can be defined or overridden in .ini config files. 6 .ini config files referencing this setting variable.

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of bHasDedicatedGamepad is to indicate whether a specific platform has a dedicated gamepad associated with it. This setting variable is primarily used for input-related functionality and platform-specific considerations in Unreal Engine 5.

This setting variable is primarily relied upon by the Common UI plugin, specifically within the CommonInput module. It’s also used in the Core module of Unreal Engine, particularly in the platform information management system.

The value of this variable is set in the platform-specific configuration files, which are loaded and processed by the DataDrivenPlatformInfoRegistry system. The LoadDDPIIniSettings function in DataDrivenPlatformInfoRegistry.cpp is responsible for reading this value from the configuration files.

This variable interacts with other input-related variables such as bDefaultInputStandardKeyboard, bInputSupportConfigurable, bSupportsMouseAndKeyboard, and bSupportsGamepad. Together, these variables define the input capabilities and default settings for a given platform.

Developers must be aware that this variable affects how the engine handles input devices, particularly in multi-platform projects. It can influence how the game detects and responds to gamepad input on different platforms.

Best practices when using this variable include:

  1. Ensure that platform-specific configuration files accurately reflect the gamepad support for each target platform.
  2. Use this variable in conjunction with other input-related settings to create a comprehensive input handling system.
  3. When developing cross-platform games, consider how this setting might affect input behavior across different devices.
  4. Regularly test input functionality on all target platforms to ensure consistent behavior.
  5. Be cautious when manually modifying this value, as it could lead to unexpected input behavior if not set correctly for the target platform.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/Android/DataDrivenPlatformInfo.ini:4, section: [DataDrivenPlatformInfo]

Location: <Workspace>/Engine/Config/IOS/DataDrivenPlatformInfo.ini:4, section: [DataDrivenPlatformInfo]

Location: <Workspace>/Engine/Config/Linux/DataDrivenPlatformInfo.ini:4, section: [DataDrivenPlatformInfo]

Location: <Workspace>/Engine/Config/LinuxArm64/DataDrivenPlatformInfo.ini:5, section: [DataDrivenPlatformInfo]

Location: <Workspace>/Engine/Config/Mac/DataDrivenPlatformInfo.ini:4, section: [DataDrivenPlatformInfo]

Location: <Workspace>/Engine/Config/Windows/DataDrivenPlatformInfo.ini:10, section: [DataDrivenPlatformInfo]

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Plugins/Runtime/CommonUI/Source/CommonInput/Private/CommonInputBaseTypes.cpp:156

Scope (from outer to inner):

file
function     const TArray<FName>& UCommonInputBaseControllerData::GetRegisteredGamepads
lambda-function

Source code excerpt:


			// Only add platforms with dedicated gamepads.
			if (PlatformInfo.bHasDedicatedGamepad)
			{
				RegisteredGamepads.Add(PlatformName);
			}
		}
		return RegisteredGamepads;
	};

#Loc: <Workspace>/Engine/Source/Runtime/Core/Private/Misc/DataDrivenPlatformInfoRegistry.cpp:351

Scope (from outer to inner):

file
function     static void LoadDDPIIniSettings

Source code excerpt:


	// NOTE: add more settings here!
	DDPIGetBool(IniFile, TEXT("bHasDedicatedGamepad"), Info.bHasDedicatedGamepad);
	DDPIGetBool(IniFile, TEXT("bDefaultInputStandardKeyboard"), Info.bDefaultInputStandardKeyboard);

	DDPIGetBool(IniFile, TEXT("bInputSupportConfigurable"), Info.bInputSupportConfigurable);
	DDPIGetString(IniFile, TEXT("DefaultInputType"), Info.DefaultInputType);
	DDPIGetBool(IniFile, TEXT("bSupportsMouseAndKeyboard"), Info.bSupportsMouseAndKeyboard);
	DDPIGetBool(IniFile, TEXT("bSupportsGamepad"), Info.bSupportsGamepad);

#Loc: <Workspace>/Engine/Source/Runtime/Core/Public/Misc/DataDrivenPlatformInfoRegistry.h:146

Scope: file

Source code excerpt:


	// True if this platform has a non-generic gamepad specifically associated with it
	bool bHasDedicatedGamepad = false;

	// True if this platform handles input via standard keyboard layout by default, translates to PC platform
	bool bDefaultInputStandardKeyboard = false;

	// Input-related settings
	bool bInputSupportConfigurable = false;