Address comments

This commit is contained in:
Thog 2019-07-03 13:42:45 +02:00
commit 77e6be8480
No known key found for this signature in database
GPG key ID: 0CD291558FAFDBC6
5 changed files with 21 additions and 22 deletions

View file

@ -1,6 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Text;
namespace Ryujinx.HLE.HOS.Services.Friend namespace Ryujinx.HLE.HOS.Services.Friend
{ {
@ -15,10 +13,10 @@ namespace Ryujinx.HLE.HOS.Services.Friend
enum FriendServicePermissionLevel enum FriendServicePermissionLevel
{ {
Admin = -1, Admin = -1,
User = FriendServicePermissionLevelMask.User, User = FriendServicePermissionLevelMask.User,
Overlay = FriendServicePermissionLevelMask.User | FriendServicePermissionLevelMask.Overlay, Overlay = FriendServicePermissionLevelMask.User | FriendServicePermissionLevelMask.Overlay,
Manager = FriendServicePermissionLevelMask.User | FriendServicePermissionLevelMask.Overlay | FriendServicePermissionLevelMask.Manager, Manager = FriendServicePermissionLevelMask.User | FriendServicePermissionLevelMask.Overlay | FriendServicePermissionLevelMask.Manager,
System = FriendServicePermissionLevelMask.User | FriendServicePermissionLevelMask.System System = FriendServicePermissionLevelMask.User | FriendServicePermissionLevelMask.System
} }
} }

View file

@ -6,6 +6,7 @@ using Ryujinx.HLE.Utilities;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using static Ryujinx.HLE.HOS.ErrorCode; using static Ryujinx.HLE.HOS.ErrorCode;
namespace Ryujinx.HLE.HOS.Services.Friend namespace Ryujinx.HLE.HOS.Services.Friend
@ -108,8 +109,7 @@ namespace Ryujinx.HLE.HOS.Services.Friend
// Padding // Padding
context.RequestData.ReadInt32(); context.RequestData.ReadInt32();
UInt128 uuid = context.RequestData.ReadStruct<UInt128>(); UInt128 uuid = context.RequestData.ReadStruct<UInt128>();
FriendFilter filter = context.RequestData.ReadStruct<FriendFilter>(); FriendFilter filter = context.RequestData.ReadStruct<FriendFilter>();
// Pid placeholder // Pid placeholder
@ -146,8 +146,7 @@ namespace Ryujinx.HLE.HOS.Services.Friend
// Padding // Padding
context.RequestData.ReadInt32(); context.RequestData.ReadInt32();
UInt128 uuid = context.RequestData.ReadStruct<UInt128>(); UInt128 uuid = context.RequestData.ReadStruct<UInt128>();
FriendFilter filter = context.RequestData.ReadStruct<FriendFilter>(); FriendFilter filter = context.RequestData.ReadStruct<FriendFilter>();
// Pid placeholder // Pid placeholder
@ -238,6 +237,7 @@ namespace Ryujinx.HLE.HOS.Services.Friend
using (BinaryReader bufferReader = new BinaryReader(new MemoryStream(bufferContent))) using (BinaryReader bufferReader = new BinaryReader(new MemoryStream(bufferContent)))
{ {
UserPresence[] userPresenceInputArray = bufferReader.ReadStructArray<UserPresence>(elementCount); UserPresence[] userPresenceInputArray = bufferReader.ReadStructArray<UserPresence>(elementCount);
Logger.PrintStub(LogClass.ServiceFriend, new { UserId = uuid.ToString(), userPresenceInputArray }); Logger.PrintStub(LogClass.ServiceFriend, new { UserId = uuid.ToString(), userPresenceInputArray });
} }

View file

@ -49,12 +49,11 @@ namespace Ryujinx.HLE.HOS.Services.Friend
public bool SamePresenceGroupApplication; public bool SamePresenceGroupApplication;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x3)] [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x3)]
char[] unknown; char[] Unknown;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 0xC0)] [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0xC0)]
public char[] AppKeyValueStorage; public char[] AppKeyValueStorage;
public override string ToString() public override string ToString()
{ {
return $"UserPresence {{ UserId: {UserId}, LastTimeOnlineTimestamp: {LastTimeOnlineTimestamp}, Status: {Status}, AppKeyValueStorage: {AppKeyValueStorage} }}"; return $"UserPresence {{ UserId: {UserId}, LastTimeOnlineTimestamp: {LastTimeOnlineTimestamp}, Status: {Status}, AppKeyValueStorage: {AppKeyValueStorage} }}";
@ -79,7 +78,7 @@ namespace Ryujinx.HLE.HOS.Services.Friend
public bool IsNew; public bool IsNew;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x6)] [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x6)]
char[] unknown; char[] Unknown;
[MarshalAs(UnmanagedType.I1)] [MarshalAs(UnmanagedType.I1)]
public bool IsValid; public bool IsValid;
@ -95,10 +94,10 @@ namespace Ryujinx.HLE.HOS.Services.Friend
[StructLayout(LayoutKind.Sequential, Pack = 0x8, Size = 0x10)] [StructLayout(LayoutKind.Sequential, Pack = 0x8, Size = 0x10)]
struct NotificationInfo struct NotificationInfo
{ {
public NotificationEventType type; public NotificationEventType Type;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x4)] [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x4)]
char[] padding; char[] Padding;
public long NetworkUserIdPlaceholder; public long NetworkUserIdPlaceholder;
} }

View file

@ -5,6 +5,7 @@ using Ryujinx.HLE.HOS.Kernel.Threading;
using Ryujinx.HLE.Utilities; using Ryujinx.HLE.Utilities;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using static Ryujinx.HLE.HOS.ErrorCode; using static Ryujinx.HLE.HOS.ErrorCode;
namespace Ryujinx.HLE.HOS.Services.Friend namespace Ryujinx.HLE.HOS.Services.Friend
@ -88,16 +89,17 @@ namespace Ryujinx.HLE.HOS.Services.Friend
NotificationInfo notificationInfo = _notifications.First.Value; NotificationInfo notificationInfo = _notifications.First.Value;
_notifications.RemoveFirst(); _notifications.RemoveFirst();
if (notificationInfo.type == NotificationEventType.FriendListUpdate) if (notificationInfo.Type == NotificationEventType.FriendListUpdate)
{ {
_hasFriendListUpdate = false; _hasFriendListUpdate = false;
} }
else if (notificationInfo.type == NotificationEventType.NewFriendRequest) else if (notificationInfo.Type == NotificationEventType.NewFriendRequest)
{ {
_hasNewFriendRequest = false; _hasNewFriendRequest = false;
} }
context.ResponseData.WriteStruct(notificationInfo); context.ResponseData.WriteStruct(notificationInfo);
return 0; return 0;
} }
} }
@ -121,7 +123,7 @@ namespace Ryujinx.HLE.HOS.Services.Friend
_notifications.RemoveFirst(); _notifications.RemoveFirst();
} }
friendListNotification.type = NotificationEventType.FriendListUpdate; friendListNotification.Type = NotificationEventType.FriendListUpdate;
_hasFriendListUpdate = true; _hasFriendListUpdate = true;
if (_hasNewFriendRequest) if (_hasNewFriendRequest)
@ -134,7 +136,7 @@ namespace Ryujinx.HLE.HOS.Services.Friend
_notifications.RemoveFirst(); _notifications.RemoveFirst();
} }
newFriendRequestNotification.type = NotificationEventType.NewFriendRequest; newFriendRequestNotification.Type = NotificationEventType.NewFriendRequest;
_notifications.AddFirst(newFriendRequestNotification); _notifications.AddFirst(newFriendRequestNotification);
} }
@ -162,7 +164,7 @@ namespace Ryujinx.HLE.HOS.Services.Friend
NotificationInfo newFriendRequestNotification = new NotificationInfo NotificationInfo newFriendRequestNotification = new NotificationInfo
{ {
type = NotificationEventType.NewFriendRequest Type = NotificationEventType.NewFriendRequest
}; };
_notifications.AddLast(newFriendRequestNotification); _notifications.AddLast(newFriendRequestNotification);

View file

@ -4,7 +4,7 @@ namespace Ryujinx.HLE.HOS.Services.Friend
{ {
public sealed class NotificationEventHandler public sealed class NotificationEventHandler
{ {
private static NotificationEventHandler instance = null; private static NotificationEventHandler instance;
private static object instanceLock = new object(); private static object instanceLock = new object();
private INotificationService[] _registry; private INotificationService[] _registry;