mirror of https://github.com/encounter/SDL.git
Add the controller mappings to the linked list in order
This commit is contained in:
parent
dd5d85a4e7
commit
d834c08ac7
|
@ -692,9 +692,22 @@ SDL_PrivateAddMappingForGUID(SDL_JoystickGUID jGUID, const char *mappingString,
|
||||||
pControllerMapping->guid = jGUID;
|
pControllerMapping->guid = jGUID;
|
||||||
pControllerMapping->name = pchName;
|
pControllerMapping->name = pchName;
|
||||||
pControllerMapping->mapping = pchMapping;
|
pControllerMapping->mapping = pchMapping;
|
||||||
pControllerMapping->next = s_pSupportedControllers;
|
pControllerMapping->next = NULL;
|
||||||
pControllerMapping->priority = priority;
|
pControllerMapping->priority = priority;
|
||||||
|
|
||||||
|
if (s_pSupportedControllers) {
|
||||||
|
/* Add the mapping to the end of the list */
|
||||||
|
ControllerMapping_t *pCurrMapping, *pPrevMapping;
|
||||||
|
|
||||||
|
for ( pPrevMapping = s_pSupportedControllers, pCurrMapping = pPrevMapping->next;
|
||||||
|
pCurrMapping;
|
||||||
|
pPrevMapping = pCurrMapping, pCurrMapping = pCurrMapping->next ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
pPrevMapping->next = pControllerMapping;
|
||||||
|
} else {
|
||||||
s_pSupportedControllers = pControllerMapping;
|
s_pSupportedControllers = pControllerMapping;
|
||||||
|
}
|
||||||
*existing = SDL_FALSE;
|
*existing = SDL_FALSE;
|
||||||
}
|
}
|
||||||
return pControllerMapping;
|
return pControllerMapping;
|
||||||
|
|
Loading…
Reference in New Issue