diff --git a/JoystickProxyWin/Joystick Proxy/ControllerDevice.cs b/JoystickProxyWin/Joystick Proxy/ControllerDevice.cs index 01c403f..1fba7ce 100644 --- a/JoystickProxyWin/Joystick Proxy/ControllerDevice.cs +++ b/JoystickProxyWin/Joystick Proxy/ControllerDevice.cs @@ -30,6 +30,8 @@ public bool Enabled public DeviceInstance DeviceInstance { get => _deviceInstance; } public bool Supported { get; internal set; } + public Dictionary AlterModels { get => _alterModels; } + public string SelectedModelUsbId { get => _selectedModelUsbId; set => _selectedModelUsbId = value; } private DeviceInstance _deviceInstance; private Joystick _joystick; @@ -38,11 +40,16 @@ public bool Enabled private bool _enabled = false; private bool NotPollable = false; - public ControllerDevice(DirectInput di, DeviceInstance deviceInstance) + private Dictionary _alterModels; + private string _selectedModelUsbId; + + public ControllerDevice(DirectInput di, DeviceInstance deviceInstance, Dictionary alterModels = null) { _deviceInstance = deviceInstance; _usbId = ProductGuidToUSBID(_deviceInstance.ProductGuid); _joystick = new Joystick(di, deviceInstance.InstanceGuid); + _alterModels = alterModels; + _selectedModelUsbId = _usbId; Joystick.Properties.BufferSize = 32; } diff --git a/JoystickProxyWin/Joystick Proxy/Form1.Designer.cs b/JoystickProxyWin/Joystick Proxy/Form1.Designer.cs index 0cab247..f4e3fcd 100644 --- a/JoystickProxyWin/Joystick Proxy/Form1.Designer.cs +++ b/JoystickProxyWin/Joystick Proxy/Form1.Designer.cs @@ -29,20 +29,14 @@ protected override void Dispose(bool disposing) private void InitializeComponent() { this.components = new System.ComponentModel.Container(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1)); this.DevicesDataGridView = new System.Windows.Forms.DataGridView(); - this.deviceEnabled = new System.Windows.Forms.DataGridViewCheckBoxColumn(); - this.nameDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.uSBIDDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.ControllerDeviceBindingSource = new System.Windows.Forms.BindingSource(this.components); this.RefreshDevicesTimer = new System.Windows.Forms.Timer(this.components); this.DataGridView1 = new System.Windows.Forms.DataGridView(); this.InputName = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.InputValue = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.InputBindingSource = new System.Windows.Forms.BindingSource(this.components); this.ReadInputTimer = new System.Windows.Forms.Timer(this.components); - this.TipJarImage = new System.Windows.Forms.PictureBox(); this.ShowAllDevicesCheckBox = new System.Windows.Forms.CheckBox(); this.label1 = new System.Windows.Forms.Label(); this.SaveFileDialog = new System.Windows.Forms.SaveFileDialog(); @@ -52,13 +46,23 @@ private void InitializeComponent() this.VisualizerHostTextBox = new System.Windows.Forms.TextBox(); this.label3 = new System.Windows.Forms.Label(); this.PortInput = new System.Windows.Forms.NumericUpDown(); + this.splitContainer1 = new System.Windows.Forms.SplitContainer(); + this.ControllerDeviceBindingSource = new System.Windows.Forms.BindingSource(this.components); + this.form1BindingSource = new System.Windows.Forms.BindingSource(this.components); + this.enabledDataGridViewCheckBoxColumn = new System.Windows.Forms.DataGridViewCheckBoxColumn(); + this.dataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.dataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn(); ((System.ComponentModel.ISupportInitialize)(this.DevicesDataGridView)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.ControllerDeviceBindingSource)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.DataGridView1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.InputBindingSource)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.TipJarImage)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.PollingRateInput)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.PortInput)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); + this.splitContainer1.Panel1.SuspendLayout(); + this.splitContainer1.Panel2.SuspendLayout(); + this.splitContainer1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.ControllerDeviceBindingSource)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.form1BindingSource)).BeginInit(); this.SuspendLayout(); // // DevicesDataGridView @@ -66,65 +70,27 @@ private void InitializeComponent() this.DevicesDataGridView.AllowUserToAddRows = false; this.DevicesDataGridView.AllowUserToDeleteRows = false; this.DevicesDataGridView.AllowUserToResizeRows = false; - this.DevicesDataGridView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); this.DevicesDataGridView.AutoGenerateColumns = false; this.DevicesDataGridView.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None; this.DevicesDataGridView.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None; this.DevicesDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.DevicesDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { - this.deviceEnabled, - this.nameDataGridViewTextBoxColumn, - this.uSBIDDataGridViewTextBoxColumn}); + this.enabledDataGridViewCheckBoxColumn, + this.dataGridViewTextBoxColumn1, + this.dataGridViewTextBoxColumn2}); this.DevicesDataGridView.DataSource = this.ControllerDeviceBindingSource; - this.DevicesDataGridView.Location = new System.Drawing.Point(12, 12); + this.DevicesDataGridView.Dock = System.Windows.Forms.DockStyle.Fill; + this.DevicesDataGridView.Location = new System.Drawing.Point(0, 0); this.DevicesDataGridView.MultiSelect = false; this.DevicesDataGridView.Name = "DevicesDataGridView"; this.DevicesDataGridView.RowHeadersVisible = false; this.DevicesDataGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.CellSelect; - this.DevicesDataGridView.Size = new System.Drawing.Size(550, 355); + this.DevicesDataGridView.Size = new System.Drawing.Size(694, 372); this.DevicesDataGridView.TabIndex = 0; this.DevicesDataGridView.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.DevicesDataGridView_CellContentClick); this.DevicesDataGridView.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(this.DevicesDataGridView_CellFormatting); this.DevicesDataGridView.SelectionChanged += new System.EventHandler(this.DevicesDataGridView_SelectionChanged); // - // deviceEnabled - // - this.deviceEnabled.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.deviceEnabled.DataPropertyName = "Enabled"; - this.deviceEnabled.FalseValue = "false"; - this.deviceEnabled.FillWeight = 10F; - this.deviceEnabled.HeaderText = "Enabled"; - this.deviceEnabled.IndeterminateValue = ""; - this.deviceEnabled.Name = "deviceEnabled"; - this.deviceEnabled.ToolTipText = "Enable device input polling"; - this.deviceEnabled.TrueValue = "true"; - // - // nameDataGridViewTextBoxColumn - // - this.nameDataGridViewTextBoxColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.nameDataGridViewTextBoxColumn.DataPropertyName = "Name"; - this.nameDataGridViewTextBoxColumn.FillWeight = 70F; - this.nameDataGridViewTextBoxColumn.HeaderText = "Name"; - this.nameDataGridViewTextBoxColumn.Name = "nameDataGridViewTextBoxColumn"; - this.nameDataGridViewTextBoxColumn.ReadOnly = true; - // - // uSBIDDataGridViewTextBoxColumn - // - this.uSBIDDataGridViewTextBoxColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.uSBIDDataGridViewTextBoxColumn.DataPropertyName = "UsbId"; - dataGridViewCellStyle1.Font = new System.Drawing.Font("Consolas", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.uSBIDDataGridViewTextBoxColumn.DefaultCellStyle = dataGridViewCellStyle1; - this.uSBIDDataGridViewTextBoxColumn.FillWeight = 20F; - this.uSBIDDataGridViewTextBoxColumn.HeaderText = "USB ID"; - this.uSBIDDataGridViewTextBoxColumn.Name = "uSBIDDataGridViewTextBoxColumn"; - this.uSBIDDataGridViewTextBoxColumn.ReadOnly = true; - // - // ControllerDeviceBindingSource - // - this.ControllerDeviceBindingSource.DataSource = typeof(Joystick_Proxy.ControllerDevice); - // // RefreshDevicesTimer // this.RefreshDevicesTimer.Enabled = true; @@ -135,18 +101,17 @@ private void InitializeComponent() // this.DataGridView1.AllowUserToAddRows = false; this.DataGridView1.AllowUserToDeleteRows = false; - this.DataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Right))); this.DataGridView1.AutoGenerateColumns = false; this.DataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.DataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.InputName, this.InputValue}); this.DataGridView1.DataSource = this.InputBindingSource; - this.DataGridView1.Location = new System.Drawing.Point(568, 12); + this.DataGridView1.Dock = System.Windows.Forms.DockStyle.Fill; + this.DataGridView1.Location = new System.Drawing.Point(0, 0); this.DataGridView1.Name = "DataGridView1"; this.DataGridView1.RowHeadersVisible = false; - this.DataGridView1.Size = new System.Drawing.Size(302, 355); + this.DataGridView1.Size = new System.Drawing.Size(370, 372); this.DataGridView1.TabIndex = 2; // // InputName @@ -170,24 +135,11 @@ private void InitializeComponent() this.ReadInputTimer.Interval = global::Joystick_Proxy.Properties.Settings.Default.PollingRate; this.ReadInputTimer.Tick += new System.EventHandler(this.ReadInputTimer_Tick); // - // TipJarImage - // - this.TipJarImage.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.TipJarImage.Cursor = System.Windows.Forms.Cursors.Hand; - this.TipJarImage.Image = global::Joystick_Proxy.Properties.Resources.tipjar; - this.TipJarImage.Location = new System.Drawing.Point(778, 377); - this.TipJarImage.Name = "TipJarImage"; - this.TipJarImage.Size = new System.Drawing.Size(92, 20); - this.TipJarImage.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; - this.TipJarImage.TabIndex = 3; - this.TipJarImage.TabStop = false; - this.TipJarImage.Click += new System.EventHandler(this.TipJar_Click); - // // ShowAllDevicesCheckBox // this.ShowAllDevicesCheckBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.ShowAllDevicesCheckBox.AutoSize = true; - this.ShowAllDevicesCheckBox.Location = new System.Drawing.Point(13, 379); + this.ShowAllDevicesCheckBox.Location = new System.Drawing.Point(13, 403); this.ShowAllDevicesCheckBox.Name = "ShowAllDevicesCheckBox"; this.ShowAllDevicesCheckBox.Size = new System.Drawing.Size(106, 17); this.ShowAllDevicesCheckBox.TabIndex = 4; @@ -199,7 +151,7 @@ private void InitializeComponent() // this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(455, 380); + this.label1.Location = new System.Drawing.Point(743, 401); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(79, 13); this.label1.TabIndex = 6; @@ -213,7 +165,7 @@ private void InitializeComponent() // this.LogToFileCheckbox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.LogToFileCheckbox.AutoSize = true; - this.LogToFileCheckbox.Location = new System.Drawing.Point(125, 379); + this.LogToFileCheckbox.Location = new System.Drawing.Point(125, 403); this.LogToFileCheckbox.Name = "LogToFileCheckbox"; this.LogToFileCheckbox.Size = new System.Drawing.Size(72, 17); this.LogToFileCheckbox.TabIndex = 7; @@ -225,7 +177,7 @@ private void InitializeComponent() // this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(323, 380); + this.label2.Location = new System.Drawing.Point(589, 401); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(67, 13); this.label2.TabIndex = 8; @@ -235,14 +187,14 @@ private void InitializeComponent() // PollingRateInput // this.PollingRateInput.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.PollingRateInput.Location = new System.Drawing.Point(396, 377); + this.PollingRateInput.Location = new System.Drawing.Point(662, 398); this.PollingRateInput.Minimum = new decimal(new int[] { 12, 0, 0, 0}); this.PollingRateInput.Name = "PollingRateInput"; - this.PollingRateInput.Size = new System.Drawing.Size(53, 20); + this.PollingRateInput.Size = new System.Drawing.Size(62, 20); this.PollingRateInput.TabIndex = 9; this.PollingRateInput.Value = new decimal(new int[] { 34, @@ -257,9 +209,9 @@ private void InitializeComponent() // this.VisualizerHostTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.VisualizerHostTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", global::Joystick_Proxy.Properties.Settings.Default, "Host", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)); - this.VisualizerHostTextBox.Location = new System.Drawing.Point(540, 377); + this.VisualizerHostTextBox.Location = new System.Drawing.Point(828, 398); this.VisualizerHostTextBox.Name = "VisualizerHostTextBox"; - this.VisualizerHostTextBox.Size = new System.Drawing.Size(115, 20); + this.VisualizerHostTextBox.Size = new System.Drawing.Size(124, 20); this.VisualizerHostTextBox.TabIndex = 5; this.VisualizerHostTextBox.Text = global::Joystick_Proxy.Properties.Settings.Default.Host; this.VisualizerHostTextBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.VisualizerHostTextBox_KeyPress); @@ -267,8 +219,9 @@ private void InitializeComponent() // // label3 // + this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(661, 379); + this.label3.Location = new System.Drawing.Point(965, 401); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(29, 13); this.label3.TabIndex = 10; @@ -276,7 +229,8 @@ private void InitializeComponent() // // PortInput // - this.PortInput.Location = new System.Drawing.Point(696, 377); + this.PortInput.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.PortInput.Location = new System.Drawing.Point(1000, 397); this.PortInput.Maximum = new decimal(new int[] { 65535, 0, @@ -288,7 +242,7 @@ private void InitializeComponent() 0, 0}); this.PortInput.Name = "PortInput"; - this.PortInput.Size = new System.Drawing.Size(65, 20); + this.PortInput.Size = new System.Drawing.Size(74, 20); this.PortInput.TabIndex = 11; this.PortInput.Value = new decimal(new int[] { 1000, @@ -297,10 +251,67 @@ private void InitializeComponent() 0}); this.PortInput.ValueChanged += new System.EventHandler(this.PortInput_ValueChanged); // + // splitContainer1 + // + this.splitContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.splitContainer1.Location = new System.Drawing.Point(13, 12); + this.splitContainer1.Name = "splitContainer1"; + // + // splitContainer1.Panel1 + // + this.splitContainer1.Panel1.Controls.Add(this.DevicesDataGridView); + // + // splitContainer1.Panel2 + // + this.splitContainer1.Panel2.Controls.Add(this.DataGridView1); + this.splitContainer1.Size = new System.Drawing.Size(1068, 372); + this.splitContainer1.SplitterDistance = 694; + this.splitContainer1.TabIndex = 12; + // + // ControllerDeviceBindingSource + // + this.ControllerDeviceBindingSource.DataSource = typeof(Joystick_Proxy.ControllerDevice); + // + // form1BindingSource + // + this.form1BindingSource.DataSource = typeof(Joystick_Proxy.Form1); + // + // enabledDataGridViewCheckBoxColumn + // + this.enabledDataGridViewCheckBoxColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None; + this.enabledDataGridViewCheckBoxColumn.DataPropertyName = "Enabled"; + this.enabledDataGridViewCheckBoxColumn.FillWeight = 6.154823F; + this.enabledDataGridViewCheckBoxColumn.HeaderText = "Enabled"; + this.enabledDataGridViewCheckBoxColumn.Name = "enabledDataGridViewCheckBoxColumn"; + this.enabledDataGridViewCheckBoxColumn.ToolTipText = "Enable device input polling"; + this.enabledDataGridViewCheckBoxColumn.Width = 74; + // + // dataGridViewTextBoxColumn1 + // + this.dataGridViewTextBoxColumn1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None; + this.dataGridViewTextBoxColumn1.DataPropertyName = "Name"; + this.dataGridViewTextBoxColumn1.FillWeight = 43.08376F; + this.dataGridViewTextBoxColumn1.HeaderText = "Name"; + this.dataGridViewTextBoxColumn1.Name = "dataGridViewTextBoxColumn1"; + this.dataGridViewTextBoxColumn1.ReadOnly = true; + this.dataGridViewTextBoxColumn1.Width = 300; + // + // dataGridViewTextBoxColumn2 + // + this.dataGridViewTextBoxColumn2.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None; + this.dataGridViewTextBoxColumn2.DataPropertyName = "UsbId"; + this.dataGridViewTextBoxColumn2.FillWeight = 50.76142F; + this.dataGridViewTextBoxColumn2.HeaderText = "USB ID"; + this.dataGridViewTextBoxColumn2.Name = "dataGridViewTextBoxColumn2"; + this.dataGridViewTextBoxColumn2.ReadOnly = true; + // // Form1 // this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.ClientSize = new System.Drawing.Size(882, 405); + this.ClientSize = new System.Drawing.Size(1093, 429); + this.Controls.Add(this.splitContainer1); this.Controls.Add(this.PortInput); this.Controls.Add(this.label3); this.Controls.Add(this.PollingRateInput); @@ -309,21 +320,22 @@ private void InitializeComponent() this.Controls.Add(this.label1); this.Controls.Add(this.VisualizerHostTextBox); this.Controls.Add(this.ShowAllDevicesCheckBox); - this.Controls.Add(this.TipJarImage); - this.Controls.Add(this.DataGridView1); - this.Controls.Add(this.DevicesDataGridView); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MinimumSize = new System.Drawing.Size(600, 250); this.Name = "Form1"; this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Show; this.Text = "Joystick Proxy"; ((System.ComponentModel.ISupportInitialize)(this.DevicesDataGridView)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.ControllerDeviceBindingSource)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.DataGridView1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.InputBindingSource)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.TipJarImage)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.PollingRateInput)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.PortInput)).EndInit(); + this.splitContainer1.Panel1.ResumeLayout(false); + this.splitContainer1.Panel2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); + this.splitContainer1.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.ControllerDeviceBindingSource)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.form1BindingSource)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -339,7 +351,6 @@ private void InitializeComponent() private System.Windows.Forms.Timer ReadInputTimer; private System.Windows.Forms.DataGridViewTextBoxColumn InputName; private System.Windows.Forms.DataGridViewTextBoxColumn InputValue; - private System.Windows.Forms.PictureBox TipJarImage; private System.Windows.Forms.CheckBox ShowAllDevicesCheckBox; private System.Windows.Forms.DataGridViewCheckBoxColumn DeviceEnabled; private System.Windows.Forms.DataGridViewTextBoxColumn NameDataGridViewTextBoxColumn; @@ -350,11 +361,13 @@ private void InitializeComponent() private System.Windows.Forms.CheckBox LogToFileCheckbox; private System.Windows.Forms.Label label2; private System.Windows.Forms.NumericUpDown PollingRateInput; - private System.Windows.Forms.DataGridViewCheckBoxColumn deviceEnabled; - private System.Windows.Forms.DataGridViewTextBoxColumn nameDataGridViewTextBoxColumn; - private System.Windows.Forms.DataGridViewTextBoxColumn uSBIDDataGridViewTextBoxColumn; private System.Windows.Forms.Label label3; private System.Windows.Forms.NumericUpDown PortInput; + private System.Windows.Forms.SplitContainer splitContainer1; + private System.Windows.Forms.BindingSource form1BindingSource; + private System.Windows.Forms.DataGridViewCheckBoxColumn enabledDataGridViewCheckBoxColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn1; + private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn2; } } diff --git a/JoystickProxyWin/Joystick Proxy/Form1.cs b/JoystickProxyWin/Joystick Proxy/Form1.cs index 1693a93..25c4a46 100644 --- a/JoystickProxyWin/Joystick Proxy/Form1.cs +++ b/JoystickProxyWin/Joystick Proxy/Form1.cs @@ -1,4 +1,5 @@ using System; +using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Data; @@ -23,6 +24,7 @@ public partial class Form1 : Form private BindingList _devices; private BindingList _input; + //private BindingList _alterDevices; private Socket _socket; private IPEndPoint _endPoint; @@ -41,16 +43,90 @@ public Form1() _devices = new BindingList(); _input = new BindingList(); + //_alterDevices = new BindingList(); InitializeComponent(); ControllerDeviceBindingSource.DataSource = _devices; InputBindingSource.DataSource = _input; + //AlternateDeviceBindingSource.DataSource = _alterDevices; VisualizerHostTextBox.Text = Properties.Settings.Default.Host; PortInput.Value = Properties.Settings.Default.Port; ScanJoysticks(); + + DataGridViewComboBoxColumn modelColumn = new DataGridViewComboBoxColumn(); + modelColumn.HeaderText = "Model"; + modelColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + modelColumn.Name = "ModelComboBoxColumn"; + modelColumn.FillWeight = 30F; + modelColumn.Width = 300; + modelColumn.DisplayMember = "Device_Name"; + modelColumn.ValueMember = "Device_USB_ID"; + modelColumn.ReadOnly = false; + DevicesDataGridView.Columns.Add(modelColumn); + + DevicesDataGridView.RowsAdded += UpdateAlterModelsHandler; + DevicesDataGridView.RowsRemoved += UpdateAlterModelsHandler; + DevicesDataGridView.EditingControlShowing += EditingControlShowingHandler; + } + + private void UpdateAlterModelsHandler(object sender, DataGridViewRowsRemovedEventArgs e) + { + UpdateAlterModels(); + } + + private void UpdateAlterModelsHandler(object sender, DataGridViewRowsAddedEventArgs e) + { + UpdateAlterModels(); + } + + private void UpdateAlterModels() + { + foreach (DataGridViewRow row in DevicesDataGridView.Rows) + { + DataGridViewComboBoxCell comboBoxCell = (DataGridViewComboBoxCell)row.Cells["ModelComboBoxColumn"]; + ControllerDevice cellDevice = (ControllerDevice)row.DataBoundItem; + + comboBoxCell.DataSource = cellDevice.AlterModels.Select(m => new { Device_USB_ID = m.Key, Device_Name = m.Value }).ToList(); + + if (cellDevice.AlterModels.Any(m => m.Key == cellDevice.UsbId)) + { + comboBoxCell.Value = cellDevice.UsbId; + } + else + { + comboBoxCell.Value = null; + } + } + } + private void EditingControlShowingHandler(object sender, DataGridViewEditingControlShowingEventArgs e) + { + if (DevicesDataGridView.CurrentCell.ColumnIndex == DevicesDataGridView.Columns["ModelComboBoxColumn"].Index && + e.Control is ComboBox comboBox) + { + // Remove the existing event handler to avoid duplicate calls + comboBox.SelectedIndexChanged -= ModelColumn_SelectedIndexChangedHandler; + // Attach the event handler + comboBox.SelectedIndexChanged += ModelColumn_SelectedIndexChangedHandler; + } + } + + private void ModelColumn_SelectedIndexChangedHandler(object sender, EventArgs e) + { + if (sender is ComboBox comboBox) + { + DataGridViewComboBoxEditingControl editingControl = comboBox as DataGridViewComboBoxEditingControl; + DataGridView dataGridView = editingControl.EditingControlDataGridView; + int rowIndex = dataGridView.CurrentCell.RowIndex; + ControllerDevice cellDevice = (ControllerDevice)dataGridView.Rows[rowIndex].DataBoundItem; + + if (comboBox.SelectedValue != null) + { + cellDevice.SelectedModelUsbId = comboBox.SelectedValue.ToString(); + } + } } private void UpdateEndpoint(string host, int port) @@ -107,7 +183,21 @@ private void ScanJoysticks() if (_devices.Where(d => d.DeviceInstance.InstanceGuid == deviceInstance.InstanceGuid).Count() == 0) { if (ShowAllDevicesCheckBox.Checked == true || SupportedDevices.ContainsKey(ControllerDevice.ProductGuidToUSBID(deviceInstance.ProductGuid))) - addedDevices.Add(new ControllerDevice(_directInput, deviceInstance)); + { + Dictionary alterModels = new Dictionary(); + foreach (KeyValuePair devices in SupportedDevices) + { + /*if ((devices.Value.ToLower().Contains("joystick") && deviceInstance.InstanceName.ToLower().Contains("joystick")) || + (devices.Value.ToLower().Contains("throttle") && deviceInstance.InstanceName.ToLower().Contains("throttle")) || + (devices.Value.ToLower().Contains("hotas") && deviceInstance.InstanceName.ToLower().Contains("hotas")) || + (devices.Value.ToLower().Contains("pedals") && deviceInstance.InstanceName.ToLower().Contains("pedals"))) + {*/ + alterModels.Add(devices.Key, devices.Value); + //} + } + addedDevices.Add(new ControllerDevice(_directInput, deviceInstance, alterModels)); + + } } } @@ -191,7 +281,7 @@ private void SendEvent(ControllerDevice device, string e) id = "046d:c215"; } - string outgoingString = String.Format("{0},{1},{2}", id, device.Name, e); + string outgoingString = String.Format("{0},{1},{2}", device.SelectedModelUsbId, device.AlterModels[device.SelectedModelUsbId], e); if (supportedDevice) { diff --git a/JoystickProxyWin/Joystick Proxy/Form1.resx b/JoystickProxyWin/Joystick Proxy/Form1.resx index 041bc17..5513067 100644 --- a/JoystickProxyWin/Joystick Proxy/Form1.resx +++ b/JoystickProxyWin/Joystick Proxy/Form1.resx @@ -118,10 +118,10 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - 17, 17 + 180, 17 - 238, 17 + 399, 17 True @@ -130,13 +130,16 @@ True - 403, 17 + 562, 17 - 562, 17 + 721, 17 - 701, 17 + 859, 17 + + + 17, 17 diff --git a/JoystickProxyWin/Joystick Proxy/Joystick Proxy.csproj b/JoystickProxyWin/Joystick Proxy/Joystick Proxy.csproj index b2b4d5f..986458a 100644 --- a/JoystickProxyWin/Joystick Proxy/Joystick Proxy.csproj +++ b/JoystickProxyWin/Joystick Proxy/Joystick Proxy.csproj @@ -79,6 +79,7 @@ Form1.cs + Designer ResXFileCodeGenerator diff --git a/JoystickProxyWin/Joystick Proxy/settings.ini b/JoystickProxyWin/Joystick Proxy/settings.ini index 9cdea0e..fec6d7a 100644 --- a/JoystickProxyWin/Joystick Proxy/settings.ini +++ b/JoystickProxyWin/Joystick Proxy/settings.ini @@ -1,9 +1,14 @@ [Devices] -044f:b10a = Thrustmaster T.16000M +044f:b10a = Thrustmaster T.16000M Joystick +044f:b10a left= Thrustmaster T.16000M Left Joystick +044f:b10a right= Thrustmaster T.16000M Right Joystick 044f:b687 = Thrustmaster T.16000M Throttle 044f:b678 = Thrustmaster T.Flight Rudder Car Mode 044f:b679 = Thrustmaster T.Flight Rudder +044f:b106 = Thrustmaster T.Flight Joystick X 044f:b108 = Thrustmaster T.Flight HOTAS X +044f:b68d = Thrustmaster T.Flight HOTAS 1 +044f:b67c = Thrustmaster T.Flight HOTAS 4 044f:0402 = Thrustmaster Warthog Joystick 044f:0404 = Thrustmaster Warthog Throttle 044f:ffff = Thrustmaster Warthog Combined @@ -11,10 +16,10 @@ 06a3:0764 = Saitek Combat Rudder Pedals 068e:c0f2 = CH Pro Pedals 068e:00f2 = CH Pro Pedals -231d:011f = VKB Gunfighter -046d:c212 = Logitech Extreme 3D Pro -046d:c215 = Logitech 3D Pro -16d0:0a38 = MFG Crosswind +231d:011f = VKB Gunfighter Joystick +046d:c212 = Logitech Extreme 3D Pro Joystick +046d:c215 = Logitech 3D Pro Joystick +16d0:0a38 = MFG Crosswind Pedals 06a3:075c = Saitek X52 HOTAS 06a3:0762 = Saitek X52 Pro HOTAS 0738:a215 = Saitek X55 Throttle @@ -24,8 +29,8 @@ 06a3:0c2d = Saitek Pro Flight Throttle Quadrant 06a3:2541 = Saitek X45 HOTAS (2541) 06a3:053c = Saitek X45 HOTAS (053c) -06a3:0464 = Saitek Cyborg Evo -03eb:2043 = Virpil Mongoos T-50 -03ef:2004 = VPC-Star-Citizen-L -03ec:2005 = VPC-Star-Citizen-R -044f:b68f = Thrustmaster Pendular Rudder +06a3:0464 = Saitek Cyborg Evo Joystick +03eb:2043 = Virpil Mongoos T-50 Joystick +03ef:2004 = VPC-Star-Citizen-L Joystick +03ec:2005 = VPC-Star-Citizen-R Joystick +044f:b68f = Thrustmaster Pendular Rudder Pedals diff --git a/JoystickVisualizer/.vsconfig b/JoystickVisualizer/.vsconfig new file mode 100644 index 0000000..aade28f --- /dev/null +++ b/JoystickVisualizer/.vsconfig @@ -0,0 +1,6 @@ +{ + "version": "1.0", + "components": [ + "Microsoft.VisualStudio.Workload.ManagedGame" + ] +} diff --git a/JoystickVisualizer/Assets/JoystickVisualizerSettings.lighting b/JoystickVisualizer/Assets/JoystickVisualizerSettings.lighting index dadf06c..aced91a 100644 Binary files a/JoystickVisualizer/Assets/JoystickVisualizerSettings.lighting and b/JoystickVisualizer/Assets/JoystickVisualizerSettings.lighting differ diff --git a/JoystickVisualizer/Assets/Models/HOTAS Warthog/Materials/Throttle - HOTAS Warthog-Color_002.mat b/JoystickVisualizer/Assets/Models/HOTAS Warthog/Materials/Throttle - HOTAS Warthog-Color_002.mat index b33148f..42e5713 100644 Binary files a/JoystickVisualizer/Assets/Models/HOTAS Warthog/Materials/Throttle - HOTAS Warthog-Color_002.mat and b/JoystickVisualizer/Assets/Models/HOTAS Warthog/Materials/Throttle - HOTAS Warthog-Color_002.mat differ diff --git a/JoystickVisualizer/Assets/Models/HOTAS Warthog/Materials/Throttle - HOTAS Warthog-Color_008.mat b/JoystickVisualizer/Assets/Models/HOTAS Warthog/Materials/Throttle - HOTAS Warthog-Color_008.mat index 10966ff..58513d7 100644 Binary files a/JoystickVisualizer/Assets/Models/HOTAS Warthog/Materials/Throttle - HOTAS Warthog-Color_008.mat and b/JoystickVisualizer/Assets/Models/HOTAS Warthog/Materials/Throttle - HOTAS Warthog-Color_008.mat differ diff --git a/JoystickVisualizer/Assets/Models/HOTAS Warthog/Materials/Throttle - HOTAS Warthog-Color_009.mat b/JoystickVisualizer/Assets/Models/HOTAS Warthog/Materials/Throttle - HOTAS Warthog-Color_009.mat index 0ee4625..d463bc8 100644 Binary files a/JoystickVisualizer/Assets/Models/HOTAS Warthog/Materials/Throttle - HOTAS Warthog-Color_009.mat and b/JoystickVisualizer/Assets/Models/HOTAS Warthog/Materials/Throttle - HOTAS Warthog-Color_009.mat differ diff --git a/JoystickVisualizer/Assets/Models/HOTAS Warthog/Materials/Throttle - HOTAS Warthog-Color_A06.mat b/JoystickVisualizer/Assets/Models/HOTAS Warthog/Materials/Throttle - HOTAS Warthog-Color_A06.mat index c2e1b18..08bac08 100644 Binary files a/JoystickVisualizer/Assets/Models/HOTAS Warthog/Materials/Throttle - HOTAS Warthog-Color_A06.mat and b/JoystickVisualizer/Assets/Models/HOTAS Warthog/Materials/Throttle - HOTAS Warthog-Color_A06.mat differ diff --git a/JoystickVisualizer/Assets/Models/HOTAS Warthog/Materials/Throttle - HOTAS Warthog-Metal_Corrogated_Shiny.mat b/JoystickVisualizer/Assets/Models/HOTAS Warthog/Materials/Throttle - HOTAS Warthog-Metal_Corrogated_Shiny.mat index 48dd2dc..0d75022 100644 Binary files a/JoystickVisualizer/Assets/Models/HOTAS Warthog/Materials/Throttle - HOTAS Warthog-Metal_Corrogated_Shiny.mat and b/JoystickVisualizer/Assets/Models/HOTAS Warthog/Materials/Throttle - HOTAS Warthog-Metal_Corrogated_Shiny.mat differ diff --git a/JoystickVisualizer/Assets/Models/HOTAS Warthog/Materials/Throttle - HOTAS Warthog-TM Warthog Trottle.mat b/JoystickVisualizer/Assets/Models/HOTAS Warthog/Materials/Throttle - HOTAS Warthog-TM Warthog Trottle.mat index 300b03b..ce458ca 100644 Binary files a/JoystickVisualizer/Assets/Models/HOTAS Warthog/Materials/Throttle - HOTAS Warthog-TM Warthog Trottle.mat and b/JoystickVisualizer/Assets/Models/HOTAS Warthog/Materials/Throttle - HOTAS Warthog-TM Warthog Trottle.mat differ diff --git a/JoystickVisualizer/Assets/Models/HOTAS Warthog/Materials/Throttle - HOTAS Warthog-[Color_007]1.mat b/JoystickVisualizer/Assets/Models/HOTAS Warthog/Materials/Throttle - HOTAS Warthog-[Color_007]1.mat index 109cbf3..4b3cc0e 100644 Binary files a/JoystickVisualizer/Assets/Models/HOTAS Warthog/Materials/Throttle - HOTAS Warthog-[Color_007]1.mat and b/JoystickVisualizer/Assets/Models/HOTAS Warthog/Materials/Throttle - HOTAS Warthog-[Color_007]1.mat differ diff --git a/JoystickVisualizer/Assets/Models/HOTAS Warthog/Textures/warthog-up-tex.jpg.meta b/JoystickVisualizer/Assets/Models/HOTAS Warthog/Textures/warthog-up-tex.jpg.meta index e03c2ed..18ba978 100644 --- a/JoystickVisualizer/Assets/Models/HOTAS Warthog/Textures/warthog-up-tex.jpg.meta +++ b/JoystickVisualizer/Assets/Models/HOTAS Warthog/Textures/warthog-up-tex.jpg.meta @@ -1,11 +1,9 @@ fileFormatVersion: 2 guid: ffd9914284ed04848bf056a967894f66 -timeCreated: 1510079446 -licenseType: Free TextureImporter: - fileIDToRecycleName: {} + internalIDToNameTable: [] externalObjects: {} - serializedVersion: 4 + serializedVersion: 11 mipmaps: mipMapMode: 0 enableMipMap: 1 @@ -23,6 +21,9 @@ TextureImporter: heightScale: 0.25 normalMapFilter: 0 isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 grayScaleToAlpha: 0 generateCubemap: 6 cubemapConvolution: 0 @@ -33,7 +34,7 @@ TextureImporter: serializedVersion: 2 filterMode: -1 aniso: -1 - mipBias: -1 + mipBias: -100 wrapU: -1 wrapV: -1 wrapW: -1 @@ -45,18 +46,25 @@ TextureImporter: spriteMeshType: 1 alignment: 0 spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 alphaUsage: 1 alphaIsTransparency: 0 spriteTessellationDetail: -1 textureType: 0 textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 maxTextureSizeSet: 0 compressionQualitySet: 0 textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 1 platformSettings: - - buildTarget: DefaultTexturePlatform + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform maxTextureSize: 2048 resizeAlgorithm: 0 textureFormat: -1 @@ -65,12 +73,24 @@ TextureImporter: crunchedCompression: 0 allowsAlphaSplitting: 0 overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 1 spriteSheet: serializedVersion: 2 sprites: [] outline: [] physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 userData: assetBundleName: assetBundleVariant: diff --git a/JoystickVisualizer/Assets/Models/Logitech 3D Pro - Mirrored.meta b/JoystickVisualizer/Assets/Models/Logitech 3D Pro - Mirrored.meta new file mode 100644 index 0000000..d33c013 --- /dev/null +++ b/JoystickVisualizer/Assets/Models/Logitech 3D Pro - Mirrored.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 804683a44d8f407489a75ae243545923 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/JoystickVisualizer/Assets/Models/Logitech 3D Pro - Mirrored/Black_Plastic.mat b/JoystickVisualizer/Assets/Models/Logitech 3D Pro - Mirrored/Black_Plastic.mat new file mode 100644 index 0000000..3abbb64 Binary files /dev/null and b/JoystickVisualizer/Assets/Models/Logitech 3D Pro - Mirrored/Black_Plastic.mat differ diff --git a/JoystickVisualizer/Assets/Models/Logitech 3D Pro - Mirrored/Black_Plastic.mat.meta b/JoystickVisualizer/Assets/Models/Logitech 3D Pro - Mirrored/Black_Plastic.mat.meta new file mode 100644 index 0000000..8bf364e --- /dev/null +++ b/JoystickVisualizer/Assets/Models/Logitech 3D Pro - Mirrored/Black_Plastic.mat.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 0c108d2a8602e164fa56264cd10c4fe5 +timeCreated: 1521302271 +licenseType: Free +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/JoystickVisualizer/Assets/Models/Logitech 3D Pro - Mirrored/Grey_Plastic.mat b/JoystickVisualizer/Assets/Models/Logitech 3D Pro - Mirrored/Grey_Plastic.mat new file mode 100644 index 0000000..e2dc3d0 Binary files /dev/null and b/JoystickVisualizer/Assets/Models/Logitech 3D Pro - Mirrored/Grey_Plastic.mat differ diff --git a/JoystickVisualizer/Assets/Models/Logitech 3D Pro - Mirrored/Grey_Plastic.mat.meta b/JoystickVisualizer/Assets/Models/Logitech 3D Pro - Mirrored/Grey_Plastic.mat.meta new file mode 100644 index 0000000..949047e --- /dev/null +++ b/JoystickVisualizer/Assets/Models/Logitech 3D Pro - Mirrored/Grey_Plastic.mat.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 6d84191d9e5c58f48acf5fcbe665e3e4 +timeCreated: 1521302271 +licenseType: Free +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/JoystickVisualizer/Assets/Models/Logitech 3D Pro - Mirrored/Logitech Extreme 3D Pro - Mirrored.blend b/JoystickVisualizer/Assets/Models/Logitech 3D Pro - Mirrored/Logitech Extreme 3D Pro - Mirrored.blend new file mode 100644 index 0000000..0689337 Binary files /dev/null and b/JoystickVisualizer/Assets/Models/Logitech 3D Pro - Mirrored/Logitech Extreme 3D Pro - Mirrored.blend differ diff --git a/JoystickVisualizer/Assets/Models/Logitech 3D Pro - Mirrored/Logitech Extreme 3D Pro - Mirrored.blend.meta b/JoystickVisualizer/Assets/Models/Logitech 3D Pro - Mirrored/Logitech Extreme 3D Pro - Mirrored.blend.meta new file mode 100644 index 0000000..73ef282 --- /dev/null +++ b/JoystickVisualizer/Assets/Models/Logitech 3D Pro - Mirrored/Logitech Extreme 3D Pro - Mirrored.blend.meta @@ -0,0 +1,102 @@ +fileFormatVersion: 2 +guid: dcf7c2f1df7e1584aa6b0074dfc48531 +ModelImporter: + serializedVersion: 21100 + internalIDToNameTable: [] + externalObjects: {} + materials: + materialImportMode: 2 + materialName: 0 + materialSearch: 1 + materialLocation: 1 + animations: + legacyGenerateAnimations: 4 + bakeSimulation: 0 + resampleCurves: 1 + optimizeGameObjects: 0 + motionNodeName: + rigImportErrors: + rigImportWarnings: + animationImportErrors: + animationImportWarnings: + animationRetargetingWarnings: + animationDoRetargetingWarnings: 0 + importAnimatedCustomProperties: 0 + importConstraints: 0 + animationCompression: 1 + animationRotationError: 0.5 + animationPositionError: 0.5 + animationScaleError: 0.5 + animationWrapMode: 0 + extraExposedTransformPaths: [] + extraUserProperties: [] + clipAnimations: [] + isReadable: 0 + meshes: + lODScreenPercentages: [] + globalScale: 1 + meshCompression: 0 + addColliders: 0 + useSRGBMaterialColor: 1 + sortHierarchyByName: 1 + importVisibility: 1 + importBlendShapes: 1 + importCameras: 1 + importLights: 1 + fileIdsGeneration: 2 + swapUVChannels: 0 + generateSecondaryUV: 0 + useFileUnits: 1 + keepQuads: 0 + weldVertices: 1 + bakeAxisConversion: 0 + preserveHierarchy: 0 + skinWeightsMode: 0 + maxBonesPerVertex: 4 + minBoneWeight: 0.001 + meshOptimizationFlags: -1 + indexFormat: 0 + secondaryUVAngleDistortion: 8 + secondaryUVAreaDistortion: 15.000001 + secondaryUVHardAngle: 88 + secondaryUVMarginMethod: 1 + secondaryUVMinLightmapResolution: 40 + secondaryUVMinObjectScale: 1 + secondaryUVPackMargin: 4 + useFileScale: 1 + tangentSpace: + normalSmoothAngle: 60 + normalImportMode: 0 + tangentImportMode: 3 + normalCalculationMode: 4 + legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0 + blendShapeNormalImportMode: 1 + normalSmoothingSource: 0 + referencedClips: [] + importAnimation: 1 + humanDescription: + serializedVersion: 3 + human: [] + skeleton: [] + armTwist: 0.5 + foreArmTwist: 0.5 + upperLegTwist: 0.5 + legTwist: 0.5 + armStretch: 0.05 + legStretch: 0.05 + feetSpacing: 0 + globalScale: 1 + rootMotionBoneName: + hasTranslationDoF: 0 + hasExtraRoot: 0 + skeletonHasParents: 1 + lastHumanDescriptionAvatarSource: {instanceID: 0} + autoGenerateAvatarMappingIfUnspecified: 1 + animationType: 2 + humanoidOversampling: 1 + avatarSetup: 0 + addHumanoidExtraRootOnlyWhenUsingAvatar: 1 + additionalBone: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/JoystickVisualizer/Assets/Models/Logitech 3D Pro - Mirrored/Logitech Extreme 3D Pro.blend1 b/JoystickVisualizer/Assets/Models/Logitech 3D Pro - Mirrored/Logitech Extreme 3D Pro.blend1 new file mode 100644 index 0000000..61895dd Binary files /dev/null and b/JoystickVisualizer/Assets/Models/Logitech 3D Pro - Mirrored/Logitech Extreme 3D Pro.blend1 differ diff --git a/JoystickVisualizer/Assets/Models/Logitech 3D Pro - Mirrored/Logitech Extreme 3D Pro.blend1.meta b/JoystickVisualizer/Assets/Models/Logitech 3D Pro - Mirrored/Logitech Extreme 3D Pro.blend1.meta new file mode 100644 index 0000000..c6ad614 --- /dev/null +++ b/JoystickVisualizer/Assets/Models/Logitech 3D Pro - Mirrored/Logitech Extreme 3D Pro.blend1.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: b2ed470727c28524ea318e0e017aad16 +timeCreated: 1520978742 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/JoystickVisualizer/Assets/Models/Logitech 3D Pro - Mirrored/Logitech3DProMirrored.cs b/JoystickVisualizer/Assets/Models/Logitech 3D Pro - Mirrored/Logitech3DProMirrored.cs new file mode 100644 index 0000000..2094e86 --- /dev/null +++ b/JoystickVisualizer/Assets/Models/Logitech 3D Pro - Mirrored/Logitech3DProMirrored.cs @@ -0,0 +1,71 @@ +using Assets; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class Logitech3DProMirrored : MonoBehaviour { + public const string USB_ID = "046d:c215"; + //public const string USB_ID = "044f:0402"; + //public const string USB_ID = "044f:0404"; + + public GameObject Model; + public GameObject Joystick; + public GameObject Throttle; + + // Use this for initialization + void Start() + { + UDPListener.StickEventListener += StickEvent; + } + + // Update is called once per frame + void Update() + { + } + + void StickEvent(JoystickState state) + { + if (state.UsbID != USB_ID) + { + return; + } + + Model.SetActive(true); + + foreach (KeyValuePair entry in state.Data) + { + switch (entry.Key) + { + case "Connected": + if (Model.activeInHierarchy) + Model.SetActive(entry.Value == 1); + break; + + case "X": + Joystick.transform.localEulerAngles = new Vector3(Joystick.transform.localEulerAngles.x, ConvertRange(entry.Value, 0, 65535, -20, 20), Joystick.transform.localEulerAngles.z); + break; + case "Y": + Joystick.transform.localEulerAngles = new Vector3(ConvertRange(entry.Value, 0, 65535, 20, -20), Joystick.transform.localEulerAngles.y, Joystick.transform.localEulerAngles.z); + break; + + case "RotationZ": + Joystick.transform.localEulerAngles = new Vector3(Joystick.transform.localEulerAngles.x, Joystick.transform.localEulerAngles.y, ConvertRange(entry.Value, 0, 65535, -20, 20)); + break; + + case "Sliders0": + Throttle.transform.localEulerAngles = new Vector3(ConvertRange(entry.Value, 0, 65535, 30, -85), Throttle.transform.localEulerAngles.y, Throttle.transform.localEulerAngles.z); + break; + } + } + } + + public static float ConvertRange( + double value, // value to convert + double originalStart, double originalEnd, // original range + double newStart, double newEnd) // desired range + { + double scale = (double)(newEnd - newStart) / (originalEnd - originalStart); + return (float)(newStart + ((value - originalStart) * scale)); + } + +} diff --git a/JoystickVisualizer/Assets/Models/Logitech 3D Pro - Mirrored/Logitech3DProMirrored.cs.meta b/JoystickVisualizer/Assets/Models/Logitech 3D Pro - Mirrored/Logitech3DProMirrored.cs.meta new file mode 100644 index 0000000..d00a784 --- /dev/null +++ b/JoystickVisualizer/Assets/Models/Logitech 3D Pro - Mirrored/Logitech3DProMirrored.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 4972860253401144ca1dbae8b5fba43e +timeCreated: 1519418147 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/JoystickVisualizer/Assets/Models/Logitech 3D Pro - Mirrored/Very_Black_Plastic.mat b/JoystickVisualizer/Assets/Models/Logitech 3D Pro - Mirrored/Very_Black_Plastic.mat new file mode 100644 index 0000000..549d03b Binary files /dev/null and b/JoystickVisualizer/Assets/Models/Logitech 3D Pro - Mirrored/Very_Black_Plastic.mat differ diff --git a/JoystickVisualizer/Assets/Models/Logitech 3D Pro - Mirrored/Very_Black_Plastic.mat.meta b/JoystickVisualizer/Assets/Models/Logitech 3D Pro - Mirrored/Very_Black_Plastic.mat.meta new file mode 100644 index 0000000..e211cb9 --- /dev/null +++ b/JoystickVisualizer/Assets/Models/Logitech 3D Pro - Mirrored/Very_Black_Plastic.mat.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: f00a473aad9217846ab6d8d75e374dd7 +timeCreated: 1521302271 +licenseType: Free +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/JoystickVisualizer/Assets/Models/Logitech 3D Pro/Logitech Extreme 3D Pro.mat b/JoystickVisualizer/Assets/Models/Logitech 3D Pro/Logitech Extreme 3D Pro.mat new file mode 100644 index 0000000..a693a57 Binary files /dev/null and b/JoystickVisualizer/Assets/Models/Logitech 3D Pro/Logitech Extreme 3D Pro.mat differ diff --git a/JoystickVisualizer/Assets/Models/Logitech 3D Pro/Logitech Extreme 3D Pro.mat.meta b/JoystickVisualizer/Assets/Models/Logitech 3D Pro/Logitech Extreme 3D Pro.mat.meta new file mode 100644 index 0000000..e86a532 --- /dev/null +++ b/JoystickVisualizer/Assets/Models/Logitech 3D Pro/Logitech Extreme 3D Pro.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ee39e4f0118b9024c8a0104f4e7e0ec7 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/JoystickVisualizer/Assets/Models/Thrustmaster T.Flight HOTAS 1.meta b/JoystickVisualizer/Assets/Models/Thrustmaster T.Flight HOTAS 1.meta new file mode 100644 index 0000000..851ab4f --- /dev/null +++ b/JoystickVisualizer/Assets/Models/Thrustmaster T.Flight HOTAS 1.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: acba3bb826613154f91af5f6dc081681 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/JoystickVisualizer/Assets/Models/Thrustmaster T.Flight HOTAS 1/ThrustmasterTFlightHOTAS1Stick.cs b/JoystickVisualizer/Assets/Models/Thrustmaster T.Flight HOTAS 1/ThrustmasterTFlightHOTAS1Stick.cs new file mode 100644 index 0000000..ed7b190 --- /dev/null +++ b/JoystickVisualizer/Assets/Models/Thrustmaster T.Flight HOTAS 1/ThrustmasterTFlightHOTAS1Stick.cs @@ -0,0 +1,61 @@ +using Assets; +using System.Collections.Generic; +using UnityEngine; + +public class ThrustmasterTFlightHOTAS1Stick : MonoBehaviour { + public const string USB_ID = "044f:b68d"; + + public GameObject Model; + public GameObject Joystick; + + // Use this for initialization + void Start() + { + UDPListener.StickEventListener += StickEvent; + } + + // Update is called once per frame + void Update() + { + } + + void StickEvent(JoystickState state) + { + if (state.UsbID != USB_ID) + { + return; + } + + Model.SetActive(true); + + foreach (KeyValuePair entry in state.Data) + { + switch (entry.Key) + { + case "Connected": + if (Model.activeInHierarchy) + Model.SetActive(entry.Value == 1); + break; + + case "X": + Joystick.transform.localEulerAngles = new Vector3(Joystick.transform.localEulerAngles.x, Joystick.transform.localEulerAngles.y, ConvertRange(entry.Value, 0, 65535, 20, -20)); + break; + case "Y": + Joystick.transform.localEulerAngles = new Vector3(ConvertRange(entry.Value, 0, 65535, 20, -20), Joystick.transform.localEulerAngles.y, Joystick.transform.localEulerAngles.z); + break; + case "RotationZ": + Joystick.transform.localEulerAngles = new Vector3(Joystick.transform.localEulerAngles.x, ConvertRange(entry.Value, 0, 65535, -30, 30), Joystick.transform.localEulerAngles.z); + break; + } + } + } + + public static float ConvertRange( + double value, // value to convert + double originalStart, double originalEnd, // original range + double newStart, double newEnd) // desired range + { + double scale = (double)(newEnd - newStart) / (originalEnd - originalStart); + return (float)(newStart + ((value - originalStart) * scale)); + } +} diff --git a/JoystickVisualizer/Assets/Models/Thrustmaster T.Flight HOTAS 1/ThrustmasterTFlightHOTAS1Stick.cs.meta b/JoystickVisualizer/Assets/Models/Thrustmaster T.Flight HOTAS 1/ThrustmasterTFlightHOTAS1Stick.cs.meta new file mode 100644 index 0000000..0d6c30d --- /dev/null +++ b/JoystickVisualizer/Assets/Models/Thrustmaster T.Flight HOTAS 1/ThrustmasterTFlightHOTAS1Stick.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b6c8cd53a90793445945a4a0ccbbe464 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/JoystickVisualizer/Assets/Models/Thrustmaster T.Flight HOTAS 1/ThrustmasterTFlightHOTAS1Throttle.cs b/JoystickVisualizer/Assets/Models/Thrustmaster T.Flight HOTAS 1/ThrustmasterTFlightHOTAS1Throttle.cs new file mode 100644 index 0000000..ec245c8 --- /dev/null +++ b/JoystickVisualizer/Assets/Models/Thrustmaster T.Flight HOTAS 1/ThrustmasterTFlightHOTAS1Throttle.cs @@ -0,0 +1,70 @@ +using Assets; +using System; +using System.Collections.Generic; +using UnityEngine; + +public class ThrustmasterTFlightHOTAS1Throttle : MonoBehaviour { + public const string USB_ID = "044f:b68d"; + + public GameObject Model; + public GameObject LeftThrottle; + public GameObject RightThrottle; + + private int ZVal = 32767; + private int Slider0Val = 32767; + + // Use this for initialization + void Start() + { + UDPListener.StickEventListener += StickEvent; + } + + // Update is called once per frame + void Update() + { + } + + void StickEvent(JoystickState state) + { + if (state.UsbID != USB_ID) + { + return; + } + + Model.SetActive(true); + + foreach (KeyValuePair entry in state.Data) + { + switch (entry.Key) + { + case "Connected": + if (Model.activeInHierarchy) + Model.SetActive(entry.Value == 1); + break; + + case "Z": + ZVal = entry.Value; + break; + + case "Sliders0": + Slider0Val = entry.Value; + break; + } + + int LeftValue = Math.Max(0, Math.Min(65535, ZVal + (Slider0Val - 32767) / 2)); + int RightValue = Math.Max(0, Math.Min(65535, ZVal - (Slider0Val - 32767) / 2)); + + RightThrottle.transform.localEulerAngles = new Vector3(ConvertRange(RightValue, 0, 65535, 30, -30), RightThrottle.transform.localEulerAngles.y, RightThrottle.transform.localEulerAngles.z); + LeftThrottle.transform.localEulerAngles = new Vector3(ConvertRange(LeftValue, 0, 65535, 30, -30), LeftThrottle.transform.localEulerAngles.y, LeftThrottle.transform.localEulerAngles.z); + } + } + + public static float ConvertRange( + double value, // value to convert + double originalStart, double originalEnd, // original range + double newStart, double newEnd) // desired range + { + double scale = (double)(newEnd - newStart) / (originalEnd - originalStart); + return (float)(newStart + ((value - originalStart) * scale)); + } +} diff --git a/JoystickVisualizer/Assets/Models/Thrustmaster T.Flight HOTAS 1/ThrustmasterTFlightHOTAS1Throttle.cs.meta b/JoystickVisualizer/Assets/Models/Thrustmaster T.Flight HOTAS 1/ThrustmasterTFlightHOTAS1Throttle.cs.meta new file mode 100644 index 0000000..2f62e70 --- /dev/null +++ b/JoystickVisualizer/Assets/Models/Thrustmaster T.Flight HOTAS 1/ThrustmasterTFlightHOTAS1Throttle.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5cc13aeefa58f4c44b17351a42c475da +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/JoystickVisualizer/Assets/Models/Thrustmaster T.Flight HOTAS 4.meta b/JoystickVisualizer/Assets/Models/Thrustmaster T.Flight HOTAS 4.meta new file mode 100644 index 0000000..b8834f0 --- /dev/null +++ b/JoystickVisualizer/Assets/Models/Thrustmaster T.Flight HOTAS 4.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1853f76ebf006514abb831113f04957f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/JoystickVisualizer/Assets/Models/Thrustmaster T.Flight HOTAS 4/ThrustmasterTFlightHOTAS4Stick.cs b/JoystickVisualizer/Assets/Models/Thrustmaster T.Flight HOTAS 4/ThrustmasterTFlightHOTAS4Stick.cs new file mode 100644 index 0000000..5c7fd2b --- /dev/null +++ b/JoystickVisualizer/Assets/Models/Thrustmaster T.Flight HOTAS 4/ThrustmasterTFlightHOTAS4Stick.cs @@ -0,0 +1,62 @@ +using Assets; +using System.Collections.Generic; +using UnityEngine; + +public class ThrustmasterTFlightHOTAS4Stick : MonoBehaviour { + public const string USB_ID = "044f:b67c"; + //public const string USB_ID = "044f:0402"; + + public GameObject Model; + public GameObject Joystick; + + // Use this for initialization + void Start() + { + UDPListener.StickEventListener += StickEvent; + } + + // Update is called once per frame + void Update() + { + } + + void StickEvent(JoystickState state) + { + if (state.UsbID != USB_ID) + { + return; + } + + Model.SetActive(true); + + foreach (KeyValuePair entry in state.Data) + { + switch (entry.Key) + { + case "Connected": + if (Model.activeInHierarchy) + Model.SetActive(entry.Value == 1); + break; + + case "X": + Joystick.transform.localEulerAngles = new Vector3(Joystick.transform.localEulerAngles.x, Joystick.transform.localEulerAngles.y, ConvertRange(entry.Value, 0, 65535, 20, -20)); + break; + case "Y": + Joystick.transform.localEulerAngles = new Vector3(ConvertRange(entry.Value, 0, 65535, 20, -20), Joystick.transform.localEulerAngles.y, Joystick.transform.localEulerAngles.z); + break; + case "RotationZ": + Joystick.transform.localEulerAngles = new Vector3(Joystick.transform.localEulerAngles.x, ConvertRange(entry.Value, 0, 65535, -30, 30), Joystick.transform.localEulerAngles.z); + break; + } + } + } + + public static float ConvertRange( + double value, // value to convert + double originalStart, double originalEnd, // original range + double newStart, double newEnd) // desired range + { + double scale = (double)(newEnd - newStart) / (originalEnd - originalStart); + return (float)(newStart + ((value - originalStart) * scale)); + } +} diff --git a/JoystickVisualizer/Assets/Models/Thrustmaster T.Flight HOTAS 4/ThrustmasterTFlightHOTAS4Stick.cs.meta b/JoystickVisualizer/Assets/Models/Thrustmaster T.Flight HOTAS 4/ThrustmasterTFlightHOTAS4Stick.cs.meta new file mode 100644 index 0000000..a6142b8 --- /dev/null +++ b/JoystickVisualizer/Assets/Models/Thrustmaster T.Flight HOTAS 4/ThrustmasterTFlightHOTAS4Stick.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f3361634c0b45754b84a8085a8306a63 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/JoystickVisualizer/Assets/Models/Thrustmaster T.Flight HOTAS 4/ThrustmasterTFlightHOTAS4Throttle.cs b/JoystickVisualizer/Assets/Models/Thrustmaster T.Flight HOTAS 4/ThrustmasterTFlightHOTAS4Throttle.cs new file mode 100644 index 0000000..06e8738 --- /dev/null +++ b/JoystickVisualizer/Assets/Models/Thrustmaster T.Flight HOTAS 4/ThrustmasterTFlightHOTAS4Throttle.cs @@ -0,0 +1,71 @@ +using Assets; +using System; +using System.Collections.Generic; +using UnityEngine; + +public class ThrustmasterTFlightHOTAS4Throttle : MonoBehaviour { + public const string USB_ID = "044f:b67c"; + //public const string USB_ID = "044f:0404"; + + public GameObject Model; + public GameObject LeftThrottle; + public GameObject RightThrottle; + + private int ZVal = 32767; + private int Slider0Val = 32767; + + // Use this for initialization + void Start() + { + UDPListener.StickEventListener += StickEvent; + } + + // Update is called once per frame + void Update() + { + } + + void StickEvent(JoystickState state) + { + if (state.UsbID != USB_ID) + { + return; + } + + Model.SetActive(true); + + foreach (KeyValuePair entry in state.Data) + { + switch (entry.Key) + { + case "Connected": + if (Model.activeInHierarchy) + Model.SetActive(entry.Value == 1); + break; + + case "Z": + ZVal = entry.Value; + break; + + case "Sliders0": + Slider0Val = entry.Value; + break; + } + + int LeftValue = Math.Max(0, Math.Min(65535, ZVal + (Slider0Val - 32767) / 2)); + int RightValue = Math.Max(0, Math.Min(65535, ZVal - (Slider0Val - 32767) / 2)); + + RightThrottle.transform.localEulerAngles = new Vector3(ConvertRange(RightValue, 0, 65535, 30, -30), RightThrottle.transform.localEulerAngles.y, RightThrottle.transform.localEulerAngles.z); + LeftThrottle.transform.localEulerAngles = new Vector3(ConvertRange(LeftValue, 0, 65535, 30, -30), LeftThrottle.transform.localEulerAngles.y, LeftThrottle.transform.localEulerAngles.z); + } + } + + public static float ConvertRange( + double value, // value to convert + double originalStart, double originalEnd, // original range + double newStart, double newEnd) // desired range + { + double scale = (double)(newEnd - newStart) / (originalEnd - originalStart); + return (float)(newStart + ((value - originalStart) * scale)); + } +} diff --git a/JoystickVisualizer/Assets/Models/Thrustmaster T.Flight HOTAS 4/ThrustmasterTFlightHOTAS4Throttle.cs.meta b/JoystickVisualizer/Assets/Models/Thrustmaster T.Flight HOTAS 4/ThrustmasterTFlightHOTAS4Throttle.cs.meta new file mode 100644 index 0000000..a0ae4ef --- /dev/null +++ b/JoystickVisualizer/Assets/Models/Thrustmaster T.Flight HOTAS 4/ThrustmasterTFlightHOTAS4Throttle.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0d052ff860e85bb44acbc8ac7c46c00c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/JoystickVisualizer/Assets/Models/Thrustmaster T16000M Duo - Left.meta b/JoystickVisualizer/Assets/Models/Thrustmaster T16000M Duo - Left.meta new file mode 100644 index 0000000..8ff9e31 --- /dev/null +++ b/JoystickVisualizer/Assets/Models/Thrustmaster T16000M Duo - Left.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 07d5cd72af7352449a546b103a5aaac8 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/JoystickVisualizer/Assets/Models/Thrustmaster T16000M Duo - Left/T16000MDuoLeft.cs b/JoystickVisualizer/Assets/Models/Thrustmaster T16000M Duo - Left/T16000MDuoLeft.cs new file mode 100644 index 0000000..c5667ee --- /dev/null +++ b/JoystickVisualizer/Assets/Models/Thrustmaster T16000M Duo - Left/T16000MDuoLeft.cs @@ -0,0 +1,72 @@ +using Assets; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class T16000MDuoLeft : MonoBehaviour { + public const string USB_ID = "044f:b10a left"; + + //private static string USB_ID = "044f:0402"; // TM Stick (test) + //private static string USB_ID = "044f:0404"; // TM Throttle (test) + + public GameObject Model; + public GameObject StickHandle; + + // Use this for initialization + void Start() + { + UDPListener.StickEventListener += StickEvent; + } + + // Update is called once per frame + void Update() + { + } + + + void StickEvent(JoystickState state) + { + if (state.UsbID != USB_ID) + { + return; + } + + Model.SetActive(true); + + foreach (KeyValuePair entry in state.Data) + { + switch (entry.Key) + { + case "Connected": + if (Model.activeInHierarchy) + Model.SetActive(entry.Value == 1); + break; + + case "X": + StickHandle.transform.localEulerAngles = new Vector3(StickHandle.transform.localEulerAngles.x, ConvertRange(entry.Value, 65535, 0, -20, 20), StickHandle.transform.localEulerAngles.z); + break; + case "Y": + StickHandle.transform.localEulerAngles = new Vector3(ConvertRange(entry.Value, 0, 65535, 20, -20), StickHandle.transform.localEulerAngles.y, StickHandle.transform.localEulerAngles.z); + break; + + case "RotationZ": + StickHandle.transform.localEulerAngles = new Vector3(StickHandle.transform.localEulerAngles.x, StickHandle.transform.localEulerAngles.y, ConvertRange(entry.Value, 65535, 0, -20, 20)); + break; + + /*case "Sliders0": + Throttle.transform.localEulerAngles = new Vector3(ConvertRange(entry.Value, 0, 65535, 30, -85), Throttle.transform.localEulerAngles.y, Throttle.transform.localEulerAngles.z); + break;*/ + } + } + } + + public static float ConvertRange( + double value, // value to convert + double originalStart, double originalEnd, // original range + double newStart, double newEnd) // desired range + { + double scale = (double)(newEnd - newStart) / (originalEnd - originalStart); + return (float)(newStart + ((value - originalStart) * scale)); + } + +} diff --git a/JoystickVisualizer/Assets/Models/Thrustmaster T16000M Duo - Left/T16000MDuoLeft.cs.meta b/JoystickVisualizer/Assets/Models/Thrustmaster T16000M Duo - Left/T16000MDuoLeft.cs.meta new file mode 100644 index 0000000..2e33831 --- /dev/null +++ b/JoystickVisualizer/Assets/Models/Thrustmaster T16000M Duo - Left/T16000MDuoLeft.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 1d1244e3fa1ee1c489483f71da248af3 +timeCreated: 1509721627 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/JoystickVisualizer/Assets/Models/Thrustmaster T16000M Duo - Right.meta b/JoystickVisualizer/Assets/Models/Thrustmaster T16000M Duo - Right.meta new file mode 100644 index 0000000..cc52a82 --- /dev/null +++ b/JoystickVisualizer/Assets/Models/Thrustmaster T16000M Duo - Right.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d18e04f4a122d704baa724507fb4a5ec +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/JoystickVisualizer/Assets/Models/Thrustmaster T16000M Duo - Right/T16000MDuoRight.cs b/JoystickVisualizer/Assets/Models/Thrustmaster T16000M Duo - Right/T16000MDuoRight.cs new file mode 100644 index 0000000..9965704 --- /dev/null +++ b/JoystickVisualizer/Assets/Models/Thrustmaster T16000M Duo - Right/T16000MDuoRight.cs @@ -0,0 +1,71 @@ +using Assets; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class T16000MDuoRight : MonoBehaviour { + public const string USB_ID = "044f:b10a right"; + + //private static string USB_ID = "044f:0402"; // TM Stick (test) + //private static string USB_ID = "044f:0404"; // TM Throttle (test) + + public GameObject Model; + public GameObject StickHandle; + + // Use this for initialization + void Start() + { + UDPListener.StickEventListener += StickEvent; + } + + // Update is called once per frame + void Update() + { + } + + void StickEvent(JoystickState state) + { + if (state.UsbID != USB_ID) + { + return; + } + + Model.SetActive(true); + + foreach (KeyValuePair entry in state.Data) + { + switch (entry.Key) + { + case "Connected": + if (Model.activeInHierarchy) + Model.SetActive(entry.Value == 1); + break; + + case "X": + StickHandle.transform.localEulerAngles = new Vector3(StickHandle.transform.localEulerAngles.x, ConvertRange(entry.Value, 0, 65535, -20, 20), StickHandle.transform.localEulerAngles.z); + break; + case "Y": + StickHandle.transform.localEulerAngles = new Vector3(ConvertRange(entry.Value, 0, 65535, 20, -20), StickHandle.transform.localEulerAngles.y, StickHandle.transform.localEulerAngles.z); + break; + + case "RotationZ": + StickHandle.transform.localEulerAngles = new Vector3(StickHandle.transform.localEulerAngles.x, StickHandle.transform.localEulerAngles.y, ConvertRange(entry.Value, 0, 65535, -20, 20)); + break; + + /*case "Sliders0": + Throttle.transform.localEulerAngles = new Vector3(ConvertRange(entry.Value, 0, 65535, 30, -85), Throttle.transform.localEulerAngles.y, Throttle.transform.localEulerAngles.z); + break;*/ + } + } + } + + public static float ConvertRange( + double value, // value to convert + double originalStart, double originalEnd, // original range + double newStart, double newEnd) // desired range + { + double scale = (double)(newEnd - newStart) / (originalEnd - originalStart); + return (float)(newStart + ((value - originalStart) * scale)); + } + +} diff --git a/JoystickVisualizer/Assets/Models/Thrustmaster T16000M Duo - Right/T16000MDuoRight.cs.meta b/JoystickVisualizer/Assets/Models/Thrustmaster T16000M Duo - Right/T16000MDuoRight.cs.meta new file mode 100644 index 0000000..f2ab4ac --- /dev/null +++ b/JoystickVisualizer/Assets/Models/Thrustmaster T16000M Duo - Right/T16000MDuoRight.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: e46bbeaa6e04bbc4e936ea34b0446cc2 +timeCreated: 1509721627 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/JoystickVisualizer/Assets/Scenes/JoystickVisualizer.unity b/JoystickVisualizer/Assets/Scenes/JoystickVisualizer.unity index ea895ff..d574743 100644 Binary files a/JoystickVisualizer/Assets/Scenes/JoystickVisualizer.unity and b/JoystickVisualizer/Assets/Scenes/JoystickVisualizer.unity differ diff --git a/JoystickVisualizer/ProjectSettings/InputManager.asset b/JoystickVisualizer/ProjectSettings/InputManager.asset index 5799a17..358935b 100644 Binary files a/JoystickVisualizer/ProjectSettings/InputManager.asset and b/JoystickVisualizer/ProjectSettings/InputManager.asset differ diff --git a/JoystickVisualizer/ProjectSettings/PackageManagerSettings.asset b/JoystickVisualizer/ProjectSettings/PackageManagerSettings.asset index 8a409a7..102c612 100644 --- a/JoystickVisualizer/ProjectSettings/PackageManagerSettings.asset +++ b/JoystickVisualizer/ProjectSettings/PackageManagerSettings.asset @@ -12,18 +12,19 @@ MonoBehaviour: m_Script: {fileID: 13964, guid: 0000000000000000e000000000000000, type: 0} m_Name: m_EditorClassIdentifier: - m_EnablePreviewPackages: 0 + m_EnablePreReleasePackages: 0 m_EnablePackageDependencies: 0 m_AdvancedSettingsExpanded: 1 m_ScopedRegistriesSettingsExpanded: 1 + m_SeeAllPackageVersions: 0 oneTimeWarningShown: 0 m_Registries: - m_Id: main m_Name: - m_Url: https://staging-packages.unity.com + m_Url: https://packages.unity.com m_Scopes: [] m_IsDefault: 1 - m_Capabilities: 0 + m_Capabilities: 7 m_UserSelectedRegistryName: m_UserAddingNewScopedRegistry: 0 m_RegistryInfoDraft: @@ -41,3 +42,4 @@ MonoBehaviour: m_Scopes: - m_SelectedScopeIndex: 0 + m_LoadAssets: 0 diff --git a/JoystickVisualizer/ProjectSettings/ProjectSettings.asset b/JoystickVisualizer/ProjectSettings/ProjectSettings.asset index bd76f78..875f8ae 100644 Binary files a/JoystickVisualizer/ProjectSettings/ProjectSettings.asset and b/JoystickVisualizer/ProjectSettings/ProjectSettings.asset differ diff --git a/JoystickVisualizer/ProjectSettings/QualitySettings.asset b/JoystickVisualizer/ProjectSettings/QualitySettings.asset index ee2f339..5b385fd 100644 Binary files a/JoystickVisualizer/ProjectSettings/QualitySettings.asset and b/JoystickVisualizer/ProjectSettings/QualitySettings.asset differ diff --git a/JoystickVisualizer/UserSettings/EditorUserSettings.asset b/JoystickVisualizer/UserSettings/EditorUserSettings.asset index b48ae81..c863cae 100644 --- a/JoystickVisualizer/UserSettings/EditorUserSettings.asset +++ b/JoystickVisualizer/UserSettings/EditorUserSettings.asset @@ -12,11 +12,14 @@ EditorUserSettings: value: 224247031146467102171f36192054261f040d2b20213c353f67083debf42d flags: 0 RecentlyUsedScenePath-2: - value: 22424703114646680e0b0227036c751f0f040c232f2310393e3c1c3febfa312aacf238e0f323 + value: 224247031146467508193a2b03365e1c1f0d1d38623d28393930 flags: 0 RecentlyUsedScenePath-3: value: 22424703114646680e0b0227036c72111f19352f223d68252320092a flags: 0 + RecentlyUsedScenePath-4: + value: 22424703114646680e0b0227036c751f0f040c232f2310393e3c1c3febfa312aacf238e0f323 + flags: 0 UnityEditor.ShaderGraph.FloatingWindowsLayout: value: 181344140043005e1a220d3b1f364b524c0c5a27130c293326201334cee5322ca0bd30e8eb293a707b0fd0180b3d0a36fc0d3d04e649500d1002ee0b5dbd1d2c27c00ad113cb1e10e41f1addc80993b98c9884a69ae6d8f0d1cda9e8fbfefaf9f9dea3fdb9ade882f0fbb0e1e380cafbf2c3adc18e9cd285a2908b80e88a9c8395949c9483d3888c97ddbd90eed2a5a892a2af949aa48bafb19f85bd75a7ed3a7d25658598b7b58bb4b76aaf777690ca2863946c72c6cd81b6b6708f9f879f88769589d91c8f888e64d20f935e796571755c6b546677696a486c781c073c713d756a66771753783a27353f4c504172674347264e2e7a16016a711e4d7d5f686758400216064d1b4f487873735e6d726f6b3f577c7d47786579002d5170ed3627f73426d6f730ff32e8f9df0bea067daaedb5e048565b50474359b151db824e4b94905899da07 flags: 0 diff --git a/JoystickVisualizer/UserSettings/Search.index b/JoystickVisualizer/UserSettings/Search.index new file mode 100644 index 0000000..299c246 --- /dev/null +++ b/JoystickVisualizer/UserSettings/Search.index @@ -0,0 +1,13 @@ +{ + "name": "Assets", + "roots": ["Assets"], + "includes": [], + "excludes": ["Temp/", "External/"], + "options": { + "types": true, + "properties": false, + "extended": false, + "dependencies": false + }, + "baseScore": 999 +} \ No newline at end of file diff --git a/JoystickVisualizer/UserSettings/Search.settings b/JoystickVisualizer/UserSettings/Search.settings index 9e26dfe..745041e 100644 --- a/JoystickVisualizer/UserSettings/Search.settings +++ b/JoystickVisualizer/UserSettings/Search.settings @@ -1 +1,66 @@ -{} \ No newline at end of file +trackSelection = true +fetchPreview = true +wantsMore = false +keepOpen = false +itemIconSize = 1 +queryFolder = "Assets" +onBoardingDoNotAskAgain = true +showPackageIndexes = false +showStatusBar = false +scopes = { + "last_search.785D90A9" = "deep profile" + "asset.785D90A9" = "True" + "menu.785D90A9" = "True" + "scene.785D90A9" = "True" + "settings.785D90A9" = "True" + "m_ShownPanels.785D90A9" = "3" + "m_SideBarSplitter.785D90A9" = "180" + "m_DetailsPanelSplitter.785D90A9" = "700" + "currentGroup.785D90A9" = "all" + "last_search.7F95D817" = "ref:\"Assets/Models/Thrustmaster Pendular Rudder/ThrustmasterPendularRudder.cs\"" + "m_ShownPanels.7F95D817" = "3" + "m_SideBarSplitter.7F95D817" = "180" + "m_DetailsPanelSplitter.7F95D817" = "700" + "currentGroup.7F95D817" = "scene" +} +providers = { + asset = { + active = true + priority = 25 + defaultAction = null + } + store = { + active = true + priority = 100 + defaultAction = null + } + find = { + active = true + priority = 25 + defaultAction = null + } + log = { + active = false + priority = 210 + defaultAction = null + } + packages = { + active = true + priority = 90 + defaultAction = null + } + scene = { + active = true + priority = 50 + defaultAction = null + } + query = { + active = true + priority = 100 + defaultAction = null + } +} +recentSearches = [ + "ref:\"Assets/Models/Thrustmaster Pendular Rudder/ThrustmasterPendularRudder.cs\"" +] +savedSearchesSortOrder = 0 \ No newline at end of file diff --git a/README.md b/README.md index fb950b3..4e65f76 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,15 @@ -# This project is no longer maintained +# This project is currently being maintained by Wolx Stein +For request please post an issue -Issues will not be attended, the code is provided as is for anyone who wants to try and improve it themselves +# The original developer is papapiishu and the original GitHub is in here: +[Original Joystick Visualizer v0.12.0](https://github.com/mdjarv/JoystickVisualizer) # Joystick Visualizer -[![GitHub release](https://img.shields.io/github/release/mdjarv/joystickvisualizer.svg)](https://github.com/mdjarv/JoystickVisualizer/releases/latest) -[![Donate](https://img.shields.io/badge/Tip%20Jar-PayPal-green.svg)](http://paypal.me/mdjarv) -[![Discord](https://img.shields.io/badge/Discord-Chat-blue.svg)](https://discord.gg/4nc3XtQ) +[![GitHub release](https://img.shields.io/github/release/WolxStein/joystickvisualizer.svg)](https://github.com/WolxStein/JoystickVisualizer/releases/latest) Show your stick and throttle movement as an overlay while streaming or recording videos. -### **[Download latest release here](https://github.com/mdjarv/JoystickVisualizer/releases/latest)** +### **[Download latest release here](https://github.com/WolxStein/JoystickVisualizer/releases/latest)** This software will read buttons and axis input from supported devices and visualize them using 3D models on top of a flat colored background making it easy to apply chroma key and placing them as overlays using streaming software like OBS or XSplit @@ -33,11 +33,13 @@ This software will read buttons and axis input from supported devices and visual * Thrustmaster Warthog Throttle * Thrustmaster T.Flight Rudder * Thrustmaster T16000M +* Thrustmaster T.Flight HOTAS 1 (Using Warthog 3D model) +* Thrustmaster T.Flight HOTAS 4 (Using Warthog 3D model) * Thrustmaster T.Flight HOTAS X (Using Warthog 3D model) * VKB Gunfighter (Using Warthog 3D model) * Virpil Mongoos T-50 (Using Warthog 3D model) -If you want to get in contact with me hop on my [Discord](https://discord.gg/4nc3XtQ) server and say hello or tweet me [@papapiishu](https://twitter.com/papapiishu) +Contact me at [@wolx_stein](https://twitter.com/wolx_stein) ## Setting it up @@ -45,11 +47,11 @@ If you want to get in contact with me hop on my [Discord](https://discord.gg/4nc * Start `JoystickProxy.exe`, you will see a list of found devices. If your device is in the [Supported Devices](#supported-devices) list but does not show, check the "`Show all devices`" checkbox and contact me so that we can figure out what the issue is. -![Proxy Window](https://raw.githubusercontent.com/mdjarv/JoystickVisualizer/master/proxy_window.png) +![Proxy Window](https://raw.githubusercontent.com/WolxStein/JoystickVisualizer/master/proxy_window.png) * Start `JoystickVisualizer.exe`, select your resolution and make sure to run in Windowed Mode -![Visualizer Window](https://raw.githubusercontent.com/mdjarv/JoystickVisualizer/master/visualizer_window.png) +![Visualizer Window](https://raw.githubusercontent.com/WolxStein/JoystickVisualizer/master/visualizer_window.png) Your devices should show up in the Visualizer when you start moving them @@ -57,27 +59,27 @@ Your devices should show up in the Visualizer when you start moving them 1. In OBS add a `Window Capture` source, give it a useful name like "Joystick Visualizer" -![Add Window Capture Source](https://raw.githubusercontent.com/mdjarv/JoystickVisualizer/master/obs_1_add_window_capture.png) +![Add Window Capture Source](https://raw.githubusercontent.com/WolxStein/JoystickVisualizer/master/obs_1_add_window_capture.png) 2. Make sure you select `JoystickVisualizer.exe` and you can also uncheck "Capture Cursor" -![Select Inner Window](https://raw.githubusercontent.com/mdjarv/JoystickVisualizer/master/obs_2_add_window_capture.png) +![Select Inner Window](https://raw.githubusercontent.com/WolxStein/JoystickVisualizer/master/obs_2_add_window_capture.png) 3. Right click on the Source you just created and select `Filters` -![Add filter to source](https://raw.githubusercontent.com/mdjarv/JoystickVisualizer/master/obs_3_sources.png) +![Add filter to source](https://raw.githubusercontent.com/WolxStein/JoystickVisualizer/master/obs_3_sources.png) 4. By clicking the + in the bottom left, add a `Color Key` filter. Change the `Key Color Type` to `Custom Color` -![Setup Color Key filter](https://raw.githubusercontent.com/mdjarv/JoystickVisualizer/master/obs_4_window_capture_filter.png) +![Setup Color Key filter](https://raw.githubusercontent.com/WolxStein/JoystickVisualizer/master/obs_4_window_capture_filter.png) 5. Click `Select color` and enter `#1e3d5d` in the HTML field -![Select color](https://raw.githubusercontent.com/mdjarv/JoystickVisualizer/master/obs_5_custom_color.png) +![Select color](https://raw.githubusercontent.com/WolxStein/JoystickVisualizer/master/obs_5_custom_color.png) 6. Save and close the filter settings and you should have an overlay with transparent background to move around your Scene -![Placement](https://raw.githubusercontent.com/mdjarv/JoystickVisualizer/master/obs_6_placement.png) +![Placement](https://raw.githubusercontent.com/WolxStein/JoystickVisualizer/master/obs_6_placement.png) ### Controlling the camera @@ -106,9 +108,13 @@ The Visualizer was created in Unity3D, and the Proxy is a normal C# application ## Contact -You can find me on: +You can find the original developer on: -* Discord: https://discord.gg/4nc3XtQ * GitHub: https://github.com/mdjarv * Twitter: [@papapiishu](https://twitter.com/papapiishu "@papapiishu on twitter") * Twitch: [papapiishu](http://www.twitch.tv/papapiishu "papapiishu on Twitch") + +You can find the Wolx Stein on: +* GitHub: https://github.com/WolxStein +* Twitter: [@wolx_stein](https://twitter.com/wolx_stein) +* Twitch: [wolxstein](https://www.twitch.tv/wolxstein "wolxstein on Twitch")