-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhotas_map.py
executable file
·1894 lines (1730 loc) · 53.2 KB
/
hotas_map.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
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/env python3
"""
Image sources (see also info message):
https://forums.eagle.ru/showthread.php?t=102016
Other's efforts:
https://github.com/subn3t/warthog
... at http://subn3t.com/warthog/ -- doesn't do all the keys!
VERSION HISTORY
* 2015-02-08
- Word wrap.
* 2015-02-07
- Created.
* 2016-04-10
- PyCharm code cleanup.
* 2018-01-21
- Better documentation.
* 2020-12-27
- Type hinting.
- Label axes more clearly (per Windows drivers).
- Python 3.7 requirement, for dataclass.
- Title/subtitle.
- Option to print blank template.
- Script files for convenience.
- Added demo Elite and JSON files.
- Star Wars: Squadrons specimen (as JSON).
* 2023-01-01
- Give text a bit more room.
"""
# =============================================================================
# Imports
# =============================================================================
import argparse
from dataclasses import dataclass
from enum import Enum
import json
import logging
import os
import re
from xml.etree import ElementTree
import sys
from typing import Any, Dict, List, Literal, Optional, Tuple
from cardinal_pythonlib.argparse_func import (
RawDescriptionArgumentDefaultsHelpFormatter,
) # noqa
from cardinal_pythonlib.enumlike import keys_descriptions_from_enum
from PIL import ( # install with "pip install pillow" but import as PIL
Image,
ImageDraw,
ImageFont,
)
log = logging.getLogger(__name__)
# =============================================================================
# Paths
# =============================================================================
THIS_DIR = os.path.dirname(os.path.abspath(__file__))
OUTPUT_DIR = os.path.join(THIS_DIR, "output")
TEMPLATE_DIR = os.path.join(THIS_DIR, "templates")
# =============================================================================
# Defaults
# =============================================================================
DEFAULT_JOYSTICK_TEMPLATE = os.path.join(
TEMPLATE_DIR, "TEMPLATE_tmw_joystick.png"
)
DEFAULT_THROTTLE_TEMPLATE = os.path.join(
TEMPLATE_DIR, "TEMPLATE_tmw_throttle.png"
)
DEFAULT_JOYSTICK_OUTPUT = os.path.join(OUTPUT_DIR, "output_joystick.png")
DEFAULT_THROTTLE_OUTPUT = os.path.join(OUTPUT_DIR, "output_throttle.png")
DEFAULT_COMPOSITE_OUTPUT = os.path.join(OUTPUT_DIR, "output_composite.png")
DEFAULT_TRUETYPE_FILE = "Arial.ttf"
# Slightly clearer than Arial_Bold.ttf?
DEFAULT_RGB_TITLE = "0,100,0" # dark green
DEFAULT_RGB_ANALOGUE = "177,97,0" # very dark orange
DEFAULT_RGB_MOMENTARY = "0,0,255" # blue
DEFAULT_RGB_STICKY = "255,0,0" # red
# The one that should be most visible is DEFAULT_RGB_MOMENTARY, which accounts
# for most of the switches, and which you're most likely to be hunting for in
# semi-darkness. Then, the contrast between "momentary" and "sticky" matters
# more than analogue, which is usually obvious physically.
DEFAULT_ED_STICK = "ThrustMasterWarthogJoystick"
DEFAULT_ED_THROTTLE = "ThrustMasterWarthogThrottle"
DEFAULT_ED_MFG_CROSSWIND_NAME = "16D00A38" # always this value or not?
# =============================================================================
# Other constants
# =============================================================================
MFG_CROSSWIND_NAME = "mfg_crosswind_pedals"
RECT_OUTLINE = (0, 0, 0)
RECT_FILL = (240, 240, 240)
ANALOGUE = "~"
MOMENTARY = "."
STICKY = "+"
# =============================================================================
# Devices, with mappings to picture coordinates, Elite Dangerous switch names,
# etc.
# =============================================================================
# -----------------------------------------------------------------------------
# Thrustmaster HOTAS Warthog: joystick
# -----------------------------------------------------------------------------
TMW_STICK_NAME = "thrustmaster_warthog_joystick"
J_WIDTH = 192 # reference: TrimHat_Up
J_XWIDE = J_WIDTH + 10 # common extra width
J_HEIGHT = 55 # reference: TrimHat_Up
# Labels on left-hand side:
WEP_L = 273 # _L: left coordinate
WEP_T = 337 # _T: top coordinate
TMS_L1 = 60
TMS_L2 = 241
TMS_L3 = 416
TMS_T1 = 498
TMS_T2 = 600
TMS_T3 = 705
CMS_L1 = 60
CMS_L2 = 80
CMS_L3 = 240
CMS_L4 = 324
CMS_L5 = 420
CMS_T1 = 1042
CMS_T2 = 1144
CMS_T3 = 1249
CMS_T4 = 1260
STICK_L1 = 39
STICK_L2 = 189
STICK_L3 = 213
STICK_L4 = 377
STICK_T1 = 1375
STICK_T2 = 1592
STICK_T3 = 1604
STICK_T4 = 1710
# Labels on right-hand side:
TRIMHAT_L1 = 909
TRIMHAT_L2 = 940
TRIMHAT_L3 = 1146
TRIMHAT_L4 = 1350
TRIMHAT_L5 = 1375
TRIMHAT_T1 = 103
TRIMHAT_T2 = 164
TRIMHAT_T3 = 250
TRIMHAT_T4 = 326
TRIMHAT_T5 = 397
MMC_L = 1222
MMC_T = 556
DMS_L1 = 1003
DMS_L2 = 1183
DMS_L3 = 1360
DMS_T1 = 727
DMS_T2 = 830
DMS_T3 = 935
GUNGROUP_L1 = 723
GUNGROUP_L2 = 770
GUNGROUP_L3 = 1308
GUNGROUP_L4 = 1342
GUNGROUP_T1 = 1738
GUNGROUP_T2 = 1863
GUNGROUP_T3 = 1868
GUNGROUP_T4 = 1982
TMW_STICK_MAP = {
# Dictionary attributes:
# l, t = left, top edge of text box
# w, h = width, height of text box
# ed = Elite Dangerous key name
# type = '~' analogue, '.' momentary switch, '+' sticky switch
# overall image size is 1625 x 2201
"Stick_Forward": dict(
l=STICK_L3,
t=STICK_T1,
w=J_XWIDE,
h=J_HEIGHT,
ed="Joy_YAxis",
type=ANALOGUE,
),
"Stick_Backward": dict(
l=STICK_L2,
t=STICK_T4,
w=J_XWIDE,
h=J_HEIGHT,
ed="Joy_YAxis",
type=ANALOGUE,
),
"Stick_Left": dict(
l=STICK_L1,
t=STICK_T2,
w=J_XWIDE,
h=J_HEIGHT,
ed="Joy_XAxis",
type=ANALOGUE,
),
"Stick_Right": dict(
l=STICK_L4,
t=STICK_T3,
w=J_XWIDE,
h=J_HEIGHT,
ed="Joy_XAxis",
type=ANALOGUE,
),
"TrimHat_Up": dict(
l=TRIMHAT_L3,
t=TRIMHAT_T1,
w=J_WIDTH,
h=J_HEIGHT,
ed="Joy_POV1Up",
type=MOMENTARY,
),
"TrimHat_Left": dict(
l=TRIMHAT_L1,
t=TRIMHAT_T3,
w=J_WIDTH,
h=J_HEIGHT,
ed="Joy_POV1Left",
type=MOMENTARY,
),
"TrimHat_Right": dict(
l=TRIMHAT_L5,
t=TRIMHAT_T3,
w=J_WIDTH,
h=J_HEIGHT,
ed="Joy_POV1Right",
type=MOMENTARY,
),
"TrimHat_Down": dict(
l=TRIMHAT_L3,
t=TRIMHAT_T5,
w=J_WIDTH,
h=J_HEIGHT,
ed="Joy_POV1Down",
type=MOMENTARY,
),
# Not sure these are actually valid
"TrimHat_UpLeft": dict(l=TRIMHAT_L2, t=TRIMHAT_T2, w=J_WIDTH, h=J_HEIGHT),
"TrimHat_UpRight": dict(l=TRIMHAT_L4, t=TRIMHAT_T2, w=J_WIDTH, h=J_HEIGHT),
"TrimHat_DownLeft": dict(
l=TRIMHAT_L2, t=TRIMHAT_T4, w=J_WIDTH, h=J_HEIGHT
),
"TrimHat_DownRight": dict(
l=TRIMHAT_L4, t=TRIMHAT_T4, w=J_WIDTH, h=J_HEIGHT
),
"S1_Trigger_FirstStage": dict(
l=GUNGROUP_L1,
t=GUNGROUP_T1,
w=J_XWIDE,
h=J_HEIGHT,
ed="Joy_1",
type=MOMENTARY,
),
"S2_WeaponsRelease": dict(
l=WEP_L,
t=WEP_T,
w=J_XWIDE,
h=J_HEIGHT,
ed="Joy_2",
type=MOMENTARY,
),
"S3_NSB": dict( # nosewheel steering button
l=GUNGROUP_L4,
t=GUNGROUP_T2,
w=J_XWIDE,
h=J_HEIGHT,
ed="Joy_3",
type=MOMENTARY,
),
"S4_PinkieLever": dict(
l=GUNGROUP_L3,
t=GUNGROUP_T4,
w=J_XWIDE,
h=J_HEIGHT,
ed="Joy_4",
type=MOMENTARY,
),
"S5_MMC": dict( # master mode control
l=MMC_L,
t=MMC_T,
w=J_XWIDE,
h=J_HEIGHT,
ed="Joy_5",
type=MOMENTARY,
),
"S6_Trigger_SecondStage": dict(
l=GUNGROUP_L2,
t=GUNGROUP_T3,
w=J_XWIDE,
h=J_HEIGHT,
ed="Joy_6",
type=MOMENTARY,
),
# Target management switch
"S7_TMS_Up": dict(
l=TMS_L2, t=TMS_T1, w=J_XWIDE, h=J_HEIGHT, ed="Joy_7", type=MOMENTARY
),
"S8_TMS_Right": dict(
l=TMS_L3, t=TMS_T2, w=J_WIDTH, h=J_HEIGHT, ed="Joy_8", type=MOMENTARY
),
"S9_TMS_Down": dict(
l=TMS_L2, t=TMS_T3, w=J_XWIDE, h=J_HEIGHT, ed="Joy_9", type=MOMENTARY
),
"S10_TMS_Left": dict(
l=TMS_L1, t=TMS_T2, w=J_XWIDE, h=J_HEIGHT, ed="Joy_10", type=MOMENTARY
),
# Data management switch
"S11_DMS_Up": dict(
l=DMS_L2, t=DMS_T1, w=J_XWIDE, h=J_HEIGHT, ed="Joy_11", type=MOMENTARY
),
"S12_DMS_Right": dict(
l=DMS_L3, t=DMS_T2, w=J_WIDTH, h=J_HEIGHT, ed="Joy_12", type=MOMENTARY
),
"S13_DMS_Down": dict(
l=DMS_L2, t=DMS_T3, w=J_XWIDE, h=J_HEIGHT, ed="Joy_13", type=MOMENTARY
),
"S14_DMS_Left": dict(
l=DMS_L1, t=DMS_T2, w=J_XWIDE, h=J_HEIGHT, ed="Joy_14", type=MOMENTARY
),
# Countermeasures management switch
"S15_CMS_Forward": dict(
l=CMS_L3, t=CMS_T1, w=J_XWIDE, h=J_HEIGHT, ed="Joy_15", type=MOMENTARY
),
"S16_CMS_Right": dict(
l=CMS_L5, t=CMS_T2, w=J_WIDTH, h=J_HEIGHT, ed="Joy_16", type=MOMENTARY
),
"S17_CMS_Backward": dict(
l=CMS_L2, t=CMS_T3, w=J_XWIDE, h=J_HEIGHT, ed="Joy_17", type=MOMENTARY
),
"S18_CMS_Left": dict(
l=CMS_L1, t=CMS_T2, w=J_XWIDE, h=J_HEIGHT, ed="Joy_18", type=MOMENTARY
),
"S19_CMS_Press": dict(
l=CMS_L4, t=CMS_T4, w=J_XWIDE, h=J_HEIGHT, ed="Joy_19", type=MOMENTARY
),
}
TMW_STICK_EXTRA_LABELS = [
dict(
text="X axis",
x=475,
y=1525 + J_HEIGHT / 2,
fontsize=20,
rgb=(0, 0, 0),
hjust=1,
vjust=0.5,
),
dict(
text="Y axis",
x=350,
y=1415 + J_HEIGHT / 2,
fontsize=20,
rgb=(0, 0, 0),
hjust=1,
vjust=0.5,
),
]
# -----------------------------------------------------------------------------
# Thrustmaster HOTAS Warthog: throttle
# -----------------------------------------------------------------------------
TMW_THROTTLE_NAME = "thrustmaster_warthog_throttle"
T_WIDTH = 162 # reference: S31_LeftEngineOperateUp
T_HEIGHT = 39 # reference: S31_LeftEngineOperateUp
T_IDLE_WIDTH = 114
T_IDLE_HEIGHT = 22
# Labels on the left-hand side of the box:
FLAPS_L = 205
FLAPS_T1 = 738
FLAPS_T2 = 792
EAC_L = 170
EAC_T = 1040
RDRALT_L = 345
RDRALT_T = 1230
# Labels on the right-hand side of the box:
FUEL_L1 = 650
FUEL_L2 = 875
FUEL_T = 67
ENG_L = 1339
ENG_T1 = 351
ENG_T2 = 408
ENG_T3 = 467
ENG_T4 = 525
APU_L = 1232
APU_T = 590
THFRICT_L = 1358
THFRICT_T = 692
GEARWARN_L = 1330
GEARWARN_T = 788
APILOT_L1 = 1036
APILOT_L2 = 1355
APILOT_T1 = 987
APILOT_T2 = EAC_T
APILOT_T3 = RDRALT_T
# Throttle, left:
COOLIE_L1 = 377
COOLIE_L2 = 395
COOLIE_L3 = 550
COOLIE_L4 = 710
COOLIE_L5 = 725
# Not exactly aligned, but very close:
COOLIE_T1 = 1315
COOLIE_T2 = 1367
COOLIE_T3 = 1425
COOLIE_T4 = 1482
COOLIE_T5 = 1536
THUMBHAT_L1 = 113
THUMBHAT_L2 = 125
THUMBHAT_L3 = 228
THUMBHAT_L4 = 280
THUMBHAT_L5 = 342
THUMBHAT_W = 130
THUMBHAT_NARROW = THUMBHAT_W - 7
THUMBHAT_T1 = 1565
THUMBHAT_T2 = 1630
THUMBHAT_T3 = 1697
THUMBHAT_T4 = 1704
THUMBHAT_H = 35
BRAKEGROUP_L = 227
BRAKEGROUP_W = 148
BRAKEGROUP_T1 = 1756
BRAKEGROUP_T2 = 1801
BRAKEGROUP_T3 = 1854
BRAKEGROUP_T4 = 1900
BRAKEGROUP_T5 = 1953
BRAKEGROUP_T6 = 1999
BRAKEGROUP_H = 35
# Throttle, right:
SLEW_L1 = 954
SLEW_L2 = 1056
SLEW_L3 = 1156
SLEW_T1 = 1330
SLEW_T2 = 1440
SLEW_T3 = 1567
SLEW_MOUSE_W = J_XWIDE
SLEW_MOUSE_H = J_HEIGHT
THBUT_L = 1346
THBUT_T = 1522
PINKY_L = 1392
PINKY_T1 = 1897
PINKY_T2 = 1960
# Throttle, bottom:
THLEVER_L1 = 580
THLEVER_L2 = 1115
THLEVER_W = J_XWIDE
THLEVER_T = 2130
THLEVER_H = J_HEIGHT
TMW_THROTTLE_MAP = {
# overall image size is 1625 x 2201
"LeftThrottle": dict(
l=THLEVER_L2,
t=THLEVER_T,
w=THLEVER_W,
h=THLEVER_H,
ed="Joy_RZAxis",
type=ANALOGUE,
),
"RightThrottle": dict(
l=THLEVER_L1,
t=THLEVER_T,
w=THLEVER_W,
h=THLEVER_H,
ed="Joy_ZAxis",
type=ANALOGUE,
),
"CoolieSwitchUp": dict(
l=COOLIE_L3,
t=COOLIE_T1,
w=T_WIDTH,
h=T_HEIGHT,
ed="Joy_POV1Up",
type=MOMENTARY,
),
"CoolieSwitchDown": dict(
l=COOLIE_L3,
t=COOLIE_T5,
w=T_WIDTH,
h=T_HEIGHT,
ed="Joy_POV1Down",
type=MOMENTARY,
),
"CoolieSwitchLeft": dict(
l=COOLIE_L5,
t=COOLIE_T3,
w=T_WIDTH,
h=T_HEIGHT,
ed="Joy_POV1Left",
type=MOMENTARY,
),
"CoolieSwitchRight": dict(
l=COOLIE_L1,
t=COOLIE_T3,
w=T_WIDTH,
h=T_HEIGHT,
ed="Joy_POV1Right",
type=MOMENTARY,
),
"CoolieSwitchUpLeft": dict(
l=COOLIE_L4, t=COOLIE_T2, w=T_WIDTH, h=T_HEIGHT
),
"CoolieSwitchUpRight": dict(
l=COOLIE_L2, t=COOLIE_T2, w=T_WIDTH, h=T_HEIGHT
),
"CoolieSwitchDownLeft": dict(
l=COOLIE_L4, t=COOLIE_T4, w=T_WIDTH, h=T_HEIGHT
),
"CoolieSwitchDownRight": dict(
l=COOLIE_L2, t=COOLIE_T4, w=T_WIDTH, h=T_HEIGHT
),
"ThrottleFrictionControl": dict(
l=THFRICT_L,
t=THFRICT_T,
w=T_WIDTH,
h=T_HEIGHT,
ed="Joy_UAxis",
type=ANALOGUE,
),
"SlewControl_LeftRight": dict(
l=SLEW_L3,
t=SLEW_T2,
w=SLEW_MOUSE_W,
h=SLEW_MOUSE_H,
ed="Joy_XAxis",
type=ANALOGUE,
),
"SlewControl_UpDown": dict(
l=SLEW_L2,
t=SLEW_T1,
w=SLEW_MOUSE_W,
h=SLEW_MOUSE_H,
ed="Joy_YAxis",
type=ANALOGUE,
),
"S1_SlewControl_Press": dict(
l=SLEW_L1, t=SLEW_T3, w=T_WIDTH, h=T_HEIGHT, ed="Joy_1", type=MOMENTARY
),
"S2_ThumbHat_Press": dict(
l=THUMBHAT_L4,
t=THUMBHAT_T4,
w=THUMBHAT_W,
h=THUMBHAT_H,
ed="Joy_2",
type=MOMENTARY,
),
"S3_ThumbHat_Up": dict(
l=THUMBHAT_L3,
t=THUMBHAT_T1,
w=THUMBHAT_W,
h=THUMBHAT_H,
ed="Joy_3",
type=MOMENTARY,
),
"S4_ThumbHat_Forward": dict(
l=THUMBHAT_L5,
t=THUMBHAT_T2,
w=THUMBHAT_NARROW,
h=THUMBHAT_H,
ed="Joy_4",
type=MOMENTARY,
),
"S5_ThumbHat_Down": dict(
l=THUMBHAT_L2,
t=THUMBHAT_T3,
w=THUMBHAT_W,
h=THUMBHAT_H,
ed="Joy_5",
type=MOMENTARY,
),
"S6_ThumbHat_Backward": dict(
l=THUMBHAT_L1,
t=THUMBHAT_T2,
w=THUMBHAT_W,
h=THUMBHAT_H,
ed="Joy_6",
type=MOMENTARY,
),
"S7_Speedbrake_Forward": dict(
l=BRAKEGROUP_L,
t=BRAKEGROUP_T1,
w=BRAKEGROUP_W,
h=BRAKEGROUP_H,
ed="Joy_7",
type=STICKY,
),
"S8_Speedbrake_Backward": dict(
l=BRAKEGROUP_L,
t=BRAKEGROUP_T2,
w=BRAKEGROUP_W,
h=BRAKEGROUP_H,
ed="Joy_8",
type=MOMENTARY,
),
"S9_BoatSwitch_Forward": dict(
l=BRAKEGROUP_L,
t=BRAKEGROUP_T3,
w=BRAKEGROUP_W,
h=BRAKEGROUP_H,
ed="Joy_9",
type=STICKY,
),
"S10_BoatSwitch_Backward": dict(
l=BRAKEGROUP_L,
t=BRAKEGROUP_T4,
w=BRAKEGROUP_W,
h=BRAKEGROUP_H,
ed="Joy_10",
type=STICKY,
),
"S11_ChinaHat_Forward": dict(
l=BRAKEGROUP_L,
t=BRAKEGROUP_T5,
w=BRAKEGROUP_W,
h=BRAKEGROUP_H,
ed="Joy_11",
type=MOMENTARY,
),
"S12_ChinaHat_Backward": dict(
l=BRAKEGROUP_L,
t=BRAKEGROUP_T6,
w=BRAKEGROUP_W,
h=BRAKEGROUP_H,
ed="Joy_12",
type=MOMENTARY,
),
"S13_PinkieSwitch_Forward": dict(
l=PINKY_L, t=PINKY_T1, w=T_WIDTH, h=T_HEIGHT, ed="Joy_13", type=STICKY
),
"S14_PinkieSwitch_Backward": dict(
l=PINKY_L, t=PINKY_T2, w=T_WIDTH, h=T_HEIGHT, ed="Joy_14", type=STICKY
),
"S15_LeftThrottleButton": dict(
l=THBUT_L,
t=THBUT_T,
w=T_WIDTH,
h=T_HEIGHT,
ed="Joy_15",
type=MOMENTARY,
),
"S16_LeftEngineFuelFlow": dict(
l=FUEL_L1, t=FUEL_T, w=T_WIDTH, h=T_HEIGHT, ed="Joy_16", type=STICKY
),
"S17_RightEngineFuelFlow": dict(
l=FUEL_L2, t=FUEL_T, w=T_WIDTH, h=T_HEIGHT, ed="Joy_17", type=STICKY
),
"S18_LeftEngineOperateDown": dict(
l=ENG_L, t=ENG_T2, w=T_WIDTH, h=T_HEIGHT, ed="Joy_18", type=STICKY
),
"S19_RightEngineOperateDown": dict(
l=ENG_L, t=ENG_T4, w=T_WIDTH, h=T_HEIGHT, ed="Joy_19", type=STICKY
),
"S20_APUStart": dict( # APU = auxiliary power unit
l=APU_L, t=APU_T, w=T_WIDTH, h=T_HEIGHT, ed="Joy_20", type=STICKY
),
"S21_LandingGearWarningSilence": dict(
l=GEARWARN_L,
t=GEARWARN_T,
w=T_WIDTH,
h=T_HEIGHT,
ed="Joy_21",
type=MOMENTARY,
),
"S22_FlapsUp": dict(
l=FLAPS_L, t=FLAPS_T1, w=T_WIDTH, h=T_HEIGHT, ed="Joy_22", type=STICKY
),
"S23_FlapsDown": dict(
l=FLAPS_L, t=FLAPS_T2, w=T_WIDTH, h=T_HEIGHT, ed="Joy_23", type=STICKY
),
"S24_EAC": dict( # Enhanced Attitude Control
l=EAC_L, t=EAC_T, w=T_WIDTH, h=T_HEIGHT, ed="Joy_24", type=STICKY
),
"S25_RadarAltimeter": dict(
l=RDRALT_L, t=RDRALT_T, w=T_WIDTH, h=T_HEIGHT, ed="Joy_25", type=STICKY
),
"S26_AutopilotEngageDisengage": dict(
l=APILOT_L1,
t=APILOT_T3,
w=T_WIDTH,
h=T_HEIGHT,
ed="Joy_26",
type=MOMENTARY,
),
"S27_AutopilotMode_Up": dict(
l=APILOT_L2,
t=APILOT_T1,
w=T_WIDTH,
h=T_HEIGHT,
ed="Joy_27",
type=STICKY,
),
"S28_AutopilotMode_Down": dict(
l=APILOT_L2,
t=APILOT_T2,
w=T_WIDTH,
h=T_HEIGHT,
ed="Joy_28",
type=STICKY,
),
"S29_RightEngineIdle": dict(
l=569, t=713, w=T_IDLE_WIDTH, h=T_IDLE_HEIGHT, ed="Joy_29", type=STICKY
),
"S30_LeftEngineIdle": dict(
l=787, t=713, w=T_IDLE_WIDTH, h=T_IDLE_HEIGHT, ed="Joy_30", type=STICKY
),
"S31_LeftEngineOperateUp": dict(
l=ENG_L, t=ENG_T1, w=T_WIDTH, h=T_HEIGHT, ed="Joy_31", type=MOMENTARY
),
"S32_RightEngineOperateUp": dict(
l=ENG_L, t=ENG_T3, w=T_WIDTH, h=T_HEIGHT, ed="Joy_32", type=MOMENTARY
),
}
TMW_THROTTLE_EXTRA_LABELS = [
dict(
text="(Z axis)", # right throttle (shown on the left)
x=565,
y=2115,
fontsize=20,
rgb=(0, 0, 0),
hjust=1,
vjust=0.5,
),
dict(
text="(Z rotation)", # left throttle (shown on the right)
x=1320,
y=2115,
fontsize=20,
rgb=(0, 0, 0),
hjust=0,
vjust=0.5,
),
]
# -----------------------------------------------------------------------------
# MFG Crosswind rudder pedals
# -----------------------------------------------------------------------------
PEDAL_LABEL_L = 300
PEDAL_L = 325
PEDAL_T1 = 1850
PEDAL_T2 = 1925
PEDAL_T3 = 2000
MFG_CROSSWIND_MAP = {
# These are specials from the MFG Crosswind:
"Rudder": dict(
l=PEDAL_L,
t=PEDAL_T1,
w=J_XWIDE,
h=J_HEIGHT,
hjust=0,
ed="Joy_RZAxis",
type=ANALOGUE,
),
"LeftFootbrake": dict(
l=PEDAL_L,
t=PEDAL_T2,
w=J_XWIDE,
h=J_HEIGHT,
hjust=0,
ed="Joy_XAxis",
type=ANALOGUE,
),
"RightFootbrake": dict(
l=PEDAL_L,
t=PEDAL_T3,
w=J_XWIDE,
h=J_HEIGHT,
hjust=0,
ed="Joy_YAxis",
type=ANALOGUE,
),
}
CROSSWIND_EXTRA_LABELS = [
dict(
text="Pedals: Rudder\n(Z rotation, L←|→R)",
x=PEDAL_LABEL_L,
y=PEDAL_T1 + J_HEIGHT / 2,
fontsize=20,
rgb=(0, 0, 0),
hjust=1,
vjust=0.5,
),
dict(
text="Pedals: Left footbrake\n(X axis)",
x=PEDAL_LABEL_L,
y=PEDAL_T2 + J_HEIGHT / 2,
fontsize=20,
rgb=(0, 0, 0),
hjust=1,
vjust=0.5,
),
dict(
text="Pedals: Right footbrake\n(Y axis)",
x=PEDAL_LABEL_L,
y=PEDAL_T3 + J_HEIGHT / 2,
fontsize=20,
rgb=(0, 0, 0),
hjust=1,
vjust=0.5,
),
]
# =============================================================================
# Map E:D labels to human
# =============================================================================
ED_LABEL_MAP = {
"AheadThrust_Landing": "Ldg/Thrust fwd/back",
"AheadThrust": "Thrust fwd/back",
"BackwardKey": "Backward",
"BackwardThrustButton_Landing": "Ldg/Thrust back",
"BackwardThrustButton": "Thrust back",
"CamPitchAxis": "Cam. pitch",
"CamPitchDown": "Cam. pitch down",
"CamPitchUp": "Cam. pitch up",
"CamTranslateBackward": "Cam. backward",
"CamTranslateDown": "Cam. xlate down",
"CamTranslateForward": "Cam. forward",
"CamTranslateLeft": "Cam. xlate L",
"CamTranslateRight": "Cam. xlate R",
"CamTranslateUp": "Cam. xlate up",
"CamTranslateXAxis": "Cam. xlate L/R",
"CamTranslateYAxis": "Cam. xlate fwd/back", # *** check
"CamTranslateZAxis": "Cam. xlate up/down",
"CamTranslateZHold": "Cam. xlate Z hold",
"CamYawAxis": "Cam. yaw",
"CamYawLeft": "Cam. yaw L",
"CamYawRight": "Cam. yaw R",
"CamZoomAxis": "Cam. zoom",
"CamZoomIn": "Cam. zoom in",
"CamZoomOut": "Cam. zoom out",
"CycleFireGroupNext": "Next firegroup",
"CycleFireGroupPrevious": "Prev. firegroup",
"CycleNextHostileTarget": "Next hostile target",
"CycleNextPanel": "UI next panel",
"CycleNextSubsystem": "Next target subsyst.",
"CycleNextTarget": "Next target",
"CyclePreviousHostileTarget": "Prev. hostile target",
"CyclePreviousPanel": "UI prev. panel",
"CyclePreviousSubsystem": "Prev. target subsyst.",
"CyclePreviousTarget": "Prev. target",
"DeployHardpointToggle": "Hardpoints ±",
"DeployHeatSink": "Heatsink",
"DisableRotationCorrectToggle": "Rotat. correction",
"DownThrustButton_Landing": "Ldg/Thrust down",
"DownThrustButton": "Thrust down",
"EjectAllCargo": "Eject cargo",
"FireChaffLauncher": "Chaff",
"FocusCommsPanel": "UI COMMS panel",
"FocusLeftPanel": "UI LEFT panel",
"FocusRadarPanel": "UI RADAR panel",
"FocusRightPanel": "UI RIGHT panel",
"ForwardKey": "Forward",
"ForwardThrustButton_Landing": "Ldg/Thrust fwd",
"GalaxyMapOpen": "Galaxy map",
"HeadLookPitchAxisRaw": "Headlook up/down",
"HeadLookPitchDown": "Headlook down",
"HeadLookPitchUp": "Headlook up",
"HeadLookReset": "Reset headlook",
"HeadLookToggle": "Headlook ±",
"HeadLookYawAxis": "Headlook L/R",
"HeadLookYawLeft": "Headlook L",
"HeadLookYawRight": "Headlook R",
"HMDReset": "Reset VR orientation", # *** I think
"HyperSuperCombination": "Frame Shift Drive ±",
"IncreaseEnginesPower": "Pwr→ENGINES",
"IncreaseSystemsPower": "Pwr→SYSTEMS",
"IncreaseWeaponsPower": "Pwr→WEAPONS",
"LandingGearToggle": "Landing gear ±",
"LateralThrustAlternate": "Lateral thrust (ALT)",
"LateralThrust_Landing": "Ldg/Lateral thrust",
"LateralThrustRaw": "Lateral thrust",
"LeftThrustButton_Landing": "Ldg/Thrust L",
"LeftThrustButton": "Thrust L",
"MicrophoneMute": "Mic. mute",
"OrbitLinesToggle": "Orbit lines ±",
"PhotoCameraToggle": "Camera view ±",
"PitchAxisAlternate": "Pitch (ALT)",
"PitchAxis_Landing": "Ldg/Pitch",
"PitchAxisRaw": "Pitch",
"PitchDownButton_Landing": "Ldg/Pitch down",
"PitchDownButton": "Pitch down",
"PitchUpButton_Landing": "Ldg/Pitch up",
"PitchUpButton": "Pitch up",
"PrimaryFire": "Fire 1",
"QuickCommsPanel": "Quick comms",
"RadarDecreaseRange": "Radar +",
"RadarIncreaseRange": "Radar –",
"RadarRangeAxis": "Radar range",
"ResetPowerDistribution": "Balance pwr distrib.",
"RightThrustButton_Landing": "Ldg/Thrust R",
"RightThrustButton": "Thrust R",
"RollAxisAlternate": "Roll (ALT)",
"RollAxis_Landing": "Ldg/Roll",
"RollAxisRaw": "Roll",
"RollLeftButton_Landing": "Ldg/Roll L",
"RollLeftButton": "Roll L",
"RollRightButton_Landing": "Ldg/Roll R",
"RollRightButton": "Roll R",
"SecondaryFire": "Fire 2",
"SelectHighestThreat": "Highest threat",
"SelectTargetsTarget": "Target's target",
"SelectTarget": "Target ahead",
"SetSpeed100": "Speed 100%",
"SetSpeed25": "Speed 25%",
"SetSpeed50": "Speed 50%",
"SetSpeed75": "Speed 75%",
"SetSpeedMinus100": "Speed –100%",
"SetSpeedMinus25": "Speed –25%",
"SetSpeedMinus50": "Speed –50%",
"SetSpeedMinus75": "Speed –75%",
"SetSpeedZero": "Speed 0%",
"ShipSpotLightToggle": "Lights ±",
"ShowPGScoreSummaryInput": "ShowPGScoreSummaryInput", # *** ??
"SystemMapOpen": "System map",
"TargetNextRouteSystem": "Next system in route",
"TargetWingman0": "Wingman 1",
"TargetWingman1": "Wingman 2",
"TargetWingman2": "Wingman 3",
"ThrottleAxis": "Throttle",
"ToggleButtonUpInput": "Silent running",
"ToggleCargoScoop": "Cargo scoop",
"ToggleFlightAssist": "Flight Assist",
"ToggleReverseThrottleInput": "Reverse throttle",
"UI_Back": "UI back",
"UI_Down": "UI down",
"UIFocus": "UI focus",
"UI_Left": "UI left",
"UI_Right": "UI right",
"UI_Select": "UI select",
"UI_Up": "UI up",
"UpThrustButton_Landing": "Ldg/Thrust up",
"UpThrustButton": "Thrust up",