I am fighting with DirectInput in a .NET application. I'm trying to use the built-in spring force of a Logitech racing wheel. I am using SharpDX which has helped quite a bit and I am successfully reading all of the inputs. But I cannot for the life of me figure out how to manage feedback effects. I've already reviewed several articles that discuss this but the API seems to have changed. I can't even get a constant force to work, let alone a spring force.
Here is some code online that I found and have been trying to adapt. After many hours of study and experimentation, I still keep getting the same error:
SharpDX.SharpDXException: 'HRESULT: [0x80070057], Module: [General], ApiCode: [E_INVALIDARG/Invalid Arguments], Message: The parameter is incorrect
int[] offsets = { (int)JoystickOffset.X };
int[] dirs = { 0 };
int[] coords = { 0, 0 };
var effParams = new EffectParameters();
effParams.SetAxes(offsets, coords);
effParams.Directions = dirs;
effParams.Flags = EffectFlags.Cartesian | EffectFlags.ObjectOffsets;
effParams.Duration = int.MaxValue;
effParams.SamplePeriod = 0;
effParams.Gain = 10000;
effParams.TriggerButton = -1; //(int)Microsoft.DirectX.DirectInput.Button.NoTrigger;
effParams.TriggerRepeatInterval = 0;
effParams.Envelope = null;
effParams.StartDelay = 0;
effParams.Parameters = new ConstantForce();
Effect e = new Effect(controllers[0].Device, springForceGuid, effParams);
e.Start();
I was hoping that if I could get a constant force working, I might be able to adapt the code to manage the spring force.
User contributions licensed under CC BY-SA 3.0