mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-11-29 12:34:18 +01:00
Fix connecting issue, small ui/gui improvements, like the start with windows doesn't hide when small, there's a tooltip on the rainbow icon, and the lightbar shows the default light blue when stopping/closing ds4windows. The lightbar also doesn't go weird when charging and idle timeout is on.
This commit is contained in:
parent
25612fa9a1
commit
12d1fe9231
@ -205,13 +205,45 @@ namespace DS4Control
|
|||||||
Global.ControllerStatusChanged(this);
|
Global.ControllerStatusChanged(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void TimeoutConnection(DS4Device d)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
|
||||||
|
sw.Start();
|
||||||
|
while (!d.IsAlive())
|
||||||
|
{
|
||||||
|
if (sw.ElapsedMilliseconds < 1000)
|
||||||
|
System.Threading.Thread.SpinWait(500);
|
||||||
|
//If weve been waiting less than 1 second let the thread keep its processing chunk
|
||||||
|
else
|
||||||
|
System.Threading.Thread.Sleep(500);
|
||||||
|
//If weve been waiting more than 1 second give up some resources
|
||||||
|
|
||||||
|
if (sw.ElapsedMilliseconds > 5000) throw new TimeoutException(); //Weve waited long enough
|
||||||
|
}
|
||||||
|
sw.Reset();
|
||||||
|
}
|
||||||
|
catch (TimeoutException e)
|
||||||
|
{
|
||||||
|
d.DisconnectBT();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public string getDS4ControllerInfo(int index)
|
public string getDS4ControllerInfo(int index)
|
||||||
{
|
{
|
||||||
if (DS4Controllers[index] != null)
|
if (DS4Controllers[index] != null)
|
||||||
{
|
{
|
||||||
DS4Device d = DS4Controllers[index];
|
DS4Device d = DS4Controllers[index];
|
||||||
if (!d.IsAlive())
|
if (!d.IsAlive())
|
||||||
return "Connecting..."; // awaiting the first battery charge indication
|
//return "Connecting..."; // awaiting the first battery charge indication
|
||||||
|
{
|
||||||
|
var TimeoutThread = new System.Threading.Thread(() => TimeoutConnection(d));
|
||||||
|
TimeoutThread.IsBackground = true;
|
||||||
|
TimeoutThread.Name = "TimeoutFor" + d.MacAddress.ToString();
|
||||||
|
TimeoutThread.Start();
|
||||||
|
return "Connecting...";
|
||||||
|
}
|
||||||
String battery;
|
String battery;
|
||||||
if (d.Charging)
|
if (d.Charging)
|
||||||
{
|
{
|
||||||
|
@ -72,7 +72,7 @@ namespace DS4Control
|
|||||||
color = Global.loadColor(deviceNum);
|
color = Global.loadColor(deviceNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Global.getIdleDisconnectTimeout(deviceNum) > 0)
|
if (Global.getIdleDisconnectTimeout(deviceNum) > 0 && !device.Charging)
|
||||||
{//Fade lightbar by idle time
|
{//Fade lightbar by idle time
|
||||||
TimeSpan timeratio = new TimeSpan(DateTime.UtcNow.Ticks - device.lastActive.Ticks);
|
TimeSpan timeratio = new TimeSpan(DateTime.UtcNow.Ticks - device.lastActive.Ticks);
|
||||||
double botratio = timeratio.TotalMilliseconds;
|
double botratio = timeratio.TotalMilliseconds;
|
||||||
|
@ -54,7 +54,9 @@ namespace ScpServer
|
|||||||
|
|
||||||
private void linkUninstall_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
private void linkUninstall_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
||||||
{
|
{
|
||||||
System.Diagnostics.Process.Start(Global.appdatapath + "\\Virtual Bus Driver\\ScpDriver.exe");
|
if (System.IO.File.Exists(Global.appdatapath + "\\Virtual Bus Driver\\ScpDriver.exe"))
|
||||||
|
try { System.Diagnostics.Process.Start(Global.appdatapath + "\\Virtual Bus Driver\\ScpDriver.exe"); }
|
||||||
|
catch { System.Diagnostics.Process.Start(Global.appdatapath + "\\Virtual Bus Driver"); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -120,6 +120,7 @@ namespace ScpServer
|
|||||||
tp.SetToolTip(btnLightbar, "Click to change color");
|
tp.SetToolTip(btnLightbar, "Click to change color");
|
||||||
tp.SetToolTip(lBControlTip, "You can also use your controller to change controls");
|
tp.SetToolTip(lBControlTip, "You can also use your controller to change controls");
|
||||||
tp.SetToolTip(touchpadJitterCompensation, "Use Sixaxis to help calulate touchpad movement");
|
tp.SetToolTip(touchpadJitterCompensation, "Use Sixaxis to help calulate touchpad movement");
|
||||||
|
tp.SetToolTip(pBRainbow, "Always on Rainbow Mode");
|
||||||
advColorDialog.OnUpdateColor += advColorDialog_OnUpdateColor;
|
advColorDialog.OnUpdateColor += advColorDialog_OnUpdateColor;
|
||||||
btnLeftStick.Enter += btnSticks_Enter;
|
btnLeftStick.Enter += btnSticks_Enter;
|
||||||
btnRightStick.Enter += btnSticks_Enter;
|
btnRightStick.Enter += btnSticks_Enter;
|
||||||
|
@ -121,14 +121,6 @@
|
|||||||
<data name="DS4" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="DS4" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\DS4.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>..\Resources\DS4.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Start" xml:space="preserve">
|
|
||||||
<value>Start</value>
|
|
||||||
<comment>To be localized.</comment>
|
|
||||||
</data>
|
|
||||||
<data name="Stop" xml:space="preserve">
|
|
||||||
<value>Stop</value>
|
|
||||||
<comment>To be localized.</comment>
|
|
||||||
</data>
|
|
||||||
<data name="_360_fades" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="_360_fades" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\360 fades.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>..\Resources\360 fades.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
</data>
|
||||||
|
18
DS4Tool/Properties/Resources1.Designer.cs
generated
18
DS4Tool/Properties/Resources1.Designer.cs
generated
@ -160,15 +160,6 @@ namespace ScpServer.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized string similar to Start.
|
|
||||||
/// </summary>
|
|
||||||
public static string Start {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("Start", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -179,15 +170,6 @@ namespace ScpServer.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized string similar to Stop.
|
|
||||||
/// </summary>
|
|
||||||
public static string Stop {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("Stop", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
21
DS4Tool/ScpForm.Designer.cs
generated
21
DS4Tool/ScpForm.Designer.cs
generated
@ -39,7 +39,6 @@
|
|||||||
this.llbHelp = new System.Windows.Forms.LinkLabel();
|
this.llbHelp = new System.Windows.Forms.LinkLabel();
|
||||||
this.btnStartStop = new System.Windows.Forms.Button();
|
this.btnStartStop = new System.Windows.Forms.Button();
|
||||||
this.btnClear = new System.Windows.Forms.Button();
|
this.btnClear = new System.Windows.Forms.Button();
|
||||||
this.btnStop = new System.Windows.Forms.Button();
|
|
||||||
this.lnkControllers = new System.Windows.Forms.LinkLabel();
|
this.lnkControllers = new System.Windows.Forms.LinkLabel();
|
||||||
this.hideDS4CheckBox = new System.Windows.Forms.CheckBox();
|
this.hideDS4CheckBox = new System.Windows.Forms.CheckBox();
|
||||||
this.startMinimizedCheckBox = new System.Windows.Forms.CheckBox();
|
this.startMinimizedCheckBox = new System.Windows.Forms.CheckBox();
|
||||||
@ -125,7 +124,6 @@
|
|||||||
this.pnlButton.Controls.Add(this.llbHelp);
|
this.pnlButton.Controls.Add(this.llbHelp);
|
||||||
this.pnlButton.Controls.Add(this.btnStartStop);
|
this.pnlButton.Controls.Add(this.btnStartStop);
|
||||||
this.pnlButton.Controls.Add(this.btnClear);
|
this.pnlButton.Controls.Add(this.btnClear);
|
||||||
this.pnlButton.Controls.Add(this.btnStop);
|
|
||||||
this.pnlButton.Controls.Add(this.lnkControllers);
|
this.pnlButton.Controls.Add(this.lnkControllers);
|
||||||
this.pnlButton.Dock = System.Windows.Forms.DockStyle.Bottom;
|
this.pnlButton.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||||
this.pnlButton.Location = new System.Drawing.Point(0, 477);
|
this.pnlButton.Location = new System.Drawing.Point(0, 477);
|
||||||
@ -177,19 +175,6 @@
|
|||||||
this.btnClear.UseVisualStyleBackColor = true;
|
this.btnClear.UseVisualStyleBackColor = true;
|
||||||
this.btnClear.Click += new System.EventHandler(this.btnClear_Click);
|
this.btnClear.Click += new System.EventHandler(this.btnClear_Click);
|
||||||
//
|
//
|
||||||
// btnStop
|
|
||||||
//
|
|
||||||
this.btnStop.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.btnStop.Enabled = false;
|
|
||||||
this.btnStop.Location = new System.Drawing.Point(710, 6);
|
|
||||||
this.btnStop.Name = "btnStop";
|
|
||||||
this.btnStop.Size = new System.Drawing.Size(75, 23);
|
|
||||||
this.btnStop.TabIndex = 2;
|
|
||||||
this.btnStop.Text = "Stop";
|
|
||||||
this.btnStop.UseVisualStyleBackColor = true;
|
|
||||||
this.btnStop.Visible = false;
|
|
||||||
this.btnStop.Click += new System.EventHandler(this.btnStop_Click);
|
|
||||||
//
|
|
||||||
// lnkControllers
|
// lnkControllers
|
||||||
//
|
//
|
||||||
this.lnkControllers.AutoSize = true;
|
this.lnkControllers.AutoSize = true;
|
||||||
@ -517,11 +502,10 @@
|
|||||||
//
|
//
|
||||||
this.lbLastMessage.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
|
this.lbLastMessage.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.lbLastMessage.ForeColor = System.Drawing.SystemColors.GrayText;
|
this.lbLastMessage.ForeColor = System.Drawing.SystemColors.GrayText;
|
||||||
this.lbLastMessage.Location = new System.Drawing.Point(12, 106);
|
this.lbLastMessage.Location = new System.Drawing.Point(12, 110);
|
||||||
this.lbLastMessage.Name = "lbLastMessage";
|
this.lbLastMessage.Name = "lbLastMessage";
|
||||||
this.lbLastMessage.Size = new System.Drawing.Size(551, 20);
|
this.lbLastMessage.Size = new System.Drawing.Size(434, 17);
|
||||||
this.lbLastMessage.TabIndex = 41;
|
this.lbLastMessage.TabIndex = 41;
|
||||||
this.lbLastMessage.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
|
||||||
this.lbLastMessage.Visible = false;
|
this.lbLastMessage.Visible = false;
|
||||||
//
|
//
|
||||||
// notifyIcon1
|
// notifyIcon1
|
||||||
@ -642,7 +626,6 @@
|
|||||||
private System.Windows.Forms.ColumnHeader chData;
|
private System.Windows.Forms.ColumnHeader chData;
|
||||||
private System.Windows.Forms.Timer tmrUpdate;
|
private System.Windows.Forms.Timer tmrUpdate;
|
||||||
private System.Windows.Forms.Panel pnlButton;
|
private System.Windows.Forms.Panel pnlButton;
|
||||||
private System.Windows.Forms.Button btnStop;
|
|
||||||
private System.Windows.Forms.Button btnStartStop;
|
private System.Windows.Forms.Button btnStartStop;
|
||||||
private System.Windows.Forms.Panel pnlDebug;
|
private System.Windows.Forms.Panel pnlDebug;
|
||||||
private System.Windows.Forms.Button btnClear;
|
private System.Windows.Forms.Button btnClear;
|
||||||
|
@ -14,7 +14,7 @@ namespace ScpServer
|
|||||||
{
|
{
|
||||||
private DS4Control.Control rootHub;
|
private DS4Control.Control rootHub;
|
||||||
delegate void LogDebugDelegate(DateTime Time, String Data);
|
delegate void LogDebugDelegate(DateTime Time, String Data);
|
||||||
double version = 7.412;
|
double version = 7.42;
|
||||||
|
|
||||||
protected Label[] Pads;
|
protected Label[] Pads;
|
||||||
protected ComboBox[] cbs;
|
protected ComboBox[] cbs;
|
||||||
@ -260,11 +260,7 @@ namespace ScpServer
|
|||||||
else lbLastMessage.Visible = true;
|
else lbLastMessage.Visible = true;
|
||||||
if (protexts != null)
|
if (protexts != null)
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
if (this.Width > 665)
|
protexts[i].Visible = (this.Width > 665);
|
||||||
protexts[i].Visible = true;
|
|
||||||
else
|
|
||||||
protexts[i].Visible = false;
|
|
||||||
StartWindowsCheckBox.Visible = (this.Width > 665);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void btnStartStop_Click(object sender, EventArgs e)
|
protected void btnStartStop_Click(object sender, EventArgs e)
|
||||||
@ -273,21 +269,27 @@ namespace ScpServer
|
|||||||
}
|
}
|
||||||
protected void btnStartStop_Clicked()
|
protected void btnStartStop_Clicked()
|
||||||
{
|
{
|
||||||
if (btnStartStop.Text == Properties.Resources.Start
|
if (btnStartStop.Text == "Start")
|
||||||
&& rootHub.Start())
|
|
||||||
btnStartStop.Text = Properties.Resources.Stop;
|
|
||||||
else if (btnStartStop.Text == Properties.Resources.Stop
|
|
||||||
&& rootHub.Stop())
|
|
||||||
btnStartStop.Text = Properties.Resources.Start;
|
|
||||||
}
|
|
||||||
protected void btnStop_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (rootHub.Stop())
|
|
||||||
{
|
{
|
||||||
btnStartStop.Enabled = true;
|
for (int i = 0; i < 4; i++)
|
||||||
btnStop.Enabled = false;
|
Global.LoadProfile(i);
|
||||||
|
rootHub.Start();
|
||||||
|
btnStartStop.Text = "Stop";
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (btnStartStop.Text == "Stop")
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 4; i++)
|
||||||
|
{
|
||||||
|
Global.setRainbow(i, 0);
|
||||||
|
Global.setLedAsBatteryIndicator(i, false);
|
||||||
|
Global.saveColor(i, 128, 255, 255);
|
||||||
|
}
|
||||||
|
rootHub.Stop();
|
||||||
|
btnStartStop.Text = "Start";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void btnClear_Click(object sender, EventArgs e)
|
protected void btnClear_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
lvDebug.Items.Clear();
|
lvDebug.Items.Clear();
|
||||||
@ -571,6 +573,12 @@ namespace ScpServer
|
|||||||
Global.setFormWidth(this.Width);
|
Global.setFormWidth(this.Width);
|
||||||
Global.setFormHeight(this.Height);
|
Global.setFormHeight(this.Height);
|
||||||
Global.Save();
|
Global.Save();
|
||||||
|
for (int i = 0; i < 4; i++)
|
||||||
|
{
|
||||||
|
Global.setRainbow(i, 0);
|
||||||
|
Global.setLedAsBatteryIndicator(i, false);
|
||||||
|
Global.saveColor(i, 128, 255, 255);
|
||||||
|
}
|
||||||
rootHub.Stop();
|
rootHub.Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user