Fix incorrect face button layout on Nintendo controllers
This commit is contained in:
parent
15d89f5ef5
commit
584157277f
3 changed files with 22 additions and 0 deletions
|
|
@ -218,6 +218,7 @@ void I_InitController(UINT8 playernum)
|
|||
SDL_PropertiesID controllerproperties = SDL_GetGamepadProperties(newcontroller);
|
||||
controller->hasrumble = SDL_GetBooleanProperty(controllerproperties, SDL_PROP_GAMEPAD_CAP_RUMBLE_BOOLEAN, false);
|
||||
controller->hasrgbled = SDL_GetBooleanProperty(controllerproperties, SDL_PROP_GAMEPAD_CAP_RGB_LED_BOOLEAN, false);
|
||||
controller->flipbuttons = SDL_GetGamepadButtonLabel(newcontroller, SDL_GAMEPAD_BUTTON_SOUTH) == SDL_GAMEPAD_BUTTON_LABEL_B;
|
||||
}
|
||||
|
||||
void I_InitController1(void)
|
||||
|
|
|
|||
|
|
@ -969,6 +969,25 @@ static void Impl_HandleControllerButtonEvent(SDL_GamepadButtonEvent evt, Uint32
|
|||
return;
|
||||
}
|
||||
|
||||
switch (evt.button)
|
||||
{
|
||||
case SDL_GAMEPAD_BUTTON_SOUTH:
|
||||
case SDL_GAMEPAD_BUTTON_EAST:
|
||||
case SDL_GAMEPAD_BUTTON_WEST:
|
||||
case SDL_GAMEPAD_BUTTON_NORTH:
|
||||
for (INT32 i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
if (controllerInfo[i].dev != NULL && controllerInfo[i].id == evt.which && controllerInfo[i].flipbuttons)
|
||||
{
|
||||
event.data1 ^= 1; // lol
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (event.type != ev_console)
|
||||
{
|
||||
D_PostEvent(&event);
|
||||
|
|
|
|||
|
|
@ -56,6 +56,8 @@ typedef struct SDLJoyInfo_s
|
|||
boolean hasrumble;
|
||||
// RGB LED Support
|
||||
boolean hasrgbled;
|
||||
// you can pry my nintendo button layout out of my cold dead hands, SDL3
|
||||
boolean flipbuttons;
|
||||
} controllerinfo_t;
|
||||
|
||||
/** \brief SDL info about controllers
|
||||
|
|
|
|||
Loading…
Reference in a new issue