Skip to content
This repository was archived by the owner on Dec 3, 2024. It is now read-only.

Commit fcad56a

Browse files
committed
Button 3 and button 6 not detected #94
1 parent 6588965 commit fcad56a

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

XOutput/Devices/Input/DirectInput/DirectDevice.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -133,13 +133,7 @@ public DirectDevice(DeviceInstance deviceInstance, Joystick joystick)
133133
this.deviceInstance = deviceInstance;
134134
this.joystick = joystick;
135135
var buttonObjectInstances = joystick.GetObjects(DeviceObjectTypeFlags.Button).Where(b => b.Usage > 0).OrderBy(b => b.ObjectId.InstanceNumber).Take(128).ToArray();
136-
var buttons = buttonObjectInstances.Select(b => new DirectInputSource(this, "Button " + b.Usage, InputSourceTypes.Button, b.Offset, state => state.Buttons[b.ObjectId.InstanceNumber] ? 1 : 0)).ToArray();
137-
int expectedButtons = Math.Min(joystick.Capabilities.ButtonCount, 128);
138-
if (expectedButtons > buttons.Length)
139-
{
140-
var additionalButtons = Enumerable.Range(0, expectedButtons).Where(i => buttonObjectInstances.All(b => b.ObjectId.InstanceNumber != i)).Select(i => new DirectInputSource(this, "Button " + (i + 1), InputSourceTypes.Button, 2000 + i, state => state.Buttons[i] ? 1 : 0)).ToArray();
141-
buttons = buttons.Concat(additionalButtons).ToArray();
142-
}
136+
var buttons = buttonObjectInstances.Select((b, i) => new DirectInputSource(this, "Button " + b.Usage, InputSourceTypes.Button, b.Offset, state => state.Buttons[i] ? 1 : 0)).ToArray();
143137
var axes = GetAxes().OrderBy(a => a.Usage).Take(24).Select(GetAxisSource);
144138
var sliders = GetSliders().OrderBy(a => a.Usage).Select(GetSliderSource);
145139
IEnumerable<DirectInputSource> dpads = new DirectInputSource[0];

0 commit comments

Comments
 (0)