From f4819d4a3ea0ef635ea79c169a472fb5a0749ed5 Mon Sep 17 00:00:00 2001 From: Travis Nickles Date: Sat, 23 Feb 2019 21:11:15 -0600 Subject: [PATCH 1/2] Added Discord link to README --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index c310ec9..329fc27 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,10 @@ you've used a 360 controller before) or built in pc). Toshiba's adapters currently do not work. - Disable Steam Controller Mapping support in Steam +## Social + +[Discord](https://discord.gg/zrpPgyN) + ## Device Detection Issue If your DS4 is not detected by DS4Windows and the lightbar continues to From 2497ced5d56ff45f17ba5c3533276c28fda8d139 Mon Sep 17 00:00:00 2001 From: Travis Nickles Date: Sun, 24 Feb 2019 15:03:12 -0600 Subject: [PATCH 2/2] Change main report routine to use custom delegate. Remove the need to box and unbox data every gamepad poll. Seems to help with performance. --- DS4Windows/DS4Control/ControlService.cs | 9 +++++---- DS4Windows/DS4Library/DS4Device.cs | 8 ++++++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/DS4Windows/DS4Control/ControlService.cs b/DS4Windows/DS4Control/ControlService.cs index 30a9db5..580efe4 100644 --- a/DS4Windows/DS4Control/ControlService.cs +++ b/DS4Windows/DS4Control/ControlService.cs @@ -404,7 +404,7 @@ namespace DS4Windows this.On_Report(sender, e, tempIdx); }; - EventHandler tempEvnt = (sender, args) => + DS4Device.ReportHandler tempEvnt = (sender, args) => { DualShockPadMeta padDetail = new DualShockPadMeta(); GetPadDetailForIdx(tempIdx, ref padDetail); @@ -620,7 +620,7 @@ namespace DS4Windows this.On_Report(sender, e, tempIdx); }; - EventHandler tempEvnt = (sender, args) => + DS4Device.ReportHandler tempEvnt = (sender, args) => { DualShockPadMeta padDetail = new DualShockPadMeta(); GetPadDetailForIdx(tempIdx, ref padDetail); @@ -1013,9 +1013,10 @@ namespace DS4Windows private string[] tempStrings = new string[4] { string.Empty, string.Empty, string.Empty, string.Empty }; // Called every time a new input report has arrived - protected virtual void On_Report(object sender, EventArgs e, int ind) + //protected virtual void On_Report(object sender, EventArgs e, int ind) + protected virtual void On_Report(DS4Device device, EventArgs e, int ind) { - DS4Device device = (DS4Device)sender; + //DS4Device device = (DS4Device)sender; if (ind != -1) { diff --git a/DS4Windows/DS4Library/DS4Device.cs b/DS4Windows/DS4Library/DS4Device.cs index a9d33c7..974ea76 100644 --- a/DS4Windows/DS4Library/DS4Device.cs +++ b/DS4Windows/DS4Library/DS4Device.cs @@ -184,11 +184,15 @@ namespace DS4Windows private bool exitInputThread = false; private object exitLocker = new object(); - public event EventHandler Report = null; + public delegate void ReportHandler(DS4Device sender, TEventArgs args); + + //public event EventHandler Report = null; + public event ReportHandler Report = null; public event EventHandler Removal = null; public event EventHandler SyncChange = null; public event EventHandler SerialChange = null; - public EventHandler MotionEvent = null; + //public EventHandler MotionEvent = null; + public ReportHandler MotionEvent = null; public HidDevice HidDevice => hDevice; public bool IsExclusive => HidDevice.IsExclusive;