Address comments
This commit is contained in:
parent
8f82e663a3
commit
77e6be8480
5 changed files with 21 additions and 22 deletions
|
@ -1,6 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Ryujinx.HLE.HOS.Services.Friend
|
||||
{
|
||||
|
@ -15,10 +13,10 @@ namespace Ryujinx.HLE.HOS.Services.Friend
|
|||
|
||||
enum FriendServicePermissionLevel
|
||||
{
|
||||
Admin = -1,
|
||||
User = FriendServicePermissionLevelMask.User,
|
||||
Overlay = FriendServicePermissionLevelMask.User | FriendServicePermissionLevelMask.Overlay,
|
||||
Manager = FriendServicePermissionLevelMask.User | FriendServicePermissionLevelMask.Overlay | FriendServicePermissionLevelMask.Manager,
|
||||
System = FriendServicePermissionLevelMask.User | FriendServicePermissionLevelMask.System
|
||||
Admin = -1,
|
||||
User = FriendServicePermissionLevelMask.User,
|
||||
Overlay = FriendServicePermissionLevelMask.User | FriendServicePermissionLevelMask.Overlay,
|
||||
Manager = FriendServicePermissionLevelMask.User | FriendServicePermissionLevelMask.Overlay | FriendServicePermissionLevelMask.Manager,
|
||||
System = FriendServicePermissionLevelMask.User | FriendServicePermissionLevelMask.System
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ using Ryujinx.HLE.Utilities;
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
using static Ryujinx.HLE.HOS.ErrorCode;
|
||||
|
||||
namespace Ryujinx.HLE.HOS.Services.Friend
|
||||
|
@ -108,8 +109,7 @@ namespace Ryujinx.HLE.HOS.Services.Friend
|
|||
// Padding
|
||||
context.RequestData.ReadInt32();
|
||||
|
||||
UInt128 uuid = context.RequestData.ReadStruct<UInt128>();
|
||||
|
||||
UInt128 uuid = context.RequestData.ReadStruct<UInt128>();
|
||||
FriendFilter filter = context.RequestData.ReadStruct<FriendFilter>();
|
||||
|
||||
// Pid placeholder
|
||||
|
@ -146,8 +146,7 @@ namespace Ryujinx.HLE.HOS.Services.Friend
|
|||
// Padding
|
||||
context.RequestData.ReadInt32();
|
||||
|
||||
UInt128 uuid = context.RequestData.ReadStruct<UInt128>();
|
||||
|
||||
UInt128 uuid = context.RequestData.ReadStruct<UInt128>();
|
||||
FriendFilter filter = context.RequestData.ReadStruct<FriendFilter>();
|
||||
|
||||
// Pid placeholder
|
||||
|
@ -238,6 +237,7 @@ namespace Ryujinx.HLE.HOS.Services.Friend
|
|||
using (BinaryReader bufferReader = new BinaryReader(new MemoryStream(bufferContent)))
|
||||
{
|
||||
UserPresence[] userPresenceInputArray = bufferReader.ReadStructArray<UserPresence>(elementCount);
|
||||
|
||||
Logger.PrintStub(LogClass.ServiceFriend, new { UserId = uuid.ToString(), userPresenceInputArray });
|
||||
}
|
||||
|
||||
|
|
|
@ -49,12 +49,11 @@ namespace Ryujinx.HLE.HOS.Services.Friend
|
|||
public bool SamePresenceGroupApplication;
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x3)]
|
||||
char[] unknown;
|
||||
char[] Unknown;
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 0xC0)]
|
||||
public char[] AppKeyValueStorage;
|
||||
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"UserPresence {{ UserId: {UserId}, LastTimeOnlineTimestamp: {LastTimeOnlineTimestamp}, Status: {Status}, AppKeyValueStorage: {AppKeyValueStorage} }}";
|
||||
|
@ -79,7 +78,7 @@ namespace Ryujinx.HLE.HOS.Services.Friend
|
|||
public bool IsNew;
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x6)]
|
||||
char[] unknown;
|
||||
char[] Unknown;
|
||||
|
||||
[MarshalAs(UnmanagedType.I1)]
|
||||
public bool IsValid;
|
||||
|
@ -95,10 +94,10 @@ namespace Ryujinx.HLE.HOS.Services.Friend
|
|||
[StructLayout(LayoutKind.Sequential, Pack = 0x8, Size = 0x10)]
|
||||
struct NotificationInfo
|
||||
{
|
||||
public NotificationEventType type;
|
||||
public NotificationEventType Type;
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x4)]
|
||||
char[] padding;
|
||||
char[] Padding;
|
||||
|
||||
public long NetworkUserIdPlaceholder;
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ using Ryujinx.HLE.HOS.Kernel.Threading;
|
|||
using Ryujinx.HLE.Utilities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using static Ryujinx.HLE.HOS.ErrorCode;
|
||||
|
||||
namespace Ryujinx.HLE.HOS.Services.Friend
|
||||
|
@ -88,16 +89,17 @@ namespace Ryujinx.HLE.HOS.Services.Friend
|
|||
NotificationInfo notificationInfo = _notifications.First.Value;
|
||||
_notifications.RemoveFirst();
|
||||
|
||||
if (notificationInfo.type == NotificationEventType.FriendListUpdate)
|
||||
if (notificationInfo.Type == NotificationEventType.FriendListUpdate)
|
||||
{
|
||||
_hasFriendListUpdate = false;
|
||||
}
|
||||
else if (notificationInfo.type == NotificationEventType.NewFriendRequest)
|
||||
else if (notificationInfo.Type == NotificationEventType.NewFriendRequest)
|
||||
{
|
||||
_hasNewFriendRequest = false;
|
||||
}
|
||||
|
||||
context.ResponseData.WriteStruct(notificationInfo);
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -121,7 +123,7 @@ namespace Ryujinx.HLE.HOS.Services.Friend
|
|||
_notifications.RemoveFirst();
|
||||
}
|
||||
|
||||
friendListNotification.type = NotificationEventType.FriendListUpdate;
|
||||
friendListNotification.Type = NotificationEventType.FriendListUpdate;
|
||||
_hasFriendListUpdate = true;
|
||||
|
||||
if (_hasNewFriendRequest)
|
||||
|
@ -134,7 +136,7 @@ namespace Ryujinx.HLE.HOS.Services.Friend
|
|||
_notifications.RemoveFirst();
|
||||
}
|
||||
|
||||
newFriendRequestNotification.type = NotificationEventType.NewFriendRequest;
|
||||
newFriendRequestNotification.Type = NotificationEventType.NewFriendRequest;
|
||||
_notifications.AddFirst(newFriendRequestNotification);
|
||||
}
|
||||
|
||||
|
@ -162,7 +164,7 @@ namespace Ryujinx.HLE.HOS.Services.Friend
|
|||
|
||||
NotificationInfo newFriendRequestNotification = new NotificationInfo
|
||||
{
|
||||
type = NotificationEventType.NewFriendRequest
|
||||
Type = NotificationEventType.NewFriendRequest
|
||||
};
|
||||
|
||||
_notifications.AddLast(newFriendRequestNotification);
|
||||
|
|
|
@ -4,7 +4,7 @@ namespace Ryujinx.HLE.HOS.Services.Friend
|
|||
{
|
||||
public sealed class NotificationEventHandler
|
||||
{
|
||||
private static NotificationEventHandler instance = null;
|
||||
private static NotificationEventHandler instance;
|
||||
private static object instanceLock = new object();
|
||||
|
||||
private INotificationService[] _registry;
|
||||
|
|
Loading…
Add table
Reference in a new issue