From d7f74815e1afd9f882fba6e605c7590fc632ca40 Mon Sep 17 00:00:00 2001 From: Travis Nickles Date: Thu, 7 Sep 2017 22:37:56 -0500 Subject: [PATCH] Changed thread affinity of ControlService instance Seems to help. Only tested with Gex so far using KB emulation. Need to try some other games --- DS4Windows/Program.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/DS4Windows/Program.cs b/DS4Windows/Program.cs index 41c370e..0f81bea 100644 --- a/DS4Windows/Program.cs +++ b/DS4Windows/Program.cs @@ -102,7 +102,8 @@ namespace DS4Windows //if (mutex.WaitOne(TimeSpan.Zero, true)) //{ - rootHub = new ControlService(); + createControlService(); + //rootHub = new ControlService(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new DS4Form(args)); @@ -116,6 +117,16 @@ namespace DS4Windows threadComEvent.Close(); } + private static void createControlService() + { + Thread temp = new Thread(() => { rootHub = new ControlService(); }); + temp.Priority = ThreadPriority.Normal; + temp.IsBackground = true; + temp.Start(); + while (temp.IsAlive) + Thread.SpinWait(500); + } + private static void CreateTempWorkerThread() { testThread = new Thread(singleAppComThread_DoWork);