Steam now shares device info with SDL!

This commit is contained in:
Ethan Lee 2023-12-20 23:17:28 -05:00 committed by GitHub
parent 30c9438f17
commit 148b518745
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 11 deletions

View File

@ -191,19 +191,17 @@ void BUTTONGLYPHS_update_layout(SDL_GameController *c)
{ {
/* Steam Virtual Gamepads can hypothetically tell us that the physical /* Steam Virtual Gamepads can hypothetically tell us that the physical
* device is a PlayStation controller, so try to catch that scenario */ * device is a PlayStation controller, so try to catch that scenario */
const char *mapping = SDL_GameControllerMapping(c); SDL_GameControllerType gct = SDL_GameControllerGetType(c);
if (SDL_strstr(mapping, "type:") != NULL) if ( gct == SDL_CONTROLLER_TYPE_PS3 ||
gct == SDL_CONTROLLER_TYPE_PS4 ||
gct == SDL_CONTROLLER_TYPE_PS5 )
{ {
SDL_GameControllerType gct = SDL_GameControllerGetType(c); layout = LAYOUT_PLAYSTATION;
if ( gct == SDL_CONTROLLER_TYPE_PS3 || }
gct == SDL_CONTROLLER_TYPE_PS4 || else
gct == SDL_CONTROLLER_TYPE_PS5 ) {
{ layout = LAYOUT_DECK;
layout = LAYOUT_PLAYSTATION;
return;
}
} }
layout = LAYOUT_DECK;
} }
else if (vendor == 0x057e) else if (vendor == 0x057e)
{ {