| 1 |
<?xml version="1.0" ?> |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
<PropertyList> |
| 18 |
|
| 19 |
|
| 20 |
<name type="string">Saitek X36</name> |
| 21 |
<name type="string">Saitek Saitek X36</name> |
| 22 |
<name type="string">Analog 4-axis 6-button 2-hat CHF joystick</name> |
| 23 |
|
| 24 |
<data> |
| 25 |
<view-mode type="int">0</view-mode> |
| 26 |
<quick-view-active type="int">0</quick-view-active> |
| 27 |
<stick-active type="int">1</stick-active> |
| 28 |
</data> |
| 29 |
|
| 30 |
<nasal> |
| 31 |
<script> |
| 32 |
<![CDATA[ |
| 33 |
var self = cmdarg().getParent(); |
| 34 |
var data = self.getNode("data"); |
| 35 |
var view_mode = data.getNode("view-mode"); |
| 36 |
var quick_view_active = data.getNode("quick-view-active"); |
| 37 |
var stick_active = data.getNode("stick-active"); |
| 38 |
var old_view = view.point.save(); |
| 39 |
|
| 40 |
var goal_heading_offset = |
| 41 |
props.globals.getNode("/sim/current-view/goal-heading-offset-deg", 1); |
| 42 |
var goal_pitch_offset = |
| 43 |
props.globals.getNode("/sim/current-view/goal-pitch-offset-deg", 1); |
| 44 |
|
| 45 |
var kbdshift = props.globals.getNode("/devices/status/keyboard/shift", 1); |
| 46 |
var kbdctrl = props.globals.getNode("/devices/status/keyboard/ctrl", 1); |
| 47 |
var kbdalt = props.globals.getNode("/devices/status/keyboard/alt", 1); |
| 48 |
|
| 49 |
var quick_view = func { |
| 50 |
var dir = arg[0]; |
| 51 |
if (dir == 0) { |
| 52 |
quick_view_active.setIntValue(0); |
| 53 |
view.point.move(old_view, 0.1); |
| 54 |
} else { |
| 55 |
if (quick_view_active.getValue() == 0) { |
| 56 |
quick_view_active.setIntValue(1); |
| 57 |
old_view = view.point.save(); |
| 58 |
|
| 59 |
if (dir == 1) { |
| 60 |
goal_heading_offset.setDoubleValue |
| 61 |
(getprop("/sim/view/config/left-direction-deg")); |
| 62 |
goal_pitch_offset.setDoubleValue |
| 63 |
(getprop("/sim/view/config/pitch-offset-deg")); |
| 64 |
view.fovProp.setDoubleValue |
| 65 |
(getprop("/sim/view/config/default-field-of-view-deg")); |
| 66 |
} if (dir == 2) { |
| 67 |
goal_heading_offset.setDoubleValue |
| 68 |
(getprop("/sim/view/config/right-direction-deg")); |
| 69 |
goal_pitch_offset.setDoubleValue |
| 70 |
(getprop("/sim/view/config/pitch-offset-deg")); |
| 71 |
view.fovProp.setDoubleValue |
| 72 |
(getprop("/sim/view/config/default-field-of-view-deg")); |
| 73 |
} if (dir == 3) { |
| 74 |
goal_heading_offset.setDoubleValue |
| 75 |
(getprop("/sim/view/config/front-direction-deg")); |
| 76 |
goal_pitch_offset.setDoubleValue |
| 77 |
(getprop("/sim/view/config/pitch-offset-deg")); |
| 78 |
view.fovProp.setDoubleValue |
| 79 |
(getprop("/sim/view/config/default-field-of-view-deg")); |
| 80 |
} if (dir == 4) { |
| 81 |
goal_heading_offset.setDoubleValue |
| 82 |
(getprop("/sim/view/config/back-direction-deg")); |
| 83 |
goal_pitch_offset.setDoubleValue |
| 84 |
(getprop("/sim/view/config/pitch-offset-deg")); |
| 85 |
view.fovProp.setDoubleValue |
| 86 |
(getprop("/sim/view/config/default-field-of-view-deg")); |
| 87 |
} |
| 88 |
} |
| 89 |
} |
| 90 |
} |
| 91 |
|
| 92 |
var aileron = props.globals.getNode("/controls/flight/aileron", 1); |
| 93 |
var elevator = props.globals.getNode("/controls/flight/elevator", 1); |
| 94 |
var rudder = props.globals.getNode("/controls/flight/rudder", 1); |
| 95 |
var aileron_js = props.globals.getNode("/controls/flight/aileron-js", 1); |
| 96 |
var elevator_js = props.globals.getNode("/controls/flight/elevator-js", 1); |
| 97 |
var rudder_js = props.globals.getNode("/controls/flight/rudder-js", 1); |
| 98 |
|
| 99 |
var js_active = func { |
| 100 |
settimer(js_active, 0); |
| 101 |
if (stick_active.getValue()) { |
| 102 |
aileron.setDoubleValue(aileron_js.getValue()); |
| 103 |
elevator.setDoubleValue(elevator_js.getValue()); |
| 104 |
rudder.setDoubleValue(rudder_js.getValue()); |
| 105 |
} |
| 106 |
} |
| 107 |
|
| 108 |
setlistener("/sim/signals/fdm-initialized", js_active); |
| 109 |
]]> |
| 110 |
</script> |
| 111 |
</nasal> |
| 112 |
|
| 113 |
|
| 114 |
<axis n="0"> |
| 115 |
<desc>aileron</desc> |
| 116 |
<binding> |
| 117 |
<command>property-scale</command> |
| 118 |
<property>/controls/flight/aileron-js</property> |
| 119 |
<dead-band type="double">0.0</dead-band> |
| 120 |
<offset type="double">0.0</offset> |
| 121 |
<squared type="bool">true</squared> |
| 122 |
</binding> |
| 123 |
</axis> |
| 124 |
|
| 125 |
|
| 126 |
<axis n="1"> |
| 127 |
<desc>elevator</desc> |
| 128 |
<binding> |
| 129 |
<command>property-scale</command> |
| 130 |
<property>/controls/flight/elevator-js</property> |
| 131 |
<dead-band type="double">0.0</dead-band> |
| 132 |
<offset type="double">0.0</offset> |
| 133 |
<factor type="double">-1.0</factor> |
| 134 |
<squared type="bool">true</squared> |
| 135 |
</binding> |
| 136 |
</axis> |
| 137 |
|
| 138 |
|
| 139 |
<axis n="3"> |
| 140 |
<desc>rudder</desc> |
| 141 |
<binding> |
| 142 |
<command>property-scale</command> |
| 143 |
<property>/controls/flight/rudder-js</property> |
| 144 |
<dead-band type="double">0.010</dead-band> |
| 145 |
<offset type="double">0.0</offset> |
| 146 |
<factor type="double">1.0</factor> |
| 147 |
<squared type="bool">true</squared> |
| 148 |
</binding> |
| 149 |
</axis> |
| 150 |
|
| 151 |
|
| 152 |
<axis n="2"> |
| 153 |
<desc>throttle</desc> |
| 154 |
<binding> |
| 155 |
<command>nasal</command> |
| 156 |
<script>controls.throttleAxis()</script> |
| 157 |
</binding> |
| 158 |
</axis> |
| 159 |
|
| 160 |
|
| 161 |
<axis n="4"> |
| 162 |
<name>Right hat left/right</name> |
| 163 |
<desc> |
| 164 |
view-mode 0: horizontal view pan, view-mode 1: quick view left/right |
| 165 |
</desc> |
| 166 |
<low> |
| 167 |
<repeatable type="bool">true</repeatable> |
| 168 |
<binding> |
| 169 |
<command>nasal</command> |
| 170 |
<script> |
| 171 |
<![CDATA[ |
| 172 |
#print("X36.xml: Axis 4, Hat 1: low!"); |
| 173 |
var m = view_mode.getValue(); |
| 174 |
if (m == 0) { |
| 175 |
view.panViewDir(0.5); |
| 176 |
} if (m == 1) { |
| 177 |
quick_view(1); |
| 178 |
} |
| 179 |
]]> |
| 180 |
</script> |
| 181 |
</binding> |
| 182 |
<mod-up> |
| 183 |
<binding> |
| 184 |
<command>nasal</command> |
| 185 |
<script> |
| 186 |
#print("X36.xml: Axis 4, Hat 1: low released!"); |
| 187 |
var m = view_mode.getValue(); |
| 188 |
if (m == 1) { |
| 189 |
quick_view(0); |
| 190 |
} |
| 191 |
</script> |
| 192 |
</binding> |
| 193 |
</mod-up> |
| 194 |
</low> |
| 195 |
<high> |
| 196 |
<repeatable type="bool">true</repeatable> |
| 197 |
<binding> |
| 198 |
<command>nasal</command> |
| 199 |
<script> |
| 200 |
<![CDATA[ |
| 201 |
#print("X36.xml: Axis 4, Hat 1: high!"); |
| 202 |
var m = view_mode.getValue(); |
| 203 |
if (m == 0) { |
| 204 |
view.panViewDir(-0.5); |
| 205 |
} if (m == 1) { |
| 206 |
quick_view(2); |
| 207 |
} |
| 208 |
]]> |
| 209 |
</script> |
| 210 |
</binding> |
| 211 |
<mod-up> |
| 212 |
<binding> |
| 213 |
<command>nasal</command> |
| 214 |
<script> |
| 215 |
#print("X36.xml: Axis 4, Hat 1: low released!"); |
| 216 |
var m = view_mode.getValue(); |
| 217 |
if (m == 1) { |
| 218 |
quick_view(0); |
| 219 |
} |
| 220 |
</script> |
| 221 |
</binding> |
| 222 |
</mod-up> |
| 223 |
</high> |
| 224 |
</axis> |
| 225 |
|
| 226 |
|
| 227 |
<axis n="5"> |
| 228 |
<name>Right hat up/down</name> |
| 229 |
<desc> |
| 230 |
view-mode 0: vertical view pan, view-mode 1: quick view front/view reset |
| 231 |
</desc> |
| 232 |
<low> |
| 233 |
<repeatable type="bool">true</repeatable> |
| 234 |
<binding> |
| 235 |
<command>nasal</command> |
| 236 |
<script> |
| 237 |
<![CDATA[ |
| 238 |
#print("X36.xml: Axis 5, Hat 1: low!"); |
| 239 |
var m = view_mode.getValue(); |
| 240 |
if (m == 0) { |
| 241 |
view.panViewPitch(0.5); |
| 242 |
} if (m == 1) { |
| 243 |
quick_view(3); |
| 244 |
} |
| 245 |
]]> |
| 246 |
</script> |
| 247 |
</binding> |
| 248 |
<mod-up> |
| 249 |
<binding> |
| 250 |
<command>nasal</command> |
| 251 |
<script> |
| 252 |
#print("X36.xml: Axis 4, Hat 1: low released!"); |
| 253 |
var m = view_mode.getValue(); |
| 254 |
if (m == 1) { |
| 255 |
quick_view(0); |
| 256 |
} |
| 257 |
</script> |
| 258 |
</binding> |
| 259 |
</mod-up> |
| 260 |
</low> |
| 261 |
<high> |
| 262 |
<repeatable type="bool">true</repeatable> |
| 263 |
<binding> |
| 264 |
<command>nasal</command> |
| 265 |
<script> |
| 266 |
<![CDATA[ |
| 267 |
#print("X36.xml: Axis 5, Hat 1: low!"); |
| 268 |
var m = view_mode.getValue(); |
| 269 |
if (m == 0) { |
| 270 |
view.panViewPitch(-0.5); |
| 271 |
} if (m == 1) { |
| 272 |
view.resetView(); |
| 273 |
#quick_view(4); |
| 274 |
} |
| 275 |
]]> |
| 276 |
</script> |
| 277 |
</binding> |
| 278 |
<mod-up> |
| 279 |
<binding> |
| 280 |
<command>nasal</command> |
| 281 |
<script> |
| 282 |
#print("X36.xml: Axis 4, Hat 1: low released!"); |
| 283 |
var m = view_mode.getValue(); |
| 284 |
if (m == 1) { |
| 285 |
#quick_view(0); |
| 286 |
} |
| 287 |
</script> |
| 288 |
</binding> |
| 289 |
</mod-up> |
| 290 |
</high> |
| 291 |
</axis> |
| 292 |
|
| 293 |
|
| 294 |
|
| 295 |
|
| 296 |
|
| 297 |
|
| 298 |
<axis n="6"> |
| 299 |
<desc>elevator trim (hat up/down)</desc> |
| 300 |
<low> |
| 301 |
<repeatable type="bool">true</repeatable> |
| 302 |
<binding> |
| 303 |
<command>nasal</command> |
| 304 |
<script> |
| 305 |
#print("X36.xml: Axis 6, Hat 1: low!"); |
| 306 |
controls.elevatorTrim(-1) |
| 307 |
</script> |
| 308 |
</binding> |
| 309 |
</low> |
| 310 |
<high> |
| 311 |
<repeatable type="bool">true</repeatable> |
| 312 |
<binding> |
| 313 |
<command>nasal</command> |
| 314 |
<script> |
| 315 |
#print("X36.xml: Axis 6, Hat 1: high!"); |
| 316 |
view.increase() |
| 317 |
</script> |
| 318 |
</binding> |
| 319 |
</high> |
| 320 |
</axis> |
| 321 |
|
| 322 |
|
| 323 |
<axis n="7"> |
| 324 |
<desc>Zoom out/in (hat left/right)</desc> |
| 325 |
<low> |
| 326 |
<repeatable type="bool">true</repeatable> |
| 327 |
<binding> |
| 328 |
<command>nasal</command> |
| 329 |
<script> |
| 330 |
#print("X36.xml: Axis 7, Hat 1: low!"); |
| 331 |
view.decrease() |
| 332 |
</script> |
| 333 |
</binding> |
| 334 |
</low> |
| 335 |
<high> |
| 336 |
<repeatable type="bool">true</repeatable> |
| 337 |
<binding> |
| 338 |
<command>nasal</command> |
| 339 |
<script> |
| 340 |
#print("X36.xml: Axis 7, Hat 1: high!"); |
| 341 |
controls.elevatorTrim(1) |
| 342 |
</script> |
| 343 |
</binding> |
| 344 |
</high> |
| 345 |
</axis> |
| 346 |
|
| 347 |
|
| 348 |
<button n="0"> |
| 349 |
<name>Trigger</name> |
| 350 |
<desc>brakes, +Shift: Toggle parking brake, +Ctrl: trigger</desc> |
| 351 |
<binding> |
| 352 |
<command>nasal</command> |
| 353 |
<script> |
| 354 |
#print("X36.xml: Button 0 pressed!"); |
| 355 |
if (kbdctrl.getBoolValue()) { |
| 356 |
controls.trigger(1); |
| 357 |
} else { |
| 358 |
if (kbdshift.getBoolValue()) { |
| 359 |
controls.applyParkingBrake(1); |
| 360 |
} else { |
| 361 |
controls.applyBrakes(1); |
| 362 |
} |
| 363 |
} |
| 364 |
</script> |
| 365 |
</binding> |
| 366 |
<mod-up> |
| 367 |
<binding> |
| 368 |
<command>nasal</command> |
| 369 |
<script> |
| 370 |
controls.applyBrakes(0); |
| 371 |
controls.trigger(0); |
| 372 |
</script> |
| 373 |
</binding> |
| 374 |
</mod-up> |
| 375 |
</button> |
| 376 |
|
| 377 |
|
| 378 |
<button n="1"> |
| 379 |
<name>Fire C</name> |
| 380 |
<desc>next view +Shift: previous view +Ctrl: next weapon +Ctrl+Shift: previous weapon</desc> |
| 381 |
<repeatable>false</repeatable> |
| 382 |
<binding> |
| 383 |
<command>nasal</command> |
| 384 |
<script> |
| 385 |
#print("X36.xml: Button 1 pressed!"); |
| 386 |
if (kbdctrl.getBoolValue()) { |
| 387 |
if (kbdshift.getBoolValue()) { |
| 388 |
controls.weaponSelect(-1); |
| 389 |
} else { |
| 390 |
controls.weaponSelect(1); |
| 391 |
} |
| 392 |
} else { |
| 393 |
if (kbdshift.getBoolValue()) { |
| 394 |
view.stepView(-1) |
| 395 |
} else { |
| 396 |
view.stepView(1) |
| 397 |
} |
| 398 |
} |
| 399 |
</script> |
| 400 |
</binding> |
| 401 |
</button> |
| 402 |
|
| 403 |
|
| 404 |
<button n="2"> |
| 405 |
<name>A</name> |
| 406 |
<desc>left brake</desc> |
| 407 |
<binding> |
| 408 |
<command>nasal</command> |
| 409 |
<script> |
| 410 |
#print("X36.xml: Button 2 pressed!"); |
| 411 |
controls.applyBrakes(1, -1); |
| 412 |
</script> |
| 413 |
</binding> |
| 414 |
<mod-up> |
| 415 |
<binding> |
| 416 |
<command>nasal</command> |
| 417 |
<script> |
| 418 |
controls.applyBrakes(0, -1); |
| 419 |
</script> |
| 420 |
</binding> |
| 421 |
</mod-up> |
| 422 |
</button> |
| 423 |
|
| 424 |
|
| 425 |
<button n="3"> |
| 426 |
<name>B</name> |
| 427 |
<desc>right brake</desc> |
| 428 |
<binding> |
| 429 |
<command>nasal</command> |
| 430 |
<script> |
| 431 |
#print("X36.xml: Button 3 pressed!"); |
| 432 |
controls.applyBrakes(1, 1); |
| 433 |
</script> |
| 434 |
</binding> |
| 435 |
<mod-up> |
| 436 |
<binding> |
| 437 |
<command>nasal</command> |
| 438 |
<script> |
| 439 |
controls.applyBrakes(0, 1); |
| 440 |
</script> |
| 441 |
</binding> |
| 442 |
</mod-up> |
| 443 |
</button> |
| 444 |
|
| 445 |
|
| 446 |
<button n="4"> |
| 447 |
<name>Launch</name> |
| 448 |
<desc>toggle view mode</desc> |
| 449 |
<binding> |
| 450 |
<command>nasal</command> |
| 451 |
<script> |
| 452 |
#print("X36.xml: Button 4 pressed!"); |
| 453 |
if (view_mode.getValue() == 0) { |
| 454 |
view_mode.setIntValue(1); |
| 455 |
} else { |
| 456 |
view_mode.setIntValue(0); |
| 457 |
} |
| 458 |
</script> |
| 459 |
</binding> |
| 460 |
<mod-up> |
| 461 |
<binding> |
| 462 |
<command>nasal</command> |
| 463 |
<script> |
| 464 |
</script> |
| 465 |
</binding> |
| 466 |
</mod-up> |
| 467 |
</button> |
| 468 |
|
| 469 |
|
| 470 |
<button n="5"> |
| 471 |
<name>F.lock</name> |
| 472 |
<desc>disarm speed brakes, +Shift: deploy speed brakes</desc> |
| 473 |
<binding> |
| 474 |
<command>nasal</command> |
| 475 |
<script> |
| 476 |
#print("X36.xml: Button 5 pressed!"); |
| 477 |
var sb = "/controls/flight/speedbrake"; |
| 478 |
if (kbdshift.getBoolValue()) { |
| 479 |
setprop(sb, 1.0); |
| 480 |
} else { |
| 481 |
setprop(sb, 0.0); |
| 482 |
} |
| 483 |
if (kbdalt.getBoolValue()) { |
| 484 |
stick_active.setIntValue(!stick_active.getValue()); |
| 485 |
} |
| 486 |
</script> |
| 487 |
</binding> |
| 488 |
</button> |
| 489 |
|
| 490 |
</PropertyList> |