Added some sanity checking on max number of bottons and axes.
This commit is contained in:
parent
1ac8af41c1
commit
7555a4b8db
1 changed files with 2 additions and 0 deletions
|
@ -158,11 +158,13 @@ fgJoystickInit()
|
|||
JOYCAPS jsCaps ;
|
||||
joyGetDevCaps( i, &jsCaps, sizeof(jsCaps) );
|
||||
int nbuttons = jsCaps.wNumButtons;
|
||||
if (nbuttons > MAX_BUTTONS) nbuttons = MAX_BUTTONS;
|
||||
#else
|
||||
int nbuttons = MAX_BUTTONS;
|
||||
#endif
|
||||
|
||||
int naxes = js->getNumAxes();
|
||||
if (naxes > MAX_AXES) naxes = MAX_AXES;
|
||||
joysticks[i].naxes = naxes;
|
||||
joysticks[i].nbuttons = nbuttons;
|
||||
|
||||
|
|
Loading…
Reference in a new issue