Commit graph

1263 commits

Author SHA1 Message Date
Fraser Waters fe3a0df56a Add #pragma warning disable for unused field warnings.
Fixes warnings [#61] by disabling unused field warnings for two structures in
HidProtocol. These fields aren't currently used by OpenTK but the stuctures are
used in native marshalling so must match the documented structures perfectly.
2014-11-03 01:39:45 +01:00
Fraser Waters 41b684491d Remove unused fields/variables.
Fixes warnings [#61] by removing some unused variables and an unused field.
Field was private so no inheritance concerns.
2014-11-03 01:36:36 +01:00
thefiddler e621b21c88 [Win] Avoid NRE in WinFactory.Dispose()
WinFactory.Dispose() could crash with a NRE when the joystick driver has
not been initialized. Fixed by checking for null before disposing the
input driver.
2014-09-23 08:55:02 +02:00
thefiddler 383cea7e82 [Mac] Fixed exception in HIDInput.Dispose()
HIDInput.Dispose() would remove elements from a DeviceCollection during
iteration. This results in an exception.

We are now using a plain for-loop instead.
2014-09-20 17:11:18 +02:00
thefiddler 747d86bafb [Common] Avoid GC in DeviceCollection
`DeviceCollection.GetEnumerator()` now returns a struct IEnumerable<T>
directly to avoid boxing.

Additionally, we can now use `DeviceCollection[int]` as a shortcut to
`FromIndex(int)`.
2014-09-20 17:10:05 +02:00
thefiddler 2b3a4c578a Merge pull request #181 from thefiddler/evdev
[Linux] Implement evdev joystick driver
2014-09-20 13:53:12 +02:00
thefiddler 179c82387c [Linux] Fixed byteswapping in joystick Guid calculation 2014-09-18 01:20:21 +02:00
thefiddler 21deea87d8 [Linux] Correctly set evdev packet number 2014-09-18 01:20:21 +02:00
thefiddler 129fb81224 [Linux] Implemented evdev joystick polling 2014-09-18 01:20:21 +02:00
thefiddler 397bdda076 [Linux] Implemented evdev joystick device discovery 2014-09-18 01:20:21 +02:00
thefiddler 8642177c30 [Mac] Use DeviceCollection
This reduces code duplication significantly.
2014-09-18 01:16:41 +02:00
thefiddler 2c26df8d93 [Input] Added From* overloads with out parameters 2014-09-18 01:16:40 +02:00
thefiddler 2a6579032e [Mac] Match SDL2 element order
Joystick elements (axes, buttons, hats) are now reported in the same
order as SDL2. This fixes potential mismatches in the GamePad
configuration database.

Additionally, elements are now counted correctly (duplicate elements no
longer count towards the total.)
2014-09-18 01:16:40 +02:00
thefiddler fbedac9a16 [Mac] Fixed Joystick Hat calculations 2014-09-18 01:16:40 +02:00
thefiddler b9f7f2c242 [Mac] Sort joystick elements like SDL2
GamePad configuration database is now working correctly on Mac.
2014-09-18 01:16:40 +02:00
thefiddler 9c67265832 [Mac] Added CFGetTypeID method 2014-09-18 01:16:40 +02:00
thefiddler 4231cf2cdd [Mac] Use cookies to match HID joystick elements 2014-09-18 01:16:40 +02:00
thefiddler d4c6b2e699 [Mac] Fixed joystick Guid calculation
The result now matches the output of SDL2 as well as the entries in the
GamePad configuration database.
2014-09-18 01:16:40 +02:00
thefiddler 4337288d74 [Win] Removed unused code 2014-09-17 18:43:29 +02:00
thefiddler 8237b889c9 [Win] Fixed XInput y-axis and trigger range 2014-09-17 18:42:47 +02:00
thefiddler ea66a828bf [Win] Suppressed spurious warning 2014-09-17 18:42:27 +02:00
thefiddler 73f255ed14 [Input] Fixed bitwise test for GamePadAxes 2014-09-12 10:23:54 +02:00
thefiddler 2df0496c44 [SDL] Correctly byteswap Guid
Fixes an issue where GamePad Guids would fail to be matched with the
Guids in the configuration database.
2014-09-12 08:43:20 +02:00
thefiddler 71e5a4f4f3 [Input] Add GamePadCapabilities.IsMapped 2014-09-12 08:42:26 +02:00
thefiddler 742149412e [Input] Fixed button/hat->trigger mapping scale 2014-09-11 12:51:50 +02:00
thefiddler 0d4fddd9b4 [Win] Skip devices with too many axes
These are likely not joysticks / gamepads, but multitouch-capable HID
devices.
2014-09-11 12:51:50 +02:00
thefiddler 388acee32a [Win] Correct joystick GUID generation
Joystick GUIDs now match SDL2/DirectInput for USB devices. (Bluetooth
devices still need to be tested.)
2014-09-11 12:51:49 +02:00
thefiddler f829b3d732 [Win] Fix compilation in Release 2014-09-11 12:51:49 +02:00
thefiddler 8c762e56e3 [Win] Added collection id to dictionary keys 2014-09-11 12:51:49 +02:00
thefiddler a2d6f1801c [Win] Improved joystick debugging information 2014-09-11 12:51:49 +02:00
thefiddler 1e5b2e57cd [Win] Correct XInput axes/button/hat mapping 2014-09-11 12:51:49 +02:00
thefiddler 0bd6854a65 [Win] Detect xinput devices and use xinput driver 2014-09-11 12:51:49 +02:00
thefiddler be575d4475 [Win] Refactored UpdateAxes 2014-09-11 12:51:49 +02:00
thefiddler 354fc04614 [Win] Do not change device index when replugging 2014-09-11 12:51:49 +02:00
thefiddler 9efa75179f [Platform] DeviceCollection hardware id is long 2014-09-11 12:51:49 +02:00
thefiddler 4c411b0b6e [Win] Retrieve joystick input even on background 2014-09-11 12:51:48 +02:00
thefiddler dd0f622670 [Win] Do not re-query caps in ProcessEvents
We just do that once when a device is opened.
2014-09-11 12:51:48 +02:00
thefiddler 5c0923004a [Win] Fixed axis, button and hat value updates 2014-09-11 12:51:48 +02:00
thefiddler e3875527eb [Win] Fixed axis range calculation
Values are now correctly scaled between [min, max]
2014-09-11 12:51:48 +02:00
thefiddler f010e32570 [Win] Added HidP status codes 2014-09-11 12:51:48 +02:00
thefiddler cbb2807959 [Win] Implemented joystick button updates
Due to the way we segregate axes from buttons, the easiest approach is
to retrieve the current button state via HidP_GetUsages().

Axes, buttons and hats are now allocated sequentially based on their
order of appearance in the device capability reports.
2014-09-11 12:51:48 +02:00
thefiddler 3fee0bd8d0 [Win] Raw input parsing moved to input drivers 2014-09-11 12:51:48 +02:00
thefiddler a51a85c517 [Win] Added helper raw input methods 2014-09-11 12:51:48 +02:00
thefiddler 6d54edc389 [Win] Use DeviceCollection. Fix GUID detection 2014-09-11 12:51:48 +02:00
thefiddler db01cac895 [Common] Use long for device keys 2014-09-11 12:51:48 +02:00
thefiddler a8aabbf02c [Win] Made internal struct non-public 2014-09-11 12:51:47 +02:00
thefiddler 8fddf8b669 [Win] Fixed axis/button detection
We can now discover button range collections.
2014-09-11 12:51:47 +02:00
thefiddler f3b3b8860e [Win] Improved HidP bindings
Marked arrays with [In] and [Out] as required. Fixes issues with
axis/button capabilities returning empty results.

Added bindings for link collection node transversal.
2014-09-11 12:51:47 +02:00
thefiddler 131de67459 Fixed minor compilation issues 2014-09-11 12:51:47 +02:00
Stefanos A 30d09a4300 [Win] Cleaned up public region 2014-09-11 12:51:47 +02:00