1
0
Fork 0

Merge branch 'master' of gitorious.org:fg/fgdata

This commit is contained in:
Durk Talsma 2011-09-16 20:14:11 +02:00
commit 05ae9ac31a
4 changed files with 96 additions and 40 deletions

View file

@ -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 <x> is replaced
by the contents of property "x":
- generic.xml
- helicopter.xml (only helicopters)
- </sim/type>.xml (some aircraft set this property to "seaplane")
- </input/joysticks/overlay>.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)
- </sim/aircraft>.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 <name> 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
<axis> in an XML config file usually has index n, even if the axis
uses <number><unix> etc. Nasal blocks are properly executed in the
namespace of the master file, so you can access all its functions
and variables.

View file

@ -0,0 +1,13 @@
<?xml version="1.0"?>
<PropertyList>
<axis n="5">
<name>Hat Switch Horizontal</name>
<desc>adjust engine balance</desc>
</axis>
<axis n="6">
<name>Hat Switch Vertical</name>
<desc>adjust engine power</desc>
</axis>
</PropertyList>

View file

@ -1,7 +1,12 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!-- <!--
Copyright (c) 2011 Melchior FRANZ mfranz # aon : at Copyright (c) 2011 Melchior FRANZ mfranz # aon : at
Work In Progress
This driver supports joystick overlay files (see ./Warthog/README).
TMS ... Target Management Switch (black, rippled cursor switch, left side)
DMS ... Data Management Switch (black cursor switch with flat cross on top, right side)
CMS ... Countermeasures Management Switch (grey)
--> -->
<PropertyList> <PropertyList>
@ -13,10 +18,12 @@
var this = cmdarg().getParent(); var this = cmdarg().getParent();
var popup = func gui.popupTip(call(sprintf, arg)); var popup = func gui.popupTip(call(sprintf, arg));
var is_helicopter = (var _ = props.globals.getNode("rotors", 0)) != nil and _.getAttribute("children"); 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) { var load_overlay = func(name) {
foreach (var dir; [getprop("/sim/fg-home"), getprop("/sim/fg-root")]) { 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) { if (io.stat(file) != nil) {
printlog("info", "WARTHOG: loading overlay " ~ file); printlog("info", "WARTHOG: loading overlay " ~ file);
cmdarg().getNode("script").setValue(""); cmdarg().getNode("script").setValue("");
@ -48,10 +55,14 @@
viewdir[i] = t != nil and t.getValue() == "lookat" ? 1 : -1; viewdir[i] = t != nil and t.getValue() == "lookat" ? 1 : -1;
} }
load_overlay("generic.xml"); load_overlay("generic");
if (is_helicopter) if (is_helicopter)
load_overlay("helicopter.xml"); load_overlay("helicopter");
load_overlay(getprop("/sim/aircraft") ~ ".xml"); if (aircraft_type)
load_overlay(aircraft_type);
if (overlay)
load_overlay(overlay);
load_overlay(getprop("/sim/aircraft"));
</script> </script>
</nasal> </nasal>
@ -77,7 +88,7 @@
</axis> </axis>
<axis n="2"> <axis n="2">
<name>Trim Coolie Left/Right</name> <name>Trim Hat Switch Left/Right</name>
<desc>adjust aileron trim, +mod: reset aileron trim</desc> <desc>adjust aileron trim, +mod: reset aileron trim</desc>
<low> <low>
<repeatable>true</repeatable> <repeatable>true</repeatable>
@ -106,7 +117,7 @@
</axis> </axis>
<axis n="3"> <axis n="3">
<name>Trim Coolie Down/Up</name> <name>Trim Hat Switch Down/Up</name>
<desc>adjust elevator trim, +mod: reset elevator trim</desc> <desc>adjust elevator trim, +mod: reset elevator trim</desc>
<low> <low>
<repeatable>true</repeatable> <repeatable>true</repeatable>
@ -136,17 +147,7 @@
<button n="0"> <button n="0">
<name>Trigger Button/Half Pushed</name> <name>Trigger Button/Half Pushed</name>
<desc>gun trigger stage 1</desc> <desc>camera oper</desc>
<binding>
<command>nasal</command>
<script>controls.trigger(1)</script>
</binding>
<mod-up>
<binding>
<command>nasal</command>
<script>controls.trigger(0)</script>
</binding>
</mod-up>
</button> </button>
<button n="1"> <button n="1">
@ -180,10 +181,10 @@
<button n="5"> <button n="5">
<name>Trigger Button/Fully Pushed</name> <name>Trigger Button/Fully Pushed</name>
<desc>gun trigger stage 2</desc> <desc>gun trigger</desc>
<binding> <binding>
<command>nasal</command> <command>nasal</command>
<script>controls.trigger(2)</script> <script>controls.trigger(1)</script>
</binding> </binding>
<mod-up> <mod-up>
<binding> <binding>
@ -194,7 +195,7 @@
</button> </button>
<button n="6"> <button n="6">
<name>Target Management Switch (TMS) up</name> <name>left black curosr (TMS) up</name>
<desc>zoom in, +mod: reset zoom</desc> <desc>zoom in, +mod: reset zoom</desc>
<repeatable>true</repeatable> <repeatable>true</repeatable>
<binding> <binding>
@ -209,7 +210,7 @@
</button> </button>
<button n="7"> <button n="7">
<name>Target Management Switch (TMS) right</name> <name>left black cursor (TMS) right</name>
<desc>next active view, +mod: next view</desc> <desc>next active view, +mod: next view</desc>
<binding> <binding>
<command>nasal</command> <command>nasal</command>
@ -218,7 +219,7 @@
</button> </button>
<button n="8"> <button n="8">
<name>Target Management Switch (TMS) down</name> <name>left black cursor (TMS) down</name>
<desc>zoom out, +mod: reset zoom</desc> <desc>zoom out, +mod: reset zoom</desc>
<repeatable>true</repeatable> <repeatable>true</repeatable>
<binding> <binding>
@ -233,7 +234,7 @@
</button> </button>
<button n="9"> <button n="9">
<name>Target Management Switch (TMS) left</name> <name>left black cursor (TMS) left</name>
<desc>previous active view, +mod: previous view</desc> <desc>previous active view, +mod: previous view</desc>
<binding> <binding>
<command>nasal</command> <command>nasal</command>
@ -242,7 +243,7 @@
</button> </button>
<button n="10"> <button n="10">
<name>Data Management Switch (DMS) up</name> <name>right black cursor (DMS) up</name>
<desc>brakes</desc> <desc>brakes</desc>
<binding> <binding>
<command>nasal</command> <command>nasal</command>
@ -257,7 +258,7 @@
</button> </button>
<button n="11"> <button n="11">
<name>Data Management Switch (DMS) right</name> <name>right black cursor (DMS) right</name>
<desc>brakes right</desc> <desc>brakes right</desc>
<binding> <binding>
<command>nasal</command> <command>nasal</command>
@ -272,7 +273,7 @@
</button> </button>
<button n="12"> <button n="12">
<name>Data Management Switch (DMS) down</name> <name>right black cursor (DMS) down</name>
<desc>toggle parking brake</desc> <desc>toggle parking brake</desc>
<binding> <binding>
<command>nasal</command> <command>nasal</command>
@ -291,7 +292,7 @@
</button> </button>
<button n="13"> <button n="13">
<name>Data Management Switch (DMS) left</name> <name>right black cursor (DMS) left</name>
<desc>brakes left</desc> <desc>brakes left</desc>
<binding> <binding>
<command>nasal</command> <command>nasal</command>
@ -306,7 +307,7 @@
</button> </button>
<button n="14"> <button n="14">
<name>Countermeasures Management Switch (CMS) up</name> <name>grey cursor (CMS) up</name>
<desc>view up</desc> <desc>view up</desc>
<repeatable>true</repeatable> <repeatable>true</repeatable>
<binding> <binding>
@ -316,7 +317,7 @@
</button> </button>
<button n="15"> <button n="15">
<name>Countermeasures Management Switch (CMS) right</name> <name>grey cursor (CMS) right</name>
<desc>view right</desc> <desc>view right</desc>
<repeatable>true</repeatable> <repeatable>true</repeatable>
<binding> <binding>
@ -326,7 +327,7 @@
</button> </button>
<button n="16"> <button n="16">
<name>Countermeasures Management Switch (CMS) down</name> <name>grey cursor (CMS) down</name>
<desc>view down</desc> <desc>view down</desc>
<repeatable>true</repeatable> <repeatable>true</repeatable>
<binding> <binding>
@ -336,7 +337,7 @@
</button> </button>
<button n="17"> <button n="17">
<name>Countermeasures Management Switch (CMS) left</name> <name>grey cursor (CMS) left</name>
<desc>view left</desc> <desc>view left</desc>
<repeatable>true</repeatable> <repeatable>true</repeatable>
<binding> <binding>
@ -346,7 +347,7 @@
</button> </button>
<button n="18"> <button n="18">
<name>Countermeasures Management Switch (CMS) push</name> <name>grey cursor (CMS) push</name>
<desc>center view, +mod: centered cockpit view</desc> <desc>center view, +mod: centered cockpit view</desc>
<binding> <binding>
<command>nasal</command> <command>nasal</command>

View file

@ -1,7 +1,8 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!-- <!--
Copyright (c) 2011 Melchior FRANZ mfranz # aon : at Copyright (c) 2011 Melchior FRANZ mfranz # aon : at
Work In Progress
This driver supports joystick overlay files (see ./Warthog/README).
--> -->
<PropertyList> <PropertyList>
@ -13,10 +14,12 @@
var this = cmdarg().getParent(); var this = cmdarg().getParent();
var popup = func gui.popupTip(call(sprintf, arg)); var popup = func gui.popupTip(call(sprintf, arg));
var is_helicopter = (var _ = props.globals.getNode("rotors", 0)) != nil and _.getAttribute("children"); 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) { var load_overlay = func(name) {
foreach (var dir; [getprop("/sim/fg-home"), getprop("/sim/fg-root")]) { foreach (var dir; [getprop("/sim/fg-home"), getprop("/sim/fg-root")]) {
var file = dir ~ "/Input/Joysticks/ThrustMaster/Warthog/Throttle/" ~ name; var file = dir ~ "/Input/Joysticks/ThrustMaster/Warthog/Throttle/" ~ name ~ ".xml";
if (io.stat(file) != nil) { if (io.stat(file) != nil) {
printlog("info", "WARTHOG: loading overlay " ~ file); printlog("info", "WARTHOG: loading overlay " ~ file);
cmdarg().getNode("script").setValue(""); cmdarg().getNode("script").setValue("");
@ -41,10 +44,14 @@
var left_engines = [0, 2, 4, 6, 8, 10]; var left_engines = [0, 2, 4, 6, 8, 10];
var right_engines = [1, 3, 5, 7, 9, 11]; var right_engines = [1, 3, 5, 7, 9, 11];
load_overlay("generic.xml"); load_overlay("generic");
if (is_helicopter) if (is_helicopter)
load_overlay("helicopter.xml"); load_overlay("helicopter");
load_overlay(getprop("/sim/aircraft") ~ ".xml"); if (aircraft_type)
load_overlay(aircraft_type);
if (overlay)
load_overlay(overlay);
load_overlay(getprop("/sim/aircraft"));
</script> </script>
</nasal> </nasal>
@ -98,7 +105,7 @@
</axis> </axis>
<axis n="5"> <axis n="5">
<name>Coolie Switch Horizontal</name> <name>Hat Switch Horizontal</name>
<desc>adjust mixture: left = leaner, right = fatter</desc> <desc>adjust mixture: left = leaner, right = fatter</desc>
<number> <number>
<unix>5</unix> <unix>5</unix>
@ -122,7 +129,7 @@
</axis> </axis>
<axis n="6"> <axis n="6">
<name>Coolie Switch Vertical</name> <name>Hat Switch Vertical</name>
<desc>adjust propeller pitch: forward = increase, backward = decrease</desc> <desc>adjust propeller pitch: forward = increase, backward = decrease</desc>
<number> <number>
<unix>6</unix> <unix>6</unix>