-
Notifications
You must be signed in to change notification settings - Fork 0
/
__TEMPLATE.py
350 lines (233 loc) · 10.8 KB
/
__TEMPLATE.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
from src.client.client_interface import joy, vjoy, action, threshold, sequence, transfer, Filter
from src.helpers.freepie_vars import FreePieVars
def x52_pro_mapping():
### Joystick Builder Settings
joy_name = "X52 Professional H.O.T.A.S."
joy_axis_max = 1000
x52_pro = joy(joy_name, joy_axis_max)
### Modifiers Vars
modifier_pinkie = 5
modifier_clutch = 30
#* ///////////////////////////////////////////////////////////////////////////////
#* //
#* // BUTTONS
#* //
#* ///////////////////////////////////////////////////////////////////////////////
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# > > > > BUTTONS / STICK
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ~~[ STICK / BTN 0 ]~~>> BUTTONS / STICK --- Index First Stage TRIGGER
# ~~[ STICK / BTN 14 ]~~>> BUTTONS / STICK --- Index Second Stage TRIGGER
# ~~[ STICK / BTN 1 ]~~>> BUTTONS / STICK --- Thumb TOP CENTER
# ~~[ STICK / BTN 2 ]~~>> BUTTONS / STICK --- Thumb TOP RIGHT
# ~~[ STICK / BTN 3 ]~~>> BUTTONS / STICK --- Thumb BOTTOM RIGHT
# ~~[ STICK / BTN 4 ]~~>> BUTTONS / STICK --- Thumb BOTTOM LEFT
# ~~[ STICK / BTN 5 ]~~>> BUTTONS / STICK --- Pinkie
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# > > > > BUTTONS / THROTTLE
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ~~[ THROTTLE / BTN 7 ]~~>> BUTTONS / THROTTLE --- TOP
# ~~[ THROTTLE / BTN 6 ]~~>> BUTTONS / THROTTLE --- MIDDLE
x52_pro.button(6).map_to(
action(
label = "VKB T-Rudder T-Link", # Differential brakes
joy_modifiers = (),
command = vjoy(4).button(0)
)
)
# ~~[ THROTTLE / BTN 30 ]~~>> BUTTONS / THROTTLE --- BOTTOM
# ~~[ THROTTLE / BTN 15 ]~~>> BUTTONS / THROTTLE --- Mouse Click BOTTOM
x52_pro.button(15).map_to(
action(
label = "OpenTrack Recenter",
joy_modifiers = (),
command = (
vjoy(0).button(0)
)
),
action(
label = "OpenTrack Freeze",
joy_modifiers = (modifier_pinkie),
command = vjoy(0).button(1)
)
)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# > > > > BUTTONS / THROTTLE MOUSE WHEEL
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ~~[ THROTTLE / WHEEL BTN 18 ]~~>> BUTTONS / THROTTLE MOUSE WHEEL --- DOWN
# ~~[ THROTTLE / WHEEL BTN 16 ]~~>> BUTTONS / THROTTLE MOUSE WHEEL --- SCROLL FWD
# ~~[ THROTTLE / WHEEL BTN 17 ]~~>> BUTTONS / THROTTLE MOUSE WHEEL --- SCROLL AFT
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# > > > > BUTTONS / THROTTLE MFD
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ~~[ THROTTLE / MFD BTN 31 ]~~>> BUTTONS / THROTTLE MFD --- Left Wheel DOWN
# ~~[ THROTTLE / MFD BTN 34 ]~~>> BUTTONS / THROTTLE MFD --- Left Wheel SCROLL FWD
# ~~[ THROTTLE / MFD BTN 35 ]~~>> BUTTONS / THROTTLE MFD --- Left Wheel SCROLL AFT
# ~~[ THROTTLE / MFD BTN 32 ]~~>> BUTTONS / THROTTLE MFD --- CENTER TOP
# ~~[ THROTTLE / MFD BTN 33 ]~~>> BUTTONS / THROTTLE MFD --- CENTER BOTTOM
# ~~[ THROTTLE / MFD BTN 38 ]~~>> BUTTONS / THROTTLE MFD --- Right Wheel DOWN
# ~~[ THROTTLE / MFD BTN 36 ]~~>> BUTTONS / THROTTLE MFD --- Right Wheel FWD
# ~~[ THROTTLE / MFD BTN 37 ]~~>> BUTTONS / THROTTLE MFD --- Right Wheel AFT
#* ///////////////////////////////////////////////////////////////////////////////
#* //
#* // SWITCHES
#* //
#* ///////////////////////////////////////////////////////////////////////////////
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# > > > > SWITCHES / STICK
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ~~[ STICK / SWITCH BTN 8 ]~~>> SWITCHES / STICK --- LEFT FWD
# ~~[ STICK / SWITCH BTN 9 ]~~>> SWITCHES / STICK --- LEFT AFT
# ~~[ STICK / SWITCH BTN 10 ]~~>> SWITCHES / STICK --- CENTER FWD
# ~~[ STICK / SWITCH BTN 11 ]~~>> SWITCHES / STICK --- CENTER AFT
# ~~[ STICK / SWITCH BTN 12 ]~~>> SWITCHES / STICK --- RIGHT FWD
# ~~[ STICK / SWITCH BTN 13 ]~~>> SWITCHES / STICK --- RIGHT AFT
#* ///////////////////////////////////////////////////////////////////////////////
#* //
#* // POVS
#* //
#* ///////////////////////////////////////////////////////////////////////////////
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# > > > > POV / STICK [TOP LEFT | 4-Way]
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ~~[ STICK / POV BTN 19 ]~~>> POV / STICK [TOP LEFT | 4-Way] --- Hat FWD
x52_pro.button(19).map_to(
action(
label = "SRS Radio Bind",
joy_modifiers = (modifier_clutch),
command = vjoy(0).button(11)
)
)
# ~~[ STICK / POV BTN 20 ]~~>> POV / STICK [TOP LEFT | 4-Way] --- Hat RIGHT
x52_pro.button(20).map_to(
action(
label = "SRS Radio Bind",
joy_modifiers = (modifier_clutch),
command = vjoy(0).button(12)
)
)
# ~~[ STICK / POV BTN 21 ]~~>> POV / STICK [TOP LEFT | 4-Way] --- Hat AFT
x52_pro.button(21).map_to(
action(
label = "SRS Radio Bind",
joy_modifiers = (modifier_clutch),
command = vjoy(0).button(13)
)
)
# ~~[ STICK / POV BTN 22 ]~~>> POV / STICK [TOP LEFT | 4-Way] --- Hat LEFT
x52_pro.button(22).map_to(
action(
label = "SRS Radio Bind",
joy_modifiers = (modifier_clutch),
command = vjoy(0).button(10)
)
)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# > > > > POV / STICK [BOTTOM CENTER - 8-Way]
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ~~[ STICK / POV 0 | N ]~~ POV / STICK [BOTTOM CENTER - 8-Way] --- North
# ~~[ STICK / POV 0 | NE ]~~ POV / STICK [BOTTOM CENTER - 8-Way] --- Northeast
# ~~[ STICK / POV 0 | E ]~~ POV / STICK [BOTTOM CENTER - 8-Way] --- East
# ~~[ STICK / POV 0 | SE ]~~ POV / STICK [BOTTOM CENTER - 8-Way] --- Southeast
# ~~[ STICK / POV 0 | S ]~~ POV / STICK [BOTTOM CENTER - 8-Way] --- South
# ~~[ STICK / POV 0 | SW ]~~ POV / STICK [BOTTOM CENTER - 8-Way] --- Southwest
# ~~[ STICK / POV 0 | W ]~~ POV / STICK [BOTTOM CENTER - 8-Way] --- West
# ~~[ STICK / POV 0 | NW ]~~ POV / STICK [BOTTOM CENTER - 8-Way] --- Northwest
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# > > > > POV / THROTTLE [TOP | 4-Way]
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ~~[ THROTTLE / POV BTN 25 ]~~>> POV / THROTTLE [TOP | 4-Way] --- Hat FWD
# ~~[ THROTTLE / POV BTN 24 ]~~>> POV / THROTTLE [TOP | 4-Way] --- Hat RIGHT
# ~~[ THROTTLE / POV BTN 23 ]~~>> POV / THROTTLE [TOP | 4-Way] --- Hat AFT
# ~~[ THROTTLE / POV BTN 26 ]~~>> POV / THROTTLE [TOP | 4-Way] --- Hat LEFT
#* ///////////////////////////////////////////////////////////////////////////////
#* //
#* // AXES
#* //
#* ///////////////////////////////////////////////////////////////////////////////
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# > > > > AXES / STICK
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#stick_deadzone = 2.3
stick_deadzone = 0
stick_curve = Filter.Curve(
max_value = joy_axis_max,
deadzone = stick_deadzone,
saturation_x = 100,
saturation_y = 100,
curvature = 0
)
# ~~[ STICK / AXIS X ]~~
x52_pro.axis('x').map_to(
vjoy(0).axis('x').filtered_with(
curve_filters = (
stick_curve
)
)
)
# ~~[ STICK / AXIS Y ]~~
x52_pro.axis('y').map_to(
vjoy(0).axis('y').filtered_with(
curve_filters = (
stick_curve
)
)
)
# ~~[ STICK / AXIS RZ ]~~
x52_pro.axis('rz').map_to(
vjoy(0).axis('rz').filtered_with(
curve_filters = (
Filter.MinMax(-1 * joy_axis_max, 1 * joy_axis_max)
)
)
)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# > > > > AXES / THROTTLE
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ~~[ THROTTLE / AXIS Z ]~~
x52_pro.axis('z').map_to(
vjoy(0).axis('z')
)
# ~~[ THROTTLE / AXIS RX ]~~
x52_pro.axis('rx').map_to(
vjoy(0).axis('rx')
)
# ~~[ THROTTLE / AXIS RY ]~~
x52_pro.axis('ry').map_to(
vjoy(0).axis('ry')
)
# ~~[ THROTTLE / AXIS SLIDER1 ]~~
x52_pro.axis('slider1').map_to(
vjoy(0).axis('slider1').filtered_with(
invert = True,
curve_filters = (
Filter.Kalman(
process_noise = 0.001,
sensor_noise = 10000000,
estimated_error = 100,
radius = 0.04 * joy_axis_max,
delay_radius_count = 17
),
# Filter.LowPass(
# smoothing_factor = 0.000001,
# radius = 0.035 * joy_axis_max
# ),
Filter.MinMax(-1 * joy_axis_max, 0.5 * joy_axis_max)
)
)
)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# > > > > AXES / REGISTRY HACK
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# The following axis doesn't physically exist on the x52 pro.
# However a registry hack allows it to virtually exist (e.g. by mapping one mouse mini-stick axis to it).
# ~~[ REGISTRY HACK / AXIS SLIDER2 ]~~
x52_pro.axis('slider2').map_to(
vjoy(0).axis('slider2').filtered_with(
invert = True,
curve_filters = (
Filter.MinMax(-1 * joy_axis_max, 1 * joy_axis_max)
)
)
)
return x52_pro