Merge branch 'jay' into vigem-udpserver

This commit is contained in:
Travis Nickles 2018-08-08 03:55:32 -05:00
commit 1bc5da2c6d
4 changed files with 1851 additions and 2671 deletions

View File

@ -269,8 +269,11 @@ namespace DS4Windows
} }
await Task.Delay(100); await Task.Delay(100);
_udpServer.Start(getUDPServerPortNum());
var UDP_SERVER_PORT = Global.getUDPServerPortNum();
try
{
_udpServer.Start(UDP_SERVER_PORT);
foreach (DS4Device dev in devices) foreach (DS4Device dev in devices)
{ {
dev.queueEvent(() => dev.queueEvent(() =>
@ -278,6 +281,15 @@ namespace DS4Windows
dev.Report += dev.MotionEvent; dev.Report += dev.MotionEvent;
}); });
} }
LogDebug("UDP server listening on port " + UDP_SERVER_PORT);
}
catch (System.Net.Sockets.SocketException ex)
{
var errMsg = String.Format("Couldn't start UDP server on port {0}, outside applications won't be able to access pad data ({1})", UDP_SERVER_PORT, ex.SocketErrorCode);
LogDebug(errMsg, true);
Log.LogToTray(errMsg, true, true);
}
changingUDPPort = false; changingUDPPort = false;
} }

View File

@ -1234,7 +1234,6 @@
resources.ApplyResources(this.ckUdpServ, "ckUdpServ"); resources.ApplyResources(this.ckUdpServ, "ckUdpServ");
this.ckUdpServ.Name = "ckUdpServ"; this.ckUdpServ.Name = "ckUdpServ";
this.ckUdpServ.UseVisualStyleBackColor = true; this.ckUdpServ.UseVisualStyleBackColor = true;
this.ckUdpServ.CheckedChanged += new System.EventHandler(this.CkUdpServ_CheckedChanged);
// //
// nUDUdpPortNum // nUDUdpPortNum
// //
@ -1255,7 +1254,6 @@
0, 0,
0, 0,
0}); 0});
this.nUDUdpPortNum.Leave += new System.EventHandler(this.NUDUdpPortNum_Leave);
// //
// languagePackComboBox1 // languagePackComboBox1
// //

View File

@ -400,9 +400,12 @@ namespace DS4Windows
StartWindowsCheckBox.CheckedChanged += new EventHandler(StartWindowsCheckBox_CheckedChanged); StartWindowsCheckBox.CheckedChanged += new EventHandler(StartWindowsCheckBox_CheckedChanged);
new ToolTip().SetToolTip(StartWindowsCheckBox, Properties.Resources.RunAtStartup); new ToolTip().SetToolTip(StartWindowsCheckBox, Properties.Resources.RunAtStartup);
ckUdpServ.Checked = isUsingUDPServer(); ckUdpServ.Checked = nUDUdpPortNum.Enabled = isUsingUDPServer();
nUDUdpPortNum.Value = getUDPServerPortNum(); nUDUdpPortNum.Value = getUDPServerPortNum();
ckUdpServ.CheckedChanged += CkUdpServ_CheckedChanged;
nUDUdpPortNum.Leave += NUDUdpPortNum_Leave;
populateHoverTextDict(); populateHoverTextDict();
cBController1.KeyPress += CBController_KeyPress; cBController1.KeyPress += CBController_KeyPress;
@ -2568,10 +2571,14 @@ Properties.Resources.DS4Update, MessageBoxButtons.YesNo, MessageBoxIcon.Question
private void NUDUdpPortNum_Leave(object sender, EventArgs e) private void NUDUdpPortNum_Leave(object sender, EventArgs e)
{ {
int curValue = (int)nUDUdpPortNum.Value;
if (curValue != getUDPServerPortNum())
{
setUDPServerPort(curValue);
nUDUdpPortNum.Enabled = false; nUDUdpPortNum.Enabled = false;
setUDPServerPort((int)nUDUdpPortNum.Value);
WaitUDPPortChange(); WaitUDPPortChange();
} }
}
private async void WaitUDPPortChange() private async void WaitUDPPortChange()
{ {

File diff suppressed because it is too large Load Diff