Saitek X36: Updated to my last version.
This commit is contained in:
parent
a460620891
commit
617fc1de70
1 changed files with 99 additions and 77 deletions
|
@ -1,70 +1,60 @@
|
|||
<?xml version="1.0" ?>
|
||||
<!-- $Id$ -->
|
||||
<!-- Saitek X36F + X35T binding.
|
||||
<!-- Saitek X36F + X35T binding.
|
||||
|
||||
Copyright (C) 2005-2007 Anders Gidenstam (anders(at)gidenstam.org)
|
||||
This file is released under the GPL license.
|
||||
Copyright (C) 2005-2012 Anders Gidenstam (anders(at)gidenstam.org)
|
||||
This file is released under the GPL license version 2 or later.
|
||||
-->
|
||||
<!--
|
||||
Remember to tell the joystick driver that it is a full CHF stick:
|
||||
On GNU/Linux this can be done in this way:
|
||||
|
||||
% modprobe analog js=0x7ff,0x7ff
|
||||
Linux 2.4.x kernel:
|
||||
modprobe analog js=0x7ff,0x7ff
|
||||
Linux 2.6.x kernel:
|
||||
modprobe analog map=fullchf
|
||||
|
||||
-->
|
||||
<PropertyList>
|
||||
|
||||
<!-- NOTE: The X36 is a game port device so it may get a generic name. -->
|
||||
<name>Saitek X36</name>
|
||||
<name>Saitek Saitek X36</name>
|
||||
<name>Analog 4-axis 6-button 2-hat CHF joystick</name>
|
||||
<name type="string">Saitek X36</name>
|
||||
<name type="string">Saitek Saitek X36</name>
|
||||
<name type="string">Analog 4-axis 6-button 2-hat CHF joystick</name>
|
||||
|
||||
<data>
|
||||
<view-mode type="int">0</view-mode>
|
||||
<old-heading-offset type="double">0</old-heading-offset>
|
||||
<old-pitch-offset type="double">0</old-pitch-offset>
|
||||
<old-field-of-view type="double">0</old-field-of-view>
|
||||
<quick-view-active type="int">0</quick-view-active>
|
||||
<stick-active type="int">1</stick-active>
|
||||
</data>
|
||||
|
||||
<nasal>
|
||||
<script>
|
||||
<![CDATA[
|
||||
self = cmdarg().getParent();
|
||||
data = self.getNode("data");
|
||||
view_mode = data.getNode("view-mode");
|
||||
old_heading_offset = data.getNode("old-heading-offset");
|
||||
old_pitch_offset = data.getNode("old-pitch-offset");
|
||||
old_field_of_view = data.getNode("old-field-of-view");
|
||||
quick_view_active = data.getNode("quick-view-active");
|
||||
var self = cmdarg().getParent();
|
||||
var data = self.getNode("data");
|
||||
var view_mode = data.getNode("view-mode");
|
||||
var quick_view_active = data.getNode("quick-view-active");
|
||||
var stick_active = data.getNode("stick-active");
|
||||
var old_view = view.point.save();
|
||||
|
||||
heading_offset =
|
||||
props.globals.getNode("/sim/current-view/heading-offset-deg", 1);
|
||||
pitch_offset =
|
||||
props.globals.getNode("/sim/current-view/pitch-offset-deg", 1);
|
||||
goal_heading_offset =
|
||||
var goal_heading_offset =
|
||||
props.globals.getNode("/sim/current-view/goal-heading-offset-deg", 1);
|
||||
goal_pitch_offset =
|
||||
var goal_pitch_offset =
|
||||
props.globals.getNode("/sim/current-view/goal-pitch-offset-deg", 1);
|
||||
|
||||
kbdshift = props.globals.getNode("/devices/status/keyboard/shift", 1);
|
||||
kbdctrl = props.globals.getNode("/devices/status/keyboard/ctrl", 1);
|
||||
kbdalt = props.globals.getNode("/devices/status/keyboard/alt", 1);
|
||||
var kbdshift = props.globals.getNode("/devices/status/keyboard/shift", 1);
|
||||
var kbdctrl = props.globals.getNode("/devices/status/keyboard/ctrl", 1);
|
||||
var kbdalt = props.globals.getNode("/devices/status/keyboard/alt", 1);
|
||||
|
||||
quick_view = func {
|
||||
dir = arg[0];
|
||||
var quick_view = func {
|
||||
var dir = arg[0];
|
||||
if (dir == 0) {
|
||||
quick_view_active.setIntValue(0);
|
||||
goal_heading_offset.setDoubleValue
|
||||
(old_heading_offset.getValue());
|
||||
goal_pitch_offset.setDoubleValue(old_pitch_offset.getValue());
|
||||
view.fovProp.setDoubleValue(old_field_of_view.getValue());
|
||||
view.point.move(old_view, 0.1);
|
||||
} else {
|
||||
if (quick_view_active.getValue() == 0) {
|
||||
quick_view_active.setIntValue(1);
|
||||
old_heading_offset.setDoubleValue(heading_offset.getValue());
|
||||
old_pitch_offset.setDoubleValue(pitch_offset.getValue());
|
||||
old_field_of_view.setDoubleValue(view.fovProp.getValue());
|
||||
old_view = view.point.save();
|
||||
|
||||
if (dir == 1) {
|
||||
goal_heading_offset.setDoubleValue
|
||||
|
@ -97,7 +87,25 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var aileron = props.globals.getNode("/controls/flight/aileron", 1);
|
||||
var elevator = props.globals.getNode("/controls/flight/elevator", 1);
|
||||
var rudder = props.globals.getNode("/controls/flight/rudder", 1);
|
||||
var aileron_js = props.globals.getNode("/controls/flight/aileron-js", 1);
|
||||
var elevator_js = props.globals.getNode("/controls/flight/elevator-js", 1);
|
||||
var rudder_js = props.globals.getNode("/controls/flight/rudder-js", 1);
|
||||
|
||||
var js_active = func {
|
||||
settimer(js_active, 0);
|
||||
if (stick_active.getValue()) {
|
||||
aileron.setDoubleValue(aileron_js.getValue());
|
||||
elevator.setDoubleValue(elevator_js.getValue());
|
||||
rudder.setDoubleValue(rudder_js.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
setlistener("/sim/signals/fdm-initialized", js_active);
|
||||
]]>
|
||||
</script>
|
||||
</nasal>
|
||||
|
@ -107,7 +115,7 @@
|
|||
<desc>aileron</desc>
|
||||
<binding>
|
||||
<command>property-scale</command>
|
||||
<property>/controls/flight/aileron</property>
|
||||
<property>/controls/flight/aileron-js</property>
|
||||
<dead-band type="double">0.0</dead-band>
|
||||
<offset type="double">0.0</offset>
|
||||
<squared type="bool">true</squared>
|
||||
|
@ -119,7 +127,7 @@
|
|||
<desc>elevator</desc>
|
||||
<binding>
|
||||
<command>property-scale</command>
|
||||
<property>/controls/flight/elevator</property>
|
||||
<property>/controls/flight/elevator-js</property>
|
||||
<dead-band type="double">0.0</dead-band>
|
||||
<offset type="double">0.0</offset>
|
||||
<factor type="double">-1.0</factor>
|
||||
|
@ -128,17 +136,15 @@
|
|||
</axis>
|
||||
|
||||
<!-- Analog axis 3. Rudder -->
|
||||
<!-- NOTE: This axis is tweaked due to faulty hardware.
|
||||
The standard case should be offset=0, factor=1.
|
||||
-->
|
||||
<axis n="3">
|
||||
<desc>rudder</desc>
|
||||
<binding>
|
||||
<command>property-scale</command>
|
||||
<property>/controls/flight/rudder</property>
|
||||
<dead-band type="double">0.030</dead-band>
|
||||
<offset type="double">0.1</offset>
|
||||
<factor type="double">0.9</factor>
|
||||
<property>/controls/flight/rudder-js</property>
|
||||
<dead-band type="double">0.010</dead-band>
|
||||
<offset type="double">0.0</offset>
|
||||
<factor type="double">1.0</factor>
|
||||
<squared type="bool">true</squared>
|
||||
</binding>
|
||||
</axis>
|
||||
|
||||
|
@ -164,7 +170,7 @@
|
|||
<script>
|
||||
<![CDATA[
|
||||
#print("X36.xml: Axis 4, Hat 1: low!");
|
||||
m = view_mode.getValue();
|
||||
var m = view_mode.getValue();
|
||||
if (m == 0) {
|
||||
view.panViewDir(0.5);
|
||||
} if (m == 1) {
|
||||
|
@ -178,7 +184,7 @@
|
|||
<command>nasal</command>
|
||||
<script>
|
||||
#print("X36.xml: Axis 4, Hat 1: low released!");
|
||||
m = view_mode.getValue();
|
||||
var m = view_mode.getValue();
|
||||
if (m == 1) {
|
||||
quick_view(0);
|
||||
}
|
||||
|
@ -193,7 +199,7 @@
|
|||
<script>
|
||||
<![CDATA[
|
||||
#print("X36.xml: Axis 4, Hat 1: high!");
|
||||
m = view_mode.getValue();
|
||||
var m = view_mode.getValue();
|
||||
if (m == 0) {
|
||||
view.panViewDir(-0.5);
|
||||
} if (m == 1) {
|
||||
|
@ -207,7 +213,7 @@
|
|||
<command>nasal</command>
|
||||
<script>
|
||||
#print("X36.xml: Axis 4, Hat 1: low released!");
|
||||
m = view_mode.getValue();
|
||||
var m = view_mode.getValue();
|
||||
if (m == 1) {
|
||||
quick_view(0);
|
||||
}
|
||||
|
@ -230,7 +236,7 @@
|
|||
<script>
|
||||
<![CDATA[
|
||||
#print("X36.xml: Axis 5, Hat 1: low!");
|
||||
m = view_mode.getValue();
|
||||
var m = view_mode.getValue();
|
||||
if (m == 0) {
|
||||
view.panViewPitch(0.5);
|
||||
} if (m == 1) {
|
||||
|
@ -244,7 +250,7 @@
|
|||
<command>nasal</command>
|
||||
<script>
|
||||
#print("X36.xml: Axis 4, Hat 1: low released!");
|
||||
m = view_mode.getValue();
|
||||
var m = view_mode.getValue();
|
||||
if (m == 1) {
|
||||
quick_view(0);
|
||||
}
|
||||
|
@ -259,7 +265,7 @@
|
|||
<script>
|
||||
<![CDATA[
|
||||
#print("X36.xml: Axis 5, Hat 1: low!");
|
||||
m = view_mode.getValue();
|
||||
var m = view_mode.getValue();
|
||||
if (m == 0) {
|
||||
view.panViewPitch(-0.5);
|
||||
} if (m == 1) {
|
||||
|
@ -274,7 +280,7 @@
|
|||
<command>nasal</command>
|
||||
<script>
|
||||
#print("X36.xml: Axis 4, Hat 1: low released!");
|
||||
m = view_mode.getValue();
|
||||
var m = view_mode.getValue();
|
||||
if (m == 1) {
|
||||
#quick_view(0);
|
||||
}
|
||||
|
@ -290,7 +296,6 @@
|
|||
Left - Right := Axis 6.high - Axis 7.low
|
||||
-->
|
||||
<axis n="6">
|
||||
<name>Left hat up/down</name>
|
||||
<desc>elevator trim (hat up/down)</desc>
|
||||
<low>
|
||||
<repeatable type="bool">true</repeatable>
|
||||
|
@ -316,7 +321,6 @@
|
|||
|
||||
<!-- Axis 7. Hat 2. -->
|
||||
<axis n="7">
|
||||
<name>Left hat left/right</name>
|
||||
<desc>Zoom out/in (hat left/right)</desc>
|
||||
<low>
|
||||
<repeatable type="bool">true</repeatable>
|
||||
|
@ -343,23 +347,28 @@
|
|||
<!-- Button: Trigger -->
|
||||
<button n="0">
|
||||
<name>Trigger</name>
|
||||
<desc>brakes, +Shift: Toggle parking brake</desc>
|
||||
<desc>brakes, +Shift: Toggle parking brake, +Ctrl: trigger</desc>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>
|
||||
#print("X36.xml: Button 0 pressed!");
|
||||
if (kbdshift.getBoolValue()) {
|
||||
controls.applyParkingBrake(1);
|
||||
} else {
|
||||
controls.applyBrakes(1);
|
||||
}
|
||||
#print("X36.xml: Button 0 pressed!");
|
||||
if (kbdctrl.getBoolValue()) {
|
||||
controls.trigger(1);
|
||||
} else {
|
||||
if (kbdshift.getBoolValue()) {
|
||||
controls.applyParkingBrake(1);
|
||||
} else {
|
||||
controls.applyBrakes(1);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</binding>
|
||||
<mod-up>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>
|
||||
controls.applyBrakes(0);
|
||||
controls.applyBrakes(0);
|
||||
controls.trigger(0);
|
||||
</script>
|
||||
</binding>
|
||||
</mod-up>
|
||||
|
@ -368,13 +377,25 @@
|
|||
<!-- Button: Fire C -->
|
||||
<button n="1">
|
||||
<name>Fire C</name>
|
||||
<desc>cycle views</desc>
|
||||
<desc>next view +Shift: previous view +Ctrl: next weapon +Ctrl+Shift: previous weapon</desc>
|
||||
<repeatable>false</repeatable>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>
|
||||
#print("X36.xml: Button 1 pressed!");
|
||||
view.stepView(1)
|
||||
if (kbdctrl.getBoolValue()) {
|
||||
if (kbdshift.getBoolValue()) {
|
||||
controls.weaponSelect(-1);
|
||||
} else {
|
||||
controls.weaponSelect(1);
|
||||
}
|
||||
} else {
|
||||
if (kbdshift.getBoolValue()) {
|
||||
view.stepView(-1)
|
||||
} else {
|
||||
view.stepView(1)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</binding>
|
||||
</button>
|
||||
|
@ -436,6 +457,13 @@
|
|||
}
|
||||
</script>
|
||||
</binding>
|
||||
<mod-up>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>
|
||||
</script>
|
||||
</binding>
|
||||
</mod-up>
|
||||
</button>
|
||||
|
||||
<!-- Button: F.lock -->
|
||||
|
@ -446,23 +474,17 @@
|
|||
<command>nasal</command>
|
||||
<script>
|
||||
#print("X36.xml: Button 5 pressed!");
|
||||
var p = "/controls/flight/speedbrake";
|
||||
var sb = "/controls/flight/speedbrake";
|
||||
if (kbdshift.getBoolValue()) {
|
||||
setprop(p, 1.0);
|
||||
setprop(sb, 1.0);
|
||||
} else {
|
||||
setprop(p, 0.0);
|
||||
setprop(sb, 0.0);
|
||||
}
|
||||
if (kbdalt.getBoolValue()) {
|
||||
stick_active.setIntValue(!stick_active.getValue());
|
||||
}
|
||||
</script>
|
||||
</binding>
|
||||
</button>
|
||||
|
||||
</PropertyList>
|
||||
<!--
|
||||
* Overrides tab width for this buffer in Emacs so the tab width is reasonable.
|
||||
* This must remain at the end of the file.
|
||||
* ===========================================================================
|
||||
* Local variables:
|
||||
* tab-width: 1
|
||||
* indent-tabs-mode: nil
|
||||
* End:
|
||||
-->
|
||||
|
|
Loading…
Reference in a new issue