Build 62 - first iteration - saved to GIT

- add Strafe Tuning
- get Tuning closer to CIG implementation
- remove Sensitivity
- add Saturation instead
- update flight model to support the above
- lot's of refacturing in that process
- add three 3D scenes
pull/104/head
bm98 7 years ago
parent 1e78d268b5
commit 23649da891

5
Form1.Designer.cs generated

@ -528,7 +528,7 @@
this.tdiAddMod2,
this.tdiAddMod3});
this.cmAddDel.Name = "cmAddDel";
this.cmAddDel.Size = new System.Drawing.Size(221, 479);
this.cmAddDel.Size = new System.Drawing.Size(221, 457);
this.cmAddDel.Closed += new System.Windows.Forms.ToolStripDropDownClosedEventHandler(this.cmAddDel_Closed);
this.cmAddDel.Opening += new System.ComponentModel.CancelEventHandler(this.cmAddDel_Opening);
//
@ -1205,6 +1205,7 @@
this.cbxInvStrafeVert.TabIndex = 0;
this.cbxInvStrafeVert.Text = "Inv. Strafe vertical";
this.cbxInvStrafeVert.UseVisualStyleBackColor = true;
this.cbxInvStrafeVert.Visible = false;
this.cbxInvStrafeVert.MouseClick += new System.Windows.Forms.MouseEventHandler(this.cbxInv_XY_MouseClick);
//
// cbxInvStrafeLat
@ -1215,6 +1216,7 @@
this.cbxInvStrafeLat.TabIndex = 0;
this.cbxInvStrafeLat.Text = "Inv. Strafe lateral";
this.cbxInvStrafeLat.UseVisualStyleBackColor = true;
this.cbxInvStrafeLat.Visible = false;
this.cbxInvStrafeLat.MouseClick += new System.Windows.Forms.MouseEventHandler(this.cbxInv_XY_MouseClick);
//
// cbxInvStrafeLon
@ -1225,6 +1227,7 @@
this.cbxInvStrafeLon.TabIndex = 0;
this.cbxInvStrafeLon.Text = "Inv. Strafe longitudinal";
this.cbxInvStrafeLon.UseVisualStyleBackColor = true;
this.cbxInvStrafeLon.Visible = false;
this.cbxInvStrafeLon.MouseClick += new System.Windows.Forms.MouseEventHandler(this.cbxInv_XY_MouseClick);
//
// tableLayoutPanel4

@ -1349,27 +1349,27 @@ namespace SCJMapper_V2
m_AT.ActionMaps.TuningY.Reset( ); // set defaults
if ( dev != null ) {
// JS commands that are supported
if ( nodeText.ToLowerInvariant( ).EndsWith( "_x" ) || nodeText.ToLowerInvariant( ).EndsWith( "_rotx" ) ) {
if ( nodeText.ToLowerInvariant( ).EndsWith( "_x" ) || nodeText.ToLowerInvariant( ).EndsWith( "_rotx" )
|| nodeText.ToLowerInvariant( ).EndsWith( "_y" ) || nodeText.ToLowerInvariant( ).EndsWith( "_roty" )
|| nodeText.ToLowerInvariant( ).EndsWith( "_Z" ) || nodeText.ToLowerInvariant( ).EndsWith( "_rotz" ) ) {
m_AT.ActionMaps.TuningY.GameDevice = dev;
m_AT.ActionMaps.TuningY.Action = nodeText;
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.Action = nodeText;
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.TuningY.GameDevice = dev;
m_AT.ActionMaps.TuningY.Action = nodeText;
m_AT.ActionMaps.TuningY.Deadzone = m_AT.ActionMaps.DeadzoneZ;
string doID = Deviceoptions.DevOptionID( dev.DevName, nodeText );
if ( ! m_AT.ActionMaps.Deadzones.ContainsKey(doID) ){
m_AT.ActionMaps.Deadzones.Add( doID, new DeviceOptionParameter( ) );
}
m_AT.ActionMaps.TuningY.Deviceoption = m_AT.ActionMaps.Deadzones[doID];
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.TuningY.GameDevice = dev;
m_AT.ActionMaps.TuningY.Action = nodeText;
m_AT.ActionMaps.TuningY.Deadzone = m_AT.ActionMaps.DeadzoneX;
string doID = Deviceoptions.DevOptionID( dev.DevName, "x" );
if ( !m_AT.ActionMaps.Deadzones.ContainsKey( doID ) ) {
m_AT.ActionMaps.Deadzones.Add( doID, new DeviceOptionParameter( ) );
}
m_AT.ActionMaps.TuningY.Deviceoption = m_AT.ActionMaps.Deadzones[doID];
JSCAL.YawTuning = m_AT.ActionMaps.TuningY;
}
}
@ -1391,27 +1391,27 @@ namespace SCJMapper_V2
m_AT.ActionMaps.TuningP.Reset( ); // set defaults
if ( dev != null ) {
// JS commands that are supported
if ( nodeText.ToLowerInvariant( ).EndsWith( "_x" ) || nodeText.ToLowerInvariant( ).EndsWith( "_rotx" ) ) {
m_AT.ActionMaps.TuningP.GameDevice = dev;
m_AT.ActionMaps.TuningP.Action = nodeText;
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" ) ) {
if ( nodeText.ToLowerInvariant( ).EndsWith( "_x" ) || nodeText.ToLowerInvariant( ).EndsWith( "_rotx" )
|| nodeText.ToLowerInvariant( ).EndsWith( "_y" ) || nodeText.ToLowerInvariant( ).EndsWith( "_roty" )
|| nodeText.ToLowerInvariant( ).EndsWith( "_Z" ) || nodeText.ToLowerInvariant( ).EndsWith( "_rotz" ) ) {
m_AT.ActionMaps.TuningP.GameDevice = dev;
m_AT.ActionMaps.TuningP.Action = nodeText;
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.TuningP.GameDevice = dev;
m_AT.ActionMaps.TuningP.Action = nodeText;
m_AT.ActionMaps.TuningP.Deadzone = m_AT.ActionMaps.DeadzoneZ;
string doID = Deviceoptions.DevOptionID( dev.DevName, nodeText );
if ( !m_AT.ActionMaps.Deadzones.ContainsKey( doID ) ) {
m_AT.ActionMaps.Deadzones.Add( doID, new DeviceOptionParameter( ) );
}
m_AT.ActionMaps.TuningP.Deviceoption = m_AT.ActionMaps.Deadzones[doID];
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.TuningP.GameDevice = dev;
m_AT.ActionMaps.TuningP.Action = nodeText;
m_AT.ActionMaps.TuningP.Deadzone = m_AT.ActionMaps.DeadzoneY;
string doID = Deviceoptions.DevOptionID( dev.DevName, "y" );
if ( !m_AT.ActionMaps.Deadzones.ContainsKey( doID ) ) {
m_AT.ActionMaps.Deadzones.Add( doID, new DeviceOptionParameter( ) );
}
m_AT.ActionMaps.TuningP.Deviceoption = m_AT.ActionMaps.Deadzones[doID];
JSCAL.PitchTuning = m_AT.ActionMaps.TuningP;
}
}
@ -1427,24 +1427,96 @@ namespace SCJMapper_V2
m_AT.ActionMaps.TuningR.Reset( ); // set defaults
if ( dev != null ) {
// JS commands that are supported
if ( nodeText.ToLowerInvariant( ).EndsWith( "_x" ) || nodeText.ToLowerInvariant( ).EndsWith( "_rotx" ) ) {
m_AT.ActionMaps.TuningR.GameDevice = dev;
m_AT.ActionMaps.TuningR.Action = nodeText;
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" ) ) {
if ( nodeText.ToLowerInvariant( ).EndsWith( "_x" ) || nodeText.ToLowerInvariant( ).EndsWith( "_rotx" )
|| nodeText.ToLowerInvariant( ).EndsWith( "_y" ) || nodeText.ToLowerInvariant( ).EndsWith( "_roty" )
|| nodeText.ToLowerInvariant( ).EndsWith( "_Z" ) || nodeText.ToLowerInvariant( ).EndsWith( "_rotz" ) ) {
m_AT.ActionMaps.TuningR.GameDevice = dev;
m_AT.ActionMaps.TuningR.Action = nodeText;
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.TuningR.GameDevice = dev;
m_AT.ActionMaps.TuningR.Action = nodeText;
m_AT.ActionMaps.TuningR.Deadzone = m_AT.ActionMaps.DeadzoneZ;
string doID = Deviceoptions.DevOptionID( dev.DevName, nodeText );
if ( !m_AT.ActionMaps.Deadzones.ContainsKey( doID ) ) {
m_AT.ActionMaps.Deadzones.Add( doID, new DeviceOptionParameter( ) );
}
m_AT.ActionMaps.TuningR.Deviceoption = m_AT.ActionMaps.Deadzones[doID];
JSCAL.RollTuning = m_AT.ActionMaps.TuningR;
}
}
// find action item for Strafe Lateral - cannot use gamepad here
find = ActionTreeNode.ComposeNodeText( "v_strafe_lateral", "js" );
nodeText = m_AT.FindText( "spaceship_movement", find ); // returns "" or a complete text ("action - command")
if ( !String.IsNullOrWhiteSpace( nodeText ) ) {
dev = m_Joystick.Find_jsN( JoystickCls.JSNum( ActionTreeNode.CommandFromNodeText( nodeText ) ) );
}
m_AT.ActionMaps.TuningStrafeLateral.Reset( ); // set defaults
if ( dev != null ) {
// JS commands that are supported
if ( nodeText.ToLowerInvariant( ).EndsWith( "_x" ) || nodeText.ToLowerInvariant( ).EndsWith( "_rotx" )
|| nodeText.ToLowerInvariant( ).EndsWith( "_y" ) || nodeText.ToLowerInvariant( ).EndsWith( "_roty" )
|| nodeText.ToLowerInvariant( ).EndsWith( "_Z" ) || nodeText.ToLowerInvariant( ).EndsWith( "_rotz" ) ) {
m_AT.ActionMaps.TuningStrafeLateral.GameDevice = dev;
m_AT.ActionMaps.TuningStrafeLateral.Action = nodeText;
string doID = Deviceoptions.DevOptionID( dev.DevName, nodeText );
if ( !m_AT.ActionMaps.Deadzones.ContainsKey( doID ) ) {
m_AT.ActionMaps.Deadzones.Add( doID, new DeviceOptionParameter( ) );
}
m_AT.ActionMaps.TuningStrafeLateral.Deviceoption = m_AT.ActionMaps.Deadzones[doID];
JSCAL.StrafeLatTuning = m_AT.ActionMaps.TuningStrafeLateral;
}
}
// attach Strafe Vertical command - cannot use gamepad here
dev = null;
find = ActionTreeNode.ComposeNodeText( "v_strafe_vertical", "js" );
nodeText = m_AT.FindText( "spaceship_movement", find ); // returns "" or a complete text ("action - command")
if ( !String.IsNullOrWhiteSpace( nodeText ) ) {
dev = m_Joystick.Find_jsN( JoystickCls.JSNum( ActionTreeNode.CommandFromNodeText( nodeText ) ) );
}
m_AT.ActionMaps.TuningStrafeVertical.Reset( ); // set defaults
if ( dev != null ) {
// JS commands that are supported
if ( nodeText.ToLowerInvariant( ).EndsWith( "_x" ) || nodeText.ToLowerInvariant( ).EndsWith( "_rotx" )
|| nodeText.ToLowerInvariant( ).EndsWith( "_y" ) || nodeText.ToLowerInvariant( ).EndsWith( "_roty" )
|| nodeText.ToLowerInvariant( ).EndsWith( "_Z" ) || nodeText.ToLowerInvariant( ).EndsWith( "_rotz" ) ) {
m_AT.ActionMaps.TuningStrafeVertical.GameDevice = dev;
m_AT.ActionMaps.TuningStrafeVertical.Action = nodeText;
string doID = Deviceoptions.DevOptionID( dev.DevName, nodeText );
if ( !m_AT.ActionMaps.Deadzones.ContainsKey( doID ) ) {
m_AT.ActionMaps.Deadzones.Add( doID, new DeviceOptionParameter( ) );
}
m_AT.ActionMaps.TuningStrafeVertical.Deviceoption = m_AT.ActionMaps.Deadzones[doID];
JSCAL.StrafeVertTuning = m_AT.ActionMaps.TuningStrafeVertical;
}
}
// attach Strafe Longitudinal command - cannot use gamepad here
dev = null;
find = ActionTreeNode.ComposeNodeText( "v_strafe_longitudinal", "js" );
nodeText = m_AT.FindText( "spaceship_movement", find ); // returns "" or a complete text ("action - command")
if ( !String.IsNullOrWhiteSpace( nodeText ) ) {
dev = m_Joystick.Find_jsN( JoystickCls.JSNum( ActionTreeNode.CommandFromNodeText( nodeText ) ) );
}
m_AT.ActionMaps.TuningStrafeLongitudinal.Reset( ); // set defaults
if ( dev != null ) {
// JS commands that are supported
if ( nodeText.ToLowerInvariant( ).EndsWith( "_x" ) || nodeText.ToLowerInvariant( ).EndsWith( "_rotx" )
|| nodeText.ToLowerInvariant( ).EndsWith( "_y" ) || nodeText.ToLowerInvariant( ).EndsWith( "_roty" )
|| nodeText.ToLowerInvariant( ).EndsWith( "_Z" ) || nodeText.ToLowerInvariant( ).EndsWith( "_rotz" ) ) {
m_AT.ActionMaps.TuningStrafeLongitudinal.GameDevice = dev;
m_AT.ActionMaps.TuningStrafeLongitudinal.Action = nodeText;
string doID = Deviceoptions.DevOptionID( dev.DevName, nodeText );
if ( !m_AT.ActionMaps.Deadzones.ContainsKey( doID ) ) {
m_AT.ActionMaps.Deadzones.Add( doID, new DeviceOptionParameter( ) );
}
m_AT.ActionMaps.TuningStrafeLongitudinal.Deviceoption = m_AT.ActionMaps.Deadzones[doID];
JSCAL.StrafeLonTuning = m_AT.ActionMaps.TuningStrafeLongitudinal;
}
}
// run
JSCAL.ShowDialog( );
m_AT.Dirty = true;

@ -128,7 +128,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAA6
EAAAAk1TRnQBSQFMAgEBCQEAAcgBEAHIAhABAAEQAQAE/wEJAQAI/wFCAU0BNgEEBgABNgEEAgABKAMA
EAAAAk1TRnQBSQFMAgEBCQEAAdABEAHQAhABAAEQAQAE/wEJAQAI/wFCAU0BNgEEBgABNgEEAgABKAMA
AUADAAEwAwABAQEAAQgGAAEMGAABgAIAAYADAAKAAQABgAMAAYABAAGAAQACgAIAA8ABAAHAAdwBwAEA
AfABygGmAQABMwUAATMBAAEzAQABMwEAAjMCAAMWAQADHAEAAyIBAAMpAQADVQEAA00BAANCAQADOQEA
AYABfAH/AQACUAH/AQABkwEAAdYBAAH/AewBzAEAAcYB1gHvAQAB1gLnAQABkAGpAa0CAAH/ATMDAAFm

@ -1,81 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace SCJMapper_V2.Joystick
{
public class DeviceDeadzoneParameter
{
private static readonly log4net.ILog log = log4net.LogManager.GetLogger( System.Reflection.MethodBase.GetCurrentMethod( ).DeclaringType );
private String m_deviceName = "";
private String m_cmdCtrl = ""; // x, y, rotz ...
private bool m_deadzoneEnabled = false; // default
private String m_deadzone = "0.000";
public DeviceDeadzoneParameter( )
{
}
#region Properties
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;
}
}
}

@ -0,0 +1,124 @@
namespace SCJMapper_V2.Joystick
{
public class DeviceOptionParameter
{
private static readonly log4net.ILog log = log4net.LogManager.GetLogger( System.Reflection.MethodBase.GetCurrentMethod( ).DeclaringType );
private string m_deviceName = "";
private string m_cmdCtrl = ""; // x, y, rotz ...
private bool m_deadzoneEnabled = false; // default
private string m_deadzone = "0.000";
private bool m_saturationEnabled = false; // default
private string m_saturation = "1.000";
public DeviceOptionParameter( )
{
}
/// <summary>
/// cTor with content
/// </summary>
/// <param name="deviceName">The device name</param>
/// <param name="cmdCtrl">The command e.g. x,y, rotz etc</param>
/// <param name="dz">The deadzone value as string (empty string disables)</param>
/// <param name="sa">The saturation value as string (empty string disables)</param>
public DeviceOptionParameter(string deviceName, string cmdCtrl, string dz, string sa )
{
m_deviceName = deviceName;
m_cmdCtrl = cmdCtrl;
if ( string.IsNullOrEmpty( dz ) ) {
m_deadzone = "0.00";
m_deadzoneEnabled = false;
} else {
m_deadzone = dz;
m_deadzoneEnabled = true;
}
if ( string.IsNullOrEmpty(sa)) {
m_saturation = "1.00";
m_saturationEnabled = false;
} else {
m_saturation = sa;
m_saturationEnabled = true;
}
}
#region Properties
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 && ( m_deadzone != "0.00" ) );
}
set { m_deadzoneEnabled = value; }
}
public string Deadzone
{
get { return m_deadzone; }
set { m_deadzone = value; }
}
public bool SaturationUsed
{
get {
return ( m_saturationEnabled && ( m_saturation != "1.00" ) );
}
set { m_saturationEnabled = value; }
}
public string Saturation
{
get { return m_saturation; }
set { m_saturation = 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" />
<option input="y" saturation="0.85" />
</deviceoptions>
*/
string tmp = "";
if ( DeadzoneUsed || SaturationUsed ) {
tmp += string.Format( "\t<deviceoptions name=\"{0}\">\n", m_deviceName );
if ( DeadzoneUsed ) tmp += string.Format( "\t\t<option input=\"{0}\" deadzone=\"{1}\" />\n", m_cmdCtrl, m_deadzone );
if ( SaturationUsed ) tmp += string.Format( "\t\t<option input=\"{0}\" saturation=\"{1}\" />\n", m_cmdCtrl, m_saturation );
tmp += string.Format( "\t</deviceoptions>\n \n" );
}
return tmp;
}
}
}

@ -1,9 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Windows.Forms;
namespace SCJMapper_V2.Joystick
{
@ -14,30 +11,31 @@ namespace SCJMapper_V2.Joystick
{
private static readonly log4net.ILog log = log4net.LogManager.GetLogger( System.Reflection.MethodBase.GetCurrentMethod( ).DeclaringType );
private String m_action = ""; // v_pitch
private String m_cmdCtrl = ""; // js1_x, js1_y, js1_rotz ...
private String m_type = ""; // joystick OR xboxpad
private string m_action = ""; // v_pitch
private string m_cmdCtrl = ""; // js1_x, js1_y, js1_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)
string m_option = ""; // the option name (level where it applies)
private String m_deviceName = "";
private string m_deviceName = "";
private bool m_isStrafe = false; // default
private bool m_senseEnabled = false; // default
private String m_sense = "1.00";
// private bool m_senseEnabled = false; // default
// private string m_sense = "1.00";
private bool m_expEnabled = false; // default
private String m_exponent = "1.000";
private string m_exponent = "1.000";
private bool m_ptsEnabled = false; // default
private List<String> m_PtsIn = new List<String>( );
private List<String> m_PtsOut = new List<String>( );
private List<string> m_PtsIn = new List<string>( );
private List<string> m_PtsOut = new List<string>( );
private bool m_invertEnabled = false; // default
private DeviceCls m_device = null;
private DeviceDeadzoneParameter m_deadzone = null;
private DeviceOptionParameter m_deviceoption = null;
public DeviceTuningParameter( )
{
@ -48,8 +46,7 @@ namespace SCJMapper_V2.Joystick
public DeviceCls GameDevice
{
get { return m_device; }
set
{
set {
m_device = value;
m_type = "";
m_devInstanceNo = -1;
@ -58,8 +55,7 @@ namespace SCJMapper_V2.Joystick
if ( JoystickCls.IsDeviceClass( m_device.DevClass ) ) {
m_type = m_device.DevClass;
m_devInstanceNo = ( m_device as JoystickCls ).JSAssignment;
}
else if ( Gamepad.GamepadCls.IsDeviceClass( m_device.DevClass ) ) {
} else if ( Gamepad.GamepadCls.IsDeviceClass( m_device.DevClass ) ) {
m_type = m_device.DevClass;
m_devInstanceNo = 1; // supports ONE gamepad
}
@ -72,50 +68,55 @@ namespace SCJMapper_V2.Joystick
get { return m_devInstanceNo; }
}
public String DeviceName
public string DeviceName
{
get { return m_deviceName; }
set { m_deviceName = value; }
}
public String Action
public string Action
{
get { return m_action; }
set { m_action = value; DecomposeCommand( ); }
}
public String CommandCtrl
public string CommandCtrl
{
get { return m_cmdCtrl; }
set { m_cmdCtrl = value; }
}
public bool IsStrafeCommand
{
get { return m_isStrafe; }
set { m_isStrafe = value; }
}
public DeviceDeadzoneParameter Deadzone
public DeviceOptionParameter Deviceoption
{
get { return m_deadzone; }
set
{
m_deadzone = value;
if ( m_deadzone != null ) {
m_deadzone.DeviceName = DeviceName; // must know too
m_deadzone.CommandCtrl = CommandCtrl; // must know too
get { return m_deviceoption; }
set {
m_deviceoption = value;
if ( m_deviceoption != null ) {
m_deviceoption.DeviceName = DeviceName; // must know too
m_deviceoption.CommandCtrl = CommandCtrl; // must know too
}
}
}
/*
public bool SensitivityUsed
{
get { return m_senseEnabled; }
set { m_senseEnabled = value; }
}
public String Sensitivity
public string Sensitivity
{
get { return m_sense; }
set { m_sense = value; }
}
*/
public bool InvertUsed
{
get { return m_invertEnabled; }
@ -128,7 +129,7 @@ namespace SCJMapper_V2.Joystick
set { m_expEnabled = value; }
}
public String Exponent
public string Exponent
{
get { return m_exponent; }
set { m_exponent = value; }
@ -141,12 +142,12 @@ namespace SCJMapper_V2.Joystick
set { m_ptsEnabled = value; }
}
public List<String> NonLinCurvePtsIn
public List<string> NonLinCurvePtsIn
{
get { return m_PtsIn; }
set { m_PtsIn = value; }
}
public List<String> NonLinCurvePtsOut
public List<string> NonLinCurvePtsOut
{
get { return m_PtsOut; }
set { m_PtsOut = value; }
@ -158,7 +159,7 @@ namespace SCJMapper_V2.Joystick
public void Reset( )
{
GameDevice = null;
Deadzone = null;
Deviceoption = null;
Action = "";
}
@ -170,47 +171,56 @@ namespace SCJMapper_V2.Joystick
{
// 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( Action );
String action = ActionTreeNode.ActionFromNodeText( Action );
string cmd = ActionTreeNode.CommandFromNodeText( Action );
string action = ActionTreeNode.ActionFromNodeText( Action );
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( "flight_move_pitch" );
else m_option = String.Format( "flight_move_yaw" );
}
else if ( cmd.Contains( "xi_thumbly" ) ) {
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( "flight_move_pitch" );
else m_option = String.Format( "flight_move_yaw" );
}
else if ( cmd.Contains( "xi_thumbrx" ) ) {
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( "flight_move_pitch" );
else m_option = String.Format( "flight_move_yaw" );
}
else if ( cmd.Contains( "xi_thumbry" ) ) {
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( "flight_move_pitch" );
else m_option = String.Format( "flight_move_yaw" );
if ( action.Contains( "pitch" ) ) m_option = string.Format( "flight_move_pitch" );
else m_option = string.Format( "flight_move_yaw" );
}
// assume joystick
else {
// assume joystick
else {
// get parts
m_cmdCtrl = JoystickCls.ActionFromJsCommand( cmd ); //js1_x -> x; js2_rotz -> rotz
m_deviceName = m_device.DevName;
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" );
if ( action.Contains( "pitch" ) ) {
m_option = string.Format( "flight_move_pitch" ); m_isStrafe = false;
} else if ( action.Contains( "yaw" ) ) {
m_option = string.Format( "flight_move_yaw" ); m_isStrafe = false;
} else if ( action.Contains( "roll" ) ) {
m_option = string.Format( "flight_move_roll" ); m_isStrafe = false;
}
// strafes
else if ( action.Contains( "vertical" ) ) {
m_option = string.Format( "flight_move_strafe_vertical" ); m_isStrafe = true;
} else if ( action.Contains( "lateral" ) ) {
m_option = string.Format( "flight_move_strafe_lateral" ); m_isStrafe = true;
} else if ( action.Contains( "longitudinal" ) ) {
m_option = string.Format( "flight_move_strafe_longitudinal" ); m_isStrafe = true;
} else m_option = string.Format( "????" ); // don't know what it is ...
}
}
}
@ -220,40 +230,40 @@ namespace SCJMapper_V2.Joystick
/// Format an XML -options- node from the tuning contents
/// </summary>
/// <returns>The XML string or an empty string</returns>
public String Options_toXML( )
public string Options_toXML( )
{
if ( ( SensitivityUsed || ExponentUsed || InvertUsed || NonLinCurveUsed ) == false ) return ""; // not used
if ( ( /*SensitivityUsed ||*/ ExponentUsed || InvertUsed || NonLinCurveUsed ) == false ) return ""; // not used
String tmp = "";
tmp += String.Format( "\t<options type=\"{0}\" instance=\"{1}\">\n", m_type, m_devInstanceNo.ToString( ) );
tmp += String.Format( "\t\t<{0} ", m_option );
string tmp = "";
tmp += string.Format( "\t<options type=\"{0}\" instance=\"{1}\">\n", m_type, m_devInstanceNo.ToString( ) );
tmp += string.Format( "\t\t<{0} ", m_option );
if ( InvertUsed ) {
tmp += String.Format( "invert=\"1\" " );
tmp += string.Format( "invert=\"1\" " );
}
/*
if ( SensitivityUsed ) {
tmp += String.Format( "sensitivity=\"{0}\" ", Sensitivity );
tmp += string.Format( "sensitivity=\"{0}\" ", Sensitivity );
}
*/
if ( NonLinCurveUsed ) {
// add exp to avoid merge of things...
tmp += String.Format( "exponent=\"1.00\" > \n" ); // CIG get to default expo 2.something if not set to 1 here
tmp += String.Format( "\t\t\t<nonlinearity_curve>\n" );
tmp += String.Format( "\t\t\t\t<point in=\"{0}\" out=\"{1}\"/>\n", m_PtsIn[0], m_PtsOut[0] );
tmp += String.Format( "\t\t\t\t<point in=\"{0}\" out=\"{1}\"/>\n", m_PtsIn[1], m_PtsOut[1] );
tmp += String.Format( "\t\t\t\t<point in=\"{0}\" out=\"{1}\"/>\n", m_PtsIn[2], m_PtsOut[2] );
tmp += String.Format( "\t\t\t</nonlinearity_curve>\n" );
tmp += String.Format( "\t\t</{0}> \n", m_option );
}
else if ( ExponentUsed ) {
tmp += string.Format( "exponent=\"1.00\" > \n" ); // CIG get to default expo 2.something if not set to 1 here
tmp += string.Format( "\t\t\t<nonlinearity_curve>\n" );
tmp += string.Format( "\t\t\t\t<point in=\"{0}\" out=\"{1}\"/>\n", m_PtsIn[0], m_PtsOut[0] );
tmp += string.Format( "\t\t\t\t<point in=\"{0}\" out=\"{1}\"/>\n", m_PtsIn[1], m_PtsOut[1] );
tmp += string.Format( "\t\t\t\t<point in=\"{0}\" out=\"{1}\"/>\n", m_PtsIn[2], m_PtsOut[2] );
tmp += string.Format( "\t\t\t</nonlinearity_curve>\n" );
tmp += string.Format( "\t\t</{0}> \n", m_option );
} else if ( ExponentUsed ) {
// only exp used
tmp += String.Format( "exponent=\"{0}\" /> \n", Exponent );
}
else {
tmp += string.Format( "exponent=\"{0}\" /> \n", Exponent );
} else {
// neither exp or curve
tmp += String.Format( " /> \n" );// nothing...
tmp += string.Format( " /> \n" );// nothing...
}
tmp += String.Format( "\t</options>\n \n" );
tmp += string.Format( "\t</options>\n \n" );
return tmp;
}
@ -266,52 +276,54 @@ namespace SCJMapper_V2.Joystick
/// <param name="reader">A prepared XML reader</param>
/// <param name="instance">the Joystick instance number</param>
/// <returns></returns>
public Boolean Options_fromXML( XmlReader reader, String type, int instance )
public Boolean Options_fromXML( XmlReader reader, string type, int instance )
{
m_type = type;
String invert = "";
String sensitivity = "";
String exponent = "";
string invert = "";
string sensitivity = "";
string exponent = "";
m_option = reader.Name;
m_devInstanceNo = instance;
// derive from flight_move_pitch || flight_move_yaw || flight_move_roll (nothing bad should arrive here)
String[] e = m_option.ToLowerInvariant( ).Split( new char[] { '_' } );
string[] e = m_option.ToLowerInvariant( ).Split( new char[] { '_' } );
if ( e.Length > 2 ) m_cmdCtrl = e[2]; // TODO - see if m_cmdCtrl is needed to be derived here
if ( reader.HasAttributes ) {
invert = reader["invert"];
if ( !String.IsNullOrWhiteSpace( invert ) ) {
if ( !string.IsNullOrWhiteSpace( invert ) ) {
InvertUsed = false;
if ( invert == "1" ) InvertUsed = true;
}
/*
sensitivity = reader["sensitivity"];
if ( !String.IsNullOrWhiteSpace( sensitivity ) ) {
if ( !string.IsNullOrWhiteSpace( sensitivity ) ) {
Sensitivity = sensitivity;
SensitivityUsed = true;
}
*/
exponent = reader["exponent"];
if ( !String.IsNullOrWhiteSpace( exponent ) ) {
if ( !string.IsNullOrWhiteSpace( exponent ) ) {
Exponent = exponent;
ExponentUsed = true;
}
}
// we may have a nonlin curve...
if ( ! reader.IsEmptyElement ) {
if ( !reader.IsEmptyElement ) {
reader.Read( );
if ( !reader.EOF ) {
if ( reader.Name.ToLowerInvariant( ) == "nonlinearity_curve" ) {
m_PtsIn.Clear( ); m_PtsOut.Clear( ); // reset pts
ExponentUsed = false; // NonLin Curve takes prio
reader.Read( );
while ( !reader.EOF ) {
String ptIn = "";
String ptOut = "";
string ptIn = "";
string ptOut = "";
if ( reader.Name.ToLowerInvariant( ) == "point" ) {
if ( reader.HasAttributes ) {
ptIn = reader["in"];

@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.IO;
using System.Xml.Linq;
@ -15,6 +13,7 @@ namespace SCJMapper_V2.Joystick
/// <!-- Reduce the deadzone -->
/// <option input="x" deadzone="0.015" />
/// <option input="y" deadzone="0.015" />
/// <option input="y" saturation="0.85" />
/// </deviceoptions>
///
/// [device] : set to device name (name shown in Windows Game Controllers control panel), currently known names follow
@ -22,64 +21,44 @@ namespace SCJMapper_V2.Joystick
/// Saitek X52 Pro Flight Controller
///
/// </summary>
public class Deviceoptions
public class Deviceoptions : Dictionary<string, DeviceOptionParameter>
{
private static readonly log4net.ILog log = log4net.LogManager.GetLogger( System.Reflection.MethodBase.GetCurrentMethod( ).DeclaringType );
List<String> m_stringOptions = new List<String>( );
private static char ID_Delimiter = '⁞';
public static string DevOptionID( string devName, string cmdCtrl )
{
string cmd = cmdCtrl.Trim();
if ( cmd.Contains( "_" ) ) {
int l = cmd.LastIndexOf("_");
cmd = cmd.Substring( l + 1 ); // assuming it is never the last one..
}
return string.Format( "{0}{1}{2}", devName, ID_Delimiter, cmd );
}
List<string> m_stringOptions = new List<string>( );
DeviceDeadzoneParameter m_deadzoneX = null;
DeviceDeadzoneParameter m_deadzoneY = null;
DeviceDeadzoneParameter m_deadzoneZ = null;
// ctor
public Deviceoptions( Options options )
{
m_deadzoneX = new DeviceDeadzoneParameter();
m_deadzoneY = new DeviceDeadzoneParameter( );
m_deadzoneZ = new DeviceDeadzoneParameter( );
}
public int Count
new public int Count
{
get { return ( m_stringOptions.Count + ( ( m_deadzoneX != null ) ? 1 : 0 ) + ( ( m_deadzoneY != null ) ? 1 : 0 ) + ( ( m_deadzoneZ != null ) ? 1 : 0 ) ); }
get { return ( m_stringOptions.Count + base.Count ); }
}
// 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 )
private string[] FormatXml( string xml )
{
try {
XDocument doc = XDocument.Parse( xml );
return doc.ToString( ).Split( new String[] { String.Format( "\n" ) }, StringSplitOptions.RemoveEmptyEntries );
}
catch ( Exception ) {
return new String[] { xml };
return doc.ToString( ).Split( new string[] { string.Format( "\n" ) }, StringSplitOptions.RemoveEmptyEntries );
} catch ( Exception ) {
return new string[] { xml };
}
}
@ -87,26 +66,26 @@ namespace SCJMapper_V2.Joystick
/// Dump the Deviceoptions as partial XML nicely formatted
/// </summary>
/// <returns>the action as XML fragment</returns>
public String toXML( )
public string toXML( )
{
String r = "";
string r = "";
// and dump the contents of plain string options
foreach ( String x in m_stringOptions ) {
foreach ( string x in m_stringOptions ) {
if ( !String.IsNullOrWhiteSpace( x ) ) {
foreach ( String line in FormatXml( x ) ) {
r += String.Format( "\t{0}", line );
if ( !string.IsNullOrWhiteSpace( x ) ) {
foreach ( string line in FormatXml( x ) ) {
r += string.Format( "\t{0}", line );
}
}
r += String.Format( "\n" );
r += string.Format( "\n" );
}
// dump Tuning
r += m_deadzoneX.Deviceoptions_toXML( );
r += m_deadzoneY.Deviceoptions_toXML( );
r += m_deadzoneZ.Deviceoptions_toXML( );
foreach ( KeyValuePair<string, DeviceOptionParameter> kv in this ) {
r += kv.Value.Deviceoptions_toXML( );
}
return r;
}
@ -118,7 +97,7 @@ namespace SCJMapper_V2.Joystick
/// </summary>
/// <param name="xml">the XML action fragment</param>
/// <returns>True if an action was decoded</returns>
public Boolean fromXML( String xml )
public Boolean fromXML( string xml )
{
/*
* This can be a lot of the following options
@ -140,7 +119,7 @@ namespace SCJMapper_V2.Joystick
reader.Read( );
String name = "";
string name = "";
if ( reader.HasAttributes ) {
name = reader["name"];
@ -150,53 +129,40 @@ namespace SCJMapper_V2.Joystick
while ( !reader.EOF ) {
if ( reader.Name.ToLowerInvariant( ) == "option" ) {
if ( reader.HasAttributes ) {
String input = reader["input"];
String deadzone = reader["deadzone"];
if ( ! (String.IsNullOrWhiteSpace( input ) || String.IsNullOrWhiteSpace( deadzone )) ) {
if ( input.ToLowerInvariant( ).EndsWith("x") ) {
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...
float testF;
if ( float.TryParse( deadzone, out testF ) ) { // check for valid number in string
m_deadzoneX.DeadzoneUsed = true; m_deadzoneX.Deadzone = deadzone;
}
else {
m_deadzoneX.DeadzoneUsed = false; m_deadzoneX.Deadzone = "0.00";
}
}
else if ( input.ToLowerInvariant( ).EndsWith("y") ) {
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...
string input = reader["input"];
string deadzone = reader["deadzone"];
string saturation = reader["saturation"];
if ( !string.IsNullOrWhiteSpace( input ) ) {
string doID = DevOptionID(name, input);
if ( !string.IsNullOrWhiteSpace( deadzone ) ) {
float testF;
if ( float.TryParse( deadzone, out testF ) ) { // check for valid number in string
m_deadzoneY.DeadzoneUsed = true; m_deadzoneY.Deadzone = deadzone;
if ( !float.TryParse( deadzone, out testF ) ) { // check for valid number in string
deadzone = "0.00";
}
else {
m_deadzoneY.DeadzoneUsed = false; m_deadzoneY.Deadzone = "0.00";
if ( !this.ContainsKey( doID ) ) {
this.Add( doID, new DeviceOptionParameter( name, input, deadzone, saturation ) );
}else {
// add deadzone value tp existing
this[doID].Deadzone = deadzone;
}
}
else if ( input.ToLowerInvariant( ).EndsWith( "z" ) ) {
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...
if ( !string.IsNullOrWhiteSpace( saturation ) ) {
float testF;
if ( float.TryParse( deadzone, out testF ) ) { // check for valid number in string
m_deadzoneZ.DeadzoneUsed = true; m_deadzoneZ.Deadzone = deadzone;
if ( !float.TryParse( saturation, out testF ) ) { // check for valid number in string
saturation = "1.00";
}
else {
m_deadzoneZ.DeadzoneUsed = false; m_deadzoneZ.Deadzone = "0.00";
if ( !this.ContainsKey( doID ) ) {
this.Add( doID, new DeviceOptionParameter( name, input, deadzone, saturation ) );
} else {
// add saturation value tp existing
this[doID].Saturation = saturation;
}
}
else {
//?? option node refers to unknown axis (not x,y,rotz)
log.ErrorFormat( "Deviceoptions.fromXML: option node refers to unknown axis {0}", input );
}
}
else {
} else {
//? option node has not the needed attributes
log.ErrorFormat( "Deviceoptions.fromXML: option node has not the needed attributes" );
}
}
else {
} else {
//?? option node has NO attributes
log.ErrorFormat( "Deviceoptions.fromXML: option node has NO attributes" );
}
@ -204,8 +170,7 @@ namespace SCJMapper_V2.Joystick
reader.Read( );
}//while
}
else {
} else {
//??
if ( !m_stringOptions.Contains( xml ) ) m_stringOptions.Add( xml );
}

@ -17,6 +17,10 @@ namespace SCJMapper_V2.Joystick
/// <pilot exponent="1" />
/// </options>
///
/// <options type="joystick" instance="2" >
/// <flight_move_strafe_longitudinal invert="1" />
/// </options>
///
/// [type] : set to shared, keyboard, xboxpad, or joystick
/// [instance] : set to the device number; js1=1, js2=2, etc
/// [optiongroup] : set to what group the option should affect (for available groups see default actionmap)
@ -30,12 +34,16 @@ namespace SCJMapper_V2.Joystick
private static readonly log4net.ILog log = log4net.LogManager.GetLogger( System.Reflection.MethodBase.GetCurrentMethod( ).DeclaringType );
// Support only one set of independent options (string storage)
List<String> m_stringOptions = new List<String>( );
List<string> m_stringOptions = new List<string>( );
// Support only one set of TuningParameters (there is only ONE Joystick Pitch, Yaw, Roll control possible, they can be on different instances however)
DeviceTuningParameter m_tuningP = null; // pitch
DeviceTuningParameter m_tuningY = null; // yaw
DeviceTuningParameter m_tuningR = null; // roll
DeviceTuningParameter m_tuningVert = null; // strafe vertical
DeviceTuningParameter m_tuningLat = null; // strafe lateral
DeviceTuningParameter m_tuningLon = null; // strafe longitudinal
// Have to support Inverters for all possible JS Instances here - right now 4 are supported - provide them for all 12 we support..
public List<OptionsInvert> m_inverter = new List<OptionsInvert>( ); // all inverters
@ -49,6 +57,10 @@ namespace SCJMapper_V2.Joystick
m_tuningY = new DeviceTuningParameter( );
m_tuningR = new DeviceTuningParameter( );
m_tuningVert = new DeviceTuningParameter( );
m_tuningLat = new DeviceTuningParameter( );
m_tuningLon = new DeviceTuningParameter( );
// create inverters (
for ( int i = 0; i < ( int )OptionsInvert.Inversions.I_LAST; i++ ) {
OptionsInvert inv = new OptionsInvert((OptionsInvert.Inversions)i);
@ -87,6 +99,28 @@ namespace SCJMapper_V2.Joystick
get { return m_tuningR; }
}
/// <summary>
/// Returns the Strafe Vertical-Tuning item
/// </summary>
public DeviceTuningParameter TuneVert
{
get { return m_tuningVert; }
}
/// <summary>
/// Returns the Strafe Lateral-Tuning item
/// </summary>
public DeviceTuningParameter TuneLat
{
get { return m_tuningLat; }
}
/// <summary>
/// Returns the Strafe Longitudinal-Tuning item
/// </summary>
public DeviceTuningParameter TuneLon
{
get { return m_tuningLon; }
}
/// <summary>
/// Returns the inverter based on the enum given
/// </summary>
@ -126,13 +160,13 @@ namespace SCJMapper_V2.Joystick
private String[] FormatXml( string xml )
private string[] FormatXml( string xml )
{
try {
XDocument doc = XDocument.Parse( xml );
return doc.ToString( ).Split( new String[] { String.Format( "\n" ) }, StringSplitOptions.RemoveEmptyEntries );
return doc.ToString( ).Split( new string[] { string.Format( "\n" ) }, StringSplitOptions.RemoveEmptyEntries );
} catch ( Exception ) {
return new String[] { xml };
return new string[] { xml };
}
}
@ -140,36 +174,40 @@ namespace SCJMapper_V2.Joystick
/// Dump the Options as partial XML nicely formatted
/// </summary>
/// <returns>the action as XML fragment</returns>
public String toXML( )
public string toXML( )
{
String r = "";
string r = "";
// and dump the contents of plain string options
foreach ( String x in m_stringOptions ) {
foreach ( string x in m_stringOptions ) {
if ( !String.IsNullOrWhiteSpace( x ) ) {
foreach ( String line in FormatXml( x ) ) {
r += String.Format( "\t{0}", line );
if ( !string.IsNullOrWhiteSpace( x ) ) {
foreach ( string line in FormatXml( x ) ) {
r += string.Format( "\t{0}", line );
}
}
r += String.Format( "\n" );
r += string.Format( "\n" );
}
// dump Tuning
r += m_tuningP.Options_toXML( );
r += m_tuningY.Options_toXML( );
r += m_tuningP.Options_toXML( );
r += m_tuningR.Options_toXML( );
r += m_tuningLat.Options_toXML( );
r += m_tuningVert.Options_toXML( );
r += m_tuningLon.Options_toXML( );
r += m_inverter[( int )OptionsInvert.Inversions.flight_aim_pitch].Options_toXML( );
r += m_inverter[( int )OptionsInvert.Inversions.flight_aim_yaw].Options_toXML( );
r += m_inverter[( int )OptionsInvert.Inversions.flight_view_pitch].Options_toXML( );
r += m_inverter[( int )OptionsInvert.Inversions.flight_view_yaw].Options_toXML( );
r += m_inverter[( int )OptionsInvert.Inversions.flight_move_strafe_vertical].Options_toXML( );
r += m_inverter[( int )OptionsInvert.Inversions.flight_move_strafe_lateral].Options_toXML( );
r += m_inverter[( int )OptionsInvert.Inversions.flight_move_strafe_longitudinal].Options_toXML( );
// r += m_inverter[( int )OptionsInvert.Inversions.flight_move_strafe_vertical].Options_toXML( );
// r += m_inverter[( int )OptionsInvert.Inversions.flight_move_strafe_lateral].Options_toXML( );
// r += m_inverter[( int )OptionsInvert.Inversions.flight_move_strafe_longitudinal].Options_toXML( );
r += m_inverter[( int )OptionsInvert.Inversions.flight_throttle].Options_toXML( );
@ -183,7 +221,7 @@ namespace SCJMapper_V2.Joystick
/// </summary>
/// <param name="xml">the XML action fragment</param>
/// <returns>True if an action was decoded</returns>
public Boolean fromXML( String xml )
public Boolean fromXML( string xml )
{
/*
* This can be a lot of the following options
@ -219,8 +257,8 @@ namespace SCJMapper_V2.Joystick
reader.Read( );
String type = "";
String instance = ""; int nInstance = 0;
string type = "";
string instance = ""; int nInstance = 0;
if ( reader.HasAttributes ) {
type = reader["type"];
@ -272,11 +310,14 @@ namespace SCJMapper_V2.Joystick
} else if ( reader.Name.ToLowerInvariant( ) == "flight_move_roll" ) {
m_tuningR.Options_fromXML( reader, type, int.Parse( instance ) );
} else if ( reader.Name.ToLowerInvariant( ) == "flight_move_strafe_vertical" ) {
m_inverter[( int )OptionsInvert.Inversions.flight_move_strafe_vertical].Options_fromXML( reader, type, int.Parse( instance ) );
m_tuningVert.Options_fromXML( reader, type, int.Parse( instance ) );
//m_inverter[( int )OptionsInvert.Inversions.flight_move_strafe_vertical].Options_fromXML( reader, type, int.Parse( instance ) );
} else if ( reader.Name.ToLowerInvariant( ) == "flight_move_strafe_lateral" ) {
m_inverter[( int )OptionsInvert.Inversions.flight_move_strafe_lateral].Options_fromXML( reader, type, int.Parse( instance ) );
m_tuningLat.Options_fromXML( reader, type, int.Parse( instance ) );
//m_inverter[( int )OptionsInvert.Inversions.flight_move_strafe_lateral].Options_fromXML( reader, type, int.Parse( instance ) );
} else if ( reader.Name.ToLowerInvariant( ) == "flight_move_strafe_longitudinal" ) {
m_inverter[( int )OptionsInvert.Inversions.flight_move_strafe_longitudinal].Options_fromXML( reader, type, int.Parse( instance ) );
m_tuningLon.Options_fromXML( reader, type, int.Parse( instance ) );
//m_inverter[( int )OptionsInvert.Inversions.flight_move_strafe_longitudinal].Options_fromXML( reader, type, int.Parse( instance ) );
} else if ( reader.Name.ToLowerInvariant( ) == "flight_aim_pitch" ) {
m_inverter[( int )OptionsInvert.Inversions.flight_aim_pitch].Options_fromXML( reader, type, int.Parse( instance ) );
} else if ( reader.Name.ToLowerInvariant( ) == "flight_aim_yaw" ) {

@ -17,9 +17,9 @@ namespace SCJMapper_V2.Joystick
flight_aim_yaw,
flight_view_yaw,
flight_throttle,
flight_move_strafe_vertical,
flight_move_strafe_lateral,
flight_move_strafe_longitudinal,
// flight_move_strafe_vertical,
// flight_move_strafe_lateral,
// flight_move_strafe_longitudinal,
I_LAST // designates the last item for loop handling
}
@ -39,9 +39,9 @@ namespace SCJMapper_V2.Joystick
new MappedActionRec("spaceship_targeting", "v_aim_yaw"),
new MappedActionRec("spaceship_view", "v_view_yaw"),
new MappedActionRec("spaceship_movement", "v_throttle_abs"),
new MappedActionRec("spaceship_movement", "v_strafe_vertical"),
new MappedActionRec("spaceship_movement", "v_strafe_lateral"),
new MappedActionRec("spaceship_movement", "v_strafe_longitudinal"),
// new MappedActionRec("spaceship_movement", "v_strafe_vertical"),
// new MappedActionRec("spaceship_movement", "v_strafe_lateral"),
// new MappedActionRec("spaceship_movement", "v_strafe_longitudinal"),
};
private CheckBox m_cbInvert = null;

@ -81,6 +81,15 @@ namespace SCJMapper_V2.Joystick
m_outCurve[m_maxpts - 1] = 1.0; // force MAX
}
public Vector2 Pt (int index )
{
// we return only the input points - i.e. not pt0 and ptMax
if ( index >= (m_points.Length-2) ) return new Vector2( 0, 0 );
return m_points[index+1];
}
public void Curve( )
{
Setup( 1 );
@ -152,7 +161,12 @@ namespace SCJMapper_V2.Joystick
GetOutput( cout );
}
/// <summary>
/// Returns the f(x) value of the curve
/// assumes a symmetric curve and handles the sign appropriately
/// </summary>
/// <param name="atX">Device Input (-1000 .. 0 .. 1000)</param>
/// <returns>The unity curve value (-1.0 .. 1.0) </returns>
public double EvalX( int atX )
{
int sng = Math.Sign( atX );

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion( "2.27.0.61" )]
[assembly: AssemblyFileVersion( "2.27.0.61" )]
[assembly: AssemblyVersion( "2.28.0.62" )]
[assembly: AssemblyFileVersion( "2.28.0.62" )]

@ -26,8 +26,8 @@
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>61</ApplicationRevision>
<ApplicationVersion>2.27.0.%2a</ApplicationVersion>
<ApplicationRevision>62</ApplicationRevision>
<ApplicationVersion>2.28.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
@ -143,7 +143,7 @@
<Compile Include="Table\FormTable.Designer.cs">
<DependentUpon>FormTable.cs</DependentUpon>
</Compile>
<Compile Include="Joystick\DeviceDeadzoneParameter.cs" />
<Compile Include="Joystick\DeviceOptionParameter.cs" />
<Compile Include="Gamepad\GamepadCls.cs" />
<Compile Include="Joystick\JsReassingList.cs" />
<Compile Include="Keyboard\KeyboardCls.cs" />
@ -256,6 +256,15 @@
<DependentUpon>UC_GpadPanel.cs</DependentUpon>
</EmbeddedResource>
<None Include="app.config" />
<None Include="graphics\SB_LA_Helipad.dds">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="graphics\SB_OutThere3.dds">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="graphics\SB_Sunset.dds">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Table\DS_ActionMaps.xsc">
<DependentUpon>DS_ActionMaps.xsd</DependentUpon>
</None>

Binary file not shown.

@ -116,25 +116,34 @@ namespace SCJMapper_V2
}
/// <summary>
/// Returns the X-Sensitivity item
/// Returns the StrafeLateral-Tuning item
/// </summary>
public DeviceDeadzoneParameter DeadzoneX
public DeviceTuningParameter TuningStrafeLateral
{
get { return m_deviceOptions.DeadzoneX; }
get { return m_options.TuneLat; }
}
/// <summary>
/// Returns the Y-Sensitivity item
/// Returns the StrafeVertical-Tuning item
/// </summary>
public DeviceDeadzoneParameter DeadzoneY
public DeviceTuningParameter TuningStrafeVertical
{
get { return m_deviceOptions.DeadzoneY; }
get { return m_options.TuneVert; }
}
/// <summary>
/// Returns the Z-Sensitivity item
/// Returns the StrafeLongitudinal-Tuning item
/// </summary>
public DeviceDeadzoneParameter DeadzoneZ
public DeviceTuningParameter TuningStrafeLongitudinal
{
get { return m_deviceOptions.DeadzoneZ; }
get { return m_options.TuneLon; }
}
/// <summary>
/// Returns the DeviceOptions containing the deadzones
/// </summary>
public Deviceoptions Deadzones
{
get { return m_deviceOptions; }
}
/// <summary>

@ -1010,7 +1010,7 @@ namespace SCJMapper_V2
{
log.Debug( "FindText - Entry" );
foreach ( ActionTreeNode tn in Ctrl.Nodes ) {
foreach ( ActionTreeNode tn in m_MasterTree.Nodes ) {
if ( String.IsNullOrEmpty( actionmap ) || ( tn.Text == actionmap ) ) {
// have to search nodes of nodes
foreach ( ActionTreeNode stn in tn.Nodes ) {

@ -19,9 +19,15 @@ namespace SCJMapper_V2
// Handle all text label composition and extraction here
public static String ComposeNodeText( String cmd, Boolean modified = false )
/// <summary>
/// Returns a the cmd with standard modifier if modified == true
/// </summary>
/// <param name="cmd">Any string</param>
/// <param name="modified">Bool true if a modifier shall be added</param>
/// <returns>The string with added Modifier if requested</returns>
public static string ComposeNodeText( string cmd, bool modified = false )
{
if ( String.IsNullOrEmpty( cmd ) ) {
if ( string.IsNullOrEmpty( cmd ) ) {
return "";
}
else {
@ -32,10 +38,14 @@ namespace SCJMapper_V2
}
}
public static void DecompNodeText( String nodeText, out String cmd )
/// <summary>
/// Returns the cmd part of a string like "cmd - anything #"
/// </summary>
/// <param name="nodeText">A nodetext string like "cmd - anything #"</param>
/// <param name="cmd">contains the cmd part if delimiters are present - else returns the input</param>
public static void DecompNodeText( string nodeText, out string cmd )
{
String[] e = nodeText.Split( new char[] { RegDiv, ModDiv }, StringSplitOptions.RemoveEmptyEntries );
string[] e = nodeText.Split( new char[] { RegDiv, ModDiv }, StringSplitOptions.RemoveEmptyEntries );
if ( e.Length > 0 )
cmd = e[0].TrimEnd( );
else
@ -45,13 +55,13 @@ namespace SCJMapper_V2
/// <summary>
/// Returns the command part from a node text
/// i.e. v_pitch - js1_x returns js1_x
/// i.e. "v_pitch - js1_x" returns v_pitch
/// </summary>
/// <param name="nodeText">The node text in 'action - command' notation</param>
/// <returns>the command part or an empty string</returns>
public new static String CommandFromNodeText( String nodeText )
public new static string CommandFromNodeText( string nodeText )
{
String cmd;
string cmd;
ActionTreeInputNode.DecompNodeText( nodeText, out cmd );
return cmd;
}
@ -98,9 +108,9 @@ namespace SCJMapper_V2
}
//private String m_command ="";
//private string m_command ="";
public new String Text
public new string Text
{
get { return base.Text; }
set
@ -111,7 +121,7 @@ namespace SCJMapper_V2
}
public new String Command
public new string Command
{
get { return m_command; }
set

@ -1,9 +1,14 @@
Canyon, Highway, Shiodome, BigSight:
Canyon, Highway, Shiodome, BigSight, LA Heliport:
http://www.hdrlabs.com/sibl/archive.html
sIBL Archive - Free HDRI sets for smart Image-Based Lighting
Sunset
https://commons.wikimedia.org/wiki/File:Afterglow_of_a_sunset.jpg
This file is licensed under the Creative Commons Attribution 2.0 Generic license.
At Toyomi fishermen's wharf, Tokyo.
Author: Author Masato OHTA
OutThere1 made with Spacescape:
OutThere1 and 3 made with Spacescape:
http://alexcpeterson.com/spacescape

Binary file not shown.

Binary file not shown.

Binary file not shown.
Loading…
Cancel
Save