3rd SC 2.0 Alpha Push

- add ActivationMode handling
- add PTU file usage in Settings
- Prepared JS Modifiers (but SC cannot right now - so it is disabled)
- Some GUI improvements
pull/104/head
bm98 9 years ago
parent 2158bcf8b7
commit ffd8a2d2a4

@ -155,7 +155,31 @@ DefaultProfile Format
<profile version="1" optionsVersion="2" rebindVersion="2">
ActivationModes:
=================
<ActivationModes>
<ActivationMode name="tap" onPress="0" onHold="0" onRelease="1" multiTap="1" multiTapBlock="1" pressTriggerThreshold="-1" releaseTriggerThreshold="0.25" releaseTriggerDelay="0" />
<ActivationMode name="double_tap" onPress="1" onHold="0" onRelease="0" multiTap="2" multiTapBlock="1" pressTriggerThreshold="-1" releaseTriggerThreshold="-1" releaseTriggerDelay="0" />
<ActivationMode name="double_tap_nonblocking" onPress="1" onHold="0" onRelease="0" multiTap="2" multiTapBlock="0" pressTriggerThreshold="-1" releaseTriggerThreshold="-1" releaseTriggerDelay="0" />
<ActivationMode name="press" onPress="1" onHold="0" onRelease="0" multiTap="1" multiTapBlock="1" pressTriggerThreshold="-1" releaseTriggerThreshold="-1" releaseTriggerDelay="0" />
<ActivationMode name="delayed_press" onPress="1" onHold="0" onRelease="0" multiTap="1" multiTapBlock="1" pressTriggerThreshold="0.25" releaseTriggerThreshold="-1" releaseTriggerDelay="0" />
<ActivationMode name="hold" onPress="1" onHold="0" onRelease="1" multiTap="1" multiTapBlock="1" pressTriggerThreshold="-1" releaseTriggerThreshold="-1" releaseTriggerDelay="0" />
<ActivationMode name="delayed_hold" onPress="1" onHold="0" onRelease="1" multiTap="1" multiTapBlock="1" pressTriggerThreshold="0.25" releaseTriggerThreshold="-1" releaseTriggerDelay="0" />
<ActivationMode name="smart_toggle" onPress="1" onHold="0" onRelease="1" multiTap="1" multiTapBlock="1" pressTriggerThreshold="-1" releaseTriggerThreshold="-1" releaseTriggerDelay="0.25" />
</ActivationModes>
Example usage as dualbinding with double tap:
<action name="v_power_throttle_up" onPress="1" onHold="1" keyboard="np_add" xboxpad=" " joystick=" " UILabel="@ui_CIPowerThrottleUp" UIDescription="@ui_CIPowerThrottleUpDesc"/>
<action name="v_power_throttle_max" ActivationMode="double_tap" keyboard="np_add" xboxpad=" " joystick=" " UILabel="" UIDescription=""/>
Default Option Trees:
======================
<optiontree type="keyboard" name="root" UIShowInvert="-1" UIShowSensitivity="-1" UISensitivityMin="0.01" UISensitivityMax="6.25">
.. structure

@ -28,9 +28,10 @@ namespace SCJMapper_V2
/// <summary>
/// Show the Settings Dialog
/// </summary>
public DialogResult ShowSettings( )
public DialogResult ShowSettings( String pasteString )
{
if ( FS == null ) FS = new FormSettings( this );
FS.PasteString = pasteString; // propagate joyinput
FS.ShowDialog( );
return ( FS.Canceled ) ? DialogResult.Cancel : DialogResult.OK;
}
@ -222,6 +223,14 @@ namespace SCJMapper_V2
set { this["DetectGamepad"] = value; }
}
[UserScopedSettingAttribute( )]
[DefaultSettingValueAttribute( "False" )]
public Boolean UsePTU
{
get { return ( Boolean )this["UsePTU"]; }
set { this["UsePTU"] = value; }
}
#endregion

198
Form1.Designer.cs generated

@ -47,6 +47,7 @@
this.btGrab = new System.Windows.Forms.Button();
this.btDump = new System.Windows.Forms.Button();
this.panel2 = new System.Windows.Forms.Panel();
this.btMakeMod = new System.Windows.Forms.Button();
this.btJsKbd = new System.Windows.Forms.Button();
this.IL = new System.Windows.Forms.ImageList(this.components);
this.btBlend = new System.Windows.Forms.Button();
@ -71,8 +72,12 @@
this.tdiBlendBinding = new System.Windows.Forms.ToolStripMenuItem();
this.tdiClearBinding = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.tsiAddBinding = new System.Windows.Forms.ToolStripMenuItem();
this.tdiAddBinding = new System.Windows.Forms.ToolStripMenuItem();
this.tdiDelBinding = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator();
this.tdiAddMod1 = new System.Windows.Forms.ToolStripMenuItem();
this.tdiAddMod2 = new System.Windows.Forms.ToolStripMenuItem();
this.tdiAddMod3 = new System.Windows.Forms.ToolStripMenuItem();
this.tc1 = new System.Windows.Forms.TabControl();
this.tabJS1 = new System.Windows.Forms.TabPage();
this.panel1 = new System.Windows.Forms.Panel();
@ -94,6 +99,7 @@
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
this.btSettings = new System.Windows.Forms.Button();
this.btJsReassign = new System.Windows.Forms.Button();
this.lblPTU = new System.Windows.Forms.Label();
this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel();
this.btSaveMyMapping = new System.Windows.Forms.Button();
this.btLoadMyMapping = new System.Windows.Forms.Button();
@ -108,7 +114,7 @@
this.label2 = new System.Windows.Forms.Label();
this.txFilter = new System.Windows.Forms.TextBox();
this.btClearFilter = new System.Windows.Forms.Button();
this.flowLayoutPanel3 = new System.Windows.Forms.FlowLayoutPanel();
this.flpExtensions = new System.Windows.Forms.FlowLayoutPanel();
this.cbxInvAimPitch = new System.Windows.Forms.CheckBox();
this.cbxInvViewPitch = new System.Windows.Forms.CheckBox();
this.cbxInvAimYaw = new System.Windows.Forms.CheckBox();
@ -131,6 +137,9 @@
this.loadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.toolStripSeparator6 = new System.Windows.Forms.ToolStripSeparator();
this.tdiCbxActivation = new System.Windows.Forms.ToolStripComboBox();
this.tdiTxDefActivationMode = new System.Windows.Forms.ToolStripTextBox();
this.UC_JoyPanel = new SCJMapper_V2.UC_JoyPanel();
this.cmCopyPaste.SuspendLayout();
this.panel2.SuspendLayout();
@ -145,7 +154,7 @@
this.tableLayoutPanel2.SuspendLayout();
this.tableLayoutPanel3.SuspendLayout();
this.flowLayoutPanel2.SuspendLayout();
this.flowLayoutPanel3.SuspendLayout();
this.flpExtensions.SuspendLayout();
this.statusStrip1.SuspendLayout();
this.SuspendLayout();
//
@ -257,6 +266,7 @@
// panel2
//
this.panel2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panel2.Controls.Add(this.btMakeMod);
this.panel2.Controls.Add(this.btJsKbd);
this.panel2.Controls.Add(this.btBlend);
this.panel2.Controls.Add(this.lblLastJ);
@ -273,12 +283,23 @@
this.panel2.Size = new System.Drawing.Size(289, 170);
this.panel2.TabIndex = 17;
//
// btMakeMod
//
this.btMakeMod.Location = new System.Drawing.Point(10, 140);
this.btMakeMod.Name = "btMakeMod";
this.btMakeMod.Size = new System.Drawing.Size(73, 25);
this.btMakeMod.TabIndex = 17;
this.btMakeMod.Text = "Make MOD";
this.btMakeMod.UseVisualStyleBackColor = true;
this.btMakeMod.Visible = false;
this.btMakeMod.Click += new System.EventHandler(this.btMakeMod_Click);
//
// btJsKbd
//
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, 125);
this.btJsKbd.Location = new System.Drawing.Point(104, 102);
this.btJsKbd.Name = "btJsKbd";
this.btJsKbd.Size = new System.Drawing.Size(79, 25);
this.btJsKbd.TabIndex = 16;
@ -303,7 +324,7 @@
//
// btBlend
//
this.btBlend.Location = new System.Drawing.Point(10, 125);
this.btBlend.Location = new System.Drawing.Point(10, 102);
this.btBlend.Name = "btBlend";
this.btBlend.Size = new System.Drawing.Size(73, 25);
this.btBlend.TabIndex = 16;
@ -380,7 +401,7 @@
// cbxThrottle
//
this.cbxThrottle.AutoSize = true;
this.cbxThrottle.Location = new System.Drawing.Point(89, 86);
this.cbxThrottle.Location = new System.Drawing.Point(89, 76);
this.cbxThrottle.Name = "cbxThrottle";
this.cbxThrottle.Size = new System.Drawing.Size(66, 17);
this.cbxThrottle.TabIndex = 13;
@ -389,7 +410,7 @@
//
// btFind
//
this.btFind.Location = new System.Drawing.Point(201, 81);
this.btFind.Location = new System.Drawing.Point(201, 71);
this.btFind.Name = "btFind";
this.btFind.Size = new System.Drawing.Size(73, 25);
this.btFind.TabIndex = 12;
@ -417,7 +438,7 @@
//
// btClear
//
this.btClear.Location = new System.Drawing.Point(201, 125);
this.btClear.Location = new System.Drawing.Point(201, 102);
this.btClear.Name = "btClear";
this.btClear.Size = new System.Drawing.Size(73, 25);
this.btClear.TabIndex = 2;
@ -437,7 +458,7 @@
//
// btAssign
//
this.btAssign.Location = new System.Drawing.Point(10, 81);
this.btAssign.Location = new System.Drawing.Point(10, 71);
this.btAssign.Name = "btAssign";
this.btAssign.Size = new System.Drawing.Size(73, 25);
this.btAssign.TabIndex = 15;
@ -469,52 +490,92 @@
this.tdiBlendBinding,
this.tdiClearBinding,
this.toolStripSeparator2,
this.tsiAddBinding,
this.tdiDelBinding});
this.tdiAddBinding,
this.tdiDelBinding,
this.toolStripSeparator5,
this.tdiTxDefActivationMode,
this.tdiCbxActivation,
this.toolStripSeparator6,
this.tdiAddMod1,
this.tdiAddMod2,
this.tdiAddMod3});
this.cmAddDel.Name = "cmAddDel";
this.cmAddDel.Size = new System.Drawing.Size(161, 120);
this.cmAddDel.Size = new System.Drawing.Size(221, 429);
this.cmAddDel.Closed += new System.Windows.Forms.ToolStripDropDownClosedEventHandler(this.cmAddDel_Closed);
this.cmAddDel.Opening += new System.ComponentModel.CancelEventHandler(this.cmAddDel_Opening);
//
// tdiAssignBinding
//
this.tdiAssignBinding.Name = "tdiAssignBinding";
this.tdiAssignBinding.Size = new System.Drawing.Size(160, 22);
this.tdiAssignBinding.Size = new System.Drawing.Size(220, 22);
this.tdiAssignBinding.Text = "Assign Mapping";
this.tdiAssignBinding.Click += new System.EventHandler(this.tdiAssignBinding_Click);
//
// tdiBlendBinding
//
this.tdiBlendBinding.Name = "tdiBlendBinding";
this.tdiBlendBinding.Size = new System.Drawing.Size(160, 22);
this.tdiBlendBinding.Size = new System.Drawing.Size(220, 22);
this.tdiBlendBinding.Text = "Blend Mapping";
this.tdiBlendBinding.Click += new System.EventHandler(this.tdiBlendBinding_Click);
//
// tdiClearBinding
//
this.tdiClearBinding.Name = "tdiClearBinding";
this.tdiClearBinding.Size = new System.Drawing.Size(160, 22);
this.tdiClearBinding.Size = new System.Drawing.Size(220, 22);
this.tdiClearBinding.Text = "Clear Mapping";
this.tdiClearBinding.Click += new System.EventHandler(this.tdiClearBinding_Click);
//
// toolStripSeparator2
//
this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator2.Size = new System.Drawing.Size(157, 6);
this.toolStripSeparator2.Size = new System.Drawing.Size(217, 6);
//
// tsiAddBinding
// tdiAddBinding
//
this.tsiAddBinding.Name = "tsiAddBinding";
this.tsiAddBinding.Size = new System.Drawing.Size(160, 22);
this.tsiAddBinding.Text = "Add Mapping";
this.tsiAddBinding.Click += new System.EventHandler(this.tsiAddBinding_Click);
this.tdiAddBinding.Name = "tdiAddBinding";
this.tdiAddBinding.Size = new System.Drawing.Size(220, 22);
this.tdiAddBinding.Text = "Add Mapping";
this.tdiAddBinding.Click += new System.EventHandler(this.tsiAddBinding_Click);
//
// tdiDelBinding
//
this.tdiDelBinding.Name = "tdiDelBinding";
this.tdiDelBinding.Size = new System.Drawing.Size(160, 22);
this.tdiDelBinding.Size = new System.Drawing.Size(220, 22);
this.tdiDelBinding.Text = "Delete Mapping";
this.tdiDelBinding.Click += new System.EventHandler(this.tdiDelBinding_Click);
//
// toolStripSeparator5
//
this.toolStripSeparator5.Name = "toolStripSeparator5";
this.toolStripSeparator5.Size = new System.Drawing.Size(217, 6);
//
// tdiAddMod1
//
this.tdiAddMod1.Name = "tdiAddMod1";
this.tdiAddMod1.Size = new System.Drawing.Size(220, 22);
this.tdiAddMod1.Tag = "0";
this.tdiAddMod1.Text = "Mod:";
this.tdiAddMod1.Visible = false;
this.tdiAddMod1.Click += new System.EventHandler(this.tdiAddMod_Click);
//
// tdiAddMod2
//
this.tdiAddMod2.Name = "tdiAddMod2";
this.tdiAddMod2.Size = new System.Drawing.Size(220, 22);
this.tdiAddMod2.Tag = "1";
this.tdiAddMod2.Text = "Mod:";
this.tdiAddMod2.Visible = false;
this.tdiAddMod2.Click += new System.EventHandler(this.tdiAddMod_Click);
//
// tdiAddMod3
//
this.tdiAddMod3.Name = "tdiAddMod3";
this.tdiAddMod3.Size = new System.Drawing.Size(220, 22);
this.tdiAddMod3.Tag = "2";
this.tdiAddMod3.Text = "Mod:";
this.tdiAddMod3.Visible = false;
this.tdiAddMod3.Click += new System.EventHandler(this.tdiAddMod_Click);
//
// tc1
//
this.tc1.Controls.Add(this.tabJS1);
@ -530,6 +591,7 @@
this.tc1.Size = new System.Drawing.Size(289, 349);
this.tc1.TabIndex = 15;
this.tc1.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.tc1_DrawItem);
this.tc1.Selected += new System.Windows.Forms.TabControlEventHandler(this.tc1_Selected);
//
// tabJS1
//
@ -656,7 +718,7 @@
this.tlpanel.Controls.Add(this.tableLayoutPanel2, 1, 3);
this.tlpanel.Controls.Add(this.tableLayoutPanel3, 2, 3);
this.tlpanel.Controls.Add(this.flowLayoutPanel2, 0, 3);
this.tlpanel.Controls.Add(this.flowLayoutPanel3, 2, 2);
this.tlpanel.Controls.Add(this.flpExtensions, 2, 2);
this.tlpanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.tlpanel.GrowStyle = System.Windows.Forms.TableLayoutPanelGrowStyle.FixedSize;
this.tlpanel.Location = new System.Drawing.Point(0, 0);
@ -732,6 +794,7 @@
this.tableLayoutPanel2.Controls.Add(this.buttonExit, 1, 1);
this.tableLayoutPanel2.Controls.Add(this.btSettings, 0, 1);
this.tableLayoutPanel2.Controls.Add(this.btJsReassign, 0, 0);
this.tableLayoutPanel2.Controls.Add(this.lblPTU, 1, 0);
this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel2.GrowStyle = System.Windows.Forms.TableLayoutPanelGrowStyle.FixedSize;
this.tableLayoutPanel2.Location = new System.Drawing.Point(376, 773);
@ -762,6 +825,18 @@
this.btJsReassign.Text = "Js Reassign...";
this.btJsReassign.Click += new System.EventHandler(this.btJsReassign_Click);
//
// lblPTU
//
this.lblPTU.BackColor = System.Drawing.Color.SandyBrown;
this.lblPTU.Font = new System.Drawing.Font("Segoe UI", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblPTU.Location = new System.Drawing.Point(150, 0);
this.lblPTU.Name = "lblPTU";
this.lblPTU.Size = new System.Drawing.Size(141, 45);
this.lblPTU.TabIndex = 17;
this.lblPTU.Text = "Using PTU folders";
this.lblPTU.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.lblPTU.Visible = false;
//
// tableLayoutPanel3
//
this.tableLayoutPanel3.ColumnCount = 2;
@ -932,23 +1007,23 @@
this.btClearFilter.UseVisualStyleBackColor = true;
this.btClearFilter.Click += new System.EventHandler(this.btClearFilter_Click);
//
// flowLayoutPanel3
//
this.flowLayoutPanel3.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.flowLayoutPanel3.Controls.Add(this.cbxInvAimPitch);
this.flowLayoutPanel3.Controls.Add(this.cbxInvViewPitch);
this.flowLayoutPanel3.Controls.Add(this.cbxInvAimYaw);
this.flowLayoutPanel3.Controls.Add(this.cbxInvViewYaw);
this.flowLayoutPanel3.Controls.Add(this.cbxInvThrottle);
this.flowLayoutPanel3.Controls.Add(this.cbxInvStrafeVert);
this.flowLayoutPanel3.Controls.Add(this.cbxInvStrafeLat);
this.flowLayoutPanel3.Controls.Add(this.cbxInvStrafeLon);
this.flowLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowLayoutPanel3.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
this.flowLayoutPanel3.Location = new System.Drawing.Point(676, 618);
this.flowLayoutPanel3.Name = "flowLayoutPanel3";
this.flowLayoutPanel3.Size = new System.Drawing.Size(372, 149);
this.flowLayoutPanel3.TabIndex = 27;
// flpExtensions
//
this.flpExtensions.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.flpExtensions.Controls.Add(this.cbxInvAimPitch);
this.flpExtensions.Controls.Add(this.cbxInvViewPitch);
this.flpExtensions.Controls.Add(this.cbxInvAimYaw);
this.flpExtensions.Controls.Add(this.cbxInvViewYaw);
this.flpExtensions.Controls.Add(this.cbxInvThrottle);
this.flpExtensions.Controls.Add(this.cbxInvStrafeVert);
this.flpExtensions.Controls.Add(this.cbxInvStrafeLat);
this.flpExtensions.Controls.Add(this.cbxInvStrafeLon);
this.flpExtensions.Dock = System.Windows.Forms.DockStyle.Fill;
this.flpExtensions.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
this.flpExtensions.Location = new System.Drawing.Point(676, 618);
this.flpExtensions.Name = "flpExtensions";
this.flpExtensions.Size = new System.Drawing.Size(372, 149);
this.flpExtensions.TabIndex = 27;
//
// cbxInvAimPitch
//
@ -1164,6 +1239,33 @@
this.statusStrip1.TabIndex = 26;
this.statusStrip1.Text = "statusStrip1";
//
// toolStripSeparator6
//
this.toolStripSeparator6.Name = "toolStripSeparator6";
this.toolStripSeparator6.Size = new System.Drawing.Size(217, 6);
//
// tdiCbxActivation
//
this.tdiCbxActivation.AutoSize = false;
this.tdiCbxActivation.DropDownHeight = 140;
this.tdiCbxActivation.DropDownStyle = System.Windows.Forms.ComboBoxStyle.Simple;
this.tdiCbxActivation.DropDownWidth = 160;
this.tdiCbxActivation.IntegralHeight = false;
this.tdiCbxActivation.Items.AddRange(new object[] {
"None"});
this.tdiCbxActivation.MaxDropDownItems = 10;
this.tdiCbxActivation.Name = "tdiCbxActivation";
this.tdiCbxActivation.Size = new System.Drawing.Size(160, 180);
//
// tdiTxDefActivationMode
//
this.tdiTxDefActivationMode.BackColor = System.Drawing.Color.PapayaWhip;
this.tdiTxDefActivationMode.Font = new System.Drawing.Font("Segoe UI", 9F);
this.tdiTxDefActivationMode.Name = "tdiTxDefActivationMode";
this.tdiTxDefActivationMode.ReadOnly = true;
this.tdiTxDefActivationMode.Size = new System.Drawing.Size(160, 23);
this.tdiTxDefActivationMode.Text = "Default ActMode";
//
// UC_JoyPanel
//
this.UC_JoyPanel.Dock = System.Windows.Forms.DockStyle.Fill;
@ -1194,6 +1296,7 @@
this.panel2.PerformLayout();
this.cmMouseEntry.ResumeLayout(false);
this.cmAddDel.ResumeLayout(false);
this.cmAddDel.PerformLayout();
this.tc1.ResumeLayout(false);
this.tabJS1.ResumeLayout(false);
this.panel1.ResumeLayout(false);
@ -1206,7 +1309,7 @@
this.tableLayoutPanel3.PerformLayout();
this.flowLayoutPanel2.ResumeLayout(false);
this.flowLayoutPanel2.PerformLayout();
this.flowLayoutPanel3.ResumeLayout(false);
this.flpExtensions.ResumeLayout(false);
this.statusStrip1.ResumeLayout(false);
this.statusStrip1.PerformLayout();
this.ResumeLayout(false);
@ -1290,9 +1393,9 @@
private System.Windows.Forms.CheckBox cbxShowMappedOnly;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.ContextMenuStrip cmAddDel;
private System.Windows.Forms.ToolStripMenuItem tsiAddBinding;
private System.Windows.Forms.ToolStripMenuItem tdiAddBinding;
private System.Windows.Forms.ToolStripMenuItem tdiDelBinding;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel3;
private System.Windows.Forms.FlowLayoutPanel flpExtensions;
private System.Windows.Forms.CheckBox cbxInvAimPitch;
private System.Windows.Forms.CheckBox cbxInvViewPitch;
private System.Windows.Forms.CheckBox cbxInvAimYaw;
@ -1314,6 +1417,15 @@
private System.Windows.Forms.ToolStripMenuItem tmeWUp;
private System.Windows.Forms.ToolStripMenuItem tmeWDown;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator4;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator5;
private System.Windows.Forms.ToolStripMenuItem tdiAddMod1;
private System.Windows.Forms.ToolStripMenuItem tdiAddMod2;
private System.Windows.Forms.ToolStripMenuItem tdiAddMod3;
private System.Windows.Forms.Button btMakeMod;
private System.Windows.Forms.Label lblPTU;
private System.Windows.Forms.ToolStripComboBox tdiCbxActivation;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator6;
private System.Windows.Forms.ToolStripTextBox tdiTxDefActivationMode;
}
}

@ -28,6 +28,11 @@ namespace SCJMapper_V2
///</remarks>
private JoystickList m_Joystick = new JoystickList( );
///<remarks>
/// Holds the currently selected Joystick
///</remarks>
private JoystickCls m_curJoystick = null;
///<remarks>
/// Holds the DXInput keyboard
///</remarks>
@ -265,6 +270,14 @@ namespace SCJMapper_V2
cbxShowMouse.Checked = m_AppSettings.ShowMouse;
cbxShowMappedOnly.Checked = m_AppSettings.ShowMapped;
// init current Joystick
int jsIndex = ( int )tc1.SelectedTab.Tag; // gets the index into the JS list
if ( jsIndex >= 0 ) m_curJoystick = m_Joystick[jsIndex];
// init PTU folder usage sign
lblPTU.Visible = m_AppSettings.UsePTU;
if (m_AppSettings.UsePTU) log.Debug( "Using PTU Folders" );
// poll the XInput
log.Debug( "Start XInput polling" );
timer1.Start( ); // this one polls the joysticks to show the props
@ -283,6 +296,18 @@ namespace SCJMapper_V2
}
// TAB Control Events
private void tc1_Selected( object sender, TabControlEventArgs e )
{
// init current Joystick
int jsIndex = ( int )tc1.SelectedTab.Tag; // gets the index into the JS list
if ( jsIndex >= 0 )
m_curJoystick = m_Joystick[jsIndex];
else
m_curJoystick = null;
}
/// <summary>
/// Fancy tab coloring with ownerdraw to paint the callout buttons
/// </summary>
@ -374,6 +399,11 @@ namespace SCJMapper_V2
inversions.Add( cbxInvStrafeVert ); inversions.Add( cbxInvStrafeLat ); inversions.Add( cbxInvStrafeLon );
m_AT.InvertCheckList = inversions;
// Activation Update
tdiCbxActivation.Items.Clear( );
tdiCbxActivation.Items.AddRange( m_AT.ActivationModes.ToArray() );
tdiCbxActivation.SelectedIndex = 0;
// apply a default JS to Joystick mapping - can be changed and reloaded from XML mappings
// must take care of Gamepads if there are (but we take care of one only...)
@ -552,6 +582,35 @@ namespace SCJMapper_V2
m_Joystick.ResetJsNAssignment( );
m_AT.ActionMaps.fromXML( rtb.Text );
// Collect modifiers - simply overwrite existing ones as we deal with THIS file now
tdiAddMod1.Visible = false; tdiAddMod2.Visible = false; tdiAddMod3.Visible = false; // make context menu invisible
tdiAddMod1.Text = ""; tdiAddMod2.Text = ""; tdiAddMod3.Text = ""; // and clear
for (int i=flpExtensions.Controls.Count-1; i>=0; i-- ) {
if ( ( flpExtensions.Controls[i] as CheckBox ).Text.StartsWith( "js" ) ) flpExtensions.Controls.RemoveAt( i );
}
if ( m_AT.ActionMaps.Modifiers.Count > 2 ) {
tdiAddMod3.Text = string.Format( "MOD: {0}", m_AT.ActionMaps.Modifiers[2] ); tdiAddMod3.Visible = true;
// make a new one
CheckBox cbx = new CheckBox(); cbx.Text = m_AT.ActionMaps.Modifiers[2]; cbx.Checked = true;
cbx.CheckedChanged += Cbx_CheckedChanged;
flpExtensions.Controls.Add( cbx );
}
if ( m_AT.ActionMaps.Modifiers.Count > 1 ) {
tdiAddMod2.Text = string.Format( "MOD: {0}", m_AT.ActionMaps.Modifiers[1] ); tdiAddMod2.Visible = true;
// make a new one
CheckBox cbx = new CheckBox(); cbx.Text = m_AT.ActionMaps.Modifiers[1]; cbx.Checked = true;
cbx.CheckedChanged += Cbx_CheckedChanged;
flpExtensions.Controls.Add( cbx );
}
if ( m_AT.ActionMaps.Modifiers.Count > 0 ) {
tdiAddMod1.Text = string.Format( "MOD: {0}", m_AT.ActionMaps.Modifiers[0] ); tdiAddMod1.Visible = true;
// make a new one
CheckBox cbx = new CheckBox(); cbx.Text = m_AT.ActionMaps.Modifiers[0]; cbx.Checked = true;
cbx.CheckedChanged += Cbx_CheckedChanged;
flpExtensions.Controls.Add( cbx );
}
// JS mapping for js1 .. js8 can be changed and reloaded from XML
// note - unmapped ones remain what they were
// This is includes similar procedures as reassigning of the jsN items
@ -634,23 +693,24 @@ namespace SCJMapper_V2
if ( tc1.SelectedTab.Tag == null ) return;
String ctrl = "";
int jsIndex = ( int )tc1.SelectedTab.Tag; // gets the index into the JS list
if ( jsIndex < 0 ) {
// poll Gamepad if active
m_Gamepad.GetData( );
ctrl = m_Gamepad.GetLastChange( );
timer1.Interval = 750; // allow more time to release buttons
if ( m_curJoystick == null ) {
if ( m_Gamepad != null ) {
// poll Gamepad if active
m_Gamepad.GetData( );
ctrl = m_Gamepad.GetLastChange( );
timer1.Interval = 750; // allow more time to release buttons
}
}
else {
// poll active Joystick
m_Joystick[jsIndex].GetData( ); // poll the device
m_curJoystick.GetData( ); // poll the device
if ( m_Keyboard == null ) {
// no keyboard = no modifier
ctrl = JSStr( ) + m_Joystick[jsIndex].GetLastChange( ); // show last handled JS control
ctrl = JSStr( ) + m_curJoystick.GetLastChange( ); // show last handled JS control
}
else {
UpdateModifiers( ); // get the last keyboard modifer to compose the command
ctrl = JSStr( ) + m_persistentMods + m_Joystick[jsIndex].GetLastChange( ); // show last handled JS control
ctrl = JSStr( ) + m_persistentMods + m_curJoystick.GetLastChange( ); // show last handled JS control
}
timer1.Interval = 150; // standard polling
}
@ -663,6 +723,9 @@ namespace SCJMapper_V2
else {
cbxThrottle.Checked = false; cbxThrottle.Enabled = false;
}
btMakeMod.Enabled = JoystickCls.ValidModifier( ctrl );
}
@ -671,7 +734,10 @@ namespace SCJMapper_V2
private void treeView1_AfterSelect( object sender, TreeViewEventArgs e )
{
String atx = m_AT.SelectedAction;
if ( !String.IsNullOrEmpty( atx ) ) lblAction.Text = atx;
if ( !String.IsNullOrEmpty( atx ) ) {
lblAction.Text = atx;
}
}
@ -732,6 +798,63 @@ namespace SCJMapper_V2
else MySounds.PlayCannot( );
}
private void btMakeMod_Click( object sender, EventArgs e )
{
if ( m_AT.ActionMaps.Modifiers.Contains( lblLastJ.Text ) ) return; // have it already
if ( m_AT.ActionMaps.Modifiers.Count > 2 ) return; // can max 3 ...
// make a new one
CheckBox cbx = new CheckBox();
cbx.Text = lblLastJ.Text;
cbx.Checked = true;
cbx.CheckedChanged += Cbx_CheckedChanged;
flpExtensions.Controls.Add( cbx );
m_AT.ActionMaps.Modifiers.Add( lblLastJ.Text );
// maintain context menu - quick and d.. version
if ( string.IsNullOrEmpty( tdiAddMod1.Text) ) {
tdiAddMod1.Text = string.Format( "MOD: {0}", lblLastJ.Text );
tdiAddMod1.Visible = true;
m_curJoystick.UpdateModifier( lblLastJ.Text, true );
m_AT.Dirty = true; if ( m_AT.Dirty ) btDump.BackColor = MyColors.DirtyColor;
}
else if ( string.IsNullOrEmpty( tdiAddMod2.Text ) ) {
tdiAddMod2.Text = string.Format( "MOD: {0}", lblLastJ.Text );
tdiAddMod2.Visible = true;
m_curJoystick.UpdateModifier( lblLastJ.Text, true );
m_AT.Dirty = true; if ( m_AT.Dirty ) btDump.BackColor = MyColors.DirtyColor;
}
else if ( string.IsNullOrEmpty( tdiAddMod3.Text ) ) {
tdiAddMod3.Text = string.Format( "MOD: {0}", lblLastJ.Text );
tdiAddMod3.Visible = true;
m_curJoystick.UpdateModifier( lblLastJ.Text, true );
m_AT.Dirty = true; if ( m_AT.Dirty ) btDump.BackColor = MyColors.DirtyColor;
}
}
private void Cbx_CheckedChanged( object sender, EventArgs e )
{
int i = flpExtensions.Controls.IndexOf( (Control)sender );
if ( i >= 0 ) {
string my = ( sender as CheckBox).Text;
int m = m_AT.ActionMaps.Modifiers.IndexOf(my);
if ( m >= 0 ) m_AT.ActionMaps.Modifiers.RemoveAt( m );
// maintain context menu - quick and d.. version
if ( tdiAddMod1.Text.EndsWith( my ) ) {
tdiAddMod1.Text = ""; tdiAddMod1.Visible = false;
}
if ( tdiAddMod2.Text.EndsWith( my ) ) {
tdiAddMod2.Text = ""; tdiAddMod2.Visible = false;
}
if ( tdiAddMod3.Text.EndsWith( my ) ) {
tdiAddMod3.Text = ""; tdiAddMod3.Visible = false;
}
// remove from joystick - but this applies to one of all - may be not the current
foreach ( JoystickCls j in m_Joystick ) { j.UpdateModifier( my, false ); } // send it to all
// finally remove the checkbox
flpExtensions.Controls.RemoveAt( i );
m_AT.Dirty = true; if ( m_AT.Dirty ) btDump.BackColor = MyColors.DirtyColor;
}
}
// General Area Items
@ -891,12 +1014,16 @@ namespace SCJMapper_V2
}
// Node Menu
private string m_prevActivationMode ="";
private void cmAddDel_Opening( object sender, CancelEventArgs e )
{
// note: the right click selected the node
ContextMenuStrip cts = ( sender as ContextMenuStrip );
Boolean any=false; // above separator
Boolean any2 = false; // below separator
m_prevActivationMode = ""; // switch Closing handling OFF in case we don't show anything
if ( m_AT.CanAssignBinding ) {
cts.Items[0].Text = "Assign: " + JoystickCls.MakeThrottle( lblLastJ.Text, cbxThrottle.Checked );
}
@ -909,9 +1036,35 @@ namespace SCJMapper_V2
cts.Items[3].Visible = any2; // separator
// handle activation modes - there is a default one and the list of choosable ones
// there is no further decision on can or cannot - any(2) is enough to know
tdiCbxActivation.Visible = false;
ActivationModes am = m_AT.ActivationModeSelectedItem( );
// have to fudge around with a descriptive text here
if ( am[0] == ActivationModes.Default )
tdiTxDefActivationMode.Text = string.Format( "Profile: {0}", "no ActivationMode" ); // show the default element
else
tdiTxDefActivationMode.Text = string.Format( "Profile: {0}", am[0] ); // show the default element
if ( any && m_AT.IsMappedAction ) {
m_prevActivationMode = am[1]; // this is the selected one
tdiCbxActivation.Visible =true;
tdiCbxActivation.Text = m_prevActivationMode;
}
e.Cancel = !( any || any2 );
}
private void cmAddDel_Closed( object sender, ToolStripDropDownClosedEventArgs e )
{
if ( !string.IsNullOrEmpty(m_prevActivationMode) && ( m_prevActivationMode != tdiCbxActivation.Text )) {
m_AT.UpdateActivationModeSelectedItem( tdiCbxActivation.Text );
if ( m_AT.Dirty ) btDump.BackColor = MyColors.DirtyColor;
m_prevActivationMode = "";
}
}
private void tdiAssignBinding_Click( object sender, EventArgs e )
{ // same as btAssign_Click
if ( m_AT.UpdateSelectedItem( JoystickCls.MakeThrottle( lblLastJ.Text, cbxThrottle.Checked ), InputMode, true ) ) {
@ -948,6 +1101,11 @@ namespace SCJMapper_V2
if ( m_AT.Dirty ) btDump.BackColor = MyColors.DirtyColor;
}
// note: the right click selected the node
private void tdiAddMod_Click( object sender, EventArgs e )
{
}
// rtb drop xml file
@ -1054,12 +1212,13 @@ namespace SCJMapper_V2
{
// have to stop polling while the Settings window is open
timer1.Enabled = false;
if ( m_AppSettings.ShowSettings( ) != System.Windows.Forms.DialogResult.Cancel ) {
if ( m_AppSettings.ShowSettings( "" ) != System.Windows.Forms.DialogResult.Cancel ) {
m_AppSettings.Reload( ); // must reload in case of any changes in the form
// then reload the profile and mappings
LoadMappingDD( );
// indicates (in)valid folders
SCFileIndication( );
// now update the contents according to new settings
foreach ( JoystickCls j in m_Joystick ) j.ApplySettings( ); // update Seetings
m_AT.IgnoreMaps = m_AppSettings.IgnoreActionmaps;
@ -1376,9 +1535,8 @@ namespace SCJMapper_V2
}
#endregion
}
}

@ -128,7 +128,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAA8
EAAAAk1TRnQBSQFMAgEBCQEAAfgBDQH4AQ0BEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
EAAAAk1TRnQBSQFMAgEBCQEAAZgBDwGYAQ8BEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAATADAAEBAQABCAYAAQwYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA

@ -56,6 +56,7 @@
this.btCancel = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.groupBox4 = new System.Windows.Forms.GroupBox();
this.cbxPTU = new System.Windows.Forms.CheckBox();
this.cbxDetectGamepad = new System.Windows.Forms.CheckBox();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
@ -65,7 +66,7 @@
//
// btDone
//
this.btDone.Location = new System.Drawing.Point(658, 405);
this.btDone.Location = new System.Drawing.Point(658, 423);
this.btDone.Name = "btDone";
this.btDone.Size = new System.Drawing.Size(93, 31);
this.btDone.TabIndex = 1;
@ -101,9 +102,9 @@
//
// txJS1
//
this.txJS1.Location = new System.Drawing.Point(66, 21);
this.txJS1.Location = new System.Drawing.Point(66, 46);
this.txJS1.Name = "txJS1";
this.txJS1.Size = new System.Drawing.Size(482, 22);
this.txJS1.Size = new System.Drawing.Size(440, 22);
this.txJS1.TabIndex = 6;
this.txJS1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txJS1_KeyDown);
this.txJS1.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txJS1_KeyPress);
@ -111,7 +112,7 @@
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(6, 24);
this.label3.Location = new System.Drawing.Point(6, 49);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(57, 13);
this.label3.TabIndex = 7;
@ -120,7 +121,7 @@
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(6, 52);
this.label4.Location = new System.Drawing.Point(6, 77);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(57, 13);
this.label4.TabIndex = 9;
@ -128,9 +129,9 @@
//
// txJS2
//
this.txJS2.Location = new System.Drawing.Point(66, 49);
this.txJS2.Location = new System.Drawing.Point(66, 74);
this.txJS2.Name = "txJS2";
this.txJS2.Size = new System.Drawing.Size(482, 22);
this.txJS2.Size = new System.Drawing.Size(440, 22);
this.txJS2.TabIndex = 8;
this.txJS2.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txJS1_KeyDown);
this.txJS2.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txJS1_KeyPress);
@ -138,7 +139,7 @@
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(6, 80);
this.label5.Location = new System.Drawing.Point(6, 105);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(57, 13);
this.label5.TabIndex = 11;
@ -146,9 +147,9 @@
//
// txJS3
//
this.txJS3.Location = new System.Drawing.Point(66, 77);
this.txJS3.Location = new System.Drawing.Point(66, 102);
this.txJS3.Name = "txJS3";
this.txJS3.Size = new System.Drawing.Size(482, 22);
this.txJS3.Size = new System.Drawing.Size(440, 22);
this.txJS3.TabIndex = 10;
this.txJS3.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txJS1_KeyDown);
this.txJS3.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txJS1_KeyPress);
@ -156,7 +157,7 @@
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(6, 108);
this.label6.Location = new System.Drawing.Point(6, 133);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(57, 13);
this.label6.TabIndex = 13;
@ -164,9 +165,9 @@
//
// txJS4
//
this.txJS4.Location = new System.Drawing.Point(66, 105);
this.txJS4.Location = new System.Drawing.Point(66, 130);
this.txJS4.Name = "txJS4";
this.txJS4.Size = new System.Drawing.Size(482, 22);
this.txJS4.Size = new System.Drawing.Size(440, 22);
this.txJS4.TabIndex = 12;
this.txJS4.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txJS1_KeyDown);
this.txJS4.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txJS1_KeyPress);
@ -174,7 +175,7 @@
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(6, 136);
this.label7.Location = new System.Drawing.Point(6, 161);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(57, 13);
this.label7.TabIndex = 15;
@ -182,9 +183,9 @@
//
// txJS5
//
this.txJS5.Location = new System.Drawing.Point(66, 133);
this.txJS5.Location = new System.Drawing.Point(66, 158);
this.txJS5.Name = "txJS5";
this.txJS5.Size = new System.Drawing.Size(482, 22);
this.txJS5.Size = new System.Drawing.Size(440, 22);
this.txJS5.TabIndex = 14;
this.txJS5.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txJS1_KeyDown);
this.txJS5.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txJS1_KeyPress);
@ -192,7 +193,7 @@
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(6, 164);
this.label8.Location = new System.Drawing.Point(6, 189);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(57, 13);
this.label8.TabIndex = 17;
@ -200,9 +201,9 @@
//
// txJS6
//
this.txJS6.Location = new System.Drawing.Point(66, 161);
this.txJS6.Location = new System.Drawing.Point(66, 186);
this.txJS6.Name = "txJS6";
this.txJS6.Size = new System.Drawing.Size(482, 22);
this.txJS6.Size = new System.Drawing.Size(440, 22);
this.txJS6.TabIndex = 16;
this.txJS6.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txJS1_KeyDown);
this.txJS6.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txJS1_KeyPress);
@ -210,7 +211,7 @@
// label9
//
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(6, 192);
this.label9.Location = new System.Drawing.Point(6, 217);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(57, 13);
this.label9.TabIndex = 19;
@ -218,9 +219,9 @@
//
// txJS7
//
this.txJS7.Location = new System.Drawing.Point(66, 189);
this.txJS7.Location = new System.Drawing.Point(66, 214);
this.txJS7.Name = "txJS7";
this.txJS7.Size = new System.Drawing.Size(482, 22);
this.txJS7.Size = new System.Drawing.Size(440, 22);
this.txJS7.TabIndex = 18;
this.txJS7.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txJS1_KeyDown);
this.txJS7.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txJS1_KeyPress);
@ -228,7 +229,7 @@
// label10
//
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(6, 220);
this.label10.Location = new System.Drawing.Point(6, 245);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(57, 13);
this.label10.TabIndex = 21;
@ -236,9 +237,9 @@
//
// txJS8
//
this.txJS8.Location = new System.Drawing.Point(66, 217);
this.txJS8.Location = new System.Drawing.Point(66, 242);
this.txJS8.Name = "txJS8";
this.txJS8.Size = new System.Drawing.Size(482, 22);
this.txJS8.Size = new System.Drawing.Size(440, 22);
this.txJS8.TabIndex = 20;
this.txJS8.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txJS1_KeyDown);
this.txJS8.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txJS1_KeyPress);
@ -269,7 +270,7 @@
this.groupBox1.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.groupBox1.Location = new System.Drawing.Point(12, 12);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(561, 257);
this.groupBox1.Size = new System.Drawing.Size(561, 276);
this.groupBox1.TabIndex = 22;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Ignore Buttons - enter button numbers which should be ignored separated by spaces" +
@ -281,7 +282,7 @@
this.groupBox2.Controls.Add(this.btChooseSCDir);
this.groupBox2.Controls.Add(this.cbxUsePath);
this.groupBox2.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.groupBox2.Location = new System.Drawing.Point(12, 275);
this.groupBox2.Location = new System.Drawing.Point(12, 294);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(561, 59);
this.groupBox2.TabIndex = 23;
@ -294,7 +295,7 @@
this.groupBox3.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.groupBox3.Location = new System.Drawing.Point(579, 12);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(274, 387);
this.groupBox3.Size = new System.Drawing.Size(274, 405);
this.groupBox3.TabIndex = 24;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "Ignore Actionmaps - check the ones to hide";
@ -306,13 +307,13 @@
this.chkLbActionMaps.FormattingEnabled = true;
this.chkLbActionMaps.Location = new System.Drawing.Point(3, 18);
this.chkLbActionMaps.Name = "chkLbActionMaps";
this.chkLbActionMaps.Size = new System.Drawing.Size(268, 366);
this.chkLbActionMaps.Size = new System.Drawing.Size(268, 384);
this.chkLbActionMaps.TabIndex = 0;
//
// btCancel
//
this.btCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btCancel.Location = new System.Drawing.Point(757, 405);
this.btCancel.Location = new System.Drawing.Point(757, 423);
this.btCancel.Name = "btCancel";
this.btCancel.Size = new System.Drawing.Size(93, 31);
this.btCancel.TabIndex = 25;
@ -323,7 +324,7 @@
// label1
//
this.label1.ForeColor = System.Drawing.Color.Red;
this.label1.Location = new System.Drawing.Point(228, 409);
this.label1.Location = new System.Drawing.Point(228, 427);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(414, 28);
this.label1.TabIndex = 26;
@ -333,15 +334,27 @@
//
// groupBox4
//
this.groupBox4.Controls.Add(this.cbxPTU);
this.groupBox4.Controls.Add(this.cbxDetectGamepad);
this.groupBox4.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.groupBox4.Location = new System.Drawing.Point(12, 340);
this.groupBox4.Location = new System.Drawing.Point(12, 359);
this.groupBox4.Name = "groupBox4";
this.groupBox4.Size = new System.Drawing.Size(561, 59);
this.groupBox4.TabIndex = 27;
this.groupBox4.TabStop = false;
this.groupBox4.Text = "Advanced Options ...";
//
// cbxPTU
//
this.cbxPTU.AutoSize = true;
this.cbxPTU.BackColor = System.Drawing.Color.SandyBrown;
this.cbxPTU.Location = new System.Drawing.Point(145, 21);
this.cbxPTU.Name = "cbxPTU";
this.cbxPTU.Size = new System.Drawing.Size(108, 17);
this.cbxPTU.TabIndex = 7;
this.cbxPTU.Text = "Use PTU folders";
this.cbxPTU.UseVisualStyleBackColor = false;
//
// cbxDetectGamepad
//
this.cbxDetectGamepad.AutoSize = true;
@ -357,7 +370,7 @@
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.btCancel;
this.ClientSize = new System.Drawing.Size(861, 446);
this.ClientSize = new System.Drawing.Size(861, 467);
this.Controls.Add(this.groupBox4);
this.Controls.Add(this.label1);
this.Controls.Add(this.btCancel);
@ -415,5 +428,6 @@
private System.Windows.Forms.Label label1;
private System.Windows.Forms.GroupBox groupBox4;
private System.Windows.Forms.CheckBox cbxDetectGamepad;
private System.Windows.Forms.CheckBox cbxPTU;
}
}

@ -16,6 +16,8 @@ namespace SCJMapper_V2
public Boolean Canceled { get; set; }
public String PasteString { get; set; } // used to copy, paste JS commands
/// <summary>
/// ctor - gets the owning class instance
/// </summary>
@ -37,6 +39,7 @@ namespace SCJMapper_V2
}
// Save from app settings into actuals
private void LoadSettings( )
{
// SC path
@ -56,15 +59,20 @@ namespace SCJMapper_V2
// Ignore actionmaps
for ( int i = 0; i < chkLbActionMaps.Items.Count; i++ ) {
if ( m_owner.IgnoreActionmaps.Contains( "," + chkLbActionMaps.Items[i].ToString( ) + "," ) ) {
chkLbActionMaps.SetItemChecked(i, true);
chkLbActionMaps.SetItemChecked( i, true );
}
}
// DetectGamepad
cbxDetectGamepad.Checked = m_owner.DetectGamepad;
// Use PTU
cbxPTU.Checked = m_owner.UsePTU;
}
// Save the current settings
private void SaveSettings( )
{
// SC path
@ -84,7 +92,7 @@ namespace SCJMapper_V2
// Ignore actionmaps
String ignore = ",";
for ( int i = 0; i < chkLbActionMaps.Items.Count; i++ ) {
if ( chkLbActionMaps.GetItemChecked(i) ) {
if ( chkLbActionMaps.GetItemChecked( i ) ) {
ignore += chkLbActionMaps.Items[i].ToString( ) + ",";
}
}
@ -96,6 +104,12 @@ namespace SCJMapper_V2
}
m_owner.DetectGamepad = cbxDetectGamepad.Checked;
// Use PTU
if ( m_owner.UsePTU != cbxPTU.Checked ) {
MessageBox.Show( "Changing to / from PTU folders needs a restart of the application !!", "Settings Notification", MessageBoxButtons.OK, MessageBoxIcon.Information );
}
m_owner.UsePTU = cbxPTU.Checked;
m_owner.Save( );
}
@ -166,7 +180,5 @@ namespace SCJMapper_V2
}
}
}

@ -270,8 +270,24 @@ namespace SCJMapper_V2
}
const string jsb_pattern = @"^js\d_button\d{1,3}$";
static Regex rgx_jsb = new Regex( jsb_pattern, RegexOptions.IgnoreCase );
/// <summary>
/// Returns True if devInput seems to be a valid Modifier
/// (only buttons are accepted)
/// </summary>
/// <param name="devInput">A qualified devInput (jsN_buttonM)</param>
/// <returns>True for a valid one</returns>
static public Bool ValidModifier( String devInput )
{
return rgx_jsb.IsMatch( devInput );
}
#endregion
// ****************** CLASS *************************
private Joystick m_device;
private JoystickState m_state = new JoystickState( );
@ -286,6 +302,8 @@ namespace SCJMapper_V2
private bool[] m_ignoreButtons;
private bool m_activated = false;
private bool[] m_modifierButtons;
private UC_JoyPanel m_jPanel = null; // the GUI panel
internal int MyTabPageIndex = -1;
@ -382,7 +400,10 @@ namespace SCJMapper_V2
m_jPanel.JsAssignment = 0; // default is no assignment
m_ignoreButtons = new bool[m_state.Buttons.Length];
ResetIgnoreButtons( );
ResetButtons( m_ignoreButtons );
m_modifierButtons = new bool[m_state.Buttons.Length];
ResetButtons( m_modifierButtons );
log.Debug( "Get JS Objects" );
try {
@ -427,11 +448,6 @@ namespace SCJMapper_V2
}
private void ResetIgnoreButtons( )
{
for ( int i=0; i < m_ignoreButtons.Length; i++ ) m_ignoreButtons[i] = false;
}
/// <summary>
/// Tells the Joystick to re-read settings
/// </summary>
@ -439,7 +455,7 @@ namespace SCJMapper_V2
{
appSettings.Reload( );
ResetIgnoreButtons( );
ResetButtons( m_ignoreButtons );
// read ignore buttons
String igs = "";
switch ( m_joystickNumber ) {
@ -469,6 +485,33 @@ namespace SCJMapper_V2
}
private void ResetButtons( bool[] bt)
{
for ( int i = 0; i < bt.Length; i++ ) bt[i] = false;
}
/// <summary>
/// Add or Remove a modifier from this joystick
/// </summary>
/// <param name="modS">The joystick command (jsN_buttonM)</param>
/// <param name="add">True to add, False to remove it</param>
public void UpdateModifier( string modS, bool add )
{
if ( !ValidModifier( modS ) ) return; // sanity..
// check if it is applicable
int jsn = JSNum(modS);
if ( jsn == m_joystickNumber ) {
// format is jsN_buttonM i.e. get button number at the end
int bNr = 0;
if ( int.TryParse( modS.Substring( 10 ), out bNr ) ) {
// valid bNr
m_modifierButtons[bNr - 1] = add; // update
}
}
}
/// <summary>
/// Enable the properties that are supported by the device

@ -0,0 +1,95 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Xml;
namespace SCJMapper_V2
{
/// <summary>
/// Maintain actionmap Modifiers
/// </summary>
class Modifiers : List<string>
{
/// <summary>
/// Returns a properly formatted Modifier entry
/// </summary>
/// <returns></returns>
public String toXML()
{
string r = "";
r += string.Format( "\t<modifiers>\n" );
foreach ( string s in this ) {
r += string.Format( "\t\t<mod input=\"{0}\" />\n", s );
}
r += string.Format( "\t</modifiers>\n" );
return r;
}
/// <summary>
/// Read an Modifier entry from XML - do some sanity check
/// </summary>
/// <param name="xml">the XML action fragment</param>
/// <returns>True if an action was decoded</returns>
private Boolean Instance_fromXML( XmlReader reader )
{
reader.Read( );
while ( !reader.EOF ) {
if ( reader.Name.ToLowerInvariant() == "mod" ) {
String input = reader["input"];
if ( !String.IsNullOrWhiteSpace( input ) ) {
this.Add( input );
}
}
reader.Read( );
if ( reader.NodeType == XmlNodeType.EndElement ) break; // expect end of <modifiers> here
}//while
return true;
}
/// <summary>
/// Reads the Modifier entry from an action map file
/// </summary>
public Boolean fromXML( String xml )
{
/*
<!-- Key modifiers -->
<modifiers>
<mod input="js1_button3" />
</modifiers>
*/
this.Clear( );
XmlReaderSettings settings = new XmlReaderSettings( );
settings.ConformanceLevel = ConformanceLevel.Fragment;
settings.IgnoreWhitespace = true;
settings.IgnoreComments = true;
XmlReader reader = XmlReader.Create( new StringReader( xml ), settings );
reader.Read( );
// try to disassemble the items
while ( !reader.EOF ) {
if ( reader.Name.ToLowerInvariant( ) == "modifiers" ) {
Instance_fromXML( reader );
}
reader.Read( );
if ( reader.NodeType == XmlNodeType.EndElement ) break; // expect end of <modifiers> here
}
return true;
}
}
}

@ -53,14 +53,14 @@ namespace SCJMapper_V2
public void ClearInstances( )
{
m_devInstances.Clear();
m_devInstances.Clear( );
}
public void AddInstances( DevRec dr )
{
m_devInstances.Add( dr );
}
private String[] FormatXml( string xml )
{
try {
@ -86,7 +86,9 @@ namespace SCJMapper_V2
<joystick instance="1"/>
<joystick instance="2"/>
</devices>
<categories />
<categories>
<category label="@ui_CCSpaceFlight"/>
</categories>
</CustomisationUIHeader>
*/
@ -103,6 +105,11 @@ namespace SCJMapper_V2
r += String.Format( "\t\t</devices>\n" );
}
// CIG adds them to export - so can we ...
r += String.Format( "\t\t<categories>\n" );
r += String.Format( "\t\t<category label=\"@ui_CCSpaceFlight\"/>\n" );
r += String.Format( "\t\t</categories>\n" );
r += String.Format( "\t</CustomisationUIHeader>\n" );
// and dump the plain contents if needed
@ -124,7 +131,7 @@ namespace SCJMapper_V2
/// </summary>
/// <param name="xml">the XML action fragment</param>
/// <returns>True if an action was decoded</returns>
public Boolean Instance_fromXML( XmlReader reader )
private Boolean Instance_fromXML( XmlReader reader )
{
reader.Read( );
@ -158,9 +165,6 @@ namespace SCJMapper_V2
/// <returns>True if an action was decoded</returns>
public Boolean fromXML( String xml )
{
// if ( !this.Contains( xml ) ) this.Add( xml );
XmlReaderSettings settings = new XmlReaderSettings( );
settings.ConformanceLevel = ConformanceLevel.Fragment;
settings.IgnoreWhitespace = true;
@ -189,6 +193,9 @@ namespace SCJMapper_V2
if ( reader.Name.ToLowerInvariant( ) == "devices" ) {
Instance_fromXML( reader );
}
else if ( reader.Name.ToLowerInvariant( ) == "categories" ) {
reader.ReadInnerXml( );
}
else {
//??
log.InfoFormat( "UICustHeader.fromXML: unknown node - {0} - stored as is", reader.Name );

@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace SCJMapper_V2
{
/// <summary>
/// Contains the ActivationMode from SC
/// can be:
/// "Default" using the defActivationMode setting of the profile
/// any of the List of profileDefined ones
/// </summary>
class ActivationModes : List<string>
{
public const String Default = "Use Profile";
/// <summary>
/// cTor: create a default one - with one Default element preset
/// </summary>
public ActivationModes( )
{
this.Add( Default ); // this is always in..
}
/// <summary>
/// cTor: create one with a first item only
/// </summary>
/// <param name="firstItem"></param>
public ActivationModes( string firstItem )
{
this.Clear( );
this.Add( firstItem );
}
}
}

@ -28,23 +28,29 @@ namespace SCJMapper_V2
private EState m_state = EState.idle;
// an action map and its actions
class Action
class ProfileAction
{
public String name { get; set; } // the action name
public String devID { get; set; } // the input method K,J,X,P
private String m_defBinding = ""; // NOTE: this is AC1 style in the Profile - need to conver later when dumping out
public String defBinding { get { return m_defBinding; } set { m_defBinding = value; } } // DONT! need to clean this one, found spaces...
private String m_defActivationMode = "";
public String defActivationMode { get { return m_defActivationMode; } set { m_defActivationMode = value; } }
public String keyName
{ get { return devID + name; } } // prep for TreView usage - create a key from input+name
}
class ActionMap : List<Action> // carries the action list
class ActionMap : List<ProfileAction> // carries the action list
{
public String name { get; set; } // the map name
};
Dictionary<String, ActionMap> m_aMap = null; // key would be the actionmap name
ActionMap m_currentMap = null;
ActivationModes m_activationModes = new ActivationModes();
public ActivationModes ActivationModes { get { return m_activationModes; } }
// ****************** CLASS **********************
@ -70,8 +76,8 @@ namespace SCJMapper_V2
String buf = "";
foreach ( ActionMap am in m_aMap.Values ) {
buf += am.name + ";";
foreach ( Action a in am ) {
buf += a.keyName + ";" + a.defBinding + ";"; // add default binding to the CSV
foreach ( ProfileAction a in am ) {
buf += a.keyName + ";" + a.defBinding + ";" + a.defActivationMode + ";"; // add default binding + activation mode to the CSV
}
buf += String.Format( "\n" );
}
@ -87,12 +93,19 @@ namespace SCJMapper_V2
/// <param name="xr">An XML reader @ StartElement</param>
private void CollectActions( Dictionary<string, string> attr )
{
// we collect actions for each input ie for K,J,X and P
//first find an ActivationMode if there is - applies to all actions
String actMode = ActivationModes.Default;
if ( attr.ContainsKey( "ActivationMode" ) ) {
actMode = attr["ActivationMode"];
}
// we collect actions for each input ie for K,J,X and M
if ( attr.ContainsKey( "joystick" ) ) {
Action ac = new Action( );
ProfileAction ac = new ProfileAction( );
ac.name = attr["name"];
ac.devID = "J";
ac.defBinding = attr["joystick"];
ac.defActivationMode = actMode;
if ( ac.defBinding == " " ) {
ac.defBinding = JoystickCls.BlendedInput;
m_currentMap.Add( ac ); // finally add it to the current map if it was bound
@ -104,10 +117,11 @@ namespace SCJMapper_V2
}
if ( attr.ContainsKey( "keyboard" ) ) {
Action ac = new Action( );
ProfileAction ac = new ProfileAction( );
ac.name = attr["name"];
ac.devID = "K";
ac.defBinding = attr["keyboard"];
ac.defActivationMode = actMode;
if ( ac.defBinding == " " ) {
ac.defBinding = KeyboardCls.BlendedInput;
m_currentMap.Add( ac ); // finally add it to the current map if it was bound
@ -119,10 +133,11 @@ namespace SCJMapper_V2
}
if ( attr.ContainsKey( "mouse" ) ) { // 20151220BM: add mouse device (from AC 2.0 defaultProfile usage)
Action ac = new Action( );
ProfileAction ac = new ProfileAction( );
ac.name = attr["name"];
ac.devID = "M";
ac.defBinding = attr["mouse"];
ac.defActivationMode = actMode;
if ( ac.defBinding == " " ) {
ac.defBinding = MouseCls.BlendedInput;
m_currentMap.Add( ac ); // finally add it to the current map if it was bound
@ -134,10 +149,11 @@ namespace SCJMapper_V2
}
if ( attr.ContainsKey( "xboxpad" ) ) {
Action ac = new Action( );
ProfileAction ac = new ProfileAction( );
ac.name = attr["name"];
ac.devID = "X";
ac.defBinding = attr["xboxpad"];
ac.defActivationMode = actMode;
if ( ac.defBinding == " " ) {
ac.defBinding = GamepadCls.BlendedInput;
m_currentMap.Add( ac ); // finally add it to the current map if it was bound
@ -224,7 +240,7 @@ namespace SCJMapper_V2
// the element name is a control
if ( xr.NodeType == XmlNodeType.EndElement ) {
done = ( xr.Name == m_nodeNameStack.Peek() ); // EXIT if the end element matches the entry
done = ( xr.Name == m_nodeNameStack.Peek( ) ); // EXIT if the end element matches the entry
}
else if ( xr.IsEmptyElement ) {
// an attribute only element
@ -312,7 +328,6 @@ namespace SCJMapper_V2
if ( ActionMapsCls.ActionMaps.Length == 0 ) ActionMapsCls.LoadSupportedActionMaps( ); // make sure we have them loaded ( refactoring to get a singleton or so...)
try {
do {
if ( xr.IsStartElement( ) ) {
@ -347,6 +362,33 @@ namespace SCJMapper_V2
}
}
private Boolean ReadActivationModes ( XmlReader xr )
{
log.Debug( "DProfileReader.ReadActivationModes - Entry" );
try {
xr.ReadToFollowing( "ActivationModes" );
xr.ReadToDescendant( "ActivationMode" );
do {
if ( xr.NodeType == XmlNodeType.EndElement ) {
xr.Read( );
break; // finished
}
String name = xr["name"];
if ( ! string.IsNullOrEmpty(name)) m_activationModes.Add( name );
} while ( xr.Read( ) );
return true;
}
catch ( Exception ex ) {
// get any exceptions from reading
log.Error( "DProfileReader.ReadXML - unexpected", ex );
return false;
}
}
/// <summary>
/// Read the defaultProfile.xml - do some sanity check
/// </summary>
@ -364,9 +406,14 @@ namespace SCJMapper_V2
m_nodeNameStack = new Stack<String>( );
m_aMap = new Dictionary<String, ActionMap>( );
m_activationModes = new ActivationModes( );
ValidContent = true; // init
reader.Read( );
ValidContent = ReadXML( reader );
ValidContent &= ReadActivationModes( reader );
m_nodeNameStack.Push( "profile" ); // we are already in the XML now
ValidContent &= ReadXML( reader );
return ValidContent;
}

@ -175,6 +175,7 @@ namespace SCJMapper_V2
/// <summary>
/// Returns the SC Client path
/// AC 1.1.6: E:\G\StarCitizen\StarCitizen\Public
/// SC 2x: alternatively use PTU path E:\G\StarCitizen\StarCitizen\Test
/// </summary>
static public String SCClientPath
{
@ -185,10 +186,14 @@ namespace SCJMapper_V2
if ( String.IsNullOrEmpty( scp ) ) return ""; // no valid one can be found
//
scp = Path.Combine( scp, "StarCitizen" );
scp = Path.Combine( scp, "Public" );
if ( appSettings.UsePTU )
scp = Path.Combine( scp, "Test" );
else
scp = Path.Combine( scp, "Public" );
if ( Directory.Exists( scp ) ) return scp;
log.WarnFormat( "SCClientDataPath - StarCitizen\\Public subfolder does not exist: {0}", scp );
log.WarnFormat( "SCClientDataPath - StarCitizen\\Public or for PTU \\Test subfolder does not exist: {0}", scp );
return "";
}
}

@ -126,6 +126,7 @@
<Compile Include="Gamepad\GamepadCls.cs" />
<Compile Include="Joystick\JsReassingList.cs" />
<Compile Include="Keyboard\KeyboardCls.cs" />
<Compile Include="Joystick\Modifiers.cs" />
<Compile Include="Mouse\MouseCls.cs" />
<Compile Include="MySounds.cs" />
<Compile Include="OGL\BezierSeries.cs" />
@ -163,6 +164,7 @@
<Compile Include="actions\ActionMapCls.cs" />
<Compile Include="actions\ActionMapsCls.cs" />
<Compile Include="actions\ActionTree.cs" />
<Compile Include="SC\ActivationModes.cs" />
<Compile Include="SC\DProfileReader.cs" />
<Compile Include="Joystick\JoystickCls.cs" />
<Compile Include="actions\MyColors.cs" />

@ -167,7 +167,8 @@ namespace SCJMapper_V2
public ActionDevice actionDevice { get; set; } // the enum of the device
public String device { get; set; } // name of the device (uses DeviceClass)
public String defBinding { get; set; } // the default binding
public List<ActionCommandCls> inputList { get; set; }
public String defActivationMode { get; set; } // the default binding ActivationMode (can be "" if not used)
public List<ActionCommandCls> inputList { get; set; } // regular bind is the 0-element, addbinds are added to the list
/// <summary>
/// ctor
@ -179,6 +180,7 @@ namespace SCJMapper_V2
device = JoystickCls.DeviceClass;
name = "";
defBinding = "";
defActivationMode = "";
inputList = new List<ActionCommandCls>( ); // empty list
}
@ -197,6 +199,7 @@ namespace SCJMapper_V2
newAc.device = this.device;
newAc.name = this.name;
newAc.defBinding = this.defBinding;
newAc.defActivationMode = this.defActivationMode;
// creates a copy of the list with reassigned jsN devs
foreach ( ActionCommandCls acc in inputList ) {
@ -210,19 +213,35 @@ namespace SCJMapper_V2
/// <summary>
/// Created and adds the inputCommand list with given input string
/// AC2 style input is used i.e. with device tag in front
/// apply given ActivationMode - can be "~" to indicate DONT APPLY
/// </summary>
/// <param name="devInput"></param>
/// <returns>Returns the ActionCommand created</returns>
public ActionCommandCls AddCommand( String devInput )
public ActionCommandCls AddCommand( String devInput, String activationMode )
{
ActionCommandCls acc = new ActionCommandCls( devInput, inputList.Count - 1 ); // starts from -1 ...
if ( activationMode == "~" ) {
// not assigned
acc.ActivationMode = "";
}
else {
acc.ActivationMode = activationMode;
}
inputList.Add( acc );
return acc;
}
/// <summary>
/// Add an ActionCommand with Input at nodeindex
/// apply default ActivationMode
/// </summary>
/// <param name="devInput"></param>
/// <param name="index"></param>
/// <returns></returns>
public ActionCommandCls AddCommand( String devInput, int index )
{
ActionCommandCls acc = new ActionCommandCls( devInput, index );
acc.ActivationMode = defActivationMode;
inputList.Add( acc );
return acc;
}
@ -265,6 +284,9 @@ namespace SCJMapper_V2
// Apply the input to the ActionTree
actionCmd.DevInput = BlendInput( devInput, this.actionDevice );
if ( string.IsNullOrEmpty( actionCmd.Input)) {
actionCmd.ActivationMode = defActivationMode; // reset activation mode if the input is empty
}
}
/// <summary>
@ -372,9 +394,13 @@ namespace SCJMapper_V2
else if ( MouseCls.IsDeviceClass( device ) ) input = MouseCls.FromAC1( input );
else if ( GamepadCls.IsDeviceClass( device ) ) input = GamepadCls.FromAC1( input );
}
// Get default ActivationMode
String activationMode = reader["ActivationMode"];
if ( string.IsNullOrEmpty(activationMode)) activationMode = ActivationModes.Default; // MARK AS NOT USED
key = DevID( device ) + name; // unique id of the action
actionDevice = ADevice( device ); // get the enum of the input device
AddCommand( input );
AddCommand( input, activationMode );
// advances the reader to the next node
reader.ReadStartElement( "rebind" );
}
@ -395,7 +421,9 @@ namespace SCJMapper_V2
else if ( MouseCls.IsDeviceClass( device ) ) input = MouseCls.FromAC1( input );
else if ( GamepadCls.IsDeviceClass( device ) ) input = GamepadCls.FromAC1( input );
}
AddCommand( input );
String activationMode = reader["ActivationMode"];
if ( string.IsNullOrEmpty( activationMode ) ) activationMode = ActivationModes.Default; // MARK AS NOT USED
AddCommand( input, activationMode );
// advances the reader to the next node
reader.ReadStartElement( "addbind" );
}

@ -24,13 +24,21 @@ namespace SCJMapper_V2
/// </summary>
public String DevID { get; set; } // the device ID (jsN, mo1, xi1, kb1)
/// <summary>
/// The applied ActivationMode for this command
/// </summary>
public String ActivationMode { get; set; } // "" or one of the defined ActivationModes
/// <summary>
/// The complete input string (devID_input)
/// Assuming internally blended ones only (i.e. no space blends contained)
/// Can derive if a device tag is given
/// </summary>
public String DevInput {
get {
public String DevInput
{
get
{
if ( string.IsNullOrEmpty( Input ) )
return Input; // no Input - return empty
else if ( string.IsNullOrEmpty( DevID ) )
@ -38,12 +46,13 @@ namespace SCJMapper_V2
else
return String.Format( "{0}_{1}", DevID, Input ); // fully qualified only if both exist
}
set {
set
{
// decompose the deviceInput into parts
if ( string.IsNullOrEmpty( value ) ) { // no Input - insert input empty
Input = ""; // empty one
}
else if ( value.IndexOf("_") == 3 ) { // fully qualified only if both exist
else if ( value.IndexOf( "_" ) == 3 ) { // fully qualified only if both exist
DevID = value.Substring( 0, 3 );
Input = value.Substring( 4 );
}
@ -67,6 +76,7 @@ namespace SCJMapper_V2
// init with something to debug if needed
Input = "UNDEF";
DevID = "NA0";
ActivationMode = "";
NodeIndex = -1;
}
@ -75,6 +85,7 @@ namespace SCJMapper_V2
{
Input = other.Input;
DevID = other.DevID;
ActivationMode = other.ActivationMode;
NodeIndex = other.NodeIndex;
}
@ -82,6 +93,7 @@ namespace SCJMapper_V2
public ActionCommandCls( String devInp )
{
DevInput = devInp;
ActivationMode = "";
NodeIndex = -1;
}
@ -89,6 +101,7 @@ namespace SCJMapper_V2
public ActionCommandCls( String devInp, int nodeIx )
{
DevInput = devInp;
ActivationMode = "";
NodeIndex = nodeIx;
}
@ -97,6 +110,7 @@ namespace SCJMapper_V2
{
Input = inp;
DevID = dev;
ActivationMode = "";
NodeIndex = -1;
}
@ -105,6 +119,7 @@ namespace SCJMapper_V2
{
Input = inp;
DevID = dev;
ActivationMode = "";
NodeIndex = nodeIx;
}
@ -118,7 +133,7 @@ namespace SCJMapper_V2
{
// full copy from 'this'
ActionCommandCls newAc = new ActionCommandCls( this );
// reassign the jsX part for Joystick commands
if ( this.DevID.StartsWith( "js" ) ) {
int oldJsN = JoystickCls.JSNum( this.DevID );
@ -138,13 +153,14 @@ namespace SCJMapper_V2
public String toXML( )
{
String r = "";
if ( String.IsNullOrEmpty( Input ) ) {
r = String.Format( " />\n" ); // actually an ERROR...
}
else {
if ( !String.IsNullOrEmpty( Input ) ) {
// regular - apply XML formatting to internally blended items
r = String.Format( "input=\"{0}_{1}\" />\n", DevID, DeviceCls.toXML( Input ) );
r += String.Format( "input=\"{0}_{1}\" ", DevID, DeviceCls.toXML( Input ) );
if ( ActivationMode != ActivationModes.Default ) {
r += String.Format( "ActivationMode=\"{0}\" ", ActivationMode );
}
}
r += String.Format( " />\n" ); // actually an ERROR...
return r;
}

@ -39,12 +39,12 @@ namespace SCJMapper_V2
private const String ACM_VERSION = "version=\"1\" optionsVersion=\"2\" rebindVersion=\"2\""; //AC2 the FIXED version
private String version { get; set; }
private String ignoreversion { get; set; }
private JoystickList m_joystickList = null;
private UICustHeader m_uiCustHeader = null;
private Options m_options = null;
private Deviceoptions m_deviceOptions = null;
private Modifiers m_modifiers = null;
private List<CheckBox> m_invertCB = null; // Options owns and handles all Inversions
@ -142,7 +142,13 @@ namespace SCJMapper_V2
}
}
/// <summary>
/// Returns the assigned Modifiers
/// </summary>
public Modifiers Modifiers
{
get { return m_modifiers; }
}
/// <summary>
/// ctor
@ -171,6 +177,7 @@ namespace SCJMapper_V2
m_uiCustHeader = new UICustHeader( );
m_options = new Options( m_joystickList );
m_deviceOptions = new Deviceoptions( m_options );
m_modifiers = new Modifiers( );
}
/// <summary>
@ -186,6 +193,7 @@ namespace SCJMapper_V2
newMaps.m_uiCustHeader = this.m_uiCustHeader;
newMaps.m_deviceOptions = this.m_deviceOptions;
newMaps.m_options = this.m_options;
newMaps.m_modifiers = this.m_modifiers;
for ( int i=0; i < JoystickCls.JSnum_MAX; i++ ) {
newMaps.jsN[i] = this.jsN[i]; newMaps.jsNGUID[i] = this.jsNGUID[i];
@ -276,6 +284,9 @@ namespace SCJMapper_V2
// *** DEVICE OPTIONS
if ( m_deviceOptions.Count > 0 ) r += m_deviceOptions.toXML( ) + String.Format( "\n" );
// *** MODIFIERS
if ( m_modifiers.Count > 0 ) r += m_modifiers.toXML( ) + String.Format( "\n" );
// *** ACTION MAPS
foreach ( ActionMapCls amc in this ) {
@ -313,8 +324,6 @@ namespace SCJMapper_V2
version = reader["version"];
if ( version == "0" ) version = ACM_VERSION; // update from legacy to actual version
ignoreversion = reader["ignoreVersion"]; // could be either / or ..
// get the joystick mapping if there is one
for ( int i=0; i < JoystickCls.JSnum_MAX; i++ ) {
jsN[i] = reader[String.Format( "js{0}", i + 1 )];
@ -332,25 +341,29 @@ namespace SCJMapper_V2
while ( !reader.EOF ) { //!String.IsNullOrEmpty( x ) ) {
if ( reader.Name == "actionmap" ) {
if ( reader.Name.ToLowerInvariant() == "actionmap" ) {
String x = reader.ReadOuterXml( );
ActionMapCls acm = new ActionMapCls( );
if ( acm.fromXML( x ) ) {
this.Merge( acm ); // merge list
}
}
else if ( reader.Name == "CustomisationUIHeader" ) {
else if ( reader.Name.ToLowerInvariant( ) == "customisationuiheader" ) {
String x = reader.ReadOuterXml( );
m_uiCustHeader.fromXML( x );
}
else if ( reader.Name == "deviceoptions" ) {
else if ( reader.Name.ToLowerInvariant( ) == "deviceoptions" ) {
String x = reader.ReadOuterXml( );
m_deviceOptions.fromXML( x );
}
else if ( reader.Name == "options" ) {
else if ( reader.Name.ToLowerInvariant( ) == "options" ) {
String x = reader.ReadOuterXml( );
m_options.fromXML( x );
}
else if ( reader.Name.ToLowerInvariant( ) == "modifiers" ) {
String x = reader.ReadOuterXml( );
m_modifiers.fromXML( x );
}
else {
reader.Read( );
}

@ -18,6 +18,7 @@ namespace SCJMapper_V2
public ActionMapsCls ActionMaps { get; set; } // the Action Maps and Actions
public ActivationModes ActivationModes { get; set; } // the ActivationModes found in Profile
private TreeView m_MasterTree = new TreeView( ); // the master TreeView (mem only)
private TreeView m_ctrl = null; // the TreeView in the GUI - injected from GUI via Ctrl property
@ -64,6 +65,7 @@ namespace SCJMapper_V2
m_gamepad = gamepad;
IgnoreMaps = ""; // nothing to ignore
ActivationModes = new ActivationModes( ); // an empty list for now
}
@ -112,7 +114,7 @@ namespace SCJMapper_V2
get
{
if ( Ctrl.SelectedNode == null ) return false;
else return ( Ctrl.SelectedNode.Level == 1 );
else return ( Ctrl.SelectedNode.Level == 1 ) && IsMappedAction;
}
}
@ -122,7 +124,7 @@ namespace SCJMapper_V2
get
{
if ( Ctrl.SelectedNode == null ) return false;
else return ( Ctrl.SelectedNode.Level == 1 );
else return ( Ctrl.SelectedNode.Level == 1 ) && IsMappedAction;
}
}
@ -135,6 +137,19 @@ namespace SCJMapper_V2
}
}
public Boolean IsMappedAction
{
get
{
if ( ( Ctrl.SelectedNode.Level == 0 ) || ( Ctrl.SelectedNode.Level > 2 ) ) return false; // not on node
if ( Ctrl.SelectedNode == null ) return false; // no node selected
if ( Ctrl.SelectedNode.Parent == null ) return false; // ERROR EXIT
return ( Ctrl.SelectedNode as ActionTreeNode ).IsMappedAction;
}
}
#endregion
/// <summary>
@ -405,9 +420,9 @@ namespace SCJMapper_V2
ActionCommandCls acc = null;
ActionMaps = new ActionMapsCls( m_jsList );
ActivationModes = new ActivationModes( );
m_MasterTree.Nodes.Clear( );
// read the action items into the TreeView
DProfileReader dpReader = new DProfileReader( ); // we may read a profile
TextReader txReader = null;
@ -415,6 +430,8 @@ namespace SCJMapper_V2
dpReader.fromXML( SCDefaultProfile.DefaultProfile( defaultProfileName + ".xml" ) );
if ( dpReader.ValidContent ) {
txReader = new StringReader( dpReader.CSVMap );
ActivationModes.Clear( );
ActivationModes.AddRange( dpReader.ActivationModes ); // content copy from profile
}
// we assume no addbind items in the profile
@ -423,18 +440,19 @@ namespace SCJMapper_V2
using ( TextReader sr = txReader ) {
String buf = sr.ReadLine( );
while ( !String.IsNullOrEmpty( buf ) ) {
String[] elem = buf.Split( new char[] { ';', ',' } );
String[] elem = buf.Split( new char[] { ';', ',' }, StringSplitOptions.None );
if ( elem.Length > 1 ) {
if ( !IgnoreMaps.Contains( "," + elem[0] + "," ) ) {
// must have 2 elements min
Array.Resize( ref cnl, 0 );
acm = new ActionMapCls( ); acm.name = elem[0]; // get actionmap name
// process items
for ( int ei = 1; ei < elem.Length; ei += 2 ) { // step 2 - action;defaultBinding come in pairs
for ( int ei = 1; ei < elem.Length; ei += 3 ) { // step 2 - action;defaultBinding;defaultActivationMode come in as tripples
if ( !String.IsNullOrEmpty( elem[ei] ) ) {
// default assignments
String action = elem[ei].Substring( 1 );
String defBinding = elem[ei + 1].Substring( 0 );
String defBinding = elem[ei + 1];
String defActivationMode = elem[ei + 2];
String devID = elem[ei].Substring( 0, 1 );
String device = ActionCls.DeviceFromID( devID );
@ -444,11 +462,12 @@ namespace SCJMapper_V2
Array.Resize( ref cnl, cnl.Length + 1 ); cnl[cnl.Length - 1] = cn;
// derive content tree
ac = new ActionCls( ); ac.key = cn.Name; ac.name = action; ac.device = device; ac.actionDevice = ActionCls.ADevice( device ); ac.defBinding = defBinding;
ac = new ActionCls( ); ac.key = cn.Name; ac.name = action; ac.device = device; ac.actionDevice = ActionCls.ADevice( device );
ac.defBinding = defBinding; ac.defActivationMode = defActivationMode;
acm.Add( ac ); // add to our map
cn.ActionDevice = ac.actionDevice; // should be known now
// create just an unmapped ActionCommand item
acc = ac.AddCommand( "" ); // profile items are shown in the ActionTreeNode (not in a child)
acc = ac.AddCommand( "", -1 ); // profile items are shown in the ActionTreeNode (not in a child)
// init and apply the default mappings if requested
if ( ac.actionDevice == ActionCls.ActionDevice.AD_Joystick ) {
@ -457,6 +476,7 @@ namespace SCJMapper_V2
if ( applyDefaults ) {
if ( JoystickCls.IsJSValid( jNum ) ) {
acc.DevInput = ac.defBinding;
acc.ActivationMode = ac.defActivationMode;
cn.Command = ac.defBinding; cn.BackColor = JoystickCls.JsNColor( jNum );
}
}
@ -466,6 +486,7 @@ namespace SCJMapper_V2
if ( applyDefaults ) {
if ( !String.IsNullOrEmpty( ac.defBinding ) ) {
acc.DevInput = ac.defBinding;
acc.ActivationMode = ac.defActivationMode;
cn.Command = ac.defBinding; cn.BackColor = GamepadCls.XiColor( );
}
}
@ -475,6 +496,7 @@ namespace SCJMapper_V2
if ( applyDefaults ) {
if ( !String.IsNullOrEmpty( ac.defBinding ) ) {
acc.DevInput = ac.defBinding;
acc.ActivationMode = ac.defActivationMode;
cn.Command = ac.defBinding; cn.BackColor = KeyboardCls.KbdColor( );
}
}
@ -484,6 +506,7 @@ namespace SCJMapper_V2
if ( applyDefaults ) {
if ( !String.IsNullOrEmpty( ac.defBinding ) ) {
acc.DevInput = ac.defBinding;
acc.ActivationMode = ac.defActivationMode;
cn.Command = ac.defBinding; cn.BackColor = MouseCls.MouseColor( );
}
}
@ -519,6 +542,70 @@ namespace SCJMapper_V2
}
/// <summary>
/// Find the ActivationMode of the selected item
/// </summary>
public ActivationModes ActivationModeSelectedItem( )
{
ActivationModes am = new ActivationModes(); am.Add( ActivationModes.Default ); // dummy answer Default is Default and selected is Default
if ( ( Ctrl.SelectedNode.Level == 0 ) || ( Ctrl.SelectedNode.Level > 2 ) ) return am;
if ( Ctrl.SelectedNode == null ) return am; // ERROR exit
if ( Ctrl.SelectedNode.Parent == null ) return am; // ERROR exit
// has a parent - must be level 1 or 2
if ( Ctrl.SelectedNode.Level == 1 ) {
// this is the main node with Action Cmd
ActionCls ac = FindActionObject( Ctrl.SelectedNode.Parent.Name, Ctrl.SelectedNode.Name ); if ( ac == null ) return am; // ERROR exit
ActionCommandCls acc = ac.FindActionInputObject( CommandFromNodeText( Ctrl.SelectedNode.Text ) ); if ( acc == null ) return am; // ERROR exit
am = new ActivationModes( ac.defActivationMode ); am.Add( acc.ActivationMode );
return am;
}
else if ( Ctrl.SelectedNode.Level == 2 ) {
// this is a child of an action with further commands
ActionTreeNode atn = ( m_ctrl.SelectedNode.Parent as ActionTreeNode ); // the parent treenode
// the related action
ActionCls ac = FindActionObject( atn.Parent.Name, atn.Name ); if ( ac == null ) return am; // ERROR exit
ActionCommandCls acc = ac.FindActionInputObject( m_ctrl.SelectedNode.Index ); if ( acc == null ) return am; // ERROR exit
am = new ActivationModes( ac.defActivationMode ); am.Add( acc.ActivationMode );
return am;
}
return am;
}
/// <summary>
/// Update the ActivationMode of the selected item
/// </summary>
public void UpdateActivationModeSelectedItem( string newActivationMode )
{
ActivationModes am = new ActivationModes(); am.Add( ActivationModes.Default ); // dummy answer Default is Default and selected is Default
if ( ( Ctrl.SelectedNode.Level == 0 ) || ( Ctrl.SelectedNode.Level > 2 ) ) return;
if ( Ctrl.SelectedNode == null ) return; // ERROR exit
if ( Ctrl.SelectedNode.Parent == null ) return; // ERROR exit
// has a parent - must be level 1 or 2
if ( Ctrl.SelectedNode.Level == 1 ) {
// this is the main node with Action Cmd
ActionCls ac = FindActionObject( Ctrl.SelectedNode.Parent.Name, Ctrl.SelectedNode.Name ); if ( ac == null ) return; // ERROR exit
ActionCommandCls acc = ac.FindActionInputObject( CommandFromNodeText( Ctrl.SelectedNode.Text ) ); if ( acc == null ) return; // ERROR exit
acc.ActivationMode = newActivationMode;
Dirty = true;
}
else if ( Ctrl.SelectedNode.Level == 2 ) {
// this is a child of an action with further commands
ActionTreeNode atn = ( m_ctrl.SelectedNode.Parent as ActionTreeNode ); // the parent treenode
// the related action
ActionCls ac = FindActionObject( atn.Parent.Name, atn.Name ); if ( ac == null ) return; // ERROR exit
ActionCommandCls acc = ac.FindActionInputObject( m_ctrl.SelectedNode.Index ); if ( acc == null ) return; // ERROR exit
acc.ActivationMode = newActivationMode;
Dirty = true;
}
}
// input is like js1_button3 OR keyboard such as lctrl+x (mouse is keyboard too)
/// <summary>
/// Apply an update the the treenode

Loading…
Cancel
Save