Debian Codegraph @

Input/Joysticks/Microsoft/sidewinder-force-feed2.xml

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