AC 1.0 Update:

change for new option tree and naming
pull/104/head
bm98 10 years ago
parent 0640564f6a
commit 4c617f85ab

@ -1007,25 +1007,33 @@ namespace SCJMapper_V2
if ( dev != null ) {
// JS commands that are supported
if ( nodeText.ToLowerInvariant( ).EndsWith( "_x" ) || nodeText.ToLowerInvariant( ).EndsWith( "_rotx" ) ) {
m_AT.ActionMaps.TuningX.GameDevice = dev;
m_AT.ActionMaps.TuningX.ActionCommand = nodeText;
JSCAL.YawTuning = m_AT.ActionMaps.TuningX;
m_AT.ActionMaps.TuningY.GameDevice = dev;
m_AT.ActionMaps.TuningY.ActionCommand = nodeText;
m_AT.ActionMaps.DeadzoneX.GameDevice = dev;
m_AT.ActionMaps.TuningY.Deadzone = m_AT.ActionMaps.DeadzoneX;
JSCAL.YawTuning = m_AT.ActionMaps.TuningY;
}
else if ( nodeText.ToLowerInvariant( ).EndsWith( "_y" ) || nodeText.ToLowerInvariant( ).EndsWith( "_roty" ) ) {
m_AT.ActionMaps.TuningY.GameDevice = dev;
m_AT.ActionMaps.TuningY.ActionCommand = nodeText;
m_AT.ActionMaps.DeadzoneY.GameDevice = dev;
m_AT.ActionMaps.TuningY.Deadzone = m_AT.ActionMaps.DeadzoneY;
JSCAL.YawTuning = m_AT.ActionMaps.TuningY;
}
else if ( nodeText.ToLowerInvariant( ).EndsWith( "_z" ) || nodeText.ToLowerInvariant( ).EndsWith( "_rotz" ) ) {
m_AT.ActionMaps.TuningZ.GameDevice = dev;
m_AT.ActionMaps.TuningZ.ActionCommand = nodeText;
JSCAL.YawTuning = m_AT.ActionMaps.TuningZ;
m_AT.ActionMaps.TuningY.GameDevice = dev;
m_AT.ActionMaps.TuningY.ActionCommand = nodeText;
m_AT.ActionMaps.DeadzoneZ.GameDevice = dev;
m_AT.ActionMaps.TuningY.Deadzone = m_AT.ActionMaps.DeadzoneZ;
JSCAL.YawTuning = m_AT.ActionMaps.TuningY;
}
// GP commands that are supported - X
else if ( nodeText.ToLowerInvariant( ).Contains( "_thumblx" ) || nodeText.ToLowerInvariant( ).Contains( "_thumbrx" ) ) {
m_AT.ActionMaps.TuningX.GameDevice = dev;
m_AT.ActionMaps.TuningX.ActionCommand = nodeText;
JSCAL.YawTuning = m_AT.ActionMaps.TuningX;
m_AT.ActionMaps.TuningY.GameDevice = dev;
m_AT.ActionMaps.TuningY.ActionCommand = nodeText;
m_AT.ActionMaps.DeadzoneX.GameDevice = dev;
m_AT.ActionMaps.TuningY.Deadzone = m_AT.ActionMaps.DeadzoneX;
JSCAL.YawTuning = m_AT.ActionMaps.TuningY;
}
}
@ -1055,25 +1063,33 @@ namespace SCJMapper_V2
if ( dev != null ) {
// JS commands that are supported
if ( nodeText.ToLowerInvariant( ).EndsWith( "_x" ) || nodeText.ToLowerInvariant( ).EndsWith( "_rotx" ) ) {
m_AT.ActionMaps.TuningX.GameDevice = dev;
m_AT.ActionMaps.TuningX.ActionCommand = nodeText;
JSCAL.PitchTuning = m_AT.ActionMaps.TuningX;
m_AT.ActionMaps.TuningP.GameDevice = dev;
m_AT.ActionMaps.TuningP.ActionCommand = nodeText;
m_AT.ActionMaps.DeadzoneX.GameDevice = dev;
m_AT.ActionMaps.TuningP.Deadzone = m_AT.ActionMaps.DeadzoneX;
JSCAL.PitchTuning = m_AT.ActionMaps.TuningP;
}
else if ( nodeText.ToLowerInvariant( ).EndsWith( "_y" ) || nodeText.ToLowerInvariant( ).EndsWith( "_roty" ) ) {
m_AT.ActionMaps.TuningY.GameDevice = dev;
m_AT.ActionMaps.TuningY.ActionCommand = nodeText;
JSCAL.PitchTuning = m_AT.ActionMaps.TuningY;
m_AT.ActionMaps.TuningP.GameDevice = dev;
m_AT.ActionMaps.TuningP.ActionCommand = nodeText;
m_AT.ActionMaps.DeadzoneY.GameDevice = dev;
m_AT.ActionMaps.TuningP.Deadzone = m_AT.ActionMaps.DeadzoneY;
JSCAL.PitchTuning = m_AT.ActionMaps.TuningP;
}
else if ( nodeText.ToLowerInvariant( ).EndsWith( "_z" ) || nodeText.ToLowerInvariant( ).EndsWith( "_rotz" ) ) {
m_AT.ActionMaps.TuningZ.GameDevice = dev;
m_AT.ActionMaps.TuningZ.ActionCommand = nodeText;
JSCAL.PitchTuning = m_AT.ActionMaps.TuningZ;
m_AT.ActionMaps.TuningP.GameDevice = dev;
m_AT.ActionMaps.TuningP.ActionCommand = nodeText;
m_AT.ActionMaps.DeadzoneZ.GameDevice = dev;
m_AT.ActionMaps.TuningP.Deadzone = m_AT.ActionMaps.DeadzoneZ;
JSCAL.PitchTuning = m_AT.ActionMaps.TuningP;
}
// GP commands that are supported - either Y
else if ( nodeText.ToLowerInvariant( ).Contains( "_thumbly" ) || nodeText.ToLowerInvariant( ).Contains( "_thumbry" ) ) {
m_AT.ActionMaps.TuningY.GameDevice = dev;
m_AT.ActionMaps.TuningY.ActionCommand = nodeText;
JSCAL.PitchTuning = m_AT.ActionMaps.TuningY;
m_AT.ActionMaps.TuningP.GameDevice = dev;
m_AT.ActionMaps.TuningP.ActionCommand = nodeText;
m_AT.ActionMaps.DeadzoneY.GameDevice = dev;
m_AT.ActionMaps.TuningP.Deadzone = m_AT.ActionMaps.DeadzoneY;
JSCAL.PitchTuning = m_AT.ActionMaps.TuningP;
}
}
@ -1092,19 +1108,25 @@ namespace SCJMapper_V2
if ( dev != null ) {
// JS commands that are supported
if ( nodeText.ToLowerInvariant( ).EndsWith( "_x" ) || nodeText.ToLowerInvariant( ).EndsWith( "_rotx" ) ) {
m_AT.ActionMaps.TuningX.GameDevice = dev;
m_AT.ActionMaps.TuningX.ActionCommand = nodeText;
JSCAL.RollTuning = m_AT.ActionMaps.TuningX;
m_AT.ActionMaps.TuningR.GameDevice = dev;
m_AT.ActionMaps.TuningR.ActionCommand = nodeText;
m_AT.ActionMaps.DeadzoneX.GameDevice = dev;
m_AT.ActionMaps.TuningR.Deadzone = m_AT.ActionMaps.DeadzoneX;
JSCAL.RollTuning = m_AT.ActionMaps.TuningR;
}
else if ( nodeText.ToLowerInvariant( ).EndsWith( "_y" ) || nodeText.ToLowerInvariant( ).EndsWith( "_roty" ) ) {
m_AT.ActionMaps.TuningY.GameDevice = dev;
m_AT.ActionMaps.TuningY.ActionCommand = nodeText;
JSCAL.RollTuning = m_AT.ActionMaps.TuningY;
m_AT.ActionMaps.TuningR.GameDevice = dev;
m_AT.ActionMaps.TuningR.ActionCommand = nodeText;
m_AT.ActionMaps.DeadzoneY.GameDevice = dev;
m_AT.ActionMaps.TuningR.Deadzone = m_AT.ActionMaps.DeadzoneY;
JSCAL.RollTuning = m_AT.ActionMaps.TuningR;
}
else if ( nodeText.ToLowerInvariant( ).EndsWith( "_z" ) || nodeText.ToLowerInvariant( ).EndsWith( "_rotz" ) ) {
m_AT.ActionMaps.TuningZ.GameDevice = dev;
m_AT.ActionMaps.TuningZ.ActionCommand = nodeText;
JSCAL.RollTuning = m_AT.ActionMaps.TuningZ;
m_AT.ActionMaps.TuningR.GameDevice = dev;
m_AT.ActionMaps.TuningR.ActionCommand = nodeText;
m_AT.ActionMaps.DeadzoneZ.GameDevice = dev;
m_AT.ActionMaps.TuningR.Deadzone = m_AT.ActionMaps.DeadzoneZ;
JSCAL.RollTuning = m_AT.ActionMaps.TuningR;
}
}

@ -0,0 +1,109 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace SCJMapper_V2
{
public class DeviceDeadzoneParameter
{
private static readonly log4net.ILog log = log4net.LogManager.GetLogger( System.Reflection.MethodBase.GetCurrentMethod( ).DeclaringType );
private String m_actionCommand = ""; // v_pitch - js1_x ..
private String m_cmdCtrl = ""; // x, y, rotz ...
private String m_type = ""; // joystick OR xboxpad
private int m_devInstanceNo = -1; // jsN - instance in XML
String m_option = ""; // the option name (level where it applies)
private String m_deviceName = "";
private bool m_deadzoneEnabled = false; // default
private String m_deadzone = "0.000";
private DeviceCls m_device = null;
public DeviceDeadzoneParameter( )
{
}
#region Properties
public DeviceCls GameDevice
{
get { return m_device; }
set { m_device = value;
m_type = "";
m_devInstanceNo = -1;
if ( JoystickCls.IsDeviceClass( m_device.DevClass ) ) {
m_type = m_device.DevClass;
m_devInstanceNo = (m_device as JoystickCls).JSAssignment;
}
else if ( GamepadCls.IsDeviceClass( m_device.DevClass ) ) {
m_type = m_device.DevClass;
m_devInstanceNo = 1; // supports ONE gamepad
}
}
}
public int DevInstanceNo
{
get { return m_devInstanceNo; }
}
public String DeviceName
{
get { return m_deviceName; }
set { m_deviceName = value; }
}
public String CommandCtrl
{
get { return m_cmdCtrl; }
set { m_cmdCtrl = value; }
}
public bool DeadzoneUsed
{
get { return m_deadzoneEnabled; }
set { m_deadzoneEnabled = value; }
}
public String Deadzone
{
get { return m_deadzone; }
set { m_deadzone = value; }
}
#endregion
/// <summary>
/// Format an XML -deviceoptions- node from the tuning contents
/// </summary>
/// <returns>The XML string or an empty string</returns>
public String Deviceoptions_toXML( )
{
/*
<deviceoptions name="Joystick - HOTAS Warthog">
<!-- Reduce the deadzone -->
<option input="x" deadzone="0.015" />
<option input="y" deadzone="0.015" />
</deviceoptions>
*/
String tmp = "";
if ( m_deadzoneEnabled ) {
tmp += String.Format( "\t<deviceoptions name=\"{0}\">\n", m_deviceName );
tmp += String.Format( "\t\t<option input=\"{0}\" deadzone=\"{1}\" />\n", m_cmdCtrl, m_deadzone );
tmp += String.Format( "\t</deviceoptions>\n \n" );
}
return tmp;
}
}
}

@ -14,17 +14,14 @@ namespace SCJMapper_V2
private static readonly log4net.ILog log = log4net.LogManager.GetLogger( System.Reflection.MethodBase.GetCurrentMethod( ).DeclaringType );
private String m_actionCommand = ""; // v_pitch - js1_x ..
private String m_cmdCtrl = ""; // x, y, rotz ...
private String m_type = ""; // joystick OR xboxpad
private int m_devInstanceNo = -1; // jsN - instance in XML
private String m_cmdCtrl = ""; // x, y, rotz ...
private String m_type = ""; // joystick OR xboxpad
private int m_devInstanceNo = -1; // jsN - instance in XML
String m_option = ""; // the option name (level where it applies)
private String m_deviceName = "";
private bool m_deadzoneEnabled = false; // default
private String m_deadzone = "0.000";
private bool m_senseEnabled = false; // default
private String m_sense = "1.00";
@ -39,6 +36,8 @@ namespace SCJMapper_V2
private DeviceCls m_device = null;
private DeviceDeadzoneParameter m_deadzone = null;
public DeviceTuningParameter( )
{
}
@ -87,13 +86,7 @@ namespace SCJMapper_V2
}
public bool DeadzoneUsed
{
get { return m_deadzoneEnabled; }
set { m_deadzoneEnabled = value; }
}
public String Deadzone
public DeviceDeadzoneParameter Deadzone
{
get { return m_deadzone; }
set { m_deadzone = value; }
@ -155,75 +148,54 @@ namespace SCJMapper_V2
/// </summary>
private void DecomposeCommand( )
{
// pobulate from input
// populate from input
// something like "v_pitch - js1_x" OR "v_pitch - xi_thumbl" OR "v_pitch - ximod+xi_thumbl+xi_mod"
String cmd = ActionTreeNode.CommandFromNodeText( ActionCommand );
String action = ActionTreeNode.ActionFromNodeText( ActionCommand );
m_cmdCtrl = "";
if ( !String.IsNullOrWhiteSpace(cmd) ) {
if ( !String.IsNullOrWhiteSpace( cmd ) ) {
// decomp gamepad entries - could have modifiers so check for contains...
if ( cmd.Contains( "xi_thumblx" ) ) {
// gamepad
m_cmdCtrl = "xi_thumblx";
m_deviceName = m_device.DevName;
if ( action.Contains( "pitch" ) ) m_option = String.Format( "pilot_movepitch" );
else m_option = String.Format( "pilot_moveyaw" );
if ( action.Contains( "pitch" ) ) m_option = String.Format( "flight_move_pitch" );
else m_option = String.Format( "flight_move_yaw" );
}
else if ( cmd.Contains( "xi_thumbly" ) ) {
// gamepad
m_cmdCtrl = "xi_thumbly";
m_deviceName = m_device.DevName;
if ( action.Contains( "pitch" ) ) m_option = String.Format( "pilot_movepitch" );
else m_option = String.Format( "pilot_moveyaw" );
if ( action.Contains( "pitch" ) ) m_option = String.Format( "flight_move_pitch" );
else m_option = String.Format( "flight_move_yaw" );
}
else if ( cmd.Contains( "xi_thumbrx" ) ) {
// gamepad
m_cmdCtrl = "xi_thumbrx";
m_deviceName = m_device.DevName;
if ( action.Contains( "pitch" ) ) m_option = String.Format( "pilot_movepitch" );
else m_option = String.Format( "pilot_moveyaw" );
if ( action.Contains( "pitch" ) ) m_option = String.Format( "flight_move_pitch" );
else m_option = String.Format( "flight_move_yaw" );
}
else if ( cmd.Contains( "xi_thumbry" ) ) {
// gamepad
m_cmdCtrl = "xi_thumbry";
m_deviceName = m_device.DevName;
if ( action.Contains( "pitch" ) ) m_option = String.Format( "pilot_movepitch" );
else m_option = String.Format( "pilot_moveyaw" );
if ( action.Contains( "pitch" ) ) m_option = String.Format( "flight_move_pitch" );
else m_option = String.Format( "flight_move_yaw" );
}
// assume joystick
else {
// get parts
m_cmdCtrl = JoystickCls.ActionFromJsCommand( cmd ); //js1_x -> x; js2_rotz -> rotz
m_deviceName = m_device.DevName;
m_option = String.Format( "pilot_move_{0}", m_cmdCtrl ); // update from Command
if ( action.Contains( "pitch" ) ) m_option = String.Format( "flight_move_pitch" );
else if ( action.Contains( "yaw" ) ) m_option = String.Format( "flight_move_yaw" );
else m_option = String.Format( "flight_move_roll" );
}
}
}
/// <summary>
/// Format an XML -deviceoptions- node from the tuning contents
/// </summary>
/// <returns>The XML string or an empty string</returns>
public String Deviceoptions_toXML( )
{
/*
<deviceoptions name="Joystick - HOTAS Warthog">
<!-- Reduce the deadzone -->
<option input="x" deadzone="0.015" />
<option input="y" deadzone="0.015" />
</deviceoptions>
*/
String tmp = "";
if ( m_deadzoneEnabled ) {
tmp += String.Format( "\t<deviceoptions name=\"{0}\">\n", m_deviceName );
tmp += String.Format( "\t\t<option input=\"{0}\" deadzone=\"{1}\" />\n", m_cmdCtrl, m_deadzone );
tmp += String.Format( "\t</deviceoptions>\n \n" );
}
return tmp;
}
/// <summary>
/// Format an XML -options- node from the tuning contents
/// </summary>

@ -27,27 +27,51 @@ namespace SCJMapper_V2
private static readonly log4net.ILog log = log4net.LogManager.GetLogger( System.Reflection.MethodBase.GetCurrentMethod( ).DeclaringType );
List<String> m_stringOptions = new List<String>( );
Options m_options = null;
DeviceTuningParameter m_tuningX = null;
DeviceTuningParameter m_tuningY = null;
DeviceTuningParameter m_tuningZ = null;
DeviceDeadzoneParameter m_deadzoneX = null;
DeviceDeadzoneParameter m_deadzoneY = null;
DeviceDeadzoneParameter m_deadzoneZ = null;
// ctor
public Deviceoptions( Options options )
{
m_options = options;
m_tuningX = m_options.TuneX;
m_tuningY = m_options.TuneY;
m_tuningZ = m_options.TuneZ;
m_deadzoneX = new DeviceDeadzoneParameter();
m_deadzoneY = new DeviceDeadzoneParameter( );
m_deadzoneZ = new DeviceDeadzoneParameter( );
}
public int Count
{
get { return ( m_stringOptions.Count + ( ( m_tuningX != null ) ? 1 : 0 ) + ( ( m_tuningY != null ) ? 1 : 0 ) + ( ( m_tuningZ != null ) ? 1 : 0 ) ); }
get { return ( m_stringOptions.Count + ( ( m_deadzoneX != null ) ? 1 : 0 ) + ( ( m_deadzoneY != null ) ? 1 : 0 ) + ( ( m_deadzoneZ != null ) ? 1 : 0 ) ); }
}
// provide access to Sense items
/// <summary>
/// Returns the Z-sensitivity item
/// </summary>
public DeviceDeadzoneParameter DeadzoneX
{
get { return m_deadzoneX; }
}
/// <summary>
/// Returns the Z-sensitivity item
/// </summary>
public DeviceDeadzoneParameter DeadzoneY
{
get { return m_deadzoneY; }
}
/// <summary>
/// Returns the Z-sensitivity item
/// </summary>
public DeviceDeadzoneParameter DeadzoneZ
{
get { return m_deadzoneZ; }
}
private String[] FormatXml( string xml )
{
try {
@ -80,9 +104,9 @@ namespace SCJMapper_V2
}
// dump Tuning
r += m_tuningX.Deviceoptions_toXML( );
r += m_tuningY.Deviceoptions_toXML( );
r += m_tuningZ.Deviceoptions_toXML( );
r += m_deadzoneX.Deviceoptions_toXML( );
r += m_deadzoneY.Deviceoptions_toXML( );
r += m_deadzoneZ.Deviceoptions_toXML( );
return r;
}
@ -130,19 +154,19 @@ namespace SCJMapper_V2
String deadzone = reader["deadzone"];
if ( ! (String.IsNullOrWhiteSpace( input ) || String.IsNullOrWhiteSpace( deadzone )) ) {
if ( input.ToLowerInvariant( ).EndsWith("x") ) {
if ( String.IsNullOrWhiteSpace( m_tuningX.CommandCtrl ) ) m_tuningX.CommandCtrl = input; // if no options have been given...
if ( string.IsNullOrWhiteSpace( m_tuningX.DeviceName ) ) m_tuningX.DeviceName = name; // if no devicename has been given...
m_tuningX.DeadzoneUsed = true; m_tuningX.Deadzone = deadzone;
if ( String.IsNullOrWhiteSpace( m_deadzoneX.CommandCtrl ) ) m_deadzoneX.CommandCtrl = input; // if no options have been given...
if ( String.IsNullOrWhiteSpace( m_deadzoneX.DeviceName ) ) m_deadzoneX.DeviceName = name; // if no devicename has been given...
m_deadzoneX.DeadzoneUsed = true; m_deadzoneX.Deadzone = deadzone;
}
else if ( input.ToLowerInvariant( ).EndsWith("y") ) {
if ( String.IsNullOrWhiteSpace( m_tuningY.CommandCtrl ) ) m_tuningY.CommandCtrl = input; // if no options have been given...
if ( string.IsNullOrWhiteSpace( m_tuningY.DeviceName ) ) m_tuningY.DeviceName = name; // if no devicename has been given...
m_tuningY.DeadzoneUsed = true; m_tuningY.Deadzone = deadzone;
if ( String.IsNullOrWhiteSpace( m_deadzoneY.CommandCtrl ) ) m_deadzoneY.CommandCtrl = input; // if no options have been given...
if ( String.IsNullOrWhiteSpace( m_deadzoneY.DeviceName ) ) m_deadzoneY.DeviceName = name; // if no devicename has been given...
m_deadzoneY.DeadzoneUsed = true; m_deadzoneY.Deadzone = deadzone;
}
else if ( input.ToLowerInvariant( ).EndsWith( "z" ) ) {
if ( String.IsNullOrWhiteSpace( m_tuningZ.CommandCtrl )) m_tuningZ.CommandCtrl=input; // if no options have been given...
if ( string.IsNullOrWhiteSpace( m_tuningZ.DeviceName ) ) m_tuningZ.DeviceName = name; // if no devicename has been given...
m_tuningZ.DeadzoneUsed = true; m_tuningZ.Deadzone = deadzone;
if ( String.IsNullOrWhiteSpace( m_deadzoneZ.CommandCtrl )) m_deadzoneZ.CommandCtrl=input; // if no options have been given...
if ( String.IsNullOrWhiteSpace( m_deadzoneZ.DeviceName ) ) m_deadzoneZ.DeviceName = name; // if no devicename has been given...
m_deadzoneZ.DeadzoneUsed = true; m_deadzoneZ.Deadzone = deadzone;
}
else {
//?? option node refers to unknown axis (not x,y,rotz)

@ -28,62 +28,48 @@ namespace SCJMapper_V2
private static readonly log4net.ILog log = log4net.LogManager.GetLogger( System.Reflection.MethodBase.GetCurrentMethod( ).DeclaringType );
List<String> m_stringOptions = new List<String>( );
DeviceTuningParameter m_tuningX = null;
DeviceTuningParameter m_tuningY = null;
DeviceTuningParameter m_tuningZ = null;
DeviceTuningParameter m_tuningP = null; // pitch
DeviceTuningParameter m_tuningY = null; // yaw
DeviceTuningParameter m_tuningR = null; // roll
// ctor
public Options( JoystickList jsList )
{
m_tuningX = new DeviceTuningParameter( ); // can be x or rotx
m_tuningY = new DeviceTuningParameter( ); // can be y or roty
m_tuningZ = new DeviceTuningParameter( ); // can be z or rotz
m_tuningP = new DeviceTuningParameter( );
m_tuningY = new DeviceTuningParameter( );
m_tuningR = new DeviceTuningParameter( );
}
public int Count
{
get { return ( m_stringOptions.Count + ( ( m_tuningX != null ) ? 1 : 0 ) + ( ( m_tuningY != null ) ? 1 : 0 ) + ( ( m_tuningZ != null ) ? 1 : 0 ) ); }
get { return ( m_stringOptions.Count + ( ( m_tuningP != null ) ? 1 : 0 ) + ( ( m_tuningY != null ) ? 1 : 0 ) + ( ( m_tuningR != null ) ? 1 : 0 ) ); }
}
// provide access to Tuning items
/// <summary>
/// Returns the X-Tuning item
/// Returns the Pitch-Tuning item
/// </summary>
public DeviceTuningParameter TuneX
public DeviceTuningParameter TuneP
{
get { return m_tuningX; }
get { return m_tuningP; }
}
/// <summary>
/// Returns the Y-Tuning item
/// Returns the Yaw-Tuning item
/// </summary>
public DeviceTuningParameter TuneY
{
get { return m_tuningY; }
}
/// <summary>
/// Returns the Z-Tuning item
/// Returns the Roll-Tuning item
/// </summary>
public DeviceTuningParameter TuneZ
public DeviceTuningParameter TuneR
{
get { return m_tuningZ; }
get { return m_tuningR; }
}
/*
/// <summary>
/// reassign the JsN Tag
/// </summary>
/// <param name="newJsList">The JsN reassign list (old,new)</param>
public void ReassignJsN( Dictionary<int, int> newJsList )
{
foreach ( KeyValuePair<int,int> kv in newJsList ) {
if ( m_tuningX.JsN == kv.Key ) m_tuningX.JsN = kv.Value;
if ( m_tuningY.JsN == kv.Key ) m_tuningY.JsN = kv.Value;
if ( m_tuningZ.JsN == kv.Key ) m_tuningZ.JsN = kv.Value;
}
}
*/
private String[] FormatXml( string xml )
{
@ -117,9 +103,9 @@ namespace SCJMapper_V2
}
// dump Tuning
r += m_tuningX.Options_toXML( );
r += m_tuningP.Options_toXML( );
r += m_tuningY.Options_toXML( );
r += m_tuningZ.Options_toXML( );
r += m_tuningR.Options_toXML( );
return r;
}
@ -141,13 +127,9 @@ namespace SCJMapper_V2
<pilot_rot_moveyaw instance="1" sensitivity="0.8" exponent="1.2" />
</options>
* <options type="joystick" instance="1">
<!-- Make all main stick piloting input linear -->
<pilot_move_main exponent="1" />
</options>
*
<options type="joystick" instance="1">
<pilot>
<flight>
<nonlinearity_curve>
<point in="0.1" out="0.001"/>
<point in="0.25" out="0.02"/>
@ -159,7 +141,7 @@ namespace SCJMapper_V2
<point in="0.94" out="0.45"/>
<point in="0.95" out="0.75"/>
</nonlinearity_curve>
</pilot>
</flight>
</options>
*/
@ -187,32 +169,23 @@ namespace SCJMapper_V2
reader.Read( );
// try to disassemble the items
/*
* <pilot> instance="0/1" sensitivity="n.nn" exponent="n.nn" (instance should be invert)
* <pilot_move>
* <pilot_move_main>
* <pilot_move_x>
* <pilot_move_y>
* <pilot_move_z>
* <pilot_move_rot>
* <pilot_move_rotx>
* <pilot_move_roty>
* <pilot_move_rotz>
* <pilot_move_sliders>
* <pilot_move_slider1>
* <pilot_move_slider2>
* <pilot_throttle> invert="0/1"
* <pilot_aim>
* <pilot_aim_main>
* <pilot_aim_x>
* <pilot_aim_y>
* <pilot_aim_rot>
* <pilot_aim_rotz>
* <pilot_view>
* <pilot_view_main>
* <pilot_view_x>
* <pilot_view_y>
* <pilot_view_rot>
* <pilot_view_rotz>
* <flight> instance="0/1" sensitivity="n.nn" exponent="n.nn" (instance should be invert)
* <flight_move>
* <flight_move_pitch>
* <flight_move_yaw>
* <flight_move_roll>
* <flight_move_strafe_vertical>
* <flight_move_strafe_lateral>
* <flight_move_strafe_longitudinal>
* <flight_throttle> invert="0/1"
* <flight_throttle_abs>
* <flight_throttle_rel>
* <flight_aim>
* <flight_aim_pitch>
* <flight_aim_yaw>
* <flight_view>
* <flight_view_pitch>
* <flight_view_yaw>
*
*
<nonlinearity_curve>
@ -225,27 +198,14 @@ namespace SCJMapper_V2
*/
while ( !reader.EOF ) {
if ( reader.Name == "pilot_move_x" || reader.Name == "pilot_move_rotx" ) {
m_tuningX.Options_fromXML( reader, type, int.Parse( instance ) );
if ( reader.Name == "flight_move_pitch" ) {
m_tuningP.Options_fromXML( reader, type, int.Parse( instance ) );
}
else if ( reader.Name == "pilot_move_y" || reader.Name == "pilot_move_roty" ) {
else if ( reader.Name == "flight_move_yaw" ) {
m_tuningY.Options_fromXML( reader, type, int.Parse( instance ) );
}
else if ( reader.Name == "pilot_move_z" || reader.Name == "pilot_move_rotz" ) {
m_tuningZ.Options_fromXML( reader, type, int.Parse( instance ) );
}
// fixed - get pitch as X and Yaw as Y
else if ( reader.Name == "pilot_movepitch" ) {
m_tuningX.Options_fromXML( reader, type, int.Parse( instance ) );
}
else if ( reader.Name == "pilot_moveyaw" ) {
m_tuningY.Options_fromXML( reader, type, int.Parse( instance ) );
}
else if ( reader.Name == "pilot_throttle" ) {
// supports invert
//jtp.Options_fromXML( reader, int.Parse( instance ) );
log.InfoFormat( "Options.fromXML: pilot_throttle node not yet supported" );
else if ( reader.Name == "flight_move_roll" ) {
m_tuningR.Options_fromXML( reader, type, int.Parse( instance ) );
}
else {

@ -169,8 +169,8 @@ namespace SCJMapper_V2
log.Info( "FormJSCalCurve : Yaw Command is: " + value );
cbxYinvert.Checked = m_Ytuning.InvertUsed;
cbxYdeadzone.Checked = m_Ytuning.DeadzoneUsed;
lblYdeadzone.Text = m_Ytuning.Deadzone;
cbxYdeadzone.Checked = m_Ytuning.Deadzone.DeadzoneUsed;
lblYdeadzone.Text = m_Ytuning.Deadzone.Deadzone;
cbxYsense.Checked = m_Ytuning.SensitivityUsed;
lblYsense.Text = m_Ytuning.Sensitivity;
cbxYexpo.Checked = m_Ytuning.ExponentUsed;
@ -199,7 +199,7 @@ namespace SCJMapper_V2
private void YawUpdateTuning( )
{
// update from left area labels (xyUsed items are updated on change - so they are actual allready)
m_Ytuning.Deadzone = lblYdeadzone.Text;
m_Ytuning.Deadzone.Deadzone = lblYdeadzone.Text;
m_Ytuning.Sensitivity = lblYsense.Text;
m_Ytuning.Exponent = lblYexponent.Text;
List<String> pts = new List<String>( );
@ -249,8 +249,8 @@ namespace SCJMapper_V2
log.Info( "FormJSCalCurve : Pitch Command is: " + value );
cbxPinvert.Checked = m_Ptuning.InvertUsed;
cbxPdeadzone.Checked = m_Ptuning.DeadzoneUsed;
lblPdeadzone.Text = m_Ptuning.Deadzone;
cbxPdeadzone.Checked = m_Ptuning.Deadzone.DeadzoneUsed;
lblPdeadzone.Text = m_Ptuning.Deadzone.Deadzone;
cbxPsense.Checked = m_Ptuning.SensitivityUsed;
lblPsense.Text = m_Ptuning.Sensitivity;
cbxPexpo.Checked = m_Ptuning.ExponentUsed;
@ -279,7 +279,7 @@ namespace SCJMapper_V2
private void PitchUpdateTuning( )
{
// update from left area labels (xyUsed items are updated on change - so they are actual allready)
m_Ptuning.Deadzone = lblPdeadzone.Text;
m_Ptuning.Deadzone.Deadzone = lblPdeadzone.Text;
m_Ptuning.Sensitivity = lblPsense.Text;
m_Ptuning.Exponent = lblPexponent.Text;
List<String> pts = new List<String>( );
@ -328,8 +328,8 @@ namespace SCJMapper_V2
log.Info( "FormJSCalCurve : Roll Command is: " + value );
cbxRinvert.Checked = m_Rtuning.InvertUsed;
cbxRdeadzone.Checked = m_Rtuning.DeadzoneUsed;
lblRdeadzone.Text = m_Rtuning.Deadzone;
cbxRdeadzone.Checked = m_Rtuning.Deadzone.DeadzoneUsed;
lblRdeadzone.Text = m_Rtuning.Deadzone.Deadzone;
cbxRsense.Checked = m_Rtuning.SensitivityUsed;
lblRsense.Text = m_Rtuning.Sensitivity;
cbxRexpo.Checked = m_Rtuning.ExponentUsed;
@ -358,7 +358,7 @@ namespace SCJMapper_V2
private void RollUpdateTuning( )
{
// update from left area labels (xyUsed items are updated on change - so they are actual allready)
m_Rtuning.Deadzone = lblRdeadzone.Text;
m_Rtuning.Deadzone.Deadzone = lblRdeadzone.Text;
m_Rtuning.Sensitivity = lblRsense.Text;
m_Rtuning.Exponent = lblRexponent.Text;
List<String> pts = new List<String>( );
@ -706,7 +706,7 @@ namespace SCJMapper_V2
m_flightModel.Velocity = Vector3d.Zero;
// Yaw
if ( m_Ytuning.DeadzoneUsed ) {
if ( m_Ytuning.Deadzone.DeadzoneUsed ) {
int sx = Math.Sign( x );
x = ( int )( Math.Abs( x ) - m_liveYdeadzone ); x = ( x < 0 ) ? 0 : x * sx; // DZ is subtracted from the input
}
@ -729,7 +729,7 @@ namespace SCJMapper_V2
}
// Pitch
if ( m_Ptuning.DeadzoneUsed ) {
if ( m_Ptuning.Deadzone.DeadzoneUsed ) {
int sy = Math.Sign( y );
y = ( int )( Math.Abs( y ) - m_livePdeadzone ); y = ( y < 0 ) ? 0 : y * sy;
}
@ -750,7 +750,7 @@ namespace SCJMapper_V2
}
// Roll
if ( m_Rtuning.DeadzoneUsed ) {
if ( m_Rtuning.Deadzone.DeadzoneUsed ) {
int sz = Math.Sign( z );
z = ( int )( Math.Abs( z ) - m_liveRdeadzone ); z = ( z < 0 ) ? 0 : z * sz;
}
@ -1195,9 +1195,9 @@ namespace SCJMapper_V2
private void cbxYdeadzone_CheckedChanged( object sender, EventArgs e )
{
m_Ytuning.DeadzoneUsed = false;
m_Ytuning.Deadzone.DeadzoneUsed = false;
if ( cbxYdeadzone.Checked == true ) {
m_Ytuning.DeadzoneUsed = true; // update storage
m_Ytuning.Deadzone.DeadzoneUsed = true; // update storage
rbY.Checked = true; // auto switch
if ( rbY.Checked == true ) tbDeadzone.Value = ( int )( float.Parse( lblYdeadzone.Text ) * 0.2f ); // go live
}
@ -1205,9 +1205,9 @@ namespace SCJMapper_V2
private void cbxPdeadzone_CheckedChanged( object sender, EventArgs e )
{
m_Ptuning.DeadzoneUsed = false;
m_Ptuning.Deadzone.DeadzoneUsed = false;
if ( cbxPdeadzone.Checked == true ) {
m_Ptuning.DeadzoneUsed = true; // update storage
m_Ptuning.Deadzone.DeadzoneUsed = true; // update storage
rbP.Checked = true; // auto switch
if ( rbP.Checked == true ) tbDeadzone.Value = ( int )( float.Parse( lblPdeadzone.Text ) * 0.2f ); // go live
}
@ -1215,9 +1215,9 @@ namespace SCJMapper_V2
private void cbxRdeadzone_CheckedChanged( object sender, EventArgs e )
{
m_Rtuning.DeadzoneUsed = false;
m_Rtuning.Deadzone.DeadzoneUsed = false;
if ( cbxRdeadzone.Checked == true ) {
m_Rtuning.DeadzoneUsed = true; // update storage
m_Rtuning.Deadzone.DeadzoneUsed = true; // update storage
rbR.Checked = true; // auto switch
if ( rbR.Checked == true ) tbDeadzone.Value = ( int )( float.Parse( lblRdeadzone.Text ) * 0.2f ); // go live
}

@ -120,12 +120,13 @@
<Compile Include="appConfiguration.cs" />
<Compile Include="AppSettings.cs" />
<Compile Include="DeviceCls.cs" />
<Compile Include="Joystick\DeviceDeadzoneParameter.cs" />
<Compile Include="Gamepad\GamepadCls.cs" />
<Compile Include="Keyboard\KeyboardCls.cs" />
<Compile Include="Mouse\MouseCls.cs" />
<Compile Include="OGL\BezierSeries.cs" />
<Compile Include="OGL\CalcBezierCurve.cs" />
<Compile Include="Joystick\JoystickTuningParameter.cs" />
<Compile Include="Joystick\DeviceTuningParameter.cs" />
<Compile Include="OGL\CubicSpline.cs" />
<Compile Include="OGL\LoaderStatics.cs" />
<Compile Include="OGL\FormJSCalCurve.cs">

@ -12,6 +12,14 @@ namespace SCJMapper_V2
/// <action name="v_view_cycle_fwd">
/// <rebind device="joystick" input="js2_button2" />
/// </action>
///
///
/// AC1.0
/// <action name="v_roll">
/// <rebind device="joystick" input="js1_rotz" />
/// <addbind device="joystick" input="js2_x" />
/// </action>
///
/// </summary>
class ActionCls
{

@ -78,9 +78,9 @@ namespace SCJMapper_V2
/// <summary>
/// Returns the X-Tuning item
/// </summary>
public DeviceTuningParameter TuningX
public DeviceTuningParameter TuningP
{
get { return m_options.TuneX; }
get { return m_options.TuneP; }
}
/// <summary>
/// Returns the Y-Tuning item
@ -92,9 +92,31 @@ namespace SCJMapper_V2
/// <summary>
/// Returns the Z-Tuning item
/// </summary>
public DeviceTuningParameter TuningZ
public DeviceTuningParameter TuningR
{
get { return m_options.TuneZ; }
get { return m_options.TuneR; }
}
/// <summary>
/// Returns the X-Sensitivity item
/// </summary>
public DeviceDeadzoneParameter DeadzoneX
{
get { return m_deviceOptions.DeadzoneX; }
}
/// <summary>
/// Returns the Y-Sensitivity item
/// </summary>
public DeviceDeadzoneParameter DeadzoneY
{
get { return m_deviceOptions.DeadzoneY; }
}
/// <summary>
/// Returns the Z-Sensitivity item
/// </summary>
public DeviceDeadzoneParameter DeadzoneZ
{
get { return m_deviceOptions.DeadzoneZ; }
}

Loading…
Cancel
Save