Debian Codegraph @

Input/Joysticks/Saitek/Aviator.xml

raw symbols SCIP
1 <?xml version="1.0" ?>
2 <?xml-stylesheet type="text/xsl" href="joystick.xsl"?>
3 <!-- Saitek AV8R/Aviator
4
5 Copyright (C) 2007 - 2012 Anders Gidenstam (anders(at)gidenstam.org)
6 This file is released under the GPL license v2 or later.
7 -->
8 <PropertyList>
9
10 <name type="string">Saitek AV8R Joystick</name>
11 <name type="string">Saitek AV8R Classic Stick</name>
12 <name type="string">Saitek Aviator Stick</name>
13
14 <nasal>
15 <script>
16 <![CDATA[
17 var self = cmdarg().getParent();
18 var data = self.getNode("data");
19 var modifier = 0;
20 var engine_select_mode = 0;
21 # TM0: All selected; TM1: #1 & #2; TM2: #3 & #4
22 var engine_axis_mode = 0;
23 # Valid only in TM1 and TM2.
24 # EA0: throttle
25 # EA1: mixture
26 # EA2: propeller
27 var quick_view_active = 0;
28 var old_view = view.point.save();
29 var pressed = [0,0,0,0,0,0,0,0,0,0,0,0];
30 # Map engines to throttles for TM1 (0, 1) and TM2 (2, 3)
31 var engine = [0, 1, 2, 3];
32
33 # Do per-aircraft modifications
34 if (contains({"Aircraft/Short_Empire/Models/Short_Empire-model.xml" : 0,
35 "Aircraft/Lockheed1049/Models/Lockheed1049_twa.xml" : 0},
36 getprop("/sim/model/path"))) {
37 # TM1: the outer engines, TM2: the inner engines
38 engine = [0, 3, 1, 2];
39 }
40 if (contains({"Aircraft/DO-X/Models/dox.xml" : 0},
41 getprop("/sim/model/path"))) {
42 engine = [[0, 1, 2, 3, 4, 5], [6, 7, 8, 9, 10, 11],
43 [0, 1, 2, 3, 4, 5], [6, 7, 8, 9, 10, 11]];
44 }
45
46
47 var goal_heading_offset =
48 props.globals.getNode("/sim/current-view/goal-heading-offset-deg", 1);
49 var goal_pitch_offset =
50 props.globals.getNode("/sim/current-view/goal-pitch-offset-deg", 1);
51
52 var headtracking = props.globals.getNode("/sim/headtracking/enabled", 1);
53
54 var kbdctrl = props.globals.getNode("/devices/status/keyboard/ctrl", 1);
55 var kbdalt = props.globals.getNode("/devices/status/keyboard/alt", 1);
56
57 var quick_view = func {
58 var dir = arg[0];
59 if (dir == 0) {
60 quick_view_active = 0;
61 view.point.move(old_view, 0.1);
62 headtracking.setIntValue(1);
63 } else {
64 if (quick_view_active == 0) {
65 quick_view_active = 1;
66 old_view = view.point.save();
67 headtracking.setIntValue(0);
68
69 if (dir == 1) {
70 goal_heading_offset.setDoubleValue
71 (getprop("/sim/view/config/left-direction-deg"));
72 goal_pitch_offset.setDoubleValue
73 (getprop("/sim/view/config/pitch-offset-deg"));
74 view.fovProp.setDoubleValue
75 (getprop("/sim/view/config/default-field-of-view-deg"));
76 } if (dir == 2) {
77 goal_heading_offset.setDoubleValue
78 (getprop("/sim/view/config/right-direction-deg"));
79 goal_pitch_offset.setDoubleValue
80 (getprop("/sim/view/config/pitch-offset-deg"));
81 view.fovProp.setDoubleValue
82 (getprop("/sim/view/config/default-field-of-view-deg"));
83 } if (dir == 3) {
84 goal_heading_offset.setDoubleValue
85 (getprop("/sim/view/config/front-direction-deg"));
86 goal_pitch_offset.setDoubleValue
87 (getprop("/sim/view/config/pitch-offset-deg"));
88 view.fovProp.setDoubleValue
89 (getprop("/sim/view/config/default-field-of-view-deg"));
90 } if (dir == 4) {
91 goal_heading_offset.setDoubleValue
92 (getprop("/sim/view/config/back-direction-deg"));
93 goal_pitch_offset.setDoubleValue
94 (getprop("/sim/view/config/pitch-offset-deg"));
95 view.fovProp.setDoubleValue
96 (getprop("/sim/view/config/default-field-of-view-deg"));
97 }
98 }
99 }
100 }
101
102 var trace = func(str) {
103 # Uncomment the line below to trace button presses.
104 #print("Aviator.xml: " ~ str);
105 }
106 ]]>
107 </script>
108 </nasal>
109
110 <!-- Analog axis 0. Aileron -->
111 <axis>
112 <name>Stick left/right</name>
113 <number>
114 <unix>0</unix>
115 <mac>0</mac>
116 <windows>0</windows>
117 </number>
118 <desc>aileron</desc>
119 <dead-band type="double">0.05</dead-band>
120 <binding>
121 <command>property-scale</command>
122 <property>/controls/flight/aileron</property>
123 <offset type="double">0.0</offset>
124 <squared type="bool">1</squared>
125 </binding>
126 </axis>
127
128 <!-- Analog axis 1. Elevator -->
129 <axis>
130 <name>Stick forward/back</name>
131 <number>
132 <unix>1</unix>
133 <mac>1</mac>
134 <windows>1</windows>
135 </number>
136 <desc>elevator</desc>
137 <dead-band type="double">0.05</dead-band>
138 <binding>
139 <command>property-scale</command>
140 <property>/controls/flight/elevator</property>
141 <offset type="double">0.0</offset>
142 <factor type="double">-1.0</factor>
143 <squared type="bool">1</squared>
144 </binding>
145 </axis>
146
147 <!-- Analog axis 3. Rudder -->
148 <axis>
149 <name>Stick twist</name>
150 <number>
151 <unix>3</unix>
152 <mac>2</mac>
153 <windows>3</windows>
154 </number>
155 <desc>rudder</desc>
156 <dead-band type="double">0.05</dead-band>
157 <binding>
158 <command>property-scale</command>
159 <property>/controls/flight/rudder</property>
160 <offset type="double">0.0</offset>
161 <factor type="double">1.0</factor>
162 <squared type="bool">1</squared>
163 </binding>
164 <!-- binding>
165 <command>nasal</command>
166 <script>
167 setprop("sim/current-view/goal-heading-offset-deg",
168 -90.0*cmdarg().getNode("setting").getValue());
169 </script>
170 </binding -->
171 </axis>
172
173 <!-- Analog axis 2. Throttle 1 -->
174 <axis>
175 <name>Left throttle</name>
176 <number>
177 <unix>2</unix>
178 <mac>3</mac>
179 <windows>2</windows>
180 </number>
181 <desc>TM0: throttle, TM1: throttle/propeller 1, TM2: throttle/propeller 3</desc>
182 <binding>
183 <command>nasal</command>
184 <script>
185 if (engine_select_mode == 0) {
186 controls.throttleAxis();
187 } else {
188 controls.perEngineSelectedAxisHandler(engine_axis_mode)
189 ((engine_select_mode == 1) ? engine[0] : engine[2]);
190 }
191 </script>
192 </binding>
193 </axis>
194
195 <!-- Analog axis 4. Throttle 2 -->
196 <axis>
197 <name>Right throttle</name>
198 <number>
199 <unix>4</unix>
200 <mac>4</mac>
201 <windows>4</windows>
202 </number>
203 <desc>TM0: mixture, TM1: throttle/propeller 2, TM2: throttle/propeller 4</desc>
204 <binding>
205 <command>nasal</command>
206 <script>
207 if (engine_select_mode == 0) {
208 controls.mixtureAxis();
209 } else {
210 controls.perEngineSelectedAxisHandler(engine_axis_mode)
211 ((engine_select_mode == 1) ? engine[1] : engine[3]);
212 }
213 </script>
214 </binding>
215 </axis>
216
217 <!-- Axis 5. Hat left/right -->
218 <axis>
219 <name>Hat left/right</name>
220 <number>
221 <unix>5</unix>
222 <mac>5</mac>
223 <windows>5</windows>
224 </number>
225 <desc>quick view left/right, +mod: horizontal view pan</desc>
226 <low>
227 <repeatable type="bool">true</repeatable>
228 <binding>
229 <command>nasal</command>
230 <script>
231 <![CDATA[
232 trace("Axis 5, Hat: low!");
233 if (modifier) {
234 view.panViewDir(0.5);
235 } else {
236 quick_view(1);
237 }
238 ]]>
239 </script>
240 </binding>
241 <mod-up>
242 <binding>
243 <command>nasal</command>
244 <script>
245 if (!modifier) {
246 quick_view(0);
247 }
248 </script>
249 </binding>
250 </mod-up>
251 </low>
252 <high>
253 <repeatable type="bool">true</repeatable>
254 <binding>
255 <command>nasal</command>
256 <script>
257 <![CDATA[
258 trace("Axis 5, Hat: high!");
259 if (modifier) {
260 view.panViewDir(-0.5);
261 } else {
262 quick_view(2);
263 }
264 ]]>
265 </script>
266 </binding>
267 <mod-up>
268 <binding>
269 <command>nasal</command>
270 <script>
271 <![CDATA[
272 trace("Axis 5, Hat: low released!");
273 if (!modifier) {
274 quick_view(0);
275 }
276 ]]>
277 </script>
278 </binding>
279 </mod-up>
280 </high>
281 </axis>
282
283 <!-- Axis 6. Hat up/down -->
284 <axis>
285 <name>Hat up/down</name>
286 <number>
287 <unix>6</unix>
288 <mac>6</mac>
289 <windows>6</windows>
290 </number>
291 <desc>view reset/quick view front, +mod: vertical view pan</desc>
292 <low>
293 <repeatable type="bool">true</repeatable>
294 <binding>
295 <command>nasal</command>
296 <script>
297 <![CDATA[
298 trace("Axis 6, Hat: low!");
299 if (modifier) {
300 view.panViewPitch(0.5);
301 } else {
302 view.resetView();
303 }
304 ]]>
305 </script>
306 </binding>
307 <mod-up>
308 <binding>
309 <command>nasal</command>
310 <script>
311 <![CDATA[
312 if (!modifier) {
313 #quick_view(0);
314 }
315 ]]>
316 </script>
317 </binding>
318 </mod-up>
319 </low>
320 <high>
321 <repeatable type="bool">true</repeatable>
322 <binding>
323 <command>nasal</command>
324 <script>
325 <![CDATA[
326 trace("Axis 6, Hat: high!");
327 if (modifier) {
328 view.panViewPitch(-0.5);
329 } else {
330 quick_view(3);
331 }
332 ]]>
333 </script>
334 </binding>
335 <mod-up>
336 <binding>
337 <command>nasal</command>
338 <script>
339 <![CDATA[
340 if (!modifier) {
341 quick_view(0);
342 }
343 ]]>
344 </script>
345 </binding>
346 </mod-up>
347 </high>
348 </axis>
349
350 <!-- Trigger Button -->
351 <button>
352 <name>Trigger</name>
353 <number>
354 <unix>0</unix>
355 <mac>0</mac>
356 <windows>0</windows>
357 </number>
358 <desc>function modifier (mod)</desc>
359 <binding>
360 <command>nasal</command>
361 <script>
362 trace("Button 0 pressed!");
363 modifier = 1;
364 </script>
365 </binding>
366 <mod-up>
367 <binding>
368 <command>nasal</command>
369 <script>
370 modifier = 0;
371 </script>
372 </binding>
373 </mod-up>
374 </button>
375
376 <!-- Center Button -->
377 <button>
378 <name>Center button</name>
379 <number>
380 <unix>2</unix>
381 <mac>2</mac>
382 <windows>2</windows>
383 </number>
384 <desc>brakes, +mod: Toggle parking brake</desc>
385 <binding>
386 <command>nasal</command>
387 <script>
388 trace("Button 2 pressed!");
389 if (modifier) {
390 controls.applyParkingBrake(1);
391 } else {
392 controls.applyBrakes(1);
393 }
394 </script>
395 </binding>
396 <mod-up>
397 <binding>
398 <command>nasal</command>
399 <script>
400 controls.applyBrakes(0);
401 </script>
402 </binding>
403 </mod-up>
404 </button>
405
406 <!-- Left Button -->
407 <button>
408 <name>Left button</name>
409 <number>
410 <unix>1</unix>
411 <mac>1</mac>
412 <windows>1</windows>
413 </number>
414 <desc>left brake, +mod: PTT</desc>
415 <binding>
416 <command>nasal</command>
417 <script>
418 trace("Button 1 pressed!");
419 if (modifier) {
420 controls.ptt(1);
421 } else {
422 controls.applyBrakes(1, -1);
423 }
424 </script>
425 </binding>
426 <mod-up>
427 <binding>
428 <command>nasal</command>
429 <script>
430 controls.applyBrakes(0, -1);
431 controls.ptt(0);
432 </script>
433 </binding>
434 </mod-up>
435 </button>
436
437 <!-- Right Button -->
438 <button>
439 <name>Right button</name>
440 <number>
441 <unix>3</unix>
442 <mac>3</mac>
443 <windows>3</windows>
444 </number>
445 <desc>right brake, +mod: trigger</desc>
446 <binding>
447 <command>nasal</command>
448 <script>
449 trace("Button 3 pressed!");
450 if (modifier) {
451 controls.trigger(1);
452 } else {
453 controls.applyBrakes(1, 1);
454 }
455 </script>
456 </binding>
457 <mod-up>
458 <binding>
459 <command>nasal</command>
460 <script>
461 controls.applyBrakes(0, 1);
462 controls.trigger(0);
463 </script>
464 </binding>
465 </mod-up>
466 </button>
467
468 <!-- Button: T1 -->
469 <button>
470 <name>T1</name>
471 <number>
472 <unix>4</unix>
473 <mac>4</mac>
474 <windows>4</windows>
475 </number>
476 <desc>next view, +mod: zoom in +Shift: next weapon</desc>
477 <repeatable type="bool">true</repeatable>
478 <binding>
479 <command>nasal</command>
480 <script>
481 trace("Button 4 pressed!");
482 if (modifier) {
483 view.decrease();
484 } else {
485 if (!pressed[4]) {
486 pressed[4] = 1;
487 view.stepView(1);
488 }
489 }
490 </script>
491 </binding>
492 <mod-shift>
493 <binding>
494 <command>nasal</command>
495 <script>
496 trace("Button 4 + shift pressed!");
497 controls.weaponSelect(1);
498 </script>
499 </binding>
500 </mod-shift>
501 <mod-up>
502 <binding>
503 <command>nasal</command>
504 <script>
505 pressed[4] = 0;
506 </script>
507 </binding>
508 </mod-up>
509 </button>
510
511 <!-- Button: T2 -->
512 <button>
513 <name>T2</name>
514 <number>
515 <unix>5</unix>
516 <mac>5</mac>
517 <windows>5</windows>
518 </number>
519 <desc>previous view, +mod: zoom out, +Shift: previous weapon</desc>
520 <repeatable type="bool">true</repeatable>
521 <binding>
522 <command>nasal</command>
523 <script>
524 trace("Button 5 pressed!");
525 if (modifier) {
526 view.increase();
527 } else {
528 if (!pressed[5]) {
529 pressed[5] = 1;
530 view.stepView(-1);
531 }
532 }
533 </script>
534 </binding>
535 <mod-shift>
536 <binding>
537 <command>nasal</command>
538 <script>
539 trace("Button 5 + shift pressed!");
540 controls.weaponSelect(-1);
541 </script>
542 </binding>
543 </mod-shift>
544 <mod-up>
545 <binding>
546 <command>nasal</command>
547 <script>
548 pressed[5] = 0;
549 </script>
550 </binding>
551 </mod-up>
552 </button>
553
554 <!-- Button: T3 -->
555 <button>
556 <name>T3</name>
557 <number>
558 <unix>6</unix>
559 <mac>6</mac>
560 <windows>6</windows>
561 </number>
562 <desc>trim nose down, +mod: disarm speed brakes</desc>
563 <repeatable type="bool">true</repeatable>
564 <binding>
565 <command>nasal</command>
566 <script>
567 trace("Button 6 pressed!");
568 if (modifier) {
569 setprop("/controls/flight/speedbrake", 0.0);
570 } else {
571 controls.elevatorTrim(1);
572 }
573 </script>
574 </binding>
575 </button>
576
577 <!-- Button: T4 -->
578 <button>
579 <name>T4</name>
580 <number>
581 <unix>7</unix>
582 <mac>7</mac>
583 <windows>7</windows>
584 </number>
585 <desc>trim nose up, +mod: deploy speed brakes</desc>
586 <repeatable type="bool">true</repeatable>
587 <binding>
588 <command>nasal</command>
589 <script>
590 trace("Button 7 pressed!");
591 if (modifier) {
592 setprop("/controls/flight/speedbrake", 1.0);
593 } else {
594 controls.elevatorTrim(-1);
595 }
596 </script>
597 </binding>
598 </button>
599
600 <!-- Button: T5 -->
601 <button>
602 <name>T5</name>
603 <number>
604 <unix>8</unix>
605 <mac>8</mac>
606 <windows>8</windows>
607 </number>
608 <desc>retract flaps one step, +mod: gear up</desc>
609 <binding>
610 <command>nasal</command>
611 <script>
612 trace("Button 8 pressed!");
613 if (!modifier) {
614 controls.flapsDown(-1);
615 } else {
616 controls.gearDown(-1);
617 }
618 </script>
619 </binding>
620 <mod-up>
621 <binding>
622 <command>nasal</command>
623 <script>
624 controls.flapsDown(0);
625 controls.gearDown(0);
626 </script>
627 </binding>
628 </mod-up>
629 </button>
630
631 <!-- Button: T6 -->
632 <button>
633 <name>T6</name>
634 <number>
635 <unix>9</unix>
636 <mac>9</mac>
637 <windows>9</windows>
638 </number>
639 <desc>deploy flaps one step, +mod: gear down</desc>
640 <binding>
641 <command>nasal</command>
642 <script>
643 trace("Button 9 pressed!");
644 if (!modifier) {
645 controls.flapsDown(1);
646 } else {
647 controls.gearDown(1);
648 }
649 </script>
650 </binding>
651 <mod-up>
652 <binding>
653 <command>nasal</command>
654 <script>
655 controls.flapsDown(0);
656 controls.gearDown(0);
657 </script>
658 </binding>
659 </mod-up>
660 </button>
661
662 <!-- Button: T7 -->
663 <button>
664 <name>T7</name>
665 <number>
666 <unix>10</unix>
667 <mac>10</mac>
668 <windows>10</windows>
669 </number>
670 <desc>Increase magnetos, +mod: Engine throttle/propeller axis swap</desc>
671 <binding>
672 <command>nasal</command>
673 <script>
674 trace("Button 10 pressed!");
675 if (!modifier) {
676 controls.stepMagnetos(1);
677 } else {
678 engine_axis_mode = 2*!engine_axis_mode;
679 }
680 </script>
681 </binding>
682 </button>
683
684 <!-- Button: T8 -->
685 <button>
686 <number>
687 <unix>11</unix>
688 <mac>11</mac>
689 <windows>11</windows>
690 </number>
691 <name>T8</name>
692 <desc>Decrease magnetos, +mod: Engine throttle/propeller axis swap</desc>
693 <binding>
694 <command>nasal</command>
695 <script>
696 trace("Button 11 pressed!");
697 if (!modifier) {
698 controls.stepMagnetos(-1);
699 } else {
700 engine_axis_mode = 2*!engine_axis_mode;
701 }
702 </script>
703 </binding>
704 </button>
705
706 <!-- Button: 3-way Mode switch -->
707 <button>
708 <name>Mode 1</name>
709 <number>
710 <unix>12</unix>
711 <mac>12</mac>
712 <windows>12</windows>
713 </number>
714 <desc>Engine 0/1 throttle mode</desc>
715 <binding>
716 <command>nasal</command>
717 <script>
718 trace("Mode 1!");
719 engine_select_mode = 1;
720 </script>
721 </binding>
722 <mod-up>
723 <binding>
724 <command>nasal</command>
725 <script>
726 trace("Mode Off!");
727 engine_select_mode = 0;
728 </script>
729 </binding>
730 </mod-up>
731 </button>
732 <button>
733 <name>Mode 2</name>
734 <number>
735 <unix>13</unix>
736 <mac>13</mac>
737 <windows>13</windows>
738 </number>
739 <name>Mode 2</name>
740 <desc>Engine 2/3 throttle mode</desc>
741 <binding>
742 <command>nasal</command>
743 <script>
744 trace("Mode 2!");
745 engine_select_mode = 2;
746 </script>
747 </binding>
748 </button>
749
750 </PropertyList>