sharpdx / SharpDX-Samples

Official repository for all SharpDX Samples
346 stars 222 forks source link

Force Feedback: Class not registered error #43

Open he1y13 opened 7 years ago

he1y13 commented 7 years ago

Hi,

Currently trying to provide force feedback on a G25 steering wheel. I am using a modified version of the Joystick app available here. I am getting this error

HRESULT: [0x80040154], Module: [SharpDX.DirectInput], ApiCode: [DIERR_DEVICENOTREG/DeviceNotRegistered], Message: Class not registered

at Effect e = when running the following code.

          var ep = new EffectParameters();
          var CF = new ConstantForce();
          var joystick = new Joystick(directInput, joystickGuid);
          joystick.SetCooperativeLevel(
                FormHandle,
                CooperativeLevel.Exclusive | CooperativeLevel.Background);

            ep = new EffectParameters();
            ep.Flags = EffectFlags.Cartesian | EffectFlags.ObjectOffsets;
            ep.Directions = new int[1] { 0 };
            ep.Gain = 5000;
            ep.Duration = int.MaxValue;
            ep.SamplePeriod = joystick.Capabilities.ForceFeedbackSamplePeriod;
            CF = new ConstantForce();
            CF.Magnitude = 10000;
            ep.Parameters = CF;

            Effect e = new Effect(joystick, joystickGuid, ep);
            e.Start();

If anyone have had similar issues, or sample code providing constant force to a G25 wheel please let me know! Any assistance is greatly appreciated.

ThomasSchemmer commented 6 years ago

Hi he1y13,

did you found a solution to your problem? I got the same one :( Cheers

he1y13 commented 6 years ago

Hi Thomas,

I used the logitech SDK as it comes with a Wrapper for C#

http://gaming.logitech.com/en-us/developers

LogitechSDK.cs is the name of the class and it needs the LogitechSteeringWheelEnginesWrapper.dll in the bin folder of your project.

ThomasSchemmer commented 6 years ago

Thanks for your quick reply :) Unfortunately that wont help me, as I got the same problem with a different driving wheel. Will look into it further.