From 3ae386cb7c21812d8a536eb8308f5a3d00a9a111 Mon Sep 17 00:00:00 2001 From: Yuki-nyan Date: Sat, 23 Jun 2018 22:04:29 +0100 Subject: [PATCH] Add support for the Nacon Revolution Pro Controller 2 & disable SixAxis calibrations for Nacon controllers as a preliminary fix for broken support. --- DS4Windows/DS4Library/DS4Device.cs | 8 +++++++- DS4Windows/DS4Library/DS4Devices.cs | 1 + DS4Windows/DS4Library/DS4Sixaxis.cs | 7 +++++-- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/DS4Windows/DS4Library/DS4Device.cs b/DS4Windows/DS4Library/DS4Device.cs index 9bd6b02..9765dd9 100644 --- a/DS4Windows/DS4Library/DS4Device.cs +++ b/DS4Windows/DS4Library/DS4Device.cs @@ -150,6 +150,7 @@ namespace DS4Windows public DateTime lastActive = DateTime.UtcNow; public DateTime firstActive = DateTime.UtcNow; private bool charging; + private bool isNacon = false; private bool outputRumble = false; private int warnInterval = WARN_INTERVAL_USB; public int getWarnInterval() @@ -428,6 +429,11 @@ namespace DS4Windows micAudio = new DS4Audio(DS4Library.CoreAudio.DataFlow.Capture); } + else if (tempAttr.VendorId == 0x146B) + { + isNacon = true; + } + synced = true; } else @@ -971,7 +977,7 @@ namespace DS4Windows pbAccel[i-6] = pbInput[i]; } } - sixAxis.handleSixaxis(gyro, accel, cState, elapsedDeltaTime); + sixAxis.handleSixaxis(gyro, accel, cState, elapsedDeltaTime, isNacon); /* Debug output of incoming HID data: if (cState.L2 == 0xff && cState.R2 == 0xff) diff --git a/DS4Windows/DS4Library/DS4Devices.cs b/DS4Windows/DS4Library/DS4Devices.cs index d0e7199..ada6904 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) }; diff --git a/DS4Windows/DS4Library/DS4Sixaxis.cs b/DS4Windows/DS4Library/DS4Sixaxis.cs index 15b4135..c44e4a2 100644 --- a/DS4Windows/DS4Library/DS4Sixaxis.cs +++ b/DS4Windows/DS4Library/DS4Sixaxis.cs @@ -218,7 +218,7 @@ namespace DS4Windows } public void handleSixaxis(byte[] gyro, byte[] accel, DS4State state, - double elapsedDelta) + double elapsedDelta, bool disableCalibs) { int currentYaw = (short)((ushort)(gyro[3] << 8) | gyro[2]); int currentPitch = (short)((ushort)(gyro[1] << 8) | gyro[0]); @@ -227,7 +227,10 @@ 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 (!disableCalibs) + { + applyCalibs(ref currentYaw, ref currentPitch, ref currentRoll, ref AccelX, ref AccelY, ref AccelZ); + } SixAxisEventArgs args = null; if (AccelX != 0 || AccelY != 0 || AccelZ != 0)