mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2025-01-23 21:51:09 +01:00
Change udp port opening routine for some scenarios
Experimental
This commit is contained in:
parent
0f3d6e379a
commit
ea3787eef2
@ -177,7 +177,7 @@ namespace DS4Windows
|
|||||||
Monitor.Pulse(busThrLck);
|
Monitor.Pulse(busThrLck);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ChangeUDPStatus(bool state)
|
public void ChangeUDPStatus(bool state, bool openPort=true)
|
||||||
{
|
{
|
||||||
if (state && _udpServer == null)
|
if (state && _udpServer == null)
|
||||||
{
|
{
|
||||||
@ -185,19 +185,25 @@ namespace DS4Windows
|
|||||||
TestQueueBus(() =>
|
TestQueueBus(() =>
|
||||||
{
|
{
|
||||||
_udpServer = new UdpServer(GetPadDetailForIdx);
|
_udpServer = new UdpServer(GetPadDetailForIdx);
|
||||||
var UDP_SERVER_PORT = Global.getUDPServerPortNum();
|
if (openPort)
|
||||||
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
_udpServer.Start(UDP_SERVER_PORT);
|
Task.Run(() =>
|
||||||
LogDebug("UDP server listening on port " + UDP_SERVER_PORT);
|
{
|
||||||
}
|
var UDP_SERVER_PORT = Global.getUDPServerPortNum();
|
||||||
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);
|
try
|
||||||
AppLogger.LogToTray(errMsg, true, true);
|
{
|
||||||
|
_udpServer.Start(UDP_SERVER_PORT);
|
||||||
|
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);
|
||||||
|
AppLogger.LogToTray(errMsg, true, true);
|
||||||
|
}
|
||||||
|
}).Wait();
|
||||||
}
|
}
|
||||||
|
|
||||||
udpChangeStatus = false;
|
udpChangeStatus = false;
|
||||||
@ -312,7 +318,7 @@ namespace DS4Windows
|
|||||||
|
|
||||||
if (isUsingUDPServer() && _udpServer == null)
|
if (isUsingUDPServer() && _udpServer == null)
|
||||||
{
|
{
|
||||||
ChangeUDPStatus(true);
|
ChangeUDPStatus(true, false);
|
||||||
while (udpChangeStatus == true)
|
while (udpChangeStatus == true)
|
||||||
{
|
{
|
||||||
Thread.SpinWait(500);
|
Thread.SpinWait(500);
|
||||||
@ -426,6 +432,25 @@ namespace DS4Windows
|
|||||||
}
|
}
|
||||||
|
|
||||||
running = true;
|
running = true;
|
||||||
|
|
||||||
|
if (_udpServer != null)
|
||||||
|
{
|
||||||
|
//var UDP_SERVER_PORT = 26760;
|
||||||
|
var UDP_SERVER_PORT = Global.getUDPServerPortNum();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_udpServer.Start(UDP_SERVER_PORT);
|
||||||
|
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);
|
||||||
|
AppLogger.LogToTray(errMsg, true, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user