diff --git a/DS4Control/Control.cs b/DS4Control/Control.cs index 197d18c..d389158 100644 --- a/DS4Control/Control.cs +++ b/DS4Control/Control.cs @@ -425,7 +425,7 @@ namespace DS4Control if (processingData[ind].Rumble[1] == 0x08) { - setRumble(Small, Big, ind); + setRumble(Big, Small, ind); } } diff --git a/DS4Control/Mapping.cs b/DS4Control/Mapping.cs index b409554..3c825af 100644 --- a/DS4Control/Mapping.cs +++ b/DS4Control/Mapping.cs @@ -665,8 +665,6 @@ namespace DS4Control Global.getShiftCustomKey(device, customButton.Key) == 0 && Global.getShiftCustomButton(device, customButton.Key) == X360Controls.None)) { - if (customButton.Key == DS4Controls.Square) - Console.WriteLine("hello"); DS4KeyType keyType = Global.getCustomKeyType(device, customButton.Key); int keyvalue = 0; switch (customButton.Value) diff --git a/DS4Tool/Options.cs b/DS4Tool/Options.cs index cd500b7..abe812d 100644 --- a/DS4Tool/Options.cs +++ b/DS4Tool/Options.cs @@ -132,6 +132,7 @@ namespace ScpServer nUDIdleDisconnect.Value = Math.Round((decimal)(Global.getIdleDisconnectTimeout(device) / 60d), 1); cBIdleDisconnect.Checked = Global.getIdleDisconnectTimeout(device) > 0; numUDMouseSens.Value = Global.getButtonMouseSensitivity(device); + cBMouseAccel.Checked = Global.getMouseAccel(device); // Force update of color choosers alphacolor = Math.Max(redBar.Value, Math.Max(greenBar.Value, blueBar.Value)); reg = Color.FromArgb(color.red, color.green, color.blue); diff --git a/DS4Tool/Properties/AssemblyInfo.cs b/DS4Tool/Properties/AssemblyInfo.cs index a6c20f9..b02dfd9 100644 --- a/DS4Tool/Properties/AssemblyInfo.cs +++ b/DS4Tool/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.4.0.7")] -[assembly: AssemblyFileVersion("1.4.0.7")] +[assembly: AssemblyVersion("1.4.0.71")] +[assembly: AssemblyFileVersion("1.4.0.71")] diff --git a/DS4Tool/ScpForm.Designer.cs b/DS4Tool/ScpForm.Designer.cs index 637ff3d..dc1915c 100644 --- a/DS4Tool/ScpForm.Designer.cs +++ b/DS4Tool/ScpForm.Designer.cs @@ -889,7 +889,6 @@ this.Controls.Add(this.pnlButton); this.Name = "ScpForm"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ScpForm_Closing); - this.Load += new System.EventHandler(this.Form_Load); 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); diff --git a/DS4Tool/ScpForm.cs b/DS4Tool/ScpForm.cs index 2150993..e8af2a8 100644 --- a/DS4Tool/ScpForm.cs +++ b/DS4Tool/ScpForm.cs @@ -93,6 +93,146 @@ namespace ScpServer if (File.Exists(appdatapath + "\\Profiles.xml")) tt.SetToolTip(linkUninstall, Properties.Resources.IfRemovingDS4Windows); tt.SetToolTip(cBSwipeProfiles, Properties.Resources.TwoFingerSwipe); + { + var AppCollectionThread = new System.Threading.Thread(() => CheckDrivers()); + AppCollectionThread.IsBackground = true; + AppCollectionThread.Start(); + if (File.Exists(exepath + "\\Auto Profiles.xml") + && File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\DS4Tool\\Auto Profiles.xml")) + new SaveWhere(true).ShowDialog(); + else if (File.Exists(exepath + "\\Auto Profiles.xml")) + Global.SaveWhere(exepath); + else if (File.Exists(appdatapath + "\\Auto Profiles.xml")) + Global.SaveWhere(appdatapath); + else if (!File.Exists(exepath + "\\Auto Profiles.xml") + && !File.Exists(appdatapath + "\\Auto Profiles.xml")) + { + new SaveWhere(false).ShowDialog(); + } + + + if (String.IsNullOrEmpty(Global.appdatapath)) + { + Close(); + return; + } + Graphics g = this.CreateGraphics(); + try + { + dpix = g.DpiX; + dpiy = g.DpiY; + } + finally + { + g.Dispose(); + } + Icon = Properties.Resources.DS4; + notifyIcon1.Icon = Properties.Resources.DS4; + rootHub = new DS4Control.Control(); + rootHub.Debug += On_Debug; + Log.GuiLog += On_Debug; + Log.TrayIconLog += ShowNotification; + // tmrUpdate.Enabled = true; TODO remove tmrUpdate and leave tick() + + Directory.CreateDirectory(Global.appdatapath); + Global.Load(); + if (!Global.Save()) //if can't write to file + if (MessageBox.Show("Cannot write at current locataion\nCopy Settings to appdata?", "DS4Windows", + MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.Yes) + { + try + { + Directory.CreateDirectory(appdatapath); + File.Copy(exepath + "\\Profiles.xml", appdatapath + "\\Profiles.xml"); + File.Copy(exepath + "\\Auto Profiles.xml", appdatapath + "\\Auto Profiles.xml"); + Directory.CreateDirectory(appdatapath + "\\Profiles"); + foreach (string s in Directory.GetFiles(exepath + "\\Profiles")) + { + File.Copy(s, appdatapath + "\\Profiles\\" + Path.GetFileName(s)); + } + } + catch { } + MessageBox.Show("Copy complete, please relaunch DS4Windows and remove settings from Program Directory", "DS4Windows"); + Global.appdatapath = null; + Close(); + return; + } + else + { + MessageBox.Show("DS4Windows cannot edit settings here, This will now close", "DS4Windows"); + Global.appdatapath = null; + Close(); + return; + } + foreach (ToolStripMenuItem t in shortcuts) + t.DropDownItemClicked += Profile_Changed_Menu; + hideDS4CheckBox.CheckedChanged -= hideDS4CheckBox_CheckedChanged; + hideDS4CheckBox.Checked = Global.getUseExclusiveMode(); + hideDS4CheckBox.CheckedChanged += hideDS4CheckBox_CheckedChanged; + cBDisconnectBT.Checked = Global.getDCBTatStop(); + // New settings + this.Width = Global.getFormWidth(); + this.Height = Global.getFormHeight(); + startMinimizedCheckBox.CheckedChanged -= startMinimizedCheckBox_CheckedChanged; + startMinimizedCheckBox.Checked = Global.getStartMinimized(); + startMinimizedCheckBox.CheckedChanged += startMinimizedCheckBox_CheckedChanged; + if (startMinimizedCheckBox.Checked) + this.WindowState = FormWindowState.Minimized; + Form_Resize(null, null); + RefreshProfiles(); + for (int i = 0; i < 4; i++) + { + Global.LoadProfile(i, true, rootHub); + } + LoadP(); + Global.ControllerStatusChange += ControllerStatusChange; + bool start = true; + foreach (string s in arguements) + if (s == "stop") + { + start = false; + break; + } + if (btnStartStop.Enabled && start) + btnStartStop_Clicked(); + startToolStripMenuItem.Text = btnStartStop.Text; + cBNotifications.Checked = Global.getNotifications(); + cBSwipeProfiles.Checked = Global.getSwipeProfiles(); + int checkwhen = Global.getCheckWhen(); + cBUpdate.Checked = checkwhen > 0; + if (checkwhen > 23) + { + cBUpdateTime.SelectedIndex = 1; + nUDUpdateTime.Value = checkwhen / 24; + } + else + { + cBUpdateTime.SelectedIndex = 0; + nUDUpdateTime.Value = checkwhen; + } + Uri url = new Uri("http://ds4windows.com/Files/Builds/newest.txt"); //Sorry other devs, gonna have to find your own server + + + if (checkwhen > 0 && DateTime.Now >= Global.getLastChecked() + TimeSpan.FromHours(checkwhen)) + { + wc.DownloadFileAsync(url, Global.appdatapath + "\\version.txt"); + wc.DownloadFileCompleted += Check_Version; + Global.setLastChecked(DateTime.Now); + } + + if (File.Exists(exepath + "\\Updater.exe")) + { + System.Threading.Thread.Sleep(2000); + File.Delete(exepath + "\\Updater.exe"); + } + //test.Start(); + hotkeystimer.Start(); + hotkeystimer.Tick += Hotkeys; + test.Tick += test_Tick; + if (!System.IO.Directory.Exists(Global.appdatapath + "\\Virtual Bus Driver")) + linkUninstall.Visible = false; + StartWindowsCheckBox.Checked = File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.Startup) + "\\DS4Windows.lnk"); + } } public static string GetTopWindowName() @@ -134,149 +274,6 @@ namespace ScpServer } } - protected void Form_Load(object sender, EventArgs e) - { - SetupArrays(); - var AppCollectionThread = new System.Threading.Thread(() => CheckDrivers()); - AppCollectionThread.IsBackground = true; - AppCollectionThread.Start(); - if (File.Exists(exepath + "\\Auto Profiles.xml") - && File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\DS4Tool\\Auto Profiles.xml")) - new SaveWhere(true).ShowDialog(); - else if (File.Exists(exepath + "\\Auto Profiles.xml")) - Global.SaveWhere(exepath); - else if (File.Exists(appdatapath + "\\Auto Profiles.xml")) - Global.SaveWhere(appdatapath); - else if (!File.Exists(exepath + "\\Auto Profiles.xml") - && !File.Exists(appdatapath + "\\Auto Profiles.xml")) - { - new SaveWhere(false).ShowDialog(); - } - - - if (String.IsNullOrEmpty(Global.appdatapath)) - { - Close(); - return; - } - Graphics g = this.CreateGraphics(); - try - { - dpix = g.DpiX; - dpiy = g.DpiY; - } - finally - { - g.Dispose(); - } - Icon = Properties.Resources.DS4; - notifyIcon1.Icon = Properties.Resources.DS4; - rootHub = new DS4Control.Control(); - rootHub.Debug += On_Debug; - Log.GuiLog += On_Debug; - Log.TrayIconLog += ShowNotification; - // tmrUpdate.Enabled = true; TODO remove tmrUpdate and leave tick() - - Directory.CreateDirectory(Global.appdatapath); - Global.Load(); - if (!Global.Save()) //if can't write to file - if (MessageBox.Show("Cannot write at current locataion\nCopy Settings to appdata?", "DS4Windows", - MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.Yes) - { - try - { - Directory.CreateDirectory(appdatapath); - File.Copy(exepath + "\\Profiles.xml", appdatapath + "\\Profiles.xml"); - File.Copy(exepath + "\\Auto Profiles.xml", appdatapath + "\\Auto Profiles.xml"); - Directory.CreateDirectory(appdatapath + "\\Profiles"); - foreach (string s in Directory.GetFiles(exepath + "\\Profiles")) - { - File.Copy(s, appdatapath + "\\Profiles\\" + Path.GetFileName(s)); - } - } - catch { } - MessageBox.Show("Copy complete, please relaunch DS4Windows and remove settings from Program Directory", "DS4Windows"); - Global.appdatapath = null; - Close(); - return; - } - else - { - MessageBox.Show("DS4Windows cannot edit settings here, This will now close", "DS4Windows"); - Global.appdatapath = null; - Close(); - return; - } - foreach (ToolStripMenuItem t in shortcuts) - t.DropDownItemClicked += Profile_Changed_Menu; - hideDS4CheckBox.CheckedChanged -= hideDS4CheckBox_CheckedChanged; - hideDS4CheckBox.Checked = Global.getUseExclusiveMode(); - hideDS4CheckBox.CheckedChanged += hideDS4CheckBox_CheckedChanged; - cBDisconnectBT.Checked = Global.getDCBTatStop(); - // New settings - this.Width = Global.getFormWidth(); - this.Height = Global.getFormHeight(); - startMinimizedCheckBox.CheckedChanged -= startMinimizedCheckBox_CheckedChanged; - startMinimizedCheckBox.Checked = Global.getStartMinimized(); - startMinimizedCheckBox.CheckedChanged += startMinimizedCheckBox_CheckedChanged; - if (startMinimizedCheckBox.Checked) - this.WindowState = FormWindowState.Minimized; - Form_Resize(sender, e); - RefreshProfiles(); - for (int i = 0; i < 4; i++) - { - Global.LoadProfile(i, true, rootHub); - } - LoadP(); - Global.ControllerStatusChange += ControllerStatusChange; - bool start = true; - foreach (string s in arguements) - if (s == "stop") - { - start = false; - break; - } - if (btnStartStop.Enabled && start) - btnStartStop_Clicked(); - startToolStripMenuItem.Text = btnStartStop.Text; - cBNotifications.Checked = Global.getNotifications(); - cBSwipeProfiles.Checked = Global.getSwipeProfiles(); - int checkwhen = Global.getCheckWhen(); - cBUpdate.Checked = checkwhen > 0; - if (checkwhen > 23) - { - cBUpdateTime.SelectedIndex = 1; - nUDUpdateTime.Value = checkwhen / 24; - } - else - { - cBUpdateTime.SelectedIndex = 0; - nUDUpdateTime.Value = checkwhen; - } - Uri url = new Uri("http://ds4windows.com/Files/Builds/newest.txt"); //Sorry other devs, gonna have to find your own server - - - if (checkwhen > 0 && DateTime.Now >= Global.getLastChecked() + TimeSpan.FromHours(checkwhen)) - { - wc.DownloadFileAsync(url, Global.appdatapath + "\\version.txt"); - wc.DownloadFileCompleted += Check_Version; - Global.setLastChecked(DateTime.Now); - } - - if (File.Exists(exepath + "\\Updater.exe")) - { - System.Threading.Thread.Sleep(2000); - File.Delete(exepath + "\\Updater.exe"); - } - //test.Start(); - hotkeystimer.Start(); - hotkeystimer.Tick += Hotkeys; - test.Tick += test_Tick; - if (!System.IO.Directory.Exists(Global.appdatapath + "\\Virtual Bus Driver")) - linkUninstall.Visible = false; - StartWindowsCheckBox.Checked = File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.Startup) + "\\DS4Windows.lnk"); - } - private void test_Tick(object sender, EventArgs e) { lBTest.Visible = true; @@ -552,14 +549,14 @@ namespace ScpServer { this.Hide(); this.ShowInTaskbar = false; - this.FormBorderStyle = FormBorderStyle.SizableToolWindow; + //this.FormBorderStyle = FormBorderStyle.SizableToolWindow; } else if (FormWindowState.Normal == this.WindowState) { this.Show(); this.ShowInTaskbar = true; - this.FormBorderStyle = FormBorderStyle.Sizable; + //this.FormBorderStyle = FormBorderStyle.Sizable; } chData.AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize); }