From 16660ed513f28cff59300015fff9db6ca341c78a Mon Sep 17 00:00:00 2001
From: ehofman <ehofman>
Date: Sat, 12 Jul 2003 11:38:12 +0000
Subject: [PATCH] Add two ThrustMaster input devices

---
 .../ThrustMaster/Attack-Throttle.xml          | 256 ++++++++++++++++++
 Input/Joysticks/ThrustMaster/FCS.xml          | 151 +++++++++++
 joysticks.xml                                 |   4 +
 3 files changed, 411 insertions(+)
 create mode 100644 Input/Joysticks/ThrustMaster/Attack-Throttle.xml
 create mode 100644 Input/Joysticks/ThrustMaster/FCS.xml

diff --git a/Input/Joysticks/ThrustMaster/Attack-Throttle.xml b/Input/Joysticks/ThrustMaster/Attack-Throttle.xml
new file mode 100644
index 000000000..91b435d43
--- /dev/null
+++ b/Input/Joysticks/ThrustMaster/Attack-Throttle.xml
@@ -0,0 +1,256 @@
+<?xml version="1.0"?>
+
+<!--
+************************************************************************
+* Bindings for ThrustMaster Attack Throttle joystick
+*
+*
+* Axis 0: ailerons
+* Axis 1: elevator
+* Axis 3: rudder
+* Axis 2: throttle
+* Axes 4 and 5 (hat): view direction
+*
+* Button 0: all brakes
+* Button 2: elevator trim up
+* Button 3: elevator trim down
+* Button 4: right brake only
+* Button 5: left brake only
+* Button 6: flap down
+* Button 7: flap up
+************************************************************************
+-->
+
+<PropertyList>
+
+ <name>ThrustMaster Attack Throttle</name>
+
+ <axis n="0">
+  <desc>Aileron</desc>
+  <binding>
+   <command>property-scale</command>
+   <property>/controls/flight/aileron</property>
+   <squared type="bool">true</squared>
+  </binding>
+ </axis>
+
+ <axis n="1">
+  <desc>Elevator</desc>
+  <binding>
+   <command>property-scale</command>
+   <property>/controls/flight/elevator</property>
+   <factor type="double">-1.0</factor>
+   <squared type="bool">true</squared>
+  </binding>
+ </axis>
+
+ <axis n="2">
+  <desc>Throttle</desc>
+  <binding>
+   <command>property-scale</command>
+   <property>/controls/engines/engine[0]/throttle</property>
+   <offset type="double">1.0</offset>
+   <factor type="double">0.5</factor>
+  </binding>
+  <binding>
+   <command>property-scale</command>
+   <property>/controls/engines/engine[1]/throttle</property>
+   <offset type="double">1.0</offset>
+   <factor type="double">0.5</factor>
+  </binding>
+  <binding>
+   <command>property-scale</command>
+   <property>/controls/engines/engine[2]/throttle</property>
+   <offset type="double">1.0</offset>
+   <factor type="double">0.5</factor>
+  </binding>
+  <binding>
+   <command>property-scale</command>
+   <property>/controls/engines/engine[3]/throttle</property>
+   <offset type="double">1.0</offset>
+   <factor type="double">0.5</factor>
+  </binding>
+  <binding>
+   <command>property-scale</command>
+   <property>/controls/engines/engine[4]/throttle</property>
+   <offset type="double">1.0</offset>
+   <factor type="double">0.5</factor>
+  </binding>
+  <binding>
+   <command>property-scale</command>
+   <property>/controls/engines/engine[5]/throttle</property>
+   <offset type="double">1.0</offset>
+   <factor type="double">0.5</factor>
+  </binding>
+  <binding>
+   <command>property-scale</command>
+   <property>/controls/engines/engine[6]/throttle</property>
+   <offset type="double">1.0</offset>
+   <factor type="double">0.5</factor>
+  </binding>
+  <binding>
+   <command>property-scale</command>
+   <property>/controls/engines/engine[7]/throttle</property>
+   <offset type="double">1.0</offset>
+   <factor type="double">0.5</factor>
+  </binding>
+ </axis>
+
+ <axis n="3">
+  <desc>Rudder</desc>
+  <binding>
+   <command>property-scale</command>
+   <property>/controls/flight/rudder</property>
+   <factor type="double">1.0</factor>
+  </binding>
+ </axis>
+
+  <axis n="4">
+   <desc>View Direction</desc>
+   <low>
+    <repeatable>true</repeatable>
+    <binding>
+     <command>property-adjust</command>
+     <property>/sim/current-view/goal-heading-offset-deg</property>
+     <step type="double">1.0</step>
+    </binding>
+   </low>
+   <high>
+    <repeatable>true</repeatable>
+    <binding>
+     <command>property-adjust</command>
+     <property>/sim/current-view/goal-heading-offset-deg</property>
+     <step type="double">-1.0</step>
+    </binding>
+   </high>
+  </axis>
+
+  <axis n="5">
+   <desc>View Elevation</desc>
+   <low>
+    <repeatable>true</repeatable>
+    <binding>
+     <command>property-adjust</command>
+     <property>/sim/current-view/goal-pitch-offset-deg</property>
+     <step type="double">1.0</step>
+    </binding>
+   </low>
+   <high>
+    <repeatable>true</repeatable>
+    <binding>
+     <command>property-adjust</command>
+     <property>/sim/current-view/goal-pitch-offset-deg</property>
+     <step type="double">-1.0</step>
+    </binding>
+   </high>
+  </axis>
+
+ <button n="0">
+  <desc>Brakes</desc>
+  <binding>
+   <command>property-assign</command>
+   <property>/controls/gear/wheel[0]/brake</property>
+   <value type="double">1.0</value>
+  </binding>
+  <binding>
+   <command>property-assign</command>
+   <property>/controls/gear/wheel[1]/brake</property>
+   <value type="double">1.0</value>
+  </binding>
+  <binding>
+   <command>property-assign</command>
+   <property>/controls/gear/wheel[2]/brake</property>
+   <value type="double">1.0</value>
+  </binding>
+  <mod-up>
+   <binding>
+    <command>property-assign</command>
+    <property>/controls/gear/wheel[0]/brake</property>
+    <value type="double">0.0</value>
+   </binding>
+   <binding>
+    <command>property-assign</command>
+    <property>/controls/gear/wheel[1]/brake</property>
+    <value type="double">0.0</value>
+   </binding>
+   <binding>
+    <command>property-assign</command>
+    <property>/controls/gear/wheel[2]/brake</property>
+    <value type="double">0.0</value>
+   </binding>
+  </mod-up>
+ </button>
+
+ <button n="2">
+  <desc>Elevator trim up</desc>
+  <repeatable type="bool">true</repeatable>
+  <binding>
+   <command>property-adjust</command>
+   <property>/controls/flight/elevator-trim</property>
+   <step type="double">0.001</step>
+  </binding>
+ </button>
+
+ <button n="3">
+  <desc>Elevator trim down</desc>
+  <repeatable type="bool">true</repeatable>
+  <binding>
+   <command>property-adjust</command>
+   <property>/controls/flight/elevator-trim</property>
+   <step type="double">-0.001</step>
+  </binding>
+ </button>
+
+ <button n="6">
+  <desc>Flaps down</desc>
+  <repeatable>false</repeatable>
+  <binding>
+   <command>property-adjust</command>
+   <property>/controls/flight/flaps</property>
+   <step type="double">-0.34</step>
+  </binding>
+ </button>
+
+ <button n="7">
+  <desc>Flaps up</desc>
+  <repeatable>false</repeatable>
+  <binding>
+   <command>property-adjust</command>
+   <property>/controls/flight/flaps</property>
+   <step type="double">0.34</step>
+  </binding>
+ </button>
+
+ <button n="4">
+  <desc>Right brake</desc>
+  <binding>
+   <command>property-assign</command>
+   <property>/controls/gear/wheel[1]/brake</property>
+   <value type="double">1.0</value>
+  </binding>
+  <mod-up>
+   <binding>
+    <command>property-assign</command>
+    <property>/controls/gear/wheel[1]/brake</property>
+    <value type="double">0.0</value>
+   </binding>
+  </mod-up>
+ </button>
+
+ <button n="5">
+  <desc>Left brake</desc>
+  <binding>
+   <command>property-assign</command>
+   <property>/controls/gear/wheel[0]/brake</property>
+   <value type="double">1.0</value>
+  </binding>
+  <mod-up>
+   <binding>
+    <command>property-assign</command>
+    <property>/controls/gear/wheel[0]/brake</property>
+    <value type="double">0.0</value>
+   </binding>
+  </mod-up>
+ </button>
+
+</PropertyList>
diff --git a/Input/Joysticks/ThrustMaster/FCS.xml b/Input/Joysticks/ThrustMaster/FCS.xml
new file mode 100644
index 000000000..8a02b967f
--- /dev/null
+++ b/Input/Joysticks/ThrustMaster/FCS.xml
@@ -0,0 +1,151 @@
+<?xml version="1.0"?>
+
+<!--
+************************************************************************
+Setup for a Thrustmaster FCS-compatible joystick with
+one stick, one digital hat, and four buttons.
+
+Layout:
+  Axis 0: ailerons
+  Axis 1: elevator
+
+  Hat:
+    Axis 2: rudder
+    Axis 3: elevator trim
+
+  Button 0: brakes
+  Button 1: center rudder
+  Button 2: flaps up
+  Button 3: flaps down
+************************************************************************
+-->
+
+<PropertyList>
+
+ <name>Analog 2-axis 4-button 1-hat FCS joystick</name>
+
+ <axis n="0">
+  <desc>Aileron</desc>
+  <binding>
+   <command>property-scale</command>
+   <property>/controls/flight/aileron</property>
+   <power type="double">2</power>
+  </binding>
+ </axis>
+
+ <axis n="1">
+  <desc>Elevator</desc>
+  <binding>
+   <command>property-scale</command>
+   <property>/controls/flight/elevator</property>
+   <factor type="double">-1.0</factor>
+   <power type="double">2</power>
+  </binding>
+ </axis>
+
+ <axis n="2">
+  <desc>Rudder</desc>
+  <low>
+   <repeatable type="bool">true</repeatable>
+   <binding>
+    <command>property-adjust</command>
+    <property>/controls/flight/rudder</property>
+    <step type="double">-0.05</step>
+   </binding>
+  </low>
+  <high>
+   <repeatable type="bool">true</repeatable>
+   <binding>
+    <command>property-adjust</command>
+    <property>/controls/flight/rudder</property>
+    <step type="double">0.05</step>
+   </binding>
+  </high>
+ </axis>
+
+ <axis n="3">
+  <desc>Elevator trim</desc>
+  <low>
+   <repeatable type="bool">true</repeatable>
+   <binding>
+    <command>property-adjust</command>
+    <property>/controls/flight/elevator-trim</property>
+    <step type="double">0.001</step>
+   </binding>
+  </low>
+  <high>
+   <repeatable type="bool">true</repeatable>
+   <binding>
+    <command>property-adjust</command>
+    <property>/controls/flight/elevator-trim</property>
+    <step type="double">-0.001</step>
+   </binding>
+  </high>
+ </axis>
+
+ <button n="0">
+  <desc>Brakes</desc>
+  <binding>
+   <command>property-assign</command>
+   <property>/controls/gear/wheel[0]/brake</property>
+   <value type="double">1.0</value>
+  </binding>
+  <binding>
+   <command>property-assign</command>
+   <property>/controls/gear/wheel[1]/brake</property>
+   <value type="double">1.0</value>
+  </binding>
+  <binding>
+   <command>property-assign</command>
+   <property>/controls/gear/wheel[2]/brake</property>
+   <value type="double">1.0</value>
+  </binding>
+  <mod-up>
+   <binding>
+    <command>property-assign</command>
+    <property>/controls/gear/wheel[0]/brake</property>
+    <value type="double">0.0</value>
+   </binding>
+   <binding>
+    <command>property-assign</command>
+    <property>/controls/gear/wheel[1]/brake</property>
+    <value type="double">0.0</value>
+   </binding>
+   <binding>
+    <command>property-assign</command>
+    <property>/controls/gear/wheel[2]/brake</property>
+    <value type="double">0.0</value>
+   </binding>
+  </mod-up>
+ </button>
+
+ <button n="1">
+  <desc>Center rudder</desc>
+  <binding>
+   <command>property-assign</command>
+   <property>/controls/flight/rudder</property>
+   <value type="double">0.0</value>
+  </binding>
+ </button>
+
+ <button n="2">
+  <desc>Flaps up</desc>
+  <binding>
+   <command>property-adjust</command>
+   <property>/controls/flight/flaps</property>
+   <step type="double">-0.34</step>
+  </binding>
+ </button>
+
+ <button n="3">
+  <desc>Flaps down</desc>
+   <binding>
+   <command>property-adjust</command>
+   <property>/controls/flight/flaps</property>
+   <step type="double">0.34</step>
+  </binding>
+ </button>
+
+</PropertyList>
+
+<!-- end of FCS.xml -->
diff --git a/joysticks.xml b/joysticks.xml
index 0cfbad603..a9ffd84d0 100644
--- a/joysticks.xml
+++ b/joysticks.xml
@@ -34,6 +34,10 @@ Joystick binding definitions.
  <js-named include="Input/Joysticks/Saitek/Cyborg-Gold-3d-USB.xml"/>
  <js-named include="Input/Joysticks/Saitek/Cyborg-3d-Rumble-Force.xml"/>
 
+ <!-- ThrustMaster devices -->
+ <js-named include="Input/Joysticks/Thrustmaster/FCS.xml"/>
+ <js-named include="Input/Joysticks/ThrustMaster/Attack-Throttle.xml"/>
+
  <!-- Lew Engineering RCJOY device for various RC transmitters.  http://www.leweng.com -->
  <js-named include="Input/Joysticks/LewEngineering/RC-transmitter-hitecLaser4.xml"/>