@@ -233,23 +233,22 @@ int IN_JoyButtons()
233233
234234 SDL_GameControllerUpdate ();
235235
236- // Read triggers in as buttons
237- int leftTrigger = (SDL_GameControllerGetAxis (GameController, SDL_CONTROLLER_AXIS_TRIGGERLEFT ) >> 8 ) > JOYDEADZONE ;
238- int rightTrigger = (SDL_GameControllerGetAxis (GameController, SDL_CONTROLLER_AXIS_TRIGGERRIGHT ) >> 8 ) > JOYDEADZONE ;
239-
240236 // Read in each button in the order we expect to define it
241237 int res = 0 ;
242- res |= ( SDL_GameControllerGetButton (GameController, SDL_CONTROLLER_BUTTON_A ) || rightTrigger ) << 0 ;
243- res |= ( SDL_GameControllerGetButton (GameController, SDL_CONTROLLER_BUTTON_B ) || leftTrigger ) << 1 ;
238+ res |= SDL_GameControllerGetButton (GameController, SDL_CONTROLLER_BUTTON_A ) << 0 ;
239+ res |= SDL_GameControllerGetButton (GameController, SDL_CONTROLLER_BUTTON_B ) << 1 ;
244240 res |= SDL_GameControllerGetButton (GameController, SDL_CONTROLLER_BUTTON_X ) << 2 ;
245241 res |= SDL_GameControllerGetButton (GameController, SDL_CONTROLLER_BUTTON_Y ) << 3 ;
246242 res |= SDL_GameControllerGetButton (GameController, SDL_CONTROLLER_BUTTON_LEFTSHOULDER ) << 4 ;
247243 res |= SDL_GameControllerGetButton (GameController, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER ) << 5 ;
248- res |= SDL_GameControllerGetButton (GameController, SDL_CONTROLLER_BUTTON_LEFTSTICK ) << 6 ;
249- res |= SDL_GameControllerGetButton (GameController, SDL_CONTROLLER_BUTTON_RIGHTSTICK ) << 7 ;
250- res |= SDL_GameControllerGetButton (GameController, SDL_CONTROLLER_BUTTON_BACK ) << 8 ;
251- res |= SDL_GameControllerGetButton (GameController, SDL_CONTROLLER_BUTTON_START ) << 9 ;
252- res |= SDL_GameControllerGetButton (GameController, SDL_CONTROLLER_BUTTON_GUIDE ) << 10 ;
244+ // Read triggers in as buttons
245+ res |= ((SDL_GameControllerGetAxis (GameController, SDL_CONTROLLER_AXIS_TRIGGERLEFT ) >> 8 ) > JOYDEADZONE ) << 6 ;
246+ res |= ((SDL_GameControllerGetAxis (GameController, SDL_CONTROLLER_AXIS_TRIGGERRIGHT ) >> 8 ) > JOYDEADZONE ) << 7 ;
247+ res |= SDL_GameControllerGetButton (GameController, SDL_CONTROLLER_BUTTON_LEFTSTICK ) << 8 ;
248+ res |= SDL_GameControllerGetButton (GameController, SDL_CONTROLLER_BUTTON_RIGHTSTICK ) << 9 ;
249+ res |= SDL_GameControllerGetButton (GameController, SDL_CONTROLLER_BUTTON_BACK ) << 10 ;
250+ res |= SDL_GameControllerGetButton (GameController, SDL_CONTROLLER_BUTTON_START ) << 11 ;
251+ res |= SDL_GameControllerGetButton (GameController, SDL_CONTROLLER_BUTTON_GUIDE ) << 12 ;
253252 return res;
254253}
255254
@@ -537,11 +536,13 @@ IN_ReadControl(int player,ControlInfo *info)
537536 info->button0 = (buttons & (1 << 0 )) != 0 ;
538537 info->button1 = (buttons & (1 << 1 )) != 0 ;
539538 info->button2 = (buttons & (1 << 2 )) != 0 ;
540- info->button3 = (buttons & (1 << 3 )) != 0 ;
541- // info->button0 = (buttons & (1 << 0)) != 0 || SDL_GameControllerGetButton(GameController, SDL_CONTROLLER_BUTTON_A);
542- // info->button1 = (buttons & (1 << 1)) != 0 || SDL_GameControllerGetButton(GameController, SDL_CONTROLLER_BUTTON_B);
543- // info->button2 = (buttons & (1 << 2)) != 0 || SDL_GameControllerGetButton(GameController, SDL_CONTROLLER_BUTTON_X);
544- // info->button3 = (buttons & (1 << 3)) != 0 || SDL_GameControllerGetButton(GameController, SDL_CONTROLLER_BUTTON_Y);
539+ info->button3 = (buttons & (1 << 3 )) != 0 ;
540+ info->button4 = (buttons & (1 << 4 )) != 0 ;
541+ info->button5 = (buttons & (1 << 5 )) != 0 ;
542+ info->button6 = (buttons & (1 << 6 )) != 0 ;
543+ info->button7 = (buttons & (1 << 7 )) != 0 ;
544+ info->button8 = (buttons & (1 << 8 )) != 0 ;
545+ info->button9 = (buttons & (1 << 9 )) != 0 ;
545546 info->dir = DirTable[((my + 1 ) * 3 ) + (mx + 1 )];
546547}
547548
0 commit comments