merge conflicts with base branch

This commit is contained in:
mika-n 2019-02-19 15:00:17 +02:00
commit 8d087b01ff
23 changed files with 887 additions and 1148 deletions

View File

@ -155,6 +155,18 @@ namespace DS4Windows
// Thread.SpinWait(500);
//}
if (Global.IsHidGuardianInstalled())
{
ProcessStartInfo startInfo =
new ProcessStartInfo(Global.exepath + "\\HidGuardHelper.exe");
startInfo.Verb = "runas";
startInfo.Arguments = Process.GetCurrentProcess().Id.ToString();
startInfo.WorkingDirectory = Global.exepath;
try
{ Process tempProc = Process.Start(startInfo); tempProc.Dispose(); }
catch { }
}
for (int i = 0, arlength = DS4Controllers.Length; i < arlength; i++)
{
processingData[i] = new X360Data();
@ -334,9 +346,12 @@ namespace DS4Windows
DS4LightBar.defaultLight = false;
//foreach (DS4Device device in devices)
for (int i = 0, devCount = devices.Count(); i < devCount; i++)
//for (int i = 0, devCount = devices.Count(); i < devCount; i++)
int i = 0;
for (var devEnum = devices.GetEnumerator(); devEnum.MoveNext(); i++)
{
DS4Device device = devices.ElementAt(i);
DS4Device device = devEnum.Current;
//DS4Device device = devices.ElementAt(i);
if (showlog)
LogDebug(Properties.Resources.FoundController + device.getMacAddress() + " (" + device.getConnectionType() + ")");
@ -357,8 +372,9 @@ namespace DS4Windows
{
ProfilePath[i] = OlderProfilePath[i];
}
LoadProfile(i, false, this, false, false);
touchPad[i] = new Mouse(i, device);
LoadProfile(i, false, this, false, false);
device.LightBarColor = getMainColor(i);
if (!getDInputOnly(i) && device.isSynced())
@ -548,9 +564,11 @@ namespace DS4Windows
DS4Devices.findControllers();
IEnumerable<DS4Device> devices = DS4Devices.getDS4Controllers();
//foreach (DS4Device device in devices)
for (int i = 0, devlen = devices.Count(); i < devlen; i++)
//for (int i = 0, devlen = devices.Count(); i < devlen; i++)
for (var devEnum = devices.GetEnumerator(); devEnum.MoveNext();)
{
DS4Device device = devices.ElementAt(i);
DS4Device device = devEnum.Current;
//DS4Device device = devices.ElementAt(i);
if (device.isDisconnectingStatus())
continue;
@ -592,8 +610,8 @@ namespace DS4Windows
ProfilePath[Index] = OlderProfilePath[Index];
}
LoadProfile(Index, false, this, false, false);
touchPad[Index] = new Mouse(Index, device);
LoadProfile(Index, false, this, false, false);
device.LightBarColor = getMainColor(Index);
int tempIdx = Index;

View File

@ -47,9 +47,9 @@ namespace DS4Windows
{
if (getLedAsBatteryIndicator(deviceNum))
{
DS4Color fullColor = getCustomColor(deviceNum);
DS4Color lowColor = getLowColor(deviceNum);
color = getTransitionedColor(lowColor, fullColor, device.getBattery());
ref DS4Color fullColor = ref getCustomColor(deviceNum);
ref DS4Color lowColor = ref getLowColor(deviceNum);
color = getTransitionedColor(ref lowColor, ref fullColor, device.getBattery());
}
else
color = getCustomColor(deviceNum);
@ -83,9 +83,9 @@ namespace DS4Windows
}
else if (getLedAsBatteryIndicator(deviceNum))
{
DS4Color fullColor = getMainColor(deviceNum);
DS4Color lowColor = getLowColor(deviceNum);
color = getTransitionedColor(lowColor, fullColor, device.getBattery());
ref DS4Color fullColor = ref getMainColor(deviceNum);
ref DS4Color lowColor = ref getLowColor(deviceNum);
color = getTransitionedColor(ref lowColor, ref fullColor, device.getBattery());
}
else
{
@ -95,7 +95,7 @@ namespace DS4Windows
if (device.getBattery() <= getFlashAt(deviceNum) && !defaultLight && !device.isCharging())
{
DS4Color flashColor = getFlashColor(deviceNum);
ref DS4Color flashColor = ref getFlashColor(deviceNum);
if (!(flashColor.red == 0 &&
flashColor.green == 0 &&
flashColor.blue == 0))
@ -144,7 +144,8 @@ namespace DS4Windows
}
}
color = getTransitionedColor(color, new DS4Color(0, 0, 0), ratio);
DS4Color tempCol = new DS4Color(0, 0, 0);
color = getTransitionedColor(ref color, ref tempCol, ratio);
}
}
@ -159,11 +160,16 @@ namespace DS4Windows
double ratio = 100.0 * (botratio / topratio), elapsed = ratio;
if (ratio >= 50.0 && ratio < 100.0)
{
color = getTransitionedColor(color, new DS4Color(0, 0, 0),
DS4Color emptyCol = new DS4Color(0, 0, 0);
color = getTransitionedColor(ref color, ref emptyCol,
(uint)(-100.0 * (elapsed = 0.02 * (ratio - 50.0)) * (elapsed - 2.0)));
}
else if (ratio >= 100.0)
color = getTransitionedColor(color, new DS4Color(0, 0, 0), 100.0);
{
DS4Color emptyCol = new DS4Color(0, 0, 0);
color = getTransitionedColor(ref color, ref emptyCol, 100.0);
}
}
if (device.isCharging() && device.getBattery() < 100)
@ -217,7 +223,8 @@ namespace DS4Windows
}
}
color = getTransitionedColor(color, new DS4Color(0, 0, 0), ratio);
DS4Color emptyCol = new DS4Color(0, 0, 0);
color = getTransitionedColor(ref color, ref emptyCol, ratio);
break;
}
case 2:
@ -257,9 +264,22 @@ namespace DS4Windows
float rumble = device.getLeftHeavySlowRumble() / 2.55f;
byte max = Max(color.red, Max(color.green, color.blue));
if (device.getLeftHeavySlowRumble() > 100)
color = getTransitionedColor(new DS4Color(max, max, 0), new DS4Color(255, 0, 0), rumble);
{
DS4Color maxCol = new DS4Color(max, max, 0);
DS4Color redCol = new DS4Color(255, 0, 0);
color = getTransitionedColor(ref maxCol, ref redCol, rumble);
}
else
color = getTransitionedColor(color, getTransitionedColor(new DS4Color(max, max, 0), new DS4Color(255, 0, 0), 39.6078f), device.getLeftHeavySlowRumble());
{
DS4Color maxCol = new DS4Color(max, max, 0);
DS4Color redCol = new DS4Color(255, 0, 0);
DS4Color tempCol = getTransitionedColor(ref maxCol,
ref redCol, 39.6078f);
color = getTransitionedColor(ref color, ref tempCol,
device.getLeftHeavySlowRumble());
}
}
DS4HapticState haptics = new DS4HapticState

View File

@ -62,6 +62,8 @@ namespace DS4Windows
}
public void populateFieldMapping(DS4State cState, DS4StateExposed exposeState, Mouse tp, bool priorMouse = false)
{
unchecked
{
axisdirs[(int)DS4Controls.LXNeg] = cState.LX;
axisdirs[(int)DS4Controls.LXPos] = cState.LX;
@ -118,7 +120,11 @@ namespace DS4Windows
swipedirbools[(int)DS4Controls.SwipeDown] = tp != null ? (!priorMouse ? tp.swipeDown : tp.priorSwipeDown) : false;
}
}
public void populateState(DS4State state)
{
unchecked
{
state.LX = axisdirs[(int)DS4Controls.LXNeg];
state.LX = axisdirs[(int)DS4Controls.LXPos];
@ -153,3 +159,4 @@ namespace DS4Windows
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -23,6 +23,7 @@ namespace DS4Windows
public bool priorLeftDown, priorRightDown, priorUpperDown, priorMultiDown;
protected DS4Controls pushed = DS4Controls.None;
protected Mapping.Click clicked = Mapping.Click.None;
public int CursorGyroDead { get => cursor.GyroCursorDeadZone; set => cursor.GyroCursorDeadZone = value; }
internal const int TRACKBALL_INIT_FICTION = 10;
internal const int TRACKBALL_MASS = 45;
@ -57,8 +58,18 @@ namespace DS4Windows
trackballAccel = TRACKBALL_RADIUS * friction / TRACKBALL_INERTIA;
}
public void ResetToggleGyroM()
{
currentToggleGyroM = false;
}
bool triggeractivated = false;
bool previousTriggerActivated = false;
bool useReverseRatchet = false;
bool toggleGyroMouse = true;
public bool ToggleGyroMouse { get => toggleGyroMouse;
set { toggleGyroMouse = value; ResetToggleGyroM(); } }
bool currentToggleGyroM = false;
public virtual void sixaxisMoved(object sender, SixAxisEventArgs arg)
{
@ -90,6 +101,21 @@ namespace DS4Windows
}
}
if (toggleGyroMouse)
{
if (triggeractivated && triggeractivated != previousTriggerActivated)
{
currentToggleGyroM = !currentToggleGyroM;
}
previousTriggerActivated = triggeractivated;
triggeractivated = currentToggleGyroM;
}
else
{
previousTriggerActivated = triggeractivated;
}
if (useReverseRatchet && triggeractivated)
cursor.sixaxisMoved(arg);
else if (!useReverseRatchet && !triggeractivated)
@ -109,9 +135,9 @@ namespace DS4Windows
case 2: return s.Square;
case 3: return s.Triangle;
case 4: return s.L1;
case 5: return s.L2 > 127;
case 5: return s.L2 > 128;
case 6: return s.R1;
case 7: return s.R2 > 127;
case 7: return s.R2 > 128;
case 8: return s.DpadUp;
case 9: return s.DpadDown;
case 10: return s.DpadLeft;
@ -419,6 +445,7 @@ namespace DS4Windows
}
public bool dragging, dragging2;
private void synthesizeMouseButtons()
{
if (Global.GetDS4Action(deviceNum, DS4Controls.TouchLeft, false) == null && leftDown)

View File

@ -21,7 +21,7 @@ namespace DS4Windows
private Direction hDirection = Direction.Neutral, vDirection = Direction.Neutral;
private const double GYRO_MOUSE_COEFFICIENT = 0.0095;
private const int GYRO_MOUSE_DEADZONE = 10;
public const int GYRO_MOUSE_DEADZONE = 10;
private const double GYRO_MOUSE_OFFSET = 0.1463;
private const double GYRO_SMOOTH_MOUSE_OFFSET = 0.14698;
private const double TOUCHPAD_MOUSE_OFFSET = 0.015;
@ -30,7 +30,8 @@ namespace DS4Windows
private double[] xSmoothBuffer = new double[SMOOTH_BUFFER_LEN];
private double[] ySmoothBuffer = new double[SMOOTH_BUFFER_LEN];
private int smoothBufferTail = 0;
private int gyroCursorDeadZone = GYRO_MOUSE_DEADZONE;
public int GyroCursorDeadZone { get => gyroCursorDeadZone; set => gyroCursorDeadZone = value; }
double coefficient = 0.0;
@ -80,8 +81,8 @@ namespace DS4Windows
vRemainder = 0.0;
}
int deadzoneX = (int)Math.Abs(normX * GYRO_MOUSE_DEADZONE);
int deadzoneY = (int)Math.Abs(normY * GYRO_MOUSE_DEADZONE);
int deadzoneX = (int)Math.Abs(normX * gyroCursorDeadZone);
int deadzoneY = (int)Math.Abs(normY * gyroCursorDeadZone);
if (Math.Abs(deltaX) > deadzoneX)
{

View File

@ -229,7 +229,7 @@ namespace DS4Windows
{
protected static BackingStore m_Config = new BackingStore();
protected static Int32 m_IdleTimeout = 600000;
public static string exepath = Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName;
public static readonly string exepath = Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName;
public static string appdatapath;
public static bool firstRun = false;
public static bool multisavespots = false;
@ -300,25 +300,28 @@ namespace DS4Windows
return principal.IsInRole(WindowsBuiltInRole.Administrator);
}
public static bool IsScpVBusInstalled()
private static bool CheckForSysDevice(string searchHardwareId)
{
bool result = false;
Guid sysGuid = Guid.Parse("{4d36e97d-e325-11ce-bfc1-08002be10318}");
NativeMethods.SP_DEVINFO_DATA deviceInfoData = new NativeMethods.SP_DEVINFO_DATA();
deviceInfoData.cbSize = System.Runtime.InteropServices.Marshal.SizeOf(deviceInfoData);
NativeMethods.SP_DEVINFO_DATA deviceInfoData =
new NativeMethods.SP_DEVINFO_DATA();
deviceInfoData.cbSize =
System.Runtime.InteropServices.Marshal.SizeOf(deviceInfoData);
var dataBuffer = new byte[4096];
ulong propertyType = 0;
var requiredSize = 0;
IntPtr deviceInfoSet = NativeMethods.SetupDiGetClassDevs(ref sysGuid, null, 0, 0);
for (int i = 0; !result && NativeMethods.SetupDiEnumDeviceInfo(deviceInfoSet, i, ref deviceInfoData); i++)
{
if (NativeMethods.SetupDiGetDeviceProperty(deviceInfoSet, ref deviceInfoData, ref NativeMethods.DEVPKEY_Device_HardwareIds, ref propertyType,
if (NativeMethods.SetupDiGetDeviceProperty(deviceInfoSet, ref deviceInfoData,
ref NativeMethods.DEVPKEY_Device_HardwareIds, ref propertyType,
dataBuffer, dataBuffer.Length, ref requiredSize, 0))
{
string hardwareId = dataBuffer.ToUTF16String();
//if (hardwareIds.Contains("Scp Virtual Bus Driver"))
// result = true;
if (hardwareId.Equals(@"root\ScpVBus"))
if (hardwareId.Equals(searchHardwareId))
result = true;
}
}
@ -331,6 +334,16 @@ namespace DS4Windows
return result;
}
public static bool IsHidGuardianInstalled()
{
return CheckForSysDevice(@"Root\HidGuardian");
}
public static bool IsScpVBusInstalled()
{
return CheckForSysDevice(@"root\ScpVBus");
}
public static void FindConfigLocation()
{
if (File.Exists(exepath + "\\Auto Profiles.xml")
@ -780,28 +793,43 @@ namespace DS4Windows
return m_Config.gyroMouseHorizontalAxis[index];
}
public static DS4Color[] MainColor => m_Config.m_Leds;
public static DS4Color getMainColor(int index)
public static int[] GyroMouseDeadZone => m_Config.gyroMouseDZ;
public static int GetGyroMouseDeadZone(int index)
{
return m_Config.m_Leds[index];
return m_Config.gyroMouseDZ[index];
}
public static void SetGyroMouseDeadZone(int index, int value, ControlService control)
{
m_Config.SetGyroMouseDZ(index, value, control);
}
public static bool[] GyroMouseToggle => m_Config.gyroMouseToggle;
public static void SetGyroMouseToggle(int index, bool value, ControlService control)
=> m_Config.SetGyroMouseToggle(index, value, control);
public static DS4Color[] MainColor => m_Config.m_Leds;
public static ref DS4Color getMainColor(int index)
{
return ref m_Config.m_Leds[index];
}
public static DS4Color[] LowColor => m_Config.m_LowLeds;
public static DS4Color getLowColor(int index)
public static ref DS4Color getLowColor(int index)
{
return m_Config.m_LowLeds[index];
return ref m_Config.m_LowLeds[index];
}
public static DS4Color[] ChargingColor => m_Config.m_ChargingLeds;
public static DS4Color getChargingColor(int index)
public static ref DS4Color getChargingColor(int index)
{
return m_Config.m_ChargingLeds[index];
return ref m_Config.m_ChargingLeds[index];
}
public static DS4Color[] CustomColor => m_Config.m_CustomLeds;
public static DS4Color getCustomColor(int index)
public static ref DS4Color getCustomColor(int index)
{
return m_Config.m_CustomLeds[index];
return ref m_Config.m_CustomLeds[index];
}
public static bool[] UseCustomLed => m_Config.useCustomLeds;
@ -811,9 +839,9 @@ namespace DS4Windows
}
public static DS4Color[] FlashColor => m_Config.m_FlashLeds;
public static DS4Color getFlashColor(int index)
public static ref DS4Color getFlashColor(int index)
{
return m_Config.m_FlashLeds[index];
return ref m_Config.m_FlashLeds[index];
}
public static byte[] TapSensitivity => m_Config.tapSensitivity;
@ -1330,17 +1358,20 @@ namespace DS4Windows
else if (r < 0.0)
r = 0.0;
r /= 100.0;
return (byte)Math.Round((b1 * (1 - r) + b2 * r), 0);
r *= 0.01;
return (byte)Math.Round((b1 * (1 - r)) + b2 * r, 0);
}
public static DS4Color getTransitionedColor(DS4Color c1, DS4Color c2, double ratio)
public static DS4Color getTransitionedColor(ref DS4Color c1, ref DS4Color c2, double ratio)
{
//Color cs = Color.FromArgb(c1.red, c1.green, c1.blue);
c1.red = applyRatio(c1.red, c2.red, ratio);
c1.green = applyRatio(c1.green, c2.green, ratio);
c1.blue = applyRatio(c1.blue, c2.blue, ratio);
return c1;
DS4Color cs = new DS4Color
{
red = applyRatio(c1.red, c2.red, ratio),
green = applyRatio(c1.green, c2.green, ratio),
blue = applyRatio(c1.blue, c2.blue, ratio)
};
return cs;
}
private static Color applyRatio(Color c1, Color c2, uint r)
@ -1464,6 +1495,11 @@ namespace DS4Windows
public int[] flashAt = new int[5] { 0, 0, 0, 0, 0 };
public bool[] mouseAccel = new bool[5] { true, true, true, true, true };
public int[] btPollRate = new int[5] { 4, 4, 4, 4, 4 };
public int[] gyroMouseDZ = new int[5] { MouseCursor.GYRO_MOUSE_DEADZONE, MouseCursor.GYRO_MOUSE_DEADZONE,
MouseCursor.GYRO_MOUSE_DEADZONE, MouseCursor.GYRO_MOUSE_DEADZONE,
MouseCursor.GYRO_MOUSE_DEADZONE };
public bool[] gyroMouseToggle = new bool[5] { false, false, false,
false, false };
public int[] lsOutCurveMode = new int[5] { 0, 0, 0, 0, 0 };
public int[] rsOutCurveMode = new int[5] { 0, 0, 0, 0, 0 };
public int[] l2OutCurveMode = new int[5] { 0, 0, 0, 0, 0 };
@ -1608,6 +1644,7 @@ namespace DS4Windows
case 1: result = "enhanced-precision"; break;
case 2: result = "quadratic"; break;
case 3: result = "cubic"; break;
case 4: result = "easeout-quad"; break;
default: break;
}
@ -1623,6 +1660,7 @@ namespace DS4Windows
case "enhanced-precision": id = 1; break;
case "quadratic": id = 2; break;
case "cubic": id = 3; break;
case "easeout-quad": id = 4; break;
default: break;
}
@ -1637,6 +1675,7 @@ namespace DS4Windows
case 0: break;
case 1: result = "quadratic"; break;
case 2: result = "cubic"; break;
case 3: result = "easeout-quad"; break;
default: break;
}
@ -1651,6 +1690,7 @@ namespace DS4Windows
case "linear": id = 0; break;
case "quadratic": id = 1; break;
case "cubic": id = 2; break;
case "easeout-quad": id = 3; break;
default: break;
}
@ -1681,6 +1721,20 @@ namespace DS4Windows
sATriggerCond[index] = SaTriggerCondValue(text);
}
public void SetGyroMouseDZ(int index, int value, ControlService control)
{
gyroMouseDZ[index] = value;
if (index < 4 && control.touchPad[index] != null)
control.touchPad[index].CursorGyroDead = value;
}
public void SetGyroMouseToggle(int index, bool value, ControlService control)
{
gyroMouseToggle[index] = value;
if (index < 4 && control.touchPad[index] != null)
control.touchPad[index].ToggleGyroMouse = value;
}
public bool SaveProfile(int device, string propath)
{
bool Saved = true;
@ -1784,6 +1838,8 @@ namespace DS4Windows
XmlNode xmlGyroSmoothWeight = m_Xdoc.CreateNode(XmlNodeType.Element, "GyroSmoothingWeight", null); xmlGyroSmoothWeight.InnerText = Convert.ToInt32(gyroSmoothWeight[device] * 100).ToString(); Node.AppendChild(xmlGyroSmoothWeight);
XmlNode xmlGyroSmoothing = m_Xdoc.CreateNode(XmlNodeType.Element, "GyroSmoothing", null); xmlGyroSmoothing.InnerText = gyroSmoothing[device].ToString(); Node.AppendChild(xmlGyroSmoothing);
XmlNode xmlGyroMouseHAxis = m_Xdoc.CreateNode(XmlNodeType.Element, "GyroMouseHAxis", null); xmlGyroMouseHAxis.InnerText = gyroMouseHorizontalAxis[device].ToString(); Node.AppendChild(xmlGyroMouseHAxis);
XmlNode xmlGyroMouseDZ = m_Xdoc.CreateNode(XmlNodeType.Element, "GyroMouseDeadZone", null); xmlGyroMouseDZ.InnerText = gyroMouseDZ[device].ToString(); Node.AppendChild(xmlGyroMouseDZ);
XmlNode xmlGyroMouseToggle = m_Xdoc.CreateNode(XmlNodeType.Element, "GyroMouseToggle", null); xmlGyroMouseToggle.InnerText = gyroMouseToggle[device].ToString(); Node.AppendChild(xmlGyroMouseToggle);
XmlNode xmlLSC = m_Xdoc.CreateNode(XmlNodeType.Element, "LSCurve", null); xmlLSC.InnerText = lsCurve[device].ToString(); Node.AppendChild(xmlLSC);
XmlNode xmlRSC = m_Xdoc.CreateNode(XmlNodeType.Element, "RSCurve", null); xmlRSC.InnerText = rsCurve[device].ToString(); Node.AppendChild(xmlRSC);
XmlNode xmlProfileActions = m_Xdoc.CreateNode(XmlNodeType.Element, "ProfileActions", null); xmlProfileActions.InnerText = string.Join("/", profileActions[device]); Node.AppendChild(xmlProfileActions);
@ -2593,7 +2649,6 @@ namespace DS4Windows
catch { dinputOnly[device] = false; missingSetting = true; }
bool oldUseDInputOnly = Global.useDInputOnly[device];
Global.useDInputOnly[device] = dinputOnly[device];
// Only change xinput devices under certain conditions. Avoid
// performing this upon program startup before loading devices.
@ -2609,20 +2664,14 @@ namespace DS4Windows
{
if (dinputOnly[device] == true)
{
Global.useDInputOnly[device] = true;
xinputPlug = false;
xinputStatus = true;
}
else if (synced && isAlive)
{
Global.useDInputOnly[device] = false;
xinputPlug = true;
xinputStatus = true;
}
else if (!synced)
{
Global.useDInputOnly[device] = true;
}
}
}
}
@ -2690,6 +2739,17 @@ namespace DS4Windows
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/GyroMouseHAxis"); int temp = 0; int.TryParse(Item.InnerText, out temp); gyroMouseHorizontalAxis[device] = Math.Min(Math.Max(0, temp), 1); }
catch { gyroMouseHorizontalAxis[device] = 0; missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/GyroMouseDeadZone"); int.TryParse(Item.InnerText, out int temp);
SetGyroMouseDZ(device, temp, control); }
catch { SetGyroMouseDZ(device, MouseCursor.GYRO_MOUSE_DEADZONE, control); missingSetting = true; }
try
{
Item = m_Xdoc.SelectSingleNode("/" + rootname + "/GyroMouseToggle"); bool.TryParse(Item.InnerText, out bool temp);
SetGyroMouseToggle(device, temp, control);
}
catch { SetGyroMouseToggle(device, false, control); missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/LSCurve"); int.TryParse(Item.InnerText, out lsCurve[device]); }
catch { lsCurve[device] = 0; missingSetting = true; }
@ -2982,12 +3042,12 @@ namespace DS4Windows
int xinputIndex = control.x360Bus.FirstController + device;
if (xinputResult)
{
dinputOnly[device] = false;
Global.useDInputOnly[device] = false;
AppLogger.LogToGui("X360 Controller # " + xinputIndex + " connected", false);
}
else
{
dinputOnly[device] = true;
Global.useDInputOnly[device] = true;
AppLogger.LogToGui("X360 Controller # " + xinputIndex + " failed. Using DInput only mode", true);
}
}
@ -2997,11 +3057,12 @@ namespace DS4Windows
int xinputIndex = control.x360Bus.FirstController + device;
if (xinputResult)
{
dinputOnly[device] = true;
Global.useDInputOnly[device] = true;
AppLogger.LogToGui("X360 Controller # " + xinputIndex + " unplugged", false);
}
else
{
Global.useDInputOnly[device] = false;
AppLogger.LogToGui("X360 Controller # " + xinputIndex + " failed to unplug", true);
}
}
@ -3509,9 +3570,11 @@ namespace DS4Windows
linkedXdoc.AppendChild(Node);
Dictionary<string, string>.KeyCollection serials = linkedProfiles.Keys;
for (int i = 0, itemCount = linkedProfiles.Count; i < itemCount; i++)
//for (int i = 0, itemCount = linkedProfiles.Count; i < itemCount; i++)
for (var serialEnum = serials.GetEnumerator(); serialEnum.MoveNext();)
{
string serial = serials.ElementAt(i);
//string serial = serials.ElementAt(i);
string serial = serialEnum.Current;
string profile = linkedProfiles[serial];
XmlElement link = linkedXdoc.CreateElement("MAC" + serial);
link.InnerText = profile;
@ -3639,15 +3702,12 @@ namespace DS4Windows
else
dc = (DS4Controls)Enum.Parse(typeof(DS4Controls), buttonName, true);
List<DS4ControlSettings> ds4settingsList = ds4settings[deviceNum];
for (int i = 0, settingsLen = ds4settingsList.Count; i < settingsLen; i++)
{
DS4ControlSettings dcs = ds4settingsList[i];
if (dcs.control == dc)
int temp = (int)dc;
if (temp > 0)
{
int index = temp - 1;
DS4ControlSettings dcs = ds4settings[deviceNum][index];
dcs.UpdateSettings(shift, action, exts, kt, trigger);
break;
}
}
}
@ -3659,19 +3719,15 @@ namespace DS4Windows
else
dc = (DS4Controls)Enum.Parse(typeof(DS4Controls), buttonName, true);
List<DS4ControlSettings> ds4settingsList = ds4settings[deviceNum];
for (int i = 0, settingsLen = ds4settingsList.Count; i < settingsLen; i++)
{
DS4ControlSettings dcs = ds4settingsList[i];
if (dcs.control == dc)
int temp = (int)dc;
if (temp > 0)
{
int index = temp - 1;
DS4ControlSettings dcs = ds4settings[deviceNum][index];
if (shift)
dcs.shiftExtras = exts;
else
dcs.extras = exts;
break;
}
}
}
@ -3683,19 +3739,15 @@ namespace DS4Windows
else
dc = (DS4Controls)Enum.Parse(typeof(DS4Controls), buttonName, true);
List<DS4ControlSettings> ds4settingsList = ds4settings[deviceNum];
for (int i = 0, settingsLen = ds4settingsList.Count; i < settingsLen; i++)
{
DS4ControlSettings dcs = ds4settingsList[i];
if (dcs.control == dc)
int temp = (int)dc;
if (temp > 0)
{
int index = temp - 1;
DS4ControlSettings dcs = ds4settings[deviceNum][index];
if (shift)
dcs.shiftKeyType = keyType;
else
dcs.keyType = keyType;
break;
}
}
}
@ -3707,15 +3759,17 @@ namespace DS4Windows
else
dc = (DS4Controls)Enum.Parse(typeof(DS4Controls), buttonName, true);
List<DS4ControlSettings> ds4settingsList = ds4settings[deviceNum];
for (int i = 0, settingsLen = ds4settingsList.Count; i < settingsLen; i++)
{
DS4ControlSettings dcs = ds4settingsList[i];
if (dcs.control == dc)
int temp = (int)dc;
if (temp > 0)
{
int index = temp - 1;
DS4ControlSettings dcs = ds4settings[deviceNum][index];
if (shift)
{
return dcs.shiftAction;
}
else
{
return dcs.action;
}
}
@ -3732,7 +3786,7 @@ namespace DS4Windows
DS4ControlSettings dcs = ds4settings[deviceNum][index];
if (shift)
{
return dcs.shiftTrigger;
return dcs.shiftAction;
}
else
{
@ -3751,18 +3805,16 @@ namespace DS4Windows
else
dc = (DS4Controls)Enum.Parse(typeof(DS4Controls), buttonName, true);
List<DS4ControlSettings> ds4settingsList = ds4settings[deviceNum];
for (int i = 0, settingsLen = ds4settingsList.Count; i < settingsLen; i++)
{
DS4ControlSettings dcs = ds4settingsList[i];
if (dcs.control == dc)
int temp = (int)dc;
if (temp > 0)
{
int index = temp - 1;
DS4ControlSettings dcs = ds4settings[deviceNum][index];
if (shift)
return dcs.shiftExtras;
else
return dcs.extras;
}
}
return null;
}
@ -3775,18 +3827,16 @@ namespace DS4Windows
else
dc = (DS4Controls)Enum.Parse(typeof(DS4Controls), buttonName, true);
List<DS4ControlSettings> ds4settingsList = ds4settings[deviceNum];
for (int i = 0, settingsLen = ds4settingsList.Count; i < settingsLen; i++)
{
DS4ControlSettings dcs = ds4settingsList[i];
if (dcs.control == dc)
int temp = (int)dc;
if (temp > 0)
{
int index = temp - 1;
DS4ControlSettings dcs = ds4settings[deviceNum][index];
if (shift)
return dcs.shiftKeyType;
else
return dcs.keyType;
}
}
return DS4KeyType.None;
}
@ -3799,11 +3849,11 @@ namespace DS4Windows
else
dc = (DS4Controls)Enum.Parse(typeof(DS4Controls), buttonName, true);
List<DS4ControlSettings> ds4settingsList = ds4settings[deviceNum];
for (int i = 0, settingsLen = ds4settingsList.Count; i < settingsLen; i++)
int temp = (int)dc;
if (temp > 0)
{
DS4ControlSettings dcs = ds4settingsList[i];
if (dcs.control == dc)
int index = temp - 1;
DS4ControlSettings dcs = ds4settings[deviceNum][index];
return dcs.shiftTrigger;
}
@ -3831,11 +3881,11 @@ namespace DS4Windows
else
dc = (DS4Controls)Enum.Parse(typeof(DS4Controls), buttonName, true);
List<DS4ControlSettings> ds4settingsList = ds4settings[deviceNum];
for (int i = 0, settingsLen = ds4settingsList.Count; i < settingsLen; i++)
int temp = (int)dc;
if (temp > 0)
{
DS4ControlSettings dcs = ds4settingsList[i];
if (dcs.control == dc)
int index = temp - 1;
DS4ControlSettings dcs = ds4settings[deviceNum][index];
return dcs;
}

View File

@ -401,7 +401,7 @@ namespace DS4Windows
if (btnStartStop.Enabled && start)
{
TaskRunner.Delay(50).ContinueWith((t) => {
TaskRunner.Delay(100).ContinueWith((t) => {
this.BeginInvoke((System.Action)(() => BtnStartStop_Clicked()));
});
}
@ -786,7 +786,7 @@ namespace DS4Windows
FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location);
string version = fvi.FileVersion;
string newversion = File.ReadAllText(appdatapath + "\\version.txt").Trim();
if (version.Replace(',', '.').CompareTo(newversion) != 0)
if (!string.IsNullOrWhiteSpace(newversion) && version.Replace(',', '.').CompareTo(newversion) != 0)
{
if ((DialogResult)this.Invoke(new Func<DialogResult>(() => {
return MessageBox.Show(Properties.Resources.DownloadVersion.Replace("*number*", newversion),
@ -2097,7 +2097,7 @@ Properties.Resources.DS4Update, MessageBoxButtons.YesNo, MessageBoxIcon.Question
FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location);
string version2 = fvi.FileVersion;
string newversion2 = File.ReadAllText(appdatapath + "\\version.txt").Trim();
if (version2.Replace(',', '.').CompareTo(newversion2) != 0)
if (!string.IsNullOrWhiteSpace(newversion2) && version2.Replace(',', '.').CompareTo(newversion2) != 0)
{
if ((DialogResult)this.Invoke(new Func<DialogResult>(() =>
{

View File

@ -320,6 +320,9 @@
this.rBSAControls = new System.Windows.Forms.RadioButton();
this.rBSAMouse = new System.Windows.Forms.RadioButton();
this.pnlSAMouse = new System.Windows.Forms.Panel();
this.toggleGyroMCb = new System.Windows.Forms.CheckBox();
this.label27 = new System.Windows.Forms.Label();
this.gyroMouseDzNUD = new System.Windows.Forms.NumericUpDown();
this.label26 = new System.Windows.Forms.Label();
this.triggerCondAndCombo = new System.Windows.Forms.ComboBox();
this.cBGyroMouseXAxis = new System.Windows.Forms.ComboBox();
@ -475,6 +478,7 @@
this.fLPSettings.SuspendLayout();
this.gBGyro.SuspendLayout();
this.pnlSAMouse.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.gyroMouseDzNUD)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nUDGyroSmoothWeight)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nUDGyroMouseVertScale)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nUDGyroSensitivity)).BeginInit();
@ -3203,7 +3207,8 @@
this.cBSixaxisZOutputCurve.Items.AddRange(new object[] {
resources.GetString("cBSixaxisZOutputCurve.Items"),
resources.GetString("cBSixaxisZOutputCurve.Items1"),
resources.GetString("cBSixaxisZOutputCurve.Items2")});
resources.GetString("cBSixaxisZOutputCurve.Items2"),
resources.GetString("cBSixaxisZOutputCurve.Items3")});
resources.ApplyResources(this.cBSixaxisZOutputCurve, "cBSixaxisZOutputCurve");
this.cBSixaxisZOutputCurve.Name = "cBSixaxisZOutputCurve";
this.cBSixaxisZOutputCurve.SelectedIndexChanged += new System.EventHandler(this.cBSixaxisZOutputCurve_SelectedIndexChanged);
@ -3216,7 +3221,8 @@
this.cBSixaxisXOutputCurve.Items.AddRange(new object[] {
resources.GetString("cBSixaxisXOutputCurve.Items"),
resources.GetString("cBSixaxisXOutputCurve.Items1"),
resources.GetString("cBSixaxisXOutputCurve.Items2")});
resources.GetString("cBSixaxisXOutputCurve.Items2"),
resources.GetString("cBSixaxisXOutputCurve.Items3")});
resources.ApplyResources(this.cBSixaxisXOutputCurve, "cBSixaxisXOutputCurve");
this.cBSixaxisXOutputCurve.Name = "cBSixaxisXOutputCurve";
this.cBSixaxisXOutputCurve.SelectedIndexChanged += new System.EventHandler(this.cBSixaxisXOutputCurve_SelectedIndexChanged);
@ -3239,7 +3245,8 @@
this.cBR2OutputCurve.Items.AddRange(new object[] {
resources.GetString("cBR2OutputCurve.Items"),
resources.GetString("cBR2OutputCurve.Items1"),
resources.GetString("cBR2OutputCurve.Items2")});
resources.GetString("cBR2OutputCurve.Items2"),
resources.GetString("cBR2OutputCurve.Items3")});
resources.ApplyResources(this.cBR2OutputCurve, "cBR2OutputCurve");
this.cBR2OutputCurve.Name = "cBR2OutputCurve";
this.cBR2OutputCurve.SelectedIndexChanged += new System.EventHandler(this.cBR2OutputCurve_SelectedIndexChanged);
@ -3252,7 +3259,8 @@
this.cBL2OutputCurve.Items.AddRange(new object[] {
resources.GetString("cBL2OutputCurve.Items"),
resources.GetString("cBL2OutputCurve.Items1"),
resources.GetString("cBL2OutputCurve.Items2")});
resources.GetString("cBL2OutputCurve.Items2"),
resources.GetString("cBL2OutputCurve.Items3")});
resources.ApplyResources(this.cBL2OutputCurve, "cBL2OutputCurve");
this.cBL2OutputCurve.Name = "cBL2OutputCurve";
this.cBL2OutputCurve.SelectedIndexChanged += new System.EventHandler(this.cBL2OutputCurve_SelectedIndexChanged);
@ -3276,7 +3284,8 @@
resources.GetString("rsOutCurveComboBox.Items"),
resources.GetString("rsOutCurveComboBox.Items1"),
resources.GetString("rsOutCurveComboBox.Items2"),
resources.GetString("rsOutCurveComboBox.Items3")});
resources.GetString("rsOutCurveComboBox.Items3"),
resources.GetString("rsOutCurveComboBox.Items4")});
resources.ApplyResources(this.rsOutCurveComboBox, "rsOutCurveComboBox");
this.rsOutCurveComboBox.Name = "rsOutCurveComboBox";
this.rsOutCurveComboBox.SelectedIndexChanged += new System.EventHandler(this.rsOutCurveComboBox_SelectedIndexChanged);
@ -3290,7 +3299,8 @@
resources.GetString("lsOutCurveComboBox.Items"),
resources.GetString("lsOutCurveComboBox.Items1"),
resources.GetString("lsOutCurveComboBox.Items2"),
resources.GetString("lsOutCurveComboBox.Items3")});
resources.GetString("lsOutCurveComboBox.Items3"),
resources.GetString("lsOutCurveComboBox.Items4")});
resources.ApplyResources(this.lsOutCurveComboBox, "lsOutCurveComboBox");
this.lsOutCurveComboBox.Name = "lsOutCurveComboBox";
this.lsOutCurveComboBox.SelectedIndexChanged += new System.EventHandler(this.lsOutCurveComboBox_SelectedIndexChanged);
@ -3452,6 +3462,9 @@
//
// pnlSAMouse
//
this.pnlSAMouse.Controls.Add(this.toggleGyroMCb);
this.pnlSAMouse.Controls.Add(this.label27);
this.pnlSAMouse.Controls.Add(this.gyroMouseDzNUD);
this.pnlSAMouse.Controls.Add(this.label26);
this.pnlSAMouse.Controls.Add(this.triggerCondAndCombo);
this.pnlSAMouse.Controls.Add(this.cBGyroMouseXAxis);
@ -3474,6 +3487,29 @@
resources.ApplyResources(this.pnlSAMouse, "pnlSAMouse");
this.pnlSAMouse.Name = "pnlSAMouse";
//
// toggleGyroMCb
//
resources.ApplyResources(this.toggleGyroMCb, "toggleGyroMCb");
this.toggleGyroMCb.Name = "toggleGyroMCb";
this.toggleGyroMCb.UseVisualStyleBackColor = true;
this.toggleGyroMCb.Click += new System.EventHandler(this.toggleGyroMCb_Click);
//
// label27
//
resources.ApplyResources(this.label27, "label27");
this.label27.Name = "label27";
//
// gyroMouseDzNUD
//
resources.ApplyResources(this.gyroMouseDzNUD, "gyroMouseDzNUD");
this.gyroMouseDzNUD.Name = "gyroMouseDzNUD";
this.gyroMouseDzNUD.Value = new decimal(new int[] {
10,
0,
0,
0});
this.gyroMouseDzNUD.ValueChanged += new System.EventHandler(this.gyroMouseDzNUD_ValueChanged);
//
// label26
//
resources.ApplyResources(this.label26, "label26");
@ -4301,6 +4337,7 @@
this.gBGyro.PerformLayout();
this.pnlSAMouse.ResumeLayout(false);
this.pnlSAMouse.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.gyroMouseDzNUD)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nUDGyroSmoothWeight)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nUDGyroMouseVertScale)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nUDGyroSensitivity)).EndInit();
@ -4686,5 +4723,8 @@
private System.Windows.Forms.Label lblSteeringWheelEmulationRange;
private System.Windows.Forms.ComboBox cBSteeringWheelEmulationRange;
private System.Windows.Forms.Button btnSteeringWheelEmulationCalibrate;
private System.Windows.Forms.Label label27;
private System.Windows.Forms.NumericUpDown gyroMouseDzNUD;
private System.Windows.Forms.CheckBox toggleGyroMCb;
}
}

View File

@ -718,6 +718,8 @@ namespace DS4Windows
nUDGyroSmoothWeight.Value = (decimal)(GyroSmoothingWeight[device]);
cBGyroMouseXAxis.SelectedIndex = GyroMouseHorizontalAxis[device];
triggerCondAndCombo.SelectedIndex = SATriggerCond[device] ? 0 : 1;
gyroMouseDzNUD.Value = GyroMouseDeadZone[device];
toggleGyroMCb.Checked = GyroMouseToggle[device];
cBSteeringWheelEmulationAxis.SelectedIndex = (int) GetSASteeringWheelEmulationAxis(device);
@ -839,6 +841,8 @@ namespace DS4Windows
cBGyroInvertY.Checked = false;
cBGyroSmooth.Checked = false;
nUDGyroSmoothWeight.Value = 0.5m;
gyroMouseDzNUD.Value = MouseCursor.GYRO_MOUSE_DEADZONE;
toggleGyroMCb.Checked = false;
cBGyroMouseXAxis.SelectedIndex = 0;
triggerCondAndCombo.SelectedIndex = 0;
cBSteeringWheelEmulationAxis.SelectedIndex = 0;
@ -1344,6 +1348,8 @@ namespace DS4Windows
GyroSmoothing[device] = cBGyroSmooth.Checked;
GyroSmoothingWeight[device] = (double)nUDGyroSmoothWeight.Value;
GyroMouseHorizontalAxis[device] = cBGyroMouseXAxis.SelectedIndex;
SetGyroMouseDeadZone(device, (int)gyroMouseDzNUD.Value, Program.rootHub);
SetGyroMouseToggle(device, toggleGyroMCb.Checked, Program.rootHub);
int invert = 0;
if (cBGyroInvertX.Checked)
@ -2824,6 +2830,8 @@ namespace DS4Windows
if (!loading)
{
GyroTriggerTurns[device] = gyroTriggerBehavior.Checked;
if (device < 4)
Program.rootHub.touchPad[device]?.ResetToggleGyroM();
}
}
@ -3071,6 +3079,26 @@ namespace DS4Windows
}
}
private void gyroMouseDzNUD_ValueChanged(object sender, EventArgs e)
{
if (loading == false)
{
SetGyroMouseDeadZone(device, (int)gyroMouseDzNUD.Value,
Program.rootHub);
}
}
private void toggleGyroMCb_Click(object sender, EventArgs e)
{
if (loading == false)
{
if (device < 4)
{
SetGyroMouseToggle(device, toggleGyroMCb.Checked, Program.rootHub);
}
}
}
private void trackFrictionNUD_ValueChanged(object sender, EventArgs e)
{
if (loading == false)

View File

@ -148,7 +148,7 @@
<value>0</value>
</data>
<data name="nUDRainbow.Location" type="System.Drawing.Point, System.Drawing">
<value>30, 215</value>
<value>28, 207</value>
</data>
<data name="nUDRainbow.Size" type="System.Drawing.Size, System.Drawing">
<value>39, 20</value>
@ -256,7 +256,7 @@
<value>NoControl</value>
</data>
<data name="cBLightbyBattery.Location" type="System.Drawing.Point, System.Drawing">
<value>6, 191</value>
<value>6, 184</value>
</data>
<data name="cBLightbyBattery.Size" type="System.Drawing.Size, System.Drawing">
<value>111, 17</value>
@ -346,7 +346,7 @@
<value>NoControl</value>
</data>
<data name="lbspc.Location" type="System.Drawing.Point, System.Drawing">
<value>72, 218</value>
<value>70, 210</value>
</data>
<data name="lbspc.Size" type="System.Drawing.Size, System.Drawing">
<value>59, 13</value>
@ -2552,7 +2552,7 @@ with profile</value>
<value>NoControl</value>
</data>
<data name="btnRainbow.Location" type="System.Drawing.Point, System.Drawing">
<value>6, 214</value>
<value>4, 206</value>
</data>
<data name="btnRainbow.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>2, 2, 2, 2</value>
@ -2582,7 +2582,7 @@ with profile</value>
<value>NoControl</value>
</data>
<data name="lbRainbowB.Location" type="System.Drawing.Point, System.Drawing">
<value>203, 214</value>
<value>201, 206</value>
</data>
<data name="lbRainbowB.Size" type="System.Drawing.Size, System.Drawing">
<value>15, 13</value>
@ -2609,7 +2609,7 @@ with profile</value>
<value>1</value>
</data>
<data name="nUDRainbowB.Location" type="System.Drawing.Point, System.Drawing">
<value>151, 214</value>
<value>149, 206</value>
</data>
<data name="nUDRainbowB.Size" type="System.Drawing.Size, System.Drawing">
<value>43, 20</value>
@ -2639,7 +2639,7 @@ with profile</value>
<value>Pulse at</value>
</data>
<data name="cBFlashType.Location" type="System.Drawing.Point, System.Drawing">
<value>4, 133</value>
<value>6, 123</value>
</data>
<data name="cBFlashType.Size" type="System.Drawing.Size, System.Drawing">
<value>68, 21</value>
@ -2672,7 +2672,7 @@ with profile</value>
<value>Color</value>
</data>
<data name="cBWhileCharging.Location" type="System.Drawing.Point, System.Drawing">
<value>91, 166</value>
<value>90, 156</value>
</data>
<data name="cBWhileCharging.Size" type="System.Drawing.Size, System.Drawing">
<value>121, 21</value>
@ -2702,7 +2702,7 @@ with profile</value>
<value>NoControl</value>
</data>
<data name="btnFlashColor.Location" type="System.Drawing.Point, System.Drawing">
<value>146, 137</value>
<value>148, 127</value>
</data>
<data name="btnFlashColor.Size" type="System.Drawing.Size, System.Drawing">
<value>13, 13</value>
@ -2729,7 +2729,7 @@ with profile</value>
<value>NoControl</value>
</data>
<data name="btnChargingColor.Location" type="System.Drawing.Point, System.Drawing">
<value>218, 168</value>
<value>217, 158</value>
</data>
<data name="btnChargingColor.Size" type="System.Drawing.Size, System.Drawing">
<value>13, 13</value>
@ -2759,7 +2759,7 @@ with profile</value>
<value>NoControl</value>
</data>
<data name="lbWhileCharging.Location" type="System.Drawing.Point, System.Drawing">
<value>5, 167</value>
<value>4, 157</value>
</data>
<data name="lbWhileCharging.Size" type="System.Drawing.Size, System.Drawing">
<value>82, 13</value>
@ -2813,7 +2813,7 @@ with profile</value>
<value>8</value>
</data>
<data name="nUDflashLED.Location" type="System.Drawing.Point, System.Drawing">
<value>78, 134</value>
<value>80, 124</value>
</data>
<data name="nUDflashLED.Size" type="System.Drawing.Size, System.Drawing">
<value>43, 20</value>
@ -2837,7 +2837,7 @@ with profile</value>
<value>3, 3</value>
</data>
<data name="gBLightbar.Size" type="System.Drawing.Size, System.Drawing">
<value>272, 244</value>
<value>272, 233</value>
</data>
<data name="gBLightbar.TabIndex" type="System.Int32, mscorlib">
<value>247</value>
@ -3821,7 +3821,7 @@ with profile</value>
<value>3, 3, 3, 3</value>
</data>
<data name="lbL2TrackS.Size" type="System.Drawing.Size, System.Drawing">
<value>438, 455</value>
<value>438, 485</value>
</data>
<data name="lbL2TrackS.TabIndex" type="System.Int32, mscorlib">
<value>2</value>
@ -4259,7 +4259,7 @@ with profile</value>
<value>4, 43</value>
</data>
<data name="fLPTiltControls.Size" type="System.Drawing.Size, System.Drawing">
<value>271, 170</value>
<value>271, 203</value>
</data>
<data name="fLPTiltControls.TabIndex" type="System.Int32, mscorlib">
<value>254</value>
@ -4385,7 +4385,7 @@ with profile</value>
<value>278, 254</value>
</data>
<data name="lBControls.Size" type="System.Drawing.Size, System.Drawing">
<value>157, 186</value>
<value>157, 212</value>
</data>
<data name="lBControls.TabIndex" type="System.Int32, mscorlib">
<value>180</value>
@ -6119,7 +6119,7 @@ with profile</value>
<value>3, 3, 3, 3</value>
</data>
<data name="tPControls.Size" type="System.Drawing.Size, System.Drawing">
<value>438, 455</value>
<value>438, 485</value>
</data>
<data name="tPControls.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
@ -6164,7 +6164,7 @@ with profile</value>
<value>0, 66</value>
</data>
<data name="lVActions.Size" type="System.Drawing.Size, System.Drawing">
<value>438, 389</value>
<value>438, 419</value>
</data>
<data name="lVActions.TabIndex" type="System.Int32, mscorlib">
<value>13</value>
@ -6353,7 +6353,7 @@ with profile</value>
<value>0, 0</value>
</data>
<data name="pnlActions.Size" type="System.Drawing.Size, System.Drawing">
<value>438, 455</value>
<value>438, 485</value>
</data>
<data name="pnlActions.TabIndex" type="System.Int32, mscorlib">
<value>15</value>
@ -6374,7 +6374,7 @@ with profile</value>
<value>4, 22</value>
</data>
<data name="tPSpecial.Size" type="System.Drawing.Size, System.Drawing">
<value>438, 455</value>
<value>438, 485</value>
</data>
<data name="tPSpecial.TabIndex" type="System.Int32, mscorlib">
<value>3</value>
@ -6401,7 +6401,7 @@ with profile</value>
<value>0, 0</value>
</data>
<data name="tCControls.Size" type="System.Drawing.Size, System.Drawing">
<value>446, 481</value>
<value>446, 511</value>
</data>
<data name="tCControls.TabIndex" type="System.Int32, mscorlib">
<value>253</value>
@ -7120,6 +7120,9 @@ with profile</value>
<data name="cBSixaxisZOutputCurve.Items2" xml:space="preserve">
<value>Cubic</value>
</data>
<data name="cBSixaxisZOutputCurve.Items3" xml:space="preserve">
<value>Easeout Quad</value>
</data>
<data name="cBSixaxisZOutputCurve.Location" type="System.Drawing.Point, System.Drawing">
<value>221, 28</value>
</data>
@ -7150,6 +7153,9 @@ with profile</value>
<data name="cBSixaxisXOutputCurve.Items2" xml:space="preserve">
<value>Cubic</value>
</data>
<data name="cBSixaxisXOutputCurve.Items3" xml:space="preserve">
<value>Easeout Quad</value>
</data>
<data name="cBSixaxisXOutputCurve.Location" type="System.Drawing.Point, System.Drawing">
<value>221, 1</value>
</data>
@ -7240,6 +7246,9 @@ with profile</value>
<data name="cBR2OutputCurve.Items2" xml:space="preserve">
<value>Cubic</value>
</data>
<data name="cBR2OutputCurve.Items3" xml:space="preserve">
<value>Easeout Quad</value>
</data>
<data name="cBR2OutputCurve.Location" type="System.Drawing.Point, System.Drawing">
<value>111, 28</value>
</data>
@ -7270,6 +7279,9 @@ with profile</value>
<data name="cBL2OutputCurve.Items2" xml:space="preserve">
<value>Cubic</value>
</data>
<data name="cBL2OutputCurve.Items3" xml:space="preserve">
<value>Easeout Quad</value>
</data>
<data name="cBL2OutputCurve.Location" type="System.Drawing.Point, System.Drawing">
<value>31, 28</value>
</data>
@ -7363,6 +7375,9 @@ with profile</value>
<data name="rsOutCurveComboBox.Items3" xml:space="preserve">
<value>Cubic</value>
</data>
<data name="rsOutCurveComboBox.Items4" xml:space="preserve">
<value>Easeout Quad</value>
</data>
<data name="rsOutCurveComboBox.Location" type="System.Drawing.Point, System.Drawing">
<value>111, 3</value>
</data>
@ -7396,6 +7411,9 @@ with profile</value>
<data name="lsOutCurveComboBox.Items3" xml:space="preserve">
<value>Cubic</value>
</data>
<data name="lsOutCurveComboBox.Items4" xml:space="preserve">
<value>Easeout Quad</value>
</data>
<data name="lsOutCurveComboBox.Location" type="System.Drawing.Point, System.Drawing">
<value>31, 2</value>
</data>
@ -7915,6 +7933,84 @@ with profile</value>
<data name="&gt;&gt;rBSAMouse.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="toggleGyroMCb.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="toggleGyroMCb.Location" type="System.Drawing.Point, System.Drawing">
<value>9, 187</value>
</data>
<data name="toggleGyroMCb.RightToLeft" type="System.Windows.Forms.RightToLeft, System.Windows.Forms">
<value>Yes</value>
</data>
<data name="toggleGyroMCb.Size" type="System.Drawing.Size, System.Drawing">
<value>59, 17</value>
</data>
<data name="toggleGyroMCb.TabIndex" type="System.Int32, mscorlib">
<value>276</value>
</data>
<data name="toggleGyroMCb.Text" xml:space="preserve">
<value>Toggle</value>
</data>
<data name="&gt;&gt;toggleGyroMCb.Name" xml:space="preserve">
<value>toggleGyroMCb</value>
</data>
<data name="&gt;&gt;toggleGyroMCb.Type" xml:space="preserve">
<value>System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;toggleGyroMCb.Parent" xml:space="preserve">
<value>pnlSAMouse</value>
</data>
<data name="&gt;&gt;toggleGyroMCb.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="label27.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label27.Location" type="System.Drawing.Point, System.Drawing">
<value>11, 166</value>
</data>
<data name="label27.Size" type="System.Drawing.Size, System.Drawing">
<value>56, 13</value>
</data>
<data name="label27.TabIndex" type="System.Int32, mscorlib">
<value>275</value>
</data>
<data name="label27.Text" xml:space="preserve">
<value>Deadzone</value>
</data>
<data name="&gt;&gt;label27.Name" xml:space="preserve">
<value>label27</value>
</data>
<data name="&gt;&gt;label27.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;label27.Parent" xml:space="preserve">
<value>pnlSAMouse</value>
</data>
<data name="&gt;&gt;label27.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="gyroMouseDzNUD.Location" type="System.Drawing.Point, System.Drawing">
<value>78, 166</value>
</data>
<data name="gyroMouseDzNUD.Size" type="System.Drawing.Size, System.Drawing">
<value>43, 20</value>
</data>
<data name="gyroMouseDzNUD.TabIndex" type="System.Int32, mscorlib">
<value>274</value>
</data>
<data name="&gt;&gt;gyroMouseDzNUD.Name" xml:space="preserve">
<value>gyroMouseDzNUD</value>
</data>
<data name="&gt;&gt;gyroMouseDzNUD.Type" xml:space="preserve">
<value>System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;gyroMouseDzNUD.Parent" xml:space="preserve">
<value>pnlSAMouse</value>
</data>
<data name="&gt;&gt;gyroMouseDzNUD.ZOrder" xml:space="preserve">
<value>2</value>
</data>
<data name="label26.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
@ -7943,7 +8039,7 @@ with profile</value>
<value>pnlSAMouse</value>
</data>
<data name="&gt;&gt;label26.ZOrder" xml:space="preserve">
<value>0</value>
<value>3</value>
</data>
<data name="triggerCondAndCombo.Items" xml:space="preserve">
<value>And</value>
@ -7952,7 +8048,7 @@ with profile</value>
<value>Or</value>
</data>
<data name="triggerCondAndCombo.Location" type="System.Drawing.Point, System.Drawing">
<value>165, 67</value>
<value>165, 62</value>
</data>
<data name="triggerCondAndCombo.Size" type="System.Drawing.Size, System.Drawing">
<value>73, 21</value>
@ -7970,7 +8066,7 @@ with profile</value>
<value>pnlSAMouse</value>
</data>
<data name="&gt;&gt;triggerCondAndCombo.ZOrder" xml:space="preserve">
<value>1</value>
<value>4</value>
</data>
<data name="cBGyroMouseXAxis.Items" xml:space="preserve">
<value>Yaw</value>
@ -7979,7 +8075,7 @@ with profile</value>
<value>Roll</value>
</data>
<data name="cBGyroMouseXAxis.Location" type="System.Drawing.Point, System.Drawing">
<value>170, 114</value>
<value>169, 107</value>
</data>
<data name="cBGyroMouseXAxis.Size" type="System.Drawing.Size, System.Drawing">
<value>74, 21</value>
@ -7997,7 +8093,7 @@ with profile</value>
<value>pnlSAMouse</value>
</data>
<data name="&gt;&gt;cBGyroMouseXAxis.ZOrder" xml:space="preserve">
<value>2</value>
<value>5</value>
</data>
<data name="label16.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@ -8006,7 +8102,7 @@ with profile</value>
<value>NoControl</value>
</data>
<data name="label16.Location" type="System.Drawing.Point, System.Drawing">
<value>167, 95</value>
<value>166, 91</value>
</data>
<data name="label16.Size" type="System.Drawing.Size, System.Drawing">
<value>39, 13</value>
@ -8027,7 +8123,7 @@ with profile</value>
<value>pnlSAMouse</value>
</data>
<data name="&gt;&gt;label16.ZOrder" xml:space="preserve">
<value>3</value>
<value>6</value>
</data>
<data name="lbGyroSmooth.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@ -8036,7 +8132,7 @@ with profile</value>
<value>NoControl</value>
</data>
<data name="lbGyroSmooth.Location" type="System.Drawing.Point, System.Drawing">
<value>8, 145</value>
<value>6, 139</value>
</data>
<data name="lbGyroSmooth.Size" type="System.Drawing.Size, System.Drawing">
<value>60, 13</value>
@ -8057,7 +8153,7 @@ with profile</value>
<value>pnlSAMouse</value>
</data>
<data name="&gt;&gt;lbGyroSmooth.ZOrder" xml:space="preserve">
<value>4</value>
<value>7</value>
</data>
<data name="cBGyroSmooth.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@ -8066,7 +8162,7 @@ with profile</value>
<value>NoControl</value>
</data>
<data name="cBGyroSmooth.Location" type="System.Drawing.Point, System.Drawing">
<value>75, 145</value>
<value>73, 139</value>
</data>
<data name="cBGyroSmooth.RightToLeft" type="System.Windows.Forms.RightToLeft, System.Windows.Forms">
<value>Yes</value>
@ -8087,7 +8183,7 @@ with profile</value>
<value>pnlSAMouse</value>
</data>
<data name="&gt;&gt;cBGyroSmooth.ZOrder" xml:space="preserve">
<value>5</value>
<value>8</value>
</data>
<data name="lbSmoothWeight.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@ -8096,7 +8192,7 @@ with profile</value>
<value>NoControl</value>
</data>
<data name="lbSmoothWeight.Location" type="System.Drawing.Point, System.Drawing">
<value>96, 145</value>
<value>94, 139</value>
</data>
<data name="lbSmoothWeight.Size" type="System.Drawing.Size, System.Drawing">
<value>83, 13</value>
@ -8117,13 +8213,13 @@ with profile</value>
<value>pnlSAMouse</value>
</data>
<data name="&gt;&gt;lbSmoothWeight.ZOrder" xml:space="preserve">
<value>6</value>
<value>9</value>
</data>
<data name="nUDGyroSmoothWeight.Enabled" type="System.Boolean, mscorlib">
<value>False</value>
</data>
<data name="nUDGyroSmoothWeight.Location" type="System.Drawing.Point, System.Drawing">
<value>185, 141</value>
<value>183, 135</value>
</data>
<data name="nUDGyroSmoothWeight.Size" type="System.Drawing.Size, System.Drawing">
<value>55, 20</value>
@ -8141,7 +8237,7 @@ with profile</value>
<value>pnlSAMouse</value>
</data>
<data name="&gt;&gt;nUDGyroSmoothWeight.ZOrder" xml:space="preserve">
<value>7</value>
<value>10</value>
</data>
<data name="label12.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@ -8171,10 +8267,10 @@ with profile</value>
<value>pnlSAMouse</value>
</data>
<data name="&gt;&gt;label12.ZOrder" xml:space="preserve">
<value>8</value>
<value>11</value>
</data>
<data name="nUDGyroMouseVertScale.Location" type="System.Drawing.Point, System.Drawing">
<value>96, 93</value>
<value>95, 89</value>
</data>
<data name="nUDGyroMouseVertScale.Size" type="System.Drawing.Size, System.Drawing">
<value>49, 20</value>
@ -8192,7 +8288,7 @@ with profile</value>
<value>pnlSAMouse</value>
</data>
<data name="&gt;&gt;nUDGyroMouseVertScale.ZOrder" xml:space="preserve">
<value>9</value>
<value>12</value>
</data>
<data name="label11.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@ -8201,7 +8297,7 @@ with profile</value>
<value>NoControl</value>
</data>
<data name="label11.Location" type="System.Drawing.Point, System.Drawing">
<value>8, 95</value>
<value>7, 91</value>
</data>
<data name="label11.Size" type="System.Drawing.Size, System.Drawing">
<value>75, 13</value>
@ -8222,7 +8318,7 @@ with profile</value>
<value>pnlSAMouse</value>
</data>
<data name="&gt;&gt;label11.ZOrder" xml:space="preserve">
<value>10</value>
<value>13</value>
</data>
<data name="gyroTriggerBehavior.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@ -8255,7 +8351,7 @@ with profile</value>
<value>pnlSAMouse</value>
</data>
<data name="&gt;&gt;gyroTriggerBehavior.ZOrder" xml:space="preserve">
<value>11</value>
<value>14</value>
</data>
<data name="cBGyroInvertY.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@ -8264,7 +8360,7 @@ with profile</value>
<value>NoControl</value>
</data>
<data name="cBGyroInvertY.Location" type="System.Drawing.Point, System.Drawing">
<value>92, 119</value>
<value>95, 114</value>
</data>
<data name="cBGyroInvertY.RightToLeft" type="System.Windows.Forms.RightToLeft, System.Windows.Forms">
<value>Yes</value>
@ -8288,7 +8384,7 @@ with profile</value>
<value>pnlSAMouse</value>
</data>
<data name="&gt;&gt;cBGyroInvertY.ZOrder" xml:space="preserve">
<value>12</value>
<value>15</value>
</data>
<data name="cBGyroInvertX.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@ -8297,7 +8393,7 @@ with profile</value>
<value>NoControl</value>
</data>
<data name="cBGyroInvertX.Location" type="System.Drawing.Point, System.Drawing">
<value>49, 119</value>
<value>52, 114</value>
</data>
<data name="cBGyroInvertX.RightToLeft" type="System.Windows.Forms.RightToLeft, System.Windows.Forms">
<value>Yes</value>
@ -8321,7 +8417,7 @@ with profile</value>
<value>pnlSAMouse</value>
</data>
<data name="&gt;&gt;cBGyroInvertX.ZOrder" xml:space="preserve">
<value>13</value>
<value>16</value>
</data>
<data name="lbGyroInvert.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@ -8330,7 +8426,7 @@ with profile</value>
<value>NoControl</value>
</data>
<data name="lbGyroInvert.Location" type="System.Drawing.Point, System.Drawing">
<value>8, 119</value>
<value>11, 114</value>
</data>
<data name="lbGyroInvert.Size" type="System.Drawing.Size, System.Drawing">
<value>37, 13</value>
@ -8354,7 +8450,7 @@ with profile</value>
<value>pnlSAMouse</value>
</data>
<data name="&gt;&gt;lbGyroInvert.ZOrder" xml:space="preserve">
<value>14</value>
<value>17</value>
</data>
<data name="lbGyroTriggers.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@ -8387,7 +8483,7 @@ with profile</value>
<value>pnlSAMouse</value>
</data>
<data name="&gt;&gt;lbGyroTriggers.ZOrder" xml:space="preserve">
<value>15</value>
<value>18</value>
</data>
<data name="btnGyroTriggers.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
@ -8417,10 +8513,10 @@ with profile</value>
<value>pnlSAMouse</value>
</data>
<data name="&gt;&gt;btnGyroTriggers.ZOrder" xml:space="preserve">
<value>16</value>
<value>19</value>
</data>
<data name="nUDGyroSensitivity.Location" type="System.Drawing.Point, System.Drawing">
<value>96, 67</value>
<value>96, 62</value>
</data>
<data name="nUDGyroSensitivity.Size" type="System.Drawing.Size, System.Drawing">
<value>49, 20</value>
@ -8438,7 +8534,7 @@ with profile</value>
<value>pnlSAMouse</value>
</data>
<data name="&gt;&gt;nUDGyroSensitivity.ZOrder" xml:space="preserve">
<value>17</value>
<value>20</value>
</data>
<data name="lbGyroSens.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@ -8447,7 +8543,7 @@ with profile</value>
<value>NoControl</value>
</data>
<data name="lbGyroSens.Location" type="System.Drawing.Point, System.Drawing">
<value>8, 69</value>
<value>8, 64</value>
</data>
<data name="lbGyroSens.Size" type="System.Drawing.Size, System.Drawing">
<value>82, 13</value>
@ -8471,16 +8567,16 @@ with profile</value>
<value>pnlSAMouse</value>
</data>
<data name="&gt;&gt;lbGyroSens.ZOrder" xml:space="preserve">
<value>18</value>
<value>21</value>
</data>
<data name="pnlSAMouse.Location" type="System.Drawing.Point, System.Drawing">
<value>6, 43</value>
<value>6, 39</value>
</data>
<data name="pnlSAMouse.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>2, 2, 2, 2</value>
</data>
<data name="pnlSAMouse.Size" type="System.Drawing.Size, System.Drawing">
<value>263, 170</value>
<value>263, 207</value>
</data>
<data name="pnlSAMouse.TabIndex" type="System.Int32, mscorlib">
<value>259</value>
@ -8498,10 +8594,10 @@ with profile</value>
<value>3</value>
</data>
<data name="gBGyro.Location" type="System.Drawing.Point, System.Drawing">
<value>3, 253</value>
<value>3, 242</value>
</data>
<data name="gBGyro.Size" type="System.Drawing.Size, System.Drawing">
<value>272, 224</value>
<value>272, 257</value>
</data>
<data name="gBGyro.TabIndex" type="System.Int32, mscorlib">
<value>248</value>
@ -8876,7 +8972,7 @@ with profile</value>
<value>2, 2, 2, 2</value>
</data>
<data name="fLPSettings.Size" type="System.Drawing.Size, System.Drawing">
<value>565, 481</value>
<value>565, 511</value>
</data>
<data name="fLPSettings.TabIndex" type="System.Int32, mscorlib">
<value>254</value>
@ -9167,16 +9263,16 @@ with profile</value>
<value>True</value>
</data>
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
<value>1011, 481</value>
<value>1011, 511</value>
</data>
<data name="$this.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>4, 4, 4, 4</value>
</data>
<data name="$this.MaximumSize" type="System.Drawing.Size, System.Drawing">
<value>1027, 520</value>
<value>1027, 550</value>
</data>
<data name="$this.MinimumSize" type="System.Drawing.Size, System.Drawing">
<value>18, 94</value>
<value>18, 520</value>
</data>
<data name="$this.Text" xml:space="preserve">
<value>Profile Options</value>
@ -9587,7 +9683,7 @@ with profile</value>
<value>advColorDialog</value>
</data>
<data name="&gt;&gt;advColorDialog.Type" xml:space="preserve">
<value>DS4Windows.AdvancedColorDialog, DS4Windows, Version=1.6.0.0, Culture=neutral, PublicKeyToken=null</value>
<value>DS4Windows.AdvancedColorDialog, DS4Windows, Version=1.6.8.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;$this.Name" xml:space="preserve">
<value>Options</value>

View File

@ -12,7 +12,7 @@ using DS4Windows.DS4Library;
namespace DS4Windows
{
public struct DS4Color
public struct DS4Color : IEquatable<DS4Color>
{
public byte red;
public byte green;
@ -31,15 +31,9 @@ namespace DS4Windows
blue = b;
}
public override bool Equals(object obj)
public bool Equals(DS4Color other)
{
if (obj is DS4Color)
{
DS4Color dsc = ((DS4Color)obj);
return (this.red == dsc.red && this.green == dsc.green && this.blue == dsc.blue);
}
else
return false;
return this.red == other.red && this.green == other.green && this.blue == other.blue;
}
public Color ToColor => Color.FromArgb(red, green, blue);
@ -1149,6 +1143,7 @@ namespace DS4Windows
lock (outReportBuffer)
{
bool output = outputPendCount > 0, change = force;
bool haptime = output || standbySw.ElapsedMilliseconds >= 4000L;
if (usingBT)
{
@ -1169,6 +1164,8 @@ namespace DS4Windows
for (int i = 0, arlen = BT_OUTPUT_CHANGE_LENGTH; !change && i < arlen; i++)
change = byteR[i] != byteB[i];
}
haptime = haptime || change;
}
else
{
@ -1189,7 +1186,8 @@ namespace DS4Windows
change = byteR[i] != byteB[i];
}
if (change && audio != null)
haptime = haptime || change;
if (haptime && audio != null)
{
// Headphone volume levels
outReportBuffer[19] = outReportBuffer[20] =
@ -1201,8 +1199,7 @@ namespace DS4Windows
if (synchronous)
{
output = output || standbySw.ElapsedMilliseconds >= 4000L;
if (output || change)
if (output || haptime)
{
if (change)
{
@ -1250,8 +1247,7 @@ namespace DS4Windows
//for (int i = 0, arlen = outputReport.Length; !change && i < arlen; i++)
// change = outputReport[i] != outReportBuffer[i];
output = output || standbySw.ElapsedMilliseconds >= 4000L;
if (output || change)
if (output || haptime)
{
if (change)
{

View File

@ -179,9 +179,11 @@ namespace DS4Windows
{
IEnumerable<DS4Device> devices = getDS4Controllers();
//foreach (DS4Device device in devices)
for (int i = 0, devCount = devices.Count(); i < devCount; i++)
//for (int i = 0, devCount = devices.Count(); i < devCount; i++)
for (var devEnum = devices.GetEnumerator(); devEnum.MoveNext();)
{
DS4Device device = devices.ElementAt(i);
DS4Device device = devEnum.Current;
//DS4Device device = devices.ElementAt(i);
device.StopUpdate();
//device.runRemoval();
device.HidDevice.CloseDevice();
@ -248,9 +250,11 @@ namespace DS4Windows
if (disabledDevCount > 0)
{
List<HidDevice> disabledDevList = new List<HidDevice>();
for (int i = 0, arlen = disabledDevCount; i < arlen; i++)
for (var devEnum = DisabledDevices.GetEnumerator(); devEnum.MoveNext();)
//for (int i = 0, arlen = disabledDevCount; i < arlen; i++)
{
HidDevice tempDev = DisabledDevices.ElementAt(i);
//HidDevice tempDev = DisabledDevices.ElementAt(i);
HidDevice tempDev = devEnum.Current;
if (tempDev != null)
{
if (tempDev.IsOpen && tempDev.IsConnected)

View File

@ -49,7 +49,7 @@ namespace DS4Windows
L1 = L2Btn = L3 = R1 = R2Btn = R3 = false;
Share = Options = PS = Touch1 = Touch2 = TouchButton = TouchRight = TouchLeft = false;
Touch1Finger = Touch2Fingers = false;
LX = RX = LY = RY = 127;
LX = RX = LY = RY = 128;
L2 = R2 = 0;
FrameCounter = 255; // only actually has 6 bits, so this is a null indicator
TouchPacketCounter = 255; // 8 bits, no great junk value
@ -187,14 +187,14 @@ namespace DS4Windows
public void calculateStickAngles()
{
double lsangle = Math.Atan2(-(LY - 127), (LX - 127));
double lsangle = Math.Atan2(-(LY - 128), (LX - 128));
LSAngleRad = lsangle;
lsangle = (lsangle >= 0 ? lsangle : (2 * Math.PI + lsangle)) * 180 / Math.PI;
LSAngle = lsangle;
LXUnit = Math.Abs(Math.Cos(LSAngleRad));
LYUnit = Math.Abs(Math.Sin(LSAngleRad));
double rsangle = Math.Atan2(-(RY - 127), (RX - 127));
double rsangle = Math.Atan2(-(RY - 128), (RX - 128));
RSAngleRad = rsangle;
rsangle = (rsangle >= 0 ? rsangle : (2 * Math.PI + rsangle)) * 180 / Math.PI;
RSAngle = rsangle;
@ -205,17 +205,17 @@ namespace DS4Windows
public void rotateLSCoordinates(double rotation)
{
double sinAngle = Math.Sin(rotation), cosAngle = Math.Cos(rotation);
double tempLX = LX - 127.5, tempLY = LY - 127.5;
LX = (Byte)(Global.Clamp(-127.5, (tempLX * cosAngle - tempLY * sinAngle), 127.5) + 127.5);
LY = (Byte)(Global.Clamp(-127.5, (tempLX * sinAngle + tempLY * cosAngle), 127.5) + 127.5);
double tempLX = LX - 128.0, tempLY = LY - 128.0;
LX = (Byte)(Global.Clamp(-128.0, (tempLX * cosAngle - tempLY * sinAngle), 127.0) + 128.0);
LY = (Byte)(Global.Clamp(-128.0, (tempLX * sinAngle + tempLY * cosAngle), 127.0) + 128.0);
}
public void rotateRSCoordinates(double rotation)
{
double sinAngle = Math.Sin(rotation), cosAngle = Math.Cos(rotation);
double tempRX = RX - 127.5, tempRY = RY - 127.5;
RX = (Byte)(Global.Clamp(-127.5, (tempRX * cosAngle - tempRY * sinAngle), 127.5) + 127.5);
RY = (Byte)(Global.Clamp(-127.5, (tempRX * sinAngle + tempRY * cosAngle), 127.5) + 127.5);
double tempRX = RX - 128.0, tempRY = RY - 128.0;
RX = (Byte)(Global.Clamp(-128.0, (tempRX * cosAngle - tempRY * sinAngle), 127.0) + 128.0);
RY = (Byte)(Global.Clamp(-128.0, (tempRX * sinAngle + tempRY * cosAngle), 127.0) + 128.0);
}
}
}

View File

@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DS4Windows</RootNamespace>
<AssemblyName>DS4Windows</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<TargetFrameworkProfile />
@ -82,7 +82,7 @@
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<DefineConstants>WIN64</DefineConstants>
<GenerateSerializationAssemblies>On</GenerateSerializationAssemblies>
<LangVersion>7.2</LangVersion>
<LangVersion>7.3</LangVersion>
<DebugSymbols>false</DebugSymbols>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<WarningLevel>1</WarningLevel>

View File

@ -450,11 +450,11 @@ namespace DS4Windows
if (isExclusive)
{
hidHandle = NativeMethods.CreateFile(devicePathName, NativeMethods.GENERIC_READ | NativeMethods.GENERIC_WRITE, 0, IntPtr.Zero, NativeMethods.OpenExisting, 0x20000000 | 0x80000000 | NativeMethods.FILE_FLAG_OVERLAPPED, 0);
hidHandle = NativeMethods.CreateFile(devicePathName, NativeMethods.GENERIC_READ | NativeMethods.GENERIC_WRITE, 0, IntPtr.Zero, NativeMethods.OpenExisting, 0x20000000 | 0x80000000 | 0x100 | NativeMethods.FILE_FLAG_OVERLAPPED, 0);
}
else
{
hidHandle = NativeMethods.CreateFile(devicePathName, NativeMethods.GENERIC_READ | NativeMethods.GENERIC_WRITE, NativeMethods.FILE_SHARE_READ | NativeMethods.FILE_SHARE_WRITE, IntPtr.Zero, NativeMethods.OpenExisting, 0x20000000 | 0x80000000 | NativeMethods.FILE_FLAG_OVERLAPPED, 0);
hidHandle = NativeMethods.CreateFile(devicePathName, NativeMethods.GENERIC_READ | NativeMethods.GENERIC_WRITE, NativeMethods.FILE_SHARE_READ | NativeMethods.FILE_SHARE_WRITE, IntPtr.Zero, NativeMethods.OpenExisting, 0x20000000 | 0x80000000 | 0x100 | NativeMethods.FILE_FLAG_OVERLAPPED, 0);
}
return hidHandle;

View File

@ -46,9 +46,11 @@ namespace DS4Windows
List<HidDevice> foundDevs = new List<HidDevice>();
int devInfoLen = devInfo.Length;
IEnumerable<DeviceInfo> temp = EnumerateDevices();
for (int i = 0, len = temp.Count(); i < len; i++)
for (var devEnum = temp.GetEnumerator(); devEnum.MoveNext();)
//for (int i = 0, len = temp.Count(); i < len; i++)
{
DeviceInfo x = temp.ElementAt(i);
DeviceInfo x = devEnum.Current;
//DeviceInfo x = temp.ElementAt(i);
HidDevice tempDev = new HidDevice(x.Path, x.Description);
bool found = false;
for (int j = 0; !found && j < devInfoLen; j++)

View File

@ -5,7 +5,6 @@ using System.Runtime.InteropServices;
using Process = System.Diagnostics.Process;
using System.ComponentModel;
using System.Globalization;
using System.Runtime;
using Microsoft.Win32.TaskScheduler;
namespace DS4Windows
@ -21,7 +20,7 @@ namespace DS4Windows
public static ControlService rootHub;
private static Thread testThread;
private static Thread controlThread;
private static DS4Form ds4form;
private static Form ds4form;
/// <summary>
/// The main entry point for the application.
@ -69,8 +68,6 @@ namespace DS4Windows
}
}
GCSettings.LatencyMode = GCLatencyMode.LowLatency;
try
{
Process.GetCurrentProcess().PriorityClass =

View File

@ -33,7 +33,7 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.6.6")]
[assembly: AssemblyFileVersion("1.6.6")]
[assembly: AssemblyVersion("1.6.11")]
[assembly: AssemblyFileVersion("1.6.11")]
[assembly: NeutralResourcesLanguage("en")]

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/>
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">

View File

@ -1 +1 @@
1.6.6
1.6.11

View File

@ -64,6 +64,21 @@ use DS4Windows properly, you have to open Steam Big Picture Mode, navigate to
Settings > Controller> Controller Settings and uncheck **Xbox Configuration
Support** along with **PlayStation Configuration Support**.
## Personal Game Testing
My PC game library is not that expansive so there are likely games
that will be tested by users that I will not have access to
playing. There are likely going to be times when I cannot directly test
against a game since I will not have access to play it. Most free to play
games or games that include a playable demo should be fine for testing.
For other games, it might be better if people could test against any game
that I have in my game library and try to reproduce a problem. Here are
links to my Steam and GOG profiles so that people can see what games I have
access to play.
https://steamcommunity.com/id/Ryochan7/games/?tab=all
https://www.gog.com/u/Ryochan7/games
## Pull Requests
Pull requests for DS4Windows are welcome. Before making a pull request, please

View File

@ -4,4 +4,5 @@ jdfeng
justalemon
Rajko Stojadinovic (rajkosto)
Yuki-nyan
xrossb