This repository was archived by the owner on Dec 3, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
XOutput/Devices/Input/DirectInput Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -209,6 +209,10 @@ public void Dispose()
209
209
{
210
210
disposed = true ;
211
211
inputRefresher ? . Abort ( ) ;
212
+ foreach ( var effect in actuators . Values . Where ( effect => effect != null ) )
213
+ {
214
+ effect . Dispose ( ) ;
215
+ }
212
216
joystick . Dispose ( ) ;
213
217
}
214
218
}
@@ -267,10 +271,11 @@ public void SetForceFeedback(double big, double small)
267
271
var values = new Dictionary < DeviceObjectInstance , Effect > ( actuators ) ;
268
272
foreach ( var pair in values )
269
273
{
274
+ var actuator = pair . Key ;
270
275
var oldEffect = pair . Value ;
271
276
oldEffect ? . Dispose ( ) ;
277
+ actuators [ actuator ] = null ;
272
278
273
- var actuator = pair . Key ;
274
279
var isSmall = actuator . ObjectType == ObjectGuid . YAxis ;
275
280
// All available axes will be added.
276
281
var axes = new List < int > { ( int ) actuator . ObjectId } ;
@@ -287,7 +292,7 @@ public void SetForceFeedback(double big, double small)
287
292
effectParams . Duration = int . MaxValue ;
288
293
effectParams . TriggerButton = - 1 ;
289
294
effectParams . TriggerRepeatInterval = int . MaxValue ;
290
- effectParams . Gain = 10000 ;
295
+ effectParams . Gain = joystick . Properties . ForceFeedbackGain ;
291
296
effectParams . SetAxes ( axes . ToArray ( ) , directions ) ;
292
297
var cf = new ConstantForce ( ) ;
293
298
cf . Magnitude = CalculateMagnitude ( isSmall ? small : big ) ;
You can’t perform that action at this time.
0 commit comments