diff --git a/Input/Joysticks/ThrustMaster/Warthog/README b/Input/Joysticks/ThrustMaster/Warthog/README new file mode 100644 index 000000000..fc0e4d898 --- /dev/null +++ b/Input/Joysticks/ThrustMaster/Warthog/README @@ -0,0 +1,35 @@ +("Master files") Warthog-Stick.xml and Warthog-Throttle.xml support +configuration overlay files. These are optional and can be used to +modify the default configuration. Warthog-Stick.xml searches for +overlay files in + + {$FG_HOME,$FG_ROOT}/Input/Joysticks/ThrustMaster/Warthog/Stick/ + +and Warthog-Throttle.xml in + + {$FG_HOME,$FG_ROOT}/Input/Joysticks/ThrustMaster/Warthog/Throttle/ + + +Available files are loaded in the following order, where is replaced +by the contents of property "x": + + - generic.xml + - helicopter.xml (only helicopters) + - .xml (some aircraft set this property to "seaplane") + - .xml (not used by the system; meant to + be set on the command line or in wrapper scripts, + for example: --prop:input/joysticks/overlay=modern_jet) + - .xml (aircraft name, for example "harrier.xml") + + +If a file is found under $FG_HOME, then an equally named file under +$FG_ROOT will be ignored. + +Overlay files are like stripped down joystick driver files, but shall +not have a entry. They only need to define what should differ +from the already loaded joystick configuration. Make sure that an +axis definition uses the same index as the master file. The n-th + in an XML config file usually has index n, even if the axis +uses etc. Nasal blocks are properly executed in the +namespace of the master file, so you can access all its functions +and variables. diff --git a/Input/Joysticks/ThrustMaster/Warthog/Throttle/helicopter.xml b/Input/Joysticks/ThrustMaster/Warthog/Throttle/helicopter.xml new file mode 100644 index 000000000..51cf49390 --- /dev/null +++ b/Input/Joysticks/ThrustMaster/Warthog/Throttle/helicopter.xml @@ -0,0 +1,13 @@ + + + + + Hat Switch Horizontal + adjust engine balance + + + + Hat Switch Vertical + adjust engine power + + diff --git a/Input/Joysticks/ThrustMaster/Warthog-Stick.xml b/Input/Joysticks/ThrustMaster/Warthog/Warthog-Stick.xml similarity index 85% rename from Input/Joysticks/ThrustMaster/Warthog-Stick.xml rename to Input/Joysticks/ThrustMaster/Warthog/Warthog-Stick.xml index 4b47100ff..614cb4d44 100644 --- a/Input/Joysticks/ThrustMaster/Warthog-Stick.xml +++ b/Input/Joysticks/ThrustMaster/Warthog/Warthog-Stick.xml @@ -1,7 +1,12 @@ @@ -13,10 +18,12 @@ var this = cmdarg().getParent(); var popup = func gui.popupTip(call(sprintf, arg)); var is_helicopter = (var _ = props.globals.getNode("rotors", 0)) != nil and _.getAttribute("children"); + var aircraft_type = getprop("/sim/type"); + var overlay = getprop("/input/joysticks/overlay"); var load_overlay = func(name) { foreach (var dir; [getprop("/sim/fg-home"), getprop("/sim/fg-root")]) { - var file = dir ~ "/Input/Joysticks/ThrustMaster/Warthog/Joystick/" ~ name; + var file = dir ~ "/Input/Joysticks/ThrustMaster/Warthog/Joystick/" ~ name ~ ".xml"; if (io.stat(file) != nil) { printlog("info", "WARTHOG: loading overlay " ~ file); cmdarg().getNode("script").setValue(""); @@ -48,10 +55,14 @@ viewdir[i] = t != nil and t.getValue() == "lookat" ? 1 : -1; } - load_overlay("generic.xml"); + load_overlay("generic"); if (is_helicopter) - load_overlay("helicopter.xml"); - load_overlay(getprop("/sim/aircraft") ~ ".xml"); + load_overlay("helicopter"); + if (aircraft_type) + load_overlay(aircraft_type); + if (overlay) + load_overlay(overlay); + load_overlay(getprop("/sim/aircraft")); @@ -77,7 +88,7 @@ - Trim Coolie Left/Right + Trim Hat Switch Left/Right adjust aileron trim, +mod: reset aileron trim true @@ -106,7 +117,7 @@ - Trim Coolie Down/Up + Trim Hat Switch Down/Up adjust elevator trim, +mod: reset elevator trim true @@ -136,17 +147,7 @@