2011-09-09 14:23:35 +00:00
|
|
|
<?xml version="1.0"?>
|
|
|
|
<!--
|
|
|
|
Copyright (c) 2011 Melchior FRANZ mfranz # aon : at
|
|
|
|
Work In Progress
|
|
|
|
-->
|
|
|
|
|
|
|
|
<PropertyList>
|
|
|
|
<name>Thustmaster Joystick - HOTAS Warthog</name>
|
|
|
|
|
|
|
|
<nasal>
|
warthog: add js overlay support
This allows to have generic axis/button definitions with aircraft
specific or aircraft class specific modification overlays. These
are also found in $FG_HOME, where they override global files. This
mechanism is desirable, because the Warthog is an A-10 replica, and
it should be possible to have an automatically loaded (1:1 mapped)
A-10 joystick config when flying the A-10, while using generic layouts
otherwise, or a specific helicopter overlay for helicopters etc.
Overlay files look exactly like joystick config files, except they
have no <name> and only specify actually differing elements. Axes
with <number> *need* a property index (e.g. <axis n="2">), which
usually corresponds to the <unix> value (i.e. n'th axis def in file).
Overlay files can contain a <nasal> block which is executed on
load. The files are to be named {$FG_ROOT,$FG_HOME}/Input/Joysticks/\
ThrustMaster/Warthog/{Joystick,Throttle}/{generic,helicopter,<aircraft>}\
.xml.
2011-09-09 22:03:11 +00:00
|
|
|
<command>nasal</command>
|
2011-09-09 14:23:35 +00:00
|
|
|
<script>
|
|
|
|
var this = cmdarg().getParent();
|
|
|
|
var popup = func gui.popupTip(call(sprintf, arg));
|
warthog: add js overlay support
This allows to have generic axis/button definitions with aircraft
specific or aircraft class specific modification overlays. These
are also found in $FG_HOME, where they override global files. This
mechanism is desirable, because the Warthog is an A-10 replica, and
it should be possible to have an automatically loaded (1:1 mapped)
A-10 joystick config when flying the A-10, while using generic layouts
otherwise, or a specific helicopter overlay for helicopters etc.
Overlay files look exactly like joystick config files, except they
have no <name> and only specify actually differing elements. Axes
with <number> *need* a property index (e.g. <axis n="2">), which
usually corresponds to the <unix> value (i.e. n'th axis def in file).
Overlay files can contain a <nasal> block which is executed on
load. The files are to be named {$FG_ROOT,$FG_HOME}/Input/Joysticks/\
ThrustMaster/Warthog/{Joystick,Throttle}/{generic,helicopter,<aircraft>}\
.xml.
2011-09-09 22:03:11 +00:00
|
|
|
var is_dir = func(path) {(var stat = io.stat(path)) != nil and stat[11] == "dir"};
|
|
|
|
var is_helicopter = (var _ = props.globals.getNode("rotors", 0)) != nil and _.getAttribute("children");
|
|
|
|
var dir = "/Input/Joysticks/ThrustMaster/Warthog/Joystick/";
|
2011-09-09 14:23:35 +00:00
|
|
|
|
warthog: add js overlay support
This allows to have generic axis/button definitions with aircraft
specific or aircraft class specific modification overlays. These
are also found in $FG_HOME, where they override global files. This
mechanism is desirable, because the Warthog is an A-10 replica, and
it should be possible to have an automatically loaded (1:1 mapped)
A-10 joystick config when flying the A-10, while using generic layouts
otherwise, or a specific helicopter overlay for helicopters etc.
Overlay files look exactly like joystick config files, except they
have no <name> and only specify actually differing elements. Axes
with <number> *need* a property index (e.g. <axis n="2">), which
usually corresponds to the <unix> value (i.e. n'th axis def in file).
Overlay files can contain a <nasal> block which is executed on
load. The files are to be named {$FG_ROOT,$FG_HOME}/Input/Joysticks/\
ThrustMaster/Warthog/{Joystick,Throttle}/{generic,helicopter,<aircraft>}\
.xml.
2011-09-09 22:03:11 +00:00
|
|
|
var overlay = {};
|
|
|
|
foreach (var base; [getprop("/sim/fg-root"), getprop("/sim/fg-home")])
|
|
|
|
if (is_dir(base ~ dir))
|
|
|
|
foreach (var file; directory(base ~ dir))
|
|
|
|
overlay[file] = base ~ dir ~ file;
|
|
|
|
|
|
|
|
var load_overlay = func(name) {
|
|
|
|
var file = name ~ ".xml";
|
|
|
|
if (contains(overlay, file)) {
|
|
|
|
printlog("info", "WARTHOG: loading overlay " ~ overlay[file]);
|
|
|
|
cmdarg().getNode("script").setValue("");
|
|
|
|
io.read_properties(overlay[file], this);
|
|
|
|
props.runBinding(cmdarg());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
load_overlay("generic");
|
|
|
|
if (is_helicopter)
|
|
|
|
load_overlay("helicopter");
|
|
|
|
load_overlay(getprop("/sim/aircraft"));
|
|
|
|
overlay = nil;
|
2011-09-09 14:23:35 +00:00
|
|
|
|
|
|
|
foreach (var b; this.getChildren("button")) {
|
|
|
|
if (b.getAttribute("children") == 1) {
|
|
|
|
var name = b.getNode("name", 1).getValue() or "??";
|
|
|
|
b.setValues({binding: {command: "nasal", script: 'popup("' ~ name ~ '")'}});
|
|
|
|
}
|
|
|
|
}
|
warthog: add js overlay support
This allows to have generic axis/button definitions with aircraft
specific or aircraft class specific modification overlays. These
are also found in $FG_HOME, where they override global files. This
mechanism is desirable, because the Warthog is an A-10 replica, and
it should be possible to have an automatically loaded (1:1 mapped)
A-10 joystick config when flying the A-10, while using generic layouts
otherwise, or a specific helicopter overlay for helicopters etc.
Overlay files look exactly like joystick config files, except they
have no <name> and only specify actually differing elements. Axes
with <number> *need* a property index (e.g. <axis n="2">), which
usually corresponds to the <unix> value (i.e. n'th axis def in file).
Overlay files can contain a <nasal> block which is executed on
load. The files are to be named {$FG_ROOT,$FG_HOME}/Input/Joysticks/\
ThrustMaster/Warthog/{Joystick,Throttle}/{generic,helicopter,<aircraft>}\
.xml.
2011-09-09 22:03:11 +00:00
|
|
|
|
|
|
|
var trimstep = 0.75;
|
2011-09-09 14:23:35 +00:00
|
|
|
</script>
|
|
|
|
</nasal>
|
|
|
|
|
|
|
|
<axis n="0">
|
|
|
|
<name>X-axis</name>
|
|
|
|
<desc>aileron</desc>
|
|
|
|
<tolerance>0.0001</tolerance>
|
|
|
|
<binding>
|
|
|
|
<command>property-scale</command>
|
|
|
|
<property>/controls/flight/aileron</property>
|
|
|
|
</binding>
|
|
|
|
</axis>
|
|
|
|
|
|
|
|
<axis n="1">
|
|
|
|
<name>Y-axis</name>
|
|
|
|
<desc>elevator</desc>
|
|
|
|
<tolerance>0.0001</tolerance>
|
|
|
|
<binding>
|
|
|
|
<command>property-scale</command>
|
|
|
|
<property>/controls/flight/elevator</property>
|
|
|
|
<factor type="double">-1.0</factor>
|
|
|
|
</binding>
|
|
|
|
</axis>
|
|
|
|
|
|
|
|
<axis n="2">
|
|
|
|
<name>Trim Coolie Left/Right</name>
|
|
|
|
<desc>aileron trim</desc>
|
|
|
|
<low>
|
|
|
|
<repeatable>true</repeatable>
|
|
|
|
<binding>
|
|
|
|
<command>nasal</command>
|
|
|
|
<script>controls.aileronTrim(-trimstep)</script>
|
|
|
|
</binding>
|
|
|
|
</low>
|
|
|
|
<high>
|
|
|
|
<repeatable>true</repeatable>
|
|
|
|
<binding>
|
|
|
|
<command>nasal</command>
|
|
|
|
<script>controls.aileronTrim(trimstep)</script>
|
|
|
|
</binding>
|
|
|
|
</high>
|
|
|
|
</axis>
|
|
|
|
|
|
|
|
<axis n="3">
|
|
|
|
<name>Trim Coolie Down/Up</name>
|
|
|
|
<desc>elevator trim</desc>
|
|
|
|
<low>
|
|
|
|
<repeatable>true</repeatable>
|
|
|
|
<binding>
|
|
|
|
<command>nasal</command>
|
|
|
|
<script>controls.elevatorTrim(trimstep)</script>
|
|
|
|
</binding>
|
|
|
|
</low>
|
|
|
|
<high>
|
|
|
|
<repeatable>true</repeatable>
|
|
|
|
<binding>
|
|
|
|
<command>nasal</command>
|
|
|
|
<script>controls.elevatorTrim(-trimstep)</script>
|
|
|
|
</binding>
|
|
|
|
</high>
|
|
|
|
</axis>
|
|
|
|
|
|
|
|
<button n="0">
|
|
|
|
<name>Trigger Button 1</name>
|
|
|
|
<desc>gun trigger stage 1</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 n="1">
|
|
|
|
<name>Weapons Release</name>
|
|
|
|
</button>
|
|
|
|
|
|
|
|
<button n="2">
|
|
|
|
<name>Nosewheel Steering Button</name>
|
|
|
|
</button>
|
|
|
|
|
|
|
|
<button n="3">
|
|
|
|
<name>Paddle Switch</name>
|
|
|
|
</button>
|
|
|
|
|
|
|
|
<button n="4">
|
|
|
|
<name>Master Mode Control Button</name>
|
|
|
|
</button>
|
|
|
|
|
|
|
|
<button n="5">
|
|
|
|
<name>Trigger Button 2</name>
|
|
|
|
<desc>gun trigger stage 2</desc>
|
|
|
|
<binding>
|
|
|
|
<command>nasal</command>
|
|
|
|
<script>controls.trigger(2)</script>
|
|
|
|
</binding>
|
|
|
|
<mod-up>
|
|
|
|
<binding>
|
|
|
|
<command>nasal</command>
|
|
|
|
<script>controls.trigger(0)</script>
|
|
|
|
</binding>
|
|
|
|
</mod-up>
|
|
|
|
</button>
|
|
|
|
|
|
|
|
<button n="6">
|
|
|
|
<name>Target Management Switch (TMS) up</name>
|
|
|
|
</button>
|
|
|
|
|
|
|
|
<button n="7">
|
|
|
|
<name>Target Management Switch (TMS) right</name>
|
|
|
|
</button>
|
|
|
|
|
|
|
|
<button n="8">
|
|
|
|
<name>Target Management Switch (TMS) down</name>
|
|
|
|
</button>
|
|
|
|
|
|
|
|
<button n="9">
|
|
|
|
<name>Target Management Switch (TMS) left</name>
|
|
|
|
</button>
|
|
|
|
|
|
|
|
<button n="10">
|
|
|
|
<name>Data Management Switch (DMS) up</name>
|
|
|
|
</button>
|
|
|
|
|
|
|
|
<button n="11">
|
|
|
|
<name>Data Management Switch (DMS) right</name>
|
|
|
|
</button>
|
|
|
|
|
|
|
|
<button n="12">
|
|
|
|
<name>Data Management Switch (DMS) down</name>
|
|
|
|
</button>
|
|
|
|
|
|
|
|
<button n="13">
|
|
|
|
<name>Data Management Switch (DMS) left</name>
|
|
|
|
</button>
|
|
|
|
|
|
|
|
<button n="14">
|
|
|
|
<name>Countermeasures Management Switch (CMS) up</name>
|
|
|
|
</button>
|
|
|
|
|
|
|
|
<button n="15">
|
|
|
|
<name>Countermeasures Management Switch (CMS) right</name>
|
|
|
|
</button>
|
|
|
|
|
|
|
|
<button n="16">
|
|
|
|
<name>Countermeasures Management Switch (CMS) down</name>
|
|
|
|
</button>
|
|
|
|
|
|
|
|
<button n="17">
|
|
|
|
<name>Countermeasures Management Switch (CMS) left</name>
|
|
|
|
</button>
|
|
|
|
|
|
|
|
<button n="18">
|
|
|
|
<name>Countermeasures Management Switch (CMS) push</name>
|
|
|
|
</button>
|
|
|
|
</PropertyList>
|