MCPcopy Create free account
hub / github.com/defold/defold / GetGamepadDeviceNameSDL

Function GetGamepadDeviceNameSDL

engine/hid/src/hid_guid.cpp:257–277  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

255}
256
257void GetGamepadDeviceNameSDL(HContext context, HGamepad gamepad, char device_name[MAX_GAMEPAD_NAME_LENGTH])
258{
259 device_name[0] = '\0';
260
261 char fallback_name[MAX_GAMEPAD_NAME_LENGTH];
262 GetGamepadDeviceName(context, gamepad, fallback_name);
263
264 GamepadGuid guid;
265 if (!GetGamepadDeviceGuid(context, gamepad, &guid))
266 {
267 dmStrlCpy(device_name, fallback_name, MAX_GAMEPAD_NAME_LENGTH);
268 return;
269 }
270
271 GamepadIdentity identity = {};
272 identity.m_Vendor = guid.m_Vendor;
273 identity.m_Product = guid.m_Product;
274
275 const char* sdl_name = GetSDLCompatibleControllerName(identity, fallback_name);
276 dmStrlCpy(device_name, sdl_name, MAX_GAMEPAD_NAME_LENGTH);
277}
278
279} // namespace dmHID

Callers 3

mainFunction · 0.85
AppendGamepadStatusFunction · 0.85

Calls 4

dmStrlCpyFunction · 0.85
GetGamepadDeviceNameFunction · 0.70
GetGamepadDeviceGuidFunction · 0.70

Tested by 1

AppendGamepadStatusFunction · 0.68