mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-16 11:06:49 +01:00
Fixed whitespace and added code to support older game controller GUIDs
This commit is contained in:
parent
b6542ab237
commit
160e719449
@ -540,7 +540,26 @@ char *SDL_PrivateGetControllerGUIDFromMappingString(const char *pMapping)
|
||||
return NULL;
|
||||
}
|
||||
SDL_memcpy(pchGUID, pMapping, pFirstComma - pMapping);
|
||||
pchGUID[ pFirstComma - pMapping ] = 0;
|
||||
pchGUID[pFirstComma - pMapping] = '\0';
|
||||
|
||||
/* Convert old style GUIDs to the new style in 2.0.5 */
|
||||
#if __WIN32__
|
||||
if (SDL_strlen(pchGUID) == 32 &&
|
||||
SDL_memcmp(&pchGUID[20], "504944564944", 12) == 0) {
|
||||
SDL_memcpy(&pchGUID[20], "000000000000", 12);
|
||||
SDL_memcpy(&pchGUID[16], &pchGUID[4], 4);
|
||||
SDL_memcpy(&pchGUID[8], &pchGUID[0], 4);
|
||||
SDL_memcpy(&pchGUID[0], "03000000", 8);
|
||||
}
|
||||
#elif __MACOSX__
|
||||
if (SDL_strlen(pchGUID) == 32 &&
|
||||
SDL_memcmp(&pchGUID[4], "000000000000", 12) == 0 &&
|
||||
SDL_memcmp(&pchGUID[20], "000000000000", 12) == 0) {
|
||||
SDL_memcpy(&pchGUID[20], "000000000000", 12);
|
||||
SDL_memcpy(&pchGUID[8], &pchGUID[0], 4);
|
||||
SDL_memcpy(&pchGUID[0], "03000000", 8);
|
||||
}
|
||||
#endif
|
||||
return pchGUID;
|
||||
}
|
||||
return NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user