diff --git a/DS4Windows/DS4Control/ControlService.cs b/DS4Windows/DS4Control/ControlService.cs
index ba414b5..7a80d98 100644
--- a/DS4Windows/DS4Control/ControlService.cs
+++ b/DS4Windows/DS4Control/ControlService.cs
@@ -7,10 +7,12 @@ using System.Media;
using System.Threading.Tasks;
using static DS4Windows.Global;
using System.Threading;
+using System.Diagnostics;
+using Microsoft.Win32;
using Nefarius.ViGEm.Client;
using Nefarius.ViGEm.Client.Targets;
using Nefarius.ViGEm.Client.Targets.Xbox360;
-using Registry = Microsoft.Win32.Registry;
+
namespace DS4Windows
{
@@ -166,7 +168,32 @@ namespace DS4Windows
}
}
- public void createHidGuardKey()
+ public void ScanPurgeHidGuard()
+ {
+ RegistryKey tempkey = Registry.LocalMachine.OpenSubKey(@"SYSTEM\CurrentControlSet\Services\HidGuardian\Parameters\Whitelist");
+ string[] subkeys = tempkey.GetSubKeyNames();
+ bool processExists = false;
+ for (int ind = 0, arlen = subkeys.Length; ind < arlen; ind++)
+ {
+ processExists = true;
+ try
+ {
+ Process.GetProcessById(Convert.ToInt32(subkeys[ind]));
+ }
+ catch { processExists = false; }
+
+ if (!processExists)
+ {
+ try
+ {
+ Registry.LocalMachine.DeleteSubKey(@"SYSTEM\CurrentControlSet\Services\HidGuardian\Parameters\Whitelist\" + subkeys[ind]);
+ }
+ catch { }
+ }
+ }
+ }
+
+ public void CreateHidGuardKey()
{
try
{
diff --git a/DS4Windows/DS4Control/Mapping.cs b/DS4Windows/DS4Control/Mapping.cs
index 2c6c94d..c751a6e 100644
--- a/DS4Windows/DS4Control/Mapping.cs
+++ b/DS4Windows/DS4Control/Mapping.cs
@@ -779,28 +779,28 @@ namespace DS4Windows
if (absX <= 0.4)
{
- outputX = 0.43 * absX;
+ outputX = 0.45 * absX;
}
else if (absX <= 0.75)
{
- outputX = absX - 0.228;
+ outputX = absX - 0.22;
}
else if (absX > 0.75)
{
- outputX = (absX * 1.912) - 0.912;
+ outputX = (absX * 1.88) - 0.88;
}
if (absY <= 0.4)
{
- outputY = 0.43 * absY;
+ outputY = 0.45 * absY;
}
else if (absY <= 0.75)
{
- outputY = absY - 0.228;
+ outputY = absY - 0.22;
}
else if (absY > 0.75)
{
- outputY = (absY * 1.912) - 0.912;
+ outputY = (absY * 1.88) - 0.88;
}
dState.LX = (byte)(outputX * signX * 127.5 + 127.5);
@@ -839,28 +839,28 @@ namespace DS4Windows
if (absX <= 0.4)
{
- outputX = 0.414 * absX;
+ outputX = 0.45 * absX;
}
else if (absX <= 0.75)
{
- outputX = absX - 0.24;
+ outputX = absX - 0.22;
}
else if (absX > 0.75)
{
- outputX = (absX * 1.9376) - 0.9376;
+ outputX = (absX * 1.88) - 0.88;
}
if (absY <= 0.4)
{
- outputY = 0.414 * absY;
+ outputY = 0.45 * absY;
}
else if (absY <= 0.75)
{
- outputY = absY - 0.24;
+ outputY = absY - 0.22;
}
else if (absY > 0.75)
{
- outputY = (absY * 1.9376) - 0.9376;
+ outputY = (absY * 1.88) - 0.88;
}
dState.RX = (byte)(outputX * signX * 127.5 + 127.5);
diff --git a/DS4Windows/DS4Control/ScpHub.Designer.cs b/DS4Windows/DS4Control/ScpHub.Designer.cs
deleted file mode 100644
index ed08d0c..0000000
--- a/DS4Windows/DS4Control/ScpHub.Designer.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-namespace DS4Windows
-{
- partial class ScpHub
- {
- ///
- /// 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 Component Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- components = new System.ComponentModel.Container();
- }
-
- #endregion
- }
-}
diff --git a/DS4Windows/DS4Control/ScpHub.cs b/DS4Windows/DS4Control/ScpHub.cs
deleted file mode 100644
index fd7031a..0000000
--- a/DS4Windows/DS4Control/ScpHub.cs
+++ /dev/null
@@ -1,87 +0,0 @@
-using System;
-using System.ComponentModel;
-
-namespace DS4Windows
-{
- public partial class ScpHub : Component
- {
- protected IntPtr m_Reference = IntPtr.Zero;
- protected volatile Boolean m_Started = false;
-
- public event EventHandler Debug = null;
-
- public event EventHandler Report = null;
-
- protected virtual Boolean LogDebug(String Data, bool warning)
- {
- DebugEventArgs args = new DebugEventArgs(Data, warning);
-
- On_Debug(this, args);
-
- return true;
- }
-
- public Boolean Active
- {
- get { return m_Started; }
- }
-
-
- public ScpHub()
- {
- InitializeComponent();
- }
-
- public ScpHub(IContainer container)
- {
- container.Add(this);
-
- InitializeComponent();
- }
-
-
- public virtual Boolean Open()
- {
- return true;
- }
-
- public virtual Boolean Start()
- {
- return m_Started;
- }
-
- public virtual Boolean Stop()
- {
- return !m_Started;
- }
-
- public virtual Boolean Close()
- {
- if (m_Reference != IntPtr.Zero) ScpDevice.UnregisterNotify(m_Reference);
-
- return !m_Started;
- }
-
-
- public virtual Boolean Suspend()
- {
- return true;
- }
-
- public virtual Boolean Resume()
- {
- return true;
- }
-
- protected virtual void On_Debug(object sender, DebugEventArgs e)
- {
- if (Debug != null) Debug(sender, e);
- }
-
-
- protected virtual void On_Report(object sender, ReportEventArgs e)
- {
- if (Report != null) Report(sender, e);
- }
- }
-}
diff --git a/DS4Windows/DS4Forms/AdvancedComboBox.cs b/DS4Windows/DS4Forms/AdvancedComboBox.cs
deleted file mode 100644
index 1731713..0000000
--- a/DS4Windows/DS4Forms/AdvancedComboBox.cs
+++ /dev/null
@@ -1,93 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Windows.Forms;
-
-namespace ScpServer
-{
- [System.ComponentModel.DesignerCategory("")]
- public class AdvancedComboBox : ComboBox
- {
- public Label Label { get; set; }
-
- public AdvancedComboBox()
- {
- base.Visible = false;
- Label = new Label();
- Label.Tag = this;
- Label.ForeColor = Color.Blue;
- Label.TextAlign = ContentAlignment.MiddleCenter;
- Label.BackColor = Color.Transparent;
- Label.MouseDown += Label_MouseDown;
- }
-
- public Color Color
- {
- get
- {
- return Label.ForeColor;
- }
- set
- {
- Label.ForeColor = value;
- }
- }
-
- public new bool Visible
- {
- get
- {
- return Label.Visible;
- }
- set
- {
- Label.Visible = value;
- }
- }
-
- private void Label_MouseDown(object sender, MouseEventArgs e)
- {
- if (e.Button == System.Windows.Forms.MouseButtons.Left)
- DroppedDown = true;
- }
-
- protected override void OnParentChanged(EventArgs e)
- {
- base.OnParentChanged(e);
-
- if (Parent != null)
- {
- Label.Location = this.Location;
- Label.Size = this.Size;
- Label.Dock = this.Dock;
- Label.Anchor = this.Anchor;
- Label.Enabled = this.Enabled;
- Label.Visible = this.Visible;
- Label.RightToLeft = this.RightToLeft;
- Label.Font = this.Font;
- Label.Text = this.Text
- .Replace("Right Click", "Right-Click")
- .Replace(" Button", string.Empty)
- .Replace("Left ", string.Empty)
- .Replace("Right ", string.Empty);
- Label.TabStop = this.TabStop;
- Label.TabIndex = this.TabIndex;
- }
- Label.Parent = this.Parent;
- }
-
- protected override void OnSelectedIndexChanged(EventArgs e)
- {
- base.OnSelectedIndexChanged(e);
-
- Label.Text = this.Text
- .Replace("Right Click", "Right-Click")
- .Replace(" Button", string.Empty)
- .Replace("Left ", string.Empty)
- .Replace("Right ", string.Empty);
- }
-
- }
-}
diff --git a/DS4Windows/DS4Forms/DS4Form.cs b/DS4Windows/DS4Forms/DS4Form.cs
index 19013b5..6a04de0 100644
--- a/DS4Windows/DS4Forms/DS4Form.cs
+++ b/DS4Windows/DS4Forms/DS4Form.cs
@@ -991,15 +991,16 @@ Properties.Resources.DS4Update, MessageBoxButtons.YesNo, MessageBoxIcon.Question
private bool inHotPlug = false;
private int hotplugCounter = 0;
private object hotplugCounterLock = new object();
+ private const int DBT_DEVNODES_CHANGED = 0x0007;
protected override void WndProc(ref Message m)
{
- try
+ if (m.Msg == ScpDevice.WM_DEVICECHANGE)
{
- if (m.Msg == ScpDevice.WM_DEVICECHANGE)
+ if (runHotPlug)
{
- if (runHotPlug)
+ Int32 Type = m.WParam.ToInt32();
+ if (Type == DBT_DEVNODES_CHANGED)
{
- Int32 Type = m.WParam.ToInt32();
lock (hotplugCounterLock)
{
hotplugCounter++;
@@ -1009,19 +1010,18 @@ Properties.Resources.DS4Update, MessageBoxButtons.YesNo, MessageBoxIcon.Question
if (!inHotPlug)
{
inHotPlug = true;
- TaskRunner.Run(() => { Thread.Sleep(1500); InnerHotplug2(uiContext); });
+ TaskRunner.Run(() => { Thread.Sleep(1500); InnerHotplug2(uiContext); });
}
}
}
}
- catch { }
+
if (m.Msg == WM_QUERYENDSESSION)
systemShutdown = true;
// If this is WM_QUERYENDSESSION, the closing event should be
// raised in the base WndProc.
- try { base.WndProc(ref m); }
- catch { }
+ base.WndProc(ref m);
}
private void InnerHotplug2(SynchronizationContext uiContext)
@@ -2463,7 +2463,7 @@ Properties.Resources.DS4Update, MessageBoxButtons.YesNo, MessageBoxIcon.Question
{
Registry.LocalMachine.DeleteSubKeyTree(@"SYSTEM\CurrentControlSet\Services\HidGuardian\Parameters\Whitelist");
Log.LogToGui("Cleared HidGuardian Whitelist", false);
- Program.rootHub.createHidGuardKey();
+ Program.rootHub.CreateHidGuardKey();
}
catch { }
}
diff --git a/DS4Windows/DS4Forms/Settings.cs b/DS4Windows/DS4Forms/Settings.cs
deleted file mode 100644
index ac0570e..0000000
--- a/DS4Windows/DS4Forms/Settings.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-namespace DS4Windows.Properties {
-
-
- // This class allows you to handle specific events on the settings class:
- // The SettingChanging event is raised before a setting's value is changed.
- // The PropertyChanged event is raised after a setting's value is changed.
- // The SettingsLoaded event is raised after the setting values are loaded.
- // The SettingsSaving event is raised before the setting values are saved.
- internal sealed partial class Settings {
-
- public Settings() {
- // // To add event handlers for saving and changing settings, uncomment the lines below:
- //
- // this.SettingChanging += this.SettingChangingEventHandler;
- //
- // this.SettingsSaving += this.SettingsSavingEventHandler;
- //
- }
-
- private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) {
- // Add code to handle the SettingChangingEvent event here.
- }
-
- private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) {
- // Add code to handle the SettingsSaving event here.
- }
- }
-}
diff --git a/DS4Windows/DS4Library/DS4Device.cs b/DS4Windows/DS4Library/DS4Device.cs
index 61974e9..3f2542a 100644
--- a/DS4Windows/DS4Library/DS4Device.cs
+++ b/DS4Windows/DS4Library/DS4Device.cs
@@ -408,12 +408,18 @@ namespace DS4Windows
private Thread timeoutCheckThread = null;
private bool timeoutExecuted = false;
private bool timeoutEvent = false;
+ private bool runCalib;
+ public bool ShouldRunCalib()
+ {
+ return runCalib;
+ }
public DS4Device(HidDevice hidDevice)
{
hDevice = hidDevice;
conType = HidConnectionType(hDevice);
Mac = hDevice.readSerial();
+ runCalib = true;
if (conType == ConnectionType.USB || conType == ConnectionType.SONYWA)
{
inputReport = new byte[64];
@@ -428,6 +434,10 @@ namespace DS4Windows
audio = new DS4Audio();
micAudio = new DS4Audio(DS4Library.CoreAudio.DataFlow.Capture);
}
+ else if (tempAttr.VendorId == 0x146B)
+ {
+ runCalib = false;
+ }
synced = true;
}
@@ -452,7 +462,8 @@ namespace DS4Windows
touchpad = new DS4Touchpad();
sixAxis = new DS4SixAxis();
Crc32Algorithm.InitializeTable(DefaultPolynomial);
- refreshCalibration();
+ if (runCalib)
+ RefreshCalibration();
if (!hDevice.IsFileStreamOpen())
{
@@ -462,7 +473,7 @@ namespace DS4Windows
sendOutputReport(true, true); // initialize the output report
}
- private void timeoutTestThread()
+ private void TimeoutTestThread()
{
while (!timeoutExecuted)
{
@@ -481,7 +492,7 @@ namespace DS4Windows
const int DS4_FEATURE_REPORT_5_LEN = 41;
const int DS4_FEATURE_REPORT_5_CRC32_POS = DS4_FEATURE_REPORT_5_LEN - 4;
- public void refreshCalibration()
+ public void RefreshCalibration()
{
byte[] calibration = new byte[41];
calibration[0] = conType == ConnectionType.BT ? (byte)0x05 : (byte)0x02;
@@ -532,7 +543,7 @@ namespace DS4Windows
ds4Output.IsBackground = true;
ds4Output.Start();
- timeoutCheckThread = new Thread(timeoutTestThread);
+ timeoutCheckThread = new Thread(TimeoutTestThread);
timeoutCheckThread.Priority = ThreadPriority.BelowNormal;
timeoutCheckThread.Name = "DS4 Timeout thread: " + Mac;
timeoutCheckThread.IsBackground = true;
@@ -987,6 +998,7 @@ namespace DS4Windows
pbAccel[i-6] = pbInput[i];
}
}
+
sixAxis.handleSixaxis(gyro, accel, cState, elapsedDeltaTime);
/* Debug output of incoming HID data:
diff --git a/DS4Windows/DS4Library/DS4Devices.cs b/DS4Windows/DS4Library/DS4Devices.cs
index d0e7199..e3a87f6 100644
--- a/DS4Windows/DS4Library/DS4Devices.cs
+++ b/DS4Windows/DS4Library/DS4Devices.cs
@@ -40,6 +40,7 @@ namespace DS4Windows
new VidPidInfo(SONY_VID, 0x09CC),
new VidPidInfo(RAZER_VID, 0x1000),
new VidPidInfo(NACON_VID, 0x0D01),
+ new VidPidInfo(NACON_VID, 0x0D02),
new VidPidInfo(HORI_VID, 0x00EE), // Hori PS4 Mini Wired Gamepad
new VidPidInfo(0x7545, 0x0104)
};
@@ -233,7 +234,8 @@ namespace DS4Windows
deviceSerials.Add(serial);
}
- device.refreshCalibration();
+ if (device.ShouldRunCalib())
+ device.RefreshCalibration();
}
}
}
diff --git a/DS4Windows/DS4Library/DS4Sixaxis.cs b/DS4Windows/DS4Library/DS4Sixaxis.cs
index 15b4135..62353b5 100644
--- a/DS4Windows/DS4Library/DS4Sixaxis.cs
+++ b/DS4Windows/DS4Library/DS4Sixaxis.cs
@@ -115,6 +115,7 @@ namespace DS4Windows
private CalibData[] calibrationData = new CalibData[6] { new CalibData(), new CalibData(),
new CalibData(), new CalibData(), new CalibData(), new CalibData()
};
+ private bool calibrationDone = false;
public DS4SixAxis()
{
@@ -187,6 +188,8 @@ namespace DS4Windows
calibrationData[5].bias = accelZPlus - accelRange / 2;
calibrationData[5].sensNumer = 2 * SixAxis.ACC_RES_PER_G;
calibrationData[5].sensDenom = accelRange;
+
+ calibrationDone = true;
}
private void applyCalibs(ref int yaw, ref int pitch, ref int roll,
@@ -227,7 +230,8 @@ namespace DS4Windows
int AccelY = (short)((ushort)(accel[3] << 8) | accel[2]);
int AccelZ = (short)((ushort)(accel[5] << 8) | accel[4]);
- applyCalibs(ref currentYaw, ref currentPitch, ref currentRoll, ref AccelX, ref AccelY, ref AccelZ);
+ if (calibrationDone)
+ applyCalibs(ref currentYaw, ref currentPitch, ref currentRoll, ref AccelX, ref AccelY, ref AccelZ);
SixAxisEventArgs args = null;
if (AccelX != 0 || AccelY != 0 || AccelZ != 0)
diff --git a/DS4Windows/DS4Windows.csproj b/DS4Windows/DS4Windows.csproj
index dc96053..7745867 100644
--- a/DS4Windows/DS4Windows.csproj
+++ b/DS4Windows/DS4Windows.csproj
@@ -9,7 +9,7 @@
Properties
DS4Windows
DS4Windows
- v4.5.2
+ v4.6.1
512
true
@@ -94,6 +94,7 @@
6
false
true
+ 1
true
@@ -118,6 +119,7 @@
6
On
true
+ 1
@@ -154,12 +156,6 @@
ScpDevice.cs
-
- Component
-
-
- ScpHub.cs
-
@@ -183,7 +179,6 @@
-
Form
@@ -233,7 +228,6 @@
SaveWhere.cs
-
Form
diff --git a/DS4Windows/Program.cs b/DS4Windows/Program.cs
index 789393f..a957344 100644
--- a/DS4Windows/Program.cs
+++ b/DS4Windows/Program.cs
@@ -103,7 +103,8 @@ namespace DS4Windows
//if (mutex.WaitOne(TimeSpan.Zero, true))
//{
createControlService();
- rootHub.createHidGuardKey();
+ rootHub.ScanPurgeHidGuard();
+ rootHub.CreateHidGuardKey();
//rootHub = new ControlService();
Application.EnableVisualStyles();
Application.Run(new DS4Form(args));
diff --git a/DS4Windows/Properties/Settings.Designer.cs b/DS4Windows/Properties/Settings.Designer.cs
index ac3f6fb..8249a9b 100644
--- a/DS4Windows/Properties/Settings.Designer.cs
+++ b/DS4Windows/Properties/Settings.Designer.cs
@@ -12,7 +12,7 @@ namespace DS4Windows.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.7.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
diff --git a/DS4Windows/app.config b/DS4Windows/app.config
index 4b7b07e..d23be82 100644
--- a/DS4Windows/app.config
+++ b/DS4Windows/app.config
@@ -1,7 +1,7 @@
-
+
diff --git a/README.md b/README.md
index d01c428..d176060 100644
--- a/README.md
+++ b/README.md
@@ -8,20 +8,20 @@ You can find the latest and older versions [here](https://github.com/Ryochan7/DS
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
+http://ryochan7.xyz/ds4windows/test/DS4Windows_1.4.121_UdpServer_x64.zip
+http://ryochan7.xyz/ds4windows/test/DS4Windows_1.4.121_ViGEm_UdpServer_x64.zip
ViGEm build.
-http://ryochan7.xyz/ds4windows/test/DS4Windows_1.4.120_ViGEm_x64.zip
+http://ryochan7.xyz/ds4windows/test/DS4Windows_1.4.121_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).
## Requirements
-- Windows 7 or newer
-- [Microsoft .NET 4.5.2 or higher (needed to unzip the driver and for macros to work properly)](http://www.microsoft.com/en-us/download/details.aspx?id=42642)
+- Windows 7 SP1 or newer
+- [Microsoft .NET 4.6.1 or higher (needed to unzip the driver and for macros to work properly)](https://www.microsoft.com/en-us/download/details.aspx?id=49982)
- SCP Virtual Bus Driver (Downloaded & Installed with DS4Windows)
- Microsoft 360 Driver (link inside DS4Windows, already installed on Windows 7 SP1 and higher or if you've used a 360 controller before)
- Sony DualShock 4 (This should be obvious)
diff --git a/TODO.md b/TODO.md
index ae89e3e..42660e0 100644
--- a/TODO.md
+++ b/TODO.md
@@ -1,7 +1,6 @@
# TODO
* Perform some final cleanup and release version 1.5
-* ~~Attempt to work out BT disconnect issues by looking at older versions~~
* Attempt to remove reliance on the main thread when disconnecting a device.
Currently used to delay hotplug routine
* Look into distributing profile properties around various objects
@@ -10,6 +9,3 @@ It will complicate the architecture a little bit but hopefully
any speed difference will make up for it.
* Remove old welcome dialog and make new driver installer executable.
Use newer standards (WPF) and bundle app with DS4Windows
-* ~~Attempt to no longer disable service when changing dinput only option
-in profiles
-* ~~Update Task Scheduler to latest version~~