Debian Codegraph @

Input/Joysticks/Saitek/Cyborg-Gold-3d-USB.xml

raw symbols SCIP
1 <?xml version="1.0"?>
2 <!--
3 $Id$
4
5
6 _______________________________________ Layout _______________________________________
7
8
9 axis 0: aileron
10 axis 1: elevator
11 axis 2: rudder
12 axis 3: throttle
13
14
15 no modifier F3 F4 F3+F4
16 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
17 button 0 (trigger): brakes parking brake speed brake thrust revers.
18 button 1 (left): flaps up gear up previous view previous view (all)
19 button 2 (middle): reset view dir tail wheel lock cockpit view reset all trim
20 button 3 (right): flaps down gear down next view next view (all)
21 button 4 (F1): brakes left * zoom out *
22 button 5 (F2): brakes right * zoom in *
23 button 6 (F3): //////////////////////// modifier 0 /////////////////////////
24 button 7 (F4): //////////////////////// modifier 1 /////////////////////////
25 button 8 (>>): * * * *
26 button 9 (<<): * * * *
27 hat left: look left leaner mixture aileron trim rudder trim
28 hat right: look right richer mixture aileron trim rudder trim
29 hat back: look down dec prop pitch elevator trim *
30 hat forward: look up inc prop pitch elevator trim *
31
32
33 F3 and F4 are used like "Shift", "Control", or "Alternate" on computer keyboards.
34 For example: press F3 and keep holding it down while pressing the fire
35 button/trigger -> toggle parking brake
36
37 When flying the Harrier, "F3/hat left" and "right" control the thrust vector.
38
39
40
41 With the keyboard's Control key pressed, the following keys have a different meaning:
42
43 Control + no modifier
44 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
45 button 0 (trigger): trigger selected weapon
46 button 1 (left): switch to previous weapon system
47 button 3 (right): switch to next weapon system
48
49
50
51 ___________________________________ Customization ____________________________________
52
53
54
55 If you want to change some (or all) of the bindings, the recommended way is
56 to copy this file to your home directory, make your changes there, and include
57 it from your personal preferences.xml file. You can use any number lower than
58 1000 for n in <js-named n="0">. The lowest takes precedence in case of identical
59 names. You can include such a preferences.xml file with the ~~config option,
60 e.g. ~~config=$HOME/.fgfs/preferences.xml, and you can put that ~~config line
61 into your personal $HOME/.fgfsrc file.
62
63 <?xml version="1.0"?>
64 <PropertyList>
65 <input>
66 <js-named n="100">
67 <joysticks include="your-modified-copy.xml"/>
68 </js-named>
69 </input>
70 </PropertyList>
71
72
73 The property "/input/joysticks/js[0]/data/modifier" indicates the "shift" level.
74 F3 sets bit 0, F4 sets bit 1. The property is zero if none of the shift buttons
75 is pressed, 1 if F3 is pressed, 2 if F4 is pressed, and 3 if both F3 and F4 are
76 pressed.
77
78 Note that you have to enclose nasal scripts in <script><![CDATA[...]]></script>
79 if they contain characters that interfere with the xml markup. This is the case
80 if you are, for example, using < (lower than). Alternatively, you can 'escape'
81 the character with "&lt;".
82
83 Also note that all nasal code shares a common namespace, so it's possible to set
84 a variable in one nasal binding, and to read it in another.
85
86
87
88 ____________________________________ References ______________________________________
89
90
91
92 Joysticks: $FG_ROOT/Docs/README.Joystick.html
93 Properties: see property browser (fgfs menu: "File"->"Browse internal properties")
94
95 Nasal: http://www.plausible.org/nasal/
96 Nasal examples: $FG_ROOT/Nasal/
97
98
99 ______________________________________________________________________________________
100
101 ~~ Melchior FRANZ <mfranz # aon : at>
102 -->
103
104 <PropertyList>
105 <name>SAITEK CYBORG 3D USB</name>
106 <name>CYBORG 3D USB</name>
107
108 <data>
109 <mode type="int">0</mode>
110 <modifier type="int">0</modifier>
111 </data>
112
113 <nasal>
114 <script>
115 var selfN = cmdarg().getParent();
116 var dataN = selfN.getNode("data");
117 var modeN = dataN.getNode("mode");
118 var modifierN = dataN.getNode("modifier");
119 var f1 = 0;
120 var f2 = 0;
121 var left_brake = 0;
122 var right_brake = 0;
123 var trigger = 0;
124
125 var modifier = 0;
126
127 var setmodifier = func(bit, val) {
128 modifierN.setValue(modifier = bits.switch(modifier, bit, val));
129 }
130
131 if (props.globals.getNode("/rotors", 0) != nil) {
132 selfN.getNode("axis[0]/binding/power").setIntValue(1);
133 selfN.getNode("axis[1]/binding/power").setIntValue(1);
134 }
135
136 var viewdir = props.globals.getNode("/sim").getChildren("view");
137 forindex (var i; viewdir) {
138 var t = viewdir[i].getNode("type");
139 viewdir[i] = t != nil and t.getValue() == "lookat" ? 1 : -1;
140 }
141
142 var kbdshift = props.globals.getNode("/devices/status/keyboard/shift", 1);
143 var kbdctrl = props.globals.getNode("/devices/status/keyboard/ctrl", 1);
144 var kbdalt = props.globals.getNode("/devices/status/keyboard/alt", 1);
145
146 var m = 0;
147 var setmode = func m = modifierN.getValue() + modeN.getValue() * 4;
148 setlistener(modeN, setmode);
149 setlistener(modifierN, setmode, 1);
150
151 var aircraft = getprop("/sim/aircraft");
152
153 var thrust_display = func nil;
154 if (aircraft == "harrier") {
155 thrust_display = func {
156 thv = getprop("/controls/engines/engine[0]/mixture");
157 gui.popupTip("Thrust vector " ~ int(thv * 120 - 20 + 0.5));
158 }
159 }
160 </script>
161 </nasal>
162
163 <axis n="0">
164 <desc>aileron</desc>
165 <binding>
166 <command>property-scale</command>
167 <property>/controls/flight/aileron</property>
168 <power type="int">2</power>
169 </binding>
170 </axis>
171
172 <axis n="1">
173 <desc>elevator</desc>
174 <binding>
175 <command>property-scale</command>
176 <property>/controls/flight/elevator</property>
177 <factor type="double">-1.0</factor>
178 <power type="int">2</power>
179 </binding>
180 </axis>
181
182 <axis>
183 <desc>rudder</desc>
184 <number>
185 <unix>2</unix>
186 <mac>2</mac>
187 <windows>3</windows>
188 </number>
189 <binding>
190 <command>property-scale</command>
191 <property>/controls/flight/rudder</property>
192 <offset type="double">0.0</offset>
193 <factor type="double">1.0</factor>
194 <power type="int">2</power>
195 </binding>
196 </axis>
197
198 <axis>
199 <desc>throttle</desc>
200 <number>
201 <unix>3</unix>
202 <mac>3</mac>
203 <windows>2</windows>
204 </number>
205 <binding>
206 <command>nasal</command>
207 <script>controls.throttleAxis()</script>
208 </binding>
209 </axis>
210
211 <button n="0">
212 <name>Trigger</name>
213 <desc>brakes, +Ctrl: fire, +F3: parking brake, +F4: speedbrake, +F3+F4: thrust reverser</desc>
214 <repeatable type="bool">false</repeatable>
215 <binding>
216 <command>nasal</command>
217 <script>
218 if (m == 0) {
219 if (kbdctrl.getBoolValue()) {
220 controls.trigger(trigger = 1);
221 } else {
222 controls.applyBrakes(1);
223 }
224 } elsif (m == 1) {
225 controls.applyBrakes(1);
226 } elsif (m == 2) {
227 #
228 } elsif (m == 3) {
229 #
230 }
231 </script>
232 </binding>
233 <mod-up>
234 <binding>
235 <command>nasal</command>
236 <script>
237 if (m == 0) {
238 if (trigger)
239 controls.trigger(trigger = 0);
240 else
241 controls.applyBrakes(0);
242
243 controls.applyBrakes(0);
244 } elsif (m == 1) {
245 i = controls.applyParkingBrake(1);
246 gui.popupTip("Parking Brake " ~ (i ? "ON" : "OFF"));
247 controls.applyBrakes(0);
248 } elsif (m == 2) {
249 i = !getprop("/controls/flight/speedbrake");
250 setprop("/controls/flight/speedbrake", i);
251 gui.popupTip("Speed Brake " ~ (i ? "ON" : "OFF"));
252 } elsif (m == 3) {
253 i = !getprop("/controls/engines/engine[0]/reverser");
254 props.setAll("/controls/engines/engine", "reverser", i);
255 gui.popupTip("Thrust Reverser " ~ (i ? "ON" : "OFF"));
256 }
257 </script>
258 </binding>
259 </mod-up>
260 </button>
261
262 <button n="1">
263 <name>Left Button</name>
264 <desc>flaps up, +F3: gear up, +F4: previous active view, +F3+F4: previous view</desc>
265 <repeatable type="bool">false</repeatable>
266 <binding>
267 <command>nasal</command>
268 <script>
269 if (m == 0) {
270 if (kbdctrl.getBoolValue())
271 controls.weaponSelect(-1);
272 else
273 controls.flapsDown(-1);
274
275 } elsif (m == 1) {
276 controls.gearDown(-1);
277 } elsif (m == 2) {
278 view.stepView(-1, 0);
279 } elsif (m == 3) {
280 view.stepView(-1, 1);
281 }
282 </script>
283 </binding>
284 <mod-up>
285 <binding>
286 <command>nasal</command>
287 <script>
288 if (m == 0) {
289 controls.flapsDown(0);
290 } elsif (m == 1) {
291 controls.gearDown(0);
292 } elsif (m == 2) {
293 #
294 } elsif (m == 3) {
295 #
296 }
297 </script>
298 </binding>
299 </mod-up>
300 </button>
301
302 <button n="2">
303 <name>Middle Button</name>
304 <desc>center view, +F3: toggle tail-wheel lock, +F4: reset view, +F3+F4: reset trim</desc>
305 <repeatable type="bool">false</repeatable>
306 <binding>
307 <command>nasal</command>
308 <script>
309 if (m == 0) {
310 view.resetView();
311 } elsif (m == 1) {
312 i = !getprop("/controls/gear/tailwheel-lock");
313 setprop("/controls/gear/tailwheel-lock", i);
314 gui.popupTip("Tail Wheel " ~ (i ? "LOCKED" : "UNLOCKED"));
315 } elsif (m == 2) {
316 setprop("/sim/current-view/view-number", 0);
317 view.resetView();
318 } elsif (m == 3) {
319 setprop("/controls/flight/elevator-trim", 0);
320 setprop("/controls/flight/aileron-trim", 0);
321 setprop("/controls/flight/rudder-trim", 0);
322 }
323 </script>
324 </binding>
325 </button>
326
327 <button n="3">
328 <name>Right Button</name>
329 <desc>flaps down, +Ctrl: weapon select, +F3: gear down, +F4: next active view, +F3+F4: next view</desc>
330 <repeatable type="bool">false</repeatable>
331 <binding>
332 <command>nasal</command>
333 <script>
334 if (m == 0) {
335 if (kbdctrl.getBoolValue())
336 controls.weaponSelect(1);
337 else
338 controls.flapsDown(1);
339
340 } elsif (m == 1) {
341 controls.gearDown(1);
342 } elsif (m == 2) {
343 view.stepView(1, 0);
344 } elsif (m == 3) {
345 view.stepView(1, 1);
346 }
347 </script>
348 </binding>
349 <mod-up>
350 <binding>
351 <command>nasal</command>
352 <script>
353 if (m == 0) {
354 controls.flapsDown(0);
355 } elsif (m == 1) {
356 controls.gearDown(0);
357 } elsif (m == 2) {
358 #
359 } elsif (m == 3) {
360 #
361 }
362 </script>
363 </binding>
364 </mod-up>
365 </button>
366
367 <button n="4">
368 <name>F1</name>
369 <desc>brakes left, +F4: zoom out</desc>
370 <repeatable type="bool">true</repeatable>
371 <binding>
372 <command>nasal</command>
373 <script>
374 f1 = 1;
375 if (m == 0) {
376 if (!left_brake)
377 controls.applyBrakes(left_brake = 1, -1);
378
379 } elsif (m == 1) {
380 #
381 } elsif (m == 2) {
382 f2 ? view.resetFOV() : view.increase();
383 } elsif (m == 3) {
384 #
385 }
386 </script>
387 </binding>
388 <mod-up>
389 <binding>
390 <command>nasal</command>
391 <script>
392 f1 = 0;
393 if (m == 0) {
394 controls.applyBrakes(left_brake = 0, -1);
395 } elsif (m == 1) {
396 #
397 } elsif (m == 2) {
398 #
399 } elsif (m == 3) {
400 #
401 }
402 </script>
403 </binding>
404 </mod-up>
405 </button>
406
407 <button n="5">
408 <name>F2</name>
409 <desc>brakes right, +F4: zoom in</desc>
410 <repeatable type="bool">true</repeatable>
411 <binding>
412 <command>nasal</command>
413 <script>
414 f2 = 1;
415 if (m == 0) {
416 if (!right_brake)
417 controls.applyBrakes(right_brake = 1, 1);
418
419 } elsif (m == 1) {
420 #
421 } elsif (m == 2) {
422 f1 ? view.resetFOV() : view.decrease();
423 } elsif (m == 3) {
424 #
425 }
426 </script>
427 </binding>
428 <mod-up>
429 <binding>
430 <command>nasal</command>
431 <script>
432 f2 = 0;
433 if (m == 0) {
434 controls.applyBrakes(right_brake = 0, 1);
435 } elsif (m == 1) {
436 #
437 } elsif (m == 2) {
438 #
439 } elsif (m == 3) {
440 #
441 }
442 </script>
443 </binding>
444 </mod-up>
445 </button>
446
447 <button n="6"><!-- bit 0 -->
448 <name>F3</name>
449 <desc>modifier for other buttons</desc>
450 <repeatable type="bool">false</repeatable>
451 <binding>
452 <command>nasal</command>
453 <script>setmodifier(0, 1)</script>
454 </binding>
455 <mod-up>
456 <binding>
457 <command>nasal</command>
458 <script>setmodifier(0, 0)</script>
459 </binding>
460 </mod-up>
461 </button>
462
463 <button n="7"><!-- bit 1 -->
464 <name>F4</name>
465 <desc>modifier for other buttons</desc>
466 <repeatable type="bool">false</repeatable>
467 <binding>
468 <command>nasal</command>
469 <script>setmodifier(1, 1)</script>
470 </binding>
471 <mod-up>
472 <binding>
473 <command>nasal</command>
474 <script>setmodifier(1, 0)</script>
475 </binding>
476 </mod-up>
477 </button>
478
479 <button n="8">
480 <name>>></name>
481 <desc>unused</desc>
482 <repeatable type="bool">false</repeatable>
483 <binding>
484 <command>nasal</command>
485 <script>
486 <![CDATA[
487 text = "read $FG_ROOT/Input/Joysticks/Saitek/Cyborg-Gold-3d-USB.xml";
488 print("Please " ~ text ~ " for the full joystick layout.");
489 gui.popupTip(text);
490 ]]>
491 </script>
492 </binding>
493 </button>
494
495 <button n="9">
496 <name>&lt;&lt;</name>
497 <desc>unused</desc>
498 <repeatable type="bool">false</repeatable>
499 <binding>
500 <command>nasal</command>
501 <script>
502 <![CDATA[
503 text = "read $FG_ROOT/Input/Joysticks/Saitek/Cyborg-Gold-3d-USB.xml";
504 print("Please " ~ text ~ " for the full joystick layout.");
505 gui.popupTip(text);
506 ]]>
507 </script>
508 </binding>
509 </button>
510
511 <button n="10">
512 <name>Hat Up</name>
513 <desc>view up, +F3: increase prop pitch, +F4: elevator trim down</desc>
514 <repeatable>true</repeatable>
515 <binding>
516 <command>nasal</command>
517 <script>
518 if (m == 0) {
519 view.panViewPitch(1);
520 } elsif (m == 1) {
521 controls.adjPropeller(1);
522 } elsif (m == 2) {
523 controls.elevatorTrim(0.75);
524 } elsif (m == 3) {
525 #
526 }
527 </script>
528 </binding>
529 </button>
530
531 <button n="11">
532 <name>Hat Left</name>
533 <desc>view left, +F3: mixture leaner, +F4: aileron trim left, +F3+F4: rudder trim left</desc>
534 <repeatable>true</repeatable>
535 <binding>
536 <command>nasal</command>
537 <script>
538 if (m == 0) {
539 view.panViewDir(-viewdir[view.index]);
540 } elsif (m == 1) {
541 controls.adjMixture(-1);
542 thrust_display();
543 } elsif (m == 2) {
544 controls.aileronTrim(-0.75);
545 } elsif (m == 3) {
546 controls.rudderTrim(-0.75);
547 }
548 </script>
549 </binding>
550 </button>
551
552 <button n="12">
553 <name>Hat Right</name>
554 <desc>view right, +F3: mixture richer, +F4: aileron trim right, +F3+F4: rudder trim right</desc>
555 <repeatable>true</repeatable>
556 <binding>
557 <command>nasal</command>
558 <script>
559 if (m == 0) {
560 view.panViewDir(viewdir[view.index]);
561 } elsif (m == 1) {
562 controls.adjMixture(1);
563 thrust_display();
564 } elsif (m == 2) {
565 controls.aileronTrim(0.75);
566 } elsif (m == 3) {
567 controls.rudderTrim(0.75);
568 }
569 </script>
570 </binding>
571 </button>
572
573 <button n="13">
574 <name>Hat Down</name>
575 <desc>view down, +F3: decrease prop pitch, +F4: elevator trim up</desc>
576 <repeatable>true</repeatable>
577 <binding>
578 <command>nasal</command>
579 <script>
580 if (m == 0) {
581 view.panViewPitch(-1);
582 } elsif (m == 1) {
583 controls.adjPropeller(-1);
584 } elsif (m == 2) {
585 controls.elevatorTrim(-0.75);
586 } elsif (m == 3) {
587 #
588 }
589 </script>
590 </binding>
591 </button>
592 </PropertyList>
593