1
0
Fork 0
Commit graph

7 commits

Author SHA1 Message Date
James Turner
dce282d7b8 Rename js.h -> FlightGear_js.h
Ensure we don’t get weird conflicts as our internal version is
starting to diverge from the original PLIB one.
2020-06-11 17:48:49 +01:00
Florent Rougon
df352346ad jsWindows: fail gracefully when joyGetDevCaps() returns undocumented values
According to Pfeffer's report[1] and many other messages on the
Internet, joyGetDevCaps() can return the (so far) undocumented value
165, which some say is JOYERR_PARMS. Since this is a valid return code
for joyGetPosEx() (not joyGetDevCaps()!), handle a few return codes from
that function too, and don't throw an exception when joyGetDevCaps()'s
return value is not one of the documented ones (we simply can't trust
its documentation).

[1] https://sourceforge.net/p/flightgear/mailman/message/36657149/
2019-05-04 08:58:15 +02:00
Florent Rougon
a5792617f7 jsWindows: throw exception instead of using an assert
Since asserts can be compiled as no-ops, throw an exception rather than
doing assert(false), in case the code passed to
joyGetDevCaps_errorString() is not one of the expected values.
2019-04-30 08:14:35 +02:00
Florent Rougon
babf0ded0c jsWindows: add debug output
Every code path that causes a joystick to report notWorking() should now
have an associated error message logged with class 'input' at level
'debug' or higher.
2019-04-29 16:38:11 +02:00
Florent Rougon
8e0271d9f6 jsWindows: remove undefined behavior when joyGetNumDevs() > INT_MAX
If joyGetNumDevs() > INT_MAX, casting it to an 'int' leads to undefined
behavior. On the other hand, after the 'ident >= 0' test succeeded, it
is perfectly safe to use static_cast<unsigned int>(ident), since 'ident'
is of type 'int'. Then we get to compare two unsigned ints, which is
well defined.
2019-04-29 13:42:32 +02:00
James Turner
4a38fa7f19 Windows build fix 2018-05-04 08:31:11 +01:00
James Turner
102fe04e91 Import PLIB JS code into FlightGear
- will permit bug-fixing which cannot occur for
  official PLIB.
2018-05-03 00:02:09 +01:00