Skip to content
This repository has been archived by the owner on Jan 1, 2024. It is now read-only.

Commit

Permalink
Version 1.4.65
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryochan7 committed Apr 28, 2017
1 parent 44501c2 commit ca2074d
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 24 deletions.
8 changes: 6 additions & 2 deletions DS4Windows/DS4Control/ControlSerivce.cs
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,8 @@ public void TouchPadOn(int ind, DS4Device device)
//ControllerStatusChanged(this);
}

/* TODO: Check if this method is really necessary. If not, delete it. For now, it is not being used because
* input reports are read async with a timeout now. */
public void TimeoutConnection(DS4Device d)
{
try
Expand Down Expand Up @@ -371,10 +373,11 @@ public string getDS4ControllerInfo(int index)
if (!d.IsAlive())
//return "Connecting..."; // awaiting the first battery charge indication
{
var TimeoutThread = new System.Threading.Thread(() => TimeoutConnection(d));
/*var TimeoutThread = new System.Threading.Thread(() => TimeoutConnection(d));
TimeoutThread.IsBackground = true;
TimeoutThread.Name = "TimeoutFor" + d.getMacAddress().ToString();
TimeoutThread.Start();
*/
return Properties.Resources.Connecting;
}

Expand Down Expand Up @@ -406,10 +409,11 @@ public string getDS4MacAddress(int index)
if (!d.IsAlive())
//return "Connecting..."; // awaiting the first battery charge indication
{
var TimeoutThread = new System.Threading.Thread(() => TimeoutConnection(d));
/*var TimeoutThread = new System.Threading.Thread(() => TimeoutConnection(d));
TimeoutThread.IsBackground = true;
TimeoutThread.Name = "TimeoutFor" + d.getMacAddress().ToString();
TimeoutThread.Start();
*/
return Properties.Resources.Connecting;
}
return d.getMacAddress();
Expand Down
22 changes: 20 additions & 2 deletions DS4Windows/DS4Forms/DS4Form.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1200,12 +1200,14 @@ private void tSBExportProfile_Click(object sender, EventArgs e)
Stream stream;
Stream profile = new StreamReader(appdatapath + "\\Profiles\\" + lBProfiles.SelectedItem.ToString() + ".xml").BaseStream;
if (saveProfiles.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
if ((stream = saveProfiles.OpenFile()) != null)
{
profile.CopyTo(stream);
profile.Close();
stream.Close();
}
}
}
}

Expand Down Expand Up @@ -1278,9 +1280,13 @@ private void editMenu_Click(object sender, EventArgs e)
if (em.Text == Properties.Resources.ContextNew.Replace("*number*", (i + 1).ToString()))
ShowOptions(i, "");
else
{
for (int t = 0; t < em.DropDownItems.Count - 2; t++)
{
if (((ToolStripMenuItem)em.DropDownItems[t]).Checked)
ShowOptions(i, ((ToolStripMenuItem)em.DropDownItems[t]).Text);
}
}
}

private void lnkControllers_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
Expand All @@ -1293,13 +1299,19 @@ private void hideDS4CheckBox_CheckedChanged(object sender, EventArgs e)
// Prevent the Game Controllers window from throwing an error when controllers are un/hidden
System.Diagnostics.Process[] rundll64 = System.Diagnostics.Process.GetProcessesByName("rundll64");
foreach (System.Diagnostics.Process rundll64Instance in rundll64)
{
foreach (System.Diagnostics.ProcessModule module in rundll64Instance.Modules)
{
if (module.FileName.Contains("joy.cpl"))
module.Dispose();
}
}

UseExclusiveMode = hideDS4CheckBox.Checked;
bool exclusiveMode = hideDS4CheckBox.Checked;
UseExclusiveMode = exclusiveMode;
if (Environment.OSVersion.Version.Major >= 10 && Environment.OSVersion.Version.Build < 10586)
btnConnectDS4Win10.Visible = hideDS4CheckBox.Checked;
btnConnectDS4Win10.Visible = exclusiveMode;

btnStartStop_Clicked(false);
btnStartStop_Clicked(false);
Save();
Expand Down Expand Up @@ -1345,6 +1357,7 @@ private void Profile_Changed(object sender, EventArgs e) //cbs[i] changed
else
ebns[tdevice].Text = Properties.Resources.EditProfile;
}

ControllerStatusChanged(); //to update profile name in notify icon
}

Expand All @@ -1353,10 +1366,12 @@ private void Profile_Changed_Menu(object sender, ToolStripItemClickedEventArgs e
ToolStripMenuItem tS = (ToolStripMenuItem)sender;
int tdevice = Int32.Parse(tS.Tag.ToString());
if (!(e.ClickedItem is ToolStripSeparator))
{
if (e.ClickedItem != tS.DropDownItems[tS.DropDownItems.Count - 1]) //if +New Profile not selected
cbs[tdevice].SelectedIndex = tS.DropDownItems.IndexOf(e.ClickedItem);
else //if +New Profile selected
ShowOptions(tdevice, "");
}
}

private void exitToolStripMenuItem_Click(object sender, EventArgs e)
Expand All @@ -1377,6 +1392,7 @@ private void startToolStripMenuItem_Click(object sender, EventArgs e)
{
btnStartStop_Clicked();
}

private void notifyIcon1_MouseClick(object sender, MouseEventArgs e)
{
if (e.Button == System.Windows.Forms.MouseButtons.Middle)
Expand All @@ -1385,6 +1401,7 @@ private void notifyIcon1_MouseClick(object sender, MouseEventArgs e)
this.Close();
}
}

private void notifyIcon1_BalloonTipClicked(object sender, EventArgs e)
{
this.Show();
Expand Down Expand Up @@ -1510,6 +1527,7 @@ private void Items_MouseHover(object sender, EventArgs e)
case "cBCloseMini": lbLastMessage.Text = Properties.Resources.CloseMinimize; break;
default: lbLastMessage.Text = Properties.Resources.HoverOverItems; break;
}

if (lbLastMessage.Text != Properties.Resources.HoverOverItems)
lbLastMessage.ForeColor = Color.Black;
else
Expand Down
40 changes: 22 additions & 18 deletions DS4Windows/DS4Library/DS4Device.cs
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,8 @@ public byte RightLightFastRumble
get { return rightLightFastRumble; }
set
{
if (value == rightLightFastRumble) return;
rightLightFastRumble = value;
if (rightLightFastRumble != value)
rightLightFastRumble = value;
}
}

Expand All @@ -276,8 +276,8 @@ public byte LeftHeavySlowRumble
get { return leftHeavySlowRumble; }
set
{
if (value == leftHeavySlowRumble) return;
leftHeavySlowRumble = value;
if (leftHeavySlowRumble != value)
leftHeavySlowRumble = value;
}
}

Expand Down Expand Up @@ -608,10 +608,10 @@ private void performDs4Input()
cState.L2 = inputReport[8];
cState.R2 = inputReport[9];

cState.Triangle = ((byte)inputReport[5] & (1 << 7)) != 0;
cState.Circle = ((byte)inputReport[5] & (1 << 6)) != 0;
cState.Cross = ((byte)inputReport[5] & (1 << 5)) != 0;
cState.Square = ((byte)inputReport[5] & (1 << 4)) != 0;
cState.Triangle = (inputReport[5] & (1 << 7)) != 0;
cState.Circle = (inputReport[5] & (1 << 6)) != 0;
cState.Cross = (inputReport[5] & (1 << 5)) != 0;
cState.Square = (inputReport[5] & (1 << 4)) != 0;

// First 4 bits denote dpad state. Clock representation
// with 8 meaning centered and 0 meaning DpadUp.
Expand All @@ -627,18 +627,18 @@ private void performDs4Input()
case 5: cState.DpadUp = false; cState.DpadDown = true; cState.DpadLeft = true; cState.DpadRight = false; break;
case 6: cState.DpadUp = false; cState.DpadDown = false; cState.DpadLeft = true; cState.DpadRight = false; break;
case 7: cState.DpadUp = true; cState.DpadDown = false; cState.DpadLeft = true; cState.DpadRight = false; break;
case 8: cState.DpadUp = false; cState.DpadDown = false; cState.DpadLeft = false; cState.DpadRight = false; break;
default: break;
case 8:
default: cState.DpadUp = false; cState.DpadDown = false; cState.DpadLeft = false; cState.DpadRight = false; break;
}

cState.R3 = ((byte)inputReport[6] & (1 << 7)) != 0;
cState.L3 = ((byte)inputReport[6] & (1 << 6)) != 0;
cState.Options = ((byte)inputReport[6] & (1 << 5)) != 0;
cState.Share = ((byte)inputReport[6] & (1 << 4)) != 0;
cState.R1 = ((byte)inputReport[6] & (1 << 1)) != 0;
cState.L1 = ((byte)inputReport[6] & (1 << 0)) != 0;
cState.R3 = (inputReport[6] & (1 << 7)) != 0;
cState.L3 = (inputReport[6] & (1 << 6)) != 0;
cState.Options = (inputReport[6] & (1 << 5)) != 0;
cState.Share = (inputReport[6] & (1 << 4)) != 0;
cState.R1 = (inputReport[6] & (1 << 1)) != 0;
cState.L1 = (inputReport[6] & (1 << 0)) != 0;

cState.PS = ((byte)inputReport[7] & (1 << 0)) != 0;
cState.PS = (inputReport[7] & (1 << 0)) != 0;
cState.TouchButton = (inputReport[7] & (1 << 2 - 1)) != 0;
cState.FrameCounter = (byte)(inputReport[7] >> 2);

Expand Down Expand Up @@ -847,7 +847,7 @@ public bool DisconnectBT()
string[] sbytes = Mac.Split(':');
for (int i = 0; i < 6; i++)
{
//parse hex byte in reverse order
// parse hex byte in reverse order
btAddr[5 - i] = Convert.ToByte(sbytes[i], 16);
}

Expand Down Expand Up @@ -998,18 +998,21 @@ private void setHapticState()
DS4HapticState haptic = hapticState[i];
if (i == hapticStackIndex)
break; // rest haven't been used this time

if (haptic.IsLightBarSet())
{
lightBarColor = haptic.LightBarColor;
lightBarFlashDurationOn = haptic.LightBarFlashDurationOn;
lightBarFlashDurationOff = haptic.LightBarFlashDurationOff;
}

if (haptic.IsRumbleSet())
{
rumbleMotorStrengthLeftHeavySlow = haptic.RumbleMotorStrengthLeftHeavySlow;
rumbleMotorStrengthRightLightFast = haptic.RumbleMotorStrengthRightLightFast;
}
}

LightBarColor = lightBarColor;
LightBarOnDuration = lightBarFlashDurationOn;
LightBarOffDuration = lightBarFlashDurationOff;
Expand All @@ -1026,6 +1029,7 @@ public void pushHapticState(DS4HapticState hs)
Array.Copy(hapticState, newHaptics, hapsLen);
hapticState = newHaptics;
}

hapticState[hapticStackIndex++] = hs;
}

Expand Down
4 changes: 2 additions & 2 deletions DS4Windows/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.4.64")]
[assembly: AssemblyFileVersion("1.4.64")]
[assembly: AssemblyVersion("1.4.65")]
[assembly: AssemblyFileVersion("1.4.65")]

0 comments on commit ca2074d

Please sign in to comment.