src/joystick/win32/SDL_dxjoystick.c
changeset 3011 8f4ed5ec2b06
parent 2859 99210400e8b9
child 3013 8cc00819c8d6
equal deleted inserted replaced
3010:a6694a812119 3011:8f4ed5ec2b06
    36 #include "SDL_error.h"
    36 #include "SDL_error.h"
    37 #include "SDL_events.h"
    37 #include "SDL_events.h"
    38 #include "SDL_joystick.h"
    38 #include "SDL_joystick.h"
    39 #include "../SDL_sysjoystick.h"
    39 #include "../SDL_sysjoystick.h"
    40 #include "../SDL_joystick_c.h"
    40 #include "../SDL_joystick_c.h"
    41 #define INITGUID /* Only set here, if set twice will cause mingw32 to break. */
    41 #define INITGUID                /* Only set here, if set twice will cause mingw32 to break. */
    42 #include "SDL_dxjoystick_c.h"
    42 #include "SDL_dxjoystick_c.h"
    43 
    43 
    44 
    44 
    45 #ifndef DIDFT_OPTIONAL
    45 #ifndef DIDFT_OPTIONAL
    46 #define DIDFT_OPTIONAL		0x80000000
    46 #define DIDFT_OPTIONAL		0x80000000
    81 static int SDL_PrivateJoystickButton_Int(SDL_Joystick * joystick,
    81 static int SDL_PrivateJoystickButton_Int(SDL_Joystick * joystick,
    82                                          Uint8 button, Uint8 state);
    82                                          Uint8 button, Uint8 state);
    83 
    83 
    84 /* Taken from Wine - Thanks! */
    84 /* Taken from Wine - Thanks! */
    85 DIOBJECTDATAFORMAT dfDIJoystick2[] = {
    85 DIOBJECTDATAFORMAT dfDIJoystick2[] = {
    86   { &GUID_XAxis,DIJOFS_X,DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
    86     {&GUID_XAxis, DIJOFS_X, DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE,
    87   { &GUID_YAxis,DIJOFS_Y,DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
    87      0},
    88   { &GUID_ZAxis,DIJOFS_Z,DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
    88     {&GUID_YAxis, DIJOFS_Y, DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE,
    89   { &GUID_RxAxis,DIJOFS_RX,DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
    89      0},
    90   { &GUID_RyAxis,DIJOFS_RY,DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
    90     {&GUID_ZAxis, DIJOFS_Z, DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE,
    91   { &GUID_RzAxis,DIJOFS_RZ,DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
    91      0},
    92   { &GUID_Slider,DIJOFS_SLIDER(0),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
    92     {&GUID_RxAxis, DIJOFS_RX, DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE,
    93   { &GUID_Slider,DIJOFS_SLIDER(1),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
    93      0},
    94   { &GUID_POV,DIJOFS_POV(0),DIDFT_OPTIONAL|DIDFT_POV|DIDFT_ANYINSTANCE,0},
    94     {&GUID_RyAxis, DIJOFS_RY, DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE,
    95   { &GUID_POV,DIJOFS_POV(1),DIDFT_OPTIONAL|DIDFT_POV|DIDFT_ANYINSTANCE,0},
    95      0},
    96   { &GUID_POV,DIJOFS_POV(2),DIDFT_OPTIONAL|DIDFT_POV|DIDFT_ANYINSTANCE,0},
    96     {&GUID_RzAxis, DIJOFS_RZ, DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE,
    97   { &GUID_POV,DIJOFS_POV(3),DIDFT_OPTIONAL|DIDFT_POV|DIDFT_ANYINSTANCE,0},
    97      0},
    98   { NULL,DIJOFS_BUTTON(0),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
    98     {&GUID_Slider, DIJOFS_SLIDER(0),
    99   { NULL,DIJOFS_BUTTON(1),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
    99      DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0},
   100   { NULL,DIJOFS_BUTTON(2),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   100     {&GUID_Slider, DIJOFS_SLIDER(1),
   101   { NULL,DIJOFS_BUTTON(3),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   101      DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0},
   102   { NULL,DIJOFS_BUTTON(4),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   102     {&GUID_POV, DIJOFS_POV(0), DIDFT_OPTIONAL | DIDFT_POV | DIDFT_ANYINSTANCE,
   103   { NULL,DIJOFS_BUTTON(5),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   103      0},
   104   { NULL,DIJOFS_BUTTON(6),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   104     {&GUID_POV, DIJOFS_POV(1), DIDFT_OPTIONAL | DIDFT_POV | DIDFT_ANYINSTANCE,
   105   { NULL,DIJOFS_BUTTON(7),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   105      0},
   106   { NULL,DIJOFS_BUTTON(8),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   106     {&GUID_POV, DIJOFS_POV(2), DIDFT_OPTIONAL | DIDFT_POV | DIDFT_ANYINSTANCE,
   107   { NULL,DIJOFS_BUTTON(9),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   107      0},
   108   { NULL,DIJOFS_BUTTON(10),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   108     {&GUID_POV, DIJOFS_POV(3), DIDFT_OPTIONAL | DIDFT_POV | DIDFT_ANYINSTANCE,
   109   { NULL,DIJOFS_BUTTON(11),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   109      0},
   110   { NULL,DIJOFS_BUTTON(12),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   110     {NULL, DIJOFS_BUTTON(0),
   111   { NULL,DIJOFS_BUTTON(13),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   111      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   112   { NULL,DIJOFS_BUTTON(14),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   112     {NULL, DIJOFS_BUTTON(1),
   113   { NULL,DIJOFS_BUTTON(15),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   113      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   114   { NULL,DIJOFS_BUTTON(16),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   114     {NULL, DIJOFS_BUTTON(2),
   115   { NULL,DIJOFS_BUTTON(17),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   115      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   116   { NULL,DIJOFS_BUTTON(18),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   116     {NULL, DIJOFS_BUTTON(3),
   117   { NULL,DIJOFS_BUTTON(19),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   117      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   118   { NULL,DIJOFS_BUTTON(20),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   118     {NULL, DIJOFS_BUTTON(4),
   119   { NULL,DIJOFS_BUTTON(21),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   119      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   120   { NULL,DIJOFS_BUTTON(22),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   120     {NULL, DIJOFS_BUTTON(5),
   121   { NULL,DIJOFS_BUTTON(23),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   121      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   122   { NULL,DIJOFS_BUTTON(24),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   122     {NULL, DIJOFS_BUTTON(6),
   123   { NULL,DIJOFS_BUTTON(25),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   123      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   124   { NULL,DIJOFS_BUTTON(26),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   124     {NULL, DIJOFS_BUTTON(7),
   125   { NULL,DIJOFS_BUTTON(27),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   125      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   126   { NULL,DIJOFS_BUTTON(28),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   126     {NULL, DIJOFS_BUTTON(8),
   127   { NULL,DIJOFS_BUTTON(29),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   127      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   128   { NULL,DIJOFS_BUTTON(30),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   128     {NULL, DIJOFS_BUTTON(9),
   129   { NULL,DIJOFS_BUTTON(31),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   129      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   130   { NULL,DIJOFS_BUTTON(32),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   130     {NULL, DIJOFS_BUTTON(10),
   131   { NULL,DIJOFS_BUTTON(33),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   131      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   132   { NULL,DIJOFS_BUTTON(34),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   132     {NULL, DIJOFS_BUTTON(11),
   133   { NULL,DIJOFS_BUTTON(35),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   133      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   134   { NULL,DIJOFS_BUTTON(36),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   134     {NULL, DIJOFS_BUTTON(12),
   135   { NULL,DIJOFS_BUTTON(37),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   135      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   136   { NULL,DIJOFS_BUTTON(38),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   136     {NULL, DIJOFS_BUTTON(13),
   137   { NULL,DIJOFS_BUTTON(39),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   137      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   138   { NULL,DIJOFS_BUTTON(40),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   138     {NULL, DIJOFS_BUTTON(14),
   139   { NULL,DIJOFS_BUTTON(41),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   139      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   140   { NULL,DIJOFS_BUTTON(42),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   140     {NULL, DIJOFS_BUTTON(15),
   141   { NULL,DIJOFS_BUTTON(43),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   141      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   142   { NULL,DIJOFS_BUTTON(44),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   142     {NULL, DIJOFS_BUTTON(16),
   143   { NULL,DIJOFS_BUTTON(45),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   143      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   144   { NULL,DIJOFS_BUTTON(46),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   144     {NULL, DIJOFS_BUTTON(17),
   145   { NULL,DIJOFS_BUTTON(47),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   145      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   146   { NULL,DIJOFS_BUTTON(48),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   146     {NULL, DIJOFS_BUTTON(18),
   147   { NULL,DIJOFS_BUTTON(49),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   147      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   148   { NULL,DIJOFS_BUTTON(50),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   148     {NULL, DIJOFS_BUTTON(19),
   149   { NULL,DIJOFS_BUTTON(51),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   149      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   150   { NULL,DIJOFS_BUTTON(52),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   150     {NULL, DIJOFS_BUTTON(20),
   151   { NULL,DIJOFS_BUTTON(53),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   151      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   152   { NULL,DIJOFS_BUTTON(54),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   152     {NULL, DIJOFS_BUTTON(21),
   153   { NULL,DIJOFS_BUTTON(55),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   153      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   154   { NULL,DIJOFS_BUTTON(56),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   154     {NULL, DIJOFS_BUTTON(22),
   155   { NULL,DIJOFS_BUTTON(57),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   155      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   156   { NULL,DIJOFS_BUTTON(58),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   156     {NULL, DIJOFS_BUTTON(23),
   157   { NULL,DIJOFS_BUTTON(59),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   157      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   158   { NULL,DIJOFS_BUTTON(60),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   158     {NULL, DIJOFS_BUTTON(24),
   159   { NULL,DIJOFS_BUTTON(61),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   159      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   160   { NULL,DIJOFS_BUTTON(62),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   160     {NULL, DIJOFS_BUTTON(25),
   161   { NULL,DIJOFS_BUTTON(63),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   161      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   162   { NULL,DIJOFS_BUTTON(64),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   162     {NULL, DIJOFS_BUTTON(26),
   163   { NULL,DIJOFS_BUTTON(65),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   163      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   164   { NULL,DIJOFS_BUTTON(66),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   164     {NULL, DIJOFS_BUTTON(27),
   165   { NULL,DIJOFS_BUTTON(67),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   165      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   166   { NULL,DIJOFS_BUTTON(68),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   166     {NULL, DIJOFS_BUTTON(28),
   167   { NULL,DIJOFS_BUTTON(69),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   167      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   168   { NULL,DIJOFS_BUTTON(70),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   168     {NULL, DIJOFS_BUTTON(29),
   169   { NULL,DIJOFS_BUTTON(71),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   169      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   170   { NULL,DIJOFS_BUTTON(72),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   170     {NULL, DIJOFS_BUTTON(30),
   171   { NULL,DIJOFS_BUTTON(73),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   171      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   172   { NULL,DIJOFS_BUTTON(74),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   172     {NULL, DIJOFS_BUTTON(31),
   173   { NULL,DIJOFS_BUTTON(75),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   173      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   174   { NULL,DIJOFS_BUTTON(76),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   174     {NULL, DIJOFS_BUTTON(32),
   175   { NULL,DIJOFS_BUTTON(77),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   175      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   176   { NULL,DIJOFS_BUTTON(78),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   176     {NULL, DIJOFS_BUTTON(33),
   177   { NULL,DIJOFS_BUTTON(79),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   177      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   178   { NULL,DIJOFS_BUTTON(80),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   178     {NULL, DIJOFS_BUTTON(34),
   179   { NULL,DIJOFS_BUTTON(81),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   179      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   180   { NULL,DIJOFS_BUTTON(82),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   180     {NULL, DIJOFS_BUTTON(35),
   181   { NULL,DIJOFS_BUTTON(83),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   181      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   182   { NULL,DIJOFS_BUTTON(84),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   182     {NULL, DIJOFS_BUTTON(36),
   183   { NULL,DIJOFS_BUTTON(85),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   183      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   184   { NULL,DIJOFS_BUTTON(86),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   184     {NULL, DIJOFS_BUTTON(37),
   185   { NULL,DIJOFS_BUTTON(87),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   185      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   186   { NULL,DIJOFS_BUTTON(88),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   186     {NULL, DIJOFS_BUTTON(38),
   187   { NULL,DIJOFS_BUTTON(89),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   187      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   188   { NULL,DIJOFS_BUTTON(90),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   188     {NULL, DIJOFS_BUTTON(39),
   189   { NULL,DIJOFS_BUTTON(91),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   189      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   190   { NULL,DIJOFS_BUTTON(92),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   190     {NULL, DIJOFS_BUTTON(40),
   191   { NULL,DIJOFS_BUTTON(93),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   191      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   192   { NULL,DIJOFS_BUTTON(94),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   192     {NULL, DIJOFS_BUTTON(41),
   193   { NULL,DIJOFS_BUTTON(95),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   193      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   194   { NULL,DIJOFS_BUTTON(96),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   194     {NULL, DIJOFS_BUTTON(42),
   195   { NULL,DIJOFS_BUTTON(97),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   195      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   196   { NULL,DIJOFS_BUTTON(98),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   196     {NULL, DIJOFS_BUTTON(43),
   197   { NULL,DIJOFS_BUTTON(99),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   197      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   198   { NULL,DIJOFS_BUTTON(100),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   198     {NULL, DIJOFS_BUTTON(44),
   199   { NULL,DIJOFS_BUTTON(101),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   199      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   200   { NULL,DIJOFS_BUTTON(102),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   200     {NULL, DIJOFS_BUTTON(45),
   201   { NULL,DIJOFS_BUTTON(103),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   201      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   202   { NULL,DIJOFS_BUTTON(104),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   202     {NULL, DIJOFS_BUTTON(46),
   203   { NULL,DIJOFS_BUTTON(105),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   203      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   204   { NULL,DIJOFS_BUTTON(106),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   204     {NULL, DIJOFS_BUTTON(47),
   205   { NULL,DIJOFS_BUTTON(107),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   205      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   206   { NULL,DIJOFS_BUTTON(108),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   206     {NULL, DIJOFS_BUTTON(48),
   207   { NULL,DIJOFS_BUTTON(109),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   207      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   208   { NULL,DIJOFS_BUTTON(110),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   208     {NULL, DIJOFS_BUTTON(49),
   209   { NULL,DIJOFS_BUTTON(111),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   209      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   210   { NULL,DIJOFS_BUTTON(112),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   210     {NULL, DIJOFS_BUTTON(50),
   211   { NULL,DIJOFS_BUTTON(113),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   211      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   212   { NULL,DIJOFS_BUTTON(114),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   212     {NULL, DIJOFS_BUTTON(51),
   213   { NULL,DIJOFS_BUTTON(115),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   213      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   214   { NULL,DIJOFS_BUTTON(116),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   214     {NULL, DIJOFS_BUTTON(52),
   215   { NULL,DIJOFS_BUTTON(117),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   215      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   216   { NULL,DIJOFS_BUTTON(118),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   216     {NULL, DIJOFS_BUTTON(53),
   217   { NULL,DIJOFS_BUTTON(119),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   217      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   218   { NULL,DIJOFS_BUTTON(120),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   218     {NULL, DIJOFS_BUTTON(54),
   219   { NULL,DIJOFS_BUTTON(121),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   219      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   220   { NULL,DIJOFS_BUTTON(122),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   220     {NULL, DIJOFS_BUTTON(55),
   221   { NULL,DIJOFS_BUTTON(123),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   221      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   222   { NULL,DIJOFS_BUTTON(124),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   222     {NULL, DIJOFS_BUTTON(56),
   223   { NULL,DIJOFS_BUTTON(125),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   223      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   224   { NULL,DIJOFS_BUTTON(126),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   224     {NULL, DIJOFS_BUTTON(57),
   225   { NULL,DIJOFS_BUTTON(127),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
   225      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   226   { &GUID_XAxis,FIELD_OFFSET(DIJOYSTATE2,lVX),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
   226     {NULL, DIJOFS_BUTTON(58),
   227   { &GUID_YAxis,FIELD_OFFSET(DIJOYSTATE2,lVY),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
   227      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   228   { &GUID_ZAxis,FIELD_OFFSET(DIJOYSTATE2,lVZ),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
   228     {NULL, DIJOFS_BUTTON(59),
   229   { &GUID_RxAxis,FIELD_OFFSET(DIJOYSTATE2,lVRx),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
   229      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   230   { &GUID_RyAxis,FIELD_OFFSET(DIJOYSTATE2,lVRy),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
   230     {NULL, DIJOFS_BUTTON(60),
   231   { &GUID_RzAxis,FIELD_OFFSET(DIJOYSTATE2,lVRz),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
   231      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   232   { &GUID_Slider,FIELD_OFFSET(DIJOYSTATE2,rglVSlider[0]),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
   232     {NULL, DIJOFS_BUTTON(61),
   233   { &GUID_Slider,FIELD_OFFSET(DIJOYSTATE2,rglVSlider[1]),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
   233      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   234   { &GUID_XAxis,FIELD_OFFSET(DIJOYSTATE2,lAX),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
   234     {NULL, DIJOFS_BUTTON(62),
   235   { &GUID_YAxis,FIELD_OFFSET(DIJOYSTATE2,lAY),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
   235      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   236   { &GUID_ZAxis,FIELD_OFFSET(DIJOYSTATE2,lAZ),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
   236     {NULL, DIJOFS_BUTTON(63),
   237   { &GUID_RxAxis,FIELD_OFFSET(DIJOYSTATE2,lARx),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
   237      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   238   { &GUID_RyAxis,FIELD_OFFSET(DIJOYSTATE2,lARy),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
   238     {NULL, DIJOFS_BUTTON(64),
   239   { &GUID_RzAxis,FIELD_OFFSET(DIJOYSTATE2,lARz),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
   239      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   240   { &GUID_Slider,FIELD_OFFSET(DIJOYSTATE2,rglASlider[0]),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
   240     {NULL, DIJOFS_BUTTON(65),
   241   { &GUID_Slider,FIELD_OFFSET(DIJOYSTATE2,rglASlider[1]),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
   241      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   242   { &GUID_XAxis,FIELD_OFFSET(DIJOYSTATE2,lFX),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
   242     {NULL, DIJOFS_BUTTON(66),
   243   { &GUID_YAxis,FIELD_OFFSET(DIJOYSTATE2,lFY),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
   243      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   244   { &GUID_ZAxis,FIELD_OFFSET(DIJOYSTATE2,lFZ),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
   244     {NULL, DIJOFS_BUTTON(67),
   245   { &GUID_RxAxis,FIELD_OFFSET(DIJOYSTATE2,lFRx),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
   245      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   246   { &GUID_RyAxis,FIELD_OFFSET(DIJOYSTATE2,lFRy),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
   246     {NULL, DIJOFS_BUTTON(68),
   247   { &GUID_RzAxis,FIELD_OFFSET(DIJOYSTATE2,lFRz),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
   247      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
   248   { &GUID_Slider,FIELD_OFFSET(DIJOYSTATE2,rglFSlider[0]),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
   248     {NULL, DIJOFS_BUTTON(69),
   249   { &GUID_Slider,FIELD_OFFSET(DIJOYSTATE2,rglFSlider[1]),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
   249      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
       
   250     {NULL, DIJOFS_BUTTON(70),
       
   251      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
       
   252     {NULL, DIJOFS_BUTTON(71),
       
   253      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
       
   254     {NULL, DIJOFS_BUTTON(72),
       
   255      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
       
   256     {NULL, DIJOFS_BUTTON(73),
       
   257      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
       
   258     {NULL, DIJOFS_BUTTON(74),
       
   259      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
       
   260     {NULL, DIJOFS_BUTTON(75),
       
   261      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
       
   262     {NULL, DIJOFS_BUTTON(76),
       
   263      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
       
   264     {NULL, DIJOFS_BUTTON(77),
       
   265      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
       
   266     {NULL, DIJOFS_BUTTON(78),
       
   267      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
       
   268     {NULL, DIJOFS_BUTTON(79),
       
   269      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
       
   270     {NULL, DIJOFS_BUTTON(80),
       
   271      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
       
   272     {NULL, DIJOFS_BUTTON(81),
       
   273      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
       
   274     {NULL, DIJOFS_BUTTON(82),
       
   275      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
       
   276     {NULL, DIJOFS_BUTTON(83),
       
   277      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
       
   278     {NULL, DIJOFS_BUTTON(84),
       
   279      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
       
   280     {NULL, DIJOFS_BUTTON(85),
       
   281      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
       
   282     {NULL, DIJOFS_BUTTON(86),
       
   283      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
       
   284     {NULL, DIJOFS_BUTTON(87),
       
   285      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
       
   286     {NULL, DIJOFS_BUTTON(88),
       
   287      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
       
   288     {NULL, DIJOFS_BUTTON(89),
       
   289      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
       
   290     {NULL, DIJOFS_BUTTON(90),
       
   291      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
       
   292     {NULL, DIJOFS_BUTTON(91),
       
   293      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
       
   294     {NULL, DIJOFS_BUTTON(92),
       
   295      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
       
   296     {NULL, DIJOFS_BUTTON(93),
       
   297      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
       
   298     {NULL, DIJOFS_BUTTON(94),
       
   299      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
       
   300     {NULL, DIJOFS_BUTTON(95),
       
   301      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
       
   302     {NULL, DIJOFS_BUTTON(96),
       
   303      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
       
   304     {NULL, DIJOFS_BUTTON(97),
       
   305      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
       
   306     {NULL, DIJOFS_BUTTON(98),
       
   307      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
       
   308     {NULL, DIJOFS_BUTTON(99),
       
   309      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
       
   310     {NULL, DIJOFS_BUTTON(100),
       
   311      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
       
   312     {NULL, DIJOFS_BUTTON(101),
       
   313      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
       
   314     {NULL, DIJOFS_BUTTON(102),
       
   315      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
       
   316     {NULL, DIJOFS_BUTTON(103),
       
   317      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
       
   318     {NULL, DIJOFS_BUTTON(104),
       
   319      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
       
   320     {NULL, DIJOFS_BUTTON(105),
       
   321      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
       
   322     {NULL, DIJOFS_BUTTON(106),
       
   323      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
       
   324     {NULL, DIJOFS_BUTTON(107),
       
   325      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
       
   326     {NULL, DIJOFS_BUTTON(108),
       
   327      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
       
   328     {NULL, DIJOFS_BUTTON(109),
       
   329      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
       
   330     {NULL, DIJOFS_BUTTON(110),
       
   331      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
       
   332     {NULL, DIJOFS_BUTTON(111),
       
   333      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
       
   334     {NULL, DIJOFS_BUTTON(112),
       
   335      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
       
   336     {NULL, DIJOFS_BUTTON(113),
       
   337      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
       
   338     {NULL, DIJOFS_BUTTON(114),
       
   339      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
       
   340     {NULL, DIJOFS_BUTTON(115),
       
   341      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
       
   342     {NULL, DIJOFS_BUTTON(116),
       
   343      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
       
   344     {NULL, DIJOFS_BUTTON(117),
       
   345      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
       
   346     {NULL, DIJOFS_BUTTON(118),
       
   347      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
       
   348     {NULL, DIJOFS_BUTTON(119),
       
   349      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
       
   350     {NULL, DIJOFS_BUTTON(120),
       
   351      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
       
   352     {NULL, DIJOFS_BUTTON(121),
       
   353      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
       
   354     {NULL, DIJOFS_BUTTON(122),
       
   355      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
       
   356     {NULL, DIJOFS_BUTTON(123),
       
   357      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
       
   358     {NULL, DIJOFS_BUTTON(124),
       
   359      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
       
   360     {NULL, DIJOFS_BUTTON(125),
       
   361      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
       
   362     {NULL, DIJOFS_BUTTON(126),
       
   363      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
       
   364     {NULL, DIJOFS_BUTTON(127),
       
   365      DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0},
       
   366     {&GUID_XAxis, FIELD_OFFSET(DIJOYSTATE2, lVX),
       
   367      DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0},
       
   368     {&GUID_YAxis, FIELD_OFFSET(DIJOYSTATE2, lVY),
       
   369      DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0},
       
   370     {&GUID_ZAxis, FIELD_OFFSET(DIJOYSTATE2, lVZ),
       
   371      DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0},
       
   372     {&GUID_RxAxis, FIELD_OFFSET(DIJOYSTATE2, lVRx),
       
   373      DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0},
       
   374     {&GUID_RyAxis, FIELD_OFFSET(DIJOYSTATE2, lVRy),
       
   375      DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0},
       
   376     {&GUID_RzAxis, FIELD_OFFSET(DIJOYSTATE2, lVRz),
       
   377      DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0},
       
   378     {&GUID_Slider, FIELD_OFFSET(DIJOYSTATE2, rglVSlider[0]),
       
   379      DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0},
       
   380     {&GUID_Slider, FIELD_OFFSET(DIJOYSTATE2, rglVSlider[1]),
       
   381      DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0},
       
   382     {&GUID_XAxis, FIELD_OFFSET(DIJOYSTATE2, lAX),
       
   383      DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0},
       
   384     {&GUID_YAxis, FIELD_OFFSET(DIJOYSTATE2, lAY),
       
   385      DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0},
       
   386     {&GUID_ZAxis, FIELD_OFFSET(DIJOYSTATE2, lAZ),
       
   387      DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0},
       
   388     {&GUID_RxAxis, FIELD_OFFSET(DIJOYSTATE2, lARx),
       
   389      DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0},
       
   390     {&GUID_RyAxis, FIELD_OFFSET(DIJOYSTATE2, lARy),
       
   391      DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0},
       
   392     {&GUID_RzAxis, FIELD_OFFSET(DIJOYSTATE2, lARz),
       
   393      DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0},
       
   394     {&GUID_Slider, FIELD_OFFSET(DIJOYSTATE2, rglASlider[0]),
       
   395      DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0},
       
   396     {&GUID_Slider, FIELD_OFFSET(DIJOYSTATE2, rglASlider[1]),
       
   397      DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0},
       
   398     {&GUID_XAxis, FIELD_OFFSET(DIJOYSTATE2, lFX),
       
   399      DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0},
       
   400     {&GUID_YAxis, FIELD_OFFSET(DIJOYSTATE2, lFY),
       
   401      DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0},
       
   402     {&GUID_ZAxis, FIELD_OFFSET(DIJOYSTATE2, lFZ),
       
   403      DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0},
       
   404     {&GUID_RxAxis, FIELD_OFFSET(DIJOYSTATE2, lFRx),
       
   405      DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0},
       
   406     {&GUID_RyAxis, FIELD_OFFSET(DIJOYSTATE2, lFRy),
       
   407      DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0},
       
   408     {&GUID_RzAxis, FIELD_OFFSET(DIJOYSTATE2, lFRz),
       
   409      DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0},
       
   410     {&GUID_Slider, FIELD_OFFSET(DIJOYSTATE2, rglFSlider[0]),
       
   411      DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0},
       
   412     {&GUID_Slider, FIELD_OFFSET(DIJOYSTATE2, rglFSlider[1]),
       
   413      DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0},
   250 };
   414 };
   251 
   415 
   252 const DIDATAFORMAT c_dfDIJoystick2 = {
   416 const DIDATAFORMAT c_dfDIJoystick2 = {
   253     sizeof(DIDATAFORMAT),
   417     sizeof(DIDATAFORMAT),
   254     sizeof(DIOBJECTDATAFORMAT),
   418     sizeof(DIOBJECTDATAFORMAT),
   262 /* Convert a DirectInput return code to a text message */
   426 /* Convert a DirectInput return code to a text message */
   263 static void
   427 static void
   264 SetDIerror(const char *function, HRESULT code)
   428 SetDIerror(const char *function, HRESULT code)
   265 {
   429 {
   266     /*
   430     /*
   267     SDL_SetError("%s() [%s]: %s", function,
   431        SDL_SetError("%s() [%s]: %s", function,
   268                  DXGetErrorString9A(code), DXGetErrorDescription9A(code));
   432        DXGetErrorString9A(code), DXGetErrorDescription9A(code));
   269      */
   433      */
   270     SDL_SetError("%s() DirectX error %d", function, code);
   434     SDL_SetError("%s() DirectX error %d", function, code);
   271 }
   435 }
   272 
   436 
   273 
   437 
   289         SetDIerror("CoInitialize", result);
   453         SetDIerror("CoInitialize", result);
   290         return (-1);
   454         return (-1);
   291     }
   455     }
   292 
   456 
   293     result = CoCreateInstance(&CLSID_DirectInput, NULL, CLSCTX_INPROC_SERVER,
   457     result = CoCreateInstance(&CLSID_DirectInput, NULL, CLSCTX_INPROC_SERVER,
   294                               &IID_IDirectInput, (LPVOID)&dinput);
   458                               &IID_IDirectInput, (LPVOID) & dinput);
   295 
   459 
   296     if (FAILED(result)) {
   460     if (FAILED(result)) {
   297         SetDIerror("CoCreateInstance", result);
   461         SetDIerror("CoCreateInstance", result);
   298         return (-1);
   462         return (-1);
   299     }
   463     }
   370     joystick->hwdata->buffered = 1;
   534     joystick->hwdata->buffered = 1;
   371     joystick->hwdata->Capabilities.dwSize = sizeof(DIDEVCAPS);
   535     joystick->hwdata->Capabilities.dwSize = sizeof(DIDEVCAPS);
   372 
   536 
   373     result =
   537     result =
   374         IDirectInput_CreateDevice(dinput,
   538         IDirectInput_CreateDevice(dinput,
   375                                   &SYS_Joystick[joystick->index].
   539                                   &SYS_Joystick[joystick->index].guidInstance,
   376                                   guidInstance, &device, NULL);
   540                                   &device, NULL);
   377     if (FAILED(result)) {
   541     if (FAILED(result)) {
   378         SetDIerror("IDirectInput::CreateDevice", result);
   542         SetDIerror("IDirectInput::CreateDevice", result);
   379         return (-1);
   543         return (-1);
   380     }
   544     }
   381 
   545 
   382     /* Now get the IDirectInputDevice2 interface, instead. */
   546     /* Now get the IDirectInputDevice2 interface, instead. */
   383     result = IDirectInputDevice_QueryInterface(device,
   547     result = IDirectInputDevice_QueryInterface(device,
   384                                                &IID_IDirectInputDevice2,
   548                                                &IID_IDirectInputDevice2,
   385                                                (LPVOID *) & joystick->
   549                                                (LPVOID *) & joystick->hwdata->
   386                                                hwdata->InputDevice);
   550                                                InputDevice);
   387     /* We are done with this object.  Use the stored one from now on. */
   551     /* We are done with this object.  Use the stored one from now on. */
   388     IDirectInputDevice_Release(device);
   552     IDirectInputDevice_Release(device);
   389 
   553 
   390     if (FAILED(result)) {
   554     if (FAILED(result)) {
   391         SetDIerror("IDirectInputDevice::QueryInterface", result);
   555         SetDIerror("IDirectInputDevice::QueryInterface", result);
   393     }
   557     }
   394 
   558 
   395     /* Aquire shared access. Exclusive access is required for forces,
   559     /* Aquire shared access. Exclusive access is required for forces,
   396      * though. */
   560      * though. */
   397     result =
   561     result =
   398         IDirectInputDevice2_SetCooperativeLevel(joystick->hwdata->
   562         IDirectInputDevice2_SetCooperativeLevel(joystick->hwdata->InputDevice,
   399                                                 InputDevice, SDL_HelperWindow,
   563                                                 SDL_HelperWindow,
   400                                                 DISCL_EXCLUSIVE |
   564                                                 DISCL_EXCLUSIVE |
   401                                                 DISCL_BACKGROUND);
   565                                                 DISCL_BACKGROUND);
   402     if (FAILED(result)) {
   566     if (FAILED(result)) {
   403         SetDIerror("IDirectInputDevice2::SetCooperativeLevel", result);
   567         SetDIerror("IDirectInputDevice2::SetCooperativeLevel", result);
   404         return (-1);
   568         return (-1);
   433             return (-1);
   597             return (-1);
   434         }
   598         }
   435 
   599 
   436         /* reset all accuators. */
   600         /* reset all accuators. */
   437         result =
   601         result =
   438             IDirectInputDevice2_SendForceFeedbackCommand(joystick->hwdata->
   602             IDirectInputDevice2_SendForceFeedbackCommand(joystick->
   439                                                          InputDevice,
   603                                                          hwdata->InputDevice,
   440                                                          DISFFC_RESET);
   604                                                          DISFFC_RESET);
   441 
   605 
   442         if (FAILED(result)) {
   606         if (FAILED(result)) {
   443             SetDIerror("IDirectInputDevice2::SendForceFeedbackCommand",
   607             SetDIerror("IDirectInputDevice2::SendForceFeedbackCommand",
   444                        result);
   608                        result);
   625 
   789 
   626             break;
   790             break;
   627 
   791 
   628         case BUTTON:
   792         case BUTTON:
   629             SDL_PrivateJoystickButton_Int(joystick, in->num,
   793             SDL_PrivateJoystickButton_Int(joystick, in->num,
   630                                           (Uint8) (state.
   794                                           (Uint8) (state.rgbButtons[in->ofs -
   631                                                    rgbButtons[in->ofs -
   795                                                                     DIJOFS_BUTTON0]
   632                                                               DIJOFS_BUTTON0]
       
   633                                                    ? SDL_PRESSED :
   796                                                    ? SDL_PRESSED :
   634                                                    SDL_RELEASED));
   797                                                    SDL_RELEASED));
   635             break;
   798             break;
   636         case HAT:
   799         case HAT:
   637             {
   800             {
   683                 SDL_PrivateJoystickAxis(joystick, in->num,
   846                 SDL_PrivateJoystickAxis(joystick, in->num,
   684                                         (Sint16) evtbuf[i].dwData);
   847                                         (Sint16) evtbuf[i].dwData);
   685                 break;
   848                 break;
   686             case BUTTON:
   849             case BUTTON:
   687                 SDL_PrivateJoystickButton(joystick, in->num,
   850                 SDL_PrivateJoystickButton(joystick, in->num,
   688                                           (Uint8) (evtbuf[i].
   851                                           (Uint8) (evtbuf[i].dwData ?
   689                                                    dwData ? SDL_PRESSED :
   852                                                    SDL_PRESSED :
   690                                                    SDL_RELEASED));
   853                                                    SDL_RELEASED));
   691                 break;
   854                 break;
   692             case HAT:
   855             case HAT:
   693                 {
   856                 {
   694                     Uint8 pos = TranslatePOV(evtbuf[i].dwData);
   857                     Uint8 pos = TranslatePOV(evtbuf[i].dwData);