Skip to content

Commit

Permalink
Version 1.4.266
Browse files Browse the repository at this point in the history
Flash Lightbar when at high latency now has the option to choose what
you decide is high latency
Show Notifications now has the option to only show warnings, such as
when a controller cannot be grabbed exclusively
Speaking of bad news for Windows 10 users: Hide DS4 has now been
disabled, until i can figure out why this is, it will be disabled, this
means some games that rely on this may not work properly or at all,
sorry about that
As for good news for Windows 10, did you know you can press Windows + G
to open a game bar which can record games. For Windows 10 users, there's
a new special action: Xbox Game DVR. Pick a trigger (only one button)
and tapping/holding/or double tapping does various things, such as
start/stop recording, save an ongoing recording, take a screenshot (via
the xbox app's option or your own hotkey ie form steam), or just open
the gamebar
Much of the code has been updated with c# 6.0
Added manifest so DS4Windows can notice Windows 10 and high DPIs, also
reorganized files
  • Loading branch information
Jays2Kings committed Jul 31, 2015
1 parent 39cf56c commit 86079b0
Show file tree
Hide file tree
Showing 237 changed files with 8,251 additions and 7,052 deletions.
6 changes: 0 additions & 6 deletions App.config

This file was deleted.

20 changes: 7 additions & 13 deletions DS4Windows.sln
Original file line number Diff line number Diff line change
@@ -1,26 +1,20 @@

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
Debug|Any CPU = Debug|Any CPU
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Reflection;
using System.Media;
using System.Threading.Tasks;
using static DS4Windows.Global;
namespace DS4Windows
{
public class ControlService
Expand Down Expand Up @@ -92,7 +93,7 @@ private async void WarnExclusiveModeFailure(DS4Device device)
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)
Expand All @@ -101,7 +102,7 @@ public bool Start(bool showlog = true)
{
if (showlog)
LogDebug(Properties.Resources.Starting);
DS4Devices.isExclusiveMode = Global.UseExclusiveMode;
DS4Devices.isExclusiveMode = UseExclusiveMode;
if (showlog)
{
LogDebug(Properties.Resources.SearchingController);
Expand All @@ -123,17 +124,17 @@ public bool Start(bool showlog = true)
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);
}
Expand Down Expand Up @@ -170,7 +171,7 @@ public bool Stop(bool showlog = true)
{
if (DS4Controllers[i] != null)
{
if (Global.DCBTatStop && !DS4Controllers[i].Charging && showlog)
if (DCBTatStop && !DS4Controllers[i].Charging && showlog)
DS4Controllers[i].DisconnectBT();
else
{
Expand All @@ -196,7 +197,7 @@ public bool Stop(bool showlog = true)
DS4Devices.stopControllers();
if (showlog)
LogDebug(Properties.Resources.StoppedDS4Windows);
Global.ControllerStatusChanged(this);
ControllerStatusChanged(this);
}
return true;
}
Expand Down Expand Up @@ -229,15 +230,15 @@ public bool HotPlug()
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);
}
Expand Down Expand Up @@ -266,7 +267,7 @@ public void TouchPadOn(int ind, DS4Device device)
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)
Expand Down Expand Up @@ -432,7 +433,7 @@ protected virtual void On_DS4Removal(object sender, EventArgs e)
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 };
Expand All @@ -449,39 +450,39 @@ protected virtual void On_Report(object sender, EventArgs e)

if (ind != -1)
{
if (Global.FlushHIDQueue[ind])
if (FlushHIDQueue[ind])
device.FlushHID();
if (!string.IsNullOrEmpty(device.error))
{
LogDebug(device.error);
}
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]);
DS4State cState = CurrentState[ind];
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.
Expand All @@ -504,7 +505,7 @@ protected virtual void On_Report(object sender, EventArgs e)
// Output any synthetic events.
Mapping.Commit(ind);
// Pull settings updates.
device.IdleTimeout = Global.IdleDisconnectTimeout[ind];
device.IdleTimeout = IdleDisconnectTimeout[ind];
}
}

Expand All @@ -514,7 +515,7 @@ public void LagFlashWarning(int ind, bool on)
{
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;
Expand All @@ -537,7 +538,7 @@ private void DoExtras(int ind)
DS4StateExposed eState = ExposedState[ind];
Mouse tp = touchPad[ind];
DS4Controls helddown = DS4Controls.None;
foreach (KeyValuePair<DS4Controls, string> p in Global.getCustomExtras(ind))
foreach (KeyValuePair<DS4Controls, string> p in getCustomExtras(ind))
{
if (Mapping.getBoolMapping(p.Key, cState, eState, tp))
{
Expand All @@ -547,7 +548,7 @@ private void DoExtras(int ind)
}
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++)
Expand All @@ -571,8 +572,8 @@ private void DoExtras(int ind)
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 { }
Expand All @@ -581,7 +582,7 @@ private void DoExtras(int ind)
{
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;
Expand Down Expand Up @@ -747,24 +748,24 @@ public DS4Controls GetInputkeysDS4(int ind)
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;
}
}
Expand All @@ -776,10 +777,10 @@ public virtual void StartTPOff(int deviceID)
{
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;
}
}

Expand Down Expand Up @@ -824,7 +825,7 @@ public virtual void OnDebug(object sender, DebugEventArgs args)
//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;
Expand Down
Loading

0 comments on commit 86079b0

Please sign in to comment.