| 1 |
<?xml version="1.0"?> |
| 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 |
<PropertyList> |
| 136 |
|
| 137 |
<name>DragonRise Inc. Generic USB Joystick </name> |
| 138 |
|
| 139 |
<nasal> |
| 140 |
<script> |
| 141 |
var (mod1, mod2, mod3) = (0, 0, 0); |
| 142 |
# These variables are used to emulate non-repeatable buttons when |
| 143 |
# mod3 != 0. |
| 144 |
var (button0_with_mod3, button1_with_mod3, button2_with_mod3, |
| 145 |
button3_with_mod3) = (0, 0, 0, 0); |
| 146 |
var initial_goal_heading_offset_deg = |
| 147 |
getprop("/sim/current-view/goal-heading-offset-deg") or 0.0; |
| 148 |
var initial_goal_pitch_offset_deg = |
| 149 |
getprop("/sim/current-view/goal-pitch-offset-deg") or 0.0; |
| 150 |
</script> |
| 151 |
</nasal> |
| 152 |
|
| 153 |
<axis n="0"> |
| 154 |
<desc>Aileron</desc> |
| 155 |
<binding> |
| 156 |
<command>property-scale</command> |
| 157 |
<property>/controls/flight/aileron</property> |
| 158 |
|
| 159 |
<offset type="double">-0.01028</offset> |
| 160 |
<factor type="double">0.5</factor> |
| 161 |
</binding> |
| 162 |
</axis> |
| 163 |
|
| 164 |
<axis n="1"> |
| 165 |
<desc>Elevator</desc> |
| 166 |
<binding> |
| 167 |
<command>property-scale</command> |
| 168 |
<property>/controls/flight/elevator</property> |
| 169 |
|
| 170 |
<offset type="double">-0.01028</offset> |
| 171 |
<factor type="double">-0.5</factor> |
| 172 |
</binding> |
| 173 |
</axis> |
| 174 |
|
| 175 |
<axis n="3"> |
| 176 |
<desc>Rudder</desc> |
| 177 |
<binding> |
| 178 |
<command>property-scale</command> |
| 179 |
<property>/controls/flight/rudder</property> |
| 180 |
|
| 181 |
<offset type="double">-0.01028</offset> |
| 182 |
</binding> |
| 183 |
</axis> |
| 184 |
|
| 185 |
<axis n="4"> |
| 186 |
<desc>Throttle [mod3=0] / Mixture Control [mod3=1] / Elevator Trim [mod3=-1]</desc> |
| 187 |
<high> |
| 188 |
<repeatable type="bool">true</repeatable> |
| 189 |
<binding> |
| 190 |
<command>nasal</command> |
| 191 |
<script> |
| 192 |
if (mod3 == 0) { |
| 193 |
controls.adjThrottle(-1.0); |
| 194 |
} elsif (mod3 == 1) { |
| 195 |
controls.adjMixture(-1); |
| 196 |
} else { |
| 197 |
setprop("/controls/flight/elevator-trim", |
| 198 |
-0.001 + getprop("/controls/flight/elevator-trim")); |
| 199 |
} |
| 200 |
</script> |
| 201 |
</binding> |
| 202 |
</high> |
| 203 |
<low> |
| 204 |
<repeatable type="bool">true</repeatable> |
| 205 |
<binding> |
| 206 |
<command>nasal</command> |
| 207 |
<script> |
| 208 |
if (mod3 == 0) { |
| 209 |
controls.adjThrottle(1.0); |
| 210 |
} elsif (mod3 == 1) { |
| 211 |
controls.adjMixture(1); |
| 212 |
} else { |
| 213 |
setprop("/controls/flight/elevator-trim", |
| 214 |
0.001 + getprop("/controls/flight/elevator-trim")); |
| 215 |
} |
| 216 |
</script> |
| 217 |
</binding> |
| 218 |
</low> |
| 219 |
</axis> |
| 220 |
|
| 221 |
<axis n="5"> |
| 222 |
<name>mod3_switch</name> |
| 223 |
<desc>Switch mod3 between the values -1, 0, 1</desc> |
| 224 |
<binding> |
| 225 |
<command>nasal</command> |
| 226 |
<script> |
| 227 |
mod3 = cmdarg().getNode("setting").getValue(); |
| 228 |
# gui.popupTip("DragonRise.mod3 = " ~ mod3, 2); |
| 229 |
</script> |
| 230 |
</binding> |
| 231 |
</axis> |
| 232 |
|
| 233 |
<axis n="6"> |
| 234 |
<name>mod1_mod2_toggle</name> |
| 235 |
<desc>Toggle mod1 and mod2</desc> |
| 236 |
<low> |
| 237 |
<binding> |
| 238 |
<command>nasal</command> |
| 239 |
<script> |
| 240 |
mod1 = !mod1; |
| 241 |
gui.popupTip("DragonRise.mod1 = " ~ mod1, 2); |
| 242 |
</script> |
| 243 |
</binding> |
| 244 |
</low> |
| 245 |
<high> |
| 246 |
<binding> |
| 247 |
<command>nasal</command> |
| 248 |
<script> |
| 249 |
mod2 = !mod2; |
| 250 |
gui.popupTip("DragonRise.mod2 = " ~ mod2, 2); |
| 251 |
</script> |
| 252 |
</binding> |
| 253 |
</high> |
| 254 |
</axis> |
| 255 |
|
| 256 |
<button n="0"> |
| 257 |
<desc>View Up [mod3=0] / Select first engine [mod3=1] / Flaps Up [mod3=-1]</desc> |
| 258 |
<repeatable type="bool">true</repeatable> |
| 259 |
<binding> |
| 260 |
<command>nasal</command> |
| 261 |
<script> |
| 262 |
if (mod3 == 0) { |
| 263 |
setprop("/sim/current-view/goal-pitch-offset-deg", |
| 264 |
1.0 + getprop("/sim/current-view/goal-pitch-offset-deg")); |
| 265 |
return; |
| 266 |
} |
| 267 |
|
| 268 |
# Emulate a non-repeatable button for mod3 != 0 |
| 269 |
if (button0_with_mod3) |
| 270 |
return; |
| 271 |
|
| 272 |
button0_with_mod3 = 1; |
| 273 |
|
| 274 |
if (mod3 == -1) { |
| 275 |
controls.flapsDown(-1); |
| 276 |
} else { |
| 277 |
controls.selectEngine(0); |
| 278 |
} |
| 279 |
</script> |
| 280 |
</binding> |
| 281 |
<mod-up> |
| 282 |
<binding> |
| 283 |
<command>nasal</command> |
| 284 |
<script> |
| 285 |
button0_with_mod3 = 0; |
| 286 |
</script> |
| 287 |
</binding> |
| 288 |
</mod-up> |
| 289 |
</button> |
| 290 |
|
| 291 |
<button n="1"> |
| 292 |
<desc>View Right / Brake Right [mod3=-1] / Select second engine [mod3=1] / Trigger1 [mod3=0 and mod1]</desc> |
| 293 |
<repeatable type="bool">true</repeatable> |
| 294 |
<binding> |
| 295 |
<command>nasal</command> |
| 296 |
<script> |
| 297 |
if (mod3 == 0) { |
| 298 |
if (mod1) { |
| 299 |
# This seems the most common for "trigger" |
| 300 |
setprop("/controls/armament/trigger1", 1); |
| 301 |
# Many planes use this instead [also true for "trigger1"?] |
| 302 |
setprop("/ai/submodels/trigger1", 1); |
| 303 |
} else { |
| 304 |
setprop("/sim/current-view/goal-heading-offset-deg", |
| 305 |
-1.0 + getprop("/sim/current-view/goal-heading-offset-deg")); |
| 306 |
} |
| 307 |
|
| 308 |
return; |
| 309 |
} |
| 310 |
|
| 311 |
# Emulate a non-repeatable button for mod3 != 0 |
| 312 |
if (button1_with_mod3) |
| 313 |
return; |
| 314 |
|
| 315 |
button1_with_mod3 = 1; |
| 316 |
|
| 317 |
if (mod3 == -1) { |
| 318 |
controls.applyBrakes(1, 1); |
| 319 |
} else { |
| 320 |
controls.selectEngine(1); |
| 321 |
} |
| 322 |
</script> |
| 323 |
</binding> |
| 324 |
<mod-up> |
| 325 |
<binding> |
| 326 |
<command>nasal</command> |
| 327 |
<script> |
| 328 |
button1_with_mod3 = 0; |
| 329 |
|
| 330 |
controls.applyBrakes(0, 1); |
| 331 |
# This seems the most common for "trigger" |
| 332 |
setprop("/controls/armament/trigger1", 0); |
| 333 |
# Many planes use this instead [also true for "trigger1"?] |
| 334 |
setprop("/ai/submodels/trigger1", 0); |
| 335 |
</script> |
| 336 |
</binding> |
| 337 |
</mod-up> |
| 338 |
</button> |
| 339 |
|
| 340 |
<button n="2"> |
| 341 |
<desc>View Down [mod3=0] / Select third engine [mod3=1] / Flaps Down [mod3=-1]</desc> |
| 342 |
<repeatable type="bool">true</repeatable> |
| 343 |
<binding> |
| 344 |
<command>nasal</command> |
| 345 |
<script> |
| 346 |
if (mod3 == 0) { |
| 347 |
setprop("/sim/current-view/goal-pitch-offset-deg", |
| 348 |
-1.0 + getprop("/sim/current-view/goal-pitch-offset-deg")); |
| 349 |
|
| 350 |
return; |
| 351 |
} |
| 352 |
|
| 353 |
# Emulate a non-repeatable button for mod3 != 0 |
| 354 |
if (button2_with_mod3) |
| 355 |
return; |
| 356 |
|
| 357 |
button2_with_mod3 = 1; |
| 358 |
|
| 359 |
if (mod3 == -1) { |
| 360 |
controls.flapsDown(1); |
| 361 |
} else { |
| 362 |
controls.selectEngine(2); |
| 363 |
} |
| 364 |
</script> |
| 365 |
</binding> |
| 366 |
<mod-up> |
| 367 |
<binding> |
| 368 |
<command>nasal</command> |
| 369 |
<script> |
| 370 |
button2_with_mod3 = 0; |
| 371 |
</script> |
| 372 |
</binding> |
| 373 |
</mod-up> |
| 374 |
</button> |
| 375 |
|
| 376 |
<button n="3"> |
| 377 |
<desc>View Left / Brake Left [mod3=-1] / Select fourth engine [mod3=1] / Trigger [mod3=0 and mod1]</desc> |
| 378 |
<repeatable type="bool">true</repeatable> |
| 379 |
<binding> |
| 380 |
<command>nasal</command> |
| 381 |
<script> |
| 382 |
if (mod3 == 0) { |
| 383 |
if (mod1) { |
| 384 |
# This seems the most common |
| 385 |
setprop("/controls/armament/trigger", 1); |
| 386 |
# Many planes use this instead |
| 387 |
setprop("/ai/submodels/trigger", 1); |
| 388 |
} else { |
| 389 |
setprop("/sim/current-view/goal-heading-offset-deg", |
| 390 |
1.0 + getprop("/sim/current-view/goal-heading-offset-deg")); |
| 391 |
} |
| 392 |
|
| 393 |
return; |
| 394 |
} |
| 395 |
|
| 396 |
# Emulate a non-repeatable button for mod3 != 0 |
| 397 |
if (button3_with_mod3) |
| 398 |
return; |
| 399 |
|
| 400 |
button3_with_mod3 = 1; |
| 401 |
|
| 402 |
if (mod3 == -1) { |
| 403 |
controls.applyBrakes(1, -1); |
| 404 |
} else { |
| 405 |
controls.selectEngine(3); |
| 406 |
} |
| 407 |
</script> |
| 408 |
</binding> |
| 409 |
<mod-up> |
| 410 |
<binding> |
| 411 |
<command>nasal</command> |
| 412 |
<script> |
| 413 |
button3_with_mod3 = 0; |
| 414 |
controls.applyBrakes(0, -1); |
| 415 |
|
| 416 |
# This seems the most common |
| 417 |
setprop("/controls/armament/trigger", 0); |
| 418 |
# Many planes use this instead |
| 419 |
setprop("/ai/submodels/trigger", 0); |
| 420 |
</script> |
| 421 |
</binding> |
| 422 |
</mod-up> |
| 423 |
</button> |
| 424 |
|
| 425 |
<button n="4"> |
| 426 |
<desc>View Cycle (backward)</desc> |
| 427 |
<repeatable type="bool">false</repeatable> |
| 428 |
<binding> |
| 429 |
<command>nasal</command> |
| 430 |
<script>view.stepView(-1)</script> |
| 431 |
</binding> |
| 432 |
</button> |
| 433 |
|
| 434 |
<button n="5"> |
| 435 |
<desc>View Cycle (forward)</desc> |
| 436 |
<repeatable type="bool">false</repeatable> |
| 437 |
<binding> |
| 438 |
<command>nasal</command> |
| 439 |
<script>view.stepView(1)</script> |
| 440 |
</binding> |
| 441 |
</button> |
| 442 |
|
| 443 |
<button n="6"> |
| 444 |
<desc>View Decrease</desc> |
| 445 |
<repeatable type="bool">true</repeatable> |
| 446 |
<binding> |
| 447 |
<command>nasal</command> |
| 448 |
<script>view.decrease(0.75)</script> |
| 449 |
</binding> |
| 450 |
</button> |
| 451 |
|
| 452 |
<button n="7"> |
| 453 |
<desc>View Increase</desc> |
| 454 |
<repeatable type="bool">true</repeatable> |
| 455 |
<binding> |
| 456 |
<command>nasal</command> |
| 457 |
<script>view.increase(0.75)</script> |
| 458 |
</binding> |
| 459 |
</button> |
| 460 |
|
| 461 |
<button n="8"> |
| 462 |
<desc>Brakes [mod3=0] / Aileron and Rudder Dance [mod3=-1]</desc> |
| 463 |
<binding> |
| 464 |
<command>nasal</command> |
| 465 |
<script> |
| 466 |
if (mod3 == -1) { |
| 467 |
interpolate("/controls/flight/aileron", |
| 468 |
-0.5, 1, 0.5, 1, -0.5, 1, 0.5, 1, -0.5, 1, 0.5, 1, |
| 469 |
-0.5, 1, 0.5, 1); |
| 470 |
interpolate("/controls/flight/rudder", |
| 471 |
-0.5, 1, 0.5, 1, -0.5, 1, 0.5, 1, -0.5, 1, 0.5, 1, |
| 472 |
-0.5, 1, 0.5, 1); |
| 473 |
} |
| 474 |
elsif (mod3 == 0) { |
| 475 |
controls.applyBrakes(1); |
| 476 |
} |
| 477 |
</script> |
| 478 |
</binding> |
| 479 |
<mod-up> |
| 480 |
<binding> |
| 481 |
<command>nasal</command> |
| 482 |
<script>controls.applyBrakes(0)</script> |
| 483 |
</binding> |
| 484 |
</mod-up> |
| 485 |
</button> |
| 486 |
|
| 487 |
<button n="9"> |
| 488 |
<desc>Select Initial View and Recenter [mod3=0] / Reset Zoom to Default [mod3=-1] / Select all engines [mod3=1]</desc> |
| 489 |
<binding> |
| 490 |
<command>nasal</command> |
| 491 |
<script> |
| 492 |
if (mod3 == -1) { |
| 493 |
setprop("/sim/current-view/field-of-view", |
| 494 |
getprop("/sim/view/config/default-field-of-view-deg")); |
| 495 |
} elsif (mod3 == 1) { |
| 496 |
controls.selectAllEngines(); |
| 497 |
} else { |
| 498 |
setprop("/sim/current-view/view-number", 0); |
| 499 |
setprop("/sim/current-view/goal-heading-offset-deg", |
| 500 |
initial_goal_heading_offset_deg); |
| 501 |
setprop("/sim/current-view/goal-pitch-offset-deg", |
| 502 |
initial_goal_pitch_offset_deg); |
| 503 |
} |
| 504 |
</script> |
| 505 |
</binding> |
| 506 |
</button> |
| 507 |
|
| 508 |
</PropertyList> |
| 509 |
|
| 510 |
|