Skip to content

Commit

Permalink
misc: chore: use new array in LdnGameDataReceivedEventArgs instead of…
Browse files Browse the repository at this point in the history
… collecting the ldn datas into a list
  • Loading branch information
GreemDev committed Feb 21, 2025
1 parent 6c6580d commit 2a84656
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
9 changes: 2 additions & 7 deletions src/Ryujinx/UI/Windows/MainWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,17 +189,12 @@ private void ApplicationLibrary_LdnGameDataReceived(LdnGameDataReceivedEventArgs
{
Dispatcher.UIThread.Post(() =>
{
List<LdnGameData> ldnGameDataArray = e.LdnData.ToList();
ViewModel.LdnData.Clear();
foreach (ApplicationData application in ViewModel.Applications.Where(it => it.HasControlHolder))
{
ref ApplicationControlProperty controlHolder = ref application.ControlHolder.Value;

ViewModel.LdnData[application.IdString] =
LdnGameData.GetArrayForApp(
ldnGameDataArray,
ref controlHolder
);

ViewModel.LdnData[application.IdString] = e.LdnData.Where(ref controlHolder);

UpdateApplicationWithLdnData(application);
}
Expand Down
8 changes: 7 additions & 1 deletion src/Ryujinx/Utilities/AppLibrary/LdnGameData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public struct LdnGameData
public IEnumerable<string> Players { get; set; }

public static Array GetArrayForApp(
IEnumerable<LdnGameData> receivedData, ref ApplicationControlProperty acp)
LdnGameData[] receivedData, ref ApplicationControlProperty acp)
{
LibHac.Common.FixedArrays.Array8<ulong> communicationId = acp.LocalCommunicationId;

Expand All @@ -40,4 +40,10 @@ internal Array(IEnumerable<LdnGameData> receivedData)
public int GameCount => _ldnDatas.Length;
}
}

public static class LdnGameDataHelper
{
public static LdnGameData.Array Where(this LdnGameData[] unfilteredDatas, ref ApplicationControlProperty acp)
=> LdnGameData.GetArrayForApp(unfilteredDatas, ref acp);
}
}

0 comments on commit 2a84656

Please sign in to comment.