Improved detection of third party PS4 and PS5 controllers

This commit is contained in:
Sam Lantinga
2022-09-22 23:42:25 -07:00
parent 7312b93d32
commit fa2063fb44
17 changed files with 132 additions and 51 deletions

View File

@@ -112,8 +112,6 @@ HIDAPI_DriverShield_InitDevice(SDL_HIDAPI_Device *device)
{
SDL_DriverShield_Context *ctx;
HIDAPI_SetDeviceName(device, "NVIDIA SHIELD Controller");
ctx = (SDL_DriverShield_Context *)SDL_calloc(1, sizeof(*ctx));
if (!ctx) {
SDL_OutOfMemory();
@@ -121,6 +119,9 @@ HIDAPI_DriverShield_InitDevice(SDL_HIDAPI_Device *device)
}
device->context = ctx;
device->type = SDL_CONTROLLER_TYPE_NVIDIA_SHIELD;
HIDAPI_SetDeviceName(device, "NVIDIA SHIELD Controller");
return HIDAPI_JoystickConnected(device, NULL);
}