Address gdk's comments
This commit is contained in:
parent
898effb7be
commit
662716bc9c
5 changed files with 52 additions and 47 deletions
|
@ -32,7 +32,7 @@ namespace Ryujinx.HLE.FileSystem
|
||||||
currentTitleId = context.Process.TitleId;
|
currentTitleId = context.Process.TitleId;
|
||||||
}
|
}
|
||||||
|
|
||||||
string saveAccount = saveMetaData.UserId.IsZero() ? "savecommon" : saveMetaData.UserId.ToString();
|
string saveAccount = saveMetaData.UserId.IsNull ? "savecommon" : saveMetaData.UserId.ToString();
|
||||||
|
|
||||||
string savePath = Path.Combine(baseSavePath,
|
string savePath = Path.Combine(baseSavePath,
|
||||||
saveMetaData.SaveId.ToString("x16"),
|
saveMetaData.SaveId.ToString("x16"),
|
||||||
|
|
|
@ -3,20 +3,17 @@
|
||||||
namespace Ryujinx.HLE.HOS.Services.Friend
|
namespace Ryujinx.HLE.HOS.Services.Friend
|
||||||
{
|
{
|
||||||
[Flags]
|
[Flags]
|
||||||
enum FriendServicePermissionLevelMask
|
|
||||||
{
|
|
||||||
User = 1,
|
|
||||||
Overlay = 2,
|
|
||||||
Manager = 4,
|
|
||||||
System = 8
|
|
||||||
}
|
|
||||||
|
|
||||||
enum FriendServicePermissionLevel
|
enum FriendServicePermissionLevel
|
||||||
{
|
{
|
||||||
|
UserMask = 1,
|
||||||
|
OverlayMask = 2,
|
||||||
|
ManagerMask = 4,
|
||||||
|
SystemMask = 8,
|
||||||
|
|
||||||
Admin = -1,
|
Admin = -1,
|
||||||
User = FriendServicePermissionLevelMask.User,
|
User = UserMask,
|
||||||
Overlay = FriendServicePermissionLevelMask.User | FriendServicePermissionLevelMask.Overlay,
|
Overlay = UserMask | OverlayMask,
|
||||||
Manager = FriendServicePermissionLevelMask.User | FriendServicePermissionLevelMask.Overlay | FriendServicePermissionLevelMask.Manager,
|
Manager = UserMask | OverlayMask | ManagerMask,
|
||||||
System = FriendServicePermissionLevelMask.User | FriendServicePermissionLevelMask.System
|
System = UserMask | SystemMask
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,8 +22,9 @@ namespace Ryujinx.HLE.HOS.Services.Friend
|
||||||
|
|
||||||
|
|
||||||
private LinkedList<NotificationInfo> _notifications;
|
private LinkedList<NotificationInfo> _notifications;
|
||||||
private bool _hasNewFriendRequest;
|
|
||||||
private bool _hasFriendListUpdate;
|
private bool _hasNewFriendRequest;
|
||||||
|
private bool _hasFriendListUpdate;
|
||||||
|
|
||||||
private Dictionary<int, ServiceProcessRequest> _commands;
|
private Dictionary<int, ServiceProcessRequest> _commands;
|
||||||
|
|
||||||
|
@ -111,7 +112,7 @@ namespace Ryujinx.HLE.HOS.Services.Friend
|
||||||
{
|
{
|
||||||
lock (_lock)
|
lock (_lock)
|
||||||
{
|
{
|
||||||
if (_userId.Equals(targetId))
|
if (_userId == targetId)
|
||||||
{
|
{
|
||||||
if (!_hasFriendListUpdate)
|
if (!_hasFriendListUpdate)
|
||||||
{
|
{
|
||||||
|
@ -153,7 +154,7 @@ namespace Ryujinx.HLE.HOS.Services.Friend
|
||||||
{
|
{
|
||||||
lock (_lock)
|
lock (_lock)
|
||||||
{
|
{
|
||||||
if (((int)_permissionLevel & (int)FriendServicePermissionLevelMask.Overlay) != 0 && _userId.Equals(targetId))
|
if ((_permissionLevel & FriendServicePermissionLevel.OverlayMask) != 0 && _userId == targetId)
|
||||||
{
|
{
|
||||||
if (!_hasNewFriendRequest)
|
if (!_hasNewFriendRequest)
|
||||||
{
|
{
|
||||||
|
@ -178,15 +179,7 @@ namespace Ryujinx.HLE.HOS.Services.Friend
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
Dispose(true);
|
NotificationEventHandler.Instance.UnregisterNotificationService(this);
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing)
|
|
||||||
{
|
|
||||||
NotificationEventHandler.Instance.UnregisterNotificationService(this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -9,6 +9,22 @@ namespace Ryujinx.HLE.HOS.Services.Friend
|
||||||
|
|
||||||
private INotificationService[] _registry;
|
private INotificationService[] _registry;
|
||||||
|
|
||||||
|
public static NotificationEventHandler Instance
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
lock (instanceLock)
|
||||||
|
{
|
||||||
|
if (instance == null)
|
||||||
|
{
|
||||||
|
instance = new NotificationEventHandler();
|
||||||
|
}
|
||||||
|
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
NotificationEventHandler()
|
NotificationEventHandler()
|
||||||
{
|
{
|
||||||
_registry = new INotificationService[0x20];
|
_registry = new INotificationService[0x20];
|
||||||
|
@ -63,21 +79,5 @@ namespace Ryujinx.HLE.HOS.Services.Friend
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static NotificationEventHandler Instance
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
lock (instanceLock)
|
|
||||||
{
|
|
||||||
if (instance == null)
|
|
||||||
{
|
|
||||||
instance = new NotificationEventHandler();
|
|
||||||
}
|
|
||||||
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,10 +6,10 @@ using System.Runtime.InteropServices;
|
||||||
namespace Ryujinx.HLE.Utilities
|
namespace Ryujinx.HLE.Utilities
|
||||||
{
|
{
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
public struct UInt128
|
public struct UInt128 : IEquatable<UInt128>
|
||||||
{
|
{
|
||||||
public long Low { get; private set; }
|
public readonly long Low;
|
||||||
public long High { get; private set; }
|
public readonly long High;
|
||||||
|
|
||||||
public bool IsNull => (Low | High) == 0;
|
public bool IsNull => (Low | High) == 0;
|
||||||
|
|
||||||
|
@ -47,14 +47,29 @@ namespace Ryujinx.HLE.Utilities
|
||||||
return High.ToString("x16") + Low.ToString("x16");
|
return High.ToString("x16") + Low.ToString("x16");
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsZero()
|
public static bool operator ==(UInt128 x, UInt128 y)
|
||||||
{
|
{
|
||||||
return (Low | High) == 0;
|
return x.Equals(y);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool operator !=(UInt128 x, UInt128 y)
|
||||||
|
{
|
||||||
|
return !x.Equals(y);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool Equals(object obj)
|
||||||
|
{
|
||||||
|
return obj is UInt128 uint128 && Equals(uint128);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Equals(UInt128 cmpObj)
|
public bool Equals(UInt128 cmpObj)
|
||||||
{
|
{
|
||||||
return Low == cmpObj.Low && High == cmpObj.High;
|
return Low == cmpObj.Low && High == cmpObj.High;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override int GetHashCode()
|
||||||
|
{
|
||||||
|
return HashCode.Combine(Low, High);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue