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

Function CreateGUIDFromIdentity

engine/hid/src/hid_guid.cpp:230–255  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

228}
229
230GamepadGuid CreateGUIDFromIdentity(uint16_t bus, const GamepadIdentity& identity, const char* fallback_name, const char** axis_keys, uint32_t axis_count, const char** button_keys, uint32_t button_count, uint16_t button_mask)
231{
232 const char* name_for_guid = GetSDLCompatibleControllerName(identity, fallback_name);
233 uint16_t signature = 0;
234
235 if (axis_count > 0 || button_count > 0)
236 {
237 signature = UpdateCRC16(signature, name_for_guid);
238
239 for (uint32_t i = 0; i < axis_count; ++i)
240 {
241 signature = UpdateCRC16(signature, axis_keys[i]);
242 }
243
244 for (uint32_t i = 0; i < button_count; ++i)
245 {
246 signature = UpdateCRC16(signature, button_keys[i]);
247 }
248 }
249 else
250 {
251 signature = button_mask;
252 }
253
254 return CreateGUID(bus, identity.m_Vendor, identity.m_Product, signature, 0, name_for_guid, 0, 0);
255}
256
257void GetGamepadDeviceNameSDL(HContext context, HGamepad gamepad, char device_name[MAX_GAMEPAD_NAME_LENGTH])
258{

Callers 1

TESTFunction · 0.85

Calls 3

CreateGUIDFunction · 0.85
UpdateCRC16Function · 0.70

Tested by 1

TESTFunction · 0.68