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,14 +269,26 @@ namespace DS4Windows
}
await Task.Delay(100);
_udpServer.Start(getUDPServerPortNum());
foreach (DS4Device dev in devices)
var UDP_SERVER_PORT = Global.getUDPServerPortNum();
try
{
dev.queueEvent(() =>
_udpServer.Start(UDP_SERVER_PORT);
foreach (DS4Device dev in devices)
{
dev.Report += dev.MotionEvent;
});
dev.queueEvent(() =>
{
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;

View File

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

View File

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

File diff suppressed because it is too large Load Diff