hidapi: Add GCN L/R buttons, just in case someone wants them...
authorEthan Lee <flibitijibibo@flibitijibibo.com>
Sun, 17 Mar 2019 12:36:40 -0400
changeset 12704704ec541957d
parent 12703 f6c7e5e03f60
child 12705 7d349998be25
hidapi: Add GCN L/R buttons, just in case someone wants them...
src/joystick/hidapi/SDL_hidapi_gamecube.c
     1.1 --- a/src/joystick/hidapi/SDL_hidapi_gamecube.c	Fri Apr 12 23:15:26 2019 +0200
     1.2 +++ b/src/joystick/hidapi/SDL_hidapi_gamecube.c	Sun Mar 17 12:36:40 2019 -0400
     1.3 @@ -209,7 +209,12 @@
     1.4              READ_BUTTON(1, 0x80, 7) /* DPAD_UP */
     1.5              READ_BUTTON(2, 0x01, 8) /* START */
     1.6              READ_BUTTON(2, 0x02, 9) /* RIGHTSHOULDER */
     1.7 -            /* [2] 0x04 - R, [2] 0x08 - L */
     1.8 +            /* These two buttons are for the bottoms of the analog triggers.
     1.9 +             * More than likely, you're going to want to read the axes instead!
    1.10 +             * -flibit
    1.11 +             */
    1.12 +            READ_BUTTON(2, 0x04, 10) /* TRIGGERRIGHT */
    1.13 +            READ_BUTTON(2, 0x08, 11) /* TRIGGERLEFT */
    1.14              #undef READ_BUTTON
    1.15  
    1.16              /* Axis math taken from SDL_xinputjoystick.c */
    1.17 @@ -286,7 +291,7 @@
    1.18      Uint8 i;
    1.19      for (i = 0; i < 4; i += 1) {
    1.20          if (instance == ctx->joysticks[i]) {
    1.21 -            joystick->nbuttons = 10;
    1.22 +            joystick->nbuttons = 12;
    1.23              joystick->naxes = 6;
    1.24              joystick->epowerlevel = SDL_JOYSTICK_POWER_WIRED;
    1.25              return SDL_TRUE;