Re: [AD] Windows DirectInput haptic driver and some small haptic enhancements |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
OK, I think I figured out the reason for the crash. The test program
ex_haptic assumes (perhaps incorrectly) that if al_is_joystick_haptic
works, then al_get_haptic_from_joystick will return nonzero. Which is
not the case if initialization fails somehow. The latter case isn't
guarded against, so this will result in a null hatpic device being
dereferenced. The ex_haptic2 program is more resillient and will not
show such NULL haptic devices.
So, that is what is happening here. "Could not enable haptic device
actuators" means that the given DISFFC_SETACTUATORSON command on
whaptic.cpp:830 failed for some reason (perhaps it was unsupported by
your jPSX controller). At that point the function will bail out and
return NULL. However, in retrospect I think that this might be too
severe. Could you try to comment out the "return false" on line
whaptic.cpp:843, and see if that helps anything?
I looked at the log, and it seems like two joystics are being
detected, and both have haptic capabilities. Did you connect two
joysticks? If not then this might be a different problem in the
joystick routines.
Finally, as for the style issues, I was hoping someone would point me
to an automatic way to solve most of these using a code beautifier.
On 5/16/14, SiegeLord <slabode@xxxxxxxxxx> wrote:
> On 05/14/2014 05:41 PM, beoran@xxxxxxxxxx wrote:
>> I have implemented a Windows driver for haptic (force feedback)
>> devices that support the full DirectInput API. Notable exception to
>> this driver are the XBOX and compatible controllers for which haptics
>> only works though the XInput API. The driver compiles under Mingw but
>> wasn't tested under MSVC yet. Also, it was tested under wine, and it
>> seems to work correctly, but it was only tested with a single device.
>> In attachment is the patch.
>>
>> If this patch is acceptable, then the next step is be to implement a
>> windows XInput joystick and haptics driver. After that will be
>> Android. I really don't have a OSX system so I cannot make the prort
>> to that system or OSX, so I was hoping that at least for that platform
>> someone would step up and help out. Everyone else can test this patch
>> on windows (using ex_haptic and ex_haptic2) and report any bugs or
>> suggestions for improvement.
>>
>> Kind Regards,
>>
>> B.
>
> There are tons of style issues, but lets ignore those for now. I have
> also not looked at the user API. I tried running this with a PSX
> controller with an adapter, and I found that it did not work. Namely,
> `ex_haptic` crashed (NULL dereference in whaptic.cpp:957) and
> `ex_haptic2` didn't show the controller at all. Attached is the log from
> running `ex_haptic`. Now, I haven't found a way yet to independently
> test the functionality of my controller (it does vibrate if I calibrate
> it through Windows). Perhaps I could try getting SDL2 or something and
> testing that... it does work on Linux, so alternatively I could verify
> that it works through Wine as well.
>
> Is there anything else you suggest I could try?
>
> -SL
>
>