mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-06-28 06:46:24 +02:00
TESTERS WANTED: RyuLDN implementation (#65)
These changes allow players to matchmake for local wireless using a LDN server. The network implementation originates from Berry's public TCP RyuLDN fork. Logo and unrelated changes have been removed. Additionally displays LDN game status in the game selection window when RyuLDN is enabled. Functionality is only enabled while network mode is set to "RyuLDN" in the settings.
This commit is contained in:
parent
abfcfcaf0f
commit
6d8738c048
93 changed files with 4100 additions and 189 deletions
|
@ -154,6 +154,36 @@ namespace Ryujinx.Ava.UI.Windows
|
|||
});
|
||||
}
|
||||
|
||||
private void ApplicationLibrary_LdnGameDataReceived(object sender, LdnGameDataReceivedEventArgs e)
|
||||
{
|
||||
Dispatcher.UIThread.Post(() =>
|
||||
{
|
||||
var ldnGameDataArray = e.LdnData;
|
||||
ViewModel.LastLdnGameData = ldnGameDataArray;
|
||||
foreach (var application in ViewModel.Applications)
|
||||
{
|
||||
UpdateApplicationWithLdnData(application);
|
||||
}
|
||||
ViewModel.RefreshView();
|
||||
});
|
||||
}
|
||||
|
||||
private void UpdateApplicationWithLdnData(ApplicationData application)
|
||||
{
|
||||
if (application.ControlHolder.ByteSpan.Length > 0 && ViewModel.LastLdnGameData != null)
|
||||
{
|
||||
IEnumerable<LdnGameData> ldnGameData = ViewModel.LastLdnGameData.Where(game => application.ControlHolder.Value.LocalCommunicationId.Items.Contains(Convert.ToUInt64(game.TitleId, 16)));
|
||||
|
||||
application.PlayerCount = ldnGameData.Sum(game => game.PlayerCount);
|
||||
application.GameCount = ldnGameData.Count();
|
||||
}
|
||||
else
|
||||
{
|
||||
application.PlayerCount = 0;
|
||||
application.GameCount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void Application_Opened(object sender, ApplicationOpenedEventArgs args)
|
||||
{
|
||||
if (args.Application != null)
|
||||
|
@ -450,7 +480,20 @@ namespace Ryujinx.Ava.UI.Windows
|
|||
.Connect()
|
||||
.ObserveOn(SynchronizationContext.Current!)
|
||||
.Bind(ViewModel.Applications)
|
||||
.OnItemAdded(UpdateApplicationWithLdnData)
|
||||
.Subscribe();
|
||||
ApplicationLibrary.LdnGameDataReceived += ApplicationLibrary_LdnGameDataReceived;
|
||||
|
||||
ConfigurationState.Instance.Multiplayer.Mode.Event += (sender, evt) =>
|
||||
{
|
||||
_ = Task.Run(ViewModel.ApplicationLibrary.RefreshLdn);
|
||||
};
|
||||
|
||||
ConfigurationState.Instance.Multiplayer.LdnServer.Event += (sender, evt) =>
|
||||
{
|
||||
_ = Task.Run(ViewModel.ApplicationLibrary.RefreshLdn);
|
||||
};
|
||||
_ = Task.Run(ViewModel.ApplicationLibrary.RefreshLdn);
|
||||
|
||||
ViewModel.RefreshFirmwareStatus();
|
||||
|
||||
|
@ -459,7 +502,7 @@ namespace Ryujinx.Ava.UI.Windows
|
|||
{
|
||||
LoadApplications();
|
||||
}
|
||||
|
||||
|
||||
_ = CheckLaunchState();
|
||||
}
|
||||
|
||||
|
@ -588,13 +631,26 @@ namespace Ryujinx.Ava.UI.Windows
|
|||
{
|
||||
switch (fileType)
|
||||
{
|
||||
case "NSP": ConfigurationState.Instance.UI.ShownFileTypes.NSP.Toggle(); break;
|
||||
case "PFS0": ConfigurationState.Instance.UI.ShownFileTypes.PFS0.Toggle(); break;
|
||||
case "XCI": ConfigurationState.Instance.UI.ShownFileTypes.XCI.Toggle(); break;
|
||||
case "NCA": ConfigurationState.Instance.UI.ShownFileTypes.NCA.Toggle(); break;
|
||||
case "NRO": ConfigurationState.Instance.UI.ShownFileTypes.NRO.Toggle(); break;
|
||||
case "NSO": ConfigurationState.Instance.UI.ShownFileTypes.NSO.Toggle(); break;
|
||||
default: throw new ArgumentOutOfRangeException(fileType);
|
||||
case "NSP":
|
||||
ConfigurationState.Instance.UI.ShownFileTypes.NSP.Toggle();
|
||||
break;
|
||||
case "PFS0":
|
||||
ConfigurationState.Instance.UI.ShownFileTypes.PFS0.Toggle();
|
||||
break;
|
||||
case "XCI":
|
||||
ConfigurationState.Instance.UI.ShownFileTypes.XCI.Toggle();
|
||||
break;
|
||||
case "NCA":
|
||||
ConfigurationState.Instance.UI.ShownFileTypes.NCA.Toggle();
|
||||
break;
|
||||
case "NRO":
|
||||
ConfigurationState.Instance.UI.ShownFileTypes.NRO.Toggle();
|
||||
break;
|
||||
case "NSO":
|
||||
ConfigurationState.Instance.UI.ShownFileTypes.NSO.Toggle();
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException(fileType);
|
||||
}
|
||||
|
||||
ConfigurationState.Instance.ToFileFormat().SaveConfig(Program.ConfigurationPath);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue