Managed DirectInput samples bugs. Logitech G25 FF fails to initialize

Recently, I had the chance to test the magnificent Logitech G25 Racing Wheel, a superb product for PC racing enthusiasts. Of course, after investing two or three hours of my life with TOCA 2 and the wheel ( yeeeeaaaaaah !) , I started to play with it using Managed DirectInput, just to see what is able to do.

I had some problems initializing Force Feedback, and I contacted Joe Kreiner from Logitech, who was very kind, I have to say. They helped me to find the solution, and I describe here what we found:

1.- Managed DirectInput samples have a bug present there for a long time, that any developer probably already discovered. They seemed to have tested their applications with joysticks only, as their code works fine with them. However, with racing wheels (even the Microsoft one), the application reports that no Force Feedback device is present. To find it:

Theres a point in the code like this: if (axis.Length - 1 >= 1)

which tests if the device has 2 or more axis (don´t really understand the sense of comparing (AnyThing -1 >= 1) instead of (AnyThing >= 2) ... :o)

Anyway, replace the code with something like this: if (axis.Length >= 1) and it will work.


2.- The second bug appears when trying to create an instance of the type EffectObject, where an exception of the type "Value does not fall in the required range" is thrown with the G25 (not with other wheels, like the Logitech Driving Force Pro). The problem is in the method FillEffStruct(), where eff.SetAxes() is called twice:

eff.SetAxes(new int[axis.Length]);
...
eff.SetAxes(axis);

Even logitech´s engineers are not very sure what this method does, as there´s no explanation in the DX SDK docs. Anyway, removing the second call to SetAxes solves the problem.


As a conclusion, we are all impressed with the work done in the Managed version of DirectX and we also know it´s been developed by a small team of people with limited resources. Anyway, the documentation lacks lots of explanations, examples, and even methods and classes specs. Hope this will be fixed someday.

Cheers !