Skip to content

Commit

Permalink
Version 1.4.25
Browse files Browse the repository at this point in the history
Added inverted deadzones to Left and Right Sticks, set the values to
negative and pushing the stick past the red in the controller readout
will make sure the output doesn't pass the set limit
Fixed bug when trying to invert left and right stick with Shift modifier
Fixed "Fall back to" text in shift modifier
Added Romanian Translation (Thanks Vlad Giurgiu and Anonim)
Updated German (added thanks to Jan-Stefan Janetzky & An Op
Turk[DedSec]), Russian, and French translations
  • Loading branch information
Jays2Kings committed Apr 21, 2015
1 parent 3da12e5 commit f70b606
Show file tree
Hide file tree
Showing 64 changed files with 24,760 additions and 14,876 deletions.
4 changes: 2 additions & 2 deletions DS4Control/ControlSerivce.cs
Original file line number Diff line number Diff line change
Expand Up @@ -468,8 +468,8 @@ protected virtual void On_Report(object sender, EventArgs e)
if (eastertime)
EasterTime(ind);
GetInputkeys(ind);
if (Global.LSCurve[ind] + Global.RSCurve[ind] + Global.LSDeadzone[ind] + Global.RSDeadzone[ind] +
Global.L2Deadzone[ind] + Global.R2Deadzone[ind] > 0) //if a curve or deadzone is in place
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
cState = Mapping.SetCurveAndDeadzone(ind, cState);
if (!recordingMacro && (!string.IsNullOrEmpty(Global.tempprofilename[ind]) ||
Global.getHasCustomKeysorButtons(ind) || Global.getHasShiftCustomKeysorButtons(ind) || Global.ProfileActions[ind].Count > 0))
Expand Down
145 changes: 84 additions & 61 deletions DS4Control/Mapping.cs
Original file line number Diff line number Diff line change
Expand Up @@ -424,18 +424,32 @@ public static DS4State SetCurveAndDeadzone(int device, DS4State cState)
dState.RX = (byte)Math.Round(curvex, 0);
dState.RY = (byte)Math.Round(curvey, 0);
}
if (Global.LSDeadzone[device] > 0 &&
Math.Sqrt(Math.Pow(cState.LX - 127.5f, 2) + Math.Pow(cState.LY - 127.5f, 2)) < Global.LSDeadzone[device])
double ls = Math.Sqrt(Math.Pow(cState.LX - 127.5f, 2) + Math.Pow(cState.LY - 127.5f, 2));
//deadzones
if (Global.LSDeadzone[device] > 0 && ls < Global.LSDeadzone[device])
{
dState.LX = 127;
dState.LY = 127;
}
if (Global.RSDeadzone[device] > 0
&& Math.Sqrt(Math.Pow(cState.RX - 127.5f, 2) + Math.Pow(cState.RY - 127.5f, 2)) < Global.LSDeadzone[device])
else if (Global.LSDeadzone[device] < 0 && ls > 127.5f + Global.LSDeadzone[device])
{
double r = Math.Atan2((dState.LY - 127.5f), (dState.LX - 127.5f));
dState.LX = (byte)(Math.Cos(r) * (127.5f + Global.LSDeadzone[device]) + 127.5f);
dState.LY = (byte)(Math.Sin(r) * (127.5f + Global.LSDeadzone[device]) + 127.5f);
}
//Console.WriteLine
double rs = Math.Sqrt(Math.Pow(cState.RX - 127.5f, 2) + Math.Pow(cState.RY - 127.5f, 2));
if (Global.RSDeadzone[device] > 0 && rs < Global.LSDeadzone[device])
{
dState.RX = 127;
dState.RY = 127;
}
else if (Global.RSDeadzone[device] < 0 && rs > 127.5f + Global.RSDeadzone[device])
{
double r = Math.Atan2((dState.RY - 127.5f), (dState.RX - 127.5f));
dState.RX = (byte)(Math.Cos(r) * (127.5f + Global.RSDeadzone[device]) + 127.5f);
dState.RY = (byte)(Math.Sin(r) * (127.5f + Global.RSDeadzone[device]) + 127.5f);
}
if (Global.L2Deadzone[device] > 0 && cState.L2 < Global.L2Deadzone[device])
dState.L2 = 0;
if (Global.R2Deadzone[device] > 0 && cState.R2 < Global.R2Deadzone[device])
Expand All @@ -449,8 +463,16 @@ public static DS4State SetCurveAndDeadzone(int device, DS4State cState)
public static void MapCustom(int device, DS4State cState, DS4State MappedState, DS4StateExposed eState, Mouse tp, ControlService ctrl)
{
bool shift;

MappedState.LX = 127;
MappedState.LY = 127;
MappedState.RX = 127;
MappedState.RY = 127;
int MouseDeltaX = 0;
int MouseDeltaY = 0;

SyntheticState deviceState = Mapping.deviceState[device];
if (Global.GetActions().Count > 0 && (Global.ProfileActions[device].Count > 0 ||
if (Global.GetActions().Count > 0 && (Global.ProfileActions[device].Count > 0 ||
!string.IsNullOrEmpty(Global.tempprofilename[device])))
MapCustomAction(device, cState, MappedState, eState, tp, ctrl);
if (ctrl.DS4Controllers[device] == null) return;
Expand Down Expand Up @@ -486,7 +508,7 @@ public static void MapCustom(int device, DS4State cState, DS4State MappedState,
}
cState.CopyTo(MappedState);
if (shift)
MapShiftCustom(device, cState, MappedState, eState, tp);
MapShiftCustom(device, cState, MappedState, eState, tp);
foreach (KeyValuePair<DS4Controls, string> customKey in Global.getCustomMacros(device))
{
if (shift == false ||
Expand Down Expand Up @@ -540,13 +562,6 @@ public static void MapCustom(int device, DS4State cState, DS4State MappedState,
}
}

MappedState.LX = 127;
MappedState.LY = 127;
MappedState.RX = 127;
MappedState.RY = 127;
int MouseDeltaX = 0;
int MouseDeltaY = 0;

//Dictionary<DS4Controls, X360Controls> customButtons = Global.getCustomButtons(device);
//foreach (KeyValuePair<DS4Controls, X360Controls> customButton in customButtons)
List<DS4Controls> Cross = new List<DS4Controls>();
Expand Down Expand Up @@ -668,14 +683,14 @@ public static void MapCustom(int device, DS4State cState, DS4State MappedState,
if (isAnalog)
getMouseWheelMapping(device, customButton.Key, cState, eState, tp, false);
else
deviceState.currentClicks.wUpCount++;
deviceState.currentClicks.wUpCount++;
break;
case X360Controls.WDOWN:
if (getBoolMapping(customButton.Key, cState, eState, tp))
if (isAnalog)
getMouseWheelMapping(device, customButton.Key, cState, eState, tp, true);
else
deviceState.currentClicks.wDownCount++;
deviceState.currentClicks.wDownCount++;
break;
case X360Controls.MouseUp:
if (MouseDeltaY == 0)
Expand Down Expand Up @@ -715,15 +730,15 @@ public static void MapCustom(int device, DS4State cState, DS4State MappedState,
if (macroControl[04]) MappedState.Options = true;
if (macroControl[05]) MappedState.Share = true;
if (macroControl[06]) MappedState.DpadUp = true;
if (macroControl[07]) MappedState.DpadDown =true;
if (macroControl[07]) MappedState.DpadDown = true;
if (macroControl[08]) MappedState.DpadLeft = true;
if (macroControl[09]) MappedState.DpadRight = true;
if (macroControl[10]) MappedState.PS = true;
if (macroControl[11]) MappedState.L1 = true;
if (macroControl[12]) MappedState.R1 = true;
if (macroControl[13]) MappedState.L2 = 255;
if (macroControl[14]) MappedState.R2 = 255;
if (macroControl[15]) MappedState.L3 = true;
if (macroControl[15]) MappedState.L3 = true;
if (macroControl[16]) MappedState.R3 = true;
if (macroControl[17]) MappedState.LX = 255;
if (macroControl[18]) MappedState.LX = 0;
Expand Down Expand Up @@ -801,50 +816,54 @@ public static void MapCustom(int device, DS4State cState, DS4State MappedState,
RYN.Add(DS4Controls.RYNeg);
if (Global.getCustomButton(device, DS4Controls.RYPos) == X360Controls.None)
RYP.Add(DS4Controls.RYPos);
if (LXN.Count > 0 || LXP.Count > 0)
{
foreach (DS4Controls dc in LXP)
if (Math.Abs(127 - getXYAxisMapping(device, dc, cState, eState, tp, true)) > 5)
MappedState.LX = getXYAxisMapping(device, dc, cState, eState, tp, true);
foreach (DS4Controls dc in LXN)
if (Math.Abs(127 - getXYAxisMapping(device, dc, cState, eState, tp)) > 5)
MappedState.LX = getXYAxisMapping(device, dc, cState, eState, tp);
}
else
MappedState.LX = cState.LX;
if (LYN.Count > 0 || LYP.Count > 0)
{
foreach (DS4Controls dc in LYN)
if (Math.Abs(127 - getXYAxisMapping(device, dc, cState, eState, tp)) > 5)
MappedState.LY = getXYAxisMapping(device, dc, cState, eState, tp);
foreach (DS4Controls dc in LYP)
if (Math.Abs(127 - getXYAxisMapping(device, dc, cState, eState, tp, true)) > 5)
MappedState.LY = getXYAxisMapping(device, dc, cState, eState, tp, true);
}
else
MappedState.LY = cState.LY;
if (RXN.Count > 0 || RXP.Count > 0)
{
foreach (DS4Controls dc in RXN)
if (Math.Abs(127 - getXYAxisMapping(device, dc, cState, eState, tp)) > 5)
MappedState.RX = getXYAxisMapping(device, dc, cState, eState, tp);
foreach (DS4Controls dc in RXP)
if (Math.Abs(127 - getXYAxisMapping(device, dc, cState, eState, tp, true)) > 5)
MappedState.RX = getXYAxisMapping(device, dc, cState, eState, tp, true);
}
else
MappedState.RX = cState.RX;
if (RYN.Count > 0 || RYP.Count > 0)
{
foreach (DS4Controls dc in RYN)
if (Math.Abs(127 - getXYAxisMapping(device, dc, cState, eState, tp)) > 5)
MappedState.RY = getXYAxisMapping(device, dc, cState, eState, tp);
foreach (DS4Controls dc in RYP)
if (Math.Abs(127 - getXYAxisMapping(device, dc, cState, eState, tp, true)) > 5)
MappedState.RY = getXYAxisMapping(device, dc, cState, eState, tp, true);
}
else
MappedState.RY = cState.RY;
if ((shift && MappedState.LX == 127) || !shift)
if (LXN.Count > 0 || LXP.Count > 0)
{
foreach (DS4Controls dc in LXP)
if (Math.Abs(127 - getXYAxisMapping(device, dc, cState, eState, tp, true)) > 5)
MappedState.LX = getXYAxisMapping(device, dc, cState, eState, tp, true);
foreach (DS4Controls dc in LXN)
if (Math.Abs(127 - getXYAxisMapping(device, dc, cState, eState, tp)) > 5)
MappedState.LX = getXYAxisMapping(device, dc, cState, eState, tp);
}
else
MappedState.LX = cState.LX;
if ((shift && MappedState.LY == 127) || !shift)
if (LYN.Count > 0 || LYP.Count > 0)
{
foreach (DS4Controls dc in LYN)
if (Math.Abs(127 - getXYAxisMapping(device, dc, cState, eState, tp)) > 5)
MappedState.LY = getXYAxisMapping(device, dc, cState, eState, tp);
foreach (DS4Controls dc in LYP)
if (Math.Abs(127 - getXYAxisMapping(device, dc, cState, eState, tp, true)) > 5)
MappedState.LY = getXYAxisMapping(device, dc, cState, eState, tp, true);
}
else
MappedState.LY = cState.LY;
if ((shift && MappedState.RX == 127) || !shift)
if (RXN.Count > 0 || RXP.Count > 0)
{
foreach (DS4Controls dc in RXN)
if (Math.Abs(127 - getXYAxisMapping(device, dc, cState, eState, tp)) > 5)
MappedState.RX = getXYAxisMapping(device, dc, cState, eState, tp);
foreach (DS4Controls dc in RXP)
if (Math.Abs(127 - getXYAxisMapping(device, dc, cState, eState, tp, true)) > 5)
MappedState.RX = getXYAxisMapping(device, dc, cState, eState, tp, true);
}
else
MappedState.RX = cState.RX;
if ((shift && MappedState.RY == 127) || !shift)
if (RYN.Count > 0 || RYP.Count > 0)
{
foreach (DS4Controls dc in RYN)
if (Math.Abs(127 - getXYAxisMapping(device, dc, cState, eState, tp)) > 5)
MappedState.RY = getXYAxisMapping(device, dc, cState, eState, tp);
foreach (DS4Controls dc in RYP)
if (Math.Abs(127 - getXYAxisMapping(device, dc, cState, eState, tp, true)) > 5)
MappedState.RY = getXYAxisMapping(device, dc, cState, eState, tp, true);
}
else
MappedState.RY = cState.RY;
InputMethods.MoveCursorBy(MouseDeltaX, MouseDeltaY);
}

Expand Down Expand Up @@ -1161,8 +1180,12 @@ public static void MapShiftCustom(int device, DS4State cState, DS4State MappedSt
if (RXN.Count > 0 || RXP.Count > 0)
{
foreach (DS4Controls dc in RXN)
{
if (Math.Abs(127 - getXYAxisMapping(device, dc, cState, eState, tp)) > 5)
{
MappedState.RX = getXYAxisMapping(device, dc, cState, eState, tp);
}
}
foreach (DS4Controls dc in RXP)
if (Math.Abs(127 - getXYAxisMapping(device, dc, cState, eState, tp, true)) > 5)
MappedState.RX = getXYAxisMapping(device, dc, cState, eState, tp, true);
Expand Down
10 changes: 5 additions & 5 deletions DS4Control/ScpUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -325,11 +325,11 @@ public static double[] SZDeadzone
{
get { return m_Config.SZDeadzone;}
}
public static byte[] LSDeadzone
public static int[] LSDeadzone
{
get { return m_Config.LSDeadzone;}
}
public static byte[] RSDeadzone
public static int[] RSDeadzone
{
get { return m_Config.RSDeadzone;}
}
Expand Down Expand Up @@ -615,7 +615,7 @@ public class BackingStore
public String[] profilePath = { String.Empty, String.Empty, String.Empty, String.Empty, String.Empty };
public Byte[] rumble = { 100, 100, 100, 100, 100 };
public Byte[] touchSensitivity = { 100, 100, 100, 100, 100 };
public Byte[] LSDeadzone = { 0, 0, 0, 0, 0 }, RSDeadzone = { 0, 0, 0, 0, 0 };
public int[] LSDeadzone = { 0, 0, 0, 0, 0 }, RSDeadzone = { 0, 0, 0, 0, 0 };
public double[] SXDeadzone = { 0.25, 0.25, 0.25, 0.25, 0.25 }, SZDeadzone = { 0.25, 0.25, 0.25, 0.25, 0.25 };
public Byte[] tapSensitivity = { 0, 0, 0, 0, 0 };
public bool[] doubleTap = { false, false, false, false, false };
Expand Down Expand Up @@ -1410,9 +1410,9 @@ public Boolean LoadProfile(int device, System.Windows.Forms.Control[] buttons, S
catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/Rainbow"); Double.TryParse(Item.InnerText, out rainbow[device]); }
catch { rainbow[device] = 0; missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/LSDeadZone"); Byte.TryParse(Item.InnerText, out LSDeadzone[device]); }
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/LSDeadZone"); int.TryParse(Item.InnerText, out LSDeadzone[device]); }
catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/RSDeadZone"); Byte.TryParse(Item.InnerText, out RSDeadzone[device]); }
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/RSDeadZone"); int.TryParse(Item.InnerText, out RSDeadzone[device]); }
catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/SXDeadZone"); Double.TryParse(Item.InnerText, out SXDeadzone[device]); }
catch { missingSetting = true; }
Expand Down
31 changes: 28 additions & 3 deletions DS4Windows.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,9 @@
<EmbeddedResource Include="DS4Windows\DupBox.pt-BR.resx">
<DependentUpon>DupBox.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="DS4Windows\DupBox.ro-RO.resx">
<DependentUpon>DupBox.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="DS4Windows\DupBox.ru-RU.resx">
<DependentUpon>DupBox.cs</DependentUpon>
</EmbeddedResource>
Expand All @@ -264,6 +267,9 @@
<EmbeddedResource Include="DS4Windows\Hotkeys.resx">
<DependentUpon>Hotkeys.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="DS4Windows\Hotkeys.ro-RO.resx">
<DependentUpon>Hotkeys.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="DS4Windows\Hotkeys.ru-RU.resx">
<DependentUpon>Hotkeys.cs</DependentUpon>
</EmbeddedResource>
Expand Down Expand Up @@ -295,6 +301,9 @@
<EmbeddedResource Include="DS4Windows\DupBox.resx">
<DependentUpon>DupBox.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="DS4Windows\KBM360.ro-RO.resx">
<DependentUpon>KBM360.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="DS4Windows\KBM360.ru-RU.resx">
<DependentUpon>KBM360.cs</DependentUpon>
</EmbeddedResource>
Expand All @@ -316,9 +325,27 @@
<EmbeddedResource Include="DS4Windows\Options.resx">
<DependentUpon>Options.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="DS4Windows\Options.ro-RO.resx">
<DependentUpon>Options.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="DS4Windows\Options.ru-RU.resx">
<DependentUpon>Options.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="DS4Windows\RecordBox.ro-RO.resx">
<DependentUpon>RecordBox.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="DS4Windows\SaveWhere.ro-RO.resx">
<DependentUpon>SaveWhere.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="DS4Windows\SpecActions.ro-RO.resx">
<DependentUpon>SpecActions.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="DS4Windows\WelcomeDialog.ro-RO.resx">
<DependentUpon>WelcomeDialog.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="DS4Windows\WinProgs.ro-RO.resx">
<DependentUpon>WinProgs.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.de-DE.resx" />
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
Expand Down Expand Up @@ -391,9 +418,6 @@
<EmbeddedResource Include="DS4Windows\SpecActions.pt-BR.resx">
<DependentUpon>SpecActions.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="DS4Windows\SpecActions.pt-PT.resx">
<DependentUpon>SpecActions.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="DS4Windows\SpecActions.resx">
<DependentUpon>SpecActions.cs</DependentUpon>
</EmbeddedResource>
Expand Down Expand Up @@ -442,6 +466,7 @@
<EmbeddedResource Include="DS4Windows\WinProgs.ru-RU.resx">
<DependentUpon>WinProgs.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.ro-RO.resx" />
<None Include="App.config">
<SubType>Designer</SubType>
</None>
Expand Down
Loading

0 comments on commit f70b606

Please sign in to comment.