diff --git a/DS4Windows/DS4Control/Mapping.cs b/DS4Windows/DS4Control/Mapping.cs index 133c607..2c6c94d 100644 --- a/DS4Windows/DS4Control/Mapping.cs +++ b/DS4Windows/DS4Control/Mapping.cs @@ -779,28 +779,28 @@ namespace DS4Windows if (absX <= 0.4) { - outputX = 0.414 * absX; + outputX = 0.43 * absX; } else if (absX <= 0.75) { - outputX = absX - 0.24; + outputX = absX - 0.228; } else if (absX > 0.75) { - outputX = (absX * 1.9376) - 0.9376; + outputX = (absX * 1.912) - 0.912; } if (absY <= 0.4) { - outputY = 0.414 * absY; + outputY = 0.43 * absY; } else if (absY <= 0.75) { - outputY = absY - 0.24; + outputY = absY - 0.228; } else if (absY > 0.75) { - outputY = (absY * 1.9376) - 0.9376; + outputY = (absY * 1.912) - 0.912; } dState.LX = (byte)(outputX * signX * 127.5 + 127.5); @@ -2475,12 +2475,12 @@ namespace DS4Windows { int controlnum = DS4ControltoInt(control); - int deadzoneL = 3; - int deadzoneR = 3; - if (getLSDeadzone(device) >= 3) - deadzoneL = 0; - if (getRSDeadzone(device) >= 3) - deadzoneR = 0; + int deadzoneL = 0; + int deadzoneR = 0; + if (getLSDeadzone(device) == 0) + deadzoneL = 3; + if (getRSDeadzone(device) == 0) + deadzoneR = 3; double value = 0.0; int speed = ButtonMouseSensitivity[device]; @@ -3125,49 +3125,49 @@ namespace DS4Windows case DS4Controls.LXNeg: { double angle = cState.LSAngle; - result = cState.LX < 127 && (angle >= 210 && angle <= 330); + result = cState.LX < 127 && (angle >= 112.5 && angle <= 247.5); break; } case DS4Controls.LYNeg: { double angle = cState.LSAngle; - result = cState.LY < 127 && (angle >= 300 || angle <= 60); + result = cState.LY < 127 && (angle >= 22.5 && angle <= 157.5); break; } case DS4Controls.RXNeg: { double angle = cState.RSAngle; - result = cState.RX < 127 && (angle >= 210 && angle <= 330); + result = cState.RX < 127 && (angle >= 112.5 && angle <= 247.5); break; } case DS4Controls.RYNeg: { double angle = cState.RSAngle; - result = cState.RY < 127 && (angle >= 300 || angle <= 60); + result = cState.RY < 127 && (angle >= 22.5 && angle <= 157.5); break; } case DS4Controls.LXPos: { double angle = cState.LSAngle; - result = cState.LX > 127 && (angle >= 30 && angle <= 150); + result = cState.LX > 127 && (angle <= 67.5 || angle >= 292.5); break; } case DS4Controls.LYPos: { double angle = cState.LSAngle; - result = cState.LY > 127 && (angle >= 120 && angle <= 240); + result = cState.LY > 127 && (angle >= 202.5 && angle <= 337.5); break; } case DS4Controls.RXPos: { double angle = cState.RSAngle; - result = cState.RX > 127 && (angle >= 30 && angle <= 150); + result = cState.RX > 127 && (angle <= 67.5 || angle >= 292.5); break; } case DS4Controls.RYPos: { double angle = cState.RSAngle; - result = cState.RY > 127 && (angle >= 120 && angle <= 240); + result = cState.RY > 127 && (angle >= 202.5 && angle <= 337.5); break; } default: break; @@ -3255,7 +3255,7 @@ namespace DS4Windows if (!analog) { double angle = cState.LSAngle; - result = cState.LX < 127 && (angle >= 210 && angle <= 330); + result = cState.LX < 127 && (angle >= 112.5 && angle <= 247.5); } else { @@ -3269,7 +3269,7 @@ namespace DS4Windows if (!analog) { double angle = cState.LSAngle; - result = cState.LY < 127 && (angle >= 300 || angle <= 60); + result = cState.LY < 127 && (angle >= 22.5 && angle <= 157.5); } else { @@ -3283,7 +3283,7 @@ namespace DS4Windows if (!analog) { double angle = cState.RSAngle; - result = cState.RX < 127 && (angle >= 210 && angle <= 330); + result = cState.RX < 127 && (angle >= 112.5 && angle <= 247.5); } else { @@ -3297,7 +3297,7 @@ namespace DS4Windows if (!analog) { double angle = cState.RSAngle; - result = cState.RY < 127 && (angle >= 300 || angle <= 60); + result = cState.RY < 127 && (angle >= 22.5 && angle <= 157.5); } else { @@ -3311,7 +3311,7 @@ namespace DS4Windows if (!analog) { double angle = cState.LSAngle; - result = cState.LX > 127 && (angle >= 30 && angle <= 150); + result = cState.LX > 127 && (angle <= 67.5 || angle >= 292.5); } else { @@ -3325,7 +3325,7 @@ namespace DS4Windows if (!analog) { double angle = cState.LSAngle; - result = cState.LY > 127 && (angle >= 120 && angle <= 240); + result = cState.LY > 127 && (angle >= 202.5 && angle <= 337.5); } else { @@ -3339,7 +3339,7 @@ namespace DS4Windows if (!analog) { double angle = cState.RSAngle; - result = cState.RX > 127 && (angle >= 30 && angle <= 150); + result = cState.RX > 127 && (angle <= 67.5 || angle >= 292.5); } else { @@ -3353,7 +3353,7 @@ namespace DS4Windows if (!analog) { double angle = cState.RSAngle; - result = cState.RY > 127 && (angle >= 120 && angle <= 240); + result = cState.RY > 127 && (angle >= 202.5 && angle <= 337.5); } else { diff --git a/DS4Windows/DS4Forms/Alreadyrunning.Designer.cs b/DS4Windows/DS4Forms/Alreadyrunning.Designer.cs deleted file mode 100644 index 28ebf6e..0000000 --- a/DS4Windows/DS4Forms/Alreadyrunning.Designer.cs +++ /dev/null @@ -1,48 +0,0 @@ -namespace DS4Windows -{ - partial class Alreadyrunning - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.SuspendLayout(); - // - // Alreadyrunning - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(226, 43); - this.Name = "Alreadyrunning"; - this.ShowInTaskbar = false; - this.Text = "Alreadyrunning"; - this.ResumeLayout(false); - - } - - #endregion - - } -} \ No newline at end of file diff --git a/DS4Windows/DS4Forms/Alreadyrunning.cs b/DS4Windows/DS4Forms/Alreadyrunning.cs deleted file mode 100644 index 195af0a..0000000 --- a/DS4Windows/DS4Forms/Alreadyrunning.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Diagnostics; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; - -namespace DS4Windows -{ - public partial class Alreadyrunning : Form - { - Stopwatch sw; - - public Alreadyrunning() - { - InitializeComponent(); - this.WindowState = FormWindowState.Minimized; - Hide(); - Timer t = new Timer(); - t.Start(); - t.Tick += t_Tick; - sw = new Stopwatch(); - sw.Start(); - } - - void t_Tick(object sender, EventArgs e) - { - if (sw.ElapsedMilliseconds >= 10) - this.Close(); - } - } -} diff --git a/DS4Windows/DS4Forms/Alreadyrunning.resx b/DS4Windows/DS4Forms/Alreadyrunning.resx deleted file mode 100644 index 1af7de1..0000000 --- a/DS4Windows/DS4Forms/Alreadyrunning.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/DS4Windows/DS4Forms/DS4Form.Designer.cs b/DS4Windows/DS4Forms/DS4Form.Designer.cs index 7696707..7ca6929 100644 --- a/DS4Windows/DS4Forms/DS4Form.Designer.cs +++ b/DS4Windows/DS4Forms/DS4Form.Designer.cs @@ -1363,8 +1363,6 @@ this.Controls.Add(this.pnlButton); this.Name = "DS4Form"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ScpForm_Closing); - this.DragDrop += new System.Windows.Forms.DragEventHandler(this.ScpForm_DragDrop); - this.DragEnter += new System.Windows.Forms.DragEventHandler(this.ScpForm_DragEnter); this.Resize += new System.EventHandler(this.Form_Resize); this.pnlButton.ResumeLayout(false); this.pnlButton.PerformLayout(); diff --git a/DS4Windows/DS4Forms/DS4Form.cs b/DS4Windows/DS4Forms/DS4Form.cs index 4ecede8..25359e5 100644 --- a/DS4Windows/DS4Forms/DS4Form.cs +++ b/DS4Windows/DS4Forms/DS4Form.cs @@ -402,6 +402,11 @@ namespace DS4Windows populateHoverTextDict(); + cBController1.KeyPress += CBController_KeyPress; + cBController2.KeyPress += CBController_KeyPress; + cBController3.KeyPress += CBController_KeyPress; + cBController4.KeyPress += CBController_KeyPress; + foreach (Control control in fLPSettings.Controls) { if (control.HasChildren) @@ -449,7 +454,8 @@ namespace DS4Windows { if (Index < ControlService.DS4_CONTROLLER_COUNT) { - statPB[Index].Visible = false; toolTip1.SetToolTip(statPB[Index], ""); + statPB[Index].Visible = false; + toolTip1.SetToolTip(statPB[Index], ""); Batteries[Index].Text = Properties.Resources.NA; Pads[Index].Text = Properties.Resources.Disconnected; Enable_Controls(Index, false); @@ -594,10 +600,24 @@ namespace DS4Windows turnOffTemp = true; if (btnStartStop.Text == Properties.Resources.StopText) { - BtnStartStop_Clicked(); - hotkeysTimer.Start(); - autoProfilesTimer.Start(); - btnStartStop.Text = Properties.Resources.StartText; + autoProfilesTimer.Stop(); + hotkeysTimer.Stop(); + + this.Invoke((System.Action)(() => { + this.changingService = true; + BtnStartStop_Clicked(); + })); + + while (this.changingService) + { + Thread.SpinWait(500); + } + + this.Invoke((System.Action)(() => + { + hotkeysTimer.Start(); + autoProfilesTimer.Start(); + })); } } @@ -620,8 +640,10 @@ namespace DS4Windows turnOffTemp = false; if (btnStartStop.Text == Properties.Resources.StartText) { - BtnStartStop_Clicked(); - btnStartStop.Text = Properties.Resources.StopText; + this.BeginInvoke((System.Action)(() => + { + BtnStartStop_Clicked(); + })); } } } @@ -1836,31 +1858,6 @@ Properties.Resources.DS4Update, MessageBoxButtons.YesNo, MessageBoxIcon.Question } } - private void ScpForm_DragDrop(object sender, DragEventArgs e) - { - bool therewasanxml = false; - string[] files = (string[])e.Data.GetData(DataFormats.FileDrop, false); - for (int i = 0; i < files.Length; i++) - { - if (files[i].EndsWith(".xml")) - { - File.Copy(files[i], appdatapath + "\\Profiles\\" + Path.GetFileName(files[i]), true); - therewasanxml = true; - } - } - - if (therewasanxml) - RefreshProfiles(); - } - - private void ScpForm_DragEnter(object sender, DragEventArgs e) - { - if (e.Data.GetDataPresent(DataFormats.FileDrop)) - e.Effect = DragDropEffects.Copy; // Okay - else - e.Effect = DragDropEffects.None; // Unknown data, ignore it - } - private void tBProfile_TextChanged(object sender, EventArgs e) { if (tSTBProfile.Text != null && tSTBProfile.Text != "" && @@ -2517,6 +2514,11 @@ Properties.Resources.DS4Update, MessageBoxButtons.YesNo, MessageBoxIcon.Question Save(); } + private void CBController_KeyPress(object sender, KeyPressEventArgs e) + { + e.Handled = true; + } + private void cBFlashWhenLate_CheckedChanged(object sender, EventArgs e) { FlashWhenLate = cBFlashWhenLate.Checked; diff --git a/DS4Windows/DS4Forms/DS4Form.resx b/DS4Windows/DS4Forms/DS4Form.resx index b462c53..6576b6f 100644 --- a/DS4Windows/DS4Forms/DS4Form.resx +++ b/DS4Windows/DS4Forms/DS4Form.resx @@ -445,10 +445,10 @@ NoControl - 780, 89 + 774, 89 - 113, 22 + 119, 22 50 @@ -472,7 +472,7 @@ NoControl - 371, 34 + 367, 34 39, 20 @@ -574,7 +574,7 @@ NoControl - 740, 89 + 734, 89 34, 22 @@ -604,7 +604,7 @@ NoControl - 740, 117 + 734, 117 34, 22 @@ -703,7 +703,7 @@ None - 623, 33 + 617, 33 111, 21 @@ -730,7 +730,7 @@ NoControl - 740, 61 + 734, 61 34, 22 @@ -757,7 +757,7 @@ None - 623, 61 + 617, 61 111, 21 @@ -781,7 +781,7 @@ None - 623, 89 + 617, 89 111, 21 @@ -808,7 +808,7 @@ NoControl - 740, 33 + 734, 33 34, 22 @@ -835,7 +835,7 @@ None - 623, 117 + 617, 117 111, 21 @@ -868,7 +868,7 @@ NoControl - 624, 7 + 618, 7 109, 15 @@ -940,7 +940,7 @@ NoControl - 367, 7 + 363, 7 47, 15 @@ -976,7 +976,7 @@ NoControl - 467, 7 + 461, 7 51, 15 @@ -1012,7 +1012,7 @@ NoControl - 473, 36 + 467, 36 39, 15 @@ -1048,7 +1048,7 @@ NoControl - 473, 64 + 467, 64 39, 15 @@ -1084,7 +1084,7 @@ NoControl - 473, 92 + 467, 92 39, 15 @@ -1120,7 +1120,7 @@ NoControl - 473, 120 + 467, 120 39, 15 @@ -1150,7 +1150,7 @@ NoControl - 371, 62 + 367, 62 39, 20 @@ -1180,7 +1180,7 @@ NoControl - 371, 90 + 367, 90 39, 20 @@ -1210,7 +1210,7 @@ NoControl - 371, 118 + 367, 118 39, 20 @@ -1243,10 +1243,10 @@ NoControl - 780, 33 + 774, 33 - 113, 22 + 119, 22 50 @@ -1273,10 +1273,10 @@ NoControl - 780, 61 + 774, 61 - 113, 22 + 119, 22 51 @@ -1303,10 +1303,10 @@ NoControl - 780, 117 + 774, 117 - 113, 22 + 119, 22 52 @@ -1336,7 +1336,7 @@ NoControl - 546, 0 + 540, 0 67, 30 @@ -1375,7 +1375,7 @@ NoControl - 572, 37 + 566, 37 15, 14 @@ -1408,7 +1408,7 @@ NoControl - 572, 65 + 566, 65 15, 14 @@ -1441,7 +1441,7 @@ NoControl - 572, 93 + 566, 93 15, 14 @@ -1474,7 +1474,7 @@ NoControl - 572, 121 + 566, 121 15, 14 @@ -1522,7 +1522,7 @@ 0 - <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="bnLight3" Row="3" RowSpan="1" Column="6" ColumnSpan="1" /><Control Name="pBStatus1" Row="1" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="lbPad1" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="lbPad2" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="bnEditC3" Row="3" RowSpan="1" Column="5" ColumnSpan="1" /><Control Name="bnEditC4" Row="4" RowSpan="1" Column="5" ColumnSpan="1" /><Control Name="lbPad3" Row="3" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="lbPad4" Row="4" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="cBController1" Row="1" RowSpan="1" Column="4" ColumnSpan="1" /><Control Name="bnEditC2" Row="2" RowSpan="1" Column="5" ColumnSpan="1" /><Control Name="cBController2" Row="2" RowSpan="1" Column="4" ColumnSpan="1" /><Control Name="cBController3" Row="3" RowSpan="1" Column="4" ColumnSpan="1" /><Control Name="bnEditC1" Row="1" RowSpan="1" Column="5" ColumnSpan="1" /><Control Name="cBController4" Row="4" RowSpan="1" Column="4" ColumnSpan="1" /><Control Name="lbSelectedProfile" Row="0" RowSpan="1" Column="4" ColumnSpan="1" /><Control Name="lbID" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="lbStatus" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="lbBattery" Row="0" RowSpan="1" Column="2" ColumnSpan="1" /><Control Name="lbBatt1" Row="1" RowSpan="1" Column="2" ColumnSpan="1" /><Control Name="lbBatt2" Row="2" RowSpan="1" Column="2" ColumnSpan="1" /><Control Name="lbBatt3" Row="3" RowSpan="1" Column="2" ColumnSpan="1" /><Control Name="lbBatt4" Row="4" RowSpan="1" Column="2" ColumnSpan="1" /><Control Name="pBStatus2" Row="2" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="pBStatus3" Row="3" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="pBStatus4" Row="4" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="bnLight1" Row="1" RowSpan="1" Column="6" ColumnSpan="1" /><Control Name="bnLight2" Row="2" RowSpan="1" Column="6" ColumnSpan="1" /><Control Name="bnLight4" Row="4" RowSpan="1" Column="6" ColumnSpan="1" /><Control Name="lbLinkProfile" Row="0" RowSpan="1" Column="3" ColumnSpan="1" /><Control Name="linkCB1" Row="1" RowSpan="1" Column="3" ColumnSpan="1" /><Control Name="linkCB2" Row="2" RowSpan="1" Column="3" ColumnSpan="1" /><Control Name="linkCB3" Row="3" RowSpan="1" Column="3" ColumnSpan="1" /><Control Name="linkCB4" Row="4" RowSpan="1" Column="3" ColumnSpan="1" /></Controls><Columns Styles="Percent,62.29144,Percent,20.02225,Percent,17.68632,Absolute,80,AutoSize,0,AutoSize,0,Absolute,117" /><Rows Styles="AutoSize,0,Percent,25,Percent,25,Percent,25,Percent,25" /></TableLayoutSettings> + <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="bnLight3" Row="3" RowSpan="1" Column="6" ColumnSpan="1" /><Control Name="pBStatus1" Row="1" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="lbPad1" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="lbPad2" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="bnEditC3" Row="3" RowSpan="1" Column="5" ColumnSpan="1" /><Control Name="bnEditC4" Row="4" RowSpan="1" Column="5" ColumnSpan="1" /><Control Name="lbPad3" Row="3" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="lbPad4" Row="4" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="cBController1" Row="1" RowSpan="1" Column="4" ColumnSpan="1" /><Control Name="bnEditC2" Row="2" RowSpan="1" Column="5" ColumnSpan="1" /><Control Name="cBController2" Row="2" RowSpan="1" Column="4" ColumnSpan="1" /><Control Name="cBController3" Row="3" RowSpan="1" Column="4" ColumnSpan="1" /><Control Name="bnEditC1" Row="1" RowSpan="1" Column="5" ColumnSpan="1" /><Control Name="cBController4" Row="4" RowSpan="1" Column="4" ColumnSpan="1" /><Control Name="lbSelectedProfile" Row="0" RowSpan="1" Column="4" ColumnSpan="1" /><Control Name="lbID" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="lbStatus" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="lbBattery" Row="0" RowSpan="1" Column="2" ColumnSpan="1" /><Control Name="lbBatt1" Row="1" RowSpan="1" Column="2" ColumnSpan="1" /><Control Name="lbBatt2" Row="2" RowSpan="1" Column="2" ColumnSpan="1" /><Control Name="lbBatt3" Row="3" RowSpan="1" Column="2" ColumnSpan="1" /><Control Name="lbBatt4" Row="4" RowSpan="1" Column="2" ColumnSpan="1" /><Control Name="pBStatus2" Row="2" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="pBStatus3" Row="3" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="pBStatus4" Row="4" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="bnLight1" Row="1" RowSpan="1" Column="6" ColumnSpan="1" /><Control Name="bnLight2" Row="2" RowSpan="1" Column="6" ColumnSpan="1" /><Control Name="bnLight4" Row="4" RowSpan="1" Column="6" ColumnSpan="1" /><Control Name="lbLinkProfile" Row="0" RowSpan="1" Column="3" ColumnSpan="1" /><Control Name="linkCB1" Row="1" RowSpan="1" Column="3" ColumnSpan="1" /><Control Name="linkCB2" Row="2" RowSpan="1" Column="3" ColumnSpan="1" /><Control Name="linkCB3" Row="3" RowSpan="1" Column="3" ColumnSpan="1" /><Control Name="linkCB4" Row="4" RowSpan="1" Column="3" ColumnSpan="1" /></Controls><Columns Styles="Percent,62.29144,Percent,20.02225,Percent,17.68632,Absolute,80,AutoSize,0,AutoSize,0,Absolute,124" /><Rows Styles="AutoSize,0,Percent,25,Percent,25,Percent,25,Percent,25" /></TableLayoutSettings> Fill @@ -2833,7 +2833,7 @@ languagePackComboBox1 - DS4Windows.DS4Forms.LanguagePackComboBox, DS4Windows, Version=1.4.119.0, Culture=neutral, PublicKeyToken=null + DS4Windows.DS4Forms.LanguagePackComboBox, DS4Windows, Version=1.4.120.0, Culture=neutral, PublicKeyToken=null fLPSettings @@ -3673,7 +3673,7 @@ advColorDialog - DS4Windows.AdvancedColorDialog, DS4Windows, Version=1.4.119.0, Culture=neutral, PublicKeyToken=null + DS4Windows.AdvancedColorDialog, DS4Windows, Version=1.4.120.0, Culture=neutral, PublicKeyToken=null DS4Form diff --git a/DS4Windows/DS4Forms/WinProgs.cs b/DS4Windows/DS4Forms/WinProgs.cs index c4bccac..13f4084 100644 --- a/DS4Windows/DS4Forms/WinProgs.cs +++ b/DS4Windows/DS4Forms/WinProgs.cs @@ -25,6 +25,10 @@ namespace DS4Windows List programpaths = new List(); List lodsf = new List(); bool appsloaded = false; + const string steamCommx86Loc = @"C:\Program Files (x86)\Steam\steamapps\common"; + const string steamCommLoc = @"C:\Program Files\Steam\steamapps\common"; + const string originx86Loc = @"C:\Program Files (x86)\Origin Games"; + const string originLoc = @"C:\Program Files\Origin Games"; public WinProgs(string[] oc, DS4Form main) { @@ -44,17 +48,17 @@ namespace DS4Windows LoadP(); - if (Directory.Exists(@"C:\Program Files (x86)\Steam\steamapps\common")) - steamgamesdir = @"C:\Program Files (x86)\Steam\steamapps\common"; - else if (Directory.Exists(@"C:\Program Files\Steam\steamapps\common")) - steamgamesdir = @"C:\Program Files\Steam\steamapps\common"; + if (Directory.Exists(steamCommx86Loc)) + steamgamesdir = steamCommx86Loc; + else if (Directory.Exists(steamCommLoc)) + steamgamesdir = steamCommLoc; else cMSPrograms.Items.Remove(addSteamGamesToolStripMenuItem); - if (Directory.Exists(@"C:\Program Files (x86)\Origin Games")) - origingamesdir = @"C:\Program Files (x86)\Origin Games"; - else if (Directory.Exists(@"C:\Program Files\Origin Games")) - origingamesdir = @"C:\Program Files\Origin Games"; + if (Directory.Exists(originx86Loc)) + origingamesdir = originx86Loc; + else if (Directory.Exists(originLoc)) + origingamesdir = originLoc; else cMSPrograms.Items.Remove(addOriginGamesToolStripMenuItem); } @@ -105,26 +109,26 @@ namespace DS4Windows programpaths.Add(x.Attributes["path"].Value); lVPrograms.BeginUpdate(); + int index = 0; foreach (string st in programpaths) { - if (File.Exists(st)) + if (!string.IsNullOrEmpty(st)) { - int index = programpaths.IndexOf(st); - if (string.Empty != st) + if (File.Exists(st)) { iLIcons.Images.Add(Icon.ExtractAssociatedIcon(st)); - ListViewItem lvi = new ListViewItem(Path.GetFileNameWithoutExtension(st), index); - lvi.SubItems.Add(st); - lvi.Checked = true; - lvi.ToolTipText = st; - lVPrograms.Items.Add(lvi); } + + ListViewItem lvi = new ListViewItem(Path.GetFileNameWithoutExtension(st), index); + lvi.Checked = true; + lvi.ToolTipText = st; + lvi.SubItems.Add(st); + lVPrograms.Items.Add(lvi); } - else - { - RemoveP(st, false, false); - } + + index++; } + lVPrograms.EndUpdate(); } @@ -172,7 +176,7 @@ namespace DS4Windows appsloaded = true; } - void addLoadedApps() + void AddLoadedApps() { if (appsloaded) { @@ -298,7 +302,7 @@ namespace DS4Windows } } - public void RemoveP(string name, bool uncheck, bool reload = true) + public void RemoveP(string name, bool uncheck) { XmlDocument doc = new XmlDocument(); doc.Load(m_Profile); @@ -316,8 +320,6 @@ namespace DS4Windows cbs[i].SelectedIndex = cbs[i].Items.Count - 1; bnSave.Enabled = false; - if (reload) - form.LoadP(); } private void CBProfile_IndexChanged(object sender, EventArgs e) @@ -388,7 +390,7 @@ namespace DS4Windows bnAddPrograms.Enabled = false; cMSPrograms.Items.Remove(addSteamGamesToolStripMenuItem); await Task.Run(() => GetApps(steamgamesdir)); - addLoadedApps(); + AddLoadedApps(); } private async void addDirectoryToolStripMenuItem_Click(object sender, EventArgs e) @@ -399,7 +401,7 @@ namespace DS4Windows bnAddPrograms.Text = Properties.Resources.Loading; bnAddPrograms.Enabled = false; await Task.Run(() => GetApps(fbd.SelectedPath)); - addLoadedApps(); + AddLoadedApps(); } } @@ -427,7 +429,7 @@ namespace DS4Windows bnAddPrograms.Enabled = false; cMSPrograms.Items.Remove(addOriginGamesToolStripMenuItem); await Task.Run(() => GetApps(origingamesdir)); - addLoadedApps(); + AddLoadedApps(); } private async void addProgramsFromStartMenuToolStripMenuItem_Click(object sender, EventArgs e) @@ -436,7 +438,7 @@ namespace DS4Windows bnAddPrograms.Enabled = false; cMSPrograms.Items.Remove(addProgramsFromStartMenuToolStripMenuItem); await Task.Run(() => GetShortcuts(Environment.GetFolderPath(Environment.SpecialFolder.StartMenu) + "\\Programs")); - addLoadedApps(); + AddLoadedApps(); } public static string GetTargetPath(string filePath) diff --git a/DS4Windows/DS4Library/DS4Devices.cs b/DS4Windows/DS4Library/DS4Devices.cs index 4ff8d6e..d0e7199 100644 --- a/DS4Windows/DS4Library/DS4Devices.cs +++ b/DS4Windows/DS4Library/DS4Devices.cs @@ -40,7 +40,8 @@ namespace DS4Windows new VidPidInfo(SONY_VID, 0x09CC), new VidPidInfo(RAZER_VID, 0x1000), new VidPidInfo(NACON_VID, 0x0D01), - new VidPidInfo(HORI_VID, 0x00EE) // Hori PS4 Mini Wired Gamepad + new VidPidInfo(HORI_VID, 0x00EE), // Hori PS4 Mini Wired Gamepad + new VidPidInfo(0x7545, 0x0104) }; private static string devicePathToInstanceId(string devicePath) diff --git a/DS4Windows/DS4Library/DS4State.cs b/DS4Windows/DS4Library/DS4State.cs index 2978c2c..7400f15 100644 --- a/DS4Windows/DS4Library/DS4State.cs +++ b/DS4Windows/DS4Library/DS4State.cs @@ -183,19 +183,19 @@ namespace DS4Windows public void calculateStickAngles() { - double lsangle = Math.Atan2((LX - 127), -(LY - 127)); + double lsangle = Math.Atan2(-(LY - 127), (LX - 127)); LSAngleRad = lsangle; lsangle = (lsangle >= 0 ? lsangle : (2 * Math.PI + lsangle)) * 180 / Math.PI; LSAngle = lsangle; LXUnit = Math.Abs(Math.Cos(LSAngleRad)); LYUnit = Math.Abs(Math.Sin(LSAngleRad)); - double rsangle = Math.Atan2((RX - 127), -(RY - 127)); + double rsangle = Math.Atan2(-(RY - 127), (RX - 127)); RSAngleRad = rsangle; rsangle = (rsangle >= 0 ? rsangle : (2 * Math.PI + rsangle)) * 180 / Math.PI; RSAngle = rsangle; RXUnit = Math.Abs(Math.Cos(RSAngleRad)); - RYUnit = Math.Abs(Math.Sin(LSAngleRad)); + RYUnit = Math.Abs(Math.Sin(RSAngleRad)); } public void rotateLSCoordinates(double rotation) diff --git a/DS4Windows/DS4Windows.csproj b/DS4Windows/DS4Windows.csproj index d31b757..1019386 100644 --- a/DS4Windows/DS4Windows.csproj +++ b/DS4Windows/DS4Windows.csproj @@ -181,12 +181,6 @@ - - Form - - - Alreadyrunning.cs - Form @@ -262,9 +256,6 @@ - - Alreadyrunning.cs - DS4Form.cs Designer diff --git a/DS4Windows/Properties/AssemblyInfo.cs b/DS4Windows/Properties/AssemblyInfo.cs index 149f758..b27f271 100644 --- a/DS4Windows/Properties/AssemblyInfo.cs +++ b/DS4Windows/Properties/AssemblyInfo.cs @@ -33,7 +33,7 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.4.120")] -[assembly: AssemblyFileVersion("1.4.120")] +[assembly: AssemblyVersion("1.4.121")] +[assembly: AssemblyFileVersion("1.4.121")] [assembly: NeutralResourcesLanguage("en")] diff --git a/README.md b/README.md index 989a9c3..d01c428 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,15 @@ DS4Windows is an extract anywhere program that allows you to get the best DualSh You can find the latest and older versions [here](https://github.com/Ryochan7/DS4Windows/releases). +UdpServer builds for using Gyro motion controls in Cemu. + +http://ryochan7.xyz/ds4windows/test/DS4Windows_1.4.120_UdpServer_x64.zip +http://ryochan7.xyz/ds4windows/test/DS4Windows_1.4.120_ViGEm_UdpServer_x64.zip + +ViGEm build. + +http://ryochan7.xyz/ds4windows/test/DS4Windows_1.4.120_ViGEm_x64.zip + This project is a fork of the work of Jays2Kings. You can find the old project website at [ds4windows.com](http://ds4windows.com).