Compare commits

..

3 Commits

Author SHA1 Message Date
Dennis
ca5de909a1 Updated German translation (#626) 2025-02-13 19:14:02 -06:00
Willians
5172567b08 Update Brazilian Translation PT-BR (#633)
I updated the Brazilian Portuguese translation, I added the texts that
were not translated.
2025-02-13 19:08:48 -06:00
heihei123456780
6fe4cee7c0 Update zh_CN translation (#650) 2025-02-13 18:16:12 -06:00
2 changed files with 242 additions and 265 deletions

View File

@@ -110,10 +110,24 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnRyu.Proxy
_broadcastAddress = config.ProxyIp | (~config.ProxySubnetMask);
}
private async Task<ushort> NatPunchForDevice(NatDevice device)
public async Task<ushort> NatPunch()
{
Logger.Info?.PrintMsg(LogClass.ServiceLdn, $"Attempting to map port using {device.ToString()}");
NatDiscoverer discoverer = new();
CancellationTokenSource cts = new(5000);
NatDevice device;
try
{
device = await discoverer.DiscoverDeviceAsync(PortMapper.Upnp, cts);
}
catch (NatDeviceNotFoundException)
{
return 0;
}
_publicPort = PublicPortBase;
for (int i = 0; i < PublicPortRange; i++)
{
try
@@ -124,14 +138,12 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnRyu.Proxy
break;
}
catch (MappingException ex)
catch (MappingException)
{
Logger.Info?.PrintMsg(LogClass.ServiceLdn, $"Failed to map port {_publicPort}: {ex.Message}");
_publicPort++;
}
catch (Exception ex)
catch (Exception)
{
Logger.Info?.PrintMsg(LogClass.ServiceLdn, $"Failed to map port {_publicPort}: {ex.GetType().Name}: {ex.Message}");
return 0;
}
@@ -143,52 +155,17 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnRyu.Proxy
if (_publicPort != 0)
{
_natDevice = device;
_ = Executor.ExecuteAfterDelayAsync(
PortLeaseRenew.Seconds(),
PortLeaseRenew.Seconds(),
_disposedCancellation.Token,
RefreshLease);
}
_natDevice = device;
return _publicPort;
}
public async Task<ushort> NatPunch()
{
NatDiscoverer discoverer = new();
CancellationTokenSource cts = new(500);
NatDevice[] devices;
try
{
devices = (await discoverer.DiscoverDevicesAsync(PortMapper.Upnp, cts)).ToArray();
}
catch (Exception ex)
{
Logger.Error?.PrintMsg(LogClass.ServiceLdn, $"Failed to discover UPnP devices: {ex.Message}");
return 0;
}
if (devices.Length == 0)
{
Logger.Error?.PrintMsg(LogClass.ServiceLdn, "No UPnP devices found.");
return 0;
}
foreach (var device in devices)
{
ushort port = await NatPunchForDevice(device);
if (port != 0)
{
return port;
}
}
Logger.Info?.PrintMsg(LogClass.ServiceLdn, $"Failed to map port using any device");
_publicPort = 0;
return 0;
}
// Proxy handlers
private void RouteMessage(P2pProxySession sender, ref ProxyInfo info, Action<P2pProxySession> action)

File diff suppressed because it is too large Load Diff