diff --git a/App.config b/App.config deleted file mode 100644 index 0089d7b..0000000 --- a/App.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/DS4Windows.sln b/DS4Windows.sln index e6a8729..0901966 100644 --- a/DS4Windows.sln +++ b/DS4Windows.sln @@ -1,11 +1,9 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0.31101.0 +# Visual Studio 14 +VisualStudioVersion = 14.0.23107.0 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DS4Windows", "DS4Windows.csproj", "{B1081607-B630-4F57-9580-8A4897145890}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ookii.Dialogs", "..\..\..\Downloads\Ookii.Dialogs\src\Ookii.Dialogs\Ookii.Dialogs.csproj", "{779E62B3-C5A6-494D-9D87-96C0DEC7FFB0}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DS4Windows", "DS4Windows\DS4Windows.csproj", "{7B9354BF-AF82-4CCB-A83D-4BEB1E9D8C96}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -13,14 +11,10 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {B1081607-B630-4F57-9580-8A4897145890}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B1081607-B630-4F57-9580-8A4897145890}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B1081607-B630-4F57-9580-8A4897145890}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B1081607-B630-4F57-9580-8A4897145890}.Release|Any CPU.Build.0 = Release|Any CPU - {779E62B3-C5A6-494D-9D87-96C0DEC7FFB0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {779E62B3-C5A6-494D-9D87-96C0DEC7FFB0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {779E62B3-C5A6-494D-9D87-96C0DEC7FFB0}.Release|Any CPU.ActiveCfg = Release|Any CPU - {779E62B3-C5A6-494D-9D87-96C0DEC7FFB0}.Release|Any CPU.Build.0 = Release|Any CPU + {7B9354BF-AF82-4CCB-A83D-4BEB1E9D8C96}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7B9354BF-AF82-4CCB-A83D-4BEB1E9D8C96}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7B9354BF-AF82-4CCB-A83D-4BEB1E9D8C96}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7B9354BF-AF82-4CCB-A83D-4BEB1E9D8C96}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/DS4Control/ControlSerivce.cs b/DS4Windows/DS4Control/ControlSerivce.cs similarity index 90% rename from DS4Control/ControlSerivce.cs rename to DS4Windows/DS4Control/ControlSerivce.cs index 804c785..e032d84 100644 --- a/DS4Control/ControlSerivce.cs +++ b/DS4Windows/DS4Control/ControlSerivce.cs @@ -7,6 +7,7 @@ using System.IO; using System.Reflection; using System.Media; using System.Threading.Tasks; +using static DS4Windows.Global; namespace DS4Windows { public class ControlService @@ -92,7 +93,7 @@ namespace DS4Windows await System.Threading.Tasks.Task.Delay(5); String message = Properties.Resources.CouldNotOpenDS4.Replace("*Mac address*", device.MacAddress) + " " + Properties.Resources.QuitOtherPrograms; LogDebug(message, true); - Log.LogToTray(message); + Log.LogToTray(message, true); } } public bool Start(bool showlog = true) @@ -101,7 +102,7 @@ namespace DS4Windows { if (showlog) LogDebug(Properties.Resources.Starting); - DS4Devices.isExclusiveMode = Global.UseExclusiveMode; + DS4Devices.isExclusiveMode = UseExclusiveMode; if (showlog) { LogDebug(Properties.Resources.SearchingController); @@ -123,17 +124,17 @@ namespace DS4Windows device.Removal += this.On_DS4Removal; device.Removal += DS4Devices.On_Removal; touchPad[ind] = new Mouse(ind, device); - device.LightBarColor = Global.MainColor[ind]; - if (!Global.DinputOnly[ind]) + device.LightBarColor = MainColor[ind]; + if (!DinputOnly[ind]) x360Bus.Plugin(ind); device.Report += this.On_Report; TouchPadOn(ind, device); - //string filename = Global.ProfilePath[ind]; + //string filename = ProfilePath[ind]; ind++; if (showlog) - if (System.IO.File.Exists(Global.appdatapath + "\\Profiles\\" + Global.ProfilePath[ind-1] + ".xml")) + if (System.IO.File.Exists(appdatapath + "\\Profiles\\" + ProfilePath[ind-1] + ".xml")) { - string prolog = Properties.Resources.UsingProfile.Replace("*number*", ind.ToString()).Replace("*Profile name*", Global.ProfilePath[ind-1]); + string prolog = Properties.Resources.UsingProfile.Replace("*number*", ind.ToString()).Replace("*Profile name*", ProfilePath[ind-1]); LogDebug(prolog); Log.LogToTray(prolog); } @@ -170,7 +171,7 @@ namespace DS4Windows { if (DS4Controllers[i] != null) { - if (Global.DCBTatStop && !DS4Controllers[i].Charging && showlog) + if (DCBTatStop && !DS4Controllers[i].Charging && showlog) DS4Controllers[i].DisconnectBT(); else { @@ -196,7 +197,7 @@ namespace DS4Windows DS4Devices.stopControllers(); if (showlog) LogDebug(Properties.Resources.StoppedDS4Windows); - Global.ControllerStatusChanged(this); + ControllerStatusChanged(this); } return true; } @@ -229,15 +230,15 @@ namespace DS4Windows device.Removal += this.On_DS4Removal; device.Removal += DS4Devices.On_Removal; touchPad[Index] = new Mouse(Index, device); - device.LightBarColor = Global.MainColor[Index]; + device.LightBarColor = MainColor[Index]; device.Report += this.On_Report; - if (!Global.DinputOnly[Index]) + if (!DinputOnly[Index]) x360Bus.Plugin(Index); TouchPadOn(Index, device); - //string filename = Path.GetFileName(Global.ProfilePath[Index]); - if (System.IO.File.Exists(Global.appdatapath + "\\Profiles\\" + Global.ProfilePath[Index] + ".xml")) + //string filename = Path.GetFileName(ProfilePath[Index]); + if (System.IO.File.Exists(appdatapath + "\\Profiles\\" + ProfilePath[Index] + ".xml")) { - string prolog = Properties.Resources.UsingProfile.Replace("*number*", (Index + 1).ToString()).Replace("*Profile name*", Global.ProfilePath[Index]); + string prolog = Properties.Resources.UsingProfile.Replace("*number*", (Index + 1).ToString()).Replace("*Profile name*", ProfilePath[Index]); LogDebug(prolog); Log.LogToTray(prolog); } @@ -266,7 +267,7 @@ namespace DS4Windows device.Touchpad.TouchUnchanged += tPad.touchUnchanged; //LogDebug("Touchpad mode for " + device.MacAddress + " is now " + tmode.ToString()); //Log.LogToTray("Touchpad mode for " + device.MacAddress + " is now " + tmode.ToString()); - Global.ControllerStatusChanged(this); + ControllerStatusChanged(this); } public void TimeoutConnection(DS4Device d) @@ -432,7 +433,7 @@ namespace DS4Windows System.Threading.Thread.Sleep(XINPUT_UNPLUG_SETTLE_TIME); DS4Controllers[ind] = null; touchPad[ind] = null; - Global.ControllerStatusChanged(this); + ControllerStatusChanged(this); } } public bool[] lag = { false, false, false, false }; @@ -449,7 +450,7 @@ namespace DS4Windows if (ind != -1) { - if (Global.FlushHIDQueue[ind]) + if (FlushHIDQueue[ind]) device.FlushHID(); if (!string.IsNullOrEmpty(device.error)) { @@ -457,9 +458,9 @@ namespace DS4Windows } if (DateTime.UtcNow - device.firstActive > TimeSpan.FromSeconds(5)) { - if (device.Latency >= 10 && !lag[ind]) + if (device.Latency >= FlashWhenLateAt && !lag[ind]) LagFlashWarning(ind, true); - else if (device.Latency < 10 && lag[ind]) + else if (device.Latency < FlashWhenLateAt && lag[ind]) LagFlashWarning(ind, false); } device.getExposedState(ExposedState[ind], CurrentState[ind]); @@ -467,21 +468,21 @@ namespace DS4Windows device.getPreviousState(PreviousState[ind]); DS4State pState = PreviousState[ind]; if (pState.Battery != cState.Battery) - Global.ControllerStatusChanged(this); + ControllerStatusChanged(this); CheckForHotkeys(ind, cState, pState); if (eastertime) EasterTime(ind); GetInputkeys(ind); - if (Global.LSCurve[ind] != 0 || Global.RSCurve[ind] != 0 || Global.LSDeadzone[ind] != 0 || Global.RSDeadzone[ind] != 0 || - Global.L2Deadzone[ind] != 0 || Global.R2Deadzone[ind] != 0) //if a curve or deadzone is in place + if (LSCurve[ind] != 0 || RSCurve[ind] != 0 || LSDeadzone[ind] != 0 || RSDeadzone[ind] != 0 || + L2Deadzone[ind] != 0 || R2Deadzone[ind] != 0) //if a curve or deadzone is in place cState = Mapping.SetCurveAndDeadzone(ind, cState); - if (!recordingMacro && (!string.IsNullOrEmpty(Global.tempprofilename[ind]) || - Global.getHasCustomKeysorButtons(ind) || Global.getHasShiftCustomKeysorButtons(ind) || Global.ProfileActions[ind].Count > 0)) + if (!recordingMacro && (!string.IsNullOrEmpty(tempprofilename[ind]) || + getHasCustomKeysorButtons(ind) || getHasShiftCustomKeysorButtons(ind) || ProfileActions[ind].Count > 0)) { Mapping.MapCustom(ind, cState, MappedState[ind], ExposedState[ind], touchPad[ind], this); cState = MappedState[ind]; } - if (Global.getHasCustomExtras(ind)) + if (getHasCustomExtras(ind)) DoExtras(ind); // Update the GUI/whatever. @@ -504,7 +505,7 @@ namespace DS4Windows // Output any synthetic events. Mapping.Commit(ind); // Pull settings updates. - device.IdleTimeout = Global.IdleDisconnectTimeout[ind]; + device.IdleTimeout = IdleDisconnectTimeout[ind]; } } @@ -514,7 +515,7 @@ namespace DS4Windows { lag[ind] = true; LogDebug(Properties.Resources.LatencyOverTen.Replace("*number*", (ind + 1).ToString()), true); - if (Global.FlashWhenLate) + if (FlashWhenLate) { DS4Color color = new DS4Color { red = 50, green = 0, blue = 0 }; DS4LightBar.forcedColor[ind] = color; @@ -537,7 +538,7 @@ namespace DS4Windows DS4StateExposed eState = ExposedState[ind]; Mouse tp = touchPad[ind]; DS4Controls helddown = DS4Controls.None; - foreach (KeyValuePair p in Global.getCustomExtras(ind)) + foreach (KeyValuePair p in getCustomExtras(ind)) { if (Mapping.getBoolMapping(p.Key, cState, eState, tp)) { @@ -547,7 +548,7 @@ namespace DS4Windows } if (helddown != DS4Controls.None) { - string p = Global.getCustomExtras(ind)[helddown]; + string p = getCustomExtras(ind)[helddown]; string[] extraS = p.Split(','); int[] extras = new int[extraS.Length]; for (int i = 0; i < extraS.Length; i++) @@ -571,8 +572,8 @@ namespace DS4Windows if (extras[7] == 1) { if (oldmouse[ind] == -1) - oldmouse[ind] = Global.ButtonMouseSensitivity[ind]; - Global.ButtonMouseSensitivity[ind] = extras[8]; + oldmouse[ind] = ButtonMouseSensitivity[ind]; + ButtonMouseSensitivity[ind] = extras[8]; } } catch { } @@ -581,7 +582,7 @@ namespace DS4Windows { DS4LightBar.forcelight[ind] = false; DS4LightBar.forcedFlash[ind] = 0; - Global.ButtonMouseSensitivity[ind] = oldmouse[ind]; + ButtonMouseSensitivity[ind] = oldmouse[ind]; oldmouse[ind] = -1; setRumble(0, 0, ind); held[ind] = false; @@ -747,24 +748,24 @@ namespace DS4Windows public int[] oldscrollvalue = { 0, 0, 0, 0 }; protected virtual void CheckForHotkeys(int deviceID, DS4State cState, DS4State pState) { - if (!Global.UseTPforControls[deviceID] && cState.Touch1 && pState.PS) + if (!UseTPforControls[deviceID] && cState.Touch1 && pState.PS) { - if (Global.TouchSensitivity[deviceID] > 0 && touchreleased[deviceID]) + if (TouchSensitivity[deviceID] > 0 && touchreleased[deviceID]) { - oldtouchvalue[deviceID] = Global.TouchSensitivity[deviceID]; - oldscrollvalue[deviceID] = Global.ScrollSensitivity[deviceID]; - Global.TouchSensitivity[deviceID] = 0; - Global.ScrollSensitivity[deviceID] = 0; - LogDebug(Global.TouchSensitivity[deviceID] > 0 ? Properties.Resources.TouchpadMovementOn : Properties.Resources.TouchpadMovementOff); - Log.LogToTray(Global.TouchSensitivity[deviceID] > 0 ? Properties.Resources.TouchpadMovementOn : Properties.Resources.TouchpadMovementOff); + oldtouchvalue[deviceID] = TouchSensitivity[deviceID]; + oldscrollvalue[deviceID] = ScrollSensitivity[deviceID]; + TouchSensitivity[deviceID] = 0; + ScrollSensitivity[deviceID] = 0; + LogDebug(TouchSensitivity[deviceID] > 0 ? Properties.Resources.TouchpadMovementOn : Properties.Resources.TouchpadMovementOff); + Log.LogToTray(TouchSensitivity[deviceID] > 0 ? Properties.Resources.TouchpadMovementOn : Properties.Resources.TouchpadMovementOff); touchreleased[deviceID] = false; } else if (touchreleased[deviceID]) { - Global.TouchSensitivity[deviceID] = oldtouchvalue[deviceID]; - Global.ScrollSensitivity[deviceID] = oldscrollvalue[deviceID]; - LogDebug(Global.TouchSensitivity[deviceID] > 0 ? Properties.Resources.TouchpadMovementOn : Properties.Resources.TouchpadMovementOff); - Log.LogToTray(Global.TouchSensitivity[deviceID] > 0 ? Properties.Resources.TouchpadMovementOn : Properties.Resources.TouchpadMovementOff); + TouchSensitivity[deviceID] = oldtouchvalue[deviceID]; + ScrollSensitivity[deviceID] = oldscrollvalue[deviceID]; + LogDebug(TouchSensitivity[deviceID] > 0 ? Properties.Resources.TouchpadMovementOn : Properties.Resources.TouchpadMovementOff); + Log.LogToTray(TouchSensitivity[deviceID] > 0 ? Properties.Resources.TouchpadMovementOn : Properties.Resources.TouchpadMovementOff); touchreleased[deviceID] = false; } } @@ -776,10 +777,10 @@ namespace DS4Windows { if (deviceID < 4) { - oldtouchvalue[deviceID] = Global.TouchSensitivity[deviceID]; - oldscrollvalue[deviceID] = Global.ScrollSensitivity[deviceID]; - Global.TouchSensitivity[deviceID] = 0; - Global.ScrollSensitivity[deviceID] = 0; + oldtouchvalue[deviceID] = TouchSensitivity[deviceID]; + oldscrollvalue[deviceID] = ScrollSensitivity[deviceID]; + TouchSensitivity[deviceID] = 0; + ScrollSensitivity[deviceID] = 0; } } @@ -824,7 +825,7 @@ namespace DS4Windows //sets the rumble adjusted with rumble boost public virtual void setRumble(byte heavyMotor, byte lightMotor, int deviceNum) { - byte boost = Global.RumbleBoost[deviceNum]; + byte boost = RumbleBoost[deviceNum]; uint lightBoosted = ((uint)lightMotor * (uint)boost) / 100; if (lightBoosted > 255) lightBoosted = 255; diff --git a/DS4Control/DS4LightBar.cs b/DS4Windows/DS4Control/DS4LightBar.cs similarity index 80% rename from DS4Control/DS4LightBar.cs rename to DS4Windows/DS4Control/DS4LightBar.cs index 1cb8680..c822d64 100644 --- a/DS4Control/DS4LightBar.cs +++ b/DS4Windows/DS4Control/DS4LightBar.cs @@ -3,7 +3,8 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Drawing; - +using static System.Math; +using static DS4Windows.Global; namespace DS4Windows { public class DS4LightBar @@ -33,56 +34,56 @@ namespace DS4Windows DS4Color color; if (!defualtLight && !forcelight[deviceNum]) { - if (Global.ShiftColorOn[deviceNum] && Global.ShiftModifier[deviceNum] > 0 && shiftMod(device, deviceNum, cState, eState, tp)) + if (ShiftColorOn[deviceNum] && ShiftModifier[deviceNum] > 0 && shiftMod(device, deviceNum, cState, eState, tp)) { - color = Global.ShiftColor[deviceNum]; + color = ShiftColor[deviceNum]; } else { - if (Global.Rainbow[deviceNum] > 0) + if (Rainbow[deviceNum] > 0) {// Display rainbow DateTime now = DateTime.UtcNow; if (now >= oldnow + TimeSpan.FromMilliseconds(10)) //update by the millisecond that way it's a smooth transtion { oldnow = now; if (device.Charging) - counters[deviceNum] -= 1.5 * 3 / Global.Rainbow[deviceNum]; + counters[deviceNum] -= 1.5 * 3 / Rainbow[deviceNum]; else - counters[deviceNum] += 1.5 * 3 / Global.Rainbow[deviceNum]; + counters[deviceNum] += 1.5 * 3 / Rainbow[deviceNum]; } if (counters[deviceNum] < 0) counters[deviceNum] = 180000; if (counters[deviceNum] > 180000) counters[deviceNum] = 0; - if (Global.LedAsBatteryIndicator[deviceNum]) + if (LedAsBatteryIndicator[deviceNum]) color = HuetoRGB((float)counters[deviceNum] % 360, (byte)(2.55 * device.Battery)); else color = HuetoRGB((float)counters[deviceNum] % 360, 255); } - else if (Global.LedAsBatteryIndicator[deviceNum]) + else if (LedAsBatteryIndicator[deviceNum]) { //if (device.Charging == false || device.Battery >= 100) // when charged, don't show the charging animation { - DS4Color fullColor = Global.MainColor[deviceNum]; - DS4Color lowColor = Global.LowColor[deviceNum]; + DS4Color fullColor = MainColor[deviceNum]; + DS4Color lowColor = LowColor[deviceNum]; - color = Global.getTransitionedColor(lowColor, fullColor, (uint)device.Battery); + color = getTransitionedColor(lowColor, fullColor, (uint)device.Battery); } } else { - color = Global.MainColor[deviceNum]; + color = MainColor[deviceNum]; } - if (device.Battery <= Global.FlashAt[deviceNum] && !defualtLight && !device.Charging) + if (device.Battery <= FlashAt[deviceNum] && !defualtLight && !device.Charging) { - if (!(Global.FlashColor[deviceNum].red == 0 && - Global.FlashColor[deviceNum].green == 0 && - Global.FlashColor[deviceNum].blue == 0)) - color = Global.FlashColor[deviceNum]; - if (Global.FlashType[deviceNum] == 1) + if (!(FlashColor[deviceNum].red == 0 && + FlashColor[deviceNum].green == 0 && + FlashColor[deviceNum].blue == 0)) + color = FlashColor[deviceNum]; + if (FlashType[deviceNum] == 1) { if (fadetimer[deviceNum] <= 0) fadedirection[deviceNum] = true; @@ -92,23 +93,23 @@ namespace DS4Windows fadetimer[deviceNum] += 1; else fadetimer[deviceNum] -= 1; - color = Global.getTransitionedColor(color, new DS4Color(0,0,0), fadetimer[deviceNum]); + color = getTransitionedColor(color, new DS4Color(0,0,0), fadetimer[deviceNum]); } } - if (Global.IdleDisconnectTimeout[deviceNum] > 0 && Global.LedAsBatteryIndicator[deviceNum] && (!device.Charging || device.Battery >= 100)) + if (IdleDisconnectTimeout[deviceNum] > 0 && LedAsBatteryIndicator[deviceNum] && (!device.Charging || device.Battery >= 100)) {//Fade lightbar by idle time TimeSpan timeratio = new TimeSpan(DateTime.UtcNow.Ticks - device.lastActive.Ticks); double botratio = timeratio.TotalMilliseconds; - double topratio = TimeSpan.FromSeconds(Global.IdleDisconnectTimeout[deviceNum]).TotalMilliseconds; + double topratio = TimeSpan.FromSeconds(IdleDisconnectTimeout[deviceNum]).TotalMilliseconds; double ratio = ((botratio / topratio) * 100); if (ratio >= 50 && ratio <= 100) - color = Global.getTransitionedColor(color, new DS4Color(0, 0, 0), (uint)((ratio - 50) * 2)); + color = getTransitionedColor(color, new DS4Color(0, 0, 0), (uint)((ratio - 50) * 2)); else if (ratio >= 100) - color = Global.getTransitionedColor(color, new DS4Color(0, 0, 0), 100); + color = getTransitionedColor(color, new DS4Color(0, 0, 0), 100); } if (device.Charging && device.Battery < 100) - switch (Global.ChargingType[deviceNum]) + switch (ChargingType[deviceNum]) { case 1: if (fadetimer[deviceNum] <= 0) @@ -119,14 +120,14 @@ namespace DS4Windows fadetimer[deviceNum] += .1; else fadetimer[deviceNum] -= .1; - color = Global.getTransitionedColor(color, new DS4Color(0, 0, 0), fadetimer[deviceNum]); + color = getTransitionedColor(color, new DS4Color(0, 0, 0), fadetimer[deviceNum]); break; case 2: counters[deviceNum] += .167; color = HuetoRGB((float)counters[deviceNum] % 360, 255); break; case 3: - color = Global.ChargingColor[deviceNum]; + color = ChargingColor[deviceNum]; break; default: break; @@ -146,15 +147,15 @@ namespace DS4Windows else color = new DS4Color(0, 0, 0); } - bool distanceprofile = (Global.ProfilePath[deviceNum].ToLower().Contains("distance") || Global.tempprofilename[deviceNum].ToLower().Contains("distance")); + bool distanceprofile = (ProfilePath[deviceNum].ToLower().Contains("distance") || tempprofilename[deviceNum].ToLower().Contains("distance")); if (distanceprofile && !defualtLight) { //Thing I did for Distance float rumble = device.LeftHeavySlowRumble / 2.55f; - byte max = Math.Max(color.red, Math.Max(color.green, color.blue)); + byte max = Max(color.red, Max(color.green, color.blue)); if (device.LeftHeavySlowRumble > 100) - color = Global.getTransitionedColor(new DS4Color(max, max, 0), new DS4Color(255, 0, 0), rumble); + color = getTransitionedColor(new DS4Color(max, max, 0), new DS4Color(255, 0, 0), rumble); else - color = Global.getTransitionedColor(color, Global.getTransitionedColor(new DS4Color(max, max, 0), new DS4Color(255, 0, 0), 39.6078f), device.LeftHeavySlowRumble); + color = getTransitionedColor(color, getTransitionedColor(new DS4Color(max, max, 0), new DS4Color(255, 0, 0), 39.6078f), device.LeftHeavySlowRumble); } DS4HapticState haptics = new DS4HapticState { @@ -167,7 +168,7 @@ namespace DS4Windows haptics.LightBarFlashDurationOff = haptics.LightBarFlashDurationOn = (byte)(25 - forcedFlash[deviceNum]); haptics.LightBarExplicitlyOff = true; } - else if (device.Battery <= Global.FlashAt[deviceNum] && Global.FlashType[deviceNum] == 0 && !defualtLight && !device.Charging) + else if (device.Battery <= FlashAt[deviceNum] && FlashType[deviceNum] == 0 && !defualtLight && !device.Charging) { int level = device.Battery / 10; //if (level >= 10) @@ -203,7 +204,7 @@ namespace DS4Windows public static bool shiftMod(DS4Device device, int deviceNum, DS4State cState, DS4StateExposed eState, Mouse tp) { bool shift; - switch (Global.ShiftModifier[deviceNum]) + switch (ShiftModifier[deviceNum]) { case 1: shift = Mapping.getBoolMapping(DS4Controls.Cross, cState, eState, tp); break; case 2: shift = Mapping.getBoolMapping(DS4Controls.Circle, cState, eState, tp); break; diff --git a/DS4Control/ITouchpadBehaviour.cs b/DS4Windows/DS4Control/ITouchpadBehaviour.cs similarity index 100% rename from DS4Control/ITouchpadBehaviour.cs rename to DS4Windows/DS4Control/ITouchpadBehaviour.cs diff --git a/DS4Control/InputMethods.cs b/DS4Windows/DS4Control/InputMethods.cs similarity index 100% rename from DS4Control/InputMethods.cs rename to DS4Windows/DS4Control/InputMethods.cs diff --git a/DS4Control/Log.cs b/DS4Windows/DS4Control/Log.cs similarity index 78% rename from DS4Control/Log.cs rename to DS4Windows/DS4Control/Log.cs index 9050586..f581f77 100644 --- a/DS4Control/Log.cs +++ b/DS4Windows/DS4Control/Log.cs @@ -18,14 +18,14 @@ namespace DS4Windows } } - public static void LogToTray(string data, bool ignoreSettings = false) + public static void LogToTray(string data, bool warning = false, bool ignoreSettings = false) { if (TrayIconLog != null) { if (ignoreSettings) - TrayIconLog(ignoreSettings, new DebugEventArgs(data, false)); + TrayIconLog(ignoreSettings, new DebugEventArgs(data, warning)); else - TrayIconLog(null, new DebugEventArgs(data, false)); + TrayIconLog(null, new DebugEventArgs(data, warning)); } } } diff --git a/DS4Control/Mapping.cs b/DS4Windows/DS4Control/Mapping.cs similarity index 95% rename from DS4Control/Mapping.cs rename to DS4Windows/DS4Control/Mapping.cs index 0adec9f..0580782 100644 --- a/DS4Control/Mapping.cs +++ b/DS4Windows/DS4Control/Mapping.cs @@ -70,6 +70,8 @@ namespace DS4Windows public static DateTime[] oldnowAction = { DateTime.MinValue, DateTime.MinValue, DateTime.MinValue, DateTime.MinValue }; public static int[] untriggerindex = { -1, -1, -1, -1 }; public static DateTime[] oldnowKeyAct = { DateTime.MinValue, DateTime.MinValue, DateTime.MinValue, DateTime.MinValue }; + private static bool tappedOnce = false, firstTouch = false, secondtouchbegin = false; + private static DateTime pastTime, firstTap, TimeofEnd; //special macros static bool altTabDone = true; @@ -1418,8 +1420,8 @@ namespace DS4Windows string[] dets = action.details.Split(','); if (bool.Parse(dets[1]) && !actionDone[device, index]) { - Log.LogToTray("Controller " + (device + 1) + ": " + - ctrl.getDS4Battery(device), true); + Log.LogToTray("Controller " + (device + 1) + ": " + + ctrl.getDS4Battery(device), true); } if (bool.Parse(dets[2])) { @@ -1433,7 +1435,7 @@ namespace DS4Windows DS4Color full = new DS4Color(byte.Parse(dets[6]), byte.Parse(dets[7]), byte.Parse(dets[8])); DS4Color trans = Global.getTransitionedColor(empty, full, d.Battery); if (fadetimer[device] < 100) - DS4LightBar.forcedColor[device] = Global.getTransitionedColor(lastColor[device], trans, fadetimer[device] += 2); + DS4LightBar.forcedColor[device] = Global.getTransitionedColor(lastColor[device], trans, fadetimer[device] += 2); } actionDone[device, index] = true; } @@ -1453,6 +1455,98 @@ namespace DS4Windows actionDone[device, index] = false; } } + else if (action.type == "XboxGameDVR") + { + if (Global.getCustomButton(device, action.trigger[0]) != X360Controls.Unbound) + Global.getCustomButtons(device)[action.trigger[0]] = X360Controls.Unbound; + string[] dets = action.details.Split(','); + DS4Device d = ctrl.DS4Controllers[device]; + //Global.cus + if (getBoolMapping(action.trigger[0], cState, eState, tp) && !getBoolMapping(action.trigger[0], d.getPreviousState(), eState, tp)) + {//pressed down + pastTime = DateTime.UtcNow; + if (DateTime.UtcNow <= (firstTap + TimeSpan.FromMilliseconds(150))) + { + tappedOnce = false; + secondtouchbegin = true; + } + else + firstTouch = true; + } + else if (!getBoolMapping(action.trigger[0], cState, eState, tp) && getBoolMapping(action.trigger[0], d.getPreviousState(), eState, tp)) + {//released + if (secondtouchbegin) + { + firstTouch = false; + secondtouchbegin = false; + } + else if (firstTouch) + { + firstTouch = false; + if (DateTime.UtcNow <= (pastTime + TimeSpan.FromMilliseconds(200)) && !tappedOnce) + { + tappedOnce = true; + firstTap = DateTime.UtcNow; + TimeofEnd = DateTime.UtcNow; + } + } + } + + int type = 0; + string macro = "91/71/71/91"; + if (tappedOnce) //single tap + { + if (int.TryParse(dets[0], out type)) + { + switch (type) + { + case 0: macro = "91/71/71/91"; break; + case 1: macro = "91/164/82/82/164/91"; break; + case 2: macro = "91/164/44/44/164/91"; break; + case 3: macro = dets[3] + "/" + dets[3]; break; + case 4: macro = "91/164/71/71/164/91"; break; + } + } + if ((DateTime.UtcNow - TimeofEnd) > TimeSpan.FromMilliseconds(150)) + { + PlayMacro(device, macroControl, macro, DS4Controls.None, DS4KeyType.None); + tappedOnce = false; + } + //if it fails the method resets, and tries again with a new tester value (gives tap a delay so tap and hold can work) + } + else if (firstTouch && (DateTime.UtcNow - pastTime) > TimeSpan.FromMilliseconds(1000)) //helddown + { + if (int.TryParse(dets[1], out type)) + { + switch (type) + { + case 0: macro = "91/71/71/91"; break; + case 1: macro = "91/164/82/82/164/91"; break; + case 2: macro = "91/164/44/44/164/91"; break; + case 3: macro = dets[3] + "/" + dets[3]; break; + case 4: macro = "91/164/71/71/164/91"; break; + } + } + PlayMacro(device, macroControl, macro, DS4Controls.None, DS4KeyType.None); + firstTouch = false; + } + else if (secondtouchbegin) //if double tap + { + if (int.TryParse(dets[2], out type)) + { + switch (type) + { + case 0: macro = "91/71/71/91"; break; + case 1: macro = "91/164/82/82/164/91"; break; + case 2: macro = "91/164/44/44/164/91"; break; + case 3: macro = dets[3] + "/" + dets[3]; break; + case 4: macro = "91/164/71/71/164/91"; break; + } + } + PlayMacro(device, macroControl, macro, DS4Controls.None, DS4KeyType.None); + secondtouchbegin = false; + } + } else actionDone[device, index] = false; } diff --git a/DS4Control/Mouse.cs b/DS4Windows/DS4Control/Mouse.cs similarity index 100% rename from DS4Control/Mouse.cs rename to DS4Windows/DS4Control/Mouse.cs diff --git a/DS4Control/MouseCursor.cs b/DS4Windows/DS4Control/MouseCursor.cs similarity index 100% rename from DS4Control/MouseCursor.cs rename to DS4Windows/DS4Control/MouseCursor.cs diff --git a/DS4Control/MouseWheel.cs b/DS4Windows/DS4Control/MouseWheel.cs similarity index 100% rename from DS4Control/MouseWheel.cs rename to DS4Windows/DS4Control/MouseWheel.cs diff --git a/DS4Control/ScpDevice.Designer.cs b/DS4Windows/DS4Control/ScpDevice.Designer.cs similarity index 100% rename from DS4Control/ScpDevice.Designer.cs rename to DS4Windows/DS4Control/ScpDevice.Designer.cs diff --git a/DS4Control/ScpDevice.cs b/DS4Windows/DS4Control/ScpDevice.cs similarity index 100% rename from DS4Control/ScpDevice.cs rename to DS4Windows/DS4Control/ScpDevice.cs diff --git a/DS4Control/ScpHub.Designer.cs b/DS4Windows/DS4Control/ScpHub.Designer.cs similarity index 100% rename from DS4Control/ScpHub.Designer.cs rename to DS4Windows/DS4Control/ScpHub.Designer.cs diff --git a/DS4Control/ScpHub.cs b/DS4Windows/DS4Control/ScpHub.cs similarity index 100% rename from DS4Control/ScpHub.cs rename to DS4Windows/DS4Control/ScpHub.cs diff --git a/DS4Control/ScpUtil.cs b/DS4Windows/DS4Control/ScpUtil.cs similarity index 93% rename from DS4Control/ScpUtil.cs rename to DS4Windows/DS4Control/ScpUtil.cs index 1100efc..cc55f55 100644 --- a/DS4Control/ScpUtil.cs +++ b/DS4Windows/DS4Control/ScpUtil.cs @@ -27,19 +27,9 @@ namespace DS4Windows warning = warn; } - public DateTime Time - { - get { return m_Time; } - } - - public String Data - { - get { return m_Data; } - } - public bool Warning - { - get { return warning; } - } + public DateTime Time => m_Time; + public String Data => m_Data; + public bool Warning => warning; } public class MappingDoneEventArgs : EventArgs @@ -51,10 +41,7 @@ namespace DS4Windows deviceNum = DeviceID; } - public int DeviceID - { - get { return deviceNum; } - } + public int DeviceID => deviceNum; } public class ReportEventArgs : EventArgs @@ -147,7 +134,7 @@ namespace DS4Windows set { m_Config.CheckWhen = value; } get { return m_Config.CheckWhen; } } - public static bool Notifications + public static int Notifications { set { m_Config.notifications = value; } get { return m_Config.notifications; } @@ -207,160 +194,52 @@ namespace DS4Windows set { m_Config.flashWhenLate = value; } get { return m_Config.flashWhenLate; } } + public static int FlashWhenLateAt + { + set { m_Config.flashWhenLateAt = value; } + get { return m_Config.flashWhenLateAt; } + } //controller/profile specfic values - public static int[] ButtonMouseSensitivity - { - get {return m_Config.buttonMouseSensitivity;} - } + public static int[] ButtonMouseSensitivity => m_Config.buttonMouseSensitivity; + public static byte[] RumbleBoost => m_Config.rumble; + public static double[] Rainbow => m_Config.rainbow; + public static bool[] FlushHIDQueue => m_Config.flushHIDQueue; + public static int[] IdleDisconnectTimeout => m_Config.idleDisconnectTimeout; + public static byte[] TouchSensitivity => m_Config.touchSensitivity; + public static byte[] FlashType => m_Config.flashType; + public static int[] FlashAt => m_Config.flashAt; + public static bool[] LedAsBatteryIndicator => m_Config.ledAsBattery; + public static int[] ChargingType => m_Config.chargingType; + public static bool[] DinputOnly => m_Config.dinputOnly; + public static bool[] StartTouchpadOff => m_Config.startTouchpadOff; + public static bool[] UseTPforControls => m_Config.useTPforControls; + public static DS4Color[] MainColor => m_Config.m_Leds; + public static DS4Color[] LowColor => m_Config.m_LowLeds; + public static DS4Color[] ChargingColor => m_Config.m_ChargingLeds; - public static byte[] RumbleBoost - { - get { return m_Config.rumble; } - } - public static double[] Rainbow - { - get { return m_Config.rainbow; } - } - public static bool[] FlushHIDQueue - { - get { return m_Config.flushHIDQueue; } - } - public static int[] IdleDisconnectTimeout - { - get { return m_Config.idleDisconnectTimeout; } - } - public static byte[] TouchSensitivity - { - get { return m_Config.touchSensitivity; } - } - public static byte[] FlashType - { - get { return m_Config.flashType;} - } - public static int[] FlashAt - { - get { return m_Config.flashAt;} - } - public static bool[] LedAsBatteryIndicator - { - get { return m_Config.ledAsBattery;} - } - public static int[] ChargingType - { - get { return m_Config.chargingType; } - } - public static bool[] DinputOnly - { - get { return m_Config.dinputOnly; } - } - public static bool[] StartTouchpadOff - { - get { return m_Config.startTouchpadOff; } - } - public static bool[] UseTPforControls - { - get { return m_Config.useTPforControls; } - } - public static DS4Color[] MainColor - { - get { return m_Config.m_Leds; } - } - public static DS4Color[] LowColor - { - get { return m_Config.m_LowLeds; } - } - public static DS4Color[] ChargingColor - { - get { return m_Config.m_ChargingLeds;} - } + public static DS4Color[] FlashColor => m_Config.m_FlashLeds; + public static DS4Color[] ShiftColor => m_Config.m_ShiftLeds; + public static bool[] ShiftColorOn => m_Config.shiftColorOn; + public static byte[] TapSensitivity => m_Config.tapSensitivity; + public static bool[] DoubleTap => m_Config.doubleTap; + public static int[] ScrollSensitivity => m_Config.scrollSensitivity; + public static bool[] LowerRCOn => m_Config.lowerRCOn; + public static bool[] TouchpadJitterCompensation => m_Config.touchpadJitterCompensation; - public static DS4Color[] FlashColor - { - get { return m_Config.m_FlashLeds;} - } - public static DS4Color[] ShiftColor - { - get { return m_Config.m_ShiftLeds; } - } - public static bool[] ShiftColorOn - { - get{ return m_Config.shiftColorOn; } - } - public static byte[] TapSensitivity - { - get { return m_Config.tapSensitivity; } - } - public static bool[] DoubleTap - { - get { return m_Config.doubleTap; } - } - public static int[] ScrollSensitivity - { - get{ return m_Config.scrollSensitivity;} - } - public static bool[] LowerRCOn - { - get{ return m_Config.lowerRCOn;} - } - public static bool[] TouchpadJitterCompensation - { - get { return m_Config.touchpadJitterCompensation; } - } - - - public static byte[] L2Deadzone - { - get { return m_Config.l2Deadzone; } - } - public static byte[] R2Deadzone - { - get { return m_Config.r2Deadzone;} - } - public static double[] SXDeadzone - { - get { return m_Config.SXDeadzone;} - } - public static double[] SZDeadzone - { - get { return m_Config.SZDeadzone;} - } - public static int[] LSDeadzone - { - get { return m_Config.LSDeadzone;} - } - public static int[] RSDeadzone - { - get { return m_Config.RSDeadzone;} - } - public static int[] LSCurve - { - get { return m_Config.lsCurve;} - } - public static int[] RSCurve - { - get { return m_Config.rsCurve;} - } - public static bool[] MouseAccel - { - get { return m_Config.mouseAccel;} - } - public static int[] ShiftModifier - { - get { return m_Config.shiftModifier;} - } - public static string[] LaunchProgram - { - get { return m_Config.launchProgram;} - } - public static string[] ProfilePath - { - get { return m_Config.profilePath; } - } - public static List[] ProfileActions - { - get { return m_Config.profileActions; } - } + public static byte[] L2Deadzone => m_Config.l2Deadzone; + public static byte[] R2Deadzone => m_Config.r2Deadzone; + public static double[] SXDeadzone => m_Config.SXDeadzone; + public static double[] SZDeadzone => m_Config.SZDeadzone; + public static int[] LSDeadzone => m_Config.LSDeadzone; + public static int[] RSDeadzone => m_Config.RSDeadzone; + public static int[] LSCurve => m_Config.lsCurve; + public static int[] RSCurve => m_Config.rsCurve; + public static bool[] MouseAccel => m_Config.mouseAccel; + public static int[] ShiftModifier => m_Config.shiftModifier; + public static string[] LaunchProgram => m_Config.launchProgram; + public static string[] ProfilePath => m_Config.profilePath; + public static List[] ProfileActions => m_Config.profileActions; public static void SaveAction(string name, string controls, int mode, string details, bool edit, string extras = "") { @@ -372,15 +251,9 @@ namespace DS4Windows m_Config.RemoveAction(name); } - public static bool LoadActions() - { - return m_Config.LoadActions(); - } + public static bool LoadActions() => m_Config.LoadActions(); - public static List GetActions() - { - return m_Config.actions; - } + public static List GetActions() => m_Config.actions; public static int GetActionIndexOf(string name) { @@ -399,109 +272,41 @@ namespace DS4Windows } - public static X360Controls getCustomButton(int device, DS4Controls controlName) - { - return m_Config.GetCustomButton(device, controlName); - } - public static ushort getCustomKey(int device, DS4Controls controlName) - { - return m_Config.GetCustomKey(device, controlName); - } - public static string getCustomMacro(int device, DS4Controls controlName) - { - return m_Config.GetCustomMacro(device, controlName); - } - public static string getCustomExtras(int device, DS4Controls controlName) - { - return m_Config.GetCustomExtras(device, controlName); - } - public static DS4KeyType getCustomKeyType(int device, DS4Controls controlName) - { - return m_Config.GetCustomKeyType(device, controlName); - } - public static bool getHasCustomKeysorButtons(int device) - { - return m_Config.customMapButtons[device].Count > 0 + public static X360Controls getCustomButton(int device, DS4Controls controlName) => m_Config.GetCustomButton(device, controlName); + + public static ushort getCustomKey(int device, DS4Controls controlName) => m_Config.GetCustomKey(device, controlName); + + public static string getCustomMacro(int device, DS4Controls controlName) => m_Config.GetCustomMacro(device, controlName); + + public static string getCustomExtras(int device, DS4Controls controlName) => m_Config.GetCustomExtras(device, controlName); + + public static DS4KeyType getCustomKeyType(int device, DS4Controls controlName) => m_Config.GetCustomKeyType(device, controlName); + + public static bool getHasCustomKeysorButtons(int device) => m_Config.customMapButtons[device].Count > 0 || m_Config.customMapKeys[device].Count > 0; - } - public static bool getHasCustomExtras(int device) - { - return m_Config.customMapExtras[device].Count > 0; - } - public static Dictionary getCustomButtons(int device) - { - return m_Config.customMapButtons[device]; - } - public static Dictionary getCustomKeys(int device) - { - return m_Config.customMapKeys[device]; - } - public static Dictionary getCustomMacros(int device) - { - return m_Config.customMapMacros[device]; - } - public static Dictionary getCustomExtras(int device) - { - return m_Config.customMapExtras[device]; - } - public static Dictionary getCustomKeyTypes(int device) - { - return m_Config.customMapKeyTypes[device]; - } + + public static bool getHasCustomExtras(int device) => m_Config.customMapExtras[device].Count > 0; + public static Dictionary getCustomButtons(int device) => m_Config.customMapButtons[device]; + public static Dictionary getCustomKeys(int device) => m_Config.customMapKeys[device]; + public static Dictionary getCustomMacros(int device) => m_Config.customMapMacros[device]; + public static Dictionary getCustomExtras(int device) => m_Config.customMapExtras[device]; + public static Dictionary getCustomKeyTypes(int device) => m_Config.customMapKeyTypes[device]; - public static X360Controls getShiftCustomButton(int device, DS4Controls controlName) - { - return m_Config.GetShiftCustomButton(device, controlName); - } - public static ushort getShiftCustomKey(int device, DS4Controls controlName) - { - return m_Config.GetShiftCustomKey(device, controlName); - } - public static string getShiftCustomMacro(int device, DS4Controls controlName) - { - return m_Config.GetShiftCustomMacro(device, controlName); - } - public static string getShiftCustomExtras(int device, DS4Controls controlName) - { - return m_Config.GetShiftCustomExtras(device, controlName); - } - public static DS4KeyType getShiftCustomKeyType(int device, DS4Controls controlName) - { - return m_Config.GetShiftCustomKeyType(device, controlName); - } - public static bool getHasShiftCustomKeysorButtons(int device) - { - return m_Config.shiftCustomMapButtons[device].Count > 0 - || m_Config.shiftCustomMapKeys[device].Count > 0; - } - public static bool getHasShiftCustomExtras(int device) - { - return m_Config.shiftCustomMapExtras[device].Count > 0; - } - public static Dictionary getShiftCustomButtons(int device) - { - return m_Config.shiftCustomMapButtons[device]; - } - public static Dictionary getShiftCustomKeys(int device) - { - return m_Config.shiftCustomMapKeys[device]; - } - public static Dictionary getShiftCustomMacros(int device) - { - return m_Config.shiftCustomMapMacros[device]; - } - public static Dictionary getShiftCustomExtras(int device) - { - return m_Config.shiftCustomMapExtras[device]; - } - public static Dictionary getShiftCustomKeyTypes(int device) - { - return m_Config.shiftCustomMapKeyTypes[device]; - } - public static bool Load() - { - return m_Config.Load(); - } + public static X360Controls getShiftCustomButton(int device, DS4Controls controlName) => m_Config.GetShiftCustomButton(device, controlName); + public static ushort getShiftCustomKey(int device, DS4Controls controlName) => m_Config.GetShiftCustomKey(device, controlName); + public static string getShiftCustomMacro(int device, DS4Controls controlName) => m_Config.GetShiftCustomMacro(device, controlName); + public static string getShiftCustomExtras(int device, DS4Controls controlName) => m_Config.GetShiftCustomExtras(device, controlName); + public static DS4KeyType getShiftCustomKeyType(int device, DS4Controls controlName) => m_Config.GetShiftCustomKeyType(device, controlName); + public static bool getHasShiftCustomKeysorButtons(int device) => m_Config.shiftCustomMapButtons[device].Count > 0 + || m_Config.shiftCustomMapKeys[device].Count > 0; + public static bool getHasShiftCustomExtras(int device) => m_Config.shiftCustomMapExtras[device].Count > 0; + public static Dictionary getShiftCustomButtons(int device) => m_Config.shiftCustomMapButtons[device]; + public static Dictionary getShiftCustomKeys(int device) => m_Config.shiftCustomMapKeys[device]; + public static Dictionary getShiftCustomMacros(int device) => m_Config.shiftCustomMapMacros[device]; + public static Dictionary getShiftCustomExtras(int device) => m_Config.shiftCustomMapExtras[device]; + public static Dictionary getShiftCustomKeyTypes(int device) => m_Config.shiftCustomMapKeyTypes[device]; + public static bool Load() => m_Config.Load(); + public static void LoadProfile(int device, System.Windows.Forms.Control[] buttons, System.Windows.Forms.Control[] shiftbuttons, bool launchprogram, ControlService control) { m_Config.LoadProfile(device, buttons, shiftbuttons, launchprogram, control); @@ -678,7 +483,7 @@ namespace DS4Windows public Boolean startMinimized = false; public DateTime lastChecked; public int CheckWhen = 1; - public bool notifications = true; + public int notifications = 2; public bool disconnectBTAtStop = false; public bool swipeProfiles = true; public bool ds4Mapping = true; @@ -700,6 +505,8 @@ namespace DS4Windows public List[] profileActions = { null, null, null, null, null }; public bool downloadLang = true; public bool flashWhenLate = true; + public int flashWhenLateAt = 10; + public BackingStore() { for (int i = 0; i < 5; i++) @@ -1719,7 +1526,11 @@ namespace DS4Windows catch { missingSetting = true; } try { Item = m_Xdoc.SelectSingleNode("/Profile/CheckWhen"); Int32.TryParse(Item.InnerText, out CheckWhen); } catch { missingSetting = true; } - try { Item = m_Xdoc.SelectSingleNode("/Profile/Notifications"); Boolean.TryParse(Item.InnerText, out notifications); } + try { + Item = m_Xdoc.SelectSingleNode("/Profile/Notifications"); + if (!int.TryParse(Item.InnerText, out notifications)) + notifications = (Boolean.Parse(Item.InnerText) ? 2 : 0); + } catch { missingSetting = true; } try { Item = m_Xdoc.SelectSingleNode("/Profile/DisconnectBTAtStop"); Boolean.TryParse(Item.InnerText, out disconnectBTAtStop); } catch { missingSetting = true; } @@ -1737,6 +1548,8 @@ namespace DS4Windows catch { missingSetting = true; } try { Item = m_Xdoc.SelectSingleNode("/Profile/FlashWhenLate"); Boolean.TryParse(Item.InnerText, out flashWhenLate); } catch { missingSetting = true; } + try { Item = m_Xdoc.SelectSingleNode("/Profile/FlashWhenLateAt"); int.TryParse(Item.InnerText, out flashWhenLateAt); } + catch { missingSetting = true; } } } catch { } @@ -1785,6 +1598,7 @@ namespace DS4Windows XmlNode xmlCloseMini = m_Xdoc.CreateNode(XmlNodeType.Element, "CloseMinimizes", null); xmlCloseMini.InnerText = closeMini.ToString(); Node.AppendChild(xmlCloseMini); XmlNode xmlDownloadLang = m_Xdoc.CreateNode(XmlNodeType.Element, "DownloadLang", null); xmlDownloadLang.InnerText = downloadLang.ToString(); Node.AppendChild(xmlDownloadLang); XmlNode xmlFlashWhenLate = m_Xdoc.CreateNode(XmlNodeType.Element, "FlashWhenLate", null); xmlFlashWhenLate.InnerText = flashWhenLate.ToString(); Node.AppendChild(xmlFlashWhenLate); + XmlNode xmlFlashWhenLateAt = m_Xdoc.CreateNode(XmlNodeType.Element, "FlashWhenLateAt", null); xmlFlashWhenLateAt.InnerText = flashWhenLateAt.ToString(); Node.AppendChild(xmlFlashWhenLateAt); m_Xdoc.AppendChild(Node); @@ -1867,6 +1681,10 @@ namespace DS4Windows el.AppendChild(m_Xdoc.CreateElement("Type")).InnerText = "BatteryCheck"; el.AppendChild(m_Xdoc.CreateElement("Details")).InnerText = details; break; + case 7: + el.AppendChild(m_Xdoc.CreateElement("Type")).InnerText = "XboxGameDVR"; + el.AppendChild(m_Xdoc.CreateElement("Details")).InnerText = details; + break; } if (edit) { @@ -1974,6 +1792,10 @@ namespace DS4Windows actions.Add(new SpecialAction(name, controls, type, details)); } } + else if (type == "XboxGameDVR") + { + actions.Add(new SpecialAction(name, controls, type, details)); + } } } catch { saved = false; } diff --git a/DS4Control/X360Device.cs b/DS4Windows/DS4Control/X360Device.cs similarity index 100% rename from DS4Control/X360Device.cs rename to DS4Windows/DS4Control/X360Device.cs diff --git a/DS4Control/X360Device.designer.cs b/DS4Windows/DS4Control/X360Device.designer.cs similarity index 100% rename from DS4Control/X360Device.designer.cs rename to DS4Windows/DS4Control/X360Device.designer.cs diff --git a/DS4Library/DS4Device.cs b/DS4Windows/DS4Library/DS4Device.cs similarity index 98% rename from DS4Library/DS4Device.cs rename to DS4Windows/DS4Library/DS4Device.cs index db16d04..5406f89 100644 --- a/DS4Library/DS4Device.cs +++ b/DS4Windows/DS4Library/DS4Device.cs @@ -42,10 +42,7 @@ namespace DS4Windows else return false; } - public override string ToString() - { - return ("Red: " + red + " Green: " + green + " Blue: " + blue); - } + public override string ToString() => $"Red: {red} Green: {green} Blue: {blue}"; } public enum ConnectionType : byte { BT, USB }; // Prioritize Bluetooth when both are connected. @@ -98,17 +95,17 @@ namespace DS4Windows public event EventHandler Report = null; public event EventHandler Removal = null; - public HidDevice HidDevice { get { return hDevice; } } - public bool IsExclusive { get { return HidDevice.IsExclusive; } } + public HidDevice HidDevice => hDevice; + public bool IsExclusive => HidDevice.IsExclusive; public bool IsDisconnecting { get; private set; } - public string MacAddress { get { return Mac; } } + public string MacAddress => Mac; - public ConnectionType ConnectionType { get { return conType; } } + public ConnectionType ConnectionType => conType; public int IdleTimeout { get; set; } // behavior only active when > 0 - public int Battery { get { return battery; } } - public bool Charging { get { return charging; } } + public int Battery => battery; + public bool Charging => charging; public byte RightLightFastRumble { diff --git a/DS4Library/DS4Devices.cs b/DS4Windows/DS4Library/DS4Devices.cs similarity index 100% rename from DS4Library/DS4Devices.cs rename to DS4Windows/DS4Library/DS4Devices.cs diff --git a/DS4Library/DS4State.cs b/DS4Windows/DS4Library/DS4State.cs similarity index 100% rename from DS4Library/DS4State.cs rename to DS4Windows/DS4Library/DS4State.cs diff --git a/DS4Library/DS4StateExposed.cs b/DS4Windows/DS4Library/DS4StateExposed.cs similarity index 100% rename from DS4Library/DS4StateExposed.cs rename to DS4Windows/DS4Library/DS4StateExposed.cs diff --git a/DS4Library/DS4Touchpad.cs b/DS4Windows/DS4Library/DS4Touchpad.cs similarity index 100% rename from DS4Library/DS4Touchpad.cs rename to DS4Windows/DS4Library/DS4Touchpad.cs diff --git a/DS4Windows.csproj b/DS4Windows/DS4Windows.csproj similarity index 75% rename from DS4Windows.csproj rename to DS4Windows/DS4Windows.csproj index 09c8b23..f4de924 100644 --- a/DS4Windows.csproj +++ b/DS4Windows/DS4Windows.csproj @@ -1,37 +1,18 @@  - + Debug AnyCPU - {B1081607-B630-4F57-9580-8A4897145890} + {7B9354BF-AF82-4CCB-A83D-4BEB1E9D8C96} WinExe Properties DS4Windows DS4Windows v4.5 512 - true + true - C:\Users\Jonathan\Dropbox\Public\DS4 Tool\ - true - Web - true - Background - 1 - Days - true - false - true - https://dl.dropboxusercontent.com/u/16364552/DS4%2520Tool/ - 1.0.0.1 - true - publish.htm - 4 - 1.0.0.%2a - false - true - true AnyCPU @@ -41,8 +22,7 @@ bin\Debug\ DEBUG;TRACE prompt - 3 - false + 4 AnyCPU @@ -52,36 +32,16 @@ TRACE prompt 4 - false - - DS4Windows\DS4W.ico - - DS4Windows.Program - 2F336030801042E29CD1F9E43E2FEC00D9702E66 + app.manifest - DS4Windows_TemporaryKey.pfx + Resources\DS4W.ico - - true - - - true - - - OnBuildSuccess - - - - - - - @@ -95,17 +55,11 @@ + - - - Form - - - Alreadyrunning.cs - @@ -139,6 +93,32 @@ + + + + Form + + + Alreadyrunning.cs + + + Form + + + DS4Form.cs + + + Form + + + DS4Keyboard.cs + + + Form + + + DupBox.cs + Form @@ -151,31 +131,13 @@ KBM360.cs - - Form - - - DupBox.cs - Form Options.cs - - - - - - - - - - True - True - Resources.resx - + Form @@ -188,12 +150,6 @@ SaveWhere.cs - - Form - - - DS4Form.cs - Form @@ -213,9 +169,13 @@ WinProgs.cs - - DS4Form.cs - + + + + + + + Alreadyrunning.cs @@ -225,27 +185,51 @@ DS4Form.cs + + DS4Form.cs + DS4Form.cs DS4Form.cs + + DS4Form.cs + + + DS4Form.cs + DS4Form.cs DS4Form.cs + + DS4Form.cs + + + DS4Keyboard.cs + DupBox.cs + + DupBox.cs + + + DupBox.cs + DupBox.cs DupBox.cs + + DupBox.cs + DupBox.cs @@ -299,16 +283,6 @@ KBM360.cs - Designer - - - DupBox.cs - - - DupBox.cs - - - DupBox.cs KBM360.cs @@ -346,42 +320,6 @@ Options.cs - - RecordBox.cs - - - RecordBox.cs - - - SaveWhere.cs - - - SaveWhere.cs - - - SpecActions.cs - - - SpecActions.cs - - - WelcomeDialog.cs - - - WelcomeDialog.cs - - - WinProgs.cs - - - WinProgs.cs - - - - ResXFileCodeGenerator - Designer - Resources1.Designer.cs - RecordBox.cs @@ -400,14 +338,15 @@ RecordBox.cs - - - - - + + RecordBox.cs + RecordBox.cs + + RecordBox.cs + SaveWhere.cs @@ -425,17 +364,16 @@ SaveWhere.cs - SaveWhere1.Designer.cs - - DS4Form.cs - - - DS4Form.cs + + SaveWhere.cs SaveWhere.cs + + SaveWhere.cs + SpecActions.cs @@ -451,9 +389,15 @@ SpecActions.cs + + SpecActions.cs + SpecActions.cs + + SpecActions.cs + WelcomeDialog.cs @@ -472,9 +416,15 @@ WelcomeDialog.cs + + WelcomeDialog.cs + WelcomeDialog.cs + + WelcomeDialog.cs + WinProgs.cs @@ -493,21 +443,33 @@ WinProgs.cs + + WinProgs.cs + WinProgs.cs - - - + + WinProgs.cs + + + + + + + + ResXFileCodeGenerator Designer - - - - + + + + + SettingsSingleFileGenerator Settings.Designer.cs + True Settings.settings @@ -515,93 +477,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - False - Microsoft .NET Framework 4 %28x86 and x64%29 - true - - - False - .NET Framework 3.5 SP1 Client Profile - false - - - False - .NET Framework 3.5 SP1 - false - - - False - Windows Installer 4.5 - true - + @@ -615,19 +491,72 @@ - - {779e62b3-c5a6-494d-9d87-96c0dec7ffb0} - Ookii.Dialogs - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - ilmerge /targetplatform:"v4,C:\Windows\Microsoft.NET\Framework\v4.0.30319" /out:Build\DS4Windows.exe DS4Windows.exe Ookii.Dialogs.dll - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + + + + + diff --git a/LICENSE.txt b/LICENSE.txt deleted file mode 100644 index e64a13b..0000000 --- a/LICENSE.txt +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Jays2Kings - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/Properties/Resources.Designer.cs b/Properties/Resources.Designer.cs deleted file mode 100644 index 53c6618..0000000 --- a/Properties/Resources.Designer.cs +++ /dev/null @@ -1,401 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.34011 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace ScpServer.Properties { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - public class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - public static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ScpServer.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - public static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - public static System.Drawing.Bitmap _1 { - get { - object obj = ResourceManager.GetObject("_1", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - public static System.Drawing.Bitmap _10 { - get { - object obj = ResourceManager.GetObject("_10", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - public static System.Drawing.Bitmap _11 { - get { - object obj = ResourceManager.GetObject("_11", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - public static System.Drawing.Bitmap _12 { - get { - object obj = ResourceManager.GetObject("_12", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - public static System.Drawing.Bitmap _13 { - get { - object obj = ResourceManager.GetObject("_13", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - public static System.Drawing.Bitmap _14 { - get { - object obj = ResourceManager.GetObject("_14", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - public static System.Drawing.Bitmap _15 { - get { - object obj = ResourceManager.GetObject("_15", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - public static System.Drawing.Bitmap _16 { - get { - object obj = ResourceManager.GetObject("_16", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - public static System.Drawing.Bitmap _17 { - get { - object obj = ResourceManager.GetObject("_17", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - public static System.Drawing.Bitmap _18 { - get { - object obj = ResourceManager.GetObject("_18", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - public static System.Drawing.Bitmap _19 { - get { - object obj = ResourceManager.GetObject("_19", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - public static System.Drawing.Bitmap _2 { - get { - object obj = ResourceManager.GetObject("_2", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - public static System.Drawing.Bitmap _20 { - get { - object obj = ResourceManager.GetObject("_20", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - public static System.Drawing.Bitmap _21 { - get { - object obj = ResourceManager.GetObject("_21", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - public static System.Drawing.Bitmap _22 { - get { - object obj = ResourceManager.GetObject("_22", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - public static System.Drawing.Bitmap _23 { - get { - object obj = ResourceManager.GetObject("_23", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - public static System.Drawing.Bitmap _24 { - get { - object obj = ResourceManager.GetObject("_24", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - public static System.Drawing.Bitmap _25 { - get { - object obj = ResourceManager.GetObject("_25", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - public static System.Drawing.Bitmap _26 { - get { - object obj = ResourceManager.GetObject("_26", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - public static System.Drawing.Bitmap _27 { - get { - object obj = ResourceManager.GetObject("_27", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - public static System.Drawing.Bitmap _28 { - get { - object obj = ResourceManager.GetObject("_28", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - public static System.Drawing.Bitmap _29 { - get { - object obj = ResourceManager.GetObject("_29", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - public static System.Drawing.Bitmap _3 { - get { - object obj = ResourceManager.GetObject("_3", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - public static System.Drawing.Bitmap _30 { - get { - object obj = ResourceManager.GetObject("_30", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - public static System.Drawing.Bitmap _31 { - get { - object obj = ResourceManager.GetObject("_31", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - public static System.Drawing.Bitmap _4 { - get { - object obj = ResourceManager.GetObject("_4", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - public static System.Drawing.Bitmap _5 { - get { - object obj = ResourceManager.GetObject("_5", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - public static System.Drawing.Bitmap _6 { - get { - object obj = ResourceManager.GetObject("_6", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - public static System.Drawing.Bitmap _7 { - get { - object obj = ResourceManager.GetObject("_7", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - public static System.Drawing.Bitmap _8 { - get { - object obj = ResourceManager.GetObject("_8", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - public static System.Drawing.Bitmap _9 { - get { - object obj = ResourceManager.GetObject("_9", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon). - /// - public static System.Drawing.Icon DS4 { - get { - object obj = ResourceManager.GetObject("DS4", resourceCulture); - return ((System.Drawing.Icon)(obj)); - } - } - - /// - /// Looks up a localized string similar to Start. - /// - public static string Start { - get { - return ResourceManager.GetString("Start", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Stop. - /// - public static string Stop { - get { - return ResourceManager.GetString("Stop", resourceCulture); - } - } - } -} diff --git a/README.md b/README.md deleted file mode 100644 index 15a543d..0000000 --- a/README.md +++ /dev/null @@ -1,13 +0,0 @@ -DS4Windows -========== - -A tool to give Sony's DualShock 4 Xinput and more - -Built off Electrobrains build, but with different features, such as: -A profile system - Make Profiles with different settings and mapping for any event you would need it for. -Revamped touchpad - A single touchpad mode, with areas such as left side, right side, multitouch, and upperpad. -Auto-Updates - When a new update arrives DS4Tool/DS4Windows will tell you there's an update and update automatically -More mapping options - You can assign mouse movement to all buttons and axis, 4th and 5th mouse button, and most keyboard keys. -And other things I didn't care to list here. - -This tool requires a driver to use, however I have not made the driver myself (but is downloaded when installing)