/// <summary> /// Creates DirectInput thread. /// </summary> /// <param name="joystickGuid">Joysticks GUID.</param> /// <param name="playerNumber">Player number.</param> /// <param name="directInputListener">Direct Input listener class.</param> /// <param name="joystickMapping">Joystick map.</param> /// <returns>Thread id.</returns> private static Thread CreateDirectInputThread(Guid joystickGuid, int playerNumber, DirectInputListener directInputListener, JoystickMapping joystickMapping) { if (joystickGuid == Guid.Empty) { return(null); } var dinputThread = new Thread(() => directInputListener.Listen(joystickGuid, playerNumber, _settingsData.UseSto0ZDrivingHack, joystickMapping)); dinputThread.Start(); return(dinputThread); }
/// <summary> /// Creates DirectInput thread. /// </summary> /// <param name="joystickGuid">Joysticks GUID.</param> /// <param name="playerNumber">Player number.</param> /// <param name="directInputListener">Direct Input listener class.</param> /// <param name="joystickMapping"></param> /// <param name="xinputMapping"></param> /// <param name="useXinput">If we use xinput instead.</param> /// <returns>Thread id.</returns> private Thread CreateDirectInputThread(Guid joystickGuid, int playerNumber, DirectInputListener directInputListener, XInputListener xinputListener, JoystickMapping joystickMapping, XInputMapping xinputMapping, bool useXinput) { Thread inputThread; if (!useXinput) { if (joystickGuid == Guid.Empty) { return(null); } inputThread = new Thread(() => directInputListener.Listen(joystickGuid, playerNumber, _settingsData.UseSto0ZDrivingHack, joystickMapping)); inputThread.Start(); } else { inputThread = new Thread(() => xinputListener.Listen(playerNumber, _settingsData.UseSto0ZDrivingHack, xinputMapping)); inputThread.Start(); } return(inputThread); }