@@ -106,6 +106,7 @@ public XInputControllerOSXState WithButton(Button button)
106
106
[ StructLayout ( LayoutKind . Explicit ) ]
107
107
internal struct XInputControllerWirelessOSXState : IInputStateTypeInfo
108
108
{
109
+ const ushort k_StickZeroValue = 32767 ;
109
110
public static FourCC kFormat => new FourCC ( 'H' , 'I' , 'D' ) ;
110
111
111
112
public enum Button
@@ -125,20 +126,20 @@ public enum Button
125
126
private byte padding ;
126
127
127
128
[ InputControl ( name = "leftStick" , layout = "Stick" , format = "VC2S" ) ]
128
- [ InputControl ( name = "leftStick/x" , offset = 0 , format = "USHT" , parameters = "normalize,normalizeMin=0,normalizeMax=1,normalizeZero=0.5" ) ]
129
+ [ InputControl ( name = "leftStick/x" , offset = 0 , format = "USHT" , parameters = "normalize,normalizeMin=0,normalizeMax=1,normalizeZero=0.5" , defaultState = k_StickZeroValue ) ]
129
130
[ InputControl ( name = "leftStick/left" , offset = 0 , format = "USHT" , parameters = "normalize,normalizeMin=0,normalizeMax=1,normalizeZero=0.5,clamp=1,clampMin=0,clampMax=0.5,invert" ) ]
130
131
[ InputControl ( name = "leftStick/right" , offset = 0 , format = "USHT" , parameters = "normalize,normalizeMin=0,normalizeMax=1,normalizeZero=0.5,clamp=1,clampMin=0.5,clampMax=1" ) ]
131
- [ InputControl ( name = "leftStick/y" , offset = 2 , format = "USHT" , parameters = "invert,normalize,normalizeMin=0,normalizeMax=1,normalizeZero=0.5" ) ]
132
+ [ InputControl ( name = "leftStick/y" , offset = 2 , format = "USHT" , parameters = "invert,normalize,normalizeMin=0,normalizeMax=1,normalizeZero=0.5" , defaultState = k_StickZeroValue ) ]
132
133
[ InputControl ( name = "leftStick/up" , offset = 2 , format = "USHT" , parameters = "normalize,normalizeMin=0,normalizeMax=1,normalizeZero=0.5,clamp=1,clampMin=0,clampMax=0.5,invert" ) ]
133
134
[ InputControl ( name = "leftStick/down" , offset = 2 , format = "USHT" , parameters = "normalize,normalizeMin=0,normalizeMax=1,normalizeZero=0.5,clamp=1,clampMin=0.5,clampMax=1,invert=false" ) ]
134
135
[ FieldOffset ( 1 ) ] public ushort leftStickX ;
135
136
[ FieldOffset ( 3 ) ] public ushort leftStickY ;
136
137
137
138
[ InputControl ( name = "rightStick" , layout = "Stick" , format = "VC2S" ) ]
138
- [ InputControl ( name = "rightStick/x" , offset = 0 , format = "USHT" , parameters = "normalize,normalizeMin=0,normalizeMax=1,normalizeZero=0.5" ) ]
139
+ [ InputControl ( name = "rightStick/x" , offset = 0 , format = "USHT" , parameters = "normalize,normalizeMin=0,normalizeMax=1,normalizeZero=0.5" , defaultState = k_StickZeroValue ) ]
139
140
[ InputControl ( name = "rightStick/left" , offset = 0 , format = "USHT" , parameters = "normalize,normalizeMin=0,normalizeMax=1,normalizeZero=0.5,clamp=1,clampMin=0,clampMax=0.5,invert" ) ]
140
141
[ InputControl ( name = "rightStick/right" , offset = 0 , format = "USHT" , parameters = "normalize,normalizeMin=0,normalizeMax=1,normalizeZero=0.5,clamp=1,clampMin=0.5,clampMax=1" ) ]
141
- [ InputControl ( name = "rightStick/y" , offset = 2 , format = "USHT" , parameters = "invert,normalize,normalizeMin=0,normalizeMax=1,normalizeZero=0.5" ) ]
142
+ [ InputControl ( name = "rightStick/y" , offset = 2 , format = "USHT" , parameters = "invert,normalize,normalizeMin=0,normalizeMax=1,normalizeZero=0.5" , defaultState = k_StickZeroValue ) ]
142
143
[ InputControl ( name = "rightStick/up" , offset = 2 , format = "USHT" , parameters = "normalize,normalizeMin=0,normalizeMax=1,normalizeZero=0.5,clamp=1,clampMin=0,clampMax=0.5,invert" ) ]
143
144
[ InputControl ( name = "rightStick/down" , offset = 2 , format = "USHT" , parameters = "normalize,normalizeMin=0,normalizeMax=1,normalizeZero=0.5,clamp=1,clampMin=0.5,clampMax=1,invert=false" ) ]
144
145
[ FieldOffset ( 5 ) ] public ushort rightStickX ;
@@ -149,7 +150,7 @@ public enum Button
149
150
[ InputControl ( name = "rightTrigger" , format = "USHT" , parameters = "normalize,normalizeMin=0,normalizeMax=0.01560998" ) ]
150
151
[ FieldOffset ( 11 ) ] public ushort rightTrigger ;
151
152
152
- [ InputControl ( name = "dpad" , format = "BIT" , layout = "Dpad" , sizeInBits = 4 , defaultState = 8 ) ]
153
+ [ InputControl ( name = "dpad" , format = "BIT" , layout = "Dpad" , sizeInBits = 4 ) ]
153
154
[ InputControl ( name = "dpad/up" , format = "BIT" , layout = "DiscreteButton" , parameters = "minValue=8,maxValue=2,nullValue=0,wrapAtValue=9" , bit = 0 , sizeInBits = 4 ) ]
154
155
[ InputControl ( name = "dpad/right" , format = "BIT" , layout = "DiscreteButton" , parameters = "minValue=2,maxValue=4" , bit = 0 , sizeInBits = 4 ) ]
155
156
[ InputControl ( name = "dpad/down" , format = "BIT" , layout = "DiscreteButton" , parameters = "minValue=4,maxValue=6" , bit = 0 , sizeInBits = 4 ) ]
@@ -188,16 +189,17 @@ public XInputControllerWirelessOSXState WithDpad(byte value)
188
189
189
190
public static XInputControllerWirelessOSXState defaultState => new XInputControllerWirelessOSXState
190
191
{
191
- rightStickX = 32767 ,
192
- rightStickY = 32767 ,
193
- leftStickX = 32767 ,
194
- leftStickY = 32767
192
+ rightStickX = k_StickZeroValue ,
193
+ rightStickY = k_StickZeroValue ,
194
+ leftStickX = k_StickZeroValue ,
195
+ leftStickY = k_StickZeroValue
195
196
} ;
196
197
}
197
198
198
199
[ StructLayout ( LayoutKind . Explicit ) ]
199
200
internal struct XInputControllerWirelessOSXStateV2 : IInputStateTypeInfo
200
201
{
202
+ const ushort k_StickZeroValue = 32767 ;
201
203
public static FourCC kFormat => new FourCC ( 'H' , 'I' , 'D' ) ;
202
204
203
205
public enum Button
@@ -217,20 +219,20 @@ public enum Button
217
219
private byte padding ;
218
220
219
221
[ InputControl ( name = "leftStick" , layout = "Stick" , format = "VC2S" ) ]
220
- [ InputControl ( name = "leftStick/x" , offset = 0 , format = "USHT" , parameters = "normalize,normalizeMin=0,normalizeMax=1,normalizeZero=0.5" ) ]
222
+ [ InputControl ( name = "leftStick/x" , offset = 0 , format = "USHT" , parameters = "normalize,normalizeMin=0,normalizeMax=1,normalizeZero=0.5" , defaultState = k_StickZeroValue ) ]
221
223
[ InputControl ( name = "leftStick/left" , offset = 0 , format = "USHT" , parameters = "normalize,normalizeMin=0,normalizeMax=1,normalizeZero=0.5,clamp=1,clampMin=0,clampMax=0.5,invert" ) ]
222
224
[ InputControl ( name = "leftStick/right" , offset = 0 , format = "USHT" , parameters = "normalize,normalizeMin=0,normalizeMax=1,normalizeZero=0.5,clamp=1,clampMin=0.5,clampMax=1" ) ]
223
- [ InputControl ( name = "leftStick/y" , offset = 2 , format = "USHT" , parameters = "invert,normalize,normalizeMin=0,normalizeMax=1,normalizeZero=0.5" ) ]
225
+ [ InputControl ( name = "leftStick/y" , offset = 2 , format = "USHT" , parameters = "invert,normalize,normalizeMin=0,normalizeMax=1,normalizeZero=0.5" , defaultState = k_StickZeroValue ) ]
224
226
[ InputControl ( name = "leftStick/up" , offset = 2 , format = "USHT" , parameters = "normalize,normalizeMin=0,normalizeMax=1,normalizeZero=0.5,clamp=1,clampMin=0,clampMax=0.5,invert" ) ]
225
227
[ InputControl ( name = "leftStick/down" , offset = 2 , format = "USHT" , parameters = "normalize,normalizeMin=0,normalizeMax=1,normalizeZero=0.5,clamp=1,clampMin=0.5,clampMax=1,invert=false" ) ]
226
228
[ FieldOffset ( 1 ) ] public ushort leftStickX ;
227
229
[ FieldOffset ( 3 ) ] public ushort leftStickY ;
228
230
229
231
[ InputControl ( name = "rightStick" , layout = "Stick" , format = "VC2S" ) ]
230
- [ InputControl ( name = "rightStick/x" , offset = 0 , format = "USHT" , parameters = "normalize,normalizeMin=0,normalizeMax=1,normalizeZero=0.5" ) ]
232
+ [ InputControl ( name = "rightStick/x" , offset = 0 , format = "USHT" , parameters = "normalize,normalizeMin=0,normalizeMax=1,normalizeZero=0.5" , defaultState = k_StickZeroValue ) ]
231
233
[ InputControl ( name = "rightStick/left" , offset = 0 , format = "USHT" , parameters = "normalize,normalizeMin=0,normalizeMax=1,normalizeZero=0.5,clamp=1,clampMin=0,clampMax=0.5,invert" ) ]
232
234
[ InputControl ( name = "rightStick/right" , offset = 0 , format = "USHT" , parameters = "normalize,normalizeMin=0,normalizeMax=1,normalizeZero=0.5,clamp=1,clampMin=0.5,clampMax=1" ) ]
233
- [ InputControl ( name = "rightStick/y" , offset = 2 , format = "USHT" , parameters = "invert,normalize,normalizeMin=0,normalizeMax=1,normalizeZero=0.5" ) ]
235
+ [ InputControl ( name = "rightStick/y" , offset = 2 , format = "USHT" , parameters = "invert,normalize,normalizeMin=0,normalizeMax=1,normalizeZero=0.5" , defaultState = k_StickZeroValue ) ]
234
236
[ InputControl ( name = "rightStick/up" , offset = 2 , format = "USHT" , parameters = "normalize,normalizeMin=0,normalizeMax=1,normalizeZero=0.5,clamp=1,clampMin=0,clampMax=0.5,invert" ) ]
235
237
[ InputControl ( name = "rightStick/down" , offset = 2 , format = "USHT" , parameters = "normalize,normalizeMin=0,normalizeMax=1,normalizeZero=0.5,clamp=1,clampMin=0.5,clampMax=1,invert=false" ) ]
236
238
[ FieldOffset ( 5 ) ] public ushort rightStickX ;
@@ -241,7 +243,7 @@ public enum Button
241
243
[ InputControl ( name = "rightTrigger" , format = "USHT" , parameters = "normalize,normalizeMin=0,normalizeMax=0.01560998" ) ]
242
244
[ FieldOffset ( 11 ) ] public ushort rightTrigger ;
243
245
244
- [ InputControl ( name = "dpad" , format = "BIT" , layout = "Dpad" , sizeInBits = 4 , defaultState = 8 ) ]
246
+ [ InputControl ( name = "dpad" , format = "BIT" , layout = "Dpad" , sizeInBits = 4 ) ]
245
247
[ InputControl ( name = "dpad/up" , format = "BIT" , layout = "DiscreteButton" , parameters = "minValue=8,maxValue=2,nullValue=0,wrapAtValue=9" , bit = 0 , sizeInBits = 4 ) ]
246
248
[ InputControl ( name = "dpad/right" , format = "BIT" , layout = "DiscreteButton" , parameters = "minValue=2,maxValue=4" , bit = 0 , sizeInBits = 4 ) ]
247
249
[ InputControl ( name = "dpad/down" , format = "BIT" , layout = "DiscreteButton" , parameters = "minValue=4,maxValue=6" , bit = 0 , sizeInBits = 4 ) ]
@@ -280,10 +282,10 @@ public XInputControllerWirelessOSXStateV2 WithDpad(byte value)
280
282
281
283
public static XInputControllerWirelessOSXStateV2 defaultState => new XInputControllerWirelessOSXStateV2
282
284
{
283
- rightStickX = 32767 ,
284
- rightStickY = 32767 ,
285
- leftStickX = 32767 ,
286
- leftStickY = 32767
285
+ rightStickX = k_StickZeroValue ,
286
+ rightStickY = k_StickZeroValue ,
287
+ leftStickX = k_StickZeroValue ,
288
+ leftStickY = k_StickZeroValue
287
289
} ;
288
290
}
289
291
}
0 commit comments