From 5b80dce79033ce5c572a16b048f89dda7c5570e9 Mon Sep 17 00:00:00 2001 From: Thog Date: Thu, 27 Jun 2019 15:59:51 +0200 Subject: [PATCH] add Friend structure layout --- .../HOS/Services/Friend/IFriendService.cs | 2 +- .../Services/Friend/IFriendServiceTypes.cs | 32 +++++++++++++++++-- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/Ryujinx.HLE/HOS/Services/Friend/IFriendService.cs b/Ryujinx.HLE/HOS/Services/Friend/IFriendService.cs index 2ce728bc23..e4f860308a 100644 --- a/Ryujinx.HLE/HOS/Services/Friend/IFriendService.cs +++ b/Ryujinx.HLE/HOS/Services/Friend/IFriendService.cs @@ -138,7 +138,7 @@ namespace Ryujinx.HLE.HOS.Services.Friend return 0; } - // nn::friends::GetFriendList(int offset, nn::account::Uid userUUID, nn::friends::detail::ipc::SizedFriendFilter friendFilter, ulong pidPlaceHolder, pid) -> int outCount, array + // nn::friends::GetFriendList(int offset, nn::account::Uid userUUID, nn::friends::detail::ipc::SizedFriendFilter friendFilter, ulong pidPlaceHolder, pid) -> int outCount, array public long GetFriendList(ServiceCtx context) { int offset = context.RequestData.ReadInt32(); diff --git a/Ryujinx.HLE/HOS/Services/Friend/IFriendServiceTypes.cs b/Ryujinx.HLE/HOS/Services/Friend/IFriendServiceTypes.cs index 98ca26166d..6f43acd876 100644 --- a/Ryujinx.HLE/HOS/Services/Friend/IFriendServiceTypes.cs +++ b/Ryujinx.HLE/HOS/Services/Friend/IFriendServiceTypes.cs @@ -38,14 +38,18 @@ namespace Ryujinx.HLE.HOS.Services.Friend public long PresenceGroupId; } - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 0x8)] struct UserPresence { public UInt128 UserId; public long LastTimeOnlineTimestamp; public PresenceStatus Status; - uint padding; + [MarshalAs(UnmanagedType.I1)] + public bool SamePresenceGroupApplication; + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x3)] + char[] unknown; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0xC0)] public char[] AppKeyValueStorage; @@ -56,4 +60,28 @@ namespace Ryujinx.HLE.HOS.Services.Friend return $"UserPresence {{ UserId: {UserId}, LastTimeOnlineTimestamp: {LastTimeOnlineTimestamp}, Status: {Status}, AppKeyValueStorage: {AppKeyValueStorage} }}"; } } + + [StructLayout(LayoutKind.Sequential, Pack = 0x8, Size = 0x200)] + struct Friend + { + public UInt128 UserId; + public long NetworkUserId; + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x21)] + public char[] Nickname; + + public UserPresence presence; + + [MarshalAs(UnmanagedType.I1)] + public bool IsFavourite; + + [MarshalAs(UnmanagedType.I1)] + public bool IsNew; + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x6)] + char[] unknown; + + [MarshalAs(UnmanagedType.I1)] + public bool IsValid; + } }