1
0
Fork 0

Added some sanity checking on max number of bottons and axes.

This commit is contained in:
curt 2001-03-06 23:03:06 +00:00
parent 1ac8af41c1
commit 7555a4b8db

View file

@ -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;