Hello and Merry Christmas!

i fixed the inverted view elevation setting for the 
sidewinder precision pro joystick because the view elevation was inverted 
under windows.
This new script in the config file checks on what OS flightgear is running
by using a new flightgear property called "/sim/operating-system" and assigns
the according value to the view.panViewPitch nasal command.
The new flightgear property  "/sim/operating-system" is set in the 
options.,cxx file.
See the attached options.patch file.



Best Regards,
 Oliver C.









--- alt/options.cxx	2004-12-25 00:22:56.000000000 +0100
+++ neu/options.cxx	2004-12-25 00:26:00.000000000 +0100
@@ -179,6 +179,33 @@
 #endif
     fgSetString("/sim/logging/priority", "alert");
 
+                                // OS-Detection  
+#if defined(WIN32)
+    fgSetString("/sim/operating-system", "windows");
+#elif defined( macintosh )
+    fgSetString("/sim/operating-system", "macintosh");
+#elif defined( unix )
+{
+    fgSetString("/sim/operating-system", "unix");
+    
+    /*
+    #if defined(__linux__)
+      fgSetString("/sim/operating-system", "linux");
+    #elif defined(__sun__)
+      fgSetString("/sim/operating-system", "solaris");
+    #elif defined(__CYGWIN__)
+      fgSetString("/sim/operating-system", "cygwin"); 
+    #elif defined(__FreeBSD__)
+      fgSetString("/sim/operating-system", "freebsd");
+    #elif defined(__sgi__)
+      fgSetString("/sim/operating-system", "irix");
+    #endif
+    */
+}
+#else 
+    fgSetString("/sim/operating-system", "unknown");
+#endif
+
 				// Features
     fgSetBool("/sim/hud/antialiased", false);
     fgSetBool("/sim/hud/enable3d", true);
<?xml version="1.0"?>

<!--
************************************************************************
* Bindings for Microsoft SideWinder Precision Pro joystick.
*
*                                            
* Axis 0:                         ailerons
* Axis 1:                         elevator
* Axis 2(Unix)/3(Win) (twist):    rudder
* Axis 3(Unix)/2(Win):            throttle
* Axis 4(Unix)/6(Win) (hat):      view direction
* Axes 5(Unix)/7(Win) (hat):      view elevation
*
* In game Name:                   Action:             Button name on Joystick:    Value:
* Button 0 (trigger):             all brakes                                      0001
* Button 1:                       view-cylce                                      0002
* Button 2:                       elevator trim up                                0004
* Button 3:                       elevator trim down                              0008
* Button 4:                       flaps up            Button B                    0020
* Button 5:                       flap down           Button A                    0010
* Button 6:                       left brake only     Button C                    0040
* Button 7:                       right brake only    Button D                    0080
* Button 8(Unix)/9(Win):          gear up             Shift Button                0100(unix), 0200(Win)
************************************************************************
$Id: sidewinder-precision-pro.xml,v 1.20 2004/11/08 00:29:00 Oliver Exp $
-->

<PropertyList>

 <name>Microsoft SideWinder Precision Pro</name>
 <name>Microsoft SideWinder Precision 2 Joystick</name>
 <name>Microsoft Microsoft SideWinder Precision Pro (USB)</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>
  <desc>Rudder</desc>
  <number>
   <unix>2</unix>
   <windows>3</windows>
  </number>
  <binding>
   <command>property-scale</command>
   <property>/controls/flight/rudder</property>
   <factor type="double">1.0</factor>
  </binding>
 </axis>

 <axis>
  <desc>Throttle</desc>
  <number>
   <unix>3</unix>
   <windows>2</windows>
  </number>
  <binding>
   <command>nasal</command>
   <script>controls.throttleAxis()</script>
  </binding>
 </axis>

  <axis>
   <desc>View Direction</desc>
   <number>
    <unix>4</unix>
    <windows>6</windows>
   </number>
   <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>
   <desc>View Elevation</desc>
   <number>
    <unix>5</unix>
    <windows>7</windows>  <!-- axis is inverse in WinMe, please fix this -->
   </number>
  <low>
   <repeatable>true</repeatable>
   <binding>
    <command>nasal</command>
    <script><![CDATA[
      # invert Axis under Windows
      if(getprop("/sim/operating-system") == "windows")
      {  
	view.panViewPitch(-1);
      }
      else
      {  
	view.panViewPitch(1);
      }
    ]]></script>	
   </binding>
  </low>
  <high>
   <repeatable>true</repeatable>
   <binding>
    <command>nasal</command>
    <script><![CDATA[
      # invert Axis under Windows
      if(getprop("/sim/operating-system") == "windows")
      {
        view.panViewPitch(1);
      }
      else
      {  
	view.panViewPitch(-1);
      }
    ]]></script> 
    <script>view.panViewPitch(-1)</script>
   </binding>
  </high>
  </axis>

 <button n="0">
  <desc>Brakes</desc>
  <binding>
   <command>property-assign</command>
   <property>/controls/gear/brake-left</property>
   <value type="double">1.0</value>
  </binding>
  <binding>
   <command>property-assign</command>
   <property>/controls/gear/brake-right</property>
   <value type="double">1.0</value>
  </binding>
  <mod-up>
   <binding>
    <command>property-assign</command>
    <property>/controls/gear/brake-left</property>
    <value type="double">0.0</value>
   </binding>
   <binding>
    <command>property-assign</command>
    <property>/controls/gear/brake-right</property>
    <value type="double">0.0</value>
   </binding>
  </mod-up>
 </button>


 <button n="1">
  <desc>view-cycle</desc>
  <repeatable>false</repeatable>
  <binding>
   <command>view-cycle</command>
  </binding>
 </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="4">
  <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="5">
  <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="6">
  <desc>Left brake</desc>
  <binding>
   <command>property-assign</command>
   <property>/controls/gear/brake-left</property>
   <value type="double">1.0</value>
  </binding>
  <mod-up>
   <binding>
    <command>property-assign</command>
    <property>/controls/gear/brake-left</property>
    <value type="double">0.0</value>
   </binding>
  </mod-up>
 </button>
 
<button n="7">
  <desc>Right brake</desc>
  <binding>
   <command>property-assign</command>
   <property>/controls/gear/brake-right</property>
   <value type="double">1.0</value>
  </binding>
  <mod-up>
   <binding>
    <command>property-assign</command>
    <property>/controls/gear/brake-right</property>
    <value type="double">0.0</value>
   </binding>
  </mod-up>
 </button>

 <button>
  <desc>Gear Up.</desc>
  <number>
    <unix>8</unix>
    <windows>9</windows>
   </number>  
  <repeatable>false</repeatable>
  <!--
    <binding>
      <command>property-assign</command>
      <property>/controls/gear/gear-down</property>
      <value type="double">0.0</value>
    </binding>
  -->  
  <unix>
    <binding>
      <command>property-assign</command>
      <property>/controls/gear/gear-down</property>
      <value type="double">0.0</value>   
    </binding>    
  </unix>
  <windows>  
    <binding>
       <command>view-cycle</command>
    </binding>
  </windows>
  
 </button>

</PropertyList>


_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@flightgear.org
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d

Reply via email to