Build updated to 35

pull/104/head
bm98 10 years ago
parent 44a37ce10c
commit 94e03d4947

23
Form1.Designer.cs generated

@ -102,6 +102,7 @@
this.loadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.cbxInvert = new System.Windows.Forms.CheckBox();
this.cmCopyPaste.SuspendLayout();
this.panel2.SuspendLayout();
this.tc1.SuspendLayout();
@ -224,6 +225,7 @@
// panel2
//
this.panel2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panel2.Controls.Add(this.cbxInvert);
this.panel2.Controls.Add(this.btJsKbd);
this.panel2.Controls.Add(this.btBlend);
this.panel2.Controls.Add(this.lblLastJ);
@ -236,7 +238,7 @@
this.panel2.Controls.Add(this.btAssign);
this.panel2.Location = new System.Drawing.Point(3, 358);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(289, 133);
this.panel2.Size = new System.Drawing.Size(289, 142);
this.panel2.TabIndex = 17;
//
// btJsKbd
@ -244,7 +246,7 @@
this.btJsKbd.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btJsKbd.ImageKey = "J";
this.btJsKbd.ImageList = this.IL;
this.btJsKbd.Location = new System.Drawing.Point(104, 98);
this.btJsKbd.Location = new System.Drawing.Point(104, 112);
this.btJsKbd.Name = "btJsKbd";
this.btJsKbd.Size = new System.Drawing.Size(79, 25);
this.btJsKbd.TabIndex = 16;
@ -267,7 +269,7 @@
//
// btBlend
//
this.btBlend.Location = new System.Drawing.Point(10, 98);
this.btBlend.Location = new System.Drawing.Point(10, 112);
this.btBlend.Name = "btBlend";
this.btBlend.Size = new System.Drawing.Size(73, 25);
this.btBlend.TabIndex = 15;
@ -289,7 +291,7 @@
// cbxThrottle
//
this.cbxThrottle.AutoSize = true;
this.cbxThrottle.Location = new System.Drawing.Point(90, 72);
this.cbxThrottle.Location = new System.Drawing.Point(89, 67);
this.cbxThrottle.Name = "cbxThrottle";
this.cbxThrottle.Size = new System.Drawing.Size(66, 17);
this.cbxThrottle.TabIndex = 13;
@ -326,7 +328,7 @@
//
// btClear
//
this.btClear.Location = new System.Drawing.Point(201, 98);
this.btClear.Location = new System.Drawing.Point(201, 112);
this.btClear.Name = "btClear";
this.btClear.Size = new System.Drawing.Size(73, 25);
this.btClear.TabIndex = 2;
@ -839,6 +841,16 @@
this.statusStrip1.TabIndex = 26;
this.statusStrip1.Text = "statusStrip1";
//
// cbxInvert
//
this.cbxInvert.AutoSize = true;
this.cbxInvert.Location = new System.Drawing.Point(89, 86);
this.cbxInvert.Name = "cbxInvert";
this.cbxInvert.Size = new System.Drawing.Size(55, 17);
this.cbxInvert.TabIndex = 17;
this.cbxInvert.Text = "Invert";
this.cbxInvert.UseVisualStyleBackColor = true;
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -946,6 +958,7 @@
private System.Windows.Forms.Button btJsKbd;
private System.Windows.Forms.Button btBlend;
private System.Windows.Forms.Button btClip;
private System.Windows.Forms.CheckBox cbxInvert;
}
}

@ -594,10 +594,14 @@ namespace SCJMapper_V2
lblLastJ.Text = ctrl;
if ( JoystickCls.CanThrottle( ctrl ) ) {
cbxThrottle.Enabled = true;
cbxInvert.Enabled = true;
}
else if ( GamepadCls.CanInvert( ctrl ) ) {
cbxInvert.Enabled = true;
}
else {
cbxThrottle.Checked = false;
cbxThrottle.Enabled = false;
cbxThrottle.Checked = false; cbxThrottle.Enabled = false;
cbxInvert.Checked = false; cbxInvert.Enabled = false;
}
}
@ -621,12 +625,12 @@ namespace SCJMapper_V2
private void btFind_Click( object sender, EventArgs e )
{
m_AT.FindCtrl( JoystickCls.MakeThrottle( lblLastJ.Text, cbxThrottle.Checked ) ); // find the action for a Control (joystick input)
m_AT.FindAndSelectCtrl( JoystickCls.MakeThrottle( lblLastJ.Text, cbxThrottle.Checked ) ); // find the action for a Control (joystick input)
}
private void btAssign_Click( object sender, EventArgs e )
{
m_AT.UpdateSelectedItem( JoystickCls.MakeThrottle( lblLastJ.Text, cbxThrottle.Checked ), InputMode );
m_AT.UpdateSelectedItem( JoystickCls.MakeThrottle( lblLastJ.Text, cbxThrottle.Checked ), cbxInvert.Checked, InputMode );
if ( m_AT.Dirty ) btDump.BackColor = MyColors.DirtyColor;
}
@ -636,7 +640,7 @@ namespace SCJMapper_V2
private void btClear_Click( object sender, EventArgs e )
{
m_AT.UpdateSelectedItem( "", InputMode );
m_AT.UpdateSelectedItem( "", false, InputMode );
if ( m_AT.Dirty ) btDump.BackColor = MyColors.DirtyColor;
}
@ -952,7 +956,7 @@ namespace SCJMapper_V2
private void btBlend_Click( object sender, EventArgs e )
{
m_AT.UpdateSelectedItem( DeviceCls.BlendedInput, InputMode );
m_AT.UpdateSelectedItem( DeviceCls.BlendedInput, false, InputMode );
if ( m_AT.Dirty ) btDump.BackColor = MyColors.DirtyColor;
}
@ -968,12 +972,24 @@ namespace SCJMapper_V2
// attach Yaw command
DeviceCls dev = null;
nodeText = m_AT.FindText( "v_yaw - js" ); // returns "" or a complete text ("action - command")
String find = "";
find = ActionTreeNode.ComposeNodeText( "v_yaw", ActionTreeNode.REG_MOD, "js" );
nodeText = m_AT.FindText( "spaceship_movement", find ); // returns "" or a complete text ("action - command")
if ( String.IsNullOrWhiteSpace( nodeText ) ) {
find = ActionTreeNode.ComposeNodeText( "v_yaw", ActionTreeNode.INV_MOD, "js" );
nodeText = m_AT.FindText( "spaceship_movement", find ); // find inverted ones too
}
if ( !String.IsNullOrWhiteSpace( nodeText ) ) {
dev = m_Joystick.Find_jsN( JoystickCls.JSNum( ActionTreeNode.CommandFromNodeText( nodeText ) ) );
}
else {
nodeText = m_AT.FindText( "v_yaw - xi" );
find = ActionTreeNode.ComposeNodeText( "v_yaw", ActionTreeNode.REG_MOD, "xi" );
nodeText = m_AT.FindText( "spaceship_movement", find );
if ( String.IsNullOrWhiteSpace( nodeText ) ) {
find = ActionTreeNode.ComposeNodeText( "v_yaw", ActionTreeNode.INV_MOD, "xi" );
nodeText = m_AT.FindText( "spaceship_movement", find ); // find inverted ones too
}
if ( !String.IsNullOrWhiteSpace( nodeText ) ) {
dev = m_Gamepad;
}
@ -982,36 +998,46 @@ namespace SCJMapper_V2
if ( dev != null ) {
// JS commands that are supported
if ( nodeText.ToLowerInvariant( ).EndsWith( "_x" ) || nodeText.ToLowerInvariant( ).EndsWith( "_rotx" ) ) {
m_AT.ActionMaps.TuningX.JsDevice = dev;
m_AT.ActionMaps.TuningX.Command = nodeText;
m_AT.ActionMaps.TuningX.GameDevice = dev;
m_AT.ActionMaps.TuningX.ActionCommand = nodeText;
JSCAL.YawTuning = m_AT.ActionMaps.TuningX;
}
else if ( nodeText.ToLowerInvariant( ).EndsWith( "_y" ) || nodeText.ToLowerInvariant( ).EndsWith( "_roty" ) ) {
m_AT.ActionMaps.TuningY.JsDevice = dev;
m_AT.ActionMaps.TuningY.Command = nodeText;
m_AT.ActionMaps.TuningY.GameDevice = dev;
m_AT.ActionMaps.TuningY.ActionCommand = nodeText;
JSCAL.YawTuning = m_AT.ActionMaps.TuningY;
}
else if ( nodeText.ToLowerInvariant( ).EndsWith( "_z" ) || nodeText.ToLowerInvariant( ).EndsWith( "_rotz" ) ) {
m_AT.ActionMaps.TuningZ.JsDevice = dev;
m_AT.ActionMaps.TuningZ.Command = nodeText;
m_AT.ActionMaps.TuningZ.GameDevice = dev;
m_AT.ActionMaps.TuningZ.ActionCommand = nodeText;
JSCAL.YawTuning = m_AT.ActionMaps.TuningZ;
}
// GP commands that are supported - X
else if ( nodeText.ToLowerInvariant( ).Contains( "_thumblx" ) || nodeText.ToLowerInvariant( ).Contains( "_thumbrx" ) ) {
m_AT.ActionMaps.TuningX.JsDevice = dev;
m_AT.ActionMaps.TuningX.Command = nodeText;
m_AT.ActionMaps.TuningX.GameDevice = dev;
m_AT.ActionMaps.TuningX.ActionCommand = nodeText;
JSCAL.YawTuning = m_AT.ActionMaps.TuningX;
}
}
// attach Pitch command
dev = null;
nodeText = m_AT.FindText( "v_pitch - js" );
find = ActionTreeNode.ComposeNodeText( "v_pitch", ActionTreeNode.REG_MOD, "js" );
nodeText = m_AT.FindText( "spaceship_movement", find ); // returns "" or a complete text ("action - command")
if ( String.IsNullOrWhiteSpace( nodeText ) ) {
find = ActionTreeNode.ComposeNodeText( "v_pitch", ActionTreeNode.INV_MOD, "js" );
nodeText = m_AT.FindText( "spaceship_movement", find ); // find inverted ones too
}
if ( !String.IsNullOrWhiteSpace( nodeText ) ) {
dev = m_Joystick.Find_jsN( JoystickCls.JSNum( ActionTreeNode.CommandFromNodeText( nodeText ) ) );
}
else {
nodeText = m_AT.FindText( "v_pitch - xi" );
find = ActionTreeNode.ComposeNodeText( "v_pitch", ActionTreeNode.REG_MOD, "xi" );
nodeText = m_AT.FindText( "spaceship_movement", find );
if ( String.IsNullOrWhiteSpace( nodeText ) ) {
find = ActionTreeNode.ComposeNodeText( "v_pitch", ActionTreeNode.INV_MOD, "xi" );
nodeText = m_AT.FindText( "spaceship_movement", find ); // find inverted ones too
}
if ( !String.IsNullOrWhiteSpace( nodeText ) ) {
dev = m_Gamepad;
}
@ -1020,31 +1046,36 @@ namespace SCJMapper_V2
if ( dev != null ) {
// JS commands that are supported
if ( nodeText.ToLowerInvariant( ).EndsWith( "_x" ) || nodeText.ToLowerInvariant( ).EndsWith( "_rotx" ) ) {
m_AT.ActionMaps.TuningX.JsDevice = dev;
m_AT.ActionMaps.TuningX.Command = nodeText;
m_AT.ActionMaps.TuningX.GameDevice = dev;
m_AT.ActionMaps.TuningX.ActionCommand = nodeText;
JSCAL.PitchTuning = m_AT.ActionMaps.TuningX;
}
else if ( nodeText.ToLowerInvariant( ).EndsWith( "_y" ) || nodeText.ToLowerInvariant( ).EndsWith( "_roty" ) ) {
m_AT.ActionMaps.TuningY.JsDevice = dev;
m_AT.ActionMaps.TuningY.Command = nodeText;
m_AT.ActionMaps.TuningY.GameDevice = dev;
m_AT.ActionMaps.TuningY.ActionCommand = nodeText;
JSCAL.PitchTuning = m_AT.ActionMaps.TuningY;
}
else if ( nodeText.ToLowerInvariant( ).EndsWith( "_z" ) || nodeText.ToLowerInvariant( ).EndsWith( "_rotz" ) ) {
m_AT.ActionMaps.TuningZ.JsDevice = dev;
m_AT.ActionMaps.TuningZ.Command = nodeText;
m_AT.ActionMaps.TuningZ.GameDevice = dev;
m_AT.ActionMaps.TuningZ.ActionCommand = nodeText;
JSCAL.PitchTuning = m_AT.ActionMaps.TuningZ;
}
// GP commands that are supported - either Y
else if ( nodeText.ToLowerInvariant( ).Contains( "_thumbly" ) || nodeText.ToLowerInvariant( ).Contains( "_thumbry" ) ) {
m_AT.ActionMaps.TuningY.JsDevice = dev;
m_AT.ActionMaps.TuningY.Command = nodeText;
m_AT.ActionMaps.TuningY.GameDevice = dev;
m_AT.ActionMaps.TuningY.ActionCommand = nodeText;
JSCAL.PitchTuning = m_AT.ActionMaps.TuningY;
}
}
// attach Roll command - cannot use gamepad here
dev = null;
nodeText = m_AT.FindText( "v_roll - js" );
find = ActionTreeNode.ComposeNodeText( "v_roll", ActionTreeNode.REG_MOD, "js" );
nodeText = m_AT.FindText( "spaceship_movement", find ); // returns "" or a complete text ("action - command")
if ( String.IsNullOrWhiteSpace( nodeText ) ) {
find = ActionTreeNode.ComposeNodeText( "v_roll", ActionTreeNode.INV_MOD, "js" );
nodeText = m_AT.FindText( "spaceship_movement", find ); // find inverted ones too
}
if ( !String.IsNullOrWhiteSpace( nodeText ) ) {
dev = m_Joystick.Find_jsN( JoystickCls.JSNum( ActionTreeNode.CommandFromNodeText( nodeText ) ) );
}
@ -1052,18 +1083,18 @@ namespace SCJMapper_V2
if ( dev != null ) {
// JS commands that are supported
if ( nodeText.ToLowerInvariant( ).EndsWith( "_x" ) || nodeText.ToLowerInvariant( ).EndsWith( "_rotx" ) ) {
m_AT.ActionMaps.TuningX.JsDevice = dev;
m_AT.ActionMaps.TuningX.Command = nodeText;
m_AT.ActionMaps.TuningX.GameDevice = dev;
m_AT.ActionMaps.TuningX.ActionCommand = nodeText;
JSCAL.RollTuning = m_AT.ActionMaps.TuningX;
}
else if ( nodeText.ToLowerInvariant( ).EndsWith( "_y" ) || nodeText.ToLowerInvariant( ).EndsWith( "_roty" ) ) {
m_AT.ActionMaps.TuningY.JsDevice = dev;
m_AT.ActionMaps.TuningY.Command = nodeText;
m_AT.ActionMaps.TuningY.GameDevice = dev;
m_AT.ActionMaps.TuningY.ActionCommand = nodeText;
JSCAL.RollTuning = m_AT.ActionMaps.TuningY;
}
else if ( nodeText.ToLowerInvariant( ).EndsWith( "_z" ) || nodeText.ToLowerInvariant( ).EndsWith( "_rotz" ) ) {
m_AT.ActionMaps.TuningZ.JsDevice = dev;
m_AT.ActionMaps.TuningZ.Command = nodeText;
m_AT.ActionMaps.TuningZ.GameDevice = dev;
m_AT.ActionMaps.TuningZ.ActionCommand = nodeText;
JSCAL.RollTuning = m_AT.ActionMaps.TuningZ;
}
}

@ -392,7 +392,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAAQ
DgAAAk1TRnQBSQFMAgEBBwEAAcABCgHAAQoBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
DgAAAk1TRnQBSQFMAgEBBwEAAcgBCgHIAQoBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAASADAAEBAQABCAYAAQgYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA

@ -69,6 +69,21 @@ namespace SCJMapper_V2
return rgx_xi.IsMatch( input );
}
const string xil_pattern = @"^xi_thumb[lr][xy]$";
static Regex rgx_xil = new Regex( xil_pattern, RegexOptions.IgnoreCase );
/// <summary>
/// returns true if the ctrl can be inverted - for now this is thumb[lr][xyz]
/// </summary>
/// <param name="control"></param>
/// <returns></returns>
static public Boolean CanInvert( String control )
{
return rgx_xil.IsMatch( control );
}
#endregion
private Controller m_device;

@ -13,7 +13,7 @@ namespace SCJMapper_V2
{
private static readonly log4net.ILog log = log4net.LogManager.GetLogger( System.Reflection.MethodBase.GetCurrentMethod( ).DeclaringType );
private String m_command = ""; // v_pitch - js1_x ..
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
@ -45,7 +45,7 @@ namespace SCJMapper_V2
#region Properties
public DeviceCls JsDevice
public DeviceCls GameDevice
{
get { return m_device; }
set { m_device = value;
@ -74,10 +74,10 @@ namespace SCJMapper_V2
set { m_deviceName = value; }
}
public String Command
public String ActionCommand
{
get { return m_command; }
set { m_command = value; DecomposeCommand( ); }
get { return m_actionCommand; }
set { m_actionCommand = value; DecomposeCommand( ); }
}
public String CommandCtrl
@ -157,8 +157,8 @@ namespace SCJMapper_V2
{
// pobulate 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( Command );
String action = ActionTreeNode.ActionFromNodeText( Command );
String cmd = ActionTreeNode.CommandFromNodeText( ActionCommand );
String action = ActionTreeNode.ActionFromNodeText( ActionCommand );
m_cmdCtrl = "";
if ( !String.IsNullOrWhiteSpace(cmd) ) {
// decomp gamepad entries - could have modifiers so check for contains...

@ -438,7 +438,7 @@
// lblYCmd
//
this.lblYCmd.AutoSize = true;
this.lblYCmd.Location = new System.Drawing.Point(45, 0);
this.lblYCmd.Location = new System.Drawing.Point(37, 0);
this.lblYCmd.Name = "lblYCmd";
this.lblYCmd.Size = new System.Drawing.Size(59, 13);
this.lblYCmd.TabIndex = 2;
@ -448,7 +448,7 @@
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label1.Location = new System.Drawing.Point(6, 0);
this.label1.Location = new System.Drawing.Point(2, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(29, 13);
this.label1.TabIndex = 1;
@ -648,7 +648,7 @@
// lblPCmd
//
this.lblPCmd.AutoSize = true;
this.lblPCmd.Location = new System.Drawing.Point(45, 0);
this.lblPCmd.Location = new System.Drawing.Point(37, 0);
this.lblPCmd.Name = "lblPCmd";
this.lblPCmd.Size = new System.Drawing.Size(59, 13);
this.lblPCmd.TabIndex = 3;
@ -658,7 +658,7 @@
//
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label2.Location = new System.Drawing.Point(6, 0);
this.label2.Location = new System.Drawing.Point(2, 0);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(33, 13);
this.label2.TabIndex = 2;
@ -858,7 +858,7 @@
// lblRCmd
//
this.lblRCmd.AutoSize = true;
this.lblRCmd.Location = new System.Drawing.Point(45, 0);
this.lblRCmd.Location = new System.Drawing.Point(37, 0);
this.lblRCmd.Name = "lblRCmd";
this.lblRCmd.Size = new System.Drawing.Size(59, 13);
this.lblRCmd.TabIndex = 4;
@ -868,7 +868,7 @@
//
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label3.Location = new System.Drawing.Point(6, 0);
this.label3.Location = new System.Drawing.Point(2, 0);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(27, 13);
this.label3.TabIndex = 2;

@ -145,6 +145,7 @@ namespace SCJMapper_V2
private float m_liveYsense = 1.0f;
private float m_liveYexponent = 1.0f;
private xyPoints m_liveYnonLinCurve = new xyPoints( 1000 ); // max val of Joystick Input
private bool m_YcmdInvert = false; // inverted by command (not as Tuning)
/// <summary>
/// Submit the tuning parameters
@ -160,10 +161,11 @@ namespace SCJMapper_V2
set
{
m_Ytuning = value;
m_Ydev = m_Ytuning.GameDevice;
// populate from input
lblYCmd.Text = m_Ytuning.Command;
lblYCmd.Text = m_Ytuning.ActionCommand;
m_YcmdInvert = ActionTreeNode.CommandInvertFromNodeText( m_Ytuning.ActionCommand );
m_liveYawCommand = m_Ytuning.CommandCtrl;
m_Ydev = m_Ytuning.JsDevice;
log.Info( "FormJSCalCurve : Yaw Command is: " + value );
cbxYinvert.Checked = m_Ytuning.InvertUsed;
@ -221,6 +223,7 @@ namespace SCJMapper_V2
private float m_livePsense = 1.0f;
private float m_livePexponent = 1.0f;
private xyPoints m_livePnonLinCurve = new xyPoints( 1000 ); // max val of Joystick Input
private bool m_PcmdInvert = false; // inverted by command (not as Tuning)
/// <summary>
/// Submit the tuning parameters
@ -237,10 +240,12 @@ namespace SCJMapper_V2
set
{
m_Ptuning = value;
m_Pdev = m_Ptuning.GameDevice;
// populate from input
lblPCmd.Text = m_Ptuning.Command; //
lblPCmd.Text = m_Ptuning.ActionCommand; //
m_PcmdInvert = ActionTreeNode.CommandInvertFromNodeText( m_Ptuning.ActionCommand );
if ( GamepadCls.IsDeviceClass( m_Pdev.DevClass ) ) m_PcmdInvert = !m_PcmdInvert; // Gamepad Pitch Movement is inverted by default in AC
m_livePitchCommand = m_Ptuning.CommandCtrl;
m_Pdev = m_Ptuning.JsDevice;
log.Info( "FormJSCalCurve : Pitch Command is: " + value );
cbxPinvert.Checked = m_Ptuning.InvertUsed;
@ -298,6 +303,7 @@ namespace SCJMapper_V2
private float m_liveRsense = 1.0f;
private float m_liveRexponent = 1.0f;
private xyPoints m_liveRnonLinCurve = new xyPoints( 1000 ); // max val of Joystick Input
private bool m_RcmdInvert = false; // inverted by command (not as Tuning)
/// <summary>
/// Submit the tuning parameters
@ -314,10 +320,11 @@ namespace SCJMapper_V2
set
{
m_Rtuning = value;
m_Rdev = m_Rtuning.GameDevice;
// populate from input
lblRCmd.Text = m_Rtuning.Command; //
lblRCmd.Text = m_Rtuning.ActionCommand; //
m_RcmdInvert = ActionTreeNode.CommandInvertFromNodeText( m_Rtuning.ActionCommand );
m_liveRollCommand = m_Rtuning.CommandCtrl;
m_Rdev = m_Rtuning.JsDevice;
log.Info( "FormJSCalCurve : Roll Command is: " + value );
cbxRinvert.Checked = m_Rtuning.InvertUsed;
@ -683,7 +690,7 @@ namespace SCJMapper_V2
// safeguard against locking (moving the window) so the integrator does not get crazy..
// if deltatime gets too big we fake a regular cycle for this round
if ( m_msElapsed > 200 ) m_msElapsed = m_frameTime;
if ( m_msElapsed > 200 ) m_msElapsed = m_frameTime;
m_ticks = newTick; // prep next run
@ -718,7 +725,7 @@ namespace SCJMapper_V2
// update in/out labels if active axis
lblYInput.Text = ( i_x / 1000.0 ).ToString( "0.00" ); lblYOutput.Text = ( fout ).ToString( "0.00" );
// calculate new direction vector
m.X = ( ( m_Ytuning.InvertUsed ) ? -1 : 1 ) * ( ( !cbYuse.Checked ) ? fout : 0 ) * m_msElapsed * DegPerMS;
m.X = ( ( m_YcmdInvert ) ? -1 : 1 ) * ( ( m_Ytuning.InvertUsed ) ? -1 : 1 ) * ( ( !cbYuse.Checked ) ? fout : 0 ) * m_msElapsed * DegPerMS;
}
// Pitch
@ -739,7 +746,7 @@ namespace SCJMapper_V2
}
fout = ( fout > 1.0 ) ? 1.0 : fout;
lblPInput.Text = ( i_y / 1000.0 ).ToString( "0.00" ); lblPOutput.Text = ( fout ).ToString( "0.00" );
m.Y = ( ( m_Ptuning.InvertUsed ) ? -1 : 1 ) * ( ( !cbPuse.Checked ) ? -fout : 0 ) * m_msElapsed * DegPerMS;
m.Y = ( ( m_PcmdInvert ) ? -1 : 1 ) * ( ( m_Ptuning.InvertUsed ) ? -1 : 1 ) * ( ( !cbPuse.Checked ) ? -fout : 0 ) * m_msElapsed * DegPerMS;
}
// Roll
@ -760,7 +767,7 @@ namespace SCJMapper_V2
}
fout = ( fout > 1.0 ) ? 1.0 : fout;
lblRInput.Text = ( i_z / 1000.0 ).ToString( "0.00" ); lblROutput.Text = ( fout ).ToString( "0.00" );
m.Z = ( ( m_Rtuning.InvertUsed ) ? -1 : 1 ) * ( ( !cbRuse.Checked ) ? fout : 0 ) * m_msElapsed * DegPerMS;
m.Z = ( ( m_RcmdInvert ) ? -1 : 1 ) * ( ( m_Rtuning.InvertUsed ) ? -1 : 1 ) * ( ( !cbRuse.Checked ) ? fout : 0 ) * m_msElapsed * DegPerMS;
}
// finalize

@ -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.8.0.34" )]
[assembly: AssemblyFileVersion( "2.8.0.34" )]
[assembly: AssemblyVersion( "2.8.0.35" )]
[assembly: AssemblyFileVersion( "2.8.0.35" )]

@ -26,7 +26,7 @@
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>34</ApplicationRevision>
<ApplicationRevision>35</ApplicationRevision>
<ApplicationVersion>2.8.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>

@ -59,13 +59,18 @@ namespace SCJMapper_V2
public String device { get; set; }
public String input { get; set; }
public String defBinding { get; set; } // the default binding
public Boolean inverted { get; set; }
/// <summary>
/// ctor
/// </summary>
public ActionCls( )
{
device = JoystickCls.DeviceClass;
key = "";
name = "";
input = "";
defBinding = "";
inverted = false;
}
@ -83,8 +88,10 @@ namespace SCJMapper_V2
newAc.device = this.device;
newAc.defBinding = this.defBinding;
newAc.input = this.input;
newAc.inverted = this.inverted;
// reassign the jsX part for Joystick commands
if ( ( this.device == JoystickCls.DeviceClass ) && ( newAc.device == JoystickCls.DeviceClass ) ) {
if ( JoystickCls.IsDeviceClass( this.device ) && JoystickCls.IsDeviceClass( newAc.device ) ) {
int oldJsN = JoystickCls.JSNum( this.input );
if ( JoystickCls.IsJSValid( oldJsN ) ) {
if ( newJsList.ContainsKey( oldJsN ) ) newAc.input = JoystickCls.ReassignJSTag( this.input, newJsList[oldJsN] );
@ -103,6 +110,7 @@ namespace SCJMapper_V2
public void Merge( ActionCls newAc )
{
input = newAc.input;
inverted = newAc.inverted;
}
/// <summary>
@ -112,7 +120,11 @@ namespace SCJMapper_V2
public String toXML( )
{
String r = "";
if ( !String.IsNullOrEmpty( input ) ) r = String.Format( "\t<action name=\"{0}\">\n\t\t\t<rebind device=\"{1}\" input=\"{2}\" />\n\t\t</action>\n", name, device, input );
if ( !String.IsNullOrEmpty( input ) ) {
if ( inverted ) r = String.Format( "\t<action name=\"{0}\">\n\t\t\t<rebind device=\"{1}\" input=\"{2}\" invert=\"1\" />\n\t\t</action>\n", name, device, input );
else r = String.Format( "\t<action name=\"{0}\">\n\t\t\t<rebind device=\"{1}\" input=\"{2}\" />\n\t\t</action>\n", name, device, input );
}
return r;
}
@ -145,8 +157,15 @@ namespace SCJMapper_V2
if ( reader.HasAttributes ) {
device = reader["device"];
input = reader["input"];
if ( input == JoystickCls.BlendedInput ) input = ""; // don't carry jsx reserved into the action
if ( ( input == JoystickCls.BlendedInput ) || ( input == GamepadCls.BlendedInput ) ) input = ""; // don't carry jsx_reserved or xi_reserved into the action
key = DevID( device ) + name; // unique id of the action
String inv = reader["invert"];
if ( String.IsNullOrWhiteSpace( inv ) ) {
inverted = false;
}
else {
inverted = ( inv == "1" ) ? true : false;
}
// Move the reader back to the element node.
reader.ReadStartElement( "rebind" );
}

@ -98,7 +98,7 @@ namespace SCJMapper_V2
// could return more than one if the action is the same in different actionmaps
foreach ( ActionTreeNode mtn in masterNode ) {
if ( mtn.Parent.Name == node.Parent.Name ) {
mtn.Command = node.Command; mtn.BackColor = node.BackColor;
mtn.Command = node.Command; mtn.InvertCommand = node.InvertCommand; mtn.BackColor = node.BackColor;
}
}
}
@ -307,15 +307,15 @@ namespace SCJMapper_V2
/// First apply to the GUI tree where the selection happend then copy it over to master tree
/// </summary>
/// <param name="input">The new Text property</param>
public void UpdateSelectedItem( String input, DeviceCls.InputKind inKind )
public void UpdateSelectedItem( String input, Boolean invert, DeviceCls.InputKind inKind )
{
log.Debug( "UpdateSelectedItem - Entry" );
if ( Ctrl.SelectedNode == null ) return;
ActionCls ac = FindAction( Ctrl.SelectedNode.Parent.Name, Ctrl.SelectedNode.Name );
UpdateActionFromInput( input, ac );
UpdateNodeFromAction((ActionTreeNode)Ctrl.SelectedNode, ac, inKind );
ActionCls ac = FindActionObject( Ctrl.SelectedNode.Parent.Name, Ctrl.SelectedNode.Name );
UpdateActionFromInput( input, invert, ac );
UpdateNodeFromAction( ( ActionTreeNode )Ctrl.SelectedNode, ac, inKind );
}
/// <summary>
@ -324,15 +324,15 @@ namespace SCJMapper_V2
/// <param name="actionMap">The actionmap name</param>
/// <param name="action">The action</param>
/// <returns>An action or null if not found</returns>
private ActionCls FindAction( String actionMap, String action )
private ActionCls FindActionObject( String actionMap, String action )
{
log.Debug( "UpdateAction - Entry" );
log.Debug( "FindActionObject - Entry" );
// Apply the input to the ActionTree
ActionCls ac = null;
ActionMapCls ACM = ActionMaps.Find( delegate( ActionMapCls acm ) { return acm.name == actionMap; } );
if ( ACM != null ) ac = ACM.Find( delegate( ActionCls _AC ) { return _AC.key == action; } );
if ( ac == null ) {
log.Error( "FindAction - Action Not found in tree" );
log.Error( "FindActionObject - Action Not found in tree" );
return null; // ERROR - Action Not found in tree
}
return ac;
@ -345,14 +345,15 @@ namespace SCJMapper_V2
/// <param name="input">The input command</param>
/// <param name="action">The action to update</param>
/// <param name="inKind">The input device</param>
private void UpdateActionFromInput( String input, ActionCls action )
private void UpdateActionFromInput( String input, Boolean invert, ActionCls action )
{
log.Debug( "UpdateAction - Entry" );
log.Debug( "UpdateActionFromInput - Entry" );
if ( action == null ) return;
// Apply the input to the ActionTree
if ( String.IsNullOrEmpty( input ) ) {
// unmapped - handle the blended ones from setting
action.inverted = false; // reset in any case
if ( JoystickCls.IsDeviceClass( action.device ) && BlendUnmappedJS ) action.input = JoystickCls.BlendedInput;
else if ( GamepadCls.IsDeviceClass( action.device ) && BlendUnmappedGP ) action.input = GamepadCls.BlendedInput;
else action.input = "";
@ -360,6 +361,7 @@ namespace SCJMapper_V2
else {
// mapped ones
action.input = input;
action.inverted = invert;
}
Dirty = true;
}
@ -374,7 +376,7 @@ namespace SCJMapper_V2
/// <param name="inKind">The input device</param>
private void UpdateNodeFromAction( ActionTreeNode node, ActionCls action, DeviceCls.InputKind inKind )
{
log.Debug( "UpdateNode - Entry" );
log.Debug( "UpdateNodeFromAction - Entry" );
if ( action == null ) return;
// applies only to ActionNodes
@ -382,22 +384,24 @@ namespace SCJMapper_V2
// input is either "" or a valid mapping or a blended mapping
if ( String.IsNullOrEmpty( action.input ) ) {
// new unmapped
node.Command = ""; node.BackColor = MyColors.UnassignedColor;
node.Command = ""; node.InvertCommand = false; node.BackColor = MyColors.UnassignedColor;
}
// blended mapped ones - can only get a Blend Background
else if ( JoystickCls.IsDeviceClass( action.device ) && ( action.input == JoystickCls.BlendedInput ) ) {
node.Command = action.input; node.BackColor = MyColors.BlendedColor;
node.Command = action.input; node.InvertCommand = false; node.BackColor = MyColors.BlendedColor;
}
else if ( GamepadCls.IsDeviceClass( action.device ) && ( action.input == GamepadCls.BlendedInput ) ) {
node.Command = action.input; node.BackColor = MyColors.BlendedColor;
node.Command = action.input; node.InvertCommand = false; node.BackColor = MyColors.BlendedColor;
}
else if ( action.input == DeviceCls.BlendedInput ) {
// Manually Blended input
node.Command = action.input; node.BackColor = MyColors.BlendedColor;
node.Command = action.input; node.InvertCommand = false; node.BackColor = MyColors.BlendedColor;
}
else {
// mapped ( regular ones )
node.Command = action.input;
node.InvertCommand = action.inverted;
// background is along the input
if ( inKind == DeviceCls.InputKind.Joystick ) {
int jNum = JoystickCls.JSNum( action.input );
@ -431,12 +435,12 @@ namespace SCJMapper_V2
foreach ( ActionMapCls acm in ActionMaps ) {
if ( IgnoreMaps.Contains( "," + acm.name + "," ) ) break; // next
try {
ActionTreeNode amTn = (ActionTreeNode)m_MasterTree.Nodes[acm.name]; // get the map node
ActionTreeNode amTn = ( ActionTreeNode )m_MasterTree.Nodes[acm.name]; // get the map node
// find the item to reload into the treeview
foreach ( ActionCls ac in acm ) {
try {
ActionTreeNode tnl = (ActionTreeNode)amTn.Nodes[ac.key];
UpdateActionFromInput(ac.input, ac ); // this may apply (un)Blending if needed
ActionTreeNode tnl = ( ActionTreeNode )amTn.Nodes[ac.key];
UpdateActionFromInput( ac.input, ac.inverted, ac ); // this may apply (un)Blending if needed
// input kind priority first
if ( JoystickCls.IsJsN( ac.input ) ) {
UpdateNodeFromAction( tnl, ac, DeviceCls.InputKind.Joystick );
@ -480,9 +484,9 @@ namespace SCJMapper_V2
/// this method is applied to the GUI TreeView only
/// </summary>
/// <param name="m_MasterTree">The string to find</param>
public void FindCtrl( String ctrl )
public void FindAndSelectCtrl( String ctrl )
{
log.Debug( "FindCtrl - Entry" );
log.Debug( "FindAndSelectCtrl - Entry" );
Boolean found = false;
foreach ( ActionTreeNode tn in Ctrl.Nodes ) {
@ -503,42 +507,98 @@ namespace SCJMapper_V2
/// <summary>
/// Find a control that contains the Command
/// </summary>
/// <param name="m_MasterTree">The string to find</param>
public String FindCommand( String ctrl )
/// <param name="actionmap">The actionmap to find the string</param>
/// <param name="text">The string to find</param>
public String FindAction( String actionmap, String action )
{
log.Debug( "FindCtrl - Entry" );
log.Debug( "FindAction - Entry" );
foreach ( ActionTreeNode tn in Ctrl.Nodes ) {
// have to search nodes of nodes
foreach ( ActionTreeNode stn in tn.Nodes ) {
if ( stn.Command.Contains( ctrl ) ) {
return stn.Text;
if ( String.IsNullOrEmpty( actionmap ) || ( tn.Text == actionmap ) ) {
// have to search nodes of nodes
foreach ( ActionTreeNode stn in tn.Nodes ) {
if ( stn.Action.Contains( action ) ) {
return stn.Text;
}
}
}
}
return "";
}
/// <summary>
/// Find a control that contains the Action
/// </summary>
/// <param name="text">The string to find</param>
public String FindAction( String action )
{
return FindAction( "", action );
}
/// <summary>
/// Find a control that contains the Text
/// Find a control that contains the Command
/// </summary>
/// <param name="m_MasterTree">The string to find</param>
public String FindText( String text )
/// <param name="actionmap">The actionmap to find the string</param>
/// <param name="text">The string to find</param>
public String FindCommand( String actionmap, String command )
{
log.Debug( "FindCommand - Entry" );
foreach ( ActionTreeNode tn in Ctrl.Nodes ) {
if ( String.IsNullOrEmpty( actionmap ) || ( tn.Text == actionmap ) ) {
// have to search nodes of nodes
foreach ( ActionTreeNode stn in tn.Nodes ) {
if ( stn.Command.Contains( command ) ) {
return stn.Text;
}
}
}
}
return "";
}
/// <summary>
/// Find a control that contains the Command
/// </summary>
/// <param name="text">The string to find</param>
public String FindCommand( String command )
{
return FindCommand( "", command );
}
/// <summary>
/// Find a control the the actionmap that contains the Text
/// </summary>
/// <param name="actionmap">The actionmap to find the string</param>
/// <param name="text">The string to find</param>
public String FindText( String actionmap, String text )
{
log.Debug( "FindText - Entry" );
foreach ( ActionTreeNode tn in Ctrl.Nodes ) {
// have to search nodes of nodes
foreach ( ActionTreeNode stn in tn.Nodes ) {
if ( stn.Text.Contains( text ) ) {
return stn.Text;
if ( String.IsNullOrEmpty( actionmap ) || ( tn.Text == actionmap ) ) {
// have to search nodes of nodes
foreach ( ActionTreeNode stn in tn.Nodes ) {
if ( stn.Text.Contains( text ) ) {
return stn.Text;
}
}
}
}
return "";
}
/// <summary>
/// Find a control that contains the Text
/// </summary>
/// <param name="text">The string to find</param>
public String FindText( String text )
{
return FindText( "", text );
}
/// <summary>
/// Reports a summary list of the mapped items

@ -12,6 +12,83 @@ namespace SCJMapper_V2
class ActionTreeNode : TreeNode
{
#region Static items
public const char REG_MOD = '-';
public const char INV_MOD = '!';
// Handle all text label composition and extraction here
public static String ComposeNodeText( String action, char mod, String cmd )
{
if ( String.IsNullOrEmpty( cmd ) ) {
return action;
}
else {
return action + " " + mod + " " + cmd;
}
}
public static void DecompNodeText( String nodeText, out String action, out char mod, out String cmd )
{
action = ""; cmd = ""; mod = ( nodeText.Contains( INV_MOD ) ) ? INV_MOD : REG_MOD;
String[] e = nodeText.Split( new char[] { REG_MOD, INV_MOD }, StringSplitOptions.RemoveEmptyEntries );
if ( e.Length > 1 ) {
action = e[0].Trim( );
cmd = e[1].Trim( );
}
else if ( e.Length > 0 ) {
action = e[0].Trim( );
cmd = "";
}
}
/// <summary>
/// Returns the action part from a node text
/// i.e. v_pitch - js1_x returns v_pitch
/// </summary>
/// <param name="nodeText">The node text in 'action - command' notation</param>
/// <returns>the action part or an empty string</returns>
public static String ActionFromNodeText( String nodeText )
{
String action, cmd; char mod;
DecompNodeText( nodeText, out action, out mod, out cmd );
return action;
}
/// <summary>
/// Returns the command part from a node text
/// i.e. v_pitch - js1_x returns js1_x
/// </summary>
/// <param name="nodeText">The node text in 'action - command' notation</param>
/// <returns>the command part or an empty string</returns>
public static String CommandFromNodeText( String nodeText )
{
String action, cmd; char mod;
DecompNodeText( nodeText, out action, out mod, out cmd );
return cmd;
}
/// <summary>
/// Returns the invert modifier of the command part from a node text
/// i.e. v_pitch - js1_x returns false v_pitch ! js1_x returns true
/// </summary>
/// <param name="nodeText">The node text in 'action - command' notation</param>
/// <returns>True if there is a command and if it contains an inverter else false</returns>
public static Boolean CommandInvertFromNodeText( String nodeText )
{
String action, cmd; char mod;
DecompNodeText( nodeText, out action, out mod, out cmd );
return ( mod == INV_MOD );
}
#endregion
public ActionTreeNode( )
: base( )
{
@ -30,11 +107,12 @@ namespace SCJMapper_V2
this.Tag = srcNode.Tag;
this.m_action = srcNode.m_action;
this.m_command = srcNode.m_command;
this.m_modifier = srcNode.m_modifier;
}
public ActionTreeNode( string text )
: base( text )
{
this.Text = text;
}
public ActionTreeNode( string text, ActionTreeNode[] children )
@ -65,6 +143,18 @@ namespace SCJMapper_V2
private String m_action = "";
private String m_command ="";
private char m_modifier = REG_MOD;
public new String Text
{
get { return base.Text; }
set
{
DecompNodeText( value, out m_action, out m_modifier, out m_command );
base.Text = ComposeNodeText( m_action, m_modifier, m_command );
}
}
public String Action
{
@ -72,7 +162,7 @@ namespace SCJMapper_V2
set
{
m_action = value;
this.Text = ComposeNodeText( m_action, m_command );
base.Text = ComposeNodeText( m_action, m_modifier, m_command );
}
}
@ -82,60 +172,21 @@ namespace SCJMapper_V2
set
{
m_command = value;
this.Text = ComposeNodeText( m_action, m_command );
base.Text = ComposeNodeText( m_action, m_modifier, m_command );
}
}
// Handle all text label composition and extraction here
private static String ComposeNodeText( String action, String cmd )
{
if ( String.IsNullOrEmpty( cmd ) ) {
return action;
}
else {
return action + " - " + cmd;
}
}
private static void DecompNodeText( String nodeText, out String action, out String cmd )
public Boolean InvertCommand
{
action = ""; cmd = "";
String[] e = nodeText.Split( new char[] { '-' }, StringSplitOptions.RemoveEmptyEntries );
if ( e.Length > 1 ) {
action = e[0].Trim( );
cmd = e[1].Trim( );
get { return ( m_modifier == INV_MOD ); }
set
{
m_modifier = ( value ) ? INV_MOD : REG_MOD;
base.Text = ComposeNodeText( m_action, m_modifier, m_command );
}
}
/// <summary>
/// Returns the action part from a node text
/// i.e. v_pitch - js1_x returns v_pitch
/// </summary>
/// <param name="nodeText">The node text in 'action - command' notation</param>
/// <returns>the action part or an empty string</returns>
public static String ActionFromNodeText( String nodeText )
{
String action, cmd;
DecompNodeText( nodeText, out action, out cmd );
return action;
}
/// <summary>
/// Returns the command part from a node text
/// i.e. v_pitch - js1_x returns js1_x
/// </summary>
/// <param name="nodeText">The node text in 'action - command' notation</param>
/// <returns>the command part or an empty string</returns>
public static String CommandFromNodeText( String nodeText )
{
String action, cmd;
DecompNodeText( nodeText, out action, out cmd );
return cmd;
}
}
}

@ -1,10 +1,10 @@
SC Joystick Mapper V 2.7 - Build 33
(c) Cassini, StandardToaster - 13-November-2014
SC Joystick Mapper V 2.8 - Build 34 BETA
(c) Cassini, StandardToaster - 18-November-2014
Contains 9 files:
SCJMapper.exe The program (V2.7)
SCJMapper.exe.config Program config (V2.7) - MUST be in the same folder as the Exe file
SCJMapper.exe The program (V2.8 BETA)
SCJMapper.exe.config Program config (V2.8) - MUST be in the same folder as the Exe file
SharpDX.DirectInput.dll Managed DirectInput Assembly - MUST be in the same folder as the Exe file
SharpDX.dll Managed DirectX Assembly - MUST be in the same folder as the Exe file
OpenTK.dll Managed OpenGL Assembly - MUST be in the same folder as the Exe file
@ -13,7 +13,7 @@ Ionic.Zip.Reduced.dll Managed Zip Assembly - MUST be in th
log4net.dll Managed Logging Assembly - MUST be in the same folder as the Exe file
log4net.config.OFF Config file for logging - To use it - rename as log4net.config and run the program
then look for trace.log in the same folder
SCJMapper_QGuide V2.7.pdf Quick Guide
SCJMapper_QGuide V2.8beta.pdf Quick Guide
ReadMe.txt This file
graphics folder Skybox Images - graphics folder MUST be in the same folder as the Exe file
@ -29,6 +29,12 @@ Scanned for viruses before packing...
cassini@burri-web.org
Changelog:
V 2.8 - BETA
- new feature - add keyboard input
- new feature - add gamepad input as xboxpad
- new feature - add gamepad for tuning
- fix - tuning copy to all axis now applies immediately
- improvement - cleanup of some inconsistencies
V 2.7 - Build 33
- fix - if an axis is not mapped the prog will not longer crash (was null ptr exception)
- doc update 2.7

Binary file not shown.

Binary file not shown.
Loading…
Cancel
Save