Commit Graph

113 Commits

Author SHA1 Message Date
Philipp Wiesemann
1bc1891db0 Removed extern declaration of not existing SDL_numhaptics from internal header. 2014-12-11 23:38:02 +01:00
Philipp Wiesemann
a3bb9a9af0 Replaced free() with SDL_free() because related allocation also uses wrapper. 2014-12-04 21:41:30 +01:00
Sam Lantinga
330100f40a Fixed bug 2766 - Haptic coding bugs and fixes for Linux FF: periodic.phase handled as time instead of angle; + direction clarification
Elias Vanderstuyft

Remove the dependency of the calculation of Linux "phase" on "period",
currently the "phase" parameter is interpreted as a time shift, instead of a phase shift.
The Linux input documentation is not clear about the exact units of the "phase" parameter (see http://lxr.free-electrons.com/source/include/uapi/linux/input.h?v=3.17#L1075 ),
but we're about to standardize the 'phase shift' interpretation into the Linux input documentation,
since this will ease the job of a driver to recalculate the effect's state when the user dynamically updates the "period" parameter.
2014-11-29 11:51:13 -08:00
Sam Lantinga
5b0a60912f Fixed bug 2766 - Haptic coding bugs and fixes for Linux FF: periodic.phase handled as time instead of angle; + direction clarification
Elias Vanderstuyft

It's not obvious from the general "haptic direction" description what the SDL direction actually means in terms of force magnitude sign,
currently its meaning is only reflected by the example.
2014-11-29 11:48:43 -08:00
Ryan C. Gordon
4563873c18 Haptic: Deal with negative periodic magnitudes (thanks, Elias!).
A negative periodic magnitude doesn't exist in Windows' and MacOS' FF APIs

The periodic magnitude parameter of the SDL Haptic API is based on the Linux
 FF API, so it means they are not directly compatible:
    'dwMagnitude' is a 'DWORD', which is unsigned.

Fixes Bugzilla #2701.
2014-09-17 14:49:36 -04:00
Ryan C. Gordon
a61f94f2a4 Haptic: Fix clamping bugs on Windows, by using the Darwin haptics code.
Thanks, Elias!

Partially fixes Bugzilla #2686.
2014-08-16 16:49:00 -04:00
Ryan C. Gordon
5f4bff4acc Haptic: Fix the saturation and deadband parameters' available range.
There was a misconception that Linux's saturation and deadband parameters -
on which the corresponding SDL parameters were based - use only half of the
possible range.

Thanks, Elias!

Partially fixes Bugzilla #2686.
2014-08-16 16:47:42 -04:00
Ryan C. Gordon
913d3c0acb Haptic: Explicitly avoid floating point arithmetic if it's not needed.
Thanks, Elias!

Partially fixes Bugzilla #2686.
2014-08-16 16:42:55 -04:00
Ryan C. Gordon
8ba088f60b Haptic: DInput's POLAR direction actually matches Linux's direction.
Thanks, Elias!

Partially fixes Bugzilla #2686.
2014-08-16 16:41:25 -04:00
Ryan C. Gordon
a752aefd59 Haptic: Don't interpret a direction of polar 35999 as "unsupported type".
(or linux-direction 0xFFFF)

Thanks, Elias!

Partially fixes Bugzilla #2686.
2014-08-16 16:40:01 -04:00
Sam Lantinga
d19bc1c3b8 Fixed bug 2631 - Mac: minor code cleanup
Alex Szpakowski

Some minor changes to the Mac-specific backend code:

- Fixed up some code style issues (mostly brace style inconsistencies).

- Fixed a compiler warning in SDL_cocoaevents.m.

- Removed some useless code now that the 10.7 SDK is required to build SDL.

- Removed Gestalt(gestaltSystemVersion, ...) call and switched to NSAppKitVersionNumber for version checking code. Using Gestalt with gestaltSystemVersion will give 0x1090 in Mac OS 10.10+, and the whole Gestalt function was deprecated in Mac OS 10.8.
2014-07-07 12:48:25 -07:00
Sam Lantinga
0da7ddd120 Fixed mingw64 build and warnings 2014-07-07 10:26:28 -07:00
Sam Lantinga
c31088073c Fixed haptic refcount bug (thanks David Ludwig!) 2014-07-04 17:20:22 -07:00
Sam Lantinga
6dd1e2f2f6 Split the XInput and DirectInput code so Windows RT can use the existing XInput support. 2014-07-03 15:39:55 -07:00
Sam Lantinga
3f4d70266b Fixed compiler warning - HRESULT is set to FFERR_* values, but is an int 2014-06-25 01:43:58 -07:00
Sam Lantinga
b52c6ef8b0 Fixed bug 2562 - SDL_hapticlist/_tail not set correctly
Zachary L

SDL_hapticlist and SDL_hapticlist_tail are not set correctly when quitting the subsystem. This matters because they are represented as global variables. In the case you quit and reinitialize the subsystems, problems with dangling pointers arise.

For instance, SDL_hapticlist_tail will not be null on second initialization and because of the check on line 298, it will fail to set SDL_hapticlist appropriately. This can cause a few things to go wrong, like feeding SDL_strcmp a null fname which can cause a segfault.
2014-06-21 20:40:00 -07:00
Philipp Wiesemann
8cc0a1f080 Removed empty statements. 2014-04-05 23:50:09 +02:00
Sam Lantinga
4ad73f0dda Fixed XInput haptic support on Windows 8
It turns out the XBox 360 controller driver never reports force feedback capability, so we'll try to set 0 state and see if that succeeds.
2014-03-29 12:29:38 -07:00
Ryan C. Gordon
2be5efc8ad Fixed SDL_HapticNewEffect() failing on various DirectInput devices. 2014-03-18 17:16:28 -04:00
Ryan C. Gordon
91cea37295 Fixed SDL_HapticOpenFromJoystick() with DirectInput devices. 2014-03-17 19:11:18 -04:00
Ryan C. Gordon
e3cdc782d7 Windows: Fixed crash if quitting without closing an XInput haptic device. 2014-03-02 00:02:56 -05:00
Jørgen P. Tjernø
2ccfd3e029 Mac: Fix error message for haptic subsystem.
We were calling SDL_Error instead of SDL_SetError when the haptic subsystem
wasn't initialized.
2014-02-25 17:25:49 -08:00
Gabriel Jacobo
08e6695494 Zero out haptic linked list items on creation
(thanks to Turo Lamminen for the report!)
2014-02-24 10:25:02 -03:00
Edward Rudd
8c04aaf554 ignore hot plugs in mac haptic layer IF hap tics hasn't been initialized. 2014-02-07 09:35:13 -05:00
Ryan C. Gordon
326bcf7cef Fixed crash on Windows if haptic isn't initialized when controllers are added. 2014-02-06 21:26:41 -05:00
Ryan C. Gordon
1e6f86ee52 Fixed a typo. 2014-02-06 10:00:45 -05:00
Edward Rudd
52bef1a3cf Fix device counting in HapticMouse and JoystickOpen routines. 0 is the first item in the list not the last 2014-02-06 09:35:44 -05:00
Edward Rudd
7123f71d3d fix indentation and spaces 2014-02-06 09:11:05 -05:00
Ryan C. Gordon
97e15d4d3b Wired up haptic hotplugging for Windows DirectInput/XInput code. 2014-02-06 07:37:20 -05:00
Ryan C. Gordon
1aef91f898 Fixed memory leak. 2014-02-05 20:07:25 -05:00
Ryan C. Gordon
da6d0e63ea Make SDL_SYS_HapticMouse() count device indexes like HapticByDevIndex(). 2014-02-05 18:36:40 -05:00
Ryan C. Gordon
2ee4b430a5 Cleanup some vi footer comments, rename new PRIVATE_* funcs to MacHaptic_*. 2014-02-05 01:02:09 -05:00
Edward Rudd
8c1b08595f Implement new backend methods for haptic and hot plugging on OS X 2014-02-04 18:17:16 -05:00
Edward Rudd
5932071c34 implement new backend method for Haptics in dummy driver 2014-02-04 16:50:34 -05:00
Edward Rudd
e957be0dd8 Rework haptic backend to properly support hotplugging of haptic devices.
* currently only linux backend updated.
2014-02-04 15:44:09 -05:00
Sam Lantinga
dba255c1e5 Fixed bug 2374 - Update copyright for 2014...
Is it that time already??
2014-02-02 00:53:27 -08:00
Ryan C. Gordon
3dfc14ade2 Implemented the Dynamic API magic. 2013-12-09 16:03:18 -05:00
Ryan C. Gordon
03d5719413 Make internal SDL sources include SDL_internal.h instead of SDL_config.h
The new header will include SDL_config.h, but allows for other global stuff.
2013-11-24 23:56:17 -05:00
Ryan C. Gordon
ce8e4d3d92 Moved a SDL_SetError() call elsewhere to avoid triggering it needlessly.
Otherwise, the XInput path would always trigger it in a harmless manner.
2013-10-23 15:54:12 -04:00
Sam Lantinga
04b2fa0ebb Fixed windows compile 2013-10-20 20:49:36 -07:00
Sam Lantinga
ee2991652c Added a macro SDL_TICKS_PASSED() to correctly compare two 32-bit tick values.
Went through the code and used the macro and fixed a couple places that were using incorrect timestamp comparisons.
2013-10-20 20:42:55 -07:00
Ryan C. Gordon
4c0d6df7d5 Fix some edge cases in XInput haptic timing. 2013-10-20 23:38:19 -04:00
Ryan C. Gordon
df2257e369 Backed out hg changeset b92b8c52946c. REFGUID is apparently a const type. 2013-10-20 16:03:11 -04:00
Ryan C. Gordon
979be9e7d1 Patched to compile on non-C99 Microsoft compiler. 2013-10-20 16:02:24 -04:00
Ryan C. Gordon
0f42de668e Patched to compile on Windows. 2013-10-20 16:01:10 -04:00
Ryan C. Gordon
cbcd35ccf4 Allow XInput haptics to run for SDL_HAPTIC_INFINITY time (thanks, Mitchell!).
Partially fixes Bugzilla #2126.
2013-10-20 15:55:47 -04:00
Ryan C. Gordon
457b63bba4 Fixed goofy logic in haptic device comparison code.
Mitchell Keith Bloch did the research on this bug, and came up with a slightly
 different patch than this.

Partially fixes Bugzilla #2126.
2013-10-20 15:49:52 -04:00
Ryan C. Gordon
4fdc8805dd Don't bother calling SDL_SYS_HapticEffectType() at all for XInput devices. 2013-10-20 15:45:48 -04:00
Sam Lantinga
753aae78fc Christoph Mallon: Remove pointless if (x) before SDL_free(x) 2013-08-29 08:29:21 -07:00
Ryan C. Gordon
efb67d6fdc Fixed comment typo. 2013-08-28 17:12:07 -04:00