Refactor the friend namespace (#721)
* Refactor the friend namespace and UInt128 This commit also: - Fix GetFriendsList arguments ordering. - Add GetFriendListIds. - Expose the permission level of the port instance. - InvalidUUID => InvalidArgument * friend: add all cmds as commments * add Friend structure layout * Rename FriendErr to FriendError * Accurately implement INotificationService * Fix singleton lock of NotificationEventHandler * Address comments * Add comments for IDaemonSuspendSessionService cmds * Explicitly define the Charset when needed Also make "Nickname" a string * Address gdk's comments
This commit is contained in:
parent
b2b736abc2
commit
789cdba8b5
13 changed files with 576 additions and 82 deletions
|
@ -1,13 +1,15 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Ryujinx.HLE.Utilities
|
||||
{
|
||||
public struct UInt128
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct UInt128 : IEquatable<UInt128>
|
||||
{
|
||||
public long High { get; private set; }
|
||||
public long Low { get; private set; }
|
||||
public readonly long Low;
|
||||
public readonly long High;
|
||||
|
||||
public bool IsNull => (Low | High) == 0;
|
||||
|
||||
|
@ -45,9 +47,29 @@ namespace Ryujinx.HLE.Utilities
|
|||
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)
|
||||
{
|
||||
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