1
0
Fork 0

Input/Joysticks/Saitek/Aviator.xml: Improved the joystick configuration.

- Prepared all bindings for per-OS number selection
- Use the new per-engine axis handlers.
- Added missing var keywords.
This commit is contained in:
Anders Gidenstam 2010-10-30 13:31:15 +02:00
parent d373245285
commit 00cbdf38b7

View file

@ -1,9 +1,8 @@
<?xml version="1.0" ?>
<?xml-stylesheet type="text/xsl" href="joystick.xsl"?>
<!-- $Id$ -->
<!-- Saitek AV8R/Aviator
Copyright (C) 2007 - 2009 Anders Gidenstam (anders(at)gidenstam.org)
Copyright (C) 2007 - 2010 Anders Gidenstam (anders(at)gidenstam.org)
This file is released under the GPL license v2 or later.
-->
<PropertyList>
@ -21,18 +20,27 @@
# TM0: All selected; TM1: #1 & #2; TM2: #3 & #4
var engine_axis_mode = 0;
# Valid only in TM1 and TM2.
# EA0: throttle, +mod: propeller
# EA1: propeller, +mod: throttle
# EA0: throttle
# EA1: mixture
# EA2: propeller
var quick_view_active = 0;
var old_view = view.point.save();
var pressed = [0,0,0,0,0,0,0,0,0,0,0,0];
# Map engines to throttles for TM1 (0, 1) and TM2 (2, 3)
var engine = [0, 1, 2, 3];
# Do per-aircraft modifications
if (getprop("/sim/model/path") ==
"Aircraft/Short_Empire/Models/Short_Empire-model.xml") {
# Do per-aircraft modifications
if (contains({"Aircraft/Short_Empire/Models/Short_Empire-model.xml" : 0,
"Aircraft/Lockheed1049/Models/Lockheed1049_twa.xml" : 0},
getprop("/sim/model/path"))) {
# TM1: the outer engines, TM2: the inner engines
engine = [0, 3, 1, 2];
}
if (contains({"Aircraft/DO-X/Models/dox.xml" : 0},
getprop("/sim/model/path"))) {
engine = [[0, 1, 2, 3, 4, 5], [6, 7, 8, 9, 10, 11],
[0, 1, 2, 3, 4, 5], [6, 7, 8, 9, 10, 11]];
}
var goal_heading_offset =
@ -46,7 +54,7 @@
var kbdalt = props.globals.getNode("/devices/status/keyboard/alt", 1);
var quick_view = func {
dir = arg[0];
var dir = arg[0];
if (dir == 0) {
quick_view_active = 0;
view.point.move(old_view, 0.1);
@ -99,7 +107,13 @@
</nasal>
<!-- Analog axis 0. Aileron -->
<axis n="0">
<axis>
<name>Stick left/right</name>
<number>
<unix>0</unix>
<mac>0</mac>
<windows>0</windows>
</number>
<desc>aileron</desc>
<binding>
<command>property-scale</command>
@ -111,7 +125,13 @@
</axis>
<!-- Analog axis 1. Elevator -->
<axis n="1">
<axis>
<name>Stick forward/back</name>
<number>
<unix>1</unix>
<mac>1</mac>
<windows>1</windows>
</number>
<desc>elevator</desc>
<binding>
<command>property-scale</command>
@ -125,6 +145,7 @@
<!-- Analog axis 3. Rudder -->
<axis>
<name>Stick twist</name>
<number>
<unix>3</unix>
<mac>2</mac>
@ -139,10 +160,18 @@
<factor type="double">1.0</factor>
<squared type="bool">true</squared>
</binding>
<!-- binding>
<command>nasal</command>
<script>
setprop("sim/current-view/goal-heading-offset-deg",
-90.0*cmdarg().getNode("setting").getValue());
</script>
</binding -->
</axis>
<!-- Analog axis 2. Throttle 1 -->
<axis>
<name>Left throttle</name>
<number>
<unix>2</unix>
<mac>3</mac>
@ -155,43 +184,43 @@
if (engine_select_mode == 0) {
controls.throttleAxis();
} else {
var val = cmdarg().getNode("setting").getValue();
var ctrl_pp =
"/controls/engines/engine[" ~
((engine_select_mode == 1) ? engine[0] : engine[2]) ~ "]/" ~
(engine_axis_mode ? "propeller-pitch" : "throttle");
setprop(ctrl_pp, (1 - val)/2);
controls.perEngineSelectedAxisHandler(engine_axis_mode)
((engine_select_mode == 1) ? engine[0] : engine[2]);
}
</script>
</binding>
</axis>
<!-- Analog axis 4. Throttle 2 -->
<axis n="4">
<desc>TM0: mixture, +mod: propeller pitch, TM1: throttle/propeller 2, TM2: throttle/propeller 4</desc>
<axis>
<name>Right throttle</name>
<number>
<unix>4</unix>
<mac>4</mac>
<windows>4</windows>
</number>
<desc>TM0: mixture, TM1: throttle/propeller 2, TM2: throttle/propeller 4</desc>
<binding>
<command>nasal</command>
<script>
if (engine_select_mode == 0) {
if (!modifier) {
controls.mixtureAxis();
} else {
controls.propellerAxis();
}
controls.mixtureAxis();
} else {
var val = cmdarg().getNode("setting").getValue();
var ctrl_pp =
"/controls/engines/engine[" ~
((engine_select_mode == 1) ? engine[1] : engine[3]) ~ "]/" ~
(engine_axis_mode ? "propeller-pitch" : "throttle");
setprop(ctrl_pp, (1 - val)/2);
controls.perEngineSelectedAxisHandler(engine_axis_mode)
((engine_select_mode == 1) ? engine[1] : engine[3]);
}
</script>
</binding>
</axis>
<!-- Axis 5. Hat left/right -->
<axis n="5">
<axis>
<name>Hat left/right</name>
<number>
<unix>5</unix>
<mac>5</mac>
<windows>5</windows>
</number>
<desc>quick view left/right, +mod: horizontal view pan</desc>
<low>
<repeatable type="bool">true</repeatable>
@ -238,10 +267,12 @@
<binding>
<command>nasal</command>
<script>
<![CDATA[
trace("Axis 5, Hat: low released!");
if (!modifier) {
quick_view(0);
}
]]>
</script>
</binding>
</mod-up>
@ -249,7 +280,13 @@
</axis>
<!-- Axis 6. Hat up/down -->
<axis n="6">
<axis>
<name>Hat up/down</name>
<number>
<unix>6</unix>
<mac>6</mac>
<windows>6</windows>
</number>
<desc>view reset/quick view front, +mod: vertical view pan</desc>
<low>
<repeatable type="bool">true</repeatable>
@ -270,9 +307,11 @@
<binding>
<command>nasal</command>
<script>
<![CDATA[
if (!modifier) {
#quick_view(0);
}
]]>
</script>
</binding>
</mod-up>
@ -296,9 +335,11 @@
<binding>
<command>nasal</command>
<script>
<![CDATA[
if (!modifier) {
quick_view(0);
}
]]>
</script>
</binding>
</mod-up>
@ -306,8 +347,13 @@
</axis>
<!-- Trigger Button -->
<button n="0">
<button>
<name>Trigger</name>
<number>
<unix>0</unix>
<mac>0</mac>
<windows>0</windows>
</number>
<desc>function modifier (mod)</desc>
<binding>
<command>nasal</command>
@ -327,8 +373,13 @@
</button>
<!-- Center Button -->
<button n="2">
<button>
<name>Center button</name>
<number>
<unix>2</unix>
<mac>2</mac>
<windows>2</windows>
</number>
<desc>brakes, +mod: Toggle parking brake</desc>
<binding>
<command>nasal</command>
@ -352,8 +403,13 @@
</button>
<!-- Left Button -->
<button n="1">
<button>
<name>Left button</name>
<number>
<unix>1</unix>
<mac>1</mac>
<windows>1</windows>
</number>
<desc>left brake, +mod: PTT</desc>
<binding>
<command>nasal</command>
@ -378,8 +434,13 @@
</button>
<!-- Right Button -->
<button n="3">
<button>
<name>Right button</name>
<number>
<unix>3</unix>
<mac>3</mac>
<windows>3</windows>
</number>
<desc>right brake, +mod: trigger</desc>
<binding>
<command>nasal</command>
@ -404,8 +465,13 @@
</button>
<!-- Button: T1 -->
<button n="4">
<button>
<name>T1</name>
<number>
<unix>4</unix>
<mac>4</mac>
<windows>4</windows>
</number>
<desc>next view, +mod: zoom in +Shift: next weapon</desc>
<repeatable type="bool">true</repeatable>
<binding>
@ -442,8 +508,13 @@
</button>
<!-- Button: T2 -->
<button n="5">
<button>
<name>T2</name>
<number>
<unix>5</unix>
<mac>5</mac>
<windows>5</windows>
</number>
<desc>previous view, +mod: zoom out, +Shift: previous weapon</desc>
<repeatable type="bool">true</repeatable>
<binding>
@ -480,8 +551,13 @@
</button>
<!-- Button: T3 -->
<button n="6">
<button>
<name>T3</name>
<number>
<unix>6</unix>
<mac>6</mac>
<windows>6</windows>
</number>
<desc>trim nose down, +mod: disarm speed brakes</desc>
<repeatable type="bool">true</repeatable>
<binding>
@ -498,8 +574,13 @@
</button>
<!-- Button: T4 -->
<button n="7">
<button>
<name>T4</name>
<number>
<unix>7</unix>
<mac>7</mac>
<windows>7</windows>
</number>
<desc>trim nose up, +mod: deploy speed brakes</desc>
<repeatable type="bool">true</repeatable>
<binding>
@ -516,8 +597,13 @@
</button>
<!-- Button: T5 -->
<button n="8">
<button>
<name>T5</name>
<number>
<unix>8</unix>
<mac>8</mac>
<windows>8</windows>
</number>
<desc>retract flaps one step, +mod: gear up</desc>
<binding>
<command>nasal</command>
@ -542,8 +628,13 @@
</button>
<!-- Button: T6 -->
<button n="9">
<button>
<name>T6</name>
<number>
<unix>9</unix>
<mac>9</mac>
<windows>9</windows>
</number>
<desc>deploy flaps one step, +mod: gear down</desc>
<binding>
<command>nasal</command>
@ -568,8 +659,13 @@
</button>
<!-- Button: T7 -->
<button n="10">
<button>
<name>T7</name>
<number>
<unix>10</unix>
<mac>10</mac>
<windows>10</windows>
</number>
<desc>Increase magnetos, +mod: Engine throttle/propeller axis swap</desc>
<binding>
<command>nasal</command>
@ -578,14 +674,19 @@
if (!modifier) {
controls.stepMagnetos(1);
} else {
engine_axis_mode = !engine_axis_mode;
engine_axis_mode = 2*!engine_axis_mode;
}
</script>
</binding>
</button>
<!-- Button: T8 -->
<button n="11">
<button>
<number>
<unix>11</unix>
<mac>11</mac>
<windows>11</windows>
</number>
<name>T8</name>
<desc>Decrease magnetos, +mod: Engine throttle/propeller axis swap</desc>
<binding>
@ -595,15 +696,20 @@
if (!modifier) {
controls.stepMagnetos(-1);
} else {
engine_axis_mode = !engine_axis_mode;
engine_axis_mode = 2*!engine_axis_mode;
}
</script>
</binding>
</button>
<!-- Button: 3-way Mode switch -->
<button n="12">
<button>
<name>Mode 1</name>
<number>
<unix>12</unix>
<mac>12</mac>
<windows>12</windows>
</number>
<desc>Engine 0/1 throttle mode</desc>
<binding>
<command>nasal</command>
@ -622,7 +728,13 @@
</binding>
</mod-up>
</button>
<button n="13">
<button>
<name>Mode 2</name>
<number>
<unix>13</unix>
<mac>13</mac>
<windows>13</windows>
</number>
<name>Mode 2</name>
<desc>Engine 2/3 throttle mode</desc>
<binding>