Fixed crash launching under Steam on Mac OS X

This commit is contained in:
Sam Lantinga 2018-09-14 12:41:29 -07:00
parent 0b3a350c90
commit 6a7b0c27af
2 changed files with 15 additions and 11 deletions

View file

@ -1462,6 +1462,7 @@ SDL_bool SDL_ShouldIgnoreGameController(const char *name, SDL_JoystickGUID guid)
int i;
Uint16 vendor;
Uint16 product;
Uint16 version;
Uint32 vidpid;
if (SDL_allowed_controllers.num_entries == 0 &&
@ -1469,7 +1470,7 @@ SDL_bool SDL_ShouldIgnoreGameController(const char *name, SDL_JoystickGUID guid)
return SDL_FALSE;
}
SDL_GetJoystickGUIDInfo(guid, &vendor, &product, NULL);
SDL_GetJoystickGUIDInfo(guid, &vendor, &product, &version);
if (SDL_GetHintBoolean("SDL_GAMECONTROLLER_ALLOW_STEAM_VIRTUAL_GAMEPAD", SDL_FALSE)) {
/* We shouldn't ignore Steam's virtual gamepad since it's using the hints to filter out the real controllers so it can remap input for the virtual controller */
@ -1477,7 +1478,7 @@ SDL_bool SDL_ShouldIgnoreGameController(const char *name, SDL_JoystickGUID guid)
#if defined(__LINUX__)
bSteamVirtualGamepad = (vendor == 0x28DE && product == 0x11FF);
#elif defined(__MACOSX__)
bSteamVirtualGamepad = (SDL_strncmp(name, "GamePad-", 8) == 0);
bSteamVirtualGamepad = (vendor == 0x045E && product == 0x028E && version == 1);
#elif defined(__WIN32__)
/* We can't tell on Windows, but Steam will block others in input hooks */
bSteamVirtualGamepad = SDL_TRUE;