Some minor changes

This commit is contained in:
Travis Nickles 2017-04-21 21:22:36 -07:00
parent a11e4c9e6d
commit 52c5fde941
4 changed files with 33 additions and 66 deletions

View File

@ -604,9 +604,6 @@ namespace DS4Windows
cState = MappedState[ind]; cState = MappedState[ind];
} }
//if (HasCustomExtras(ind))
// DoExtras(ind);
// Update the GUI/whatever. // Update the GUI/whatever.
DS4LightBar.updateLightBar(device, ind, cState, ExposedState[ind], touchPad[ind]); DS4LightBar.updateLightBar(device, ind, cState, ExposedState[ind], touchPad[ind]);
@ -653,63 +650,6 @@ namespace DS4Windows
DS4LightBar.forcedFlash[ind] = 0; DS4LightBar.forcedFlash[ind] = 0;
} }
} }
/* private void DoExtras(int ind)
{
DS4State cState = CurrentState[ind];
DS4StateExposed eState = ExposedState[ind];
Mouse tp = touchPad[ind];
DS4Controls helddown = DS4Controls.None;
foreach (KeyValuePair<DS4Controls, string> p in getCustomExtras(ind))
{
if (Mapping.getBoolMapping(ind, p.Key, cState, eState, tp))
{
helddown = p.Key;
break;
}
}
if (helddown != DS4Controls.None)
{
string p = getCustomExtras(ind)[helddown];
string[] extraS = p.Split(',');
int[] extras = new int[extraS.Length];
for (int i = 0; i < extraS.Length; i++)
{
int b;
if (int.TryParse(extraS[i], out b))
extras[i] = b;
}
held[ind] = true;
try
{
if (!(extras[0] == extras[1] && extras[1] == 0))
setRumble((byte)extras[0], (byte)extras[1], ind);
if (extras[2] == 1)
{
DS4Color color = new DS4Color { red = (byte)extras[3], green = (byte)extras[4], blue = (byte)extras[5] };
DS4LightBar.forcedColor[ind] = color;
DS4LightBar.forcedFlash[ind] = (byte)extras[6];
DS4LightBar.forcelight[ind] = true;
}
if (extras[7] == 1)
{
if (oldmouse[ind] == -1)
oldmouse[ind] = ButtonMouseSensitivity[ind];
ButtonMouseSensitivity[ind] = extras[8];
}
}
catch { }
}
else if (held[ind])
{
DS4LightBar.forcelight[ind] = false;
DS4LightBar.forcedFlash[ind] = 0;
ButtonMouseSensitivity[ind] = oldmouse[ind];
oldmouse[ind] = -1;
setRumble(0, 0, ind);
held[ind] = false;
}
}*/
public void EasterTime(int ind) public void EasterTime(int ind)
{ {

View File

@ -38,6 +38,7 @@ namespace DS4Windows
previousClicks = currentClicks; previousClicks = currentClicks;
if (performClear) if (performClear)
currentClicks.leftCount = currentClicks.middleCount = currentClicks.rightCount = currentClicks.fourthCount = currentClicks.fifthCount = currentClicks.wUpCount = currentClicks.wDownCount = currentClicks.toggleCount = 0; currentClicks.leftCount = currentClicks.middleCount = currentClicks.rightCount = currentClicks.fourthCount = currentClicks.fifthCount = currentClicks.wUpCount = currentClicks.wDownCount = currentClicks.toggleCount = 0;
//foreach (KeyPresses kp in keyPresses.Values) //foreach (KeyPresses kp in keyPresses.Values)
Dictionary<ushort, KeyPresses>.ValueCollection keyValues = keyPresses.Values; Dictionary<ushort, KeyPresses>.ValueCollection keyValues = keyPresses.Values;
for (int i = 0, kpCount = keyValues.Count; i < kpCount; i++) for (int i = 0, kpCount = keyValues.Count; i < kpCount; i++)

View File

@ -86,7 +86,6 @@ namespace DS4Windows
void AddtoDS4List() void AddtoDS4List()
{ {
dcs.Add(DS4Controls.Cross);
dcs.Add(DS4Controls.Cross); dcs.Add(DS4Controls.Cross);
dcs.Add(DS4Controls.Circle); dcs.Add(DS4Controls.Circle);
dcs.Add(DS4Controls.Square); dcs.Add(DS4Controls.Square);
@ -121,7 +120,9 @@ namespace DS4Windows
else else
macros.Add(value); macros.Add(value);
} }
bool[] pTP = new bool[4]; bool[] pTP = new bool[4];
void ds4_Tick(object sender, EventArgs e) void ds4_Tick(object sender, EventArgs e)
{ {
if (Program.rootHub.DS4Controllers[0] != null) if (Program.rootHub.DS4Controllers[0] != null)
@ -147,17 +148,25 @@ namespace DS4Windows
pTP[0] = tP.leftDown; pTP[0] = tP.leftDown;
pTP[1] = tP.rightDown; pTP[1] = tP.rightDown;
} }
foreach (DS4Controls dc in dcs)
//foreach (DS4Controls dc in dcs)
for (int controlIndex = 0, dcsLen = dcs.Count; controlIndex < dcsLen; controlIndex++)
{
DS4Controls dc = dcs[controlIndex];
if (Mapping.getBoolMapping(0, dc, cState, null, null)) if (Mapping.getBoolMapping(0, dc, cState, null, null))
{ {
int value = DS4ControltoInt(dc); int value = DS4ControltoInt(dc);
int count = 0; int count = 0;
foreach (int i in macros) int macroLen = macros.Count;
//foreach (int i in macros)
for (int macroIndex = 0; macroIndex < macroLen; macroIndex++)
{ {
int i = macros[macroIndex];
if (i == value) if (i == value)
count++; count++;
} }
if (macros.Count == 0)
if (macroLen == 0)
{ {
AddMacroValue(value); AddMacroValue(value);
lVMacros.Items.Add(DS4ControltoX360(dc), 0); lVMacros.Items.Add(DS4ControltoX360(dc), 0);
@ -179,22 +188,28 @@ namespace DS4Windows
AddMacroValue(value); AddMacroValue(value);
lVMacros.Items.Add(DS4ControltoX360(dc), 0); lVMacros.Items.Add(DS4ControltoX360(dc), 0);
} }
lVMacros.Items[lVMacros.Items.Count - 1].EnsureVisible(); lVMacros.Items[lVMacros.Items.Count - 1].EnsureVisible();
} }
else if (!Mapping.getBoolMapping(0, dc, cState, null, null)) else if (!Mapping.getBoolMapping(0, dc, cState, null, null))
{ {
if (macros.Count != 0) int macroLen = macros.Count;
if (macroLen != 0)
{ {
int value = DS4ControltoInt(dc); int value = DS4ControltoInt(dc);
int count = 0; int count = 0;
foreach (int i in macros) //foreach (int i in macros)
for (int macroIndex = 0; macroIndex < macroLen; macroIndex++)
{ {
int i = macros[macroIndex];
if (i == value) if (i == value)
count++; count++;
} }
/*for (int i = macros.Count - 1; i >= 0; i--) /*for (int i = macros.Count - 1; i >= 0; i--)
if (macros.Count == 261) if (macros.Count == 261)
count++;*/ count++;*/
if (count % 2 == 1) if (count % 2 == 1)
{ {
if (cBRecordDelays.Checked) if (cBRecordDelays.Checked)
@ -204,12 +219,14 @@ namespace DS4Windows
sw.Reset(); sw.Reset();
sw.Start(); sw.Start();
} }
AddMacroValue(value); AddMacroValue(value);
lVMacros.Items.Add(DS4ControltoX360(dc), 1); lVMacros.Items.Add(DS4ControltoX360(dc), 1);
lVMacros.Items[lVMacros.Items.Count - 1].EnsureVisible(); lVMacros.Items[lVMacros.Items.Count - 1].EnsureVisible();
} }
} }
} }
}
} }
} }
} }
@ -279,8 +296,10 @@ namespace DS4Windows
} }
return "None"; return "None";
} }
bool recordAfter = false; bool recordAfter = false;
int recordAfterInt = 0; int recordAfterInt = 0;
private void btnRecord_Click(object sender, EventArgs e) private void btnRecord_Click(object sender, EventArgs e)
{ {
if (btnRecord.Text != Properties.Resources.StopText) if (btnRecord.Text != Properties.Resources.StopText)

View File

@ -29,12 +29,14 @@ namespace DS4Windows
green = c.G; green = c.G;
blue = c.B; blue = c.B;
} }
public DS4Color(byte r, byte g, byte b) public DS4Color(byte r, byte g, byte b)
{ {
red = r; red = r;
green = g; green = g;
blue = b; blue = b;
} }
public override bool Equals(object obj) public override bool Equals(object obj)
{ {
if (obj is DS4Color) if (obj is DS4Color)
@ -45,6 +47,7 @@ namespace DS4Windows
else else
return false; return false;
} }
public Color ToColor => Color.FromArgb(red, green, blue); public Color ToColor => Color.FromArgb(red, green, blue);
public Color ToColorA public Color ToColorA
{ {
@ -84,6 +87,7 @@ namespace DS4Windows
} }
catch { return false; } catch { return false; }
} }
public override string ToString() => $"Red: {red} Green: {green} Blue: {blue}"; public override string ToString() => $"Red: {red} Green: {green} Blue: {blue}";
} }
@ -100,10 +104,12 @@ namespace DS4Windows
public byte LightBarFlashDurationOn, LightBarFlashDurationOff; public byte LightBarFlashDurationOn, LightBarFlashDurationOff;
public byte RumbleMotorStrengthLeftHeavySlow, RumbleMotorStrengthRightLightFast; public byte RumbleMotorStrengthLeftHeavySlow, RumbleMotorStrengthRightLightFast;
public bool RumbleMotorsExplicitlyOff; public bool RumbleMotorsExplicitlyOff;
public bool IsLightBarSet() public bool IsLightBarSet()
{ {
return LightBarExplicitlyOff || LightBarColor.red != 0 || LightBarColor.green != 0 || LightBarColor.blue != 0; return LightBarExplicitlyOff || LightBarColor.red != 0 || LightBarColor.green != 0 || LightBarColor.blue != 0;
} }
public bool IsRumbleSet() public bool IsRumbleSet()
{ {
return RumbleMotorsExplicitlyOff || RumbleMotorStrengthLeftHeavySlow != 0 || RumbleMotorStrengthRightLightFast != 0; return RumbleMotorsExplicitlyOff || RumbleMotorStrengthLeftHeavySlow != 0 || RumbleMotorStrengthRightLightFast != 0;
@ -869,6 +875,7 @@ namespace DS4Windows
} }
private DS4HapticState testRumble = new DS4HapticState(); private DS4HapticState testRumble = new DS4HapticState();
public void setRumble(byte rightLightFastMotor, byte leftHeavySlowMotor) public void setRumble(byte rightLightFastMotor, byte leftHeavySlowMotor)
{ {
testRumble.RumbleMotorStrengthRightLightFast = rightLightFastMotor; testRumble.RumbleMotorStrengthRightLightFast = rightLightFastMotor;